diff --git a/src/main/java/com/legacy/aether/Aether.java b/src/main/java/com/legacy/aether/Aether.java index 270360e..ff48893 100644 --- a/src/main/java/com/legacy/aether/Aether.java +++ b/src/main/java/com/legacy/aether/Aether.java @@ -22,8 +22,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid = Aether.MOD_ID, version = "v1.0.0") -public class Aether -{ +public class Aether { public static final String MOD_ID = "aether_legacy"; @@ -33,44 +32,39 @@ public class Aether @SidedProxy(clientSide = "com.legacy.aether.client.ClientProxy", serverSide = "com.legacy.aether.CommonProxy") public static CommonProxy proxy; - @EventHandler - public void preInit(FMLPreInitializationEvent event) - { - AetherRankings.initialization(); - AetherNetwork.preInitialization(); - AetherConfig.init(event.getModConfigurationDirectory()); - } + @EventHandler + public void preInit(FMLPreInitializationEvent event) { + AetherRankings.initialization(); + AetherNetwork.preInitialization(); + AetherConfig.init(event.getModConfigurationDirectory()); + } - @EventHandler - public void init(FMLInitializationEvent event) - { - BlocksAether.initialization(); - ItemsAether.initialization(); - AetherRegistries.register(); - EntitiesAether.initialization(); - AetherCreativeTabs.initialization(); - AetherTileEntities.initialization(); - AetherWorld.initialization(); - AchievementsAether.initialization(); + @EventHandler + public void init(FMLInitializationEvent event) { + BlocksAether.initialization(); + ItemsAether.initialization(); + AetherRegistries.register(); + EntitiesAether.initialization(); + AetherCreativeTabs.initialization(); + AetherTileEntities.initialization(); + AetherWorld.initialization(); + AchievementsAether.initialization(); - proxy.init(); + proxy.init(); - CommonProxy.registerEvent(new PlayerAetherEvents()); - CommonProxy.registerEvent(new AetherEventHandler()); - } + CommonProxy.registerEvent(new PlayerAetherEvents()); + CommonProxy.registerEvent(new AetherEventHandler()); + } - public static ResourceLocation locate(String location) - { + public static ResourceLocation locate(String location) { return new ResourceLocation(MOD_ID, location); } - public static String find(String location) - { + public static String find(String location) { return modAddress() + location; } - public static String modAddress() - { + public static String modAddress() { return MOD_ID + ":"; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/AetherConfig.java b/src/main/java/com/legacy/aether/AetherConfig.java index 350e7ff..e8199a9 100644 --- a/src/main/java/com/legacy/aether/AetherConfig.java +++ b/src/main/java/com/legacy/aether/AetherConfig.java @@ -5,8 +5,7 @@ import java.io.IOException; import net.minecraftforge.common.config.Configuration; -public class AetherConfig -{ +public class AetherConfig { private static int max_life_shards; @@ -22,16 +21,12 @@ public class AetherConfig private static int travel_dimension; - public static void init(File location) - { + public static void init(File location) { File newFile = new File(location + "/aether" + "/AetherI.cfg"); - try - { + try { newFile.createNewFile(); - } - catch (IOException e) - { + } catch (IOException e) { } @@ -58,53 +53,43 @@ public class AetherConfig config.save(); } - public static int getAetherDimensionID() - { + public static int getAetherDimensionID() { return AetherConfig.aether_dimension_id; } - public static int getAetherBiomeID() - { + public static int getAetherBiomeID() { return AetherConfig.aether_biome_id; } - public static int getMaxLifeShards() - { + public static int getMaxLifeShards() { return AetherConfig.max_life_shards; } - public static int getTravelDimensionID() - { + public static int getTravelDimensionID() { return AetherConfig.travel_dimension; } - public static boolean shouldFloatWithBlock() - { + public static boolean shouldFloatWithBlock() { return AetherConfig.floating_block_collision; } - public static boolean triviaDisabled() - { + public static boolean triviaDisabled() { return AetherConfig.disable_trivia; } - - public static boolean oldMobsEnabled() - { + + public static boolean oldMobsEnabled() { return AetherConfig.old_mobs; } - public static boolean shouldLoadHolidayContent() - { + public static boolean shouldLoadHolidayContent() { return AetherConfig.christmas_content; } - - public static boolean tallgrassEnabled() - { + + public static boolean tallgrassEnabled() { return AetherConfig.tallgrass; } - - public static boolean activateOnlyWithSkyroot() - { + + public static boolean activateOnlyWithSkyroot() { return AetherConfig.skyrootBucketOnly; } diff --git a/src/main/java/com/legacy/aether/AetherEventHandler.java b/src/main/java/com/legacy/aether/AetherEventHandler.java index 3cc85d8..b2885d9 100644 --- a/src/main/java/com/legacy/aether/AetherEventHandler.java +++ b/src/main/java/com/legacy/aether/AetherEventHandler.java @@ -34,106 +34,83 @@ import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; -public class AetherEventHandler -{ +public class +AetherEventHandler { @SubscribeEvent - public void checkBlockBannedEvent(PlayerInteractEvent event) - { + public void checkBlockBannedEvent(PlayerInteractEvent event) { EntityPlayer player = event.entityPlayer; ItemStack currentStack = player.getCurrentEquippedItem(); - if (player.dimension == AetherConfig.getAetherDimensionID()) - { - if (currentStack != null) - { - if (currentStack.getItem() == Items.flint_and_steel || currentStack.getItem() == Item.getItemFromBlock(Blocks.torch) || currentStack.getItem() == Items.fire_charge) - { - for (int i = 0; i < 10; ++i) - { + if (player.dimension == AetherConfig.getAetherDimensionID()) { + if (currentStack != null) { + if (currentStack.getItem() == Items.flint_and_steel || currentStack.getItem() == Item.getItemFromBlock(Blocks.torch) || currentStack.getItem() == Items.fire_charge) { + for (int i = 0; i < 10; ++i) { event.world.spawnParticle("smoke", event.x, event.y, event.z, 0.0D, 0.0D, 0.0D); } event.setCanceled(true); } - } - else if (event.world.getBlock(event.x, event.y, event.z) == Blocks.bed) - { + } else if (event.world.getBlock(event.x, event.y, event.z) == Blocks.bed) { event.setCanceled(true); } } } @SubscribeEvent - public void onEntityInteract(EntityInteractEvent event) - { - if (event.target instanceof EntityAgeable) - { - ItemStack itemstack = event.entityPlayer.inventory.getCurrentItem(); + public void onEntityInteract(EntityInteractEvent event) { + if (event.target instanceof EntityAgeable) { + ItemStack itemstack = event.entityPlayer.inventory.getCurrentItem(); - if (itemstack != null && itemstack.getItem() == ItemsAether.aether_spawn_egg) - { - if (!event.entityPlayer.worldObj.isRemote) - { - Class oclass = EntitiesAether.getClassFromID(itemstack.getItemDamage()); + if (itemstack != null && itemstack.getItem() == ItemsAether.aether_spawn_egg) { + if (!event.entityPlayer.worldObj.isRemote) { + Class oclass = EntitiesAether.getClassFromID(itemstack.getItemDamage()); - if (oclass != null && oclass.isAssignableFrom(this.getClass())) - { - EntityAgeable entityageable = ((EntityAgeable)event.target).createChild((EntityAgeable) event.target); + if (oclass != null && oclass.isAssignableFrom(this.getClass())) { + EntityAgeable entityageable = ((EntityAgeable) event.target).createChild((EntityAgeable) event.target); - if (entityageable != null) - { - entityageable.setGrowingAge(-24000); - entityageable.setLocationAndAngles(event.target.posX, event.target.posY, event.target.posZ, 0.0F, 0.0F); - event.entityPlayer.worldObj.spawnEntityInWorld(entityageable); + if (entityageable != null) { + entityageable.setGrowingAge(-24000); + entityageable.setLocationAndAngles(event.target.posX, event.target.posY, event.target.posZ, 0.0F, 0.0F); + event.entityPlayer.worldObj.spawnEntityInWorld(entityageable); - if (itemstack.hasDisplayName()) - { - entityageable.setCustomNameTag(itemstack.getDisplayName()); - } + if (itemstack.hasDisplayName()) { + entityageable.setCustomNameTag(itemstack.getDisplayName()); + } - if (!event.entityPlayer.capabilities.isCreativeMode) - { - --itemstack.stackSize; + if (!event.entityPlayer.capabilities.isCreativeMode) { + --itemstack.stackSize; - if (itemstack.stackSize <= 0) - { - event.entityPlayer.inventory.setInventorySlotContents(event.entityPlayer.inventory.currentItem, (ItemStack)null); - } - } - } - } - } - } + if (itemstack.stackSize <= 0) { + event.entityPlayer.inventory.setInventorySlotContents(event.entityPlayer.inventory.currentItem, (ItemStack) null); + } + } + } + } + } + } } - if (event.target instanceof EntityCow || event.target instanceof EntityFlyingCow) - { + if (event.target instanceof EntityCow || event.target instanceof EntityFlyingCow) { EntityPlayer player = event.entityPlayer; ItemStack heldItem = player.getCurrentEquippedItem(); - if (heldItem != null && heldItem.getItem() == ItemsAether.skyroot_bucket && EnumSkyrootBucketType.getType(heldItem.getItemDamage()) == EnumSkyrootBucketType.Empty) - { - if (!player.capabilities.isCreativeMode) - { + if (heldItem != null && heldItem.getItem() == ItemsAether.skyroot_bucket && EnumSkyrootBucketType.getType(heldItem.getItemDamage()) == EnumSkyrootBucketType.Empty) { + if (!player.capabilities.isCreativeMode) { --heldItem.stackSize; } - if (heldItem.stackSize <= 0) - { - player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta)); - } - else if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta))) - { - player.dropPlayerItemWithRandomChoice(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta), false); - } + if (heldItem.stackSize <= 0) { + player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta)); + } else if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta))) { + player.dropPlayerItemWithRandomChoice(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Milk.meta), false); + } } } } @SubscribeEvent - public void onFillBucket(FillBucketEvent event) - { + public void onFillBucket(FillBucketEvent event) { World worldObj = event.world; MovingObjectPosition target = event.target; ItemStack stack = event.current; @@ -144,50 +121,39 @@ public class AetherEventHandler boolean validDimension = (player.dimension == AetherConfig.getTravelDimensionID() || player.dimension == AetherConfig.getAetherDimensionID()); - if (target != null && target.typeOfHit == MovingObjectType.BLOCK && validDimension) - { - int i = target.blockX; - int j = target.blockY; - int k = target.blockZ; + if (target != null && target.typeOfHit == MovingObjectType.BLOCK && validDimension) { + int i = target.blockX; + int j = target.blockY; + int k = target.blockZ; - if (target.sideHit == 0) - { - --j; - } + if (target.sideHit == 0) { + --j; + } - if (target.sideHit == 1) - { - ++j; - } + if (target.sideHit == 1) { + ++j; + } - if (target.sideHit == 2) - { - --k; - } + if (target.sideHit == 2) { + --k; + } - if (target.sideHit == 3) - { - ++k; - } + if (target.sideHit == 3) { + ++k; + } - if (target.sideHit == 4) - { - --i; - } + if (target.sideHit == 4) { + --i; + } - if (isWater) - { - if (((BlockAetherPortal) BlocksAether.aether_portal).trySpawnPortal(worldObj, i, j, k)) - { - if (!player.capabilities.isCreativeMode) - { - if (stack.getItem() == ItemsAether.skyroot_bucket && stack.getItemDamage() == 1) - { + if (isWater) { + if (((BlockAetherPortal) BlocksAether.aether_portal).trySpawnPortal(worldObj, i, j, k)) { + if (!player.capabilities.isCreativeMode) { + if (stack.getItem() == ItemsAether.skyroot_bucket && stack.getItemDamage() == 1) { event.result = new ItemStack(ItemsAether.skyroot_bucket); } - if (stack.getItem() == Items.water_bucket) - { + if (stack.getItem() == Items.water_bucket) { event.result = new ItemStack(Items.bucket); } } @@ -196,19 +162,15 @@ public class AetherEventHandler } } - if (isLava && player.dimension == AetherConfig.getAetherDimensionID()) - { - if (player.capabilities.isCreativeMode && player.isSneaking()) - { + if (isLava && player.dimension == AetherConfig.getAetherDimensionID()) { + if (player.capabilities.isCreativeMode && player.isSneaking()) { return; } - if (worldObj.isAirBlock(i, j, k)) - { + if (worldObj.isAirBlock(i, j, k)) { worldObj.setBlock(i, j, k, BlocksAether.aerogel); - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { event.result = new ItemStack(Items.bucket); } } @@ -219,39 +181,29 @@ public class AetherEventHandler } @SubscribeEvent - public void onCrafting(ItemCraftedEvent event) - { - if (this.isGravititeTool(event.crafting.getItem())) - { + public void onCrafting(ItemCraftedEvent event) { + if (this.isGravititeTool(event.crafting.getItem())) { event.player.triggerAchievement(AchievementsAether.grav_tools); - } - else if (event.crafting.getItem() == Item.getItemFromBlock(BlocksAether.enchanter)) - { + } else if (event.crafting.getItem() == Item.getItemFromBlock(BlocksAether.enchanter)) { event.player.triggerAchievement(AchievementsAether.enchanter); } } @SubscribeEvent - public void onEntityDropLoot(LivingDropsEvent event) - { - if (event.source instanceof EntityDamageSource) - { + public void onEntityDropLoot(LivingDropsEvent event) { + if (event.source instanceof EntityDamageSource) { EntityLivingBase entity = event.entityLiving; EntityDamageSource source = (EntityDamageSource) event.source; - if (source.getEntity() instanceof EntityPlayer) - { + if (source.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) source.getEntity(); ItemStack currentItem = player.inventory.getCurrentItem(); - if (currentItem != null && currentItem.getItem() instanceof ItemSkyrootSword && !(entity instanceof EntityPlayer) && !(entity instanceof EntityWither) && !(entity instanceof EntityValkyrie)) - { - for (EntityItem items : event.drops) - { + if (currentItem != null && currentItem.getItem() instanceof ItemSkyrootSword && !(entity instanceof EntityPlayer) && !(entity instanceof EntityWither) && !(entity instanceof EntityValkyrie)) { + for (EntityItem items : event.drops) { ItemStack stack = items.getEntityItem(); - if (!(stack.getItem() instanceof ItemDungeonKey) && stack.getItem() != ItemsAether.victory_medal && stack.getItem() != Items.skull) - { + if (!(stack.getItem() instanceof ItemDungeonKey) && stack.getItem() != ItemsAether.victory_medal && stack.getItem() != Items.skull) { EntityItem item = new EntityItem(entity.worldObj, entity.posX, entity.posY, entity.posZ, items.getEntityItem()); entity.worldObj.spawnEntityInWorld(item); @@ -262,8 +214,7 @@ public class AetherEventHandler } } - public boolean isGravititeTool(Item stackID) - { + public boolean isGravititeTool(Item stackID) { return stackID == ItemsAether.gravitite_shovel || stackID == ItemsAether.gravitite_axe || stackID == ItemsAether.gravitite_pickaxe; } diff --git a/src/main/java/com/legacy/aether/CommonProxy.java b/src/main/java/com/legacy/aether/CommonProxy.java index 0415e69..4f234b1 100644 --- a/src/main/java/com/legacy/aether/CommonProxy.java +++ b/src/main/java/com/legacy/aether/CommonProxy.java @@ -4,8 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.FMLCommonHandler; -public class CommonProxy -{ +public class CommonProxy { public static int berryBushRenderID; @@ -13,28 +12,23 @@ public class CommonProxy public static int aetherFlowerRenderID; - public void init() - { + public void init() { } - public void openSunAltar() - { + public void openSunAltar() { } - public void sendMessage(EntityPlayer player, String text) - { + public void sendMessage(EntityPlayer player, String text) { } - public EntityPlayer getPlayer() - { + public EntityPlayer getPlayer() { return null; } - public static void registerEvent(Object event) - { + public static void registerEvent(Object event) { FMLCommonHandler.instance().bus().register(event); MinecraftForge.EVENT_BUS.register(event); } diff --git a/src/main/java/com/legacy/aether/api/AetherAPI.java b/src/main/java/com/legacy/aether/api/AetherAPI.java index 0ce701c..2053ccb 100644 --- a/src/main/java/com/legacy/aether/api/AetherAPI.java +++ b/src/main/java/com/legacy/aether/api/AetherAPI.java @@ -17,175 +17,148 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -public class AetherAPI -{ +public class AetherAPI { - private static final HashMap iAccessoryRegistry = new HashMap(4096); - private static final HashMap iEnchantmentRegistry = new HashMap(4096); - private static final HashMap iEnchantmentFuelRegistry = new HashMap(4096); - private static final HashMap iFreezableRegistry = new HashMap(4096); - private static final HashMap iFreezableFuelRegistry = new HashMap(4096); - private static final HashMap iMoaTypeRegistry = new HashMap(4096); + private static final HashMap iAccessoryRegistry = new HashMap(4096); + private static final HashMap iEnchantmentRegistry = new HashMap(4096); + private static final HashMap iEnchantmentFuelRegistry = new HashMap(4096); + private static final HashMap iFreezableRegistry = new HashMap(4096); + private static final HashMap iFreezableFuelRegistry = new HashMap(4096); + private static final HashMap iMoaTypeRegistry = new HashMap(4096); - private static final AetherAPI instance = new AetherAPI(); + private static final AetherAPI instance = new AetherAPI(); - public static final IPlayerAether get(EntityPlayer playerIn) - { + public static final IPlayerAether get(EntityPlayer playerIn) { return (IPlayerAether) playerIn.getExtendedProperties("aether_legacy:player_aether"); } - public AetherAccessory register(AetherAccessory type) - { - ItemStack stack = type.getAccessoryStack(); - ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); + public AetherAccessory register(AetherAccessory type) { + ItemStack stack = type.getAccessoryStack(); + ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); - iAccessoryRegistry.put(registryName, (AetherAccessory) type.setRegistryName(registryName)); + iAccessoryRegistry.put(registryName, (AetherAccessory) type.setRegistryName(registryName)); - return type; - } + return type; + } - public AetherEnchantment register(AetherEnchantment type) - { - ItemStack stack = type.getInput(); - ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); + public AetherEnchantment register(AetherEnchantment type) { + ItemStack stack = type.getInput(); + ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); - iEnchantmentRegistry.put(registryName, (AetherEnchantment) type.setRegistryName(registryName)); + iEnchantmentRegistry.put(registryName, (AetherEnchantment) type.setRegistryName(registryName)); - return type; - } + return type; + } - public AetherEnchantmentFuel register(AetherEnchantmentFuel type) - { - ItemStack stack = type.getFuelStack(); - ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); + public AetherEnchantmentFuel register(AetherEnchantmentFuel type) { + ItemStack stack = type.getFuelStack(); + ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); - iEnchantmentFuelRegistry.put(registryName, (AetherEnchantmentFuel) type.setRegistryName(registryName)); + iEnchantmentFuelRegistry.put(registryName, (AetherEnchantmentFuel) type.setRegistryName(registryName)); - return type; - } + return type; + } - public AetherFreezable register(AetherFreezable type) - { - ItemStack stack = type.getInput(); - ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); + public AetherFreezable register(AetherFreezable type) { + ItemStack stack = type.getInput(); + ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); - iFreezableRegistry.put(registryName, (AetherFreezable) type.setRegistryName(registryName)); + iFreezableRegistry.put(registryName, (AetherFreezable) type.setRegistryName(registryName)); - return type; - } + return type; + } - public AetherFreezableFuel register(AetherFreezableFuel type) - { - ItemStack stack = type.getFuelStack(); - ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); + public AetherFreezableFuel register(AetherFreezableFuel type) { + ItemStack stack = type.getFuelStack(); + ResourceLocation registryName = new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); - iFreezableFuelRegistry.put(registryName, (AetherFreezableFuel) type.setRegistryName(registryName)); + iFreezableFuelRegistry.put(registryName, (AetherFreezableFuel) type.setRegistryName(registryName)); - return type; - } + return type; + } - public AetherMoaType register(String modId, String name, AetherMoaType type) - { - iMoaTypeRegistry.put(new ResourceLocation(modId, name), (AetherMoaType) type.setRegistryName(modId, name)); + public AetherMoaType register(String modId, String name, AetherMoaType type) { + iMoaTypeRegistry.put(new ResourceLocation(modId, name), (AetherMoaType) type.setRegistryName(modId, name)); - return type; - } + return type; + } - public AetherMoaType register(ResourceLocation registryName, AetherMoaType type) - { - iMoaTypeRegistry.put(registryName, (AetherMoaType) type.setRegistryName(registryName)); + public AetherMoaType register(ResourceLocation registryName, AetherMoaType type) { + iMoaTypeRegistry.put(registryName, (AetherMoaType) type.setRegistryName(registryName)); - return type; - } + return type; + } - public boolean isAccessory(ItemStack stack) - { - return iAccessoryRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); - } + public boolean isAccessory(ItemStack stack) { + return iAccessoryRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); + } - public AetherAccessory getAccessory(ItemStack stack) - { + public AetherAccessory getAccessory(ItemStack stack) { return iAccessoryRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); } - public boolean hasEnchantment(ItemStack stack) - { + public boolean hasEnchantment(ItemStack stack) { return iEnchantmentRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); } - public AetherEnchantment getEnchantment(ItemStack stack) - { + public AetherEnchantment getEnchantment(ItemStack stack) { return iEnchantmentRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); } - public boolean isEnchantmentFuel(ItemStack stack) - { + public boolean isEnchantmentFuel(ItemStack stack) { return iEnchantmentFuelRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); } - public AetherEnchantmentFuel getEnchantmentFuel(ItemStack stack) - { + public AetherEnchantmentFuel getEnchantmentFuel(ItemStack stack) { return iEnchantmentFuelRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); } - public boolean hasFreezable(ItemStack stack) - { + public boolean hasFreezable(ItemStack stack) { return iFreezableRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); } - public AetherFreezable getFreezable(ItemStack stack) - { + public AetherFreezable getFreezable(ItemStack stack) { return iFreezableRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); } - public boolean isFreezableFuel(ItemStack stack) - { + public boolean isFreezableFuel(ItemStack stack) { return iFreezableFuelRegistry.containsKey(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); } - public AetherFreezableFuel getFreezableFuel(ItemStack stack) - { + public AetherFreezableFuel getFreezableFuel(ItemStack stack) { return iFreezableFuelRegistry.get(new ResourceLocation(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage()))); } - public List getEnchantmentValues() - { - return new ArrayList(iEnchantmentRegistry.values()); - } + public List getEnchantmentValues() { + return new ArrayList(iEnchantmentRegistry.values()); + } - public List getFreezableValues() - { - return new ArrayList(iFreezableRegistry.values()); - } + public List getFreezableValues() { + return new ArrayList(iFreezableRegistry.values()); + } - public List getMoaTypeValues() - { - return new ArrayList(iMoaTypeRegistry.values()); - } + public List getMoaTypeValues() { + return new ArrayList(iMoaTypeRegistry.values()); + } - public int getMoaTypeId(AetherMoaType type) - { - return this.getMoaTypeValues().indexOf(type); - } + public int getMoaTypeId(AetherMoaType type) { + return this.getMoaTypeValues().indexOf(type); + } - public AetherMoaType getMoaType(int id) - { - return this.getMoaTypeValues().get(id); - } + public AetherMoaType getMoaType(int id) { + return this.getMoaTypeValues().get(id); + } - public AetherMoaType getRandomMoaType() - { - return this.getMoaTypeValues().get(new Random().nextInt(this.getMoaTypeSize())); - } + public AetherMoaType getRandomMoaType() { + return this.getMoaTypeValues().get(new Random().nextInt(this.getMoaTypeSize())); + } - public int getMoaTypeSize() - { - return this.getMoaTypeValues().size(); - } + public int getMoaTypeSize() { + return this.getMoaTypeValues().size(); + } - public static AetherAPI instance() - { - return instance; - } + public static AetherAPI instance() { + return instance; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/api/RegistryEntry.java b/src/main/java/com/legacy/aether/api/RegistryEntry.java index 8dc27ee..1baae94 100644 --- a/src/main/java/com/legacy/aether/api/RegistryEntry.java +++ b/src/main/java/com/legacy/aether/api/RegistryEntry.java @@ -2,34 +2,29 @@ package com.legacy.aether.api; import net.minecraft.util.ResourceLocation; -public class RegistryEntry -{ +public class RegistryEntry { private ResourceLocation location; - public RegistryEntry setRegistryName(String modid, String location) - { + public RegistryEntry setRegistryName(String modid, String location) { this.location = new ResourceLocation(modid, location); return this; } - public RegistryEntry setRegistryName(String location) - { + public RegistryEntry setRegistryName(String location) { this.location = new ResourceLocation(location); return this; } - public RegistryEntry setRegistryName(ResourceLocation location) - { + public RegistryEntry setRegistryName(ResourceLocation location) { this.location = location; return this; } - public ResourceLocation getRegistryName() - { + public ResourceLocation getRegistryName() { return this.location; } diff --git a/src/main/java/com/legacy/aether/api/accessories/AccessoryType.java b/src/main/java/com/legacy/aether/api/accessories/AccessoryType.java index 460d5fb..45f918a 100644 --- a/src/main/java/com/legacy/aether/api/accessories/AccessoryType.java +++ b/src/main/java/com/legacy/aether/api/accessories/AccessoryType.java @@ -2,8 +2,7 @@ package com.legacy.aether.api.accessories; import net.minecraft.util.ObjectIntIdentityMap; -public enum AccessoryType -{ +public enum AccessoryType { RING("ring", 11, 3), EXTRA_RING("ring", 11, 3), PENDANT("pendant", 16, 7), @@ -17,30 +16,25 @@ public enum AccessoryType private String displayName; - AccessoryType(String displayName, int maxDamage, int damageReduced) - { + AccessoryType(String displayName, int maxDamage, int damageReduced) { this.displayName = displayName; this.maxDamage = maxDamage; this.damagedReduced = damageReduced; } - public int getMaxDamage() - { + public int getMaxDamage() { return this.maxDamage; } - public int getDamageReduced() - { + public int getDamageReduced() { return this.damagedReduced; } - public String getDisplayName() - { + public String getDisplayName() { return this.displayName; } - public static ObjectIntIdentityMap createCompleteList() - { + public static ObjectIntIdentityMap createCompleteList() { ObjectIntIdentityMap identityMap = new ObjectIntIdentityMap(); identityMap.func_148746_a(PENDANT, 0); @@ -53,7 +47,7 @@ public enum AccessoryType identityMap.func_148746_a(EXTRA_MISC, 7); return identityMap; - + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/api/accessories/AetherAccessory.java b/src/main/java/com/legacy/aether/api/accessories/AetherAccessory.java index dc6c2ec..9a22ac3 100644 --- a/src/main/java/com/legacy/aether/api/accessories/AetherAccessory.java +++ b/src/main/java/com/legacy/aether/api/accessories/AetherAccessory.java @@ -6,8 +6,7 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class AetherAccessory extends RegistryEntry -{ +public class AetherAccessory extends RegistryEntry { private ItemStack accessoryStack; @@ -15,18 +14,15 @@ public class AetherAccessory extends RegistryEntry private AccessoryType extraType; - public AetherAccessory(Block item, AccessoryType type) - { + public AetherAccessory(Block item, AccessoryType type) { this(new ItemStack(item), type); } - public AetherAccessory(Item item, AccessoryType type) - { + public AetherAccessory(Item item, AccessoryType type) { this(new ItemStack(item), type); } - public AetherAccessory(ItemStack stack, AccessoryType type) - { + public AetherAccessory(ItemStack stack, AccessoryType type) { this.accessoryType = type; this.accessoryStack = stack; this.extraType = type == AccessoryType.RING ? AccessoryType.EXTRA_RING : type == AccessoryType.MISC ? AccessoryType.EXTRA_MISC : null; @@ -34,18 +30,15 @@ public class AetherAccessory extends RegistryEntry this.setRegistryName(stack.getItem().getUnlocalizedName().toString() + "_meta_" + (stack.isItemStackDamageable() ? 0 : stack.getItemDamage())); } - public AccessoryType getAccessoryType() - { + public AccessoryType getAccessoryType() { return this.accessoryType; } - public AccessoryType getExtraType() - { + public AccessoryType getExtraType() { return this.extraType; } - public ItemStack getAccessoryStack() - { + public ItemStack getAccessoryStack() { return this.accessoryStack; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/api/enchantments/AetherEnchantment.java b/src/main/java/com/legacy/aether/api/enchantments/AetherEnchantment.java index 1a3cb08..b308907 100644 --- a/src/main/java/com/legacy/aether/api/enchantments/AetherEnchantment.java +++ b/src/main/java/com/legacy/aether/api/enchantments/AetherEnchantment.java @@ -6,60 +6,49 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class AetherEnchantment extends RegistryEntry -{ +public class AetherEnchantment extends RegistryEntry { public int timeRequired; public ItemStack input, output; - public AetherEnchantment(ItemStack input, Block output, int timeRequired) - { + public AetherEnchantment(ItemStack input, Block output, int timeRequired) { this(input, new ItemStack(output), timeRequired); } - public AetherEnchantment(Block input, ItemStack output, int timeRequired) - { + public AetherEnchantment(Block input, ItemStack output, int timeRequired) { this(new ItemStack(input), output, timeRequired); } - public AetherEnchantment(Block input, Block output, int timeRequired) - { + public AetherEnchantment(Block input, Block output, int timeRequired) { this(new ItemStack(input), new ItemStack(output), timeRequired); } - public AetherEnchantment(ItemStack input, Item output, int timeRequired) - { + public AetherEnchantment(ItemStack input, Item output, int timeRequired) { this(input, new ItemStack(output), timeRequired); } - public AetherEnchantment(Item input, ItemStack output, int timeRequired) - { + public AetherEnchantment(Item input, ItemStack output, int timeRequired) { this(new ItemStack(input), output, timeRequired); } - public AetherEnchantment(Item input, Item output, int timeRequired) - { + public AetherEnchantment(Item input, Item output, int timeRequired) { this(new ItemStack(input), new ItemStack(output), timeRequired); } - public AetherEnchantment(Block input, Item output, int timeRequired) - { + public AetherEnchantment(Block input, Item output, int timeRequired) { this(new ItemStack(input), new ItemStack(output), timeRequired); } - public AetherEnchantment(Item input, Block output, int timeRequired) - { + public AetherEnchantment(Item input, Block output, int timeRequired) { this(new ItemStack(input), new ItemStack(output), timeRequired); } - public AetherEnchantment(Item result, int timeRequired) - { + public AetherEnchantment(Item result, int timeRequired) { this(new ItemStack(result), new ItemStack(result), timeRequired); } - public AetherEnchantment(ItemStack input, ItemStack output, int timeRequired) - { + public AetherEnchantment(ItemStack input, ItemStack output, int timeRequired) { this.input = input; this.output = output; this.timeRequired = timeRequired; @@ -67,26 +56,21 @@ public class AetherEnchantment extends RegistryEntry this.setRegistryName(input.getItem().getUnlocalizedName().toString() + "_meta_" + (input.isItemStackDamageable() ? 0 : input.getItemDamage())); } - public int getTimeRequired() - { + public int getTimeRequired() { return this.timeRequired; } - public ItemStack getInput() - { + public ItemStack getInput() { return this.input; } - public ItemStack getOutput() - { + public ItemStack getOutput() { return this.output; } @Override - public boolean equals(Object obj) - { - if (obj instanceof AetherEnchantment) - { + public boolean equals(Object obj) { + if (obj instanceof AetherEnchantment) { AetherEnchantment freezable = (AetherEnchantment) obj; boolean inputCheck = this.getInput().getItem() == freezable.getInput().getItem() && this.getInput().getItemDamage() == freezable.getInput().getItemDamage(); diff --git a/src/main/java/com/legacy/aether/api/enchantments/AetherEnchantmentFuel.java b/src/main/java/com/legacy/aether/api/enchantments/AetherEnchantmentFuel.java index d94e110..1a86660 100644 --- a/src/main/java/com/legacy/aether/api/enchantments/AetherEnchantmentFuel.java +++ b/src/main/java/com/legacy/aether/api/enchantments/AetherEnchantmentFuel.java @@ -6,46 +6,38 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class AetherEnchantmentFuel extends RegistryEntry -{ +public class AetherEnchantmentFuel extends RegistryEntry { public int timeGiven; public ItemStack fuelStack; - public AetherEnchantmentFuel(Block fuelBlock, int timeGiven) - { + public AetherEnchantmentFuel(Block fuelBlock, int timeGiven) { this(new ItemStack(fuelBlock), timeGiven); } - public AetherEnchantmentFuel(Item fuelItem, int timeGiven) - { + public AetherEnchantmentFuel(Item fuelItem, int timeGiven) { this(new ItemStack(fuelItem), timeGiven); } - public AetherEnchantmentFuel(ItemStack fuelStack, int timeGiven) - { + public AetherEnchantmentFuel(ItemStack fuelStack, int timeGiven) { this.timeGiven = timeGiven; this.fuelStack = fuelStack; this.setRegistryName(fuelStack.getItem().getUnlocalizedName().toString() + "_meta_" + (fuelStack.isItemStackDamageable() ? 0 : fuelStack.getItemDamage())); } - public int getTimeGiven() - { + public int getTimeGiven() { return this.timeGiven; } - public ItemStack getFuelStack() - { + public ItemStack getFuelStack() { return this.fuelStack; } @Override - public boolean equals(Object obj) - { - if (obj instanceof AetherEnchantmentFuel) - { + public boolean equals(Object obj) { + if (obj instanceof AetherEnchantmentFuel) { AetherEnchantmentFuel fuel = (AetherEnchantmentFuel) obj; return this.getFuelStack().getItem() == fuel.getFuelStack().getItem() && this.getFuelStack().getItemDamage() == fuel.getFuelStack().getItemDamage(); diff --git a/src/main/java/com/legacy/aether/api/events/AetherHooks.java b/src/main/java/com/legacy/aether/api/events/AetherHooks.java index 534d2c4..d96323d 100644 --- a/src/main/java/com/legacy/aether/api/events/AetherHooks.java +++ b/src/main/java/com/legacy/aether/api/events/AetherHooks.java @@ -13,41 +13,35 @@ import com.legacy.aether.api.events.moas.MoaHatchEvent; import com.legacy.aether.api.freezables.AetherFreezable; import com.legacy.aether.api.moa.AetherMoaType; -public class AetherHooks -{ +public class AetherHooks { - public static boolean isValidAccessory(EntityPlayer player, AetherAccessory accessory) - { + public static boolean isValidAccessory(EntityPlayer player, AetherAccessory accessory) { ValidAccessoryEvent event = new ValidAccessoryEvent(player, accessory); - if (MinecraftForge.EVENT_BUS.post(event)) return false; + if (MinecraftForge.EVENT_BUS.post(event)) return false; return !event.isCanceled(); } - public static void onMoaHatched(AetherMoaType type, TileEntity incubator) - { + public static void onMoaHatched(AetherMoaType type, TileEntity incubator) { MoaHatchEvent event = new MoaHatchEvent(type, incubator); MinecraftForge.EVENT_BUS.post(event); } - public static void onItemEnchant(TileEntity enchanter, AetherEnchantment enchantment) - { + public static void onItemEnchant(TileEntity enchanter, AetherEnchantment enchantment) { AetherEnchantmentEvent.EnchantEvent event = new AetherEnchantmentEvent.EnchantEvent(enchanter, enchantment); MinecraftForge.EVENT_BUS.post(event); } - public static void onItemFreeze(TileEntity freezer, AetherFreezable freezable) - { + public static void onItemFreeze(TileEntity freezer, AetherFreezable freezable) { AetherFreezableEvent.FreezeEvent event = new AetherFreezableEvent.FreezeEvent(freezer, freezable); MinecraftForge.EVENT_BUS.post(event); } - public static int onSetEnchantmentTime(TileEntity enchanter, AetherEnchantment enchantment, int original) - { + public static int onSetEnchantmentTime(TileEntity enchanter, AetherEnchantment enchantment, int original) { AetherEnchantmentEvent.SetTimeEvent event = new AetherEnchantmentEvent.SetTimeEvent(enchanter, enchantment, original); if (MinecraftForge.EVENT_BUS.post(event)) return original; @@ -55,8 +49,7 @@ public class AetherHooks return event.getNewTime(); } - public static int onSetFreezableTime(TileEntity freezer, AetherFreezable freezable, int original) - { + public static int onSetFreezableTime(TileEntity freezer, AetherFreezable freezable, int original) { AetherFreezableEvent.SetTimeEvent event = new AetherFreezableEvent.SetTimeEvent(freezer, freezable, original); if (MinecraftForge.EVENT_BUS.post(event)) return original; diff --git a/src/main/java/com/legacy/aether/api/events/accessories/AetherAccessoryEvent.java b/src/main/java/com/legacy/aether/api/events/accessories/AetherAccessoryEvent.java index 2d3964b..f1bd2e6 100644 --- a/src/main/java/com/legacy/aether/api/events/accessories/AetherAccessoryEvent.java +++ b/src/main/java/com/legacy/aether/api/events/accessories/AetherAccessoryEvent.java @@ -4,18 +4,15 @@ import com.legacy.aether.api.accessories.AetherAccessory; import cpw.mods.fml.common.eventhandler.Event; -public class AetherAccessoryEvent extends Event -{ +public class AetherAccessoryEvent extends Event { private AetherAccessory accessory; - public AetherAccessoryEvent(AetherAccessory accessory) - { + public AetherAccessoryEvent(AetherAccessory accessory) { this.accessory = accessory; } - public AetherAccessory getAetherAccessory() - { + public AetherAccessory getAetherAccessory() { return this.accessory; } diff --git a/src/main/java/com/legacy/aether/api/events/accessories/ValidAccessoryEvent.java b/src/main/java/com/legacy/aether/api/events/accessories/ValidAccessoryEvent.java index 1802b92..e7dc5b5 100644 --- a/src/main/java/com/legacy/aether/api/events/accessories/ValidAccessoryEvent.java +++ b/src/main/java/com/legacy/aether/api/events/accessories/ValidAccessoryEvent.java @@ -7,11 +7,9 @@ import com.legacy.aether.api.accessories.AetherAccessory; import cpw.mods.fml.common.eventhandler.Cancelable; @Cancelable -public class ValidAccessoryEvent extends AetherAccessoryEvent -{ +public class ValidAccessoryEvent extends AetherAccessoryEvent { - public ValidAccessoryEvent(EntityPlayer player, AetherAccessory accessory) - { + public ValidAccessoryEvent(EntityPlayer player, AetherAccessory accessory) { super(accessory); } diff --git a/src/main/java/com/legacy/aether/api/events/enchantments/AetherEnchantmentEvent.java b/src/main/java/com/legacy/aether/api/events/enchantments/AetherEnchantmentEvent.java index 980981d..f037c71 100644 --- a/src/main/java/com/legacy/aether/api/events/enchantments/AetherEnchantmentEvent.java +++ b/src/main/java/com/legacy/aether/api/events/enchantments/AetherEnchantmentEvent.java @@ -6,16 +6,13 @@ import com.legacy.aether.api.enchantments.AetherEnchantment; import cpw.mods.fml.common.eventhandler.Event; -public class AetherEnchantmentEvent extends Event -{ +public class AetherEnchantmentEvent extends Event { + + public AetherEnchantmentEvent() { - public AetherEnchantmentEvent() - { - } - public static class SetTimeEvent extends AetherEnchantmentEvent - { + public static class SetTimeEvent extends AetherEnchantmentEvent { private TileEntity tileEntity; private AetherEnchantment enchantment; @@ -24,8 +21,7 @@ public class AetherEnchantmentEvent extends Event private int newTime; - public SetTimeEvent(TileEntity tileEntity, AetherEnchantment enchantment, int original) - { + public SetTimeEvent(TileEntity tileEntity, AetherEnchantment enchantment, int original) { this.tileEntity = tileEntity; this.enchantment = enchantment; this.original = original; @@ -33,51 +29,42 @@ public class AetherEnchantmentEvent extends Event this.setNewTime(original); } - public TileEntity getTileEntity() - { + public TileEntity getTileEntity() { return this.tileEntity; } - public AetherEnchantment getEnchantment() - { + public AetherEnchantment getEnchantment() { return this.enchantment; } - public int getOriginal() - { + public int getOriginal() { return this.original; } - public int getNewTime() - { + public int getNewTime() { return this.newTime; } - public void setNewTime(int newTime) - { + public void setNewTime(int newTime) { this.newTime = newTime; } } - public static class EnchantEvent extends AetherEnchantmentEvent - { + public static class EnchantEvent extends AetherEnchantmentEvent { private TileEntity tileEntity; private AetherEnchantment enchantent; - public EnchantEvent(TileEntity tileEntity, AetherEnchantment enchantment) - { + public EnchantEvent(TileEntity tileEntity, AetherEnchantment enchantment) { this.tileEntity = tileEntity; this.enchantent = enchantment; } - public TileEntity getTileEntity() - { + public TileEntity getTileEntity() { return this.tileEntity; } - public AetherEnchantment getEnchantment() - { + public AetherEnchantment getEnchantment() { return this.enchantent; } } diff --git a/src/main/java/com/legacy/aether/api/events/freezables/AetherFreezableEvent.java b/src/main/java/com/legacy/aether/api/events/freezables/AetherFreezableEvent.java index bdc7cee..0c29336 100644 --- a/src/main/java/com/legacy/aether/api/events/freezables/AetherFreezableEvent.java +++ b/src/main/java/com/legacy/aether/api/events/freezables/AetherFreezableEvent.java @@ -6,16 +6,13 @@ import com.legacy.aether.api.freezables.AetherFreezable; import cpw.mods.fml.common.eventhandler.Event; -public class AetherFreezableEvent extends Event -{ +public class AetherFreezableEvent extends Event { + + public AetherFreezableEvent() { - public AetherFreezableEvent() - { - } - public static class SetTimeEvent extends AetherFreezableEvent - { + public static class SetTimeEvent extends AetherFreezableEvent { private TileEntity tileEntity; private AetherFreezable freezable; @@ -24,8 +21,7 @@ public class AetherFreezableEvent extends Event private int newTime; - public SetTimeEvent(TileEntity tileEntity, AetherFreezable freezable, int original) - { + public SetTimeEvent(TileEntity tileEntity, AetherFreezable freezable, int original) { this.tileEntity = tileEntity; this.freezable = freezable; this.original = original; @@ -33,51 +29,42 @@ public class AetherFreezableEvent extends Event this.setNewTime(original); } - public TileEntity getTileEntity() - { + public TileEntity getTileEntity() { return this.tileEntity; } - public AetherFreezable getFreezable() - { + public AetherFreezable getFreezable() { return this.freezable; } - public int getOriginal() - { + public int getOriginal() { return this.original; } - public int getNewTime() - { + public int getNewTime() { return this.newTime; } - public void setNewTime(int newTime) - { + public void setNewTime(int newTime) { this.newTime = newTime; } } - public static class FreezeEvent extends AetherFreezableEvent - { + public static class FreezeEvent extends AetherFreezableEvent { private TileEntity tileEntity; private AetherFreezable freezable; - public FreezeEvent(TileEntity tileEntity, AetherFreezable freezable) - { + public FreezeEvent(TileEntity tileEntity, AetherFreezable freezable) { this.tileEntity = tileEntity; this.freezable = freezable; } - public TileEntity getTileEntity() - { + public TileEntity getTileEntity() { return this.tileEntity; } - public AetherFreezable getFreezable() - { + public AetherFreezable getFreezable() { return this.freezable; } } diff --git a/src/main/java/com/legacy/aether/api/events/moas/MoaEvent.java b/src/main/java/com/legacy/aether/api/events/moas/MoaEvent.java index 4052343..42930e4 100644 --- a/src/main/java/com/legacy/aether/api/events/moas/MoaEvent.java +++ b/src/main/java/com/legacy/aether/api/events/moas/MoaEvent.java @@ -4,18 +4,15 @@ import com.legacy.aether.api.moa.AetherMoaType; import cpw.mods.fml.common.eventhandler.Event; -public class MoaEvent extends Event -{ +public class MoaEvent extends Event { private AetherMoaType moaType; - public MoaEvent(AetherMoaType moaType) - { + public MoaEvent(AetherMoaType moaType) { this.moaType = moaType; } - public AetherMoaType getMoaType() - { + public AetherMoaType getMoaType() { return this.moaType; } diff --git a/src/main/java/com/legacy/aether/api/events/moas/MoaHatchEvent.java b/src/main/java/com/legacy/aether/api/events/moas/MoaHatchEvent.java index bd0cc83..b79f8a1 100644 --- a/src/main/java/com/legacy/aether/api/events/moas/MoaHatchEvent.java +++ b/src/main/java/com/legacy/aether/api/events/moas/MoaHatchEvent.java @@ -4,20 +4,17 @@ import net.minecraft.tileentity.TileEntity; import com.legacy.aether.api.moa.AetherMoaType; -public class MoaHatchEvent extends MoaEvent -{ +public class MoaHatchEvent extends MoaEvent { private TileEntity incubator; - public MoaHatchEvent(AetherMoaType moaType, TileEntity incubator) - { + public MoaHatchEvent(AetherMoaType moaType, TileEntity incubator) { super(moaType); this.incubator = incubator; } - public TileEntity getTileEntity() - { + public TileEntity getTileEntity() { return this.incubator; } diff --git a/src/main/java/com/legacy/aether/api/freezables/AetherFreezable.java b/src/main/java/com/legacy/aether/api/freezables/AetherFreezable.java index 1e62d34..5efc2e7 100644 --- a/src/main/java/com/legacy/aether/api/freezables/AetherFreezable.java +++ b/src/main/java/com/legacy/aether/api/freezables/AetherFreezable.java @@ -6,55 +6,45 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class AetherFreezable extends RegistryEntry -{ +public class AetherFreezable extends RegistryEntry { public int timeRequired; public ItemStack input, output; - public AetherFreezable(ItemStack input, Block output, int timeRequired) - { + public AetherFreezable(ItemStack input, Block output, int timeRequired) { this(input, new ItemStack(output), timeRequired); } - public AetherFreezable(Block input, ItemStack output, int timeRequired) - { + public AetherFreezable(Block input, ItemStack output, int timeRequired) { this(new ItemStack(input), output, timeRequired); } - public AetherFreezable(Block input, Block output, int timeRequired) - { + public AetherFreezable(Block input, Block output, int timeRequired) { this(new ItemStack(input), new ItemStack(output), timeRequired); } - public AetherFreezable(ItemStack input, Item output, int timeRequired) - { + public AetherFreezable(ItemStack input, Item output, int timeRequired) { this(input, new ItemStack(output), timeRequired); } - public AetherFreezable(Item input, ItemStack output, int timeRequired) - { + public AetherFreezable(Item input, ItemStack output, int timeRequired) { this(new ItemStack(input), output, timeRequired); } - public AetherFreezable(Item input, Item output, int timeRequired) - { + public AetherFreezable(Item input, Item output, int timeRequired) { this(new ItemStack(input), new ItemStack(output), timeRequired); } - public AetherFreezable(Block input, Item output, int timeRequired) - { + public AetherFreezable(Block input, Item output, int timeRequired) { this(new ItemStack(input), new ItemStack(output), timeRequired); } - public AetherFreezable(Item input, Block output, int timeRequired) - { + public AetherFreezable(Item input, Block output, int timeRequired) { this(new ItemStack(input), new ItemStack(output), timeRequired); } - public AetherFreezable(ItemStack input, ItemStack output, int timeRequired) - { + public AetherFreezable(ItemStack input, ItemStack output, int timeRequired) { this.input = input; this.output = output; this.timeRequired = timeRequired; @@ -62,26 +52,21 @@ public class AetherFreezable extends RegistryEntry this.setRegistryName(input.getItem().getUnlocalizedName().toString() + "_meta_" + (input.isItemStackDamageable() ? 0 : input.getItemDamage())); } - public int getTimeRequired() - { + public int getTimeRequired() { return this.timeRequired; } - public ItemStack getInput() - { + public ItemStack getInput() { return this.input; } - public ItemStack getOutput() - { + public ItemStack getOutput() { return this.output; } @Override - public boolean equals(Object obj) - { - if (obj instanceof AetherFreezable) - { + public boolean equals(Object obj) { + if (obj instanceof AetherFreezable) { AetherFreezable freezable = (AetherFreezable) obj; boolean inputCheck = this.getInput().getItem() == freezable.getInput().getItem() && this.getInput().getItemDamage() == freezable.getInput().getItemDamage(); diff --git a/src/main/java/com/legacy/aether/api/freezables/AetherFreezableFuel.java b/src/main/java/com/legacy/aether/api/freezables/AetherFreezableFuel.java index 385498f..ca6f44b 100644 --- a/src/main/java/com/legacy/aether/api/freezables/AetherFreezableFuel.java +++ b/src/main/java/com/legacy/aether/api/freezables/AetherFreezableFuel.java @@ -6,46 +6,38 @@ import net.minecraft.item.ItemStack; import com.legacy.aether.api.RegistryEntry; -public class AetherFreezableFuel extends RegistryEntry -{ +public class AetherFreezableFuel extends RegistryEntry { public int timeGiven; public ItemStack fuelStack; - public AetherFreezableFuel(Block fuelBlock, int timeGiven) - { + public AetherFreezableFuel(Block fuelBlock, int timeGiven) { this(new ItemStack(fuelBlock), timeGiven); } - public AetherFreezableFuel(Item fuelItem, int timeGiven) - { + public AetherFreezableFuel(Item fuelItem, int timeGiven) { this(new ItemStack(fuelItem), timeGiven); } - public AetherFreezableFuel(ItemStack fuelStack, int timeGiven) - { + public AetherFreezableFuel(ItemStack fuelStack, int timeGiven) { this.timeGiven = timeGiven; this.fuelStack = fuelStack; this.setRegistryName(fuelStack.getItem().getUnlocalizedName().toString() + "_meta_" + (fuelStack.isItemStackDamageable() ? 0 : fuelStack.getItemDamage())); } - public int getTimeGiven() - { + public int getTimeGiven() { return this.timeGiven; } - public ItemStack getFuelStack() - { + public ItemStack getFuelStack() { return this.fuelStack; } @Override - public boolean equals(Object obj) - { - if (obj instanceof AetherFreezableFuel) - { + public boolean equals(Object obj) { + if (obj instanceof AetherFreezableFuel) { AetherFreezableFuel fuel = (AetherFreezableFuel) obj; return this.getFuelStack().getItem() == fuel.getFuelStack().getItem() && this.getFuelStack().getItemDamage() == fuel.getFuelStack().getItemDamage(); diff --git a/src/main/java/com/legacy/aether/api/moa/AetherMoaType.java b/src/main/java/com/legacy/aether/api/moa/AetherMoaType.java index c689722..f3a88ec 100644 --- a/src/main/java/com/legacy/aether/api/moa/AetherMoaType.java +++ b/src/main/java/com/legacy/aether/api/moa/AetherMoaType.java @@ -5,8 +5,7 @@ import com.legacy.aether.api.RegistryEntry; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.ResourceLocation; -public class AetherMoaType extends RegistryEntry -{ +public class AetherMoaType extends RegistryEntry { private MoaProperties properties; @@ -14,43 +13,36 @@ public class AetherMoaType extends RegistryEntry public CreativeTabs creativeTab; - public AetherMoaType(int hexColor, MoaProperties properties) - { + public AetherMoaType(int hexColor, MoaProperties properties) { this.hexColor = hexColor; this.properties = properties; this.creativeTab = CreativeTabs.tabMisc; } - public AetherMoaType(int hexColor, MoaProperties properties, CreativeTabs creativeTab) - { + public AetherMoaType(int hexColor, MoaProperties properties, CreativeTabs creativeTab) { this(hexColor, properties); this.creativeTab = creativeTab; } - public ResourceLocation getTexture(boolean saddled, boolean isBeingRidden) - { - if (this.properties.hasCustomTexture()) - { + public ResourceLocation getTexture(boolean saddled, boolean isBeingRidden) { + if (this.properties.hasCustomTexture()) { return this.properties.getCustomTexture(saddled, isBeingRidden); } return new ResourceLocation("aether_legacy", "textures/entities/moa/" + ("moa_") + this.getRegistryName().getResourcePath().toLowerCase() + ".png"); } - public MoaProperties getMoaProperties() - { + public MoaProperties getMoaProperties() { return this.properties; } - public CreativeTabs getCreativeTab() - { + public CreativeTabs getCreativeTab() { return this.creativeTab; } - public int getMoaEggColor() - { + public int getMoaEggColor() { return this.hexColor; } diff --git a/src/main/java/com/legacy/aether/api/moa/MoaProperties.java b/src/main/java/com/legacy/aether/api/moa/MoaProperties.java index 0cedfcc..eed3a42 100644 --- a/src/main/java/com/legacy/aether/api/moa/MoaProperties.java +++ b/src/main/java/com/legacy/aether/api/moa/MoaProperties.java @@ -2,8 +2,7 @@ package com.legacy.aether.api.moa; import net.minecraft.util.ResourceLocation; -public class MoaProperties -{ +public class MoaProperties { private int maxJumps; @@ -11,36 +10,30 @@ public class MoaProperties private ResourceLocation location = null; - public MoaProperties(int maxJumps, float moaSpeed) - { + public MoaProperties(int maxJumps, float moaSpeed) { this.maxJumps = maxJumps; this.moaSpeed = moaSpeed; } - public MoaProperties(int maxJumps, float moaSpeed, ResourceLocation location) - { + public MoaProperties(int maxJumps, float moaSpeed, ResourceLocation location) { this(maxJumps, moaSpeed); this.location = location; } - public int getMaxJumps() - { + public int getMaxJumps() { return this.maxJumps; } - public float getMoaSpeed() - { + public float getMoaSpeed() { return this.moaSpeed; } - public boolean hasCustomTexture() - { + public boolean hasCustomTexture() { return this.location != null; } - public ResourceLocation getCustomTexture(boolean isSaddled, boolean isBeingRidden) - { + public ResourceLocation getCustomTexture(boolean isSaddled, boolean isBeingRidden) { return this.location; } diff --git a/src/main/java/com/legacy/aether/api/player/IPlayerAether.java b/src/main/java/com/legacy/aether/api/player/IPlayerAether.java index bc4645a..e57e8d1 100644 --- a/src/main/java/com/legacy/aether/api/player/IPlayerAether.java +++ b/src/main/java/com/legacy/aether/api/player/IPlayerAether.java @@ -9,8 +9,7 @@ import com.legacy.aether.api.player.util.IAccessoryInventory; import com.legacy.aether.api.player.util.IAetherAbility; import com.legacy.aether.api.player.util.IAetherBoss; -public interface IPlayerAether extends IExtendedEntityProperties -{ +public interface IPlayerAether extends IExtendedEntityProperties { public void onUpdate(); diff --git a/src/main/java/com/legacy/aether/api/player/util/IAccessoryInventory.java b/src/main/java/com/legacy/aether/api/player/util/IAccessoryInventory.java index 9372960..55c5062 100644 --- a/src/main/java/com/legacy/aether/api/player/util/IAccessoryInventory.java +++ b/src/main/java/com/legacy/aether/api/player/util/IAccessoryInventory.java @@ -11,8 +11,7 @@ import net.minecraft.nbt.NBTTagList; import com.legacy.aether.api.accessories.AccessoryType; -public interface IAccessoryInventory extends IInventory -{ +public interface IAccessoryInventory extends IInventory { public void dropAccessories(); diff --git a/src/main/java/com/legacy/aether/api/player/util/IAetherAbility.java b/src/main/java/com/legacy/aether/api/player/util/IAetherAbility.java index 2f709d8..8575a10 100644 --- a/src/main/java/com/legacy/aether/api/player/util/IAetherAbility.java +++ b/src/main/java/com/legacy/aether/api/player/util/IAetherAbility.java @@ -1,7 +1,6 @@ package com.legacy.aether.api.player.util; -public interface IAetherAbility -{ +public interface IAetherAbility { public void onUpdate(); diff --git a/src/main/java/com/legacy/aether/api/player/util/IAetherBoss.java b/src/main/java/com/legacy/aether/api/player/util/IAetherBoss.java index 2785745..48ff759 100644 --- a/src/main/java/com/legacy/aether/api/player/util/IAetherBoss.java +++ b/src/main/java/com/legacy/aether/api/player/util/IAetherBoss.java @@ -1,7 +1,6 @@ package com.legacy.aether.api.player.util; -public interface IAetherBoss -{ +public interface IAetherBoss { public String getBossName(); diff --git a/src/main/java/com/legacy/aether/blocks/BlockAether.java b/src/main/java/com/legacy/aether/blocks/BlockAether.java index 4928b64..dc95dc1 100644 --- a/src/main/java/com/legacy/aether/blocks/BlockAether.java +++ b/src/main/java/com/legacy/aether/blocks/BlockAether.java @@ -3,11 +3,9 @@ package com.legacy.aether.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -public class BlockAether extends Block -{ +public class BlockAether extends Block { - public BlockAether(Material material, String texture) - { + public BlockAether(Material material, String texture) { super(material); this.setBlockTextureName(texture); diff --git a/src/main/java/com/legacy/aether/blocks/BlockAetherSapling.java b/src/main/java/com/legacy/aether/blocks/BlockAetherSapling.java index 1770556..61da811 100644 --- a/src/main/java/com/legacy/aether/blocks/BlockAetherSapling.java +++ b/src/main/java/com/legacy/aether/blocks/BlockAetherSapling.java @@ -9,13 +9,11 @@ import net.minecraft.world.gen.feature.WorldGenerator; import com.legacy.aether.blocks.natural.BlockAetherFlower; -public class BlockAetherSapling extends BlockAetherFlower implements IGrowable -{ +public class BlockAetherSapling extends BlockAetherFlower implements IGrowable { public WorldGenerator treeGenObject = null; - public BlockAetherSapling(WorldGenerator treeGen) - { + public BlockAetherSapling(WorldGenerator treeGen) { super(); float f = 0.4F; @@ -24,49 +22,40 @@ public class BlockAetherSapling extends BlockAetherFlower implements IGrowable } @Override - public void updateTick(World world, int x, int y, int z, Random random) - { - if (!world.isRemote) - { + public void updateTick(World world, int x, int y, int z, Random random) { + if (!world.isRemote) { super.updateTick(world, x, y, z, random); - if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(30) == 0) - { + if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(30) == 0) { this.growTree(world, x, y, z, random); } } } - public void growTree(World world, int x, int y, int z, Random rand) - { + public void growTree(World world, int x, int y, int z, Random rand) { world.setBlock(x, y, z, Blocks.air); - if (!this.treeGenObject.generate(world, world.rand, x, y, z)) - { + if (!this.treeGenObject.generate(world, world.rand, x, y, z)) { world.setBlock(x, y, z, this); } } @Override - public boolean func_149851_a(World worldIn, int x, int y, int z, boolean isClient) - { + public boolean func_149851_a(World worldIn, int x, int y, int z, boolean isClient) { return true; } @Override - public boolean func_149852_a(World worldIn, Random rand, int x, int y, int z) - { + public boolean func_149852_a(World worldIn, Random rand, int x, int y, int z) { return true; } @Override - public void func_149853_b(World worldIn, Random rand, int x, int y, int z) - { - if (worldIn.rand.nextFloat() < 0.45D) - { - this.growTree(worldIn, x, y, z, rand); - } - + public void func_149853_b(World worldIn, Random rand, int x, int y, int z) { + if (worldIn.rand.nextFloat() < 0.45D) { + this.growTree(worldIn, x, y, z, rand); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/BlockIcestone.java b/src/main/java/com/legacy/aether/blocks/BlockIcestone.java index 9fbc045..a5a28af 100644 --- a/src/main/java/com/legacy/aether/blocks/BlockIcestone.java +++ b/src/main/java/com/legacy/aether/blocks/BlockIcestone.java @@ -5,11 +5,9 @@ import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.world.World; -public class BlockIcestone extends Block -{ +public class BlockIcestone extends Block { - public BlockIcestone() - { + public BlockIcestone() { super(Material.ice); this.setHardness(3F); @@ -20,22 +18,15 @@ public class BlockIcestone extends Block } @Override - public void onBlockAdded(World worldIn, int xIn, int yIn, int zIn) - { - for (int x = xIn - 3; x <= (xIn + 3); ++x) - { - for (int y = yIn - 3; y <= (yIn + 3); ++y) - { - for (int z = zIn - 3; z <= (zIn + 3); ++z) - { + public void onBlockAdded(World worldIn, int xIn, int yIn, int zIn) { + for (int x = xIn - 3; x <= (xIn + 3); ++x) { + for (int y = yIn - 3; y <= (yIn + 3); ++y) { + for (int z = zIn - 3; z <= (zIn + 3); ++z) { Block block = worldIn.getBlock(x, y, z); - if (block == Blocks.water || block == Blocks.flowing_water) - { + if (block == Blocks.water || block == Blocks.flowing_water) { worldIn.setBlock(x, y, z, Blocks.ice); - } - else if (block == Blocks.lava || block == Blocks.flowing_lava) - { + } else if (block == Blocks.lava || block == Blocks.flowing_lava) { worldIn.setBlock(x, y, z, Blocks.obsidian); } } diff --git a/src/main/java/com/legacy/aether/blocks/BlocksAether.java b/src/main/java/com/legacy/aether/blocks/BlocksAether.java index cd461da..9a0b50d 100644 --- a/src/main/java/com/legacy/aether/blocks/BlocksAether.java +++ b/src/main/java/com/legacy/aether/blocks/BlocksAether.java @@ -48,8 +48,7 @@ import com.legacy.aether.world.biome.decoration.AetherGenSkyrootTree; import cpw.mods.fml.common.registry.GameRegistry; -public class BlocksAether -{ +public class BlocksAether { public static Block aether_grass, enchanted_aether_grass, aether_dirt; @@ -106,11 +105,10 @@ public class BlocksAether public static Block holiday_leaves, decorated_holiday_leaves, present; public static Block sun_altar; - + public static Block skyroot_bookshelf; - public static void initialization() - { + public static void initialization() { aether_grass = registerMeta("aether_grass", new BlockAetherGrass()); enchanted_aether_grass = register("enchanted_aether_grass", new BlockEnchantedAetherGrass()); aether_dirt = registerMeta("aether_dirt", new BlockAetherDirt()); @@ -200,13 +198,11 @@ public class BlocksAether skyroot_bookshelf = register("skyroot_bookshelf", new BlockSkyrootBookshelf()); } - public static boolean isGood(Block block) - { - return block == Blocks.air || block == aercloud; + public static boolean isGood(Block block) { + return block == Blocks.air || block == aercloud; } - public static Block registerSlab(String name, Block slab1, Block slab2) - { + public static Block registerSlab(String name, Block slab1, Block slab2) { slab1.setBlockName(name); slab1.setCreativeTab(AetherCreativeTabs.blocks); @@ -215,8 +211,7 @@ public class BlocksAether return slab1; } - public static Block register(String name, Block block) - { + public static Block register(String name, Block block) { block.setBlockName(name); block.setCreativeTab(AetherCreativeTabs.blocks); @@ -225,8 +220,7 @@ public class BlocksAether return block; } - public static Block registerMeta(String name, Block block) - { + public static Block registerMeta(String name, Block block) { block.setBlockName(name); block.setCreativeTab(AetherCreativeTabs.blocks); diff --git a/src/main/java/com/legacy/aether/blocks/container/BlockAetherContainer.java b/src/main/java/com/legacy/aether/blocks/container/BlockAetherContainer.java index 1048d01..16f7ab7 100644 --- a/src/main/java/com/legacy/aether/blocks/container/BlockAetherContainer.java +++ b/src/main/java/com/legacy/aether/blocks/container/BlockAetherContainer.java @@ -9,39 +9,32 @@ import net.minecraft.world.World; import com.legacy.aether.tileentity.util.AetherTileEntity; -public abstract class BlockAetherContainer extends BlockContainer -{ +public abstract class BlockAetherContainer extends BlockContainer { - public BlockAetherContainer(Material materialIn) - { + public BlockAetherContainer(Material materialIn) { super(materialIn); } @Override - public void onBlockPlacedBy(World worldIn, int x, int y, int z, EntityLivingBase placer, ItemStack stack) - { - if (stack.hasDisplayName()) - { - TileEntity tileentity = worldIn.getTileEntity(x, y, z); + public void onBlockPlacedBy(World worldIn, int x, int y, int z, EntityLivingBase placer, ItemStack stack) { + if (stack.hasDisplayName()) { + TileEntity tileentity = worldIn.getTileEntity(x, y, z); - if (tileentity instanceof AetherTileEntity) - { - ((AetherTileEntity)tileentity).setCustomName(stack.getDisplayName()); - } - } - } + if (tileentity instanceof AetherTileEntity) { + ((AetherTileEntity) tileentity).setCustomName(stack.getDisplayName()); + } + } + } - public static void setState(World worldIn, int x, int y, int z, boolean isActive) - { - TileEntity tileentity = worldIn.getTileEntity(x, y, z); + public static void setState(World worldIn, int x, int y, int z, boolean isActive) { + TileEntity tileentity = worldIn.getTileEntity(x, y, z); - worldIn.setBlockMetadataWithNotify(x, y, z, isActive ? 1 : 0, 3); + worldIn.setBlockMetadataWithNotify(x, y, z, isActive ? 1 : 0, 3); - if (tileentity != null) - { - tileentity.validate(); - worldIn.setTileEntity(x, y, z, tileentity); - } + if (tileentity != null) { + tileentity.validate(); + worldIn.setTileEntity(x, y, z, tileentity); + } } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/container/BlockEnchanter.java b/src/main/java/com/legacy/aether/blocks/container/BlockEnchanter.java index c14e247..0c45077 100644 --- a/src/main/java/com/legacy/aether/blocks/container/BlockEnchanter.java +++ b/src/main/java/com/legacy/aether/blocks/container/BlockEnchanter.java @@ -23,138 +23,118 @@ import com.legacy.aether.tileentity.TileEntityEnchanter; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockEnchanter extends BlockAetherContainer -{ +public class BlockEnchanter extends BlockAetherContainer { - @SideOnly(Side.CLIENT) - private IIcon blockIconTop; + @SideOnly(Side.CLIENT) + private IIcon blockIconTop; - @SideOnly(Side.CLIENT) - private IIcon blockIconBottom; + @SideOnly(Side.CLIENT) + private IIcon blockIconBottom; - public BlockEnchanter() - { + public BlockEnchanter() { super(Material.rock); - this.setHardness(2.0F); + this.setHardness(2.0F); } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - this.blockIcon = registry.registerIcon(Aether.find("enchanter_side")); - this.blockIconTop = registry.registerIcon(Aether.find("enchanter_bottom")); - this.blockIconBottom = registry.registerIcon(Aether.find("enchanter_bottom")); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 1 ? this.blockIconTop : (side == 0 ? this.blockIconBottom : this.blockIcon); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - if (side == 1) - { - return this.blockIconTop; - } - else if (side == 0) - { - return this.blockIconBottom; - } - - return this.blockIcon; - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + this.blockIcon = registry.registerIcon(Aether.find("enchanter_side")); + this.blockIconTop = registry.registerIcon(Aether.find("enchanter_bottom")); + this.blockIconBottom = registry.registerIcon(Aether.find("enchanter_bottom")); + } @Override - public TileEntity createNewTileEntity(World worldIn, int meta) - { + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side == 1 ? this.blockIconTop : (side == 0 ? this.blockIconBottom : this.blockIcon); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + if (side == 1) { + return this.blockIconTop; + } else if (side == 0) { + return this.blockIconBottom; + } + + return this.blockIcon; + } + + @Override + public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityEnchanter(); } @Override - public Item getItemDropped(int meta, Random rand, int fortune) - { - return Item.getItemFromBlock(BlocksAether.enchanter); - } + public Item getItemDropped(int meta, Random rand, int fortune) { + return Item.getItemFromBlock(BlocksAether.enchanter); + } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random random) - { - if(world.getBlockMetadata(x, y, z) == 1) - { - float f = (float)x + 0.5F; - float f1 = (float)y + 1.0F + (random.nextFloat() * 6F) / 16F; - float f2 = (float)z + 0.5F; + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random random) { + if (world.getBlockMetadata(x, y, z) == 1) { + float f = (float) x + 0.5F; + float f1 = (float) y + 1.0F + (random.nextFloat() * 6F) / 16F; + float f2 = (float) z + 0.5F; world.spawnParticle("smoke", f, f1, f2, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f, f1, f2, 0.0D, 0.0D, 0.0D); } - } + } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) - { - player.openGui(Aether.instance, AetherGuiHandler.enchanter, world, x, y, z); + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + player.openGui(Aether.instance, AetherGuiHandler.enchanter, world, x, y, z); - return true; - } + return true; + } @Override - public void breakBlock(World worldIn, int x, int y, int z, Block block, int meta) - { - TileEntity tileentity = worldIn.getTileEntity(x, y, z); + public void breakBlock(World worldIn, int x, int y, int z, Block block, int meta) { + TileEntity tileentity = worldIn.getTileEntity(x, y, z); - if (tileentity instanceof TileEntityEnchanter) - { - TileEntityEnchanter tile = (TileEntityEnchanter) tileentity; + if (tileentity instanceof TileEntityEnchanter) { + TileEntityEnchanter tile = (TileEntityEnchanter) tileentity; - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { - ItemStack itemstack = tile.getStackInSlot(i1); + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { + ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = worldIn.rand.nextFloat() * 0.8F + 0.1F; - float f1 = worldIn.rand.nextFloat() * 0.8F + 0.1F; - float f2 = worldIn.rand.nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = worldIn.rand.nextFloat() * 0.8F + 0.1F; + float f1 = worldIn.rand.nextFloat() * 0.8F + 0.1F; + float f2 = worldIn.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = worldIn.rand.nextInt(21) + 10; + while (itemstack.stackSize > 0) { + int j1 = worldIn.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if (j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(worldIn, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(worldIn, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if (itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (double)((float)worldIn.rand.nextGaussian() * f3); - entityitem.motionY = (double)((float)worldIn.rand.nextGaussian() * f3 + 0.2F); - entityitem.motionZ = (double)((float)worldIn.rand.nextGaussian() * f3); - worldIn.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (double) ((float) worldIn.rand.nextGaussian() * f3); + entityitem.motionY = (double) ((float) worldIn.rand.nextGaussian() * f3 + 0.2F); + entityitem.motionZ = (double) ((float) worldIn.rand.nextGaussian() * f3); + worldIn.spawnEntityInWorld(entityitem); + } + } + } - worldIn.func_147453_f(x, y, z, this); - } + worldIn.func_147453_f(x, y, z, this); + } - super.breakBlock(worldIn, x, y, z, block, meta); - } + super.breakBlock(worldIn, x, y, z, block, meta); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/container/BlockFreezer.java b/src/main/java/com/legacy/aether/blocks/container/BlockFreezer.java index 76779e8..61354c2 100644 --- a/src/main/java/com/legacy/aether/blocks/container/BlockFreezer.java +++ b/src/main/java/com/legacy/aether/blocks/container/BlockFreezer.java @@ -23,138 +23,118 @@ import com.legacy.aether.tileentity.TileEntityFreezer; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockFreezer extends BlockAetherContainer -{ +public class BlockFreezer extends BlockAetherContainer { - @SideOnly(Side.CLIENT) - private IIcon blockIconTop; + @SideOnly(Side.CLIENT) + private IIcon blockIconTop; - @SideOnly(Side.CLIENT) - private IIcon blockIconBottom; + @SideOnly(Side.CLIENT) + private IIcon blockIconBottom; - public BlockFreezer() - { + public BlockFreezer() { super(Material.rock); this.setHardness(2.5F); } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - this.blockIcon = registry.registerIcon(Aether.find("freezer_side")); - this.blockIconTop = registry.registerIcon(Aether.find("freezer_top")); - this.blockIconBottom = registry.registerIcon(Aether.find("enchanter_bottom")); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 1 ? this.blockIconTop : (side == 0 ? this.blockIconBottom : this.blockIcon); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - if (side == 1) - { - return this.blockIconTop; - } - else if (side == 0) - { - return this.blockIconBottom; - } - - return this.blockIcon; - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + this.blockIcon = registry.registerIcon(Aether.find("freezer_side")); + this.blockIconTop = registry.registerIcon(Aether.find("freezer_top")); + this.blockIconBottom = registry.registerIcon(Aether.find("enchanter_bottom")); + } @Override - public TileEntity createNewTileEntity(World worldIn, int meta) - { + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side == 1 ? this.blockIconTop : (side == 0 ? this.blockIconBottom : this.blockIcon); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + if (side == 1) { + return this.blockIconTop; + } else if (side == 0) { + return this.blockIconBottom; + } + + return this.blockIcon; + } + + @Override + public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityFreezer(); } @Override - public Item getItemDropped(int meta, Random rand, int fortune) - { - return Item.getItemFromBlock(BlocksAether.freezer); - } + public Item getItemDropped(int meta, Random rand, int fortune) { + return Item.getItemFromBlock(BlocksAether.freezer); + } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) - { - player.openGui(Aether.instance, AetherGuiHandler.freezer, world, x, y, z); + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + player.openGui(Aether.instance, AetherGuiHandler.freezer, world, x, y, z); + + return true; + } - return true; - } - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random random) - { - if(world.getBlockMetadata(x, y, z) == 1) - { - float f = (float)x + 0.5F; - float f1 = (float)y + 1.0F + (random.nextFloat() * 6F) / 16F; - float f2 = (float)z + 0.5F; + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random random) { + if (world.getBlockMetadata(x, y, z) == 1) { + float f = (float) x + 0.5F; + float f1 = (float) y + 1.0F + (random.nextFloat() * 6F) / 16F; + float f2 = (float) z + 0.5F; world.spawnParticle("smoke", f, f1, f2, 0.0D, 0.0D, 0.0D); world.spawnParticle("snowshovel", f, f1, f2, 0.0D, 0.0D, 0.0D); } - } + } @Override - public void breakBlock(World worldIn, int x, int y, int z, Block block, int meta) - { - TileEntity tileentity = worldIn.getTileEntity(x, y, z); + public void breakBlock(World worldIn, int x, int y, int z, Block block, int meta) { + TileEntity tileentity = worldIn.getTileEntity(x, y, z); - if (tileentity instanceof TileEntityFreezer) - { - TileEntityFreezer tile = (TileEntityFreezer) tileentity; + if (tileentity instanceof TileEntityFreezer) { + TileEntityFreezer tile = (TileEntityFreezer) tileentity; - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { - ItemStack itemstack = tile.getStackInSlot(i1); + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { + ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = worldIn.rand.nextFloat() * 0.8F + 0.1F; - float f1 = worldIn.rand.nextFloat() * 0.8F + 0.1F; - float f2 = worldIn.rand.nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = worldIn.rand.nextFloat() * 0.8F + 0.1F; + float f1 = worldIn.rand.nextFloat() * 0.8F + 0.1F; + float f2 = worldIn.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = worldIn.rand.nextInt(21) + 10; + while (itemstack.stackSize > 0) { + int j1 = worldIn.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if (j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(worldIn, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(worldIn, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if (itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (double)((float)worldIn.rand.nextGaussian() * f3); - entityitem.motionY = (double)((float)worldIn.rand.nextGaussian() * f3 + 0.2F); - entityitem.motionZ = (double)((float)worldIn.rand.nextGaussian() * f3); - worldIn.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (double) ((float) worldIn.rand.nextGaussian() * f3); + entityitem.motionY = (double) ((float) worldIn.rand.nextGaussian() * f3 + 0.2F); + entityitem.motionZ = (double) ((float) worldIn.rand.nextGaussian() * f3); + worldIn.spawnEntityInWorld(entityitem); + } + } + } - worldIn.func_147453_f(x, y, z, this); - } + worldIn.func_147453_f(x, y, z, this); + } - super.breakBlock(worldIn, x, y, z, block, meta); - } + super.breakBlock(worldIn, x, y, z, block, meta); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/container/BlockIncubator.java b/src/main/java/com/legacy/aether/blocks/container/BlockIncubator.java index 728c03c..b058be2 100644 --- a/src/main/java/com/legacy/aether/blocks/container/BlockIncubator.java +++ b/src/main/java/com/legacy/aether/blocks/container/BlockIncubator.java @@ -23,138 +23,118 @@ import com.legacy.aether.tileentity.TileEntityIncubator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockIncubator extends BlockAetherContainer -{ +public class BlockIncubator extends BlockAetherContainer { - @SideOnly(Side.CLIENT) - private IIcon blockIconTop; + @SideOnly(Side.CLIENT) + private IIcon blockIconTop; - @SideOnly(Side.CLIENT) - private IIcon blockIconBottom; + @SideOnly(Side.CLIENT) + private IIcon blockIconBottom; - public BlockIncubator() - { + public BlockIncubator() { super(Material.rock); this.setHardness(2.0F); } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - this.blockIcon = registry.registerIcon(Aether.find("incubator_side")); - this.blockIconTop = registry.registerIcon(Aether.find("incubator_top")); - this.blockIconBottom = registry.registerIcon(Aether.find("enchanter_bottom")); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 1 ? this.blockIconTop : (side == 0 ? this.blockIconBottom : this.blockIcon); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - if (side == 1) - { - return this.blockIconTop; - } - else if (side == 0) - { - return this.blockIconBottom; - } - - return this.blockIcon; - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + this.blockIcon = registry.registerIcon(Aether.find("incubator_side")); + this.blockIconTop = registry.registerIcon(Aether.find("incubator_top")); + this.blockIconBottom = registry.registerIcon(Aether.find("enchanter_bottom")); + } @Override - public TileEntity createNewTileEntity(World worldIn, int meta) - { + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side == 1 ? this.blockIconTop : (side == 0 ? this.blockIconBottom : this.blockIcon); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + if (side == 1) { + return this.blockIconTop; + } else if (side == 0) { + return this.blockIconBottom; + } + + return this.blockIcon; + } + + @Override + public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityIncubator(); } @Override - public Item getItemDropped(int meta, Random rand, int fortune) - { - return Item.getItemFromBlock(BlocksAether.incubator); - } + public Item getItemDropped(int meta, Random rand, int fortune) { + return Item.getItemFromBlock(BlocksAether.incubator); + } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random random) - { - if(world.getBlockMetadata(x, y, z) == 1) - { - float f = (float)x + 0.5F; - float f1 = (float)y + 1.0F + (random.nextFloat() * 6F) / 16F; - float f2 = (float)z + 0.5F; + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random random) { + if (world.getBlockMetadata(x, y, z) == 1) { + float f = (float) x + 0.5F; + float f1 = (float) y + 1.0F + (random.nextFloat() * 6F) / 16F; + float f2 = (float) z + 0.5F; world.spawnParticle("smoke", f, f1, f2, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f, f1, f2, 0.0D, 0.0D, 0.0D); } - } + } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) - { - player.openGui(Aether.instance, AetherGuiHandler.incubator, world, x, y, z); + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + player.openGui(Aether.instance, AetherGuiHandler.incubator, world, x, y, z); - return true; - } + return true; + } @Override - public void breakBlock(World worldIn, int x, int y, int z, Block block, int meta) - { - TileEntity tileentity = worldIn.getTileEntity(x, y, z); + public void breakBlock(World worldIn, int x, int y, int z, Block block, int meta) { + TileEntity tileentity = worldIn.getTileEntity(x, y, z); - if (tileentity instanceof TileEntityIncubator) - { - TileEntityIncubator tile = (TileEntityIncubator) tileentity; + if (tileentity instanceof TileEntityIncubator) { + TileEntityIncubator tile = (TileEntityIncubator) tileentity; - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { - ItemStack itemstack = tile.getStackInSlot(i1); + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { + ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = worldIn.rand.nextFloat() * 0.8F + 0.1F; - float f1 = worldIn.rand.nextFloat() * 0.8F + 0.1F; - float f2 = worldIn.rand.nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = worldIn.rand.nextFloat() * 0.8F + 0.1F; + float f1 = worldIn.rand.nextFloat() * 0.8F + 0.1F; + float f2 = worldIn.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = worldIn.rand.nextInt(21) + 10; + while (itemstack.stackSize > 0) { + int j1 = worldIn.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if (j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(worldIn, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(worldIn, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if (itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (double)((float)worldIn.rand.nextGaussian() * f3); - entityitem.motionY = (double)((float)worldIn.rand.nextGaussian() * f3 + 0.2F); - entityitem.motionZ = (double)((float)worldIn.rand.nextGaussian() * f3); - worldIn.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (double) ((float) worldIn.rand.nextGaussian() * f3); + entityitem.motionY = (double) ((float) worldIn.rand.nextGaussian() * f3 + 0.2F); + entityitem.motionZ = (double) ((float) worldIn.rand.nextGaussian() * f3); + worldIn.spawnEntityInWorld(entityitem); + } + } + } - worldIn.func_147453_f(x, y, z, this); - } + worldIn.func_147453_f(x, y, z, this); + } - super.breakBlock(worldIn, x, y, z, block, meta); - } + super.breakBlock(worldIn, x, y, z, block, meta); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/container/BlockSunAltar.java b/src/main/java/com/legacy/aether/blocks/container/BlockSunAltar.java index bfd6d26..b18964b 100644 --- a/src/main/java/com/legacy/aether/blocks/container/BlockSunAltar.java +++ b/src/main/java/com/legacy/aether/blocks/container/BlockSunAltar.java @@ -17,69 +17,56 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockSunAltar extends Block -{ +public class BlockSunAltar extends Block { - @SideOnly(Side.CLIENT) - private IIcon blockIconTop; + @SideOnly(Side.CLIENT) + private IIcon blockIconTop; - public BlockSunAltar() - { + public BlockSunAltar() { super(Material.rock); this.setHardness(2.5F); this.setStepSound(soundTypeMetal); } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - this.blockIcon = registry.registerIcon(Aether.find("sun_altar_side")); - this.blockIconTop = registry.registerIcon(Aether.find("sun_altar_top")); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 1 ? this.blockIconTop : (side == 0 ? BlocksAether.hellfire_stone.getBlockTextureFromSide(side) : this.blockIcon); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - if (side == 1) - { - return this.blockIconTop; - } - else if (side == 0) - { - return BlocksAether.hellfire_stone.getBlockTextureFromSide(side); - } - - return this.blockIcon; - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + this.blockIcon = registry.registerIcon(Aether.find("sun_altar_side")); + this.blockIconTop = registry.registerIcon(Aether.find("sun_altar_top")); + } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) - { + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side == 1 ? this.blockIconTop : (side == 0 ? BlocksAether.hellfire_stone.getBlockTextureFromSide(side) : this.blockIcon); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + if (side == 1) { + return this.blockIconTop; + } else if (side == 0) { + return BlocksAether.hellfire_stone.getBlockTextureFromSide(side); + } + + return this.blockIcon; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); - if (server != null && ((server.isDedicatedServer() && server.getConfigurationManager().func_152596_g(player.getGameProfile()) && player.capabilities.isCreativeMode) || !server.isDedicatedServer())) - { + if (server != null && ((server.isDedicatedServer() && server.getConfigurationManager().func_152596_g(player.getGameProfile()) && player.capabilities.isCreativeMode) || !server.isDedicatedServer())) { Aether.proxy.openSunAltar(); - } - else if (world.isRemote) - { - if (player instanceof EntityPlayerSP && player.capabilities.isCreativeMode) - { + } else if (world.isRemote) { + if (player instanceof EntityPlayerSP && player.capabilities.isCreativeMode) { Aether.proxy.openSunAltar(); } } return true; - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockAerogel.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockAerogel.java index 84700eb..63b3f55 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockAerogel.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockAerogel.java @@ -8,11 +8,9 @@ import com.legacy.aether.Aether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockAerogel extends BlockBreakable -{ +public class BlockAerogel extends BlockBreakable { - public BlockAerogel() - { + public BlockAerogel() { super(Aether.find("aerogel"), Material.rock, false); this.setHardness(1.0F); @@ -23,16 +21,14 @@ public class BlockAerogel extends BlockBreakable } @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { - return 1; - } + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 1; + } @Override - public boolean renderAsNormalBlock() - { - return true; - } + public boolean renderAsNormalBlock() { + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherFence.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherFence.java index 1a9bb52..69e4db1 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherFence.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherFence.java @@ -10,11 +10,9 @@ import net.minecraft.world.World; import com.legacy.aether.Aether; import com.legacy.aether.blocks.BlocksAether; -public class BlockAetherFence extends BlockFence -{ +public class BlockAetherFence extends BlockFence { - public BlockAetherFence() - { + public BlockAetherFence() { super(Aether.find("skyroot_planks"), Material.wood); this.setHardness(2.0F); @@ -23,16 +21,14 @@ public class BlockAetherFence extends BlockFence } @Override - public boolean canPlaceTorchOnTop(World world, int x, int y, int z) - { - return true; - } + public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { + return true; + } @Override - public boolean canConnectFenceTo(IBlockAccess p_149826_1_, int p_149826_2_, int p_149826_3_, int p_149826_4_) - { - Block block = p_149826_1_.getBlock(p_149826_2_, p_149826_3_, p_149826_4_); - return block != this && block != Blocks.fence_gate && block != BlocksAether.skyroot_fence_gate ? (block.getMaterial().isOpaque() && block.renderAsNormalBlock() ? block.getMaterial() != Material.gourd : false) : true; - } + public boolean canConnectFenceTo(IBlockAccess p_149826_1_, int p_149826_2_, int p_149826_3_, int p_149826_4_) { + Block block = p_149826_1_.getBlock(p_149826_2_, p_149826_3_, p_149826_4_); + return block != this && block != Blocks.fence_gate && block != BlocksAether.skyroot_fence_gate ? (block.getMaterial().isOpaque() && block.renderAsNormalBlock() ? block.getMaterial() != Material.gourd : false) : true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherFenceGate.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherFenceGate.java index 0762016..8031f7e 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherFenceGate.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherFenceGate.java @@ -9,11 +9,9 @@ import com.legacy.aether.blocks.BlocksAether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockAetherFenceGate extends BlockFenceGate -{ +public class BlockAetherFenceGate extends BlockFenceGate { - public BlockAetherFenceGate() - { + public BlockAetherFenceGate() { super(); this.setHardness(2.0F); @@ -23,10 +21,9 @@ public class BlockAetherFenceGate extends BlockFenceGate } @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { - return BlocksAether.skyroot_planks.getBlockTextureFromSide(p_149691_1_); - } + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int p_149691_2_) { + return BlocksAether.skyroot_planks.getBlockTextureFromSide(p_149691_1_); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherSlab.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherSlab.java index bd3a7c8..3e0bfb4 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherSlab.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherSlab.java @@ -10,53 +10,55 @@ import net.minecraft.world.World; import com.legacy.aether.blocks.BlocksAether; -public class BlockAetherSlab extends BlockSlab -{ +public class BlockAetherSlab extends BlockSlab { private String name; - public BlockAetherSlab(String name, boolean double_slab, Material materialIn) - { + public BlockAetherSlab(String name, boolean double_slab, Material materialIn) { super(double_slab, materialIn); this.name = name; - this.setLightOpacity(0); + this.setLightOpacity(0); this.setStepSound(materialIn == Material.wood ? soundTypeWood : soundTypeStone); } @Override - public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) - { - return Item.getItemFromBlock(this.getDroppedSlab()); - } + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { + return Item.getItemFromBlock(this.getDroppedSlab()); + } - public Block getDroppedSlab() - { - if (this == BlocksAether.skyroot_double_slab) { return BlocksAether.skyroot_slab; } - else if (this == BlocksAether.carved_double_slab) { return BlocksAether.carved_slab; } - else if (this == BlocksAether.angelic_double_slab) { return BlocksAether.angelic_slab; } - else if (this == BlocksAether.hellfire_double_slab) { return BlocksAether.hellfire_slab; } - else if (this == BlocksAether.holystone_brick_double_slab) { return BlocksAether.holystone_brick_slab; } - else if (this == BlocksAether.holystone_double_slab) { return BlocksAether.holystone_slab; } - else if (this == BlocksAether.mossy_holystone_double_slab) { return BlocksAether.mossy_holystone_slab; } - else { return this; } - } + public Block getDroppedSlab() { + if (this == BlocksAether.skyroot_double_slab) { + return BlocksAether.skyroot_slab; + } else if (this == BlocksAether.carved_double_slab) { + return BlocksAether.carved_slab; + } else if (this == BlocksAether.angelic_double_slab) { + return BlocksAether.angelic_slab; + } else if (this == BlocksAether.hellfire_double_slab) { + return BlocksAether.hellfire_slab; + } else if (this == BlocksAether.holystone_brick_double_slab) { + return BlocksAether.holystone_brick_slab; + } else if (this == BlocksAether.holystone_double_slab) { + return BlocksAether.holystone_slab; + } else if (this == BlocksAether.mossy_holystone_double_slab) { + return BlocksAether.mossy_holystone_slab; + } else { + return this; + } + } @Override - public Item getItemDropped(int meta, Random rand, int fortune) - { - return Item.getItemFromBlock(this.getDroppedSlab()); - } + public Item getItemDropped(int meta, Random rand, int fortune) { + return Item.getItemFromBlock(this.getDroppedSlab()); + } @Override - public int damageDropped(int meta) - { - return 0; - } + public int damageDropped(int meta) { + return 0; + } @Override - public String func_150002_b(int meta) - { + public String func_150002_b(int meta) { return this.name; } diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherStairs.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherStairs.java index 1c85676..6f57f8d 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherStairs.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherStairs.java @@ -3,11 +3,9 @@ package com.legacy.aether.blocks.decorative; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs; -public class BlockAetherStairs extends BlockStairs -{ +public class BlockAetherStairs extends BlockStairs { - public BlockAetherStairs(Block block) - { + public BlockAetherStairs(Block block) { super(block, 0); this.setLightOpacity(0); diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherWall.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherWall.java index 7f53b3a..0d2cffa 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherWall.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockAetherWall.java @@ -12,36 +12,31 @@ import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockAetherWall extends BlockWall -{ +public class BlockAetherWall extends BlockWall { private Block block; - public BlockAetherWall(Block block) - { + public BlockAetherWall(Block block) { super(block); this.block = block; } @Override - public boolean canPlaceTorchOnTop(World world, int x, int y, int z) - { - return true; - } + public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { + return true; + } @Override @SideOnly(Side.CLIENT) - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) - { - p_149666_3_.add(new ItemStack(p_149666_1_, 1, 0)); - } + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { + p_149666_3_.add(new ItemStack(p_149666_1_, 1, 0)); + } @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { - return this.block.getBlockTextureFromSide(p_149691_1_); - } + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int p_149691_2_) { + return this.block.getBlockTextureFromSide(p_149691_1_); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockAmbrosiumTorch.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockAmbrosiumTorch.java index db7f0e7..ccc7be4 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockAmbrosiumTorch.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockAmbrosiumTorch.java @@ -2,16 +2,14 @@ package com.legacy.aether.blocks.decorative; import net.minecraft.block.BlockTorch; -public class BlockAmbrosiumTorch extends BlockTorch -{ +public class BlockAmbrosiumTorch extends BlockTorch { - public BlockAmbrosiumTorch() - { - super(); + public BlockAmbrosiumTorch() { + super(); - this.setTickRandomly(true); - this.setLightLevel(0.9375F); - this.setStepSound(soundTypeWood); - } + this.setTickRandomly(true); + this.setLightLevel(0.9375F); + this.setStepSound(soundTypeWood); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockPresent.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockPresent.java index c3d182a..791d4f9 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockPresent.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockPresent.java @@ -17,14 +17,12 @@ import com.legacy.aether.items.ItemsAether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockPresent extends Block -{ +public class BlockPresent extends Block { - @SideOnly(Side.CLIENT) - private IIcon blockIconTop; + @SideOnly(Side.CLIENT) + private IIcon blockIconTop; - public BlockPresent() - { + public BlockPresent() { super(Material.grass); this.setHardness(0.6F); @@ -32,75 +30,58 @@ public class BlockPresent extends Block this.setBlockTextureName(Aether.find("present_side")); } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - super.registerBlockIcons(registry); + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + super.registerBlockIcons(registry); - this.blockIconTop = registry.registerIcon(Aether.find("present_top")); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return (side == 1 || side == 0) ? this.blockIconTop : this.blockIcon; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - if (side == 1 || side == 0) - { - return this.blockIconTop; - } - - return this.blockIcon; - } + this.blockIconTop = registry.registerIcon(Aether.find("present_top")); + } @Override - public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) - { + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return (side == 1 || side == 0) ? this.blockIconTop : this.blockIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + if (side == 1 || side == 0) { + return this.blockIconTop; + } + + return this.blockIcon; + } + + @Override + public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { int randomNumber = (int) (((9 - 6 + 1) * world.rand.nextDouble()) + 6); int crateType = world.rand.nextInt(4); - if (crateType == 0) - { - for (int size = 1; size <= randomNumber; ++size) - { - if (!world.isRemote) - { + if (crateType == 0) { + for (int size = 1; size <= randomNumber; ++size) { + if (!world.isRemote) { world.spawnEntityInWorld(new EntityXPOrb(world, x, y, z, size)); } } - } - else if (crateType == 1) - { - if (world.rand.nextInt(9) == 0) - { + } else if (crateType == 1) { + if (world.rand.nextInt(9) == 0) { this.dropBlockAsItem(world, x, y, z, new ItemStack(ItemsAether.candy_cane_sword)); - } - else - { - for (int size = 1; size <= randomNumber; ++size) - { + } else { + for (int size = 1; size <= randomNumber; ++size) { this.dropBlockAsItem(world, x, y, z, new ItemStack(ItemsAether.gingerbread_man)); } } - } - else - { + } else { EntityTNTPresent present = new EntityTNTPresent(world, x, y, z); - - if (!world.isRemote) - { + + if (!world.isRemote) { world.spawnEntityInWorld(present); } world.playSoundAtEntity(present, "game.tnt.primed", 1.0F, 1.0F); } - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockQuicksoilGlass.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockQuicksoilGlass.java index cd9512f..f5d8031 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockQuicksoilGlass.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockQuicksoilGlass.java @@ -10,11 +10,9 @@ import com.legacy.aether.Aether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockQuicksoilGlass extends BlockBreakable -{ +public class BlockQuicksoilGlass extends BlockBreakable { - public BlockQuicksoilGlass() - { + public BlockQuicksoilGlass() { super(Aether.find("quicksoil_glass"), Material.glass, false); this.slipperiness = 1.1F; @@ -26,28 +24,24 @@ public class BlockQuicksoilGlass extends BlockBreakable } @Override - public int quantityDropped(Random random) - { - return 0; - } + public int quantityDropped(Random random) { + return 0; + } @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { - return 1; - } + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 1; + } @Override - public boolean renderAsNormalBlock() - { - return true; - } + public boolean renderAsNormalBlock() { + return true; + } @Override - protected boolean canSilkHarvest() - { - return true; - } + protected boolean canSilkHarvest() { + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockSkyrootBookshelf.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockSkyrootBookshelf.java index df62a73..4d203ea 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockSkyrootBookshelf.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockSkyrootBookshelf.java @@ -15,42 +15,36 @@ import com.legacy.aether.blocks.BlocksAether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockSkyrootBookshelf extends Block -{ +public class BlockSkyrootBookshelf extends Block { - public BlockSkyrootBookshelf() - { - super(Material.wood); - - this.setHardness(2F); + public BlockSkyrootBookshelf() { + super(Material.wood); + + this.setHardness(2F); this.setResistance(5F); this.setHarvestLevel("axe", 0); this.setStepSound(soundTypeWood); this.setBlockTextureName(Aether.find("skyroot_bookshelf")); - } + } - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { - return p_149691_1_ != 1 && p_149691_1_ != 0 ? super.getIcon(p_149691_1_, p_149691_2_) : BlocksAether.skyroot_planks.getBlockTextureFromSide(p_149691_1_); - } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int p_149691_2_) { + return p_149691_1_ != 1 && p_149691_1_ != 0 ? super.getIcon(p_149691_1_, p_149691_2_) : BlocksAether.skyroot_planks.getBlockTextureFromSide(p_149691_1_); + } - @Override - public int quantityDropped(Random random) - { - return 3; - } - - @Override - public float getEnchantPowerBonus(World world, int x, int y, int z) - { + @Override + public int quantityDropped(Random random) { + return 3; + } + + @Override + public float getEnchantPowerBonus(World world, int x, int y, int z) { return 1; } - @Override - public Item getItemDropped(int meta, Random rand, int fortune) - { - return Items.book; - } + @Override + public Item getItemDropped(int meta, Random rand, int fortune) { + return Items.book; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockSkyrootPlanks.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockSkyrootPlanks.java index c13ca51..ee7b62d 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockSkyrootPlanks.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockSkyrootPlanks.java @@ -5,11 +5,9 @@ import net.minecraft.block.material.Material; import com.legacy.aether.Aether; -public class BlockSkyrootPlanks extends Block -{ +public class BlockSkyrootPlanks extends Block { - public BlockSkyrootPlanks() - { + public BlockSkyrootPlanks() { super(Material.wood); this.setHardness(2F); diff --git a/src/main/java/com/legacy/aether/blocks/decorative/BlockZanite.java b/src/main/java/com/legacy/aether/blocks/decorative/BlockZanite.java index 97f7f5f..ceaa76c 100644 --- a/src/main/java/com/legacy/aether/blocks/decorative/BlockZanite.java +++ b/src/main/java/com/legacy/aether/blocks/decorative/BlockZanite.java @@ -6,11 +6,9 @@ import net.minecraft.world.IBlockAccess; import com.legacy.aether.Aether; -public class BlockZanite extends Block -{ +public class BlockZanite extends Block { - public BlockZanite() - { + public BlockZanite() { super(Material.iron); this.setHardness(3F); @@ -20,9 +18,8 @@ public class BlockZanite extends Block } @Override - public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) - { - return true; - } + public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/dungeon/BlockDungeonBase.java b/src/main/java/com/legacy/aether/blocks/dungeon/BlockDungeonBase.java index 7ee6692..4498970 100644 --- a/src/main/java/com/legacy/aether/blocks/dungeon/BlockDungeonBase.java +++ b/src/main/java/com/legacy/aether/blocks/dungeon/BlockDungeonBase.java @@ -10,24 +10,20 @@ import net.minecraft.world.World; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class BlockDungeonBase extends Block -{ +public class BlockDungeonBase extends Block { private Block pickBlock; private boolean isLit; - public BlockDungeonBase(boolean isLit) - { + public BlockDungeonBase(boolean isLit) { this(null, isLit); } - public BlockDungeonBase(Block pickBlock, boolean isLit) - { + public BlockDungeonBase(Block pickBlock, boolean isLit) { super(Material.rock); - if (pickBlock != null) - { + if (pickBlock != null) { this.pickBlock = pickBlock; this.setResistance(6000000.0F); } @@ -39,36 +35,30 @@ public class BlockDungeonBase extends Block } @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) - { - Block block = world.getBlock(x, y, z); - - if (block != this) - { - return block.getLightValue(world, x, y, z); - } + public int getLightValue(IBlockAccess world, int x, int y, int z) { + Block block = world.getBlock(x, y, z); - if (this.isLit) - { - return (int)(15.0F * 0.75f); - } + if (block != this) { + return block.getLightValue(world, x, y, z); + } - return super.getLightValue(world, x, y, z); - } + if (this.isLit) { + return (int) (15.0F * 0.75f); + } + + return super.getLightValue(world, x, y, z); + } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) - { - if (this.pickBlock != null) - { + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { + if (this.pickBlock != null) { return new ItemStack(this.pickBlock); } return super.getPickBlock(target, world, x, y, z, player); - } + } - public Block getUnlockedBlock() - { + public Block getUnlockedBlock() { return this.pickBlock == null ? this : this.pickBlock; } diff --git a/src/main/java/com/legacy/aether/blocks/dungeon/BlockDungeonTrap.java b/src/main/java/com/legacy/aether/blocks/dungeon/BlockDungeonTrap.java index d2cdda2..8821680 100644 --- a/src/main/java/com/legacy/aether/blocks/dungeon/BlockDungeonTrap.java +++ b/src/main/java/com/legacy/aether/blocks/dungeon/BlockDungeonTrap.java @@ -11,13 +11,11 @@ import com.legacy.aether.entities.bosses.EntityFireMinion; import com.legacy.aether.entities.bosses.EntityValkyrie; import com.legacy.aether.entities.hostile.EntitySentry; -public class BlockDungeonTrap extends Block -{ +public class BlockDungeonTrap extends Block { private Block pickBlock; - public BlockDungeonTrap(Block pickBlock) - { + public BlockDungeonTrap(Block pickBlock) { super(Material.rock); this.pickBlock = pickBlock; @@ -25,44 +23,34 @@ public class BlockDungeonTrap extends Block } @Override - public void onEntityWalking(World world, int x, int y, int z, Entity entityIn) - { - if (entityIn instanceof EntityPlayer) - { - world.setBlock(x, y, z, this.pickBlock); + public void onEntityWalking(World world, int x, int y, int z, Entity entityIn) { + if (entityIn instanceof EntityPlayer) { + world.setBlock(x, y, z, this.pickBlock); - if (this == BlocksAether.carved_trap) - { - EntitySentry sentry = new EntitySentry(world, x + 2D, y + 1D, z + 2D); + if (this == BlocksAether.carved_trap) { + EntitySentry sentry = new EntitySentry(world, x + 2D, y + 1D, z + 2D); - if (!world.isRemote) - { - world.spawnEntityInWorld(sentry); - } - } - else if (this == BlocksAether.angelic_trap) - { - EntityValkyrie valkyrie = new EntityValkyrie(world); - valkyrie.setPosition(x + 0.5D, y + 1D, z + 0.5D); + if (!world.isRemote) { + world.spawnEntityInWorld(sentry); + } + } else if (this == BlocksAether.angelic_trap) { + EntityValkyrie valkyrie = new EntityValkyrie(world); + valkyrie.setPosition(x + 0.5D, y + 1D, z + 0.5D); - if (!world.isRemote) - { - world.spawnEntityInWorld(valkyrie); - } - } - else if (this == BlocksAether.hellfire_trap) - { - EntityFireMinion minion = new EntityFireMinion(world); - minion.setPosition(x + 0.5D, y + 1D, z + 0.5D); + if (!world.isRemote) { + world.spawnEntityInWorld(valkyrie); + } + } else if (this == BlocksAether.hellfire_trap) { + EntityFireMinion minion = new EntityFireMinion(world); + minion.setPosition(x + 0.5D, y + 1D, z + 0.5D); - if (!world.isRemote) - { - world.spawnEntityInWorld(minion); - } - } + if (!world.isRemote) { + world.spawnEntityInWorld(minion); + } + } - world.playSoundEffect(x, y, z, "random.door_close", 2.0F, world.rand.nextFloat() - world.rand.nextFloat() * 0.2F + 1.2F); - } - } + world.playSoundEffect(x, y, z, "random.door_close", 2.0F, world.rand.nextFloat() - world.rand.nextFloat() * 0.2F + 1.2F); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/dungeon/BlockMimicChest.java b/src/main/java/com/legacy/aether/blocks/dungeon/BlockMimicChest.java index ceec74f..0157ff1 100644 --- a/src/main/java/com/legacy/aether/blocks/dungeon/BlockMimicChest.java +++ b/src/main/java/com/legacy/aether/blocks/dungeon/BlockMimicChest.java @@ -11,54 +11,45 @@ import net.minecraft.world.World; import com.legacy.aether.entities.hostile.EntityMimic; import com.legacy.aether.tileentity.TileEntityChestMimic; -public class BlockMimicChest extends BlockChest -{ +public class BlockMimicChest extends BlockChest { - public BlockMimicChest() - { + public BlockMimicChest() { super(13); this.setHardness(2.0F); } @Override - public TileEntity createNewTileEntity(World worldIn, int meta) - { - return new TileEntityChestMimic(); - } + public TileEntity createNewTileEntity(World worldIn, int meta) { + return new TileEntityChestMimic(); + } @Override - public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer playerIn, int side, float hitX, float hitY, float hitZ) - { + public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer playerIn, int side, float hitX, float hitY, float hitZ) { this.spawnMimic(worldIn, playerIn, x, y, z); - worldIn.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "random.chestopen", 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); + worldIn.playSoundEffect((double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, "random.chestopen", 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); return true; } @Override - public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) - { - this.spawnMimic(worldIn, player, x, y, z); - } + public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) { + this.spawnMimic(worldIn, player, x, y, z); + } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) - { - return new ItemStack(Blocks.chest); - } + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { + return new ItemStack(Blocks.chest); + } - private void spawnMimic(World world, EntityPlayer player, int x, int y, int z) - { - if (!world.isRemote) - { + private void spawnMimic(World world, EntityPlayer player, int x, int y, int z) { + if (!world.isRemote) { EntityMimic mimic = new EntityMimic(world); - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { mimic.setAttackTarget(player); } - mimic.setPosition((double)x + 0.5D, (double)y + 1.5D, (double)z + 0.5D); + mimic.setPosition((double) x + 0.5D, (double) y + 1.5D, (double) z + 0.5D); world.spawnEntityInWorld(mimic); } diff --git a/src/main/java/com/legacy/aether/blocks/dungeon/BlockPillar.java b/src/main/java/com/legacy/aether/blocks/dungeon/BlockPillar.java index b0dc253..cad4558 100644 --- a/src/main/java/com/legacy/aether/blocks/dungeon/BlockPillar.java +++ b/src/main/java/com/legacy/aether/blocks/dungeon/BlockPillar.java @@ -9,18 +9,16 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; -public class BlockPillar extends BlockRotatedPillar -{ +public class BlockPillar extends BlockRotatedPillar { private String topTexture; private String sideTexture; - @SideOnly(Side.CLIENT) - protected IIcon sideIcon; + @SideOnly(Side.CLIENT) + protected IIcon sideIcon; - public BlockPillar(String topIcon, String sideTexture) - { + public BlockPillar(String topIcon, String sideTexture) { super(Material.rock); this.topTexture = topIcon; @@ -32,18 +30,16 @@ public class BlockPillar extends BlockRotatedPillar } @Override - @SideOnly(Side.CLIENT) - protected IIcon getSideIcon(int meta) - { + @SideOnly(Side.CLIENT) + protected IIcon getSideIcon(int meta) { return this.sideIcon; } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - this.field_150164_N = registry.registerIcon(Aether.find(this.topTexture)); - this.sideIcon = registry.registerIcon(Aether.find(this.sideTexture)); - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + this.field_150164_N = registry.registerIcon(Aether.find(this.topTexture)); + this.sideIcon = registry.registerIcon(Aether.find(this.sideTexture)); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/dungeon/BlockTreasureChest.java b/src/main/java/com/legacy/aether/blocks/dungeon/BlockTreasureChest.java index e314b0e..ebe2e9c 100644 --- a/src/main/java/com/legacy/aether/blocks/dungeon/BlockTreasureChest.java +++ b/src/main/java/com/legacy/aether/blocks/dungeon/BlockTreasureChest.java @@ -18,70 +18,58 @@ import com.legacy.aether.tileentity.TileEntityTreasureChest; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockTreasureChest extends BlockChest -{ +public class BlockTreasureChest extends BlockChest { - public BlockTreasureChest() - { + public BlockTreasureChest() { super(56); this.setBlockUnbreakable(); } @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(Aether.find("carved_stone")); - } + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister p_149651_1_) { + this.blockIcon = p_149651_1_.registerIcon(Aether.find("carved_stone")); + } @Override - public TileEntity createNewTileEntity(World worldIn, int meta) - { - return new TileEntityTreasureChest(); - } + public TileEntity createNewTileEntity(World worldIn, int meta) { + return new TileEntityTreasureChest(); + } @Override - public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer playerIn, int side, float hitX, float hitY, float hitZ) - { - if (worldIn.isRemote) - { + public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer playerIn, int side, float hitX, float hitY, float hitZ) { + if (worldIn.isRemote) { return true; } - TileEntityTreasureChest treasurechest = (TileEntityTreasureChest)worldIn.getTileEntity(x, y, z); + TileEntityTreasureChest treasurechest = (TileEntityTreasureChest) worldIn.getTileEntity(x, y, z); - ItemStack guiID = playerIn.getCurrentEquippedItem(); + ItemStack guiID = playerIn.getCurrentEquippedItem(); - if (treasurechest.isLocked()) - { - if (guiID == null || guiID != null && guiID.getItem() != ItemsAether.dungeon_key) - { - return false; - } + if (treasurechest.isLocked()) { + if (guiID == null || guiID != null && guiID.getItem() != ItemsAether.dungeon_key) { + return false; + } - treasurechest.unlock(guiID.getItemDamage()); + treasurechest.unlock(guiID.getItemDamage()); - --guiID.stackSize; - } - else - { - playerIn.openGui(Aether.instance, AetherGuiHandler.treasure_chest, worldIn, x, y, z); - } + --guiID.stackSize; + } else { + playerIn.openGui(Aether.instance, AetherGuiHandler.treasure_chest, worldIn, x, y, z); + } - return true; - } + return true; + } @Override - public int quantityDropped(Random random) - { - return 0; - } + public int quantityDropped(Random random) { + return 0; + } @Override - public int getRenderType() - { - return CommonProxy.treasureChestRenderID; - } + public int getRenderType() { + return CommonProxy.treasureChestRenderID; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockAercloud.java b/src/main/java/com/legacy/aether/blocks/natural/BlockAercloud.java index 1009c51..e626c60 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockAercloud.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockAercloud.java @@ -21,11 +21,9 @@ import com.legacy.aether.registry.achievements.AchievementsAether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockAercloud extends Block implements IColoredBlock, INamedBlock -{ +public class BlockAercloud extends Block implements IColoredBlock, INamedBlock { - public BlockAercloud() - { + public BlockAercloud() { super(Material.ice); this.setHardness(0.2F); @@ -34,50 +32,39 @@ public class BlockAercloud extends Block implements IColoredBlock, INamedBlock } @SideOnly(Side.CLIENT) - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) - { - p_149666_3_.add(new ItemStack(this, 1, 0)); - p_149666_3_.add(new ItemStack(this, 1, 1)); - p_149666_3_.add(new ItemStack(this, 1, 2)); - } + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { + p_149666_3_.add(new ItemStack(this, 1, 0)); + p_149666_3_.add(new ItemStack(this, 1, 1)); + p_149666_3_.add(new ItemStack(this, 1, 2)); + } @Override - public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) - { - entity.fallDistance = 0; + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + entity.fallDistance = 0; - if (world.getBlockMetadata(x, y, z) == 1) - { - if (entity instanceof EntityPlayer) - { + if (world.getBlockMetadata(x, y, z) == 1) { + if (entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; player.triggerAchievement(AchievementsAether.blue_cloud); - if (player.isSneaking()) - { - if (entity.motionY < 0) - { - entity.motionY *= 0.005D; - } + if (player.isSneaking()) { + if (entity.motionY < 0) { + entity.motionY *= 0.005D; + } - return; + return; } entity.motionY = 2.0D; - } - else - { + } else { entity.motionY = 2.0D; } - if (world.isRemote) - { - if (!(entity instanceof net.minecraft.client.particle.EntityFX)) - { - for (int count = 0; count < 50; count++) - { + if (world.isRemote) { + if (!(entity instanceof net.minecraft.client.particle.EntityFX)) { + for (int count = 0; count < 50; count++) { double xOffset = x + world.rand.nextDouble(); double yOffset = y + world.rand.nextDouble(); double zOffset = z + world.rand.nextDouble(); @@ -86,106 +73,86 @@ public class BlockAercloud extends Block implements IColoredBlock, INamedBlock } } } - } - else if (entity.motionY < 0) - { + } else if (entity.motionY < 0) { entity.motionY *= 0.005D; - } + } } @Override - public boolean renderAsNormalBlock() - { - return true; - } + public boolean renderAsNormalBlock() { + return true; + } @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { - return 1; - } + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 1; + } @Override - public boolean isOpaqueCube() - { - return false; - } + public boolean isOpaqueCube() { + return false; + } @Override - public int damageDropped(int meta) - { - return meta; - } + public int damageDropped(int meta) { + return meta; + } @Override - @SideOnly(Side.CLIENT) - public int getRenderColor(int meta) - { - if (meta == 1) - { - return 0xCCFFFF; - } - else if (meta == 2) - { - return 0xFFFF80; - } + @SideOnly(Side.CLIENT) + public int getRenderColor(int meta) { + if (meta == 1) { + return 0xCCFFFF; + } else if (meta == 2) { + return 0xFFFF80; + } - return this.getBlockColor(); - } + return this.getBlockColor(); + } @Override - @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess world, int x, int y, int z) - { - int meta = world.getBlockMetadata(x, y, z); + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); - return this.getRenderColor(meta); - } + return this.getRenderColor(meta); + } @Override - public String getUnlocalizedName(ItemStack stack) - { + public String getUnlocalizedName(ItemStack stack) { return stack.getItemDamage() == 1 ? "blue_aercloud" : stack.getItemDamage() == 2 ? "golden_aercloud" : "cold_aercloud"; } @Override - public int getColorFromItemStack(ItemStack stack, int pass) - { - if (stack.getItemDamage() == 1) - { - return 0xCCFFFF; - } - else if (stack.getItemDamage() == 2) - { - return 0xFFFF80; - } + public int getColorFromItemStack(ItemStack stack, int pass) { + if (stack.getItemDamage() == 1) { + return 0xCCFFFF; + } else if (stack.getItemDamage() == 2) { + return 0xFFFF80; + } - return 0; + return 0; } @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) - { - Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_); + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { + Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_); - if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) - { - return true; - } + if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) { + return true; + } - if (block == this) - { - return false; - } + if (block == this) { + return false; + } - return super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); - } + return super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); + } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) - { + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return world.getBlockMetadata(x, y, z) != 1 ? AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0D, y + 0.01D, z + 1.0D) : AxisAlignedBB.getBoundingBox(x, y, z, x, y, z); } diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherDirt.java b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherDirt.java index 3de9c1c..7b19164 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherDirt.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherDirt.java @@ -7,11 +7,9 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class BlockAetherDirt extends Block -{ +public class BlockAetherDirt extends Block { - public BlockAetherDirt() - { + public BlockAetherDirt() { super(Material.ground); this.setHardness(0.2F); @@ -21,15 +19,13 @@ public class BlockAetherDirt extends Block } @Override - public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) - { + public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) { DoubleDropHelper.dropBlock(player, x, y, z, this, meta); } @Override - public int damageDropped(int meta) - { - return 1; - } + public int damageDropped(int meta) { + return 1; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherFlower.java b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherFlower.java index a00abb4..e3ee958 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherFlower.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherFlower.java @@ -8,13 +8,11 @@ import net.minecraft.world.World; import com.legacy.aether.CommonProxy; import com.legacy.aether.blocks.BlocksAether; -public class BlockAetherFlower extends BlockBush -{ +public class BlockAetherFlower extends BlockBush { - public AxisAlignedBB FLOWER_AABB = AxisAlignedBB.getBoundingBox(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D); + public AxisAlignedBB FLOWER_AABB = AxisAlignedBB.getBoundingBox(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D); - public BlockAetherFlower() - { + public BlockAetherFlower() { this.setHardness(0.0F); this.setTickRandomly(true); this.setStepSound(soundTypeGrass); @@ -22,23 +20,20 @@ public class BlockAetherFlower extends BlockBush } @Override - public boolean canPlaceBlockAt(World world, int x, int y, int z) - { - Block soil = world.getBlock(x, y - 1, z); + public boolean canPlaceBlockAt(World world, int x, int y, int z) { + Block soil = world.getBlock(x, y - 1, z); return soil == BlocksAether.aether_grass || soil == BlocksAether.aether_dirt || soil == BlocksAether.enchanted_aether_grass; } @Override - public boolean canBlockStay(World world, int x, int y, int z) - { + public boolean canBlockStay(World world, int x, int y, int z) { Block soil = world.getBlock(x, y - 1, z); return (soil != null && this.canPlaceBlockAt(world, x, y, z)); } @Override - public int getRenderType() - { - return CommonProxy.aetherFlowerRenderID; - } + public int getRenderType() { + return CommonProxy.aetherFlowerRenderID; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherGrass.java b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherGrass.java index fb197ac..0f3de2b 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherGrass.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherGrass.java @@ -23,14 +23,12 @@ import com.legacy.aether.world.AetherWorld; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockAetherGrass extends Block implements IGrowable -{ +public class BlockAetherGrass extends Block implements IGrowable { - @SideOnly(Side.CLIENT) - private IIcon blockIconTop; + @SideOnly(Side.CLIENT) + private IIcon blockIconTop; - public BlockAetherGrass() - { + public BlockAetherGrass() { super(Material.grass); this.setHardness(0.2F); @@ -40,152 +38,119 @@ public class BlockAetherGrass extends Block implements IGrowable } @Override - public void updateTick(World worldIn, int x, int y, int z, Random rand) - { - if (!worldIn.isRemote) - { - if (worldIn.getBlockLightValue(x, y + 1, z) < 4 && worldIn.getBlockLightOpacity(x, y + 1, z) > 2) - { - worldIn.setBlock(x, y, z, BlocksAether.aether_dirt); - } - else if (worldIn.getBlockLightValue(x, y + 1, z) >= 9) - { - for (int l = 0; l < 4; ++l) - { - int i1 = x + rand.nextInt(3) - 1; - int j1 = y + rand.nextInt(5) - 3; - int k1 = z + rand.nextInt(3) - 1; + public void updateTick(World worldIn, int x, int y, int z, Random rand) { + if (!worldIn.isRemote) { + if (worldIn.getBlockLightValue(x, y + 1, z) < 4 && worldIn.getBlockLightOpacity(x, y + 1, z) > 2) { + worldIn.setBlock(x, y, z, BlocksAether.aether_dirt); + } else if (worldIn.getBlockLightValue(x, y + 1, z) >= 9) { + for (int l = 0; l < 4; ++l) { + int i1 = x + rand.nextInt(3) - 1; + int j1 = y + rand.nextInt(5) - 3; + int k1 = z + rand.nextInt(3) - 1; - if (worldIn.getBlock(i1, j1, k1) == BlocksAether.aether_dirt && worldIn.getBlockMetadata(i1, j1, k1) == 0 && worldIn.getBlockLightValue(i1, j1 + 1, k1) >= 4 && worldIn.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) - { - worldIn.setBlock(i1, j1, k1, BlocksAether.aether_grass); - } - } - } - } - } + if (worldIn.getBlock(i1, j1, k1) == BlocksAether.aether_dirt && worldIn.getBlockMetadata(i1, j1, k1) == 0 && worldIn.getBlockLightValue(i1, j1 + 1, k1) >= 4 && worldIn.getBlockLightOpacity(i1, j1 + 1, k1) <= 2) { + worldIn.setBlock(i1, j1, k1, BlocksAether.aether_grass); + } + } + } + } + } @Override - public Item getItemDropped(int meta, Random random, int fortune) - { - return Item.getItemFromBlock(BlocksAether.aether_dirt); - } + public Item getItemDropped(int meta, Random random, int fortune) { + return Item.getItemFromBlock(BlocksAether.aether_dirt); + } @Override - public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) - { + public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) { DoubleDropHelper.dropBlock(player, x, y, z, this, meta); } @Override - public int damageDropped(int meta) - { - return 1; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - this.blockIcon = registry.registerIcon("aether_legacy:aether_grass_side"); - this.blockIconTop = registry.registerIcon("aether_legacy:aether_grass_top"); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 1 ? this.blockIconTop : (side == 0 ? BlocksAether.aether_dirt.getBlockTextureFromSide(side) : this.blockIcon); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - if (side == 1) - { - return this.blockIconTop; - } - else if (side == 0) - { - return BlocksAether.aether_dirt.getBlockTextureFromSide(side); - } - - return this.blockIcon; - } - - @Override - public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) - { - EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z); - - return plantType == EnumPlantType.Plains; - } + public int damageDropped(int meta) { + return 1; + } @Override - public boolean func_149851_a(World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_) - { - return true; - } + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + this.blockIcon = registry.registerIcon("aether_legacy:aether_grass_side"); + this.blockIconTop = registry.registerIcon("aether_legacy:aether_grass_top"); + } @Override - public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) - { - return true; - } + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side == 1 ? this.blockIconTop : (side == 0 ? BlocksAether.aether_dirt.getBlockTextureFromSide(side) : this.blockIcon); + } @Override - public void func_149853_b(World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_) - { - int l = 0; + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + if (side == 1) { + return this.blockIconTop; + } else if (side == 0) { + return BlocksAether.aether_dirt.getBlockTextureFromSide(side); + } - while (l < 128) - { - int i1 = p_149853_3_; - int j1 = p_149853_4_ + 1; - int k1 = p_149853_5_; - int l1 = 0; + return this.blockIcon; + } - while (true) - { - if (l1 < l / 16) - { - i1 += p_149853_2_.nextInt(3) - 1; - j1 += (p_149853_2_.nextInt(3) - 1) * p_149853_2_.nextInt(3) / 2; - k1 += p_149853_2_.nextInt(3) - 1; + @Override + public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) { + EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z); - if (p_149853_1_.getBlock(i1, j1 - 1, k1) == BlocksAether.aether_grass && !p_149853_1_.getBlock(i1, j1, k1).isNormalCube()) - { - ++l1; - continue; - } - } - else if (p_149853_1_.isAirBlock(i1, j1, k1)) - { - if (p_149853_2_.nextInt(8) != 0) - { - if (Blocks.tallgrass.canBlockStay(p_149853_1_, i1, j1, k1)) - { - p_149853_1_.setBlock(i1, j1, k1, Blocks.tallgrass, 1, 3); - } - } - else if (p_149853_2_.nextInt(12) == 0) - { - if (BlocksAether.berry_bush_stem.canBlockStay(p_149853_1_, i1, j1, k1)) - { - p_149853_1_.setBlock(i1, j1, k1, BlocksAether.berry_bush_stem, 0, 3); - } - } - else - { - AetherWorld.aether_biome.plantFlower(p_149853_1_, p_149853_2_, i1, j1, k1); - } - } + return plantType == EnumPlantType.Plains; + } - ++l; - break; - } - } + @Override + public boolean func_149851_a(World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_) { + return true; + } + + @Override + public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) { + return true; + } + + @Override + public void func_149853_b(World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_) { + int l = 0; + + while (l < 128) { + int i1 = p_149853_3_; + int j1 = p_149853_4_ + 1; + int k1 = p_149853_5_; + int l1 = 0; + + while (true) { + if (l1 < l / 16) { + i1 += p_149853_2_.nextInt(3) - 1; + j1 += (p_149853_2_.nextInt(3) - 1) * p_149853_2_.nextInt(3) / 2; + k1 += p_149853_2_.nextInt(3) - 1; + + if (p_149853_1_.getBlock(i1, j1 - 1, k1) == BlocksAether.aether_grass && !p_149853_1_.getBlock(i1, j1, k1).isNormalCube()) { + ++l1; + continue; + } + } else if (p_149853_1_.isAirBlock(i1, j1, k1)) { + if (p_149853_2_.nextInt(8) != 0) { + if (Blocks.tallgrass.canBlockStay(p_149853_1_, i1, j1, k1)) { + p_149853_1_.setBlock(i1, j1, k1, Blocks.tallgrass, 1, 3); + } + } else if (p_149853_2_.nextInt(12) == 0) { + if (BlocksAether.berry_bush_stem.canBlockStay(p_149853_1_, i1, j1, k1)) { + p_149853_1_.setBlock(i1, j1, k1, BlocksAether.berry_bush_stem, 0, 3); + } + } else { + AetherWorld.aether_biome.plantFlower(p_149853_1_, p_149853_2_, i1, j1, k1); + } + } + + ++l; + break; + } + } } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherLeaves.java b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherLeaves.java index 5be0022..09e24c1 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherLeaves.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherLeaves.java @@ -20,62 +20,51 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockAetherLeaves extends BlockLeaves -{ +public class BlockAetherLeaves extends BlockLeaves { - public BlockAetherLeaves() - { + public BlockAetherLeaves() { super(); } - @Override - @SideOnly(Side.CLIENT) - public int getBlockColor() - { - return 16777215; - } - - @Override - @SideOnly(Side.CLIENT) - public int getRenderColor(int meta) - { - return 16777215; - } - - @Override - @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess world, int x, int y, int z) - { - return 16777215; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isOpaqueCube() - { - return false; - } + @Override + @SideOnly(Side.CLIENT) + public int getBlockColor() { + return 16777215; + } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random rand) - { + @SideOnly(Side.CLIENT) + public int getRenderColor(int meta) { + return 16777215; + } + + @Override + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess world, int x, int y, int z) { + return 16777215; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean isOpaqueCube() { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random rand) { super.randomDisplayTick(world, x, y, z, rand); - if (!world.isRemote) - { + if (!world.isRemote) { return; } - if (net.minecraft.client.Minecraft.getMinecraft().gameSettings.particleSetting == 2) - { + if (net.minecraft.client.Minecraft.getMinecraft().gameSettings.particleSetting == 2) { return; } - if (this == BlocksAether.golden_oak_leaves) - { - for (int ammount = 0; ammount < 2; ammount++) - { + if (this == BlocksAether.golden_oak_leaves) { + for (int ammount = 0; ammount < 2; ammount++) { double d = x + (rand.nextFloat() - 0.5D) * 10; double d1 = y + (rand.nextFloat() - 0.5D) * 10; double d2 = z + (rand.nextFloat() - 0.5D) * 10; @@ -88,82 +77,70 @@ public class BlockAetherLeaves extends BlockLeaves } } - if (this == BlocksAether.holiday_leaves || this == BlocksAether.decorated_holiday_leaves) - { - if (rand.nextInt(5) == 0) - { - for (int l = 0; l < 6; ++l) - { - double d = (double)x + ((double)rand.nextFloat() - 0.5D) * 8.0D; - double d1 = (double)y + ((double)rand.nextFloat() - 0.5D) * 8.0D; - double d2 = (double)z + ((double)rand.nextFloat() - 0.5D) * 8.0D; - double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D; - double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D; - double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D; + if (this == BlocksAether.holiday_leaves || this == BlocksAether.decorated_holiday_leaves) { + if (rand.nextInt(5) == 0) { + for (int l = 0; l < 6; ++l) { + double d = (double) x + ((double) rand.nextFloat() - 0.5D) * 8.0D; + double d1 = (double) y + ((double) rand.nextFloat() - 0.5D) * 8.0D; + double d2 = (double) z + ((double) rand.nextFloat() - 0.5D) * 8.0D; + double d3 = ((double) rand.nextFloat() - 0.5D) * 0.5D; + double d4 = ((double) rand.nextFloat() - 0.5D) * 0.5D; + double d5 = ((double) rand.nextFloat() - 0.5D) * 0.5D; - ParticleHolidayLeaves particle = new ParticleHolidayLeaves(world, d, d1, d2, d3, d4, d5); - FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); - } - } + ParticleHolidayLeaves particle = new ParticleHolidayLeaves(world, d, d1, d2, d3, d4, d5); + FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); + } + } } - if (this == BlocksAether.crystal_leaves || this == BlocksAether.crystal_fruit_leaves) - { - if (rand.nextInt(5) == 0) - { - for (int l = 0; l < 6; ++l) - { - double d = (double)x + ((double)rand.nextFloat() - 0.5D) * 6.0D; - double d1 = (double)y + ((double)rand.nextFloat() - 0.5D) * 6.0D; - double d2 = (double)z + ((double)rand.nextFloat() - 0.5D) * 6.0D; - double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D; - double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D; - double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D; + if (this == BlocksAether.crystal_leaves || this == BlocksAether.crystal_fruit_leaves) { + if (rand.nextInt(5) == 0) { + for (int l = 0; l < 6; ++l) { + double d = (double) x + ((double) rand.nextFloat() - 0.5D) * 6.0D; + double d1 = (double) y + ((double) rand.nextFloat() - 0.5D) * 6.0D; + double d2 = (double) z + ((double) rand.nextFloat() - 0.5D) * 6.0D; + double d3 = ((double) rand.nextFloat() - 0.5D) * 0.5D; + double d4 = ((double) rand.nextFloat() - 0.5D) * 0.5D; + double d5 = ((double) rand.nextFloat() - 0.5D) * 0.5D; - ParticleCrystalLeaves particle = new ParticleCrystalLeaves(world, d, d1, d2, d3, d4, d5); - FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); - } - } + ParticleCrystalLeaves particle = new ParticleCrystalLeaves(world, d, d1, d2, d3, d4, d5); + FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); + } + } } } @Override - public Item getItemDropped(int meta, Random random, int fortune) - { - return this == BlocksAether.skyroot_leaves ? Item.getItemFromBlock(BlocksAether.skyroot_sapling) : this == BlocksAether.golden_oak_leaves ? Item.getItemFromBlock(BlocksAether.golden_oak_leaves) : null; - } - - @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) - { - ArrayList drops = super.getDrops(world, x, y, z, metadata, fortune); - - if (this == BlocksAether.crystal_fruit_leaves) - { - drops.add(new ItemStack(ItemsAether.white_apple)); - } - - return drops; - } + public Item getItemDropped(int meta, Random random, int fortune) { + return this == BlocksAether.skyroot_leaves ? Item.getItemFromBlock(BlocksAether.skyroot_sapling) : this == BlocksAether.golden_oak_leaves ? Item.getItemFromBlock(BlocksAether.golden_oak_leaves) : null; + } @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList drops = super.getDrops(world, x, y, z, metadata, fortune); + + if (this == BlocksAether.crystal_fruit_leaves) { + drops.add(new ItemStack(ItemsAether.white_apple)); + } + + return drops; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { return super.blockIcon; } @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) - { + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { return true; - } + } @Override - public String[] func_150125_e() - { - return new String[] { this.getUnlocalizedName() }; + public String[] func_150125_e() { + return new String[]{this.getUnlocalizedName()}; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherLog.java b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherLog.java index aa3a587..3cadbf0 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherLog.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherLog.java @@ -25,77 +25,60 @@ import com.legacy.aether.items.util.EnumAetherToolType; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockAetherLog extends BlockLog -{ +public class BlockAetherLog extends BlockLog { - public BlockAetherLog() - { + public BlockAetherLog() { super(); } @Override - public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) - { + public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) { player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1); - player.addExhaustion(0.025F); + player.addExhaustion(0.025F); - int size = meta == 0 ? 2 : 1; + int size = meta == 0 ? 2 : 1; - ItemStack stack = player.getCurrentEquippedItem(); + ItemStack stack = player.getCurrentEquippedItem(); - if (stack != null && ((stack.getItem() instanceof ItemAetherTool && ((ItemAetherTool)stack.getItem()).toolType == EnumAetherToolType.AXE) || stack.getItem() == Items.diamond_axe)) - { - if (stack.getItem() instanceof ItemGravititeTool || stack.getItem() instanceof ItemValkyrieTool || stack.getItem() == Items.diamond_axe) - { - if (this == BlocksAether.golden_oak_log) - { - this.dropBlockAsItem(worldIn, x, y, z, new ItemStack(ItemsAether.golden_amber, 1 + worldIn.rand.nextInt(2))); - } + if (stack != null && ((stack.getItem() instanceof ItemAetherTool && ((ItemAetherTool) stack.getItem()).toolType == EnumAetherToolType.AXE) || stack.getItem() == Items.diamond_axe)) { + if (stack.getItem() instanceof ItemGravititeTool || stack.getItem() instanceof ItemValkyrieTool || stack.getItem() == Items.diamond_axe) { + if (this == BlocksAether.golden_oak_log) { + this.dropBlockAsItem(worldIn, x, y, z, new ItemStack(ItemsAether.golden_amber, 1 + worldIn.rand.nextInt(2))); + } - this.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - } - else if (stack.getItem() instanceof ItemSkyrootTool) - { - for (int i = 0; i < size; ++i) - { - this.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - } - } - else - { - this.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - } - } - else - { - super.harvestBlock(worldIn, player, x, y, z, meta); - } + this.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); + } else if (stack.getItem() instanceof ItemSkyrootTool) { + for (int i = 0; i < size; ++i) { + this.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); + } + } else { + this.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); + } + } else { + super.harvestBlock(worldIn, player, x, y, z, meta); + } } @Override - public Item getItemDropped(int meta, Random random, int fortune) - { - return Item.getItemFromBlock(BlocksAether.skyroot_log); - } + public Item getItemDropped(int meta, Random random, int fortune) { + return Item.getItemFromBlock(BlocksAether.skyroot_log); + } @Override - public int damageDropped(int meta) - { - return 1; - } + public int damageDropped(int meta) { + return 1; + } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - this.field_150167_a = new IIcon[1]; - this.field_150166_b = new IIcon[1]; + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + this.field_150167_a = new IIcon[1]; + this.field_150166_b = new IIcon[1]; - for (int i = 0; i < this.field_150167_a.length; ++i) - { - this.field_150167_a[i] = registry.registerIcon(this.getTextureName() + "_side"); - this.field_150166_b[i] = registry.registerIcon(this.getTextureName() + "_top"); - } - } + for (int i = 0; i < this.field_150167_a.length; ++i) { + this.field_150167_a[i] = registry.registerIcon(this.getTextureName() + "_side"); + this.field_150166_b[i] = registry.registerIcon(this.getTextureName() + "_top"); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherOre.java b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherOre.java index fe36666..8f1d7bc 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockAetherOre.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockAetherOre.java @@ -20,11 +20,9 @@ import com.legacy.aether.items.tools.ItemAetherTool; import com.legacy.aether.items.tools.ItemSkyrootTool; import com.legacy.aether.items.util.EnumAetherToolType; -public class BlockAetherOre extends Block -{ +public class BlockAetherOre extends Block { - public BlockAetherOre(int level) - { + public BlockAetherOre(int level) { super(Material.rock); this.setHardness(3.0F); @@ -34,81 +32,64 @@ public class BlockAetherOre extends Block } @Override - public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) - { + public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) { player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1); - player.addExhaustion(0.025F); + player.addExhaustion(0.025F); - ItemStack stack = player.getCurrentEquippedItem(); + ItemStack stack = player.getCurrentEquippedItem(); - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0) - { - super.harvestBlock(worldIn, player, x, y, z, meta); + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0) { + super.harvestBlock(worldIn, player, x, y, z, meta); - return; - } + return; + } - if (stack != null && stack.getItem() instanceof ItemSkyrootTool && ((ItemAetherTool)stack.getItem()).toolType == EnumAetherToolType.PICKAXE) - { - for (int i = 0; i < 2; ++i) - { - this.dropBlockAsItem(worldIn, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - } - } - else - { - super.harvestBlock(worldIn, player, x, y, z, meta); - } + if (stack != null && stack.getItem() instanceof ItemSkyrootTool && ((ItemAetherTool) stack.getItem()).toolType == EnumAetherToolType.PICKAXE) { + for (int i = 0; i < 2; ++i) { + this.dropBlockAsItem(worldIn, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); + } + } else { + super.harvestBlock(worldIn, player, x, y, z, meta); + } } @Override - public Item getItemDropped(int meta, Random random, int fortune) - { - return this == BlocksAether.zanite_ore ? ItemsAether.zanite_gemstone : ItemsAether.ambrosium_shard; - } + public Item getItemDropped(int meta, Random random, int fortune) { + return this == BlocksAether.zanite_ore ? ItemsAether.zanite_gemstone : ItemsAether.ambrosium_shard; + } @Override - public int quantityDroppedWithBonus(int fortune, Random random) - { - if (fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, random, fortune)) - { - int j = random.nextInt(fortune + 2) - 1; + public int quantityDroppedWithBonus(int fortune, Random random) { + if (fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, random, fortune)) { + int j = random.nextInt(fortune + 2) - 1; - if (j < 0) - { - j = 0; - } + if (j < 0) { + j = 0; + } - return this.quantityDropped(random) * (j + 1); - } - else - { - return this.quantityDropped(random); - } - } + return this.quantityDropped(random) * (j + 1); + } else { + return this.quantityDropped(random); + } + } - @Override - public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_) - { - Random random = new Random(); + @Override + public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_) { + Random random = new Random(); - if (this.getItemDropped(p_149690_5_, random, p_149690_7_) != Item.getItemFromBlock(this)) - { - int amount = 0; + if (this.getItemDropped(p_149690_5_, random, p_149690_7_) != Item.getItemFromBlock(this)) { + int amount = 0; - if (this == BlocksAether.ambrosium_ore) - { - amount = MathHelper.getRandomIntegerInRange(random, 0, 2); - } - else if (this == BlocksAether.zanite_ore) - { - amount = MathHelper.getRandomIntegerInRange(random, 2, 5); - } + if (this == BlocksAether.ambrosium_ore) { + amount = MathHelper.getRandomIntegerInRange(random, 0, 2); + } else if (this == BlocksAether.zanite_ore) { + amount = MathHelper.getRandomIntegerInRange(random, 2, 5); + } - return amount; - } + return amount; + } - return 0; - } + return 0; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockBerryBush.java b/src/main/java/com/legacy/aether/blocks/natural/BlockBerryBush.java index ad510b0..46678df 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockBerryBush.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockBerryBush.java @@ -19,12 +19,10 @@ import com.legacy.aether.items.ItemsAether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockBerryBush extends BlockAetherFlower -{ +public class BlockBerryBush extends BlockAetherFlower { - public BlockBerryBush() - { - this.setHardness(0.2F); + public BlockBerryBush() { + this.setHardness(0.2F); this.setHarvestLevel("axe", 0); this.setStepSound(soundTypeGrass); this.setBlockTextureName(Aether.find("berry_bush")); @@ -32,29 +30,23 @@ public class BlockBerryBush extends BlockAetherFlower } @Override - public Item getItemDropped(int meta, Random rand, int fortune) - { + public Item getItemDropped(int meta, Random rand, int fortune) { return Item.getItemFromBlock(BlocksAether.berry_bush_stem); } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public void harvestBlock(World world, EntityPlayer entityplayer, int x, int y, int z, int meta) - { + public void harvestBlock(World world, EntityPlayer entityplayer, int x, int y, int z, int meta) { int min, max; - if (world.getBlock(x, y, z) == BlocksAether.enchanted_aether_grass) - { + if (world.getBlock(x, y, z) == BlocksAether.enchanted_aether_grass) { min = 1; max = 4; - } - else - { + } else { min = 1; max = 3; } @@ -65,53 +57,44 @@ public class BlockBerryBush extends BlockAetherFlower world.setBlock(x, y, z, BlocksAether.berry_bush_stem); - if (randomNum != 0) - { + if (randomNum != 0) { this.dropBlockAsItem(world, x, y, z, new ItemStack(ItemsAether.blueberry, randomNum, 0)); } } @Override - protected void checkAndDropBlock(World world, int x, int y, int z) - { - if(!this.canBlockStay(world, x, y, z)) - { - int min, max; + protected void checkAndDropBlock(World world, int x, int y, int z) { + if (!this.canBlockStay(world, x, y, z)) { + int min, max; - if (world.getBlock(x, y, z) == BlocksAether.enchanted_aether_grass) - { - min = 1; - max = 4; - } - else - { - min = 1; - max = 3; - } + if (world.getBlock(x, y, z) == BlocksAether.enchanted_aether_grass) { + min = 1; + max = 4; + } else { + min = 1; + max = 3; + } - int randomNum = world.rand.nextInt(max - min + 1) + min; - this.dropBlockAsItem(world, x, y, z, new ItemStack(ItemsAether.blueberry, randomNum, 0)); - world.setBlock(x, y, z, BlocksAether.berry_bush_stem); - } - } + int randomNum = world.rand.nextInt(max - min + 1) + min; + this.dropBlockAsItem(world, x, y, z, new ItemStack(ItemsAether.blueberry, randomNum, 0)); + world.setBlock(x, y, z, BlocksAether.berry_bush_stem); + } + } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) - { - return AxisAlignedBB.getBoundingBox((double)p_149668_2_ + this.minX, (double)p_149668_3_ + this.minY, (double)p_149668_4_ + this.minZ, (double)p_149668_2_ + this.maxX, (double)p_149668_3_ + this.maxY, (double)p_149668_4_ + this.maxZ); - } + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { + return AxisAlignedBB.getBoundingBox((double) p_149668_2_ + this.minX, (double) p_149668_3_ + this.minY, (double) p_149668_4_ + this.minZ, (double) p_149668_2_ + this.maxX, (double) p_149668_3_ + this.maxY, (double) p_149668_4_ + this.maxZ); + } @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) - { - return true; - } + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) { + return true; + } @Override - public int getRenderType() - { - return CommonProxy.berryBushRenderID; - } + public int getRenderType() { + return CommonProxy.berryBushRenderID; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockBerryBushStem.java b/src/main/java/com/legacy/aether/blocks/natural/BlockBerryBushStem.java index db21886..d539e28 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockBerryBushStem.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockBerryBushStem.java @@ -13,11 +13,9 @@ import com.legacy.aether.blocks.BlocksAether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockBerryBushStem extends BlockAetherFlower implements IGrowable -{ +public class BlockBerryBushStem extends BlockAetherFlower implements IGrowable { - public BlockBerryBushStem() - { + public BlockBerryBushStem() { this.setHardness(0.2F); this.setStepSound(soundTypeGrass); this.setBlockTextureName(Aether.find("berry_bush_stem")); @@ -25,48 +23,40 @@ public class BlockBerryBushStem extends BlockAetherFlower implements IGrowable } @Override - public void updateTick(World world, int x, int y, int z, Random random) - { - if (world.isRemote) - { + public void updateTick(World world, int x, int y, int z, Random random) { + if (world.isRemote) { return; } super.updateTick(world, x, y, z, random); - if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(60) == 0) - { + if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(60) == 0) { world.setBlock(x, y, z, BlocksAether.berry_bush); } } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) - { + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; } - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) - { - return true; - } - - @Override - public boolean func_149851_a(World world, int x, int y, int z, boolean isClient) - { + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) { return true; } @Override - public boolean func_149852_a(World world, Random random, int x, int y, int z) - { - return (double)random.nextFloat() < 0.45D; + public boolean func_149851_a(World world, int x, int y, int z, boolean isClient) { + return true; } @Override - public void func_149853_b(World world, Random random, int x, int y, int z) - { + public boolean func_149852_a(World world, Random random, int x, int y, int z) { + return (double) random.nextFloat() < 0.45D; + } + + @Override + public void func_149853_b(World world, Random random, int x, int y, int z) { world.setBlock(x, y, z, BlocksAether.berry_bush); } diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockEnchantedAetherGrass.java b/src/main/java/com/legacy/aether/blocks/natural/BlockEnchantedAetherGrass.java index dd13dd9..e537cae 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockEnchantedAetherGrass.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockEnchantedAetherGrass.java @@ -11,13 +11,11 @@ import com.legacy.aether.blocks.BlocksAether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockEnchantedAetherGrass extends Block -{ - @SideOnly(Side.CLIENT) - private IIcon blockIconTop; +public class BlockEnchantedAetherGrass extends Block { + @SideOnly(Side.CLIENT) + private IIcon blockIconTop; - public BlockEnchantedAetherGrass() - { + public BlockEnchantedAetherGrass() { super(Material.grass); this.setHardness(0.2F); @@ -25,35 +23,29 @@ public class BlockEnchantedAetherGrass extends Block this.setHarvestLevel("shovel", 0); } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - this.blockIcon = registry.registerIcon("aether_legacy:enchanted_aether_grass_side"); - this.blockIconTop = registry.registerIcon("aether_legacy:enchanted_aether_grass_top"); - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + this.blockIcon = registry.registerIcon("aether_legacy:enchanted_aether_grass_side"); + this.blockIconTop = registry.registerIcon("aether_legacy:enchanted_aether_grass_top"); + } - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 1 ? this.blockIconTop : (side == 0 ? BlocksAether.aether_dirt.getBlockTextureFromSide(side) : this.blockIcon); - } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side == 1 ? this.blockIconTop : (side == 0 ? BlocksAether.aether_dirt.getBlockTextureFromSide(side) : this.blockIcon); + } - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - if (side == 1) - { - return this.blockIconTop; - } - else if (side == 0) - { - return BlocksAether.aether_dirt.getBlockTextureFromSide(side); - } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + if (side == 1) { + return this.blockIconTop; + } else if (side == 0) { + return BlocksAether.aether_dirt.getBlockTextureFromSide(side); + } - return this.blockIcon; - } + return this.blockIcon; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockHolystone.java b/src/main/java/com/legacy/aether/blocks/natural/BlockHolystone.java index e089249..8326bef 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockHolystone.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockHolystone.java @@ -7,11 +7,9 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class BlockHolystone extends Block -{ +public class BlockHolystone extends Block { - public BlockHolystone() - { + public BlockHolystone() { super(Material.rock); this.setHardness(0.5F); @@ -21,15 +19,13 @@ public class BlockHolystone extends Block } @Override - public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) - { + public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) { DoubleDropHelper.dropBlock(player, x, y, z, this, meta); } @Override - public int damageDropped(int meta) - { - return 1; - } + public int damageDropped(int meta) { + return 1; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/natural/BlockQuicksoil.java b/src/main/java/com/legacy/aether/blocks/natural/BlockQuicksoil.java index 74318bb..48a4391 100644 --- a/src/main/java/com/legacy/aether/blocks/natural/BlockQuicksoil.java +++ b/src/main/java/com/legacy/aether/blocks/natural/BlockQuicksoil.java @@ -7,11 +7,9 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class BlockQuicksoil extends Block -{ +public class BlockQuicksoil extends Block { - public BlockQuicksoil() - { + public BlockQuicksoil() { super(Material.sand); this.slipperiness = 1.1F; @@ -23,15 +21,13 @@ public class BlockQuicksoil extends Block } @Override - public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) - { + public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta) { DoubleDropHelper.dropBlock(player, x, y, z, this, meta); } @Override - public int damageDropped(int meta) - { - return 1; - } + public int damageDropped(int meta) { + return 1; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/portal/AetherPortalSize.java b/src/main/java/com/legacy/aether/blocks/portal/AetherPortalSize.java index ab5d031..0ebaea2 100644 --- a/src/main/java/com/legacy/aether/blocks/portal/AetherPortalSize.java +++ b/src/main/java/com/legacy/aether/blocks/portal/AetherPortalSize.java @@ -10,181 +10,149 @@ import net.minecraft.world.World; import com.legacy.aether.blocks.BlocksAether; -public class AetherPortalSize -{ +public class AetherPortalSize { - private final World world; - private final int axis; - public final int rightDir; - public final int leftDir; - public int portalBlockCount = 0; - public ChunkCoordinates bottomLeft; - public int height; - public int width; + private final World world; + private final int axis; + public final int rightDir; + public final int leftDir; + public int portalBlockCount = 0; + public ChunkCoordinates bottomLeft; + public int height; + public int width; - public AetherPortalSize(World worldIn, int x, int y, int z, int axis) - { - this.world = worldIn; - this.axis = axis; + public AetherPortalSize(World worldIn, int x, int y, int z, int axis) { + this.world = worldIn; + this.axis = axis; - this.leftDir = BlockPortal.field_150001_a[axis][0]; - this.rightDir = BlockPortal.field_150001_a[axis][1]; + this.leftDir = BlockPortal.field_150001_a[axis][0]; + this.rightDir = BlockPortal.field_150001_a[axis][1]; - for (int i1 = y; y > i1 - 21 && y > 0 && this.isEmptyBlock(worldIn.getBlock(x, y - 1, z)); --y) - { - ; - } + for (int i1 = y; y > i1 - 21 && y > 0 && this.isEmptyBlock(worldIn.getBlock(x, y - 1, z)); --y) { + ; + } - int i = this.getDistanceUntilEdge(x, y, z, this.leftDir) - 1; + int i = this.getDistanceUntilEdge(x, y, z, this.leftDir) - 1; - if (i >= 0) - { - this.bottomLeft = new ChunkCoordinates(x + i * Direction.offsetX[this.leftDir], y, z + i * Direction.offsetZ[this.leftDir]); - this.width = this.getDistanceUntilEdge(this.bottomLeft.posX, this.bottomLeft.posY, this.bottomLeft.posZ, this.rightDir); + if (i >= 0) { + this.bottomLeft = new ChunkCoordinates(x + i * Direction.offsetX[this.leftDir], y, z + i * Direction.offsetZ[this.leftDir]); + this.width = this.getDistanceUntilEdge(this.bottomLeft.posX, this.bottomLeft.posY, this.bottomLeft.posZ, this.rightDir); - if (this.width < 2 || this.width > 21) - { - this.bottomLeft = null; - this.width = 0; - } - } + if (this.width < 2 || this.width > 21) { + this.bottomLeft = null; + this.width = 0; + } + } - if (this.bottomLeft != null) - { - this.height = this.calculatePortalHeight(); - } - } + if (this.bottomLeft != null) { + this.height = this.calculatePortalHeight(); + } + } - protected int getDistanceUntilEdge(int x, int y, int z, int leftDir) - { - int j1 = Direction.offsetX[leftDir]; - int k1 = Direction.offsetZ[leftDir]; - int i1; - Block block; + protected int getDistanceUntilEdge(int x, int y, int z, int leftDir) { + int j1 = Direction.offsetX[leftDir]; + int k1 = Direction.offsetZ[leftDir]; + int i1; + Block block; - for (i1 = 0; i1 < 22; ++i1) - { - block = this.world.getBlock(x + j1 * i1, y, z + k1 * i1); + for (i1 = 0; i1 < 22; ++i1) { + block = this.world.getBlock(x + j1 * i1, y, z + k1 * i1); - if (!this.isEmptyBlock(block)) - { - break; - } + if (!this.isEmptyBlock(block)) { + break; + } - Block block1 = this.world.getBlock(x + j1 * i1, y - 1, z + k1 * i1); + Block block1 = this.world.getBlock(x + j1 * i1, y - 1, z + k1 * i1); - if (block1 != Blocks.glowstone) - { - break; - } - } + if (block1 != Blocks.glowstone) { + break; + } + } - block = this.world.getBlock(x + j1 * i1, y, z + k1 * i1); - return block == Blocks.glowstone ? i1 : 0; - } + block = this.world.getBlock(x + j1 * i1, y, z + k1 * i1); + return block == Blocks.glowstone ? i1 : 0; + } - public int getHeight() - { - return this.height; - } + public int getHeight() { + return this.height; + } - public int getWidth() - { - return this.width; - } + public int getWidth() { + return this.width; + } - protected int calculatePortalHeight() - { - label24: + protected int calculatePortalHeight() { + label24: - for (this.height = 0; this.height < 21; ++this.height) - { - for (int i = 0; i < this.width; ++i) - { - int k = this.bottomLeft.posX + i * Direction.offsetX[BlockPortal.field_150001_a[this.axis][1]]; - int l = this.bottomLeft.posZ + i * Direction.offsetZ[BlockPortal.field_150001_a[this.axis][1]]; - Block block = this.world.getBlock(k, this.bottomLeft.posY + this.height, l); + for (this.height = 0; this.height < 21; ++this.height) { + for (int i = 0; i < this.width; ++i) { + int k = this.bottomLeft.posX + i * Direction.offsetX[BlockPortal.field_150001_a[this.axis][1]]; + int l = this.bottomLeft.posZ + i * Direction.offsetZ[BlockPortal.field_150001_a[this.axis][1]]; + Block block = this.world.getBlock(k, this.bottomLeft.posY + this.height, l); - if (!this.isEmptyBlock(block)) - { - break label24; - } + if (!this.isEmptyBlock(block)) { + break label24; + } - if (block == BlocksAether.aether_portal) - { - ++this.portalBlockCount; - } + if (block == BlocksAether.aether_portal) { + ++this.portalBlockCount; + } - if (i == 0) - { - block = this.world.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.axis][0]], this.bottomLeft.posY + this.height, l + Direction.offsetZ[BlockPortal.field_150001_a[this.axis][0]]); + if (i == 0) { + block = this.world.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.axis][0]], this.bottomLeft.posY + this.height, l + Direction.offsetZ[BlockPortal.field_150001_a[this.axis][0]]); - if (block != Blocks.glowstone) - { - break label24; - } - } - else if (i == this.width - 1) - { - block = this.world.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.axis][1]], this.bottomLeft.posY + this.height, l + Direction.offsetZ[BlockPortal.field_150001_a[this.axis][1]]); + if (block != Blocks.glowstone) { + break label24; + } + } else if (i == this.width - 1) { + block = this.world.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.axis][1]], this.bottomLeft.posY + this.height, l + Direction.offsetZ[BlockPortal.field_150001_a[this.axis][1]]); - if (block != Blocks.glowstone) - { - break label24; - } - } - } - } + if (block != Blocks.glowstone) { + break label24; + } + } + } + } - for (int j = 0; j < this.width; ++j) - { - int i = this.bottomLeft.posX + j * Direction.offsetX[BlockPortal.field_150001_a[this.axis][1]]; - int k = this.bottomLeft.posY + this.height; - int l = this.bottomLeft.posZ + j * Direction.offsetZ[BlockPortal.field_150001_a[this.axis][1]]; + for (int j = 0; j < this.width; ++j) { + int i = this.bottomLeft.posX + j * Direction.offsetX[BlockPortal.field_150001_a[this.axis][1]]; + int k = this.bottomLeft.posY + this.height; + int l = this.bottomLeft.posZ + j * Direction.offsetZ[BlockPortal.field_150001_a[this.axis][1]]; - if (this.world.getBlock(i, k, l) != Blocks.glowstone) - { - this.height = 0; - break; - } - } + if (this.world.getBlock(i, k, l) != Blocks.glowstone) { + this.height = 0; + break; + } + } - if (this.height <= 21 && this.height >= 3) - { - return this.height; - } - else - { - this.bottomLeft = null; - this.width = 0; - this.height = 0; - return 0; - } - } + if (this.height <= 21 && this.height >= 3) { + return this.height; + } else { + this.bottomLeft = null; + this.width = 0; + this.height = 0; + return 0; + } + } - protected boolean isEmptyBlock(Block blockIn) - { - return blockIn.getMaterial() == Material.air || blockIn == Blocks.fire || blockIn == BlocksAether.aether_portal; - } + protected boolean isEmptyBlock(Block blockIn) { + return blockIn.getMaterial() == Material.air || blockIn == Blocks.fire || blockIn == BlocksAether.aether_portal; + } - public boolean isValid() - { - return this.bottomLeft != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21; - } + public boolean isValid() { + return this.bottomLeft != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21; + } - public void placePortalBlocks() - { - for (int i = 0; i < this.width; ++i) - { - int j = this.bottomLeft.posX + Direction.offsetX[this.rightDir] * i; - int k = this.bottomLeft.posZ + Direction.offsetZ[this.rightDir] * i; + public void placePortalBlocks() { + for (int i = 0; i < this.width; ++i) { + int j = this.bottomLeft.posX + Direction.offsetX[this.rightDir] * i; + int k = this.bottomLeft.posZ + Direction.offsetZ[this.rightDir] * i; - for (int l = 0; l < this.height; ++l) - { - int i1 = this.bottomLeft.posY + l; - this.world.setBlock(j, i1, k, BlocksAether.aether_portal, this.axis, 2); - } - } - } + for (int l = 0; l < this.height; ++l) { + int i1 = this.bottomLeft.posY + l; + this.world.setBlock(j, i1, k, BlocksAether.aether_portal, this.axis, 2); + } + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/blocks/portal/BlockAetherPortal.java b/src/main/java/com/legacy/aether/blocks/portal/BlockAetherPortal.java index 432fa87..5ed51b9 100644 --- a/src/main/java/com/legacy/aether/blocks/portal/BlockAetherPortal.java +++ b/src/main/java/com/legacy/aether/blocks/portal/BlockAetherPortal.java @@ -20,11 +20,9 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockAetherPortal extends BlockPortal -{ +public class BlockAetherPortal extends BlockPortal { - public BlockAetherPortal() - { + public BlockAetherPortal() { super(); this.setHardness(-1); @@ -32,115 +30,90 @@ public class BlockAetherPortal extends BlockPortal } @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister registry) - { - this.blockIcon = registry.registerIcon(Aether.find("aether_portal")); - } + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister registry) { + this.blockIcon = registry.registerIcon(Aether.find("aether_portal")); + } @Override - public void onEntityCollidedWithBlock(World world, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity entity) - { - if (entity instanceof EntityPlayer) - { - PlayerAether.get((EntityPlayer)entity).setInPortal(); - } - else if ((entity instanceof EntityLivingBase) && entity.ridingEntity == null && entity.riddenByEntity == null) - { - ((EntityHook)entity.getExtendedProperties("aether_legacy:entity_hook")).setInPortal(); + public void onEntityCollidedWithBlock(World world, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity entity) { + if (entity instanceof EntityPlayer) { + PlayerAether.get((EntityPlayer) entity).setInPortal(); + } else if ((entity instanceof EntityLivingBase) && entity.ridingEntity == null && entity.riddenByEntity == null) { + ((EntityHook) entity.getExtendedProperties("aether_legacy:entity_hook")).setInPortal(); } } - public boolean trySpawnPortal(World worldIn, int x, int y, int z) - { + public boolean trySpawnPortal(World worldIn, int x, int y, int z) { AetherPortalSize aetherportal$size = new AetherPortalSize(worldIn, x, y, z, 1); - if (aetherportal$size.isValid() && aetherportal$size.portalBlockCount == 0) - { - aetherportal$size.placePortalBlocks(); + if (aetherportal$size.isValid() && aetherportal$size.portalBlockCount == 0) { + aetherportal$size.placePortalBlocks(); - return true; - } - else - { - AetherPortalSize aetherportal$size1 = new AetherPortalSize(worldIn, x, y, z, 2); + return true; + } else { + AetherPortalSize aetherportal$size1 = new AetherPortalSize(worldIn, x, y, z, 2); - if (aetherportal$size1.isValid() && aetherportal$size1.portalBlockCount == 0) - { - aetherportal$size1.placePortalBlocks(); + if (aetherportal$size1.isValid() && aetherportal$size1.portalBlockCount == 0) { + aetherportal$size1.placePortalBlocks(); - return true; - } - else - { - return false; - } - } + return true; + } else { + return false; + } + } } @Override - public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block blockIn) - { - int l = func_149999_b(worldIn.getBlockMetadata(x, y, z)); + public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block blockIn) { + int l = func_149999_b(worldIn.getBlockMetadata(x, y, z)); - if (l == 1) - { - AetherPortalSize blockportal$size = new AetherPortalSize(worldIn, x, y, z, 1); + if (l == 1) { + AetherPortalSize blockportal$size = new AetherPortalSize(worldIn, x, y, z, 1); - if (!blockportal$size.isValid() || blockportal$size.portalBlockCount < blockportal$size.width * blockportal$size.height) - { - worldIn.setBlock(x, y, z, Blocks.air); - } - } - else if (l == 2) - { - AetherPortalSize blockportal$size1 = new AetherPortalSize(worldIn, x, y, z, 2); + if (!blockportal$size.isValid() || blockportal$size.portalBlockCount < blockportal$size.width * blockportal$size.height) { + worldIn.setBlock(x, y, z, Blocks.air); + } + } else if (l == 2) { + AetherPortalSize blockportal$size1 = new AetherPortalSize(worldIn, x, y, z, 2); - if (!blockportal$size1.isValid() || blockportal$size1.portalBlockCount < blockportal$size1.width * blockportal$size1.height) - { - worldIn.setBlock(x, y, z, Blocks.air); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random rand) - { - if (rand.nextInt(100) == 0) - { - world.playSound((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "portal.portal", 0.5F, rand.nextFloat() * 0.4F + 0.8F, false); - } - - for (int i = 0; i < 4; ++i) - { - double d0 = (double)((float)x + rand.nextFloat()); - double d1 = (double)((float)y + rand.nextFloat()); - double d2 = (double)((float)z + rand.nextFloat()); - double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D; - double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D; - double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D; - int j = rand.nextInt(2) * 2 - 1; - - if (world.getBlock(x - 1, y, z) != this && world.getBlock(x + 1, y, z) != this) - { - d0 = (double)x + 0.5D + 0.25D * (double)j; - d3 = (double)(rand.nextFloat() * 2.0F * (float)j); - } - else - { - d2 = (double)z + 0.5D + 0.25D * (double)j; - d5 = (double)(rand.nextFloat() * 2.0F * (float)j); - } - - ParticleAetherPortal particle = new ParticleAetherPortal(world, d0, d1, d2, d3, d4, d5); - FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); - } + if (!blockportal$size1.isValid() || blockportal$size1.portalBlockCount < blockportal$size1.width * blockportal$size1.height) { + worldIn.setBlock(x, y, z, Blocks.air); + } + } } @Override - public void updateTick(World world, int x, int y, int z, Random rand) - { + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random rand) { + if (rand.nextInt(100) == 0) { + world.playSound((double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, "portal.portal", 0.5F, rand.nextFloat() * 0.4F + 0.8F, false); + } + + for (int i = 0; i < 4; ++i) { + double d0 = (double) ((float) x + rand.nextFloat()); + double d1 = (double) ((float) y + rand.nextFloat()); + double d2 = (double) ((float) z + rand.nextFloat()); + double d3 = ((double) rand.nextFloat() - 0.5D) * 0.5D; + double d4 = ((double) rand.nextFloat() - 0.5D) * 0.5D; + double d5 = ((double) rand.nextFloat() - 0.5D) * 0.5D; + int j = rand.nextInt(2) * 2 - 1; + + if (world.getBlock(x - 1, y, z) != this && world.getBlock(x + 1, y, z) != this) { + d0 = (double) x + 0.5D + 0.25D * (double) j; + d3 = (double) (rand.nextFloat() * 2.0F * (float) j); + } else { + d2 = (double) z + 0.5D + 0.25D * (double) j; + d5 = (double) (rand.nextFloat() * 2.0F * (float) j); + } + + ParticleAetherPortal particle = new ParticleAetherPortal(world, d0, d1, d2, d3, d4, d5); + FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); + } + } + + @Override + public void updateTick(World world, int x, int y, int z, Random rand) { } diff --git a/src/main/java/com/legacy/aether/blocks/util/BlockFloating.java b/src/main/java/com/legacy/aether/blocks/util/BlockFloating.java index fd69f30..7d20741 100644 --- a/src/main/java/com/legacy/aether/blocks/util/BlockFloating.java +++ b/src/main/java/com/legacy/aether/blocks/util/BlockFloating.java @@ -11,13 +11,11 @@ import net.minecraft.world.World; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.entities.block.EntityFloatingBlock; -public class BlockFloating extends Block -{ +public class BlockFloating extends Block { private boolean leveled; - public BlockFloating(Material material, boolean leveled) - { + public BlockFloating(Material material, boolean leveled) { super(material); this.leveled = leveled; @@ -27,40 +25,32 @@ public class BlockFloating extends Block } @Override - public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) - { - return this == BlocksAether.enchanted_gravitite; - } + public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { + return this == BlocksAether.enchanted_gravitite; + } @Override - public void onBlockAdded(World world, int x, int y, int z) - { + public void onBlockAdded(World world, int x, int y, int z) { world.scheduleBlockUpdate(x, y, z, this, 3); } @Override - public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighborBlock) - { + public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighborBlock) { worldIn.scheduleBlockUpdate(x, y, z, this, 3); - } + } @Override - public void updateTick(World world, int x, int y, int z, Random rand) - { - if (!this.leveled || this.leveled && world.isBlockIndirectlyGettingPowered(x, y, z)) - { + public void updateTick(World world, int x, int y, int z, Random rand) { + if (!this.leveled || this.leveled && world.isBlockIndirectlyGettingPowered(x, y, z)) { this.floatBlock(world, x, y, z); } } - private void floatBlock(World world, int x, int y, int z) - { - if (canContinue(world, x, y + 1, z) && y < world.getHeight()) - { + private void floatBlock(World world, int x, int y, int z) { + if (canContinue(world, x, y + 1, z) && y < world.getHeight()) { EntityFloatingBlock floating = new EntityFloatingBlock(world, x, y, z, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); - if (!world.isRemote) - { + if (!world.isRemote) { world.spawnEntityInWorld(floating); } @@ -68,22 +58,19 @@ public class BlockFloating extends Block } } - public static boolean canContinue(World world, int x, int y, int z) - { + public static boolean canContinue(World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); Material material = block.getMaterial(); - if (block == Blocks.air || block == Blocks.fire) - { + if (block == Blocks.air || block == Blocks.fire) { return true; } - if (material == Material.water || material == Material.lava) - { + if (material == Material.water || material == Material.lava) { return true; } - return false; + return false; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/AetherClientEvents.java b/src/main/java/com/legacy/aether/client/AetherClientEvents.java index 25b8b90..7feb8c7 100644 --- a/src/main/java/com/legacy/aether/client/AetherClientEvents.java +++ b/src/main/java/com/legacy/aether/client/AetherClientEvents.java @@ -40,45 +40,33 @@ import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; -public class AetherClientEvents -{ +public class AetherClientEvents { @SubscribeEvent - public void onClientTick(TickEvent.ClientTickEvent event) throws Exception - { + public void onClientTick(TickEvent.ClientTickEvent event) throws Exception { Minecraft mc = Minecraft.getMinecraft(); TickEvent.Phase phase = event.phase; TickEvent.Type type = event.type; - if (phase == TickEvent.Phase.END) - { - if (type.equals(TickEvent.Type.CLIENT)) - { - if (!AetherConfig.triviaDisabled()) - { - if (!(mc.loadingScreen instanceof AetherLoadingScreen)) - { + if (phase == TickEvent.Phase.END) { + if (type.equals(TickEvent.Type.CLIENT)) { + if (!AetherConfig.triviaDisabled()) { + if (!(mc.loadingScreen instanceof AetherLoadingScreen)) { mc.loadingScreen = new AetherLoadingScreen(mc); } } - if (mc.thePlayer != null && !(mc.thePlayer.movementInput instanceof AetherMovementInput)) - { + if (mc.thePlayer != null && !(mc.thePlayer.movementInput instanceof AetherMovementInput)) { mc.thePlayer.movementInput = new AetherMovementInput(mc, mc.gameSettings); } } } - if (phase == TickEvent.Phase.START) - { - if (type.equals(TickEvent.Type.CLIENT)) - { - if (mc.currentScreen == null || mc.currentScreen.allowUserInput) - { - if (!mc.thePlayer.isUsingItem()) - { - if (GameSettings.isKeyDown(mc.gameSettings.keyBindPickBlock)) - { + if (phase == TickEvent.Phase.START) { + if (type.equals(TickEvent.Type.CLIENT)) { + if (mc.currentScreen == null || mc.currentScreen.allowUserInput) { + if (!mc.thePlayer.isUsingItem()) { + if (GameSettings.isKeyDown(mc.gameSettings.keyBindPickBlock)) { this.sendPickupPacket(mc); } } @@ -87,105 +75,87 @@ public class AetherClientEvents } } - private void sendPickupPacket(Minecraft mc) - { - if (mc.objectMouseOver != null) - { - if (!this.onPickEntity(mc.objectMouseOver, mc.thePlayer, mc.theWorld)) - { - return; - } + private void sendPickupPacket(Minecraft mc) { + if (mc.objectMouseOver != null) { + if (!this.onPickEntity(mc.objectMouseOver, mc.thePlayer, mc.theWorld)) { + return; + } - if (mc.thePlayer.capabilities.isCreativeMode) - { - int index = mc.thePlayer.inventoryContainer.inventorySlots.size() - 9 + mc.thePlayer.inventory.currentItem; + if (mc.thePlayer.capabilities.isCreativeMode) { + int index = mc.thePlayer.inventoryContainer.inventorySlots.size() - 9 + mc.thePlayer.inventory.currentItem; - mc.playerController.sendSlotPacket(mc.thePlayer.inventory.getStackInSlot(mc.thePlayer.inventory.currentItem), index); - } - } - } + mc.playerController.sendSlotPacket(mc.thePlayer.inventory.getStackInSlot(mc.thePlayer.inventory.currentItem), index); + } + } + } - private boolean onPickEntity(MovingObjectPosition target, EntityPlayer player, World world) - { - ItemStack result = null; - boolean isCreative = player.capabilities.isCreativeMode; + private boolean onPickEntity(MovingObjectPosition target, EntityPlayer player, World world) { + ItemStack result = null; + boolean isCreative = player.capabilities.isCreativeMode; - if (!isCreative) - { - return false; - } + if (!isCreative) { + return false; + } - if (target.entityHit != null) - { - int id = EntitiesAether.getEntityID(target.entityHit); + if (target.entityHit != null) { + int id = EntitiesAether.getEntityID(target.entityHit); - if (id >= 0 && ItemAetherSpawnEgg.entityEggs.containsKey(id)) - { - result = new ItemStack(ItemsAether.aether_spawn_egg, 1, id); - } - } + if (id >= 0 && ItemAetherSpawnEgg.entityEggs.containsKey(id)) { + result = new ItemStack(ItemsAether.aether_spawn_egg, 1, id); + } + } - if (result == null) - { - return false; - } + if (result == null) { + return false; + } - for (int x = 0; x < 9; x++) - { - ItemStack stack = player.inventory.getStackInSlot(x); + for (int x = 0; x < 9; x++) { + ItemStack stack = player.inventory.getStackInSlot(x); - if (stack != null && stack.isItemEqual(result) && ItemStack.areItemStackTagsEqual(stack, result)) - { - player.inventory.currentItem = x; + if (stack != null && stack.isItemEqual(result) && ItemStack.areItemStackTagsEqual(stack, result)) { + player.inventory.currentItem = x; - return true; - } - } + return true; + } + } - int slot = player.inventory.getFirstEmptyStack(); + int slot = player.inventory.getFirstEmptyStack(); - if (slot < 0 || slot >= 9) - { - slot = player.inventory.currentItem; - } + if (slot < 0 || slot >= 9) { + slot = player.inventory.currentItem; + } - player.inventory.setInventorySlotContents(slot, result); - player.inventory.currentItem = slot; + player.inventory.setInventorySlotContents(slot, result); + player.inventory.currentItem = slot; - return true; - } + return true; + } @SubscribeEvent - public void onBowPulled(FOVUpdateEvent event) - { + public void onBowPulled(FOVUpdateEvent event) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (player == null || (player != null && player.getCurrentEquippedItem() == null)) - { + if (player == null || (player != null && player.getCurrentEquippedItem() == null)) { return; } Item item = player.getCurrentEquippedItem().getItem(); - if (item == ItemsAether.phoenix_bow) - { - int i = player.getItemInUseDuration(); - float f1 = (float)i / 20.0F; + if (item == ItemsAether.phoenix_bow) { + int i = player.getItemInUseDuration(); + float f1 = (float) i / 20.0F; - if (f1 > 1.0F) - { - f1 = 1.0F; - } - else - { - f1 = f1 * f1; - } + if (f1 > 1.0F) { + f1 = 1.0F; + } else { + f1 = f1 * f1; + } - float original = event.fov; + float original = event.fov; - original *= 1.0F - f1 * 0.15F; + original *= 1.0F - f1 * 0.15F; - event.newfov = original; + event.newfov = original; } } @@ -195,54 +165,41 @@ public class AetherClientEvents @SubscribeEvent @SuppressWarnings("unchecked") - public void onGuiOpened(GuiScreenEvent.InitGuiEvent.Post event) - { - if (event.gui instanceof GuiContainer) - { + public void onGuiOpened(GuiScreenEvent.InitGuiEvent.Post event) { + if (event.gui instanceof GuiContainer) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; Class clazz = event.gui.getClass(); - int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.gui, "guiLeft", "field_147003_i"); - int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.gui, "guiTop", "field_147009_r"); + int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer) event.gui, "guiLeft", "field_147003_i"); + int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer) event.gui, "guiTop", "field_147009_r"); - if (player.capabilities.isCreativeMode) - { - if (event.gui instanceof GuiContainerCreative) - { - if (((GuiContainerCreative)event.gui).func_147056_g() == CreativeTabs.tabInventory.getTabIndex()) - { + if (player.capabilities.isCreativeMode) { + if (event.gui instanceof GuiContainerCreative) { + if (((GuiContainerCreative) event.gui).func_147056_g() == CreativeTabs.tabInventory.getTabIndex()) { event.buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 28, guiTop + 38)); previousSelectedTabIndex = CreativeTabs.tabInventory.getTabIndex(); } } - } - else if (clazz == GuiInventory.class) - { + } else if (clazz == GuiInventory.class) { event.buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 26, guiTop + 65)); } } } @SubscribeEvent - public void onMouseClicked(DrawScreenEvent.Post event) - { - if (Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) - { + public void onMouseClicked(DrawScreenEvent.Post event) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) { GuiContainerCreative guiScreen = (GuiContainerCreative) Minecraft.getMinecraft().currentScreen; - if (previousSelectedTabIndex != guiScreen.func_147056_g()) - { + if (previousSelectedTabIndex != guiScreen.func_147056_g()) { List buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, (GuiScreen) guiScreen, 4); - if (guiScreen.func_147056_g() == CreativeTabs.tabInventory.getTabIndex() && !buttonList.contains(ACCESSORY_BUTTON)) - { - int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)guiScreen, "guiLeft", "field_147003_i"); - int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)guiScreen, "guiTop", "field_147009_r"); + if (guiScreen.func_147056_g() == CreativeTabs.tabInventory.getTabIndex() && !buttonList.contains(ACCESSORY_BUTTON)) { + int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer) guiScreen, "guiLeft", "field_147003_i"); + int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer) guiScreen, "guiTop", "field_147009_r"); buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 28, guiTop + 38)); - } - else if (previousSelectedTabIndex == CreativeTabs.tabInventory.getTabIndex()) - { + } else if (previousSelectedTabIndex == CreativeTabs.tabInventory.getTabIndex()) { buttonList.remove(ACCESSORY_BUTTON); } @@ -252,26 +209,21 @@ public class AetherClientEvents } @SubscribeEvent - public void onButtonPressed(GuiScreenEvent.ActionPerformedEvent.Pre event) - { + public void onButtonPressed(GuiScreenEvent.ActionPerformedEvent.Pre event) { Class clazz = event.gui.getClass(); - if ((clazz == GuiInventory.class || clazz == GuiContainerCreative.class) && event.button.id == 18067) - { + if ((clazz == GuiInventory.class || clazz == GuiContainerCreative.class) && event.button.id == 18067) { AetherNetwork.sendToServer(new PacketOpenContainer(AetherGuiHandler.accessories)); } } @SubscribeEvent - public void onRenderInvisibility(RenderPlayerEvent.Pre event) - { + public void onRenderInvisibility(RenderPlayerEvent.Pre event) { EntityPlayer player = event.entityPlayer; PlayerAether playerAether = PlayerAether.get(player); - if (playerAether != null) - { - if (playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) - { + if (playerAether != null) { + if (playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) { event.setCanceled(true); } } @@ -280,25 +232,20 @@ public class AetherClientEvents } @SubscribeEvent - public void onRenderAetherCape(RenderPlayerEvent.Specials.Pre event) - { + public void onRenderAetherCape(RenderPlayerEvent.Specials.Pre event) { event.renderCape = !PlayerAetherRenderer.instance().isCapeRendering(); } @SubscribeEvent - public void onRenderAetherArmor(SetArmorModel event) - { - if (event.stack != null && event.stack.getItem() instanceof ItemAetherArmor) - { - event.result = PlayerAetherRenderer.instance().renderAetherArmor(PlayerAether.get(event.entityPlayer), event.renderer, event.stack, 3- event.slot); + public void onRenderAetherArmor(SetArmorModel event) { + if (event.stack != null && event.stack.getItem() instanceof ItemAetherArmor) { + event.result = PlayerAetherRenderer.instance().renderAetherArmor(PlayerAether.get(event.entityPlayer), event.renderer, event.stack, 3 - event.slot); } } @SubscribeEvent - public void onRenderAccessories(RenderLivingEvent.Post event) - { - if (event.entity instanceof EntityPlayer) - { + public void onRenderAccessories(RenderLivingEvent.Post event) { + if (event.entity instanceof EntityPlayer) { PlayerAether playerAether = PlayerAether.get((EntityPlayer) event.entity); PlayerAetherRenderer.instance().renderAccessories(playerAether, (RenderPlayer) event.renderer, event.x, event.y, event.z, PlayerAetherRenderer.instance().getPartialTicks()); diff --git a/src/main/java/com/legacy/aether/client/AetherMovementInput.java b/src/main/java/com/legacy/aether/client/AetherMovementInput.java index c1720fe..2c87e0b 100644 --- a/src/main/java/com/legacy/aether/client/AetherMovementInput.java +++ b/src/main/java/com/legacy/aether/client/AetherMovementInput.java @@ -10,19 +10,17 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.settings.GameSettings; import net.minecraft.util.MovementInputFromOptions; -public class AetherMovementInput extends MovementInputFromOptions -{ +public class AetherMovementInput extends MovementInputFromOptions { private Minecraft mc; - private GameSettings gameSettings; + private GameSettings gameSettings; - private boolean currentSneak; + private boolean currentSneak; - private boolean previousSneak; - - public AetherMovementInput(Minecraft mc, GameSettings gameSettings) - { + private boolean previousSneak; + + public AetherMovementInput(Minecraft mc, GameSettings gameSettings) { super(gameSettings); this.mc = mc; @@ -30,44 +28,36 @@ public class AetherMovementInput extends MovementInputFromOptions } @Override - public void updatePlayerMoveState() - { + public void updatePlayerMoveState() { super.updatePlayerMoveState(); - this.jump = this.gameSettings.keyBindJump.getIsKeyPressed(); + this.jump = this.gameSettings.keyBindJump.getIsKeyPressed(); - boolean isSneaking = this.gameSettings.keyBindSneak.getIsKeyPressed(); + boolean isSneaking = this.gameSettings.keyBindSneak.getIsKeyPressed(); - this.sneak = isSneaking; + this.sneak = isSneaking; - if (this.mc.thePlayer == null) - { - return; - } + if (this.mc.thePlayer == null) { + return; + } - if (this.mc.thePlayer.ridingEntity instanceof EntitySaddleMount) - { - if (this.mc.thePlayer.ridingEntity instanceof EntitySaddleMount) - { - this.sneak = false; - this.currentSneak = isSneaking; + if (this.mc.thePlayer.ridingEntity instanceof EntitySaddleMount) { + if (this.mc.thePlayer.ridingEntity instanceof EntitySaddleMount) { + this.sneak = false; + this.currentSneak = isSneaking; - if (this.previousSneak != this.currentSneak) - { - AetherNetwork.sendToServer(new PacketSendSneaking(this.mc.thePlayer.getEntityId(), this.currentSneak)); - this.previousSneak = this.currentSneak; - } + if (this.previousSneak != this.currentSneak) { + AetherNetwork.sendToServer(new PacketSendSneaking(this.mc.thePlayer.getEntityId(), this.currentSneak)); + this.previousSneak = this.currentSneak; + } - if (((EntityMountable) this.mc.thePlayer.ridingEntity).isOnGround()) - { - this.sneak = isSneaking; - } - } - } - else if (this.mc.thePlayer.ridingEntity instanceof EntitySwet && !((EntitySwet)this.mc.thePlayer.ridingEntity).isFriendly()) - { - this.sneak = false; - } - } + if (((EntityMountable) this.mc.thePlayer.ridingEntity).isOnGround()) { + this.sneak = isSneaking; + } + } + } else if (this.mc.thePlayer.ridingEntity instanceof EntitySwet && !((EntitySwet) this.mc.thePlayer.ridingEntity).isFriendly()) { + this.sneak = false; + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/ClientProxy.java b/src/main/java/com/legacy/aether/client/ClientProxy.java index 7b058fe..9469b7f 100644 --- a/src/main/java/com/legacy/aether/client/ClientProxy.java +++ b/src/main/java/com/legacy/aether/client/ClientProxy.java @@ -17,14 +17,12 @@ import com.legacy.aether.client.renders.RendersAether; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.RenderingRegistry; -public class ClientProxy extends CommonProxy -{ +public class ClientProxy extends CommonProxy { public static final IIcon[] ACCESSORY_ICONS = new IIcon[8]; @Override - public void init() - { + public void init() { berryBushRenderID = RenderingRegistry.getNextAvailableRenderId(); treasureChestRenderID = RenderingRegistry.getNextAvailableRenderId(); aetherFlowerRenderID = RenderingRegistry.getNextAvailableRenderId(); @@ -43,20 +41,17 @@ public class ClientProxy extends CommonProxy } @Override - public void sendMessage(EntityPlayer player, String text) - { + public void sendMessage(EntityPlayer player, String text) { Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(text)); } @Override - public void openSunAltar() - { + public void openSunAltar() { FMLClientHandler.instance().getClient().displayGuiScreen(new GuiSunAltar()); } @Override - public EntityPlayer getPlayer() - { + public EntityPlayer getPlayer() { return Minecraft.getMinecraft().thePlayer; } diff --git a/src/main/java/com/legacy/aether/client/audio/AetherMusicHandler.java b/src/main/java/com/legacy/aether/client/audio/AetherMusicHandler.java index 7c327e8..a6a6ac8 100644 --- a/src/main/java/com/legacy/aether/client/audio/AetherMusicHandler.java +++ b/src/main/java/com/legacy/aether/client/audio/AetherMusicHandler.java @@ -16,25 +16,20 @@ import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class AetherMusicHandler -{ +public class AetherMusicHandler { private Minecraft mc = Minecraft.getMinecraft(); private final AetherMusicTicker musicTicker = new AetherMusicTicker(this.mc); @SubscribeEvent - public void onClientTick(TickEvent.ClientTickEvent event) throws Exception - { + public void onClientTick(TickEvent.ClientTickEvent event) throws Exception { TickEvent.Phase phase = event.phase; TickEvent.Type type = event.type; - if (phase == TickEvent.Phase.END) - { - if (type.equals(TickEvent.Type.CLIENT)) - { - if (!this.mc.isGamePaused()) - { + if (phase == TickEvent.Phase.END) { + if (type.equals(TickEvent.Type.CLIENT)) { + if (!this.mc.isGamePaused()) { this.musicTicker.update(); } } @@ -42,31 +37,24 @@ public class AetherMusicHandler } @SubscribeEvent - public void onMusicControl(PlaySoundEvent17 event) - { + public void onMusicControl(PlaySoundEvent17 event) { ISound sound = event.result; - if (sound == null) - { + if (sound == null) { return; } SoundCategory category = event.category; - if (category == SoundCategory.MUSIC) - { - if (this.mc.thePlayer != null && this.mc.thePlayer.dimension == AetherConfig.getAetherDimensionID()) - { - if (!sound.getPositionedSoundLocation().toString().contains("aether_legacy") && (this.musicTicker.playingMusic() || !this.musicTicker.playingMusic())) - { + if (category == SoundCategory.MUSIC) { + if (this.mc.thePlayer != null && this.mc.thePlayer.dimension == AetherConfig.getAetherDimensionID()) { + if (!sound.getPositionedSoundLocation().toString().contains("aether_legacy") && (this.musicTicker.playingMusic() || !this.musicTicker.playingMusic())) { event.result = null; return; } } - } - else if (category == SoundCategory.RECORDS) - { + } else if (category == SoundCategory.RECORDS) { this.musicTicker.stopMusic(); this.mc.getSoundHandler().stopSounds(); @@ -75,8 +63,7 @@ public class AetherMusicHandler } @SideOnly(Side.CLIENT) - public static ISound getAchievementSound(int number) - { + public static ISound getAchievementSound(int number) { ResourceLocation sound = number == 1 ? Aether.locate("achievement_bronze") : number == 2 ? Aether.locate("achievement_silver") : Aether.locate("achievement"); return PositionedSoundRecord.func_147673_a(sound); diff --git a/src/main/java/com/legacy/aether/client/audio/music/AetherMusicTicker.java b/src/main/java/com/legacy/aether/client/audio/music/AetherMusicTicker.java index 4f9ee97..0a470eb 100644 --- a/src/main/java/com/legacy/aether/client/audio/music/AetherMusicTicker.java +++ b/src/main/java/com/legacy/aether/client/audio/music/AetherMusicTicker.java @@ -17,123 +17,101 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class AetherMusicTicker implements IUpdatePlayerListBox -{ +public class AetherMusicTicker implements IUpdatePlayerListBox { - private final Random rand = new Random(); - private final Minecraft mc; - private ISound currentMusic; - private int timeUntilNextMusic = 100; + private final Random rand = new Random(); + private final Minecraft mc; + private ISound currentMusic; + private int timeUntilNextMusic = 100; - public AetherMusicTicker(Minecraft mcIn) - { - this.mc = mcIn; - } + public AetherMusicTicker(Minecraft mcIn) { + this.mc = mcIn; + } - public void update() - { - TrackType tracktype = this.getRandomTrack(); + public void update() { + TrackType tracktype = this.getRandomTrack(); - if (this.mc.thePlayer != null) - { - if (this.mc.gameSettings.getSoundLevel(SoundCategory.MUSIC) == 0.0F) - { - if (this.currentMusic != null) - { - this.stopMusic(); - this.currentMusic = null; - } + if (this.mc.thePlayer != null) { + if (this.mc.gameSettings.getSoundLevel(SoundCategory.MUSIC) == 0.0F) { + if (this.currentMusic != null) { + this.stopMusic(); + this.currentMusic = null; + } - return; - } + return; + } - if (this.mc.thePlayer.dimension != AetherConfig.getAetherDimensionID()) - { - this.stopMusic(); - } - else if (this.mc.thePlayer.dimension == AetherConfig.getAetherDimensionID()) - { - if (this.currentMusic != null) - { - if (!this.mc.getSoundHandler().isSoundPlaying(this.currentMusic)) - { - this.currentMusic = null; - this.timeUntilNextMusic = Math.min(MathHelper.getRandomIntegerInRange(this.rand, tracktype.getMinDelay(), tracktype.getMaxDelay()), this.timeUntilNextMusic); - } - } + if (this.mc.thePlayer.dimension != AetherConfig.getAetherDimensionID()) { + this.stopMusic(); + } else if (this.mc.thePlayer.dimension == AetherConfig.getAetherDimensionID()) { + if (this.currentMusic != null) { + if (!this.mc.getSoundHandler().isSoundPlaying(this.currentMusic)) { + this.currentMusic = null; + this.timeUntilNextMusic = Math.min(MathHelper.getRandomIntegerInRange(this.rand, tracktype.getMinDelay(), tracktype.getMaxDelay()), this.timeUntilNextMusic); + } + } - this.timeUntilNextMusic = Math.min(this.timeUntilNextMusic, tracktype.getMaxDelay()); + this.timeUntilNextMusic = Math.min(this.timeUntilNextMusic, tracktype.getMaxDelay()); - if (this.currentMusic == null && this.timeUntilNextMusic-- <= 0) - { - this.playMusic(tracktype); - } - } - } - } + if (this.currentMusic == null && this.timeUntilNextMusic-- <= 0) { + this.playMusic(tracktype); + } + } + } + } - public boolean playingMusic() - { - return this.currentMusic != null; - } + public boolean playingMusic() { + return this.currentMusic != null; + } - public AetherMusicTicker.TrackType getRandomTrack() - { - int num = this.rand.nextInt(4); + public AetherMusicTicker.TrackType getRandomTrack() { + int num = this.rand.nextInt(4); - return num == 0 ? TrackType.TRACK_ONE : num == 1 ? TrackType.TRACK_TWO : num == 2 ? TrackType.TRACK_THREE : TrackType.TRACK_FOUR; - } + return num == 0 ? TrackType.TRACK_ONE : num == 1 ? TrackType.TRACK_TWO : num == 2 ? TrackType.TRACK_THREE : TrackType.TRACK_FOUR; + } - public void playMusic(TrackType requestedMusicType) - { - this.currentMusic = PositionedSoundRecord.func_147673_a(requestedMusicType.getMusicLocation()); - this.mc.getSoundHandler().playSound(this.currentMusic); - this.timeUntilNextMusic = Integer.MAX_VALUE; - } + public void playMusic(TrackType requestedMusicType) { + this.currentMusic = PositionedSoundRecord.func_147673_a(requestedMusicType.getMusicLocation()); + this.mc.getSoundHandler().playSound(this.currentMusic); + this.timeUntilNextMusic = Integer.MAX_VALUE; + } - public void stopMusic() - { - if (this.currentMusic != null) - { - this.mc.getSoundHandler().stopSound(this.currentMusic); - this.currentMusic = null; - this.timeUntilNextMusic = 0; - } - } + public void stopMusic() { + if (this.currentMusic != null) { + this.mc.getSoundHandler().stopSound(this.currentMusic); + this.currentMusic = null; + this.timeUntilNextMusic = 0; + } + } - @SideOnly(Side.CLIENT) - public static enum TrackType - { - TRACK_ONE(Aether.locate("music.aether1"), 1200, 1500), - TRACK_TWO(Aether.locate("music.aether2"), 1200, 1500), - TRACK_THREE(Aether.locate("music.aether3"), 1200, 1500), - TRACK_FOUR(Aether.locate("music.aether4"), 1200, 1500); + @SideOnly(Side.CLIENT) + public static enum TrackType { + TRACK_ONE(Aether.locate("music.aether1"), 1200, 1500), + TRACK_TWO(Aether.locate("music.aether2"), 1200, 1500), + TRACK_THREE(Aether.locate("music.aether3"), 1200, 1500), + TRACK_FOUR(Aether.locate("music.aether4"), 1200, 1500); - private final ResourceLocation musicLocation; - private final int minDelay; - private final int maxDelay; + private final ResourceLocation musicLocation; + private final int minDelay; + private final int maxDelay; - private TrackType(ResourceLocation musicLocationIn, int minDelayIn, int maxDelayIn) - { - this.musicLocation = musicLocationIn; - this.minDelay = minDelayIn; - this.maxDelay = maxDelayIn; - } + private TrackType(ResourceLocation musicLocationIn, int minDelayIn, int maxDelayIn) { + this.musicLocation = musicLocationIn; + this.minDelay = minDelayIn; + this.maxDelay = maxDelayIn; + } - public ResourceLocation getMusicLocation() - { - return this.musicLocation; - } + public ResourceLocation getMusicLocation() { + return this.musicLocation; + } - public int getMinDelay() - { - return this.minDelay; - } + public int getMinDelay() { + return this.minDelay; + } - public int getMaxDelay() - { - return this.maxDelay; - } - } + public int getMaxDelay() { + return this.maxDelay; + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/AetherLoadingScreen.java b/src/main/java/com/legacy/aether/client/gui/AetherLoadingScreen.java index 71a412b..036f986 100644 --- a/src/main/java/com/legacy/aether/client/gui/AetherLoadingScreen.java +++ b/src/main/java/com/legacy/aether/client/gui/AetherLoadingScreen.java @@ -14,143 +14,127 @@ import com.legacy.aether.client.gui.trivia.AetherTrivia; import cpw.mods.fml.client.FMLClientHandler; -public class AetherLoadingScreen extends LoadingScreenRenderer -{ +public class AetherLoadingScreen extends LoadingScreenRenderer { - private String message = ""; + private String message = ""; - private Minecraft mc; + private Minecraft mc; - private String currentlyDisplayedText = ""; + private String currentlyDisplayedText = ""; - private String currentDisplayedTrivia = ""; + private String currentDisplayedTrivia = ""; - private long systemTime = Minecraft.getSystemTime(); + private long systemTime = Minecraft.getSystemTime(); - private Framebuffer framebuffer; + private Framebuffer framebuffer; - public AetherLoadingScreen(Minecraft mcIn) - { + public AetherLoadingScreen(Minecraft mcIn) { super(mcIn); - this.mc = mcIn; + this.mc = mcIn; - this.framebuffer = new Framebuffer(mcIn.displayWidth, mcIn.displayHeight, false); - this.framebuffer.setFramebufferFilter(9728); + this.framebuffer = new Framebuffer(mcIn.displayWidth, mcIn.displayHeight, false); + this.framebuffer.setFramebufferFilter(9728); } - @Override - public void resetProgressAndMessage(String message) - { - super.resetProgressAndMessage(message); + @Override + public void resetProgressAndMessage(String message) { + super.resetProgressAndMessage(message); - this.currentDisplayedTrivia = AetherTrivia.getNewTrivia(); - } + this.currentDisplayedTrivia = AetherTrivia.getNewTrivia(); + } - @Override - public void displayProgressMessage(String message) - { - this.systemTime = 0L; - this.message = message; - this.setLoadingProgress(-1); - this.systemTime = 0L; - } + @Override + public void displayProgressMessage(String message) { + this.systemTime = 0L; + this.message = message; + this.setLoadingProgress(-1); + this.systemTime = 0L; + } - @Override - public void setLoadingProgress(int progress) - { - long j = Minecraft.getSystemTime(); + @Override + public void setLoadingProgress(int progress) { + long j = Minecraft.getSystemTime(); - if (j - this.systemTime >= 100L) - { - this.systemTime = j; - ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); - int k = scaledresolution.getScaleFactor(); - int l = scaledresolution.getScaledWidth(); - int i1 = scaledresolution.getScaledHeight(); + if (j - this.systemTime >= 100L) { + this.systemTime = j; + ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); + int k = scaledresolution.getScaleFactor(); + int l = scaledresolution.getScaledWidth(); + int i1 = scaledresolution.getScaledHeight(); - if (OpenGlHelper.isFramebufferEnabled()) - { - this.framebuffer.framebufferClear(); - } - else - { - GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); - } + if (OpenGlHelper.isFramebufferEnabled()) { + this.framebuffer.framebufferClear(); + } else { + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + } - this.framebuffer.bindFramebuffer(false); - GL11.glMatrixMode(GL11.GL_PROJECTION); - GL11.glLoadIdentity(); - GL11.glOrtho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); - GL11.glMatrixMode(GL11.GL_MODELVIEW); - GL11.glLoadIdentity(); - GL11.glTranslatef(0.0F, 0.0F, -200.0F); + this.framebuffer.bindFramebuffer(false); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -200.0F); - if (!OpenGlHelper.isFramebufferEnabled()) - { - GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); - } + if (!OpenGlHelper.isFramebufferEnabled()) { + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); + } - if (!FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) - { - Tessellator tessellator = Tessellator.instance; - this.mc.getTextureManager().bindTexture(Gui.optionsBackground); - float f = 32.0F; - tessellator.startDrawingQuads(); - tessellator.setColorOpaque_I(4210752); - tessellator.addVertexWithUV(0.0D, (double)i1, 0.0D, 0.0D, (double)((float)i1 / f)); - tessellator.addVertexWithUV((double)l, (double)i1, 0.0D, (double)((float)l / f), (double)((float)i1 / f)); - tessellator.addVertexWithUV((double)l, 0.0D, 0.0D, (double)((float)l / f), 0.0D); - tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); - tessellator.draw(); + if (!FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) { + Tessellator tessellator = Tessellator.instance; + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + float f = 32.0F; + tessellator.startDrawingQuads(); + tessellator.setColorOpaque_I(4210752); + tessellator.addVertexWithUV(0.0D, (double) i1, 0.0D, 0.0D, (double) ((float) i1 / f)); + tessellator.addVertexWithUV((double) l, (double) i1, 0.0D, (double) ((float) l / f), (double) ((float) i1 / f)); + tessellator.addVertexWithUV((double) l, 0.0D, 0.0D, (double) ((float) l / f), 0.0D); + tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + tessellator.draw(); - if (progress >= 0) - { - byte b0 = 100; - byte b1 = 2; - int j1 = l / 2 - b0 / 2; - int k1 = i1 / 2 + 16; - GL11.glDisable(GL11.GL_TEXTURE_2D); - tessellator.startDrawingQuads(); - tessellator.setColorOpaque_I(8421504); - tessellator.addVertex((double)j1, (double)k1, 0.0D); - tessellator.addVertex((double)j1, (double)(k1 + b1), 0.0D); - tessellator.addVertex((double)(j1 + b0), (double)(k1 + b1), 0.0D); - tessellator.addVertex((double)(j1 + b0), (double)k1, 0.0D); - tessellator.setColorOpaque_I(8454016); - tessellator.addVertex((double)j1, (double)k1, 0.0D); - tessellator.addVertex((double)j1, (double)(k1 + b1), 0.0D); - tessellator.addVertex((double)(j1 + progress), (double)(k1 + b1), 0.0D); - tessellator.addVertex((double)(j1 + progress), (double)k1, 0.0D); - tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } + if (progress >= 0) { + byte b0 = 100; + byte b1 = 2; + int j1 = l / 2 - b0 / 2; + int k1 = i1 / 2 + 16; + GL11.glDisable(GL11.GL_TEXTURE_2D); + tessellator.startDrawingQuads(); + tessellator.setColorOpaque_I(8421504); + tessellator.addVertex((double) j1, (double) k1, 0.0D); + tessellator.addVertex((double) j1, (double) (k1 + b1), 0.0D); + tessellator.addVertex((double) (j1 + b0), (double) (k1 + b1), 0.0D); + tessellator.addVertex((double) (j1 + b0), (double) k1, 0.0D); + tessellator.setColorOpaque_I(8454016); + tessellator.addVertex((double) j1, (double) k1, 0.0D); + tessellator.addVertex((double) j1, (double) (k1 + b1), 0.0D); + tessellator.addVertex((double) (j1 + progress), (double) (k1 + b1), 0.0D); + tessellator.addVertex((double) (j1 + progress), (double) k1, 0.0D); + tessellator.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - this.mc.fontRenderer.drawStringWithShadow(this.currentlyDisplayedText, (l - this.mc.fontRenderer.getStringWidth(this.currentlyDisplayedText)) / 2, i1 / 2 - 4 - 16, 16777215); - this.mc.fontRenderer.drawStringWithShadow(this.message, (l - this.mc.fontRenderer.getStringWidth(this.message)) / 2, i1 / 2 - 4 + 8, 16777215); - this.mc.fontRenderer.drawStringWithShadow(this.currentDisplayedTrivia, (k - this.mc.fontRenderer.getStringWidth(this.currentDisplayedTrivia)) / 2, l - 16, 0xffff99); - } + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + this.mc.fontRenderer.drawStringWithShadow(this.currentlyDisplayedText, (l - this.mc.fontRenderer.getStringWidth(this.currentlyDisplayedText)) / 2, i1 / 2 - 4 - 16, 16777215); + this.mc.fontRenderer.drawStringWithShadow(this.message, (l - this.mc.fontRenderer.getStringWidth(this.message)) / 2, i1 / 2 - 4 + 8, 16777215); + this.mc.fontRenderer.drawStringWithShadow(this.currentDisplayedTrivia, (k - this.mc.fontRenderer.getStringWidth(this.currentDisplayedTrivia)) / 2, l - 16, 0xffff99); + } - this.framebuffer.unbindFramebuffer(); + this.framebuffer.unbindFramebuffer(); - if (OpenGlHelper.isFramebufferEnabled()) - { - this.framebuffer.framebufferRender(l * k, i1 * k); - } + if (OpenGlHelper.isFramebufferEnabled()) { + this.framebuffer.framebufferRender(l * k, i1 * k); + } - this.mc.func_147120_f(); + this.mc.func_147120_f(); - try - { - Thread.yield(); - } - catch (Exception exception) - { - ; - } - } - } + try { + Thread.yield(); + } catch (Exception exception) { + ; + } + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/GuiAetherInGame.java b/src/main/java/com/legacy/aether/client/gui/GuiAetherInGame.java index 11c6433..91e6cc2 100644 --- a/src/main/java/com/legacy/aether/client/gui/GuiAetherInGame.java +++ b/src/main/java/com/legacy/aether/client/gui/GuiAetherInGame.java @@ -13,43 +13,35 @@ import com.legacy.aether.player.PlayerAether; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -public class GuiAetherInGame extends Gui -{ +public class GuiAetherInGame extends Gui { private Minecraft mc; - public GuiAetherInGame(Minecraft mc) - { + public GuiAetherInGame(Minecraft mc) { super(); this.mc = mc; } @SubscribeEvent - public void onRenderBlockOverlay(RenderBlockOverlayEvent event) - { - if (this.mc.thePlayer != null) - { + public void onRenderBlockOverlay(RenderBlockOverlayEvent event) { + if (this.mc.thePlayer != null) { PlayerAether player = PlayerAether.get(this.mc.thePlayer); - if (player.getAccessoryInventory().isWearingPhoenixSet() && event.overlayType == OverlayType.FIRE) - { + if (player.getAccessoryInventory().isWearingPhoenixSet() && event.overlayType == OverlayType.FIRE) { event.setCanceled(true); } } } @SubscribeEvent - public void onRenderGui(RenderGameOverlayEvent event) - { - if (event.isCancelable() || event.type != ElementType.TEXT) - { + public void onRenderGui(RenderGameOverlayEvent event) { + if (event.isCancelable() || event.type != ElementType.TEXT) { return; } PlayerAether player = PlayerAether.get(this.mc.thePlayer); - if (player.getEntity() != null) - { + if (player.getEntity() != null) { AetherOverlay.renderCure(this.mc); AetherOverlay.renderPoison(this.mc); AetherOverlay.renderIronBubble(this.mc); @@ -58,12 +50,11 @@ public class GuiAetherInGame extends Gui AetherOverlay.renderBossHP(this.mc); } - float portalTime = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * event.partialTicks;//player.portalAnimTime * 1.2F + (player.prevPortalAnimTime - player.portalAnimTime); + float portalTime = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * event.partialTicks;//player.portalAnimTime * 1.2F + (player.prevPortalAnimTime - player.portalAnimTime); - if(portalTime > 0.0F) - { - AetherOverlay.renderAetherPortal(portalTime, new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight)); - } + if (portalTime > 0.0F) { + AetherOverlay.renderAetherPortal(portalTime, new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight)); + } } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/GuiEnchanter.java b/src/main/java/com/legacy/aether/client/gui/GuiEnchanter.java index 6739f83..8ef8d13 100644 --- a/src/main/java/com/legacy/aether/client/gui/GuiEnchanter.java +++ b/src/main/java/com/legacy/aether/client/gui/GuiEnchanter.java @@ -15,22 +15,19 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class GuiEnchanter extends GuiContainer -{ +public class GuiEnchanter extends GuiContainer { private static final ResourceLocation TEXTURE = Aether.locate("textures/gui/altar.png"); private TileEntityEnchanter enchanter; - public GuiEnchanter(InventoryPlayer inventory, TileEntityEnchanter tileEntity) - { + public GuiEnchanter(InventoryPlayer inventory, TileEntityEnchanter tileEntity) { super(new ContainerEnchanter(inventory, tileEntity)); this.enchanter = tileEntity; } @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { + protected void drawGuiContainerForegroundLayer(int par1, int par2) { String enchanterName = this.enchanter.getInventoryName(); this.fontRendererObj.drawString(enchanterName, this.xSize / 2 - this.fontRendererObj.getStringWidth(enchanterName) / 2, 6, 4210752); @@ -38,8 +35,7 @@ public class GuiEnchanter extends GuiContainer } @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TEXTURE); int k = (this.width - this.xSize) / 2; @@ -47,8 +43,7 @@ public class GuiEnchanter extends GuiContainer this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); int i1; - if (this.enchanter.isEnchanting()) - { + if (this.enchanter.isEnchanting()) { i1 = this.enchanter.getEnchantmentTimeRemaining(12); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2); } diff --git a/src/main/java/com/legacy/aether/client/gui/GuiFreezer.java b/src/main/java/com/legacy/aether/client/gui/GuiFreezer.java index ee84c14..3b0ae80 100644 --- a/src/main/java/com/legacy/aether/client/gui/GuiFreezer.java +++ b/src/main/java/com/legacy/aether/client/gui/GuiFreezer.java @@ -15,22 +15,19 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class GuiFreezer extends GuiContainer -{ +public class GuiFreezer extends GuiContainer { private static final ResourceLocation TEXTURE = Aether.locate("textures/gui/altar.png"); private TileEntityFreezer freezer; - public GuiFreezer(InventoryPlayer inventory, TileEntityFreezer tileEntity) - { + public GuiFreezer(InventoryPlayer inventory, TileEntityFreezer tileEntity) { super(new ContainerFreezer(inventory, tileEntity)); this.freezer = tileEntity; } @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { + protected void drawGuiContainerForegroundLayer(int par1, int par2) { String freezerName = this.freezer.getInventoryName(); this.fontRendererObj.drawString(freezerName, this.xSize / 2 - this.fontRendererObj.getStringWidth(freezerName) / 2, 6, 4210752); @@ -38,8 +35,7 @@ public class GuiFreezer extends GuiContainer } @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TEXTURE); int k = (this.width - this.xSize) / 2; @@ -47,8 +43,7 @@ public class GuiFreezer extends GuiContainer this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); int i1; - if (this.freezer.isFreezing()) - { + if (this.freezer.isFreezing()) { i1 = this.freezer.getFreezingTimeRemaining(12); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2); } diff --git a/src/main/java/com/legacy/aether/client/gui/GuiIncubator.java b/src/main/java/com/legacy/aether/client/gui/GuiIncubator.java index a56c22a..6e273d4 100644 --- a/src/main/java/com/legacy/aether/client/gui/GuiIncubator.java +++ b/src/main/java/com/legacy/aether/client/gui/GuiIncubator.java @@ -12,23 +12,20 @@ import com.legacy.aether.Aether; import com.legacy.aether.inventory.ContainerIncubator; import com.legacy.aether.tileentity.TileEntityIncubator; -public class GuiIncubator extends GuiContainer -{ +public class GuiIncubator extends GuiContainer { private TileEntityIncubator incubatorInventory; private static final ResourceLocation TEXTURE_INCUBATOR = Aether.locate("textures/gui/incubator.png"); - public GuiIncubator(EntityPlayer player, InventoryPlayer inventoryplayer, TileEntityIncubator tileentityIncubator) - { + public GuiIncubator(EntityPlayer player, InventoryPlayer inventoryplayer, TileEntityIncubator tileentityIncubator) { super(new ContainerIncubator(player, inventoryplayer, tileentityIncubator)); this.incubatorInventory = (TileEntityIncubator) tileentityIncubator; } @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { + protected void drawGuiContainerForegroundLayer(int par1, int par2) { String incubatorName = this.incubatorInventory.getInventoryName(); this.fontRendererObj.drawString(incubatorName, this.xSize / 2 - this.fontRendererObj.getStringWidth(incubatorName) / 2, 6, 4210752); @@ -36,8 +33,7 @@ public class GuiIncubator extends GuiContainer } @Override - protected void drawGuiContainerBackgroundLayer(float f, int ia, int ib) - { + protected void drawGuiContainerBackgroundLayer(float f, int ia, int ib) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(TEXTURE_INCUBATOR); @@ -47,8 +43,7 @@ public class GuiIncubator extends GuiContainer this.drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize); - if (this.incubatorInventory.isIncubating()) - { + if (this.incubatorInventory.isIncubating()) { int l = this.incubatorInventory.getPowerTimeRemainingScaled(12); this.drawTexturedModalRect(j + 74, (k + 47) - l, 176, 12 - l, 14, l + 2); diff --git a/src/main/java/com/legacy/aether/client/gui/GuiLore.java b/src/main/java/com/legacy/aether/client/gui/GuiLore.java index e88f030..475e932 100644 --- a/src/main/java/com/legacy/aether/client/gui/GuiLore.java +++ b/src/main/java/com/legacy/aether/client/gui/GuiLore.java @@ -16,12 +16,11 @@ import com.legacy.aether.client.gui.button.GuiLoreButton; import com.legacy.aether.inventory.ContainerLore; import com.legacy.aether.registry.AetherLore; -public class GuiLore extends GuiContainer -{ +public class GuiLore extends GuiContainer { - private static final ResourceLocation TEXTURE_LORE = Aether.locate("textures/gui/lore.png"); + private static final ResourceLocation TEXTURE_LORE = Aether.locate("textures/gui/lore.png"); - private static final ResourceLocation TEXTURE_LORE_BOOK = Aether.locate("textures/gui/lore_book.png"); + private static final ResourceLocation TEXTURE_LORE_BOOK = Aether.locate("textures/gui/lore_book.png"); private String stringToLoad; @@ -31,78 +30,67 @@ public class GuiLore extends GuiContainer private int pageNumber; - public GuiLore(InventoryPlayer inventoryplayer) - { - super(new ContainerLore(inventoryplayer)); + public GuiLore(InventoryPlayer inventoryplayer) { + super(new ContainerLore(inventoryplayer)); - this.xSize = 256; this.ySize = 195; - } + this.xSize = 256; + this.ySize = 195; + } - @SuppressWarnings("unchecked") - public void initGui() - { - super.initGui(); + @SuppressWarnings("unchecked") + public void initGui() { + super.initGui(); - this.previousPage = new GuiLoreButton(19, this.width / 2 - 110, this.height / 2 + 72, 20, 20, "<"); - this.nextPage = new GuiLoreButton(20, this.width / 2 + 90, this.height / 2 + 72, 20, 20, ">"); + this.previousPage = new GuiLoreButton(19, this.width / 2 - 110, this.height / 2 + 72, 20, 20, "<"); + this.nextPage = new GuiLoreButton(20, this.width / 2 + 90, this.height / 2 + 72, 20, 20, ">"); - this.buttonList.add(this.previousPage); - this.buttonList.add(this.nextPage); - } - - @Override - protected void actionPerformed(GuiButton button) - { - if (this.previousPage == button) - { - --this.pageNumber; - } - else if (this.nextPage == button) - { - ++this.pageNumber; - } - } + this.buttonList.add(this.previousPage); + this.buttonList.add(this.nextPage); + } @Override - @SuppressWarnings("unchecked") - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - this.fontRendererObj.drawString("Prev.", 16, 160, 4210752); - this.fontRendererObj.drawString("Next", 218, 160, 4210752); + protected void actionPerformed(GuiButton button) { + if (this.previousPage == button) { + --this.pageNumber; + } else if (this.nextPage == button) { + ++this.pageNumber; + } + } - this.fontRendererObj.drawString("Book", 32, -5, 4210752); - this.fontRendererObj.drawString("of Lore:", 24, 4, 4210752); + @Override + @SuppressWarnings("unchecked") + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRendererObj.drawString("Prev.", 16, 160, 4210752); + this.fontRendererObj.drawString("Next", 218, 160, 4210752); - this.fontRendererObj.drawString("Item :", 75, 0, 4210752); + this.fontRendererObj.drawString("Book", 32, -5, 4210752); + this.fontRendererObj.drawString("of Lore:", 24, 4, 4210752); - ItemStack searchedStack = ((ContainerLore)this.inventorySlots).loreSlot.getStackInSlot(0); + this.fontRendererObj.drawString("Item :", 75, 0, 4210752); - if (searchedStack != null) - { - if (this.currentItem == null || (searchedStack.getItem() != this.currentItem.getItem() || (!searchedStack.isItemStackDamageable() && searchedStack.getItemDamage() != this.currentItem.getItemDamage()))) - { - this.pageNumber = 0; - this.stringToLoad = AetherLore.getLoreEntry(searchedStack); - this.currentItem = searchedStack; - } + ItemStack searchedStack = ((ContainerLore) this.inventorySlots).loreSlot.getStackInSlot(0); - int nameSize = 0; + if (searchedStack != null) { + if (this.currentItem == null || (searchedStack.getItem() != this.currentItem.getItem() || (!searchedStack.isItemStackDamageable() && searchedStack.getItemDamage() != this.currentItem.getItemDamage()))) { + this.pageNumber = 0; + this.stringToLoad = AetherLore.getLoreEntry(searchedStack); + this.currentItem = searchedStack; + } - for (String name : ((List) this.fontRendererObj.listFormattedStringToWidth(searchedStack.getItem().getItemStackDisplayName(searchedStack), 109))) - { - this.drawCenteredString(this.fontRendererObj, searchedStack.getRarity().rarityColor.toString() + name, 71, 18 + (10 * nameSize), 4210752); + int nameSize = 0; - ++nameSize; - } + for (String name : ((List) this.fontRendererObj.listFormattedStringToWidth(searchedStack.getItem().getItemStackDisplayName(searchedStack), 109))) { + this.drawCenteredString(this.fontRendererObj, searchedStack.getRarity().rarityColor.toString() + name, 71, 18 + (10 * nameSize), 4210752); + + ++nameSize; + } int size = 0; - for (String lore : ((List) this.fontRendererObj.listFormattedStringToWidth(this.stringToLoad, 109))) - { - if (size >= 15 * this.pageNumber && size + (nameSize - 1) <= 15 * (this.pageNumber + 1)) - { + for (String lore : ((List) this.fontRendererObj.listFormattedStringToWidth(this.stringToLoad, 109))) { + if (size >= 15 * this.pageNumber && size + (nameSize - 1) <= 15 * (this.pageNumber + 1)) { int actualSize = this.pageNumber >= 1 ? size - ((15 - (nameSize - 1)) * this.pageNumber) : size + (nameSize - 1); - + this.fontRendererObj.drawString(lore, (((actualSize >= 6 ? 184 : 71)) - this.fontRendererObj.getStringWidth(lore) / 2), (actualSize >= 6 ? -68 : 28) + (10 * actualSize), 4210752); } @@ -111,29 +99,26 @@ public class GuiLore extends GuiContainer this.previousPage.enabled = this.pageNumber != 0; this.nextPage.enabled = size > (15 * (this.pageNumber + 1)); - } - else - { - this.pageNumber = 0; - this.stringToLoad = ""; - this.currentItem = null; - } - } + } else { + this.pageNumber = 0; + this.stringToLoad = ""; + this.currentItem = null; + } + } - @Override - protected void drawGuiContainerBackgroundLayer(float f, int i1, int i2) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i1, int i2) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - int j = (this.width - this.xSize) / 2; - int k = (this.height - this.ySize) / 2; + int j = (this.width - this.xSize) / 2; + int k = (this.height - this.ySize) / 2; - this.mc.renderEngine.bindTexture(TEXTURE_LORE); - Gui.func_152125_a(j, k - 4, 0, 0, 120, 120, this.xSize, this.ySize + 61, 120, 120); + this.mc.renderEngine.bindTexture(TEXTURE_LORE); + Gui.func_152125_a(j, k - 4, 0, 0, 120, 120, this.xSize, this.ySize + 61, 120, 120); - this.mc.renderEngine.bindTexture(TEXTURE_LORE_BOOK); - Gui.func_146110_a(j - 1, k - 20, 0, 0, this.xSize + 20, this.ySize - 60, 275, 315); - Gui.func_146110_a(j + 90, k - 5, 0, 225, this.xSize + 20, this.ySize - 177, 500, 500); - } + this.mc.renderEngine.bindTexture(TEXTURE_LORE_BOOK); + Gui.func_146110_a(j - 1, k - 20, 0, 0, this.xSize + 20, this.ySize - 60, 275, 315); + Gui.func_146110_a(j + 90, k - 5, 0, 225, this.xSize + 20, this.ySize - 177, 500, 500); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/GuiSunAltar.java b/src/main/java/com/legacy/aether/client/gui/GuiSunAltar.java index cd926ec..60e1ceb 100644 --- a/src/main/java/com/legacy/aether/client/gui/GuiSunAltar.java +++ b/src/main/java/com/legacy/aether/client/gui/GuiSunAltar.java @@ -9,50 +9,45 @@ import net.minecraft.world.World; import com.legacy.aether.Aether; import com.legacy.aether.client.gui.button.GuiSunAltarSlider; -public class GuiSunAltar extends GuiScreen -{ +public class GuiSunAltar extends GuiScreen { private static final ResourceLocation TEXTURE = Aether.locate("textures/gui/sun_altar.png"); private World world; - public GuiSunAltar() - { + public GuiSunAltar() { } @SuppressWarnings("unchecked") @Override - public void initGui() - { + public void initGui() { super.initGui(); this.world = this.mc.theWorld; - this.buttonList.add(new GuiSunAltarSlider(this.world, this.width / 2 - 75, this.height/2, "Select Time")); + this.buttonList.add(new GuiSunAltarSlider(this.world, this.width / 2 - 75, this.height / 2, "Select Time")); } @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) - { + public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); - this.mc.renderEngine.bindTexture(TEXTURE); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(TEXTURE); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - int xSize = 175; - int ySize = 78; - int j = (this.width - xSize) / 2; - int k = (this.height - ySize) / 2; + int xSize = 175; + int ySize = 78; + int j = (this.width - xSize) / 2; + int k = (this.height - ySize) / 2; - this.drawTexturedModalRect(j, k, 0, 0, xSize, ySize); - this.fontRendererObj.drawString("Sun Altar", (this.width - this.fontRendererObj.getStringWidth("Sun Altar")) / 2, k + 20, 0x404040); + this.drawTexturedModalRect(j, k, 0, 0, xSize, ySize); + this.fontRendererObj.drawString("Sun Altar", (this.width - this.fontRendererObj.getStringWidth("Sun Altar")) / 2, k + 20, 0x404040); super.drawScreen(mouseX, mouseY, partialTicks); } @Override - public boolean doesGuiPauseGame() - { + public boolean doesGuiPauseGame() { return false; } diff --git a/src/main/java/com/legacy/aether/client/gui/GuiTreasureChest.java b/src/main/java/com/legacy/aether/client/gui/GuiTreasureChest.java index 8048d9f..1f3eaa0 100644 --- a/src/main/java/com/legacy/aether/client/gui/GuiTreasureChest.java +++ b/src/main/java/com/legacy/aether/client/gui/GuiTreasureChest.java @@ -13,60 +13,49 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class GuiTreasureChest extends GuiContainer -{ - private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png"); +public class GuiTreasureChest extends GuiContainer { + private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png"); - private final int inventoryRows; + private final int inventoryRows; - private String chestType; + private String chestType; - public GuiTreasureChest(InventoryPlayer playerInventory, TileEntityTreasureChest chestInventory) - { - super(new ContainerChest(playerInventory, chestInventory)); + public GuiTreasureChest(InventoryPlayer playerInventory, TileEntityTreasureChest chestInventory) { + super(new ContainerChest(playerInventory, chestInventory)); - this.allowUserInput = false; + this.allowUserInput = false; - this.inventoryRows = chestInventory.getSizeInventory() / 9; + this.inventoryRows = chestInventory.getSizeInventory() / 9; - this.ySize = 114 + this.inventoryRows * 18; + this.ySize = 114 + this.inventoryRows * 18; - if (chestInventory.getKind() == 0) - { + if (chestInventory.getKind() == 0) { this.chestType = "Bronze Treasure Chest"; - } - else if (chestInventory.getKind() == 1) - { + } else if (chestInventory.getKind() == 1) { this.chestType = "Silver Treasure Chest"; - } - else if (chestInventory.getKind() == 2) - { + } else if (chestInventory.getKind() == 2) { this.chestType = "Gold Treasure Chest"; - } - else - { - this.chestType = "Platinum Treasure Chest"; - } - } + } else { + this.chestType = "Platinum Treasure Chest"; + } + } - /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) - */ - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) - { - this.fontRendererObj.drawString(this.chestType, 8, 6, 4210752); - } + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + this.fontRendererObj.drawString(this.chestType, 8, 6, 4210752); + } - /** - * Draws the background layer of this container (behind the items). - */ - protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) - { + /** + * Draws the background layer of this container (behind the items). + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE); - int i = (this.width - this.xSize) / 2; - int j = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17); - this.drawTexturedModalRect(i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); - } + this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17); + this.drawTexturedModalRect(i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/button/GuiAccessoryButton.java b/src/main/java/com/legacy/aether/client/gui/button/GuiAccessoryButton.java index 1bde544..a9feebc 100644 --- a/src/main/java/com/legacy/aether/client/gui/button/GuiAccessoryButton.java +++ b/src/main/java/com/legacy/aether/client/gui/button/GuiAccessoryButton.java @@ -8,43 +8,38 @@ import org.lwjgl.opengl.GL11; import com.legacy.aether.Aether; -public class GuiAccessoryButton extends GuiButton -{ +public class GuiAccessoryButton extends GuiButton { - protected static final ResourceLocation BUTTON_TEXTURE = Aether.locate("textures/gui/inventory/button/cloud.png"); + protected static final ResourceLocation BUTTON_TEXTURE = Aether.locate("textures/gui/inventory/button/cloud.png"); - protected static final ResourceLocation BUTTON_HOVERED_TEXTURE = Aether.locate("textures/gui/inventory/button/cloud_hover.png"); + protected static final ResourceLocation BUTTON_HOVERED_TEXTURE = Aether.locate("textures/gui/inventory/button/cloud_hover.png"); - public GuiAccessoryButton(int x, int y) - { + public GuiAccessoryButton(int x, int y) { super(18067, x, y, 12, 12, ""); } - public GuiAccessoryButton setPosition(int x, int y) - { + public GuiAccessoryButton setPosition(int x, int y) { this.xPosition = x; this.yPosition = y; return this; } - @Override - public void drawButton(Minecraft mc, int mouseX, int mouseY) - { - this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) { + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - if (this.visible) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPushMatrix(); - int i = this.getHoverState(this.field_146123_n); - mc.getTextureManager().bindTexture(i == 2 ? BUTTON_HOVERED_TEXTURE : BUTTON_TEXTURE); - GL11.glEnable(GL11.GL_BLEND); + if (this.visible) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + int i = this.getHoverState(this.field_146123_n); + mc.getTextureManager().bindTexture(i == 2 ? BUTTON_HOVERED_TEXTURE : BUTTON_TEXTURE); + GL11.glEnable(GL11.GL_BLEND); - func_146110_a(this.xPosition - 1, this.yPosition, 0, 0, 14, 14, 14, 14); + func_146110_a(this.xPosition - 1, this.yPosition, 0, 0, 14, 14, 14, 14); - GL11.glPopMatrix(); - } - } + GL11.glPopMatrix(); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/button/GuiAetherButton.java b/src/main/java/com/legacy/aether/client/gui/button/GuiAetherButton.java index 0921a2f..c887f2d 100644 --- a/src/main/java/com/legacy/aether/client/gui/button/GuiAetherButton.java +++ b/src/main/java/com/legacy/aether/client/gui/button/GuiAetherButton.java @@ -13,10 +13,9 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class GuiAetherButton extends GuiButton -{ +public class GuiAetherButton extends GuiButton { - protected static final ResourceLocation buttonTextures = Aether.locate("textures/gui/buttons.png"); + protected static final ResourceLocation buttonTextures = Aether.locate("textures/gui/buttons.png"); public int scrollMax = 100; @@ -30,47 +29,34 @@ public class GuiAetherButton extends GuiButton public boolean retracting = false; - public GuiAetherButton(int i, int j, int k, String s) - { + public GuiAetherButton(int i, int j, int k, String s) { super(i, j, k, s); } @Override - public int getHoverState(boolean flag) - { + public int getHoverState(boolean flag) { byte byte0 = 1; - if (!this.enabled) - { + if (!this.enabled) { byte0 = 0; - } - else if (flag) - { - if (byte0 < 2) - { + } else if (flag) { + if (byte0 < 2) { byte0++; } - if (this.scrollCrop < this.scrollCropMax) - { + if (this.scrollCrop < this.scrollCropMax) { this.scrollCrop += 4; } - if (this.scrollHeight < this.scrollMin) - { + if (this.scrollHeight < this.scrollMin) { this.scrollHeight += 4; } - } - else - { - if (this.scrollCrop > this.scrollCropMax) - { + } else { + if (this.scrollCrop > this.scrollCropMax) { this.scrollCrop -= 4; } - if (this.scrollHeight > this.scrollMax) - { + if (this.scrollHeight > this.scrollMax) { this.scrollHeight -= 4; } - if (this.scrollHeight == this.scrollMax) - { + if (this.scrollHeight == this.scrollMax) { this.retracting = false; } } @@ -79,10 +65,8 @@ public class GuiAetherButton extends GuiButton } @Override - public void drawButton(Minecraft minecraft, int i, int j) - { - if (!this.visible) - { + public void drawButton(Minecraft minecraft, int i, int j) { + if (!this.visible) { return; } @@ -100,33 +84,25 @@ public class GuiAetherButton extends GuiButton GL11.glDisable(GL11.GL_BLEND); - if (!this.enabled) - { + if (!this.enabled) { this.drawString(fontrenderer, this.displayString, this.xPosition + this.width / 10 + this.scrollHeight - 80, this.yPosition + (this.height - 8) / 2, -6250336); - } - else if (flag) - { + } else if (flag) { this.drawString(fontrenderer, this.displayString, this.xPosition + this.width / 10 + this.scrollHeight - 80, this.yPosition + (this.height - 8) / 2, 0x77cccc); - } - else - { + } else { this.drawString(fontrenderer, this.displayString, this.xPosition + this.width / 10 + this.scrollHeight - 80, this.yPosition + (this.height - 8) / 2, 14737632); } } @Override - protected void mouseDragged(Minecraft var1, int var2, int var3) - { + protected void mouseDragged(Minecraft var1, int var2, int var3) { } @Override - public void mouseReleased(int var1, int var2) - { + public void mouseReleased(int var1, int var2) { } @Override - public boolean mousePressed(Minecraft var1, int var2, int var3) - { + public boolean mousePressed(Minecraft var1, int var2, int var3) { return this.enabled && this.visible && var2 >= this.xPosition && var3 >= this.yPosition && var2 < this.xPosition + this.width && var3 < this.yPosition + this.height; } diff --git a/src/main/java/com/legacy/aether/client/gui/button/GuiButtonPerks.java b/src/main/java/com/legacy/aether/client/gui/button/GuiButtonPerks.java index 70f6589..f391a8b 100644 --- a/src/main/java/com/legacy/aether/client/gui/button/GuiButtonPerks.java +++ b/src/main/java/com/legacy/aether/client/gui/button/GuiButtonPerks.java @@ -2,12 +2,10 @@ package com.legacy.aether.client.gui.button; import net.minecraft.client.gui.GuiButton; -public class GuiButtonPerks extends GuiButton -{ +public class GuiButtonPerks extends GuiButton { - public GuiButtonPerks(int xPos, int yPos) - { - super(24, xPos, yPos, 20, 20, "?"); - } + public GuiButtonPerks(int xPos, int yPos) { + super(24, xPos, yPos, 20, 20, "?"); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/button/GuiDescButton.java b/src/main/java/com/legacy/aether/client/gui/button/GuiDescButton.java index 3d61edf..3bf6d49 100644 --- a/src/main/java/com/legacy/aether/client/gui/button/GuiDescButton.java +++ b/src/main/java/com/legacy/aether/client/gui/button/GuiDescButton.java @@ -4,38 +4,29 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; -public class GuiDescButton extends GuiButton -{ +public class GuiDescButton extends GuiButton { public String descText; - public GuiDescButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, String descText) - { + public GuiDescButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, String descText) { super(buttonId, x, y, widthIn, heightIn, buttonText); this.descText = descText; } - public void drawButton(Minecraft mc, int mouseX, int mouseY) - { - super.drawButton(mc, mouseX, mouseY); + public void drawButton(Minecraft mc, int mouseX, int mouseY) { + super.drawButton(mc, mouseX, mouseY); - FontRenderer fontrenderer = mc.fontRenderer; + FontRenderer fontrenderer = mc.fontRenderer; - if (this.visible && this.field_146123_n) - { - if (this.displayString == "Q") - { - this.drawCenteredString(fontrenderer, this.descText, this.xPosition + (this.width + 50) / 2, this.yPosition + (this.height + 24) / 2, 0xfffffF); - } - else if (this.displayString == "W") - { - this.drawCenteredString(fontrenderer, this.descText, this.xPosition + (this.width - 50) / 2, this.yPosition + (this.height + 24) / 2, 0xfffffF); - } - else - { - this.drawCenteredString(fontrenderer, this.descText, this.xPosition + this.width / 2, this.yPosition + (this.height + 24) / 2, 0xfffffF); - } - } - } + if (this.visible && this.field_146123_n) { + if (this.displayString == "Q") { + this.drawCenteredString(fontrenderer, this.descText, this.xPosition + (this.width + 50) / 2, this.yPosition + (this.height + 24) / 2, 0xfffffF); + } else if (this.displayString == "W") { + this.drawCenteredString(fontrenderer, this.descText, this.xPosition + (this.width - 50) / 2, this.yPosition + (this.height + 24) / 2, 0xfffffF); + } else { + this.drawCenteredString(fontrenderer, this.descText, this.xPosition + this.width / 2, this.yPosition + (this.height + 24) / 2, 0xfffffF); + } + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/button/GuiLoreButton.java b/src/main/java/com/legacy/aether/client/gui/button/GuiLoreButton.java index c325667..aa8f80c 100644 --- a/src/main/java/com/legacy/aether/client/gui/button/GuiLoreButton.java +++ b/src/main/java/com/legacy/aether/client/gui/button/GuiLoreButton.java @@ -10,50 +10,40 @@ import org.lwjgl.opengl.GL11; import com.legacy.aether.Aether; -public class GuiLoreButton extends GuiButton -{ +public class GuiLoreButton extends GuiButton { - protected static final ResourceLocation BUTTON_TEXTURES = Aether.locate("textures/gui/lore_widgets.png"); + protected static final ResourceLocation BUTTON_TEXTURES = Aether.locate("textures/gui/lore_widgets.png"); - public GuiLoreButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) - { + public GuiLoreButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) { super(buttonId, x, y, widthIn, heightIn, buttonText); } @Override - public void drawButton(Minecraft mc, int mouseX, int mouseY) - { - if (this.visible) - { - FontRenderer fontrenderer = mc.fontRenderer; - mc.getTextureManager().bindTexture(BUTTON_TEXTURES); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - int i = this.getHoverState(this.field_146123_n); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + i * 20, this.width / 2, this.height); - this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height); - this.mouseDragged(mc, mouseX, mouseY); - int j = 14737632; + public void drawButton(Minecraft mc, int mouseX, int mouseY) { + if (this.visible) { + FontRenderer fontrenderer = mc.fontRenderer; + mc.getTextureManager().bindTexture(BUTTON_TEXTURES); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + int i = this.getHoverState(this.field_146123_n); + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + i * 20, this.width / 2, this.height); + this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height); + this.mouseDragged(mc, mouseX, mouseY); + int j = 14737632; - if (this.packedFGColour != 0) - { - j = this.packedFGColour; - } - else - if (!this.enabled) - { - j = 10526880; - } - else if (this.field_146123_n) - { - j = 16777120; - } + if (this.packedFGColour != 0) { + j = this.packedFGColour; + } else if (!this.enabled) { + j = 10526880; + } else if (this.field_146123_n) { + j = 16777120; + } - this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j); - } - } + this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/button/GuiSunAltarSlider.java b/src/main/java/com/legacy/aether/client/gui/button/GuiSunAltarSlider.java index 883f09e..83e6697 100644 --- a/src/main/java/com/legacy/aether/client/gui/button/GuiSunAltarSlider.java +++ b/src/main/java/com/legacy/aether/client/gui/button/GuiSunAltarSlider.java @@ -9,104 +9,88 @@ import org.lwjgl.opengl.GL11; import com.legacy.aether.network.AetherNetwork; import com.legacy.aether.network.packets.PacketSetTime; -public class GuiSunAltarSlider extends GuiButton -{ +public class GuiSunAltarSlider extends GuiButton { - public float sliderValue; + public float sliderValue; - public boolean dragging = false; + public boolean dragging = false; - private World world; + private World world; - public GuiSunAltarSlider(World world, int par2, int par3, String par5Str) - { - super(1, par2, par3, 150, 20, par5Str); + public GuiSunAltarSlider(World world, int par2, int par3, String par5Str) { + super(1, par2, par3, 150, 20, par5Str); - this.world = world; - } + this.world = world; + } - /** - * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over - * this button. - */ - public int getHoverState(boolean par1) - { - return 0; - } + /** + * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over + * this button. + */ + public int getHoverState(boolean par1) { + return 0; + } - @Override - protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) - { - if (this.visible) - { - if (this.dragging) - { - this.sliderValue = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8); + @Override + protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) { + if (this.visible) { + if (this.dragging) { + this.sliderValue = (float) (mouseX - (this.xPosition + 4)) / (float) (this.width - 8); - long shouldTime = (long)(24000L * sliderValue); - long worldTime = world.getWorldInfo().getWorldTime(); - long remainder = worldTime % 24000L; - long add = shouldTime > remainder ? shouldTime - remainder : shouldTime + 24000 - remainder; + long shouldTime = (long) (24000L * sliderValue); + long worldTime = world.getWorldInfo().getWorldTime(); + long remainder = worldTime % 24000L; + long add = shouldTime > remainder ? shouldTime - remainder : shouldTime + 24000 - remainder; - world.getWorldInfo().setWorldTime(worldTime + add); - if (this.sliderValue < 0.0F) - { - this.sliderValue = 0.0F; - } + world.getWorldInfo().setWorldTime(worldTime + add); + if (this.sliderValue < 0.0F) { + this.sliderValue = 0.0F; + } - if (this.sliderValue > 1.0F) - { - this.sliderValue = 1.0F; - } + if (this.sliderValue > 1.0F) { + this.sliderValue = 1.0F; + } - } + } - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)), this.yPosition, 0, 66, 4, 20); - this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); - } - } + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.xPosition + (int) (this.sliderValue * (float) (this.width - 8)), this.yPosition, 0, 66, 4, 20); + this.drawTexturedModalRect(this.xPosition + (int) (this.sliderValue * (float) (this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); + } + } - @Override - public void drawButton(Minecraft par1Minecraft, int mouseX, int mouseY) - { - this.sliderValue = (this.world.getWorldInfo().getWorldTime() % 24000) / 24000.0F; + @Override + public void drawButton(Minecraft par1Minecraft, int mouseX, int mouseY) { + this.sliderValue = (this.world.getWorldInfo().getWorldTime() % 24000) / 24000.0F; super.drawButton(par1Minecraft, mouseX, mouseY); } - @Override - public boolean mousePressed(Minecraft par1Minecraft, int par2, int par3) - { - if (super.mousePressed(par1Minecraft, par2, par3)) - { - this.sliderValue = (float)(par2 - (this.xPosition + 4)) / (float)(this.width - 8); + @Override + public boolean mousePressed(Minecraft par1Minecraft, int par2, int par3) { + if (super.mousePressed(par1Minecraft, par2, par3)) { + this.sliderValue = (float) (par2 - (this.xPosition + 4)) / (float) (this.width - 8); - if (this.sliderValue < 0.0F) - { - this.sliderValue = 0.0F; - } + if (this.sliderValue < 0.0F) { + this.sliderValue = 0.0F; + } - if (this.sliderValue > 1.0F) - { - this.sliderValue = 1.0F; - } + if (this.sliderValue > 1.0F) { + this.sliderValue = 1.0F; + } - this.dragging = true; - return true; - } - else - { - return false; - } - } + this.dragging = true; + return true; + } else { + return false; + } + } - @Override - public void mouseReleased(int mouseX, int mouseY) - { - this.dragging = false; + @Override + public void mouseReleased(int mouseX, int mouseY) { + this.dragging = false; - AetherNetwork.sendToServer(new PacketSetTime(this.sliderValue, Minecraft.getMinecraft().thePlayer.dimension)); - } + AetherNetwork.sendToServer(new PacketSetTime(this.sliderValue, Minecraft.getMinecraft().thePlayer.dimension)); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/dialogue/DialogueOption.java b/src/main/java/com/legacy/aether/client/gui/dialogue/DialogueOption.java index 9e748e0..9c61f59 100644 --- a/src/main/java/com/legacy/aether/client/gui/dialogue/DialogueOption.java +++ b/src/main/java/com/legacy/aether/client/gui/dialogue/DialogueOption.java @@ -7,8 +7,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -public class DialogueOption extends Gui -{ +public class DialogueOption extends Gui { private int dialogueId; @@ -20,67 +19,55 @@ public class DialogueOption extends Gui private Minecraft mc = Minecraft.getMinecraft(); - public DialogueOption(String dialogueText) - { + public DialogueOption(String dialogueText) { this.dialogueText = "[" + dialogueText + "]"; this.height = 12; this.width = this.mc.fontRenderer.getStringWidth(this.dialogueText) + 2; } - public void renderDialogue(int mouseX, int mouseY) - { - this.drawGradientRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 0x66000000, 0x66000000); - this.drawString(this.mc.fontRenderer, this.isMouseOver(mouseX, mouseY) ? EnumChatFormatting.YELLOW.toString() + this.getDialogueText() : this.getDialogueText(), this.xPosition + 2, this.yPosition + 2, 0xffffff); + public void renderDialogue(int mouseX, int mouseY) { + this.drawGradientRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 0x66000000, 0x66000000); + this.drawString(this.mc.fontRenderer, this.isMouseOver(mouseX, mouseY) ? EnumChatFormatting.YELLOW.toString() + this.getDialogueText() : this.getDialogueText(), this.xPosition + 2, this.yPosition + 2, 0xffffff); } - public boolean isMouseOver(int mouseX, int mouseY) - { + public boolean isMouseOver(int mouseX, int mouseY) { return mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; } - public void playPressSound(SoundHandler soundHandlerIn) - { - soundHandlerIn.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); - } + public void playPressSound(SoundHandler soundHandlerIn) { + soundHandlerIn.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + } - public void setDialogueText(String dialogueText) - { + public void setDialogueText(String dialogueText) { this.dialogueText = "[" + dialogueText + "]"; this.width = this.mc.fontRenderer.getStringWidth(this.dialogueText) + 2; } - public void setXPosition(int xPosition) - { + public void setXPosition(int xPosition) { this.xPosition = xPosition; } - public void setYPosition(int yPosition) - { + public void setYPosition(int yPosition) { this.yPosition = yPosition; } - public void setDialogueId(int id) - { + public void setDialogueId(int id) { this.dialogueId = id; } - public int getDialogueId() - { + public int getDialogueId() { return this.dialogueId; } - public int getHeight() - { + public int getHeight() { return this.height; } - public int getWidth() - { + public int getWidth() { return this.width; } - public String getDialogueText() - { + public String getDialogueText() { return this.dialogueText; } diff --git a/src/main/java/com/legacy/aether/client/gui/dialogue/GuiDialogue.java b/src/main/java/com/legacy/aether/client/gui/dialogue/GuiDialogue.java index 931634b..eaa4bfb 100644 --- a/src/main/java/com/legacy/aether/client/gui/dialogue/GuiDialogue.java +++ b/src/main/java/com/legacy/aether/client/gui/dialogue/GuiDialogue.java @@ -8,139 +8,114 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ChatComponentText; -public class GuiDialogue extends GuiScreen -{ +public class GuiDialogue extends GuiScreen { private ArrayList dialogueOptions = new ArrayList(); private String dialogue; - public GuiDialogue(String dialogue) - { + public GuiDialogue(String dialogue) { this.dialogue = dialogue; } - public GuiDialogue(String dialogue, DialogueOption... options) - { + public GuiDialogue(String dialogue, DialogueOption... options) { this(dialogue); this.addDialogueOptions(options); } - public void addDialogueWithOptions(String dialogue, DialogueOption... options) - { - this.dialogue = dialogue; + public void addDialogueWithOptions(String dialogue, DialogueOption... options) { + this.dialogue = dialogue; - this.dialogueOptions.clear(); + this.dialogueOptions.clear(); - this.addDialogueOptions(options); - this.positionDialogueOptions(this.getDialogueOptions()); - } - - public void initGui() - { - this.positionDialogueOptions(this.getDialogueOptions()); - } - - private void positionDialogueOptions(ArrayList options) - { - int lineNumber = 0; - - for (DialogueOption option : options) - { - option.setDialogueId(lineNumber); - option.setXPosition((this.width / 2) - (option.getWidth() / 2)); - option.setYPosition((this.height / 2) + this.fontRendererObj.listFormattedStringToWidth(this.dialogue, 300).size() * 12 + 12 * lineNumber); - - lineNumber++; - } - } - - public void addDialogueOptions(DialogueOption... options) - { - for (DialogueOption option : options) - { - this.dialogueOptions.add(option); - } + this.addDialogueOptions(options); + this.positionDialogueOptions(this.getDialogueOptions()); } - public void addDialogueMessage(String dialogueMessage) - { + public void initGui() { + this.positionDialogueOptions(this.getDialogueOptions()); + } + + private void positionDialogueOptions(ArrayList options) { + int lineNumber = 0; + + for (DialogueOption option : options) { + option.setDialogueId(lineNumber); + option.setXPosition((this.width / 2) - (option.getWidth() / 2)); + option.setYPosition((this.height / 2) + this.fontRendererObj.listFormattedStringToWidth(this.dialogue, 300).size() * 12 + 12 * lineNumber); + + lineNumber++; + } + } + + public void addDialogueOptions(DialogueOption... options) { + for (DialogueOption option : options) { + this.dialogueOptions.add(option); + } + } + + public void addDialogueMessage(String dialogueMessage) { Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(dialogueMessage)); } - public void dialogueTreeCompleted() - { + public void dialogueTreeCompleted() { this.mc.displayGuiScreen(null); } - @Override - public boolean doesGuiPauseGame() - { - return false; - } + @Override + public boolean doesGuiPauseGame() { + return false; + } @Override @SuppressWarnings("unchecked") - public void drawScreen(int mouseX, int mouseY, float partialTicks) - { - super.drawScreen(mouseX, mouseY, partialTicks); + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawScreen(mouseX, mouseY, partialTicks); - int optionWidth = 0; + int optionWidth = 0; - for (String theDialogue : ((List) this.fontRendererObj.listFormattedStringToWidth(this.dialogue, 300))) - { - int stringWidth = this.fontRendererObj.getStringWidth(theDialogue); + for (String theDialogue : ((List) this.fontRendererObj.listFormattedStringToWidth(this.dialogue, 300))) { + int stringWidth = this.fontRendererObj.getStringWidth(theDialogue); - this.drawGradientRect(this.width / 2 - stringWidth / 2 - 2, this.height / 2 + optionWidth * 12 - 2, this.width / 2 + stringWidth / 2 + 2, this.height / 2 + optionWidth * 10 + 10, 0x66000000, 0x66000000); - this.drawString(this.fontRendererObj, theDialogue, this.width / 2 - stringWidth / 2, this.height / 2 + optionWidth * 10, 0xffffff); - ++optionWidth; - } - - for (DialogueOption dialogue : this.dialogueOptions) - { - dialogue.renderDialogue(mouseX, mouseY); - } - } - - @Override - public void mouseClicked(int mouseX, int mouseY, int mouseButton) - { - if (mouseButton == 0) - { - for (DialogueOption dialogue : this.dialogueOptions) - { - if (dialogue.isMouseOver(mouseX, mouseY)) - { - dialogue.playPressSound(this.mc.getSoundHandler()); - - try - { - this.dialogueClicked(dialogue); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - } + this.drawGradientRect(this.width / 2 - stringWidth / 2 - 2, this.height / 2 + optionWidth * 12 - 2, this.width / 2 + stringWidth / 2 + 2, this.height / 2 + optionWidth * 10 + 10, 0x66000000, 0x66000000); + this.drawString(this.fontRendererObj, theDialogue, this.width / 2 - stringWidth / 2, this.height / 2 + optionWidth * 10, 0xffffff); + ++optionWidth; } - super.mouseClicked(mouseX, mouseY, mouseButton); - } - - public void dialogueClicked(DialogueOption dialogue) throws IOException - { - + for (DialogueOption dialogue : this.dialogueOptions) { + dialogue.renderDialogue(mouseX, mouseY); + } } - public ArrayList getDialogueOptions() - { + @Override + public void mouseClicked(int mouseX, int mouseY, int mouseButton) { + if (mouseButton == 0) { + for (DialogueOption dialogue : this.dialogueOptions) { + if (dialogue.isMouseOver(mouseX, mouseY)) { + dialogue.playPressSound(this.mc.getSoundHandler()); + + try { + this.dialogueClicked(dialogue); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + public void dialogueClicked(DialogueOption dialogue) throws IOException { + + } + + public ArrayList getDialogueOptions() { return this.dialogueOptions; } - public String getDialogue() - { + public String getDialogue() { return this.dialogue; } diff --git a/src/main/java/com/legacy/aether/client/gui/dialogue/entity/GuiValkyrieDialogue.java b/src/main/java/com/legacy/aether/client/gui/dialogue/entity/GuiValkyrieDialogue.java index 3019504..34b6ace 100644 --- a/src/main/java/com/legacy/aether/client/gui/dialogue/entity/GuiValkyrieDialogue.java +++ b/src/main/java/com/legacy/aether/client/gui/dialogue/entity/GuiValkyrieDialogue.java @@ -10,100 +10,76 @@ import com.legacy.aether.items.ItemsAether; import com.legacy.aether.network.AetherNetwork; import com.legacy.aether.network.packets.PacketInitiateValkyrieFight; -public class GuiValkyrieDialogue extends GuiDialogue -{ +public class GuiValkyrieDialogue extends GuiDialogue { - private EntityValkyrieQueen valkyrieQueen; + private EntityValkyrieQueen valkyrieQueen; - private String title; + private String title; - private int medalSlotId = -1; + private int medalSlotId = -1; - public GuiValkyrieDialogue(EntityValkyrieQueen valkyrieQueen) - { - super("[\247e" + valkyrieQueen.getName() + ", the Valkyrie Queen\247r]", new DialogueOption[] {new DialogueOption("What can you tell me about this place?"), new DialogueOption("I wish to fight you!"), new DialogueOption("Nevermind")}); + public GuiValkyrieDialogue(EntityValkyrieQueen valkyrieQueen) { + super("[\247e" + valkyrieQueen.getName() + ", the Valkyrie Queen\247r]", new DialogueOption[]{new DialogueOption("What can you tell me about this place?"), new DialogueOption("I wish to fight you!"), new DialogueOption("Nevermind")}); - this.title = this.getDialogue(); - this.valkyrieQueen = valkyrieQueen; - } + this.title = this.getDialogue(); + this.valkyrieQueen = valkyrieQueen; + } - @Override - public void dialogueClicked(DialogueOption dialogue) - { - if (this.getDialogueOptions().size() == 3) - { - if (dialogue.getDialogueId() == 0) - { - this.addDialogueMessage(this.title + ": This is a sanctuary for us Valkyries who seek rest."); - this.dialogueTreeCompleted(); - } - else if (dialogue.getDialogueId() == 1) - { - DialogueOption medalDialogue = new DialogueOption(this.getMedalDiaulogue()); + @Override + public void dialogueClicked(DialogueOption dialogue) { + if (this.getDialogueOptions().size() == 3) { + if (dialogue.getDialogueId() == 0) { + this.addDialogueMessage(this.title + ": This is a sanctuary for us Valkyries who seek rest."); + this.dialogueTreeCompleted(); + } else if (dialogue.getDialogueId() == 1) { + DialogueOption medalDialogue = new DialogueOption(this.getMedalDiaulogue()); - this.addDialogueWithOptions(this.title + ": Very well then. Bring me ten medals from my subordinates to prove your worth, then we'll see.", medalDialogue, new DialogueOption("On second thought, i'd rather not.")); - } - else if (dialogue.getDialogueId() == 2) - { - this.addDialogueMessage(this.title + ": Goodbye adventurer."); - this.dialogueTreeCompleted(); - } - } - else - { - if (dialogue.getDialogueId() == 0) - { - if (this.mc.theWorld.difficultySetting == EnumDifficulty.PEACEFUL) - { - this.addDialogueMessage(this.title + ": Sorry, I don't fight with weaklings."); - this.dialogueTreeCompleted(); + this.addDialogueWithOptions(this.title + ": Very well then. Bring me ten medals from my subordinates to prove your worth, then we'll see.", medalDialogue, new DialogueOption("On second thought, i'd rather not.")); + } else if (dialogue.getDialogueId() == 2) { + this.addDialogueMessage(this.title + ": Goodbye adventurer."); + this.dialogueTreeCompleted(); + } + } else { + if (dialogue.getDialogueId() == 0) { + if (this.mc.theWorld.difficultySetting == EnumDifficulty.PEACEFUL) { + this.addDialogueMessage(this.title + ": Sorry, I don't fight with weaklings."); + this.dialogueTreeCompleted(); - return; - } + return; + } - if (this.medalSlotId != -1) - { - AetherNetwork.sendToServer(new PacketInitiateValkyrieFight(this.medalSlotId, this.valkyrieQueen.getEntityId())); + if (this.medalSlotId != -1) { + AetherNetwork.sendToServer(new PacketInitiateValkyrieFight(this.medalSlotId, this.valkyrieQueen.getEntityId())); - this.valkyrieQueen.setBossReady(true); - this.addDialogueMessage(this.title + ": Now then, let's begin!"); - this.dialogueTreeCompleted(); - } - else - { - this.addDialogueMessage(this.title + ": Take your time."); - this.dialogueTreeCompleted(); - } - } - else if (dialogue.getDialogueId() == 1) - { - this.addDialogueMessage(this.title + ": So be it then. Goodbye adventurer."); - this.dialogueTreeCompleted(); - } - } - } + this.valkyrieQueen.setBossReady(true); + this.addDialogueMessage(this.title + ": Now then, let's begin!"); + this.dialogueTreeCompleted(); + } else { + this.addDialogueMessage(this.title + ": Take your time."); + this.dialogueTreeCompleted(); + } + } else if (dialogue.getDialogueId() == 1) { + this.addDialogueMessage(this.title + ": So be it then. Goodbye adventurer."); + this.dialogueTreeCompleted(); + } + } + } - private String getMedalDiaulogue() - { - for (int slotId = 0; slotId < this.mc.thePlayer.inventory.mainInventory.length; ++slotId) - { - ItemStack stack = this.mc.thePlayer.inventory.mainInventory[slotId]; + private String getMedalDiaulogue() { + for (int slotId = 0; slotId < this.mc.thePlayer.inventory.mainInventory.length; ++slotId) { + ItemStack stack = this.mc.thePlayer.inventory.mainInventory[slotId]; - if (stack != null && stack.getItem() == ItemsAether.victory_medal) - { - if (stack.stackSize >= 10) - { - this.medalSlotId = slotId; - return "I'm ready, I have the medals right here!"; - } - else - { - return "I'll return when I have them. (" + stack.stackSize + "/10)"; - } - } - } + if (stack != null && stack.getItem() == ItemsAether.victory_medal) { + if (stack.stackSize >= 10) { + this.medalSlotId = slotId; + return "I'm ready, I have the medals right here!"; + } else { + return "I'll return when I have them. (" + stack.stackSize + "/10)"; + } + } + } - return "I'll return when I have them. (0/10)"; - } + return "I'll return when I have them. (0/10)"; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/dialogue/server/GuiServerDialogue.java b/src/main/java/com/legacy/aether/client/gui/dialogue/server/GuiServerDialogue.java index 086457f..92ab0e1 100644 --- a/src/main/java/com/legacy/aether/client/gui/dialogue/server/GuiServerDialogue.java +++ b/src/main/java/com/legacy/aether/client/gui/dialogue/server/GuiServerDialogue.java @@ -8,32 +8,28 @@ import com.legacy.aether.client.gui.dialogue.GuiDialogue; import com.legacy.aether.network.AetherNetwork; import com.legacy.aether.network.packets.PacketDialogueClicked; -public class GuiServerDialogue extends GuiDialogue -{ +public class GuiServerDialogue extends GuiDialogue { - private String dialogueName; + private String dialogueName; - public GuiServerDialogue(String dialogueName, String dialogue, ArrayList dialogueText) - { - super(dialogue); + public GuiServerDialogue(String dialogueName, String dialogue, ArrayList dialogueText) { + super(dialogue); - this.dialogueName = dialogueName; + this.dialogueName = dialogueName; - ArrayList dialogueOptions = Lists.newArrayList(); + ArrayList dialogueOptions = Lists.newArrayList(); - for (String dialogueForOption : dialogueText) - { - dialogueOptions.add(new DialogueOption(dialogueForOption)); - } + for (String dialogueForOption : dialogueText) { + dialogueOptions.add(new DialogueOption(dialogueForOption)); + } - this.addDialogueOptions(dialogueOptions.toArray(new DialogueOption[] {})); - } + this.addDialogueOptions(dialogueOptions.toArray(new DialogueOption[]{})); + } - @Override - public void dialogueClicked(DialogueOption dialogue) - { - AetherNetwork.sendToServer(new PacketDialogueClicked(this.dialogueName, dialogue.getDialogueId())); - this.dialogueTreeCompleted(); - } + @Override + public void dialogueClicked(DialogueOption dialogue) { + AetherNetwork.sendToServer(new PacketDialogueClicked(this.dialogueName, dialogue.getDialogueId())); + this.dialogueTreeCompleted(); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/inventory/GuiAccessories.java b/src/main/java/com/legacy/aether/client/gui/inventory/GuiAccessories.java index 3064d2b..30badad 100644 --- a/src/main/java/com/legacy/aether/client/gui/inventory/GuiAccessories.java +++ b/src/main/java/com/legacy/aether/client/gui/inventory/GuiAccessories.java @@ -18,15 +18,13 @@ import com.legacy.aether.network.packets.PacketOpenContainer; import com.legacy.aether.player.PlayerAether; import com.legacy.aether.player.perks.AetherRankings; -public class GuiAccessories extends GuiContainer -{ +public class GuiAccessories extends GuiContainer { private static final ResourceLocation ACCESSORIES = Aether.locate("textures/gui/inventory/accessories.png"); private PlayerAether playerAether; - public GuiAccessories(PlayerAether player) - { + public GuiAccessories(PlayerAether player) { super(new ContainerAccessories(player.getAccessoryInventory(), player.getEntity())); this.playerAether = player; @@ -35,12 +33,10 @@ public class GuiAccessories extends GuiContainer @Override @SuppressWarnings("unchecked") - public void initGui() - { + public void initGui() { super.initGui(); - if (AetherRankings.isRankedPlayer(this.playerAether.getEntity().getUniqueID()) || this.playerAether.isDonator()) - { + if (AetherRankings.isRankedPlayer(this.playerAether.getEntity().getUniqueID()) || this.playerAether.isDonator()) { this.buttonList.add(new GuiButtonPerks(this.width / 2 - 108, this.height / 2 - 83)); } @@ -48,59 +44,51 @@ public class GuiAccessories extends GuiContainer } @Override - public void setWorldAndResolution(Minecraft mc, int width, int height) - { - super.setWorldAndResolution(mc, width, height); + public void setWorldAndResolution(Minecraft mc, int width, int height) { + super.setWorldAndResolution(mc, width, height); - for (int size = 0; size < this.buttonList.size(); ++size) - { + for (int size = 0; size < this.buttonList.size(); ++size) { GuiButton button = (GuiButton) this.buttonList.get(size); int id = button.id; - if (id == 13211) - { + if (id == 13211) { this.setButtonPosition(button, this.width / 2 + 65, this.height / 2 - 23); } } - } + } - private void setButtonPosition(GuiButton button, int xPosition, int yPosition) - { + private void setButtonPosition(GuiButton button, int xPosition, int yPosition) { button.xPosition = xPosition; button.yPosition = yPosition; } @Override - protected void actionPerformed(GuiButton button) - { - if (button.id == 24) - { - this.mc.displayGuiScreen(new GuiAetherPerks()); - } + protected void actionPerformed(GuiButton button) { + if (button.id == 24) { + this.mc.displayGuiScreen(new GuiAetherPerks()); + } - if (button.id == 18067) - { + if (button.id == 18067) { this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer)); AetherNetwork.sendToServer(new PacketOpenContainer(-1)); } - } + } @Override - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) - { - this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 115, 8, 4210752); - } + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 115, 8, 4210752); + } @Override - protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) - {; + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { + ; GL11.glColor3d(1.0D, 1.0D, 1.0D); this.mc.renderEngine.bindTexture(ACCESSORIES); this.drawTexturedModalRect(this.width / 2 - 88, this.height / 2 - 166 / 2, 0, 0, 176, 166); - GuiInventory.func_147046_a(this.guiLeft + 35, this.guiTop + 75, 30, (float)(this.guiLeft + 51) - (float)mouseX, (float)(this.guiTop + 75 - 50) - (float)mouseY, this.mc.thePlayer); + GuiInventory.func_147046_a(this.guiLeft + 35, this.guiTop + 75, 30, (float) (this.guiLeft + 51) - (float) mouseX, (float) (this.guiTop + 75 - 50) - (float) mouseY, this.mc.thePlayer); } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/inventory/GuiAetherPerks.java b/src/main/java/com/legacy/aether/client/gui/inventory/GuiAetherPerks.java index 1c2b76e..7e01363 100644 --- a/src/main/java/com/legacy/aether/client/gui/inventory/GuiAetherPerks.java +++ b/src/main/java/com/legacy/aether/client/gui/inventory/GuiAetherPerks.java @@ -17,8 +17,7 @@ import com.legacy.aether.player.perks.AetherRankings; import com.legacy.aether.player.perks.util.DonatorMoaSkin; import com.legacy.aether.player.perks.util.EnumAetherPerkType; -public class GuiAetherPerks extends GuiScreen -{ +public class GuiAetherPerks extends GuiScreen { private boolean enableMoaEditor, enableHaloEditor; @@ -34,170 +33,150 @@ public class GuiAetherPerks extends GuiScreen private DonatorMoaSkin moaSkin = new DonatorMoaSkin(); - protected int guiLeft; + protected int guiLeft; - protected int guiTop; + protected int guiTop; - public GuiAetherPerks() - { + public GuiAetherPerks() { super(); this.mc = Minecraft.getMinecraft(); - this.player = PlayerAether.get(this.mc.thePlayer); - this.moaSkin = this.player.donatorMoaSkin; + this.player = PlayerAether.get(this.mc.thePlayer); + this.moaSkin = this.player.donatorMoaSkin; this.moa = this.player.getEntity().ridingEntity instanceof EntityMoa ? (EntityMoa) this.player.getEntity().ridingEntity : new EntityMoa(this.mc.theWorld, AetherMoaTypes.blue); } @Override - public void updateScreen() - { - this.moaWingMarking.updateCursorCounter(); - this.moaWing.updateCursorCounter(); - this.moaBody.updateCursorCounter(); - this.moaBodyMarking.updateCursorCounter(); - this.moaEye.updateCursorCounter(); - this.moaOutside.updateCursorCounter(); + public void updateScreen() { + this.moaWingMarking.updateCursorCounter(); + this.moaWing.updateCursorCounter(); + this.moaBody.updateCursorCounter(); + this.moaBodyMarking.updateCursorCounter(); + this.moaEye.updateCursorCounter(); + this.moaOutside.updateCursorCounter(); - if (!this.moaWingMarking.getText().isEmpty()) - { - this.moaSkin.setWingMarkingColor(Integer.decode("0x" + this.moaWingMarking.getText())); - } + if (!this.moaWingMarking.getText().isEmpty()) { + this.moaSkin.setWingMarkingColor(Integer.decode("0x" + this.moaWingMarking.getText())); + } - if (!this.moaWing.getText().isEmpty()) - { - this.moaSkin.setWingColor(Integer.decode("0x" + this.moaWing.getText())); - } + if (!this.moaWing.getText().isEmpty()) { + this.moaSkin.setWingColor(Integer.decode("0x" + this.moaWing.getText())); + } - if (!this.moaBody.getText().isEmpty()) - { - this.moaSkin.setBodyColor(Integer.decode("0x" + this.moaBody.getText())); - } + if (!this.moaBody.getText().isEmpty()) { + this.moaSkin.setBodyColor(Integer.decode("0x" + this.moaBody.getText())); + } - if (!this.moaBodyMarking.getText().isEmpty()) - { - this.moaSkin.setMarkingColor(Integer.decode("0x" + this.moaBodyMarking.getText())); - } + if (!this.moaBodyMarking.getText().isEmpty()) { + this.moaSkin.setMarkingColor(Integer.decode("0x" + this.moaBodyMarking.getText())); + } - if (!this.moaEye.getText().isEmpty()) - { - this.moaSkin.setEyeColor(Integer.decode("0x" + this.moaEye.getText())); - } + if (!this.moaEye.getText().isEmpty()) { + this.moaSkin.setEyeColor(Integer.decode("0x" + this.moaEye.getText())); + } - if (!this.moaOutside.getText().isEmpty()) - { - this.moaSkin.setOutsideColor(Integer.decode("0x" + this.moaOutside.getText())); - } + if (!this.moaOutside.getText().isEmpty()) { + this.moaSkin.setOutsideColor(Integer.decode("0x" + this.moaOutside.getText())); + } - this.moaSkin.shouldUseDefualt(this.defualtSkin.displayString.contains("true")); + this.moaSkin.shouldUseDefualt(this.defualtSkin.displayString.contains("true")); - if (!this.enableHaloEditor) - { - this.enableHalo.visible = false; - } + if (!this.enableHaloEditor) { + this.enableHalo.visible = false; + } - if (!this.enableMoaEditor) - { - this.defualtSkin.visible = false; - this.confirmPreference.visible = false; - } - } + if (!this.enableMoaEditor) { + this.defualtSkin.visible = false; + this.confirmPreference.visible = false; + } + } @Override @SuppressWarnings("unchecked") - public void initGui() - { - Keyboard.enableRepeatEvents(true); + public void initGui() { + Keyboard.enableRepeatEvents(true); - this.guiLeft = (this.width - 176) / 2; - this.guiTop = (this.height - 166) / 2; + this.guiLeft = (this.width - 176) / 2; + this.guiTop = (this.height - 166) / 2; - this.buttonList.add(this.perkMoa = new GuiButton(1, 4, 17, 100, 20, "Moa Customizer")); - this.buttonList.add(this.perkHalo = new GuiButton(5, 110, 17, 100, 20, "Developer Perks")); + this.buttonList.add(this.perkMoa = new GuiButton(1, 4, 17, 100, 20, "Moa Customizer")); + this.buttonList.add(this.perkHalo = new GuiButton(5, 110, 17, 100, 20, "Developer Perks")); - this.buttonList.add(this.enableHalo = new GuiButton(6, this.width / 2 - 50, this.height - 20, 100, 20, "Enable Halo: ")); - this.buttonList.add(this.defualtSkin = new GuiButton(2, this.width / 2 - 100, this.height - 20, 100, 20, "Default skin: " + this.player.donatorMoaSkin.shouldUseDefualt())); - this.buttonList.add(this.confirmPreference = new GuiButton(4, this.width / 2, this.height - 20, 100, 20, "Confirm Skin")); + this.buttonList.add(this.enableHalo = new GuiButton(6, this.width / 2 - 50, this.height - 20, 100, 20, "Enable Halo: ")); + this.buttonList.add(this.defualtSkin = new GuiButton(2, this.width / 2 - 100, this.height - 20, 100, 20, "Default skin: " + this.player.donatorMoaSkin.shouldUseDefualt())); + this.buttonList.add(this.confirmPreference = new GuiButton(4, this.width / 2, this.height - 20, 100, 20, "Confirm Skin")); - if (!AetherRankings.isRankedPlayer(this.player.getEntity().getUniqueID())) - { - this.perkHalo.visible = false; - } + if (!AetherRankings.isRankedPlayer(this.player.getEntity().getUniqueID())) { + this.perkHalo.visible = false; + } - this.enableHalo.displayString = this.enableHalo.displayString + Boolean.toString(this.player.shouldRenderHalo ? false : true); + this.enableHalo.displayString = this.enableHalo.displayString + Boolean.toString(this.player.shouldRenderHalo ? false : true); - this.moaEye = new GuiTextField(this.fontRendererObj, (this.width / 2) + 105, 70, 45, 20); - this.moaEye.setMaxStringLength(6); - this.moaEye.setText(Integer.toHexString(this.player.donatorMoaSkin.getEyeColor())); + this.moaEye = new GuiTextField(this.fontRendererObj, (this.width / 2) + 105, 70, 45, 20); + this.moaEye.setMaxStringLength(6); + this.moaEye.setText(Integer.toHexString(this.player.donatorMoaSkin.getEyeColor())); - this.moaWingMarking = new GuiTextField(this.fontRendererObj, (this.width / 2) + 105, this.height - 40, 45, 20); - this.moaWingMarking.setMaxStringLength(6); - this.moaWingMarking.setText(Integer.toHexString(this.player.donatorMoaSkin.getWingMarkingColor())); + this.moaWingMarking = new GuiTextField(this.fontRendererObj, (this.width / 2) + 105, this.height - 40, 45, 20); + this.moaWingMarking.setMaxStringLength(6); + this.moaWingMarking.setText(Integer.toHexString(this.player.donatorMoaSkin.getWingMarkingColor())); - this.moaWing = new GuiTextField(this.fontRendererObj, (this.width / 2) + 105, this.height / 2 + 15, 45, 20); - this.moaWing.setMaxStringLength(6); - this.moaWing.setText(Integer.toHexString(this.player.donatorMoaSkin.getWingColor())); + this.moaWing = new GuiTextField(this.fontRendererObj, (this.width / 2) + 105, this.height / 2 + 15, 45, 20); + this.moaWing.setMaxStringLength(6); + this.moaWing.setText(Integer.toHexString(this.player.donatorMoaSkin.getWingColor())); - this.moaBody = new GuiTextField(this.fontRendererObj, (this.width / 2) - 155, this.height / 2 + 15, 45, 20); - this.moaBody.setMaxStringLength(6); - this.moaBody.setText(Integer.toHexString(this.player.donatorMoaSkin.getBodyColor())); + this.moaBody = new GuiTextField(this.fontRendererObj, (this.width / 2) - 155, this.height / 2 + 15, 45, 20); + this.moaBody.setMaxStringLength(6); + this.moaBody.setText(Integer.toHexString(this.player.donatorMoaSkin.getBodyColor())); - this.moaBodyMarking = new GuiTextField(this.fontRendererObj, (this.width / 2) - 155, this.height - 40, 45, 20); - this.moaBodyMarking.setMaxStringLength(6); - this.moaBodyMarking.setText(Integer.toHexString(this.player.donatorMoaSkin.getMarkingColor())); + this.moaBodyMarking = new GuiTextField(this.fontRendererObj, (this.width / 2) - 155, this.height - 40, 45, 20); + this.moaBodyMarking.setMaxStringLength(6); + this.moaBodyMarking.setText(Integer.toHexString(this.player.donatorMoaSkin.getMarkingColor())); - this.moaOutside = new GuiTextField(this.fontRendererObj, (this.width / 2) - 155, 70, 45, 20); - this.moaOutside.setMaxStringLength(6); - this.moaOutside.setText(Integer.toHexString(this.player.donatorMoaSkin.getOutsideColor())); - } + this.moaOutside = new GuiTextField(this.fontRendererObj, (this.width / 2) - 155, 70, 45, 20); + this.moaOutside.setMaxStringLength(6); + this.moaOutside.setText(Integer.toHexString(this.player.donatorMoaSkin.getOutsideColor())); + } @Override - protected void keyTyped(char typedChar, int keyCode) - { - super.keyTyped(typedChar, keyCode); + protected void keyTyped(char typedChar, int keyCode) { + super.keyTyped(typedChar, keyCode); - if (this.enableMoaEditor) - { - if (keyCode > 1 && keyCode < 12 || keyCode == 14 || keyCode == 30 || keyCode == 48 || keyCode == 46 || keyCode == 32 || keyCode == 18 || keyCode == 33) - { - this.moaWingMarking.textboxKeyTyped(typedChar, keyCode); - this.moaWing.textboxKeyTyped(typedChar, keyCode); - this.moaBody.textboxKeyTyped(typedChar, keyCode); - this.moaBodyMarking.textboxKeyTyped(typedChar, keyCode); - this.moaEye.textboxKeyTyped(typedChar, keyCode); - this.moaOutside.textboxKeyTyped(typedChar, keyCode); - } - } - } + if (this.enableMoaEditor) { + if (keyCode > 1 && keyCode < 12 || keyCode == 14 || keyCode == 30 || keyCode == 48 || keyCode == 46 || keyCode == 32 || keyCode == 18 || keyCode == 33) { + this.moaWingMarking.textboxKeyTyped(typedChar, keyCode); + this.moaWing.textboxKeyTyped(typedChar, keyCode); + this.moaBody.textboxKeyTyped(typedChar, keyCode); + this.moaBodyMarking.textboxKeyTyped(typedChar, keyCode); + this.moaEye.textboxKeyTyped(typedChar, keyCode); + this.moaOutside.textboxKeyTyped(typedChar, keyCode); + } + } + } @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) - { - super.mouseClicked(mouseX, mouseY, mouseButton); + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { + super.mouseClicked(mouseX, mouseY, mouseButton); - if (this.enableMoaEditor) - { - this.moaWingMarking.mouseClicked(mouseX, mouseY, mouseButton); - this.moaWing.mouseClicked(mouseX, mouseY, mouseButton); - this.moaBody.mouseClicked(mouseX, mouseY, mouseButton); - this.moaBodyMarking.mouseClicked(mouseX, mouseY, mouseButton); - this.moaEye.mouseClicked(mouseX, mouseY, mouseButton); - this.moaOutside.mouseClicked(mouseX, mouseY, mouseButton); - } - } + if (this.enableMoaEditor) { + this.moaWingMarking.mouseClicked(mouseX, mouseY, mouseButton); + this.moaWing.mouseClicked(mouseX, mouseY, mouseButton); + this.moaBody.mouseClicked(mouseX, mouseY, mouseButton); + this.moaBodyMarking.mouseClicked(mouseX, mouseY, mouseButton); + this.moaEye.mouseClicked(mouseX, mouseY, mouseButton); + this.moaOutside.mouseClicked(mouseX, mouseY, mouseButton); + } + } @Override - public void onGuiClosed() - { - Keyboard.enableRepeatEvents(false); + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); AetherNetwork.sendToServer(new PacketPerkChanged(this.player.getEntity().getEntityId(), EnumAetherPerkType.Moa, this.moaSkin)); - } + } @Override - protected void actionPerformed(GuiButton button) - { - if (button.id == 1) - { + protected void actionPerformed(GuiButton button) { + if (button.id == 1) { boolean shouldEnable = this.enableMoaEditor ? false : true; this.enableMoaEditor = shouldEnable; @@ -205,92 +184,77 @@ public class GuiAetherPerks extends GuiScreen this.enableHalo.visible = false; this.confirmPreference.visible = true; this.defualtSkin.visible = true; - } - else if (button.id == 2) - { + } else if (button.id == 2) { boolean enableDefualt = this.player.donatorMoaSkin.shouldUseDefualt() ? false : true; this.defualtSkin.displayString = "Use Default: " + Boolean.toString(enableDefualt); this.player.donatorMoaSkin.shouldUseDefualt(enableDefualt); - } - else if (button.id == 4) - { + } else if (button.id == 4) { AetherNetwork.sendToServer(new PacketPerkChanged(this.player.getEntity().getEntityId(), EnumAetherPerkType.Moa, this.moaSkin)); - } - else if (button.id == 5) - { + } else if (button.id == 5) { boolean shouldEnable = this.enableHaloEditor ? false : true; this.enableHaloEditor = shouldEnable; this.enableMoaEditor = false; this.enableHalo.visible = true; - } - else if (button.id == 6) - { + } else if (button.id == 6) { boolean enableHalo = this.player.shouldRenderHalo ? false : true; this.player.shouldRenderHalo = enableHalo; AetherNetwork.sendToServer(new PacketPerkChanged(this.player.getEntity().getEntityId(), EnumAetherPerkType.Halo, enableHalo)); this.enableHalo.displayString = "Enable Halo: " + Boolean.toString(enableHalo); } - } + } @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) - { - this.drawDefaultBackground(); + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); - this.drawCenteredString(this.fontRendererObj, "Donator Options", 45, 4, 16777215); + this.drawCenteredString(this.fontRendererObj, "Donator Options", 45, 4, 16777215); - if (this.enableMoaEditor) - { - GuiInventory.func_147046_a(this.width / 2, this.height / 2 + (this.height / 2) - 30, (this.height / 3) - 20, (float)(this.guiLeft + 51) - (float)mouseX, (float)(75 - 50) - (float)mouseY, this.moa); + if (this.enableMoaEditor) { + GuiInventory.func_147046_a(this.width / 2, this.height / 2 + (this.height / 2) - 30, (this.height / 3) - 20, (float) (this.guiLeft + 51) - (float) mouseX, (float) (75 - 50) - (float) mouseY, this.moa); - /* Left Side*/ + /* Left Side*/ - this.drawString(this.fontRendererObj, "Leg/Beak Color", (this.width / 2) - 170, 55, 16777215); + this.drawString(this.fontRendererObj, "Leg/Beak Color", (this.width / 2) - 170, 55, 16777215); - this.drawString(this.fontRendererObj, "Body Color", (this.width / 2) - 160, this.height / 2, 16777215); + this.drawString(this.fontRendererObj, "Body Color", (this.width / 2) - 160, this.height / 2, 16777215); - this.drawString(this.fontRendererObj, "Body Marking Color", (this.width / 2) - 180, this.height - 55, 16777215); + this.drawString(this.fontRendererObj, "Body Marking Color", (this.width / 2) - 180, this.height - 55, 16777215); - /* Right Side */ + /* Right Side */ - this.drawString(this.fontRendererObj, "Eye Color", (this.width / 2) + 104, 55, 16777215); + this.drawString(this.fontRendererObj, "Eye Color", (this.width / 2) + 104, 55, 16777215); - this.drawString(this.fontRendererObj, "Wing Color", (this.width / 2) + 102, this.height / 2, 16777215); + this.drawString(this.fontRendererObj, "Wing Color", (this.width / 2) + 102, this.height / 2, 16777215); - this.drawString(this.fontRendererObj, "Wing Marking Color", (this.width / 2) + 82, this.height - 55, 16777215); + this.drawString(this.fontRendererObj, "Wing Marking Color", (this.width / 2) + 82, this.height - 55, 16777215); - this.moaWingMarking.drawTextBox(); - this.moaWing.drawTextBox(); - this.moaBody.drawTextBox(); - this.moaBodyMarking.drawTextBox(); - this.moaEye.drawTextBox(); - this.moaOutside.drawTextBox(); - } + this.moaWingMarking.drawTextBox(); + this.moaWing.drawTextBox(); + this.moaBody.drawTextBox(); + this.moaBodyMarking.drawTextBox(); + this.moaEye.drawTextBox(); + this.moaOutside.drawTextBox(); + } - if (this.enableHaloEditor) - { - GuiInventory.func_147046_a(this.width / 2, this.height / 2 + (this.height / 2) - 30, (this.height / 3) - 20, (float)(this.guiLeft + 51) - (float)mouseX, (float)(75 - 50) - (float)mouseY, this.player.getEntity()); - } + if (this.enableHaloEditor) { + GuiInventory.func_147046_a(this.width / 2, this.height / 2 + (this.height / 2) - 30, (this.height / 3) - 20, (float) (this.guiLeft + 51) - (float) mouseX, (float) (75 - 50) - (float) mouseY, this.player.getEntity()); + } - super.drawScreen(mouseX, mouseY, partialTicks); - } + super.drawScreen(mouseX, mouseY, partialTicks); + } @Override - public void drawWorldBackground(int tint) - { - this.drawGradientRect(0, 0, this.width, 50, -1072689136, -804253680); + public void drawWorldBackground(int tint) { + this.drawGradientRect(0, 0, this.width, 50, -1072689136, -804253680); - if (this.mc.theWorld != null) - { - this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680); - } - else - { - this.drawBackground(tint); - } - } + if (this.mc.theWorld != null) { + this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680); + } else { + this.drawBackground(tint); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/gui/trivia/AetherTrivia.java b/src/main/java/com/legacy/aether/client/gui/trivia/AetherTrivia.java index 9d255e2..bfcc06f 100644 --- a/src/main/java/com/legacy/aether/client/gui/trivia/AetherTrivia.java +++ b/src/main/java/com/legacy/aether/client/gui/trivia/AetherTrivia.java @@ -12,61 +12,46 @@ import net.minecraft.client.Minecraft; import com.google.common.collect.Lists; import com.legacy.aether.Aether; -public class AetherTrivia -{ +public class AetherTrivia { - private static Random random = new Random(); + private static Random random = new Random(); - public AetherTrivia() - { - - } + public AetherTrivia() { - public static String getNewTrivia() - { - BufferedReader bufferedreader = null; + } - try - { - List list = Lists.newArrayList(); - bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(Aether.locate("texts/trivia.txt")).getInputStream(), StandardCharsets.UTF_8)); - String s; + public static String getNewTrivia() { + BufferedReader bufferedreader = null; - while ((s = bufferedreader.readLine()) != null) - { - s = s.trim(); + try { + List list = Lists.newArrayList(); + bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(Aether.locate("texts/trivia.txt")).getInputStream(), StandardCharsets.UTF_8)); + String s; - if (!s.isEmpty()) - { - list.add(s); - } - } + while ((s = bufferedreader.readLine()) != null) { + s = s.trim(); - if (!list.isEmpty()) - { - return "Pro Tip: " + (String)list.get(random.nextInt(list.size())); - } - } - catch (IOException var8) - { - ; - } - finally - { - if (bufferedreader != null) - { - try - { - bufferedreader.close(); - } - catch (IOException ioexception) - { - ; - } - } - } + if (!s.isEmpty()) { + list.add(s); + } + } - return "missingno"; - } + if (!list.isEmpty()) { + return "Pro Tip: " + (String) list.get(random.nextInt(list.size())); + } + } catch (IOException var8) { + ; + } finally { + if (bufferedreader != null) { + try { + bufferedreader.close(); + } catch (IOException ioexception) { + ; + } + } + } + + return "missingno"; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/attachments/ModelAetherWings.java b/src/main/java/com/legacy/aether/client/models/attachments/ModelAetherWings.java index 45613de..7e90fc3 100644 --- a/src/main/java/com/legacy/aether/client/models/attachments/ModelAetherWings.java +++ b/src/main/java/com/legacy/aether/client/models/attachments/ModelAetherWings.java @@ -4,8 +4,7 @@ import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelAetherWings extends ModelBiped -{ +public class ModelAetherWings extends ModelBiped { public ModelRenderer wingLeft; @@ -15,18 +14,15 @@ public class ModelAetherWings extends ModelBiped public boolean gonRound; - public ModelAetherWings() - { + public ModelAetherWings() { this(0.0F); } - public ModelAetherWings(float f) - { + public ModelAetherWings(float f) { this(f, 0.0F); } - public ModelAetherWings(float f, float f1) - { + public ModelAetherWings(float f, float f1) { this.isSneak = false; this.wingLeft = new ModelRenderer(this, 24, 31); @@ -40,22 +36,19 @@ public class ModelAetherWings extends ModelBiped } @Override - public void render(Entity e, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity e, float f, float f1, float f2, float f3, float f4, float f5) { this.setRotationAngles(f, f1, f2, f3, f4, f5, e); this.wingLeft.renderWithRotation(f5); this.wingRight.renderWithRotation(f5); } - public void setWingSinage(float sinage) - { + public void setWingSinage(float sinage) { this.sinage = sinage; } @Override - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { this.gonRound = entity.onGround; this.wingLeft.rotateAngleY = -0.4F; @@ -63,19 +56,16 @@ public class ModelAetherWings extends ModelBiped this.wingLeft.rotateAngleZ = -0.125F; this.wingRight.rotateAngleZ = 0.125F; - if (entity.isSneaking()) - { + if (entity.isSneaking()) { this.wingLeft.rotateAngleX = 0.45F; this.wingRight.rotateAngleX = 0.45F; this.wingLeft.offsetY = -0.17F; this.wingRight.offsetY = -0.17F; this.wingLeft.offsetZ = 0.112F; this.wingRight.offsetZ = 0.112F; - } - else - { + } else { this.wingLeft.rotateAngleX = this.wingLeft.offsetZ = this.wingLeft.offsetY = - this.wingRight.rotateAngleX = this.wingRight.offsetZ = this.wingRight.offsetY = 0.0F; + this.wingRight.rotateAngleX = this.wingRight.offsetZ = this.wingRight.offsetY = 0.0F; } this.wingLeft.rotateAngleY += Math.sin(this.sinage) / 6F; diff --git a/src/main/java/com/legacy/aether/client/models/attachments/ModelHalo.java b/src/main/java/com/legacy/aether/client/models/attachments/ModelHalo.java index 95ebe6f..476e4ea 100644 --- a/src/main/java/com/legacy/aether/client/models/attachments/ModelHalo.java +++ b/src/main/java/com/legacy/aether/client/models/attachments/ModelHalo.java @@ -3,43 +3,40 @@ package com.legacy.aether.client.models.attachments; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; -public class ModelHalo extends ModelBiped -{ +public class ModelHalo extends ModelBiped { - public ModelRenderer halo1, halo2, halo3, halo4; - - public ModelHalo() - { - this.textureWidth = 64; - this.textureHeight = 32; + public ModelRenderer halo1, halo2, halo3, halo4; - this.halo1 = new ModelRenderer(this, 0, 0); - this.halo1.addBox(-3F, 0F, -2F, 1, 1, 4); - this.halo1.setTextureSize(64, 32); - this.halo1.setRotationPoint(0.0F, 0F, 0F); - this.halo2 = new ModelRenderer(this, 0, 0); - this.halo2.addBox(2F, 0F, -2F, 1, 1, 4); - this.halo2.setTextureSize(64, 32); - this.halo3 = new ModelRenderer(this, 0, 0); - this.halo3.addBox(-2F, 0F, 2F, 4, 1, 1); - this.halo3.setTextureSize(64, 32); - this.halo4 = new ModelRenderer(this, 0, 0); - this.halo4.addBox(-2F, 0F, -3F, 4, 1, 1); - this.halo4.setTextureSize(64, 32); - this.halo4.setRotationPoint(0.0F, 0F, 0.0F); - } + public ModelHalo() { + this.textureWidth = 64; + this.textureHeight = 32; - public void renderHalo(float scale) - { - this.halo1.rotateAngleY = this.halo2.rotateAngleY = this.halo3.rotateAngleY = this.halo4.rotateAngleY = this.bipedHead.rotateAngleY; - this.halo1.rotateAngleX = this.halo2.rotateAngleX = this.halo3.rotateAngleX = this.halo4.rotateAngleX = this.bipedHead.rotateAngleX; - this.halo1.rotationPointX = this.halo2.rotationPointX = this.halo3.rotationPointX = this.halo4.rotationPointX = 0.0F; - this.halo1.rotationPointY = this.halo2.rotationPointY = this.halo3.rotationPointY = this.halo4.rotationPointY = 0.0F; + this.halo1 = new ModelRenderer(this, 0, 0); + this.halo1.addBox(-3F, 0F, -2F, 1, 1, 4); + this.halo1.setTextureSize(64, 32); + this.halo1.setRotationPoint(0.0F, 0F, 0F); + this.halo2 = new ModelRenderer(this, 0, 0); + this.halo2.addBox(2F, 0F, -2F, 1, 1, 4); + this.halo2.setTextureSize(64, 32); + this.halo3 = new ModelRenderer(this, 0, 0); + this.halo3.addBox(-2F, 0F, 2F, 4, 1, 1); + this.halo3.setTextureSize(64, 32); + this.halo4 = new ModelRenderer(this, 0, 0); + this.halo4.addBox(-2F, 0F, -3F, 4, 1, 1); + this.halo4.setTextureSize(64, 32); + this.halo4.setRotationPoint(0.0F, 0F, 0.0F); + } - this.halo1.render(scale); - this.halo2.render(scale); - this.halo3.render(scale); - this.halo4.render(scale); - } + public void renderHalo(float scale) { + this.halo1.rotateAngleY = this.halo2.rotateAngleY = this.halo3.rotateAngleY = this.halo4.rotateAngleY = this.bipedHead.rotateAngleY; + this.halo1.rotateAngleX = this.halo2.rotateAngleX = this.halo3.rotateAngleX = this.halo4.rotateAngleX = this.bipedHead.rotateAngleX; + this.halo1.rotationPointX = this.halo2.rotationPointX = this.halo3.rotationPointX = this.halo4.rotationPointX = 0.0F; + this.halo1.rotationPointY = this.halo2.rotationPointY = this.halo3.rotationPointY = this.halo4.rotationPointY = 0.0F; + + this.halo1.render(scale); + this.halo2.render(scale); + this.halo3.render(scale); + this.halo4.render(scale); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/AechorPlantModel.java b/src/main/java/com/legacy/aether/client/models/entities/AechorPlantModel.java index 839a31b..b852955 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/AechorPlantModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/AechorPlantModel.java @@ -6,8 +6,7 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class AechorPlantModel extends ModelBase -{ +public class AechorPlantModel extends ModelBase { private ModelRenderer petal[]; @@ -29,18 +28,15 @@ public class AechorPlantModel extends ModelBase public float size; - public AechorPlantModel() - { - this(0.0F); - } + public AechorPlantModel() { + this(0.0F); + } - public AechorPlantModel(float modelSize) - { - this(modelSize, 0.0F); - } + public AechorPlantModel(float modelSize) { + this(modelSize, 0.0F); + } - public AechorPlantModel(float modelSize, float rotationPointY) - { + public AechorPlantModel(float modelSize, float rotationPointY) { this.size = 1.0F; this.petal = new ModelRenderer[10]; @@ -49,18 +45,14 @@ public class AechorPlantModel extends ModelBase this.stamen2 = new ModelRenderer[3]; this.thorn = new ModelRenderer[4]; - for(int i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) { this.petal[i] = new ModelRenderer(this, 0, 0); - if(i % 2 == 0) - { + if (i % 2 == 0) { this.petal[i] = new ModelRenderer(this, 29, 3); this.petal[i].addBox(-4F, -1F, -12F, 8, 1, 9, modelSize - 0.25F); this.petal[i].setRotationPoint(0.0F, 1.0F + rotationPointY, 0.0F); - } - else - { + } else { this.petal[i].addBox(-4F, -1F, -13F, 8, 1, 10, modelSize - 0.125F); this.petal[i].setRotationPoint(0.0F, 1.0F + rotationPointY, 0.0F); } @@ -70,15 +62,13 @@ public class AechorPlantModel extends ModelBase this.leaf[i].setRotationPoint(0.0F, 1.0F + rotationPointY, 0.0F); } - for(int i = 0; i < 3; i++) - { + for (int i = 0; i < 3; i++) { this.stamen[i] = new ModelRenderer(this, 36, 13); this.stamen[i].addBox(0F, -9F, -1.5F, 1, 6, 1, modelSize - 0.25F); this.stamen[i].setRotationPoint(0.0F, 1.0F + rotationPointY, 0.0F); } - - for(int i = 0; i < 3; i++) - { + + for (int i = 0; i < 3; i++) { this.stamen2[i] = new ModelRenderer(this, 32, 15); this.stamen2[i].addBox(0F, -10F, -1.5F, 1, 1, 1, modelSize + 0.125F); this.stamen2[i].setRotationPoint(0.0F, 1.0F + rotationPointY, 0.0F); @@ -92,8 +82,7 @@ public class AechorPlantModel extends ModelBase this.stem.addBox(-1F, 0F, -1F, 2, 6, 2, modelSize); this.stem.setRotationPoint(0.0F, 1.0F + rotationPointY, 0.0F); - for(int i = 0; i < 4; i++) - { + for (int i = 0; i < 4; i++) { this.thorn[i] = new ModelRenderer(this, 32, 13); this.thorn[i].setRotationPoint(0.0F, 1.0F + rotationPointY, 0.0F); } @@ -104,41 +93,36 @@ public class AechorPlantModel extends ModelBase this.thorn[3].addBox(0F, 2.25F, -1.75F, 1, 1, 1, modelSize - 0.25F); } - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 1.2F, 0.0F); - GL11.glScalef(this.size, this.size, this.size); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 1.2F, 0.0F); + GL11.glScalef(this.size, this.size, this.size); - for(int i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) { this.petal[i].render(scale); this.leaf[i].render(scale); } - for(int i = 0; i < 3; i++) - { + for (int i = 0; i < 3; i++) { this.stamen[i].render(scale); this.stamen2[i].render(scale); } - this.head.render(scale); + this.head.render(scale); this.stem.render(scale); - for(int i = 0; i < 4; i++) - { + for (int i = 0; i < 4; i++) { this.thorn[i].render(scale); } GL11.glPopMatrix(); } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { this.head.rotateAngleX = 0.0F; this.head.rotateAngleY = headPitch / 57.29578F; @@ -147,45 +131,42 @@ public class AechorPlantModel extends ModelBase this.stem.rotateAngleY = head.rotateAngleY; this.stem.rotationPointY = boff * 0.5F; - for(int i = 0; i < 10; i++) - { - if (i < 3) - { - this.stamen[i].rotateAngleX = 0.2F + ((float)i / 15F); - this.stamen[i].rotateAngleY = head.rotateAngleY + 0.1F; - this.stamen[i].rotateAngleY += ((Math.PI * 2) / (float)3) * (float)i; - this.stamen[i].rotateAngleX += sinage * 0.4F; - - this.stamen2[i].rotateAngleX = 0.2F + ((float)i / 15F); - this.stamen2[i].rotateAngleY = head.rotateAngleY + 0.1F; - this.stamen2[i].rotateAngleY += ((Math.PI * 2) / (float)3) * (float)i; - this.stamen2[i].rotateAngleX += sinage * 0.4F; - - this.stamen[i].rotationPointY = boff + ((sinage) * 2F); - this.stamen2[i].rotationPointY = boff + ((sinage) * 2F); - } + for (int i = 0; i < 10; i++) { + if (i < 3) { + this.stamen[i].rotateAngleX = 0.2F + ((float) i / 15F); + this.stamen[i].rotateAngleY = head.rotateAngleY + 0.1F; + this.stamen[i].rotateAngleY += ((Math.PI * 2) / (float) 3) * (float) i; + this.stamen[i].rotateAngleX += sinage * 0.4F; - if (i < 4) - { - this.thorn[i].rotateAngleY = head.rotateAngleY; - this.thorn[i].rotationPointY = boff * 0.5F; - } + this.stamen2[i].rotateAngleX = 0.2F + ((float) i / 15F); + this.stamen2[i].rotateAngleY = head.rotateAngleY + 0.1F; + this.stamen2[i].rotateAngleY += ((Math.PI * 2) / (float) 3) * (float) i; + this.stamen2[i].rotateAngleX += sinage * 0.4F; - this.petal[i].rotateAngleX = ((i % 2 == 0) ? -0.25F : -0.4125F); - this.petal[i].rotateAngleX += sinage; - this.petal[i].rotateAngleY = head.rotateAngleY; - this.petal[i].rotateAngleY += ((Math.PI * 2) / (float)10) * (float)i; - - this.leaf[i].rotateAngleX = ((i % 2 == 0) ? 0.1F : 0.2F); + this.stamen[i].rotationPointY = boff + ((sinage) * 2F); + this.stamen2[i].rotationPointY = boff + ((sinage) * 2F); + } + + if (i < 4) { + this.thorn[i].rotateAngleY = head.rotateAngleY; + this.thorn[i].rotationPointY = boff * 0.5F; + } + + this.petal[i].rotateAngleX = ((i % 2 == 0) ? -0.25F : -0.4125F); + this.petal[i].rotateAngleX += sinage; + this.petal[i].rotateAngleY = head.rotateAngleY; + this.petal[i].rotateAngleY += ((Math.PI * 2) / (float) 10) * (float) i; + + this.leaf[i].rotateAngleX = ((i % 2 == 0) ? 0.1F : 0.2F); this.leaf[i].rotateAngleX += sinage * 0.75F; - this.leaf[i].rotateAngleY = (float) (head.rotateAngleY + ((Math.PI * 2) / (float)10 / 2F)); - this.leaf[i].rotateAngleY += ((Math.PI * 2) / (float)10) * (float)i; - + this.leaf[i].rotateAngleY = (float) (head.rotateAngleY + ((Math.PI * 2) / (float) 10 / 2F)); + this.leaf[i].rotateAngleY += ((Math.PI * 2) / (float) 10) * (float) i; + this.petal[i].rotationPointY = boff; this.leaf[i].rotationPointY = boff; - } + } this.head.rotationPointY = boff + ((sinage) * 2F); - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/AerbunnyModel.java b/src/main/java/com/legacy/aether/client/models/entities/AerbunnyModel.java index 1bfccbe..1f683be 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/AerbunnyModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/AerbunnyModel.java @@ -7,134 +7,127 @@ import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; -public class AerbunnyModel extends ModelBase -{ +public class AerbunnyModel extends ModelBase { - public ModelRenderer a; - public ModelRenderer b; - public ModelRenderer b2; - public ModelRenderer b3; - public ModelRenderer e1; - public ModelRenderer e2; - public ModelRenderer ff1; - public ModelRenderer ff2; - public ModelRenderer g; - public ModelRenderer g2; - public ModelRenderer h; - public ModelRenderer h2; - public float puffiness; + public ModelRenderer a; + public ModelRenderer b; + public ModelRenderer b2; + public ModelRenderer b3; + public ModelRenderer e1; + public ModelRenderer e2; + public ModelRenderer ff1; + public ModelRenderer ff2; + public ModelRenderer g; + public ModelRenderer g2; + public ModelRenderer h; + public ModelRenderer h2; + public float puffiness; - public AerbunnyModel() - { - byte byte0 = 16; - this.a = new ModelRenderer(this, 0, 0); - this.a.addBox(-2.0F, -1.0F, -4.0F, 4, 4, 6, 0.0F); - this.a.setRotationPoint(0.0F, (float)(-1 + byte0), -4.0F); - this.g = new ModelRenderer(this, 14, 0); - this.g.addBox(-2.0F, -5.0F, -3.0F, 1, 4, 2, 0.0F); - this.g.setRotationPoint(0.0F, (float)(-1 + byte0), -4.0F); - this.g2 = new ModelRenderer(this, 14, 0); - this.g2.addBox(1.0F, -5.0F, -3.0F, 1, 4, 2, 0.0F); - this.g2.setRotationPoint(0.0F, (float)(-1 + byte0), -4.0F); - this.h = new ModelRenderer(this, 20, 0); - this.h.addBox(-4.0F, 0.0F, -3.0F, 2, 3, 2, 0.0F); - this.h.setRotationPoint(0.0F, (float)(-1 + byte0), -4.0F); - this.h2 = new ModelRenderer(this, 20, 0); - this.h2.addBox(2.0F, 0.0F, -3.0F, 2, 3, 2, 0.0F); - this.h2.setRotationPoint(0.0F, (float)(-1 + byte0), -4.0F); - this.b = new ModelRenderer(this, 0, 10); - this.b.addBox(-3.0F, -4.0F, -3.0F, 6, 8, 6, 0.0F); - this.b.setRotationPoint(0.0F, (float)(0 + byte0), 0.0F); - this.b2 = new ModelRenderer(this, 0, 24); - this.b2.addBox(-2.0F, 4.0F, -2.0F, 4, 3, 4, 0.0F); - this.b2.setRotationPoint(0.0F, (float)(0 + byte0), 0.0F); - this.b3 = new ModelRenderer(this, 29, 0); - this.b3.addBox(-3.5F, -3.5F, -3.5F, 7, 7, 7, 0.0F); - this.b3.setRotationPoint(0.0F, 0.0F, 0.0F); - this.e1 = new ModelRenderer(this, 24, 16); - this.e1.addBox(-2.0F, 0.0F, -1.0F, 2, 2, 2); - this.e1.setRotationPoint(3.0F, (float)(3 + byte0), -3.0F); - this.e2 = new ModelRenderer(this, 24, 16); - this.e2.addBox(0.0F, 0.0F, -1.0F, 2, 2, 2); - this.e2.setRotationPoint(-3.0F, (float)(3 + byte0), -3.0F); - this.ff1 = new ModelRenderer(this, 16, 24); - this.ff1.addBox(-2.0F, 0.0F, -4.0F, 2, 2, 4); - this.ff1.setRotationPoint(3.0F, (float)(3 + byte0), 4.0F); - this.ff2 = new ModelRenderer(this, 16, 24); - this.ff2.addBox(0.0F, 0.0F, -4.0F, 2, 2, 4); - this.ff2.setRotationPoint(-3.0F, (float)(3 + byte0), 4.0F); - } + public AerbunnyModel() { + byte byte0 = 16; + this.a = new ModelRenderer(this, 0, 0); + this.a.addBox(-2.0F, -1.0F, -4.0F, 4, 4, 6, 0.0F); + this.a.setRotationPoint(0.0F, (float) (-1 + byte0), -4.0F); + this.g = new ModelRenderer(this, 14, 0); + this.g.addBox(-2.0F, -5.0F, -3.0F, 1, 4, 2, 0.0F); + this.g.setRotationPoint(0.0F, (float) (-1 + byte0), -4.0F); + this.g2 = new ModelRenderer(this, 14, 0); + this.g2.addBox(1.0F, -5.0F, -3.0F, 1, 4, 2, 0.0F); + this.g2.setRotationPoint(0.0F, (float) (-1 + byte0), -4.0F); + this.h = new ModelRenderer(this, 20, 0); + this.h.addBox(-4.0F, 0.0F, -3.0F, 2, 3, 2, 0.0F); + this.h.setRotationPoint(0.0F, (float) (-1 + byte0), -4.0F); + this.h2 = new ModelRenderer(this, 20, 0); + this.h2.addBox(2.0F, 0.0F, -3.0F, 2, 3, 2, 0.0F); + this.h2.setRotationPoint(0.0F, (float) (-1 + byte0), -4.0F); + this.b = new ModelRenderer(this, 0, 10); + this.b.addBox(-3.0F, -4.0F, -3.0F, 6, 8, 6, 0.0F); + this.b.setRotationPoint(0.0F, (float) (0 + byte0), 0.0F); + this.b2 = new ModelRenderer(this, 0, 24); + this.b2.addBox(-2.0F, 4.0F, -2.0F, 4, 3, 4, 0.0F); + this.b2.setRotationPoint(0.0F, (float) (0 + byte0), 0.0F); + this.b3 = new ModelRenderer(this, 29, 0); + this.b3.addBox(-3.5F, -3.5F, -3.5F, 7, 7, 7, 0.0F); + this.b3.setRotationPoint(0.0F, 0.0F, 0.0F); + this.e1 = new ModelRenderer(this, 24, 16); + this.e1.addBox(-2.0F, 0.0F, -1.0F, 2, 2, 2); + this.e1.setRotationPoint(3.0F, (float) (3 + byte0), -3.0F); + this.e2 = new ModelRenderer(this, 24, 16); + this.e2.addBox(0.0F, 0.0F, -1.0F, 2, 2, 2); + this.e2.setRotationPoint(-3.0F, (float) (3 + byte0), -3.0F); + this.ff1 = new ModelRenderer(this, 16, 24); + this.ff1.addBox(-2.0F, 0.0F, -4.0F, 2, 2, 4); + this.ff1.setRotationPoint(3.0F, (float) (3 + byte0), 4.0F); + this.ff2 = new ModelRenderer(this, 16, 24); + this.ff2.addBox(0.0F, 0.0F, -4.0F, 2, 2, 4); + this.ff2.setRotationPoint(-3.0F, (float) (3 + byte0), 4.0F); + } - public void render(Entity e, float f, float f1, float f2, float f3, float f4, float f5) - { - this.setRotationAngles(f, f1, f2, f3, f4, f5); - float a; + public void render(Entity e, float f, float f1, float f2, float f3, float f4, float f5) { + this.setRotationAngles(f, f1, f2, f3, f4, f5); + float a; - if (this.isChild) - { - a = 2.0F; - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, f5, f5); - this.a.render(f5); - this.g.render(f5); - this.g2.render(f5); - this.h.render(f5); - this.h2.render(f5); - GL11.glPopMatrix(); - GL11.glScalef(1.0F / a, 1.0F / a, 1.0F / a); - GL11.glTranslatef(0.0F, 18.0F * f5, 0.0F); - this.b.render(f5); - this.b2.render(f5); - this.e1.render(f5); - this.e2.render(f5); - this.ff1.render(f5); - this.ff2.render(f5); - float a1 = 1.0F + this.puffiness * 0.5F; - GL11.glTranslatef(0.0F, 1.0F, 0.0F); - GL11.glScalef(a1, a1, a1); - this.b3.render(f5); - } - else - { - this.a.render(f5); - this.g.render(f5); - this.g2.render(f5); - this.h.render(f5); - this.h2.render(f5); - this.b.render(f5); - this.b2.render(f5); - GL11.glPushMatrix(); - a = 1.0F + this.puffiness * 0.5F; - GL11.glTranslatef(0.0F, 1.0F, 0.0F); - GL11.glScalef(a, a, a); - this.b3.render(f5); - GL11.glPopMatrix(); - this.e1.render(f5); - this.e2.render(f5); - this.ff1.render(f5); - this.ff2.render(f5); - } - } + if (this.isChild) { + a = 2.0F; + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, f5, f5); + this.a.render(f5); + this.g.render(f5); + this.g2.render(f5); + this.h.render(f5); + this.h2.render(f5); + GL11.glPopMatrix(); + GL11.glScalef(1.0F / a, 1.0F / a, 1.0F / a); + GL11.glTranslatef(0.0F, 18.0F * f5, 0.0F); + this.b.render(f5); + this.b2.render(f5); + this.e1.render(f5); + this.e2.render(f5); + this.ff1.render(f5); + this.ff2.render(f5); + float a1 = 1.0F + this.puffiness * 0.5F; + GL11.glTranslatef(0.0F, 1.0F, 0.0F); + GL11.glScalef(a1, a1, a1); + this.b3.render(f5); + } else { + this.a.render(f5); + this.g.render(f5); + this.g2.render(f5); + this.h.render(f5); + this.h2.render(f5); + this.b.render(f5); + this.b2.render(f5); + GL11.glPushMatrix(); + a = 1.0F + this.puffiness * 0.5F; + GL11.glTranslatef(0.0F, 1.0F, 0.0F); + GL11.glScalef(a, a, a); + this.b3.render(f5); + GL11.glPopMatrix(); + this.e1.render(f5); + this.e2.render(f5); + this.ff1.render(f5); + this.ff2.render(f5); + } + } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - this.a.rotateAngleX = -(f4 / (180F / (float)Math.PI)); - this.a.rotateAngleY = f3 / (180F / (float)Math.PI); - this.g.rotateAngleX = this.a.rotateAngleX; - this.g.rotateAngleY = this.a.rotateAngleY; - this.g2.rotateAngleX = this.a.rotateAngleX; - this.g2.rotateAngleY = this.a.rotateAngleY; - this.h.rotateAngleX = this.a.rotateAngleX; - this.h.rotateAngleY = this.a.rotateAngleY; - this.h2.rotateAngleX = this.a.rotateAngleX; - this.h2.rotateAngleY = this.a.rotateAngleY; - this.b.rotateAngleX = ((float)Math.PI / 2F); - this.b2.rotateAngleX = ((float)Math.PI / 2F); - this.b3.rotateAngleX = ((float)Math.PI / 2F); - this.e1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.0F * f1; - this.ff1.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.2F * f1; - this.e2.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.0F * f1; - this.ff2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.2F * f1; - } + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { + this.a.rotateAngleX = -(f4 / (180F / (float) Math.PI)); + this.a.rotateAngleY = f3 / (180F / (float) Math.PI); + this.g.rotateAngleX = this.a.rotateAngleX; + this.g.rotateAngleY = this.a.rotateAngleY; + this.g2.rotateAngleX = this.a.rotateAngleX; + this.g2.rotateAngleY = this.a.rotateAngleY; + this.h.rotateAngleX = this.a.rotateAngleX; + this.h.rotateAngleY = this.a.rotateAngleY; + this.h2.rotateAngleX = this.a.rotateAngleX; + this.h2.rotateAngleY = this.a.rotateAngleY; + this.b.rotateAngleX = ((float) Math.PI / 2F); + this.b2.rotateAngleX = ((float) Math.PI / 2F); + this.b3.rotateAngleX = ((float) Math.PI / 2F); + this.e1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.0F * f1; + this.ff1.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.2F * f1; + this.e2.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.0F * f1; + this.ff2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.2F * f1; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/AerwhaleModel.java b/src/main/java/com/legacy/aether/client/models/entities/AerwhaleModel.java index 052789d..c0e2c10 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/AerwhaleModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/AerwhaleModel.java @@ -4,128 +4,124 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class AerwhaleModel extends ModelBase -{ +public class AerwhaleModel extends ModelBase { - public ModelRenderer FrontBody; - public ModelRenderer RightFin; - public ModelRenderer BottomPartHead; - public ModelRenderer LeftFin; - public ModelRenderer BottomPartMiddlebody; - public ModelRenderer Head; - public ModelRenderer MiddleFin; - public ModelRenderer BackfinRight; - public ModelRenderer BackBody; - public ModelRenderer BackfinLeft; - public ModelRenderer Middlebody; + public ModelRenderer FrontBody; + public ModelRenderer RightFin; + public ModelRenderer BottomPartHead; + public ModelRenderer LeftFin; + public ModelRenderer BottomPartMiddlebody; + public ModelRenderer Head; + public ModelRenderer MiddleFin; + public ModelRenderer BackfinRight; + public ModelRenderer BackBody; + public ModelRenderer BackfinLeft; + public ModelRenderer Middlebody; - public AerwhaleModel() - { - this.textureWidth = 512; - this.textureHeight = 64; + public AerwhaleModel() { + this.textureWidth = 512; + this.textureHeight = 64; - this.FrontBody = new ModelRenderer(this, 0, 0); - this.FrontBody.addBox(-11.5F, -1.0F, -0.5F, 19, 5, 21); - this.FrontBody.setRotationPoint(2.0F, 6.0F, 38.0F); - this.FrontBody.setTextureSize(512, 64); - this.FrontBody.mirror = true; - this.setRotation(this.FrontBody, -0.1047198F, 0.0F, 0.0F); - - this.RightFin = new ModelRenderer(this, 446, 1); - this.RightFin.addBox(-20.0F, -2.0F, -6.0F, 19, 3, 14); - this.RightFin.setRotationPoint(-10.0F, 4.0F, 10.0F); - this.RightFin.setTextureSize(512, 64); - this.RightFin.mirror = true; - this.setRotation(this.RightFin, -0.148353F, 0.2094395F, 0.0F); - this.RightFin.mirror = false; + this.FrontBody = new ModelRenderer(this, 0, 0); + this.FrontBody.addBox(-11.5F, -1.0F, -0.5F, 19, 5, 21); + this.FrontBody.setRotationPoint(2.0F, 6.0F, 38.0F); + this.FrontBody.setTextureSize(512, 64); + this.FrontBody.mirror = true; + this.setRotation(this.FrontBody, -0.1047198F, 0.0F, 0.0F); - this.BottomPartHead = new ModelRenderer(this, 116, 28); - this.BottomPartHead.addBox(-13.0F, 4.0F, -15.0F, 26, 6, 30); - this.BottomPartHead.setRotationPoint(0.0F, 0.0F, 0.0F); - this.BottomPartHead.setTextureSize(512, 64); - this.BottomPartHead.mirror = true; - this.setRotation(this.BottomPartHead, 0.0F, 0.0F, 0.0F); + this.RightFin = new ModelRenderer(this, 446, 1); + this.RightFin.addBox(-20.0F, -2.0F, -6.0F, 19, 3, 14); + this.RightFin.setRotationPoint(-10.0F, 4.0F, 10.0F); + this.RightFin.setTextureSize(512, 64); + this.RightFin.mirror = true; + this.setRotation(this.RightFin, -0.148353F, 0.2094395F, 0.0F); + this.RightFin.mirror = false; - this.LeftFin = new ModelRenderer(this, 446, 1); - this.LeftFin.addBox(1.0F, -2.0F, -6.0F, 19, 3, 14); - this.LeftFin.setRotationPoint(10.0F, 4.0F, 10.0F); - this.LeftFin.setTextureSize(512, 64); - this.LeftFin.mirror = true; - this.setRotation(this.LeftFin, -0.148353F, -0.2094395F, 0.0F); + this.BottomPartHead = new ModelRenderer(this, 116, 28); + this.BottomPartHead.addBox(-13.0F, 4.0F, -15.0F, 26, 6, 30); + this.BottomPartHead.setRotationPoint(0.0F, 0.0F, 0.0F); + this.BottomPartHead.setTextureSize(512, 64); + this.BottomPartHead.mirror = true; + this.setRotation(this.BottomPartHead, 0.0F, 0.0F, 0.0F); - this.BottomPartMiddlebody = new ModelRenderer(this, 16, 32); - this.BottomPartMiddlebody.addBox(-12.0F, 5.0F, -1.0F, 24, 6, 26); - this.BottomPartMiddlebody.setRotationPoint(0.0F, -1.0F, 14.0F); - this.BottomPartMiddlebody.setTextureSize(512, 64); - this.BottomPartMiddlebody.mirror = true; - this.setRotation(this.BottomPartMiddlebody, 0.0F, 0.0F, 0.0F); + this.LeftFin = new ModelRenderer(this, 446, 1); + this.LeftFin.addBox(1.0F, -2.0F, -6.0F, 19, 3, 14); + this.LeftFin.setRotationPoint(10.0F, 4.0F, 10.0F); + this.LeftFin.setTextureSize(512, 64); + this.LeftFin.mirror = true; + this.setRotation(this.LeftFin, -0.148353F, -0.2094395F, 0.0F); - this.Head = new ModelRenderer(this, 408, 18); - this.Head.addBox(-12.0F, -9.0F, -14.0F, 24, 18, 28); - this.Head.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Head.setTextureSize(512, 64); - this.Head.mirror = true; - this.setRotation(this.Head, 0.0F, 0.0F, 0.0F); + this.BottomPartMiddlebody = new ModelRenderer(this, 16, 32); + this.BottomPartMiddlebody.addBox(-12.0F, 5.0F, -1.0F, 24, 6, 26); + this.BottomPartMiddlebody.setRotationPoint(0.0F, -1.0F, 14.0F); + this.BottomPartMiddlebody.setTextureSize(512, 64); + this.BottomPartMiddlebody.mirror = true; + this.setRotation(this.BottomPartMiddlebody, 0.0F, 0.0F, 0.0F); - this.MiddleFin = new ModelRenderer(this, 318, 35); - this.MiddleFin.addBox(-1.0F, -11.0F, 7.0F, 2, 7, 8); - this.MiddleFin.setRotationPoint(0.0F, -1.0F, 14.0F); - this.MiddleFin.setTextureSize(512, 64); - this.MiddleFin.mirror = true; - this.setRotation(this.MiddleFin, -0.1441704F, 0.0F, 0.0F); + this.Head = new ModelRenderer(this, 408, 18); + this.Head.addBox(-12.0F, -9.0F, -14.0F, 24, 18, 28); + this.Head.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Head.setTextureSize(512, 64); + this.Head.mirror = true; + this.setRotation(this.Head, 0.0F, 0.0F, 0.0F); - this.BackfinRight = new ModelRenderer(this, 261, 5); - this.BackfinRight.addBox(-11.0F, 0.0F, -6.0F, 15, 3, 24); - this.BackfinRight.setRotationPoint(-4.0F, 5.0F, 59.0F); - this.BackfinRight.setTextureSize(512, 64); - this.BackfinRight.mirror = true; - this.setRotation(this.BackfinRight, -0.1047198F, -0.7330383F, 0.0F); - this.BackfinRight.mirror = false; + this.MiddleFin = new ModelRenderer(this, 318, 35); + this.MiddleFin.addBox(-1.0F, -11.0F, 7.0F, 2, 7, 8); + this.MiddleFin.setRotationPoint(0.0F, -1.0F, 14.0F); + this.MiddleFin.setTextureSize(512, 64); + this.MiddleFin.mirror = true; + this.setRotation(this.MiddleFin, -0.1441704F, 0.0F, 0.0F); - this.BackBody = new ModelRenderer(this, 228, 32); - this.BackBody.addBox(-10.5F, -9.0F, -2.0F, 17, 10, 22); - this.BackBody.setRotationPoint(2.0F, 5.0F, 38.0F); - this.BackBody.setTextureSize(512, 64); - this.BackBody.mirror = true; - this.setRotation(this.BackBody, -0.1047198F, 0.0F, 0.0F); + this.BackfinRight = new ModelRenderer(this, 261, 5); + this.BackfinRight.addBox(-11.0F, 0.0F, -6.0F, 15, 3, 24); + this.BackfinRight.setRotationPoint(-4.0F, 5.0F, 59.0F); + this.BackfinRight.setTextureSize(512, 64); + this.BackfinRight.mirror = true; + this.setRotation(this.BackfinRight, -0.1047198F, -0.7330383F, 0.0F); + this.BackfinRight.mirror = false; - this.BackfinLeft = new ModelRenderer(this, 261, 5); - this.BackfinLeft.addBox(-4.0F, 0.0F, -6.0F, 13, 3, 24); - this.BackfinLeft.setRotationPoint(5.0F, 5.0F, 59.0F); - this.BackfinLeft.setTextureSize(512, 64); - this.BackfinLeft.mirror = true; - this.setRotation(this.BackfinLeft, -0.1047198F, 0.7330383F, 0.0F); + this.BackBody = new ModelRenderer(this, 228, 32); + this.BackBody.addBox(-10.5F, -9.0F, -2.0F, 17, 10, 22); + this.BackBody.setRotationPoint(2.0F, 5.0F, 38.0F); + this.BackBody.setTextureSize(512, 64); + this.BackBody.mirror = true; + this.setRotation(this.BackBody, -0.1047198F, 0.0F, 0.0F); - this.Middlebody = new ModelRenderer(this, 314, 25); - this.Middlebody.addBox(-11.0F, -5.0F, -1.0F, 22, 14, 25); - this.Middlebody.setRotationPoint(0.0F, -1.0F, 14.0F); - this.Middlebody.setTextureSize(512, 64); - this.Middlebody.mirror = true; - this.setRotation(this.Middlebody, -0.0698132F, 0.0F, 0.0F); - } + this.BackfinLeft = new ModelRenderer(this, 261, 5); + this.BackfinLeft.addBox(-4.0F, 0.0F, -6.0F, 13, 3, 24); + this.BackfinLeft.setRotationPoint(5.0F, 5.0F, 59.0F); + this.BackfinLeft.setTextureSize(512, 64); + this.BackfinLeft.mirror = true; + this.setRotation(this.BackfinLeft, -0.1047198F, 0.7330383F, 0.0F); - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); - this.FrontBody.render(scale); - this.RightFin.render(scale); - this.BottomPartHead.render(scale); - this.LeftFin.render(scale); - this.BottomPartMiddlebody.render(scale); - this.Head.render(scale); - this.MiddleFin.render(scale); - this.BackfinRight.render(scale); - this.BackBody.render(scale); - this.BackfinLeft.render(scale); - this.Middlebody.render(scale); - } + this.Middlebody = new ModelRenderer(this, 314, 25); + this.Middlebody.addBox(-11.0F, -5.0F, -1.0F, 22, 14, 25); + this.Middlebody.setRotationPoint(0.0F, -1.0F, 14.0F); + this.Middlebody.setTextureSize(512, 64); + this.Middlebody.mirror = true; + this.setRotation(this.Middlebody, -0.0698132F, 0.0F, 0.0F); + } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + this.FrontBody.render(scale); + this.RightFin.render(scale); + this.BottomPartHead.render(scale); + this.LeftFin.render(scale); + this.BottomPartMiddlebody.render(scale); + this.Head.render(scale); + this.MiddleFin.render(scale); + this.BackfinRight.render(scale); + this.BackBody.render(scale); + this.BackfinLeft.render(scale); + this.Middlebody.render(scale); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/CockatriceModel.java b/src/main/java/com/legacy/aether/client/models/entities/CockatriceModel.java index a4d0e77..5fbb85c 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/CockatriceModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/CockatriceModel.java @@ -5,132 +5,125 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class CockatriceModel extends ModelBase -{ +public class CockatriceModel extends ModelBase { - public ModelRenderer head, body; + public ModelRenderer head, body; - public ModelRenderer legs, legs2; + public ModelRenderer legs, legs2; - public ModelRenderer wings, wings2; + public ModelRenderer wings, wings2; - public ModelRenderer jaw, neck; + public ModelRenderer jaw, neck; - public ModelRenderer feather1, feather2, feather3; + public ModelRenderer feather1, feather2, feather3; - public CockatriceModel() - { - this.head = new ModelRenderer(this, 0, 13); - this.head.addBox(-2.0F, -4.0F, -6.0F, 4, 4, 8, 0.0F); - this.head.setRotationPoint(0.0F, (float)(-8 + 16), -4.0F); + public CockatriceModel() { + this.head = new ModelRenderer(this, 0, 13); + this.head.addBox(-2.0F, -4.0F, -6.0F, 4, 4, 8, 0.0F); + this.head.setRotationPoint(0.0F, (float) (-8 + 16), -4.0F); - this.jaw = new ModelRenderer(this, 24, 13); - this.jaw.addBox(-2.0F, -1.0F, -6.0F, 4, 1, 8, -0.1F); - this.jaw.setRotationPoint(0.0F, (float)(-8 + 16), -4.0F); + this.jaw = new ModelRenderer(this, 24, 13); + this.jaw.addBox(-2.0F, -1.0F, -6.0F, 4, 1, 8, -0.1F); + this.jaw.setRotationPoint(0.0F, (float) (-8 + 16), -4.0F); - this.body = new ModelRenderer(this, 0, 0); - this.body.addBox(-3.0F, -3.0F, 0.0F, 6, 8, 5, 0.0F); - this.body.setRotationPoint(0.0F, (float)(0 + 16), 0.0F); + this.body = new ModelRenderer(this, 0, 0); + this.body.addBox(-3.0F, -3.0F, 0.0F, 6, 8, 5, 0.0F); + this.body.setRotationPoint(0.0F, (float) (0 + 16), 0.0F); - this.legs = new ModelRenderer(this, 22, 0); - this.legs.addBox(-1.0F, -1.0F, -1.0F, 2, 9, 2); - this.legs.setRotationPoint(-2.0F, (float)(0 + 16), 1.0F); + this.legs = new ModelRenderer(this, 22, 0); + this.legs.addBox(-1.0F, -1.0F, -1.0F, 2, 9, 2); + this.legs.setRotationPoint(-2.0F, (float) (0 + 16), 1.0F); - this.legs2 = new ModelRenderer(this, 22, 0); - this.legs2.addBox(-1.0F, -1.0F, -1.0F, 2, 9, 2); - this.legs2.setRotationPoint(2.0F, (float)(0 + 16), 1.0F); + this.legs2 = new ModelRenderer(this, 22, 0); + this.legs2.addBox(-1.0F, -1.0F, -1.0F, 2, 9, 2); + this.legs2.setRotationPoint(2.0F, (float) (0 + 16), 1.0F); - this.wings = new ModelRenderer(this, 52, 0); - this.wings.addBox(-1.0F, -0.0F, -1.0F, 1, 8, 4); - this.wings.setRotationPoint(-3.0F, (float)(16), 2.0F); + this.wings = new ModelRenderer(this, 52, 0); + this.wings.addBox(-1.0F, -0.0F, -1.0F, 1, 8, 4); + this.wings.setRotationPoint(-3.0F, (float) (16), 2.0F); - this.wings2 = new ModelRenderer(this, 52, 0); - this.wings2.addBox(0.0F, -0.0F, -1.0F, 1, 8, 4); - this.wings2.setRotationPoint(3.0F, (float)(-4 + 16), 0.0F); + this.wings2 = new ModelRenderer(this, 52, 0); + this.wings2.addBox(0.0F, -0.0F, -1.0F, 1, 8, 4); + this.wings2.setRotationPoint(3.0F, (float) (-4 + 16), 0.0F); - this.neck = new ModelRenderer(this, 44, 0); - this.neck.addBox(-1.0F, -6.0F, -1.0F, 2, 6, 2); - this.neck.setRotationPoint(0.0F, (float)(-2 + 16), -4.0F); + this.neck = new ModelRenderer(this, 44, 0); + this.neck.addBox(-1.0F, -6.0F, -1.0F, 2, 6, 2); + this.neck.setRotationPoint(0.0F, (float) (-2 + 16), -4.0F); - this.feather1 = new ModelRenderer(this, 30, 0); - this.feather1.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); - this.feather1.setRotationPoint(0.0F, (float)(1 + 16), 1.0F); - this.feather2 = new ModelRenderer(this, 30, 0); - this.feather2.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); - this.feather2.setRotationPoint(0.0F, (float)(1 + 16), 1.0F); - this.feather3 = new ModelRenderer(this, 30, 0); - this.feather3.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); - this.feather3.setRotationPoint(0.0F, (float)(1 + 16), 1.0F); - this.feather1.rotationPointY += 0.5F; - this.feather2.rotationPointY += 0.5F; - this.feather3.rotationPointY += 0.5F; - } + this.feather1 = new ModelRenderer(this, 30, 0); + this.feather1.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); + this.feather1.setRotationPoint(0.0F, (float) (1 + 16), 1.0F); + this.feather2 = new ModelRenderer(this, 30, 0); + this.feather2.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); + this.feather2.setRotationPoint(0.0F, (float) (1 + 16), 1.0F); + this.feather3 = new ModelRenderer(this, 30, 0); + this.feather3.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); + this.feather3.setRotationPoint(0.0F, (float) (1 + 16), 1.0F); + this.feather1.rotationPointY += 0.5F; + this.feather2.rotationPointY += 0.5F; + this.feather3.rotationPointY += 0.5F; + } - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); - this.head.render(scale); - this.jaw.render(scale); - this.body.render(scale); - this.legs.render(scale); - this.legs2.render(scale); - this.wings.render(scale); - this.wings2.render(scale); - this.neck.render(scale); - this.feather1.render(scale); - this.feather2.render(scale); - this.feather3.render(scale); - } + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + this.head.render(scale); + this.jaw.render(scale); + this.body.render(scale); + this.legs.render(scale); + this.legs2.render(scale); + this.wings.render(scale); + this.wings2.render(scale); + this.neck.render(scale); + this.feather1.render(scale); + this.feather2.render(scale); + this.feather3.render(scale); + } - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - this.head.rotateAngleX = headPitch / 57.29578F; - this.head.rotateAngleY = netHeadYaw / 57.29578F; + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + this.head.rotateAngleX = headPitch / 57.29578F; + this.head.rotateAngleY = netHeadYaw / 57.29578F; - this.jaw.rotateAngleX = head.rotateAngleX; - this.jaw.rotateAngleY = head.rotateAngleY; + this.jaw.rotateAngleX = head.rotateAngleX; + this.jaw.rotateAngleY = head.rotateAngleY; - this.body.rotateAngleX = 1.570796F; + this.body.rotateAngleX = 1.570796F; - this.legs.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.legs2.rotateAngleX = MathHelper.cos((float) (limbSwing * 0.6662F + Math.PI)) * 1.4F * limbSwingAmount; + this.legs.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + this.legs2.rotateAngleX = MathHelper.cos((float) (limbSwing * 0.6662F + Math.PI)) * 1.4F * limbSwingAmount; - if(ageInTicks > 0.001F) - { - this.wings.rotationPointZ = -1F; - this.wings2.rotationPointZ = -1F; - this.wings.rotationPointY = 12F; - this.wings2.rotationPointY = 12F; - this.wings.rotateAngleX = 0.0F; - this.wings2.rotateAngleX = 0.0F; - this.wings.rotateAngleZ = ageInTicks; - this.wings2.rotateAngleZ = -ageInTicks; - this.legs.rotateAngleX = 0.6F; - this.legs2.rotateAngleX = 0.6F; - } - else - { - this.wings.rotationPointZ = -3F; - this.wings2.rotationPointZ = -3F; - this.wings.rotationPointY = 14F; - this.wings2.rotationPointY = 14F; - this.wings.rotateAngleX = (float) (Math.PI / 2.0F); - this.wings2.rotateAngleX = (float) (Math.PI / 2.0F); - this.wings.rotateAngleZ = 0.0F; - this.wings2.rotateAngleZ = 0.0F; - } + if (ageInTicks > 0.001F) { + this.wings.rotationPointZ = -1F; + this.wings2.rotationPointZ = -1F; + this.wings.rotationPointY = 12F; + this.wings2.rotationPointY = 12F; + this.wings.rotateAngleX = 0.0F; + this.wings2.rotateAngleX = 0.0F; + this.wings.rotateAngleZ = ageInTicks; + this.wings2.rotateAngleZ = -ageInTicks; + this.legs.rotateAngleX = 0.6F; + this.legs2.rotateAngleX = 0.6F; + } else { + this.wings.rotationPointZ = -3F; + this.wings2.rotationPointZ = -3F; + this.wings.rotationPointY = 14F; + this.wings2.rotationPointY = 14F; + this.wings.rotateAngleX = (float) (Math.PI / 2.0F); + this.wings2.rotateAngleX = (float) (Math.PI / 2.0F); + this.wings.rotateAngleZ = 0.0F; + this.wings2.rotateAngleZ = 0.0F; + } - this.feather1.rotateAngleY = -0.375F; - this.feather2.rotateAngleY = 0.0F; - this.feather3.rotateAngleY = 0.375F; - this.feather1.rotateAngleX = 0.25F; - this.feather2.rotateAngleX = 0.25F; - this.feather3.rotateAngleX = 0.25F; + this.feather1.rotateAngleY = -0.375F; + this.feather2.rotateAngleY = 0.0F; + this.feather3.rotateAngleY = 0.375F; + this.feather1.rotateAngleX = 0.25F; + this.feather2.rotateAngleX = 0.25F; + this.feather3.rotateAngleX = 0.25F; - this.neck.rotateAngleX = 0.0F; - this.neck.rotateAngleY = head.rotateAngleY; - this.jaw.rotateAngleX += 0.35F; - } + this.neck.rotateAngleX = 0.0F; + this.neck.rotateAngleY = head.rotateAngleY; + this.jaw.rotateAngleX += 0.35F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/CrystalModel.java b/src/main/java/com/legacy/aether/client/models/entities/CrystalModel.java index 6866cdb..0b3da38 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/CrystalModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/CrystalModel.java @@ -6,49 +6,43 @@ import net.minecraft.entity.Entity; import org.lwjgl.opengl.GL11; -public class CrystalModel extends ModelBase -{ +public class CrystalModel extends ModelBase { - public ModelRenderer head[]; + public ModelRenderer head[]; public float sinage[]; private static final float sponge = (180F / 3.141593F); - public CrystalModel() - { - this(0.0F); - } + public CrystalModel() { + this(0.0F); + } - public CrystalModel(float f) - { - this(f, 0.0F); - } + public CrystalModel(float f) { + this(f, 0.0F); + } - public CrystalModel(float f, float f1) - { + public CrystalModel(float f, float f1) { this.sinage = new float[3]; this.head = new ModelRenderer[3]; this.head[0] = new ModelRenderer(this, 0, 0); this.head[1] = new ModelRenderer(this, 32, 0); this.head[2] = new ModelRenderer(this, 0, 16); - for(int i = 0; i < 3; i ++) - { + for (int i = 0; i < 3; i++) { this.head[i].addBox(-4F, -4F, -4F, 8, 8, 8, f); this.head[i].setRotationPoint(0.0F, 0.0F + f1, 0.0F); } - } + } - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { GL11.glTranslatef(0F, 0.75F, 0F); GL11.glEnable(2977 /*GL_NORMALIZE*/); - GL11.glEnable(3042 /*GL_BLEND*/); - GL11.glDisable(3008 /*GL_ALPHA_TEST*/); - GL11.glBlendFunc(770, 771); + GL11.glEnable(3042 /*GL_BLEND*/); + GL11.glDisable(3008 /*GL_ALPHA_TEST*/); + GL11.glBlendFunc(770, 771); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -68,16 +62,14 @@ public class CrystalModel extends ModelBase GL11.glPopMatrix(); GL11.glEnable(3008 /*GL_ALPHA_TEST*/); - } + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - for(int i = 0; i < 3; i ++) - { - this.head[i].rotateAngleY = netHeadYaw / 57.29578F; - this.head[i].rotateAngleX = headPitch / 57.29578F; + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + for (int i = 0; i < 3; i++) { + this.head[i].rotateAngleY = netHeadYaw / 57.29578F; + this.head[i].rotateAngleX = headPitch / 57.29578F; } - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/FlyingCowModel.java b/src/main/java/com/legacy/aether/client/models/entities/FlyingCowModel.java index dc4d6de..debe37e 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/FlyingCowModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/FlyingCowModel.java @@ -5,75 +5,68 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import org.lwjgl.opengl.GL11; -public class FlyingCowModel extends ModelQuadruped -{ +public class FlyingCowModel extends ModelQuadruped { - ModelRenderer udders; - ModelRenderer horn1; - ModelRenderer horn2; + ModelRenderer udders; + ModelRenderer horn1; + ModelRenderer horn2; - public FlyingCowModel(float scale) - { - super(12, scale); - this.head = new ModelRenderer(this, 0, 0); - this.head.addBox(-4.0F, -4.0F, -6.0F, 8, 8, 6, 0.0F); - this.head.setRotationPoint(0.0F, 4.0F, -8.0F); - this.horn1 = new ModelRenderer(this, 22, 0); - this.horn1.addBox(-4.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); - this.horn1.setRotationPoint(0.0F, 3.0F, -7.0F); - this.horn2 = new ModelRenderer(this, 22, 0); - this.horn2.addBox(3.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); - this.horn2.setRotationPoint(0.0F, 3.0F, -7.0F); - this.udders = new ModelRenderer(this, 52, 0); - this.udders.addBox(-2.0F, -3.0F, 0.0F, 4, 6, 2, 0.0F); - this.udders.setRotationPoint(0.0F, 14.0F, 6.0F); - this.udders.rotateAngleX = ((float)Math.PI / 2F); - this.body = new ModelRenderer(this, 18, 4); - this.body.addBox(-6.0F, -10.0F, -7.0F, 12, 18, 10, scale); - this.body.setRotationPoint(0.0F, 5.0F, 2.0F); - --this.leg1.rotationPointX; - ++this.leg2.rotationPointX; - this.leg1.rotationPointZ += 0.0F; - this.leg2.rotationPointZ += 0.0F; - --this.leg3.rotationPointX; - ++this.leg4.rotationPointX; - --this.leg3.rotationPointZ; - --this.leg4.rotationPointZ; - } + public FlyingCowModel(float scale) { + super(12, scale); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-4.0F, -4.0F, -6.0F, 8, 8, 6, 0.0F); + this.head.setRotationPoint(0.0F, 4.0F, -8.0F); + this.horn1 = new ModelRenderer(this, 22, 0); + this.horn1.addBox(-4.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); + this.horn1.setRotationPoint(0.0F, 3.0F, -7.0F); + this.horn2 = new ModelRenderer(this, 22, 0); + this.horn2.addBox(3.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); + this.horn2.setRotationPoint(0.0F, 3.0F, -7.0F); + this.udders = new ModelRenderer(this, 52, 0); + this.udders.addBox(-2.0F, -3.0F, 0.0F, 4, 6, 2, 0.0F); + this.udders.setRotationPoint(0.0F, 14.0F, 6.0F); + this.udders.rotateAngleX = ((float) Math.PI / 2F); + this.body = new ModelRenderer(this, 18, 4); + this.body.addBox(-6.0F, -10.0F, -7.0F, 12, 18, 10, scale); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + --this.leg1.rotationPointX; + ++this.leg2.rotationPointX; + this.leg1.rotationPointZ += 0.0F; + this.leg2.rotationPointZ += 0.0F; + --this.leg3.rotationPointX; + ++this.leg4.rotationPointX; + --this.leg3.rotationPointZ; + --this.leg4.rotationPointZ; + } - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); - if (this.isChild) - { - float f6 = 2.0F; - GL11.glPushMatrix(); - GL11.glPopMatrix(); - GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6); - GL11.glTranslatef(0.0F, 24.0F * scale, 0.0F); - this.horn1.render(scale); - this.horn2.render(scale); - this.udders.render(scale); - } - else - { - this.horn1.render(scale); - this.horn2.render(scale); - this.udders.render(scale); - } - } + if (this.isChild) { + float f6 = 2.0F; + GL11.glPushMatrix(); + GL11.glPopMatrix(); + GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6); + GL11.glTranslatef(0.0F, 24.0F * scale, 0.0F); + this.horn1.render(scale); + this.horn2.render(scale); + this.udders.render(scale); + } else { + this.horn1.render(scale); + this.horn2.render(scale); + this.udders.render(scale); + } + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); - this.horn1.rotateAngleY = this.head.rotateAngleY; - this.horn1.rotateAngleX = this.head.rotateAngleX; - this.horn2.rotateAngleY = this.head.rotateAngleY; - this.horn2.rotateAngleX = this.head.rotateAngleX; - } + this.horn1.rotateAngleY = this.head.rotateAngleY; + this.horn1.rotateAngleX = this.head.rotateAngleX; + this.horn2.rotateAngleY = this.head.rotateAngleY; + this.horn2.rotateAngleX = this.head.rotateAngleX; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/FlyingCowWingModel.java b/src/main/java/com/legacy/aether/client/models/entities/FlyingCowWingModel.java index 479797d..f869f39 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/FlyingCowWingModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/FlyingCowWingModel.java @@ -8,64 +8,62 @@ import org.lwjgl.opengl.GL11; import com.legacy.aether.entities.passive.mountable.EntityFlyingCow; -public class FlyingCowWingModel extends ModelBase -{ +public class FlyingCowWingModel extends ModelBase { - private ModelRenderer leftWingInner = new ModelRenderer(this, 0, 0); - private ModelRenderer leftWingOuter = new ModelRenderer(this, 20, 0); - private ModelRenderer rightWingInner = new ModelRenderer(this, 0, 0); - private ModelRenderer rightWingOuter = new ModelRenderer(this, 40, 0); + private ModelRenderer leftWingInner = new ModelRenderer(this, 0, 0); + private ModelRenderer leftWingOuter = new ModelRenderer(this, 20, 0); + private ModelRenderer rightWingInner = new ModelRenderer(this, 0, 0); + private ModelRenderer rightWingOuter = new ModelRenderer(this, 40, 0); - public FlyingCowWingModel() - { - this.leftWingInner.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); - this.leftWingOuter.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); - this.rightWingInner.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); - this.rightWingOuter.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); + public FlyingCowWingModel() { + this.leftWingInner.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); + this.leftWingOuter.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); + this.rightWingInner.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); + this.rightWingOuter.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); - this.rightWingOuter.rotateAngleY = (float)Math.PI; - } + this.rightWingOuter.rotateAngleY = (float) Math.PI; + } - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - GL11.glPushMatrix(); + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + GL11.glPushMatrix(); - EntityFlyingCow flyingcow = ((EntityFlyingCow)entityIn); - GL11.glTranslatef(0.0F, -10.0F * scale, 0.0F); + EntityFlyingCow flyingcow = ((EntityFlyingCow) entityIn); + GL11.glTranslatef(0.0F, -10.0F * scale, 0.0F); - float wingBend = -((float)Math.acos((double)flyingcow.wingFold)); + float wingBend = -((float) Math.acos((double) flyingcow.wingFold)); - float x = 32.0F * flyingcow.wingFold / 4.0F; - float y = -32.0F * (float)Math.sqrt((double)(1.0F - flyingcow.wingFold * flyingcow.wingFold)) / 4.0F; + float x = 32.0F * flyingcow.wingFold / 4.0F; + float y = -32.0F * (float) Math.sqrt((double) (1.0F - flyingcow.wingFold * flyingcow.wingFold)) / 4.0F; - float x2 = x * (float)Math.cos((double)flyingcow.wingAngle) - y * (float)Math.sin((double)flyingcow.wingAngle); - float y2 = x * (float)Math.sin((double)flyingcow.wingAngle) + y * (float)Math.cos((double)flyingcow.wingAngle); + float x2 = x * (float) Math.cos((double) flyingcow.wingAngle) - y * (float) Math.sin((double) flyingcow.wingAngle); + float y2 = x * (float) Math.sin((double) flyingcow.wingAngle) + y * (float) Math.cos((double) flyingcow.wingAngle); - this.leftWingInner.setRotationPoint(4.0F + x2, y2 + 12.0F, 0.0F); - this.rightWingInner.setRotationPoint(-4.0F - x2, y2 + 12.0F, 0.0F); + this.leftWingInner.setRotationPoint(4.0F + x2, y2 + 12.0F, 0.0F); + this.rightWingInner.setRotationPoint(-4.0F - x2, y2 + 12.0F, 0.0F); - x *= 3.0F; - x2 = x * (float)Math.cos((double)flyingcow.wingAngle) - y * (float)Math.sin((double)flyingcow.wingAngle); - y2 = x * (float)Math.sin((double)flyingcow.wingAngle) + y * (float)Math.cos((double)flyingcow.wingAngle); + x *= 3.0F; + x2 = x * (float) Math.cos((double) flyingcow.wingAngle) - y * (float) Math.sin((double) flyingcow.wingAngle); + y2 = x * (float) Math.sin((double) flyingcow.wingAngle) + y * (float) Math.cos((double) flyingcow.wingAngle); - this.leftWingOuter.setRotationPoint(4.0F + x2, y2 + 12.0F, 0.0F); - this.rightWingOuter.setRotationPoint(-4.0F - x2, y2 + 12.0F, 0.0F); + this.leftWingOuter.setRotationPoint(4.0F + x2, y2 + 12.0F, 0.0F); + this.rightWingOuter.setRotationPoint(-4.0F - x2, y2 + 12.0F, 0.0F); - this.leftWingInner.rotateAngleZ = flyingcow.wingAngle + wingBend + ((float)Math.PI / 2F); - this.leftWingOuter.rotateAngleZ = flyingcow.wingAngle - wingBend + ((float)Math.PI / 2F); - this.rightWingInner.rotateAngleZ = -(flyingcow.wingAngle + wingBend - ((float)Math.PI / 2F)); - this.rightWingOuter.rotateAngleZ = -(flyingcow.wingAngle - wingBend + ((float)Math.PI / 2F)); + this.leftWingInner.rotateAngleZ = flyingcow.wingAngle + wingBend + ((float) Math.PI / 2F); + this.leftWingOuter.rotateAngleZ = flyingcow.wingAngle - wingBend + ((float) Math.PI / 2F); + this.rightWingInner.rotateAngleZ = -(flyingcow.wingAngle + wingBend - ((float) Math.PI / 2F)); + this.rightWingOuter.rotateAngleZ = -(flyingcow.wingAngle - wingBend + ((float) Math.PI / 2F)); - this.leftWingOuter.render(scale); - this.leftWingInner.render(scale); - this.rightWingOuter.render(scale); - this.rightWingInner.render(scale); + this.leftWingOuter.render(scale); + this.leftWingInner.render(scale); + this.rightWingOuter.render(scale); + this.rightWingInner.render(scale); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {} + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/MimicModel.java b/src/main/java/com/legacy/aether/client/models/entities/MimicModel.java index 103e4fa..d27f07c 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/MimicModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/MimicModel.java @@ -6,49 +6,44 @@ import net.minecraft.entity.Entity; import com.legacy.aether.entities.hostile.EntityMimic; -public class MimicModel extends ModelBase -{ +public class MimicModel extends ModelBase { - ModelRenderer box, boxLid; + ModelRenderer box, boxLid; - ModelRenderer leftLeg, rightLeg; + ModelRenderer leftLeg, rightLeg; - public MimicModel() - { - this.box = new ModelRenderer(this, 0, 0); - this.box.addBox(-8F, 0F, -8F, 16, 10, 16); - this.box.setRotationPoint(0F, -24F, 0F); - - this.boxLid = new ModelRenderer(this, 16, 10); - this.boxLid.addBox(0F, 0F, 0F, 16, 6, 16); - this.boxLid.setRotationPoint(-8F, -24F, 8F); - - this.leftLeg = new ModelRenderer(this, 0, 0); + public MimicModel() { + this.box = new ModelRenderer(this, 0, 0); + this.box.addBox(-8F, 0F, -8F, 16, 10, 16); + this.box.setRotationPoint(0F, -24F, 0F); + + this.boxLid = new ModelRenderer(this, 16, 10); + this.boxLid.addBox(0F, 0F, 0F, 16, 6, 16); + this.boxLid.setRotationPoint(-8F, -24F, 8F); + + this.leftLeg = new ModelRenderer(this, 0, 0); this.leftLeg.addBox(-3F, 0F, -3F, 6, 15, 6); this.leftLeg.setRotationPoint(-4F, -15F, 0F); - + this.rightLeg = new ModelRenderer(this, 0, 0); this.rightLeg.addBox(-3F, 0F, -3F, 6, 15, 6); this.rightLeg.setRotationPoint(4F, -15F, 0F); - - } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - EntityMimic mimic = (EntityMimic) entityIn; + } + + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + EntityMimic mimic = (EntityMimic) entityIn; this.boxLid.rotateAngleX = 3.14159265F - mimic.mouth; this.rightLeg.rotateAngleX = mimic.legs; - this.leftLeg.rotateAngleX = - mimic.legs; - } + this.leftLeg.rotateAngleX = -mimic.legs; + } - public void renderHead(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale, EntityMimic mimic) - { + public void renderHead(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale, EntityMimic mimic) { this.box.render(scale); - } + } - public void renderLegs(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale, EntityMimic mimic) - { + public void renderLegs(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale, EntityMimic mimic) { boxLid.render(scale); leftLeg.render(scale); rightLeg.render(scale); diff --git a/src/main/java/com/legacy/aether/client/models/entities/MiniCloudModel.java b/src/main/java/com/legacy/aether/client/models/entities/MiniCloudModel.java index d2588b0..959fc81 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/MiniCloudModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/MiniCloudModel.java @@ -6,23 +6,19 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class MiniCloudModel extends ModelBase -{ +public class MiniCloudModel extends ModelBase { - public ModelRenderer head[]; + public ModelRenderer head[]; - public MiniCloudModel() - { - this(0.0F); - } + public MiniCloudModel() { + this(0.0F); + } - public MiniCloudModel(float modelSize) - { - this(modelSize, 0.0F); - } + public MiniCloudModel(float modelSize) { + this(modelSize, 0.0F); + } - public MiniCloudModel(float modelSize, float rotationPointY) - { + public MiniCloudModel(float modelSize, float rotationPointY) { this.head = new ModelRenderer[5]; this.head[0] = new ModelRenderer(this, 0, 0); @@ -30,44 +26,40 @@ public class MiniCloudModel extends ModelBase this.head[2] = new ModelRenderer(this, 36, 0); this.head[3] = new ModelRenderer(this, 36, 8); this.head[4] = new ModelRenderer(this, 36, 8); - + this.head[0].addBox(-4.5F, -4.5F, -4.5F, 9, 9, 9, modelSize); this.head[0].setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - + this.head[1].addBox(-3.5F, -3.5F, -5.5F, 7, 7, 1, modelSize); this.head[1].setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - + this.head[2].addBox(-3.5F, -3.5F, 4.5F, 7, 7, 1, modelSize); this.head[2].setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - + this.head[3].addBox(-5.5F, -3.5F, -3.5F, 1, 7, 7, modelSize); this.head[3].setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - + this.head[4].addBox(4.5F, -3.5F, -3.5F, 1, 7, 7, modelSize); this.head[4].setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - } + } - @Override - public void render(Entity e, float f, float f1, float f2, float f3, float f4, float f5) - { - GL11.glTranslatef(0.0F, 1.3F, 0.0F); + @Override + public void render(Entity e, float f, float f1, float f2, float f3, float f4, float f5) { + GL11.glTranslatef(0.0F, 1.3F, 0.0F); - this.setRotationAngles(f, f1, f2, f3, f4, f5, e); + this.setRotationAngles(f, f1, f2, f3, f4, f5, e); - for(int i = 0; i < 5; i ++) - { + for (int i = 0; i < 5; i++) { this.head[i].render(f5); } - } + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - for(int i = 0; i < 5; i ++) - { + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + for (int i = 0; i < 5; i++) { this.head[i].rotateAngleY = 0F; this.head[i].rotateAngleX = 0F; } - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/MoaModel.java b/src/main/java/com/legacy/aether/client/models/entities/MoaModel.java index daff31c..5e980eb 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/MoaModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/MoaModel.java @@ -7,171 +7,160 @@ import net.minecraft.util.MathHelper; import com.legacy.aether.entities.passive.mountable.EntityMoa; -public class MoaModel extends ModelBase -{ +public class MoaModel extends ModelBase { - public ModelRenderer head, body; + public ModelRenderer head, body; - public ModelRenderer legs, legs2; + public ModelRenderer legs, legs2; - public ModelRenderer wings, wings2; + public ModelRenderer wings, wings2; - public ModelRenderer jaw, neck; + public ModelRenderer jaw, neck; - public ModelRenderer feather1, feather2, feather3; + public ModelRenderer feather1, feather2, feather3; - public MoaModel(float scale) - { - - this.head = new ModelRenderer(this, 0, 13); - this.head.addBox(-2.0F, -4.0F, -6.0F, 4, 4, 8, 0.0F); - this.head.setRotationPoint(0.0F, (float)(-8 + 16), -4.0F); + public MoaModel(float scale) { - this.jaw = new ModelRenderer(this, 24, 13); - this.jaw.addBox(-2.0F, -1.0F, -6.0F, 4, 1, 8, -0.1F); - this.jaw.setRotationPoint(0.0F, (float)(-8 + 16), -4.0F); + this.head = new ModelRenderer(this, 0, 13); + this.head.addBox(-2.0F, -4.0F, -6.0F, 4, 4, 8, 0.0F); + this.head.setRotationPoint(0.0F, (float) (-8 + 16), -4.0F); - this.body = new ModelRenderer(this, 0, 0); - this.body.addBox(-3.0F, -3.0F, 0.0F, 6, 8, 5, scale); - this.body.setRotationPoint(0.0F, (float)(0 + 16), 0.0F); + this.jaw = new ModelRenderer(this, 24, 13); + this.jaw.addBox(-2.0F, -1.0F, -6.0F, 4, 1, 8, -0.1F); + this.jaw.setRotationPoint(0.0F, (float) (-8 + 16), -4.0F); - this.legs = new ModelRenderer(this, 22, 0); - this.legs.addBox(-1.0F, -1.0F, -1.0F, 2, 9, 2, 0.0F); - this.legs.setRotationPoint(-2.0F, (float)(0 + 16), 1.0F); + this.body = new ModelRenderer(this, 0, 0); + this.body.addBox(-3.0F, -3.0F, 0.0F, 6, 8, 5, scale); + this.body.setRotationPoint(0.0F, (float) (0 + 16), 0.0F); - this.legs2 = new ModelRenderer(this, 22, 0); - this.legs2.addBox(-1.0F, -1.0F, -1.0F, 2, 9, 2, 0.0F); - this.legs2.setRotationPoint(2.0F, (float)(0 + 16), 1.0F); + this.legs = new ModelRenderer(this, 22, 0); + this.legs.addBox(-1.0F, -1.0F, -1.0F, 2, 9, 2, 0.0F); + this.legs.setRotationPoint(-2.0F, (float) (0 + 16), 1.0F); - this.wings = new ModelRenderer(this, 52, 0); - this.wings.addBox(-1.0F, -0.0F, -1.0F, 1, 8, 4); - this.wings.setRotationPoint(-3.0F, (float)(16), 2.0F); + this.legs2 = new ModelRenderer(this, 22, 0); + this.legs2.addBox(-1.0F, -1.0F, -1.0F, 2, 9, 2, 0.0F); + this.legs2.setRotationPoint(2.0F, (float) (0 + 16), 1.0F); - this.wings2 = new ModelRenderer(this, 52, 0); - this.wings2.addBox(0.0F, -0.0F, -1.0F, 1, 8, 4); - this.wings2.setRotationPoint(3.0F, (float)(-4 + 16), 0.0F); + this.wings = new ModelRenderer(this, 52, 0); + this.wings.addBox(-1.0F, -0.0F, -1.0F, 1, 8, 4); + this.wings.setRotationPoint(-3.0F, (float) (16), 2.0F); - this.neck = new ModelRenderer(this, 44, 0); - this.neck.addBox(-1.0F, -6.0F, -1.0F, 2, 6, 2); - this.neck.setRotationPoint(0.0F, (float)(-2 + 16), -4.0F); + this.wings2 = new ModelRenderer(this, 52, 0); + this.wings2.addBox(0.0F, -0.0F, -1.0F, 1, 8, 4); + this.wings2.setRotationPoint(3.0F, (float) (-4 + 16), 0.0F); - this.feather1 = new ModelRenderer(this, 30, 0); - this.feather1.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); - this.feather1.setRotationPoint(0.0F, (float)(1 + 16), 1.0F); - this.feather2 = new ModelRenderer(this, 30, 0); - this.feather2.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); - this.feather2.setRotationPoint(0.0F, (float)(1 + 16), 1.0F); - this.feather3 = new ModelRenderer(this, 30, 0); - this.feather3.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); - this.feather3.setRotationPoint(0.0F, (float)(1 + 16), 1.0F); - this.feather1.rotationPointY += 0.5F; - this.feather2.rotationPointY += 0.5F; - this.feather3.rotationPointY += 0.5F; - } + this.neck = new ModelRenderer(this, 44, 0); + this.neck.addBox(-1.0F, -6.0F, -1.0F, 2, 6, 2); + this.neck.setRotationPoint(0.0F, (float) (-2 + 16), -4.0F); - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); - EntityMoa moa = (EntityMoa) entityIn; - - if (!moa.isSitting() || (!moa.onGround && moa.isSitting())) - { - this.legs.render(scale); - this.legs2.render(scale); - } - - this.head.render(scale); - this.jaw.render(scale); - this.body.render(scale); - this.wings.render(scale); - this.wings2.render(scale); - this.neck.render(scale); - this.feather1.render(scale); - this.feather2.render(scale); - this.feather3.render(scale); - } + this.feather1 = new ModelRenderer(this, 30, 0); + this.feather1.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); + this.feather1.setRotationPoint(0.0F, (float) (1 + 16), 1.0F); + this.feather2 = new ModelRenderer(this, 30, 0); + this.feather2.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); + this.feather2.setRotationPoint(0.0F, (float) (1 + 16), 1.0F); + this.feather3 = new ModelRenderer(this, 30, 0); + this.feather3.addBox(-1.0F, -5.0F, 5.0F, 2, 1, 5, -0.3F); + this.feather3.setRotationPoint(0.0F, (float) (1 + 16), 1.0F); + this.feather1.rotationPointY += 0.5F; + this.feather2.rotationPointY += 0.5F; + this.feather3.rotationPointY += 0.5F; + } - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - EntityMoa moa = (EntityMoa)entityIn; - - this.head.rotateAngleX = headPitch / 57.29578F; - this.head.rotateAngleY = netHeadYaw / 57.29578F; + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + EntityMoa moa = (EntityMoa) entityIn; - this.jaw.rotateAngleX = head.rotateAngleX; - this.jaw.rotateAngleY = head.rotateAngleY; + if (!moa.isSitting() || (!moa.onGround && moa.isSitting())) { + this.legs.render(scale); + this.legs2.render(scale); + } - this.body.rotateAngleX = 1.570796F; + this.head.render(scale); + this.jaw.render(scale); + this.body.render(scale); + this.wings.render(scale); + this.wings2.render(scale); + this.neck.render(scale); + this.feather1.render(scale); + this.feather2.render(scale); + this.feather3.render(scale); + } - this.legs.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.legs2.rotateAngleX = MathHelper.cos((float) (limbSwing * 0.6662F + Math.PI)) * 1.4F * limbSwingAmount; + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + EntityMoa moa = (EntityMoa) entityIn; - if(ageInTicks > 0.001F) - { - this.wings.rotationPointZ = -1F; - this.wings2.rotationPointZ = -1F; - this.wings.rotationPointY = 12F; - this.wings2.rotationPointY = 12F; - this.wings.rotateAngleX = 0.0F; - this.wings2.rotateAngleX = 0.0F; - this.wings.rotateAngleZ = ageInTicks; - this.wings2.rotateAngleZ = -ageInTicks; - this.legs.rotateAngleX = 0.6F; - this.legs2.rotateAngleX = 0.6F; - } - else - { - this.wings.rotationPointZ = -3F; - this.wings2.rotationPointZ = -3F; - this.wings.rotationPointY = 14F; - this.wings2.rotationPointY = 14F; - this.wings.rotateAngleX = (float) (Math.PI / 2.0F); - this.wings2.rotateAngleX = (float) (Math.PI / 2.0F); - this.wings.rotateAngleZ = 0.0F; - this.wings2.rotateAngleZ = 0.0F; - } - - if (moa.isSitting()) - { - this.head.setRotationPoint(0.0F, (float)(-8 + 24), -4.0F); - this.jaw.setRotationPoint(0.0F, (float)(-8 + 24), -4.0F); - this.body.setRotationPoint(0.0F, (float)(0 + 24), 0.0F); - this.legs.setRotationPoint(-2.0F, (float)(0 + 24), 1.0F); - this.legs2.setRotationPoint(2.0F, (float)(0 + 24), 1.0F); - this.neck.setRotationPoint(0.0F, (float)(-2 + 24), -4.0F); - this.feather1.setRotationPoint(0.0F, (float)(1 + 24), 1.0F); - this.feather2.setRotationPoint(0.0F, (float)(1 + 24), 1.0F); - this.feather3.setRotationPoint(0.0F, (float)(1 + 24), 1.0F); - - this.jaw.rotateAngleX = -0.3F; - this.head.rotateAngleX = 0F; - - this.wings.rotationPointY = 22F; - this.wings2.rotationPointY = 22F; - } - else - { - this.head.setRotationPoint(0.0F, (float)(-8 + 16), -4.0F); - this.jaw.setRotationPoint(0.0F, (float)(-8 + 16), -4.0F); - this.body.setRotationPoint(0.0F, (float)(0 + 16), 0.0F); - this.legs.setRotationPoint(-2.0F, (float)(0 + 16), 1.0F); - this.legs2.setRotationPoint(2.0F, (float)(0 + 16), 1.0F); - this.neck.setRotationPoint(0.0F, (float)(-2 + 16), -4.0F); - this.feather1.setRotationPoint(0.0F, (float)(1 + 16), 1.0F); - this.feather2.setRotationPoint(0.0F, (float)(1 + 16), 1.0F); - this.feather3.setRotationPoint(0.0F, (float)(1 + 16), 1.0F); - } + this.head.rotateAngleX = headPitch / 57.29578F; + this.head.rotateAngleY = netHeadYaw / 57.29578F; - this.feather1.rotateAngleY = -0.375F; - this.feather2.rotateAngleY = 0.0F; - this.feather3.rotateAngleY = 0.375F; - this.feather1.rotateAngleX = 0.25F; - this.feather2.rotateAngleX = 0.25F; - this.feather3.rotateAngleX = 0.25F; + this.jaw.rotateAngleX = head.rotateAngleX; + this.jaw.rotateAngleY = head.rotateAngleY; - this.neck.rotateAngleX = 0.0F; - this.neck.rotateAngleY = head.rotateAngleY; - this.jaw.rotateAngleX += 0.35F; - } + this.body.rotateAngleX = 1.570796F; + + this.legs.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + this.legs2.rotateAngleX = MathHelper.cos((float) (limbSwing * 0.6662F + Math.PI)) * 1.4F * limbSwingAmount; + + if (ageInTicks > 0.001F) { + this.wings.rotationPointZ = -1F; + this.wings2.rotationPointZ = -1F; + this.wings.rotationPointY = 12F; + this.wings2.rotationPointY = 12F; + this.wings.rotateAngleX = 0.0F; + this.wings2.rotateAngleX = 0.0F; + this.wings.rotateAngleZ = ageInTicks; + this.wings2.rotateAngleZ = -ageInTicks; + this.legs.rotateAngleX = 0.6F; + this.legs2.rotateAngleX = 0.6F; + } else { + this.wings.rotationPointZ = -3F; + this.wings2.rotationPointZ = -3F; + this.wings.rotationPointY = 14F; + this.wings2.rotationPointY = 14F; + this.wings.rotateAngleX = (float) (Math.PI / 2.0F); + this.wings2.rotateAngleX = (float) (Math.PI / 2.0F); + this.wings.rotateAngleZ = 0.0F; + this.wings2.rotateAngleZ = 0.0F; + } + + if (moa.isSitting()) { + this.head.setRotationPoint(0.0F, (float) (-8 + 24), -4.0F); + this.jaw.setRotationPoint(0.0F, (float) (-8 + 24), -4.0F); + this.body.setRotationPoint(0.0F, (float) (0 + 24), 0.0F); + this.legs.setRotationPoint(-2.0F, (float) (0 + 24), 1.0F); + this.legs2.setRotationPoint(2.0F, (float) (0 + 24), 1.0F); + this.neck.setRotationPoint(0.0F, (float) (-2 + 24), -4.0F); + this.feather1.setRotationPoint(0.0F, (float) (1 + 24), 1.0F); + this.feather2.setRotationPoint(0.0F, (float) (1 + 24), 1.0F); + this.feather3.setRotationPoint(0.0F, (float) (1 + 24), 1.0F); + + this.jaw.rotateAngleX = -0.3F; + this.head.rotateAngleX = 0F; + + this.wings.rotationPointY = 22F; + this.wings2.rotationPointY = 22F; + } else { + this.head.setRotationPoint(0.0F, (float) (-8 + 16), -4.0F); + this.jaw.setRotationPoint(0.0F, (float) (-8 + 16), -4.0F); + this.body.setRotationPoint(0.0F, (float) (0 + 16), 0.0F); + this.legs.setRotationPoint(-2.0F, (float) (0 + 16), 1.0F); + this.legs2.setRotationPoint(2.0F, (float) (0 + 16), 1.0F); + this.neck.setRotationPoint(0.0F, (float) (-2 + 16), -4.0F); + this.feather1.setRotationPoint(0.0F, (float) (1 + 16), 1.0F); + this.feather2.setRotationPoint(0.0F, (float) (1 + 16), 1.0F); + this.feather3.setRotationPoint(0.0F, (float) (1 + 16), 1.0F); + } + + this.feather1.rotateAngleY = -0.375F; + this.feather2.rotateAngleY = 0.0F; + this.feather3.rotateAngleY = 0.375F; + this.feather1.rotateAngleX = 0.25F; + this.feather2.rotateAngleX = 0.25F; + this.feather3.rotateAngleX = 0.25F; + + this.neck.rotateAngleX = 0.0F; + this.neck.rotateAngleY = head.rotateAngleY; + this.jaw.rotateAngleX += 0.35F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/OldAerwhaleModel.java b/src/main/java/com/legacy/aether/client/models/entities/OldAerwhaleModel.java index aa44bde..9311963 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/OldAerwhaleModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/OldAerwhaleModel.java @@ -9,64 +9,61 @@ import net.minecraft.entity.Entity; * Created using Tabula 7.0.0 */ public class OldAerwhaleModel extends ModelBase { - public ModelRenderer Middlebody; - public ModelRenderer LeftFin; - public ModelRenderer Head; - public ModelRenderer BackfinLeft; - public ModelRenderer BackBody; - public ModelRenderer BackfinRight; - public ModelRenderer RightFin; + public ModelRenderer Middlebody; + public ModelRenderer LeftFin; + public ModelRenderer Head; + public ModelRenderer BackfinLeft; + public ModelRenderer BackBody; + public ModelRenderer BackfinRight; + public ModelRenderer RightFin; - public OldAerwhaleModel() - { - this.textureWidth = 192; - this.textureHeight = 96; - this.Middlebody = new ModelRenderer(this, 0, 0); - this.Middlebody.setRotationPoint(0.0F, -1.0F, 14.0F); - this.Middlebody.addBox(-9.0F, -6.0F, 1.0F, 15, 15, 15, 0.0F); - this.Head = new ModelRenderer(this, 60, 0); - this.Head.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Head.addBox(-12.0F, -9.0F, -14.0F, 21, 18, 30, 0.0F); - this.BackBody = new ModelRenderer(this, 0, 30); - this.BackBody.setRotationPoint(0.0F, 5.0F, 38.0F); - this.BackBody.addBox(-6.0F, -9.0F, -8.5F, 9, 9, 12, 0.0F); - this.BackfinRight = new ModelRenderer(this, 0, 51); - this.BackfinRight.setRotationPoint(-5.0F, 2.2F, 38.0F); - this.BackfinRight.addBox(-4.0F, 0.0F, -6.0F, 24, 3, 12, 0.0F); - this.setRotateAngle(BackfinRight, 0.10471975511965977F, -2.5497515042385164F, 0.0F); - this.BackfinLeft = new ModelRenderer(this, 0, 51); - this.BackfinLeft.setRotationPoint(3.0F, 2.2F, 38.0F); - this.BackfinLeft.addBox(-4.0F, 0.0F, -6.0F, 24, 3, 12, 0.0F); - this.setRotateAngle(BackfinLeft, -0.10471975511965977F, -0.593411945678072F, 0.0F); - this.RightFin = new ModelRenderer(this, 0, 66); - this.RightFin.setRotationPoint(-10.0F, 4.0F, 10.0F); - this.RightFin.addBox(-12.0F, 1.4F, -6.0F, 12, 3, 6, 0.0F); - this.setRotateAngle(RightFin, 0.0F, 0.17453292519943295F, 0.0F); - this.LeftFin = new ModelRenderer(this, 0, 66); - this.LeftFin.setRotationPoint(7.0F, 4.0F, 10.0F); - this.LeftFin.addBox(0.0F, 1.4F, -6.0F, 12, 3, 6, 0.0F); - this.setRotateAngle(LeftFin, 0.0F, -0.17453292519943295F, 0.0F); - } + public OldAerwhaleModel() { + this.textureWidth = 192; + this.textureHeight = 96; + this.Middlebody = new ModelRenderer(this, 0, 0); + this.Middlebody.setRotationPoint(0.0F, -1.0F, 14.0F); + this.Middlebody.addBox(-9.0F, -6.0F, 1.0F, 15, 15, 15, 0.0F); + this.Head = new ModelRenderer(this, 60, 0); + this.Head.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Head.addBox(-12.0F, -9.0F, -14.0F, 21, 18, 30, 0.0F); + this.BackBody = new ModelRenderer(this, 0, 30); + this.BackBody.setRotationPoint(0.0F, 5.0F, 38.0F); + this.BackBody.addBox(-6.0F, -9.0F, -8.5F, 9, 9, 12, 0.0F); + this.BackfinRight = new ModelRenderer(this, 0, 51); + this.BackfinRight.setRotationPoint(-5.0F, 2.2F, 38.0F); + this.BackfinRight.addBox(-4.0F, 0.0F, -6.0F, 24, 3, 12, 0.0F); + this.setRotateAngle(BackfinRight, 0.10471975511965977F, -2.5497515042385164F, 0.0F); + this.BackfinLeft = new ModelRenderer(this, 0, 51); + this.BackfinLeft.setRotationPoint(3.0F, 2.2F, 38.0F); + this.BackfinLeft.addBox(-4.0F, 0.0F, -6.0F, 24, 3, 12, 0.0F); + this.setRotateAngle(BackfinLeft, -0.10471975511965977F, -0.593411945678072F, 0.0F); + this.RightFin = new ModelRenderer(this, 0, 66); + this.RightFin.setRotationPoint(-10.0F, 4.0F, 10.0F); + this.RightFin.addBox(-12.0F, 1.4F, -6.0F, 12, 3, 6, 0.0F); + this.setRotateAngle(RightFin, 0.0F, 0.17453292519943295F, 0.0F); + this.LeftFin = new ModelRenderer(this, 0, 66); + this.LeftFin.setRotationPoint(7.0F, 4.0F, 10.0F); + this.LeftFin.addBox(0.0F, 1.4F, -6.0F, 12, 3, 6, 0.0F); + this.setRotateAngle(LeftFin, 0.0F, -0.17453292519943295F, 0.0F); + } - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - this.Middlebody.render(f5); - this.Head.render(f5); - this.BackBody.render(f5); - this.BackfinRight.render(f5); - this.BackfinLeft.render(f5); - this.RightFin.render(f5); - this.LeftFin.render(f5); - } + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.Middlebody.render(f5); + this.Head.render(f5); + this.BackBody.render(f5); + this.BackfinRight.render(f5); + this.BackfinLeft.render(f5); + this.RightFin.render(f5); + this.LeftFin.render(f5); + } - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/com/legacy/aether/client/models/entities/OldZephyrModel.java b/src/main/java/com/legacy/aether/client/models/entities/OldZephyrModel.java index 8c60ee3..132e506 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/OldZephyrModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/OldZephyrModel.java @@ -4,29 +4,25 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class OldZephyrModel extends ModelBase -{ - public ModelRenderer zephyr; +public class OldZephyrModel extends ModelBase { + public ModelRenderer zephyr; - public OldZephyrModel() - { - this.textureWidth = 128; - this.textureHeight = 64; - this.zephyr = new ModelRenderer(this, 0, 0); - this.zephyr.setRotationPoint(0.0F, 0.0F, 0.0F); - this.zephyr.addBox(-10.0F, 0.0F, -10.0F, 20, 14, 24, 0.0F); - } + public OldZephyrModel() { + this.textureWidth = 128; + this.textureHeight = 64; + this.zephyr = new ModelRenderer(this, 0, 0); + this.zephyr.setRotationPoint(0.0F, 0.0F, 0.0F); + this.zephyr.addBox(-10.0F, 0.0F, -10.0F, 20, 14, 24, 0.0F); + } - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - this.zephyr.render(f5); - } - - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.zephyr.render(f5); + } + + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/com/legacy/aether/client/models/entities/PhygWingModel.java b/src/main/java/com/legacy/aether/client/models/entities/PhygWingModel.java index 5342156..db3a893 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/PhygWingModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/PhygWingModel.java @@ -8,99 +8,94 @@ import net.minecraft.entity.Entity; import com.legacy.aether.entities.passive.mountable.EntityPhyg; -public class PhygWingModel extends ModelBase -{ +public class PhygWingModel extends ModelBase { - private ModelRenderer leftWingInner = new ModelRenderer(this, 0, 0); - private ModelRenderer leftWingOuter = new ModelRenderer(this, 20, 0); - private ModelRenderer rightWingInner = new ModelRenderer(this, 0, 0); - private ModelRenderer rightWingOuter = new ModelRenderer(this, 40, 0); + private ModelRenderer leftWingInner = new ModelRenderer(this, 0, 0); + private ModelRenderer leftWingOuter = new ModelRenderer(this, 20, 0); + private ModelRenderer rightWingInner = new ModelRenderer(this, 0, 0); + private ModelRenderer rightWingOuter = new ModelRenderer(this, 40, 0); - public PhygWingModel() - { - this.leftWingInner.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); - this.leftWingOuter.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); - this.rightWingInner.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); - this.rightWingOuter.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); + public PhygWingModel() { + this.leftWingInner.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); + this.leftWingOuter.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); + this.rightWingInner.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); + this.rightWingOuter.addBox(-1.0F, -8.0F, -4.0F, 2, 16, 8, 0.0F); - this.rightWingOuter.rotateAngleY = (float)Math.PI; - } + this.rightWingOuter.rotateAngleY = (float) Math.PI; + } - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - EntityPhyg pig = ((EntityPhyg)entityIn); - float wingBend; - float x; - float y; - float z; - float x2; - float y2; + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + EntityPhyg pig = ((EntityPhyg) entityIn); + float wingBend; + float x; + float y; + float z; + float x2; + float y2; - if (pig.isChild()) - { - wingBend = -((float)Math.acos((double)pig.wingFold)); - GL11.glScalef(1.0F / 2.0F, 1.0F / 2.0F, 1.0F / 2.0F); - GL11.glTranslatef(0.0F, 24.0F * scale, 0.0F); - x = -((float)Math.acos((double)pig.wingFold)); - y = 32.0F * pig.wingFold / 4.0F; - z = -32.0F * (float)Math.sqrt((double)(1.0F - pig.wingFold * pig.wingFold)) / 4.0F; - x2 = 0.0F; - y2 = y * (float)Math.cos((double)pig.wingAngle) - z * (float)Math.sin((double)pig.wingAngle); - float y21 = y * (float)Math.sin((double)pig.wingAngle) + z * (float)Math.cos((double)pig.wingAngle); + if (pig.isChild()) { + wingBend = -((float) Math.acos((double) pig.wingFold)); + GL11.glScalef(1.0F / 2.0F, 1.0F / 2.0F, 1.0F / 2.0F); + GL11.glTranslatef(0.0F, 24.0F * scale, 0.0F); + x = -((float) Math.acos((double) pig.wingFold)); + y = 32.0F * pig.wingFold / 4.0F; + z = -32.0F * (float) Math.sqrt((double) (1.0F - pig.wingFold * pig.wingFold)) / 4.0F; + x2 = 0.0F; + y2 = y * (float) Math.cos((double) pig.wingAngle) - z * (float) Math.sin((double) pig.wingAngle); + float y21 = y * (float) Math.sin((double) pig.wingAngle) + z * (float) Math.cos((double) pig.wingAngle); - this.leftWingInner.setRotationPoint(4.0F + y2, y21 + 12.0F, x2); - this.rightWingInner.setRotationPoint(-4.0F - y2, y21 + 12.0F, x2); + this.leftWingInner.setRotationPoint(4.0F + y2, y21 + 12.0F, x2); + this.rightWingInner.setRotationPoint(-4.0F - y2, y21 + 12.0F, x2); - y *= 3.0F; - y2 = y * (float)Math.cos((double)pig.wingAngle) - z * (float)Math.sin((double)pig.wingAngle); - y21 = y * (float)Math.sin((double)pig.wingAngle) + z * (float)Math.cos((double)pig.wingAngle); + y *= 3.0F; + y2 = y * (float) Math.cos((double) pig.wingAngle) - z * (float) Math.sin((double) pig.wingAngle); + y21 = y * (float) Math.sin((double) pig.wingAngle) + z * (float) Math.cos((double) pig.wingAngle); - this.leftWingOuter.setRotationPoint(4.0F + y2, y21 + 12.0F, x2); - this.rightWingOuter.setRotationPoint(-4.0F - y2, y21 + 12.0F, x2); + this.leftWingOuter.setRotationPoint(4.0F + y2, y21 + 12.0F, x2); + this.rightWingOuter.setRotationPoint(-4.0F - y2, y21 + 12.0F, x2); - this.leftWingInner.rotateAngleZ = pig.wingAngle + wingBend + ((float)Math.PI / 2F); - this.leftWingOuter.rotateAngleZ = pig.wingAngle - wingBend + ((float)Math.PI / 2F); - this.rightWingInner.rotateAngleZ = -(pig.wingAngle + wingBend - ((float)Math.PI / 2F)); - this.rightWingOuter.rotateAngleZ = -(pig.wingAngle - wingBend + ((float)Math.PI / 2F)); + this.leftWingInner.rotateAngleZ = pig.wingAngle + wingBend + ((float) Math.PI / 2F); + this.leftWingOuter.rotateAngleZ = pig.wingAngle - wingBend + ((float) Math.PI / 2F); + this.rightWingInner.rotateAngleZ = -(pig.wingAngle + wingBend - ((float) Math.PI / 2F)); + this.rightWingOuter.rotateAngleZ = -(pig.wingAngle - wingBend + ((float) Math.PI / 2F)); - this.leftWingOuter.render(scale); - this.leftWingInner.render(scale); - this.rightWingOuter.render(scale); - this.rightWingInner.render(scale); - } - else - { - wingBend = -((float)Math.acos((double)pig.wingFold)); - x = 32.0F * pig.wingFold / 4.0F; - y = -32.0F * (float)Math.sqrt((double)(1.0F - pig.wingFold * pig.wingFold)) / 4.0F; - z = 0.0F; - x2 = x * (float)Math.cos((double)pig.wingAngle) - y * (float)Math.sin((double)pig.wingAngle); - y2 = x * (float)Math.sin((double)pig.wingAngle) + y * (float)Math.cos((double)pig.wingAngle); + this.leftWingOuter.render(scale); + this.leftWingInner.render(scale); + this.rightWingOuter.render(scale); + this.rightWingInner.render(scale); + } else { + wingBend = -((float) Math.acos((double) pig.wingFold)); + x = 32.0F * pig.wingFold / 4.0F; + y = -32.0F * (float) Math.sqrt((double) (1.0F - pig.wingFold * pig.wingFold)) / 4.0F; + z = 0.0F; + x2 = x * (float) Math.cos((double) pig.wingAngle) - y * (float) Math.sin((double) pig.wingAngle); + y2 = x * (float) Math.sin((double) pig.wingAngle) + y * (float) Math.cos((double) pig.wingAngle); - this.leftWingInner.setRotationPoint(4.0F + x2, y2 + 12.0F, z); - this.rightWingInner.setRotationPoint(-4.0F - x2, y2 + 12.0F, z); + this.leftWingInner.setRotationPoint(4.0F + x2, y2 + 12.0F, z); + this.rightWingInner.setRotationPoint(-4.0F - x2, y2 + 12.0F, z); - x *= 3.0F; - x2 = x * (float)Math.cos((double)pig.wingAngle) - y * (float)Math.sin((double)pig.wingAngle); - y2 = x * (float)Math.sin((double)pig.wingAngle) + y * (float)Math.cos((double)pig.wingAngle); + x *= 3.0F; + x2 = x * (float) Math.cos((double) pig.wingAngle) - y * (float) Math.sin((double) pig.wingAngle); + y2 = x * (float) Math.sin((double) pig.wingAngle) + y * (float) Math.cos((double) pig.wingAngle); - this.leftWingOuter.setRotationPoint(4.0F + x2, y2 + 12.0F, z); - this.rightWingOuter.setRotationPoint(-4.0F - x2, y2 + 12.0F, z); + this.leftWingOuter.setRotationPoint(4.0F + x2, y2 + 12.0F, z); + this.rightWingOuter.setRotationPoint(-4.0F - x2, y2 + 12.0F, z); - this.leftWingInner.rotateAngleZ = pig.wingAngle + wingBend + ((float)Math.PI / 2F); - this.leftWingOuter.rotateAngleZ = pig.wingAngle - wingBend + ((float)Math.PI / 2F); - this.rightWingInner.rotateAngleZ = -(pig.wingAngle + wingBend - ((float)Math.PI / 2F)); - this.rightWingOuter.rotateAngleZ = -(pig.wingAngle - wingBend + ((float)Math.PI / 2F)); + this.leftWingInner.rotateAngleZ = pig.wingAngle + wingBend + ((float) Math.PI / 2F); + this.leftWingOuter.rotateAngleZ = pig.wingAngle - wingBend + ((float) Math.PI / 2F); + this.rightWingInner.rotateAngleZ = -(pig.wingAngle + wingBend - ((float) Math.PI / 2F)); + this.rightWingOuter.rotateAngleZ = -(pig.wingAngle - wingBend + ((float) Math.PI / 2F)); - this.leftWingOuter.render(scale); - this.leftWingInner.render(scale); - this.rightWingOuter.render(scale); - this.rightWingInner.render(scale); - } - } + this.leftWingOuter.render(scale); + this.leftWingInner.render(scale); + this.rightWingOuter.render(scale); + this.rightWingInner.render(scale); + } + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {} + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/SheepuffModel.java b/src/main/java/com/legacy/aether/client/models/entities/SheepuffModel.java index 2f4347f..5f27f49 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/SheepuffModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/SheepuffModel.java @@ -7,55 +7,51 @@ import net.minecraft.entity.EntityLivingBase; import com.legacy.aether.entities.passive.EntitySheepuff; -public class SheepuffModel extends ModelQuadruped -{ +public class SheepuffModel extends ModelQuadruped { - private float headRotationAngleX; + private float headRotationAngleX; - public SheepuffModel() - { - super(12, 0.0F); + public SheepuffModel() { + super(12, 0.0F); - this.head = new ModelRenderer(this, 0, 0); - this.head.addBox(-3.0F, -4.0F, -4.0F, 6, 6, 6, 0.6F); - this.head.setRotationPoint(0.0F, 6.0F, -8.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-3.0F, -4.0F, -4.0F, 6, 6, 6, 0.6F); + this.head.setRotationPoint(0.0F, 6.0F, -8.0F); - this.body = new ModelRenderer(this, 28, 8); - this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 1.75F); - this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + this.body = new ModelRenderer(this, 28, 8); + this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 1.75F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); - this.leg1 = new ModelRenderer(this, 0, 16); - this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); - this.leg1.setRotationPoint(-3.0F, 12.0F, 7.0F); + this.leg1 = new ModelRenderer(this, 0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); + this.leg1.setRotationPoint(-3.0F, 12.0F, 7.0F); - this.leg2 = new ModelRenderer(this, 0, 16); - this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); - this.leg2.setRotationPoint(3.0F, 12.0F, 7.0F); + this.leg2 = new ModelRenderer(this, 0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); + this.leg2.setRotationPoint(3.0F, 12.0F, 7.0F); - this.leg3 = new ModelRenderer(this, 0, 16); - this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); - this.leg3.setRotationPoint(-3.0F, 12.0F, -5.0F); + this.leg3 = new ModelRenderer(this, 0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); + this.leg3.setRotationPoint(-3.0F, 12.0F, -5.0F); - this.leg4 = new ModelRenderer(this, 0, 16); - this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); - this.leg4.setRotationPoint(3.0F, 12.0F, -5.0F); - } + this.leg4 = new ModelRenderer(this, 0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); + this.leg4.setRotationPoint(3.0F, 12.0F, -5.0F); + } - @Override - public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwing, float prevLimbSwing, float partialTickTime) - { - super.setLivingAnimations(entitylivingbaseIn, limbSwing, prevLimbSwing, partialTickTime); + @Override + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwing, float prevLimbSwing, float partialTickTime) { + super.setLivingAnimations(entitylivingbaseIn, limbSwing, prevLimbSwing, partialTickTime); - this.head.rotationPointY = 6.0F + ((EntitySheepuff)entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F; - this.headRotationAngleX = ((EntitySheepuff)entitylivingbaseIn).getHeadRotationAngleX(partialTickTime); - } + this.head.rotationPointY = 6.0F + ((EntitySheepuff) entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F; + this.headRotationAngleX = ((EntitySheepuff) entitylivingbaseIn).getHeadRotationAngleX(partialTickTime); + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); - this.head.rotateAngleX = this.headRotationAngleX; - } + this.head.rotateAngleX = this.headRotationAngleX; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/SheepuffWoolModel.java b/src/main/java/com/legacy/aether/client/models/entities/SheepuffWoolModel.java index 4fd4113..4468401 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/SheepuffWoolModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/SheepuffWoolModel.java @@ -7,36 +7,32 @@ import net.minecraft.entity.EntityLivingBase; import com.legacy.aether.entities.passive.EntitySheepuff; -public class SheepuffWoolModel extends ModelQuadruped -{ - private float headRotationAngleX; +public class SheepuffWoolModel extends ModelQuadruped { + private float headRotationAngleX; - public SheepuffWoolModel() - { - super(12, 0.0F); - this.head = new ModelRenderer(this, 0, 0); - this.head.addBox(-3.0F, -4.0F, -6.0F, 6, 6, 8, 0.0F); - this.head.setRotationPoint(0.0F, 6.0F, -8.0F); - this.body = new ModelRenderer(this, 28, 8); - this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 0.0F); - this.body.setRotationPoint(0.0F, 5.0F, 2.0F); - } + public SheepuffWoolModel() { + super(12, 0.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-3.0F, -4.0F, -6.0F, 6, 6, 8, 0.0F); + this.head.setRotationPoint(0.0F, 6.0F, -8.0F); + this.body = new ModelRenderer(this, 28, 8); + this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 0.0F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + } - @Override - public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwing, float prevLimbSwing, float partialTickTime) - { - super.setLivingAnimations(entitylivingbaseIn, limbSwing, prevLimbSwing, partialTickTime); + @Override + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwing, float prevLimbSwing, float partialTickTime) { + super.setLivingAnimations(entitylivingbaseIn, limbSwing, prevLimbSwing, partialTickTime); - this.head.rotationPointY = 6.0F + ((EntitySheepuff)entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F; - this.headRotationAngleX = ((EntitySheepuff)entitylivingbaseIn).getHeadRotationAngleX(partialTickTime); - } + this.head.rotationPointY = 6.0F + ((EntitySheepuff) entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F; + this.headRotationAngleX = ((EntitySheepuff) entitylivingbaseIn).getHeadRotationAngleX(partialTickTime); + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); - this.head.rotateAngleX = this.headRotationAngleX; - } + this.head.rotateAngleX = this.headRotationAngleX; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/SheepuffedModel.java b/src/main/java/com/legacy/aether/client/models/entities/SheepuffedModel.java index bd30620..652af18 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/SheepuffedModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/SheepuffedModel.java @@ -7,55 +7,51 @@ import net.minecraft.entity.EntityLivingBase; import com.legacy.aether.entities.passive.EntitySheepuff; -public class SheepuffedModel extends ModelQuadruped -{ +public class SheepuffedModel extends ModelQuadruped { - private float headRotationAngleX; + private float headRotationAngleX; - public SheepuffedModel() - { - super(12, 0.0F); + public SheepuffedModel() { + super(12, 0.0F); - this.head = new ModelRenderer(this, 0, 0); - this.head.addBox(-3.0F, -4.0F, -4.0F, 6, 6, 6, 0.6F); - this.head.setRotationPoint(0.0F, 6.0F, -8.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-3.0F, -4.0F, -4.0F, 6, 6, 6, 0.6F); + this.head.setRotationPoint(0.0F, 6.0F, -8.0F); - this.body = new ModelRenderer(this, 28, 8); - this.body.addBox(-4.0F, -8.0F, -7.0F, 8, 16, 6, 3.75F); - this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + this.body = new ModelRenderer(this, 28, 8); + this.body.addBox(-4.0F, -8.0F, -7.0F, 8, 16, 6, 3.75F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); - this.leg1 = new ModelRenderer(this, 0, 16); - this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); - this.leg1.setRotationPoint(-3.0F, 12.0F, 7.0F); + this.leg1 = new ModelRenderer(this, 0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); + this.leg1.setRotationPoint(-3.0F, 12.0F, 7.0F); - this.leg2 = new ModelRenderer(this, 0, 16); - this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); - this.leg2.setRotationPoint(3.0F, 12.0F, 7.0F); + this.leg2 = new ModelRenderer(this, 0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); + this.leg2.setRotationPoint(3.0F, 12.0F, 7.0F); - this.leg3 = new ModelRenderer(this, 0, 16); - this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); - this.leg3.setRotationPoint(-3.0F, 12.0F, -5.0F); + this.leg3 = new ModelRenderer(this, 0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); + this.leg3.setRotationPoint(-3.0F, 12.0F, -5.0F); - this.leg4 = new ModelRenderer(this, 0, 16); - this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); - this.leg4.setRotationPoint(3.0F, 12.0F, -5.0F); - } + this.leg4 = new ModelRenderer(this, 0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F); + this.leg4.setRotationPoint(3.0F, 12.0F, -5.0F); + } - @Override - public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwing, float prevLimbSwing, float partialTickTime) - { - super.setLivingAnimations(entitylivingbaseIn, limbSwing, prevLimbSwing, partialTickTime); + @Override + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwing, float prevLimbSwing, float partialTickTime) { + super.setLivingAnimations(entitylivingbaseIn, limbSwing, prevLimbSwing, partialTickTime); - this.head.rotationPointY = 6.0F + ((EntitySheepuff)entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F; - this.headRotationAngleX = ((EntitySheepuff)entitylivingbaseIn).getHeadRotationAngleX(partialTickTime); - } + this.head.rotationPointY = 6.0F + ((EntitySheepuff) entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F; + this.headRotationAngleX = ((EntitySheepuff) entitylivingbaseIn).getHeadRotationAngleX(partialTickTime); + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); - this.head.rotateAngleX = this.headRotationAngleX; - } + this.head.rotateAngleX = this.headRotationAngleX; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/SliderModel.java b/src/main/java/com/legacy/aether/client/models/entities/SliderModel.java index 18a8f92..42b0d63 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/SliderModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/SliderModel.java @@ -6,47 +6,41 @@ import net.minecraft.entity.Entity; import org.lwjgl.opengl.GL11; -public class SliderModel extends ModelBase -{ +public class SliderModel extends ModelBase { - public ModelRenderer head; + public ModelRenderer head; - public float hurtAngle, hurtAngleX, hurtAngleZ; + public float hurtAngle, hurtAngleX, hurtAngleZ; - public SliderModel() - { - this(0.0F); - } + public SliderModel() { + this(0.0F); + } - public SliderModel(float modelSize) - { - this(modelSize, 0.0F); - } + public SliderModel(float modelSize) { + this(modelSize, 0.0F); + } - public SliderModel(float modelSize, float rotationPointY) - { - this.head = new ModelRenderer(this, 0, 0); - this.head.addBox(-8F, -16F, -8F, 16, 16, 16, modelSize); - this.head.setRotationPoint(0.0F, rotationPointY, 0.0F); - } + public SliderModel(float modelSize, float rotationPointY) { + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-8F, -16F, -8F, 16, 16, 16, modelSize); + this.head.setRotationPoint(0.0F, rotationPointY, 0.0F); + } - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - this.head.rotateAngleY = this.head.rotateAngleY = 0.0F; + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + this.head.rotateAngleY = this.head.rotateAngleY = 0.0F; - GL11.glPushMatrix(); + GL11.glPushMatrix(); - GL11.glScalef(2.0F, 2.0F, 2.0F); + GL11.glScalef(2.0F, 2.0F, 2.0F); - if(this.hurtAngle > 0.01F) - { + if (this.hurtAngle > 0.01F) { GL11.glRotatef(this.hurtAngle * -30F, this.hurtAngleX, 0F, this.hurtAngleZ); } - this.head.render(scale); + this.head.render(scale); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/SunSpiritModel.java b/src/main/java/com/legacy/aether/client/models/entities/SunSpiritModel.java index 8c9f9f1..79566ef 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/SunSpiritModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/SunSpiritModel.java @@ -9,142 +9,133 @@ import net.minecraft.util.MathHelper; import com.legacy.aether.entities.bosses.sun_spirit.EntitySunSpirit; -public class SunSpiritModel extends ModelBiped -{ +public class SunSpiritModel extends ModelBiped { public ModelRenderer bipedBody2; public ModelRenderer bipedBody3; public ModelRenderer bipedBody4; public ModelRenderer bipedRightArm2; - public ModelRenderer bipedLeftArm2; + public ModelRenderer bipedLeftArm2; public ModelRenderer bipedRightArm3; - public ModelRenderer bipedLeftArm3; + public ModelRenderer bipedLeftArm3; - public SunSpiritModel() - { - this(0.0F); - } + public SunSpiritModel() { + this(0.0F); + } - public SunSpiritModel(float modelSize) - { - this(modelSize, 0.0F); - } + public SunSpiritModel(float modelSize) { + this(modelSize, 0.0F); + } - public SunSpiritModel(float modelSize, float rotationPointY) - { - this.isSneak = false; - - this.bipedHead = new ModelRenderer(this, 0, 0); - this.bipedHead.addBox(-4F, -8F, -3F, 8, 5, 7, modelSize); - this.bipedHead.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - - this.bipedHeadwear = new ModelRenderer(this, 32, 0); - this.bipedHeadwear.addBox(-4F, -3F, -4F, 8, 3, 8, modelSize); - this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - - this.bipedBody = new ModelRenderer(this, 0, 12); - this.bipedBody.addBox(-5F, 0.0F, -2.5F, 10, 6, 5, modelSize); - this.bipedBody.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - - this.bipedBody2 = new ModelRenderer(this, 0, 23); - this.bipedBody2.addBox(-4.5F, 6.0F, -2F, 9, 5, 4, modelSize); - this.bipedBody2.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - - this.bipedBody3 = new ModelRenderer(this, 30, 27); - this.bipedBody3.addBox(-4.5F, 11.0F, -2F, 5, 1, 4, modelSize + 0.5F); - this.bipedBody3.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - - this.bipedBody4 = new ModelRenderer(this, 30, 27); - this.bipedBody4.addBox(-0.5F, 11.0F, -2F, 5, 1, 4, modelSize + 0.5F); - this.bipedBody4.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - - this.bipedRightArm = new ModelRenderer(this, 30, 11); - this.bipedRightArm.addBox(-2.5F, -2.5F, -2.5F, 5, 5, 5, modelSize + 0.5F); - this.bipedRightArm.setRotationPoint(-8F, 2.0F + rotationPointY, 0.0F); - - this.bipedRightArm2 = new ModelRenderer(this, 30, 11); - this.bipedRightArm2.addBox(-2.5F, 2.5F, -2.5F, 5, 10, 5, modelSize); - this.bipedRightArm2.setRotationPoint(-8F, 2.0F + rotationPointY, 0.0F); - - this.bipedRightArm3 = new ModelRenderer(this, 30, 26); - this.bipedRightArm3.addBox(-2.5F, 7.5F, -2.5F, 5, 1, 5, modelSize + 0.25F); - this.bipedRightArm3.setRotationPoint(-8F, 2.0F + rotationPointY, 0.0F); - - this.bipedLeftArm = new ModelRenderer(this, 30, 11); - this.bipedLeftArm.mirror = true; - this.bipedLeftArm.addBox(-2.5F, -2.5F, -2.5F, 5, 5, 5, modelSize + 0.5F); - this.bipedLeftArm.setRotationPoint(8F, 2.0F + rotationPointY, 0.0F); - - this.bipedLeftArm2 = new ModelRenderer(this, 30, 11); - this.bipedLeftArm2.mirror = true; - this.bipedLeftArm2.addBox(-2.5F, 2.5F, -2.5F, 5, 10, 5, modelSize); - this.bipedLeftArm2.setRotationPoint(8F, 2.0F + rotationPointY, 0.0F); - - this.bipedLeftArm3 = new ModelRenderer(this, 30, 26); - this.bipedLeftArm3.mirror = true; - this.bipedLeftArm3.addBox(-2.5F, 7.5F, -2.5F, 5, 1, 5, modelSize + 0.25F); - this.bipedLeftArm3.setRotationPoint(8F, 2.0F + rotationPointY, 0.0F); - } + public SunSpiritModel(float modelSize, float rotationPointY) { + this.isSneak = false; - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.bipedHead = new ModelRenderer(this, 0, 0); + this.bipedHead.addBox(-4F, -8F, -3F, 8, 5, 7, modelSize); + this.bipedHead.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); - if (entityIn instanceof EntitySunSpirit) - { + this.bipedHeadwear = new ModelRenderer(this, 32, 0); + this.bipedHeadwear.addBox(-4F, -3F, -4F, 8, 3, 8, modelSize); + this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); + + this.bipedBody = new ModelRenderer(this, 0, 12); + this.bipedBody.addBox(-5F, 0.0F, -2.5F, 10, 6, 5, modelSize); + this.bipedBody.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); + + this.bipedBody2 = new ModelRenderer(this, 0, 23); + this.bipedBody2.addBox(-4.5F, 6.0F, -2F, 9, 5, 4, modelSize); + this.bipedBody2.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); + + this.bipedBody3 = new ModelRenderer(this, 30, 27); + this.bipedBody3.addBox(-4.5F, 11.0F, -2F, 5, 1, 4, modelSize + 0.5F); + this.bipedBody3.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); + + this.bipedBody4 = new ModelRenderer(this, 30, 27); + this.bipedBody4.addBox(-0.5F, 11.0F, -2F, 5, 1, 4, modelSize + 0.5F); + this.bipedBody4.setRotationPoint(0.0F, 0.0F + rotationPointY, 0.0F); + + this.bipedRightArm = new ModelRenderer(this, 30, 11); + this.bipedRightArm.addBox(-2.5F, -2.5F, -2.5F, 5, 5, 5, modelSize + 0.5F); + this.bipedRightArm.setRotationPoint(-8F, 2.0F + rotationPointY, 0.0F); + + this.bipedRightArm2 = new ModelRenderer(this, 30, 11); + this.bipedRightArm2.addBox(-2.5F, 2.5F, -2.5F, 5, 10, 5, modelSize); + this.bipedRightArm2.setRotationPoint(-8F, 2.0F + rotationPointY, 0.0F); + + this.bipedRightArm3 = new ModelRenderer(this, 30, 26); + this.bipedRightArm3.addBox(-2.5F, 7.5F, -2.5F, 5, 1, 5, modelSize + 0.25F); + this.bipedRightArm3.setRotationPoint(-8F, 2.0F + rotationPointY, 0.0F); + + this.bipedLeftArm = new ModelRenderer(this, 30, 11); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-2.5F, -2.5F, -2.5F, 5, 5, 5, modelSize + 0.5F); + this.bipedLeftArm.setRotationPoint(8F, 2.0F + rotationPointY, 0.0F); + + this.bipedLeftArm2 = new ModelRenderer(this, 30, 11); + this.bipedLeftArm2.mirror = true; + this.bipedLeftArm2.addBox(-2.5F, 2.5F, -2.5F, 5, 10, 5, modelSize); + this.bipedLeftArm2.setRotationPoint(8F, 2.0F + rotationPointY, 0.0F); + + this.bipedLeftArm3 = new ModelRenderer(this, 30, 26); + this.bipedLeftArm3.mirror = true; + this.bipedLeftArm3.addBox(-2.5F, 7.5F, -2.5F, 5, 1, 5, modelSize + 0.25F); + this.bipedLeftArm3.setRotationPoint(8F, 2.0F + rotationPointY, 0.0F); + } + + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + if (entityIn instanceof EntitySunSpirit) { GL11.glScalef(2.25F, 2.25F, 2.25F); - } - else - { + } else { GL11.glScalef(1.0F, 1.0F, 1.0F); } GL11.glTranslatef(0F, -0.25F, 0F); this.bipedHead.render(scale); - this.bipedHeadwear.render(scale); - this.bipedBody.render(scale); - this.bipedBody2.render(scale); + this.bipedHeadwear.render(scale); + this.bipedBody.render(scale); + this.bipedBody2.render(scale); this.bipedBody3.render(scale); this.bipedBody4.render(scale); this.bipedRightArm.offsetX = 0.985F; this.bipedRightArm.render(scale); - this.bipedRightArm2.render(scale); + this.bipedRightArm2.render(scale); this.bipedRightArm3.render(scale); this.bipedLeftArm.offsetX = -0.985F; this.bipedLeftArm.render(scale); - this.bipedLeftArm2.render(scale); - this.bipedLeftArm3.render(scale); - } + this.bipedLeftArm2.render(scale); + this.bipedLeftArm3.render(scale); + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - this.bipedHead.rotateAngleX = headPitch * 0.017453292F; - this.bipedHead.rotateAngleY = netHeadYaw * 0.017453292F; + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + this.bipedHead.rotateAngleX = headPitch * 0.017453292F; + this.bipedHead.rotateAngleY = netHeadYaw * 0.017453292F; - this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; - this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; - this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleY = this.bipedRightArm.rotateAngleZ = 0.0F; - this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleZ = this.bipedLeftArm.rotateAngleY = 0.0F; + this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; + this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; + this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleY = this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleZ = this.bipedLeftArm.rotateAngleY = 0.0F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F - 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F - 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; - - this.bipedBody4.rotateAngleX = this.bipedBody3.rotateAngleX = this.bipedBody2.rotateAngleX = this.bipedBody.rotateAngleX; - this.bipedBody4.rotateAngleY = this.bipedBody3.rotateAngleY = this.bipedBody2.rotateAngleY = this.bipedBody.rotateAngleY; + this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F - 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F - 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; - this.bipedLeftArm3.rotateAngleX = this.bipedLeftArm2.rotateAngleX = -this.bipedLeftArm.rotateAngleX; - this.bipedLeftArm3.rotateAngleY = this.bipedLeftArm2.rotateAngleY = -this.bipedLeftArm.rotateAngleY; - this.bipedLeftArm3.rotateAngleZ = this.bipedLeftArm2.rotateAngleZ = -this.bipedLeftArm.rotateAngleZ; - - this.bipedRightArm3.rotateAngleX = this.bipedRightArm2.rotateAngleX = -this.bipedRightArm.rotateAngleX; - this.bipedRightArm3.rotateAngleY = this.bipedRightArm2.rotateAngleY = -this.bipedRightArm.rotateAngleY; - this.bipedRightArm3.rotateAngleZ = this.bipedRightArm2.rotateAngleZ = -this.bipedRightArm.rotateAngleZ; - } + this.bipedBody4.rotateAngleX = this.bipedBody3.rotateAngleX = this.bipedBody2.rotateAngleX = this.bipedBody.rotateAngleX; + this.bipedBody4.rotateAngleY = this.bipedBody3.rotateAngleY = this.bipedBody2.rotateAngleY = this.bipedBody.rotateAngleY; + + this.bipedLeftArm3.rotateAngleX = this.bipedLeftArm2.rotateAngleX = -this.bipedLeftArm.rotateAngleX; + this.bipedLeftArm3.rotateAngleY = this.bipedLeftArm2.rotateAngleY = -this.bipedLeftArm.rotateAngleY; + this.bipedLeftArm3.rotateAngleZ = this.bipedLeftArm2.rotateAngleZ = -this.bipedLeftArm.rotateAngleZ; + + this.bipedRightArm3.rotateAngleX = this.bipedRightArm2.rotateAngleX = -this.bipedRightArm.rotateAngleX; + this.bipedRightArm3.rotateAngleY = this.bipedRightArm2.rotateAngleY = -this.bipedRightArm.rotateAngleY; + this.bipedRightArm3.rotateAngleZ = this.bipedRightArm2.rotateAngleZ = -this.bipedRightArm.rotateAngleZ; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/ValkyrieModel.java b/src/main/java/com/legacy/aether/client/models/entities/ValkyrieModel.java index 6c85a4a..b6883be 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/ValkyrieModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/ValkyrieModel.java @@ -7,16 +7,15 @@ import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; -public class ValkyrieModel extends ModelBiped -{ +public class ValkyrieModel extends ModelBiped { - public ModelRenderer bipedBody2; + public ModelRenderer bipedBody2; public ModelRenderer bipedRightArm2; public ModelRenderer bipedLeftArm2; public ModelRenderer wingLeft; public ModelRenderer wingRight; public ModelRenderer skirt[]; - public ModelRenderer sword[]; + public ModelRenderer sword[]; public ModelRenderer strand[]; public ModelRenderer halo[]; @@ -28,340 +27,324 @@ public class ValkyrieModel extends ModelBiped public float sinage; public boolean gonRound, halow; - public ValkyrieModel() - { - this(0.0F); - } + public ValkyrieModel() { + this(0.0F); + } - public ValkyrieModel(float f) - { - this(f, 0.0F); - } + public ValkyrieModel(float f) { + this(f, 0.0F); + } - public ValkyrieModel(float f, float f1) - { - this.isSneak = false; - - this.bipedHead = new ModelRenderer(this, 0, 0); - this.bipedHead.addBox(-4F, -8F, -4F, 8, 8, 8, f); - this.bipedHead.setRotationPoint(0.0F, 0.0F + f1, 0.0F); - - this.bipedBody = new ModelRenderer(this, 12, 16); - this.bipedBody.addBox(-3F, 0.0F, -1.5F, 6, 12, 3, f); - this.bipedBody.setRotationPoint(0.0F, 0.0F + f1, 0.0F); - - this.bipedBody2 = new ModelRenderer(this, 12, 16); + public ValkyrieModel(float f, float f1) { + this.isSneak = false; + + this.bipedHead = new ModelRenderer(this, 0, 0); + this.bipedHead.addBox(-4F, -8F, -4F, 8, 8, 8, f); + this.bipedHead.setRotationPoint(0.0F, 0.0F + f1, 0.0F); + + this.bipedBody = new ModelRenderer(this, 12, 16); + this.bipedBody.addBox(-3F, 0.0F, -1.5F, 6, 12, 3, f); + this.bipedBody.setRotationPoint(0.0F, 0.0F + f1, 0.0F); + + this.bipedBody2 = new ModelRenderer(this, 12, 16); this.bipedBody2.addBox(-3F, 0.5F, -1.25F, 6, 5, 3, f + 0.75F); this.bipedBody2.setRotationPoint(0.0F, 0.0F + f1, 0.0F); - + this.bipedRightArm = new ModelRenderer(this, 30, 16); this.bipedRightArm.addBox(-3F, -1.5F, -1.5F, 3, 12, 3, f); - this.bipedRightArm.setRotationPoint(-4F, 1.5F + f1, 0.0F); - - this.bipedLeftArm = new ModelRenderer(this, 30, 16); - this.bipedLeftArm.mirror = true; - this.bipedLeftArm.addBox(-1F, -1.5F, -1.5F, 3, 12, 3, f); - this.bipedLeftArm.setRotationPoint(5F, 1.5F + f1, 0.0F); - - this.bipedRightArm2 = new ModelRenderer(this, 30, 16); + this.bipedRightArm.setRotationPoint(-4F, 1.5F + f1, 0.0F); + + this.bipedLeftArm = new ModelRenderer(this, 30, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1F, -1.5F, -1.5F, 3, 12, 3, f); + this.bipedLeftArm.setRotationPoint(5F, 1.5F + f1, 0.0F); + + this.bipedRightArm2 = new ModelRenderer(this, 30, 16); this.bipedRightArm2.addBox(-3F, -1.5F, -1.5F, 3, 3, 3, f + 0.75F); - this.bipedRightArm2.setRotationPoint(-4F, 1.5F + f1, 0.0F); - - this.bipedLeftArm2 = new ModelRenderer(this, 30, 16); - this.bipedLeftArm2.mirror = true; - this.bipedLeftArm2.addBox(-1F, -1.5F, -1.5F, 3, 3, 3, f + 0.75F); - this.bipedLeftArm2.setRotationPoint(5F, 1.5F + f1, 0.0F); - - this.bipedRightLeg = new ModelRenderer(this, 0, 16); - this.bipedRightLeg.addBox(-2F, 0.0F, -1.5F, 3, 12, 3, f); - this.bipedRightLeg.setRotationPoint(-1F, 12F + f1, 0.0F); - - this.bipedLeftLeg = new ModelRenderer(this, 0, 16); - this.bipedLeftLeg.mirror = true; - this.bipedLeftLeg.addBox(-2F, 0.0F, -1.5F, 3, 12, 3, f); - this.bipedLeftLeg.setRotationPoint(2.0F, 12F + f1, 0.0F); - - this.sword = new ModelRenderer[swordParts]; - this.sword[0] = new ModelRenderer(this, 9, 16); - this.sword[0].addBox(-2.5F, 8F, 1.5F, 2, 2, 1, f); - this.sword[0].setRotationPoint(-4F, 1.5F + f1, 0.0F); - - this.sword[1] = new ModelRenderer(this, 32, 10); - this.sword[1].addBox(-3F, 6.5F, -2.75F, 3, 5, 1, f + 0.5F); - this.sword[1].setRotationPoint(-4F, 1.5F + f1, 0.0F); - - this.sword[2] = new ModelRenderer(this, 42, 18); - this.sword[2].addBox(-2F, 7.5F, -12.5F, 1, 3, 10, f); - this.sword[2].setRotationPoint(-4F, 1.5F + f1, 0.0F); - - this.sword[3] = new ModelRenderer(this, 42, 18); - this.sword[3].addBox(-2F, 7.5F, -22.5F, 1, 3, 10, f); - this.sword[3].setRotationPoint(-4F, 1.5F + f1, 0.0F); - - this.sword[4] = new ModelRenderer(this, 28, 17); - this.sword[4].addBox(-2F, 8.5F, -23.5F, 1, 1, 1, f); - this.sword[4].setRotationPoint(-4F, 1.5F + f1, 0.0F); - - this.wingLeft = new ModelRenderer(this, 24, 31); - this.wingLeft.addBox(0F, -4.5F, 0F, 19, 8, 1, f); - this.wingLeft.setRotationPoint(0.5F, 4.5F + f1, 2.625F); - - this.wingRight = new ModelRenderer(this, 24, 31); - this.wingRight.mirror = true; - this.wingRight.addBox(-19F, -4.5F, 0F, 19, 8, 1, f); - this.wingRight.setRotationPoint(-0.5F, 4.5F + f1, 2.625F); - - this.skirt = new ModelRenderer[skirtParts]; - this.skirt[0] = new ModelRenderer(this, 0, 0); - this.skirt[0].addBox(0F, 0F, -1F, 3, 6, 1, f); - this.skirt[0].setRotationPoint(-3F, 9F + f1, -1.5F); + this.bipedRightArm2.setRotationPoint(-4F, 1.5F + f1, 0.0F); - this.skirt[1] = new ModelRenderer(this, 0, 0); - this.skirt[1].addBox(0F, 0F, -1F, 3, 6, 1, f); - this.skirt[1].setRotationPoint(0F, 9F + f1, -1.5F); - - this.skirt[2] = new ModelRenderer(this, 0, 0); - this.skirt[2].addBox(0F, 0F, 0F, 3, 6, 1, f); - this.skirt[2].setRotationPoint(-3F, 9F + f1, 1.5F); - - this.skirt[3] = new ModelRenderer(this, 0, 0); - this.skirt[3].addBox(0F, 0F, 0F, 3, 6, 1, f); - this.skirt[3].setRotationPoint(0F, 9F + f1, 1.5F); - - this.skirt[4] = new ModelRenderer(this, 55, 19); - this.skirt[4].addBox(-1F, 0F, 0F, 1, 6, 3, f); - this.skirt[4].setRotationPoint(-3F, 9F + f1, -1.5F); - - this.skirt[5] = new ModelRenderer(this, 55, 19); - this.skirt[5].addBox(0F, 0F, 0F, 1, 6, 3, f); - this.skirt[5].setRotationPoint(3F, 9F + f1, -1.5F); + this.bipedLeftArm2 = new ModelRenderer(this, 30, 16); + this.bipedLeftArm2.mirror = true; + this.bipedLeftArm2.addBox(-1F, -1.5F, -1.5F, 3, 3, 3, f + 0.75F); + this.bipedLeftArm2.setRotationPoint(5F, 1.5F + f1, 0.0F); - this.strand = new ModelRenderer[strandParts]; + this.bipedRightLeg = new ModelRenderer(this, 0, 16); + this.bipedRightLeg.addBox(-2F, 0.0F, -1.5F, 3, 12, 3, f); + this.bipedRightLeg.setRotationPoint(-1F, 12F + f1, 0.0F); - for(int i = 0; i < strandParts; i++) - { + this.bipedLeftLeg = new ModelRenderer(this, 0, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-2F, 0.0F, -1.5F, 3, 12, 3, f); + this.bipedLeftLeg.setRotationPoint(2.0F, 12F + f1, 0.0F); + + this.sword = new ModelRenderer[swordParts]; + this.sword[0] = new ModelRenderer(this, 9, 16); + this.sword[0].addBox(-2.5F, 8F, 1.5F, 2, 2, 1, f); + this.sword[0].setRotationPoint(-4F, 1.5F + f1, 0.0F); + + this.sword[1] = new ModelRenderer(this, 32, 10); + this.sword[1].addBox(-3F, 6.5F, -2.75F, 3, 5, 1, f + 0.5F); + this.sword[1].setRotationPoint(-4F, 1.5F + f1, 0.0F); + + this.sword[2] = new ModelRenderer(this, 42, 18); + this.sword[2].addBox(-2F, 7.5F, -12.5F, 1, 3, 10, f); + this.sword[2].setRotationPoint(-4F, 1.5F + f1, 0.0F); + + this.sword[3] = new ModelRenderer(this, 42, 18); + this.sword[3].addBox(-2F, 7.5F, -22.5F, 1, 3, 10, f); + this.sword[3].setRotationPoint(-4F, 1.5F + f1, 0.0F); + + this.sword[4] = new ModelRenderer(this, 28, 17); + this.sword[4].addBox(-2F, 8.5F, -23.5F, 1, 1, 1, f); + this.sword[4].setRotationPoint(-4F, 1.5F + f1, 0.0F); + + this.wingLeft = new ModelRenderer(this, 24, 31); + this.wingLeft.addBox(0F, -4.5F, 0F, 19, 8, 1, f); + this.wingLeft.setRotationPoint(0.5F, 4.5F + f1, 2.625F); + + this.wingRight = new ModelRenderer(this, 24, 31); + this.wingRight.mirror = true; + this.wingRight.addBox(-19F, -4.5F, 0F, 19, 8, 1, f); + this.wingRight.setRotationPoint(-0.5F, 4.5F + f1, 2.625F); + + this.skirt = new ModelRenderer[skirtParts]; + this.skirt[0] = new ModelRenderer(this, 0, 0); + this.skirt[0].addBox(0F, 0F, -1F, 3, 6, 1, f); + this.skirt[0].setRotationPoint(-3F, 9F + f1, -1.5F); + + this.skirt[1] = new ModelRenderer(this, 0, 0); + this.skirt[1].addBox(0F, 0F, -1F, 3, 6, 1, f); + this.skirt[1].setRotationPoint(0F, 9F + f1, -1.5F); + + this.skirt[2] = new ModelRenderer(this, 0, 0); + this.skirt[2].addBox(0F, 0F, 0F, 3, 6, 1, f); + this.skirt[2].setRotationPoint(-3F, 9F + f1, 1.5F); + + this.skirt[3] = new ModelRenderer(this, 0, 0); + this.skirt[3].addBox(0F, 0F, 0F, 3, 6, 1, f); + this.skirt[3].setRotationPoint(0F, 9F + f1, 1.5F); + + this.skirt[4] = new ModelRenderer(this, 55, 19); + this.skirt[4].addBox(-1F, 0F, 0F, 1, 6, 3, f); + this.skirt[4].setRotationPoint(-3F, 9F + f1, -1.5F); + + this.skirt[5] = new ModelRenderer(this, 55, 19); + this.skirt[5].addBox(0F, 0F, 0F, 1, 6, 3, f); + this.skirt[5].setRotationPoint(3F, 9F + f1, -1.5F); + + this.strand = new ModelRenderer[strandParts]; + + for (int i = 0; i < strandParts; i++) { this.strand[i] = new ModelRenderer(this, 42 + (i % 7), 17); } - + this.strand[0].addBox(-5F, -7F, -4F, 1, 3, 1, f); - this.strand[0].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[0].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[1].addBox(4F, -7F, -4F, 1, 3, 1, f); - this.strand[1].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[1].addBox(4F, -7F, -4F, 1, 3, 1, f); + this.strand[1].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[2].addBox(-5F, -7F, -3F, 1, 4, 1, f); - this.strand[2].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[2].addBox(-5F, -7F, -3F, 1, 4, 1, f); + this.strand[2].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[3].addBox(4F, -7F, -3F, 1, 4, 1, f); - this.strand[3].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[3].addBox(4F, -7F, -3F, 1, 4, 1, f); + this.strand[3].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[4].addBox(-5F, -7F, -2F, 1, 4, 1, f); - this.strand[4].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[4].addBox(-5F, -7F, -2F, 1, 4, 1, f); + this.strand[4].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[5].addBox(4F, -7F, -2F, 1, 4, 1, f); - this.strand[5].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[5].addBox(4F, -7F, -2F, 1, 4, 1, f); + this.strand[5].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[6].addBox(-5F, -7F, -1F, 1, 5, 1, f); - this.strand[6].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[6].addBox(-5F, -7F, -1F, 1, 5, 1, f); + this.strand[6].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[7].addBox(4F, -7F, -1F, 1, 5, 1, f); - this.strand[7].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[7].addBox(4F, -7F, -1F, 1, 5, 1, f); + this.strand[7].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[8].addBox(-5F, -7F, 0.0F, 1, 5, 1, f); - this.strand[8].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[8].addBox(-5F, -7F, 0.0F, 1, 5, 1, f); + this.strand[8].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[9].addBox(4F, -7F, 0.0F, 1, 5, 1, f); - this.strand[9].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[9].addBox(4F, -7F, 0.0F, 1, 5, 1, f); + this.strand[9].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[10].addBox(-5F, -7F, 1.0F, 1, 6, 1, f); - this.strand[10].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[10].addBox(-5F, -7F, 1.0F, 1, 6, 1, f); + this.strand[10].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[11].addBox(4F, -7F, 1.0F, 1, 6, 1, f); - this.strand[11].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[11].addBox(4F, -7F, 1.0F, 1, 6, 1, f); + this.strand[11].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[12].addBox(-5F, -7F, 2.0F, 1, 7, 1, f); - this.strand[12].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[12].addBox(-5F, -7F, 2.0F, 1, 7, 1, f); + this.strand[12].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[13].addBox(4F, -7F, 2.0F, 1, 7, 1, f); - this.strand[13].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[13].addBox(4F, -7F, 2.0F, 1, 7, 1, f); + this.strand[13].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[14].addBox(-5F, -7F, 3F, 1, 8, 1, f); - this.strand[14].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[14].addBox(-5F, -7F, 3F, 1, 8, 1, f); + this.strand[14].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[15].addBox(4F, -7F, 3F, 1, 8, 1, f); - this.strand[15].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[15].addBox(4F, -7F, 3F, 1, 8, 1, f); + this.strand[15].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[16].addBox(-4F, -7F, 4F, 1, 9, 1, f); - this.strand[16].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[16].addBox(-4F, -7F, 4F, 1, 9, 1, f); + this.strand[16].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[17].addBox(3F, -7F, 4F, 1, 9, 1, f); - this.strand[17].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[17].addBox(3F, -7F, 4F, 1, 9, 1, f); + this.strand[17].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[18] = new ModelRenderer(this, 42, 17); - this.strand[18].addBox(-3F, -7F, 4F, 3, 10, 1, f); - this.strand[18].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[18] = new ModelRenderer(this, 42, 17); + this.strand[18].addBox(-3F, -7F, 4F, 3, 10, 1, f); + this.strand[18].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[19] = new ModelRenderer(this, 43, 17); - this.strand[19].addBox(0.0F, -7F, 4F, 3, 10, 1, f); - this.strand[19].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[19] = new ModelRenderer(this, 43, 17); + this.strand[19].addBox(0.0F, -7F, 4F, 3, 10, 1, f); + this.strand[19].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[20].addBox(-1F, -7F, -5F, 1, 2, 1, f); - this.strand[20].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + this.strand[20].addBox(-1F, -7F, -5F, 1, 2, 1, f); + this.strand[20].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.strand[21].addBox(0.0F, -7F, -5F, 1, 3, 1, f); - this.strand[21].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - - this.halo = new ModelRenderer[haloParts]; - this.halo[0] = new ModelRenderer(this, 43, 9); - this.halo[0].addBox(-2.5F, -11F, -3.5F, 5, 1, 1, f); - this.halo[0].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - - this.halo[1] = new ModelRenderer(this, 43, 9); - this.halo[1].addBox(-2.5F, -11F, 2.5F, 5, 1, 1, f); - this.halo[1].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - - this.halo[2] = new ModelRenderer(this, 42, 11); - this.halo[2].addBox(-3.5F, -11F, -2.5F, 1, 1, 5, f); - this.halo[2].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - - this.halo[3] = new ModelRenderer(this, 42, 11); - this.halo[3].addBox(2.5F, -11F, -2.5F, 1, 1, 5, f); - this.halo[3].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - } + this.strand[21].addBox(0.0F, -7F, -5F, 1, 3, 1, f); + this.strand[21].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + this.halo = new ModelRenderer[haloParts]; + this.halo[0] = new ModelRenderer(this, 43, 9); + this.halo[0].addBox(-2.5F, -11F, -3.5F, 5, 1, 1, f); + this.halo[0].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.bipedHead.render(scale); - this.bipedBody.render(scale); - this.bipedRightArm.render(scale); - this.bipedLeftArm.render(scale); - this.bipedRightLeg.render(scale); - this.bipedLeftLeg.render(scale); + this.halo[1] = new ModelRenderer(this, 43, 9); + this.halo[1].addBox(-2.5F, -11F, 2.5F, 5, 1, 1, f); + this.halo[1].setRotationPoint(0.0F, 0.0F + f1, 0.0F); - this.bipedBody2.render(scale); + this.halo[2] = new ModelRenderer(this, 42, 11); + this.halo[2].addBox(-3.5F, -11F, -2.5F, 1, 1, 5, f); + this.halo[2].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + + this.halo[3] = new ModelRenderer(this, 42, 11); + this.halo[3].addBox(2.5F, -11F, -2.5F, 1, 1, 5, f); + this.halo[3].setRotationPoint(0.0F, 0.0F + f1, 0.0F); + } + + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + + this.bipedHead.render(scale); + this.bipedBody.render(scale); + this.bipedRightArm.render(scale); + this.bipedLeftArm.render(scale); + this.bipedRightLeg.render(scale); + this.bipedLeftLeg.render(scale); + + this.bipedBody2.render(scale); this.bipedRightArm2.render(scale); this.bipedLeftArm2.render(scale); - this.wingLeft.render(scale); + this.wingLeft.render(scale); this.wingRight.render(scale); - for(int i = 0; i < swordParts; i++) - { + for (int i = 0; i < swordParts; i++) { this.sword[i].render(scale); } - for(int i = 0; i < skirtParts; i++) - { + for (int i = 0; i < skirtParts; i++) { this.skirt[i].render(scale); } - for(int i = 0; i < strandParts; i++) - { + for (int i = 0; i < strandParts; i++) { this.strand[i].render(scale); - } - - if(halow) - { + } + + if (halow) { GL11.glEnable(GL11.GL_NORMALIZE); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(770, 771); - for(int i = 0; i < haloParts; i++) - { + for (int i = 0; i < haloParts; i++) { this.halo[i].render(scale); } GL11.glEnable(GL11.GL_ALPHA_TEST); } - } + } - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - this.bipedHead.rotateAngleY = netHeadYaw / 57.29578F; - this.bipedHead.rotateAngleX = headPitch / 57.29578F; + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + this.bipedHead.rotateAngleY = netHeadYaw / 57.29578F; + this.bipedHead.rotateAngleX = headPitch / 57.29578F; - this.bipedRightArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + 3.141593F) * 2.0F * limbSwingAmount * 0.5F; - this.bipedLeftArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F; - this.bipedRightArm.rotateAngleZ = 0.05F; - this.bipedLeftArm.rotateAngleZ = -0.05F; - this.bipedRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - this.bipedLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + 3.141593F) * 1.4F * limbSwingAmount; - this.bipedRightLeg.rotateAngleY = 0.0F; - this.bipedLeftLeg.rotateAngleY = 0.0F; + this.bipedRightArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + 3.141593F) * 2.0F * limbSwingAmount * 0.5F; + this.bipedLeftArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F; + this.bipedRightArm.rotateAngleZ = 0.05F; + this.bipedLeftArm.rotateAngleZ = -0.05F; + this.bipedRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + this.bipedLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + 3.141593F) * 1.4F * limbSwingAmount; + this.bipedRightLeg.rotateAngleY = 0.0F; + this.bipedLeftLeg.rotateAngleY = 0.0F; - for(int i = 0; i < strandParts; i++) - { + for (int i = 0; i < strandParts; i++) { this.strand[i].rotateAngleY = this.bipedHead.rotateAngleY; - this.strand[i].rotateAngleX = this.bipedHead.rotateAngleX; - } - - for(int i = 0; i < haloParts; i++) - { + this.strand[i].rotateAngleX = this.bipedHead.rotateAngleX; + } + + for (int i = 0; i < haloParts; i++) { this.halo[i].rotateAngleY = this.bipedHead.rotateAngleY; this.halo[i].rotateAngleX = this.bipedHead.rotateAngleX; - } - - if(this.isRiding) - { - this.bipedRightArm.rotateAngleX += -0.6283185F; - this.bipedLeftArm.rotateAngleX += -0.6283185F; - this.bipedRightLeg.rotateAngleX = -1.256637F; - this.bipedLeftLeg.rotateAngleX = -1.256637F; - this.bipedRightLeg.rotateAngleY = 0.3141593F; - this.bipedLeftLeg.rotateAngleY = -0.3141593F; - } + } - this.bipedRightArm.rotateAngleY = 0.0F; - this.bipedLeftArm.rotateAngleY = 0.0F; + if (this.isRiding) { + this.bipedRightArm.rotateAngleX += -0.6283185F; + this.bipedLeftArm.rotateAngleX += -0.6283185F; + this.bipedRightLeg.rotateAngleX = -1.256637F; + this.bipedLeftLeg.rotateAngleX = -1.256637F; + this.bipedRightLeg.rotateAngleY = 0.3141593F; + this.bipedLeftLeg.rotateAngleY = -0.3141593F; + } - if(this.onGround > -9990F) - { - float f6 = onGround; - this.bipedBody2.rotateAngleY = this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * 3.141593F * 2.0F) * 0.2F; - this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY; - this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY; - this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY; - f6 = 1.0F - this.onGround; - f6 *= f6; - f6 *= f6; - f6 = 1.0F - f6; - float f7 = MathHelper.sin(f6 * 3.141593F); - float f8 = MathHelper.sin(this.onGround * 3.141593F) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F; - this.bipedRightArm.rotateAngleX -= (double)f7 * 1.2D + (double)f8; - this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; - this.bipedRightArm.rotateAngleZ = MathHelper.sin(this.onGround * 3.141593F) * -0.4F; - } + this.bipedRightArm.rotateAngleY = 0.0F; + this.bipedLeftArm.rotateAngleY = 0.0F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; - - for(int i = 0; i < swordParts; i++) - { + if (this.onGround > -9990F) { + float f6 = onGround; + this.bipedBody2.rotateAngleY = this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * 3.141593F * 2.0F) * 0.2F; + this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY; + f6 = 1.0F - this.onGround; + f6 *= f6; + f6 *= f6; + f6 = 1.0F - f6; + float f7 = MathHelper.sin(f6 * 3.141593F); + float f8 = MathHelper.sin(this.onGround * 3.141593F) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F; + this.bipedRightArm.rotateAngleX -= (double) f7 * 1.2D + (double) f8; + this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; + this.bipedRightArm.rotateAngleZ = MathHelper.sin(this.onGround * 3.141593F) * -0.4F; + } + + this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; + + for (int i = 0; i < swordParts; i++) { this.sword[i].rotateAngleZ = this.bipedRightArm.rotateAngleZ; this.sword[i].rotateAngleY = this.bipedRightArm.rotateAngleY; this.sword[i].rotateAngleX = this.bipedRightArm.rotateAngleX; } - + this.bipedRightArm2.rotateAngleZ = this.bipedRightArm.rotateAngleZ; this.bipedRightArm2.rotateAngleY = this.bipedRightArm.rotateAngleY; this.bipedRightArm2.rotateAngleX = this.bipedRightArm.rotateAngleX; this.bipedLeftArm2.rotateAngleZ = this.bipedLeftArm.rotateAngleZ; this.bipedLeftArm2.rotateAngleX = this.bipedLeftArm.rotateAngleX; - + this.wingLeft.rotateAngleY = -0.2F; this.wingRight.rotateAngleY = 0.2F; this.wingLeft.rotateAngleZ = -0.125F; this.wingRight.rotateAngleZ = 0.125F; - + this.wingLeft.rotateAngleY += Math.sin(this.sinage) / 6F; this.wingRight.rotateAngleY -= Math.sin(this.sinage) / 6F; this.wingLeft.rotateAngleZ += Math.cos(this.sinage) / (this.gonRound ? 8F : 3F); this.wingRight.rotateAngleZ -= Math.cos(this.sinage) / (this.gonRound ? 8F : 3F); - + this.skirt[0].rotateAngleX = -0.2F; this.skirt[1].rotateAngleX = -0.2F; this.skirt[2].rotateAngleX = 0.2F; @@ -369,18 +352,16 @@ public class ValkyrieModel extends ModelBiped this.skirt[4].rotateAngleZ = 0.2F; this.skirt[5].rotateAngleZ = -0.2F; - if(this.bipedLeftLeg.rotateAngleX < -0.3F) - { + if (this.bipedLeftLeg.rotateAngleX < -0.3F) { this.skirt[1].rotateAngleX += (this.bipedLeftLeg.rotateAngleX + 0.3F); this.skirt[2].rotateAngleX -= (this.bipedLeftLeg.rotateAngleX + 0.3F); } - if(this.bipedLeftLeg.rotateAngleX > 0.3F) - { + if (this.bipedLeftLeg.rotateAngleX > 0.3F) { this.skirt[3].rotateAngleX += (this.bipedLeftLeg.rotateAngleX - 0.3F); this.skirt[0].rotateAngleX -= (this.bipedLeftLeg.rotateAngleX - 0.3F); } - - } + + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/models/entities/ZephyrModel.java b/src/main/java/com/legacy/aether/client/models/entities/ZephyrModel.java index 30dcd85..4a87218 100644 --- a/src/main/java/com/legacy/aether/client/models/entities/ZephyrModel.java +++ b/src/main/java/com/legacy/aether/client/models/entities/ZephyrModel.java @@ -4,164 +4,159 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ZephyrModel extends ModelBase -{ +public class ZephyrModel extends ModelBase { - ModelRenderer LeftFace; - ModelRenderer BodyRightSide2; - ModelRenderer Mouth; - ModelRenderer CloudButt; - ModelRenderer Tail3; - ModelRenderer RightFace; - ModelRenderer BodyLeftSide1; - ModelRenderer BodyLeftSide2; - ModelRenderer Body; - ModelRenderer BodyRightSide1; - ModelRenderer Tail1; - ModelRenderer Tail2; - - public ZephyrModel() - { - this.textureWidth = 128; - this.textureHeight = 32; - - this.setTextureOffset("Tail1.tail1", 96, 22); - this.setTextureOffset("Tail2.tail2", 80, 24); - this.setTextureOffset("Tail3.tail3", 84, 18); - - this.Tail1 = new ModelRenderer(this, "Tail1"); - this.Tail1.setRotationPoint(0F, 0F, 12.4F); - this.Tail1.addBox("tail1",-2.5F, -2.5F, -2.5F, 5, 5, 5); - - this.Tail2 = new ModelRenderer(this, "Tail2"); - this.Tail2.setRotationPoint(0, 0, 6); - this.Tail2.addBox("tail2", -2F, -2F, -1.966667F, 4, 4, 4); - - this.Tail3 = new ModelRenderer(this, "Tail3"); - this.Tail3.setRotationPoint(0, 0, 5); - this.Tail3.addBox(-1.5F, -1.5F, -1.5F, 3, 3, 3); - - this.Tail1.addChild(Tail2); - this.Tail2.addChild(Tail3); - - this.LeftFace = new ModelRenderer(this, 67, 11); - this.LeftFace.addBox(3F, -1F, -9F, 4, 6, 2); - this.LeftFace.setRotationPoint(0F, 8F, 0F); - this.LeftFace.setTextureSize(128, 32); - this.LeftFace.mirror = true; - this.setRotation(LeftFace, 0F, 0F, 0F); + ModelRenderer LeftFace; + ModelRenderer BodyRightSide2; + ModelRenderer Mouth; + ModelRenderer CloudButt; + ModelRenderer Tail3; + ModelRenderer RightFace; + ModelRenderer BodyLeftSide1; + ModelRenderer BodyLeftSide2; + ModelRenderer Body; + ModelRenderer BodyRightSide1; + ModelRenderer Tail1; + ModelRenderer Tail2; - this.BodyRightSide2 = new ModelRenderer(this, 25, 11); - this.BodyRightSide2.addBox(-2F, -3.333333F, -2.5F, 2, 6, 6); - this.BodyRightSide2.setRotationPoint(-5.5F, 9F, 2F); - this.BodyRightSide2.setTextureSize(128, 32); - this.BodyRightSide2.mirror = true; - this.setRotation(BodyRightSide2, 0F, 0F, 0F); - this.BodyRightSide2.mirror = false; + public ZephyrModel() { + this.textureWidth = 128; + this.textureHeight = 32; - this.Mouth = new ModelRenderer(this, 66, 19); - this.Mouth.addBox(-3F, 1F, -8F, 6, 3, 1); - this.Mouth.setRotationPoint(0F, 8F, 0F); - this.Mouth.setTextureSize(128, 32); - this.Mouth.mirror = true; - this.setRotation(Mouth, 0F, 0F, 0F); + this.setTextureOffset("Tail1.tail1", 96, 22); + this.setTextureOffset("Tail2.tail2", 80, 24); + this.setTextureOffset("Tail3.tail3", 84, 18); - this.CloudButt = new ModelRenderer(this, 0, 0); - this.CloudButt.addBox(-6F, -3F, 0F, 8, 6, 2); - this.CloudButt.setRotationPoint(2F, 8F, 7F); - this.CloudButt.setTextureSize(128, 32); - this.CloudButt.mirror = true; - this.setRotation(CloudButt, 0F, 0F, 0F); + this.Tail1 = new ModelRenderer(this, "Tail1"); + this.Tail1.setRotationPoint(0F, 0F, 12.4F); + this.Tail1.addBox("tail1", -2.5F, -2.5F, -2.5F, 5, 5, 5); - this.RightFace = new ModelRenderer(this, 67, 11); - this.RightFace.addBox(-7F, -1F, -9F, 4, 6, 2); - this.RightFace.setRotationPoint(0F, 8F, 0F); - this.RightFace.setTextureSize(128, 32); - this.RightFace.mirror = true; - this.setRotation(RightFace, 0F, 0F, 0F); - this.RightFace.mirror = false; + this.Tail2 = new ModelRenderer(this, "Tail2"); + this.Tail2.setRotationPoint(0, 0, 6); + this.Tail2.addBox("tail2", -2F, -2F, -1.966667F, 4, 4, 4); - this.BodyLeftSide1 = new ModelRenderer(this, 0, 20); - this.BodyLeftSide1.addBox(0F, -3F, -3F, 2, 6, 6); - this.BodyLeftSide1.setRotationPoint(6F, 8F, -4F); - this.BodyLeftSide1.setTextureSize(128, 32); - this.BodyLeftSide1.mirror = true; - this.setRotation(BodyLeftSide1, 0F, 0F, 0F); + this.Tail3 = new ModelRenderer(this, "Tail3"); + this.Tail3.setRotationPoint(0, 0, 5); + this.Tail3.addBox(-1.5F, -1.5F, -1.5F, 3, 3, 3); - this.BodyLeftSide2 = new ModelRenderer(this, 25, 11); - this.BodyLeftSide2.addBox(0F, -3.333333F, -2.5F, 2, 6, 6); - this.BodyLeftSide2.setRotationPoint(5.5F, 9F, 2F); - this.BodyLeftSide2.setTextureSize(128, 32); - this.BodyLeftSide2.mirror = true; - this.setRotation(BodyLeftSide2, 0F, 0F, 0F); + this.Tail1.addChild(Tail2); + this.Tail2.addChild(Tail3); - this.Body = new ModelRenderer(this, 27, 9); - this.Body.addBox(-6F, -4F, -7F, 12, 9, 14); - this.Body.setRotationPoint(0F, 8F, 0F); - this.Body.setTextureSize(128, 32); - this.setRotation(Body, 0F, 0F, 0F); + this.LeftFace = new ModelRenderer(this, 67, 11); + this.LeftFace.addBox(3F, -1F, -9F, 4, 6, 2); + this.LeftFace.setRotationPoint(0F, 8F, 0F); + this.LeftFace.setTextureSize(128, 32); + this.LeftFace.mirror = true; + this.setRotation(LeftFace, 0F, 0F, 0F); - this.BodyRightSide1 = new ModelRenderer(this, 0, 20); - this.BodyRightSide1.addBox(-2F, -3F, -3F, 2, 6, 6); - this.BodyRightSide1.setRotationPoint(-6F, 8F, -4F); - this.BodyRightSide1.setTextureSize(128, 32); - this.BodyRightSide1.mirror = true; - this.setRotation(BodyRightSide1, 0F, 0F, 0F); - this.BodyRightSide1.mirror = false; - } + this.BodyRightSide2 = new ModelRenderer(this, 25, 11); + this.BodyRightSide2.addBox(-2F, -3.333333F, -2.5F, 2, 6, 6); + this.BodyRightSide2.setRotationPoint(-5.5F, 9F, 2F); + this.BodyRightSide2.setTextureSize(128, 32); + this.BodyRightSide2.mirror = true; + this.setRotation(BodyRightSide2, 0F, 0F, 0F); + this.BodyRightSide2.mirror = false; - @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) - { - this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + this.Mouth = new ModelRenderer(this, 66, 19); + this.Mouth.addBox(-3F, 1F, -8F, 6, 3, 1); + this.Mouth.setRotationPoint(0F, 8F, 0F); + this.Mouth.setTextureSize(128, 32); + this.Mouth.mirror = true; + this.setRotation(Mouth, 0F, 0F, 0F); - this.LeftFace.render(scale); - this.BodyRightSide2.render(scale); - this.Mouth.render(scale); - this.CloudButt.render(scale); - this.RightFace.render(scale); - this.BodyLeftSide1.render(scale); - this.BodyLeftSide2.render(scale); - this.Body.render(scale); - this.BodyRightSide1.render(scale); - this.Tail1.render(scale); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - @Override - public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) - { - float motion = (float)(Math.sin(limbSwing * 20 / 57.2957795) * limbSwingAmount * .5F); + this.CloudButt = new ModelRenderer(this, 0, 0); + this.CloudButt.addBox(-6F, -3F, 0F, 8, 6, 2); + this.CloudButt.setRotationPoint(2F, 8F, 7F); + this.CloudButt.setTextureSize(128, 32); + this.CloudButt.mirror = true; + this.setRotation(CloudButt, 0F, 0F, 0F); - this.LeftFace.rotationPointY = motion + 8; - this.LeftFace.rotationPointX = motion * 0.5F; + this.RightFace = new ModelRenderer(this, 67, 11); + this.RightFace.addBox(-7F, -1F, -9F, 4, 6, 2); + this.RightFace.setRotationPoint(0F, 8F, 0F); + this.RightFace.setTextureSize(128, 32); + this.RightFace.mirror = true; + this.setRotation(RightFace, 0F, 0F, 0F); + this.RightFace.mirror = false; - this.BodyLeftSide1.rotationPointY = 8 - motion * 0.5F; - this.BodyLeftSide2.rotationPointY = 9 + motion * 0.5F; - - this.RightFace.rotationPointY = 8 - motion; - this.RightFace.rotationPointX = -motion * 0.5F; + this.BodyLeftSide1 = new ModelRenderer(this, 0, 20); + this.BodyLeftSide1.addBox(0F, -3F, -3F, 2, 6, 6); + this.BodyLeftSide1.setRotationPoint(6F, 8F, -4F); + this.BodyLeftSide1.setTextureSize(128, 32); + this.BodyLeftSide1.mirror = true; + this.setRotation(BodyLeftSide1, 0F, 0F, 0F); - this.BodyRightSide1.rotationPointY = 8 - motion * 0.5F; - this.BodyRightSide2.rotationPointY = 9 + motion * 0.5F; + this.BodyLeftSide2 = new ModelRenderer(this, 25, 11); + this.BodyLeftSide2.addBox(0F, -3.333333F, -2.5F, 2, 6, 6); + this.BodyLeftSide2.setRotationPoint(5.5F, 9F, 2F); + this.BodyLeftSide2.setTextureSize(128, 32); + this.BodyLeftSide2.mirror = true; + this.setRotation(BodyLeftSide2, 0F, 0F, 0F); - this.Tail1.rotationPointX = (float)(Math.sin(limbSwing * 20 / 57.2957795) * limbSwingAmount * 0.75F); - - this.Tail1.rotateAngleY = (float)(Math.sin(limbSwing * 0.5F / 57.2957795) * limbSwingAmount * 0.75F); - this.Tail1.rotationPointY = 8 - motion; - - this.Tail2.rotationPointX = (float)(Math.sin(limbSwing * 15 / 57.2957795) * limbSwingAmount * 0.85F); - this.Tail2.rotationPointY = motion * 1.25F; - this.Tail2.rotateAngleY = this.Tail1.rotateAngleY + 0.25F; - - this.Tail3.rotationPointX = (float)(Math.sin(limbSwing * 10 / 57.2957795) * limbSwingAmount * 0.95F); - this.Tail3.rotationPointY =- motion; - this.Tail3.rotateAngleY = this.Tail2.rotateAngleY + 0.35F; - } + this.Body = new ModelRenderer(this, 27, 9); + this.Body.addBox(-6F, -4F, -7F, 12, 9, 14); + this.Body.setRotationPoint(0F, 8F, 0F); + this.Body.setTextureSize(128, 32); + this.setRotation(Body, 0F, 0F, 0F); + + this.BodyRightSide1 = new ModelRenderer(this, 0, 20); + this.BodyRightSide1.addBox(-2F, -3F, -3F, 2, 6, 6); + this.BodyRightSide1.setRotationPoint(-6F, 8F, -4F); + this.BodyRightSide1.setTextureSize(128, 32); + this.BodyRightSide1.mirror = true; + this.setRotation(BodyRightSide1, 0F, 0F, 0F); + this.BodyRightSide1.mirror = false; + } + + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + + this.LeftFace.render(scale); + this.BodyRightSide2.render(scale); + this.Mouth.render(scale); + this.CloudButt.render(scale); + this.RightFace.render(scale); + this.BodyLeftSide1.render(scale); + this.BodyLeftSide2.render(scale); + this.Body.render(scale); + this.BodyRightSide1.render(scale); + this.Tail1.render(scale); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + float motion = (float) (Math.sin(limbSwing * 20 / 57.2957795) * limbSwingAmount * .5F); + + this.LeftFace.rotationPointY = motion + 8; + this.LeftFace.rotationPointX = motion * 0.5F; + + this.BodyLeftSide1.rotationPointY = 8 - motion * 0.5F; + this.BodyLeftSide2.rotationPointY = 9 + motion * 0.5F; + + this.RightFace.rotationPointY = 8 - motion; + this.RightFace.rotationPointX = -motion * 0.5F; + + this.BodyRightSide1.rotationPointY = 8 - motion * 0.5F; + this.BodyRightSide2.rotationPointY = 9 + motion * 0.5F; + + this.Tail1.rotationPointX = (float) (Math.sin(limbSwing * 20 / 57.2957795) * limbSwingAmount * 0.75F); + + this.Tail1.rotateAngleY = (float) (Math.sin(limbSwing * 0.5F / 57.2957795) * limbSwingAmount * 0.75F); + this.Tail1.rotationPointY = 8 - motion; + + this.Tail2.rotationPointX = (float) (Math.sin(limbSwing * 15 / 57.2957795) * limbSwingAmount * 0.85F); + this.Tail2.rotationPointY = motion * 1.25F; + this.Tail2.rotateAngleY = this.Tail1.rotateAngleY + 0.25F; + + this.Tail3.rotationPointX = (float) (Math.sin(limbSwing * 10 / 57.2957795) * limbSwingAmount * 0.95F); + this.Tail3.rotationPointY = -motion; + this.Tail3.rotateAngleY = this.Tail2.rotateAngleY + 0.35F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/overlay/AetherOverlay.java b/src/main/java/com/legacy/aether/client/overlay/AetherOverlay.java index 1d23840..f95fff1 100644 --- a/src/main/java/com/legacy/aether/client/overlay/AetherOverlay.java +++ b/src/main/java/com/legacy/aether/client/overlay/AetherOverlay.java @@ -25,134 +25,124 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class AetherOverlay -{ +public class AetherOverlay { private static final ResourceLocation TEXTURE_JUMPS = Aether.locate("textures/gui/jumps.png"); private static final ResourceLocation TEXTURE_COOLDOWN_BAR = Aether.locate("textures/gui/cooldown_bar.png"); - private static final ResourceLocation TEXTURE_POISON_VIGNETTE = Aether.locate("textures/blur/poison_vignette.png"); + private static final ResourceLocation TEXTURE_POISON_VIGNETTE = Aether.locate("textures/blur/poison_vignette.png"); - private static final ResourceLocation TEXTURE_CURE_VIGNETTE = Aether.locate("textures/blur/cure_vignette.png"); - - public static void renderPoison(Minecraft mc) - { - PlayerAether playerAether = PlayerAether.get(mc.thePlayer); + private static final ResourceLocation TEXTURE_CURE_VIGNETTE = Aether.locate("textures/blur/cure_vignette.png"); - if(playerAether.isPoisoned()) - { - ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); - Tessellator tessellator = Tessellator.instance; + public static void renderPoison(Minecraft mc) { + PlayerAether playerAether = PlayerAether.get(mc.thePlayer); - float alpha = getPoisonAlpha((float)(playerAether.poisonMovement.ticks % 50) / 50); - int width = scaledresolution.getScaledWidth(); - int height = scaledresolution.getScaledHeight(); + if (playerAether.isPoisoned()) { + ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); + Tessellator tessellator = Tessellator.instance; - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(0.5F, 0.5F, 0.5F, alpha); + float alpha = getPoisonAlpha((float) (playerAether.poisonMovement.ticks % 50) / 50); + int width = scaledresolution.getScaledWidth(); + int height = scaledresolution.getScaledHeight(); + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(0.5F, 0.5F, 0.5F, alpha); - mc.renderEngine.bindTexture(TEXTURE_POISON_VIGNETTE); + mc.renderEngine.bindTexture(TEXTURE_POISON_VIGNETTE); - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(0.0D, (double)height, -90.0D, 0.0D, 1.0D); - tessellator.addVertexWithUV((double)width, (double)height, -90.0D, 1.0D, 1.0D); - tessellator.addVertexWithUV((double)width, 0.0D, -90.0D, 1.0D, 0.0D); - tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); - tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(0.0D, (double) height, -90.0D, 0.0D, 1.0D); + tessellator.addVertexWithUV((double) width, (double) height, -90.0D, 1.0D, 1.0D); + tessellator.addVertexWithUV((double) width, 0.0D, -90.0D, 1.0D, 0.0D); + tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); + tessellator.draw(); - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPopMatrix(); - } - } + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + } - public static void renderCure(Minecraft mc) - { - PlayerAether playerAether = PlayerAether.get(mc.thePlayer); + public static void renderCure(Minecraft mc) { + PlayerAether playerAether = PlayerAether.get(mc.thePlayer); - if(playerAether.isCured()) - { - ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); - Tessellator tessellator = Tessellator.instance; + if (playerAether.isCured()) { + ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); + Tessellator tessellator = Tessellator.instance; - float alpha = 0.5F; - int width = scaledresolution.getScaledWidth(); - int height = scaledresolution.getScaledHeight(); + float alpha = 0.5F; + int width = scaledresolution.getScaledWidth(); + int height = scaledresolution.getScaledHeight(); - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(0.5F, 0.5F, 0.5F, alpha); + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(0.5F, 0.5F, 0.5F, alpha); - mc.renderEngine.bindTexture(TEXTURE_CURE_VIGNETTE); + mc.renderEngine.bindTexture(TEXTURE_CURE_VIGNETTE); - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(0.0D, (double)height, -90.0D, 0.0D, 1.0D); - tessellator.addVertexWithUV((double)width, (double)height, -90.0D, 1.0D, 1.0D); - tessellator.addVertexWithUV((double)width, 0.0D, -90.0D, 1.0D, 0.0D); - tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); - tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(0.0D, (double) height, -90.0D, 0.0D, 1.0D); + tessellator.addVertexWithUV((double) width, (double) height, -90.0D, 1.0D, 1.0D); + tessellator.addVertexWithUV((double) width, 0.0D, -90.0D, 1.0D, 0.0D); + tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); + tessellator.draw(); - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPopMatrix(); - } - } + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + } - public static void renderIronBubble(Minecraft mc) - { + public static void renderIronBubble(Minecraft mc) { ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_ALPHA_TEST); mc.renderEngine.bindTexture(Gui.icons); int bubbleAmount = PlayerAether.get(mc.thePlayer).getAccessoryInventory().getAccessoryCount(new ItemStack(ItemsAether.iron_bubble)); - if (mc.playerController.shouldDrawHUD() && mc.thePlayer.isInWater() && mc.thePlayer.isInsideOfMaterial(Material.water)) - { - for (int i = 0; i < bubbleAmount; ++i) - { + if (mc.playerController.shouldDrawHUD() && mc.thePlayer.isInWater() && mc.thePlayer.isInsideOfMaterial(Material.water)) { + for (int i = 0; i < bubbleAmount; ++i) { drawTexturedModalRect((width / 2 - 8 * i) + 81, height - 49, 16, 18, 9, 9); } } - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPopMatrix(); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); } - public static void renderCooldown(Minecraft mc) - { + public static void renderCooldown(Minecraft mc) { PlayerAether playerInfo = PlayerAether.get(mc.thePlayer); - if (playerInfo.getHammerCooldown() != 0) - { + if (playerInfo.getHammerCooldown() != 0) { ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); int cooldownRemaining = (int) ((float) (playerInfo.getHammerCooldown()) / (float) (playerInfo.getHammerMaxCooldown()) * 128F); @@ -160,14 +150,14 @@ public class AetherOverlay mc.fontRenderer.drawStringWithShadow(playerInfo.getHammerName() + " Cooldown", (width / 2) - (mc.fontRenderer.getStringWidth(playerInfo.getHammerName() + " Cooldown") / 2), 32, 0xffffffff); - GL11.glPushMatrix(); + GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_ALPHA_TEST); mc.renderEngine.bindTexture(TEXTURE_COOLDOWN_BAR); @@ -175,21 +165,19 @@ public class AetherOverlay drawTexturedModalRect(width / 2 - 64, 42, 0, 0, cooldownRemaining, 8); - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPopMatrix(); + GL11.glPopMatrix(); } } - public static void renderJumps(Minecraft mc) - { + public static void renderJumps(Minecraft mc) { EntityPlayer player = mc.thePlayer; - if (player == null || player.ridingEntity == null || !(player.ridingEntity instanceof EntityMoa)) - { + if (player == null || player.ridingEntity == null || !(player.ridingEntity instanceof EntityMoa)) { return; } @@ -203,71 +191,62 @@ public class AetherOverlay mc.renderEngine.bindTexture(TEXTURE_JUMPS); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - for (int jump = 0; jump < moa.getMaxJumps(); jump++) - { + for (int jump = 0; jump < moa.getMaxJumps(); jump++) { int yPos = 18; int xPos = ((width / 2) + (jump * 8)) - (moa.getMaxJumps() * 8) / 2; - if (jump < moa.getRemainingJumps()) - { + if (jump < moa.getRemainingJumps()) { drawTexturedModalRect(xPos, yPos, 0, 0, 9, 11); - } - else - { + } else { drawTexturedModalRect(xPos, yPos, 10, 0, 9, 11); } } - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } - public static void renderAetherPortal(float timeInPortal, ScaledResolution scaledRes) - { - if (timeInPortal < 1.0F) - { - timeInPortal = timeInPortal * timeInPortal; - timeInPortal = timeInPortal * timeInPortal; - timeInPortal = timeInPortal * 0.8F + 0.2F; - } + public static void renderAetherPortal(float timeInPortal, ScaledResolution scaledRes) { + if (timeInPortal < 1.0F) { + timeInPortal = timeInPortal * timeInPortal; + timeInPortal = timeInPortal * timeInPortal; + timeInPortal = timeInPortal * 0.8F + 0.2F; + } - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - GL11.glColor4f(1.0F, 1.0F, 1.0F, timeInPortal); - IIcon iicon = BlocksAether.aether_portal.getBlockTextureFromSide(1); - Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); - float f = iicon.getMinU(); - float f1 = iicon.getMinV(); - float f2 = iicon.getMaxU(); - float f3 = iicon.getMaxV(); - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(0.0D, (double)scaledRes.getScaledHeight(), -90.0D, (double)f, (double)f3); - tessellator.addVertexWithUV((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D, (double)f2, (double)f3); - tessellator.addVertexWithUV((double)scaledRes.getScaledWidth(), 0.0D, -90.0D, (double)f2, (double)f1); - tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, (double)f, (double)f1); - tessellator.draw(); - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glColor4f(1.0F, 1.0F, 1.0F, timeInPortal); + IIcon iicon = BlocksAether.aether_portal.getBlockTextureFromSide(1); + Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + float f = iicon.getMinU(); + float f1 = iicon.getMinV(); + float f2 = iicon.getMaxU(); + float f3 = iicon.getMaxV(); + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(0.0D, (double) scaledRes.getScaledHeight(), -90.0D, (double) f, (double) f3); + tessellator.addVertexWithUV((double) scaledRes.getScaledWidth(), (double) scaledRes.getScaledHeight(), -90.0D, (double) f2, (double) f3); + tessellator.addVertexWithUV((double) scaledRes.getScaledWidth(), 0.0D, -90.0D, (double) f2, (double) f1); + tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, (double) f, (double) f1); + tessellator.draw(); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } - public static void renderBossHP(Minecraft mc) - { + public static void renderBossHP(Minecraft mc) { PlayerAether player = PlayerAether.get(mc.thePlayer); IAetherBoss boss = (IAetherBoss) player.getFocusedBoss(); - if (player.getFocusedBoss() != null) - { - if (player.getFocusedBoss().getBossHealth() <= 0.0F) - { + if (player.getFocusedBoss() != null) { + if (player.getFocusedBoss().getBossHealth() <= 0.0F) { player.setFocusedBoss(null); return; } @@ -275,50 +254,47 @@ public class AetherOverlay String bossTitle = boss.getBossName(); ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); - int healthRemaining = (int) (boss.getBossHealth() / boss.getMaxBossHealth() * 256F); + int healthRemaining = (int) (boss.getBossHealth() / boss.getMaxBossHealth() * 256F); int width = scaledresolution.getScaledWidth(); GL11.glPushMatrix(); - mc.fontRenderer.drawStringWithShadow(bossTitle, width / 2 - (mc.fontRenderer.getStringWidth(bossTitle) / 2), 2, 0xffffffff); + mc.fontRenderer.drawStringWithShadow(bossTitle, width / 2 - (mc.fontRenderer.getStringWidth(bossTitle) / 2), 2, 0xffffffff); - mc.renderEngine.bindTexture(Aether.locate("textures/gui/boss_bar.png")); + mc.renderEngine.bindTexture(Aether.locate("textures/gui/boss_bar.png")); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - drawTexturedModalRect(width / 2 - 128, 12, 0, 16, 256, 32); + drawTexturedModalRect(width / 2 - 128, 12, 0, 16, 256, 32); - drawTexturedModalRect(width/ 2 - 128, 12, 0, 0, healthRemaining, 16); + drawTexturedModalRect(width / 2 - 128, 12, 0, 0, healthRemaining, 16); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPopMatrix(); + GL11.glPopMatrix(); } } - public static void drawTexturedModalRect(float x, float y, float u, float v, float width, float height) - { + public static void drawTexturedModalRect(float x, float y, float u, float v, float width, float height) { float zLevel = -90.0F; float var7 = 0.00390625F; float var8 = 0.00390625F; Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV((double) (x + 0), (double) (y + height), (double) zLevel, (double) ((float) (u + 0) * var7), (double) ((float) (v + height) * var8)); - tessellator.addVertexWithUV((double) (x + width), (double) (y + height), (double) zLevel, (double) ((float) (u + width) * var7), (double) ((float) (v + height) * var8)); - tessellator.addVertexWithUV((double) (x + width), (double) (y + 0), (double) zLevel, (double) ((float) (u + width) * var7), (double) ((float) (v + 0) * var8)); - tessellator.addVertexWithUV((double) (x + 0), (double) (y + 0), (double) zLevel, (double) ((float) (u + 0) * var7), (double) ((float) (v + 0) * var8)); - tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV((double) (x + 0), (double) (y + height), (double) zLevel, (double) ((float) (u + 0) * var7), (double) ((float) (v + height) * var8)); + tessellator.addVertexWithUV((double) (x + width), (double) (y + height), (double) zLevel, (double) ((float) (u + width) * var7), (double) ((float) (v + height) * var8)); + tessellator.addVertexWithUV((double) (x + width), (double) (y + 0), (double) zLevel, (double) ((float) (u + width) * var7), (double) ((float) (v + 0) * var8)); + tessellator.addVertexWithUV((double) (x + 0), (double) (y + 0), (double) zLevel, (double) ((float) (u + 0) * var7), (double) ((float) (v + 0) * var8)); + tessellator.draw(); } - public static float getPoisonAlpha(float f) - { - return (f * f) / 5.0F + 0.4F; - } + public static float getPoisonAlpha(float f) { + return (f * f) / 5.0F + 0.4F; + } - public static float getCureAlpha(float f) - { - return (f * f) / 10.0F + 0.4F; - } + public static float getCureAlpha(float f) { + return (f * f) / 10.0F + 0.4F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/AetherEntityRenderer.java b/src/main/java/com/legacy/aether/client/renders/AetherEntityRenderer.java index 78d5a07..778d9e5 100644 --- a/src/main/java/com/legacy/aether/client/renders/AetherEntityRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/AetherEntityRenderer.java @@ -17,17 +17,15 @@ import com.legacy.aether.items.tools.ItemValkyrieTool; import cpw.mods.fml.common.ObfuscationReflectionHelper; -public class AetherEntityRenderer extends EntityRenderer -{ +public class AetherEntityRenderer extends EntityRenderer { - private Entity pointedEntity; + private Entity pointedEntity; private final Minecraft mc; private final EntityRenderer previous; - public AetherEntityRenderer(Minecraft mc, EntityRenderer previous, IResourceManager manager) - { + public AetherEntityRenderer(Minecraft mc, EntityRenderer previous, IResourceManager manager) { super(mc, manager); this.mc = mc; @@ -37,109 +35,87 @@ public class AetherEntityRenderer extends EntityRenderer } @Override - public void getMouseOver(float p_78473_1_) - { - if (this.mc.renderViewEntity != null) - { - if (this.mc.theWorld != null) - { - ItemStack stack = this.mc.thePlayer.getCurrentEquippedItem(); + public void getMouseOver(float p_78473_1_) { + if (this.mc.renderViewEntity != null) { + if (this.mc.theWorld != null) { + ItemStack stack = this.mc.thePlayer.getCurrentEquippedItem(); - if (stack == null || !(stack.getItem() instanceof ItemValkyrieTool)) - { - this.previous.getMouseOver(p_78473_1_); - return; - } + if (stack == null || !(stack.getItem() instanceof ItemValkyrieTool)) { + this.previous.getMouseOver(p_78473_1_); + return; + } - this.mc.pointedEntity = null; - double d0 = 10.0D; - this.mc.objectMouseOver = this.mc.renderViewEntity.rayTrace(d0, p_78473_1_); - double d1 = d0; - Vec3 vec3 = this.mc.renderViewEntity.getPosition(p_78473_1_); + this.mc.pointedEntity = null; + double d0 = 10.0D; + this.mc.objectMouseOver = this.mc.renderViewEntity.rayTrace(d0, p_78473_1_); + double d1 = d0; + Vec3 vec3 = this.mc.renderViewEntity.getPosition(p_78473_1_); - if (this.mc.playerController.extendedReach()) - { - d0 = 6.0D; - d1 = 6.0D; - } - else - { - if (d0 > 3.0D) - { - d1 = 3.0D; - } + if (this.mc.playerController.extendedReach()) { + d0 = 6.0D; + d1 = 6.0D; + } else { + if (d0 > 3.0D) { + d1 = 3.0D; + } - d0 = d1; - } + d0 = d1; + } - if (this.mc.objectMouseOver != null) - { - d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3); - } + if (this.mc.objectMouseOver != null) { + d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3); + } - Vec3 vec31 = this.mc.renderViewEntity.getLook(p_78473_1_); - Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0); - this.pointedEntity = null; - Vec3 vec33 = null; - float f1 = 1.0F; - List list = this.mc.theWorld.getEntitiesWithinAABBExcludingEntity(this.mc.renderViewEntity, this.mc.renderViewEntity.boundingBox.addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand((double)f1, (double)f1, (double)f1)); - double d2 = d1; + Vec3 vec31 = this.mc.renderViewEntity.getLook(p_78473_1_); + Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0); + this.pointedEntity = null; + Vec3 vec33 = null; + float f1 = 1.0F; + List list = this.mc.theWorld.getEntitiesWithinAABBExcludingEntity(this.mc.renderViewEntity, this.mc.renderViewEntity.boundingBox.addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand((double) f1, (double) f1, (double) f1)); + double d2 = d1; - for (int i = 0; i < list.size(); ++i) - { - Entity entity = (Entity)list.get(i); + for (int i = 0; i < list.size(); ++i) { + Entity entity = (Entity) list.get(i); - if (entity.canBeCollidedWith()) - { - float f2 = entity.getCollisionBorderSize(); - AxisAlignedBB axisalignedbb = entity.boundingBox.expand((double)f2, (double)f2, (double)f2); - MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32); + if (entity.canBeCollidedWith()) { + float f2 = entity.getCollisionBorderSize(); + AxisAlignedBB axisalignedbb = entity.boundingBox.expand((double) f2, (double) f2, (double) f2); + MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32); - if (axisalignedbb.isVecInside(vec3)) - { - if (0.0D < d2 || d2 == 0.0D) - { - this.pointedEntity = entity; - vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec; - d2 = 0.0D; - } - } - else if (movingobjectposition != null) - { - double d3 = vec3.distanceTo(movingobjectposition.hitVec); + if (axisalignedbb.isVecInside(vec3)) { + if (0.0D < d2 || d2 == 0.0D) { + this.pointedEntity = entity; + vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec; + d2 = 0.0D; + } + } else if (movingobjectposition != null) { + double d3 = vec3.distanceTo(movingobjectposition.hitVec); - if (d3 < d2 || d2 == 0.0D) - { - if (entity == this.mc.renderViewEntity.ridingEntity && !entity.canRiderInteract()) - { - if (d2 == 0.0D) - { - this.pointedEntity = entity; - vec33 = movingobjectposition.hitVec; - } - } - else - { - this.pointedEntity = entity; - vec33 = movingobjectposition.hitVec; - d2 = d3; - } - } - } - } - } + if (d3 < d2 || d2 == 0.0D) { + if (entity == this.mc.renderViewEntity.ridingEntity && !entity.canRiderInteract()) { + if (d2 == 0.0D) { + this.pointedEntity = entity; + vec33 = movingobjectposition.hitVec; + } + } else { + this.pointedEntity = entity; + vec33 = movingobjectposition.hitVec; + d2 = d3; + } + } + } + } + } - if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null)) - { - this.mc.objectMouseOver = new MovingObjectPosition(this.pointedEntity, vec33); + if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null)) { + this.mc.objectMouseOver = new MovingObjectPosition(this.pointedEntity, vec33); - if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame) - { - this.mc.pointedEntity = this.pointedEntity; - } - } - } - } - } + if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame) { + this.mc.pointedEntity = this.pointedEntity; + } + } + } + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/AetherItemRenderer.java b/src/main/java/com/legacy/aether/client/renders/AetherItemRenderer.java index 735f3a8..55ddf73 100644 --- a/src/main/java/com/legacy/aether/client/renders/AetherItemRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/AetherItemRenderer.java @@ -2,6 +2,7 @@ package com.legacy.aether.client.renders; import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON; import static net.minecraftforge.client.IItemRenderer.ItemRenderType.FIRST_PERSON_MAP; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.entity.EntityPlayerSP; @@ -30,53 +31,48 @@ import com.legacy.aether.items.ItemsAether; import com.legacy.aether.items.accessories.ItemAccessory; import com.legacy.aether.player.PlayerAether; -public class AetherItemRenderer extends ItemRenderer -{ +public class AetherItemRenderer extends ItemRenderer { - private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png"); + private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png"); - private Minecraft mc; + private Minecraft mc; - private ItemStack itemToRender; + private ItemStack itemToRender; - private float equippedProgress; + private float equippedProgress; - private float prevEquippedProgress; + private float prevEquippedProgress; - private int equippedItemSlot = -1; + private int equippedItemSlot = -1; - public AetherItemRenderer(Minecraft mcIn) - { + public AetherItemRenderer(Minecraft mcIn) { super(mcIn); this.mc = mcIn; } - public void renderFirstPersonArm(RenderPlayer renderPlayer, EntityClientPlayerMP playerIn) - { + public void renderFirstPersonArm(RenderPlayer renderPlayer, EntityClientPlayerMP playerIn) { PlayerAether playerAether = PlayerAether.get(playerIn); ItemStack gloves = playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.GLOVES); - this.mc.getTextureManager().bindTexture(playerIn.getLocationSkin()); + this.mc.getTextureManager().bindTexture(playerIn.getLocationSkin()); - if (gloves == null) - { + if (gloves == null) { renderPlayer.renderFirstPersonArm(playerIn); return; } - renderPlayer.renderFirstPersonArm(playerIn); + renderPlayer.renderFirstPersonArm(playerIn); - this.mc.getTextureManager().bindTexture(((ItemAccessory)gloves.getItem()).texture); + this.mc.getTextureManager().bindTexture(((ItemAccessory) gloves.getItem()).texture); int colour = gloves.getItem().getColorFromItemStack(gloves, 0); float red = ((colour >> 16) & 0xff) / 255F; float green = ((colour >> 8) & 0xff) / 255F; float blue = (colour & 0xff) / 255F; - if (gloves.getItem() != ItemsAether.phoenix_gloves) - { + if (gloves.getItem() != ItemsAether.phoenix_gloves) { GL11.glColor3f(red, green, blue); } @@ -86,361 +82,320 @@ public class AetherItemRenderer extends ItemRenderer renderPlayer.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, playerIn); renderPlayer.modelBipedMain.bipedRightArm.render(0.0625F); - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor3f(1.0F, 1.0F, 1.0F); - } + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor3f(1.0F, 1.0F, 1.0F); + } @Override - public void renderItemInFirstPerson(float partialTicks) - { - float f1 = this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks; - EntityClientPlayerMP entityclientplayermp = this.mc.thePlayer; - float f2 = entityclientplayermp.prevRotationPitch + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialTicks; - GL11.glPushMatrix(); - GL11.glRotatef(f2, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(entityclientplayermp.prevRotationYaw + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * partialTicks, 0.0F, 1.0F, 0.0F); - RenderHelper.enableStandardItemLighting(); - GL11.glPopMatrix(); - EntityPlayerSP entityplayersp = (EntityPlayerSP)entityclientplayermp; - float f3 = entityplayersp.prevRenderArmPitch + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialTicks; - float f4 = entityplayersp.prevRenderArmYaw + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialTicks; - GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F); - ItemStack itemstack = this.itemToRender; + public void renderItemInFirstPerson(float partialTicks) { + float f1 = this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks; + EntityClientPlayerMP entityclientplayermp = this.mc.thePlayer; + float f2 = entityclientplayermp.prevRotationPitch + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialTicks; + GL11.glPushMatrix(); + GL11.glRotatef(f2, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(entityclientplayermp.prevRotationYaw + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * partialTicks, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + EntityPlayerSP entityplayersp = (EntityPlayerSP) entityclientplayermp; + float f3 = entityplayersp.prevRenderArmPitch + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialTicks; + float f4 = entityplayersp.prevRenderArmYaw + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialTicks; + GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F); + ItemStack itemstack = this.itemToRender; - if (itemstack != null && itemstack.getItem() instanceof ItemCloth) - { - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - } + if (itemstack != null && itemstack.getItem() instanceof ItemCloth) { + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + } - int i = this.mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(entityclientplayermp.posX), MathHelper.floor_double(entityclientplayermp.posY), MathHelper.floor_double(entityclientplayermp.posZ), 0); - int j = i % 65536; - int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - float f5; - float f6; - float f7; + int i = this.mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(entityclientplayermp.posX), MathHelper.floor_double(entityclientplayermp.posY), MathHelper.floor_double(entityclientplayermp.posZ), 0); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float f5; + float f6; + float f7; - if (itemstack != null) - { - int l = itemstack.getItem().getColorFromItemStack(itemstack, 0); - f5 = (float)(l >> 16 & 255) / 255.0F; - f6 = (float)(l >> 8 & 255) / 255.0F; - f7 = (float)(l & 255) / 255.0F; - GL11.glColor4f(f5, f6, f7, 1.0F); - } - else - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } + if (itemstack != null) { + int l = itemstack.getItem().getColorFromItemStack(itemstack, 0); + f5 = (float) (l >> 16 & 255) / 255.0F; + f6 = (float) (l >> 8 & 255) / 255.0F; + f7 = (float) (l & 255) / 255.0F; + GL11.glColor4f(f5, f6, f7, 1.0F); + } else { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } - float f8; - float f9; - float f10; - float f13; - Render render; - RenderPlayer renderplayer; + float f8; + float f9; + float f10; + float f13; + Render render; + RenderPlayer renderplayer; - if (itemstack != null && itemstack.getItem() instanceof ItemMap) - { - GL11.glPushMatrix(); - f13 = 0.8F; - f5 = entityclientplayermp.getSwingProgress(partialTicks); - f6 = MathHelper.sin(f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); - GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.2F, -f6 * 0.2F); - f5 = 1.0F - f2 / 45.0F + 0.1F; + if (itemstack != null && itemstack.getItem() instanceof ItemMap) { + GL11.glPushMatrix(); + f13 = 0.8F; + f5 = entityclientplayermp.getSwingProgress(partialTicks); + f6 = MathHelper.sin(f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); + GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.2F, -f6 * 0.2F); + f5 = 1.0F - f2 / 45.0F + 0.1F; - if (f5 < 0.0F) - { - f5 = 0.0F; - } + if (f5 < 0.0F) { + f5 = 0.0F; + } - if (f5 > 1.0F) - { - f5 = 1.0F; - } + if (f5 > 1.0F) { + f5 = 1.0F; + } - f5 = -MathHelper.cos(f5 * (float)Math.PI) * 0.5F + 0.5F; - GL11.glTranslatef(0.0F, 0.0F * f13 - (1.0F - f1) * 1.2F - f5 * 0.5F + 0.04F, -0.9F * f13); - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(f5 * -85.0F, 0.0F, 0.0F, 1.0F); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - this.mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin()); + f5 = -MathHelper.cos(f5 * (float) Math.PI) * 0.5F + 0.5F; + GL11.glTranslatef(0.0F, 0.0F * f13 - (1.0F - f1) * 1.2F - f5 * 0.5F + 0.04F, -0.9F * f13); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(f5 * -85.0F, 0.0F, 0.0F, 1.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + this.mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin()); - for (int i1 = 0; i1 < 2; ++i1) - { - int j1 = i1 * 2 - 1; - GL11.glPushMatrix(); - GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float)j1); - GL11.glRotatef((float)(-45 * j1), 1.0F, 0.0F, 0.0F); - GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef((float)(-65 * j1), 0.0F, 1.0F, 0.0F); - render = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer); - renderplayer = (RenderPlayer)render; - f10 = 1.0F; - GL11.glScalef(f10, f10, f10); - this.renderFirstPersonArm(renderplayer, this.mc.thePlayer); - GL11.glPopMatrix(); - } + for (int i1 = 0; i1 < 2; ++i1) { + int j1 = i1 * 2 - 1; + GL11.glPushMatrix(); + GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float) j1); + GL11.glRotatef((float) (-45 * j1), 1.0F, 0.0F, 0.0F); + GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef((float) (-65 * j1), 0.0F, 1.0F, 0.0F); + render = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer); + renderplayer = (RenderPlayer) render; + f10 = 1.0F; + GL11.glScalef(f10, f10, f10); + this.renderFirstPersonArm(renderplayer, this.mc.thePlayer); + GL11.glPopMatrix(); + } - f6 = entityclientplayermp.getSwingProgress(partialTicks); - f7 = MathHelper.sin(f6 * f6 * (float)Math.PI); - f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI); - GL11.glRotatef(-f7 * 20.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F); - f9 = 0.38F; - GL11.glScalef(f9, f9, f9); - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-1.0F, -1.0F, 0.0F); - f10 = 0.015625F; - GL11.glScalef(f10, f10, f10); - this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND); - Tessellator tessellator = Tessellator.instance; - GL11.glNormal3f(0.0F, 0.0F, -1.0F); - tessellator.startDrawingQuads(); - byte b0 = 7; - tessellator.addVertexWithUV((double)(0 - b0), (double)(128 + b0), 0.0D, 0.0D, 1.0D); - tessellator.addVertexWithUV((double)(128 + b0), (double)(128 + b0), 0.0D, 1.0D, 1.0D); - tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D); - tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D); - tessellator.draw(); + f6 = entityclientplayermp.getSwingProgress(partialTicks); + f7 = MathHelper.sin(f6 * f6 * (float) Math.PI); + f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float) Math.PI); + GL11.glRotatef(-f7 * 20.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F); + f9 = 0.38F; + GL11.glScalef(f9, f9, f9); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-1.0F, -1.0F, 0.0F); + f10 = 0.015625F; + GL11.glScalef(f10, f10, f10); + this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND); + Tessellator tessellator = Tessellator.instance; + GL11.glNormal3f(0.0F, 0.0F, -1.0F); + tessellator.startDrawingQuads(); + byte b0 = 7; + tessellator.addVertexWithUV((double) (0 - b0), (double) (128 + b0), 0.0D, 0.0D, 1.0D); + tessellator.addVertexWithUV((double) (128 + b0), (double) (128 + b0), 0.0D, 1.0D, 1.0D); + tessellator.addVertexWithUV((double) (128 + b0), (double) (0 - b0), 0.0D, 1.0D, 0.0D); + tessellator.addVertexWithUV((double) (0 - b0), (double) (0 - b0), 0.0D, 0.0D, 0.0D); + tessellator.draw(); - IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP); - MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, this.mc.theWorld); + IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP); + MapData mapdata = ((ItemMap) itemstack.getItem()).getMapData(itemstack, this.mc.theWorld); - if (custom == null) - { - if (mapdata != null) - { - this.mc.entityRenderer.getMapItemRenderer().func_148250_a(mapdata, false); - } - } - else - { - custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.getTextureManager(), mapdata); - } + if (custom == null) { + if (mapdata != null) { + this.mc.entityRenderer.getMapItemRenderer().func_148250_a(mapdata, false); + } + } else { + custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.getTextureManager(), mapdata); + } - GL11.glPopMatrix(); - } - else if (itemstack != null) - { - GL11.glPushMatrix(); - f13 = 0.8F; + GL11.glPopMatrix(); + } else if (itemstack != null) { + GL11.glPushMatrix(); + f13 = 0.8F; - if (entityclientplayermp.getItemInUseCount() > 0) - { - EnumAction enumaction = itemstack.getItemUseAction(); + if (entityclientplayermp.getItemInUseCount() > 0) { + EnumAction enumaction = itemstack.getItemUseAction(); - if (enumaction == EnumAction.eat || enumaction == EnumAction.drink) - { - f6 = (float)entityclientplayermp.getItemInUseCount() - partialTicks + 1.0F; - f7 = 1.0F - f6 / (float)itemstack.getMaxItemUseDuration(); - f8 = 1.0F - f7; - f8 = f8 * f8 * f8; - f8 = f8 * f8 * f8; - f8 = f8 * f8 * f8; - f9 = 1.0F - f8; - GL11.glTranslatef(0.0F, MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float)Math.PI) * 0.1F) * (float)((double)f7 > 0.2D ? 1 : 0), 0.0F); - GL11.glTranslatef(f9 * 0.6F, -f9 * 0.5F, 0.0F); - GL11.glRotatef(f9 * 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F); - } - } - else - { - f5 = entityclientplayermp.getSwingProgress(partialTicks); - f6 = MathHelper.sin(f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); - GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.2F, -f6 * 0.2F); - } + if (enumaction == EnumAction.eat || enumaction == EnumAction.drink) { + f6 = (float) entityclientplayermp.getItemInUseCount() - partialTicks + 1.0F; + f7 = 1.0F - f6 / (float) itemstack.getMaxItemUseDuration(); + f8 = 1.0F - f7; + f8 = f8 * f8 * f8; + f8 = f8 * f8 * f8; + f8 = f8 * f8 * f8; + f9 = 1.0F - f8; + GL11.glTranslatef(0.0F, MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float) Math.PI) * 0.1F) * (float) ((double) f7 > 0.2D ? 1 : 0), 0.0F); + GL11.glTranslatef(f9 * 0.6F, -f9 * 0.5F, 0.0F); + GL11.glRotatef(f9 * 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F); + } + } else { + f5 = entityclientplayermp.getSwingProgress(partialTicks); + f6 = MathHelper.sin(f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); + GL11.glTranslatef(-f7 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.2F, -f6 * 0.2F); + } - GL11.glTranslatef(0.7F * f13, -0.65F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13); - GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - f5 = entityclientplayermp.getSwingProgress(partialTicks); - f6 = MathHelper.sin(f5 * f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); - GL11.glRotatef(-f6 * 20.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-f7 * 20.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-f7 * 80.0F, 1.0F, 0.0F, 0.0F); - f8 = 0.4F; - GL11.glScalef(f8, f8, f8); - float f11; - float f12; + GL11.glTranslatef(0.7F * f13, -0.65F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + f5 = entityclientplayermp.getSwingProgress(partialTicks); + f6 = MathHelper.sin(f5 * f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); + GL11.glRotatef(-f6 * 20.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-f7 * 20.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-f7 * 80.0F, 1.0F, 0.0F, 0.0F); + f8 = 0.4F; + GL11.glScalef(f8, f8, f8); + float f11; + float f12; - if (entityclientplayermp.getItemInUseCount() > 0) - { - EnumAction enumaction1 = itemstack.getItemUseAction(); + if (entityclientplayermp.getItemInUseCount() > 0) { + EnumAction enumaction1 = itemstack.getItemUseAction(); - if (enumaction1 == EnumAction.block) - { - GL11.glTranslatef(-0.5F, 0.2F, 0.0F); - GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); - } - else if (enumaction1 == EnumAction.bow) - { - GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F); - GL11.glTranslatef(-0.9F, 0.2F, 0.0F); - f10 = (float)itemstack.getMaxItemUseDuration() - ((float)entityclientplayermp.getItemInUseCount() - partialTicks + 1.0F); - f11 = f10 / 20.0F; - f11 = (f11 * f11 + f11 * 2.0F) / 3.0F; + if (enumaction1 == EnumAction.block) { + GL11.glTranslatef(-0.5F, 0.2F, 0.0F); + GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); + } else if (enumaction1 == EnumAction.bow) { + GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F); + GL11.glTranslatef(-0.9F, 0.2F, 0.0F); + f10 = (float) itemstack.getMaxItemUseDuration() - ((float) entityclientplayermp.getItemInUseCount() - partialTicks + 1.0F); + f11 = f10 / 20.0F; + f11 = (f11 * f11 + f11 * 2.0F) / 3.0F; - if (f11 > 1.0F) - { - f11 = 1.0F; - } + if (f11 > 1.0F) { + f11 = 1.0F; + } - if (f11 > 0.1F) - { - GL11.glTranslatef(0.0F, MathHelper.sin((f10 - 0.1F) * 1.3F) * 0.01F * (f11 - 0.1F), 0.0F); - } + if (f11 > 0.1F) { + GL11.glTranslatef(0.0F, MathHelper.sin((f10 - 0.1F) * 1.3F) * 0.01F * (f11 - 0.1F), 0.0F); + } - GL11.glTranslatef(0.0F, 0.0F, f11 * 0.1F); - GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(0.0F, 0.5F, 0.0F); - f12 = 1.0F + f11 * 0.2F; - GL11.glScalef(1.0F, 1.0F, f12); - GL11.glTranslatef(0.0F, -0.5F, 0.0F); - GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); - } - } + GL11.glTranslatef(0.0F, 0.0F, f11 * 0.1F); + GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, 0.5F, 0.0F); + f12 = 1.0F + f11 * 0.2F; + GL11.glScalef(1.0F, 1.0F, f12); + GL11.glTranslatef(0.0F, -0.5F, 0.0F); + GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); + } + } - if (itemstack.getItem().shouldRotateAroundWhenRendering()) - { - GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); - } + if (itemstack.getItem().shouldRotateAroundWhenRendering()) { + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + } - if (itemstack.getItem().requiresMultipleRenderPasses()) - { - this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); - for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) - { - int k1 = itemstack.getItem().getColorFromItemStack(itemstack, x); - f10 = (float)(k1 >> 16 & 255) / 255.0F; - f11 = (float)(k1 >> 8 & 255) / 255.0F; - f12 = (float)(k1 & 255) / 255.0F; - GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F); - this.renderItem(entityclientplayermp, itemstack, x, EQUIPPED_FIRST_PERSON); - } - } - else - { - this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); - } + if (itemstack.getItem().requiresMultipleRenderPasses()) { + this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); + for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) { + int k1 = itemstack.getItem().getColorFromItemStack(itemstack, x); + f10 = (float) (k1 >> 16 & 255) / 255.0F; + f11 = (float) (k1 >> 8 & 255) / 255.0F; + f12 = (float) (k1 & 255) / 255.0F; + GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F); + this.renderItem(entityclientplayermp, itemstack, x, EQUIPPED_FIRST_PERSON); + } + } else { + this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON); + } - GL11.glPopMatrix(); - } - else if (!entityclientplayermp.isInvisible()) - { - GL11.glPushMatrix(); - f13 = 0.8F; - f5 = entityclientplayermp.getSwingProgress(partialTicks); - f6 = MathHelper.sin(f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); - GL11.glTranslatef(-f7 * 0.3F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI * 2.0F) * 0.4F, -f6 * 0.4F); - GL11.glTranslatef(0.8F * f13, -0.75F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13); - GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - f5 = entityclientplayermp.getSwingProgress(partialTicks); - f6 = MathHelper.sin(f5 * f5 * (float)Math.PI); - f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float)Math.PI); - GL11.glRotatef(f7 * 70.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-f6 * 20.0F, 0.0F, 0.0F, 1.0F); - this.mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin()); - GL11.glTranslatef(-1.0F, 3.6F, 3.5F); - GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef(5.6F, 0.0F, 0.0F); - render = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer); - renderplayer = (RenderPlayer)render; - f10 = 1.0F; - GL11.glScalef(f10, f10, f10); - this.renderFirstPersonArm(renderplayer, this.mc.thePlayer); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } else if (!entityclientplayermp.isInvisible()) { + GL11.glPushMatrix(); + f13 = 0.8F; + f5 = entityclientplayermp.getSwingProgress(partialTicks); + f6 = MathHelper.sin(f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); + GL11.glTranslatef(-f7 * 0.3F, MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.4F, -f6 * 0.4F); + GL11.glTranslatef(0.8F * f13, -0.75F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + f5 = entityclientplayermp.getSwingProgress(partialTicks); + f6 = MathHelper.sin(f5 * f5 * (float) Math.PI); + f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI); + GL11.glRotatef(f7 * 70.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-f6 * 20.0F, 0.0F, 0.0F, 1.0F); + this.mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin()); + GL11.glTranslatef(-1.0F, 3.6F, 3.5F); + GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glTranslatef(5.6F, 0.0F, 0.0F); + render = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer); + renderplayer = (RenderPlayer) render; + f10 = 1.0F; + GL11.glScalef(f10, f10, f10); + this.renderFirstPersonArm(renderplayer, this.mc.thePlayer); + GL11.glPopMatrix(); + } - if (itemstack != null && itemstack.getItem() instanceof ItemCloth) - { - GL11.glDisable(GL11.GL_BLEND); - } + if (itemstack != null && itemstack.getItem() instanceof ItemCloth) { + GL11.glDisable(GL11.GL_BLEND); + } - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - RenderHelper.disableStandardItemLighting(); - } + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + } - @Override - public void updateEquippedItem() - { - super.updateEquippedItem(); + @Override + public void updateEquippedItem() { + super.updateEquippedItem(); - this.prevEquippedProgress = this.equippedProgress; - EntityClientPlayerMP entityclientplayermp = this.mc.thePlayer; - ItemStack itemstack = entityclientplayermp.inventory.getCurrentItem(); - boolean flag = this.equippedItemSlot == entityclientplayermp.inventory.currentItem && itemstack == this.itemToRender; + this.prevEquippedProgress = this.equippedProgress; + EntityClientPlayerMP entityclientplayermp = this.mc.thePlayer; + ItemStack itemstack = entityclientplayermp.inventory.getCurrentItem(); + boolean flag = this.equippedItemSlot == entityclientplayermp.inventory.currentItem && itemstack == this.itemToRender; - if (this.itemToRender == null && itemstack == null) - { - flag = true; - } + if (this.itemToRender == null && itemstack == null) { + flag = true; + } - if (itemstack != null && this.itemToRender != null && itemstack != this.itemToRender && itemstack.getItem() == this.itemToRender.getItem() && itemstack.getItemDamage() == this.itemToRender.getItemDamage()) - { - this.itemToRender = itemstack; - flag = true; - } + if (itemstack != null && this.itemToRender != null && itemstack != this.itemToRender && itemstack.getItem() == this.itemToRender.getItem() && itemstack.getItemDamage() == this.itemToRender.getItemDamage()) { + this.itemToRender = itemstack; + flag = true; + } - float f = 0.4F; - float f1 = flag ? 1.0F : 0.0F; - float f2 = f1 - this.equippedProgress; + float f = 0.4F; + float f1 = flag ? 1.0F : 0.0F; + float f2 = f1 - this.equippedProgress; - if (f2 < -f) - { - f2 = -f; - } + if (f2 < -f) { + f2 = -f; + } - if (f2 > f) - { - f2 = f; - } + if (f2 > f) { + f2 = f; + } - this.equippedProgress += f2; + this.equippedProgress += f2; - if (this.equippedProgress < 0.1F) - { - this.itemToRender = itemstack; - this.equippedItemSlot = entityclientplayermp.inventory.currentItem; - } - } + if (this.equippedProgress < 0.1F) { + this.itemToRender = itemstack; + this.equippedItemSlot = entityclientplayermp.inventory.currentItem; + } + } - @Override - public void resetEquippedProgress() - { - super.resetEquippedProgress(); + @Override + public void resetEquippedProgress() { + super.resetEquippedProgress(); - this.equippedProgress = 0.0F; - } + this.equippedProgress = 0.0F; + } - @Override - public void resetEquippedProgress2() - { - super.resetEquippedProgress2(); + @Override + public void resetEquippedProgress2() { + super.resetEquippedProgress2(); - this.equippedProgress = 0.0F; - } + this.equippedProgress = 0.0F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/RendersAether.java b/src/main/java/com/legacy/aether/client/renders/RendersAether.java index 2329956..7b9746e 100644 --- a/src/main/java/com/legacy/aether/client/renders/RendersAether.java +++ b/src/main/java/com/legacy/aether/client/renders/RendersAether.java @@ -70,11 +70,9 @@ import com.legacy.aether.tileentity.TileEntityTreasureChest; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; -public class RendersAether -{ +public class RendersAether { - public static void initialization() - { + public static void initialization() { /* Misc */ register(EntityHammerProjectile.class, new HammerProjectileRenderer()); register(EntityFloatingBlock.class, new FloatingBlockRenderer()); @@ -122,8 +120,7 @@ public class RendersAether ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTreasureChest.class, new TreasureChestRenderer()); } - public static void register(Class entityClass, Render render) - { + public static void register(Class entityClass, Render render) { RenderingRegistry.registerEntityRenderingHandler(entityClass, render); } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/TreasureChestRenderer.java b/src/main/java/com/legacy/aether/client/renders/TreasureChestRenderer.java index 3844c92..78cd7c2 100644 --- a/src/main/java/com/legacy/aether/client/renders/TreasureChestRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/TreasureChestRenderer.java @@ -15,8 +15,7 @@ import com.legacy.aether.Aether; import com.legacy.aether.blocks.dungeon.BlockTreasureChest; import com.legacy.aether.tileentity.TileEntityTreasureChest; -public class TreasureChestRenderer extends TileEntitySpecialRenderer -{ +public class TreasureChestRenderer extends TileEntitySpecialRenderer { private static final ResourceLocation TEXTURE_DOUBLE = Aether.locate("textures/tile_entities/treasure_chest_large.png"); @@ -27,45 +26,35 @@ public class TreasureChestRenderer extends TileEntitySpecialRenderer private final ModelChest largeChestModel = new ModelLargeChest(); @Override - public void renderTileEntityAt(TileEntity par1TileEntityChest, double posX, double posY, double posZ, float partialTicks) - { + public void renderTileEntityAt(TileEntity par1TileEntityChest, double posX, double posY, double posZ, float partialTicks) { int var9; - if (par1TileEntityChest == null) - { + if (par1TileEntityChest == null) { TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityTreasureChest(), 0.0, 0.0, 0.0, 0.0F); - return; + return; } - if (!par1TileEntityChest.hasWorldObj()) - { + if (!par1TileEntityChest.hasWorldObj()) { var9 = 0; - } - else - { + } else { Block var10 = par1TileEntityChest.getBlockType(); var9 = par1TileEntityChest.getBlockMetadata(); - if (var10 != null && var10 instanceof BlockTreasureChest) - { + if (var10 != null && var10 instanceof BlockTreasureChest) { ((BlockTreasureChest) var10).func_149954_e(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord); var9 = par1TileEntityChest.getBlockMetadata(); } - ((TileEntityTreasureChest)par1TileEntityChest).checkForAdjacentChests(); + ((TileEntityTreasureChest) par1TileEntityChest).checkForAdjacentChests(); } - if (((TileEntityTreasureChest)par1TileEntityChest).adjacentChestZNeg == null && ((TileEntityTreasureChest)par1TileEntityChest).adjacentChestXNeg == null) - { + if (((TileEntityTreasureChest) par1TileEntityChest).adjacentChestZNeg == null && ((TileEntityTreasureChest) par1TileEntityChest).adjacentChestXNeg == null) { ModelChest var14; - if (((TileEntityTreasureChest)par1TileEntityChest).adjacentChestXPos == null && ((TileEntityTreasureChest)par1TileEntityChest).adjacentChestZPos == null) - { + if (((TileEntityTreasureChest) par1TileEntityChest).adjacentChestXPos == null && ((TileEntityTreasureChest) par1TileEntityChest).adjacentChestZPos == null) { var14 = this.chestModel; this.bindTexture(TEXTURE_SINGLE); - } - else - { + } else { var14 = this.largeChestModel; this.bindTexture(TEXTURE_DOUBLE); } @@ -77,57 +66,47 @@ public class TreasureChestRenderer extends TileEntitySpecialRenderer GL11.glTranslatef(0.5F, 0.5F, 0.5F); short var11 = 0; - if (var9 == 2) - { + if (var9 == 2) { var11 = 180; } - if (var9 == 3) - { + if (var9 == 3) { var11 = 0; } - if (var9 == 4) - { + if (var9 == 4) { var11 = 90; } - if (var9 == 5) - { + if (var9 == 5) { var11 = -90; } - if (var9 == 2 && ((TileEntityTreasureChest)par1TileEntityChest).adjacentChestXPos != null) - { + if (var9 == 2 && ((TileEntityTreasureChest) par1TileEntityChest).adjacentChestXPos != null) { GL11.glTranslatef(1.0F, 0.0F, 0.0F); } - if (var9 == 5 && ((TileEntityTreasureChest)par1TileEntityChest).adjacentChestZPos != null) - { + if (var9 == 5 && ((TileEntityTreasureChest) par1TileEntityChest).adjacentChestZPos != null) { GL11.glTranslatef(0.0F, 0.0F, -1.0F); } GL11.glRotatef(var11, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - float var12 = ((TileEntityTreasureChest)par1TileEntityChest).prevLidAngle + (((TileEntityTreasureChest)par1TileEntityChest).lidAngle - ((TileEntityTreasureChest)par1TileEntityChest).prevLidAngle) * partialTicks; + float var12 = ((TileEntityTreasureChest) par1TileEntityChest).prevLidAngle + (((TileEntityTreasureChest) par1TileEntityChest).lidAngle - ((TileEntityTreasureChest) par1TileEntityChest).prevLidAngle) * partialTicks; float var13; - if (((TileEntityTreasureChest)par1TileEntityChest).adjacentChestZNeg != null) - { - var13 = ((TileEntityTreasureChest)par1TileEntityChest).adjacentChestZNeg.prevLidAngle + (((TileEntityTreasureChest)par1TileEntityChest).adjacentChestZNeg.lidAngle - ((TileEntityTreasureChest)par1TileEntityChest).adjacentChestZNeg.prevLidAngle) * partialTicks; + if (((TileEntityTreasureChest) par1TileEntityChest).adjacentChestZNeg != null) { + var13 = ((TileEntityTreasureChest) par1TileEntityChest).adjacentChestZNeg.prevLidAngle + (((TileEntityTreasureChest) par1TileEntityChest).adjacentChestZNeg.lidAngle - ((TileEntityTreasureChest) par1TileEntityChest).adjacentChestZNeg.prevLidAngle) * partialTicks; - if (var13 > var12) - { + if (var13 > var12) { var12 = var13; } } - if (((TileEntityTreasureChest)par1TileEntityChest).adjacentChestXNeg != null) - { - var13 = ((TileEntityTreasureChest)par1TileEntityChest).adjacentChestXNeg.prevLidAngle + (((TileEntityTreasureChest)par1TileEntityChest).adjacentChestXNeg.lidAngle - ((TileEntityTreasureChest)par1TileEntityChest).adjacentChestXNeg.prevLidAngle) * partialTicks; + if (((TileEntityTreasureChest) par1TileEntityChest).adjacentChestXNeg != null) { + var13 = ((TileEntityTreasureChest) par1TileEntityChest).adjacentChestXNeg.prevLidAngle + (((TileEntityTreasureChest) par1TileEntityChest).adjacentChestXNeg.lidAngle - ((TileEntityTreasureChest) par1TileEntityChest).adjacentChestXNeg.prevLidAngle) * partialTicks; - if (var13 > var12) - { + if (var13 > var12) { var12 = var13; } } diff --git a/src/main/java/com/legacy/aether/client/renders/block/AetherFlowerRenderer.java b/src/main/java/com/legacy/aether/client/renders/block/AetherFlowerRenderer.java index f9f833d..9fe297b 100644 --- a/src/main/java/com/legacy/aether/client/renders/block/AetherFlowerRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/block/AetherFlowerRenderer.java @@ -12,70 +12,63 @@ import com.legacy.aether.blocks.natural.BlockAetherFlower; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -public class AetherFlowerRenderer implements ISimpleBlockRenderingHandler -{ +public class AetherFlowerRenderer implements ISimpleBlockRenderingHandler { @Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) - { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, -1.0F, 0.0F); - IIcon iicon = renderer.getBlockIconFromSideAndMetadata(block, 0, metadata); - renderer.drawCrossedSquares(iicon, -0.5D, -0.5D, -0.5D, 1.0F); - tessellator.draw(); + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1.0F, 0.0F); + IIcon iicon = renderer.getBlockIconFromSideAndMetadata(block, 0, metadata); + renderer.drawCrossedSquares(iicon, -0.5D, -0.5D, -0.5D, 1.0F); + tessellator.draw(); } @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { - Tessellator tessellator = Tessellator.instance; - tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); - int l = block.colorMultiplier(world, x, y, z); - float f = (float)(l >> 16 & 255) / 255.0F; - float f1 = (float)(l >> 8 & 255) / 255.0F; - float f2 = (float)(l & 255) / 255.0F; + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + Tessellator tessellator = Tessellator.instance; + tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); + int l = block.colorMultiplier(world, x, y, z); + float f = (float) (l >> 16 & 255) / 255.0F; + float f1 = (float) (l >> 8 & 255) / 255.0F; + float f2 = (float) (l & 255) / 255.0F; - if (EntityRenderer.anaglyphEnable) - { - float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; - float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; - float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; - f = f3; - f1 = f4; - f2 = f5; - } + if (EntityRenderer.anaglyphEnable) { + float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; + float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; + float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; + f = f3; + f1 = f4; + f2 = f5; + } - tessellator.setColorOpaque_F(f, f1, f2); - double d1 = (double)x; - double d2 = (double)y; - double d0 = (double)z; - long i1; + tessellator.setColorOpaque_F(f, f1, f2); + double d1 = (double) x; + double d2 = (double) y; + double d0 = (double) z; + long i1; - if (block instanceof BlockAetherFlower) - { - i1 = (long)(x * 3129871) ^ (long)z * 116129781L ^ (long)y; - i1 = i1 * i1 * 42317861L + i1 * 11L; - d1 += ((double)((float)(i1 >> 16 & 15L) / 15.0F) - 0.5D) * 0.3D; - d0 += ((double)((float)(i1 >> 24 & 15L) / 15.0F) - 0.5D) * 0.3D; - } + if (block instanceof BlockAetherFlower) { + i1 = (long) (x * 3129871) ^ (long) z * 116129781L ^ (long) y; + i1 = i1 * i1 * 42317861L + i1 * 11L; + d1 += ((double) ((float) (i1 >> 16 & 15L) / 15.0F) - 0.5D) * 0.3D; + d0 += ((double) ((float) (i1 >> 24 & 15L) / 15.0F) - 0.5D) * 0.3D; + } - IIcon iicon = renderer.getBlockIconFromSideAndMetadata(block, 0, world.getBlockMetadata(x, y, z)); + IIcon iicon = renderer.getBlockIconFromSideAndMetadata(block, 0, world.getBlockMetadata(x, y, z)); - renderer.drawCrossedSquares(iicon, d1, d2, d0, 1.0F); + renderer.drawCrossedSquares(iicon, d1, d2, d0, 1.0F); return true; } @Override - public boolean shouldRender3DInInventory(int modelId) - { + public boolean shouldRender3DInInventory(int modelId) { return false; } @Override - public int getRenderId() - { + public int getRenderId() { return CommonProxy.aetherFlowerRenderID; } diff --git a/src/main/java/com/legacy/aether/client/renders/block/BerryBushRenderer.java b/src/main/java/com/legacy/aether/client/renders/block/BerryBushRenderer.java index dcfb13a..ac3b300 100644 --- a/src/main/java/com/legacy/aether/client/renders/block/BerryBushRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/block/BerryBushRenderer.java @@ -12,58 +12,55 @@ import com.legacy.aether.blocks.BlocksAether; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -public class BerryBushRenderer implements ISimpleBlockRenderingHandler -{ +public class BerryBushRenderer implements ISimpleBlockRenderingHandler { @Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) - { - Tessellator tessellator = Tessellator.instance; + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, -1F, 0.0F); - renderer.drawCrossedSquares(BlocksAether.berry_bush_stem.getIcon(metadata, 0), -0.5D, -0.5D, -0.5D, 1.0F); - tessellator.draw(); + tessellator.setNormal(0.0F, -1F, 0.0F); + renderer.drawCrossedSquares(BlocksAether.berry_bush_stem.getIcon(metadata, 0), -0.5D, -0.5D, -0.5D, 1.0F); + tessellator.draw(); block.setBlockBoundsForItemRender(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - float f1 = 0.0625F; - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, -1.0F, 0.0F); - renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 0)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 1.0F, 0.0F); - renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 1)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, -1.0F); - tessellator.addTranslation(0.0F, 0.0F, f1); - renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 2)); - tessellator.addTranslation(0.0F, 0.0F, -f1); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, 1.0F); - tessellator.addTranslation(0.0F, 0.0F, -f1); - renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 3)); - tessellator.addTranslation(0.0F, 0.0F, f1); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(-1.0F, 0.0F, 0.0F); - tessellator.addTranslation(f1, 0.0F, 0.0F); - renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 4)); - tessellator.addTranslation(-f1, 0.0F, 0.0F); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(1.0F, 0.0F, 0.0F); - tessellator.addTranslation(-f1, 0.0F, 0.0F); - renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 5)); - tessellator.addTranslation(f1, 0.0F, 0.0F); - tessellator.draw(); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + float f1 = 0.0625F; + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1.0F, 0.0F); + renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 0)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 1)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, -1.0F); + tessellator.addTranslation(0.0F, 0.0F, f1); + renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 2)); + tessellator.addTranslation(0.0F, 0.0F, -f1); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, 1.0F); + tessellator.addTranslation(0.0F, 0.0F, -f1); + renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 3)); + tessellator.addTranslation(0.0F, 0.0F, f1); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1.0F, 0.0F, 0.0F); + tessellator.addTranslation(f1, 0.0F, 0.0F); + renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 4)); + tessellator.addTranslation(-f1, 0.0F, 0.0F); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + tessellator.addTranslation(-f1, 0.0F, 0.0F); + renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 5)); + tessellator.addTranslation(f1, 0.0F, 0.0F); + tessellator.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); } @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { renderer.renderCrossedSquares(BlocksAether.berry_bush_stem, x, y, z); renderer.renderStandardBlock(block, x, y, z); @@ -71,14 +68,12 @@ public class BerryBushRenderer implements ISimpleBlockRenderingHandler } @Override - public boolean shouldRender3DInInventory(int modelId) - { + public boolean shouldRender3DInInventory(int modelId) { return true; } @Override - public int getRenderId() - { + public int getRenderId() { return CommonProxy.berryBushRenderID; } diff --git a/src/main/java/com/legacy/aether/client/renders/block/TreasureChestBlockRenderer.java b/src/main/java/com/legacy/aether/client/renders/block/TreasureChestBlockRenderer.java index 33b2d5c..88fd79c 100644 --- a/src/main/java/com/legacy/aether/client/renders/block/TreasureChestBlockRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/block/TreasureChestBlockRenderer.java @@ -13,33 +13,28 @@ import com.legacy.aether.tileentity.TileEntityTreasureChest; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -public class TreasureChestBlockRenderer implements ISimpleBlockRenderingHandler -{ +public class TreasureChestBlockRenderer implements ISimpleBlockRenderingHandler { @Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) - { - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityTreasureChest(), 0.0, 0.0, 0.0, 0f); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); } @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { return false; } @Override - public boolean shouldRender3DInInventory(int modelId) - { + public boolean shouldRender3DInInventory(int modelId) { return true; } @Override - public int getRenderId() - { + public int getRenderId() { return CommonProxy.treasureChestRenderID; } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/AechorPlantRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/AechorPlantRenderer.java index 7f2daa0..1a1a510 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/AechorPlantRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/AechorPlantRenderer.java @@ -9,15 +9,13 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.AechorPlantModel; import com.legacy.aether.entities.hostile.EntityAechorPlant; -public class AechorPlantRenderer extends RenderLiving -{ +public class AechorPlantRenderer extends RenderLiving { public static final ResourceLocation TEXTURE = Aether.locate("textures/entities/aechor_plant/aechor_plant.png"); public AechorPlantModel mode; - public AechorPlantRenderer() - { + public AechorPlantRenderer() { super(new AechorPlantModel(), 0.3F); this.mode = ((AechorPlantModel) this.mainModel); @@ -25,53 +23,43 @@ public class AechorPlantRenderer extends RenderLiving } @Override - protected void preRenderCallback(EntityLivingBase entity, float f) - { - EntityAechorPlant plant = (EntityAechorPlant) entity; + protected void preRenderCallback(EntityLivingBase entity, float f) { + EntityAechorPlant plant = (EntityAechorPlant) entity; - float f1 = (float)Math.sin((double)plant.sinage); + float f1 = (float) Math.sin((double) plant.sinage); float f3; - if (plant.hurtTime > 0) - { + if (plant.hurtTime > 0) { f1 *= 0.45F; f1 -= 0.125F; - f3 = 1.75F + (float)Math.sin((double)(plant.sinage + 2.0F)) * 1.5F; - } - else - { + f3 = 1.75F + (float) Math.sin((double) (plant.sinage + 2.0F)) * 1.5F; + } else { f1 *= 0.125F; f3 = 1.75F; } ((AechorPlantModel) this.mainModel).sinage = f1; ((AechorPlantModel) this.mainModel).sinage2 = f3; - float f2 = 0.625F + (float)plant.getSize() / 6.0F; + float f2 = 0.625F + (float) plant.getSize() / 6.0F; ((AechorPlantModel) this.mainModel).size = f2; this.shadowSize = f2 - 0.25F + f1; } - protected int doAechorPlantRender(EntityAechorPlant entityaechorplant, int i, float f) - { - if (i != 0) - { + protected int doAechorPlantRender(EntityAechorPlant entityaechorplant, int i, float f) { + if (i != 0) { return -1; - } - else - { + } else { return 1; } } @Override - protected int shouldRenderPass(EntityLivingBase entityliving, int i, float f) - { + protected int shouldRenderPass(EntityLivingBase entityliving, int i, float f) { return this.doAechorPlantRender((EntityAechorPlant) entityliving, i, f); } @Override - protected ResourceLocation getEntityTexture(Entity entity) - { + protected ResourceLocation getEntityTexture(Entity entity) { return TEXTURE; } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/AerbunnyRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/AerbunnyRenderer.java index 64420e4..48fc6a4 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/AerbunnyRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/AerbunnyRenderer.java @@ -12,59 +12,45 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.AerbunnyModel; import com.legacy.aether.entities.passive.mountable.EntityAerbunny; -public class AerbunnyRenderer extends RenderLiving -{ +public class AerbunnyRenderer extends RenderLiving { private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/aerbunny/aerbunny.png"); public AerbunnyModel model; - public AerbunnyRenderer() - { - super(new AerbunnyModel(), 0.3F); - this.model = (AerbunnyModel) this.mainModel; - } + public AerbunnyRenderer() { + super(new AerbunnyModel(), 0.3F); + this.model = (AerbunnyModel) this.mainModel; + } - protected void rotateAerbunny(EntityAerbunny entitybunny) - { - if (!entitybunny.isRiding()) - { - GL11.glTranslated(0.0D, 0.2D, 0.0D); - } - else if (entitybunny.ridingEntity == Minecraft.getMinecraft().thePlayer) - { - GL11.glTranslated(0.0D, 1.7D, 0.0D); - } + protected void rotateAerbunny(EntityAerbunny entitybunny) { + if (!entitybunny.isRiding()) { + GL11.glTranslated(0.0D, 0.2D, 0.0D); + } else if (entitybunny.ridingEntity == Minecraft.getMinecraft().thePlayer) { + GL11.glTranslated(0.0D, 1.7D, 0.0D); + } - if (!entitybunny.onGround) - { - if (entitybunny.motionY > 0.5D) - { + if (!entitybunny.onGround) { + if (entitybunny.motionY > 0.5D) { GL11.glRotatef(15.0F, -1.0F, 0.0F, 0.0F); - } - else if (entitybunny.motionY < -0.5D) - { + } else if (entitybunny.motionY < -0.5D) { GL11.glRotatef(-15.0F, -1.0F, 0.0F, 0.0F); - } - else - { - GL11.glRotatef((float)(entitybunny.motionY * 30.0D), -1.0F, 0.0F, 0.0F); + } else { + GL11.glRotatef((float) (entitybunny.motionY * 30.0D), -1.0F, 0.0F, 0.0F); } } - this.model.puffiness = (float)(entitybunny.ridingEntity != null ? entitybunny.getPuffinessClient() : entitybunny.getPuffiness()) / 10.0F; + this.model.puffiness = (float) (entitybunny.ridingEntity != null ? entitybunny.getPuffinessClient() : entitybunny.getPuffiness()) / 10.0F; } - @Override - protected void preRenderCallback(EntityLivingBase entitybunny, float f) - { + @Override + protected void preRenderCallback(EntityLivingBase entitybunny, float f) { this.rotateAerbunny((EntityAerbunny) entitybunny); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return TEXTURE; - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return TEXTURE; + } } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/AerwhaleRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/AerwhaleRenderer.java index 144a4f6..74f1e12 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/AerwhaleRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/AerwhaleRenderer.java @@ -13,46 +13,37 @@ import com.legacy.aether.client.models.entities.AerwhaleModel; import com.legacy.aether.client.models.entities.OldAerwhaleModel; import com.legacy.aether.entities.passive.EntityAerwhale; -public class AerwhaleRenderer extends Render -{ +public class AerwhaleRenderer extends Render { - private static final ResourceLocation AERWHALE_TEXTURE = Aether.locate("textures/entities/aerwhale/aerwhale.png"); + private static final ResourceLocation AERWHALE_TEXTURE = Aether.locate("textures/entities/aerwhale/aerwhale.png"); - private static final ResourceLocation OLD_AERWHALE_TEXTURE = Aether.locate("textures/entities/aerwhale/old_aerwhale.png"); + private static final ResourceLocation OLD_AERWHALE_TEXTURE = Aether.locate("textures/entities/aerwhale/old_aerwhale.png"); private ModelBase model = new AerwhaleModel(); private ModelBase old_model = new OldAerwhaleModel(); - - public AerwhaleRenderer() - { - super(); - } - @Override - public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) - { - EntityAerwhale aerwhale = (EntityAerwhale) entity; + public AerwhaleRenderer() { + super(); + } - GL11.glPushMatrix(); + @Override + public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) { + EntityAerwhale aerwhale = (EntityAerwhale) entity; - if (aerwhale.hurtResistantTime > 11) - { - GL11.glColor3f(1.0F, 0.5F, 0.5F); - } - else - { - GL11.glColor3f(1.0F, 1.0F, 1.0F); - } - - - if (AetherConfig.oldMobsEnabled()) - { - this.renderManager.renderEngine.bindTexture(OLD_AERWHALE_TEXTURE); + GL11.glPushMatrix(); + + if (aerwhale.hurtResistantTime > 11) { + GL11.glColor3f(1.0F, 0.5F, 0.5F); + } else { + GL11.glColor3f(1.0F, 1.0F, 1.0F); } - else - { - this.renderManager.renderEngine.bindTexture(AERWHALE_TEXTURE); + + + if (AetherConfig.oldMobsEnabled()) { + this.renderManager.renderEngine.bindTexture(OLD_AERWHALE_TEXTURE); + } else { + this.renderManager.renderEngine.bindTexture(AERWHALE_TEXTURE); } GL11.glTranslated(x, y + 2.0D, z); @@ -60,22 +51,18 @@ public class AerwhaleRenderer extends Render GL11.glRotatef(180.0F - (float) aerwhale.aerwhaleRotationPitch, 1.0F, 0.0F, 0.0F); GL11.glScalef(2.0F, 2.0F, 2.0F); - if (AetherConfig.oldMobsEnabled()) - { - this.old_model.render(aerwhale, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - } - else - { - this.model.render(aerwhale, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); + if (AetherConfig.oldMobsEnabled()) { + this.old_model.render(aerwhale, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); + } else { + this.model.render(aerwhale, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); } GL11.glPopMatrix(); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { + @Override + protected ResourceLocation getEntityTexture(Entity entity) { return AERWHALE_TEXTURE; - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/CockatriceRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/CockatriceRenderer.java index b25e540..8e47468 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/CockatriceRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/CockatriceRenderer.java @@ -12,18 +12,15 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.CockatriceModel; import com.legacy.aether.entities.hostile.EntityCockatrice; -public class CockatriceRenderer extends RenderLiving -{ +public class CockatriceRenderer extends RenderLiving { private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/cockatrice/cockatrice.png"); - public CockatriceRenderer() - { - super(new CockatriceModel(), 1.0F); - } + public CockatriceRenderer() { + super(new CockatriceModel(), 1.0F); + } - protected float getWingRotation(EntityCockatrice cockatrice, float f) - { + protected float getWingRotation(EntityCockatrice cockatrice, float f) { float f1 = cockatrice.prevWingRotation + (cockatrice.wingRotation - cockatrice.prevWingRotation) * f; float f2 = cockatrice.prevDestPos + (cockatrice.destPos - cockatrice.prevDestPos) * f; @@ -31,21 +28,18 @@ public class CockatriceRenderer extends RenderLiving } @Override - protected float handleRotationFloat(EntityLivingBase cockatrice, float f) - { + protected float handleRotationFloat(EntityLivingBase cockatrice, float f) { return this.getWingRotation((EntityCockatrice) cockatrice, f); } @Override - protected void preRenderCallback(EntityLivingBase cockatrice, float f) - { + protected void preRenderCallback(EntityLivingBase cockatrice, float f) { GL11.glScalef(1.8F, 1.8F, 1.8F); } - @Override - protected ResourceLocation getEntityTexture(Entity cockatrice) - { - return TEXTURE; - } + @Override + protected ResourceLocation getEntityTexture(Entity cockatrice) { + return TEXTURE; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/CrystalRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/CrystalRenderer.java index 5746bfd..3652de5 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/CrystalRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/CrystalRenderer.java @@ -11,29 +11,24 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.CrystalModel; import com.legacy.aether.entities.projectile.crystals.EntityCrystal; -public class CrystalRenderer extends RenderLiving -{ +public class CrystalRenderer extends RenderLiving { - public CrystalRenderer() - { - super(new CrystalModel(), 0.25F); - } - - @Override - public void preRenderCallback(EntityLivingBase entity, float f) - { - for(int i = 0; i < 3; i ++) - { - ((CrystalModel)this.mainModel).sinage[i] = ((EntityCrystal)entity).sinage[i]; - } - - GL11.glTranslatef(0.0F, 0.3F, 0.0F); + public CrystalRenderer() { + super(new CrystalModel(), 0.25F); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return Aether.locate("textures/entities/crystals/" + ((EntityCrystal)entity).getCrystalType().name().toLowerCase() + ".png"); - } + @Override + public void preRenderCallback(EntityLivingBase entity, float f) { + for (int i = 0; i < 3; i++) { + ((CrystalModel) this.mainModel).sinage[i] = ((EntityCrystal) entity).sinage[i]; + } + + GL11.glTranslatef(0.0F, 0.3F, 0.0F); + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return Aether.locate("textures/entities/crystals/" + ((EntityCrystal) entity).getCrystalType().name().toLowerCase() + ".png"); + } } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/DartBaseRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/DartBaseRenderer.java index f2ec36e..9a84998 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/DartBaseRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/DartBaseRenderer.java @@ -16,31 +16,26 @@ import com.legacy.aether.entities.projectile.darts.EntityDartEnchanted; import com.legacy.aether.entities.projectile.darts.EntityDartGolden; import com.legacy.aether.entities.projectile.darts.EntityDartPoison; -public class DartBaseRenderer extends Render -{ +public class DartBaseRenderer extends Render { - public DartBaseRenderer() - { - super(); + public DartBaseRenderer() { + super(); - this.shadowSize = 0.0F; - } + this.shadowSize = 0.0F; + } - public void renderDart(EntityDartBase dart, double d, double d1, double d2, float f, float f1) - { - if (dart.isInvisible() && dart.prevRotationYaw == 0.0F || dart.prevRotationPitch == 0.0F) - { - return; - } + public void renderDart(EntityDartBase dart, double d, double d1, double d2, float f, float f1) { + if (dart.isInvisible() && dart.prevRotationYaw == 0.0F || dart.prevRotationPitch == 0.0F) { + return; + } - if (dart instanceof EntityDartPoison && ((EntityDartPoison)dart).victim != null) - { - return; - } + if (dart instanceof EntityDartPoison && ((EntityDartPoison) dart).victim != null) { + return; + } this.bindEntityTexture(dart); GL11.glPushMatrix(); - GL11.glTranslatef((float)d, (float)d1, (float)d2); + GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glRotatef(dart.prevRotationYaw + (dart.rotationYaw - dart.prevRotationYaw) * f1 - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(dart.prevRotationPitch + (dart.rotationPitch - dart.prevRotationPitch) * f1, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; @@ -48,18 +43,17 @@ public class DartBaseRenderer extends Render byte i = 1; float f2 = 0.0F; float f3 = 0.5F; - float f4 = (float)(0 + i * 10) / 32.0F; - float f5 = (float)(5 + i * 10) / 32.0F; + float f4 = (float) (0 + i * 10) / 32.0F; + float f5 = (float) (5 + i * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; - float f8 = (float)(5 + i * 10) / 32.0F; - float f9 = (float)(10 + i * 10) / 32.0F; + float f8 = (float) (5 + i * 10) / 32.0F; + float f9 = (float) (10 + i * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); - float f11 = (float)dart.dartShake - f1; + float f11 = (float) dart.dartShake - f1; - if (f11 > 0.0F) - { + if (f11 > 0.0F) { float j = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(j, 0.0F, 0.0F, 1.0F); } @@ -70,31 +64,30 @@ public class DartBaseRenderer extends Render GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8); - tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8); - tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9); - tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9); + tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); + tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); + tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); + tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8); - tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8); - tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9); - tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9); + tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); + tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); + tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); + tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); - for (int var23 = 0; var23 < 5; ++var23) - { + for (int var23 = 0; var23 < 5; ++var23) { GL11.glRotatef(72.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4); - tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4); - tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5); - tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5); + tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); + tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); + tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); + tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); tessellator.draw(); } @@ -102,16 +95,14 @@ public class DartBaseRenderer extends Render GL11.glPopMatrix(); } - @Override - public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) - { + @Override + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { this.renderDart((EntityDartBase) entity, d, d1, d2, f, f1); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - String base = entity instanceof EntityDartGolden ? "golden" : entity instanceof EntityDartEnchanted ? "enchanted" : "poison"; + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + String base = entity instanceof EntityDartGolden ? "golden" : entity instanceof EntityDartEnchanted ? "enchanted" : "poison"; return Aether.locate("textures/entities/projectile/dart/" + base + (entity instanceof EntityPoisonNeedle ? "_needle" : "_dart") + ".png"); } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/FireMinionRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/FireMinionRenderer.java index f7a8f2a..b705372 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/FireMinionRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/FireMinionRenderer.java @@ -8,32 +8,26 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.SunSpiritModel; import com.legacy.aether.entities.bosses.EntityFireMinion; -public class FireMinionRenderer extends RenderBiped -{ +public class FireMinionRenderer extends RenderBiped { private static final ResourceLocation SPIRIT = Aether.locate("textures/bosses/sun_spirit/sun_spirit.png"); - + private static final ResourceLocation FROZEN_SPIRIT = Aether.locate("textures/bosses/sun_spirit/frozen_sun_spirit.png"); - public FireMinionRenderer() - { + public FireMinionRenderer() { super(new SunSpiritModel(0.0F, 0.0F), 0.4F); this.shadowSize = 0.8F; } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - EntityFireMinion sunSpirit = (EntityFireMinion) entity; + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + EntityFireMinion sunSpirit = (EntityFireMinion) entity; - if (sunSpirit.hasCustomNameTag() && "JorgeQ".equals(sunSpirit.getCustomNameTag())) - { - return FROZEN_SPIRIT; - } - else - { - return SPIRIT; - } + if (sunSpirit.hasCustomNameTag() && "JorgeQ".equals(sunSpirit.getCustomNameTag())) { + return FROZEN_SPIRIT; + } else { + return SPIRIT; + } } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/FloatingBlockRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/FloatingBlockRenderer.java index 3b4aac4..9c73f3d 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/FloatingBlockRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/FloatingBlockRenderer.java @@ -14,22 +14,18 @@ import org.lwjgl.opengl.GL11; import com.legacy.aether.entities.block.EntityFloatingBlock; -public class FloatingBlockRenderer extends Render -{ +public class FloatingBlockRenderer extends Render { private final RenderBlocks renderBlocks = new RenderBlocks(); - public FloatingBlockRenderer() - { - super(); + public FloatingBlockRenderer() { + super(); this.shadowSize = 0.5F; } - public void renderFloatingBlock(EntityFloatingBlock entityFloatingBlock, double d, double d1, double d2, float f, float f1) - { - if (entityFloatingBlock.getBlock() == null || entityFloatingBlock.getBlock() == Blocks.air) - { - return; + public void renderFloatingBlock(EntityFloatingBlock entityFloatingBlock, double d, double d1, double d2, float f, float f1) { + if (entityFloatingBlock.getBlock() == null || entityFloatingBlock.getBlock() == Blocks.air) { + return; } this.bindTexture(TextureMap.locationBlocksTexture); @@ -39,10 +35,9 @@ public class FloatingBlockRenderer extends Render int j = MathHelper.floor_double(entityFloatingBlock.posY); int k = MathHelper.floor_double(entityFloatingBlock.posZ); - if (block != world.getBlock(i, j, k)) - { + if (block != world.getBlock(i, j, k)) { GL11.glPushMatrix(); - GL11.glTranslatef((float)d, (float)d1 + 0.48F, (float)d2); + GL11.glTranslatef((float) d, (float) d1 + 0.48F, (float) d2); this.bindEntityTexture(entityFloatingBlock); GL11.glDisable(GL11.GL_LIGHTING); @@ -55,14 +50,12 @@ public class FloatingBlockRenderer extends Render } @Override - public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) - { - this.renderFloatingBlock((EntityFloatingBlock)entity, d, d1, d2, f, f1); + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { + this.renderFloatingBlock((EntityFloatingBlock) entity, d, d1, d2, f, f1); } @Override - protected ResourceLocation getEntityTexture(Entity entity) - { + protected ResourceLocation getEntityTexture(Entity entity) { return TextureMap.locationBlocksTexture; } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/FlyingCowRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/FlyingCowRenderer.java index 748f293..ca9a3ad 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/FlyingCowRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/FlyingCowRenderer.java @@ -10,41 +10,33 @@ import com.legacy.aether.client.models.entities.FlyingCowModel; import com.legacy.aether.client.models.entities.FlyingCowWingModel; import com.legacy.aether.entities.passive.mountable.EntityFlyingCow; -public class FlyingCowRenderer extends RenderLiving -{ +public class FlyingCowRenderer extends RenderLiving { - private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/flying_cow/flying_cow.png"); + private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/flying_cow/flying_cow.png"); - private static final ResourceLocation TEXTURE_WINGS = Aether.locate("textures/entities/flying_cow/wings.png"); + private static final ResourceLocation TEXTURE_WINGS = Aether.locate("textures/entities/flying_cow/wings.png"); private static final ResourceLocation TEXTURE_SADDLE = Aether.locate("textures/entities/flying_cow/saddle.png"); - private final FlyingCowWingModel wingModel = new FlyingCowWingModel(); + private final FlyingCowWingModel wingModel = new FlyingCowWingModel(); - private final FlyingCowModel saddleModel = new FlyingCowModel(0.5F); + private final FlyingCowModel saddleModel = new FlyingCowModel(0.5F); - public FlyingCowRenderer() - { - super(new FlyingCowModel(0.0F), 0.7F); - } + public FlyingCowRenderer() { + super(new FlyingCowModel(0.0F), 0.7F); + } - protected int renderLayers(EntityFlyingCow entity, int pass, float particleTicks) - { - if (entity.isInvisible()) - { + protected int renderLayers(EntityFlyingCow entity, int pass, float particleTicks) { + if (entity.isInvisible()) { return 0; - } - else if (pass == 0) - { - this.setRenderPassModel(this.wingModel); - this.bindTexture(TEXTURE_WINGS); + } else if (pass == 0) { + this.setRenderPassModel(this.wingModel); + this.bindTexture(TEXTURE_WINGS); return 1; - } - else if (pass == 1 && entity.isSaddled()) - { - this.setRenderPassModel(this.saddleModel); - this.bindTexture(TEXTURE_SADDLE); + } else if (pass == 1 && entity.isSaddled()) { + this.setRenderPassModel(this.saddleModel); + this.bindTexture(TEXTURE_SADDLE); return 1; } @@ -53,15 +45,13 @@ public class FlyingCowRenderer extends RenderLiving } @Override - protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) - { - return this.renderLayers((EntityFlyingCow)entity, pass, particleTicks); + protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) { + return this.renderLayers((EntityFlyingCow) entity, pass, particleTicks); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return TEXTURE; - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return TEXTURE; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/HammerProjectileRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/HammerProjectileRenderer.java index ad0bdbf..b6e8b80 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/HammerProjectileRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/HammerProjectileRenderer.java @@ -11,21 +11,18 @@ import org.lwjgl.opengl.GL12; import com.legacy.aether.Aether; import com.legacy.aether.entities.projectile.EntityHammerProjectile; -public class HammerProjectileRenderer extends Render -{ +public class HammerProjectileRenderer extends Render { - public HammerProjectileRenderer() - { - super(); + public HammerProjectileRenderer() { + super(); - this.shadowSize = 0.0F; - } + this.shadowSize = 0.0F; + } - public void doRenderNotchWave(EntityHammerProjectile notchwave, double par2, double par4, double par6, float par8, float par9) - { - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glTranslated(par2, par4, par6); + public void doRenderNotchWave(EntityHammerProjectile notchwave, double par2, double par4, double par6, float par8, float par9) { + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslated(par2, par4, par6); this.bindTexture(this.getEntityTexture(notchwave)); @@ -47,18 +44,16 @@ public class HammerProjectileRenderer extends Render GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); - } + } - @Override - public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) - { - this.doRenderNotchWave((EntityHammerProjectile) par1Entity, par2, par4, par6, par8, par9); - } + @Override + public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { + this.doRenderNotchWave((EntityHammerProjectile) par1Entity, par2, par4, par6, par8, par9); + } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return Aether.locate("textures/entities/projectile/notch_wave.png"); - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return Aether.locate("textures/entities/projectile/notch_wave.png"); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/LightningKnifeRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/LightningKnifeRenderer.java index 46bdc26..6936486 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/LightningKnifeRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/LightningKnifeRenderer.java @@ -11,23 +11,19 @@ import org.lwjgl.opengl.GL12; import com.legacy.aether.Aether; import com.legacy.aether.entities.projectile.EntityLightningKnife; -public class LightningKnifeRenderer extends Render -{ +public class LightningKnifeRenderer extends Render { - public LightningKnifeRenderer() - { - super(); - } + public LightningKnifeRenderer() { + super(); + } - public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) - { + public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { this.doRenderKnife((EntityLightningKnife) var1, var2, var4, var6, var8, var9); } - public void doRenderKnife(EntityLightningKnife arr, double d, double d1, double d2, float yaw, float time) - { + public void doRenderKnife(EntityLightningKnife arr, double d, double d1, double d2, float yaw, float time) { GL11.glPushMatrix(); - GL11.glTranslatef((float)d, (float)d1, (float)d2); + GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glRotatef(yaw, 0F, 1.0F, 0F); GL11.glRotatef(-(arr.prevRotationPitch + (arr.rotationPitch - arr.prevRotationPitch) * time), 1F, 0F, 0F); GL11.glRotatef(45f, 0.0F, 1.0F, 0.0F); @@ -64,9 +60,8 @@ public class LightningKnifeRenderer extends Render tessellator.startDrawingQuads(); tessellator.setNormal(-1.0F, 0.0F, 0.0F); - for(int i = 0; i < 16; i++) - { - float f9 = (float)i / 16F; + for (int i = 0; i < 16; i++) { + float f9 = (float) i / 16F; float f13 = (texMaxX + (texMinX - texMaxX) * f9) - 0.001953125F; float f17 = f4 * f9; tessellator.addVertexWithUV(f17, 0.0F - f8, 0.0D, f13, texMaxY); @@ -80,9 +75,8 @@ public class LightningKnifeRenderer extends Render tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); - for(int j = 0; j < 16; j++) - { - float f10 = (float)j / 16F; + for (int j = 0; j < 16; j++) { + float f10 = (float) j / 16F; float f14 = (texMaxX + (texMinX - texMaxX) * f10) - 0.001953125F; float f18 = f4 * f10 + 0.0625F; tessellator.addVertexWithUV(f18, 0.0F - f8, 1.0D, f14, texMinY); @@ -96,9 +90,8 @@ public class LightningKnifeRenderer extends Render tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); - for(int k = 0; k < 16; k++) - { - float f11 = (float)k / 16F; + for (int k = 0; k < 16; k++) { + float f11 = (float) k / 16F; float f15 = (texMaxY + (texMinY - texMaxY) * f11) - 0.001953125F; float f19 = f4 * f11 + 0.0625F; tessellator.addVertexWithUV(0.0D, 0.0D, f19, texMaxX, f15); @@ -112,9 +105,8 @@ public class LightningKnifeRenderer extends Render tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 1.0F); - for(int l = 0; l < 16; l++) - { - float f12 = (float)l / 16F; + for (int l = 0; l < 16; l++) { + float f12 = (float) l / 16F; float f16 = (texMaxY + (texMinY - texMaxY) * f12) - 0.001953125F; float f20 = f4 * f12; tessellator.addVertexWithUV(f4, 0.0D, f20, texMinX, f16); @@ -129,10 +121,9 @@ public class LightningKnifeRenderer extends Render GL11.glPopMatrix(); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return null; - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return null; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/MimicRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/MimicRenderer.java index f512f0c..8cf4bef 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/MimicRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/MimicRenderer.java @@ -12,50 +12,41 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.MimicModel; import com.legacy.aether.entities.hostile.EntityMimic; -public class MimicRenderer extends RenderLiving -{ +public class MimicRenderer extends RenderLiving { private MimicModel modelbase; - public MimicRenderer() - { - super(new MimicModel(), 0.0F); + public MimicRenderer() { + super(new MimicModel(), 0.0F); - this.modelbase = (MimicModel) this.mainModel; - } + this.modelbase = (MimicModel) this.mainModel; + } - @Override - public void doRender(Entity entity, double x, double y, double z, float pitch, float yaw) - { - EntityMimic mimic = (EntityMimic) entity; + @Override + public void doRender(Entity entity, double x, double y, double z, float pitch, float yaw) { + EntityMimic mimic = (EntityMimic) entity; - GL11.glPushMatrix(); - GL11.glTranslated(x, y, z); - GL11.glRotatef(180F - pitch, 0.0F, 1.0F, 0.0F); - GL11.glScalef(-1F, -1F, 1.0F); + GL11.glPushMatrix(); + GL11.glTranslated(x, y, z); + GL11.glRotatef(180F - pitch, 0.0F, 1.0F, 0.0F); + GL11.glScalef(-1F, -1F, 1.0F); - this.modelbase.setRotationAngles(0,0F, 0.0F, 0.0F, 0.0F, 0.0F, mimic); + this.modelbase.setRotationAngles(0, 0F, 0.0F, 0.0F, 0.0F, 0.0F, mimic); - if (mimic.hurtResistantTime > 11) - { + if (mimic.hurtResistantTime > 11) { GL11.glColor3f(1.0F, 0.5F, 0.5F); - } - else - { + } else { GL11.glColor3f(1.0F, 1.0F, 1.0F); } Calendar calendar = Calendar.getInstance(); - if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26) - { + if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26) { this.renderManager.renderEngine.bindTexture(Aether.locate("textures/entities/mimic/mimic_head_christmas.png")); this.modelbase.renderHead(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, mimic); this.renderManager.renderEngine.bindTexture(Aether.locate("textures/entities/mimic/mimic_legs_christmas.png")); this.modelbase.renderLegs(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, mimic); - } - else - { + } else { this.renderManager.renderEngine.bindTexture(Aether.locate("textures/entities/mimic/mimic_head.png")); this.modelbase.renderHead(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, mimic); this.renderManager.renderEngine.bindTexture(Aether.locate("textures/entities/mimic/mimic_legs.png")); @@ -63,11 +54,10 @@ public class MimicRenderer extends RenderLiving } GL11.glPopMatrix(); - } + } - protected ResourceLocation getEntityTexture(Entity entity) - { + protected ResourceLocation getEntityTexture(Entity entity) { return null; - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/MiniCloudRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/MiniCloudRenderer.java index e9b570c..b91dd26 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/MiniCloudRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/MiniCloudRenderer.java @@ -7,18 +7,15 @@ import net.minecraft.util.ResourceLocation; import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.MiniCloudModel; -public class MiniCloudRenderer extends RenderLiving -{ +public class MiniCloudRenderer extends RenderLiving { - public MiniCloudRenderer() - { - super(new MiniCloudModel(), 0.5F); - } + public MiniCloudRenderer() { + super(new MiniCloudModel(), 0.5F); + } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return Aether.locate("textures/entities/mini_cloud/mini_cloud.png"); - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return Aether.locate("textures/entities/mini_cloud/mini_cloud.png"); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/MoaRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/MoaRenderer.java index d25df0e..16e9ba3 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/MoaRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/MoaRenderer.java @@ -16,8 +16,7 @@ import com.legacy.aether.entities.util.AetherMoaTypes; import com.legacy.aether.player.PlayerAether; import com.legacy.aether.player.perks.util.DonatorMoaSkin; -public class MoaRenderer extends RenderLiving -{ +public class MoaRenderer extends RenderLiving { private static final ResourceLocation TEXTURE_OUTSIDE = Aether.locate("textures/entities/moa/canvas/moa_outside.png"); @@ -33,102 +32,87 @@ public class MoaRenderer extends RenderLiving private static final ResourceLocation TEXTURE_UNCHANGED = Aether.locate("textures/entities/moa/canvas/moa_unchanged.png"); - private static final ResourceLocation SADDLE = Aether.locate("textures/entities/moa/moa_saddle.png"); + private static final ResourceLocation SADDLE = Aether.locate("textures/entities/moa/moa_saddle.png"); - private static final ResourceLocation BLACK_SADDLE = Aether.locate("textures/entities/moa/black_moa_saddle.png"); + private static final ResourceLocation BLACK_SADDLE = Aether.locate("textures/entities/moa/black_moa_saddle.png"); - public MoaRenderer() - { + public MoaRenderer() { super(new MoaModel(0.0F), 1.0F); this.setRenderPassModel(new MoaModel(0.5F)); } @Override - protected void renderModel(EntityLivingBase entity, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) - { + protected void renderModel(EntityLivingBase entity, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) { EntityMoa moa = (EntityMoa) entity; - if (!entity.isInvisible()) - { - if (!(moa.riddenByEntity instanceof EntityPlayer)) - { - this.bindTexture(this.getEntityTexture(entity)); - this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - } - else - { - PlayerAether playerAether = PlayerAether.get((EntityPlayer) moa.riddenByEntity); + if (!entity.isInvisible()) { + if (!(moa.riddenByEntity instanceof EntityPlayer)) { + this.bindTexture(this.getEntityTexture(entity)); + this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + } else { + PlayerAether playerAether = PlayerAether.get((EntityPlayer) moa.riddenByEntity); - if (playerAether.donatorMoaSkin != null && !playerAether.donatorMoaSkin.shouldUseDefualt()) - { - DonatorMoaSkin skin = playerAether.donatorMoaSkin; + if (playerAether.donatorMoaSkin != null && !playerAether.donatorMoaSkin.shouldUseDefualt()) { + DonatorMoaSkin skin = playerAether.donatorMoaSkin; - GL11.glColor3f(1.0F, 1.0F, 1.0F); + GL11.glColor3f(1.0F, 1.0F, 1.0F); - this.bindTexture(TEXTURE_UNCHANGED); - this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + this.bindTexture(TEXTURE_UNCHANGED); + this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - this.bindTexture(TEXTURE_WING_MARKINGS); - GL11.glColor3f(r(skin.getWingMarkingColor()), g(skin.getWingMarkingColor()), b(skin.getWingMarkingColor())); - this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + this.bindTexture(TEXTURE_WING_MARKINGS); + GL11.glColor3f(r(skin.getWingMarkingColor()), g(skin.getWingMarkingColor()), b(skin.getWingMarkingColor())); + this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - this.bindTexture(TEXTURE_WING); - GL11.glColor3f(r(skin.getWingColor()), g(skin.getWingColor()), b(skin.getWingColor())); - this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + this.bindTexture(TEXTURE_WING); + GL11.glColor3f(r(skin.getWingColor()), g(skin.getWingColor()), b(skin.getWingColor())); + this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - this.bindTexture(TEXTURE_MARKINGS); - GL11.glColor3f(r(skin.getMarkingColor()), g(skin.getMarkingColor()), b(skin.getMarkingColor())); - this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + this.bindTexture(TEXTURE_MARKINGS); + GL11.glColor3f(r(skin.getMarkingColor()), g(skin.getMarkingColor()), b(skin.getMarkingColor())); + this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - this.bindTexture(TEXTURE_BODY); - GL11.glColor3f(r(skin.getBodyColor()), g(skin.getBodyColor()), b(skin.getBodyColor())); - this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + this.bindTexture(TEXTURE_BODY); + GL11.glColor3f(r(skin.getBodyColor()), g(skin.getBodyColor()), b(skin.getBodyColor())); + this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - this.bindTexture(TEXTURE_EYE); - GL11.glColor3f(r(skin.getEyeColor()), g(skin.getEyeColor()), b(skin.getEyeColor())); - this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + this.bindTexture(TEXTURE_EYE); + GL11.glColor3f(r(skin.getEyeColor()), g(skin.getEyeColor()), b(skin.getEyeColor())); + this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - this.bindTexture(TEXTURE_OUTSIDE); - GL11.glColor3f(r(skin.getOutsideColor()), g(skin.getOutsideColor()), b(skin.getOutsideColor())); - this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + this.bindTexture(TEXTURE_OUTSIDE); + GL11.glColor3f(r(skin.getOutsideColor()), g(skin.getOutsideColor()), b(skin.getOutsideColor())); + this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - GL11.glColor3f(1.0F, 1.0F, 1.0F); - } - else - { - this.bindTexture(this.getEntityTexture(entity)); - this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - } - } - } - else - { - this.mainModel.setRotationAngles(p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_, entity); - } - } + GL11.glColor3f(1.0F, 1.0F, 1.0F); + } else { + this.bindTexture(this.getEntityTexture(entity)); + this.mainModel.render(moa, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + } + } + } else { + this.mainModel.setRotationAngles(p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_, entity); + } + } - protected int renderLayer(EntityMoa entity, int pass, float particleTicks) - { - if (pass == 0 && entity.isSaddled()) - { - GL11.glTranslatef(0.0F, 0.02F, 0.0F); - this.bindTexture(entity.getMoaType() == AetherMoaTypes.black ? BLACK_SADDLE : SADDLE); + protected int renderLayer(EntityMoa entity, int pass, float particleTicks) { + if (pass == 0 && entity.isSaddled()) { + GL11.glTranslatef(0.0F, 0.02F, 0.0F); + this.bindTexture(entity.getMoaType() == AetherMoaTypes.black ? BLACK_SADDLE : SADDLE); - return 1; - } + return 1; + } - return -1; - } + return -1; + } - @Override - protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) - { - return this.renderLayer((EntityMoa)entity, pass, particleTicks); - } + @Override + protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) { + return this.renderLayer((EntityMoa) entity, pass, particleTicks); + } - protected float getWingRotation(EntityMoa moa, float f) - { + protected float getWingRotation(EntityMoa moa, float f) { float f1 = moa.prevWingRotation + (moa.wingRotation - moa.prevWingRotation) * f; float f2 = moa.prevDestPos + (moa.destPos - moa.prevDestPos) * f; @@ -136,21 +120,18 @@ public class MoaRenderer extends RenderLiving } @Override - protected float handleRotationFloat(EntityLivingBase entityliving, float f) - { + protected float handleRotationFloat(EntityLivingBase entityliving, float f) { return this.getWingRotation((EntityMoa) entityliving, f); } - - protected void scaleMoa(EntityMoa entityMoa) - { - float moaScale = entityMoa.isChild() ? 1.0f : 1.8f; + + protected void scaleMoa(EntityMoa entityMoa) { + float moaScale = entityMoa.isChild() ? 1.0f : 1.8f; GL11.glScalef(moaScale, moaScale, moaScale); } @Override - protected void preRenderCallback(EntityLivingBase entityliving, float f) - { + protected void preRenderCallback(EntityLivingBase entityliving, float f) { /* * Dear person who finds this, * have fun :) @@ -160,16 +141,13 @@ public class MoaRenderer extends RenderLiving } @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - EntityMoa moa = (EntityMoa)entity; - - if (moa.riddenByEntity instanceof EntityPlayer) - { + protected ResourceLocation getEntityTexture(Entity entity) { + EntityMoa moa = (EntityMoa) entity; + + if (moa.riddenByEntity instanceof EntityPlayer) { PlayerAether player = PlayerAether.get((EntityPlayer) moa.riddenByEntity); - if (player != null && !player.donatorMoaSkin.shouldUseDefualt()) - { + if (player != null && !player.donatorMoaSkin.shouldUseDefualt()) { return null; } } @@ -177,18 +155,15 @@ public class MoaRenderer extends RenderLiving return moa.getMoaType().getTexture(moa.isSaddled(), moa.riddenByEntity != null); } - private static float r(int r) - { + private static float r(int r) { return ((r >> 16) & 0xff) / 255F; } - private static float g(int g) - { + private static float g(int g) { return ((g >> 8) & 0xff) / 255F; } - private static float b(int b) - { + private static float b(int b) { return (b & 0xff) / 255F; } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/ParachuteRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/ParachuteRenderer.java index 9930c5b..515f541 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/ParachuteRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/ParachuteRenderer.java @@ -11,39 +11,34 @@ import org.lwjgl.opengl.GL11; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.entities.passive.mountable.EntityParachute; -public class ParachuteRenderer extends Render -{ +public class ParachuteRenderer extends Render { private final RenderBlocks renderBlocks = new RenderBlocks(); - public ParachuteRenderer() - { - super(); - } + public ParachuteRenderer() { + super(); + } - public void renderParachute(EntityParachute entityParachute, double d, double d1, double d2, float f, float f1) - { + public void renderParachute(EntityParachute entityParachute, double d, double d1, double d2, float f, float f1) { this.bindTexture(TextureMap.locationBlocksTexture); int meta = entityParachute.isGoldenParachute ? 2 : 0; GL11.glPushMatrix(); - GL11.glTranslatef((float)d, (float)d1 + 0.5F, (float)d2); + GL11.glTranslatef((float) d, (float) d1 + 0.5F, (float) d2); this.bindEntityTexture(entityParachute); this.renderBlocks.renderBlockAsItem(BlocksAether.aercloud, meta, entityParachute.getBrightness(f1)); GL11.glPopMatrix(); } - @Override - public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) - { + @Override + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { this.renderParachute((EntityParachute) entity, d, d1, d2, f, f1); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return TextureMap.locationBlocksTexture; - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return TextureMap.locationBlocksTexture; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/PhoenixArrowRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/PhoenixArrowRenderer.java index ff366b0..f4a74dc 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/PhoenixArrowRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/PhoenixArrowRenderer.java @@ -12,40 +12,35 @@ import org.lwjgl.opengl.GL12; import com.legacy.aether.Aether; import com.legacy.aether.entities.projectile.EntityPhoenixArrow; -public class PhoenixArrowRenderer extends Render -{ +public class PhoenixArrowRenderer extends Render { - public PhoenixArrowRenderer() - { - super(); + public PhoenixArrowRenderer() { + super(); - } + } - public void renderArrow(EntityPhoenixArrow var1, double var2, double var4, double var6, float var8, float var9) - { - if (var1.prevRotationYaw != 0.0F || var1.prevRotationPitch != 0.0F) - { + public void renderArrow(EntityPhoenixArrow var1, double var2, double var4, double var6, float var8, float var9) { + if (var1.prevRotationYaw != 0.0F || var1.prevRotationPitch != 0.0F) { this.bindEntityTexture(var1); GL11.glPushMatrix(); - GL11.glTranslatef((float)var2, (float)var4, (float)var6); + GL11.glTranslatef((float) var2, (float) var4, (float) var6); GL11.glRotatef(var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var9 - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(var1.prevRotationPitch + (var1.rotationPitch - var1.prevRotationPitch) * var9, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; - float f4 = (float)(0 + b0 * 10) / 32.0F; - float f5 = (float)(5 + b0 * 10) / 32.0F; + float f4 = (float) (0 + b0 * 10) / 32.0F; + float f5 = (float) (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; - float f8 = (float)(5 + b0 * 10) / 32.0F; - float f9 = (float)(10 + b0 * 10) / 32.0F; + float f8 = (float) (5 + b0 * 10) / 32.0F; + float f9 = (float) (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); - float f11 = (float)var1.arrowShake - var9; + float f11 = (float) var1.arrowShake - var9; - if (f11 > 0.0F) - { + if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } @@ -55,28 +50,27 @@ public class PhoenixArrowRenderer extends Render GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8); - tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8); - tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9); - tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9); + tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); + tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); + tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); + tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8); - tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8); - tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9); - tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9); + tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); + tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); + tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); + tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); - for (int i = 0; i < 4; ++i) - { + for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4); - tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4); - tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5); - tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5); + tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); + tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); + tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); + tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); tessellator.draw(); } @@ -86,15 +80,13 @@ public class PhoenixArrowRenderer extends Render } @Override - public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) - { - this.renderArrow((EntityPhoenixArrow) entity, x, y, z, entityYaw, partialTicks); + public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) { + this.renderArrow((EntityPhoenixArrow) entity, x, y, z, entityYaw, partialTicks); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return Aether.locate("textures/entities/projectile/flaming_arrow.png"); - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return Aether.locate("textures/entities/projectile/flaming_arrow.png"); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/PhygRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/PhygRenderer.java index ad88124..8c3bceb 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/PhygRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/PhygRenderer.java @@ -10,57 +10,47 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.PhygWingModel; import com.legacy.aether.entities.passive.mountable.EntityPhyg; -public class PhygRenderer extends RenderLiving -{ +public class PhygRenderer extends RenderLiving { private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/phyg/phyg.png"); private static final ResourceLocation TEXTURE_WINGS = Aether.locate("textures/entities/phyg/wings.png"); - private static final ResourceLocation TEXTURE_SADDLE = new ResourceLocation("textures/entity/pig/pig_saddle.png"); + private static final ResourceLocation TEXTURE_SADDLE = new ResourceLocation("textures/entity/pig/pig_saddle.png"); private final PhygWingModel wingModel = new PhygWingModel(); private final ModelPig saddleModel = new ModelPig(0.5F); - public PhygRenderer() - { + public PhygRenderer() { super(new ModelPig(), 0.7F); } - protected int renderLayers(EntityPhyg entity, int pass, float particleTicks) - { - if (entity.isInvisible()) - { - return 0; - } - else if (pass == 0) - { - this.setRenderPassModel(this.wingModel); - this.bindTexture(TEXTURE_WINGS); + protected int renderLayers(EntityPhyg entity, int pass, float particleTicks) { + if (entity.isInvisible()) { + return 0; + } else if (pass == 0) { + this.setRenderPassModel(this.wingModel); + this.bindTexture(TEXTURE_WINGS); - return 1; - } - else if (pass == 1 && entity.isSaddled()) - { - this.setRenderPassModel(this.saddleModel); - this.bindTexture(TEXTURE_SADDLE); + return 1; + } else if (pass == 1 && entity.isSaddled()) { + this.setRenderPassModel(this.saddleModel); + this.bindTexture(TEXTURE_SADDLE); - return 1; - } + return 1; + } - return -1; - } - - @Override - protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) - { - return this.renderLayers((EntityPhyg)entity, pass, particleTicks); - } + return -1; + } @Override - protected ResourceLocation getEntityTexture(Entity entity) - { + protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) { + return this.renderLayers((EntityPhyg) entity, pass, particleTicks); + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { return TEXTURE; } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/PlayerAetherRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/PlayerAetherRenderer.java index b8a1020..be21256 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/PlayerAetherRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/PlayerAetherRenderer.java @@ -27,60 +27,55 @@ import com.legacy.aether.items.armor.ItemAetherArmor; import com.legacy.aether.player.PlayerAether; import com.legacy.aether.player.perks.AetherRankings; -public class PlayerAetherRenderer -{ +public class PlayerAetherRenderer { - private static final ResourceLocation TEXTURE_VALKYRIE = Aether.locate("textures/entities/valkyrie/valkyrie.png"); + private static final ResourceLocation TEXTURE_VALKYRIE = Aether.locate("textures/entities/valkyrie/valkyrie.png"); - private static final ResourceLocation TEXTURE_HALO = Aether.locate("textures/other/halo.png"); + private static final ResourceLocation TEXTURE_HALO = Aether.locate("textures/other/halo.png"); - private Minecraft mc; + private Minecraft mc; - private ModelHalo modelHalo; + private ModelHalo modelHalo; - public ModelBiped modelMisc; + public ModelBiped modelMisc; - public ModelBiped modelGlow; + public ModelBiped modelGlow; - private ModelAetherWings modelWings; + private ModelAetherWings modelWings; - private float partialTicks; + private float partialTicks; - private boolean isCapeRendering; + private boolean isCapeRendering; - private static final PlayerAetherRenderer instance = new PlayerAetherRenderer(); + private static final PlayerAetherRenderer instance = new PlayerAetherRenderer(); - public PlayerAetherRenderer() - { - super(); + public PlayerAetherRenderer() { + super(); - this.mc = Minecraft.getMinecraft(); - this.modelHalo = new ModelHalo(); - this.modelGlow = new ModelBiped(0.005F); - this.modelMisc = new ModelBiped(1.0F); - this.modelWings = new ModelAetherWings(1.0F); - } + this.mc = Minecraft.getMinecraft(); + this.modelHalo = new ModelHalo(); + this.modelGlow = new ModelBiped(0.005F); + this.modelMisc = new ModelBiped(1.0F); + this.modelWings = new ModelAetherWings(1.0F); + } - public int renderAetherArmor(PlayerAether playerAether, RenderPlayer renderPlayer, ItemStack stack, int slotType) - { - if (stack != null) - { + public int renderAetherArmor(PlayerAether playerAether, RenderPlayer renderPlayer, ItemStack stack, int slotType) { + if (stack != null) { Item item = stack.getItem(); - if (item instanceof ItemAetherArmor) - { - ItemAetherArmor itemarmor = (ItemAetherArmor)item; + if (item instanceof ItemAetherArmor) { + ItemAetherArmor itemarmor = (ItemAetherArmor) item; this.mc.getTextureManager().bindTexture(RenderBiped.getArmorResource(playerAether.getEntity(), stack, slotType, null)); - ModelBiped modelbiped = slotType == 2 ? renderPlayer.modelArmor : renderPlayer.modelArmorChestplate; + ModelBiped modelbiped = slotType == 2 ? renderPlayer.modelArmor : renderPlayer.modelArmorChestplate; modelbiped.bipedHead.showModel = slotType == 0; - modelbiped.bipedHeadwear.showModel = slotType == 0; - modelbiped.bipedBody.showModel = slotType == 1 || slotType == 2; - modelbiped.bipedRightArm.showModel = slotType == 1; - modelbiped.bipedLeftArm.showModel = slotType == 1; - modelbiped.bipedRightLeg.showModel = slotType == 2 || slotType == 3; - modelbiped.bipedLeftLeg.showModel = slotType == 2 || slotType == 3; - modelbiped = net.minecraftforge.client.ForgeHooksClient.getArmorModel(playerAether.getEntity(), stack, slotType, modelbiped); + modelbiped.bipedHeadwear.showModel = slotType == 0; + modelbiped.bipedBody.showModel = slotType == 1 || slotType == 2; + modelbiped.bipedRightArm.showModel = slotType == 1; + modelbiped.bipedLeftArm.showModel = slotType == 1; + modelbiped.bipedRightLeg.showModel = slotType == 2 || slotType == 3; + modelbiped.bipedLeftLeg.showModel = slotType == 2 || slotType == 3; + modelbiped = net.minecraftforge.client.ForgeHooksClient.getArmorModel(playerAether.getEntity(), stack, slotType, modelbiped); renderPlayer.setRenderPassModel(modelbiped); modelbiped.onGround = renderPlayer.modelBipedMain.onGround; modelbiped.isRiding = renderPlayer.modelBipedMain.isRiding; @@ -88,17 +83,15 @@ public class PlayerAetherRenderer int j = itemarmor.getColorFromItemStack(stack, 0); - if (j != -1) - { - float f1 = (float)(j >> 16 & 255) / 255.0F; - float f2 = (float)(j >> 8 & 255) / 255.0F; - float f3 = (float)(j & 255) / 255.0F; + if (j != -1) { + float f1 = (float) (j >> 16 & 255) / 255.0F; + float f2 = (float) (j >> 8 & 255) / 255.0F; + float f3 = (float) (j & 255) / 255.0F; GL11.glColor3f(f1, f2, f3); } - if (stack.isItemEnchanted()) - { + if (stack.isItemEnchanted()) { return 15; } @@ -107,46 +100,40 @@ public class PlayerAetherRenderer } return -1; - } + } - public void renderAccessories(PlayerAether playerAether, RenderPlayer renderer, double x, double y, double z, float partialTicks) - { + public void renderAccessories(PlayerAether playerAether, RenderPlayer renderer, double x, double y, double z, float partialTicks) { GL11.glColor3f(1.0F, 1.0F, 1.0F); ItemStack itemstack = playerAether.getEntity().getCurrentEquippedItem(); this.modelMisc.heldItemRight = this.modelWings.heldItemRight = this.modelGlow.heldItemRight = itemstack != null ? 1 : 0; - if (itemstack != null && playerAether.getEntity().getItemInUseCount() > 0) - { + if (itemstack != null && playerAether.getEntity().getItemInUseCount() > 0) { EnumAction enumaction = itemstack.getItemUseAction(); - if (enumaction == EnumAction.block) - { + if (enumaction == EnumAction.block) { this.modelMisc.heldItemRight = this.modelWings.heldItemRight = this.modelGlow.heldItemRight = 3; - } - else if (enumaction == EnumAction.bow) - { + } else if (enumaction == EnumAction.bow) { this.modelMisc.aimedBow = this.modelWings.aimedBow = this.modelGlow.aimedBow = true; } } this.modelMisc.isSneak = this.modelWings.isSneak = this.modelWings.isSneak = playerAether.getEntity().isSneaking(); - this.doRender(playerAether, x, y, z, partialTicks); + this.doRender(playerAether, x, y, z, partialTicks); this.modelMisc.aimedBow = this.modelWings.aimedBow = this.modelGlow.aimedBow = false; this.modelMisc.isSneak = this.modelWings.isSneak = this.modelGlow.isSneak = false; this.modelMisc.heldItemRight = this.modelWings.heldItemRight = this.modelGlow.heldItemRight = 0; - } + } - private void doRender(PlayerAether playerAether, double x, double y, double z, float partialTicks) - { - EntityPlayer player = playerAether.getEntity(); + private void doRender(PlayerAether playerAether, double x, double y, double z, float partialTicks) { + EntityPlayer player = playerAether.getEntity(); - this.modelMisc.onGround = this.modelWings.onGround = this.modelGlow.onGround = playerAether.getEntity().getSwingProgress(partialTicks); - this.modelMisc.isRiding = this.modelWings.isRiding = this.modelGlow.isRiding = playerAether.getEntity().isRiding(); - this.modelMisc.isChild = this.modelWings.isChild = this.modelGlow.isChild = playerAether.getEntity().isChild(); + this.modelMisc.onGround = this.modelWings.onGround = this.modelGlow.onGround = playerAether.getEntity().getSwingProgress(partialTicks); + this.modelMisc.isRiding = this.modelWings.isRiding = this.modelGlow.isRiding = playerAether.getEntity().isRiding(); + this.modelMisc.isChild = this.modelWings.isChild = this.modelGlow.isChild = playerAether.getEntity().isChild(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); @@ -155,26 +142,22 @@ public class PlayerAetherRenderer float f3 = this.interpolateRotation(player.prevRotationYawHead, player.rotationYawHead, partialTicks); float f4; - if (player.isRiding() && player.ridingEntity instanceof EntityLivingBase) - { - EntityLivingBase entitylivingbase1 = (EntityLivingBase)player.ridingEntity; + if (player.isRiding() && player.ridingEntity instanceof EntityLivingBase) { + EntityLivingBase entitylivingbase1 = (EntityLivingBase) player.ridingEntity; f2 = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset, entitylivingbase1.renderYawOffset, partialTicks); f4 = MathHelper.wrapAngleTo180_float(f3 - f2); - if (f4 < -85.0F) - { + if (f4 < -85.0F) { f4 = -85.0F; } - if (f4 >= 85.0F) - { + if (f4 >= 85.0F) { f4 = 85.0F; } f2 = f3 - f4; - if (f4 * f4 > 2500.0F) - { + if (f4 * f4 > 2500.0F) { f2 += f4 * 0.2F; } } @@ -191,13 +174,11 @@ public class PlayerAetherRenderer float f6 = player.prevLimbSwingAmount + (player.limbSwingAmount - player.prevLimbSwingAmount) * partialTicks; float f7 = player.limbSwing - player.limbSwingAmount * (1.0F - partialTicks); - if (player.isChild()) - { + if (player.isChild()) { f7 *= 3.0F; } - if (f6 > 1.0F) - { + if (f6 > 1.0F) { f6 = 1.0F; } @@ -212,314 +193,267 @@ public class PlayerAetherRenderer GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); - } + } - private void renderModel(PlayerAether playerAether, float limbSwing, float prevLimbSwing, float rotation, float interpolateRotation, float prevRotationPitch, float scale, float partialTicks) - { - EntityPlayer player = playerAether.getEntity(); + private void renderModel(PlayerAether playerAether, float limbSwing, float prevLimbSwing, float rotation, float interpolateRotation, float prevRotationPitch, float scale, float partialTicks) { + EntityPlayer player = playerAether.getEntity(); - GL11.glPushMatrix(); + GL11.glPushMatrix(); - this.setCapeRendering(playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.CAPE) != null); + this.setCapeRendering(playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.CAPE) != null); - this.modelMisc.setRotationAngles(limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale, player); - this.modelWings.setRotationAngles(limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale, player); - this.modelHalo.setRotationAngles(limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale, player); + this.modelMisc.setRotationAngles(limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale, player); + this.modelWings.setRotationAngles(limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale, player); + this.modelHalo.setRotationAngles(limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale, player); this.modelGlow.setRotationAngles(limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale, player); - if (playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.PENDANT) != null) - { - ItemAccessory pendant = (ItemAccessory) playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.PENDANT).getItem(); + if (playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.PENDANT) != null) { + ItemAccessory pendant = (ItemAccessory) playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.PENDANT).getItem(); - this.mc.getTextureManager().bindTexture(pendant.texture); + this.mc.getTextureManager().bindTexture(pendant.texture); - int colour = pendant.getColorFromItemStack(new ItemStack(pendant, 1, 0), 1); - float red = ((colour >> 16) & 0xff) / 255F; - float green = ((colour >> 8) & 0xff) / 255F; - float blue = (colour & 0xff) / 255F; + int colour = pendant.getColorFromItemStack(new ItemStack(pendant, 1, 0), 1); + float red = ((colour >> 16) & 0xff) / 255F; + float green = ((colour >> 8) & 0xff) / 255F; + float blue = (colour & 0xff) / 255F; - if (player.hurtTime > 0) - { - GL11.glColor3f(1.0F, 0.5F, 0.5F); - } - else - { - GL11.glColor3f(red, green, blue); - } + if (player.hurtTime > 0) { + GL11.glColor3f(1.0F, 0.5F, 0.5F); + } else { + GL11.glColor3f(red, green, blue); + } - this.modelMisc.bipedBody.render(scale); + this.modelMisc.bipedBody.render(scale); - GL11.glColor3f(1.0F, 1.0F, 1.0F); - } + GL11.glColor3f(1.0F, 1.0F, 1.0F); + } GL11.glScalef(0.9375F, 0.9375F, 0.9375F); - if (playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.CAPE) != null && !playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) - { - ItemAccessory cape = (ItemAccessory) playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.CAPE).getItem(); + if (playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.CAPE) != null && !playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) { + ItemAccessory cape = (ItemAccessory) playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.CAPE).getItem(); - if (!player.isInvisible() && !player.getHideCape()) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 0.0F, 0.125F); - double d0 = player.field_71091_bM + (player.field_71094_bP - player.field_71091_bM) * (double)partialTicks - (player.prevPosX + (player.posX - player.prevPosX) * (double)partialTicks); - double d1 = player.field_71096_bN + (player.field_71095_bQ - player.field_71096_bN) * (double)partialTicks - (player.prevPosY + (player.posY - player.prevPosY) * (double)partialTicks); - double d2 = player.field_71097_bO + (player.field_71085_bR - player.field_71097_bO) * (double)partialTicks - (player.prevPosZ + (player.posZ - player.prevPosZ) * (double)partialTicks); - float f = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks; - double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); - double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); - float f1 = (float)d1 * 10.0F; - f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); - float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; - float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + if (!player.isInvisible() && !player.getHideCape()) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, 0.125F); + double d0 = player.field_71091_bM + (player.field_71094_bP - player.field_71091_bM) * (double) partialTicks - (player.prevPosX + (player.posX - player.prevPosX) * (double) partialTicks); + double d1 = player.field_71096_bN + (player.field_71095_bQ - player.field_71096_bN) * (double) partialTicks - (player.prevPosY + (player.posY - player.prevPosY) * (double) partialTicks); + double d2 = player.field_71097_bO + (player.field_71085_bR - player.field_71097_bO) * (double) partialTicks - (player.prevPosZ + (player.posZ - player.prevPosZ) * (double) partialTicks); + float f = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks; + double d3 = (double) MathHelper.sin(f * (float) Math.PI / 180.0F); + double d4 = (double) (-MathHelper.cos(f * (float) Math.PI / 180.0F)); + float f1 = (float) d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float) (d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float) (d0 * d4 - d2 * d3) * 100.0F; - if (f2 < 0.0F) - { - f2 = 0.0F; - } + if (f2 < 0.0F) { + f2 = 0.0F; + } - float f4 = player.prevCameraYaw + (player.cameraYaw - player.prevCameraYaw) * partialTicks; - f1 = f1 + MathHelper.sin((player.prevDistanceWalkedModified + (player.distanceWalkedModified - player.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + float f4 = player.prevCameraYaw + (player.cameraYaw - player.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((player.prevDistanceWalkedModified + (player.distanceWalkedModified - player.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; - if (player.isSneaking()) - { - f1 += 25.0F; - } + if (player.isSneaking()) { + f1 += 25.0F; + } - GL11.glRotatef(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(f3 / 2.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); - int colour = cape.getColorFromItemStack(playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.CAPE), 0); + int colour = cape.getColorFromItemStack(playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.CAPE), 0); - float red = ((colour >> 16) & 0xff) / 255F; - float green = ((colour >> 8) & 0xff) / 255F; - float blue = (colour & 0xff) / 255F; + float red = ((colour >> 16) & 0xff) / 255F; + float green = ((colour >> 8) & 0xff) / 255F; + float blue = (colour & 0xff) / 255F; - if (player.hurtTime > 0) - { - GL11.glColor3f(1.0F, 0.5F, 0.5F); - } - else - { - GL11.glColor3f(red, green, blue); - } + if (player.hurtTime > 0) { + GL11.glColor3f(1.0F, 0.5F, 0.5F); + } else { + GL11.glColor3f(red, green, blue); + } - if (player.getUniqueID().toString().equals("47ec3a3b-3f41-49b6-b5a0-c39abb7b51ef")) - { - this.mc.getTextureManager().bindTexture(Aether.locate("textures/armor/accessory_swuff.png")); - } - else - { - this.mc.getTextureManager().bindTexture(cape.texture); - } + if (player.getUniqueID().toString().equals("47ec3a3b-3f41-49b6-b5a0-c39abb7b51ef")) { + this.mc.getTextureManager().bindTexture(Aether.locate("textures/armor/accessory_swuff.png")); + } else { + this.mc.getTextureManager().bindTexture(cape.texture); + } - this.modelMisc.renderCloak(scale); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPopMatrix(); - } - } + this.modelMisc.renderCloak(scale); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + } - if (playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.GLOVES) != null) - { - ItemAccessory gloves = (ItemAccessory) playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.GLOVES).getItem(); + if (playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.GLOVES) != null) { + ItemAccessory gloves = (ItemAccessory) playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.GLOVES).getItem(); - this.mc.getTextureManager().bindTexture(gloves.texture); + this.mc.getTextureManager().bindTexture(gloves.texture); - int colour = gloves.getColorFromItemStack(playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.GLOVES), 0); - float red = ((colour >> 16) & 0xff) / 255F; - float green = ((colour >> 8) & 0xff) / 255F; - float blue = (colour & 0xff) / 255F; + int colour = gloves.getColorFromItemStack(playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.GLOVES), 0); + float red = ((colour >> 16) & 0xff) / 255F; + float green = ((colour >> 8) & 0xff) / 255F; + float blue = (colour & 0xff) / 255F; - if (player.hurtTime > 0) - { - GL11.glColor3f(1.0F, 0.5F, 0.5F); - } - else if (gloves != ItemsAether.phoenix_gloves) - { - GL11.glColor3f(red, green, blue); - } + if (player.hurtTime > 0) { + GL11.glColor3f(1.0F, 0.5F, 0.5F); + } else if (gloves != ItemsAether.phoenix_gloves) { + GL11.glColor3f(red, green, blue); + } - this.modelMisc.bipedLeftArm.render(scale); - this.modelMisc.bipedRightArm.render(scale); + this.modelMisc.bipedLeftArm.render(scale); + this.modelMisc.bipedRightArm.render(scale); - GL11.glColor3f(1.0F, 1.0F, 1.0F); - } + GL11.glColor3f(1.0F, 1.0F, 1.0F); + } - if (playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.SHIELD) != null) - { - ItemAccessory shield = (ItemAccessory) playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.SHIELD).getItem(); + if (playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.SHIELD) != null) { + ItemAccessory shield = (ItemAccessory) playerAether.getAccessoryInventory().getStackInSlot(AccessoryType.SHIELD).getItem(); - this.mc.getTextureManager().bindTexture(shield.texture); + this.mc.getTextureManager().bindTexture(shield.texture); - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glScalef(1.1F, 1.1F, 1.1F); + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glScalef(1.1F, 1.1F, 1.1F); - if (player.hurtResistantTime > 0) - { - GL11.glColor4f(1.0F, 0.5F, 0.5F, 1.0F); - } - else - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } + if (player.hurtResistantTime > 0) { + GL11.glColor4f(1.0F, 0.5F, 0.5F, 1.0F); + } else { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } - this.modelGlow.render(player, limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale); + this.modelGlow.render(player, limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - if (playerAether.getAccessoryInventory().isWearingValkyrieSet()) - { - this.mc.getTextureManager().bindTexture(TEXTURE_VALKYRIE); + if (playerAether.getAccessoryInventory().isWearingValkyrieSet()) { + this.mc.getTextureManager().bindTexture(TEXTURE_VALKYRIE); - this.modelWings.setWingSinage(playerAether.wingSinage); - this.modelWings.wingLeft.render(scale); - this.modelWings.wingRight.render(scale); + this.modelWings.setWingSinage(playerAether.wingSinage); + this.modelWings.wingLeft.render(scale); + this.modelWings.wingRight.render(scale); - if (player.hurtResistantTime > 0) - { - GL11.glColor3f(1.0F, 0.5F, 0.5F); - } - else - { - GL11.glColor3f(1.0F, 1.0F, 1.0F); - } - } + if (player.hurtResistantTime > 0) { + GL11.glColor3f(1.0F, 0.5F, 0.5F); + } else { + GL11.glColor3f(1.0F, 1.0F, 1.0F); + } + } - if (AetherRankings.isRankedPlayer(player.getUniqueID()) && PlayerAether.get(player).shouldRenderHalo) - { + if (AetherRankings.isRankedPlayer(player.getUniqueID()) && PlayerAether.get(player).shouldRenderHalo) { float f9 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * partialTicks - (player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks); - GL11.glPushMatrix(); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glRotatef(f9, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(prevRotationPitch, 1.0F, 0.0F, 0.0F); + GL11.glPushMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glRotatef(f9, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(prevRotationPitch, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, -0.65F, 0.0F); GL11.glRotatef(-prevRotationPitch, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-f9, 0.0F, 1.0F, 0.0F); - this.mc.getTextureManager().bindTexture(TEXTURE_HALO); + this.mc.getTextureManager().bindTexture(TEXTURE_HALO); - this.modelHalo.renderHalo(scale); - GL11.glPopMatrix(); - } + this.modelHalo.renderHalo(scale); + GL11.glPopMatrix(); + } - if (player.getUniqueID().toString().equals("cf51ef47-04a8-439a-aa41-47d871b0b837")) - { - this.mc.getTextureManager().bindTexture(((AbstractClientPlayer)player).getLocationSkin()); + if (player.getUniqueID().toString().equals("cf51ef47-04a8-439a-aa41-47d871b0b837")) { + this.mc.getTextureManager().bindTexture(((AbstractClientPlayer) player).getLocationSkin()); - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_NORMALIZE); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_NORMALIZE); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); - this.modelGlow.render(player, limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale); + this.modelGlow.render(player, limbSwing, prevLimbSwing, rotation, interpolateRotation, prevRotationPitch, scale); - GL11.glDisable(GL11.GL_NORMALIZE); + GL11.glDisable(GL11.GL_NORMALIZE); GL11.glDisable(GL11.GL_BLEND); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - GL11.glPopMatrix(); + GL11.glPopMatrix(); } - private void preRenderCallback(EntityLivingBase entity, float partialTicks) - { + private void preRenderCallback(EntityLivingBase entity, float partialTicks) { float f1 = 0.9375F; GL11.glScalef(f1, f1, f1); } - protected float getDeathMaxRotation(EntityLivingBase entity) - { + protected float getDeathMaxRotation(EntityLivingBase entity) { return 90.0F; } - private float handleRotationFloat(EntityLivingBase entity, float partialTicks) - { - return (float)entity.ticksExisted + partialTicks; + private float handleRotationFloat(EntityLivingBase entity, float partialTicks) { + return (float) entity.ticksExisted + partialTicks; } - private void renderLivingAt(EntityLivingBase entity, double x, double y, double z) - { - GL11.glTranslatef((float)x, (float)y, (float)z); + private void renderLivingAt(EntityLivingBase entity, double x, double y, double z) { + GL11.glTranslatef((float) x, (float) y, (float) z); } - protected void rotateCorpse(EntityLivingBase entity, float p_77043_2_, float p_77043_3_, float partialTicks) - { + protected void rotateCorpse(EntityLivingBase entity, float p_77043_2_, float p_77043_3_, float partialTicks) { GL11.glRotatef(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F); - if (entity.deathTime > 0) - { - float f3 = ((float)entity.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F; + if (entity.deathTime > 0) { + float f3 = ((float) entity.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F; f3 = MathHelper.sqrt_float(f3); - if (f3 > 1.0F) - { + if (f3 > 1.0F) { f3 = 1.0F; } GL11.glRotatef(f3 * this.getDeathMaxRotation(entity), 0.0F, 0.0F, 1.0F); - } - else - { + } else { String s = EnumChatFormatting.getTextWithoutFormattingCodes(entity.getCommandSenderName()); - if ((s.equals("Dinnerbone") || s.equals("Grumm")) && (!(entity instanceof EntityPlayer) || !((EntityPlayer)entity).getHideCape())) - { + if ((s.equals("Dinnerbone") || s.equals("Grumm")) && (!(entity instanceof EntityPlayer) || !((EntityPlayer) entity).getHideCape())) { GL11.glTranslatef(0.0F, entity.height + 0.1F, 0.0F); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); } } } - private float interpolateRotation(float p_77034_1_, float p_77034_2_, float p_77034_3_) - { + private float interpolateRotation(float p_77034_1_, float p_77034_2_, float p_77034_3_) { float f3; - for (f3 = p_77034_2_ - p_77034_1_; f3 < -180.0F; f3 += 360.0F) - { + for (f3 = p_77034_2_ - p_77034_1_; f3 < -180.0F; f3 += 360.0F) { ; } - while (f3 >= 180.0F) - { + while (f3 >= 180.0F) { f3 -= 360.0F; } return p_77034_1_ + p_77034_3_ * f3; } - public void setPartialTicks(float partialTicks) - { - this.partialTicks = partialTicks; - } + public void setPartialTicks(float partialTicks) { + this.partialTicks = partialTicks; + } - public float getPartialTicks() - { - return this.partialTicks; - } + public float getPartialTicks() { + return this.partialTicks; + } - private void setCapeRendering(boolean isRendering) - { - this.isCapeRendering = isRendering; - } + private void setCapeRendering(boolean isRendering) { + this.isCapeRendering = isRendering; + } - public boolean isCapeRendering() - { - return this.isCapeRendering; - } + public boolean isCapeRendering() { + return this.isCapeRendering; + } - public static PlayerAetherRenderer instance() - { - return instance; - } + public static PlayerAetherRenderer instance() { + return instance; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/SentryRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/SentryRenderer.java index 28127dc..ea0bb7d 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/SentryRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/SentryRenderer.java @@ -12,67 +12,57 @@ import org.lwjgl.opengl.GL11; import com.legacy.aether.Aether; import com.legacy.aether.entities.hostile.EntitySentry; -public class SentryRenderer extends RenderLiving -{ +public class SentryRenderer extends RenderLiving { - private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/sentry/sentry.png"); + private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/sentry/sentry.png"); - private static final ResourceLocation TEXTURE_LIT = Aether.locate("textures/entities/sentry/sentry_lit.png"); + private static final ResourceLocation TEXTURE_LIT = Aether.locate("textures/entities/sentry/sentry_lit.png"); - private static final ResourceLocation TEXTURE_EYE = Aether.locate("textures/entities/sentry/eye.png"); + private static final ResourceLocation TEXTURE_EYE = Aether.locate("textures/entities/sentry/eye.png"); - public SentryRenderer() - { - super(new ModelSlime(0), 0.3F); + public SentryRenderer() { + super(new ModelSlime(0), 0.3F); - this.setRenderPassModel(this.mainModel); - } + this.setRenderPassModel(this.mainModel); + } @Override - protected void preRenderCallback(EntityLivingBase entityliving, float f) - { - float f1 = 1.75F; - GL11.glScalef(f1, f1, f1); - } + protected void preRenderCallback(EntityLivingBase entityliving, float f) { + float f1 = 1.75F; + GL11.glScalef(f1, f1, f1); + } - protected int renderEyeGlow(EntitySentry entity, int pass, float particleTicks) - { - if (pass == 0 && entity.isAwake()) - { - this.bindTexture(TEXTURE_EYE); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + protected int renderEyeGlow(EntitySentry entity, int pass, float particleTicks) { + if (pass == 0 && entity.isAwake()) { + this.bindTexture(TEXTURE_EYE); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); - if (entity.isInvisible()) - { - GL11.glDepthMask(false); - } - else - { - GL11.glDepthMask(true); - } + if (entity.isInvisible()) { + GL11.glDepthMask(false); + } else { + GL11.glDepthMask(true); + } - char c0 = 61680; - int j = c0 % 65536; - int k = c0 / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - return 1; - } + char c0 = 61680; + int j = c0 % 65536; + int k = c0 / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + return 1; + } - return -1; - } + return -1; + } - @Override - protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) - { - return this.renderEyeGlow((EntitySentry)entity, pass, particleTicks); - } + @Override + protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) { + return this.renderEyeGlow((EntitySentry) entity, pass, particleTicks); + } - protected ResourceLocation getEntityTexture(Entity entity) - { - return !((EntitySentry)entity).isAwake() ? TEXTURE : TEXTURE_LIT; - } + protected ResourceLocation getEntityTexture(Entity entity) { + return !((EntitySentry) entity).isAwake() ? TEXTURE : TEXTURE_LIT; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/SheepuffRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/SheepuffRenderer.java index 3709899..2dab17c 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/SheepuffRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/SheepuffRenderer.java @@ -14,44 +14,34 @@ import com.legacy.aether.client.models.entities.SheepuffWoolModel; import com.legacy.aether.client.models.entities.SheepuffedModel; import com.legacy.aether.entities.passive.EntitySheepuff; -public class SheepuffRenderer extends RenderLiving -{ +public class SheepuffRenderer extends RenderLiving { - private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/sheepuff/sheepuff.png"); + private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/sheepuff/sheepuff.png"); private static final ResourceLocation TEXTURE_FUR = Aether.locate("textures/entities/sheepuff/fur.png"); - public SheepuffRenderer() - { - super(new SheepuffWoolModel(), 0.7F); - } + public SheepuffRenderer() { + super(new SheepuffWoolModel(), 0.7F); + } - protected int renderLayer(EntitySheepuff entity, int pass, float particleTicks) - { - if (entity.isInvisible()) - { + protected int renderLayer(EntitySheepuff entity, int pass, float particleTicks) { + if (entity.isInvisible()) { return 0; - } - else if (pass == 0 && !entity.getSheared()) - { + } else if (pass == 0 && !entity.getSheared()) { this.bindTexture(TEXTURE_FUR); this.setRenderPassModel(entity.getPuffed() ? new SheepuffedModel() : new SheepuffModel()); - if (this.renderPassModel != null) - { + if (this.renderPassModel != null) { this.renderPassModel.isChild = this.mainModel.isChild; } - if (entity.hasCustomNameTag() && "jeb_".equals(entity.getCustomNameTag())) - { + if (entity.hasCustomNameTag() && "jeb_".equals(entity.getCustomNameTag())) { int k = entity.ticksExisted / 25 + entity.getEntityId(); int l = k % EntitySheep.fleeceColorTable.length; int i1 = (k + 1) % EntitySheep.fleeceColorTable.length; - float f1 = ((float)(entity.ticksExisted % 25) + particleTicks) / 25.0F; + float f1 = ((float) (entity.ticksExisted % 25) + particleTicks) / 25.0F; GL11.glColor3f(EntitySheep.fleeceColorTable[l][0] * (1.0F - f1) + EntitySheep.fleeceColorTable[i1][0] * f1, EntitySheep.fleeceColorTable[l][1] * (1.0F - f1) + EntitySheep.fleeceColorTable[i1][1] * f1, EntitySheep.fleeceColorTable[l][2] * (1.0F - f1) + EntitySheep.fleeceColorTable[i1][2] * f1); - } - else - { + } else { int j = entity.getFleeceColor(); GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]); } @@ -63,15 +53,13 @@ public class SheepuffRenderer extends RenderLiving } @Override - protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) - { - return this.renderLayer((EntitySheepuff)entity, pass, particleTicks); + protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) { + return this.renderLayer((EntitySheepuff) entity, pass, particleTicks); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return TEXTURE; - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return TEXTURE; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/SliderRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/SliderRenderer.java index 3ad37b2..e8a7b63 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/SliderRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/SliderRenderer.java @@ -12,54 +12,45 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.SliderModel; import com.legacy.aether.entities.bosses.slider.EntitySlider; -public class SliderRenderer extends RenderLiving -{ +public class SliderRenderer extends RenderLiving { - private static final ResourceLocation TEXTURE_AWAKE_RED = Aether.locate("textures/bosses/slider/slider_awake_critical.png"); + private static final ResourceLocation TEXTURE_AWAKE_RED = Aether.locate("textures/bosses/slider/slider_awake_critical.png"); - private static final ResourceLocation TEXTURE_AWAKE = Aether.locate("textures/bosses/slider/slider_awake.png"); + private static final ResourceLocation TEXTURE_AWAKE = Aether.locate("textures/bosses/slider/slider_awake.png"); - private static final ResourceLocation TEXTURE_SLEEP = Aether.locate("textures/bosses/slider/slider_asleep.png"); + private static final ResourceLocation TEXTURE_SLEEP = Aether.locate("textures/bosses/slider/slider_asleep.png"); - private static final ResourceLocation TEXTURE_SLEEP_RED = Aether.locate("textures/bosses/slider/slider_asleep_critical.png"); + private static final ResourceLocation TEXTURE_SLEEP_RED = Aether.locate("textures/bosses/slider/slider_asleep_critical.png"); - private static final ResourceLocation TEXTURE_GLOW = Aether.locate("textures/bosses/slider/slider_awake_glow.png"); + private static final ResourceLocation TEXTURE_GLOW = Aether.locate("textures/bosses/slider/slider_awake_glow.png"); - private static final ResourceLocation TEXTURE_GLOW_RED = Aether.locate("textures/bosses/slider/slider_awake_critical_glow.png"); + private static final ResourceLocation TEXTURE_GLOW_RED = Aether.locate("textures/bosses/slider/slider_awake_critical_glow.png"); - public SliderRenderer() - { + public SliderRenderer() { super(new SliderModel(0.0F, 12.0F), 1.5F); this.setRenderPassModel(this.mainModel); } - protected int renderEyeGlow(EntitySlider slider, int pass, float particleTicks) - { - if (slider.isInvisible()) - { + protected int renderEyeGlow(EntitySlider slider, int pass, float particleTicks) { + if (slider.isInvisible()) { return 0; - } - else if (pass == 0 && slider.isAwake()) - { + } else if (pass == 0 && slider.isAwake()) { this.bindTexture(slider.criticalCondition() ? TEXTURE_GLOW_RED : TEXTURE_GLOW); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); - if (slider.isInvisible()) - { + if (slider.isInvisible()) { GL11.glDepthMask(false); - } - else - { + } else { GL11.glDepthMask(true); } char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); return 1; @@ -69,37 +60,32 @@ public class SliderRenderer extends RenderLiving } @Override - protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) - { - return this.renderEyeGlow((EntitySlider)entity, pass, particleTicks); + protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) { + return this.renderEyeGlow((EntitySlider) entity, pass, particleTicks); } - @Override - protected void preRenderCallback(EntityLivingBase entity, float f) - { - EntitySlider slider = (EntitySlider) entity; + @Override + protected void preRenderCallback(EntityLivingBase entity, float f) { + EntitySlider slider = (EntitySlider) entity; - ((SliderModel)this.mainModel).hurtAngle = slider.hurtAngle; - ((SliderModel)this.mainModel).hurtAngleX = slider.hurtAngleX; - ((SliderModel)this.mainModel).hurtAngleZ = slider.hurtAngleZ; - } - - protected void renderLivingAt(EntitySlider slider, double x, double y, double z) - { - super.renderLivingAt(slider, x, y, z); + ((SliderModel) this.mainModel).hurtAngle = slider.hurtAngle; + ((SliderModel) this.mainModel).hurtAngleX = slider.hurtAngleX; + ((SliderModel) this.mainModel).hurtAngleZ = slider.hurtAngleZ; } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - EntitySlider slider = (EntitySlider) entity; + protected void renderLivingAt(EntitySlider slider, double x, double y, double z) { + super.renderLivingAt(slider, x, y, z); + } - if (slider.isAwake()) - { - return slider.criticalCondition() ? TEXTURE_AWAKE_RED : TEXTURE_AWAKE; - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + EntitySlider slider = (EntitySlider) entity; - return slider.criticalCondition() ? TEXTURE_SLEEP_RED : TEXTURE_SLEEP; - } + if (slider.isAwake()) { + return slider.criticalCondition() ? TEXTURE_AWAKE_RED : TEXTURE_AWAKE; + } + + return slider.criticalCondition() ? TEXTURE_SLEEP_RED : TEXTURE_SLEEP; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/SunSpiritRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/SunSpiritRenderer.java index 8173634..6a9a613 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/SunSpiritRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/SunSpiritRenderer.java @@ -11,30 +11,26 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.SunSpiritModel; import com.legacy.aether.entities.bosses.sun_spirit.EntitySunSpirit; -public class SunSpiritRenderer extends RenderBiped -{ +public class SunSpiritRenderer extends RenderBiped { private static final ResourceLocation SPIRIT = Aether.locate("textures/bosses/sun_spirit/sun_spirit.png"); private static final ResourceLocation SPIRIT_FROZE = Aether.locate("textures/bosses/sun_spirit/frozen_sun_spirit.png"); - public SunSpiritRenderer() - { + public SunSpiritRenderer() { super(new SunSpiritModel(0.0F, 0.0F), 1.0F); this.shadowSize = 0.8F; } @Override - protected void preRenderCallback(EntityLivingBase spirit, float partialTickTime) - { - GL11.glTranslated(0.0D, 0.5D, 0.0D); + protected void preRenderCallback(EntityLivingBase spirit, float partialTickTime) { + GL11.glTranslated(0.0D, 0.5D, 0.0D); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return ((EntitySunSpirit)entity).isFreezing() ? SPIRIT_FROZE : SPIRIT; + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return ((EntitySunSpirit) entity).isFreezing() ? SPIRIT_FROZE : SPIRIT; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/SwetRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/SwetRenderer.java index 14317a6..67b57d9 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/SwetRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/SwetRenderer.java @@ -12,94 +12,74 @@ import com.legacy.aether.Aether; import com.legacy.aether.entities.hostile.swet.EnumSwetType; import com.legacy.aether.entities.passive.mountable.EntitySwet; -public class SwetRenderer extends RenderLiving -{ +public class SwetRenderer extends RenderLiving { - private static final ResourceLocation TEXTURE_BLUE = Aether.locate("textures/entities/swet/swet_blue.png"); + private static final ResourceLocation TEXTURE_BLUE = Aether.locate("textures/entities/swet/swet_blue.png"); - private static final ResourceLocation TEXTURE_GOLDEN = Aether.locate("textures/entities/swet/swet_golden.png"); + private static final ResourceLocation TEXTURE_GOLDEN = Aether.locate("textures/entities/swet/swet_golden.png"); - public SwetRenderer() - { + public SwetRenderer() { super(new ModelSlime(16), 0.3F); this.setRenderPassModel(new ModelSlime(0)); } - protected int renderEyeGlow(EntitySwet entity, int pass, float particleTicks) - { - if (entity.isInvisible()) - { - return 0; - } - else if (pass == 0) - { - GL11.glEnable(GL11.GL_NORMALIZE); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - return 1; - } - else - { - if (pass == 1) - { - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } + protected int renderEyeGlow(EntitySwet entity, int pass, float particleTicks) { + if (entity.isInvisible()) { + return 0; + } else if (pass == 0) { + GL11.glEnable(GL11.GL_NORMALIZE); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + return 1; + } else { + if (pass == 1) { + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } - return -1; - } - } + return -1; + } + } - protected void setupAnimation(EntitySwet swet, float f) - { - float f2 = 1.0F; - float f1 = 1.0F; - float f3 = 1.5F; + protected void setupAnimation(EntitySwet swet, float f) { + float f2 = 1.0F; + float f1 = 1.0F; + float f3 = 1.5F; - if(!swet.onGround && swet.worldObj.isRemote) - { - if(swet.motionY > 0.85D) - { - f1 = 1.425F; - f2 = 0.575F; - } - else if(swet.motionY < -0.85D) - { - f1 = 0.575F; - f2 = 1.425F; - } - else - { - float f4 = (float)swet.motionY * 0.5F; - f1 += f4; - f2 -= f4; - } - } + if (!swet.onGround && swet.worldObj.isRemote) { + if (swet.motionY > 0.85D) { + f1 = 1.425F; + f2 = 0.575F; + } else if (swet.motionY < -0.85D) { + f1 = 0.575F; + f2 = 1.425F; + } else { + float f4 = (float) swet.motionY * 0.5F; + f1 += f4; + f2 -= f4; + } + } - if(swet.riddenByEntity != null) - { - f3 = 1.5F + (swet.riddenByEntity.width + swet.riddenByEntity.height) * 2.0F; - } + if (swet.riddenByEntity != null) { + f3 = 1.5F + (swet.riddenByEntity.width + swet.riddenByEntity.height) * 2.0F; + } - GL11.glScalef(f2 * f3, f1 * f3, f2 * f3); - } - - @Override - protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) - { - return this.renderEyeGlow((EntitySwet)entity, pass, particleTicks); - } - - @Override - protected void preRenderCallback(EntityLivingBase swet, float f) - { - this.setupAnimation((EntitySwet) swet, f); - } + GL11.glScalef(f2 * f3, f1 * f3, f2 * f3); + } @Override - public ResourceLocation getEntityTexture(Entity swet) - { - return ((EntitySwet)swet).getSwetType() == EnumSwetType.BLUE ? TEXTURE_BLUE : TEXTURE_GOLDEN; + protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) { + return this.renderEyeGlow((EntitySwet) entity, pass, particleTicks); + } + + @Override + protected void preRenderCallback(EntityLivingBase swet, float f) { + this.setupAnimation((EntitySwet) swet, f); + } + + @Override + public ResourceLocation getEntityTexture(Entity swet) { + return ((EntitySwet) swet).getSwetType() == EnumSwetType.BLUE ? TEXTURE_BLUE : TEXTURE_GOLDEN; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/TNTPresentRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/TNTPresentRenderer.java index 0019c65..12246ef 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/TNTPresentRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/TNTPresentRenderer.java @@ -11,33 +11,27 @@ import org.lwjgl.opengl.GL11; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.entities.block.EntityTNTPresent; -public class TNTPresentRenderer extends Render -{ +public class TNTPresentRenderer extends Render { private RenderBlocks blockRenderer = new RenderBlocks(); - public TNTPresentRenderer() - { + public TNTPresentRenderer() { this.shadowSize = 0.5F; } - public void doRender(EntityTNTPresent p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { + public void doRender(EntityTNTPresent p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { GL11.glPushMatrix(); - GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_ + 0.48F, (float)p_76986_6_); + GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_ + 0.48F, (float) p_76986_6_); float f2; - if ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F < 10.0F) - { - f2 = 1.0F - ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F) / 10.0F; + if ((float) p_76986_1_.fuse - p_76986_9_ + 1.0F < 10.0F) { + f2 = 1.0F - ((float) p_76986_1_.fuse - p_76986_9_ + 1.0F) / 10.0F; - if (f2 < 0.0F) - { + if (f2 < 0.0F) { f2 = 0.0F; } - if (f2 > 1.0F) - { + if (f2 > 1.0F) { f2 = 1.0F; } @@ -47,12 +41,11 @@ public class TNTPresentRenderer extends Render GL11.glScalef(f3, f3, f3); } - f2 = (1.0F - ((float)p_76986_1_.fuse - p_76986_9_ + 1.0F) / 100.0F) * 0.8F; + f2 = (1.0F - ((float) p_76986_1_.fuse - p_76986_9_ + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(p_76986_1_); this.blockRenderer.renderBlockAsItem(BlocksAether.present, 0, p_76986_1_.getBrightness(p_76986_9_)); - if (p_76986_1_.fuse / 5 % 2 == 0) - { + if (p_76986_1_.fuse / 5 % 2 == 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); @@ -69,14 +62,12 @@ public class TNTPresentRenderer extends Render } @Override - public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { - this.doRender((EntityTNTPresent)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { + this.doRender((EntityTNTPresent) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } @Override - protected ResourceLocation getEntityTexture(Entity entity) - { + protected ResourceLocation getEntityTexture(Entity entity) { return TextureMap.locationBlocksTexture; } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/ValkyrieQueenRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/ValkyrieQueenRenderer.java index 2946faf..b7bb48a 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/ValkyrieQueenRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/ValkyrieQueenRenderer.java @@ -9,27 +9,23 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.ValkyrieModel; import com.legacy.aether.entities.bosses.valkyrie_queen.EntityValkyrieQueen; -public class ValkyrieQueenRenderer extends RenderLiving -{ +public class ValkyrieQueenRenderer extends RenderLiving { - private static final ResourceLocation TEXTURE = Aether.locate("textures/bosses/valkyrie_queen/valkyrie_queen.png"); + private static final ResourceLocation TEXTURE = Aether.locate("textures/bosses/valkyrie_queen/valkyrie_queen.png"); - public ValkyrieQueenRenderer() - { - super(new ValkyrieModel(), 0.3F); - } - - protected void preRenderCallback(EntityLivingBase valkyrie, float partialTickTime) - { - ((ValkyrieModel)this.mainModel).sinage = ((EntityValkyrieQueen)valkyrie).sinage; - ((ValkyrieModel)this.mainModel).gonRound = valkyrie.onGround; - ((ValkyrieModel)this.mainModel).halow = true; + public ValkyrieQueenRenderer() { + super(new ValkyrieModel(), 0.3F); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return TEXTURE; - } + protected void preRenderCallback(EntityLivingBase valkyrie, float partialTickTime) { + ((ValkyrieModel) this.mainModel).sinage = ((EntityValkyrieQueen) valkyrie).sinage; + ((ValkyrieModel) this.mainModel).gonRound = valkyrie.onGround; + ((ValkyrieModel) this.mainModel).halow = true; + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return TEXTURE; + } } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/ValkyrieRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/ValkyrieRenderer.java index 74d1b53..2a39984 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/ValkyrieRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/ValkyrieRenderer.java @@ -9,28 +9,24 @@ import com.legacy.aether.Aether; import com.legacy.aether.client.models.entities.ValkyrieModel; import com.legacy.aether.entities.bosses.EntityValkyrie; -public class ValkyrieRenderer extends RenderLiving -{ +public class ValkyrieRenderer extends RenderLiving { - private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/valkyrie/valkyrie.png"); + private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/valkyrie/valkyrie.png"); - public ValkyrieRenderer() - { - super(new ValkyrieModel(), 0.3F); - } - - @Override - protected void preRenderCallback(EntityLivingBase valkyrie, float partialTickTime) - { - ((ValkyrieModel)this.mainModel).sinage = ((EntityValkyrie)valkyrie).sinage; - ((ValkyrieModel)this.mainModel).gonRound = valkyrie.onGround; - ((ValkyrieModel)this.mainModel).halow = true; + public ValkyrieRenderer() { + super(new ValkyrieModel(), 0.3F); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return TEXTURE; - } + @Override + protected void preRenderCallback(EntityLivingBase valkyrie, float partialTickTime) { + ((ValkyrieModel) this.mainModel).sinage = ((EntityValkyrie) valkyrie).sinage; + ((ValkyrieModel) this.mainModel).gonRound = valkyrie.onGround; + ((ValkyrieModel) this.mainModel).halow = true; + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return TEXTURE; + } } diff --git a/src/main/java/com/legacy/aether/client/renders/entity/WhirlwindRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/WhirlwindRenderer.java index d73fe72..b77b035 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/WhirlwindRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/WhirlwindRenderer.java @@ -4,24 +4,20 @@ import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class WhirlwindRenderer extends Render -{ +public class WhirlwindRenderer extends Render { - public WhirlwindRenderer() - { - super(); - } + public WhirlwindRenderer() { + super(); + } - @Override - public void doRender(Entity entity, double renderX, double renderY, double renderZ, float p_76986_8_, float p_76986_9_) - { + @Override + public void doRender(Entity entity, double renderX, double renderY, double renderZ, float p_76986_8_, float p_76986_9_) { - } + } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return null; - } + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return null; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/ZephyrRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/ZephyrRenderer.java index a0773c5..7f813e1 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/ZephyrRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/ZephyrRenderer.java @@ -13,8 +13,7 @@ import com.legacy.aether.client.models.entities.OldZephyrModel; import com.legacy.aether.client.models.entities.ZephyrModel; import com.legacy.aether.entities.hostile.EntityZephyr; -public class ZephyrRenderer extends RenderLiving -{ +public class ZephyrRenderer extends RenderLiving { private static final ResourceLocation TEXTURE = Aether.locate("textures/entities/zephyr/zephyr_main.png"); @@ -22,17 +21,14 @@ public class ZephyrRenderer extends RenderLiving private static final ResourceLocation TEXTURE_OLD = Aether.locate("textures/entities/zephyr/zephyr_old.png"); - public ZephyrRenderer() - { - super(AetherConfig.oldMobsEnabled() ? new OldZephyrModel() : new ZephyrModel(), 0.5F); - } + public ZephyrRenderer() { + super(AetherConfig.oldMobsEnabled() ? new OldZephyrModel() : new ZephyrModel(), 0.5F); + } - protected void renderZephyrMovement(EntityZephyr zephyr, float partialTickTime) - { - float f1 = ((float)zephyr.shootingAI.prevAttackCounter + (float)(zephyr.shootingAI.attackCounter - zephyr.shootingAI.prevAttackCounter) * partialTickTime) / 20.0F; + protected void renderZephyrMovement(EntityZephyr zephyr, float partialTickTime) { + float f1 = ((float) zephyr.shootingAI.prevAttackCounter + (float) (zephyr.shootingAI.attackCounter - zephyr.shootingAI.prevAttackCounter) * partialTickTime) / 20.0F; - if (f1 < 0.0F) - { + if (f1 < 0.0F) { f1 = 0.0F; } @@ -43,32 +39,26 @@ public class ZephyrRenderer extends RenderLiving GL11.glScalef(f3, f2, f3); GL11.glTranslated(0.0D, 0.5D, 0.0D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - if (AetherConfig.oldMobsEnabled()) - { - GL11.glScalef(0.8F, 0.8F, 0.8F); - GL11.glTranslated(0.0D, -0.1D, 0.0D); + + if (AetherConfig.oldMobsEnabled()) { + GL11.glScalef(0.8F, 0.8F, 0.8F); + GL11.glTranslated(0.0D, -0.1D, 0.0D); } } - protected int renderLayers(EntityZephyr entity, int pass, float particleTicks) - { - if (entity.isInvisible()) - { + protected int renderLayers(EntityZephyr entity, int pass, float particleTicks) { + if (entity.isInvisible()) { return 0; - } - else if (pass == 1) - { - GL11.glEnable(GL11.GL_NORMALIZE); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } else if (pass == 1) { + GL11.glEnable(GL11.GL_NORMALIZE); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (this.renderPassModel != this.mainModel) - { - this.setRenderPassModel(this.mainModel); - } + if (this.renderPassModel != this.mainModel) { + this.setRenderPassModel(this.mainModel); + } - this.bindTexture(TEXTURE_ADDON); + this.bindTexture(TEXTURE_ADDON); return 1; } @@ -77,21 +67,18 @@ public class ZephyrRenderer extends RenderLiving } @Override - protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) - { - return this.renderLayers((EntityZephyr)entity, pass, particleTicks); + protected int shouldRenderPass(EntityLivingBase entity, int pass, float particleTicks) { + return this.renderLayers((EntityZephyr) entity, pass, particleTicks); } @Override - protected void preRenderCallback(EntityLivingBase zephyr, float partialTickTime) - { + protected void preRenderCallback(EntityLivingBase zephyr, float partialTickTime) { this.renderZephyrMovement((EntityZephyr) zephyr, partialTickTime); } - @Override - protected ResourceLocation getEntityTexture(Entity zephyr) - { - return AetherConfig.oldMobsEnabled() ? TEXTURE_OLD : TEXTURE; - } + @Override + protected ResourceLocation getEntityTexture(Entity zephyr) { + return AetherConfig.oldMobsEnabled() ? TEXTURE_OLD : TEXTURE; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/entity/ZephyrSnowballRenderer.java b/src/main/java/com/legacy/aether/client/renders/entity/ZephyrSnowballRenderer.java index f606551..6701bf2 100644 --- a/src/main/java/com/legacy/aether/client/renders/entity/ZephyrSnowballRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/entity/ZephyrSnowballRenderer.java @@ -14,18 +14,15 @@ import org.lwjgl.opengl.GL12; import com.legacy.aether.entities.projectile.EntityZephyrSnowball; -public class ZephyrSnowballRenderer extends Render -{ +public class ZephyrSnowballRenderer extends Render { - public ZephyrSnowballRenderer() - { - super(); - } + public ZephyrSnowballRenderer() { + super(); + } - public void doRenderFireball(EntityZephyrSnowball entity, double x, double y, double z, float entityYaw, float partialTicks) - { + public void doRenderFireball(EntityZephyrSnowball entity, double x, double y, double z, float entityYaw, float partialTicks) { GL11.glPushMatrix(); - GL11.glTranslatef((float)x, (float)y, (float)z); + GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(1.0F, 1.0F, 1.0F); this.bindEntityTexture(entity); @@ -34,8 +31,7 @@ public class ZephyrSnowballRenderer extends Render GL11.glPopMatrix(); } - private void renderItem(Tessellator p_77026_1_, IIcon p_77026_2_) - { + private void renderItem(Tessellator p_77026_1_, IIcon p_77026_2_) { float f = p_77026_2_.getMinU(); float f1 = p_77026_2_.getMaxU(); float f2 = p_77026_2_.getMinV(); @@ -47,23 +43,21 @@ public class ZephyrSnowballRenderer extends Render GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); p_77026_1_.startDrawingQuads(); p_77026_1_.setNormal(0.0F, 1.0F, 0.0F); - p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3); - p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3); - p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2); - p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2); + p_77026_1_.addVertexWithUV((double) (0.0F - f5), (double) (0.0F - f6), 0.0D, (double) f, (double) f3); + p_77026_1_.addVertexWithUV((double) (f4 - f5), (double) (0.0F - f6), 0.0D, (double) f1, (double) f3); + p_77026_1_.addVertexWithUV((double) (f4 - f5), (double) (f4 - f6), 0.0D, (double) f1, (double) f2); + p_77026_1_.addVertexWithUV((double) (0.0F - f5), (double) (f4 - f6), 0.0D, (double) f, (double) f2); p_77026_1_.draw(); } - @Override - public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) - { - this.doRenderFireball((EntityZephyrSnowball) entity, x, y, z, entityYaw, partialTicks); + @Override + public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) { + this.doRenderFireball((EntityZephyrSnowball) entity, x, y, z, entityYaw, partialTicks); } - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { + @Override + protected ResourceLocation getEntityTexture(Entity entity) { return TextureMap.locationItemsTexture; - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/renders/items/PhoenixBowRenderer.java b/src/main/java/com/legacy/aether/client/renders/items/PhoenixBowRenderer.java index 9f23458..0495197 100644 --- a/src/main/java/com/legacy/aether/client/renders/items/PhoenixBowRenderer.java +++ b/src/main/java/com/legacy/aether/client/renders/items/PhoenixBowRenderer.java @@ -5,32 +5,27 @@ import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; -public class PhoenixBowRenderer implements IItemRenderer -{ +public class PhoenixBowRenderer implements IItemRenderer { @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - if (type == ItemRenderType.EQUIPPED) - { - GL11.glTranslatef(-0.02F, -0.075F, 0.2125F); - GL11.glRotatef(10.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(30.0F, 1.0F, 0.0F, 0.0F); + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + if (type == ItemRenderType.EQUIPPED) { + GL11.glTranslatef(-0.02F, -0.075F, 0.2125F); + GL11.glRotatef(10.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(30.0F, 1.0F, 0.0F, 0.0F); } return false; } @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return false; } @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { } diff --git a/src/main/java/com/legacy/aether/entities/EntitiesAether.java b/src/main/java/com/legacy/aether/entities/EntitiesAether.java index ca8af75..d892914 100644 --- a/src/main/java/com/legacy/aether/entities/EntitiesAether.java +++ b/src/main/java/com/legacy/aether/entities/EntitiesAether.java @@ -48,21 +48,19 @@ import com.legacy.aether.items.ItemAetherSpawnEgg; import cpw.mods.fml.common.registry.EntityRegistry; -public class EntitiesAether -{ +public class EntitiesAether { - public static Map, String> classToStringMapping = new HashMap, String>(); + public static Map, String> classToStringMapping = new HashMap, String>(); - public static Map> IDtoClassMapping = new HashMap>(); + public static Map> IDtoClassMapping = new HashMap>(); private static Map, Integer> classToIDMapping = new HashMap, Integer>(); - private static Map stringToIDMapping = new HashMap(); + private static Map stringToIDMapping = new HashMap(); - private static final Logger logger = LogManager.getLogger(); + private static final Logger logger = LogManager.getLogger(); - public static void initialization() - { + public static void initialization() { register(EntityMoa.class, "moa", 0, 0x9fc3f7, 0x343e44); register(EntityPhyg.class, "phyg", 1, 0x9fc3f7, 0xdb635f); register(EntityFlyingCow.class, "flying_cow", 2, 0x9fc3f7, 0x3e3122); @@ -104,75 +102,60 @@ public class EntitiesAether AetherMoaTypes.initialization(); } - public static void register(Class entityClass, String entityName, int entityID, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates) - { + public static void register(Class entityClass, String entityName, int entityID, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates) { EntityRegistry.registerModEntity(entityClass, entityName, entityID, Aether.instance, trackingRange, updateFrequency, sendsVelocityUpdates); } - public static void register(Class entityClass, String entityName, int entityID, int primaryEggColor, int secondaryEggColor) - { + public static void register(Class entityClass, String entityName, int entityID, int primaryEggColor, int secondaryEggColor) { addMapping(entityClass, entityName, entityID, primaryEggColor, secondaryEggColor); EntityRegistry.registerModEntity(entityClass, entityName, entityID, Aether.instance, 80, 3, true); } - private static void addMapping(Class entityClass, String entityName, int entityID, int primaryEggColor, int secondaryEggColor) - { - if (IDtoClassMapping.containsKey(Integer.valueOf(entityID))) - { - throw new IllegalArgumentException("ID is already registered: " + entityID); - } - else - { - classToStringMapping.put(entityClass, entityName); - IDtoClassMapping.put(Integer.valueOf(entityID), entityClass); - classToIDMapping.put(entityClass, Integer.valueOf(entityID)); - stringToIDMapping.put(entityName, Integer.valueOf(entityID)); - ItemAetherSpawnEgg.entityEggs.put(Integer.valueOf(entityID), new EntityList.EntityEggInfo(entityID, primaryEggColor, secondaryEggColor)); - } - } + private static void addMapping(Class entityClass, String entityName, int entityID, int primaryEggColor, int secondaryEggColor) { + if (IDtoClassMapping.containsKey(Integer.valueOf(entityID))) { + throw new IllegalArgumentException("ID is already registered: " + entityID); + } else { + classToStringMapping.put(entityClass, entityName); + IDtoClassMapping.put(Integer.valueOf(entityID), entityClass); + classToIDMapping.put(entityClass, Integer.valueOf(entityID)); + stringToIDMapping.put(entityName, Integer.valueOf(entityID)); + ItemAetherSpawnEgg.entityEggs.put(Integer.valueOf(entityID), new EntityList.EntityEggInfo(entityID, primaryEggColor, secondaryEggColor)); + } + } - public static Entity createEntityByID(int id, World p_75616_1_) - { - Entity entity = null; + public static Entity createEntityByID(int id, World p_75616_1_) { + Entity entity = null; - try - { - Class oclass = getClassFromID(id); + try { + Class oclass = getClassFromID(id); - if (oclass != null) - { - entity = (Entity)oclass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {p_75616_1_}); - } - } - catch (Exception exception) - { - exception.printStackTrace(); - } + if (oclass != null) { + entity = (Entity) oclass.getConstructor(new Class[]{World.class}).newInstance(new Object[]{p_75616_1_}); + } + } catch (Exception exception) { + exception.printStackTrace(); + } - if (entity == null) - { - logger.warn("Skipping Aether Entity with id " + id); - } + if (entity == null) { + logger.warn("Skipping Aether Entity with id " + id); + } - return entity; - } + return entity; + } - public static int getEntityID(Entity p_75619_0_) - { - Class oclass = p_75619_0_.getClass(); - return classToIDMapping.containsKey(oclass) ? ((Integer)classToIDMapping.get(oclass)).intValue() : -1; - } + public static int getEntityID(Entity p_75619_0_) { + Class oclass = p_75619_0_.getClass(); + return classToIDMapping.containsKey(oclass) ? ((Integer) classToIDMapping.get(oclass)).intValue() : -1; + } - public static Class getClassFromID(int p_90035_0_) - { - return (Class)IDtoClassMapping.get(Integer.valueOf(p_90035_0_)); - } + public static Class getClassFromID(int p_90035_0_) { + return (Class) IDtoClassMapping.get(Integer.valueOf(p_90035_0_)); + } - public static String getStringFromID(int p_75617_0_) - { - Class oclass = getClassFromID(p_75617_0_); + public static String getStringFromID(int p_75617_0_) { + Class oclass = getClassFromID(p_75617_0_); - return oclass != null ? (String)classToStringMapping.get(oclass) : null; - } + return oclass != null ? (String) classToStringMapping.get(oclass) : null; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/ai/EntityAIAttackContinuously.java b/src/main/java/com/legacy/aether/entities/ai/EntityAIAttackContinuously.java index f13a927..53d3029 100644 --- a/src/main/java/com/legacy/aether/entities/ai/EntityAIAttackContinuously.java +++ b/src/main/java/com/legacy/aether/entities/ai/EntityAIAttackContinuously.java @@ -5,106 +5,89 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.player.EntityPlayer; -public class EntityAIAttackContinuously extends EntityAIBase -{ +public class EntityAIAttackContinuously extends EntityAIBase { - private EntityCreature attacker; + private EntityCreature attacker; - private int attackTick; + private int attackTick; - double speedTowardsTarget; + double speedTowardsTarget; - private double targetX; - private double targetY; - private double targetZ; + private double targetX; + private double targetY; + private double targetZ; - public EntityAIAttackContinuously(EntityCreature creature, double speedIn) - { - this.attacker = creature; - this.speedTowardsTarget = speedIn; + public EntityAIAttackContinuously(EntityCreature creature, double speedIn) { + this.attacker = creature; + this.speedTowardsTarget = speedIn; - this.setMutexBits(3); - } + this.setMutexBits(3); + } - @Override - public boolean shouldExecute() - { - EntityLivingBase entitylivingbase = (EntityLivingBase) this.attacker.getEntityToAttack(); + @Override + public boolean shouldExecute() { + EntityLivingBase entitylivingbase = (EntityLivingBase) this.attacker.getEntityToAttack(); - if (entitylivingbase == null) - { - return false; - } - else if (!entitylivingbase.isEntityAlive()) - { - return false; - } - else - { - return true; - } - } + if (entitylivingbase == null) { + return false; + } else if (!entitylivingbase.isEntityAlive()) { + return false; + } else { + return true; + } + } - @Override - public boolean continueExecuting() - { - EntityLivingBase entitylivingbase = (EntityLivingBase) this.attacker.getEntityToAttack(); - return entitylivingbase != null; - } + @Override + public boolean continueExecuting() { + EntityLivingBase entitylivingbase = (EntityLivingBase) this.attacker.getEntityToAttack(); + return entitylivingbase != null; + } - @Override - public void startExecuting() - { + @Override + public void startExecuting() { - } + } - @Override - public void resetTask() - { - EntityLivingBase entitylivingbase = (EntityLivingBase) this.attacker.getEntityToAttack(); + @Override + public void resetTask() { + EntityLivingBase entitylivingbase = (EntityLivingBase) this.attacker.getEntityToAttack(); - if (entitylivingbase instanceof EntityPlayer && ((EntityPlayer)entitylivingbase).capabilities.isCreativeMode) - { - this.attacker.setAttackTarget((EntityLivingBase)null); - } - } + if (entitylivingbase instanceof EntityPlayer && ((EntityPlayer) entitylivingbase).capabilities.isCreativeMode) { + this.attacker.setAttackTarget((EntityLivingBase) null); + } + } - @Override - public void updateTask() - { - EntityLivingBase entitylivingbase = (EntityLivingBase) this.attacker.getEntityToAttack(); + @Override + public void updateTask() { + EntityLivingBase entitylivingbase = (EntityLivingBase) this.attacker.getEntityToAttack(); - this.attacker.getNavigator().setPath(this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase), this.speedTowardsTarget); - this.attacker.getLookHelper().setLookPositionWithEntity(entitylivingbase, 360.0F, 360.0F); + this.attacker.getNavigator().setPath(this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase), this.speedTowardsTarget); + this.attacker.getLookHelper().setLookPositionWithEntity(entitylivingbase, 360.0F, 360.0F); - double d0 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ); + double d0 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ); - if (this.attacker.getEntitySenses().canSee(entitylivingbase) && (this.targetX == 0.0D && this.targetY == 0.0D && this.targetZ == 0.0D || entitylivingbase.getDistanceSq(this.targetX, this.targetY, this.targetZ) >= 1.0D || this.attacker.getRNG().nextFloat() < 0.05F)) - { - this.targetX = entitylivingbase.posX; - this.targetY = entitylivingbase.boundingBox.minY; - this.targetZ = entitylivingbase.posZ; - } + if (this.attacker.getEntitySenses().canSee(entitylivingbase) && (this.targetX == 0.0D && this.targetY == 0.0D && this.targetZ == 0.0D || entitylivingbase.getDistanceSq(this.targetX, this.targetY, this.targetZ) >= 1.0D || this.attacker.getRNG().nextFloat() < 0.05F)) { + this.targetX = entitylivingbase.posX; + this.targetY = entitylivingbase.boundingBox.minY; + this.targetZ = entitylivingbase.posZ; + } - this.attackTick = Math.max(this.attackTick - 1, 0); - this.checkAndPerformAttack(entitylivingbase, d0); - } + this.attackTick = Math.max(this.attackTick - 1, 0); + this.checkAndPerformAttack(entitylivingbase, d0); + } - protected void checkAndPerformAttack(EntityLivingBase p_190102_1_, double p_190102_2_) - { - double d0 = this.getAttackReachSqr(p_190102_1_); + protected void checkAndPerformAttack(EntityLivingBase p_190102_1_, double p_190102_2_) { + double d0 = this.getAttackReachSqr(p_190102_1_); - if (p_190102_2_ <= d0 && this.attackTick <= 0) - { - this.attackTick = 20; - this.attacker.swingItem(); - this.attacker.attackEntityAsMob(p_190102_1_); - } - } + if (p_190102_2_ <= d0 && this.attackTick <= 0) { + this.attackTick = 20; + this.attacker.swingItem(); + this.attacker.attackEntityAsMob(p_190102_1_); + } + } - protected double getAttackReachSqr(EntityLivingBase attackTarget) - { - return (double)(this.attacker.width * 2.0F * this.attacker.width * 2.0F + attackTarget.width); - } + protected double getAttackReachSqr(EntityLivingBase attackTarget) { + return (double) (this.attacker.width * 2.0F * this.attacker.width * 2.0F + attackTarget.width); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/ai/EntityAIUpdateState.java b/src/main/java/com/legacy/aether/entities/ai/EntityAIUpdateState.java index ec6066f..a97b400 100644 --- a/src/main/java/com/legacy/aether/entities/ai/EntityAIUpdateState.java +++ b/src/main/java/com/legacy/aether/entities/ai/EntityAIUpdateState.java @@ -3,68 +3,58 @@ package com.legacy.aether.entities.ai; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAIBase; -public class EntityAIUpdateState extends EntityAIBase -{ +public class EntityAIUpdateState extends EntityAIBase { private EntityLivingBase entity; - private boolean isStuckWarning = false; + private boolean isStuckWarning = false; - private long checkTime = 0L; + private long checkTime = 0L; - private double checkX; + private double checkX; - private double checkY; + private double checkY; - private double checkZ; + private double checkZ; - public EntityAIUpdateState(EntityLivingBase entity) - { + public EntityAIUpdateState(EntityLivingBase entity) { this.entity = entity; - this.setMutexBits(1); + this.setMutexBits(1); } @Override - public boolean isInterruptible() - { - return false; - } + public boolean isInterruptible() { + return false; + } @Override - public void updateTask() - { - long curtime = System.currentTimeMillis(); + public void updateTask() { + long curtime = System.currentTimeMillis(); - if (curtime > this.checkTime + 3000L) - { - double diffx = this.entity.posX - this.checkX; - double diffy = this.entity.posY - this.checkY; - double diffz = this.entity.posZ - this.checkZ; + if (curtime > this.checkTime + 3000L) { + double diffx = this.entity.posX - this.checkX; + double diffy = this.entity.posY - this.checkY; + double diffz = this.entity.posZ - this.checkZ; - double distanceTravelled = Math.sqrt((diffx * diffx) + (diffy * diffy) + (diffz * diffz)); + double distanceTravelled = Math.sqrt((diffx * diffx) + (diffy * diffy) + (diffz * diffz)); - if (distanceTravelled < 3D) - { - if (!this.isStuckWarning) - { - this.isStuckWarning = true; - } - else - { - this.entity.setDead(); - } - } + if (distanceTravelled < 3D) { + if (!this.isStuckWarning) { + this.isStuckWarning = true; + } else { + this.entity.setDead(); + } + } - this.checkX = this.entity.posX; - this.checkY = this.entity.posY; - this.checkZ = this.entity.posZ; - this.checkTime = curtime; - } - } + this.checkX = this.entity.posX; + this.checkY = this.entity.posY; + this.checkZ = this.entity.posZ; + this.checkTime = curtime; + } + } @Override - public boolean shouldExecute() - { + public boolean shouldExecute() { return !this.entity.isDead; } diff --git a/src/main/java/com/legacy/aether/entities/ai/SheepuffAIEatAetherGrass.java b/src/main/java/com/legacy/aether/entities/ai/SheepuffAIEatAetherGrass.java index cf5040d..2e5e82f 100644 --- a/src/main/java/com/legacy/aether/entities/ai/SheepuffAIEatAetherGrass.java +++ b/src/main/java/com/legacy/aether/entities/ai/SheepuffAIEatAetherGrass.java @@ -7,74 +7,60 @@ import net.minecraft.world.World; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.entities.passive.EntitySheepuff; -public class SheepuffAIEatAetherGrass extends EntityAIBase -{ +public class SheepuffAIEatAetherGrass extends EntityAIBase { - private EntitySheepuff sheepuff; + private EntitySheepuff sheepuff; - private World entityWorld; + private World entityWorld; - int eatingGrassTimer; + int eatingGrassTimer; - public SheepuffAIEatAetherGrass(EntitySheepuff sheepuff) - { - this.sheepuff = sheepuff; - this.entityWorld = sheepuff.worldObj; - this.setMutexBits(7); - } + public SheepuffAIEatAetherGrass(EntitySheepuff sheepuff) { + this.sheepuff = sheepuff; + this.entityWorld = sheepuff.worldObj; + this.setMutexBits(7); + } - public boolean shouldExecute() - { - if (this.sheepuff.getRNG().nextInt(1000) != 0) - { - return false; - } - else - { - return this.entityWorld.getBlock((int) this.sheepuff.posX, (int) this.sheepuff.posY - 1, (int) this.sheepuff.posZ) == BlocksAether.aether_grass; - } - } + public boolean shouldExecute() { + if (this.sheepuff.getRNG().nextInt(1000) != 0) { + return false; + } else { + return this.entityWorld.getBlock((int) this.sheepuff.posX, (int) this.sheepuff.posY - 1, (int) this.sheepuff.posZ) == BlocksAether.aether_grass; + } + } - public void startExecuting() - { - this.eatingGrassTimer = 40; - this.entityWorld.setEntityState(this.sheepuff, (byte)10); - this.sheepuff.getNavigator().clearPathEntity(); - } + public void startExecuting() { + this.eatingGrassTimer = 40; + this.entityWorld.setEntityState(this.sheepuff, (byte) 10); + this.sheepuff.getNavigator().clearPathEntity(); + } - public void resetTask() - { - this.eatingGrassTimer = 0; - } + public void resetTask() { + this.eatingGrassTimer = 0; + } - public boolean continueExecuting() - { - return this.eatingGrassTimer > 0; - } + public boolean continueExecuting() { + return this.eatingGrassTimer > 0; + } - public int getEatingGrassTimer() - { - return this.eatingGrassTimer; - } + public int getEatingGrassTimer() { + return this.eatingGrassTimer; + } - public void updateTask() - { - this.eatingGrassTimer = Math.max(0, this.eatingGrassTimer - 1); + public void updateTask() { + this.eatingGrassTimer = Math.max(0, this.eatingGrassTimer - 1); - if (this.eatingGrassTimer == 4) - { + if (this.eatingGrassTimer == 4) { - if (this.entityWorld.getBlock((int) this.sheepuff.posX, (int) this.sheepuff.posY - 1, (int) this.sheepuff.posZ) == BlocksAether.aether_grass) - { - if (this.entityWorld.getGameRules().getGameRuleBooleanValue("mobGriefing")) - { - this.entityWorld.playAuxSFX(2001, (int) this.sheepuff.posX, (int) this.sheepuff.posY - 1, (int) this.sheepuff.posZ, Block.getIdFromBlock(BlocksAether.aether_grass)); - this.entityWorld.setBlock((int) this.sheepuff.posX, (int) this.sheepuff.posY - 1, (int) this.sheepuff.posZ, BlocksAether.aether_dirt); - } + if (this.entityWorld.getBlock((int) this.sheepuff.posX, (int) this.sheepuff.posY - 1, (int) this.sheepuff.posZ) == BlocksAether.aether_grass) { + if (this.entityWorld.getGameRules().getGameRuleBooleanValue("mobGriefing")) { + this.entityWorld.playAuxSFX(2001, (int) this.sheepuff.posX, (int) this.sheepuff.posY - 1, (int) this.sheepuff.posZ, Block.getIdFromBlock(BlocksAether.aether_grass)); + this.entityWorld.setBlock((int) this.sheepuff.posX, (int) this.sheepuff.posY - 1, (int) this.sheepuff.posZ, BlocksAether.aether_dirt); + } - this.sheepuff.eatGrassBonus(); - } - } - } + this.sheepuff.eatGrassBonus(); + } + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/ai/aechorplant/AechorPlantAIShootPlayer.java b/src/main/java/com/legacy/aether/entities/ai/aechorplant/AechorPlantAIShootPlayer.java index c864455..14e29f2 100644 --- a/src/main/java/com/legacy/aether/entities/ai/aechorplant/AechorPlantAIShootPlayer.java +++ b/src/main/java/com/legacy/aether/entities/ai/aechorplant/AechorPlantAIShootPlayer.java @@ -6,73 +6,64 @@ import net.minecraft.world.EnumDifficulty; import com.legacy.aether.entities.hostile.EntityAechorPlant; import com.legacy.aether.entities.projectile.EntityPoisonNeedle; -public class AechorPlantAIShootPlayer extends EntityAIBase -{ +public class AechorPlantAIShootPlayer extends EntityAIBase { - private EntityAechorPlant shooter; + private EntityAechorPlant shooter; - private int reloadTime; + private int reloadTime; - public AechorPlantAIShootPlayer(EntityAechorPlant aechorplant) - { - this.shooter = aechorplant; - this.setMutexBits(4); - } + public AechorPlantAIShootPlayer(EntityAechorPlant aechorplant) { + this.shooter = aechorplant; + this.setMutexBits(4); + } - @Override - public boolean shouldExecute() - { - return !this.shooter.isDead && this.shooter.getEntityToAttack() != null; - } + @Override + public boolean shouldExecute() { + return !this.shooter.isDead && this.shooter.getEntityToAttack() != null; + } - @Override - public void updateTask() - { - double distanceToPlayer = this.shooter.getEntityToAttack().getDistanceToEntity(this.shooter); - double lookDistance = 5.5D + ((double)this.shooter.getSize() / 2D); + @Override + public void updateTask() { + double distanceToPlayer = this.shooter.getEntityToAttack().getDistanceToEntity(this.shooter); + double lookDistance = 5.5D + ((double) this.shooter.getSize() / 2D); - if(this.shooter.getEntityToAttack().isDead || distanceToPlayer > lookDistance) - { - this.shooter.setTarget(null); - this.reloadTime = 0; - } + if (this.shooter.getEntityToAttack().isDead || distanceToPlayer > lookDistance) { + this.shooter.setTarget(null); + this.reloadTime = 0; + } - if(this.reloadTime == 20 &&this.shooter.canEntityBeSeen(this.shooter.getEntityToAttack())) - { - this.shootAtPlayer(); - this.reloadTime = -10; - } + if (this.reloadTime == 20 && this.shooter.canEntityBeSeen(this.shooter.getEntityToAttack())) { + this.shootAtPlayer(); + this.reloadTime = -10; + } - if(this.reloadTime != 20) - { - ++this.reloadTime; - } - } + if (this.reloadTime != 20) { + ++this.reloadTime; + } + } - public void shootAtPlayer() - { - if(this.shooter.worldObj.difficultySetting.equals(EnumDifficulty.PEACEFUL)) - { - return; - } + public void shootAtPlayer() { + if (this.shooter.worldObj.difficultySetting.equals(EnumDifficulty.PEACEFUL)) { + return; + } - double x = this.shooter.getEntityToAttack().posX - this.shooter.posX; - double z = this.shooter.getEntityToAttack().posZ - this.shooter.posZ; - double y = 0.1D + (Math.sqrt((x * x) + (z * z) + 0.1D) * 0.5D) + ((this.shooter.posY - this.shooter.getEntityToAttack().posY) * 0.25D); + double x = this.shooter.getEntityToAttack().posX - this.shooter.posX; + double z = this.shooter.getEntityToAttack().posZ - this.shooter.posZ; + double y = 0.1D + (Math.sqrt((x * x) + (z * z) + 0.1D) * 0.5D) + ((this.shooter.posY - this.shooter.getEntityToAttack().posY) * 0.25D); - double distance = 1.5D / Math.sqrt((x * x) + (z * z) + 0.1D); + double distance = 1.5D / Math.sqrt((x * x) + (z * z) + 0.1D); - x = x * distance; - z = z * distance; + x = x * distance; + z = z * distance; - EntityPoisonNeedle poisonNeedle = new EntityPoisonNeedle(this.shooter.worldObj, this.shooter, 0.5F); + EntityPoisonNeedle poisonNeedle = new EntityPoisonNeedle(this.shooter.worldObj, this.shooter, 0.5F); - poisonNeedle.posY = this.shooter.posY + 1D; + poisonNeedle.posY = this.shooter.posY + 1D; this.shooter.playSound("random.bow", 1.0F, 1.2F / (this.shooter.getRNG().nextFloat() * 0.2F + 0.9F)); - this.shooter.worldObj.spawnEntityInWorld(poisonNeedle); + this.shooter.worldObj.spawnEntityInWorld(poisonNeedle); - poisonNeedle.setThrowableHeading(x, y, z, 0.285F + ((float)y * 0.05F), 1.0F); - } + poisonNeedle.setThrowableHeading(x, y, z, 0.285F + ((float) y * 0.05F), 1.0F); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/ai/aerbunny/AerbunnyAIHop.java b/src/main/java/com/legacy/aether/entities/ai/aerbunny/AerbunnyAIHop.java index 64be9bd..36b2c58 100644 --- a/src/main/java/com/legacy/aether/entities/ai/aerbunny/AerbunnyAIHop.java +++ b/src/main/java/com/legacy/aether/entities/ai/aerbunny/AerbunnyAIHop.java @@ -4,28 +4,23 @@ import net.minecraft.entity.ai.EntityAIBase; import com.legacy.aether.entities.passive.mountable.EntityAerbunny; -public class AerbunnyAIHop extends EntityAIBase -{ +public class AerbunnyAIHop extends EntityAIBase { private EntityAerbunny aerbunny; - public AerbunnyAIHop(EntityAerbunny aerbunny) - { + public AerbunnyAIHop(EntityAerbunny aerbunny) { this.aerbunny = aerbunny; this.setMutexBits(8); } - public boolean shouldExecute() - { + public boolean shouldExecute() { return this.aerbunny.motionZ > 0.0D || this.aerbunny.motionX > 0.0D || this.aerbunny.onGround; } - public void updateTask() - { - if (this.aerbunny.moveForward != 0.0F) - { - this.aerbunny.getJumpHelper().setJumping(); - } + public void updateTask() { + if (this.aerbunny.moveForward != 0.0F) { + this.aerbunny.getJumpHelper().setJumping(); + } } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/ai/aerwhale/AerwhaleAITravelCourse.java b/src/main/java/com/legacy/aether/entities/ai/aerwhale/AerwhaleAITravelCourse.java index 92124e0..119a065 100644 --- a/src/main/java/com/legacy/aether/entities/ai/aerwhale/AerwhaleAITravelCourse.java +++ b/src/main/java/com/legacy/aether/entities/ai/aerwhale/AerwhaleAITravelCourse.java @@ -10,35 +10,31 @@ import net.minecraft.world.World; import com.legacy.aether.entities.passive.EntityAerwhale; -public class AerwhaleAITravelCourse extends EntityAIBase -{ +public class AerwhaleAITravelCourse extends EntityAIBase { - private EntityAerwhale aerwhale; + private EntityAerwhale aerwhale; - private World worldObj; + private World worldObj; - private double motionYaw; + private double motionYaw; private double motionPitch; - private double origin_direction, westward_direction, eastward_direction, upward_direction, downward_direction; + private double origin_direction, westward_direction, eastward_direction, upward_direction, downward_direction; - public AerwhaleAITravelCourse(EntityAerwhale aerwhale) - { - this.aerwhale = aerwhale; - this.worldObj = aerwhale.worldObj; + public AerwhaleAITravelCourse(EntityAerwhale aerwhale) { + this.aerwhale = aerwhale; + this.worldObj = aerwhale.worldObj; this.setMutexBits(4); - } + } - @Override - public boolean shouldExecute() - { - return !this.aerwhale.isDead; - } + @Override + public boolean shouldExecute() { + return !this.aerwhale.isDead; + } - @Override - public void updateTask() - { + @Override + public void updateTask() { this.origin_direction = this.checkForTravelableCourse(0F, 0F); this.westward_direction = this.checkForTravelableCourse(45F, 0F); this.upward_direction = this.checkForTravelableCourse(0F, 45F); @@ -47,59 +43,43 @@ public class AerwhaleAITravelCourse extends EntityAIBase int course = this.getCorrectCourse(); - if (course == 0) - { - if(this.origin_direction == 50D) - { + if (course == 0) { + if (this.origin_direction == 50D) { this.motionYaw *= 0.9F; this.motionPitch *= 0.9F; - if(this.aerwhale.posY > 100) - { - this.motionPitch -= 2F; + if (this.aerwhale.posY > 100) { + this.motionPitch -= 2F; } - if(this.aerwhale.posY < 20) - { - this.motionPitch += 2F; + if (this.aerwhale.posY < 20) { + this.motionPitch += 2F; } + } else { + this.aerwhale.rotationPitch = -this.aerwhale.rotationPitch; + this.aerwhale.rotationYaw = -this.aerwhale.rotationYaw; } - else - { - this.aerwhale.rotationPitch = -this.aerwhale.rotationPitch; - this.aerwhale.rotationYaw = -this.aerwhale.rotationYaw; - } - } - else if (course == 1) - { - this.motionYaw += 5F; - } - else if (course == 2) - { - this.motionPitch -= 5F; - } - else if (course == 3) - { - this.motionYaw -= 5F; - } - else - { + } else if (course == 1) { + this.motionYaw += 5F; + } else if (course == 2) { + this.motionPitch -= 5F; + } else if (course == 3) { + this.motionYaw -= 5F; + } else { this.motionPitch += 5F; } this.motionYaw += 2F * this.aerwhale.getRNG().nextFloat() - 1F; - this.motionPitch += 2F * this.aerwhale.getRNG().nextFloat() - 1F; + this.motionPitch += 2F * this.aerwhale.getRNG().nextFloat() - 1F; this.aerwhale.rotationPitch += 0.1D * this.motionPitch; this.aerwhale.rotationYaw += 0.1D * this.motionYaw; - if(this.aerwhale.rotationPitch < -60F) - { - this.aerwhale.rotationPitch = -60F; + if (this.aerwhale.rotationPitch < -60F) { + this.aerwhale.rotationPitch = -60F; } - if(this.aerwhale.rotationPitch > 60F) - { - this.aerwhale.rotationPitch = 60F; + if (this.aerwhale.rotationPitch > 60F) { + this.aerwhale.rotationPitch = 60F; } this.aerwhale.rotationPitch *= 0.99D; @@ -116,67 +96,54 @@ public class AerwhaleAITravelCourse extends EntityAIBase int y = MathHelper.floor_double(this.aerwhale.boundingBox.minY); int z = MathHelper.floor_double(this.aerwhale.posZ); - if(this.aerwhale.motionX > 0D && this.worldObj.getBlock(x + 1, y, z) != Blocks.air) - { - this.aerwhale.motionX = -this.aerwhale.motionX; - this.motionYaw -= 10F; - } - else if(this.aerwhale.motionX < 0D && worldObj.getBlock(x - 1, y, z) != Blocks.air) - { - this.aerwhale.motionX = -this.aerwhale.motionX; - this.motionYaw += 10F; + if (this.aerwhale.motionX > 0D && this.worldObj.getBlock(x + 1, y, z) != Blocks.air) { + this.aerwhale.motionX = -this.aerwhale.motionX; + this.motionYaw -= 10F; + } else if (this.aerwhale.motionX < 0D && worldObj.getBlock(x - 1, y, z) != Blocks.air) { + this.aerwhale.motionX = -this.aerwhale.motionX; + this.motionYaw += 10F; } - if(this.aerwhale.motionY > 0D && this.worldObj.getBlock(x, y + 1, z) != Blocks.air) - { + if (this.aerwhale.motionY > 0D && this.worldObj.getBlock(x, y + 1, z) != Blocks.air) { this.aerwhale.motionY = -this.aerwhale.motionY; this.motionPitch -= 10F; - } - else if(this.aerwhale.motionY < 0D && this.worldObj.getBlock(x, y - 1, z) != Blocks.air) - { - this.aerwhale.motionY = -this.aerwhale.motionY; - this.motionPitch += 10F; + } else if (this.aerwhale.motionY < 0D && this.worldObj.getBlock(x, y - 1, z) != Blocks.air) { + this.aerwhale.motionY = -this.aerwhale.motionY; + this.motionPitch += 10F; } - if(this.aerwhale.motionZ > 0D && worldObj.getBlock(x, y, z + 1) != Blocks.air) - { - this.aerwhale.motionZ = -this.aerwhale.motionZ; - this.motionYaw -= 10F; - } - else if(this.aerwhale.motionZ < 0D && worldObj.getBlock(x, y, z - 1) != Blocks.air) - { - this.aerwhale.motionZ = -this.aerwhale.motionZ; - this.motionYaw += 10F; + if (this.aerwhale.motionZ > 0D && worldObj.getBlock(x, y, z + 1) != Blocks.air) { + this.aerwhale.motionZ = -this.aerwhale.motionZ; + this.motionYaw -= 10F; + } else if (this.aerwhale.motionZ < 0D && worldObj.getBlock(x, y, z - 1) != Blocks.air) { + this.aerwhale.motionZ = -this.aerwhale.motionZ; + this.motionYaw += 10F; } - // System.out.println(this.aerwhale.motionY); + // System.out.println(this.aerwhale.motionY); //this.aerwhale.moveEntityWithHeading(this.aerwhale.moveStrafing, this.aerwhale.moveForward); //this.aerwhale.moveFlying(p_70060_1_, p_70060_2_, p_70060_3_); - this.aerwhale.moveFlying((float)this.aerwhale.motionX, (float)this.aerwhale.motionY, (float)this.aerwhale.motionZ); + this.aerwhale.moveFlying((float) this.aerwhale.motionX, (float) this.aerwhale.motionY, (float) this.aerwhale.motionZ); } - private int getCorrectCourse() - { - double[] distances = new double [] {this.origin_direction, this.westward_direction, this.upward_direction, this.eastward_direction, this.downward_direction}; + private int getCorrectCourse() { + double[] distances = new double[]{this.origin_direction, this.westward_direction, this.upward_direction, this.eastward_direction, this.downward_direction}; int correctCourse = 0; - for(int i = 1; i < 5; i++) - { - if(distances[i] > distances[correctCourse]) - { - correctCourse = i; + for (int i = 1; i < 5; i++) { + if (distances[i] > distances[correctCourse]) { + correctCourse = i; } } return correctCourse; - } + } + + private double checkForTravelableCourse(float rotationYawOffset, float rotationPitchOffset) { + double standard = 50D; - private double checkForTravelableCourse(float rotationYawOffset, float rotationPitchOffset) - { - double standard = 50D; - float yaw = this.aerwhale.rotationYaw + rotationYawOffset; float pitch = this.aerwhale.rotationYaw + rotationYawOffset; @@ -190,17 +157,15 @@ public class AerwhaleAITravelCourse extends EntityAIBase float f9 = f3 * f5; Vec3 vec3d = Vec3.createVectorHelper(this.aerwhale.posX, this.aerwhale.boundingBox.minY, this.aerwhale.posZ); - Vec3 vec3d1 = vec3d.addVector((double)f7 * standard, (double)f8 * standard, (double)f9 * standard); + Vec3 vec3d1 = vec3d.addVector((double) f7 * standard, (double) f8 * standard, (double) f9 * standard); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3d, vec3d1, true); - if(movingobjectposition == null) - { + if (movingobjectposition == null) { return standard; } - if(movingobjectposition.typeOfHit == MovingObjectType.BLOCK) - { + if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK) { double i = movingobjectposition.blockX - this.aerwhale.posX; double j = movingobjectposition.blockY - this.aerwhale.boundingBox.minY; double k = movingobjectposition.blockZ - this.aerwhale.posZ; diff --git a/src/main/java/com/legacy/aether/entities/ai/valkyrie_queen/ValkyrieQueenAIWander.java b/src/main/java/com/legacy/aether/entities/ai/valkyrie_queen/ValkyrieQueenAIWander.java index 123c23b..21565da 100644 --- a/src/main/java/com/legacy/aether/entities/ai/valkyrie_queen/ValkyrieQueenAIWander.java +++ b/src/main/java/com/legacy/aether/entities/ai/valkyrie_queen/ValkyrieQueenAIWander.java @@ -4,22 +4,19 @@ import net.minecraft.entity.ai.EntityAIWander; import com.legacy.aether.entities.bosses.valkyrie_queen.EntityValkyrieQueen; -public class ValkyrieQueenAIWander extends EntityAIWander -{ +public class ValkyrieQueenAIWander extends EntityAIWander { - private EntityValkyrieQueen theQueen; + private EntityValkyrieQueen theQueen; - public ValkyrieQueenAIWander(EntityValkyrieQueen creatureIn, double speedIn) - { - super(creatureIn, speedIn); + public ValkyrieQueenAIWander(EntityValkyrieQueen creatureIn, double speedIn) { + super(creatureIn, speedIn); - this.theQueen = creatureIn; - } + this.theQueen = creatureIn; + } - @Override - public boolean shouldExecute() - { - return super.shouldExecute() && this.theQueen.isBossReady(); + @Override + public boolean shouldExecute() { + return super.shouldExecute() && this.theQueen.isBossReady(); } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/ai/zephyr/ZephyrAIShootTarget.java b/src/main/java/com/legacy/aether/entities/ai/zephyr/ZephyrAIShootTarget.java index 23dd369..85b0048 100644 --- a/src/main/java/com/legacy/aether/entities/ai/zephyr/ZephyrAIShootTarget.java +++ b/src/main/java/com/legacy/aether/entities/ai/zephyr/ZephyrAIShootTarget.java @@ -8,95 +8,79 @@ import net.minecraft.world.World; import com.legacy.aether.entities.hostile.EntityZephyr; import com.legacy.aether.entities.projectile.EntityZephyrSnowball; -public class ZephyrAIShootTarget extends EntityAIBase -{ +public class ZephyrAIShootTarget extends EntityAIBase { - private EntityZephyr zephyr; + private EntityZephyr zephyr; - private World worldObj; + private World worldObj; - private final float base; + private final float base; - public int prevAttackCounter; + public int prevAttackCounter; - public int attackCounter; + public int attackCounter; - public ZephyrAIShootTarget(EntityZephyr zephyr) - { - this.zephyr = zephyr; - this.worldObj = zephyr.worldObj; - this.attackCounter = 0; - this.base = (this.zephyr.getRNG().nextFloat() - this.zephyr.getRNG().nextFloat()) * 0.2F + 1.0F; - this.setMutexBits(4); - } + public ZephyrAIShootTarget(EntityZephyr zephyr) { + this.zephyr = zephyr; + this.worldObj = zephyr.worldObj; + this.attackCounter = 0; + this.base = (this.zephyr.getRNG().nextFloat() - this.zephyr.getRNG().nextFloat()) * 0.2F + 1.0F; + this.setMutexBits(4); + } - @Override - public boolean shouldExecute() - { - return !this.zephyr.isDead; - } + @Override + public boolean shouldExecute() { + return !this.zephyr.isDead; + } - @Override - public void updateTask() - { - this.prevAttackCounter = this.attackCounter; + @Override + public void updateTask() { + this.prevAttackCounter = this.attackCounter; - if(this.zephyr.getAttackTarget() == null) - { - if(this.attackCounter > 0) - { - this.attackCounter--; + if (this.zephyr.getAttackTarget() == null) { + if (this.attackCounter > 0) { + this.attackCounter--; } - this.zephyr.setAttackTarget(this.worldObj.getClosestVulnerablePlayerToEntity(this.zephyr, 100D)); - } - else - { - if (this.zephyr.getAttackTarget() instanceof EntityPlayer && (((EntityPlayer)this.zephyr.getAttackTarget()).capabilities.isCreativeMode)) - { - this.zephyr.setAttackTarget(null); - return; - } + this.zephyr.setAttackTarget(this.worldObj.getClosestVulnerablePlayerToEntity(this.zephyr, 100D)); + } else { + if (this.zephyr.getAttackTarget() instanceof EntityPlayer && (((EntityPlayer) this.zephyr.getAttackTarget()).capabilities.isCreativeMode)) { + this.zephyr.setAttackTarget(null); + return; + } - if (this.zephyr.getAttackTarget().getDistanceSqToEntity(this.zephyr) < 4096.0D && this.zephyr.canEntityBeSeen(this.zephyr.getAttackTarget())) - { + if (this.zephyr.getAttackTarget().getDistanceSqToEntity(this.zephyr) < 4096.0D && this.zephyr.canEntityBeSeen(this.zephyr.getAttackTarget())) { double x = this.zephyr.getAttackTarget().posX - this.zephyr.posX; double y = (this.zephyr.getAttackTarget().boundingBox.minY + (this.zephyr.getAttackTarget().height / 2.0F)) - (this.zephyr.posY + (this.zephyr.height / 2.0F)); double z = this.zephyr.getAttackTarget().posZ - this.zephyr.posZ; - this.zephyr.rotationYaw = (-(float)Math.atan2(x, z) * 180F) / 3.141593F; + this.zephyr.rotationYaw = (-(float) Math.atan2(x, z) * 180F) / 3.141593F; ++this.attackCounter; - if(this.attackCounter == 10) - { - this.zephyr.playSound("aether_legacy:aemob.zephyr.call", 3F, this.base); - } - else if(this.attackCounter == 20) - { - this.zephyr.playSound("aether_legacy:aemob.zephyr.call", 3F, this.base); + if (this.attackCounter == 10) { + this.zephyr.playSound("aether_legacy:aemob.zephyr.call", 3F, this.base); + } else if (this.attackCounter == 20) { + this.zephyr.playSound("aether_legacy:aemob.zephyr.call", 3F, this.base); EntityZephyrSnowball projectile = new EntityZephyrSnowball(this.worldObj, this.zephyr, x, y, z); Vec3 lookVector = this.zephyr.getLook(1.0F); projectile.posX = this.zephyr.posX + lookVector.xCoord * 4D; - projectile.posY = this.zephyr.posY + (double)(this.zephyr.height / 2.0F) + 0.5D; + projectile.posY = this.zephyr.posY + (double) (this.zephyr.height / 2.0F) + 0.5D; projectile.posZ = this.zephyr.posZ + lookVector.zCoord * 4D; - if (!this.worldObj.isRemote) - { - projectile.setThrowableHeading(x, y, z, 1.2F, 1.0F); + if (!this.worldObj.isRemote) { + projectile.setThrowableHeading(x, y, z, 1.2F, 1.0F); this.worldObj.spawnEntityInWorld(projectile); } this.attackCounter = -40; } - } - else if (this.attackCounter > 0) - { - this.attackCounter--; - } + } else if (this.attackCounter > 0) { + this.attackCounter--; + } } - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/ai/zephyr/ZephyrAITravelCourse.java b/src/main/java/com/legacy/aether/entities/ai/zephyr/ZephyrAITravelCourse.java index 53e7357..0ec3ed9 100644 --- a/src/main/java/com/legacy/aether/entities/ai/zephyr/ZephyrAITravelCourse.java +++ b/src/main/java/com/legacy/aether/entities/ai/zephyr/ZephyrAITravelCourse.java @@ -6,77 +6,65 @@ import net.minecraft.util.MathHelper; import com.legacy.aether.entities.hostile.EntityZephyr; -public class ZephyrAITravelCourse extends EntityAIBase -{ +public class ZephyrAITravelCourse extends EntityAIBase { - private EntityZephyr zephyr; + private EntityZephyr zephyr; public int courseCooldown; public double waypointX, waypointY, waypointZ; - public ZephyrAITravelCourse(EntityZephyr zephyr) - { - this.zephyr = zephyr; - this.setMutexBits(2); + public ZephyrAITravelCourse(EntityZephyr zephyr) { + this.zephyr = zephyr; + this.setMutexBits(2); } - @Override - public boolean shouldExecute() - { - return !this.zephyr.isDead; - } + @Override + public boolean shouldExecute() { + return !this.zephyr.isDead; + } - @Override - public void updateTask() - { + @Override + public void updateTask() { double x = this.waypointX - this.zephyr.posX; double y = this.waypointY - this.zephyr.posY; double z = this.waypointZ - this.zephyr.posZ; double distance = MathHelper.sqrt_double(x * x + y * y + z * z); - if(distance < 1.0D || distance > 60D) - { - this.waypointX = this.zephyr.posX + ((this.zephyr.getRNG().nextFloat() * 2.0F - 1.0F) * 16F); - this.waypointY = this.zephyr.posY + ((this.zephyr.getRNG().nextFloat() * 2.0F - 1.0F) * 16F); - this.waypointZ = this.zephyr.posZ + ((this.zephyr.getRNG().nextFloat() * 2.0F - 1.0F) * 16F); + if (distance < 1.0D || distance > 60D) { + this.waypointX = this.zephyr.posX + ((this.zephyr.getRNG().nextFloat() * 2.0F - 1.0F) * 16F); + this.waypointY = this.zephyr.posY + ((this.zephyr.getRNG().nextFloat() * 2.0F - 1.0F) * 16F); + this.waypointZ = this.zephyr.posZ + ((this.zephyr.getRNG().nextFloat() * 2.0F - 1.0F) * 16F); } - if(this.courseCooldown-- <= 0) - { - this.courseCooldown += this.zephyr.getRNG().nextInt(5) + 2; + if (this.courseCooldown-- <= 0) { + this.courseCooldown += this.zephyr.getRNG().nextInt(5) + 2; - if(isCourseTraversable(distance)) - { - this.zephyr.motionX += (x / distance) * 0.10000000000000001D; - this.zephyr.motionY += (y / distance) * 0.10000000000000001D; - this.zephyr.motionZ += (z / distance) * 0.10000000000000001D; - } - else - { - this.waypointX = this.zephyr.posX; - this.waypointY = this.zephyr.posY; - this.waypointZ = this.zephyr.posZ; + if (isCourseTraversable(distance)) { + this.zephyr.motionX += (x / distance) * 0.10000000000000001D; + this.zephyr.motionY += (y / distance) * 0.10000000000000001D; + this.zephyr.motionZ += (z / distance) * 0.10000000000000001D; + } else { + this.waypointX = this.zephyr.posX; + this.waypointY = this.zephyr.posY; + this.waypointZ = this.zephyr.posZ; } } - } + } - private boolean isCourseTraversable(double distance) - { + private boolean isCourseTraversable(double distance) { double x = (this.waypointX - this.zephyr.posX) / distance; double y = (this.waypointY - this.zephyr.posY) / distance; double z = (this.waypointZ - this.zephyr.posZ) / distance; AxisAlignedBB axisalignedbb = this.zephyr.boundingBox.copy(); - for(int i = 1; (double)i < distance; i++) - { + for (int i = 1; (double) i < distance; i++) { axisalignedbb.offset(x, y, z); - if(this.zephyr.worldObj.getCollidingBoundingBoxes(this.zephyr, axisalignedbb).size() > 0) - { + if (this.zephyr.worldObj.getCollidingBoundingBoxes(this.zephyr, axisalignedbb).size() > 0) { return false; } } diff --git a/src/main/java/com/legacy/aether/entities/block/EntityFloatingBlock.java b/src/main/java/com/legacy/aether/entities/block/EntityFloatingBlock.java index 5b2d897..c9f7ffe 100644 --- a/src/main/java/com/legacy/aether/entities/block/EntityFloatingBlock.java +++ b/src/main/java/com/legacy/aether/entities/block/EntityFloatingBlock.java @@ -16,8 +16,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; -public class EntityFloatingBlock extends Entity implements IEntityAdditionalSpawnData -{ +public class EntityFloatingBlock extends Entity implements IEntityAdditionalSpawnData { private Block block = Blocks.air; @@ -25,157 +24,133 @@ public class EntityFloatingBlock extends Entity implements IEntityAdditionalSpaw private int timeFloated = 0; - public EntityFloatingBlock(World worldIn) - { + public EntityFloatingBlock(World worldIn) { super(worldIn); - this.setSize(0.98F, 0.98F); + this.setSize(0.98F, 0.98F); } - public EntityFloatingBlock(World world, int x, int y, int z, Block block, int meta) - { + public EntityFloatingBlock(World world, int x, int y, int z, Block block, int meta) { super(world); this.meta = meta; this.block = block; - this.preventEntitySpawning = true; + this.preventEntitySpawning = true; this.motionX = this.motionY = this.motionZ = 0; - this.setSize(0.98F, 0.98F); + this.setSize(0.98F, 0.98F); this.setPosition(x + 0.5D, y, z + 0.5D); } @Override - protected void entityInit() - { + protected void entityInit() { } @Override - public void onUpdate() - { - if (this.getBlock() == null || this.getBlock() == Blocks.air) - { - this.setDead(); - return; - } + public void onUpdate() { + if (this.getBlock() == null || this.getBlock() == Blocks.air) { + this.setDead(); + return; + } - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - ++this.timeFloated; - this.motionY += 0.04D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.9800000190734863D; - this.motionY *= 0.9800000190734863D; - this.motionZ *= 0.9800000190734863D; - Block block = this.getBlock(); - int i = MathHelper.floor_double(this.posX); - int j = MathHelper.floor_double(this.posY); - int k = MathHelper.floor_double(this.posZ); + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + ++this.timeFloated; + this.motionY += 0.04D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + Block block = this.getBlock(); + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY); + int k = MathHelper.floor_double(this.posZ); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.0D, 1.0D, 0.0D)); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.0D, 1.0D, 0.0D)); - for (int stack = 0; stack < list.size(); ++stack) - { - Entity entity = (Entity) list.get(stack); + for (int stack = 0; stack < list.size(); ++stack) { + Entity entity = (Entity) list.get(stack); - if (entity instanceof EntityFallingBlock && block.canPlaceBlockAt(this.worldObj, i, j, k)) - { - this.worldObj.setBlock(i, j + 1, k, this.getBlock(), this.getMetadata(), 2); - this.setDead(); - } - else if (AetherConfig.shouldFloatWithBlock()) - { - entity.setPosition(entity.posX, this.posY + 2.6D, entity.posZ); - entity.motionY = 0.0D; - entity.onGround = true; - entity.fallDistance = 0.0F; - } - } + if (entity instanceof EntityFallingBlock && block.canPlaceBlockAt(this.worldObj, i, j, k)) { + this.worldObj.setBlock(i, j + 1, k, this.getBlock(), this.getMetadata(), 2); + this.setDead(); + } else if (AetherConfig.shouldFloatWithBlock()) { + entity.setPosition(entity.posX, this.posY + 2.6D, entity.posZ); + entity.motionY = 0.0D; + entity.onGround = true; + entity.fallDistance = 0.0F; + } + } - if (this.isCollidedVertically && !this.onGround) - { - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; - this.motionY *= -0.5D; - this.setDead(); + if (this.isCollidedVertically && !this.onGround) { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + this.motionY *= -0.5D; + this.setDead(); - if (!block.canPlaceBlockAt(this.worldObj, i, j, k) || BlockFloating.canContinue(this.worldObj, i, j + 1, k) || !this.worldObj.setBlock(i, j, k, this.getBlock(), this.getMetadata(), 2)) - { - block.dropBlockAsItem(this.worldObj, i, j, k, this.getMetadata(), 0); - } - } - else if (this.timeFloated > 100) - { - block.dropBlockAsItem(this.worldObj, i, j, k, this.getMetadata(), 0); + if (!block.canPlaceBlockAt(this.worldObj, i, j, k) || BlockFloating.canContinue(this.worldObj, i, j + 1, k) || !this.worldObj.setBlock(i, j, k, this.getBlock(), this.getMetadata(), 2)) { + block.dropBlockAsItem(this.worldObj, i, j, k, this.getMetadata(), 0); + } + } else if (this.timeFloated > 100) { + block.dropBlockAsItem(this.worldObj, i, j, k, this.getMetadata(), 0); - this.setDead(); - } + this.setDead(); + } } - public void setBlock(Block block) - { + public void setBlock(Block block) { this.block = block; } - public Block getBlock() - { + public Block getBlock() { return this.block; } - public void setMetadata(int meta) - { + public void setMetadata(int meta) { this.meta = meta; } - public int getMetadata() - { + public int getMetadata() { return this.meta; } @Override - protected boolean canTriggerWalking() - { - return false; - } - - @Override - public void setDead() - { - super.setDead(); - } - - @Override - public boolean canBeCollidedWith() - { - return !this.isDead; - } + protected boolean canTriggerWalking() { + return false; + } @Override - protected void readEntityFromNBT(NBTTagCompound compound) - { + public void setDead() { + super.setDead(); + } + + @Override + public boolean canBeCollidedWith() { + return !this.isDead; + } + + @Override + protected void readEntityFromNBT(NBTTagCompound compound) { this.setBlock(Block.getBlockById(compound.getInteger("blockId"))); this.setMetadata(compound.getInteger("metadata")); } @Override - protected void writeEntityToNBT(NBTTagCompound compound) - { + protected void writeEntityToNBT(NBTTagCompound compound) { compound.setInteger("blockId", Block.getIdFromBlock(this.getBlock())); compound.setInteger("metadata", this.getMetadata()); } @Override - public void writeSpawnData(ByteBuf buffer) - { + public void writeSpawnData(ByteBuf buffer) { buffer.writeInt(Block.getIdFromBlock(this.getBlock())); buffer.writeInt(this.meta); } @Override - public void readSpawnData(ByteBuf buffer) - { + public void readSpawnData(ByteBuf buffer) { this.setBlock(Block.getBlockById(buffer.readInt())); this.setMetadata(buffer.readInt()); } diff --git a/src/main/java/com/legacy/aether/entities/block/EntityTNTPresent.java b/src/main/java/com/legacy/aether/entities/block/EntityTNTPresent.java index e5c1d28..eeada79 100644 --- a/src/main/java/com/legacy/aether/entities/block/EntityTNTPresent.java +++ b/src/main/java/com/legacy/aether/entities/block/EntityTNTPresent.java @@ -4,96 +4,80 @@ import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -public class EntityTNTPresent extends Entity -{ +public class EntityTNTPresent extends Entity { - public int fuse; + public int fuse; - public EntityTNTPresent(World world) - { - super(world); - this.fuse = 10; - this.preventEntitySpawning = true; - this.setSize(0.98F, 0.98F); - } + public EntityTNTPresent(World world) { + super(world); + this.fuse = 10; + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.98F); + } - public EntityTNTPresent(World world, double d, double d1, double d2) - { - this(world); - this.setPosition(d + 0.5D, d1, d2 + 0.5D); - this.motionY = 0.20000000298023224D; - this.fuse = 10; - } + public EntityTNTPresent(World world, double d, double d1, double d2) { + this(world); + this.setPosition(d + 0.5D, d1, d2 + 0.5D); + this.motionY = 0.20000000298023224D; + this.fuse = 10; + } - @Override - protected void entityInit() - { - - } + @Override + protected void entityInit() { - @Override - protected boolean canTriggerWalking() - { - return false; - } + } - @Override - public boolean canBeCollidedWith() - { - return !this.isDead; - } + @Override + protected boolean canTriggerWalking() { + return false; + } - @Override - public void onUpdate() - { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.motionY -= 0.03999999910593033D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionY *= 0.9800000190734863D; + @Override + public boolean canBeCollidedWith() { + return !this.isDead; + } - if (this.onGround) - { - this.motionY *= -0.5D; - } + @Override + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.03999999910593033D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionY *= 0.9800000190734863D; - if (this.fuse-- <= 0) - { - if (!this.worldObj.isRemote) - { - this.setDead(); - this.explode(); - } - } - else - { - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - } - } + if (this.onGround) { + this.motionY *= -0.5D; + } - private void explode() - { - float f = 0.4F; - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true); - } + if (this.fuse-- <= 0) { + if (!this.worldObj.isRemote) { + this.setDead(); + this.explode(); + } + } else { + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + } + } - @Override - protected void writeEntityToNBT(NBTTagCompound compound) - { - compound.setInteger("fuse", this.fuse); - } + private void explode() { + float f = 0.4F; + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true); + } - @Override - protected void readEntityFromNBT(NBTTagCompound compound) - { - this.fuse = compound.getInteger("fuse"); - } + @Override + protected void writeEntityToNBT(NBTTagCompound compound) { + compound.setInteger("fuse", this.fuse); + } - @Override - public float getShadowSize() - { - return 0.0F; - } + @Override + protected void readEntityFromNBT(NBTTagCompound compound) { + this.fuse = compound.getInteger("fuse"); + } + + @Override + public float getShadowSize() { + return 0.0F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/bosses/EntityFireMinion.java b/src/main/java/com/legacy/aether/entities/bosses/EntityFireMinion.java index 92c2275..7077458 100644 --- a/src/main/java/com/legacy/aether/entities/bosses/EntityFireMinion.java +++ b/src/main/java/com/legacy/aether/entities/bosses/EntityFireMinion.java @@ -10,46 +10,41 @@ import net.minecraft.world.World; import com.legacy.aether.entities.hostile.EntityAetherMob; -public class EntityFireMinion extends EntityAetherMob -{ +public class EntityFireMinion extends EntityAetherMob { - public EntityFireMinion(World world) - { - super(world); + public EntityFireMinion(World world) { + super(world); - this.isImmuneToFire = true; - this.setSize(1.1F, 1.8F); - this.tasks.addTask(2, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.5D, true)); - this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); - } + this.isImmuneToFire = true; + this.setSize(1.1F, 1.8F); + this.tasks.addTask(2, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.5D, true)); + this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); + } - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(12.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); - } + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(12.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); + } - @Override - public void onUpdate() - { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - for(int i = 0; i < 2; i++) - { - double d = rand.nextFloat() - 0.5F; - double d1 = rand.nextFloat(); - double d2 = rand.nextFloat() - 0.5F; - double d3 = posX + d * d1; - double d4 = (this.boundingBox.minY + d1) + 0.1D; - double d5 = posZ + d2 * d1; - this.worldObj.spawnParticle("flame", d3, d4, d5, 0.0D, -0.075000002980232239D, 0.0D); - } - } + for (int i = 0; i < 2; i++) { + double d = rand.nextFloat() - 0.5F; + double d1 = rand.nextFloat(); + double d2 = rand.nextFloat() - 0.5F; + double d3 = posX + d * d1; + double d4 = (this.boundingBox.minY + d1) + 0.1D; + double d5 = posZ + d2 * d1; + this.worldObj.spawnParticle("flame", d3, d4, d5, 0.0D, -0.075000002980232239D, 0.0D); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/bosses/EntityValkyrie.java b/src/main/java/com/legacy/aether/entities/bosses/EntityValkyrie.java index 858b03f..ad02efb 100644 --- a/src/main/java/com/legacy/aether/entities/bosses/EntityValkyrie.java +++ b/src/main/java/com/legacy/aether/entities/bosses/EntityValkyrie.java @@ -19,468 +19,372 @@ import com.legacy.aether.items.ItemsAether; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; -public class EntityValkyrie extends EntityAetherMob -{ +public class EntityValkyrie extends EntityAetherMob { private int attackTime; - public int angerLevel; + public int angerLevel; - public int timeLeft, chatTime; + public int timeLeft, chatTime; - public double safeX, safeY, safeZ; + public double safeX, safeY, safeZ; - public float sinage; + public float sinage; - public double lastMotionY; + public double lastMotionY; - public int teleTimer; + public int teleTimer; - public EntityValkyrie(World world) - { - super(world); - setSize(0.8F, 1.6F); - this.teleTimer = this.rand.nextInt(250); - this.timeLeft = 1200; - this.safeX = this.posX; - this.safeY = this.posY; - this.safeZ = this.posZ; - this.tasks.addTask(2, new EntityAIWander(this, 0.5D)); - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 0.65D, true)); - } + public EntityValkyrie(World world) { + super(world); + setSize(0.8F, 1.6F); + this.teleTimer = this.rand.nextInt(250); + this.timeLeft = 1200; + this.safeX = this.posX; + this.safeY = this.posY; + this.safeZ = this.posZ; + this.tasks.addTask(2, new EntityAIWander(this, 0.5D)); + this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 0.65D, true)); + } - @Override - protected void applyEntityAttributes() - { + @Override + protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(8.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D); } - public void swingArm() - { - if (!this.isSwingInProgress) - { - this.isSwingInProgress = true; - } - } + public void swingArm() { + if (!this.isSwingInProgress) { + this.isSwingInProgress = true; + } + } - private void becomeAngryAt(EntityLivingBase entity) - { - this.setAttackTarget(entity); - this.angerLevel = 200 + rand.nextInt(200); - } + private void becomeAngryAt(EntityLivingBase entity) { + this.setAttackTarget(entity); + this.angerLevel = 200 + rand.nextInt(200); + } - private void chatItUp(EntityPlayer player, String s) - { + private void chatItUp(EntityPlayer player, String s) { Side side = FMLCommonHandler.instance().getEffectiveSide(); - if (this.chatTime <= 0) - { - if (side.isClient()) - { - Aether.proxy.sendMessage(player, s); - } + if (this.chatTime <= 0) { + if (side.isClient()) { + Aether.proxy.sendMessage(player, s); + } - this.chatTime = 60; - } - } + this.chatTime = 60; + } + } - @Override - public boolean interact(EntityPlayer entityplayer) - { + @Override + public boolean interact(EntityPlayer entityplayer) { this.faceEntity(entityplayer, 180F, 180F); ItemStack stack = entityplayer.getCurrentEquippedItem(); - if(stack != null && stack.getItem() == ItemsAether.victory_medal && stack.stackSize >= 0) - { - if(stack.stackSize >= 10) - { + if (stack != null && stack.getItem() == ItemsAether.victory_medal && stack.stackSize >= 0) { + if (stack.stackSize >= 10) { this.chatItUp(entityplayer, "Umm... that's a nice pile of medallions you have there..."); - } - else if(stack.stackSize >= 5) - { + } else if (stack.stackSize >= 5) { this.chatItUp(entityplayer, "That's pretty impressive, but you won't defeat me."); - } - else - { + } else { this.chatItUp(entityplayer, "You think you're a tough guy, eh? Well, bring it on!"); } - } - else - { + } else { int line = rand.nextInt(3); - if(line == 2) - { + if (line == 2) { this.chatItUp(entityplayer, "What's that? You want to fight? Aww, what a cute little human."); - } - else if(line == 1) - { + } else if (line == 1) { this.chatItUp(entityplayer, "You're not thinking of fighting a big, strong Valkyrie are you?"); - } - else - { + } else { this.chatItUp(entityplayer, "I don't think you should bother me, you could get really hurt."); } } return true; - } + } - public void teleport(double x, double y, double z, int rad) - { - int a = this.rand.nextInt(rad + 1); - int b = this.rand.nextInt(rad / 2); - int c = rad - a; + public void teleport(double x, double y, double z, int rad) { + int a = this.rand.nextInt(rad + 1); + int b = this.rand.nextInt(rad / 2); + int c = rad - a; - a *= ((this.rand.nextInt(2) * 2) - 1); - b *= ((this.rand.nextInt(2) * 2) - 1); - c *= ((this.rand.nextInt(2) * 2) - 1); + a *= ((this.rand.nextInt(2) * 2) - 1); + b *= ((this.rand.nextInt(2) * 2) - 1); + c *= ((this.rand.nextInt(2) * 2) - 1); - x += (double) a; - y += (double) b; - z += (double) c; + x += (double) a; + y += (double) b; + z += (double) c; - int newX = (int) Math.floor(x - 0.5D); - int newY = (int) Math.floor(y - 0.5D); - int newZ = (int) Math.floor(z - 0.5D); + int newX = (int) Math.floor(x - 0.5D); + int newY = (int) Math.floor(y - 0.5D); + int newZ = (int) Math.floor(z - 0.5D); - boolean flag = false; - - for (int q = 0; q < 32 && !flag; q++) - { - this.rand.nextInt(rad / 2); - this.rand.nextInt(rad / 2); - int j = newY + (this.rand.nextInt(rad / 2) - this.rand.nextInt(rad / 2)); - this.rand.nextInt(rad / 2); - this.rand.nextInt(rad / 2); + boolean flag = false; - if (j > 124 || j < 5) - { - continue; - } - } - - if (!flag) - { - teleFail(); - } - else - { - spawnExplosionParticle(); - setPosition((double) newX + 0.5D, (double) newY + 0.5D, (double) newZ + 0.5D); - this.motionX = this.motionY = this.motionZ = 0.0D; - this.moveForward = this.moveStrafing = this.rotationPitch = this.rotationYaw = 0.0F; - this.isJumping = false; - this.renderYawOffset = this.rand.nextFloat() * 360F; - spawnExplosionParticle(); - this.teleTimer = this.rand.nextInt(40); - } - } + for (int q = 0; q < 32 && !flag; q++) { + this.rand.nextInt(rad / 2); + this.rand.nextInt(rad / 2); + int j = newY + (this.rand.nextInt(rad / 2) - this.rand.nextInt(rad / 2)); + this.rand.nextInt(rad / 2); + this.rand.nextInt(rad / 2); - public void teleFail() - { - this.teleTimer -= (this.rand.nextInt(40) + 40); - - if (this.posY <= 0D) - { - this.teleTimer = 446; - } - } + if (j > 124 || j < 5) { + continue; + } + } - @Override - public void onEntityUpdate() - { - super.onEntityUpdate(); - this.teleTimer++; - --this.attackTime; - - if (this.teleTimer >= 450) - { - if (this.getAttackTarget() != null) - { - teleport(this.getAttackTarget().posX, this.getAttackTarget().posY, this.getAttackTarget().posZ, 7); - } - else if (!this.onGround) - { - teleport(this.safeX, this.safeY, this.safeZ, 6); - } - } - else if (this.teleTimer < 446 && (this.posY <= 0D || this.posY <= (this.safeY - 16D))) - { - this.teleTimer = 446; - } - else if ((this.teleTimer % 5) == 0 && this.getAttackTarget() != null && !canEntityBeSeen(this.getAttackTarget())) - { - this.teleTimer += 100; - } + if (!flag) { + teleFail(); + } else { + spawnExplosionParticle(); + setPosition((double) newX + 0.5D, (double) newY + 0.5D, (double) newZ + 0.5D); + this.motionX = this.motionY = this.motionZ = 0.0D; + this.moveForward = this.moveStrafing = this.rotationPitch = this.rotationYaw = 0.0F; + this.isJumping = false; + this.renderYawOffset = this.rand.nextFloat() * 360F; + spawnExplosionParticle(); + this.teleTimer = this.rand.nextInt(40); + } + } - if (this.onGround && this.teleTimer % 10 == 0) - { - this.safeX = this.posX; - this.safeY = this.posY; - this.safeZ = this.posZ; - } + public void teleFail() { + this.teleTimer -= (this.rand.nextInt(40) + 40); - if (this.getAttackTarget() != null && this.getAttackTarget().isDead) - { - this.setAttackTarget(null); - this.angerLevel = 0; - } + if (this.posY <= 0D) { + this.teleTimer = 446; + } + } - if (this.chatTime > 0) - { - this.chatTime--; - } - } + @Override + public void onEntityUpdate() { + super.onEntityUpdate(); + this.teleTimer++; + --this.attackTime; - @Override - public void onUpdate() - { - this.lastMotionY = motionY; - super.onUpdate(); - - if (!this.onGround && this.getAttackTarget() != null && this.lastMotionY >= 0.0D && this.motionY < 0.0D && getDistanceToEntity(this.getAttackTarget()) <= 16F && canEntityBeSeen(this.getAttackTarget())) - { - double a = this.getAttackTarget().posX - posX; - double b = this.getAttackTarget().posZ - posZ; - double angle = Math.atan2(a, b); - this.motionX = Math.sin(angle) * 0.25D; - this.motionZ = Math.cos(angle) * 0.25D; - } - - if (!this.onGround && !isOnLadder() && Math.abs(this.motionY - this.lastMotionY) > 0.07D && Math.abs(this.motionY - this.lastMotionY) < 0.09D) - { - this.motionY += 0.055F; - - if (this.motionY < -0.275F) - { - this.motionY = -0.275F; - } - } + if (this.teleTimer >= 450) { + if (this.getAttackTarget() != null) { + teleport(this.getAttackTarget().posX, this.getAttackTarget().posY, this.getAttackTarget().posZ, 7); + } else if (!this.onGround) { + teleport(this.safeX, this.safeY, this.safeZ, 6); + } + } else if (this.teleTimer < 446 && (this.posY <= 0D || this.posY <= (this.safeY - 16D))) { + this.teleTimer = 446; + } else if ((this.teleTimer % 5) == 0 && this.getAttackTarget() != null && !canEntityBeSeen(this.getAttackTarget())) { + this.teleTimer += 100; + } - if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL && (this.getAttackTarget() != null || this.angerLevel > 0)) - { - this.angerLevel = 0; - this.setAttackTarget(null); - } + if (this.onGround && this.teleTimer % 10 == 0) { + this.safeX = this.posX; + this.safeY = this.posY; + this.safeZ = this.posZ; + } - if (!this.onGround) - { - this.sinage += 0.75F; - } - else - { - this.sinage += 0.15F; - } + if (this.getAttackTarget() != null && this.getAttackTarget().isDead) { + this.setAttackTarget(null); + this.angerLevel = 0; + } - if (this.sinage > 3.141593F * 2F) - { - this.sinage -= (3.141593F * 2F); - } + if (this.chatTime > 0) { + this.chatTime--; + } + } - if (this.getAttackTarget() instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)this.getAttackTarget(); - - if (this.getHealth() <= 0) - { - int pokey = rand.nextInt(3); + @Override + public void onUpdate() { + this.lastMotionY = motionY; + super.onUpdate(); - if (pokey == 2) - { - chatItUp(player, "Alright, alright! You win!"); - } - else if (pokey == 1) - { - chatItUp(player, "Okay, I give up! Geez!"); - } - else - { - chatItUp(player, "Oww! Fine, here's your medal..."); - } - - this.setDead(); - } + if (!this.onGround && this.getAttackTarget() != null && this.lastMotionY >= 0.0D && this.motionY < 0.0D && getDistanceToEntity(this.getAttackTarget()) <= 16F && canEntityBeSeen(this.getAttackTarget())) { + double a = this.getAttackTarget().posX - posX; + double b = this.getAttackTarget().posZ - posZ; + double angle = Math.atan2(a, b); + this.motionX = Math.sin(angle) * 0.25D; + this.motionZ = Math.cos(angle) * 0.25D; + } - if (player.getHealth() <= 0 && player.isDead) - { - int pokey = rand.nextInt(3); + if (!this.onGround && !isOnLadder() && Math.abs(this.motionY - this.lastMotionY) > 0.07D && Math.abs(this.motionY - this.lastMotionY) < 0.09D) { + this.motionY += 0.055F; - if (pokey == 2) - { - chatItUp(player, "You want a medallion? Try being less pathetic."); - } - else if (pokey == 1) - { - chatItUp(player, "Maybe some day, " + player.getCommandSenderName() + "... maybe some day."); - } - else - { - chatItUp(player, "Humans aren't nearly as cute when they're dead."); - } + if (this.motionY < -0.275F) { + this.motionY = -0.275F; + } + } - this.setAttackTarget(null); - this.angerLevel = this.chatTime = 0; - } - } - } + if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL && (this.getAttackTarget() != null || this.angerLevel > 0)) { + this.angerLevel = 0; + this.setAttackTarget(null); + } - @Override - protected Entity findPlayerToAttack() - { - return null; - } + if (!this.onGround) { + this.sinage += 0.75F; + } else { + this.sinage += 0.15F; + } - @Override - public void writeEntityToNBT(NBTTagCompound compound) - { - super.writeEntityToNBT(compound); + if (this.sinage > 3.141593F * 2F) { + this.sinage -= (3.141593F * 2F); + } - compound.setInteger("angerLevel", this.angerLevel); - compound.setInteger("teleTimer", this.teleTimer); - compound.setInteger("timeLeft", this.timeLeft); - compound.setDouble("safePosX", this.safeX); - compound.setDouble("safePosY", this.safeY); - compound.setDouble("safePosZ", this.safeZ); - } + if (this.getAttackTarget() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) this.getAttackTarget(); - @Override - public void readEntityFromNBT(NBTTagCompound compound) - { - super.readEntityFromNBT(compound); + if (this.getHealth() <= 0) { + int pokey = rand.nextInt(3); - this.angerLevel = compound.getInteger("angerLevel"); - this.teleTimer = compound.getInteger("teleTimer"); - this.timeLeft = compound.getInteger("timeLeft"); - this.safeX = compound.getInteger("safePosX"); - this.safeY = compound.getInteger("safePosY"); - this.safeZ = compound.getInteger("safePosZ"); - } + if (pokey == 2) { + chatItUp(player, "Alright, alright! You win!"); + } else if (pokey == 1) { + chatItUp(player, "Okay, I give up! Geez!"); + } else { + chatItUp(player, "Oww! Fine, here's your medal..."); + } - public boolean attackEntityFrom(DamageSource ds, float i) - { - if (ds.getEntity() instanceof EntityPlayer && worldObj.difficultySetting != EnumDifficulty.PEACEFUL) - { - EntityPlayer player = (EntityPlayer)ds.getEntity(); + this.setDead(); + } - if (this.getAttackTarget() == null) - { - this.chatTime = 0; - int pokey = rand.nextInt(3); - if (pokey == 2) - { - chatItUp(player, "I'm not going easy on you!"); - } - else if (pokey == 1) - { - chatItUp(player, "You're gonna regret that!"); - } - else - { - chatItUp(player, "Now you're in for it!"); - } - - this.setAttackTarget(player); - } - else - { - this.teleTimer -= 10; - } + if (player.getHealth() <= 0 && player.isDead) { + int pokey = rand.nextInt(3); - if (ds.getEntity() instanceof EntityLivingBase) - { - becomeAngryAt((EntityLivingBase) ds.getEntity()); - } - } - else - { - teleport(this.posX, this.posY, this.posZ, 8); - extinguish(); - return false; - } + if (pokey == 2) { + chatItUp(player, "You want a medallion? Try being less pathetic."); + } else if (pokey == 1) { + chatItUp(player, "Maybe some day, " + player.getCommandSenderName() + "... maybe some day."); + } else { + chatItUp(player, "Humans aren't nearly as cute when they're dead."); + } - boolean flag = super.attackEntityFrom(ds, i); - - if (flag && this.getHealth() <= 0) - { - spawnExplosionParticle(); - this.setDead(); - } + this.setAttackTarget(null); + this.angerLevel = this.chatTime = 0; + } + } + } - return flag; - } + @Override + protected Entity findPlayerToAttack() { + return null; + } - @Override - public boolean attackEntityAsMob(Entity entity) - { - boolean flag = false; + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); - if (this.attackTime <= 0 && entity.boundingBox.maxY > this.boundingBox.minY && entity.boundingBox.minY < this.boundingBox.maxY) - { - this.attackTime = 20; - swingArm(); - flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), 7); - if (entity != null && this.getAttackTarget() != null && entity == getAttackTarget() && entity instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer) entity; - if (player.getHealth() <= 0) - { - int pokey = this.rand.nextInt(3); + compound.setInteger("angerLevel", this.angerLevel); + compound.setInteger("teleTimer", this.teleTimer); + compound.setInteger("timeLeft", this.timeLeft); + compound.setDouble("safePosX", this.safeX); + compound.setDouble("safePosY", this.safeY); + compound.setDouble("safePosZ", this.safeZ); + } - if (pokey == 2) - { - chatItUp((EntityPlayer) this.getAttackTarget(), "You want a medallion? Try being less pathetic."); - } - else if (pokey == 1) - { - chatItUp((EntityPlayer) this.getAttackTarget(),"Maybe some day, " + player.getCommandSenderName() + "... maybe some day."); - } - else - { - chatItUp((EntityPlayer) this.getAttackTarget(),"Humans aren't nearly as cute when they're dead."); - } + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + super.readEntityFromNBT(compound); - this.setAttackTarget(null); - this.angerLevel = this.chatTime = 0; - } - } - } + this.angerLevel = compound.getInteger("angerLevel"); + this.teleTimer = compound.getInteger("teleTimer"); + this.timeLeft = compound.getInteger("timeLeft"); + this.safeX = compound.getInteger("safePosX"); + this.safeY = compound.getInteger("safePosY"); + this.safeZ = compound.getInteger("safePosZ"); + } + + public boolean attackEntityFrom(DamageSource ds, float i) { + if (ds.getEntity() instanceof EntityPlayer && worldObj.difficultySetting != EnumDifficulty.PEACEFUL) { + EntityPlayer player = (EntityPlayer) ds.getEntity(); + + if (this.getAttackTarget() == null) { + this.chatTime = 0; + int pokey = rand.nextInt(3); + if (pokey == 2) { + chatItUp(player, "I'm not going easy on you!"); + } else if (pokey == 1) { + chatItUp(player, "You're gonna regret that!"); + } else { + chatItUp(player, "Now you're in for it!"); + } + + this.setAttackTarget(player); + } else { + this.teleTimer -= 10; + } + + if (ds.getEntity() instanceof EntityLivingBase) { + becomeAngryAt((EntityLivingBase) ds.getEntity()); + } + } else { + teleport(this.posX, this.posY, this.posZ, 8); + extinguish(); + return false; + } + + boolean flag = super.attackEntityFrom(ds, i); + + if (flag && this.getHealth() <= 0) { + spawnExplosionParticle(); + this.setDead(); + } return flag; - } - - @Override - protected void dropFewItems(boolean var1, int var2) - { - dropItem(ItemsAether.victory_medal, 1); - } - - @Override - public void fall(float distance) - { - } - - @Override - public boolean canDespawn() - { - return true; - } + } @Override - protected String getHurtSound() - { - return "game.player.hurt"; - } + public boolean attackEntityAsMob(Entity entity) { + boolean flag = false; + + if (this.attackTime <= 0 && entity.boundingBox.maxY > this.boundingBox.minY && entity.boundingBox.minY < this.boundingBox.maxY) { + this.attackTime = 20; + swingArm(); + flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), 7); + if (entity != null && this.getAttackTarget() != null && entity == getAttackTarget() && entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entity; + if (player.getHealth() <= 0) { + int pokey = this.rand.nextInt(3); + + if (pokey == 2) { + chatItUp((EntityPlayer) this.getAttackTarget(), "You want a medallion? Try being less pathetic."); + } else if (pokey == 1) { + chatItUp((EntityPlayer) this.getAttackTarget(), "Maybe some day, " + player.getCommandSenderName() + "... maybe some day."); + } else { + chatItUp((EntityPlayer) this.getAttackTarget(), "Humans aren't nearly as cute when they're dead."); + } + + this.setAttackTarget(null); + this.angerLevel = this.chatTime = 0; + } + } + } + + return flag; + } @Override - protected String getDeathSound() - { - return "game.player.hurt.fall.big"; - } + protected void dropFewItems(boolean var1, int var2) { + dropItem(ItemsAether.victory_medal, 1); + } + + @Override + public void fall(float distance) { + } + + @Override + public boolean canDespawn() { + return true; + } + + @Override + protected String getHurtSound() { + return "game.player.hurt"; + } + + @Override + protected String getDeathSound() { + return "game.player.hurt.fall.big"; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/bosses/slider/EntitySlider.java b/src/main/java/com/legacy/aether/entities/bosses/slider/EntitySlider.java index cc36f83..d74ba3c 100644 --- a/src/main/java/com/legacy/aether/entities/bosses/slider/EntitySlider.java +++ b/src/main/java/com/legacy/aether/entities/bosses/slider/EntitySlider.java @@ -35,82 +35,73 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class EntitySlider extends EntityFlying implements IAetherBoss -{ +public class EntitySlider extends EntityFlying implements IAetherBoss { - private int dungeonX, dungeonY, dungeonZ; + private int dungeonX, dungeonY, dungeonZ; - public float hurtAngle, hurtAngleX, hurtAngleZ; + public float hurtAngle, hurtAngleX, hurtAngleZ; - public int chatTime, moveTime; + public int chatTime, moveTime; - public boolean crushedBlock; + public boolean crushedBlock; - public float velocity; + public float velocity; - public EnumFacing direction; + public EnumFacing direction; - public EntitySlider(World world) - { - super(world); + public EntitySlider(World world) { + super(world); - this.rotationYaw = this.rotationPitch = 0.0F; + this.rotationYaw = this.rotationPitch = 0.0F; - this.setSize(2.0F, 2.0F); - this.dataWatcher.updateObject(19, AetherNameGen.gen()); - } + this.setSize(2.0F, 2.0F); + this.dataWatcher.updateObject(19, AetherNameGen.gen()); + } - @Override - public void entityInit() - { - super.entityInit(); + @Override + public void entityInit() { + super.entityInit(); - this.dataWatcher.addObject(18, new Byte((byte) 0)); - this.dataWatcher.addObject(19, AetherNameGen.gen()); - this.dataWatcher.addObject(20, new Byte((byte) 0)); - } + this.dataWatcher.addObject(18, new Byte((byte) 0)); + this.dataWatcher.addObject(19, AetherNameGen.gen()); + this.dataWatcher.addObject(20, new Byte((byte) 0)); + } - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(500.0D); } @Override - protected String getLivingSound() - { + protected String getLivingSound() { return "ambient.cave.cave"; } @Override - protected String getHurtSound() - { + protected String getHurtSound() { return "step.stone"; } @Override - protected String getDeathSound() - { + protected String getDeathSound() { return null; } @Override - public void writeEntityToNBT(NBTTagCompound nbttagcompound) - { + public void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); - nbttagcompound.setInteger("dungeonX", this.dungeonX); - nbttagcompound.setInteger("dungeonY", this.dungeonY); - nbttagcompound.setInteger("dungeonZ", this.dungeonZ); + nbttagcompound.setInteger("dungeonX", this.dungeonX); + nbttagcompound.setInteger("dungeonY", this.dungeonY); + nbttagcompound.setInteger("dungeonZ", this.dungeonZ); nbttagcompound.setBoolean("isAwake", this.isAwake()); - nbttagcompound.setString("bossName", this.getName()); + nbttagcompound.setString("bossName", this.getName()); } - public void readEntityFromNBT(NBTTagCompound nbttagcompound) - { + public void readEntityFromNBT(NBTTagCompound nbttagcompound) { super.readEntityFromNBT(nbttagcompound); this.dungeonX = nbttagcompound.getInteger("dungeonX"); @@ -121,671 +112,541 @@ public class EntitySlider extends EntityFlying implements IAetherBoss this.setBossName(nbttagcompound.getString("bossName")); } - public boolean criticalCondition() - { - return this.getHealth() <= 80.0F; - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - if(this.hurtAngle > 0.01F) - { - this.hurtAngle *= 0.8F; - } - - if(this.chatTime > 0) - { - this.chatTime --; - } - - this.renderYawOffset = this.rotationPitch = this.rotationYaw = 0.0F; - } - - @Override - public void onLivingUpdate() - { - super.onLivingUpdate(); - } + public boolean criticalCondition() { + return this.getHealth() <= 80.0F; + } @Override - public void updateEntityActionState() - { - if (!this.isAwake()) - { - this.setAttackTarget(null); - return; - } + public void onUpdate() { + super.onUpdate(); - if(!this.worldObj.isRemote) - { - if (this.getAttackTarget() == null || this.getAttackTarget().isDead || this.getAttackTarget().getHealth() <= 0.0F) - { - this.reset(); + if (this.hurtAngle > 0.01F) { + this.hurtAngle *= 0.8F; + } - return; - } + if (this.chatTime > 0) { + this.chatTime--; + } - if(this.isMoving()) - { - if(this.isCollided) - { - double x, y, z; - x = this.posX - 0.5D; - y = this.boundingBox.minY + 0.75D; - z = this.posZ - 0.5D; + this.renderYawOffset = this.rotationPitch = this.rotationYaw = 0.0F; + } - this.crushedBlock = false; + @Override + public void onLivingUpdate() { + super.onLivingUpdate(); + } - if(y > 4D) - { - if(this.direction == EnumFacing.UP) - { - for(int i = 0; i < 25; i++) - { - double a = (double)((i / 5) - 2) * 0.75D; - double b = (double)((i % 5) - 2) * 0.75D; + @Override + public void updateEntityActionState() { + if (!this.isAwake()) { + this.setAttackTarget(null); + return; + } - this.destroyBlock(x + a, y + 1.5D, z + b); - } - } - else if(this.direction == EnumFacing.DOWN) - { - for(int i = 0; i < 25; i++) - { - double a = (double)((i / 5) - 2) * 0.75D; - double b = (double)((i % 5) - 2) * 0.75D; + if (!this.worldObj.isRemote) { + if (this.getAttackTarget() == null || this.getAttackTarget().isDead || this.getAttackTarget().getHealth() <= 0.0F) { + this.reset(); - this.destroyBlock(x + a, y - 1.5D, z + b); - } - } - else if(this.direction == EnumFacing.EAST) - { - for(int i = 0; i < 25; i++) - { - double a = (double)((i / 5) - 2) * 0.75D; - double b = (double)((i % 5) - 2) * 0.75D; + return; + } - this.destroyBlock(x + 1.5D, y + a, z + b); - } - } - else if(this.direction == EnumFacing.WEST) - { - for(int i = 0; i < 25; i++) - { - double a = (double)((i / 5) - 2) * 0.75D; - double b = (double)((i % 5) - 2) * 0.75D; + if (this.isMoving()) { + if (this.isCollided) { + double x, y, z; + x = this.posX - 0.5D; + y = this.boundingBox.minY + 0.75D; + z = this.posZ - 0.5D; - this.destroyBlock(x - 1.5D, y + a, z + b); - } - } - else if(this.direction == EnumFacing.SOUTH) - { - for(int i = 0; i < 25; i++) - { - double a = (double)((i / 5) - 2) * 0.75D; - double b = (double)((i % 5) - 2) * 0.75D; + this.crushedBlock = false; - this.destroyBlock(x + a, y + b, z + 1.5D); - } - } - else if(this.direction == EnumFacing.NORTH) - { - for(int i = 0; i < 25; i++) - { - double a = (double)((i / 5) - 2) * 0.75D; - double b = (double)((i % 5) - 2) * 0.75D; + if (y > 4D) { + if (this.direction == EnumFacing.UP) { + for (int i = 0; i < 25; i++) { + double a = (double) ((i / 5) - 2) * 0.75D; + double b = (double) ((i % 5) - 2) * 0.75D; - this.destroyBlock(x + a, y + b, z - 1.5D); - } - } - } + this.destroyBlock(x + a, y + 1.5D, z + b); + } + } else if (this.direction == EnumFacing.DOWN) { + for (int i = 0; i < 25; i++) { + double a = (double) ((i / 5) - 2) * 0.75D; + double b = (double) ((i % 5) - 2) * 0.75D; - if(this.crushedBlock) - { - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 3.0F, (0.625F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss.slider.collide", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); - } + this.destroyBlock(x + a, y - 1.5D, z + b); + } + } else if (this.direction == EnumFacing.EAST) { + for (int i = 0; i < 25; i++) { + double a = (double) ((i / 5) - 2) * 0.75D; + double b = (double) ((i % 5) - 2) * 0.75D; - this.stop(); - } - else - { - if(this.velocity < 2.0F) - { - this.velocity += (this.criticalCondition() ? 0.07F : 0.035F); - } + this.destroyBlock(x + 1.5D, y + a, z + b); + } + } else if (this.direction == EnumFacing.WEST) { + for (int i = 0; i < 25; i++) { + double a = (double) ((i / 5) - 2) * 0.75D; + double b = (double) ((i % 5) - 2) * 0.75D; - this.motionX = this.motionY = this.motionZ = 0.0F; + this.destroyBlock(x - 1.5D, y + a, z + b); + } + } else if (this.direction == EnumFacing.SOUTH) { + for (int i = 0; i < 25; i++) { + double a = (double) ((i / 5) - 2) * 0.75D; + double b = (double) ((i % 5) - 2) * 0.75D; - if(this.direction == EnumFacing.UP) - { - this.motionY = this.velocity; + this.destroyBlock(x + a, y + b, z + 1.5D); + } + } else if (this.direction == EnumFacing.NORTH) { + for (int i = 0; i < 25; i++) { + double a = (double) ((i / 5) - 2) * 0.75D; + double b = (double) ((i % 5) - 2) * 0.75D; - if(this.boundingBox.minY > this.getAttackTarget().boundingBox.minY + 0.35D) - { - this.stop(); - this.moveTime = this.criticalCondition() ? 4 : 8; - } - } - else if(this.direction == EnumFacing.DOWN) - { - this.motionY = -this.velocity; + this.destroyBlock(x + a, y + b, z - 1.5D); + } + } + } - if(this.boundingBox.minY < this.getAttackTarget().boundingBox.minY - 0.25D) - { - this.stop(); - this.moveTime = this.criticalCondition() ? 4 : 8; - } - } - else if(this.direction == EnumFacing.EAST) - { - this.motionX = this.velocity; + if (this.crushedBlock) { + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 3.0F, (0.625F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss.slider.collide", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); + } - if(this.posX > this.getAttackTarget().posX + 0.125D) - { - this.stop(); - this.moveTime = this.criticalCondition() ? 4 : 8; - } - } - else if(this.direction == EnumFacing.WEST) - { - this.motionX = -this.velocity; + this.stop(); + } else { + if (this.velocity < 2.0F) { + this.velocity += (this.criticalCondition() ? 0.07F : 0.035F); + } - if(this.posX < this.getAttackTarget().posX - 0.125D) - { - this.stop(); - this.moveTime = this.criticalCondition() ? 4 : 8; - } - } - else if(this.direction == EnumFacing.SOUTH) - { - this.motionZ = this.velocity; + this.motionX = this.motionY = this.motionZ = 0.0F; - if(this.posZ > this.getAttackTarget().posZ + 0.125D) - { - this.stop(); - this.moveTime = this.criticalCondition() ? 4 : 8; - } - } - else if(this.direction == EnumFacing.NORTH) - { - this.motionZ = -this.velocity; + if (this.direction == EnumFacing.UP) { + this.motionY = this.velocity; - if(this.posZ < this.getAttackTarget().posZ - 0.125D) - { - this.stop(); - this.moveTime = this.criticalCondition() ? 4 : 8; - } - } - } - } - else - { - if(this.moveTime > 0) - { - this.moveTime--; + if (this.boundingBox.minY > this.getAttackTarget().boundingBox.minY + 0.35D) { + this.stop(); + this.moveTime = this.criticalCondition() ? 4 : 8; + } + } else if (this.direction == EnumFacing.DOWN) { + this.motionY = -this.velocity; - if(this.criticalCondition() && this.rand.nextInt(2) == 0) - { - this.moveTime--; - } + if (this.boundingBox.minY < this.getAttackTarget().boundingBox.minY - 0.25D) { + this.stop(); + this.moveTime = this.criticalCondition() ? 4 : 8; + } + } else if (this.direction == EnumFacing.EAST) { + this.motionX = this.velocity; - this.motionX = this.motionY = this.motionZ = 0.0F; - } - else - { - if (this.getAttackTarget() == null) return; + if (this.posX > this.getAttackTarget().posX + 0.125D) { + this.stop(); + this.moveTime = this.criticalCondition() ? 4 : 8; + } + } else if (this.direction == EnumFacing.WEST) { + this.motionX = -this.velocity; - double a, b, c; - a = Math.abs(this.posX - this.getAttackTarget().posX); - b = Math.abs(this.boundingBox.minY - this.getAttackTarget().boundingBox.minY); - c = Math.abs(this.posZ - this.getAttackTarget().posZ); + if (this.posX < this.getAttackTarget().posX - 0.125D) { + this.stop(); + this.moveTime = this.criticalCondition() ? 4 : 8; + } + } else if (this.direction == EnumFacing.SOUTH) { + this.motionZ = this.velocity; - if(a > c) - { - this.direction = EnumFacing.EAST; + if (this.posZ > this.getAttackTarget().posZ + 0.125D) { + this.stop(); + this.moveTime = this.criticalCondition() ? 4 : 8; + } + } else if (this.direction == EnumFacing.NORTH) { + this.motionZ = -this.velocity; - if(this.posX > this.getAttackTarget().posX) - { - this.direction = EnumFacing.WEST; - } - } - else - { - this.direction = EnumFacing.SOUTH; + if (this.posZ < this.getAttackTarget().posZ - 0.125D) { + this.stop(); + this.moveTime = this.criticalCondition() ? 4 : 8; + } + } + } + } else { + if (this.moveTime > 0) { + this.moveTime--; - if(this.posZ > this.getAttackTarget().posZ) - { - this.direction = EnumFacing.NORTH; - } - } + if (this.criticalCondition() && this.rand.nextInt(2) == 0) { + this.moveTime--; + } - if((b > a && b > c) || (b > 0.25F && this.rand.nextInt(5) == 0)) - { - this.direction = EnumFacing.UP; + this.motionX = this.motionY = this.motionZ = 0.0F; + } else { + if (this.getAttackTarget() == null) return; - if(this.posY > this.getAttackTarget().posY) - { - this.direction = EnumFacing.DOWN; - } - } + double a, b, c; + a = Math.abs(this.posX - this.getAttackTarget().posX); + b = Math.abs(this.boundingBox.minY - this.getAttackTarget().boundingBox.minY); + c = Math.abs(this.posZ - this.getAttackTarget().posZ); - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss.slider.move", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); - this.setMoving(true); - } - } - } - } + if (a > c) { + this.direction = EnumFacing.EAST; - private void destroyBlock(double x, double y, double z) - { - Block block = this.worldObj.getBlock((int) x, (int) y, (int) z); - int metadata = this.worldObj.getBlockMetadata((int) x, (int) y, (int) z); + if (this.posX > this.getAttackTarget().posX) { + this.direction = EnumFacing.WEST; + } + } else { + this.direction = EnumFacing.SOUTH; - if(block == Blocks.air || block instanceof BlockDungeonBase) - { - return; - } + if (this.posZ > this.getAttackTarget().posZ) { + this.direction = EnumFacing.NORTH; + } + } - for (int j = 0; j < 4; ++j) - { - for (int k = 0; k < 4; ++k) - { - for (int l = 0; l < 4; ++l) - { - double d0 = ((double)j + 0.5D) / 4.0D; - double d1 = ((double)k + 0.5D) / 4.0D; - double d2 = ((double)l + 0.5D) / 4.0D; - this.worldObj.spawnParticle("blockcrack_" + Block.getIdFromBlock(block) + "_" + metadata, (double)x + d0, (double)y + d1, (double)z + d2, d0 - 0.5D, d1 - 0.5D, d2 - 0.5D); + if ((b > a && b > c) || (b > 0.25F && this.rand.nextInt(5) == 0)) { + this.direction = EnumFacing.UP; + + if (this.posY > this.getAttackTarget().posY) { + this.direction = EnumFacing.DOWN; + } + } + + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss.slider.move", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.setMoving(true); + } + } + } + } + + private void destroyBlock(double x, double y, double z) { + Block block = this.worldObj.getBlock((int) x, (int) y, (int) z); + int metadata = this.worldObj.getBlockMetadata((int) x, (int) y, (int) z); + + if (block == Blocks.air || block instanceof BlockDungeonBase) { + return; + } + + for (int j = 0; j < 4; ++j) { + for (int k = 0; k < 4; ++k) { + for (int l = 0; l < 4; ++l) { + double d0 = ((double) j + 0.5D) / 4.0D; + double d1 = ((double) k + 0.5D) / 4.0D; + double d2 = ((double) l + 0.5D) / 4.0D; + this.worldObj.spawnParticle("blockcrack_" + Block.getIdFromBlock(block) + "_" + metadata, (double) x + d0, (double) y + d1, (double) z + d2, d0 - 0.5D, d1 - 0.5D, d2 - 0.5D); } } } - block.breakBlock(this.worldObj, (int) x, (int) y, (int) z, block, metadata); - block.dropBlockAsItem(this.worldObj, (int) x, (int) y, (int) z, metadata, 0); + block.breakBlock(this.worldObj, (int) x, (int) y, (int) z, block, metadata); + block.dropBlockAsItem(this.worldObj, (int) x, (int) y, (int) z, metadata, 0); - this.worldObj.setBlockToAir((int) x, (int) y, (int) z); + this.worldObj.setBlockToAir((int) x, (int) y, (int) z); - this.crushedBlock = true; + this.crushedBlock = true; - double a = x + 0.5D + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.375D); - double b = y + 0.5D + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.375D); - double c = z + 0.5D + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.375D); + double a = x + 0.5D + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.375D); + double b = y + 0.5D + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.375D); + double c = z + 0.5D + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.375D); - this.worldObj.spawnParticle("smoke", a, b, c, 0.0D, 0.0D, 0.0D); - } - - private void openDoor() - { - for(int y = this.dungeonY + 1; y < this.dungeonY + 5; y++) - { - for(int z = this.dungeonZ + 6; z < this.dungeonZ + 10; z++) - { - this.worldObj.setBlock(this.dungeonX + 15, y, z, Blocks.air); - } - } - } - - @Override - public void applyEntityCollision(Entity entity) - { - if (this.isAwake() && this.isMoving()) - { - boolean flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), 6); - - if(flag && entity instanceof EntityLivingBase) - { - EntityLivingBase collidedEntity = (EntityLivingBase)entity; - collidedEntity.addVelocity(collidedEntity.motionY, 0.35D, collidedEntity.motionZ); - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss.slider.collide", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); - - this.stop(); - } - } + this.worldObj.spawnParticle("smoke", a, b, c, 0.0D, 0.0D, 0.0D); } - @Override - protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier) - { - this.dropItem(Item.getItemFromBlock(BlocksAether.carved_stone), 7 + rand.nextInt(3)); - - this.entityDropItem(new ItemStack(ItemsAether.dungeon_key), 0.5F); + private void openDoor() { + for (int y = this.dungeonY + 1; y < this.dungeonY + 5; y++) { + for (int z = this.dungeonZ + 6; z < this.dungeonZ + 10; z++) { + this.worldObj.setBlock(this.dungeonX + 15, y, z, Blocks.air); + } + } } @Override - public EntityItem entityDropItem(ItemStack stack, float offsetY) - { - if (stack.stackSize != 0 && stack.getItem() != null) - { - EntityAetherItem entityitem = new EntityAetherItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, stack); + public void applyEntityCollision(Entity entity) { + if (this.isAwake() && this.isMoving()) { + boolean flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), 6); + + if (flag && entity instanceof EntityLivingBase) { + EntityLivingBase collidedEntity = (EntityLivingBase) entity; + collidedEntity.addVelocity(collidedEntity.motionY, 0.35D, collidedEntity.motionZ); + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss.slider.collide", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); + + this.stop(); + } + } + } + + @Override + protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier) { + this.dropItem(Item.getItemFromBlock(BlocksAether.carved_stone), 7 + rand.nextInt(3)); + + this.entityDropItem(new ItemStack(ItemsAether.dungeon_key), 0.5F); + } + + @Override + public EntityItem entityDropItem(ItemStack stack, float offsetY) { + if (stack.stackSize != 0 && stack.getItem() != null) { + EntityAetherItem entityitem = new EntityAetherItem(this.worldObj, this.posX, this.posY + (double) offsetY, this.posZ, stack); if (captureDrops) this.capturedDrops.add(entityitem); else this.worldObj.spawnEntityInWorld(entityitem); return entityitem; - } - else - { + } else { return null; } } - public void stop() - { - this.setMoving(false); - this.moveTime = 12; - this.direction = EnumFacing.UP; - this.motionX = this.motionY = this.motionZ = this.velocity = 0.0F; - } + public void stop() { + this.setMoving(false); + this.moveTime = 12; + this.direction = EnumFacing.UP; + this.motionX = this.motionY = this.motionZ = this.velocity = 0.0F; + } - private void sendMessage(EntityPlayer player, String s) - { - Side side = FMLCommonHandler.instance().getEffectiveSide(); + private void sendMessage(EntityPlayer player, String s) { + Side side = FMLCommonHandler.instance().getEffectiveSide(); - if (this.chatTime <= 0) - { - if (side.isClient()) - { + if (this.chatTime <= 0) { + if (side.isClient()) { Aether.proxy.sendMessage(player, s); - } + } this.chatTime = 60; } } - @Override - public boolean attackEntityFrom(DamageSource ds, float var2) - { - if(ds.getEntity() == null || !(ds.getEntity() instanceof EntityPlayer) || ds.isProjectile() || ds.isMagicDamage() || ds.isExplosion() || ds.isFireDamage()) - { - return false; - } + @Override + public boolean attackEntityFrom(DamageSource ds, float var2) { + if (ds.getEntity() == null || !(ds.getEntity() instanceof EntityPlayer) || ds.isProjectile() || ds.isMagicDamage() || ds.isExplosion() || ds.isFireDamage()) { + return false; + } - EntityPlayer player = (EntityPlayer)ds.getEntity(); - ItemStack stack = player.inventory.getCurrentItem(); + EntityPlayer player = (EntityPlayer) ds.getEntity(); + ItemStack stack = player.inventory.getCurrentItem(); - if (stack == null || stack.getItem() == null) - { - return false; - } + if (stack == null || stack.getItem() == null) { + return false; + } - boolean isTCPickaxe = stack.getItem().getClass().getName().equals("tconstruct.items.tools.Pickaxe"); + boolean isTCPickaxe = stack.getItem().getClass().getName().equals("tconstruct.items.tools.Pickaxe"); - if (!isTCPickaxe) - { - if (!(stack.getItem() instanceof ItemPickaxe) && !(stack.getItem() instanceof ItemAetherTool)) - { - this.sendMessage(player, "Hmm. Perhaps I need to attack it with a Pickaxe?"); + if (!isTCPickaxe) { + if (!(stack.getItem() instanceof ItemPickaxe) && !(stack.getItem() instanceof ItemAetherTool)) { + this.sendMessage(player, "Hmm. Perhaps I need to attack it with a Pickaxe?"); - return false; - } + return false; + } - if (stack.getItem() instanceof ItemAetherTool && ((ItemAetherTool)stack.getItem()).toolType != EnumAetherToolType.PICKAXE) - { - this.sendMessage(player, "Hmm. Perhaps I need to attack it with a Pickaxe?"); + if (stack.getItem() instanceof ItemAetherTool && ((ItemAetherTool) stack.getItem()).toolType != EnumAetherToolType.PICKAXE) { + this.sendMessage(player, "Hmm. Perhaps I need to attack it with a Pickaxe?"); - return false; - } - } + return false; + } + } - boolean flag = super.attackEntityFrom(ds, Math.max(0, var2)); - - if(flag) - { - for(int size = 0; size < (this.getHealth() <= 0 ? 2 : 4); size++) - { - double a = this.posX + ((this.rand.nextFloat() - this.rand.nextFloat()) * 1.5D); - double b = this.boundingBox.minY + 1.75D; - double c = this.posZ + ((this.rand.nextFloat() - this.rand.nextFloat()) * 1.5D); + boolean flag = super.attackEntityFrom(ds, Math.max(0, var2)); - if(this.getHealth() <= 0) - { - this.worldObj.spawnParticle("explode", a, b, c, 0.0D, 0.0D, 0.0D); - } + if (flag) { + for (int size = 0; size < (this.getHealth() <= 0 ? 2 : 4); size++) { + double a = this.posX + ((this.rand.nextFloat() - this.rand.nextFloat()) * 1.5D); + double b = this.boundingBox.minY + 1.75D; + double c = this.posZ + ((this.rand.nextFloat() - this.rand.nextFloat()) * 1.5D); - for (int j = 0; j < 4; ++j) - { - for (int k = 0; k < 4; ++k) - { - for (int l = 0; l < 4; ++l) - { - double d0 = ((double)j + 0.5D) / 4.0D; - double d1 = ((double)k + 0.5D) / 4.0D; - double d2 = ((double)l + 0.5D) / 4.0D; - this.worldObj.spawnParticle("blockcrack_" + Blocks.stone + "_0", (double)a + d0, (double)b + d1, (double)c + d2, d0 - 0.5D, d1 - 0.5D, d2 - 0.5D); - } - } - } - } + if (this.getHealth() <= 0) { + this.worldObj.spawnParticle("explode", a, b, c, 0.0D, 0.0D, 0.0D); + } - if(this.getHealth() <= 0 || this.isDead) - { - openDoor(); - unlockBlock(this.dungeonX, this.dungeonY, this.dungeonZ); + for (int j = 0; j < 4; ++j) { + for (int k = 0; k < 4; ++k) { + for (int l = 0; l < 4; ++l) { + double d0 = ((double) j + 0.5D) / 4.0D; + double d1 = ((double) k + 0.5D) / 4.0D; + double d2 = ((double) l + 0.5D) / 4.0D; + this.worldObj.spawnParticle("blockcrack_" + Blocks.stone + "_0", (double) a + d0, (double) b + d1, (double) c + d2, d0 - 0.5D, d1 - 0.5D, d2 - 0.5D); + } + } + } + } - this.worldObj.setBlock(this.dungeonX + 7, this.dungeonY + 1, this.dungeonZ + 7, Blocks.trapdoor, 3, 2); - this.worldObj.setBlock(this.dungeonX + 8, this.dungeonY + 1, this.dungeonZ + 7, Blocks.trapdoor, 2, 2); - this.worldObj.setBlock(this.dungeonX + 7, this.dungeonY + 1, this.dungeonZ + 8, Blocks.trapdoor, 3, 2); - this.worldObj.setBlock(this.dungeonX + 8, this.dungeonY + 1, this.dungeonZ + 8, Blocks.trapdoor, 2, 2); + if (this.getHealth() <= 0 || this.isDead) { + openDoor(); + unlockBlock(this.dungeonX, this.dungeonY, this.dungeonZ); - PlayerAether.get(player).setFocusedBoss(null); + this.worldObj.setBlock(this.dungeonX + 7, this.dungeonY + 1, this.dungeonZ + 7, Blocks.trapdoor, 3, 2); + this.worldObj.setBlock(this.dungeonX + 8, this.dungeonY + 1, this.dungeonZ + 7, Blocks.trapdoor, 2, 2); + this.worldObj.setBlock(this.dungeonX + 7, this.dungeonY + 1, this.dungeonZ + 8, Blocks.trapdoor, 3, 2); + this.worldObj.setBlock(this.dungeonX + 8, this.dungeonY + 1, this.dungeonZ + 8, Blocks.trapdoor, 2, 2); - List dungeonPlayers = this.getPlayersInDungeon(player); + PlayerAether.get(player).setFocusedBoss(null); - for (int i = 0; i < dungeonPlayers.size(); ++i) - { - Entity entity = (Entity) dungeonPlayers.get(i); + List dungeonPlayers = this.getPlayersInDungeon(player); - if (entity instanceof EntityPlayer) - { - ((EntityPlayer) entity).triggerAchievement(AchievementsAether.defeat_bronze); - } - } + for (int i = 0; i < dungeonPlayers.size(); ++i) { + Entity entity = (Entity) dungeonPlayers.get(i); - player.triggerAchievement(AchievementsAether.defeat_bronze); + if (entity instanceof EntityPlayer) { + ((EntityPlayer) entity).triggerAchievement(AchievementsAether.defeat_bronze); + } + } - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss.slider.death", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); - this.setDead(); - } + player.triggerAchievement(AchievementsAether.defeat_bronze); - if(!this.isAwake()) - { - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss_slider.awaken", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); - this.setAttackTarget(player); + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss.slider.death", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.setDead(); + } - int x = this.dungeonX + 15; + if (!this.isAwake()) { + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss_slider.awaken", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.setAttackTarget(player); - for(int y = this.dungeonY + 1; y < this.dungeonY + 8; y++) - { - for(int z = this.dungeonZ + 5; z < this.dungeonZ + 11; z++) - { - this.worldObj.setBlock(x, y, z, BlocksAether.locked_carved_stone); - } - } + int x = this.dungeonX + 15; - this.setAwake(true); - } + for (int y = this.dungeonY + 1; y < this.dungeonY + 8; y++) { + for (int z = this.dungeonZ + 5; z < this.dungeonZ + 11; z++) { + this.worldObj.setBlock(x, y, z, BlocksAether.locked_carved_stone); + } + } - if(this.isMoving()) - { - this.velocity *= 0.75F; - } - } + this.setAwake(true); + } - double a, c; + if (this.isMoving()) { + this.velocity *= 0.75F; + } + } - a = Math.abs(this.posX - player.posX); - c = Math.abs(this.posZ - player.posZ); + double a, c; - if(a > c) - { - this.hurtAngleZ = 1; - this.hurtAngleX = 0; + a = Math.abs(this.posX - player.posX); + c = Math.abs(this.posZ - player.posZ); - if(this.posX > player.posX) - { - this.hurtAngleZ = -1; - } - } - else - { - this.hurtAngleX = 1; - this.hurtAngleZ = 0; + if (a > c) { + this.hurtAngleZ = 1; + this.hurtAngleX = 0; - if(this.posZ > player.posZ) - { - this.hurtAngleX = -1; - } - } + if (this.posX > player.posX) { + this.hurtAngleZ = -1; + } + } else { + this.hurtAngleX = 1; + this.hurtAngleZ = 0; - this.hurtAngle = 0.7F - (this.getHealth() / 875F); + if (this.posZ > player.posZ) { + this.hurtAngleX = -1; + } + } - PlayerAether.get(player).setFocusedBoss(this); + this.hurtAngle = 0.7F - (this.getHealth() / 875F); - return flag; - } + PlayerAether.get(player).setFocusedBoss(this); - private void unlockBlock(int x, int y, int z) - { - Block block = this.worldObj.getBlock(x, y, z); + return flag; + } - if(block == BlocksAether.locked_carved_stone || block == BlocksAether.locked_sentry_stone) - { - this.worldObj.setBlock(x, y, z, ((BlockDungeonBase)block).getUnlockedBlock()); - this.unlockBlock(x + 1, y, z); - this.unlockBlock(x - 1, y, z); - this.unlockBlock(x, y + 1, z); - this.unlockBlock(x, y - 1, z); - this.unlockBlock(x, y, z + 1); - this.unlockBlock(x, y, z - 1); - } - } + private void unlockBlock(int x, int y, int z) { + Block block = this.worldObj.getBlock(x, y, z); - @Override - protected void collideWithNearbyEntities() - { + if (block == BlocksAether.locked_carved_stone || block == BlocksAether.locked_sentry_stone) { + this.worldObj.setBlock(x, y, z, ((BlockDungeonBase) block).getUnlockedBlock()); + this.unlockBlock(x + 1, y, z); + this.unlockBlock(x - 1, y, z); + this.unlockBlock(x, y + 1, z); + this.unlockBlock(x, y - 1, z); + this.unlockBlock(x, y, z + 1); + this.unlockBlock(x, y, z - 1); + } + } + + @Override + protected void collideWithNearbyEntities() { List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - if (list != null && !list.isEmpty()) - { - for (int i = 0; i < list.size(); ++i) - { - Entity entity = (Entity)list.get(i); + if (list != null && !list.isEmpty()) { + for (int i = 0; i < list.size(); ++i) { + Entity entity = (Entity) list.get(i); this.applyEntityCollision(entity); } } } - @Override - public boolean canDespawn() - { - return false; - } + @Override + public boolean canDespawn() { + return false; + } - @Override - public boolean canBePushed() - { - return false; - } + @Override + public boolean canBePushed() { + return false; + } - @Override - public boolean canBeCollidedWith() - { - return !this.isDead; - } + @Override + public boolean canBeCollidedWith() { + return !this.isDead; + } - @Override - public void addVelocity(double d, double d1, double d2) - { - } + @Override + public void addVelocity(double d, double d1, double d2) { + } - @Override + @Override @SideOnly(Side.CLIENT) - public void setVelocity(double x, double y, double z) - { + public void setVelocity(double x, double y, double z) { } - @Override - public void knockBack(Entity par1Entity, float par2, double par3, double par5) - { + @Override + public void knockBack(Entity par1Entity, float par2, double par3, double par5) { - } - - public void reset() - { - this.moveTime = 0; - - this.stop(); - this.openDoor(); - this.setAwake(false); - this.setAttackTarget(null); - this.setHealth(this.getMaxHealth()); - this.setPositionAndUpdate(this.dungeonX + 8, this.dungeonY + 2, this.dungeonZ + 8); - } - - public List getPlayersInDungeon(EntityPlayer player) - { - return this.worldObj.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(this.dungeonX, this.dungeonY, this.dungeonZ, this.dungeonX, this.dungeonY, this.dungeonZ).expand(10, 10, 10)); } - public void setDungeon(double posX, double posY, double posZ) - { - this.dungeonX = (int) posX; - this.dungeonY = (int) posY; - this.dungeonZ = (int) posZ; - } + public void reset() { + this.moveTime = 0; - public void setAwake(boolean isAwake) - { - this.dataWatcher.updateObject(18, new Byte(isAwake ? (byte) 1 : (byte) 0)); - } - - public boolean isAwake() - { - return this.dataWatcher.getWatchableObjectByte(18) == (byte) 1; - } - - public void setMoving(boolean moving) - { - this.dataWatcher.updateObject(20, new Byte(moving ? (byte) 1 : (byte) 0)); - } - - public boolean isMoving() - { - return this.dataWatcher.getWatchableObjectByte(20) == (byte) 1; - } - - public String getName() - { - return this.dataWatcher.getWatchableObjectString(19); + this.stop(); + this.openDoor(); + this.setAwake(false); + this.setAttackTarget(null); + this.setHealth(this.getMaxHealth()); + this.setPositionAndUpdate(this.dungeonX + 8, this.dungeonY + 2, this.dungeonZ + 8); } - public void setBossName(String name) - { - this.dataWatcher.updateObject(19, name); - } + public List getPlayersInDungeon(EntityPlayer player) { + return this.worldObj.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(this.dungeonX, this.dungeonY, this.dungeonZ, this.dungeonX, this.dungeonY, this.dungeonZ).expand(10, 10, 10)); + } - @Override - public String getBossName() - { - return this.dataWatcher.getWatchableObjectString(19) + ", the Slider"; - } + public void setDungeon(double posX, double posY, double posZ) { + this.dungeonX = (int) posX; + this.dungeonY = (int) posY; + this.dungeonZ = (int) posZ; + } - @Override - public float getBossHealth() - { - return this.getHealth(); - } + public void setAwake(boolean isAwake) { + this.dataWatcher.updateObject(18, new Byte(isAwake ? (byte) 1 : (byte) 0)); + } - @Override - public float getMaxBossHealth() - { - return this.getMaxHealth(); - } + public boolean isAwake() { + return this.dataWatcher.getWatchableObjectByte(18) == (byte) 1; + } + + public void setMoving(boolean moving) { + this.dataWatcher.updateObject(20, new Byte(moving ? (byte) 1 : (byte) 0)); + } + + public boolean isMoving() { + return this.dataWatcher.getWatchableObjectByte(20) == (byte) 1; + } + + public String getName() { + return this.dataWatcher.getWatchableObjectString(19); + } + + public void setBossName(String name) { + this.dataWatcher.updateObject(19, name); + } + + @Override + public String getBossName() { + return this.dataWatcher.getWatchableObjectString(19) + ", the Slider"; + } + + @Override + public float getBossHealth() { + return this.getHealth(); + } + + @Override + public float getMaxBossHealth() { + return this.getMaxHealth(); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/bosses/sun_spirit/EntitySunSpirit.java b/src/main/java/com/legacy/aether/entities/bosses/sun_spirit/EntitySunSpirit.java index 7e6c7f7..9bda334 100644 --- a/src/main/java/com/legacy/aether/entities/bosses/sun_spirit/EntitySunSpirit.java +++ b/src/main/java/com/legacy/aether/entities/bosses/sun_spirit/EntitySunSpirit.java @@ -33,8 +33,7 @@ import com.legacy.aether.items.ItemsAether; import com.legacy.aether.player.PlayerAether; import com.legacy.aether.registry.achievements.AchievementsAether; -public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss -{ +public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss { public int originPointX, originPointY, originPointZ; @@ -48,75 +47,66 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss public double rotary; public double velocity; - public EntitySunSpirit(World worldIn) - { + public EntitySunSpirit(World worldIn) { super(worldIn); this.setSize(2.25F, 2.5F); - this.dataWatcher.updateObject(20, AetherNameGen.gen()); + this.dataWatcher.updateObject(20, AetherNameGen.gen()); } - public EntitySunSpirit(World worldIn, int posX, int posY, int posZ, int var6) - { + public EntitySunSpirit(World worldIn, int posX, int posY, int posZ, int var6) { this(worldIn); this.noClip = true; this.direction = var6; - this.rotary = (double)this.rand.nextFloat() * 360.0D;; + this.rotary = (double) this.rand.nextFloat() * 360.0D; + ; this.rotationYaw = this.rotationYawHead = var6 == 3 ? 0 : var6 == 0 ? 90 : var6 == 2 ? 180 : 270; - this.setPosition((double)posX + 0.5D, (double)posY, (double)posZ + 0.5D); + this.setPosition((double) posX + 0.5D, (double) posY, (double) posZ + 0.5D); this.setOriginPosition((int) posX, (int) posY, (int) posZ); } - @Override - public void entityInit() - { - super.entityInit(); + @Override + public void entityInit() { + super.entityInit(); - this.dataWatcher.addObject(18, new Byte((byte) 0)); - this.dataWatcher.addObject(19, new Byte((byte) 0)); - this.dataWatcher.addObject(20, AetherNameGen.gen()); - } + this.dataWatcher.addObject(18, new Byte((byte) 0)); + this.dataWatcher.addObject(19, new Byte((byte) 0)); + this.dataWatcher.addObject(20, AetherNameGen.gen()); + } - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D); } - public boolean isPotionApplicable(PotionEffect par1PotionEffect) - { + public boolean isPotionApplicable(PotionEffect par1PotionEffect) { return false; } - public boolean canDespawn() - { + public boolean canDespawn() { return false; } - @Override - protected String getHurtSound() - { - return null; - } - - @Override - protected String getDeathSound() - { + @Override + protected String getHurtSound() { return null; } - public boolean isDead() - { + @Override + protected String getDeathSound() { + return null; + } + + public boolean isDead() { return this.getHealth() <= 0.0F || this.isDead; } - public void writeEntityToNBT(NBTTagCompound tag) - { + public void writeEntityToNBT(NBTTagCompound tag) { super.writeEntityToNBT(tag); tag.setInteger("originPointX", this.originPointX); @@ -129,8 +119,7 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss tag.setBoolean("isFreezing", this.isFreezing()); } - public void readEntityFromNBT(NBTTagCompound tag) - { + public void readEntityFromNBT(NBTTagCompound tag) { super.readEntityFromNBT(tag); this.originPointX = tag.getInteger("originPointX"); @@ -139,53 +128,45 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss this.direction = tag.getInteger("dungeonDirection"); this.setChatLine(tag.getInteger("chatLog")); - this.setBossName(tag.getString("bossName")); - this.setFreezing(tag.getBoolean("isFreezing")); + this.setBossName(tag.getString("bossName")); + this.setFreezing(tag.getBoolean("isFreezing")); } - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); - this.velocity = 0.5D - (double)this.getHealth() / 70.0D * 0.2D; + this.velocity = 0.5D - (double) this.getHealth() / 70.0D * 0.2D; this.width = this.height = 2.0F; - if (this.getAttackTarget() instanceof EntityPlayer) - { - List dungeonPlayers = this.getPlayersInDungeon(); - EntityPlayer dungeonTarget = (EntityPlayer) this.getAttackTarget(); - PlayerAether playerAether = PlayerAether.get(dungeonTarget); + if (this.getAttackTarget() instanceof EntityPlayer) { + List dungeonPlayers = this.getPlayersInDungeon(); + EntityPlayer dungeonTarget = (EntityPlayer) this.getAttackTarget(); + PlayerAether playerAether = PlayerAether.get(dungeonTarget); - for (int i = 0; i < dungeonPlayers.size(); ++i) - { - Entity entity = (Entity) dungeonPlayers.get(i); + for (int i = 0; i < dungeonPlayers.size(); ++i) { + Entity entity = (Entity) dungeonPlayers.get(i); - if (entity instanceof EntityPlayer) - { - PlayerAether dungeonPA = PlayerAether.get((EntityPlayer) entity); + if (entity instanceof EntityPlayer) { + PlayerAether dungeonPA = PlayerAether.get((EntityPlayer) entity); - if (dungeonPA.getFocusedBoss() != this) - { - dungeonPA.setFocusedBoss(this); - } - } - } + if (dungeonPA.getFocusedBoss() != this) { + dungeonPA.setFocusedBoss(this); + } + } + } - if (dungeonTarget.isDead) - { - for (int i = 0; i < dungeonPlayers.size(); ++i) - { - Entity entity = (Entity) dungeonPlayers.get(i); + if (dungeonTarget.isDead) { + for (int i = 0; i < dungeonPlayers.size(); ++i) { + Entity entity = (Entity) dungeonPlayers.get(i); - if (entity instanceof EntityPlayer) - { - PlayerAether dungeonPA = PlayerAether.get((EntityPlayer) entity); + if (entity instanceof EntityPlayer) { + PlayerAether dungeonPA = PlayerAether.get((EntityPlayer) entity); - dungeonPA.setFocusedBoss(null); - } - } + dungeonPA.setFocusedBoss(null); + } + } - this.setPosition((double)this.originPointX + 0.5D, (double)this.originPointY, (double)this.originPointZ + 0.5D); + this.setPosition((double) this.originPointX + 0.5D, (double) this.originPointY, (double) this.originPointZ + 0.5D); this.chatLog = 10; @@ -194,44 +175,38 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss this.chatLine(dungeonTarget, "\u00a7cSuch is the fate of a being who opposes the might of the sun."); this.chatCount = 100; - this.setPosition((double)this.originPointX + 0.5D, (double)this.originPointY, (double)this.originPointZ + 0.5D); + this.setPosition((double) this.originPointX + 0.5D, (double) this.originPointY, (double) this.originPointZ + 0.5D); this.setDoor(Blocks.air); this.setFreezing(false); this.setAttackTarget(null); this.setHealth(this.getMaxHealth()); - } - else - { - playerAether.setFocusedBoss(this); - } + } else { + playerAether.setFocusedBoss(this); + } - if (this.isDead()) - { + if (this.isDead()) { this.chatLine(dungeonTarget, "\u00a7bSuch bitter cold... is this the feeling... of pain?"); this.chatCount = 100; - for (int i = 0; i < dungeonPlayers.size(); ++i) - { - Entity entity = (Entity) dungeonPlayers.get(i); + for (int i = 0; i < dungeonPlayers.size(); ++i) { + Entity entity = (Entity) dungeonPlayers.get(i); - if (entity instanceof EntityPlayer) - { - ((EntityPlayer) entity).triggerAchievement(AchievementsAether.defeat_gold); - } - } + if (entity instanceof EntityPlayer) { + ((EntityPlayer) entity).triggerAchievement(AchievementsAether.defeat_gold); + } + } dungeonTarget.triggerAchievement(AchievementsAether.defeat_gold); this.setDoor(Blocks.air); - this.unlockTreasure(); - } + this.unlockTreasure(); + } } this.setFreezing(this.hurtTime > 0); - if (this.getHealth() > 0) - { + if (this.getHealth() > 0) { double xCoord = this.posX + (this.rand.nextFloat() - 0.5F) * this.rand.nextFloat(); double yCoord = this.boundingBox.minY + this.rand.nextFloat() - 0.5D; double zCoord = this.posZ + (this.rand.nextFloat() - 0.5F) * this.rand.nextFloat(); @@ -242,54 +217,42 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss this.evapWater(); } - if (this.chatCount > 0) - { + if (this.chatCount > 0) { --this.chatCount; } } @Override - protected void updateEntityActionState() - { + protected void updateEntityActionState() { super.updateEntityActionState(); - if (this.getAttackTarget() != null) - { + if (this.getAttackTarget() != null) { this.motionY = 0.0D; this.renderYawOffset = this.rotationYaw; - this.setPosition(this.posX, (double)this.originPointY, this.posZ); + this.setPosition(this.posX, (double) this.originPointY, this.posZ); boolean changedCourse = false; - if (this.motionX >= 0.0D && this.posX > (double)this.originPointX + 8.5D) - { + if (this.motionX >= 0.0D && this.posX > (double) this.originPointX + 8.5D) { this.rotary = 360.0D - this.rotary; changedCourse = true; - } - else if (this.motionX <= 0.0D && this.posX < (double)this.originPointX - 10D) - { + } else if (this.motionX <= 0.0D && this.posX < (double) this.originPointX - 10D) { this.rotary = 360.0D - this.rotary; changedCourse = true; } - if (this.motionZ >= 0.0D && this.posZ > (double)this.originPointZ + 10.0D) - { + if (this.motionZ >= 0.0D && this.posZ > (double) this.originPointZ + 10.0D) { this.rotary = 180.0D - this.rotary; changedCourse = true; - } - else if (this.motionZ <= 0.0D && this.posZ < (double)this.originPointZ - 9.0D) - { + } else if (this.motionZ <= 0.0D && this.posZ < (double) this.originPointZ - 9.0D) { this.rotary = 180.0D - this.rotary; changedCourse = true; } - if (this.rotary > 360.0D) - { + if (this.rotary > 360.0D) { this.rotary -= 360.0D; - } - else if (this.rotary < 0.0D) - { + } else if (this.rotary < 0.0D) { this.rotary += 360.0D; } @@ -302,11 +265,9 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss ++this.motionTimer; - if (this.motionTimer >= 20 || changedCourse) - { - if (this.rand.nextInt(3) == 0) - { - this.rotary += (double)(this.rand.nextFloat() - this.rand.nextFloat()) * 60.0D; + if (this.motionTimer >= 20 || changedCourse) { + if (this.rand.nextInt(3) == 0) { + this.rotary += (double) (this.rand.nextFloat() - this.rand.nextFloat()) * 60.0D; } this.motionTimer = 0; @@ -314,12 +275,9 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss ++this.flameCount; - if (this.flameCount == 40) - { + if (this.flameCount == 40) { this.summonFire(); - } - else if (this.flameCount >= 55 + this.getHealth() / 2) - { + } else if (this.flameCount >= 55 + this.getHealth() / 2) { this.makeFireBall(1); this.flameCount = 0; } @@ -327,51 +285,41 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss } @Override - public void updateAITasks() - { + public void updateAITasks() { super.updateAITasks(); } - public void burnEntities() - { + public void burnEntities() { List entityList = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.0D, 4.0D, 0.0D)); - for (int ammount = 0; ammount < entityList.size(); ++ammount) - { - Entity entity = (Entity)entityList.get(ammount); + for (int ammount = 0; ammount < entityList.size(); ++ammount) { + Entity entity = (Entity) entityList.get(ammount); - if (entity instanceof EntityLivingBase && !entity.isImmuneToFire()) - { - entity.attackEntityFrom(DamageSource.causeMobDamage(this), 10); - entity.setFire(15); + if (entity instanceof EntityLivingBase && !entity.isImmuneToFire()) { + entity.attackEntityFrom(DamageSource.causeMobDamage(this), 10); + entity.setFire(15); } } } - public void evapWater() - { + public void evapWater() { int var1 = MathHelper.floor_double(this.boundingBox.minX + (this.boundingBox.maxX - this.boundingBox.minX) / 2.0D); int var2 = MathHelper.floor_double(this.boundingBox.minZ + (this.boundingBox.maxZ - this.boundingBox.minZ) / 2.0D); byte radius = 10; - for (int var4 = var1 - radius; var4 <= var1 + radius; ++var4) - { - for (int var5 = var2 - radius; var5 <= var2 + radius; ++var5) - { - for (int var6 = 0; var6 < 8; ++var6) - { + for (int var4 = var1 - radius; var4 <= var1 + radius; ++var4) { + for (int var5 = var2 - radius; var5 <= var2 + radius; ++var5) { + for (int var6 = 0; var6 < 8; ++var6) { int var7 = this.originPointY - 2 + var6; - if (this.worldObj.getBlock(var4, var7, var5).getMaterial() == Material.water) - { + if (this.worldObj.getBlock(var4, var7, var5).getMaterial() == Material.water) { this.worldObj.setBlock(var4, var7, var5, Blocks.air); this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.fizz", 2.0F, this.rand.nextFloat() - this.rand.nextFloat() * 0.2F + 1.2F); - for (int var8 = 0; var8 < 8; ++var8) - { - this.worldObj.spawnParticle("largesmoke", (double)var4 + Math.random(), (double)var7 + 0.75D, (double)var5 + Math.random(), 0.0D, 0.0D, 0.0D); + for (int var8 = 0; var8 < 8; ++var8) { + this.worldObj.spawnParticle("largesmoke", (double) var4 + Math.random(), (double) var7 + 0.75D, (double) var5 + Math.random(), 0.0D, 0.0D, 0.0D); } } } @@ -379,126 +327,93 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss } } - public void makeFireBall(int var1) - { - this.worldObj.playSoundAtEntity(this, "mob.ghast.fireball", this.rand.nextFloat() - this.rand.nextFloat() * 0.2F + 1.2F, 1.0F); + public void makeFireBall(int var1) { + this.worldObj.playSoundAtEntity(this, "mob.ghast.fireball", this.rand.nextFloat() - this.rand.nextFloat() * 0.2F + 1.2F, 1.0F); boolean shootIceyBall = false; ++this.ballCount; - if (this.ballCount >= 2 + this.rand.nextInt(3)) - { - shootIceyBall = true; + if (this.ballCount >= 2 + this.rand.nextInt(3)) { + shootIceyBall = true; this.ballCount = 0; } - for (int var3 = 0; var3 < var1; ++var3) - { - EntityCrystal crystal = new EntityCrystal(this.worldObj, this.posX - this.motionX / 2.0D, this.posY, this.posZ - this.motionZ / 2.0D, shootIceyBall ? EnumCrystalType.ICE : EnumCrystalType.FIRE); + for (int var3 = 0; var3 < var1; ++var3) { + EntityCrystal crystal = new EntityCrystal(this.worldObj, this.posX - this.motionX / 2.0D, this.posY, this.posZ - this.motionZ / 2.0D, shootIceyBall ? EnumCrystalType.ICE : EnumCrystalType.FIRE); - if (!this.worldObj.isRemote) - { - this.worldObj.spawnEntityInWorld(crystal); - } + if (!this.worldObj.isRemote) { + this.worldObj.spawnEntityInWorld(crystal); + } } } - public void summonFire() - { + public void summonFire() { int x = MathHelper.floor_double(this.posX); int z = MathHelper.floor_double(this.posZ); int y = this.originPointY - 2; - if (this.worldObj.isAirBlock(x, y, z)) - { + if (this.worldObj.isAirBlock(x, y, z)) { this.worldObj.setBlock(x, y, z, Blocks.fire); } } - private void chatLine(EntityPlayer player, String s) - { - List dungeonPlayers = this.getPlayersInDungeon(); + private void chatLine(EntityPlayer player, String s) { + List dungeonPlayers = this.getPlayersInDungeon(); - for (int i = 0; i < dungeonPlayers.size(); ++i) - { - Entity entity = (Entity) dungeonPlayers.get(i); + for (int i = 0; i < dungeonPlayers.size(); ++i) { + Entity entity = (Entity) dungeonPlayers.get(i); - if (entity instanceof EntityPlayer) - { - if (this.chatCount <= 0) - { - Aether.proxy.sendMessage((EntityPlayer) entity, s); - } - } - } + if (entity instanceof EntityPlayer) { + if (this.chatCount <= 0) { + Aether.proxy.sendMessage((EntityPlayer) entity, s); + } + } + } - Aether.proxy.sendMessage(player, s); + Aether.proxy.sendMessage(player, s); } - public boolean chatWithMe(EntityPlayer entityPlayer) - { - if (this.chatCount <= 0) - { - if (this.getChatLine() == 0) - { + public boolean chatWithMe(EntityPlayer entityPlayer) { + if (this.chatCount <= 0) { + if (this.getChatLine() == 0) { this.chatLine(entityPlayer, "\u00a7cYou are certainly a brave soul to have entered this chamber."); this.setChatLine(1); - } - else if (this.getChatLine() == 1) - { + } else if (this.getChatLine() == 1) { this.chatLine(entityPlayer, "\u00a7cBegone human, you serve no purpose here."); this.setChatLine(2); - } - else if (this.getChatLine() == 2) - { + } else if (this.getChatLine() == 2) { this.chatLine(entityPlayer, "\u00a7cYour presence annoys me. Do you not fear my burning aura?"); this.setChatLine(3); - } - else if (this.getChatLine() == 3) - { + } else if (this.getChatLine() == 3) { this.chatLine(entityPlayer, "\u00a7cI have nothing to offer you, fool. Leave me at peace."); this.setChatLine(4); - } - else if (this.getChatLine() == 4) - { + } else if (this.getChatLine() == 4) { this.chatLine(entityPlayer, "\u00a7cPerhaps you are ignorant. Do you wish to know who I am?"); this.setChatLine(5); - } - else if (this.getChatLine() == 5) - { + } else if (this.getChatLine() == 5) { this.chatLine(entityPlayer, "\u00a7cI am a sun spirit, embodiment of Aether's eternal daylight. As "); this.chatLine(entityPlayer, "\u00a7clong as I am alive, the sun will never set on this world."); this.setChatLine(6); - } - else if (this.getChatLine() == 6) - { + } else if (this.getChatLine() == 6) { this.chatLine(entityPlayer, "\u00a7cMy body burns with the anger of a thousand beasts. No man, "); this.chatLine(entityPlayer, "\u00a7chero, or villain can harm me. You are no exception."); this.setChatLine(7); - } - else if (this.getChatLine() == 7) - { + } else if (this.getChatLine() == 7) { this.chatLine(entityPlayer, "\u00a7cYou wish to challenge the might of the sun? You are mad. "); this.chatLine(entityPlayer, "\u00a7cDo not further insult me or you will feel my wrath."); this.setChatLine(8); - } - else if (this.getChatLine() == 8) - { + } else if (this.getChatLine() == 8) { this.chatLine(entityPlayer, "\u00a7cThis is your final warning. Leave now, or prepare to burn."); this.setChatLine(9); - } - else - { - if (this.getChatLine() == 9) - { + } else { + if (this.getChatLine() == 9) { this.chatLine(entityPlayer, "\u00a76As you wish, your death will be slow and agonizing."); this.setChatLine(10); return true; } - if (this.getChatLine() == 10 && this.getAttackTarget() == null) - { + if (this.getChatLine() == 10 && this.getAttackTarget() == null) { this.chatLine(entityPlayer, "\u00a7cDid your previous death not satisfy your curiosity, human?"); this.setChatLine(9); } @@ -509,10 +424,8 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss } @Override - public boolean interact(EntityPlayer player) - { - if (this.chatWithMe(player)) - { + public boolean interact(EntityPlayer player) { + if (this.chatWithMe(player)) { this.rotary = (180D / Math.PI) * Math.atan2(this.posX - player.posX, this.posZ - player.posZ); this.setAttackTarget(player); this.setDoor(BlocksAether.locked_hellfire_stone); @@ -524,55 +437,44 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss } @Override - public void addVelocity(double x, double y, double z) - { + public void addVelocity(double x, double y, double z) { } @Override - public void knockBack(Entity entity, float strength, double xRatio, double zRatio) - { + public void knockBack(Entity entity, float strength, double xRatio, double zRatio) { } @Override - public boolean attackEntityFrom(DamageSource source, float amount) - { - if (source.getEntity() instanceof EntityCrystal && ((EntityCrystal)source.getEntity()).getCrystalType() == EnumCrystalType.ICE) - { - this.velocity = 0.5D - (double)this.getHealth() / 70.0D * 0.2D; + public boolean attackEntityFrom(DamageSource source, float amount) { + if (source.getEntity() instanceof EntityCrystal && ((EntityCrystal) source.getEntity()).getCrystalType() == EnumCrystalType.ICE) { + this.velocity = 0.5D - (double) this.getHealth() / 70.0D * 0.2D; boolean flag = super.attackEntityFrom(source, amount); - if (flag) - { + if (flag) { EntityFireMinion minion = new EntityFireMinion(this.worldObj); minion.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); - - if (!this.worldObj.isRemote) - { + + if (!this.worldObj.isRemote) { this.worldObj.spawnEntityInWorld(minion); } } return flag; - } - else - { + } else { return false; } } @Override - protected void dropFewItems(boolean var1, int var2) - { + protected void dropFewItems(boolean var1, int var2) { this.entityDropItem(new ItemStack(ItemsAether.dungeon_key, 1, 2), 0.5F); } @Override - public EntityItem entityDropItem(ItemStack stack, float offsetY) - { - if (stack.stackSize != 0 && stack.getItem() != null) - { - EntityAetherItem entityitem = new EntityAetherItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, stack); + public EntityItem entityDropItem(ItemStack stack, float offsetY) { + if (stack.stackSize != 0 && stack.getItem() != null) { + EntityAetherItem entityitem = new EntityAetherItem(this.worldObj, this.posX, this.posY + (double) offsetY, this.posZ, stack); if (this.captureDrops) this.capturedDrops.add(entityitem); @@ -580,146 +482,111 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss this.worldObj.spawnEntityInWorld(entityitem); return entityitem; - } - else - { + } else { return null; } } - private void setDoor(Block block) - { + private void setDoor(Block block) { int x, y, z; - if (this.direction / 2 == 0) - { - for (y = this.originPointY - 1; y < this.originPointY + 2; ++y) - { - for (z = this.originPointZ - 1; z < this.originPointZ + 2; ++z) - { - if (this.worldObj.getBlock(this.originPointX + (this.direction == 0 ? -13 : 13), y, z) != block) - { + if (this.direction / 2 == 0) { + for (y = this.originPointY - 1; y < this.originPointY + 2; ++y) { + for (z = this.originPointZ - 1; z < this.originPointZ + 2; ++z) { + if (this.worldObj.getBlock(this.originPointX + (this.direction == 0 ? -13 : 13), y, z) != block) { this.worldObj.setBlock(this.originPointX + (this.direction == 0 ? -13 : 13), y, z, block); - } + } } } - } - else - { - for (y = this.originPointY - 1; y < this.originPointY + 2; ++y) - { - for (x = this.originPointX - 1; x < this.originPointX + 2; ++x) - { - if (this.worldObj.getBlock(x, y, this.originPointZ + (this.direction == 3 ? 13 : -13)) != block) - { + } else { + for (y = this.originPointY - 1; y < this.originPointY + 2; ++y) { + for (x = this.originPointX - 1; x < this.originPointX + 2; ++x) { + if (this.worldObj.getBlock(x, y, this.originPointZ + (this.direction == 3 ? 13 : -13)) != block) { this.worldObj.setBlock(x, y, this.originPointZ + (this.direction == 3 ? 13 : -13), block); - } + } } } } } - private void unlockTreasure() - { - int x, y, z; + private void unlockTreasure() { + int x, y, z; - if (this.direction / 2 == 0) - { - for (y = this.originPointY - 1; y < this.originPointY + 2; ++y) - { - for (z = this.originPointZ - 1; z < this.originPointZ + 2; ++z) - { + if (this.direction / 2 == 0) { + for (y = this.originPointY - 1; y < this.originPointY + 2; ++y) { + for (z = this.originPointZ - 1; z < this.originPointZ + 2; ++z) { this.worldObj.setBlock(this.originPointX + (this.direction == 0 ? 13 : -13), y, z, Blocks.air); } } - } - else - { - for (y = this.originPointY - 1; y < this.originPointY + 2; ++y) - { - for (x = this.originPointX - 1; x < this.originPointX + 2; ++x) - { + } else { + for (y = this.originPointY - 1; y < this.originPointY + 2; ++y) { + for (x = this.originPointX - 1; x < this.originPointX + 2; ++x) { this.worldObj.setBlock(x, y, this.originPointZ + (this.direction == 3 ? -13 : 13), Blocks.air); } } } - for (x = this.originPointX - 20; x < this.originPointX + 20; ++x) - { - for (y = this.originPointY - 3; y < this.originPointY + 6; ++y) - { - for (z = this.originPointZ - 20; z < this.originPointZ + 20; ++z) - { - Block unlock_block = this.worldObj.getBlock(x, y, z); + for (x = this.originPointX - 20; x < this.originPointX + 20; ++x) { + for (y = this.originPointY - 3; y < this.originPointY + 6; ++y) { + for (z = this.originPointZ - 20; z < this.originPointZ + 20; ++z) { + Block unlock_block = this.worldObj.getBlock(x, y, z); - if (unlock_block == BlocksAether.locked_hellfire_stone || unlock_block == BlocksAether.locked_light_hellfire_stone) - { - this.worldObj.setBlock(x, y, z, ((BlockDungeonBase)unlock_block).getUnlockedBlock()); - } - } - } + if (unlock_block == BlocksAether.locked_hellfire_stone || unlock_block == BlocksAether.locked_light_hellfire_stone) { + this.worldObj.setBlock(x, y, z, ((BlockDungeonBase) unlock_block).getUnlockedBlock()); + } + } + } } } - public List getPlayersInDungeon() - { - return this.worldObj.getEntitiesWithinAABBExcludingEntity(this.getAttackTarget(), AxisAlignedBB.getBoundingBox(this.originPointX, this.originPointY, this.originPointZ, this.originPointX, this.originPointY, this.originPointZ).expand(20, 3, 20)); + public List getPlayersInDungeon() { + return this.worldObj.getEntitiesWithinAABBExcludingEntity(this.getAttackTarget(), AxisAlignedBB.getBoundingBox(this.originPointX, this.originPointY, this.originPointZ, this.originPointX, this.originPointY, this.originPointZ).expand(20, 3, 20)); } - public void setOriginPosition(int x, int y, int z) - { - this.originPointX = x; - this.originPointY = y; - this.originPointZ = z; + public void setOriginPosition(int x, int y, int z) { + this.originPointX = x; + this.originPointY = y; + this.originPointZ = z; } - public int getChatLine() - { - return (int) this.dataWatcher.getWatchableObjectByte(18); + public int getChatLine() { + return (int) this.dataWatcher.getWatchableObjectByte(18); } - public void setChatLine(int lineNumber) - { + public void setChatLine(int lineNumber) { this.chatCount = 100; this.dataWatcher.updateObject(18, new Byte((byte) lineNumber)); } - public boolean isFreezing() - { - return this.dataWatcher.getWatchableObjectByte(19) == (byte) 1; + public boolean isFreezing() { + return this.dataWatcher.getWatchableObjectByte(19) == (byte) 1; } - public void setFreezing(boolean isFreezing) - { - this.dataWatcher.updateObject(19, new Byte(isFreezing ? (byte) 1 : (byte) 0)); + public void setFreezing(boolean isFreezing) { + this.dataWatcher.updateObject(19, new Byte(isFreezing ? (byte) 1 : (byte) 0)); } - public void setBossName(String name) - { - this.dataWatcher.updateObject(20, name); + public void setBossName(String name) { + this.dataWatcher.updateObject(20, name); } - public String getName() - { - return this.dataWatcher.getWatchableObjectString(20); + public String getName() { + return this.dataWatcher.getWatchableObjectString(20); } @Override - public String getBossName() - { - return this.dataWatcher.getWatchableObjectString(20) + ", the Sun Spirit"; + public String getBossName() { + return this.dataWatcher.getWatchableObjectString(20) + ", the Sun Spirit"; } - @Override - public float getBossHealth() - { - return this.getHealth(); - } + @Override + public float getBossHealth() { + return this.getHealth(); + } - @Override - public float getMaxBossHealth() - { - return this.getMaxHealth(); - } + @Override + public float getMaxBossHealth() { + return this.getMaxHealth(); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/bosses/valkyrie_queen/EntityValkyrieQueen.java b/src/main/java/com/legacy/aether/entities/bosses/valkyrie_queen/EntityValkyrieQueen.java index bc95a8e..3a34004 100644 --- a/src/main/java/com/legacy/aether/entities/bosses/valkyrie_queen/EntityValkyrieQueen.java +++ b/src/main/java/com/legacy/aether/entities/bosses/valkyrie_queen/EntityValkyrieQueen.java @@ -41,10 +41,9 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss -{ +public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss { - private EntityAIAttackContinuously enhancedCombat = new EntityAIAttackContinuously(this, 0.65D); + private EntityAIAttackContinuously enhancedCombat = new EntityAIAttackContinuously(this, 0.65D); public int angerLevel; @@ -60,36 +59,34 @@ public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss public double lastMotionY; - public EntityValkyrieQueen(World world) - { + public EntityValkyrieQueen(World world) { super(world); this.timeUntilTeleport = this.rand.nextInt(250); this.registerEntityAI(); - this.dataWatcher.updateObject(19, AetherNameGen.valkGen()); - this.safeX = posX; this.safeY = posY; this.safeZ = posZ; + this.dataWatcher.updateObject(19, AetherNameGen.valkGen()); + this.safeX = posX; + this.safeY = posY; + this.safeZ = posZ; } - public EntityValkyrieQueen(World world, double x, double y, double z) - { + public EntityValkyrieQueen(World world, double x, double y, double z) { this(world); this.safeX = posX = x; this.safeY = posY = y; this.safeZ = posZ = z; } - @Override - public void entityInit() - { - super.entityInit(); + @Override + public void entityInit() { + super.entityInit(); - this.dataWatcher.addObject(18, new Byte((byte) 0)); - this.dataWatcher.addObject(19, AetherNameGen.valkGen()); - } + this.dataWatcher.addObject(18, new Byte((byte) 0)); + this.dataWatcher.addObject(19, AetherNameGen.valkGen()); + } - public void registerEntityAI() - { + public void registerEntityAI() { this.targetTasks.addTask(0, this.enhancedCombat); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new ValkyrieQueenAIWander(this, 0.5D)); @@ -97,211 +94,166 @@ public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss } @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); + protected void applyEntityAttributes() { + super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(28.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.85D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(13.0D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(500.0D); - } - - @Override - protected boolean isMovementBlocked() - { - return !this.isBossReady(); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(28.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.85D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(13.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(500.0D); } @Override - public void addVelocity(double x, double y, double z) - { - if (this.isBossReady()) - { - super.addVelocity(x, y, z); - } + protected boolean isMovementBlocked() { + return !this.isBossReady(); } - public void swingArm() - { - if (!this.isSwingInProgress) - { - this.isSwingInProgress = true; + @Override + public void addVelocity(double x, double y, double z) { + if (this.isBossReady()) { + super.addVelocity(x, y, z); } } - private void becomeAngryAt(EntityLivingBase entity) - { - this.setTarget(entity); + public void swingArm() { + if (!this.isSwingInProgress) { + this.isSwingInProgress = true; + } + } - this.angerLevel = 200 + this.rand.nextInt(200); - - for (int k = this.dungeonZ + 2; k < this.dungeonZ + 23; k += 7) - { - Block block = this.worldObj.getBlock(this.dungeonX - 1, this.dungeonY, k); + private void becomeAngryAt(EntityLivingBase entity) { + this.setTarget(entity); - if (block != BlocksAether.locked_angelic_stone || block != BlocksAether.locked_light_angelic_stone) - { - this.dungeonEntranceZ = k; - this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY, k, BlocksAether.angelic_stone, 0, 2); - this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY, k + 1, BlocksAether.angelic_stone, 0, 2); - this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY + 1, k + 1, BlocksAether.angelic_stone, 0, 2); - this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY + 1, k, BlocksAether.angelic_stone, 0, 2); + this.angerLevel = 200 + this.rand.nextInt(200); + + for (int k = this.dungeonZ + 2; k < this.dungeonZ + 23; k += 7) { + Block block = this.worldObj.getBlock(this.dungeonX - 1, this.dungeonY, k); + + if (block != BlocksAether.locked_angelic_stone || block != BlocksAether.locked_light_angelic_stone) { + this.dungeonEntranceZ = k; + this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY, k, BlocksAether.angelic_stone, 0, 2); + this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY, k + 1, BlocksAether.angelic_stone, 0, 2); + this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY + 1, k + 1, BlocksAether.angelic_stone, 0, 2); + this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY + 1, k, BlocksAether.angelic_stone, 0, 2); return; } } } - public void setDungeon(int i, int j, int k) - { - this.dungeonX = i; - this.dungeonY = j; - this.dungeonZ = k - 19; + public void setDungeon(int i, int j, int k) { + this.dungeonX = i; + this.dungeonY = j; + this.dungeonZ = k - 19; } - private void unlockDoor() - { - this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY, this.dungeonEntranceZ, Blocks.air); - this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY, this.dungeonEntranceZ + 1, Blocks.air); - this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY + 1, this.dungeonEntranceZ + 1, Blocks.air); - this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY + 1, this.dungeonEntranceZ, Blocks.air); + private void unlockDoor() { + this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY, this.dungeonEntranceZ, Blocks.air); + this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY, this.dungeonEntranceZ + 1, Blocks.air); + this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY + 1, this.dungeonEntranceZ + 1, Blocks.air); + this.worldObj.setBlock(this.dungeonX - 1, this.dungeonY + 1, this.dungeonEntranceZ, Blocks.air); } - private void unlockTreasure() - { - this.worldObj.setBlock(this.dungeonX + 16, dungeonY + 1, dungeonZ + 9, Blocks.trapdoor, 3, 2); - this.worldObj.setBlock(this.dungeonX + 17, dungeonY + 1, dungeonZ + 9, Blocks.trapdoor, 2, 2); - this.worldObj.setBlock(this.dungeonX + 16, dungeonY + 1, dungeonZ + 10, Blocks.trapdoor, 3, 2); - this.worldObj.setBlock(this.dungeonX + 17, dungeonY + 1, dungeonZ + 10, Blocks.trapdoor, 2, 2); + private void unlockTreasure() { + this.worldObj.setBlock(this.dungeonX + 16, dungeonY + 1, dungeonZ + 9, Blocks.trapdoor, 3, 2); + this.worldObj.setBlock(this.dungeonX + 17, dungeonY + 1, dungeonZ + 9, Blocks.trapdoor, 2, 2); + this.worldObj.setBlock(this.dungeonX + 16, dungeonY + 1, dungeonZ + 10, Blocks.trapdoor, 3, 2); + this.worldObj.setBlock(this.dungeonX + 17, dungeonY + 1, dungeonZ + 10, Blocks.trapdoor, 2, 2); - for (int x = this.dungeonX - 27; x < this.dungeonX + 30; x++) - { - for (int y = this.dungeonY - 1; y < this.dungeonY + 22; y++) - { - for (int z = this.dungeonZ - 6; z < this.dungeonZ + 26; z++) - { + for (int x = this.dungeonX - 27; x < this.dungeonX + 30; x++) { + for (int y = this.dungeonY - 1; y < this.dungeonY + 22; y++) { + for (int z = this.dungeonZ - 6; z < this.dungeonZ + 26; z++) { Block block = this.worldObj.getBlock(x, y, z); - if (block == BlocksAether.locked_angelic_stone || block == BlocksAether.locked_light_angelic_stone) - { - this.worldObj.setBlock(x, y, z, ((BlockDungeonBase)block).getUnlockedBlock()); + if (block == BlocksAether.locked_angelic_stone || block == BlocksAether.locked_light_angelic_stone) { + this.worldObj.setBlock(x, y, z, ((BlockDungeonBase) block).getUnlockedBlock()); } } } } } - private void chatItUp(EntityPlayer player, String s) - { - Side side = FMLCommonHandler.instance().getEffectiveSide(); + private void chatItUp(EntityPlayer player, String s) { + Side side = FMLCommonHandler.instance().getEffectiveSide(); - if (this.chatTime <= 0) - { - if (side.isClient()) - { + if (this.chatTime <= 0) { + if (side.isClient()) { Aether.proxy.sendMessage(player, s); - } + } this.chatTime = 60; } } - public void makeHomeShot(int shots, EntityPlayer player) - { - for (int i = 0; i < shots; i++) - { - EntityCrystal crystal = new EntityCrystal(this.worldObj, this.posX - (this.motionX / 2D), this.posY, this.posZ - (this.motionZ / 2D), player); + public void makeHomeShot(int shots, EntityPlayer player) { + for (int i = 0; i < shots; i++) { + EntityCrystal crystal = new EntityCrystal(this.worldObj, this.posX - (this.motionX / 2D), this.posY, this.posZ - (this.motionZ / 2D), player); - if (!this.worldObj.isRemote) - { - this.worldObj.spawnEntityInWorld(crystal); - } + if (!this.worldObj.isRemote) { + this.worldObj.spawnEntityInWorld(crystal); + } } } @SideOnly(Side.CLIENT) - public void displayValkyrieDialogue() - { - if (this.worldObj.isRemote) - { - FMLClientHandler.instance().getClient().displayGuiScreen(new GuiValkyrieDialogue(this)); - } + public void displayValkyrieDialogue() { + if (this.worldObj.isRemote) { + FMLClientHandler.instance().getClient().displayGuiScreen(new GuiValkyrieDialogue(this)); + } } @Override - public boolean interact(EntityPlayer entityplayer) - { - this.faceEntity(entityplayer, 180F, 180F); + public boolean interact(EntityPlayer entityplayer) { + this.faceEntity(entityplayer, 180F, 180F); - if(this.isBossReady()) - { - this.chatItUp(entityplayer, "If you wish to challenge me, strike at any time."); - } - else if (this.worldObj.isRemote) - { - this.displayValkyrieDialogue(); - } + if (this.isBossReady()) { + this.chatItUp(entityplayer, "If you wish to challenge me, strike at any time."); + } else if (this.worldObj.isRemote) { + this.displayValkyrieDialogue(); + } return true; } @Override - public void updateEntityActionState() - { - super.updateEntityActionState(); + public void updateEntityActionState() { + super.updateEntityActionState(); - if (!this.isBossReady()) - { - this.motionY *= .5f; - this.moveStrafing = this.moveForward = 0; - } - else - { - if (this.getEntityToAttack() instanceof EntityPlayer) - { - if (this.timeUntilTeleport++ >= 450) - { - if (this.onGround && this.rand.nextInt(10) == 0) - { + if (!this.isBossReady()) { + this.motionY *= .5f; + this.moveStrafing = this.moveForward = 0; + } else { + if (this.getEntityToAttack() instanceof EntityPlayer) { + if (this.timeUntilTeleport++ >= 450) { + if (this.onGround && this.rand.nextInt(10) == 0) { this.makeHomeShot(1, (EntityPlayer) this.getEntityToAttack()); + } else { + this.teleport(this.getEntityToAttack().posX, this.getEntityToAttack().posY, this.getEntityToAttack().posZ, 4); } - else - { - this.teleport(this.getEntityToAttack().posX, this.getEntityToAttack().posY, this.getEntityToAttack().posZ, 4); - } - } - else if (this.timeUntilTeleport < 446 && (this.posY <= 0D || this.posY <= (this.safeY - 16D))) - { - this.timeUntilTeleport = 446; - } - else if ((this.timeUntilTeleport % 5) == 0 && !canEntityBeSeen(this.getEntityToAttack())) - { - this.timeUntilTeleport += 100; + } else if (this.timeUntilTeleport < 446 && (this.posY <= 0D || this.posY <= (this.safeY - 16D))) { + this.timeUntilTeleport = 446; + } else if ((this.timeUntilTeleport % 5) == 0 && !canEntityBeSeen(this.getEntityToAttack())) { + this.timeUntilTeleport += 100; } } } - if (this.getEntityToAttack() != null && this.getEntityToAttack().isDead) - { - this.setTarget(null); + if (this.getEntityToAttack() != null && this.getEntityToAttack().isDead) { + this.setTarget(null); unlockDoor(); this.angerLevel = 0; } - if (this.chatTime > 0) - { - this.chatTime--; + if (this.chatTime > 0) { + this.chatTime--; } } @Override - public void onUpdate() - { - this.lastMotionY = motionY; + public void onUpdate() { + this.lastMotionY = motionY; super.onUpdate(); - if (!this.onGround && this.getEntityToAttack() != null && this.lastMotionY >= 0.0D && motionY < 0.0D && getDistanceToEntity(this.getEntityToAttack()) <= 16F && canEntityBeSeen(this.getEntityToAttack())) - { + if (!this.onGround && this.getEntityToAttack() != null && this.lastMotionY >= 0.0D && motionY < 0.0D && getDistanceToEntity(this.getEntityToAttack()) <= 16F && canEntityBeSeen(this.getEntityToAttack())) { double a = this.getEntityToAttack().posX - posX; double b = this.getEntityToAttack().posZ - posZ; double angle = Math.atan2(a, b); @@ -309,59 +261,48 @@ public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss this.motionZ = Math.cos(angle) * 0.25D; } - if (!this.onGround && !isOnLadder() && Math.abs(this.motionY - this.lastMotionY) > 0.07D && Math.abs(this.motionY - this.lastMotionY) < 0.09D) - { - this.motionY += 0.055F; - - if (this.motionY < -0.275F) - { - this.motionY = -0.275F; + if (!this.onGround && !isOnLadder() && Math.abs(this.motionY - this.lastMotionY) > 0.07D && Math.abs(this.motionY - this.lastMotionY) < 0.09D) { + this.motionY += 0.055F; + + if (this.motionY < -0.275F) { + this.motionY = -0.275F; } } - if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL && (this.getEntityToAttack() != null || this.angerLevel > 0)) - { - this.angerLevel = 0; + if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL && (this.getEntityToAttack() != null || this.angerLevel > 0)) { + this.angerLevel = 0; this.setTarget(null); } - if (!this.onGround) - { - this.sinage += 0.75F; - } - else - { - this.sinage += 0.15F; + if (!this.onGround) { + this.sinage += 0.75F; + } else { + this.sinage += 0.15F; } - if (this.sinage > 3.141593F * 2F) - { - this.sinage -= (3.141593F * 2F); + if (this.sinage > 3.141593F * 2F) { + this.sinage -= (3.141593F * 2F); } - if (this.getHealth() <= 0 || this.isDead) - { - this.unlockDoor(); - this.unlockTreasure(); + if (this.getHealth() <= 0 || this.isDead) { + this.unlockDoor(); + this.unlockTreasure(); - if (this.getEntityToAttack() instanceof EntityPlayer) - { - this.chatItUp((EntityPlayer) this.getEntityToAttack(), "You are truly... a mighty warrior..."); + if (this.getEntityToAttack() instanceof EntityPlayer) { + this.chatItUp((EntityPlayer) this.getEntityToAttack(), "You are truly... a mighty warrior..."); - ((EntityPlayer)this.getEntityToAttack()).triggerAchievement(AchievementsAether.defeat_silver); + ((EntityPlayer) this.getEntityToAttack()).triggerAchievement(AchievementsAether.defeat_silver); - PlayerAether.get((EntityPlayer) this.getEntityToAttack()).setFocusedBoss(null); - } + PlayerAether.get((EntityPlayer) this.getEntityToAttack()).setFocusedBoss(null); + } - this.spawnExplosionParticle(); - this.setDead(); + this.spawnExplosionParticle(); + this.setDead(); } - if (!otherDimension()) - { - this.timeLeft--; - if (this.timeLeft <= 0) - { + if (!otherDimension()) { + this.timeLeft--; + if (this.timeLeft <= 0) { spawnExplosionParticle(); this.setDead(); } @@ -369,14 +310,12 @@ public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss } @Override - protected Entity findPlayerToAttack() - { - return null; + protected Entity findPlayerToAttack() { + return null; } @Override - public void writeEntityToNBT(NBTTagCompound nbttagcompound) - { + public void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); nbttagcompound.setShort("Anger", (short) angerLevel); nbttagcompound.setShort("TimeLeft", (short) timeLeft); @@ -385,13 +324,12 @@ public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss nbttagcompound.setInteger("DungeonY", this.dungeonY); nbttagcompound.setInteger("DungeonZ", this.dungeonZ); nbttagcompound.setInteger("DungeonEntranceZ", this.dungeonEntranceZ); - nbttagcompound.setTag("SafePos", newDoubleNBTList(new double[] { this.safeX, this.safeY, this.safeZ })); + nbttagcompound.setTag("SafePos", newDoubleNBTList(new double[]{this.safeX, this.safeY, this.safeZ})); nbttagcompound.setString("BossName", this.getName()); } @Override - public void readEntityFromNBT(NBTTagCompound nbttagcompound) - { + public void readEntityFromNBT(NBTTagCompound nbttagcompound) { super.readEntityFromNBT(nbttagcompound); this.angerLevel = nbttagcompound.getShort("Anger"); this.timeLeft = nbttagcompound.getShort("TimeLeft"); @@ -409,133 +347,106 @@ public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss } @Override - public boolean attackEntityFrom(DamageSource ds, float i) - { - if (ds.getEntity() instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)ds.getEntity(); + public boolean attackEntityFrom(DamageSource ds, float i) { + if (ds.getEntity() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) ds.getEntity(); - if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) - { - this.spawnExplosionParticle(); - chatItUp(player, "Sorry, I don't fight with weaklings."); - return false; - } - - if (!this.isBossReady()) - { + if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { + this.spawnExplosionParticle(); + chatItUp(player, "Sorry, I don't fight with weaklings."); + return false; + } + + if (!this.isBossReady()) { spawnExplosionParticle(); int pokey = rand.nextInt(2); - if (pokey == 2) - { + if (pokey == 2) { chatItUp(player, "Sorry, I don't fight with weaklings."); - } - else - { + } else { chatItUp(player, "Try defeating some weaker valkyries first."); } return false; - } - else - { - PlayerAether playerAether = PlayerAether.get(player); + } else { + PlayerAether playerAether = PlayerAether.get(player); boolean flag; - if (playerAether != null) - { + if (playerAether != null) { flag = true; - if (!player.isDead && flag) - { + if (!player.isDead && flag) { playerAether.setFocusedBoss(this); } - if (this.isDead || this.getHealth() <= 0.0F) - { - playerAether.setFocusedBoss(null); + if (this.isDead || this.getHealth() <= 0.0F) { + playerAether.setFocusedBoss(null); } } - if (this.getEntityToAttack() == null) - { - this.chatTime = 0; + if (this.getEntityToAttack() == null) { + this.chatTime = 0; chatItUp(player, "This will be your final battle!"); if (ds.getEntity() instanceof EntityLivingBase) - becomeAngryAt((EntityLivingBase) ds.getEntity()); - } - else - { + becomeAngryAt((EntityLivingBase) ds.getEntity()); + } else { this.timeUntilTeleport += 60; } - } - } - else - { - extinguish(); - return false; - } + } + } else { + extinguish(); + return false; + } return super.attackEntityFrom(ds, i); } @Override - public boolean attackEntityAsMob(Entity entity) - { - boolean flag = false; + public boolean attackEntityAsMob(Entity entity) { + boolean flag = false; this.swingArm(); flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), 8); - if (entity != null && this.getEntityToAttack() != null && entity == this.getEntityToAttack() && entity instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)entity; + if (entity != null && this.getEntityToAttack() != null && entity == this.getEntityToAttack() && entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entity; - if (player.getHealth() <= 0 || player.isDead) - { - this.setTarget(null); - this.angerLevel = this.chatTime = 0; - this.chatItUp(player, "As expected of a human."); - this.unlockDoor(); - } + if (player.getHealth() <= 0 || player.isDead) { + this.setTarget(null); + this.angerLevel = this.chatTime = 0; + this.chatItUp(player, "As expected of a human."); + this.unlockDoor(); + } } return flag; } @Override - protected void dropFewItems(boolean var1, int var2) - { + protected void dropFewItems(boolean var1, int var2) { this.entityDropItem(new ItemStack(ItemsAether.dungeon_key, 1, 1), 0.5F); this.dropItem(Items.golden_sword, 1); } @Override - public EntityItem entityDropItem(ItemStack stack, float offsetY) - { - if (stack.stackSize != 0 && stack.getItem() != null) - { - EntityAetherItem entityitem = new EntityAetherItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, stack); + public EntityItem entityDropItem(ItemStack stack, float offsetY) { + if (stack.stackSize != 0 && stack.getItem() != null) { + EntityAetherItem entityitem = new EntityAetherItem(this.worldObj, this.posX, this.posY + (double) offsetY, this.posZ, stack); if (captureDrops) this.capturedDrops.add(entityitem); else this.worldObj.spawnEntityInWorld(entityitem); return entityitem; - } - else - { + } else { return null; } } @Override - public void fall(float distance) - { + public void fall(float distance) { } - public void teleport(double x, double y, double z, int rad) - { + public void teleport(double x, double y, double z, int rad) { int a = this.rand.nextInt(rad + 1); int b = this.rand.nextInt(rad / 2); int c = rad - a; @@ -554,14 +465,12 @@ public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss boolean flag = false; - for (int q = 0; q < 32 && !flag; q++) - { + for (int q = 0; q < 32 && !flag; q++) { int i = newX + (this.rand.nextInt(rad / 2) - this.rand.nextInt(rad / 2)); int j = newY + (this.rand.nextInt(rad / 2) - this.rand.nextInt(rad / 2)); int k = newZ + (this.rand.nextInt(rad / 2) - this.rand.nextInt(rad / 2)); - if (this.isAirySpace(i, j, k) && this.isAirySpace(i, j + 1, k) && !this.isAirySpace(i, j - 1, k) && (i > dungeonX && i < dungeonX + 20 && j > dungeonY && j < dungeonY + 12 && k > dungeonZ && k < dungeonZ + 20)) - { + if (this.isAirySpace(i, j, k) && this.isAirySpace(i, j + 1, k) && !this.isAirySpace(i, j - 1, k) && (i > dungeonX && i < dungeonX + 20 && j > dungeonY && j < dungeonY + 12 && k > dungeonZ && k < dungeonZ + 20)) { newX = i; newY = j; newZ = k; @@ -569,21 +478,17 @@ public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss } } - if (!flag) - { + if (!flag) { this.timeUntilTeleport -= (this.rand.nextInt(40) + 40); - if (this.posY <= 0D) - { - this.timeUntilTeleport = 446; + if (this.posY <= 0D) { + this.timeUntilTeleport = 446; } - } - else - { + } else { this.spawnExplosionParticle(); this.enhancedCombat.resetTask(); this.setPosition((double) newX + 0.5D, (double) newY + 0.5D, (double) newZ + 0.5D); - + this.isJumping = false; this.renderYawOffset = this.rand.nextFloat() * 360F; this.timeUntilTeleport = this.rand.nextInt(40); @@ -592,103 +497,85 @@ public class EntityValkyrieQueen extends EntityAetherMob implements IAetherBoss } } - public boolean isAirySpace(int x, int y, int z) - { - Block block = this.worldObj.getBlock(x, y, z); + public boolean isAirySpace(int x, int y, int z) { + Block block = this.worldObj.getBlock(x, y, z); return block == Blocks.air || block.getCollisionBoundingBoxFromPool(this.worldObj, x, y, z) == null; } - public boolean otherDimension() - { + public boolean otherDimension() { return true; } - public boolean canDespawn() - { + public boolean canDespawn() { return false; } @Override - public boolean getCanSpawnHere() - { + public boolean getCanSpawnHere() { int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.boundingBox.minY); int k = MathHelper.floor_double(this.posZ); return this.worldObj.getBlockLightValue(i, j, k) > 8 && this.worldObj.checkBlockCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).size() == 0 && !this.worldObj.isAnyLiquid(this.boundingBox); } - public int getMedals(EntityPlayer entityplayer) - { - int medals = 0; + public int getMedals(EntityPlayer entityplayer) { + int medals = 0; - for (ItemStack item : entityplayer.inventory.mainInventory) - { - if (item != null) - { - if (item.getItem() == ItemsAether.victory_medal) - { - medals += item.stackSize; - } - } - } + for (ItemStack item : entityplayer.inventory.mainInventory) { + if (item != null) { + if (item.getItem() == ItemsAether.victory_medal) { + medals += item.stackSize; + } + } + } return medals; } - public List getPlayersInDungeon() - { - return this.worldObj.getEntitiesWithinAABBExcludingEntity(this.getEntityToAttack(), AxisAlignedBB.getBoundingBox(this.dungeonX, this.dungeonY, this.dungeonZ, this.dungeonX, this.dungeonY, this.dungeonZ).expand(20, 20, 20)); + public List getPlayersInDungeon() { + return this.worldObj.getEntitiesWithinAABBExcludingEntity(this.getEntityToAttack(), AxisAlignedBB.getBoundingBox(this.dungeonX, this.dungeonY, this.dungeonZ, this.dungeonX, this.dungeonY, this.dungeonZ).expand(20, 20, 20)); } @Override - protected String getHurtSound() - { - return "game.player.hurt"; + protected String getHurtSound() { + return "game.player.hurt"; } @Override - protected String getDeathSound() - { - return "game.player.die"; + protected String getDeathSound() { + return "game.player.die"; } - public String getName() - { - return this.dataWatcher.getWatchableObjectString(19); + public String getName() { + return this.dataWatcher.getWatchableObjectString(19); } @Override - public String getBossName() - { + public String getBossName() { return this.dataWatcher.getWatchableObjectString(19) + ", the Valkyrie Queen"; } - public void setBossName(String name) - { - this.dataWatcher.updateObject(19, name); + public void setBossName(String name) { + this.dataWatcher.updateObject(19, name); } - @Override - public float getBossHealth() - { - return this.getHealth(); - } + @Override + public float getBossHealth() { + return this.getHealth(); + } - @Override - public float getMaxBossHealth() - { - return this.getMaxHealth(); - } + @Override + public float getMaxBossHealth() { + return this.getMaxHealth(); + } - public void setBossReady(boolean isReady) - { - this.dataWatcher.updateObject(18, new Byte(isReady ? (byte) 1 : (byte) 0)); - } + public void setBossReady(boolean isReady) { + this.dataWatcher.updateObject(18, new Byte(isReady ? (byte) 1 : (byte) 0)); + } - public boolean isBossReady() - { - return this.dataWatcher.getWatchableObjectByte(18) == (byte) 1; - } + public boolean isBossReady() { + return this.dataWatcher.getWatchableObjectByte(18) == (byte) 1; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/hostile/EntityAechorPlant.java b/src/main/java/com/legacy/aether/entities/hostile/EntityAechorPlant.java index ec8720a..c5b20c9 100644 --- a/src/main/java/com/legacy/aether/entities/hostile/EntityAechorPlant.java +++ b/src/main/java/com/legacy/aether/entities/hostile/EntityAechorPlant.java @@ -16,8 +16,7 @@ import com.legacy.aether.entities.projectile.EntityPoisonNeedle; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.items.util.EnumSkyrootBucketType; -public class EntityAechorPlant extends EntityAetherAnimal -{ +public class EntityAechorPlant extends EntityAetherAnimal { public float sinage; @@ -25,8 +24,7 @@ public class EntityAechorPlant extends EntityAetherAnimal private int reloadTime; - public EntityAechorPlant(World world) - { + public EntityAechorPlant(World world) { super(world); this.sinage = this.rand.nextFloat() * 6F; @@ -34,97 +32,78 @@ public class EntityAechorPlant extends EntityAetherAnimal this.setSize(this.rand.nextInt(4) + 1); this.setPosition(this.posX, this.posY, this.posZ); - this.setSize(0.75F + ((float)this.getSize() * 0.125F), 0.5F + ((float)this.getSize() * 0.075F)); + this.setSize(0.75F + ((float) this.getSize() * 0.125F), 0.5F + ((float) this.getSize() * 0.075F)); } @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); + protected void applyEntityAttributes() { + super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); - } + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); + } @Override - public void entityInit() - { + public void entityInit() { super.entityInit(); this.dataWatcher.addObject(20, new Byte((byte) 0)); } @Override - public int getMaxSpawnedInChunk() - { + public int getMaxSpawnedInChunk() { return 3; } @Override - public void onLivingUpdate() - { + public void onLivingUpdate() { super.onLivingUpdate(); - if(this.hurtTime > 0) - { + if (this.hurtTime > 0) { this.sinage += 0.9F; - } - else - { - if(this.getEntityToAttack() != null) - { + } else { + if (this.getEntityToAttack() != null) { this.sinage += 0.3F; - } - else - { + } else { this.sinage += 0.1F; } } - if(this.sinage > 3.141593F * 2F) - { + if (this.sinage > 3.141593F * 2F) { this.sinage -= (3.141593F * 2F); } - if(this.getEntityToAttack() == null) - { + if (this.getEntityToAttack() == null) { EntityPlayer player = this.worldObj.getClosestVulnerablePlayerToEntity(this, 10.0F); this.setTarget(player); } - if (!this.isDead && this.getEntityToAttack() != null) - { + if (!this.isDead && this.getEntityToAttack() != null) { double distanceToPlayer = this.getEntityToAttack().getDistanceToEntity(this); - double lookDistance = 5.5D + ((double)this.getSize() / 2D); + double lookDistance = 5.5D + ((double) this.getSize() / 2D); - if(this.getEntityToAttack().isDead || distanceToPlayer > lookDistance) - { + if (this.getEntityToAttack().isDead || distanceToPlayer > lookDistance) { this.setTarget(null); this.reloadTime = 0; } - if(this.reloadTime == 20 && this.canEntityBeSeen(this.getEntityToAttack())) - { + if (this.reloadTime == 20 && this.canEntityBeSeen(this.getEntityToAttack())) { this.shootAtPlayer(); this.reloadTime = -10; } - if(this.reloadTime != 20) - { + if (this.reloadTime != 20) { ++this.reloadTime; } } - if(this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) - 1, MathHelper.floor_double(this.posZ)) != BlocksAether.aether_grass) - { + if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) - 1, MathHelper.floor_double(this.posZ)) != BlocksAether.aether_grass) { this.setDead(); } } - public void shootAtPlayer() - { - if(this.worldObj.difficultySetting.equals(EnumDifficulty.PEACEFUL)) - { + public void shootAtPlayer() { + if (this.worldObj.difficultySetting.equals(EnumDifficulty.PEACEFUL)) { return; } @@ -141,17 +120,15 @@ public class EntityAechorPlant extends EntityAetherAnimal poisonNeedle.posY = this.posY + 1D; - this.playSound("random.bow", 1.0F, 1.2F / (this.getRNG().nextFloat() * 0.2F + 0.9F)); + this.playSound("random.bow", 1.0F, 1.2F / (this.getRNG().nextFloat() * 0.2F + 0.9F)); this.worldObj.spawnEntityInWorld(poisonNeedle); - poisonNeedle.setThrowableHeading(x, y, z, 0.285F + ((float)y * 0.05F), 1.0F); + poisonNeedle.setThrowableHeading(x, y, z, 0.285F + ((float) y * 0.05F), 1.0F); } @Override - public void knockBack(Entity entity, float strength, double xRatio, double zRatio) - { - if(this.getHealth() >= 0) - { + public void knockBack(Entity entity, float strength, double xRatio, double zRatio) { + if (this.getHealth() >= 0) { return; } @@ -159,24 +136,18 @@ public class EntityAechorPlant extends EntityAetherAnimal } @Override - public boolean interact(EntityPlayer player) - { + public boolean interact(EntityPlayer player) { ItemStack heldItem = player.getCurrentEquippedItem(); - if(heldItem != null && !this.worldObj.isRemote) - { - if (heldItem.getItem() == ItemsAether.skyroot_bucket && EnumSkyrootBucketType.getType(heldItem.getItemDamage()) == EnumSkyrootBucketType.Empty && this.poisonRemaining > 0) - { - if (--heldItem.stackSize == 0) - { - player.setCurrentItemOrArmor(0, new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Poison.meta)); - } - else if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Poison.meta))) - { - player.entityDropItem(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Poison.meta), 1.0F); - } + if (heldItem != null && !this.worldObj.isRemote) { + if (heldItem.getItem() == ItemsAether.skyroot_bucket && EnumSkyrootBucketType.getType(heldItem.getItemDamage()) == EnumSkyrootBucketType.Empty && this.poisonRemaining > 0) { + if (--heldItem.stackSize == 0) { + player.setCurrentItemOrArmor(0, new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Poison.meta)); + } else if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Poison.meta))) { + player.entityDropItem(new ItemStack(ItemsAether.skyroot_bucket, 1, EnumSkyrootBucketType.Poison.meta), 1.0F); + } - --this.poisonRemaining; + --this.poisonRemaining; } } @@ -184,83 +155,70 @@ public class EntityAechorPlant extends EntityAetherAnimal } @Override - public void writeEntityToNBT(NBTTagCompound compound) - { - super.writeEntityToNBT(compound); + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); - compound.setByte("size", this.getSize()); - } + compound.setByte("size", this.getSize()); + } @Override - public void readEntityFromNBT(NBTTagCompound compound) - { - super.readEntityFromNBT(compound); + public void readEntityFromNBT(NBTTagCompound compound) { + super.readEntityFromNBT(compound); - this.setSize(compound.getByte("size")); - } + this.setSize(compound.getByte("size")); + } - public void setSize(int size) - { + public void setSize(int size) { this.dataWatcher.updateObject(20, (byte) size); } - public byte getSize() - { + public byte getSize() { return this.dataWatcher.getWatchableObjectByte(20); } - @Override - protected void dropFewItems(boolean var1, int var2) - { - this.dropItem(ItemsAether.aechor_petal, 2); - } - - @Override - public void applyEntityCollision(Entity entity) - { - - } - - @Override - public void addVelocity(double x, double y, double z) - { - - } - - @Override - protected boolean isMovementBlocked() - { - return true; - } + @Override + protected void dropFewItems(boolean var1, int var2) { + this.dropItem(ItemsAether.aechor_petal, 2); + } @Override - public EntityAgeable createChild(EntityAgeable baby) - { + public void applyEntityCollision(Entity entity) { + + } + + @Override + public void addVelocity(double x, double y, double z) { + + } + + @Override + protected boolean isMovementBlocked() { + return true; + } + + @Override + public EntityAgeable createChild(EntityAgeable baby) { return null; } @Override - protected String getHurtSound() - { - return "game.player.hurt"; - } + protected String getHurtSound() { + return "game.player.hurt"; + } @Override - protected String getDeathSound() - { - return "game.player.hurt.fall.big"; - } + protected String getDeathSound() { + return "game.player.hurt.fall.big"; + } @Override - public boolean canBePushed() - { + public boolean canBePushed() { return false; } @Override - protected boolean canDespawn() - { - return true; - } + protected boolean canDespawn() { + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/hostile/EntityAetherMob.java b/src/main/java/com/legacy/aether/entities/hostile/EntityAetherMob.java index 3954777..d590fdf 100644 --- a/src/main/java/com/legacy/aether/entities/hostile/EntityAetherMob.java +++ b/src/main/java/com/legacy/aether/entities/hostile/EntityAetherMob.java @@ -13,214 +13,174 @@ import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; -public abstract class EntityAetherMob extends EntityCreature implements IMob -{ +public abstract class EntityAetherMob extends EntityCreature implements IMob { - public EntityAetherMob(World world) - { + public EntityAetherMob(World world) { super(world); - this.experienceValue = 5; - } + this.experienceValue = 5; + } - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); - } + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); + } - @Override - public void onLivingUpdate() - { - this.updateArmSwingProgress(); - float f = this.getBrightness(1.0F); + @Override + public void onLivingUpdate() { + this.updateArmSwingProgress(); + float f = this.getBrightness(1.0F); - if (f > 0.5F) - { - this.entityAge += 2; - } + if (f > 0.5F) { + this.entityAge += 2; + } - super.onLivingUpdate(); - } + super.onLivingUpdate(); + } - @Override - public void onUpdate() - { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - if (!this.worldObj.isRemote && this.willDespawnPeacefully() && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) - { - this.setDead(); - } - } + if (!this.worldObj.isRemote && this.willDespawnPeacefully() && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { + this.setDead(); + } + } - @Override - protected Entity findPlayerToAttack() - { - EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D); - return entityplayer != null && this.canEntityBeSeen(entityplayer) ? entityplayer : null; - } + @Override + protected Entity findPlayerToAttack() { + EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D); + return entityplayer != null && this.canEntityBeSeen(entityplayer) ? entityplayer : null; + } - @Override - public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) - { - if (this.isEntityInvulnerable()) - { - return false; - } - else if (super.attackEntityFrom(p_70097_1_, p_70097_2_)) - { - Entity entity = p_70097_1_.getEntity(); + @Override + public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { + if (this.isEntityInvulnerable()) { + return false; + } else if (super.attackEntityFrom(p_70097_1_, p_70097_2_)) { + Entity entity = p_70097_1_.getEntity(); - if (this.riddenByEntity != entity && this.ridingEntity != entity) - { - if (entity != this) - { - this.entityToAttack = entity; - } + if (this.riddenByEntity != entity && this.ridingEntity != entity) { + if (entity != this) { + this.entityToAttack = entity; + } - return true; - } - else - { - return true; - } - } - else - { - return false; - } - } + return true; + } else { + return true; + } + } else { + return false; + } + } - @Override - public boolean attackEntityAsMob(Entity p_70652_1_) - { - float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); - int i = 0; + @Override + public boolean attackEntityAsMob(Entity p_70652_1_) { + float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + int i = 0; - if (p_70652_1_ instanceof EntityLivingBase) - { - f += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase)p_70652_1_); - i += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase)p_70652_1_); - } + if (p_70652_1_ instanceof EntityLivingBase) { + f += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase) p_70652_1_); + i += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase) p_70652_1_); + } - boolean flag = p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), f); + boolean flag = p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), f); - if (flag) - { - if (i > 0) - { - p_70652_1_.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F)); - this.motionX *= 0.6D; - this.motionZ *= 0.6D; - } + if (flag) { + if (i > 0) { + p_70652_1_.addVelocity((double) (-MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F) * (float) i * 0.5F)); + this.motionX *= 0.6D; + this.motionZ *= 0.6D; + } - int j = EnchantmentHelper.getFireAspectModifier(this); + int j = EnchantmentHelper.getFireAspectModifier(this); - if (j > 0) - { - p_70652_1_.setFire(j * 4); - } + if (j > 0) { + p_70652_1_.setFire(j * 4); + } - if (p_70652_1_ instanceof EntityLivingBase) - { - EnchantmentHelper.func_151384_a((EntityLivingBase)p_70652_1_, this); - } + if (p_70652_1_ instanceof EntityLivingBase) { + EnchantmentHelper.func_151384_a((EntityLivingBase) p_70652_1_, this); + } - EnchantmentHelper.func_151385_b(this, p_70652_1_); - } + EnchantmentHelper.func_151385_b(this, p_70652_1_); + } - return flag; - } + return flag; + } - @Override - protected void attackEntity(Entity p_70785_1_, float p_70785_2_) - { - if (this.attackTime <= 0 && p_70785_2_ < 2.0F && p_70785_1_.boundingBox.maxY > this.boundingBox.minY && p_70785_1_.boundingBox.minY < this.boundingBox.maxY) - { - this.attackTime = 20; - this.attackEntityAsMob(p_70785_1_); - } - } + @Override + protected void attackEntity(Entity p_70785_1_, float p_70785_2_) { + if (this.attackTime <= 0 && p_70785_2_ < 2.0F && p_70785_1_.boundingBox.maxY > this.boundingBox.minY && p_70785_1_.boundingBox.minY < this.boundingBox.maxY) { + this.attackTime = 20; + this.attackEntityAsMob(p_70785_1_); + } + } - @Override - public float getBlockPathWeight(int p_70783_1_, int p_70783_2_, int p_70783_3_) - { - return 0.5F - this.worldObj.getLightBrightness(p_70783_1_, p_70783_2_, p_70783_3_); - } + @Override + public float getBlockPathWeight(int p_70783_1_, int p_70783_2_, int p_70783_3_) { + return 0.5F - this.worldObj.getLightBrightness(p_70783_1_, p_70783_2_, p_70783_3_); + } - protected boolean isValidLightLevel() - { - int i = MathHelper.floor_double(this.posX); - int j = MathHelper.floor_double(this.boundingBox.minY); - int k = MathHelper.floor_double(this.posZ); + protected boolean isValidLightLevel() { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.boundingBox.minY); + int k = MathHelper.floor_double(this.posZ); - if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, i, j, k) > this.rand.nextInt(32)) - { - return false; - } - else - { - int l = this.worldObj.getBlockLightValue(i, j, k); + if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, i, j, k) > this.rand.nextInt(32)) { + return false; + } else { + int l = this.worldObj.getBlockLightValue(i, j, k); - if (this.worldObj.isThundering()) - { - int i1 = this.worldObj.skylightSubtracted; - this.worldObj.skylightSubtracted = 10; - l = this.worldObj.getBlockLightValue(i, j, k); - this.worldObj.skylightSubtracted = i1; - } + if (this.worldObj.isThundering()) { + int i1 = this.worldObj.skylightSubtracted; + this.worldObj.skylightSubtracted = 10; + l = this.worldObj.getBlockLightValue(i, j, k); + this.worldObj.skylightSubtracted = i1; + } - return l <= this.rand.nextInt(8); - } - } + return l <= this.rand.nextInt(8); + } + } - public boolean willDespawnPeacefully() - { - return false; - } + public boolean willDespawnPeacefully() { + return false; + } - @Override - public boolean getCanSpawnHere() - { - return this.isValidLightLevel() && super.getCanSpawnHere(); - } + @Override + public boolean getCanSpawnHere() { + return this.isValidLightLevel() && super.getCanSpawnHere(); + } - @Override - protected boolean func_146066_aG() - { - return true; - } + @Override + protected boolean func_146066_aG() { + return true; + } - @Override - protected String func_146067_o(int p_146067_1_) - { - return p_146067_1_ > 4 ? "game.hostile.hurt.fall.big" : "game.hostile.hurt.fall.small"; - } + @Override + protected String func_146067_o(int p_146067_1_) { + return p_146067_1_ > 4 ? "game.hostile.hurt.fall.big" : "game.hostile.hurt.fall.small"; + } - @Override - protected String getSwimSound() - { - return "game.hostile.swim"; - } + @Override + protected String getSwimSound() { + return "game.hostile.swim"; + } - @Override - protected String getSplashSound() - { - return "game.hostile.swim.splash"; - } + @Override + protected String getSplashSound() { + return "game.hostile.swim.splash"; + } - @Override - protected String getHurtSound() - { - return "game.hostile.hurt"; - } + @Override + protected String getHurtSound() { + return "game.hostile.hurt"; + } - @Override - protected String getDeathSound() - { - return "game.hostile.die"; - } + @Override + protected String getDeathSound() { + return "game.hostile.die"; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/hostile/EntityCockatrice.java b/src/main/java/com/legacy/aether/entities/hostile/EntityCockatrice.java index 9b11d03..438468d 100644 --- a/src/main/java/com/legacy/aether/entities/hostile/EntityCockatrice.java +++ b/src/main/java/com/legacy/aether/entities/hostile/EntityCockatrice.java @@ -19,60 +19,52 @@ import net.minecraft.world.World; import com.legacy.aether.entities.passive.mountable.EntityMoa; import com.legacy.aether.entities.projectile.EntityPoisonNeedle; -public class EntityCockatrice extends EntityMob -{ +public class EntityCockatrice extends EntityMob { public float wingRotation, destPos, prevDestPos, prevWingRotation; public int shootTime, ticksUntilFlap; - public EntityCockatrice(World world) - { + public EntityCockatrice(World world) { super(world); this.stepHeight = 1.0F; this.setSize(1.0F, 2.0F); - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - this.tasks.addTask(8, new EntityAILookIdle(this)); - this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); } @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); + protected void applyEntityAttributes() { + super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10D); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); this.setHealth(10); - } + } @Override - public boolean getCanSpawnHere() - { - return this.rand.nextInt(25) == 0 && super.getCanSpawnHere(); - } + public boolean getCanSpawnHere() { + return this.rand.nextInt(25) == 0 && super.getCanSpawnHere(); + } @Override - public boolean isPotionApplicable(PotionEffect effect) - { + public boolean isPotionApplicable(PotionEffect effect) { return effect.getPotionID() == Potion.poison.id ? false : super.isPotionApplicable(effect); } @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); - if (this.getEntityToAttack() instanceof EntityPlayer) - { + if (this.getEntityToAttack() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) this.getEntityToAttack(); - if (player.capabilities.isCreativeMode || this.getHealth() <= 0.0F || this.isDead || this.getEntityToAttack().isDead || this.getEntityToAttack().getDistanceToEntity(this) > 12D) - { + if (player.capabilities.isCreativeMode || this.getHealth() <= 0.0F || this.isDead || this.getEntityToAttack().isDead || this.getEntityToAttack().getDistanceToEntity(this) > 12D) { this.setTarget(null); this.shootTime = 0; return; @@ -81,16 +73,14 @@ public class EntityCockatrice extends EntityMob double d = this.getEntityToAttack().posX - this.posX; double d1 = this.getEntityToAttack().posZ - this.posZ; - this.getLookHelper().setLookPositionWithEntity(this.getEntityToAttack(), 30.0F, 30.0F); + this.getLookHelper().setLookPositionWithEntity(this.getEntityToAttack(), 30.0F, 30.0F); - if (this.shootTime >= 20 && this.canEntityBeSeen(this.getEntityToAttack())) - { + if (this.shootTime >= 20 && this.canEntityBeSeen(this.getEntityToAttack())) { this.shootTarget(); this.shootTime = -60; } - if (this.shootTime < 20) - { + if (this.shootTime < 20) { this.shootTime += 2; } @@ -99,16 +89,13 @@ public class EntityCockatrice extends EntityMob this.updateWingRotation(); - if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) - { + if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { this.setDead(); } } - public void shootTarget() - { - if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) - { + public void shootTarget() { + if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { return; } @@ -120,33 +107,26 @@ public class EntityCockatrice extends EntityMob d2 = d2 * d3; EntityPoisonNeedle entityarrow = new EntityPoisonNeedle(this.worldObj, this, 1.0F); entityarrow.posY = this.posY + 1.55D; - this.playSound("random.bow", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.playSound("random.bow", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.worldObj.spawnEntityInWorld(entityarrow); } @Override - public void onLivingUpdate() - { + public void onLivingUpdate() { super.onLivingUpdate(); - if (!this.onGround && this.motionY < 0.0D) - { + if (!this.onGround && this.motionY < 0.0D) { this.motionY *= 0.59999999999999998D; } } - public void updateWingRotation() - { - if (!this.onGround) - { - if (this.ticksUntilFlap == 0) - { + public void updateWingRotation() { + if (!this.onGround) { + if (this.ticksUntilFlap == 0) { this.worldObj.playSoundAtEntity(this, "mob.bat.takeoff", 0.15F, MathHelper.clamp_float(this.rand.nextFloat(), 0.7f, 1.0f) + MathHelper.clamp_float(this.rand.nextFloat(), 0f, 0.3f)); this.ticksUntilFlap = 8; - } - else - { + } else { this.ticksUntilFlap--; } } @@ -157,8 +137,7 @@ public class EntityCockatrice extends EntityMob this.destPos += 0.2D; this.destPos = EntityMoa.minMax(0.01F, 1.0F, this.destPos); - if (this.onGround) - { + if (this.onGround) { this.destPos = 0.0F; } @@ -166,43 +145,36 @@ public class EntityCockatrice extends EntityMob } @Override - public void fall(float distance) - { + public void fall(float distance) { } @Override - public void writeEntityToNBT(NBTTagCompound nbttagcompound) - { + public void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); } @Override - public void readEntityFromNBT(NBTTagCompound nbttagcompound) - { + public void readEntityFromNBT(NBTTagCompound nbttagcompound) { super.readEntityFromNBT(nbttagcompound); } @Override - protected String getLivingSound() - { + protected String getLivingSound() { return "aether_legacy:aemob.moa.say"; } @Override - protected String getHurtSound() - { + protected String getHurtSound() { return "aether_legacy:aemob.moa.say"; } @Override - protected String getDeathSound() - { + protected String getDeathSound() { return "aether_legacy:aemob.moa.say"; } @Override - protected void dropFewItems(boolean var1, int var2) - { + protected void dropFewItems(boolean var1, int var2) { this.dropItem(Items.feather, 1 + this.rand.nextInt(4)); } diff --git a/src/main/java/com/legacy/aether/entities/hostile/EntityMimic.java b/src/main/java/com/legacy/aether/entities/hostile/EntityMimic.java index 9cfe53c..81cacc2 100644 --- a/src/main/java/com/legacy/aether/entities/hostile/EntityMimic.java +++ b/src/main/java/com/legacy/aether/entities/hostile/EntityMimic.java @@ -19,119 +19,98 @@ import net.minecraft.world.World; import com.legacy.aether.items.tools.ItemAetherTool; import com.legacy.aether.items.util.EnumAetherToolType; -public class EntityMimic extends EntityMob -{ +public class EntityMimic extends EntityMob { public float mouth, legs; private float legsDirection = 1; - public EntityMimic(World world) - { - super(world); - this.setSize(1.0F, 2.0F); - this.applyEntityAI(); - } + public EntityMimic(World world) { + super(world); + this.setSize(1.0F, 2.0F); + this.applyEntityAI(); + } - protected void applyEntityAI() - { - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(2, new EntityAIAttackOnCollide(this, 1.0D, false)); - this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); - this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); - } - - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(8.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.68000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); - } + protected void applyEntityAI() { + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIAttackOnCollide(this, 1.0D, false)); + this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); + } - public void onUpdate() - { + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(8.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.68000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); + } + + public void onUpdate() { super.onUpdate(); - this.mouth = (float)((Math.cos((float)ticksExisted / 10F * 3.14159265F)) + 1F) * 0.6F; + this.mouth = (float) ((Math.cos((float) ticksExisted / 10F * 3.14159265F)) + 1F) * 0.6F; this.legs *= 0.9F; - if (this.prevPosX - this.posX != 0 || this.prevPosZ - this.posZ != 0) - { + if (this.prevPosX - this.posX != 0 || this.prevPosZ - this.posZ != 0) { this.legs += legsDirection * 0.2F; - if(this.legs > 1.0F) - { + if (this.legs > 1.0F) { this.legsDirection = -1; } - if(this.legs < -1.0F) - { + if (this.legs < -1.0F) { this.legsDirection = 1; } - } - else - { + } else { this.legs = 0.0F; } - } - - @Override - protected String getHurtSound() - { - return "mob.slime.small"; - } - - @Override - protected String getDeathSound() - { - return "mob.slime.small"; - } - - protected float getSoundVolume() - { - return 0.6F; - } + } @Override - protected void dropFewItems(boolean var1, int var2) - { + protected String getHurtSound() { + return "mob.slime.small"; + } + + @Override + protected String getDeathSound() { + return "mob.slime.small"; + } + + protected float getSoundVolume() { + return 0.6F; + } + + @Override + protected void dropFewItems(boolean var1, int var2) { dropItem(Item.getItemFromBlock(Blocks.chest), 1); } @Override - public boolean attackEntityFrom(DamageSource ds, float var2) - { - if (ds.getEntity() instanceof EntityMimic) - { + public boolean attackEntityFrom(DamageSource ds, float var2) { + if (ds.getEntity() instanceof EntityMimic) { return false; } - if (ds.getEntity() instanceof EntityLivingBase) - { + if (ds.getEntity() instanceof EntityLivingBase) { this.setAttackTarget((EntityLivingBase) ds.getEntity()); } - if (ds.getEntity() instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)ds.getEntity(); + if (ds.getEntity() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) ds.getEntity(); ItemStack stack = player.inventory.getCurrentItem(); - if (stack == null || stack.getItem() == null) - { + if (stack == null || stack.getItem() == null) { return super.attackEntityFrom(ds, var2); } - if (!(stack.getItem() instanceof ItemAxe) && !(stack.getItem() instanceof ItemAetherTool)) - { - return super.attackEntityFrom(ds, var2); + if (!(stack.getItem() instanceof ItemAxe) && !(stack.getItem() instanceof ItemAetherTool)) { + return super.attackEntityFrom(ds, var2); } - if (stack.getItem() instanceof ItemAetherTool && ((ItemAetherTool)stack.getItem()).toolType != EnumAetherToolType.AXE) - { - return super.attackEntityFrom(ds, var2); + if (stack.getItem() instanceof ItemAetherTool && ((ItemAetherTool) stack.getItem()).toolType != EnumAetherToolType.AXE) { + return super.attackEntityFrom(ds, var2); } return super.attackEntityFrom(ds, var2 * 1.5F); diff --git a/src/main/java/com/legacy/aether/entities/hostile/EntitySentry.java b/src/main/java/com/legacy/aether/entities/hostile/EntitySentry.java index b41f146..6979edb 100644 --- a/src/main/java/com/legacy/aether/entities/hostile/EntitySentry.java +++ b/src/main/java/com/legacy/aether/entities/hostile/EntitySentry.java @@ -13,277 +13,227 @@ import net.minecraft.world.World; import com.legacy.aether.blocks.BlocksAether; -public class EntitySentry extends EntityLiving implements IMob -{ +public class EntitySentry extends EntityLiving implements IMob { - private int jumpCount; + private int jumpCount; - public int searchTicks; + public int searchTicks; - public int lostTicks; + public int lostTicks; - public EntitySentry(World world) - { - super(world); + public EntitySentry(World world) { + super(world); - this.yOffset = 0.0F; - this.jumpCount = this.rand.nextInt(20) + 10; - } + this.yOffset = 0.0F; + this.jumpCount = this.rand.nextInt(20) + 10; + } - public EntitySentry(World world, double x, double y, double z) - { - this(world); + public EntitySentry(World world, double x, double y, double z) { + this(world); - this.rotationYaw = (float)this.rand.nextInt(4) * 1.570796F; + this.rotationYaw = (float) this.rand.nextInt(4) * 1.570796F; - this.setPosition(x, y, z); - this.setSize(0.85F, 0.85F); - } + this.setPosition(x, y, z); + this.setSize(0.85F, 0.85F); + } @Override - public void entityInit() - { + public void entityInit() { super.entityInit(); this.dataWatcher.addObject(20, new Byte((byte) 0)); } @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); + protected void applyEntityAttributes() { + super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); - } - - @Override - public void writeEntityToNBT(NBTTagCompound compound) - { - super.writeEntityToNBT(compound); - - compound.setBoolean("awake", this.isAwake()); - } - - @Override - public void readEntityFromNBT(NBTTagCompound compound) - { - super.readEntityFromNBT(compound); - - this.setAwake(compound.getBoolean("awake")); - } - - @Override - public void onUpdate() - { - boolean flag = this.onGround; - - super.onUpdate(); - - if(this.onGround && !flag) - { - this.worldObj.playSoundAtEntity(this, "mob.slime", getSoundVolume(), ((rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F) / 0.8F); - } - else if(!this.onGround && flag && this.getAttackTarget() != null) - { - this.motionX *= 3D; - this.motionZ *= 3D; - } - if(this.getAttackTarget() != null && this.getAttackTarget().isDead) - { - this.setAttackTarget(null); - } - } - - @Override - public boolean attackEntityFrom(DamageSource source, float damage) - { - boolean flag = super.attackEntityFrom(source, damage); - - if(flag && (source.getEntity() instanceof EntityLiving)) - { - this.lostTicks = 0; - this.setAwake(true); - this.setAttackTarget((EntityLivingBase) source.getEntity()); - } - return flag; - } - - @Override - public void applyEntityCollision(Entity entity) - { - if(!this.isDead && this.getAttackTarget() != null && this.getAttackTarget() == entity) - { - this.worldObj.createExplosion(entity, this.posX, this.posY, this.posZ, 0.1F, false); - - entity.attackEntityFrom(DamageSource.causeMobDamage(this), 2.0F); - - if(entity instanceof EntityLivingBase) - { - EntityLivingBase entityliving = (EntityLivingBase)entity; - - double d = entityliving.posX - this.posX; - double d2; - - for(d2 = entityliving.posZ - this.posZ; d * d + d2 * d2 < 0.0001D; d2 = (Math.random() - Math.random()) * 0.01D) - { - d = (Math.random() - Math.random()) * 0.01D; - } - - entityliving.knockBack(this, 5, -d, -d2); - entityliving.motionX *= 4D; - entityliving.motionY *= 4D; - entityliving.motionZ *= 4D; - } - - float f = 0.01745329F; - - for(int i = 0; i < 40; i++) - { - double d1 = (float)this.posX + this.rand.nextFloat() * 0.25F; - double d3 = (float)this.posY + 0.5F; - double d4 = (float)this.posZ + this.rand.nextFloat() * 0.25F; - float f1 = this.rand.nextFloat() * 360F; - this.worldObj.spawnParticle("explode", d1, d3, d4, -Math.sin(f * f1) * 0.75D, 0.125D, Math.cos(f * f1) * 0.75D); - } - - this.setDead(); - } - } - - @Override - protected void updateEntityActionState() - { - EntityPlayer player = this.worldObj.getClosestPlayerToEntity(this, 8.0D); - - if (!this.isAwake() && this.searchTicks >= 8) - { - if (player != null && this.canEntityBeSeen(player)) - { - this.lostTicks = 0; - this.setAwake(true); - this.setAttackTarget(player); - this.faceEntity(player, 10.0F, 10.0F); - } - - this.searchTicks = 0; - } - else if (this.isAwake() && this.searchTicks >= 8) - { - if (this.getAttackTarget() == null) - { - if (player != null && this.canEntityBeSeen(player)) - { - this.lostTicks = 0; - this.setAwake(true); - this.setAttackTarget(player); - } - else - { - ++this.lostTicks; - - if (this.lostTicks >= 4) - { - this.setSentryLost(); - } - } - } - else if (this.getAttackTarget().isDead || !this.canEntityBeSeen(this.getAttackTarget()) || this.getDistanceToEntity(this.getAttackTarget()) >= 16.0F) - { - ++this.lostTicks; - - if (this.lostTicks >= 4) - { - this.setSentryLost(); - } - } - else - { - this.lostTicks = 0; - } - - this.searchTicks = 0; - } - else - { - ++this.searchTicks; - } - - if (!this.isAwake()) - { - return; - } - - if (this.getAttackTarget() != null) - { - this.faceEntity(this.getAttackTarget(), 10.0F, 10.0F); - } - - if (this.onGround && this.jumpCount-- <= 0) - { - this.isJumping = true; - this.moveForward = 1.0F; - this.jumpCount = this.rand.nextInt(20) + 10; - this.moveStrafing = 0.5F - this.rand.nextFloat(); - - if(this.getAttackTarget() != null) - { - this.jumpCount /= 2; - this.moveForward = 1.0F; - } - - this.playSound("mob.slime", getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); - } - else - { - this.isJumping = false; - - if (this.onGround) - { - this.moveStrafing = this.moveForward = 0.0F; - } - } - } - - private void setSentryLost() - { - this.lostTicks = 0; - this.searchTicks = -64; - this.setAttackTarget(null); - } - - public void setAwake(boolean awake) - { - this.dataWatcher.updateObject(20, (byte) (awake ? 1 : 0)); - } - - public boolean isAwake() - { - return this.dataWatcher.getWatchableObjectByte(20) == (byte)1; + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); } @Override - protected String getHurtSound() - { - return "mob.slime"; - } + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); - @Override - protected String getDeathSound() - { - return "mob.slime"; - } + compound.setBoolean("awake", this.isAwake()); + } - @Override - protected float getSoundVolume() - { - return 0.6F; - } + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + super.readEntityFromNBT(compound); - @Override - protected Item getDropItem() - { - return this.rand.nextInt(5) == 0 ? Item.getItemFromBlock(BlocksAether.sentry_stone) : Item.getItemFromBlock(BlocksAether.carved_stone); - } + this.setAwake(compound.getBoolean("awake")); + } + + @Override + public void onUpdate() { + boolean flag = this.onGround; + + super.onUpdate(); + + if (this.onGround && !flag) { + this.worldObj.playSoundAtEntity(this, "mob.slime", getSoundVolume(), ((rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F) / 0.8F); + } else if (!this.onGround && flag && this.getAttackTarget() != null) { + this.motionX *= 3D; + this.motionZ *= 3D; + } + if (this.getAttackTarget() != null && this.getAttackTarget().isDead) { + this.setAttackTarget(null); + } + } + + @Override + public boolean attackEntityFrom(DamageSource source, float damage) { + boolean flag = super.attackEntityFrom(source, damage); + + if (flag && (source.getEntity() instanceof EntityLiving)) { + this.lostTicks = 0; + this.setAwake(true); + this.setAttackTarget((EntityLivingBase) source.getEntity()); + } + return flag; + } + + @Override + public void applyEntityCollision(Entity entity) { + if (!this.isDead && this.getAttackTarget() != null && this.getAttackTarget() == entity) { + this.worldObj.createExplosion(entity, this.posX, this.posY, this.posZ, 0.1F, false); + + entity.attackEntityFrom(DamageSource.causeMobDamage(this), 2.0F); + + if (entity instanceof EntityLivingBase) { + EntityLivingBase entityliving = (EntityLivingBase) entity; + + double d = entityliving.posX - this.posX; + double d2; + + for (d2 = entityliving.posZ - this.posZ; d * d + d2 * d2 < 0.0001D; d2 = (Math.random() - Math.random()) * 0.01D) { + d = (Math.random() - Math.random()) * 0.01D; + } + + entityliving.knockBack(this, 5, -d, -d2); + entityliving.motionX *= 4D; + entityliving.motionY *= 4D; + entityliving.motionZ *= 4D; + } + + float f = 0.01745329F; + + for (int i = 0; i < 40; i++) { + double d1 = (float) this.posX + this.rand.nextFloat() * 0.25F; + double d3 = (float) this.posY + 0.5F; + double d4 = (float) this.posZ + this.rand.nextFloat() * 0.25F; + float f1 = this.rand.nextFloat() * 360F; + this.worldObj.spawnParticle("explode", d1, d3, d4, -Math.sin(f * f1) * 0.75D, 0.125D, Math.cos(f * f1) * 0.75D); + } + + this.setDead(); + } + } + + @Override + protected void updateEntityActionState() { + EntityPlayer player = this.worldObj.getClosestPlayerToEntity(this, 8.0D); + + if (!this.isAwake() && this.searchTicks >= 8) { + if (player != null && this.canEntityBeSeen(player)) { + this.lostTicks = 0; + this.setAwake(true); + this.setAttackTarget(player); + this.faceEntity(player, 10.0F, 10.0F); + } + + this.searchTicks = 0; + } else if (this.isAwake() && this.searchTicks >= 8) { + if (this.getAttackTarget() == null) { + if (player != null && this.canEntityBeSeen(player)) { + this.lostTicks = 0; + this.setAwake(true); + this.setAttackTarget(player); + } else { + ++this.lostTicks; + + if (this.lostTicks >= 4) { + this.setSentryLost(); + } + } + } else if (this.getAttackTarget().isDead || !this.canEntityBeSeen(this.getAttackTarget()) || this.getDistanceToEntity(this.getAttackTarget()) >= 16.0F) { + ++this.lostTicks; + + if (this.lostTicks >= 4) { + this.setSentryLost(); + } + } else { + this.lostTicks = 0; + } + + this.searchTicks = 0; + } else { + ++this.searchTicks; + } + + if (!this.isAwake()) { + return; + } + + if (this.getAttackTarget() != null) { + this.faceEntity(this.getAttackTarget(), 10.0F, 10.0F); + } + + if (this.onGround && this.jumpCount-- <= 0) { + this.isJumping = true; + this.moveForward = 1.0F; + this.jumpCount = this.rand.nextInt(20) + 10; + this.moveStrafing = 0.5F - this.rand.nextFloat(); + + if (this.getAttackTarget() != null) { + this.jumpCount /= 2; + this.moveForward = 1.0F; + } + + this.playSound("mob.slime", getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); + } else { + this.isJumping = false; + + if (this.onGround) { + this.moveStrafing = this.moveForward = 0.0F; + } + } + } + + private void setSentryLost() { + this.lostTicks = 0; + this.searchTicks = -64; + this.setAttackTarget(null); + } + + public void setAwake(boolean awake) { + this.dataWatcher.updateObject(20, (byte) (awake ? 1 : 0)); + } + + public boolean isAwake() { + return this.dataWatcher.getWatchableObjectByte(20) == (byte) 1; + } + + @Override + protected String getHurtSound() { + return "mob.slime"; + } + + @Override + protected String getDeathSound() { + return "mob.slime"; + } + + @Override + protected float getSoundVolume() { + return 0.6F; + } + + @Override + protected Item getDropItem() { + return this.rand.nextInt(5) == 0 ? Item.getItemFromBlock(BlocksAether.sentry_stone) : Item.getItemFromBlock(BlocksAether.carved_stone); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/hostile/EntityWhirlwind.java b/src/main/java/com/legacy/aether/entities/hostile/EntityWhirlwind.java index 701daa9..44f129f 100644 --- a/src/main/java/com/legacy/aether/entities/hostile/EntityWhirlwind.java +++ b/src/main/java/com/legacy/aether/entities/hostile/EntityWhirlwind.java @@ -30,384 +30,317 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class EntityWhirlwind extends EntityMob -{ +public class EntityWhirlwind extends EntityMob { public ArrayList particles = new ArrayList(); - public int lifeLeft; + public int lifeLeft; - public int actionTimer; + public int actionTimer; - public float movementAngle; - public float movementCurve; + public float movementAngle; + public float movementCurve; - public boolean isRainbow; + public boolean isRainbow; - public boolean canDropItems = true; + public boolean canDropItems = true; - public EntityWhirlwind(World world) - { - super(world); + public EntityWhirlwind(World world) { + super(world); - this.setSize(0.6F, 0.8F); + this.setSize(0.6F, 0.8F); - this.movementAngle = this.rand.nextFloat() * 360F; - this.movementCurve = (this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F; + this.movementAngle = this.rand.nextFloat() * 360F; + this.movementCurve = (this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F; - this.lifeLeft = this.rand.nextInt(512) + 512; + this.lifeLeft = this.rand.nextInt(512) + 512; - if(this.rand.nextInt(10) == 0) - { - this.lifeLeft /= 2; - this.setEvil(true); - } + if (this.rand.nextInt(10) == 0) { + this.lifeLeft /= 2; + this.setEvil(true); + } - this.setColorData(15); - } - - @Override - public float getBlockPathWeight(int x, int y, int z) - { - return this.worldObj.getBlock(x, y - 1, z) == BlocksAether.aether_grass ? 10.0F : this.worldObj.getLightBrightness(x, y, z) - 0.5F; - } - - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue((this.rand.nextDouble() * 0.025D) + 0.025D); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); - - this.setHealth(10.0F); + this.setColorData(15); } @Override - protected void entityInit() - { + public float getBlockPathWeight(int x, int y, int z) { + return this.worldObj.getBlock(x, y - 1, z) == BlocksAether.aether_grass ? 10.0F : this.worldObj.getLightBrightness(x, y, z) - 0.5F; + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue((this.rand.nextDouble() * 0.025D) + 0.025D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); + + this.setHealth(10.0F); + } + + @Override + protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(20, new Byte((byte) 0)); this.dataWatcher.addObject(21, new Byte((byte) 15)); } - public void setColorData(int data) - { + public void setColorData(int data) { this.dataWatcher.updateObject(21, (byte) data); } - public int getColorData() - { + public int getColorData() { return (int) this.dataWatcher.getWatchableObjectByte(21); } - public void setEvil(boolean isEvil) - { + public void setEvil(boolean isEvil) { this.dataWatcher.updateObject(20, (byte) (isEvil ? 1 : 0)); } - public boolean isEvil() - { - return this.dataWatcher.getWatchableObjectByte(20) == (byte)1; + public boolean isEvil() { + return this.dataWatcher.getWatchableObjectByte(20) == (byte) 1; } - public void onLivingUpdate() - { - EntityPlayer closestPlayer = this.findClosestPlayer(); + public void onLivingUpdate() { + EntityPlayer closestPlayer = this.findClosestPlayer(); - if(this.isEvil()) - { - if(closestPlayer != null && closestPlayer.onGround) - { - this.setAttackTarget(closestPlayer); - } - } + if (this.isEvil()) { + if (closestPlayer != null && closestPlayer.onGround) { + this.setAttackTarget(closestPlayer); + } + } - if(this.getAttackTarget() == null) - { - this.motionX = Math.cos(0.01745329F * this.movementAngle) * this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); - this.motionZ = -Math.sin(0.01745329F * this.movementAngle) * this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); - this.movementAngle += this.movementCurve; - } - else - { - super.onLivingUpdate(); - } + if (this.getAttackTarget() == null) { + this.motionX = Math.cos(0.01745329F * this.movementAngle) * this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); + this.motionZ = -Math.sin(0.01745329F * this.movementAngle) * this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); + this.movementAngle += this.movementCurve; + } else { + super.onLivingUpdate(); + } - if (this.lifeLeft != -100) - { - --this.lifeLeft; - } + if (this.lifeLeft != -100) { + --this.lifeLeft; + } - if((this.lifeLeft <= 0 && this.lifeLeft != -100) || this.handleWaterMovement()) - { - this.setDead(); - } + if ((this.lifeLeft <= 0 && this.lifeLeft != -100) || this.handleWaterMovement()) { + this.setDead(); + } - if (!this.worldObj.isRemote) - { - if(closestPlayer != null) - { - this.actionTimer++; - } + if (!this.worldObj.isRemote) { + if (closestPlayer != null) { + this.actionTimer++; + } - if(this.actionTimer >= 128) - { - if(this.isEvil()) - { - EntityCreeper entitycreeper = new EntityCreeper(this.worldObj); + if (this.actionTimer >= 128) { + if (this.isEvil()) { + EntityCreeper entitycreeper = new EntityCreeper(this.worldObj); - entitycreeper.setLocationAndAngles(this.posX, this.posY + 0.5D, this.posZ, this.rand.nextFloat() * 360F, 0.0F); - entitycreeper.motionX = (double)(this.rand.nextFloat() - this.rand.nextFloat()) * 0.125D; - entitycreeper.motionZ = (double)(this.rand.nextFloat() - this.rand.nextFloat()) * 0.125D; + entitycreeper.setLocationAndAngles(this.posX, this.posY + 0.5D, this.posZ, this.rand.nextFloat() * 360F, 0.0F); + entitycreeper.motionX = (double) (this.rand.nextFloat() - this.rand.nextFloat()) * 0.125D; + entitycreeper.motionZ = (double) (this.rand.nextFloat() - this.rand.nextFloat()) * 0.125D; - this.worldObj.spawnEntityInWorld(entitycreeper); - this.actionTimer = 0; - this.worldObj.playSoundAtEntity(this, "random.pop", 0.5F, 1.0F); - } - else if (this.canDropItems && this.rand.nextInt(4) == 0) - { - this.dropItem(this.getRandomDrop(), 1); - this.actionTimer = 0; - this.worldObj.playSoundAtEntity(this, "random.pop", 0.5F, 1.0F); - } - } - } - else - { - this.updateParticles(); - } + this.worldObj.spawnEntityInWorld(entitycreeper); + this.actionTimer = 0; + this.worldObj.playSoundAtEntity(this, "random.pop", 0.5F, 1.0F); + } else if (this.canDropItems && this.rand.nextInt(4) == 0) { + this.dropItem(this.getRandomDrop(), 1); + this.actionTimer = 0; + this.worldObj.playSoundAtEntity(this, "random.pop", 0.5F, 1.0F); + } + } + } else { + this.updateParticles(); + } - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(2.5D, 2.5D, 2.5D)); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(2.5D, 2.5D, 2.5D)); - for(int l = 0; l < list.size(); l++) - { - Entity entity = (Entity)list.get(l); + for (int l = 0; l < list.size(); l++) { + Entity entity = (Entity) list.get(l); - double d9 = (float)entity.posX; - double d11 = (float)entity.posY - entity.getYOffset() * 0.6F; - double d13 = (float)entity.posZ; - double d15 = this.getDistanceToEntity(entity); - double d17 = d11 - this.posY; + double d9 = (float) entity.posX; + double d11 = (float) entity.posY - entity.getYOffset() * 0.6F; + double d13 = (float) entity.posZ; + double d15 = this.getDistanceToEntity(entity); + double d17 = d11 - this.posY; - if(d15 <= 1.5D + d17) - { - entity.motionY = 0.15000000596046448D; - entity.fallDistance = 0.0F; + if (d15 <= 1.5D + d17) { + entity.motionY = 0.15000000596046448D; + entity.fallDistance = 0.0F; - if(d17 > 1.5D) - { - entity.motionY = -0.44999998807907104D + d17 * 0.34999999403953552D; - d15 += d17 * 1.5D; - } - else - { - entity.motionY = 0.125D; - } + if (d17 > 1.5D) { + entity.motionY = -0.44999998807907104D + d17 * 0.34999999403953552D; + d15 += d17 * 1.5D; + } else { + entity.motionY = 0.125D; + } - double d19 = Math.atan2(this.posX - d9, this.posZ - d13) / 0.01745329424738884D; - d19 += 160D; - entity.motionX = -Math.cos(0.01745329424738884D * d19) * (d15 + 0.25D) * 0.10000000149011612D; - entity.motionZ = Math.sin(0.01745329424738884D * d19) * (d15 + 0.25D) * 0.10000000149011612D; + double d19 = Math.atan2(this.posX - d9, this.posZ - d13) / 0.01745329424738884D; + d19 += 160D; + entity.motionX = -Math.cos(0.01745329424738884D * d19) * (d15 + 0.25D) * 0.10000000149011612D; + entity.motionZ = Math.sin(0.01745329424738884D * d19) * (d15 + 0.25D) * 0.10000000149011612D; - if(entity instanceof EntityWhirlwind) - { - entity.setDead(); + if (entity instanceof EntityWhirlwind) { + entity.setDead(); - if(!this.isEvil()) - { - this.lifeLeft /= 2; - this.setEvil(true); - this.playSound("random.fizz", this.rand.nextFloat() - this.rand.nextFloat() * 0.2F + 1.2F, 1.0F); - } - } - } - else - { - double d20 = Math.atan2(this.posX - d9, this.posZ - d13) / 0.01745329424738884D; - entity.motionX += Math.sin(0.01745329424738884D * d20) * 0.0099999997764825821D; - entity.motionZ += Math.cos(0.01745329424738884D * d20) * 0.0099999997764825821D; - } + if (!this.isEvil()) { + this.lifeLeft /= 2; + this.setEvil(true); + this.playSound("random.fizz", this.rand.nextFloat() - this.rand.nextFloat() * 0.2F + 1.2F, 1.0F); + } + } + } else { + double d20 = Math.atan2(this.posX - d9, this.posZ - d13) / 0.01745329424738884D; + entity.motionX += Math.sin(0.01745329424738884D * d20) * 0.0099999997764825821D; + entity.motionZ += Math.cos(0.01745329424738884D * d20) * 0.0099999997764825821D; + } - if(!this.worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) - { - this.lifeLeft -= 50; - } + if (!this.worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ)) { + this.lifeLeft -= 50; + } - if (this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) - { - int i2 = (MathHelper.floor_double(this.posX) - 1) + this.rand.nextInt(3); - int j2 = MathHelper.floor_double(this.posY) + this.rand.nextInt(5); - int k2 = (MathHelper.floor_double(this.posZ) - 1) + this.rand.nextInt(3); + if (this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) { + int i2 = (MathHelper.floor_double(this.posX) - 1) + this.rand.nextInt(3); + int j2 = MathHelper.floor_double(this.posY) + this.rand.nextInt(5); + int k2 = (MathHelper.floor_double(this.posZ) - 1) + this.rand.nextInt(3); - if(this.worldObj.getBlock(i2, j2, k2) instanceof BlockLeaves) - { - this.worldObj.setBlock(i2, j2, k2, Blocks.air); - } - } - } - } - - @Override - public boolean interact(EntityPlayer player) - { - ItemStack heldItem = player.getCurrentEquippedItem(); - - if (heldItem != null && heldItem.getItem() == Items.dye && AetherRankings.isRankedPlayer(player.getUniqueID())) - { - this.setColorData(heldItem.getItemDamage()); - - return true; - } - - return super.interact(player); - } - - @Override - public boolean canTriggerWalking() - { - return false; - } - - @SideOnly(Side.CLIENT) - public void updateParticles() - { - if(!this.isEvil()) - { - Integer color = ItemDye.field_150922_c[this.getColorData()]; - - for(int k = 0; k < 2; k++) - { - double d1 = (float)this.posX + rand.nextFloat() * 0.25F; - double d4 = (float)posY + height + 0.125F; - double d7 = (float)this.posZ + rand.nextFloat() * 0.25F; - float f = rand.nextFloat() * 360F; - - AetherParticle particle = new ParticlePassiveWhirly(this.worldObj, -Math.sin(0.01745329F * f) * 0.75D, d4 - 0.25D, Math.cos(0.01745329F * f) * 0.75D, d1, 0.125D, d7); - FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); - this.particles.add(particle); - - particle.setRBGColorF((((color >> 16) & 0xFF) / 255F), (((color >> 8) & 0xFF) / 255F), ((color & 0xFF) / 255F)); - - if (this.isRainbow) - { - int k1 = this.ticksExisted / 25 + this.getEntityId(); - int l = k1 % EntitySheep.fleeceColorTable.length; - int i1 = (k1 + 1) % EntitySheep.fleeceColorTable.length; - float f1 = ((float)(this.ticksExisted % 25)) / 25.0F; - particle.setRBGColorF(EntitySheep.fleeceColorTable[l][0] * (1.0F - f1) + EntitySheep.fleeceColorTable[i1][0] * f1, EntitySheep.fleeceColorTable[l][1] * (1.0F - f1) + EntitySheep.fleeceColorTable[i1][1] * f1, EntitySheep.fleeceColorTable[l][2] * (1.0F - f1) + EntitySheep.fleeceColorTable[i1][2] * f1); - } - - particle.setPosition(this.posX, this.posY, this.posZ); - } - } - else - { - for(int k = 0; k < 3; k++) - { - double d2 = (float)posX + rand.nextFloat() * 0.25F; - double d5 = (float)posY + height + 0.125F; - double d8 = (float)posZ + rand.nextFloat() * 0.25F; - float f1 = rand.nextFloat() * 360F; - AetherParticle particle = new ParticleEvilWhirly(this.worldObj, -Math.sin(0.01745329F * f1) * 0.75D, d5 - 0.25D, Math.cos(0.01745329F * f1) * 0.75D, d2, 0.125D, d8, 3.5F); - FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); - this.particles.add(particle); - - particle.setPosition(this.posX, this.posY, this.posZ); - } - } - - if(this.particles.size() > 0) - { - for(int i1 = 0; i1 < this.particles.size(); i1++) - { - AetherParticle particle = (AetherParticle)this.particles.get(i1); - - if(particle.isDead) - { - this.particles.remove(particle); - } - else - { - double d10 = particle.getX(); - double d12 = particle.boundingBox.minY; - double d14 = particle.getZ(); - double d16 = this.getDistanceToEntity(particle); - double d18 = d12 - this.posY; - particle.setMotionY(0.11500000208616257D); - double d21 = Math.atan2(this.posX - d10, this.posZ - d14) / 0.01745329424738884D; - d21 += 160D; - particle.setMotionX(-Math.cos(0.01745329424738884D * d21) * (d16 * 2.5D - d18) * 0.10000000149011612D); - particle.setMotionZ(Math.sin(0.01745329424738884D * d21) * (d16 * 2.5D - d18) * 0.10000000149011612D); - } - } - } - } - - public Item getRandomDrop() - { - int i = this.rand.nextInt(100) + 1; - - if(i == 100) - { - return Items.diamond; - } - - if(i >= 96) - { - return Items.iron_ingot; - } - - if(i >= 91) - { - return Items.gold_ingot; - } - - if(i >= 82) - { - return Items.coal; - } - - if (i >= 80) - { - return Item.getItemFromBlock(Blocks.pumpkin); - } - - if(i >= 75) - { - return Item.getItemFromBlock(Blocks.gravel); - } - - if(i >= 64) - { - return Item.getItemFromBlock(Blocks.clay); - } - - if(i >= 52) - { - return Items.stick; - } - - if(i >= 38) - { - return Items.flint; - } - - if(i > 20) - { - return Item.getItemFromBlock(Blocks.log); - } - else - { - return Item.getItemFromBlock(Blocks.sand); - } - } + if (this.worldObj.getBlock(i2, j2, k2) instanceof BlockLeaves) { + this.worldObj.setBlock(i2, j2, k2, Blocks.air); + } + } + } + } @Override - public boolean getCanSpawnHere() - { + public boolean interact(EntityPlayer player) { + ItemStack heldItem = player.getCurrentEquippedItem(); + + if (heldItem != null && heldItem.getItem() == Items.dye && AetherRankings.isRankedPlayer(player.getUniqueID())) { + this.setColorData(heldItem.getItemDamage()); + + return true; + } + + return super.interact(player); + } + + @Override + public boolean canTriggerWalking() { + return false; + } + + @SideOnly(Side.CLIENT) + public void updateParticles() { + if (!this.isEvil()) { + Integer color = ItemDye.field_150922_c[this.getColorData()]; + + for (int k = 0; k < 2; k++) { + double d1 = (float) this.posX + rand.nextFloat() * 0.25F; + double d4 = (float) posY + height + 0.125F; + double d7 = (float) this.posZ + rand.nextFloat() * 0.25F; + float f = rand.nextFloat() * 360F; + + AetherParticle particle = new ParticlePassiveWhirly(this.worldObj, -Math.sin(0.01745329F * f) * 0.75D, d4 - 0.25D, Math.cos(0.01745329F * f) * 0.75D, d1, 0.125D, d7); + FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); + this.particles.add(particle); + + particle.setRBGColorF((((color >> 16) & 0xFF) / 255F), (((color >> 8) & 0xFF) / 255F), ((color & 0xFF) / 255F)); + + if (this.isRainbow) { + int k1 = this.ticksExisted / 25 + this.getEntityId(); + int l = k1 % EntitySheep.fleeceColorTable.length; + int i1 = (k1 + 1) % EntitySheep.fleeceColorTable.length; + float f1 = ((float) (this.ticksExisted % 25)) / 25.0F; + particle.setRBGColorF(EntitySheep.fleeceColorTable[l][0] * (1.0F - f1) + EntitySheep.fleeceColorTable[i1][0] * f1, EntitySheep.fleeceColorTable[l][1] * (1.0F - f1) + EntitySheep.fleeceColorTable[i1][1] * f1, EntitySheep.fleeceColorTable[l][2] * (1.0F - f1) + EntitySheep.fleeceColorTable[i1][2] * f1); + } + + particle.setPosition(this.posX, this.posY, this.posZ); + } + } else { + for (int k = 0; k < 3; k++) { + double d2 = (float) posX + rand.nextFloat() * 0.25F; + double d5 = (float) posY + height + 0.125F; + double d8 = (float) posZ + rand.nextFloat() * 0.25F; + float f1 = rand.nextFloat() * 360F; + AetherParticle particle = new ParticleEvilWhirly(this.worldObj, -Math.sin(0.01745329F * f1) * 0.75D, d5 - 0.25D, Math.cos(0.01745329F * f1) * 0.75D, d2, 0.125D, d8, 3.5F); + FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle); + this.particles.add(particle); + + particle.setPosition(this.posX, this.posY, this.posZ); + } + } + + if (this.particles.size() > 0) { + for (int i1 = 0; i1 < this.particles.size(); i1++) { + AetherParticle particle = (AetherParticle) this.particles.get(i1); + + if (particle.isDead) { + this.particles.remove(particle); + } else { + double d10 = particle.getX(); + double d12 = particle.boundingBox.minY; + double d14 = particle.getZ(); + double d16 = this.getDistanceToEntity(particle); + double d18 = d12 - this.posY; + particle.setMotionY(0.11500000208616257D); + double d21 = Math.atan2(this.posX - d10, this.posZ - d14) / 0.01745329424738884D; + d21 += 160D; + particle.setMotionX(-Math.cos(0.01745329424738884D * d21) * (d16 * 2.5D - d18) * 0.10000000149011612D); + particle.setMotionZ(Math.sin(0.01745329424738884D * d21) * (d16 * 2.5D - d18) * 0.10000000149011612D); + } + } + } + } + + public Item getRandomDrop() { + int i = this.rand.nextInt(100) + 1; + + if (i == 100) { + return Items.diamond; + } + + if (i >= 96) { + return Items.iron_ingot; + } + + if (i >= 91) { + return Items.gold_ingot; + } + + if (i >= 82) { + return Items.coal; + } + + if (i >= 80) { + return Item.getItemFromBlock(Blocks.pumpkin); + } + + if (i >= 75) { + return Item.getItemFromBlock(Blocks.gravel); + } + + if (i >= 64) { + return Item.getItemFromBlock(Blocks.clay); + } + + if (i >= 52) { + return Items.stick; + } + + if (i >= 38) { + return Items.flint; + } + + if (i > 20) { + return Item.getItemFromBlock(Blocks.log); + } else { + return Item.getItemFromBlock(Blocks.sand); + } + } + + @Override + public boolean getCanSpawnHere() { int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.boundingBox.minY); int k = MathHelper.floor_double(this.posZ); @@ -415,55 +348,48 @@ public class EntityWhirlwind extends EntityMob return this.rand.nextInt(450) == 0 && this.worldObj.getBlock(i, j - 1, k) == BlocksAether.aether_grass && this.worldObj.getBlockLightValue(i, j, k) > 8 && this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); } - public EntityPlayer findClosestPlayer() - { - return this.worldObj.getClosestPlayerToEntity(this, 16D); - } + public EntityPlayer findClosestPlayer() { + return this.worldObj.getClosestPlayerToEntity(this, 16D); + } @Override - public void writeEntityToNBT(NBTTagCompound compound) - { - super.writeEntityToNBT(compound); + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); - compound.setFloat("movementAngle", this.movementAngle); - compound.setFloat("movementCurve", this.movementCurve); - compound.setBoolean("isRainbow", this.isRainbow); - compound.setBoolean("canDropItems", this.canDropItems); - } + compound.setFloat("movementAngle", this.movementAngle); + compound.setFloat("movementCurve", this.movementCurve); + compound.setBoolean("isRainbow", this.isRainbow); + compound.setBoolean("canDropItems", this.canDropItems); + } @Override - public void readEntityFromNBT(NBTTagCompound compound) - { - super.readEntityFromNBT(compound); + public void readEntityFromNBT(NBTTagCompound compound) { + super.readEntityFromNBT(compound); - this.movementAngle = compound.getFloat("movementAngle"); - this.movementCurve = compound.getFloat("movementCurve"); - this.isRainbow = compound.getBoolean("isRainbow"); - this.canDropItems = compound.getBoolean("canDropItems"); - } + this.movementAngle = compound.getFloat("movementAngle"); + this.movementCurve = compound.getFloat("movementCurve"); + this.isRainbow = compound.getBoolean("isRainbow"); + this.canDropItems = compound.getBoolean("canDropItems"); + } @Override - public boolean attackEntityFrom(DamageSource source, float damage) - { - return false; - } + public boolean attackEntityFrom(DamageSource source, float damage) { + return false; + } - @Override - public void applyEntityCollision(Entity entity) - { + @Override + public void applyEntityCollision(Entity entity) { - } + } - @Override - public int getMaxSpawnedInChunk() - { - return 3; - } + @Override + public int getMaxSpawnedInChunk() { + return 3; + } - @Override - public boolean isOnLadder() - { - return this.isCollidedHorizontally; - } + @Override + public boolean isOnLadder() { + return this.isCollidedHorizontally; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/hostile/EntityZephyr.java b/src/main/java/com/legacy/aether/entities/hostile/EntityZephyr.java index 78521d7..457755a 100644 --- a/src/main/java/com/legacy/aether/entities/hostile/EntityZephyr.java +++ b/src/main/java/com/legacy/aether/entities/hostile/EntityZephyr.java @@ -15,116 +15,99 @@ import com.legacy.aether.entities.ai.EntityAIUpdateState; import com.legacy.aether.entities.ai.zephyr.ZephyrAIShootTarget; import com.legacy.aether.entities.ai.zephyr.ZephyrAITravelCourse; -public class EntityZephyr extends EntityFlying implements IMob -{ +public class EntityZephyr extends EntityFlying implements IMob { - public ZephyrAIShootTarget shootingAI; + public ZephyrAIShootTarget shootingAI; - public int courseCooldown; + public int courseCooldown; - public double waypointX, waypointY, waypointZ; + public double waypointX, waypointY, waypointZ; - public EntityZephyr(World world) - { - super(world); + public EntityZephyr(World world) { + super(world); - this.setSize(4F, 4F); + this.setSize(4F, 4F); - this.tasks.addTask(1, this.shootingAI = new ZephyrAIShootTarget(this)); - this.tasks.addTask(0, new EntityAIUpdateState(this)); - this.tasks.addTask(2, new ZephyrAITravelCourse(this)); - this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - this.tasks.addTask(6, new EntityAILookIdle(this)); - } + this.tasks.addTask(1, this.shootingAI = new ZephyrAIShootTarget(this)); + this.tasks.addTask(0, new EntityAIUpdateState(this)); + this.tasks.addTask(2, new ZephyrAITravelCourse(this)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); + } - @Override - protected boolean isAIEnabled() - { - return true; - } + @Override + protected boolean isAIEnabled() { + return true; + } - @Override - public boolean getCanSpawnHere() - { - int i = MathHelper.floor_double(this.posX); - int j = MathHelper.floor_double(this.boundingBox.minY); - int k = MathHelper.floor_double(this.posZ); + @Override + public boolean getCanSpawnHere() { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.boundingBox.minY); + int k = MathHelper.floor_double(this.posZ); - return this.worldObj.getBlock(i, j - 1, k) == BlocksAether.aether_grass && this.rand.nextInt(85) == 0 && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).size() == 0 && !this.worldObj.isAnyLiquid(this.boundingBox) && this.worldObj.getBlockLightValue(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY), MathHelper.floor_double(this.posZ)) > 8 && super.getCanSpawnHere(); - } + return this.worldObj.getBlock(i, j - 1, k) == BlocksAether.aether_grass && this.rand.nextInt(85) == 0 && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).size() == 0 && !this.worldObj.isAnyLiquid(this.boundingBox) && this.worldObj.getBlockLightValue(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY), MathHelper.floor_double(this.posZ)) > 8 && super.getCanSpawnHere(); + } - @Override - public int getMaxSpawnedInChunk() - { - return 1; - } + @Override + public int getMaxSpawnedInChunk() { + return 1; + } - @Override - public void onEntityUpdate() - { - super.onEntityUpdate(); + @Override + public void onEntityUpdate() { + super.onEntityUpdate(); - if (this.worldObj.isRemote) - { - this.shootingAI.updateTask(); - } + if (this.worldObj.isRemote) { + this.shootingAI.updateTask(); + } - if(this.posY < -2D || this.posY > 255D) - { + if (this.posY < -2D || this.posY > 255D) { this.despawnEntity(); } - if(this.getAttackTarget() != null && this.getAttackTarget().isDead) - { - this.setAttackTarget(null); - } + if (this.getAttackTarget() != null && this.getAttackTarget().isDead) { + this.setAttackTarget(null); + } - if(!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) - { - this.setDead(); - } - } - - @Override - protected void updateEntityActionState() - { - super.updateEntityActionState(); - } - - @Override - protected String getLivingSound() - { - return "aether_legacy:aemob.zephyr.call"; - } - - @Override - protected String getHurtSound() - { - return "aether_legacy:aemob.zephyr.call"; - } - - @Override - protected String getDeathSound() - { - return null; - } + if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { + this.setDead(); + } + } @Override - protected void dropFewItems(boolean var1, int var2) - { + protected void updateEntityActionState() { + super.updateEntityActionState(); + } + + @Override + protected String getLivingSound() { + return "aether_legacy:aemob.zephyr.call"; + } + + @Override + protected String getHurtSound() { + return "aether_legacy:aemob.zephyr.call"; + } + + @Override + protected String getDeathSound() { + return null; + } + + @Override + protected void dropFewItems(boolean var1, int var2) { this.dropItem(Item.getItemFromBlock(BlocksAether.aercloud), 1); } - @Override - public boolean canDespawn() - { - return true; - } + @Override + public boolean canDespawn() { + return true; + } - @Override - protected float getSoundVolume() - { - return 1F; - } + @Override + protected float getSoundVolume() { + return 1F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/hostile/swet/EnumSwetType.java b/src/main/java/com/legacy/aether/entities/hostile/swet/EnumSwetType.java index c1238a3..0e9f64e 100644 --- a/src/main/java/com/legacy/aether/entities/hostile/swet/EnumSwetType.java +++ b/src/main/java/com/legacy/aether/entities/hostile/swet/EnumSwetType.java @@ -1,22 +1,18 @@ package com.legacy.aether.entities.hostile.swet; -public enum EnumSwetType -{ +public enum EnumSwetType { - BLUE(), GOLDEN(); + BLUE(), GOLDEN(); - EnumSwetType() - { + EnumSwetType() { - } + } - public int getId() - { - return this.ordinal(); - } + public int getId() { + return this.ordinal(); + } - public static EnumSwetType get(int id) - { - return values()[id]; - } + public static EnumSwetType get(int id) { + return values()[id]; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/movement/AetherPoisonMovement.java b/src/main/java/com/legacy/aether/entities/movement/AetherPoisonMovement.java index 5254c7f..60918b5 100644 --- a/src/main/java/com/legacy/aether/entities/movement/AetherPoisonMovement.java +++ b/src/main/java/com/legacy/aether/entities/movement/AetherPoisonMovement.java @@ -3,76 +3,62 @@ package com.legacy.aether.entities.movement; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; -public class AetherPoisonMovement -{ +public class AetherPoisonMovement { - public int ticks = 0; + public int ticks = 0; - public double rotD, motD; + public double rotD, motD; private EntityLivingBase entity; - public AetherPoisonMovement(EntityLivingBase entity) - { + public AetherPoisonMovement(EntityLivingBase entity) { this.entity = entity; } - public void onUpdate() - { - int timeUntilHit = this.ticks % 50; + public void onUpdate() { + int timeUntilHit = this.ticks % 50; - if (this.entity.isDead) - { - this.ticks = 0; - } - else if (this.ticks < 0) - { - this.ticks++; - } - else if (this.ticks > 0) - { - this.ticks--; + if (this.entity.isDead) { + this.ticks = 0; + } else if (this.ticks < 0) { + this.ticks++; + } else if (this.ticks > 0) { + this.ticks--; - if (timeUntilHit == 0) - { - this.entity.attackEntityFrom(causePoisonDamage(), 1.0F); - } + if (timeUntilHit == 0) { + this.entity.attackEntityFrom(causePoisonDamage(), 1.0F); + } - this.distractEntity(); - } + this.distractEntity(); + } } - public void inflictPoison(int ticks) - { - if (this.ticks >= 0) - { - this.ticks = ticks; - } - } + public void inflictPoison(int ticks) { + if (this.ticks >= 0) { + this.ticks = ticks; + } + } - public void inflictCure(int ticks) - { - this.ticks = -ticks; - } + public void inflictCure(int ticks) { + this.ticks = -ticks; + } - public void distractEntity() - { - double gaussian = this.entity.worldObj.rand.nextGaussian(); - double newMotD = 0.1D * gaussian; - double newRotD = (Math.PI / 4D) * gaussian; + public void distractEntity() { + double gaussian = this.entity.worldObj.rand.nextGaussian(); + double newMotD = 0.1D * gaussian; + double newRotD = (Math.PI / 4D) * gaussian; - this.motD = 0.2D * newMotD + (0.8D) * this.motD; - this.entity.motionX += this.motD; - this.entity.motionZ += this.motD; - this.rotD = 0.125D * newRotD + (1.0D - 0.125D) * this.rotD; + this.motD = 0.2D * newMotD + (0.8D) * this.motD; + this.entity.motionX += this.motD; + this.entity.motionZ += this.motD; + this.rotD = 0.125D * newRotD + (1.0D - 0.125D) * this.rotD; - this.entity.rotationYaw = (float)((double)this.entity.rotationYaw + rotD); - this.entity.rotationPitch = (float)((double)this.entity.rotationPitch + rotD); - } + this.entity.rotationYaw = (float) ((double) this.entity.rotationYaw + rotD); + this.entity.rotationPitch = (float) ((double) this.entity.rotationPitch + rotD); + } - public static DamageSource causePoisonDamage() - { - return new DamageSource("aether_legacy.poison").setDamageBypassesArmor(); - } + public static DamageSource causePoisonDamage() { + return new DamageSource("aether_legacy.poison").setDamageBypassesArmor(); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/particles/AetherParticle.java b/src/main/java/com/legacy/aether/entities/particles/AetherParticle.java index c73fc98..7c0d9c3 100644 --- a/src/main/java/com/legacy/aether/entities/particles/AetherParticle.java +++ b/src/main/java/com/legacy/aether/entities/particles/AetherParticle.java @@ -3,62 +3,50 @@ package com.legacy.aether.entities.particles; import net.minecraft.client.particle.EntityFX; import net.minecraft.world.World; -public class AetherParticle extends EntityFX -{ +public class AetherParticle extends EntityFX { - public AetherParticle(World worldIn, double posXIn, double posYIn, double posZIn) - { + public AetherParticle(World worldIn, double posXIn, double posYIn, double posZIn) { super(worldIn, posXIn, posYIn, posZIn); } - public AetherParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) - { + public AetherParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); - } + } - public void setMotionX(double motionX) - { - this.motionX = motionX; - } + public void setMotionX(double motionX) { + this.motionX = motionX; + } - public void setMotionY(double motionY) - { - this.motionY = motionY; - } + public void setMotionY(double motionY) { + this.motionY = motionY; + } - public void setMotionZ(double motionZ) - { - this.motionZ = motionZ; - } + public void setMotionZ(double motionZ) { + this.motionZ = motionZ; + } - public double getX() - { - return this.posX; - } + public double getX() { + return this.posX; + } - public double getY() - { - return this.posY; - } + public double getY() { + return this.posY; + } - public double getZ() - { - return this.posZ; - } + public double getZ() { + return this.posZ; + } - public double getMotionX() - { - return this.motionX; - } + public double getMotionX() { + return this.motionX; + } - public double getMotionY() - { - return this.motionY; - } + public double getMotionY() { + return this.motionY; + } - public double getMotionZ() - { - return this.motionZ; - } + public double getMotionZ() { + return this.motionZ; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/particles/EntityBlueFX.java b/src/main/java/com/legacy/aether/entities/particles/EntityBlueFX.java index 1b26b13..c8ac759 100644 --- a/src/main/java/com/legacy/aether/entities/particles/EntityBlueFX.java +++ b/src/main/java/com/legacy/aether/entities/particles/EntityBlueFX.java @@ -3,18 +3,16 @@ package com.legacy.aether.entities.particles; import net.minecraft.client.particle.EntityPortalFX; import net.minecraft.world.World; -public class EntityBlueFX extends EntityPortalFX -{ +public class EntityBlueFX extends EntityPortalFX { - public EntityBlueFX(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) - { + public EntityBlueFX(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) { super(world, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed); - float f = this.rand.nextFloat() * 0.6F + 0.4F; + float f = this.rand.nextFloat() * 0.6F + 0.4F; - this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f; - this.particleRed *= 0.2F; - this.particleGreen *= 0.2F; - } + this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f; + this.particleRed *= 0.2F; + this.particleGreen *= 0.2F; + } } diff --git a/src/main/java/com/legacy/aether/entities/particles/EntityCloudSmokeFX.java b/src/main/java/com/legacy/aether/entities/particles/EntityCloudSmokeFX.java index 0043f76..a139168 100644 --- a/src/main/java/com/legacy/aether/entities/particles/EntityCloudSmokeFX.java +++ b/src/main/java/com/legacy/aether/entities/particles/EntityCloudSmokeFX.java @@ -4,15 +4,13 @@ import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.World; -public class EntityCloudSmokeFX extends EntityFX -{ +public class EntityCloudSmokeFX extends EntityFX { float smokeParticleScale; public double riseRate; - public EntityCloudSmokeFX(World world, double x, double y, double z, double initialMotionX, double initialMotionY, double intialMotionZ, float size, float red, float blue, float green, double riseRate) - { + public EntityCloudSmokeFX(World world, double x, double y, double z, double initialMotionX, double initialMotionY, double intialMotionZ, float size, float red, float blue, float green, double riseRate) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.motionX *= 0.10000000149011612D; @@ -33,53 +31,47 @@ public class EntityCloudSmokeFX extends EntityFX } @Override - public void renderParticle(Tessellator renderer, float f, float f1, float f2, float f3, float f4, float f5) - { + public void renderParticle(Tessellator renderer, float f, float f1, float f2, float f3, float f4, float f5) { super.renderParticle(renderer, f, f1, f2, f3, f4, f5); float f6 = (((float) this.particleAge + f) / (float) this.particleMaxAge) * 32F; - if (f6 < 0.0F) - { + if (f6 < 0.0F) { f6 = 0.0F; } - if (f6 > 1.0F) - { + if (f6 > 1.0F) { f6 = 1.0F; } this.particleScale = this.smokeParticleScale * f6; - float f61 = (float)this.particleTextureIndexX / 16.0F; - float f7 = f61 + 0.0624375F; - float f8 = (float)this.particleTextureIndexY / 16.0F; - float f9 = f8 + 0.0624375F; - float f10 = 0.1F * this.particleScale; + float f61 = (float) this.particleTextureIndexX / 16.0F; + float f7 = f61 + 0.0624375F; + float f8 = (float) this.particleTextureIndexY / 16.0F; + float f9 = f8 + 0.0624375F; + float f10 = 0.1F * this.particleScale; - if (this.particleIcon != null) - { - f61 = this.particleIcon.getMinU(); - f7 = this.particleIcon.getMaxU(); - f8 = this.particleIcon.getMinV(); - f9 = this.particleIcon.getMaxV(); - } + if (this.particleIcon != null) { + f61 = this.particleIcon.getMinU(); + f7 = this.particleIcon.getMaxU(); + f8 = this.particleIcon.getMinV(); + f9 = this.particleIcon.getMaxV(); + } - float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)f - interpPosX); - float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)f - interpPosY); - float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)f - interpPosZ); - renderer.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); - renderer.addVertexWithUV((double)(f11 - f1 * f10 - f4 * f10), (double)(f12 - f2 * f10), (double)(f13 - f3 * f10 - f5 * f10), (double)f7, (double)f9); - renderer.addVertexWithUV((double)(f11 - f1 * f10 + f4 * f10), (double)(f12 + f2 * f10), (double)(f13 - f3 * f10 + f5 * f10), (double)f7, (double)f8); - renderer.addVertexWithUV((double)(f11 + f1 * f10 + f4 * f10), (double)(f12 + f2 * f10), (double)(f13 + f3 * f10 + f5 * f10), (double)f61, (double)f8); - renderer.addVertexWithUV((double)(f11 + f1 * f10 - f4 * f10), (double)(f12 - f2 * f10), (double)(f13 + f3 * f10 - f5 * f10), (double)f61, (double)f9); + float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) f - interpPosX); + float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) f - interpPosY); + float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) f - interpPosZ); + renderer.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); + renderer.addVertexWithUV((double) (f11 - f1 * f10 - f4 * f10), (double) (f12 - f2 * f10), (double) (f13 - f3 * f10 - f5 * f10), (double) f7, (double) f9); + renderer.addVertexWithUV((double) (f11 - f1 * f10 + f4 * f10), (double) (f12 + f2 * f10), (double) (f13 - f3 * f10 + f5 * f10), (double) f7, (double) f8); + renderer.addVertexWithUV((double) (f11 + f1 * f10 + f4 * f10), (double) (f12 + f2 * f10), (double) (f13 + f3 * f10 + f5 * f10), (double) f61, (double) f8); + renderer.addVertexWithUV((double) (f11 + f1 * f10 - f4 * f10), (double) (f12 - f2 * f10), (double) (f13 + f3 * f10 - f5 * f10), (double) f61, (double) f9); } @Override - public void onUpdate() - { + public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; - if (this.particleAge++ >= this.particleMaxAge) - { + if (this.particleAge++ >= this.particleMaxAge) { this.setDead(); } @@ -88,8 +80,7 @@ public class EntityCloudSmokeFX extends EntityFX this.moveEntity(this.motionX, this.motionY, this.motionZ); - if (this.posY == this.prevPosY) - { + if (this.posY == this.prevPosY) { this.motionX *= 1.1000000000000001D; this.motionZ *= 1.1000000000000001D; } @@ -98,8 +89,7 @@ public class EntityCloudSmokeFX extends EntityFX this.motionY *= this.riseRate; this.motionZ *= 0.95999997854232788D; - if (this.isCollided) - { + if (this.isCollided) { this.motionX *= 0.69999998807907104D; this.motionZ *= 0.69999998807907104D; } diff --git a/src/main/java/com/legacy/aether/entities/particles/EntityGoldenFX.java b/src/main/java/com/legacy/aether/entities/particles/EntityGoldenFX.java index 2f37d02..c806b45 100644 --- a/src/main/java/com/legacy/aether/entities/particles/EntityGoldenFX.java +++ b/src/main/java/com/legacy/aether/entities/particles/EntityGoldenFX.java @@ -3,11 +3,9 @@ package com.legacy.aether.entities.particles; import net.minecraft.client.particle.EntityPortalFX; import net.minecraft.world.World; -public class EntityGoldenFX extends EntityPortalFX -{ +public class EntityGoldenFX extends EntityPortalFX { - public EntityGoldenFX(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) - { + public EntityGoldenFX(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) { super(world, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed); this.particleBlue = 0.0F; diff --git a/src/main/java/com/legacy/aether/entities/particles/EntityPurpleFX.java b/src/main/java/com/legacy/aether/entities/particles/EntityPurpleFX.java index 8c4d593..5498265 100644 --- a/src/main/java/com/legacy/aether/entities/particles/EntityPurpleFX.java +++ b/src/main/java/com/legacy/aether/entities/particles/EntityPurpleFX.java @@ -3,11 +3,9 @@ package com.legacy.aether.entities.particles; import net.minecraft.client.particle.EntityPortalFX; import net.minecraft.world.World; -public class EntityPurpleFX extends EntityPortalFX -{ +public class EntityPurpleFX extends EntityPortalFX { - public EntityPurpleFX(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) - { + public EntityPurpleFX(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) { super(world, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed); this.particleRed = 0.69F; diff --git a/src/main/java/com/legacy/aether/entities/particles/ParticleAetherPortal.java b/src/main/java/com/legacy/aether/entities/particles/ParticleAetherPortal.java index 2b96d25..e9baa48 100644 --- a/src/main/java/com/legacy/aether/entities/particles/ParticleAetherPortal.java +++ b/src/main/java/com/legacy/aether/entities/particles/ParticleAetherPortal.java @@ -3,18 +3,16 @@ package com.legacy.aether.entities.particles; import net.minecraft.client.particle.EntityPortalFX; import net.minecraft.world.World; -public class ParticleAetherPortal extends EntityPortalFX -{ +public class ParticleAetherPortal extends EntityPortalFX { - public ParticleAetherPortal(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) - { + public ParticleAetherPortal(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) { super(world, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed); - float f = this.rand.nextFloat() * 0.6F + 0.4F; + float f = this.rand.nextFloat() * 0.6F + 0.4F; - this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f; - this.particleRed *= 0.2F; - this.particleGreen *= 0.2F; - } + this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f; + this.particleRed *= 0.2F; + this.particleGreen *= 0.2F; + } } diff --git a/src/main/java/com/legacy/aether/entities/particles/ParticleCrystalLeaves.java b/src/main/java/com/legacy/aether/entities/particles/ParticleCrystalLeaves.java index deda8af..3dca81a 100644 --- a/src/main/java/com/legacy/aether/entities/particles/ParticleCrystalLeaves.java +++ b/src/main/java/com/legacy/aether/entities/particles/ParticleCrystalLeaves.java @@ -3,11 +3,9 @@ package com.legacy.aether.entities.particles; import net.minecraft.client.particle.EntityPortalFX; import net.minecraft.world.World; -public class ParticleCrystalLeaves extends EntityPortalFX -{ +public class ParticleCrystalLeaves extends EntityPortalFX { - public ParticleCrystalLeaves(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) - { + public ParticleCrystalLeaves(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) { super(world, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed); this.particleBlue = 0.7450980392156863F; diff --git a/src/main/java/com/legacy/aether/entities/particles/ParticleEvilWhirly.java b/src/main/java/com/legacy/aether/entities/particles/ParticleEvilWhirly.java index a033951..dbfd18e 100644 --- a/src/main/java/com/legacy/aether/entities/particles/ParticleEvilWhirly.java +++ b/src/main/java/com/legacy/aether/entities/particles/ParticleEvilWhirly.java @@ -4,77 +4,69 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class ParticleEvilWhirly extends AetherParticle -{ +public class ParticleEvilWhirly extends AetherParticle { - float smokeParticleScale; + float smokeParticleScale; - public ParticleEvilWhirly(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46347_8_, double p_i46347_10_, double p_i46347_12_) - { - this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46347_8_, p_i46347_10_, p_i46347_12_, 1.0F); - } + public ParticleEvilWhirly(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46347_8_, double p_i46347_10_, double p_i46347_12_) { + this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46347_8_, p_i46347_10_, p_i46347_12_, 1.0F); + } - public ParticleEvilWhirly(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46348_8_, double p_i46348_10_, double p_i46348_12_, float p_i46348_14_) - { - super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); - this.motionX *= 0.10000000149011612D; - this.motionY *= 0.10000000149011612D; - this.motionZ *= 0.10000000149011612D; - this.motionX += p_i46348_8_; - this.motionY += p_i46348_10_; - this.motionZ += p_i46348_12_; - float f = (float)(Math.random() * 0.30000001192092896D); - this.particleRed = f; - this.particleGreen = f; - this.particleBlue = f; - this.particleScale *= 0.75F; - this.particleScale *= p_i46348_14_; - this.smokeParticleScale = this.particleScale; - this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); - this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46348_14_); - } + public ParticleEvilWhirly(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46348_8_, double p_i46348_10_, double p_i46348_12_, float p_i46348_14_) { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += p_i46348_8_; + this.motionY += p_i46348_10_; + this.motionZ += p_i46348_12_; + float f = (float) (Math.random() * 0.30000001192092896D); + this.particleRed = f; + this.particleGreen = f; + this.particleBlue = f; + this.particleScale *= 0.75F; + this.particleScale *= p_i46348_14_; + this.smokeParticleScale = this.particleScale; + this.particleMaxAge = (int) (8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int) ((float) this.particleMaxAge * p_i46348_14_); + } - /** - * Renders the particle - */ - public void renderParticle(Tessellator worldRendererIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) - { - float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; - f = MathHelper.clamp_float(f, 0.0F, 1.0F); - this.particleScale = this.smokeParticleScale * f; - super.renderParticle(worldRendererIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); - } + /** + * Renders the particle + */ + public void renderParticle(Tessellator worldRendererIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { + float f = ((float) this.particleAge + partialTicks) / (float) this.particleMaxAge * 32.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + this.particleScale = this.smokeParticleScale * f; + super.renderParticle(worldRendererIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); + } - public void onUpdate() - { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; - if (this.particleAge++ >= this.particleMaxAge) - { - this.setDead(); - } + if (this.particleAge++ >= this.particleMaxAge) { + this.setDead(); + } - this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); - this.motionY += 0.004D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); - if (this.posY == this.prevPosY) - { - this.motionX *= 1.1D; - this.motionZ *= 1.1D; - } + if (this.posY == this.prevPosY) { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } - this.motionX *= 0.9599999785423279D; - this.motionY *= 0.9599999785423279D; - this.motionZ *= 0.9599999785423279D; + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; - if (this.onGround) - { - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; - } - } + if (this.onGround) { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } } diff --git a/src/main/java/com/legacy/aether/entities/particles/ParticleGoldenOakLeaves.java b/src/main/java/com/legacy/aether/entities/particles/ParticleGoldenOakLeaves.java index 86ecc0e..f040878 100644 --- a/src/main/java/com/legacy/aether/entities/particles/ParticleGoldenOakLeaves.java +++ b/src/main/java/com/legacy/aether/entities/particles/ParticleGoldenOakLeaves.java @@ -3,11 +3,9 @@ package com.legacy.aether.entities.particles; import net.minecraft.client.particle.EntityPortalFX; import net.minecraft.world.World; -public class ParticleGoldenOakLeaves extends EntityPortalFX -{ +public class ParticleGoldenOakLeaves extends EntityPortalFX { - public ParticleGoldenOakLeaves(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) - { + public ParticleGoldenOakLeaves(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) { super(world, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed); this.particleBlue = 0.0F; diff --git a/src/main/java/com/legacy/aether/entities/particles/ParticleHolidayLeaves.java b/src/main/java/com/legacy/aether/entities/particles/ParticleHolidayLeaves.java index 14cf458..db9a183 100644 --- a/src/main/java/com/legacy/aether/entities/particles/ParticleHolidayLeaves.java +++ b/src/main/java/com/legacy/aether/entities/particles/ParticleHolidayLeaves.java @@ -3,11 +3,9 @@ package com.legacy.aether.entities.particles; import net.minecraft.client.particle.EntityPortalFX; import net.minecraft.world.World; -public class ParticleHolidayLeaves extends EntityPortalFX -{ +public class ParticleHolidayLeaves extends EntityPortalFX { - public ParticleHolidayLeaves(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) - { + public ParticleHolidayLeaves(World world, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed) { super(world, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed); this.particleRed = 1F; diff --git a/src/main/java/com/legacy/aether/entities/particles/ParticlePassiveWhirly.java b/src/main/java/com/legacy/aether/entities/particles/ParticlePassiveWhirly.java index 2790e4e..9308892 100644 --- a/src/main/java/com/legacy/aether/entities/particles/ParticlePassiveWhirly.java +++ b/src/main/java/com/legacy/aether/entities/particles/ParticlePassiveWhirly.java @@ -2,47 +2,42 @@ package com.legacy.aether.entities.particles; import net.minecraft.world.World; -public class ParticlePassiveWhirly extends AetherParticle -{ +public class ParticlePassiveWhirly extends AetherParticle { - public ParticlePassiveWhirly(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) - { - super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + public ParticlePassiveWhirly(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); - this.motionX = xSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D; - this.motionY = ySpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D; - this.motionZ = zSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D; - float f = this.rand.nextFloat() * 0.3F + 0.7F; - this.particleRed = f; - this.particleGreen = f; - this.particleBlue = f; - this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F; - this.particleMaxAge = (int)(16.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D)) + 2; - } + this.motionX = xSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D; + this.motionY = ySpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D; + this.motionZ = zSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D; + float f = this.rand.nextFloat() * 0.3F + 0.7F; + this.particleRed = f; + this.particleGreen = f; + this.particleBlue = f; + this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F; + this.particleMaxAge = (int) (16.0D / ((double) this.rand.nextFloat() * 0.8D + 0.2D)) + 2; + } - public void onUpdate() - { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; - if (this.particleAge++ >= this.particleMaxAge) - { - this.setDead(); - } + if (this.particleAge++ >= this.particleMaxAge) { + this.setDead(); + } - this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); - this.motionY += 0.004D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.8999999761581421D; - this.motionY *= 0.8999999761581421D; - this.motionZ *= 0.8999999761581421D; + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.8999999761581421D; + this.motionY *= 0.8999999761581421D; + this.motionZ *= 0.8999999761581421D; - if (this.onGround) - { - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; - } - } + if (this.onGround) { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/passive/EntityAerwhale.java b/src/main/java/com/legacy/aether/entities/passive/EntityAerwhale.java index b1765e9..5b05601 100644 --- a/src/main/java/com/legacy/aether/entities/passive/EntityAerwhale.java +++ b/src/main/java/com/legacy/aether/entities/passive/EntityAerwhale.java @@ -14,318 +14,263 @@ import net.minecraft.world.World; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.entities.ai.EntityAIUpdateState; -public class EntityAerwhale extends EntityFlying implements IMob -{ +public class EntityAerwhale extends EntityFlying implements IMob { private double motionYaw; - private double motionPitch; + private double motionPitch; - public double aerwhaleRotationYaw; + public double aerwhaleRotationYaw; - public double aerwhaleRotationPitch; + public double aerwhaleRotationPitch; - public EntityAerwhale(World world) - { - super(world); + public EntityAerwhale(World world) { + super(world); - this.setSize(4F, 4F); - this.isImmuneToFire = true; - this.ignoreFrustumCheck = true; - this.rotationYaw = 360F * this.getRNG().nextFloat(); - this.rotationPitch = 90F * this.getRNG().nextFloat() - 45F; - this.tasks.addTask(0, new EntityAIUpdateState(this)); - this.tasks.addTask(6, new EntityAILookIdle(this)); - } - - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); - } - - @Override - protected boolean isAIEnabled() - { - return true; - } - - @Override - public boolean getCanSpawnHere() - { - int i = MathHelper.floor_double(this.posX); - int j = MathHelper.floor_double(this.boundingBox.minY); - int k = MathHelper.floor_double(this.posZ); - - return this.worldObj.getBlock(i, j - 1, k) == BlocksAether.aether_grass && this.rand.nextInt(65) == 0 && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).size() == 0 && !this.worldObj.isAnyLiquid(this.boundingBox) && this.worldObj.getBlockLightValue(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY), MathHelper.floor_double(this.posZ)) > 8 && super.getCanSpawnHere(); - } - - @Override - public int getMaxSpawnedInChunk() - { - return 1; - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - this.extinguish(); - this.updateEntityActionState(); - } - - @Override - public void updateEntityActionState() - { - if (this.riddenByEntity != null) - { - return; - } - - int x = MathHelper.floor_double(this.posX); - int y = MathHelper.floor_double(this.boundingBox.minY); - int z = MathHelper.floor_double(this.posZ); - - double[] distances = new double[5]; - - distances[0] = this.checkForTravelableCourse(0F, 0F); - distances[1] = this.checkForTravelableCourse(45F, 0F); - distances[2] = this.checkForTravelableCourse(0F, 45F); - distances[3] = this.checkForTravelableCourse(-45F, 0F); - distances[4] = this.checkForTravelableCourse(0, -45F); - - int course = this.getCorrectCourse(distances); - - if (course == 0) - { - if(distances[0] == 50D) - { - this.motionYaw *= 0.9F; - this.motionPitch *= 0.9F; - - if(this.posY > 100) - { - this.motionPitch -= 2F; - } - if(this.posY < 20) - { - this.motionPitch += 2F; - } - } - else - { - this.rotationPitch = -this.rotationPitch; - this.rotationYaw = -this.rotationYaw; - } - } - else if (course == 1) - { - this.motionYaw += 5F; - } - else if (course == 2) - { - this.motionPitch -= 5F; - } - else if (course == 3) - { - this.motionYaw -= 5F; - } - else - { - this.motionPitch += 5F; - } - - if (this.posY < -64.0D) - { - this.setDead(); - } - - this.motionYaw += 2F * this.getRNG().nextFloat() - 1F; - this.motionPitch += 2F * this.getRNG().nextFloat() - 1F; - - this.rotationPitch += 0.1D * this.motionPitch; - this.rotationYaw += 0.1D * this.motionYaw; - - this.aerwhaleRotationPitch += 0.1D * this.motionPitch; - this.aerwhaleRotationYaw += 0.1D * this.motionYaw; - - if(this.rotationPitch < -60F) - { - this.rotationPitch = -60F; - } - - if (this.aerwhaleRotationPitch < -60D) - { - this.aerwhaleRotationPitch = -60D; - } - - if(this.rotationPitch > 60F) - { - this.rotationPitch = 60F; - } - - if (this.aerwhaleRotationPitch > 60D) - { - this.aerwhaleRotationPitch = 60D; - } - - this.rotationPitch *= 0.99D; - this.aerwhaleRotationPitch *= 0.99D; - - if (!this.worldObj.isRemote) - { - this.motionX += 0.01D * Math.cos((this.aerwhaleRotationYaw / 180D) * 3.1415926535897931D ) * Math.cos((this.aerwhaleRotationPitch / 180D) * 3.1415926535897931D); - - this.motionY += 0.01D * Math.sin((this.aerwhaleRotationPitch / 180D) * Math.PI); - - this.motionZ += 0.01D * Math.sin((this.aerwhaleRotationYaw / 180D) * 3.1415926535897931D ) * Math.cos((this.aerwhaleRotationPitch / 180D) * 3.1415926535897931D); - - this.motionX *= 0.98D; - this.motionY *= 0.98D; - this.motionZ *= 0.98D; - } - - if(this.motionX > 0D && this.worldObj.getBlock(x + 1, y, z) != Blocks.air) - { - if (!this.worldObj.isRemote) - { - this.motionX = -this.motionX; - } - - this.motionYaw -= 10F; - } - else if(this.motionX < 0D && this.worldObj.getBlock(x - 1, y, z) != Blocks.air) - { - if (!this.worldObj.isRemote) - { - this.motionX = -this.motionX; - } - - this.motionYaw += 10F; - } - - if(this.motionY > 0D && this.worldObj.getBlock(x, y + 1, z) != Blocks.air) - { - if (!this.worldObj.isRemote) - { - this.motionY = -this.motionY; - } - - this.motionPitch -= 20F; - } - else if(this.motionY < 0D && this.worldObj.getBlock(x, y - 1, z) != Blocks.air) - { - if (!this.worldObj.isRemote) - { - this.motionY = -this.motionY; - } - - this.motionPitch += 20F; - } - - if(this.motionZ > 0D && this.worldObj.getBlock(x, y, z + 1) != Blocks.air) - { - if (!this.worldObj.isRemote) - { - this.motionZ = -this.motionZ; - } - - this.motionYaw -= 10F; - } - else if(this.motionZ < 0D && this.worldObj.getBlock(x, y, z - 1) != Blocks.air) - { - if (!this.worldObj.isRemote) - { - this.motionZ = -this.motionZ; - } - - this.motionYaw += 10F; - } - - if (!this.worldObj.isRemote) - { - this.moveEntity(this.motionX, this.motionY, this.motionZ); - } - } - - private int getCorrectCourse(double[] distances) - { - int correctCourse = 0; - - for(int i = 1; i < 5; i++) - { - if(distances[i] > distances[correctCourse]) - { - correctCourse = i; - } - } - - return correctCourse; + this.setSize(4F, 4F); + this.isImmuneToFire = true; + this.ignoreFrustumCheck = true; + this.rotationYaw = 360F * this.getRNG().nextFloat(); + this.rotationPitch = 90F * this.getRNG().nextFloat() - 45F; + this.tasks.addTask(0, new EntityAIUpdateState(this)); + this.tasks.addTask(6, new EntityAILookIdle(this)); } - private double checkForTravelableCourse(float rotationYawOffset, float rotationPitchOffset) - { - double standard = 50D; - - float yaw = this.rotationYaw + rotationYawOffset; - float pitch = this.rotationYaw + rotationYawOffset; + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); + } - float f3 = MathHelper.cos(-yaw * 0.01745329F - 3.141593F); - float f4 = MathHelper.sin(-yaw * 0.01745329F - 3.141593F); - float f5 = MathHelper.cos(-pitch * 0.01745329F); - float f6 = MathHelper.sin(-pitch * 0.01745329F); + @Override + protected boolean isAIEnabled() { + return true; + } - float f7 = f4 * f5; - float f8 = f6; - float f9 = f3 * f5; + @Override + public boolean getCanSpawnHere() { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.boundingBox.minY); + int k = MathHelper.floor_double(this.posZ); - Vec3 vec3d = Vec3.createVectorHelper(this.posX, this.boundingBox.minY, this.posZ); - Vec3 vec3d1 = vec3d.addVector((double)f7 * standard, (double)f8 * standard, (double)f9 * standard); + return this.worldObj.getBlock(i, j - 1, k) == BlocksAether.aether_grass && this.rand.nextInt(65) == 0 && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).size() == 0 && !this.worldObj.isAnyLiquid(this.boundingBox) && this.worldObj.getBlockLightValue(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY), MathHelper.floor_double(this.posZ)) > 8 && super.getCanSpawnHere(); + } - MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3d, vec3d1, true); + @Override + public int getMaxSpawnedInChunk() { + return 1; + } - if(movingobjectposition == null) - { - return standard; - } + @Override + public void onUpdate() { + super.onUpdate(); - if(movingobjectposition.typeOfHit == MovingObjectType.BLOCK) - { - double i = movingobjectposition.blockX - this.posX; - double j = movingobjectposition.blockY - this.boundingBox.minY; - double k = movingobjectposition.blockZ - this.posZ; + this.extinguish(); + this.updateEntityActionState(); + } - return Math.sqrt(i * i + j * j + k * k); - } + @Override + public void updateEntityActionState() { + if (this.riddenByEntity != null) { + return; + } - return standard; - } + int x = MathHelper.floor_double(this.posX); + int y = MathHelper.floor_double(this.boundingBox.minY); + int z = MathHelper.floor_double(this.posZ); - @Override - public String getLivingSound() - { - return "aether_legacy:aemob.aerwhale.call"; - } + double[] distances = new double[5]; - @Override - protected String getHurtSound() - { - return "aether_legacy:aemob.aerwhale.death"; - } + distances[0] = this.checkForTravelableCourse(0F, 0F); + distances[1] = this.checkForTravelableCourse(45F, 0F); + distances[2] = this.checkForTravelableCourse(0F, 45F); + distances[3] = this.checkForTravelableCourse(-45F, 0F); + distances[4] = this.checkForTravelableCourse(0, -45F); - @Override - protected String getDeathSound() - { - return "aether_legacy:aemob.aerwhale.death"; - } + int course = this.getCorrectCourse(distances); - @Override - public boolean canDespawn() - { - return true; - } + if (course == 0) { + if (distances[0] == 50D) { + this.motionYaw *= 0.9F; + this.motionPitch *= 0.9F; + + if (this.posY > 100) { + this.motionPitch -= 2F; + } + if (this.posY < 20) { + this.motionPitch += 2F; + } + } else { + this.rotationPitch = -this.rotationPitch; + this.rotationYaw = -this.rotationYaw; + } + } else if (course == 1) { + this.motionYaw += 5F; + } else if (course == 2) { + this.motionPitch -= 5F; + } else if (course == 3) { + this.motionYaw -= 5F; + } else { + this.motionPitch += 5F; + } + + if (this.posY < -64.0D) { + this.setDead(); + } + + this.motionYaw += 2F * this.getRNG().nextFloat() - 1F; + this.motionPitch += 2F * this.getRNG().nextFloat() - 1F; + + this.rotationPitch += 0.1D * this.motionPitch; + this.rotationYaw += 0.1D * this.motionYaw; + + this.aerwhaleRotationPitch += 0.1D * this.motionPitch; + this.aerwhaleRotationYaw += 0.1D * this.motionYaw; + + if (this.rotationPitch < -60F) { + this.rotationPitch = -60F; + } + + if (this.aerwhaleRotationPitch < -60D) { + this.aerwhaleRotationPitch = -60D; + } + + if (this.rotationPitch > 60F) { + this.rotationPitch = 60F; + } + + if (this.aerwhaleRotationPitch > 60D) { + this.aerwhaleRotationPitch = 60D; + } + + this.rotationPitch *= 0.99D; + this.aerwhaleRotationPitch *= 0.99D; + + if (!this.worldObj.isRemote) { + this.motionX += 0.01D * Math.cos((this.aerwhaleRotationYaw / 180D) * 3.1415926535897931D) * Math.cos((this.aerwhaleRotationPitch / 180D) * 3.1415926535897931D); + + this.motionY += 0.01D * Math.sin((this.aerwhaleRotationPitch / 180D) * Math.PI); + + this.motionZ += 0.01D * Math.sin((this.aerwhaleRotationYaw / 180D) * 3.1415926535897931D) * Math.cos((this.aerwhaleRotationPitch / 180D) * 3.1415926535897931D); + + this.motionX *= 0.98D; + this.motionY *= 0.98D; + this.motionZ *= 0.98D; + } + + if (this.motionX > 0D && this.worldObj.getBlock(x + 1, y, z) != Blocks.air) { + if (!this.worldObj.isRemote) { + this.motionX = -this.motionX; + } + + this.motionYaw -= 10F; + } else if (this.motionX < 0D && this.worldObj.getBlock(x - 1, y, z) != Blocks.air) { + if (!this.worldObj.isRemote) { + this.motionX = -this.motionX; + } + + this.motionYaw += 10F; + } + + if (this.motionY > 0D && this.worldObj.getBlock(x, y + 1, z) != Blocks.air) { + if (!this.worldObj.isRemote) { + this.motionY = -this.motionY; + } + + this.motionPitch -= 20F; + } else if (this.motionY < 0D && this.worldObj.getBlock(x, y - 1, z) != Blocks.air) { + if (!this.worldObj.isRemote) { + this.motionY = -this.motionY; + } + + this.motionPitch += 20F; + } + + if (this.motionZ > 0D && this.worldObj.getBlock(x, y, z + 1) != Blocks.air) { + if (!this.worldObj.isRemote) { + this.motionZ = -this.motionZ; + } + + this.motionYaw -= 10F; + } else if (this.motionZ < 0D && this.worldObj.getBlock(x, y, z - 1) != Blocks.air) { + if (!this.worldObj.isRemote) { + this.motionZ = -this.motionZ; + } + + this.motionYaw += 10F; + } + + if (!this.worldObj.isRemote) { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + } + + private int getCorrectCourse(double[] distances) { + int correctCourse = 0; + + for (int i = 1; i < 5; i++) { + if (distances[i] > distances[correctCourse]) { + correctCourse = i; + } + } + + return correctCourse; + } + + private double checkForTravelableCourse(float rotationYawOffset, float rotationPitchOffset) { + double standard = 50D; + + float yaw = this.rotationYaw + rotationYawOffset; + float pitch = this.rotationYaw + rotationYawOffset; + + float f3 = MathHelper.cos(-yaw * 0.01745329F - 3.141593F); + float f4 = MathHelper.sin(-yaw * 0.01745329F - 3.141593F); + float f5 = MathHelper.cos(-pitch * 0.01745329F); + float f6 = MathHelper.sin(-pitch * 0.01745329F); + + float f7 = f4 * f5; + float f8 = f6; + float f9 = f3 * f5; + + Vec3 vec3d = Vec3.createVectorHelper(this.posX, this.boundingBox.minY, this.posZ); + Vec3 vec3d1 = vec3d.addVector((double) f7 * standard, (double) f8 * standard, (double) f9 * standard); + + MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3d, vec3d1, true); + + if (movingobjectposition == null) { + return standard; + } + + if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK) { + double i = movingobjectposition.blockX - this.posX; + double j = movingobjectposition.blockY - this.boundingBox.minY; + double k = movingobjectposition.blockZ - this.posZ; + + return Math.sqrt(i * i + j * j + k * k); + } + + return standard; + } + + @Override + public String getLivingSound() { + return "aether_legacy:aemob.aerwhale.call"; + } + + @Override + protected String getHurtSound() { + return "aether_legacy:aemob.aerwhale.death"; + } + + @Override + protected String getDeathSound() { + return "aether_legacy:aemob.aerwhale.death"; + } + + @Override + public boolean canDespawn() { + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/passive/EntityAetherAnimal.java b/src/main/java/com/legacy/aether/entities/passive/EntityAetherAnimal.java index c717be8..a540b99 100644 --- a/src/main/java/com/legacy/aether/entities/passive/EntityAetherAnimal.java +++ b/src/main/java/com/legacy/aether/entities/passive/EntityAetherAnimal.java @@ -9,26 +9,22 @@ import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public abstract class EntityAetherAnimal extends EntityAnimal -{ +public abstract class EntityAetherAnimal extends EntityAnimal { Random random = new Random(); - public EntityAetherAnimal(World worldIn) - { + public EntityAetherAnimal(World worldIn) { super(worldIn); } @Override - public float getBlockPathWeight(int x, int y, int z) - { - return this.worldObj.getBlock(x, y - 1, z) == BlocksAether.aether_grass ? 10.0F : this.worldObj.getLightBrightness(x, y, z) - 0.5F; - } + public float getBlockPathWeight(int x, int y, int z) { + return this.worldObj.getBlock(x, y - 1, z) == BlocksAether.aether_grass ? 10.0F : this.worldObj.getLightBrightness(x, y, z) - 0.5F; + } @Override - public boolean isBreedingItem(ItemStack stack) - { + public boolean isBreedingItem(ItemStack stack) { return stack.getItem() == ItemsAether.blueberry; - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/passive/EntityMiniCloud.java b/src/main/java/com/legacy/aether/entities/passive/EntityMiniCloud.java index f5a7baa..6339d20 100644 --- a/src/main/java/com/legacy/aether/entities/passive/EntityMiniCloud.java +++ b/src/main/java/com/legacy/aether/entities/passive/EntityMiniCloud.java @@ -13,218 +13,183 @@ import com.legacy.aether.entities.projectile.crystals.EnumCrystalType; import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; -public class EntityMiniCloud extends EntityFlying implements IEntityAdditionalSpawnData -{ +public class EntityMiniCloud extends EntityFlying implements IEntityAdditionalSpawnData { - public EntityPlayer owner; + public EntityPlayer owner; - public int shotTimer, lifeSpan; + public int shotTimer, lifeSpan; - public boolean direction; + public boolean direction; - public double targetX, targetY, targetZ; + public double targetX, targetY, targetZ; - public EntityMiniCloud(World worldObj) - { - super(worldObj); + public EntityMiniCloud(World worldObj) { + super(worldObj); - this.noClip = true; - this.lifeSpan = 3600; - this.entityCollisionReduction = 1.75F; + this.noClip = true; + this.lifeSpan = 3600; + this.entityCollisionReduction = 1.75F; - this.setSize(0.5F, 0.45F); - } + this.setSize(0.5F, 0.45F); + } - public EntityMiniCloud(World worldObj, EntityPlayer owner, int direction) - { - this(worldObj); + public EntityMiniCloud(World worldObj, EntityPlayer owner, int direction) { + this(worldObj); - this.owner = owner; - this.direction = direction == 0; - this.rotationYaw = this.owner.rotationYaw; - this.rotationPitch = this.owner.rotationPitch; + this.owner = owner; + this.direction = direction == 0; + this.rotationYaw = this.owner.rotationYaw; + this.rotationPitch = this.owner.rotationPitch; - this.getTargetPos(); - this.setPosition(this.targetX, this.targetY, this.targetZ); - } + this.getTargetPos(); + this.setPosition(this.targetX, this.targetY, this.targetZ); + } - public boolean isInRangeToRenderDist(double var1) - { - return true; - } + public boolean isInRangeToRenderDist(double var1) { + return true; + } - public void getTargetPos() - { - if (this.getDistanceToEntity(this.owner) > 2.0F) - { - this.targetX = this.owner.posX; - this.targetY = this.owner.posY + 1.10000000149011612D; - this.targetZ = this.owner.posZ; - } - else - { - double var1 = (double)this.owner.rotationYaw; + public void getTargetPos() { + if (this.getDistanceToEntity(this.owner) > 2.0F) { + this.targetX = this.owner.posX; + this.targetY = this.owner.posY + 1.10000000149011612D; + this.targetZ = this.owner.posZ; + } else { + double var1 = (double) this.owner.rotationYaw; - if (this.direction) - { - var1 -= 90.0D; - } - else - { - var1 += 90.0D; - } + if (this.direction) { + var1 -= 90.0D; + } else { + var1 += 90.0D; + } - var1 /= -(180D / Math.PI); - this.targetX = this.owner.posX + Math.sin(var1) * 1.05D; - this.targetY = this.owner.posY + 1.10000000149011612D; - this.targetZ = this.owner.posZ + Math.cos(var1) * 1.05D; - } - } + var1 /= -(180D / Math.PI); + this.targetX = this.owner.posX + Math.sin(var1) * 1.05D; + this.targetY = this.owner.posY + 1.10000000149011612D; + this.targetZ = this.owner.posZ + Math.cos(var1) * 1.05D; + } + } - public boolean atShoulder() - { - double var1 = this.posX - this.targetX; - double var3 = this.posY - this.targetY; - double var5 = this.posZ - this.targetZ; - return Math.sqrt(var1 * var1 + var3 * var3 + var5 * var5) < 0.3D; - } + public boolean atShoulder() { + double var1 = this.posX - this.targetX; + double var3 = this.posY - this.targetY; + double var5 = this.posZ - this.targetZ; + return Math.sqrt(var1 * var1 + var3 * var3 + var5 * var5) < 0.3D; + } - public void approachTarget() - { - double var1 = this.targetX - this.posX; - double var3 = this.targetY - this.posY; - double var5 = this.targetZ - this.posZ; - double var7 = Math.sqrt(var1 * var1 + var3 * var3 + var5 * var5) * 3.25D; - this.motionX = (this.motionX + var1 / var7) / 2.0D; - this.motionY = (this.motionY + var3 / var7) / 2.0D; - this.motionZ = (this.motionZ + var5 / var7) / 2.0D; - Math.atan2(var1, var5); - } + public void approachTarget() { + double var1 = this.targetX - this.posX; + double var3 = this.targetY - this.posY; + double var5 = this.targetZ - this.posZ; + double var7 = Math.sqrt(var1 * var1 + var3 * var3 + var5 * var5) * 3.25D; + this.motionX = (this.motionX + var1 / var7) / 2.0D; + this.motionY = (this.motionY + var3 / var7) / 2.0D; + this.motionZ = (this.motionZ + var5 / var7) / 2.0D; + Math.atan2(var1, var5); + } - public void writeEntityToNBT(NBTTagCompound var1) - { - super.writeEntityToNBT(var1); + public void writeEntityToNBT(NBTTagCompound var1) { + super.writeEntityToNBT(var1); - var1.setShort("LifeSpan", (short)this.lifeSpan); - var1.setShort("ShotTimer", (short)this.shotTimer); - var1.setBoolean("direction", this.direction); - } + var1.setShort("LifeSpan", (short) this.lifeSpan); + var1.setShort("ShotTimer", (short) this.shotTimer); + var1.setBoolean("direction", this.direction); + } - public void readEntityFromNBT(NBTTagCompound var1) - { - super.readEntityFromNBT(var1); + public void readEntityFromNBT(NBTTagCompound var1) { + super.readEntityFromNBT(var1); - this.lifeSpan = var1.getShort("LifeSpan"); - this.shotTimer = var1.getShort("ShotTimer"); - this.direction = var1.getBoolean("direction"); - } - - @Override - public void onEntityUpdate() - { - super.onEntityUpdate(); - - --this.lifeSpan; - - if (this.lifeSpan <= 0) - { - this.spawnExplosionParticle(); - this.isDead = true; - } - else - { - if (this.owner == null && !this.worldObj.isRemote) - { - this.setDead(); - return; - } - - if (this.shotTimer > 0) - { - --this.shotTimer; - } - - if (!this.owner.isDead) - { - if (this.worldObj.isRemote) - { - return; - } - - this.getTargetPos(); - - if (this.atShoulder()) - { - this.motionX *= 0.65D; - this.motionY *= 0.65D; - this.motionZ *= 0.65D; - - this.rotationYaw = this.owner.rotationYaw + (this.direction ? 1.0F : -1F); - this.rotationPitch = this.owner.rotationPitch; - this.rotationYawHead = this.owner.rotationYawHead; - - if (this.shotTimer <= 0 && this.owner.swingProgress > 0.0F) - { - float var7 = this.rotationYaw - (this.direction ? 1.0F : -1.0F); - double var1 = this.posX + Math.sin((double)var7 / -(180D / Math.PI)) * 1.6D; - double var3 = this.posY - -1.0D; - double var5 = this.posZ + Math.cos((double)var7 / -(180D / Math.PI)) * 1.6D; - EntityCrystal crystal = new EntityCrystal(this.worldObj, var1, var3, var5, EnumCrystalType.CLOUD); - Vec3 var9 = this.getLookVec(); - - if (var9 != null) - { - crystal.smotionX = var9.xCoord * 1.5D; - crystal.smotionY = var9.yCoord * 1.5D; - crystal.smotionZ = var9.zCoord * 1.5D; - } - - crystal.wasHit = true; - - if (!this.worldObj.isRemote) - { - this.worldObj.spawnEntityInWorld(crystal); - } - - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aemob.zephyr.shoot", 0.75F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); - - this.shotTimer = 40; - } - } - else - { - this.approachTarget(); - } - } - else - { - this.spawnExplosionParticle(); - this.isDead = true; - } - } - } - - @Override - public boolean attackEntityFrom(DamageSource var1, float var2) - { - if (var1.getEntity() == this.owner || var1.getDamageType() == "inWall") - { - return false; - } - - return super.attackEntityFrom(var1, var2); - } + this.lifeSpan = var1.getShort("LifeSpan"); + this.shotTimer = var1.getShort("ShotTimer"); + this.direction = var1.getBoolean("direction"); + } @Override - public void writeSpawnData(ByteBuf buffer) - { + public void onEntityUpdate() { + super.onEntityUpdate(); + + --this.lifeSpan; + + if (this.lifeSpan <= 0) { + this.spawnExplosionParticle(); + this.isDead = true; + } else { + if (this.owner == null && !this.worldObj.isRemote) { + this.setDead(); + return; + } + + if (this.shotTimer > 0) { + --this.shotTimer; + } + + if (!this.owner.isDead) { + if (this.worldObj.isRemote) { + return; + } + + this.getTargetPos(); + + if (this.atShoulder()) { + this.motionX *= 0.65D; + this.motionY *= 0.65D; + this.motionZ *= 0.65D; + + this.rotationYaw = this.owner.rotationYaw + (this.direction ? 1.0F : -1F); + this.rotationPitch = this.owner.rotationPitch; + this.rotationYawHead = this.owner.rotationYawHead; + + if (this.shotTimer <= 0 && this.owner.swingProgress > 0.0F) { + float var7 = this.rotationYaw - (this.direction ? 1.0F : -1.0F); + double var1 = this.posX + Math.sin((double) var7 / -(180D / Math.PI)) * 1.6D; + double var3 = this.posY - -1.0D; + double var5 = this.posZ + Math.cos((double) var7 / -(180D / Math.PI)) * 1.6D; + EntityCrystal crystal = new EntityCrystal(this.worldObj, var1, var3, var5, EnumCrystalType.CLOUD); + Vec3 var9 = this.getLookVec(); + + if (var9 != null) { + crystal.smotionX = var9.xCoord * 1.5D; + crystal.smotionY = var9.yCoord * 1.5D; + crystal.smotionZ = var9.zCoord * 1.5D; + } + + crystal.wasHit = true; + + if (!this.worldObj.isRemote) { + this.worldObj.spawnEntityInWorld(crystal); + } + + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aemob.zephyr.shoot", 0.75F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + + this.shotTimer = 40; + } + } else { + this.approachTarget(); + } + } else { + this.spawnExplosionParticle(); + this.isDead = true; + } + } + } + + @Override + public boolean attackEntityFrom(DamageSource var1, float var2) { + if (var1.getEntity() == this.owner || var1.getDamageType() == "inWall") { + return false; + } + + return super.attackEntityFrom(var1, var2); + } + + @Override + public void writeSpawnData(ByteBuf buffer) { buffer.writeBoolean(this.direction); buffer.writeInt(this.owner.getEntityId()); } @Override - public void readSpawnData(ByteBuf buffer) - { + public void readSpawnData(ByteBuf buffer) { this.direction = buffer.readBoolean(); this.owner = (EntityPlayer) this.worldObj.getEntityByID(buffer.readInt()); } diff --git a/src/main/java/com/legacy/aether/entities/passive/EntitySheepuff.java b/src/main/java/com/legacy/aether/entities/passive/EntitySheepuff.java index 880156a..2994080 100644 --- a/src/main/java/com/legacy/aether/entities/passive/EntitySheepuff.java +++ b/src/main/java/com/legacy/aether/entities/passive/EntitySheepuff.java @@ -24,293 +24,247 @@ import com.legacy.aether.entities.ai.SheepuffAIEatAetherGrass; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class EntitySheepuff extends EntityAetherAnimal -{ +public class EntitySheepuff extends EntityAetherAnimal { private SheepuffAIEatAetherGrass entityAIEatGrass; private int sheepTimer, amountEaten; - public EntitySheepuff(World world) - { - super(world); + public EntitySheepuff(World world) { + super(world); this.amountEaten = 0; - this.setSize(0.9F, 1.3F); + this.setSize(0.9F, 1.3F); this.setFleeceColor(getRandomFleeceColor(rand)); - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); - this.tasks.addTask(5, this.entityAIEatGrass = new SheepuffAIEatAetherGrass(this)); - this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.tasks.addTask(8, new EntityAILookIdle(this)); - } - - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - } - - @Override - protected void entityInit() - { - super.entityInit(); - - this.dataWatcher.addObject(16, new Byte((byte)0)); - this.dataWatcher.addObject(17, new Byte((byte)0)); - this.dataWatcher.addObject(18, new Byte((byte)0)); - } + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); + this.tasks.addTask(5, this.entityAIEatGrass = new SheepuffAIEatAetherGrass(this)); + this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + } @Override - protected void dropFewItems(boolean var1, int ammount) - { - if(!this.getSheared()) - { - this.entityDropItem(new ItemStack(Blocks.wool, 1 + this.rand.nextInt(2), this.getFleeceColor()), 0.0F); - } - } + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + } @Override - protected void updateAITasks() - { - this.sheepTimer = this.entityAIEatGrass.getEatingGrassTimer(); - super.updateAITasks(); - } + protected void entityInit() { + super.entityInit(); - @Override - public void onLivingUpdate() - { - if (this.worldObj.isRemote) - { - this.sheepTimer = Math.max(0, this.sheepTimer - 1); - } - - super.onLivingUpdate(); - } - - @SideOnly(Side.CLIENT) - public void handleHealthUpdate(byte id) - { - if (id == 10) - { - this.sheepTimer = 40; - } - else - { - super.handleHealthUpdate(id); - } - } - - @SideOnly(Side.CLIENT) - public float getHeadRotationPointY(float p_70894_1_) - { - return this.sheepTimer <= 0 ? 0.0F : (this.sheepTimer >= 4 && this.sheepTimer <= 36 ? 1.0F : (this.sheepTimer < 4 ? ((float)this.sheepTimer - p_70894_1_) / 4.0F : -((float)(this.sheepTimer - 40) - p_70894_1_) / 4.0F)); - } - - @SideOnly(Side.CLIENT) - public float getHeadRotationAngleX(float p_70890_1_) - { - if (this.sheepTimer > 4 && this.sheepTimer <= 36) - { - float f = ((float)(this.sheepTimer - 4) - p_70890_1_) / 32.0F; - return ((float)Math.PI / 5F) + ((float)Math.PI * 7F / 100F) * MathHelper.sin(f * 28.7F); - } - else - { - return this.sheepTimer > 0 ? ((float)Math.PI / 5F) : this.rotationPitch * 0.017453292F; - } - } - - @Override - public void eatGrassBonus() - { - ++this.amountEaten; - } + this.dataWatcher.addObject(16, new Byte((byte) 0)); + this.dataWatcher.addObject(17, new Byte((byte) 0)); + this.dataWatcher.addObject(18, new Byte((byte) 0)); + } @Override - protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) - { - this.playSound("mob.sheep.step", 0.15F, 1.0F); - } + protected void dropFewItems(boolean var1, int ammount) { + if (!this.getSheared()) { + this.entityDropItem(new ItemStack(Blocks.wool, 1 + this.rand.nextInt(2), this.getFleeceColor()), 0.0F); + } + } @Override - public boolean interact(EntityPlayer player) - { - ItemStack itemstack = player.inventory.getCurrentItem(); + protected void updateAITasks() { + this.sheepTimer = this.entityAIEatGrass.getEatingGrassTimer(); + super.updateAITasks(); + } - if(itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared()) - { - if(!this.worldObj.isRemote) - { - if(this.getPuffed()) - { + @Override + public void onLivingUpdate() { + if (this.worldObj.isRemote) { + this.sheepTimer = Math.max(0, this.sheepTimer - 1); + } + + super.onLivingUpdate(); + } + + @SideOnly(Side.CLIENT) + public void handleHealthUpdate(byte id) { + if (id == 10) { + this.sheepTimer = 40; + } else { + super.handleHealthUpdate(id); + } + } + + @SideOnly(Side.CLIENT) + public float getHeadRotationPointY(float p_70894_1_) { + return this.sheepTimer <= 0 ? 0.0F : (this.sheepTimer >= 4 && this.sheepTimer <= 36 ? 1.0F : (this.sheepTimer < 4 ? ((float) this.sheepTimer - p_70894_1_) / 4.0F : -((float) (this.sheepTimer - 40) - p_70894_1_) / 4.0F)); + } + + @SideOnly(Side.CLIENT) + public float getHeadRotationAngleX(float p_70890_1_) { + if (this.sheepTimer > 4 && this.sheepTimer <= 36) { + float f = ((float) (this.sheepTimer - 4) - p_70890_1_) / 32.0F; + return ((float) Math.PI / 5F) + ((float) Math.PI * 7F / 100F) * MathHelper.sin(f * 28.7F); + } else { + return this.sheepTimer > 0 ? ((float) Math.PI / 5F) : this.rotationPitch * 0.017453292F; + } + } + + @Override + public void eatGrassBonus() { + ++this.amountEaten; + } + + @Override + protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { + this.playSound("mob.sheep.step", 0.15F, 1.0F); + } + + @Override + public boolean interact(EntityPlayer player) { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared()) { + if (!this.worldObj.isRemote) { + if (this.getPuffed()) { this.setPuffed(false); - } - else - { + } else { this.setSheared(true); } int i = 2 + this.rand.nextInt(3); - for(int j = 0; j < i; j++) - { + for (int j = 0; j < i; j++) { EntityItem entityitem = this.entityDropItem(new ItemStack(Blocks.wool, 1, this.getFleeceColor()), 1.0F); entityitem.motionY += this.rand.nextFloat() * 0.05F; entityitem.motionX += (this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F; entityitem.motionZ += (this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F; } - } + } - itemstack.damageItem(1, player); - } + itemstack.damageItem(1, player); + } - if (itemstack != null && itemstack.getItem() == Items.dye && !this.getSheared()) - { - if (this.getFleeceColor() != itemstack.getItemDamage()) - { - if (this.getPuffed() && itemstack.stackSize >= 2) - { - this.setFleeceColor(15 - itemstack.getItemDamage()); - itemstack.stackSize -= 2; - } - else if (!this.getPuffed()) - { - this.setFleeceColor(15 - itemstack.getItemDamage()); - --itemstack.stackSize; - } - } - } + if (itemstack != null && itemstack.getItem() == Items.dye && !this.getSheared()) { + if (this.getFleeceColor() != itemstack.getItemDamage()) { + if (this.getPuffed() && itemstack.stackSize >= 2) { + this.setFleeceColor(15 - itemstack.getItemDamage()); + itemstack.stackSize -= 2; + } else if (!this.getPuffed()) { + this.setFleeceColor(15 - itemstack.getItemDamage()); + --itemstack.stackSize; + } + } + } - return super.interact(player); - } + return super.interact(player); + } - protected void jump() - { - if(this.getPuffed()) - { + protected void jump() { + if (this.getPuffed()) { this.motionY = 1.8D; this.motionX += this.rand.nextGaussian() * 0.5D; this.motionZ += this.rand.nextGaussian() * 0.5D; - } - else - { + } else { this.motionY = 0.41999998688697815D; } - } + } - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); - if(this.getPuffed()) - { + if (this.getPuffed()) { this.fallDistance = 0; - if(this.motionY < -0.05D) - { + if (this.motionY < -0.05D) { this.motionY = -0.05D; } } - if(this.amountEaten == 5 && !this.getSheared() && !this.getPuffed()) - { + if (this.amountEaten == 5 && !this.getSheared() && !this.getPuffed()) { this.setPuffed(true); this.amountEaten = 0; } - if(this.amountEaten == 10 && this.getSheared() && !this.getPuffed()) - { + if (this.amountEaten == 10 && this.getSheared() && !this.getPuffed()) { this.setSheared(false); this.setFleeceColor(15); this.amountEaten = 0; } } - public void writeEntityToNBT(NBTTagCompound nbttagcompound) - { - super.writeEntityToNBT(nbttagcompound); - nbttagcompound.setBoolean("Sheared", this.getSheared()); + public void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); + nbttagcompound.setBoolean("Sheared", this.getSheared()); nbttagcompound.setBoolean("Puffed", this.getPuffed()); - nbttagcompound.setByte("Color", (byte)this.getFleeceColor()); - } + nbttagcompound.setByte("Color", (byte) this.getFleeceColor()); + } - public void readEntityFromNBT(NBTTagCompound nbttagcompound) - { - super.readEntityFromNBT(nbttagcompound); + public void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); - this.setSheared(nbttagcompound.getBoolean("Sheared")); - this.setPuffed(nbttagcompound.getBoolean("Puffed")); - this.setFleeceColor(nbttagcompound.getByte("Color")); - } - - @Override - protected String getLivingSound() - { - return "mob.sheep.say"; - } - - @Override - protected String getHurtSound() - { - return "mob.sheep.say"; - } - - @Override - protected String getDeathSound() - { - return "mob.sheep.say"; - } - - public int getFleeceColor() - { - return this.dataWatcher.getWatchableObjectByte(16) & 15; - } - - public void setFleeceColor(int i) - { - byte byte0 = this.dataWatcher.getWatchableObjectByte(16); - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(byte0 & 240 | i & 15))); - } - - public boolean getSheared() - { - return this.dataWatcher.getWatchableObjectByte(17) == (byte)1; - } - - public void setSheared(boolean flag) - { - this.dataWatcher.updateObject(17, Byte.valueOf((byte)(flag ? 1 : 0))); - } - - public boolean getPuffed() - { - return this.dataWatcher.getWatchableObjectByte(18) == (byte)1; - } - - public void setPuffed(boolean flag) - { - this.dataWatcher.updateObject(18, Byte.valueOf((byte)(flag ? 1 : 0))); - } - - public static int getRandomFleeceColor(Random random) - { - int i = random.nextInt(100); - - if(i < 5) { return 3; } - if(i < 10) { return 9; } - if(i < 15) { return 5; } - if(i < 18) { return 6; } - - return random.nextInt(500) != 0 ? 0 : 10; - } + this.setSheared(nbttagcompound.getBoolean("Sheared")); + this.setPuffed(nbttagcompound.getBoolean("Puffed")); + this.setFleeceColor(nbttagcompound.getByte("Color")); + } @Override - public EntityAgeable createChild(EntityAgeable entityageable) - { + protected String getLivingSound() { + return "mob.sheep.say"; + } + + @Override + protected String getHurtSound() { + return "mob.sheep.say"; + } + + @Override + protected String getDeathSound() { + return "mob.sheep.say"; + } + + public int getFleeceColor() { + return this.dataWatcher.getWatchableObjectByte(16) & 15; + } + + public void setFleeceColor(int i) { + byte byte0 = this.dataWatcher.getWatchableObjectByte(16); + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (byte0 & 240 | i & 15))); + } + + public boolean getSheared() { + return this.dataWatcher.getWatchableObjectByte(17) == (byte) 1; + } + + public void setSheared(boolean flag) { + this.dataWatcher.updateObject(17, Byte.valueOf((byte) (flag ? 1 : 0))); + } + + public boolean getPuffed() { + return this.dataWatcher.getWatchableObjectByte(18) == (byte) 1; + } + + public void setPuffed(boolean flag) { + this.dataWatcher.updateObject(18, Byte.valueOf((byte) (flag ? 1 : 0))); + } + + public static int getRandomFleeceColor(Random random) { + int i = random.nextInt(100); + + if (i < 5) { + return 3; + } + if (i < 10) { + return 9; + } + if (i < 15) { + return 5; + } + if (i < 18) { + return 6; + } + + return random.nextInt(500) != 0 ? 0 : 10; + } + + @Override + public EntityAgeable createChild(EntityAgeable entityageable) { return new EntitySheepuff(this.worldObj); } diff --git a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityAerbunny.java b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityAerbunny.java index b3f3f57..f7a9cf6 100644 --- a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityAerbunny.java +++ b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityAerbunny.java @@ -18,19 +18,17 @@ import com.legacy.aether.player.PlayerAether; import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; -public class EntityAerbunny extends EntityAetherAnimal implements IEntityAdditionalSpawnData -{ +public class EntityAerbunny extends EntityAetherAnimal implements IEntityAdditionalSpawnData { - private int puff; + private int puff; - public int puffiness; + public int puffiness; private int jumpTicks; private int jumps; - public EntityAerbunny(World world) - { + public EntityAerbunny(World world) { super(world); this.ignoreFrustumCheck = true; @@ -42,130 +40,106 @@ public class EntityAerbunny extends EntityAetherAnimal implements IEntityAdditio this.tasks.addTask(6, new AerbunnyAIHop(this)); } - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(5.0D); this.setHealth(5.0F); - } + } - @Override - public boolean isInRangeToRenderDist(double par1) - { + @Override + public boolean isInRangeToRenderDist(double par1) { return true; } - @Override - public double getYOffset() - { + @Override + public double getYOffset() { return 0.4D; } - @Override - protected void jump() - { + @Override + protected void jump() { this.spawnExplosionParticle(); this.setPuffiness(11); --this.jumps; super.jump(); } - @Override - public void spawnExplosionParticle() - { - for (int i = 0; i < 5; ++i) - { + @Override + public void spawnExplosionParticle() { + for (int i = 0; i < 5; ++i) { double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; double d2 = this.rand.nextGaussian() * 0.02D; double d3 = 10.0D; - this.worldObj.spawnParticle("explode", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d0 * d3, this.posY + (double)(this.rand.nextFloat() * this.height) - d1 * d3, this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d2 * d3, d0, d1, d2); + this.worldObj.spawnParticle("explode", this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width - d0 * d3, this.posY + (double) (this.rand.nextFloat() * this.height) - d1 * d3, this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width - d2 * d3, d0, d1, d2); } } - public int getPuffinessClient() - { + public int getPuffinessClient() { return this.puffiness; } - public int getPuffiness() - { + public int getPuffiness() { return this.puff; } - public void setPuffinessClient(int i) - { + public void setPuffinessClient(int i) { this.puffiness = i; } - public void setPuffiness(int i) - { - this.puff = i; + public void setPuffiness(int i) { + this.puff = i; } - public void onUpdate() - { - this.setPuffinessClient(this.getPuffinessClient() - 1); + public void onUpdate() { + this.setPuffinessClient(this.getPuffinessClient() - 1); this.setPuffiness(this.getPuffiness() - 1); - if (this.getPuffinessClient() < 0) - { - this.setPuffinessClient(0); + if (this.getPuffinessClient() < 0) { + this.setPuffinessClient(0); } - if (this.getPuffiness() < 0) - { + if (this.getPuffiness() < 0) { this.setPuffiness(0); } super.onUpdate(); } - public void onLivingUpdate() - { - if (this.onGround) - { + public void onLivingUpdate() { + if (this.onGround) { this.jumps = 1; this.jumpTicks = 10; - } - else if (this.jumpTicks > 0) - { + } else if (this.jumpTicks > 0) { --this.jumpTicks; } - if (this.onGround) - { - this.jump(); + if (this.onGround) { + this.jump(); } - if (this.isJumping && !this.isInWater() && !this.handleLavaMovement() && !this.onGround && this.jumpTicks == 0 && this.jumps > 0) - { - if (this.moveForward != 0.0F) - { + if (this.isJumping && !this.isInWater() && !this.handleLavaMovement() && !this.onGround && this.jumpTicks == 0 && this.jumps > 0) { + if (this.moveForward != 0.0F) { //this.jump(); - } + } this.jumpTicks = 10; } - if (this.motionY < -0.1D) - { + if (this.motionY < -0.1D) { this.motionY = -0.1D; } - if (this.ridingEntity != null && this.ridingEntity instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer) this.ridingEntity; + if (this.ridingEntity != null && this.ridingEntity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) this.ridingEntity; - if (this.worldObj.isRemote) - { - for(int k = 0; k < 3; k++) - { - double d2 = (float)this.posX + this.rand.nextFloat() * 0.25F; - double d5 = (float)this.posY + this.height + 0.125F; - double d8 = (float)this.posZ + this.rand.nextFloat() * 0.25F; + if (this.worldObj.isRemote) { + for (int k = 0; k < 3; k++) { + double d2 = (float) this.posX + this.rand.nextFloat() * 0.25F; + double d5 = (float) this.posY + this.height + 0.125F; + double d8 = (float) this.posZ + this.rand.nextFloat() * 0.25F; float f1 = this.rand.nextFloat() * 360F; this.worldObj.spawnParticle("smoke", -Math.sin(0.01745329F * f1) * 0.75D, d5 - 0.25D, Math.cos(0.01745329F * f1) * 0.75D, d2, 0.125D, d8); } @@ -177,24 +151,20 @@ public class EntityAerbunny extends EntityAetherAnimal implements IEntityAdditio player.fallDistance = 0.0F; - if(!player.onGround) - { - if (!player.capabilities.isFlying) - { - player.motionY += 0.05000000074505806D; - } + if (!player.onGround) { + if (!player.capabilities.isFlying) { + player.motionY += 0.05000000074505806D; + } - player.fallDistance = 0.0F; + player.fallDistance = 0.0F; - if (player.motionY < -0.22499999403953552D) - { - if (PlayerAether.get((EntityPlayer) this.ridingEntity).isJumping()) - { - this.setPuffinessClient(11); - this.spawnExplosionParticle(); - player.motionY = 0.125D; - } - } + if (player.motionY < -0.22499999403953552D) { + if (PlayerAether.get((EntityPlayer) this.ridingEntity).isJumping()) { + this.setPuffinessClient(11); + this.spawnExplosionParticle(); + player.motionY = 0.125D; + } + } } } @@ -202,40 +172,32 @@ public class EntityAerbunny extends EntityAetherAnimal implements IEntityAdditio } @Override - public void fall(float distance) {} + public void fall(float distance) { + } @Override - public boolean isEntityInsideOpaqueBlock() - { + public boolean isEntityInsideOpaqueBlock() { return false; } @Override - public boolean isOnLadder() - { + public boolean isOnLadder() { return false; } @Override - public boolean interact(EntityPlayer entityplayer) - { + public boolean interact(EntityPlayer entityplayer) { ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - if (itemstack != null && (itemstack.getItem() == Items.name_tag)) - { + if (itemstack != null && (itemstack.getItem() == Items.name_tag)) { return super.interact(entityplayer); - } - else - { - this.worldObj.playSound(this.posX, this.posY, this.posZ, "aether_legacy:aemob.aerbunny.lift", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F, false); + } else { + this.worldObj.playSound(this.posX, this.posY, this.posZ, "aether_legacy:aemob.aerbunny.lift", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F, false); - if (this.isRiding()) - { - this.mountEntity(null); - } - else - { - this.mountEntity(entityplayer); + if (this.isRiding()) { + this.mountEntity(null); + } else { + this.mountEntity(entityplayer); } return true; @@ -243,51 +205,43 @@ public class EntityAerbunny extends EntityAetherAnimal implements IEntityAdditio } @Override - protected void dropFewItems(boolean recentlyHit, int var2) - { + protected void dropFewItems(boolean recentlyHit, int var2) { this.dropItem(Items.string, 1); } @Override - public boolean attackEntityFrom(DamageSource source, float damage) - { + public boolean attackEntityFrom(DamageSource source, float damage) { return source.getEntity() == this.ridingEntity ? false : super.attackEntityFrom(source, damage); } @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return this.onGround; } @Override - protected String getHurtSound() - { + protected String getHurtSound() { return "aether_legacy:aemob.aerbunny.hurt"; } @Override - protected String getDeathSound() - { + protected String getDeathSound() { return "aether_legacy:aemob.aerbunny.death"; } @Override - public EntityAgeable createChild(EntityAgeable entityageable) - { + public EntityAgeable createChild(EntityAgeable entityageable) { return new EntityAerbunny(this.worldObj); } - @Override - public void writeSpawnData(ByteBuf buffer) - { - buffer.writeInt(this.getPuffiness()); - } + @Override + public void writeSpawnData(ByteBuf buffer) { + buffer.writeInt(this.getPuffiness()); + } - @Override - public void readSpawnData(ByteBuf buffer) - { - this.setPuffiness(buffer.readInt()); - } + @Override + public void readSpawnData(ByteBuf buffer) { + this.setPuffiness(buffer.readInt()); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityFlyingCow.java b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityFlyingCow.java index 34ca1a6..be85328 100644 --- a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityFlyingCow.java +++ b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityFlyingCow.java @@ -20,237 +20,197 @@ import net.minecraft.world.World; import com.legacy.aether.entities.util.EntitySaddleMount; -public class EntityFlyingCow extends EntitySaddleMount -{ +public class EntityFlyingCow extends EntitySaddleMount { - public float wingFold; + public float wingFold; - public float wingAngle; + public float wingAngle; - private float aimingForFold; + private float aimingForFold; - public int maxJumps; + public int maxJumps; - public int jumpsRemaining; + public int jumpsRemaining; - private int ticks; + private int ticks; - public EntityFlyingCow(World world) - { - super(world); + public EntityFlyingCow(World world) { + super(world); - this.ticks = 0; - this.maxJumps = 1; - this.jumpsRemaining = 0; - this.stepHeight = 1.0F; - this.ignoreFrustumCheck = true; - this.canJumpMidAir = true; + this.ticks = 0; + this.maxJumps = 1; + this.jumpsRemaining = 0; + this.stepHeight = 1.0F; + this.ignoreFrustumCheck = true; + this.canJumpMidAir = true; - this.setSize(0.9F, 1.3F); + this.setSize(0.9F, 1.3F); this.getNavigator().setAvoidsWater(true); - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(1, new EntityAIPanic(this, 2.0D)); - this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); - this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D)); - this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.tasks.addTask(7, new EntityAILookIdle(this)); - } + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 2.0D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D)); + this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + } - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000000298023224D); - } + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000000298023224D); + } - @Override - public void onUpdate() - { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - if (this.isOnGround()) - { - this.wingAngle *= 0.8F; - this.aimingForFold = 0.1F; - this.jumpsRemaining = this.maxJumps; - } - else - { - this.aimingForFold = 1.0F; - } + if (this.isOnGround()) { + this.wingAngle *= 0.8F; + this.aimingForFold = 0.1F; + this.jumpsRemaining = this.maxJumps; + } else { + this.aimingForFold = 1.0F; + } - this.ticks++; + this.ticks++; - this.wingAngle = this.wingFold * (float) Math.sin(this.ticks / 31.83098862F); - this.wingFold += (this.aimingForFold - this.wingFold) / 5F; - this.fallDistance = 0; - this.fall(); - } + this.wingAngle = this.wingFold * (float) Math.sin(this.ticks / 31.83098862F); + this.wingFold += (this.aimingForFold - this.wingFold) / 5F; + this.fallDistance = 0; + this.fall(); + } - @Override - public void writeEntityToNBT(NBTTagCompound compound) - { - super.writeEntityToNBT(compound); + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); - compound.setInteger("maxJumps", (short) this.maxJumps); - compound.setInteger("jumpsRemaining", (short) this.jumpsRemaining); - } + compound.setInteger("maxJumps", (short) this.maxJumps); + compound.setInteger("jumpsRemaining", (short) this.jumpsRemaining); + } - @Override - public void readEntityFromNBT(NBTTagCompound compound) - { - super.readEntityFromNBT(compound); + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + super.readEntityFromNBT(compound); - this.maxJumps = compound.getInteger("maxJumps"); - this.jumpsRemaining = compound.getInteger("jumpsRemaining"); - } + this.maxJumps = compound.getInteger("maxJumps"); + this.jumpsRemaining = compound.getInteger("jumpsRemaining"); + } - @Override - public double getMountedYOffset() - { - return 1.15D; - } + @Override + public double getMountedYOffset() { + return 1.15D; + } - @Override - public float getMountedMoveSpeed() - { - return 0.3F; - } + @Override + public float getMountedMoveSpeed() { + return 0.3F; + } - @Override - protected void jump() - { - if (this.riddenByEntity == null) - { - super.jump(); - } - } + @Override + protected void jump() { + if (this.riddenByEntity == null) { + super.jump(); + } + } - private void fall() - { - if (!this.onGround) - { - if (this.motionY < 0.0D && !this.isRiderSneaking()) - { - this.motionY *= 0.6D; - } + private void fall() { + if (!this.onGround) { + if (this.motionY < 0.0D && !this.isRiderSneaking()) { + this.motionY *= 0.6D; + } - if (this.onGround && !this.worldObj.isRemote) - { - this.jumpsRemaining = this.maxJumps; - } - } - } + if (this.onGround && !this.worldObj.isRemote) { + this.jumpsRemaining = this.maxJumps; + } + } + } - @Override - public boolean interact(EntityPlayer player) - { - ItemStack stack = player.getCurrentEquippedItem(); + @Override + public boolean interact(EntityPlayer player) { + ItemStack stack = player.getCurrentEquippedItem(); - if (stack != null) - { - ItemStack currentStack = stack; + if (stack != null) { + ItemStack currentStack = stack; - if (currentStack.getItem() == Items.bucket) - { - Item milk = Items.milk_bucket; + if (currentStack.getItem() == Items.bucket) { + Item milk = Items.milk_bucket; - if (stack != null && stack.stackSize == 1) - { - player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(milk)); - } - else if (!player.inventory.addItemStackToInventory(new ItemStack(milk))) - { - if (!this.worldObj.isRemote) - { - this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, player.posX, player.posY, player.posZ, new ItemStack(milk))); + if (stack != null && stack.stackSize == 1) { + player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(milk)); + } else if (!player.inventory.addItemStackToInventory(new ItemStack(milk))) { + if (!this.worldObj.isRemote) { + this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, player.posX, player.posY, player.posZ, new ItemStack(milk))); - if (!player.capabilities.isCreativeMode) - { - --stack.stackSize; - } - } - } - else if (!player.capabilities.isCreativeMode) - { - --stack.stackSize; - } - } - } + if (!player.capabilities.isCreativeMode) { + --stack.stackSize; + } + } + } else if (!player.capabilities.isCreativeMode) { + --stack.stackSize; + } + } + } - return super.interact(player); - } + return super.interact(player); + } - @Override - protected String getLivingSound() - { + @Override + protected String getLivingSound() { return "mob.cow.say"; } - @Override - protected String getHurtSound() - { + @Override + protected String getHurtSound() { return "mob.cow.hurt"; } - @Override - protected String getDeathSound() - { + @Override + protected String getDeathSound() { return "mob.cow.hurt"; } - @Override - protected float getSoundVolume() - { - return 0.4F; - } + @Override + protected float getSoundVolume() { + return 0.4F; + } - @Override - protected void func_145780_a(int x, int y, int z, Block block) - { + @Override + protected void func_145780_a(int x, int y, int z, Block block) { this.playSound("mob.cow.step", 0.15F, 1.0F); } - @Override - public EntityAgeable createChild(EntityAgeable entityageable) - { - return new EntityFlyingCow(this.worldObj); - } + @Override + public EntityAgeable createChild(EntityAgeable entityageable) { + return new EntityFlyingCow(this.worldObj); + } - @Override - protected void dropFewItems(boolean recentlyHit, int lootLevel) - { - int j = this.rand.nextInt(3) + this.rand.nextInt(1 + lootLevel); - int k; + @Override + protected void dropFewItems(boolean recentlyHit, int lootLevel) { + int j = this.rand.nextInt(3) + this.rand.nextInt(1 + lootLevel); + int k; - for (k = 0; k < j; ++k) - { - this.dropItem(Items.leather, 1); - } + for (k = 0; k < j; ++k) { + this.dropItem(Items.leather, 1); + } - j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + lootLevel); + j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + lootLevel); - for (k = 0; k < j; ++k) - { - if (this.isBurning()) - { - this.dropItem(Items.cooked_beef, 1); - } - else - { - this.dropItem(Items.beef, 1); - } - } + for (k = 0; k < j; ++k) { + if (this.isBurning()) { + this.dropItem(Items.cooked_beef, 1); + } else { + this.dropItem(Items.beef, 1); + } + } - super.dropFewItems(recentlyHit, lootLevel); - } + super.dropFewItems(recentlyHit, lootLevel); + } - @Override - protected double getMountJumpStrength() - { - return 5.0D; - } + @Override + protected double getMountJumpStrength() { + return 5.0D; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityMoa.java b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityMoa.java index d225b6a..5c0e8c5 100644 --- a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityMoa.java +++ b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityMoa.java @@ -22,441 +22,362 @@ import com.legacy.aether.entities.util.EntitySaddleMount; import com.legacy.aether.items.ItemMoaEgg; import com.legacy.aether.items.ItemsAether; -public class EntityMoa extends EntitySaddleMount -{ +public class EntityMoa extends EntitySaddleMount { - public float wingRotation, destPos, prevDestPos, prevWingRotation; + public float wingRotation, destPos, prevDestPos, prevWingRotation; - protected int ticksOffGround, ticksUntilFlap, secsUntilFlying, secsUntilWalking, secsUntilHungry, secsUntilEgg; + protected int ticksOffGround, ticksUntilFlap, secsUntilFlying, secsUntilWalking, secsUntilHungry, secsUntilEgg; - public EntityMoa(World world) - { - super(world); + public EntityMoa(World world) { + super(world); - this.initAI(); + this.initAI(); - this.setSize(1.0F, 2.0F); - this.stepHeight = 1.0F; + this.setSize(1.0F, 2.0F); + this.stepHeight = 1.0F; - this.secsUntilEgg = this.getRandomEggTime(); - } - - public EntityMoa(World world, AetherMoaType type) - { - this(world); - - this.setMoaType(type); - } - - @Override - public void moveEntity(double x, double y, double z) - { - if (!this.isSitting()) - { - super.moveEntity(x, y, z); - } - else - { - super.moveEntity(0, y, 0); - } + this.secsUntilEgg = this.getRandomEggTime(); } - public int getRandomEggTime() - { - return 775 + this.rand.nextInt(50); - } + public EntityMoa(World world, AetherMoaType type) { + this(world); - public void initAI() - { - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(2, new EntityAIWander(this, 0.30F)); - this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.tasks.addTask(5, new EntityAILookIdle(this)); - this.tasks.addTask(6, new EntityAIMate(this, 0.25F)); - } + this.setMoaType(type); + } - @Override - public void entityInit() - { - super.entityInit(); + @Override + public void moveEntity(double x, double y, double z) { + if (!this.isSitting()) { + super.moveEntity(x, y, z); + } else { + super.moveEntity(0, y, 0); + } + } - AetherMoaType moaType = AetherAPI.instance().getRandomMoaType(); + public int getRandomEggTime() { + return 775 + this.rand.nextInt(50); + } - this.dataWatcher.addObject(20, new Short((short) AetherAPI.instance().getMoaTypeId(moaType))); - this.dataWatcher.addObject(21, new Byte((byte) moaType.getMoaProperties().getMaxJumps())); - this.dataWatcher.addObject(22, new Byte((byte) 0)); - this.dataWatcher.addObject(23, new Byte((byte) 0)); - this.dataWatcher.addObject(24, new Byte((byte) 0)); - this.dataWatcher.addObject(25, new Byte((byte) 0)); + public void initAI() { + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIWander(this, 0.30F)); + this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(5, new EntityAILookIdle(this)); + this.tasks.addTask(6, new EntityAIMate(this, 0.25F)); + } - } + @Override + public void entityInit() { + super.entityInit(); - @Override - public boolean isAIEnabled() - { - return true; - } + AetherMoaType moaType = AetherAPI.instance().getRandomMoaType(); - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); + this.dataWatcher.addObject(20, new Short((short) AetherAPI.instance().getMoaTypeId(moaType))); + this.dataWatcher.addObject(21, new Byte((byte) moaType.getMoaProperties().getMaxJumps())); + this.dataWatcher.addObject(22, new Byte((byte) 0)); + this.dataWatcher.addObject(23, new Byte((byte) 0)); + this.dataWatcher.addObject(24, new Byte((byte) 0)); + this.dataWatcher.addObject(25, new Byte((byte) 0)); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); - } + } - public boolean isSitting() - { - return this.dataWatcher.getWatchableObjectByte(25) == (byte)1; - } + @Override + public boolean isAIEnabled() { + return true; + } - public void setSitting(boolean isSitting) - { - this.dataWatcher.updateObject(25, (byte) (isSitting ? 1 : 0)); - } + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); - public boolean isHungry() - { - return this.dataWatcher.getWatchableObjectByte(24) == (byte)1; - } + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); + } - public void setHungry(boolean hungry) - { - this.dataWatcher.updateObject(24, (byte) (hungry ? 1 : 0)); - } + public boolean isSitting() { + return this.dataWatcher.getWatchableObjectByte(25) == (byte) 1; + } - public byte getAmountFed() - { - return this.dataWatcher.getWatchableObjectByte(23); - } + public void setSitting(boolean isSitting) { + this.dataWatcher.updateObject(25, (byte) (isSitting ? 1 : 0)); + } - public void setAmountFed(int amountFed) - { - this.dataWatcher.updateObject(23, (byte) amountFed); - } + public boolean isHungry() { + return this.dataWatcher.getWatchableObjectByte(24) == (byte) 1; + } - public void increaseAmountFed(int amountFed) - { - int amount = (int) this.getAmountFed(); + public void setHungry(boolean hungry) { + this.dataWatcher.updateObject(24, (byte) (hungry ? 1 : 0)); + } - this.setAmountFed(amount + amountFed); - } + public byte getAmountFed() { + return this.dataWatcher.getWatchableObjectByte(23); + } - public boolean isPlayerGrown() - { - return this.dataWatcher.getWatchableObjectByte(22) == (byte)1; - } + public void setAmountFed(int amountFed) { + this.dataWatcher.updateObject(23, (byte) amountFed); + } - public void setPlayerGrown(boolean playerGrown) - { - this.dataWatcher.updateObject(22, (byte) (playerGrown ? 1 : 0)); - } + public void increaseAmountFed(int amountFed) { + int amount = (int) this.getAmountFed(); - public int getMaxJumps() - { - return this.getMoaType().getMoaProperties().getMaxJumps(); - } + this.setAmountFed(amount + amountFed); + } - public int getRemainingJumps() - { - return (int) this.dataWatcher.getWatchableObjectByte(21); - } + public boolean isPlayerGrown() { + return this.dataWatcher.getWatchableObjectByte(22) == (byte) 1; + } - public void setRemainingJumps(int jumps) - { - this.dataWatcher.updateObject(21, (byte) jumps); - } + public void setPlayerGrown(boolean playerGrown) { + this.dataWatcher.updateObject(22, (byte) (playerGrown ? 1 : 0)); + } - public int getMoaTypeId() - { - return (int) this.dataWatcher.getWatchableObjectShort(20); - } + public int getMaxJumps() { + return this.getMoaType().getMoaProperties().getMaxJumps(); + } - public AetherMoaType getMoaType() - { - int id = (int) this.dataWatcher.getWatchableObjectShort(20); + public int getRemainingJumps() { + return (int) this.dataWatcher.getWatchableObjectByte(21); + } - return AetherAPI.instance().getMoaType(id); - } + public void setRemainingJumps(int jumps) { + this.dataWatcher.updateObject(21, (byte) jumps); + } - public void setMoaType(AetherMoaType type) - { - this.dataWatcher.updateObject(20, new Short((short) AetherAPI.instance().getMoaTypeId(type))); - this.dataWatcher.updateObject(21, new Byte((byte) type.getMoaProperties().getMaxJumps())); - } + public int getMoaTypeId() { + return (int) this.dataWatcher.getWatchableObjectShort(20); + } - @Override - public void onUpdate() - { - super.onUpdate(); + public AetherMoaType getMoaType() { + int id = (int) this.dataWatcher.getWatchableObjectShort(20); - if (this.isJumping) - { - this.motionY += 0.05F; - } + return AetherAPI.instance().getMoaType(id); + } - this.updateWingRotation(); - this.fall(); - - if (this.secsUntilHungry > 0) - { - if (this.ticksExisted % 20 == 0) - { - this.secsUntilHungry--; - } - } - else if (!this.isHungry()) - { - this.setHungry(true); - } + public void setMoaType(AetherMoaType type) { + this.dataWatcher.updateObject(20, new Short((short) AetherAPI.instance().getMoaTypeId(type))); + this.dataWatcher.updateObject(21, new Byte((byte) type.getMoaProperties().getMaxJumps())); + } - if (!this.worldObj.isRemote && !this.isChild() && this.riddenByEntity == null) - { - if (this.secsUntilEgg > 0) - { - if (this.ticksExisted % 20 == 0) - { - this.secsUntilEgg--; - } - } - else - { - this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); - this.entityDropItem(ItemMoaEgg.getStackFromType(this.getMoaType()), 0); + @Override + public void onUpdate() { + super.onUpdate(); - this.secsUntilEgg = this.getRandomEggTime(); - } - } + if (this.isJumping) { + this.motionY += 0.05F; + } - this.fallDistance = 0.0F; - } + this.updateWingRotation(); + this.fall(); - public void resetHunger() - { - if (!this.worldObj.isRemote) - { - this.setHungry(false); - } + if (this.secsUntilHungry > 0) { + if (this.ticksExisted % 20 == 0) { + this.secsUntilHungry--; + } + } else if (!this.isHungry()) { + this.setHungry(true); + } - this.secsUntilHungry = 40 + this.rand.nextInt(40); - } + if (!this.worldObj.isRemote && !this.isChild() && this.riddenByEntity == null) { + if (this.secsUntilEgg > 0) { + if (this.ticksExisted % 20 == 0) { + this.secsUntilEgg--; + } + } else { + this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.entityDropItem(ItemMoaEgg.getStackFromType(this.getMoaType()), 0); - public void updateWingRotation() - { - if (!this.onGround) - { - if (this.ticksUntilFlap == 0) - { - this.worldObj.playSoundAtEntity(this, "mob.bat.takeoff", 0.15F, MathHelper.clamp_float(this.rand.nextFloat(), 0.7f, 1.0f) + MathHelper.clamp_float(this.rand.nextFloat(), 0f, 0.3f)); + this.secsUntilEgg = this.getRandomEggTime(); + } + } - this.ticksUntilFlap = 8; - } - else - { - this.ticksUntilFlap--; - } - } + this.fallDistance = 0.0F; + } - this.prevWingRotation = this.wingRotation; - this.prevDestPos = this.destPos; + public void resetHunger() { + if (!this.worldObj.isRemote) { + this.setHungry(false); + } - this.destPos += 0.2D; - this.destPos = minMax(0.01F, 1.0F, this.destPos); + this.secsUntilHungry = 40 + this.rand.nextInt(40); + } - if (this.isOnGround()) - { - this.destPos = 0.0F; - } + public void updateWingRotation() { + if (!this.onGround) { + if (this.ticksUntilFlap == 0) { + this.worldObj.playSoundAtEntity(this, "mob.bat.takeoff", 0.15F, MathHelper.clamp_float(this.rand.nextFloat(), 0.7f, 1.0f) + MathHelper.clamp_float(this.rand.nextFloat(), 0f, 0.3f)); - this.wingRotation += 1.233F; - } + this.ticksUntilFlap = 8; + } else { + this.ticksUntilFlap--; + } + } - public static float minMax(float min, float max, float value) - { - return Math.min(max, Math.max(min, value)); - } + this.prevWingRotation = this.wingRotation; + this.prevDestPos = this.destPos; - @Override - public void onMountedJump(float par1, float par2) - { - if (this.getRemainingJumps() > 0 && this.motionY < 0.0D) - { - if (!this.isOnGround()) - { - this.motionY = 0.7D; - this.worldObj.playSoundAtEntity(this, "mob.bat.takeoff", 0.15F, MathHelper.clamp_float(this.rand.nextFloat(), 0.7f, 1.0f) + MathHelper.clamp_float(this.rand.nextFloat(), 0f, 0.3f)); + this.destPos += 0.2D; + this.destPos = minMax(0.01F, 1.0F, this.destPos); - if (!this.worldObj.isRemote) - { - this.setRemainingJumps(this.getRemainingJumps() - 1); - } + if (this.isOnGround()) { + this.destPos = 0.0F; + } - this.spawnExplosionParticle(); - } - else - { - this.motionY = 0.89D; - } - } - } + this.wingRotation += 1.233F; + } - @Override - public float getMountedMoveSpeed() - { - return this.getMoaType().getMoaProperties().getMoaSpeed(); - } + public static float minMax(float min, float max, float value) { + return Math.min(max, Math.max(min, value)); + } - public void setToAdult() - { - this.setGrowingAge(0); - } + @Override + public void onMountedJump(float par1, float par2) { + if (this.getRemainingJumps() > 0 && this.motionY < 0.0D) { + if (!this.isOnGround()) { + this.motionY = 0.7D; + this.worldObj.playSoundAtEntity(this, "mob.bat.takeoff", 0.15F, MathHelper.clamp_float(this.rand.nextFloat(), 0.7f, 1.0f) + MathHelper.clamp_float(this.rand.nextFloat(), 0f, 0.3f)); - @Override - public boolean interact(EntityPlayer player) - { - ItemStack stack = player.getCurrentEquippedItem(); + if (!this.worldObj.isRemote) { + this.setRemainingJumps(this.getRemainingJumps() - 1); + } - if (stack != null && this.isPlayerGrown() && !this.worldObj.isRemote) - { - Item currentItem = stack.getItem(); + this.spawnExplosionParticle(); + } else { + this.motionY = 0.89D; + } + } + } - if (this.isChild() && this.isHungry()) - { - if (this.getAmountFed() < 3 && currentItem == ItemsAether.aechor_petal) - { - if (!player.capabilities.isCreativeMode) - { - --stack.stackSize; - } + @Override + public float getMountedMoveSpeed() { + return this.getMoaType().getMoaProperties().getMoaSpeed(); + } - this.increaseAmountFed(1); + public void setToAdult() { + this.setGrowingAge(0); + } - if (this.getAmountFed() >= 3) - { - this.setToAdult(); - } - else - { - this.resetHunger(); - } - } - } + @Override + public boolean interact(EntityPlayer player) { + ItemStack stack = player.getCurrentEquippedItem(); - if (currentItem == ItemsAether.nature_staff) - { - stack.damageItem(2, player); + if (stack != null && this.isPlayerGrown() && !this.worldObj.isRemote) { + Item currentItem = stack.getItem(); - this.setSitting(this.isSitting() ? false : true); + if (this.isChild() && this.isHungry()) { + if (this.getAmountFed() < 3 && currentItem == ItemsAether.aechor_petal) { + if (!player.capabilities.isCreativeMode) { + --stack.stackSize; + } - return true; - } - } + this.increaseAmountFed(1); - return super.interact(player); - } + if (this.getAmountFed() >= 3) { + this.setToAdult(); + } else { + this.resetHunger(); + } + } + } - @Override - public boolean canSaddle() - { - return !this.isChild() && this.isPlayerGrown(); - } + if (currentItem == ItemsAether.nature_staff) { + stack.damageItem(2, player); - @Override - public void writeEntityToNBT(NBTTagCompound nbt) - { - super.writeEntityToNBT(nbt); + this.setSitting(this.isSitting() ? false : true); - nbt.setBoolean("playerGrown", this.isPlayerGrown()); - nbt.setInteger("remainingJumps", this.getRemainingJumps()); - nbt.setInteger("moaTypeId", this.getMoaTypeId()); - nbt.setByte("amountFed", this.getAmountFed()); - nbt.setBoolean("isHungry", this.isHungry()); - nbt.setBoolean("isSitting", this.isSitting()); - } + return true; + } + } - @Override - public void readEntityFromNBT(NBTTagCompound nbt) - { - super.readEntityFromNBT(nbt); + return super.interact(player); + } - this.setPlayerGrown(nbt.getBoolean("playerGrown")); - this.setRemainingJumps(nbt.getInteger("remainingJumps")); - this.setMoaType(AetherAPI.instance().getMoaType(nbt.getInteger("moaTypeId"))); - this.setAmountFed(nbt.getByte("amountFed")); - this.setHungry(nbt.getBoolean("isHungry")); - this.setSitting(nbt.getBoolean("isSitting")); - } + @Override + public boolean canSaddle() { + return !this.isChild() && this.isPlayerGrown(); + } - @Override - protected String getLivingSound() - { - return "aether_legacy:aemob.moa.say"; - } + @Override + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); - @Override - protected String getHurtSound() - { - return "aether_legacy:aemob.moa.say"; - } + nbt.setBoolean("playerGrown", this.isPlayerGrown()); + nbt.setInteger("remainingJumps", this.getRemainingJumps()); + nbt.setInteger("moaTypeId", this.getMoaTypeId()); + nbt.setByte("amountFed", this.getAmountFed()); + nbt.setBoolean("isHungry", this.isHungry()); + nbt.setBoolean("isSitting", this.isSitting()); + } - @Override - protected String getDeathSound() - { - return "aether_legacy:aemob.moa.say"; - } + @Override + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); - @Override - protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) - { + this.setPlayerGrown(nbt.getBoolean("playerGrown")); + this.setRemainingJumps(nbt.getInteger("remainingJumps")); + this.setMoaType(AetherAPI.instance().getMoaType(nbt.getInteger("moaTypeId"))); + this.setAmountFed(nbt.getByte("amountFed")); + this.setHungry(nbt.getBoolean("isHungry")); + this.setSitting(nbt.getBoolean("isSitting")); + } + + @Override + protected String getLivingSound() { + return "aether_legacy:aemob.moa.say"; + } + + @Override + protected String getHurtSound() { + return "aether_legacy:aemob.moa.say"; + } + + @Override + protected String getDeathSound() { + return "aether_legacy:aemob.moa.say"; + } + + @Override + protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { this.playSound("mob.pig.step", 0.15F, 1.0F); } - @Override - protected void dropFewItems(boolean recentlyHit, int lootLevel) - { - super.dropFewItems(recentlyHit, lootLevel); + @Override + protected void dropFewItems(boolean recentlyHit, int lootLevel) { + super.dropFewItems(recentlyHit, lootLevel); - this.dropItem(Items.feather, 3); - } + this.dropItem(Items.feather, 3); + } - public void fall() - { - int x = MathHelper.floor_double(this.posX); - int y = MathHelper.floor_double(this.posY); - int z = MathHelper.floor_double(this.posZ); - boolean blockBeneath = !this.worldObj.isAirBlock(x, y - 1, z); + public void fall() { + int x = MathHelper.floor_double(this.posX); + int y = MathHelper.floor_double(this.posY); + int z = MathHelper.floor_double(this.posZ); + boolean blockBeneath = !this.worldObj.isAirBlock(x, y - 1, z); - if (this.motionY < 0.0D && !this.isRiderSneaking()) - { - this.motionY *= 0.6D; - } + if (this.motionY < 0.0D && !this.isRiderSneaking()) { + this.motionY *= 0.6D; + } - if (blockBeneath) - { - this.setRemainingJumps(this.getMaxJumps()); - } - } + if (blockBeneath) { + this.setRemainingJumps(this.getMaxJumps()); + } + } - @Override - public void jump() - { - if (!this.isSitting() && this.riddenByEntity == null) - { - super.jump(); - } - } + @Override + public void jump() { + if (!this.isSitting() && this.riddenByEntity == null) { + super.jump(); + } + } - @Override - public double getMountedYOffset() - { - return 1.25D; - } + @Override + public double getMountedYOffset() { + return 1.25D; + } - @Override - public EntityAgeable createChild(EntityAgeable matingAnimal) - { - return new EntityMoa(this.worldObj, this.getMoaType()); - } + @Override + public EntityAgeable createChild(EntityAgeable matingAnimal) { + return new EntityMoa(this.worldObj, this.getMoaType()); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityParachute.java b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityParachute.java index 71f880c..37f5f3e 100644 --- a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityParachute.java +++ b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityParachute.java @@ -12,23 +12,20 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -public class EntityParachute extends Entity implements IEntityAdditionalSpawnData -{ +public class EntityParachute extends Entity implements IEntityAdditionalSpawnData { - private EntityPlayer ridingPlayer; + private EntityPlayer ridingPlayer; - public boolean isGoldenParachute; + public boolean isGoldenParachute; - public EntityParachute(World world) - { + public EntityParachute(World world) { super(world); this.setSize(1.0F, 1.0F); } - public EntityParachute(World world, EntityPlayer player, boolean isGolden) - { - this(world); + public EntityParachute(World world, EntityPlayer player, boolean isGolden) { + this(world); this.prevPosX = this.posX; this.prevPosY = this.posY; @@ -38,153 +35,128 @@ public class EntityParachute extends Entity implements IEntityAdditionalSpawnDat this.moveToEntityUsing(); this.spawnExplosionParticle(); - } + } - @Override - protected void entityInit() - { + @Override + protected void entityInit() { - } + } - public void spawnExplosionParticle() - { - if (this.worldObj.isRemote) - { + public void spawnExplosionParticle() { + if (this.worldObj.isRemote) { double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; double d2 = this.rand.nextGaussian() * 0.02D; double d3 = 10.0D; - this.worldObj.spawnParticle("explode", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d0 * d3, this.posY - 0.5D + (double)(this.rand.nextFloat() * this.height) - d1 * d3, this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d2 * d3, d0, d1, d2); - } - else - { - this.worldObj.setEntityState(this, (byte)20); + this.worldObj.spawnParticle("explode", this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width - d0 * d3, this.posY - 0.5D + (double) (this.rand.nextFloat() * this.height) - d1 * d3, this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width - d2 * d3, d0, d1, d2); + } else { + this.worldObj.setEntityState(this, (byte) 20); } } - @Override - public void onUpdate() - { - if (this.isDead || this.ridingPlayer == null) - { - this.setDead(); - - return; - } - - if (this.ridingPlayer != null) - { - if (this.ridingPlayer.motionY < -0.25F) - { - this.ridingPlayer.motionY = -0.25F; - } - - this.ridingPlayer.fallDistance = 0F; - - this.moveToEntityUsing(); - this.spawnExplosionParticle(); - } - } - - private void moveToEntityUsing() - { - this.setPositionAndRotation(this.ridingPlayer.posX, this.ridingPlayer.boundingBox.minY - (this.height / 2) - 0.5D, this.ridingPlayer.posZ, this.ridingPlayer.rotationYaw, this.ridingPlayer.rotationPitch); - - this.motionX = this.ridingPlayer.motionX; - this.motionY = this.ridingPlayer.motionY; - this.motionZ = this.ridingPlayer.motionZ; - this.rotationYaw = this.ridingPlayer.rotationYaw; - - if(this.isCollided()) - { - this.die(); - } - } - - private boolean isCollided() - { - List list = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox); - - for (int size = 0; size < list.size();) - { - if (size == 0 && list.size() == 0) - { - return false; - } - - AxisAlignedBB collision_list = (AxisAlignedBB) list.get(size); - - return collision_list != this.ridingPlayer.boundingBox; - } - - return this.worldObj.isAABBInMaterial(this.boundingBox, Material.water); - } - @Override - public void onCollideWithPlayer(EntityPlayer entityplayer) - { + public void onUpdate() { + if (this.isDead || this.ridingPlayer == null) { + this.setDead(); + return; + } + + if (this.ridingPlayer != null) { + if (this.ridingPlayer.motionY < -0.25F) { + this.ridingPlayer.motionY = -0.25F; + } + + this.ridingPlayer.fallDistance = 0F; + + this.moveToEntityUsing(); + this.spawnExplosionParticle(); + } } - public void die() - { - if(this.ridingPlayer != null) - { - this.spawnExplosionParticle(); - } - - this.ridingPlayer = null; - this.isDead = true; - } + private void moveToEntityUsing() { + this.setPositionAndRotation(this.ridingPlayer.posX, this.ridingPlayer.boundingBox.minY - (this.height / 2) - 0.5D, this.ridingPlayer.posZ, this.ridingPlayer.rotationYaw, this.ridingPlayer.rotationPitch); - public static boolean entityHasRoomForCloud(World world, EntityPlayer player) - { - AxisAlignedBB boundingBox = player.boundingBox; + this.motionX = this.ridingPlayer.motionX; + this.motionY = this.ridingPlayer.motionY; + this.motionZ = this.ridingPlayer.motionZ; + this.rotationYaw = this.ridingPlayer.rotationYaw; - return world.getCollidingBoundingBoxes(player, boundingBox).size() == 0 && !world.isAABBInMaterial(boundingBox, Material.water); + if (this.isCollided()) { + this.die(); + } + } + + private boolean isCollided() { + List list = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox); + + for (int size = 0; size < list.size(); ) { + if (size == 0 && list.size() == 0) { + return false; + } + + AxisAlignedBB collision_list = (AxisAlignedBB) list.get(size); + + return collision_list != this.ridingPlayer.boundingBox; + } + + return this.worldObj.isAABBInMaterial(this.boundingBox, Material.water); } @Override - public boolean isInRangeToRenderDist(double d) - { - if(this.ridingPlayer != null) - { - return this.ridingPlayer.isInRangeToRenderDist(d); - } + public void onCollideWithPlayer(EntityPlayer entityplayer) { - return super.isInRangeToRenderDist(d); + } + + public void die() { + if (this.ridingPlayer != null) { + this.spawnExplosionParticle(); + } + + this.ridingPlayer = null; + this.isDead = true; + } + + public static boolean entityHasRoomForCloud(World world, EntityPlayer player) { + AxisAlignedBB boundingBox = player.boundingBox; + + return world.getCollidingBoundingBoxes(player, boundingBox).size() == 0 && !world.isAABBInMaterial(boundingBox, Material.water); } @Override - public boolean canBeCollidedWith() - { + public boolean isInRangeToRenderDist(double d) { + if (this.ridingPlayer != null) { + return this.ridingPlayer.isInRangeToRenderDist(d); + } + + return super.isInRangeToRenderDist(d); + } + + @Override + public boolean canBeCollidedWith() { return true; } - @Override - protected void readEntityFromNBT(NBTTagCompound compound) - { + @Override + protected void readEntityFromNBT(NBTTagCompound compound) { - } + } - @Override - protected void writeEntityToNBT(NBTTagCompound compound) - { + @Override + protected void writeEntityToNBT(NBTTagCompound compound) { - } + } - @Override - public void writeSpawnData(ByteBuf buffer) - { - buffer.writeBoolean(this.isGoldenParachute); - buffer.writeInt(this.ridingPlayer.getEntityId()); - } + @Override + public void writeSpawnData(ByteBuf buffer) { + buffer.writeBoolean(this.isGoldenParachute); + buffer.writeInt(this.ridingPlayer.getEntityId()); + } - @Override - public void readSpawnData(ByteBuf buffer) - { - this.isGoldenParachute = buffer.readBoolean(); - this.ridingPlayer = (EntityPlayer) this.worldObj.getEntityByID(buffer.readInt()); - } + @Override + public void readSpawnData(ByteBuf buffer) { + this.isGoldenParachute = buffer.readBoolean(); + this.ridingPlayer = (EntityPlayer) this.worldObj.getEntityByID(buffer.readInt()); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityPhyg.java b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityPhyg.java index 05d0683..1cd772c 100644 --- a/src/main/java/com/legacy/aether/entities/passive/mountable/EntityPhyg.java +++ b/src/main/java/com/legacy/aether/entities/passive/mountable/EntityPhyg.java @@ -18,189 +18,160 @@ import net.minecraft.world.World; import com.legacy.aether.entities.util.EntitySaddleMount; import com.legacy.aether.registry.achievements.AchievementsAether; -public class EntityPhyg extends EntitySaddleMount -{ +public class EntityPhyg extends EntitySaddleMount { - public float wingFold; + public float wingFold; - public float wingAngle; + public float wingAngle; - private float aimingForFold; + private float aimingForFold; - public int maxJumps; + public int maxJumps; - public int jumpsRemaining; + public int jumpsRemaining; - public int ticks; + public int ticks; - public EntityPhyg(World world) - { - super(world); + public EntityPhyg(World world) { + super(world); - this.jumpsRemaining = 0; - this.maxJumps = 1; - this.stepHeight = 1.0F; + this.jumpsRemaining = 0; + this.maxJumps = 1; + this.stepHeight = 1.0F; - this.ignoreFrustumCheck = true; - this.canJumpMidAir = true; + this.ignoreFrustumCheck = true; + this.canJumpMidAir = true; - this.setSize(0.9F, 1.3F); + this.setSize(0.9F, 1.3F); this.getNavigator().setAvoidsWater(true); - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); - this.tasks.addTask(3, new EntityAIMate(this, 1.0D)); - this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.tasks.addTask(5, new EntityAILookIdle(this)); - this.tasks.addTask(5, new EntityAIFollowParent(this, 1.1D)); - this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); - } - - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - if (this.isOnGround()) - { - this.wingAngle *= 0.8F; - this.aimingForFold = 0.1F; - this.jumpsRemaining = this.maxJumps; - } - else - { - this.aimingForFold = 1.0F; - } - - if (this.riddenByEntity instanceof EntityPlayer) - { - ((EntityPlayer)this.riddenByEntity).triggerAchievement(AchievementsAether.flying_pig); - } - - this.ticks++; - - this.wingAngle = this.wingFold * (float) Math.sin(this.ticks / 31.83098862F); - this.wingFold += (this.aimingForFold - this.wingFold) / 5F; - this.fallDistance = 0; - this.fall(); - } + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); + this.tasks.addTask(3, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(5, new EntityAILookIdle(this)); + this.tasks.addTask(5, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); + } @Override - protected String getLivingSound() - { + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + } + + @Override + public void onUpdate() { + super.onUpdate(); + + if (this.isOnGround()) { + this.wingAngle *= 0.8F; + this.aimingForFold = 0.1F; + this.jumpsRemaining = this.maxJumps; + } else { + this.aimingForFold = 1.0F; + } + + if (this.riddenByEntity instanceof EntityPlayer) { + ((EntityPlayer) this.riddenByEntity).triggerAchievement(AchievementsAether.flying_pig); + } + + this.ticks++; + + this.wingAngle = this.wingFold * (float) Math.sin(this.ticks / 31.83098862F); + this.wingFold += (this.aimingForFold - this.wingFold) / 5F; + this.fallDistance = 0; + this.fall(); + } + + @Override + protected String getLivingSound() { return "mob.pig.say"; } @Override - protected String getHurtSound() - { + protected String getHurtSound() { return "mob.pig.say"; } @Override - protected String getDeathSound() - { + protected String getDeathSound() { return "mob.pig.death"; } - @Override - public double getMountedYOffset() - { - return 0.65D; - } + @Override + public double getMountedYOffset() { + return 0.65D; + } - @Override - public float getMountedMoveSpeed() - { - return 0.3F; - } + @Override + public float getMountedMoveSpeed() { + return 0.3F; + } - @Override - protected void jump() - { - if (this.riddenByEntity == null) - { - super.jump(); - } - } + @Override + protected void jump() { + if (this.riddenByEntity == null) { + super.jump(); + } + } - @Override - protected void dropFewItems(boolean recentlyHit, int lootLevel) - { - int j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + lootLevel); + @Override + protected void dropFewItems(boolean recentlyHit, int lootLevel) { + int j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + lootLevel); - for (int k = 0; k < j; ++k) - { - if (this.isBurning()) - { - this.dropItem(Items.cooked_porkchop, 1); - } - else - { - this.dropItem(Items.porkchop, 1); - } - } + for (int k = 0; k < j; ++k) { + if (this.isBurning()) { + this.dropItem(Items.cooked_porkchop, 1); + } else { + this.dropItem(Items.porkchop, 1); + } + } - super.dropFewItems(recentlyHit, lootLevel); - } + super.dropFewItems(recentlyHit, lootLevel); + } - private void fall() - { - if (this.motionY < 0.0D && !this.isRiderSneaking()) - { - this.motionY *= 0.6D; - } + private void fall() { + if (this.motionY < 0.0D && !this.isRiderSneaking()) { + this.motionY *= 0.6D; + } - if (!this.isOnGround() && !this.isJumping) - { - if (this.isOnGround() && !this.worldObj.isRemote) - { - this.jumpsRemaining = this.maxJumps; - } - } - } + if (!this.isOnGround() && !this.isJumping) { + if (this.isOnGround() && !this.worldObj.isRemote) { + this.jumpsRemaining = this.maxJumps; + } + } + } - @Override - protected double getMountJumpStrength() - { - return 5.0D; - } + @Override + protected double getMountJumpStrength() { + return 5.0D; + } - @Override - protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) - { + @Override + protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { this.playSound("mob.pig.step", 0.15F, 1.0F); } - @Override - public void readEntityFromNBT(NBTTagCompound nbttagcompound) - { - super.readEntityFromNBT(nbttagcompound); + @Override + public void readEntityFromNBT(NBTTagCompound nbttagcompound) { + super.readEntityFromNBT(nbttagcompound); - this.maxJumps = nbttagcompound.getShort("Jumps"); - this.jumpsRemaining = nbttagcompound.getShort("Remaining"); - } + this.maxJumps = nbttagcompound.getShort("Jumps"); + this.jumpsRemaining = nbttagcompound.getShort("Remaining"); + } - @Override - public void writeEntityToNBT(NBTTagCompound nbttagcompound) - { - super.writeEntityToNBT(nbttagcompound); + @Override + public void writeEntityToNBT(NBTTagCompound nbttagcompound) { + super.writeEntityToNBT(nbttagcompound); - nbttagcompound.setShort("Jumps", (short) this.maxJumps); - nbttagcompound.setShort("Remaining", (short) this.jumpsRemaining); - } + nbttagcompound.setShort("Jumps", (short) this.maxJumps); + nbttagcompound.setShort("Remaining", (short) this.jumpsRemaining); + } - @Override - public EntityAgeable createChild(EntityAgeable entityageable) - { - return new EntityPhyg(this.worldObj); - } + @Override + public EntityAgeable createChild(EntityAgeable entityageable) { + return new EntityPhyg(this.worldObj); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/passive/mountable/EntitySwet.java b/src/main/java/com/legacy/aether/entities/passive/mountable/EntitySwet.java index 4f01980..9c13596 100644 --- a/src/main/java/com/legacy/aether/entities/passive/mountable/EntitySwet.java +++ b/src/main/java/com/legacy/aether/entities/passive/mountable/EntitySwet.java @@ -22,663 +22,541 @@ import com.legacy.aether.entities.util.EntityMountable; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.player.PlayerAether; -public class EntitySwet extends EntityMountable -{ +public class EntitySwet extends EntityMountable { - private int slimeJumpDelay = 0; + private int slimeJumpDelay = 0; - public int ticker; + public int ticker; - public int flutter; + public int flutter; - public int hops; + public int hops; - public boolean kickoff; + public boolean kickoff; - public EntitySwet(World world) - { - super(world); + public EntitySwet(World world) { + super(world); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(25); - this.setHealth(25); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(25); + this.setHealth(25); - this.setSwetType(this.rand.nextInt(2)); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5F); - this.setSize(0.8F, 0.8F); - this.setPosition(this.posX, this.posY, this.posZ); - this.hops = 0; - this.flutter = 0; - this.ticker = 0; - this.slimeJumpDelay = this.rand.nextInt(20) + 10; - } + this.setSwetType(this.rand.nextInt(2)); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5F); + this.setSize(0.8F, 0.8F); + this.setPosition(this.posX, this.posY, this.posZ); + this.hops = 0; + this.flutter = 0; + this.ticker = 0; + this.slimeJumpDelay = this.rand.nextInt(20) + 10; + } - @Override - public void entityInit() - { - super.entityInit(); + @Override + public void entityInit() { + super.entityInit(); - this.dataWatcher.addObject(20, new Byte((byte) 0)); - this.dataWatcher.addObject(21, new Byte((byte) this.rand.nextInt(EnumSwetType.values().length))); - } + this.dataWatcher.addObject(20, new Byte((byte) 0)); + this.dataWatcher.addObject(21, new Byte((byte) this.rand.nextInt(EnumSwetType.values().length))); + } - @Override - public void updateRidden() - { - super.updateRidden(); + @Override + public void updateRidden() { + super.updateRidden(); - if (this.riddenByEntity != null && this.kickoff) - { - this.riddenByEntity.mountEntity(null); - this.kickoff = false; - } - } + if (this.riddenByEntity != null && this.kickoff) { + this.riddenByEntity.mountEntity(null); + this.kickoff = false; + } + } - @Override - public void onUpdate() - { - super.onUpdate(); + @Override + public void onUpdate() { + super.onUpdate(); - if (this.getAttackTarget() != null) - { - for (int i = 0; i < 3; i++) - { - double d = (float) this.posX + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.3F; - double d1 = (float) this.posY + this.height; - double d2 = (float) this.posZ + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.3F; + if (this.getAttackTarget() != null) { + for (int i = 0; i < 3; i++) { + double d = (float) this.posX + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.3F; + double d1 = (float) this.posY + this.height; + double d2 = (float) this.posZ + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.3F; - this.worldObj.spawnParticle("splash", d, d1 - 0.25D, d2, 0.0D, 0.0D, 0.0D); - } - } + this.worldObj.spawnParticle("splash", d, d1 - 0.25D, d2, 0.0D, 0.0D, 0.0D); + } + } - if (this.riddenByEntity == null && !this.isFriendly()) - { - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.5D, 0.75D, 0.5D), new IEntitySelector() - { - @Override - public boolean isEntityApplicable(Entity entity) - { - return !(entity instanceof EntitySwet) && entity instanceof EntityLivingBase && entity.ridingEntity == null; - } - }); + if (this.riddenByEntity == null && !this.isFriendly()) { + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.5D, 0.75D, 0.5D), new IEntitySelector() { + @Override + public boolean isEntityApplicable(Entity entity) { + return !(entity instanceof EntitySwet) && entity instanceof EntityLivingBase && entity.ridingEntity == null; + } + }); - for (int j = 0; j < list.size() && this.riddenByEntity == null; ++j) - { - EntityLivingBase entity = (EntityLivingBase) list.get(j); + for (int j = 0; j < list.size() && this.riddenByEntity == null; ++j) { + EntityLivingBase entity = (EntityLivingBase) list.get(j); - this.capturePrey(entity); - } - } + this.capturePrey(entity); + } + } - if (this.handleWaterMovement()) - { - this.dissolve(); - } - } + if (this.handleWaterMovement()) { + this.dissolve(); + } + } - @Override - protected boolean canDespawn() - { - return !this.isFriendly(); - } + @Override + protected boolean canDespawn() { + return !this.isFriendly(); + } - @Override - public void fall(float distance) - { - if (!this.isFriendly()) - { - super.fall(distance); + @Override + public void fall(float distance) { + if (!this.isFriendly()) { + super.fall(distance); - if (this.hops >= 3 && this.getHealth() >= 0) - { - this.dissolve(); - } - } - } + if (this.hops >= 3 && this.getHealth() >= 0) { + this.dissolve(); + } + } + } - @Override - public void knockBack(Entity entity, float damage, double distanceX, double distanceZ) - { - if (this.riddenByEntity != entity) - { - super.knockBack(entity, damage, distanceX, distanceZ); - } - } + @Override + public void knockBack(Entity entity, float damage, double distanceX, double distanceZ) { + if (this.riddenByEntity != entity) { + super.knockBack(entity, damage, distanceX, distanceZ); + } + } - public void dissolve() - { - for (int i = 0; i < 50; i++) - { - float f = this.rand.nextFloat() * 3.141593F * 2.0F; - float f1 = this.rand.nextFloat() * 0.5F + 0.25F; - float f2 = MathHelper.sin(f) * f1; - float f3 = MathHelper.cos(f) * f1; + public void dissolve() { + for (int i = 0; i < 50; i++) { + float f = this.rand.nextFloat() * 3.141593F * 2.0F; + float f1 = this.rand.nextFloat() * 0.5F + 0.25F; + float f2 = MathHelper.sin(f) * f1; + float f3 = MathHelper.cos(f) * f1; - this.worldObj.spawnParticle("splash", this.posX + (double) f2, this.boundingBox.minY + 1.25D, this.posZ + (double) f3, (double) f2 * 1.5D + this.motionX, 4D, (double) f3 * 1.5D + this.motionZ); - } + this.worldObj.spawnParticle("splash", this.posX + (double) f2, this.boundingBox.minY + 1.25D, this.posZ + (double) f3, (double) f2 * 1.5D + this.motionX, 4D, (double) f3 * 1.5D + this.motionZ); + } - this.setDead(); - } + this.setDead(); + } - public void capturePrey(Entity entity) - { - this.splorch(); + public void capturePrey(Entity entity) { + this.splorch(); - this.prevPosX = this.posX = entity.posX; - this.prevPosY = this.posY = entity.posY + 0.0099999997764825821D; - this.prevPosZ = this.posZ = entity.posZ; - this.prevRotationYaw = this.rotationYaw = entity.rotationYaw; - this.prevRotationPitch = this.rotationPitch = entity.rotationPitch; - this.motionX = entity.motionX; - this.motionY = entity.motionY; - this.motionZ = entity.motionZ; + this.prevPosX = this.posX = entity.posX; + this.prevPosY = this.posY = entity.posY + 0.0099999997764825821D; + this.prevPosZ = this.posZ = entity.posZ; + this.prevRotationYaw = this.rotationYaw = entity.rotationYaw; + this.prevRotationPitch = this.rotationPitch = entity.rotationPitch; + this.motionX = entity.motionX; + this.motionY = entity.motionY; + this.motionZ = entity.motionZ; - this.setSize(entity.width, entity.height); - this.setPosition(this.posX, this.posY, this.posZ); + this.setSize(entity.width, entity.height); + this.setPosition(this.posX, this.posY, this.posZ); - entity.mountEntity(this); + entity.mountEntity(this); - this.rotationYaw = this.rand.nextFloat() * 360F; - } + this.rotationYaw = this.rand.nextFloat() * 360F; + } - @Override - public boolean attackEntityFrom(DamageSource damageSource, float i) - { - Entity entity = damageSource.getEntity(); + @Override + public boolean attackEntityFrom(DamageSource damageSource, float i) { + Entity entity = damageSource.getEntity(); - if (this.hops == 3 && entity == null && this.getHealth() > 1) - { - this.setHealth(1); - } + if (this.hops == 3 && entity == null && this.getHealth() > 1) { + this.setHealth(1); + } - boolean flag = super.attackEntityFrom(damageSource, i); + boolean flag = super.attackEntityFrom(damageSource, i); - if (flag && this.riddenByEntity != null && (this.riddenByEntity instanceof EntityLivingBase)) - { - EntityLivingBase rider = (EntityLivingBase) this.riddenByEntity; + if (flag && this.riddenByEntity != null && (this.riddenByEntity instanceof EntityLivingBase)) { + EntityLivingBase rider = (EntityLivingBase) this.riddenByEntity; - if (entity != null && rider == entity) - { - if (this.rand.nextInt(3) == 0) - { - this.kickoff = true; - } - } - else - { - rider.attackEntityFrom(DamageSource.causeMobDamage(this), i); + if (entity != null && rider == entity) { + if (this.rand.nextInt(3) == 0) { + this.kickoff = true; + } + } else { + rider.attackEntityFrom(DamageSource.causeMobDamage(this), i); - if (this.getHealth() <= 0) - { - this.kickoff = true; - } - } - } + if (this.getHealth() <= 0) { + this.kickoff = true; + } + } + } - if (flag && this.getHealth() <= 0) - { - this.dissolve(); - } - else if (flag && (entity instanceof EntityLivingBase)) - { - EntityLivingBase entityliving = (EntityLivingBase) entity; + if (flag && this.getHealth() <= 0) { + this.dissolve(); + } else if (flag && (entity instanceof EntityLivingBase)) { + EntityLivingBase entityliving = (EntityLivingBase) entity; - if (entityliving.getHealth() > 0 && (this.riddenByEntity == null || this.riddenByEntity != null && entityliving != this.riddenByEntity)) - { - this.setAttackTarget((EntityLivingBase) entity); - this.kickoff = true; - } - } + if (entityliving.getHealth() > 0 && (this.riddenByEntity == null || this.riddenByEntity != null && entityliving != this.riddenByEntity)) { + this.setAttackTarget((EntityLivingBase) entity); + this.kickoff = true; + } + } - if (this.isFriendly()) - { - this.setAttackTarget(null); - } + if (this.isFriendly()) { + this.setAttackTarget(null); + } - return flag; - } + return flag; + } - @Override - public void updateEntityActionState() - { - super.updateEntityActionState(); - this.entityAge++; + @Override + public void updateEntityActionState() { + super.updateEntityActionState(); + this.entityAge++; - if (this.isFriendly() && this.riddenByEntity != null) - { - return; - } + if (this.isFriendly() && this.riddenByEntity != null) { + return; + } - if (this.getAttackTarget() == null && this.riddenByEntity == null && this.getHealth() > 0) - { - if (this.onGround && this.slimeJumpDelay-- <= 0) - { - this.slimeJumpDelay = this.getJumpDelay(); + if (this.getAttackTarget() == null && this.riddenByEntity == null && this.getHealth() > 0) { + if (this.onGround && this.slimeJumpDelay-- <= 0) { + this.slimeJumpDelay = this.getJumpDelay(); - this.isJumping = true; + this.isJumping = true; - this.motionY = 0.34999999403953552D; + this.motionY = 0.34999999403953552D; - this.playSound("mob.slime.small", 1.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); + this.playSound("mob.slime.small", 1.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); - this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F; - this.moveForward = 16.0F; - } - else - { - this.isJumping = false; + this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F; + this.moveForward = 16.0F; + } else { + this.isJumping = false; - if (this.onGround) - { - this.moveStrafing = this.moveForward = 0.0F; - } - } - } - if (!this.onGround && this.isJumping) - { - this.isJumping = false; - } + if (this.onGround) { + this.moveStrafing = this.moveForward = 0.0F; + } + } + } + if (!this.onGround && this.isJumping) { + this.isJumping = false; + } - if (this.getAttackTarget() != null && this.riddenByEntity == null && this.getHealth() > 0) - { - float f = MathHelper.wrapAngleTo180_float(20.0F); + if (this.getAttackTarget() != null && this.riddenByEntity == null && this.getHealth() > 0) { + float f = MathHelper.wrapAngleTo180_float(20.0F); - if (f > 20.0F) - { + if (f > 20.0F) { f = 10.0F; } - if (f < -20.0F) - { + if (f < -20.0F) { f = -210.0F; } this.rotationYaw = f + this.getAttackTarget().rotationYaw + 214.0F; - //this.faceEntity(this.getAttackTarget(), 10F, 20F); - - if (this.onGround && this.slimeJumpDelay-- <= 0) - { - this.slimeJumpDelay = this.getJumpDelay(); + //this.faceEntity(this.getAttackTarget(), 10F, 20F); - this.isJumping = true; + if (this.onGround && this.slimeJumpDelay-- <= 0) { + this.slimeJumpDelay = this.getJumpDelay(); - this.motionY = 0.34999999403953552D; + this.isJumping = true; - this.playSound("mob.slime.small", 1.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); + this.motionY = 0.34999999403953552D; - this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F; - this.moveForward = 16.0F; - } - else - { - this.isJumping = false; + this.playSound("mob.slime.small", 1.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); - if (this.onGround) - { - this.moveStrafing = this.moveForward = 0.0F; - } - } - } + this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F; + this.moveForward = 16.0F; + } else { + this.isJumping = false; - if (this.getAttackTarget() != null && this.getAttackTarget().isDead) - { - this.setAttackTarget(null); - } - - if (!this.onGround && this.motionY < 0.05000000074505806D && this.flutter > 0) - { - this.motionY += 0.070000000298023224D; - this.flutter--; - } - if (this.ticker < 4) - { - this.ticker++; - } - else - { - if (this.onGround && this.riddenByEntity == null && this.hops != 0 && this.hops != 3) - { - this.hops = 0; - } - - if (this.getAttackTarget() == null && this.riddenByEntity == null) - { - Entity entity = this.getPrey(); - if (entity != null) - { - this.setAttackTarget((EntityLivingBase) entity); - } - } - else if (this.getAttackTarget() != null && this.riddenByEntity == null) - { - if (this.getDistanceToEntity(this.getAttackTarget()) <= 9F) - { - if (this.onGround && this.canEntityBeSeen(this.getAttackTarget())) - { - this.splotch(); - this.flutter = 10; - this.isJumping = true; - this.moveForward = 16.0F; - this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F; - this.rotationYaw += 5F * (this.rand.nextFloat() - this.rand.nextFloat()); - } - } - else - { - this.setAttackTarget(null); - this.isJumping = false; - this.moveStrafing = this.moveForward = 0.0F; - } - } - else if (this.riddenByEntity != null && this.riddenByEntity != null && this.onGround) - { - if (this.hops == 0) - { - this.splotch(); - this.onGround = false; - this.motionY = 0.34999999403953552D; - this.moveForward = 0.8F; - this.hops = 1; - this.flutter = 5; - this.rotationYaw += 20F * (this.rand.nextFloat() - this.rand.nextFloat()); - } - else if (this.hops == 1) - { - this.splotch(); - this.onGround = false; - this.motionY = 0.44999998807907104D; - this.moveForward = 0.9F; - this.hops = 2; - this.flutter = 5; - this.rotationYaw += 20F * (this.rand.nextFloat() - this.rand.nextFloat()); - } - else if (this.hops == 2) - { - this.splotch(); - this.onGround = false; - this.motionY = 1.25D; - this.moveForward = 1.25F; - this.hops = 3; - this.flutter = 5; - this.rotationYaw += 20F * (this.rand.nextFloat() - this.rand.nextFloat()); - } - } - - this.ticker = 0; - } - - if (this.onGround && this.hops >= 3) - { - this.dissolve(); - } - } - - protected int getJumpDelay() - { - return this.rand.nextInt(20) + 10; - } - - public void moveEntityWithHeading(float par1, float par2) - { - EntityPlayer rider = this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer ? (EntityPlayer) this.riddenByEntity : null; - - if (rider != null) - { - PlayerAether aetherRider = PlayerAether.get(rider); - - if (aetherRider == null) - { - return; - } - - this.setFriendly(aetherRider.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.swet_cape)) ? true : false); - - if (this.isFriendly()) - { - this.prevRotationYaw = this.rotationYaw = rider.rotationYaw; - this.rotationPitch = rider.rotationPitch * 0.5F; - - this.setRotation(this.rotationYaw, this.rotationPitch); - - this.rotationYawHead = this.renderYawOffset = this.rotationYaw; - - if (this.onGround && this.slimeJumpDelay-- <= 0) - { - par1 = rider.moveStrafing * 2F; - par2 = rider.moveForward * 2; - - if (par1 != 0.0f || par2 != 0.0f) - { - this.jump(); - this.onGround = false; - this.motionY = 0.7f; - this.slimeJumpDelay = this.rand.nextInt(4); - } - - if (aetherRider.isJumping()) - { - this.jump(); - this.onGround = false; - this.motionY = 1.0f; - this.slimeJumpDelay = this.rand.nextInt(15); - } - - int rotate = MathHelper.floor_double(rider.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - double x = Math.cos(this.getLookVec().xCoord); - double z = Math.cos(this.getLookVec().zCoord); - - if (par2 > 0.0F) - { - this.motionX = this.getLookVec().xCoord / 2; - this.motionZ = this.getLookVec().zCoord / 2; - } - - if (par2 < 0.0F) - { - this.motionX = -this.getLookVec().xCoord / 2; - this.motionZ = -this.getLookVec().zCoord / 2; - } - - if (par1 > 0.0F) - { - if (rotate <= 1) - { - this.motionX = x / 2; - this.motionZ = z / 2; - } - else - { - this.motionX = -x / 2; - this.motionZ = -z / 2; - } - } - - if (par1 < 0.0F) - { - if (rotate <= 1) - { - this.motionX = +-x / 2; - this.motionZ = +-z / 2; - } - else - { - this.motionX = +x / 2; - this.motionZ = +z / 2; - } - } - } - else if (this.onGround) - { - return; - } - - if (par2 <= 0.0F) - { - par2 *= 0.25F; - this.field_110285_bP = 0; - } - - this.stepHeight = 1.0F; - this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F; - - if (!this.worldObj.isRemote) - { - this.setAIMoveSpeed((float) this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue()); - super.moveEntityWithHeading(par1, par2); - } - } - else - { - this.stepHeight = 0.5F; - this.jumpMovementFactor = 0.02F; - super.moveEntityWithHeading(this.moveForward, this.moveStrafing); - } - } - else - { - this.stepHeight = 0.5F; - this.jumpMovementFactor = 0.02F; - super.moveEntityWithHeading(this.moveForward, this.moveStrafing); - } - } - - @Override - protected void jump() - { - super.jump(); - - this.playSound("mob.slime.small", 1.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); - } - - public void setSwetType(int id) - { - this.dataWatcher.updateObject(21, (byte) id); - } - - public EnumSwetType getSwetType() - { - int id = this.dataWatcher.getWatchableObjectByte(21); - - return EnumSwetType.get(id); - } - - public void setFriendly(boolean friendly) - { - this.dataWatcher.updateObject(20, (byte) (friendly ? 1 : 0)); - } - - public boolean isFriendly() - { - return this.dataWatcher.getWatchableObjectByte(20) == (byte)1; - } - - public void splorch() - { - this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.attack", 0.5F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F, false); - } - - public void splotch() - { - this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.slime.small", 0.5F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F, false); - } - - @Override - protected String getHurtSound() - { - return "mob.slime.small"; - } - - @Override - protected String getDeathSound() - { - return "mob.slime.small"; - } - - @Override - public void applyEntityCollision(Entity entity) - { - if (this.hops == 0 && !this.isFriendly() && this.riddenByEntity == null && this.getAttackTarget() != null && entity != null && entity == this.getAttackTarget() && (entity.ridingEntity == null || !(entity.ridingEntity instanceof EntitySwet))) - { - this.capturePrey(entity); - } - - super.applyEntityCollision(entity); - } - - @Override - public boolean interact(EntityPlayer player) - { - if (!this.worldObj.isRemote && this.isFriendly()) - { - if (this.riddenByEntity == null) - { - this.capturePrey(player); - } - else if (this.riddenByEntity == player) - { - player.mountEntity(null); - } - } - - return super.interact(player); - } - - protected Entity getPrey() - { - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(6D, 6D, 6D)); - for (int i = 0; i < list.size(); i++) - { - Entity entity = (Entity) list.get(i); - if ((entity instanceof EntityLivingBase) && !(entity instanceof EntitySwet) && (this.isFriendly() ? !(entity instanceof EntityPlayer) : !(entity instanceof EntityMob))) - { - return entity; - } - } - - return null; - } - - @Override - protected void dropFewItems(boolean recentlyHit, int lootLevel) - { - int count = this.rand.nextInt(3); - - if (lootLevel > 0) - { - count += this.rand.nextInt(lootLevel + 1); + if (this.onGround) { + this.moveStrafing = this.moveForward = 0.0F; + } + } } - this.entityDropItem(new ItemStack(this.getSwetType().getId() == 0 ? BlocksAether.aercloud : Blocks.glowstone, count, this.getSwetType().getId() == 0 ? 1 : 0), 1.0F); - this.entityDropItem(new ItemStack(ItemsAether.swet_ball, count), 1.0F); - } + if (this.getAttackTarget() != null && this.getAttackTarget().isDead) { + this.setAttackTarget(null); + } - @Override - public EntityAgeable createChild(EntityAgeable entityageable) - { - return null; - } + if (!this.onGround && this.motionY < 0.05000000074505806D && this.flutter > 0) { + this.motionY += 0.070000000298023224D; + this.flutter--; + } + if (this.ticker < 4) { + this.ticker++; + } else { + if (this.onGround && this.riddenByEntity == null && this.hops != 0 && this.hops != 3) { + this.hops = 0; + } - @Override - public void writeEntityToNBT(NBTTagCompound compound) - { - super.writeEntityToNBT(compound); + if (this.getAttackTarget() == null && this.riddenByEntity == null) { + Entity entity = this.getPrey(); + if (entity != null) { + this.setAttackTarget((EntityLivingBase) entity); + } + } else if (this.getAttackTarget() != null && this.riddenByEntity == null) { + if (this.getDistanceToEntity(this.getAttackTarget()) <= 9F) { + if (this.onGround && this.canEntityBeSeen(this.getAttackTarget())) { + this.splotch(); + this.flutter = 10; + this.isJumping = true; + this.moveForward = 16.0F; + this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F; + this.rotationYaw += 5F * (this.rand.nextFloat() - this.rand.nextFloat()); + } + } else { + this.setAttackTarget(null); + this.isJumping = false; + this.moveStrafing = this.moveForward = 0.0F; + } + } else if (this.riddenByEntity != null && this.riddenByEntity != null && this.onGround) { + if (this.hops == 0) { + this.splotch(); + this.onGround = false; + this.motionY = 0.34999999403953552D; + this.moveForward = 0.8F; + this.hops = 1; + this.flutter = 5; + this.rotationYaw += 20F * (this.rand.nextFloat() - this.rand.nextFloat()); + } else if (this.hops == 1) { + this.splotch(); + this.onGround = false; + this.motionY = 0.44999998807907104D; + this.moveForward = 0.9F; + this.hops = 2; + this.flutter = 5; + this.rotationYaw += 20F * (this.rand.nextFloat() - this.rand.nextFloat()); + } else if (this.hops == 2) { + this.splotch(); + this.onGround = false; + this.motionY = 1.25D; + this.moveForward = 1.25F; + this.hops = 3; + this.flutter = 5; + this.rotationYaw += 20F * (this.rand.nextFloat() - this.rand.nextFloat()); + } + } - compound.setShort("Hops", (short) this.hops); - compound.setShort("Flutter", (short) this.flutter); - compound.setBoolean("isFriendly", this.isFriendly()); - compound.setInteger("swetType", this.getSwetType().getId()); - } + this.ticker = 0; + } - @Override - public void readEntityFromNBT(NBTTagCompound compound) - { - super.readEntityFromNBT(compound); + if (this.onGround && this.hops >= 3) { + this.dissolve(); + } + } - this.hops = compound.getShort("Hops"); - this.flutter = compound.getShort("Flutter"); + protected int getJumpDelay() { + return this.rand.nextInt(20) + 10; + } - this.setFriendly(compound.getBoolean("isFriendly")); - this.setSwetType(compound.getInteger("swetType")); - } + public void moveEntityWithHeading(float par1, float par2) { + EntityPlayer rider = this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer ? (EntityPlayer) this.riddenByEntity : null; + + if (rider != null) { + PlayerAether aetherRider = PlayerAether.get(rider); + + if (aetherRider == null) { + return; + } + + this.setFriendly(aetherRider.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.swet_cape)) ? true : false); + + if (this.isFriendly()) { + this.prevRotationYaw = this.rotationYaw = rider.rotationYaw; + this.rotationPitch = rider.rotationPitch * 0.5F; + + this.setRotation(this.rotationYaw, this.rotationPitch); + + this.rotationYawHead = this.renderYawOffset = this.rotationYaw; + + if (this.onGround && this.slimeJumpDelay-- <= 0) { + par1 = rider.moveStrafing * 2F; + par2 = rider.moveForward * 2; + + if (par1 != 0.0f || par2 != 0.0f) { + this.jump(); + this.onGround = false; + this.motionY = 0.7f; + this.slimeJumpDelay = this.rand.nextInt(4); + } + + if (aetherRider.isJumping()) { + this.jump(); + this.onGround = false; + this.motionY = 1.0f; + this.slimeJumpDelay = this.rand.nextInt(15); + } + + int rotate = MathHelper.floor_double(rider.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + + double x = Math.cos(this.getLookVec().xCoord); + double z = Math.cos(this.getLookVec().zCoord); + + if (par2 > 0.0F) { + this.motionX = this.getLookVec().xCoord / 2; + this.motionZ = this.getLookVec().zCoord / 2; + } + + if (par2 < 0.0F) { + this.motionX = -this.getLookVec().xCoord / 2; + this.motionZ = -this.getLookVec().zCoord / 2; + } + + if (par1 > 0.0F) { + if (rotate <= 1) { + this.motionX = x / 2; + this.motionZ = z / 2; + } else { + this.motionX = -x / 2; + this.motionZ = -z / 2; + } + } + + if (par1 < 0.0F) { + if (rotate <= 1) { + this.motionX = +-x / 2; + this.motionZ = +-z / 2; + } else { + this.motionX = +x / 2; + this.motionZ = +z / 2; + } + } + } else if (this.onGround) { + return; + } + + if (par2 <= 0.0F) { + par2 *= 0.25F; + this.field_110285_bP = 0; + } + + this.stepHeight = 1.0F; + this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F; + + if (!this.worldObj.isRemote) { + this.setAIMoveSpeed((float) this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue()); + super.moveEntityWithHeading(par1, par2); + } + } else { + this.stepHeight = 0.5F; + this.jumpMovementFactor = 0.02F; + super.moveEntityWithHeading(this.moveForward, this.moveStrafing); + } + } else { + this.stepHeight = 0.5F; + this.jumpMovementFactor = 0.02F; + super.moveEntityWithHeading(this.moveForward, this.moveStrafing); + } + } + + @Override + protected void jump() { + super.jump(); + + this.playSound("mob.slime.small", 1.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); + } + + public void setSwetType(int id) { + this.dataWatcher.updateObject(21, (byte) id); + } + + public EnumSwetType getSwetType() { + int id = this.dataWatcher.getWatchableObjectByte(21); + + return EnumSwetType.get(id); + } + + public void setFriendly(boolean friendly) { + this.dataWatcher.updateObject(20, (byte) (friendly ? 1 : 0)); + } + + public boolean isFriendly() { + return this.dataWatcher.getWatchableObjectByte(20) == (byte) 1; + } + + public void splorch() { + this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.attack", 0.5F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F, false); + } + + public void splotch() { + this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.slime.small", 0.5F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F, false); + } + + @Override + protected String getHurtSound() { + return "mob.slime.small"; + } + + @Override + protected String getDeathSound() { + return "mob.slime.small"; + } + + @Override + public void applyEntityCollision(Entity entity) { + if (this.hops == 0 && !this.isFriendly() && this.riddenByEntity == null && this.getAttackTarget() != null && entity != null && entity == this.getAttackTarget() && (entity.ridingEntity == null || !(entity.ridingEntity instanceof EntitySwet))) { + this.capturePrey(entity); + } + + super.applyEntityCollision(entity); + } + + @Override + public boolean interact(EntityPlayer player) { + if (!this.worldObj.isRemote && this.isFriendly()) { + if (this.riddenByEntity == null) { + this.capturePrey(player); + } else if (this.riddenByEntity == player) { + player.mountEntity(null); + } + } + + return super.interact(player); + } + + protected Entity getPrey() { + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(6D, 6D, 6D)); + for (int i = 0; i < list.size(); i++) { + Entity entity = (Entity) list.get(i); + if ((entity instanceof EntityLivingBase) && !(entity instanceof EntitySwet) && (this.isFriendly() ? !(entity instanceof EntityPlayer) : !(entity instanceof EntityMob))) { + return entity; + } + } + + return null; + } + + @Override + protected void dropFewItems(boolean recentlyHit, int lootLevel) { + int count = this.rand.nextInt(3); + + if (lootLevel > 0) { + count += this.rand.nextInt(lootLevel + 1); + } + + this.entityDropItem(new ItemStack(this.getSwetType().getId() == 0 ? BlocksAether.aercloud : Blocks.glowstone, count, this.getSwetType().getId() == 0 ? 1 : 0), 1.0F); + this.entityDropItem(new ItemStack(ItemsAether.swet_ball, count), 1.0F); + } + + @Override + public EntityAgeable createChild(EntityAgeable entityageable) { + return null; + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); + + compound.setShort("Hops", (short) this.hops); + compound.setShort("Flutter", (short) this.flutter); + compound.setBoolean("isFriendly", this.isFriendly()); + compound.setInteger("swetType", this.getSwetType().getId()); + } + + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + super.readEntityFromNBT(compound); + + this.hops = compound.getShort("Hops"); + this.flutter = compound.getShort("Flutter"); + + this.setFriendly(compound.getBoolean("isFriendly")); + this.setSwetType(compound.getInteger("swetType")); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/EntityHammerProjectile.java b/src/main/java/com/legacy/aether/entities/projectile/EntityHammerProjectile.java index d5980f0..31e2c92 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/EntityHammerProjectile.java +++ b/src/main/java/com/legacy/aether/entities/projectile/EntityHammerProjectile.java @@ -14,67 +14,50 @@ import net.minecraft.world.World; import com.legacy.aether.api.player.util.IAetherBoss; import com.legacy.aether.entities.util.EntitySaddleMount; -public class EntityHammerProjectile extends EntityProjectileBase -{ +public class EntityHammerProjectile extends EntityProjectileBase { public ArrayList harvestBlockBans = new ArrayList(); - public EntityHammerProjectile(World worldIn) - { + public EntityHammerProjectile(World worldIn) { super(worldIn); } - public EntityHammerProjectile(World worldIn, EntityLivingBase shooter) - { + public EntityHammerProjectile(World worldIn, EntityLivingBase shooter) { super(worldIn, shooter); } @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); this.worldObj.spawnParticle("reddust", this.posX, this.posY + 0.2F, this.posZ, 1.0D, 1.0D, 1.0D); - if (this.ticksInAir > 100) - { + if (this.ticksInAir > 100) { this.setDead(); - } - else - { + } else { this.ticksInAir++; } } @Override @SuppressWarnings("deprecation") - protected void onImpact(MovingObjectPosition object) - { - if (object.typeOfHit == MovingObjectType.ENTITY) - { - if (object.entityHit instanceof EntitySaddleMount && ((EntitySaddleMount)object.entityHit).isSaddled()) - { - - } - else if (object.entityHit != this.getThrower() && !(object.entityHit instanceof IAetherBoss)) - { + protected void onImpact(MovingObjectPosition object) { + if (object.typeOfHit == MovingObjectType.ENTITY) { + if (object.entityHit instanceof EntitySaddleMount && ((EntitySaddleMount) object.entityHit).isSaddled()) { + + } else if (object.entityHit != this.getThrower() && !(object.entityHit instanceof IAetherBoss)) { object.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.getThrower()), 5); object.entityHit.addVelocity(this.motionX, 0.6D, this.motionZ); } } - for (int l = (int) (this.posX - 3); l <= this.posX + 3; l++) - { - for (int i1 = (int) (this.posY - 3); i1 <= this.posY + 3; i1++) - { - for (int j1 = (int) (this.posZ - 3); j1 <= this.posZ + 3; j1++) - { - if (this.worldObj.getBlock(l, i1, j1) instanceof BlockBush && this.getThrower() instanceof EntityPlayer) - { + for (int l = (int) (this.posX - 3); l <= this.posX + 3; l++) { + for (int i1 = (int) (this.posY - 3); i1 <= this.posY + 3; i1++) { + for (int j1 = (int) (this.posZ - 3); j1 <= this.posZ + 3; j1++) { + if (this.worldObj.getBlock(l, i1, j1) instanceof BlockBush && this.getThrower() instanceof EntityPlayer) { Block prevBlock = this.worldObj.getBlock(l, i1, j1); - if (!this.harvestBlockBans.contains(prevBlock)) - { + if (!this.harvestBlockBans.contains(prevBlock)) { prevBlock.harvestBlock(this.getThrower().worldObj, (EntityPlayer) this.getThrower(), l, i1, j1, this.worldObj.getBlockMetadata(l, i1, j1)); prevBlock.removedByPlayer(this.getThrower().worldObj, (EntityPlayer) this.getThrower(), l, i1, j1); @@ -86,8 +69,7 @@ public class EntityHammerProjectile extends EntityProjectileBase } } - for (int j = 0; j < 8; j++) - { + for (int j = 0; j < 8; j++) { this.worldObj.spawnParticle("explode", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); this.worldObj.spawnParticle("explode", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); @@ -97,15 +79,13 @@ public class EntityHammerProjectile extends EntityProjectileBase } @Override - protected float getBoundingBoxExpansion() - { - return 2.5F; - } + protected float getBoundingBoxExpansion() { + return 2.5F; + } @Override - protected float getGravityVelocity() - { - return 0.0F; - } + protected float getGravityVelocity() { + return 0.0F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/EntityLightningKnife.java b/src/main/java/com/legacy/aether/entities/projectile/EntityLightningKnife.java index 65d243e..5e696fe 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/EntityLightningKnife.java +++ b/src/main/java/com/legacy/aether/entities/projectile/EntityLightningKnife.java @@ -6,30 +6,25 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class EntityLightningKnife extends EntityProjectileBase -{ +public class EntityLightningKnife extends EntityProjectileBase { - public EntityLightningKnife(World world) - { + public EntityLightningKnife(World world) { super(world); } - public EntityLightningKnife(World world, EntityLivingBase thrower) - { + public EntityLightningKnife(World world, EntityLivingBase thrower) { super(world, thrower); } @Override - protected void onImpact(MovingObjectPosition object) - { + protected void onImpact(MovingObjectPosition object) { this.worldObj.addWeatherEffect(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); this.setDead(); } @Override - public void onCollideWithPlayer(EntityPlayer entityplayer) - { + public void onCollideWithPlayer(EntityPlayer entityplayer) { - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/EntityPhoenixArrow.java b/src/main/java/com/legacy/aether/entities/projectile/EntityPhoenixArrow.java index 889814f..fa73d94 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/EntityPhoenixArrow.java +++ b/src/main/java/com/legacy/aether/entities/projectile/EntityPhoenixArrow.java @@ -6,60 +6,48 @@ import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.world.World; import cpw.mods.fml.common.registry.IThrowableEntity; -public class EntityPhoenixArrow extends EntityArrow implements IThrowableEntity -{ +public class EntityPhoenixArrow extends EntityArrow implements IThrowableEntity { - private int timeInGround; + private int timeInGround; - private boolean hitGround; + private boolean hitGround; - public EntityPhoenixArrow(World worldIn) - { + public EntityPhoenixArrow(World worldIn) { super(worldIn); } - public EntityPhoenixArrow(World worldIn, EntityLivingBase shooter, float distance) - { + public EntityPhoenixArrow(World worldIn, EntityLivingBase shooter, float distance) { super(worldIn, shooter, distance); } @Override - public void onUpdate() - { - if (this.arrowShake == 7) - { - this.hitGround = true; - } + public void onUpdate() { + if (this.arrowShake == 7) { + this.hitGround = true; + } - if (this.hitGround) - { - ++this.timeInGround; + if (this.hitGround) { + ++this.timeInGround; - if (this.timeInGround % 5 == 0) - { - this.worldObj.spawnParticle("flame", this.posX + (this.rand.nextGaussian() / 5D), this.posY + (this.rand.nextGaussian() / 5D), this.posZ + (this.rand.nextGaussian() / 3D), 0.0D, 0.0D, 0.0D); - } - } - else - { - for (int j = 0; j < 2; ++j) - { - this.worldObj.spawnParticle("flame", this.posX + (this.rand.nextGaussian() / 5D), this.posY + (this.rand.nextGaussian() / 5D), this.posZ + (this.rand.nextGaussian() / 3D), 0.0D, 0.0D, 0.0D); - } - } + if (this.timeInGround % 5 == 0) { + this.worldObj.spawnParticle("flame", this.posX + (this.rand.nextGaussian() / 5D), this.posY + (this.rand.nextGaussian() / 5D), this.posZ + (this.rand.nextGaussian() / 3D), 0.0D, 0.0D, 0.0D); + } + } else { + for (int j = 0; j < 2; ++j) { + this.worldObj.spawnParticle("flame", this.posX + (this.rand.nextGaussian() / 5D), this.posY + (this.rand.nextGaussian() / 5D), this.posZ + (this.rand.nextGaussian() / 3D), 0.0D, 0.0D, 0.0D); + } + } - super.onUpdate(); - } + super.onUpdate(); + } @Override - public void setThrower(Entity entity) - { + public void setThrower(Entity entity) { this.shootingEntity = entity; } @Override - public Entity getThrower() - { + public Entity getThrower() { return this.shootingEntity; } diff --git a/src/main/java/com/legacy/aether/entities/projectile/EntityPoisonNeedle.java b/src/main/java/com/legacy/aether/entities/projectile/EntityPoisonNeedle.java index 7c6a96f..2ce53ce 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/EntityPoisonNeedle.java +++ b/src/main/java/com/legacy/aether/entities/projectile/EntityPoisonNeedle.java @@ -5,29 +5,24 @@ import net.minecraft.world.World; import com.legacy.aether.entities.projectile.darts.EntityDartPoison; -public class EntityPoisonNeedle extends EntityDartPoison -{ +public class EntityPoisonNeedle extends EntityDartPoison { - public EntityPoisonNeedle(World world) - { - super(world); - } + public EntityPoisonNeedle(World world) { + super(world); + } - public EntityPoisonNeedle(World world, EntityLiving ent, float velocity) - { - super(world, ent, velocity); - } + public EntityPoisonNeedle(World world, EntityLiving ent, float velocity) { + super(world, ent, velocity); + } - public void entityInit() - { - super.entityInit(); - this.setDamage(1); - } + public void entityInit() { + super.entityInit(); + this.setDamage(1); + } - @Override - protected float getGravityVelocity() - { - return 0.03F; - } + @Override + protected float getGravityVelocity() { + return 0.03F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/EntityProjectileBase.java b/src/main/java/com/legacy/aether/entities/projectile/EntityProjectileBase.java index 8d021da..6889e27 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/EntityProjectileBase.java +++ b/src/main/java/com/legacy/aether/entities/projectile/EntityProjectileBase.java @@ -19,329 +19,283 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public abstract class EntityProjectileBase extends Entity implements IProjectile, IThrowableEntity -{ +public abstract class EntityProjectileBase extends Entity implements IProjectile, IThrowableEntity { - public int xTile = -1; - public int yTile = -1; - public int zTile = -1; - public Block inTile; - public boolean inGround; - public int throwableShake; - public int canBePickedUp; - private EntityLivingBase thrower; - private String throwerName; - public int ticksInGround; - public int ticksInAir; + public int xTile = -1; + public int yTile = -1; + public int zTile = -1; + public Block inTile; + public boolean inGround; + public int throwableShake; + public int canBePickedUp; + private EntityLivingBase thrower; + private String throwerName; + public int ticksInGround; + public int ticksInAir; - public EntityProjectileBase(World world) - { - super(world); + public EntityProjectileBase(World world) { + super(world); - this.yOffset = 0.0F; - this.setSize(0.25F, 0.25F); - } + this.yOffset = 0.0F; + this.setSize(0.25F, 0.25F); + } - public EntityProjectileBase(World worldIn, double x, double y, double z) - { - this(worldIn); + public EntityProjectileBase(World worldIn, double x, double y, double z) { + this(worldIn); - this.setPosition(x, y, z); - } + this.setPosition(x, y, z); + } - public EntityProjectileBase(World world, EntityLivingBase thrower) - { - this(world, thrower.posX, thrower.posY + (double)thrower.getEyeHeight() - 0.10000000149011612D, thrower.posZ); + public EntityProjectileBase(World world, EntityLivingBase thrower) { + this(world, thrower.posX, thrower.posY + (double) thrower.getEyeHeight() - 0.10000000149011612D, thrower.posZ); - this.thrower = thrower; - } + this.thrower = thrower; + } - @Override - protected void entityInit() - { + @Override + protected void entityInit() { - } + } - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double distance) - { - double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; - d1 *= 64.0D; - return distance < d1 * d1; - } + @Override + @SideOnly(Side.CLIENT) + public boolean isInRangeToRenderDist(double distance) { + double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; + d1 *= 64.0D; + return distance < d1 * d1; + } - public void shoot(Entity entityThrower, float rotationPitchIn, float rotationYawIn, float pitchOffset, float velocity, float inaccuracy) - { - float f = -MathHelper.sin(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F); - float f1 = -MathHelper.sin((rotationPitchIn + pitchOffset) * 0.017453292F); - float f2 = MathHelper.cos(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F); - this.setThrowableHeading((double)f, (double)f1, (double)f2, velocity, inaccuracy); - this.motionX += entityThrower.motionX; - this.motionZ += entityThrower.motionZ; + public void shoot(Entity entityThrower, float rotationPitchIn, float rotationYawIn, float pitchOffset, float velocity, float inaccuracy) { + float f = -MathHelper.sin(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F); + float f1 = -MathHelper.sin((rotationPitchIn + pitchOffset) * 0.017453292F); + float f2 = MathHelper.cos(rotationYawIn * 0.017453292F) * MathHelper.cos(rotationPitchIn * 0.017453292F); + this.setThrowableHeading((double) f, (double) f1, (double) f2, velocity, inaccuracy); + this.motionX += entityThrower.motionX; + this.motionZ += entityThrower.motionZ; - if (!entityThrower.onGround) - { - this.motionY += entityThrower.motionY; - } - } + if (!entityThrower.onGround) { + this.motionY += entityThrower.motionY; + } + } - @Override - public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) - { - float f2 = MathHelper.sqrt_double(x * x + y * y + z * z); - x /= (double)f2; - y /= (double)f2; - z /= (double)f2; - x += this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy; - y += this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy; - z += this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy; - x *= (double)velocity; - y *= (double)velocity; - z *= (double)velocity; - this.motionX = x; - this.motionY = y; - this.motionZ = z; - float f3 = MathHelper.sqrt_double(x * x + z * z); - this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f3) * 180.0D / Math.PI); - this.ticksInGround = 0; - } + @Override + public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) { + float f2 = MathHelper.sqrt_double(x * x + y * y + z * z); + x /= (double) f2; + y /= (double) f2; + z /= (double) f2; + x += this.rand.nextGaussian() * 0.007499999832361937D * (double) inaccuracy; + y += this.rand.nextGaussian() * 0.007499999832361937D * (double) inaccuracy; + z += this.rand.nextGaussian() * 0.007499999832361937D * (double) inaccuracy; + x *= (double) velocity; + y *= (double) velocity; + z *= (double) velocity; + this.motionX = x; + this.motionY = y; + this.motionZ = z; + float f3 = MathHelper.sqrt_double(x * x + z * z); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(y, (double) f3) * 180.0D / Math.PI); + this.ticksInGround = 0; + } - @Override - @SideOnly(Side.CLIENT) - public void setVelocity(double x, double y, double z) - { - this.motionX = x; - this.motionY = y; - this.motionZ = z; + @Override + @SideOnly(Side.CLIENT) + public void setVelocity(double x, double y, double z) { + this.motionX = x; + this.motionY = y; + this.motionZ = z; - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) - { - float f = MathHelper.sqrt_double(x * x + z * z); - this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f) * 180.0D / Math.PI); - } - } + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { + float f = MathHelper.sqrt_double(x * x + z * z); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(y, (double) f) * 180.0D / Math.PI); + } + } - @Override - public void onUpdate() - { - this.lastTickPosX = this.posX; - this.lastTickPosY = this.posY; - this.lastTickPosZ = this.posZ; - super.onUpdate(); + @Override + public void onUpdate() { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); - if (this.throwableShake > 0) - { - --this.throwableShake; - } + if (this.throwableShake > 0) { + --this.throwableShake; + } - if (this.inGround) - { - if (this.worldObj.getBlock(this.xTile, this.yTile, this.zTile) == this.inTile) - { - ++this.ticksInGround; + if (this.inGround) { + if (this.worldObj.getBlock(this.xTile, this.yTile, this.zTile) == this.inTile) { + ++this.ticksInGround; - if (this.ticksInGround == 1200) - { - this.setDead(); - } + if (this.ticksInGround == 1200) { + this.setDead(); + } - return; - } + return; + } - this.inGround = false; - this.motionX *= (double)(this.rand.nextFloat() * 0.2F); - this.motionY *= (double)(this.rand.nextFloat() * 0.2F); - this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); - this.ticksInGround = 0; - this.ticksInAir = 0; - } - else - { - ++this.ticksInAir; - } + this.inGround = false; + this.motionX *= (double) (this.rand.nextFloat() * 0.2F); + this.motionY *= (double) (this.rand.nextFloat() * 0.2F); + this.motionZ *= (double) (this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } else { + ++this.ticksInAir; + } - Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX + this.getBoundingBoxExpansion(), this.posY + this.motionY + this.getBoundingBoxExpansion(), this.posZ + this.motionZ + this.getBoundingBoxExpansion()); - MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31); - vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX + this.getBoundingBoxExpansion(), this.posY + this.motionY + this.getBoundingBoxExpansion(), this.posZ + this.motionZ + this.getBoundingBoxExpansion()); + MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31); + vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - if (movingobjectposition != null) - { - vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); - } + if (movingobjectposition != null) { + vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + } - if (!this.worldObj.isRemote) - { - Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(this.getBoundingBoxExpansion(), this.getBoundingBoxExpansion(), this.getBoundingBoxExpansion())); - double d0 = 0.0D; - EntityLivingBase entitylivingbase = this.getThrower(); + if (!this.worldObj.isRemote) { + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(this.getBoundingBoxExpansion(), this.getBoundingBoxExpansion(), this.getBoundingBoxExpansion())); + double d0 = 0.0D; + EntityLivingBase entitylivingbase = this.getThrower(); - for (int j = 0; j < list.size(); ++j) - { - Entity entity1 = (Entity)list.get(j); + for (int j = 0; j < list.size(); ++j) { + Entity entity1 = (Entity) list.get(j); - if (entity1.canBeCollidedWith() && (entity1 != entitylivingbase || this.ticksInAir >= 5)) - { - float f = 0.3F + this.getBoundingBoxExpansion(); - AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); - MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); + if (entity1.canBeCollidedWith() && (entity1 != entitylivingbase || this.ticksInAir >= 5)) { + float f = 0.3F + this.getBoundingBoxExpansion(); + AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double) f, (double) f, (double) f); + MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - if (movingobjectposition1 != null) - { - double d1 = vec3.distanceTo(movingobjectposition1.hitVec); + if (movingobjectposition1 != null) { + double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) - { - entity = entity1; - d0 = d1; - } - } - } - } + if (d1 < d0 || d0 == 0.0D) { + entity = entity1; + d0 = d1; + } + } + } + } - if (entity != null) - { - movingobjectposition = new MovingObjectPosition(entity); - } - } + if (entity != null) { + movingobjectposition = new MovingObjectPosition(entity); + } + } - if (movingobjectposition != null) - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ) == Blocks.portal) - { - this.setInPortal(); - } - else - { - this.onImpact(movingobjectposition); - } - } + if (movingobjectposition != null) { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ) == Blocks.portal) { + this.setInPortal(); + } else { + this.onImpact(movingobjectposition); + } + } - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) - { - ; - } + for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + ; + } - while (this.rotationPitch - this.prevRotationPitch >= 180.0F) - { - this.prevRotationPitch += 360.0F; - } + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { + this.prevRotationPitch += 360.0F; + } - while (this.rotationYaw - this.prevRotationYaw < -180.0F) - { - this.prevRotationYaw -= 360.0F; - } + while (this.rotationYaw - this.prevRotationYaw < -180.0F) { + this.prevRotationYaw -= 360.0F; + } - while (this.rotationYaw - this.prevRotationYaw >= 180.0F) - { - this.prevRotationYaw += 360.0F; - } + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { + this.prevRotationYaw += 360.0F; + } - this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; - this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; - float f2 = 0.99F; - float f3 = this.getGravityVelocity(); + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float f2 = 0.99F; + float f3 = this.getGravityVelocity(); - if (this.isInWater()) - { - for (int i = 0; i < 4; ++i) - { - float f4 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ); - } + if (this.isInWater()) { + for (int i = 0; i < 4; ++i) { + float f4 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double) f4, this.posY - this.motionY * (double) f4, this.posZ - this.motionZ * (double) f4, this.motionX, this.motionY, this.motionZ); + } - f2 = 0.8F; - } + f2 = 0.8F; + } - this.motionX *= (double)f2; - this.motionY *= (double)f2; - this.motionZ *= (double)f2; - this.motionY -= (double)f3; - this.setPosition(this.posX, this.posY, this.posZ); - } + this.motionX *= (double) f2; + this.motionY *= (double) f2; + this.motionZ *= (double) f2; + this.motionY -= (double) f3; + this.setPosition(this.posX, this.posY, this.posZ); + } - protected float getBoundingBoxExpansion() - { - return 1.0F; - } + protected float getBoundingBoxExpansion() { + return 1.0F; + } - protected float getGravityVelocity() - { - return 0.03F; - } + protected float getGravityVelocity() { + return 0.03F; + } - protected abstract void onImpact(MovingObjectPosition object); + protected abstract void onImpact(MovingObjectPosition object); - @Override - public void writeEntityToNBT(NBTTagCompound compound) - { - compound.setShort("xTile", (short)this.xTile); - compound.setShort("yTile", (short)this.yTile); - compound.setShort("zTile", (short)this.zTile); - compound.setByte("inTile", (byte)Block.getIdFromBlock(this.inTile)); - compound.setByte("shake", (byte)this.throwableShake); - compound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + compound.setShort("xTile", (short) this.xTile); + compound.setShort("yTile", (short) this.yTile); + compound.setShort("zTile", (short) this.zTile); + compound.setByte("inTile", (byte) Block.getIdFromBlock(this.inTile)); + compound.setByte("shake", (byte) this.throwableShake); + compound.setByte("inGround", (byte) (this.inGround ? 1 : 0)); - if ((this.throwerName == null || this.throwerName.length() == 0) && this.thrower != null && this.thrower instanceof EntityPlayer) - { - this.throwerName = this.thrower.getCommandSenderName(); - } + if ((this.throwerName == null || this.throwerName.length() == 0) && this.thrower != null && this.thrower instanceof EntityPlayer) { + this.throwerName = this.thrower.getCommandSenderName(); + } - compound.setString("ownerName", this.throwerName == null ? "" : this.throwerName); - } + compound.setString("ownerName", this.throwerName == null ? "" : this.throwerName); + } - @Override - public void readEntityFromNBT(NBTTagCompound compound) - { - this.xTile = compound.getShort("xTile"); - this.yTile = compound.getShort("yTile"); - this.zTile = compound.getShort("zTile"); - this.inTile = Block.getBlockById(compound.getByte("inTile") & 255); - this.throwableShake = compound.getByte("shake") & 255; - this.inGround = compound.getByte("inGround") == 1; - this.throwerName = compound.getString("ownerName"); + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + this.xTile = compound.getShort("xTile"); + this.yTile = compound.getShort("yTile"); + this.zTile = compound.getShort("zTile"); + this.inTile = Block.getBlockById(compound.getByte("inTile") & 255); + this.throwableShake = compound.getByte("shake") & 255; + this.inGround = compound.getByte("inGround") == 1; + this.throwerName = compound.getString("ownerName"); - if (this.throwerName != null && this.throwerName.length() == 0) - { - this.throwerName = null; - } - } + if (this.throwerName != null && this.throwerName.length() == 0) { + this.throwerName = null; + } + } - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() - { - return 0.0F; - } + @Override + @SideOnly(Side.CLIENT) + public float getShadowSize() { + return 0.0F; + } - @Override - public void setThrower(Entity entity) - { - if (entity instanceof EntityLivingBase) - { - this.thrower = (EntityLivingBase) entity; - } - } + @Override + public void setThrower(Entity entity) { + if (entity instanceof EntityLivingBase) { + this.thrower = (EntityLivingBase) entity; + } + } - @Override - public EntityLivingBase getThrower() - { - if (this.thrower == null && this.throwerName != null && this.throwerName.length() > 0) - { - this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName); - } + @Override + public EntityLivingBase getThrower() { + if (this.thrower == null && this.throwerName != null && this.throwerName.length() > 0) { + this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName); + } - return this.thrower; - } + return this.thrower; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/EntityZephyrSnowball.java b/src/main/java/com/legacy/aether/entities/projectile/EntityZephyrSnowball.java index 5d8e8e7..fe74d16 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/EntityZephyrSnowball.java +++ b/src/main/java/com/legacy/aether/entities/projectile/EntityZephyrSnowball.java @@ -11,36 +11,29 @@ import net.minecraft.network.play.server.S12PacketEntityVelocity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class EntityZephyrSnowball extends EntityProjectileBase -{ +public class EntityZephyrSnowball extends EntityProjectileBase { - public EntityZephyrSnowball(World world) - { + public EntityZephyrSnowball(World world) { super(world); } - public EntityZephyrSnowball(World world, EntityLivingBase thrower, double x, double y, double z) - { + public EntityZephyrSnowball(World world, EntityLivingBase thrower, double x, double y, double z) { super(world, thrower); this.setPosition(x, y, z); } @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } @Override - protected void onImpact(MovingObjectPosition object) - { - if (object.entityHit instanceof EntityLivingBase) - { - if (object.entityHit instanceof EntityPlayer && PlayerAether.get((EntityPlayer) object.entityHit).getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.sentry_boots))) - { + protected void onImpact(MovingObjectPosition object) { + if (object.entityHit instanceof EntityLivingBase) { + if (object.entityHit instanceof EntityPlayer && PlayerAether.get((EntityPlayer) object.entityHit).getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.sentry_boots))) { this.setDead(); return; @@ -50,9 +43,8 @@ public class EntityZephyrSnowball extends EntityProjectileBase object.entityHit.motionY += 0.5D; object.entityHit.motionZ += this.motionZ * 1.5F; - if (object.entityHit instanceof EntityPlayerMP) - { - ((EntityPlayerMP)object.entityHit).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(object.entityHit)); + if (object.entityHit instanceof EntityPlayerMP) { + ((EntityPlayerMP) object.entityHit).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(object.entityHit)); } this.setDead(); @@ -60,9 +52,8 @@ public class EntityZephyrSnowball extends EntityProjectileBase } @Override - protected float getGravityVelocity() - { - return 0.0F; - } + protected float getGravityVelocity() { + return 0.0F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/crystals/EntityCrystal.java b/src/main/java/com/legacy/aether/entities/projectile/crystals/EntityCrystal.java index 6573aa0..14bd0d8 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/crystals/EntityCrystal.java +++ b/src/main/java/com/legacy/aether/entities/projectile/crystals/EntityCrystal.java @@ -22,236 +22,189 @@ import com.legacy.aether.entities.bosses.EntityFireMinion; import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; -public class EntityCrystal extends EntityFlying implements IEntityAdditionalSpawnData -{ +public class EntityCrystal extends EntityFlying implements IEntityAdditionalSpawnData { - public float[] sinage = new float[3]; + public float[] sinage = new float[3]; - public double smotionX; + public double smotionX; - public double smotionY; + public double smotionY; - public double smotionZ; + public double smotionZ; - public boolean wasHit; + public boolean wasHit; - private EnumCrystalType type; + private EnumCrystalType type; - public EntityCrystal(World world) - { - super(world); + public EntityCrystal(World world) { + super(world); - double base = 0.2F; + double base = 0.2F; - this.smotionX = (base + (double)this.rand.nextFloat() * 0.15D) * (this.rand.nextInt(2) == 0 ? 1.0D : -1.0D); - this.smotionY = (base + (double)this.rand.nextFloat() * 0.15D) * (this.rand.nextInt(2) == 0 ? 1.0D : -1.0D); - this.smotionZ = (base + (double)this.rand.nextFloat() * 0.15D) * (this.rand.nextInt(2) == 0 ? 1.0D : -1.0D); + this.smotionX = (base + (double) this.rand.nextFloat() * 0.15D) * (this.rand.nextInt(2) == 0 ? 1.0D : -1.0D); + this.smotionY = (base + (double) this.rand.nextFloat() * 0.15D) * (this.rand.nextInt(2) == 0 ? 1.0D : -1.0D); + this.smotionZ = (base + (double) this.rand.nextFloat() * 0.15D) * (this.rand.nextInt(2) == 0 ? 1.0D : -1.0D); - this.isImmuneToFire = true; - this.type = EnumCrystalType.get(this.rand.nextInt(2)); + this.isImmuneToFire = true; + this.type = EnumCrystalType.get(this.rand.nextInt(2)); - for (int var2 = 0; var2 < this.sinage.length; ++var2) - { + for (int var2 = 0; var2 < this.sinage.length; ++var2) { this.sinage[var2] = this.rand.nextFloat() * 6.0F; } this.setSize(0.9F, 0.9F); - } + } - public EntityCrystal(World world, double x, double y, double z, EnumCrystalType type) - { - this(world); + public EntityCrystal(World world, double x, double y, double z, EnumCrystalType type) { + this(world); - this.type = type; + this.type = type; - if (this.type == EnumCrystalType.ICE) - { - this.smotionX /= 3.0D; - this.smotionY = 0.0D; - this.smotionZ /= 3.0D; - } + if (this.type == EnumCrystalType.ICE) { + this.smotionX /= 3.0D; + this.smotionY = 0.0D; + this.smotionZ /= 3.0D; + } - this.setPosition(x, y, z); - } + this.setPosition(x, y, z); + } - public EntityCrystal(World world, double x, double y, double z, EntityLivingBase target) - { - this(world, x, y, z, EnumCrystalType.THUNDER); + public EntityCrystal(World world, double x, double y, double z, EntityLivingBase target) { + this(world, x, y, z, EnumCrystalType.THUNDER); - this.setAttackTarget(target); - } + this.setAttackTarget(target); + } - @Override - protected void applyEntityAttributes() - { + @Override + protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); } - @Override - public void onUpdate() - { + @Override + public void onUpdate() { super.onUpdate(); - if (this.type != EnumCrystalType.THUNDER && !this.worldObj.isRemote) - { + if (this.type != EnumCrystalType.THUNDER && !this.worldObj.isRemote) { this.motionX = this.smotionX; this.motionY = this.smotionY; this.motionZ = this.smotionZ; } - if (this.type == EnumCrystalType.THUNDER) - { - if (!this.worldObj.isRemote) - { - if (this.getAttackTarget() == null || (this.getAttackTarget() != null && !this.getAttackTarget().isEntityAlive())) - { - this.setDead(); - } + if (this.type == EnumCrystalType.THUNDER) { + if (!this.worldObj.isRemote) { + if (this.getAttackTarget() == null || (this.getAttackTarget() != null && !this.getAttackTarget().isEntityAlive())) { + this.setDead(); + } - this.faceEntity(this.getAttackTarget(), 10F, 10F); - this.moveTowardsTarget(this.getAttackTarget(), 0.02D); - } - } - else if (this.isCollided && !this.worldObj.isRemote) - { - if (this.wasHit()) - { - this.explode(); - this.expire(); - this.setDead(); - } + this.faceEntity(this.getAttackTarget(), 10F, 10F); + this.moveTowardsTarget(this.getAttackTarget(), 0.02D); + } + } else if (this.isCollided && !this.worldObj.isRemote) { + if (this.wasHit()) { + this.explode(); + this.expire(); + this.setDead(); + } int var1 = MathHelper.floor_double(this.posX); int var2 = MathHelper.floor_double(this.boundingBox.minY); int var3 = MathHelper.floor_double(this.posZ); - if (this.smotionX > 0.0D && !this.worldObj.isAirBlock(var1 + 1, var2, var3)) - { + if (this.smotionX > 0.0D && !this.worldObj.isAirBlock(var1 + 1, var2, var3)) { this.motionX = this.smotionX = -this.smotionX; - } - else if (this.smotionX < 0.0D && !this.worldObj.isAirBlock(var1 - 1, var2, var3)) - { + } else if (this.smotionX < 0.0D && !this.worldObj.isAirBlock(var1 - 1, var2, var3)) { this.motionX = this.smotionX = -this.smotionX; } - if (this.smotionY > 0.0D && !this.worldObj.isAirBlock(var1, var2 + 1, var3)) - { + if (this.smotionY > 0.0D && !this.worldObj.isAirBlock(var1, var2 + 1, var3)) { this.motionY = this.smotionY = -this.smotionY; - } - else if (this.smotionY < 0.0D && !this.worldObj.isAirBlock(var1, var2 - 1, var3)) - { + } else if (this.smotionY < 0.0D && !this.worldObj.isAirBlock(var1, var2 - 1, var3)) { this.motionY = this.smotionY = -this.smotionY; } - if (this.smotionZ > 0.0D && !this.worldObj.isAirBlock(var1, var2, var3 + 1)) - { + if (this.smotionZ > 0.0D && !this.worldObj.isAirBlock(var1, var2, var3 + 1)) { this.motionZ = this.smotionZ = -this.smotionZ; - } - else if (this.smotionZ < 0.0D && !this.worldObj.isAirBlock(var1, var2, var3 - 1)) - { + } else if (this.smotionZ < 0.0D && !this.worldObj.isAirBlock(var1, var2, var3 - 1)) { this.motionZ = this.smotionZ = -this.smotionZ; } } - if (this.ticksExisted >= this.maxTicksAlive()) - { - if (this.type == EnumCrystalType.THUNDER) - { - this.worldObj.addWeatherEffect(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); - } + if (this.ticksExisted >= this.maxTicksAlive()) { + if (this.type == EnumCrystalType.THUNDER) { + this.worldObj.addWeatherEffect(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ)); + } - this.expire(); - this.setDead(); + this.expire(); + this.setDead(); } - for (int var1 = 0; var1 < this.sinage.length; ++var1) - { - this.sinage[var1] += 0.3F + (float)var1 * 0.13F; + for (int var1 = 0; var1 < this.sinage.length; ++var1) { + this.sinage[var1] += 0.3F + (float) var1 * 0.13F; - if (this.sinage[var1] > ((float)Math.PI * 2F)) - { - this.sinage[var1] -= ((float)Math.PI * 2F); + if (this.sinage[var1] > ((float) Math.PI * 2F)) { + this.sinage[var1] -= ((float) Math.PI * 2F); } } } @Override - public void applyEntityCollision(Entity entity) - { + public void applyEntityCollision(Entity entity) { super.applyEntityCollision(entity); - if (entity instanceof EntityCrystal && this.worldObj.difficultySetting == EnumDifficulty.HARD) - { - EntityCrystal crystal = (EntityCrystal) entity; + if (entity instanceof EntityCrystal && this.worldObj.difficultySetting == EnumDifficulty.HARD) { + EntityCrystal crystal = (EntityCrystal) entity; - if (this.type != crystal.type) - { - this.explode(); - this.expire(); - this.setDead(); - crystal.explode(); - crystal.expire(); - crystal.setDead(); - } - } - else if (entity instanceof EntityLivingBase) - { - if (this.type == EnumCrystalType.FIRE && !(entity instanceof IAetherBoss) && !(entity instanceof EntityFireMinion)) - { - if (entity.attackEntityFrom(DamageSource.causeMobDamage(this), 5.0F)) - { - this.explode(); - this.expire(); - this.setDead(); - entity.setFire(100); - } - } - else if (this.type == EnumCrystalType.ICE && this.wasHit()) - { - if (entity.attackEntityFrom(DamageSource.causeMobDamage(this), 5.0F)) - { - this.explode(); - this.expire(); - this.setDead(); - ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.weakness.id, 10)); - } - } - else if (this.type == EnumCrystalType.CLOUD && !(entity instanceof IAetherBoss)) - { - this.explode(); - this.expire(); - this.setDead(); - entity.attackEntityFrom(DamageSource.causeMobDamage(this), 5.0F); - } - else if(this.type == EnumCrystalType.THUNDER && entity == this.getAttackTarget()) - { - if (entity.attackEntityFrom(DamageSource.causeMobDamage(this), 1.0F)) - { - this.moveTowardsTarget(entity, -0.3D); - } - } + if (this.type != crystal.type) { + this.explode(); + this.expire(); + this.setDead(); + crystal.explode(); + crystal.expire(); + crystal.setDead(); + } + } else if (entity instanceof EntityLivingBase) { + if (this.type == EnumCrystalType.FIRE && !(entity instanceof IAetherBoss) && !(entity instanceof EntityFireMinion)) { + if (entity.attackEntityFrom(DamageSource.causeMobDamage(this), 5.0F)) { + this.explode(); + this.expire(); + this.setDead(); + entity.setFire(100); + } + } else if (this.type == EnumCrystalType.ICE && this.wasHit()) { + if (entity.attackEntityFrom(DamageSource.causeMobDamage(this), 5.0F)) { + this.explode(); + this.expire(); + this.setDead(); + ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.id, 10)); + } + } else if (this.type == EnumCrystalType.CLOUD && !(entity instanceof IAetherBoss)) { + this.explode(); + this.expire(); + this.setDead(); + entity.attackEntityFrom(DamageSource.causeMobDamage(this), 5.0F); + } else if (this.type == EnumCrystalType.THUNDER && entity == this.getAttackTarget()) { + if (entity.attackEntityFrom(DamageSource.causeMobDamage(this), 1.0F)) { + this.moveTowardsTarget(entity, -0.3D); + } + } } } @Override - public boolean attackEntityFrom(DamageSource source, float damage) - { - if (source.getEntity() != null) - { - if (this.type == EnumCrystalType.THUNDER) - { - this.moveTowardsTarget(source.getEntity(), -0.15D - ((double)damage / 8D)); + public boolean attackEntityFrom(DamageSource source, float damage) { + if (source.getEntity() != null) { + if (this.type == EnumCrystalType.THUNDER) { + this.moveTowardsTarget(source.getEntity(), -0.15D - ((double) damage / 8D)); - return super.attackEntityFrom(source, damage); - } + return super.attackEntityFrom(source, damage); + } Vec3 var3 = source.getEntity().getLookVec(); - if (var3 != null) - { + if (var3 != null) { this.smotionX = var3.xCoord; this.smotionY = var3.yCoord; this.smotionZ = var3.zCoord; @@ -265,112 +218,91 @@ public class EntityCrystal extends EntityFlying implements IEntityAdditionalSpaw return false; } - public void moveTowardsTarget(Entity target, double speed) - { - if (this.worldObj.isRemote) - { - return; - } + public void moveTowardsTarget(Entity target, double speed) { + if (this.worldObj.isRemote) { + return; + } - double angle1 = this.rotationYaw / (180F / Math.PI); + double angle1 = this.rotationYaw / (180F / Math.PI); - this.motionX -= Math.sin(angle1) * speed; - this.motionZ += Math.cos(angle1) * speed; + this.motionX -= Math.sin(angle1) * speed; + this.motionZ += Math.cos(angle1) * speed; - double a = target.posY - 0.75F; + double a = target.posY - 0.75F; - if(a < this.boundingBox.minY - 0.5F) - { - this.motionY -= (speed / 2); - } - else if(a > this.boundingBox.minY + 0.5F) - { - this.motionY += (speed / 2); - } - else - { - this.motionY += (a - this.boundingBox.minY) * (speed / 2); - } + if (a < this.boundingBox.minY - 0.5F) { + this.motionY -= (speed / 2); + } else if (a > this.boundingBox.minY + 0.5F) { + this.motionY += (speed / 2); + } else { + this.motionY += (a - this.boundingBox.minY) * (speed / 2); + } - if(this.onGround) - { - this.onGround = false; - this.motionY = 0.1F; - } - } - - public boolean wasHit() - { - return this.wasHit; + if (this.onGround) { + this.onGround = false; + this.motionY = 0.1F; + } } - public int maxTicksAlive() - { - return this.type == EnumCrystalType.THUNDER ? 200 : 300; - } + public boolean wasHit() { + return this.wasHit; + } - private void expire() - { - this.worldObj.playSoundAtEntity(this, this.type.getDeathSound(), 2.0F, this.rand.nextFloat() - this.rand.nextFloat() * 0.2F + 1.2F); + public int maxTicksAlive() { + return this.type == EnumCrystalType.THUNDER ? 200 : 300; + } - if (this.worldObj.isRemote) - { - return; - } + private void expire() { + this.worldObj.playSoundAtEntity(this, this.type.getDeathSound(), 2.0F, this.rand.nextFloat() - this.rand.nextFloat() * 0.2F + 1.2F); - ((WorldServer)this.worldObj).func_147487_a(this.type.getDeathParticle(), this.posX, this.boundingBox.minY + this.height * 0.8D, this.posZ, 16, 0.25D, 0.25D, 0.25D, 0.0D); - } + if (this.worldObj.isRemote) { + return; + } - private void explode() - { - this.worldObj.playSoundAtEntity(this, this.type.getExplosionSound(), 2.0F, this.rand.nextFloat() - this.rand.nextFloat() * 0.2F + 1.2F); + ((WorldServer) this.worldObj).func_147487_a(this.type.getDeathParticle(), this.posX, this.boundingBox.minY + this.height * 0.8D, this.posZ, 16, 0.25D, 0.25D, 0.25D, 0.0D); + } - if (this.worldObj.isRemote) - { - return; - } + private void explode() { + this.worldObj.playSoundAtEntity(this, this.type.getExplosionSound(), 2.0F, this.rand.nextFloat() - this.rand.nextFloat() * 0.2F + 1.2F); + + if (this.worldObj.isRemote) { + return; + } double motionMultiplier = 0.5F; - if (this.type == EnumCrystalType.ICE || this.type == EnumCrystalType.CLOUD) - { - motionMultiplier *= 0.5D; + if (this.type == EnumCrystalType.ICE || this.type == EnumCrystalType.CLOUD) { + motionMultiplier *= 0.5D; } - ((WorldServer)this.worldObj).func_147487_a(this.type.getExplosionParticle(), this.posX, this.posY, this.posZ, 40, 0.0D, 0.0D, 0.0D, motionMultiplier); + ((WorldServer) this.worldObj).func_147487_a(this.type.getExplosionParticle(), this.posX, this.posY, this.posZ, 40, 0.0D, 0.0D, 0.0D, motionMultiplier); } - public EnumCrystalType getCrystalType() - { - return this.type; + public EnumCrystalType getCrystalType() { + return this.type; } @Override - public IChatComponent func_145748_c_() - { + public IChatComponent func_145748_c_() { return new ChatComponentText(this.getCommandSenderName() + this.type.toString().toLowerCase()); } - @Override - public void writeSpawnData(ByteBuf buffer) - { - buffer.writeInt(this.type.getId()); + @Override + public void writeSpawnData(ByteBuf buffer) { + buffer.writeInt(this.type.getId()); - if (this.type == EnumCrystalType.THUNDER) - { - buffer.writeInt(this.getAttackTarget().getEntityId()); - } - } + if (this.type == EnumCrystalType.THUNDER) { + buffer.writeInt(this.getAttackTarget().getEntityId()); + } + } - @Override - public void readSpawnData(ByteBuf buffer) - { - this.type = EnumCrystalType.get(buffer.readInt()); + @Override + public void readSpawnData(ByteBuf buffer) { + this.type = EnumCrystalType.get(buffer.readInt()); - if (this.type == EnumCrystalType.THUNDER) - { - this.setAttackTarget((EntityLivingBase) this.worldObj.getEntityByID(buffer.readInt())); - } - } + if (this.type == EnumCrystalType.THUNDER) { + this.setAttackTarget((EntityLivingBase) this.worldObj.getEntityByID(buffer.readInt())); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/crystals/EnumCrystalType.java b/src/main/java/com/legacy/aether/entities/projectile/crystals/EnumCrystalType.java index 037ab67..c2968bd 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/crystals/EnumCrystalType.java +++ b/src/main/java/com/legacy/aether/entities/projectile/crystals/EnumCrystalType.java @@ -1,58 +1,49 @@ package com.legacy.aether.entities.projectile.crystals; -public enum EnumCrystalType -{ +public enum EnumCrystalType { - FIRE("random.fizz", "largesmoke", "random.explode", "flame"), ICE("dig.glass", "", "dig.glass", "snowshovel"), THUNDER(), CLOUD("dig.glass", "", "dig.glass", "snowshovel"); + FIRE("random.fizz", "largesmoke", "random.explode", "flame"), ICE("dig.glass", "", "dig.glass", "snowshovel"), THUNDER(), CLOUD("dig.glass", "", "dig.glass", "snowshovel"); - private String deathSound = ""; + private String deathSound = ""; - private String deathParticle = ""; + private String deathParticle = ""; - private String explosionSound = ""; + private String explosionSound = ""; - private String explosionParticle = ""; + private String explosionParticle = ""; - private EnumCrystalType() - { - - } + private EnumCrystalType() { - EnumCrystalType(String deathSound, String deathParticle, String explosionSound, String explosionParticle) - { - this.deathSound = deathSound; - this.deathParticle = deathParticle; - this.explosionSound = explosionSound; - this.explosionParticle = explosionParticle; - } + } - public String getDeathSound() - { - return this.deathSound; - } + EnumCrystalType(String deathSound, String deathParticle, String explosionSound, String explosionParticle) { + this.deathSound = deathSound; + this.deathParticle = deathParticle; + this.explosionSound = explosionSound; + this.explosionParticle = explosionParticle; + } - public String getDeathParticle() - { - return this.deathParticle; - } + public String getDeathSound() { + return this.deathSound; + } - public String getExplosionSound() - { - return this.explosionSound; - } + public String getDeathParticle() { + return this.deathParticle; + } - public String getExplosionParticle() - { - return this.explosionParticle; - } + public String getExplosionSound() { + return this.explosionSound; + } - public int getId() - { - return this.ordinal(); - } + public String getExplosionParticle() { + return this.explosionParticle; + } - public static EnumCrystalType get(int id) - { - return values()[id]; - } + public int getId() { + return this.ordinal(); + } + + public static EnumCrystalType get(int id) { + return values()[id]; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartBase.java b/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartBase.java index 845d027..01f9437 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartBase.java +++ b/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartBase.java @@ -26,8 +26,7 @@ import cpw.mods.fml.common.registry.IThrowableEntity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public abstract class EntityDartBase extends EntityArrow implements IProjectile, IThrowableEntity -{ +public abstract class EntityDartBase extends EntityArrow implements IProjectile, IThrowableEntity { private int tileX = -1; private int tileY = -1; @@ -41,16 +40,14 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, private int ticksInAir; private double damage = 2.0D; - public EntityDartBase(World world) - { + public EntityDartBase(World world) { super(world); this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); } - public EntityDartBase(World world, double x, double y, double z) - { + public EntityDartBase(World world, double x, double y, double z) { super(world); this.renderDistanceWeight = 10.0D; @@ -59,110 +56,100 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, this.yOffset = 0.0F; } - public EntityDartBase(World world, EntityLivingBase shooter, EntityLivingBase target, float velocity, float inaccuracy) - { + public EntityDartBase(World world, EntityLivingBase shooter, EntityLivingBase target, float velocity, float inaccuracy) { super(world); this.renderDistanceWeight = 10.0D; this.shootingEntity = shooter; - if (shooter instanceof EntityPlayer) - { + if (shooter instanceof EntityPlayer) { this.canBePickedUp = 1; } - this.posY = shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D; + this.posY = shooter.posY + (double) shooter.getEyeHeight() - 0.10000000149011612D; double d0 = target.posX - shooter.posX; - double d1 = target.boundingBox.minY + (double)(target.height / 3.0F) - this.posY; + double d1 = target.boundingBox.minY + (double) (target.height / 3.0F) - this.posY; double d2 = target.posZ - shooter.posZ; - double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2); + double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2); - if (d3 >= 1.0E-7D) - { - float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; - float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI)); + if (d3 >= 1.0E-7D) { + float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; + float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI)); double d4 = d0 / d3; double d5 = d2 / d3; this.setLocationAndAngles(shooter.posX + d4, this.posY, shooter.posZ + d5, f2, f3); this.yOffset = 0.0F; - float f4 = (float)d3 * 0.2F; - this.setThrowableHeading(d0, d1 + (double)f4, d2, velocity, inaccuracy); + float f4 = (float) d3 * 0.2F; + this.setThrowableHeading(d0, d1 + (double) f4, d2, velocity, inaccuracy); } } - public EntityDartBase(World world, EntityLivingBase shooter, float velocity) - { + public EntityDartBase(World world, EntityLivingBase shooter, float velocity) { super(world); this.renderDistanceWeight = 10.0D; this.shootingEntity = shooter; - if (shooter instanceof EntityPlayer) - { + if (shooter instanceof EntityPlayer) { this.canBePickedUp = 1; } this.setSize(0.5F, 0.5F); - this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); - this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setLocationAndAngles(shooter.posX, shooter.posY + (double) shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); + this.posX -= (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F); this.posY -= 0.10000000149011612D; - this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posZ -= (double) (MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F); this.setPosition(this.posX, this.posY, this.posZ); this.yOffset = 0.0F; - this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); - this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); - this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI)); + this.motionX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); + this.motionZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); + this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, velocity * 1.5F, 1.0F); } @Override - protected void entityInit() - { + protected void entityInit() { } @Override - public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) - { + public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) { float f2 = MathHelper.sqrt_double(x * x + y * y + z * z); - x /= (double)f2; - y /= (double)f2; - z /= (double)f2; - x += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; - y += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; - z += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; - x *= (double)velocity; - y *= (double)velocity; - z *= (double)velocity; + x /= (double) f2; + y /= (double) f2; + z /= (double) f2; + x += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) inaccuracy; + y += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) inaccuracy; + z += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) inaccuracy; + x *= (double) velocity; + y *= (double) velocity; + z *= (double) velocity; this.motionX = x; this.motionY = y; this.motionZ = z; float f3 = MathHelper.sqrt_double(x * x + z * z); - this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f3) * 180.0D / Math.PI); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(y, (double) f3) * 180.0D / Math.PI); this.ticksInGround = 0; } @Override @SideOnly(Side.CLIENT) - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int type) - { + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int type) { this.setPosition(x, y, z); this.setRotation(yaw, pitch); } @Override @SideOnly(Side.CLIENT) - public void setVelocity(double x, double y, double z) - { + public void setVelocity(double x, double y, double z) { this.motionX = x; this.motionY = y; this.motionZ = z; - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) - { + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(x * x + z * z); - this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f) * 180.0D / Math.PI); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(y, (double) f) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch; this.prevRotationYaw = this.rotationYaw; this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); @@ -171,61 +158,49 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, } @Override - public void onUpdate() - { + public void onUpdate() { super.onEntityUpdate(); - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) - { + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI); } Block block = this.worldObj.getBlock(this.tileX, this.tileY, this.tileZ); - if (block.getMaterial() != Material.air) - { + if (block.getMaterial() != Material.air) { block.setBlockBoundsBasedOnState(this.worldObj, this.tileX, this.tileY, this.tileZ); AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.tileX, this.tileY, this.tileZ); - if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) - { + if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { this.inGround = true; this.wasInGround = true; } } - if (this.dartShake > 0) - { + if (this.dartShake > 0) { --this.dartShake; } - if (this.inGround) - { + if (this.inGround) { int j = this.worldObj.getBlockMetadata(this.tileX, this.tileY, this.tileZ); - if (block == this.inTile && j == this.inData) - { + if (block == this.inTile && j == this.inData) { ++this.ticksInGround; - if (this.ticksInGround == 1200) - { + if (this.ticksInGround == 1200) { this.setDead(); } - } - else - { + } else { this.inGround = false; - this.motionX *= (double)(this.rand.nextFloat() * 0.2F); - this.motionY *= (double)(this.rand.nextFloat() * 0.2F); - this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.motionX *= (double) (this.rand.nextFloat() * 0.2F); + this.motionY *= (double) (this.rand.nextFloat() * 0.2F); + this.motionZ *= (double) (this.rand.nextFloat() * 0.2F); this.ticksInGround = 0; this.ticksInAir = 0; } - } - else - { + } else { ++this.ticksInAir; Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); @@ -233,8 +208,7 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - if (movingobjectposition != null) - { + if (movingobjectposition != null) { vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } @@ -244,22 +218,18 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, int i; float f1; - for (i = 0; i < list.size(); ++i) - { - Entity entity1 = (Entity)list.get(i); + for (i = 0; i < list.size(); ++i) { + Entity entity1 = (Entity) list.get(i); - if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) - { + if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) { f1 = 0.3F; - AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double)f1, (double)f1, (double)f1); + AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double) f1, (double) f1, (double) f1); MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3); - if (movingobjectposition1 != null) - { + if (movingobjectposition1 != null) { double d1 = vec31.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) - { + if (d1 < d0 || d0 == 0.0D) { entity = entity1; d0 = d1; } @@ -267,17 +237,14 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, } } - if (entity != null) - { + if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } - if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) - { - EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit; + if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { + EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; - if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer)) - { + if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } @@ -285,9 +252,8 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, float f2; float f4; - if (movingobjectposition != null) - { - this.onDartHit(movingobjectposition); + if (movingobjectposition != null) { + this.onDartHit(movingobjectposition); } this.posX += this.motionX; @@ -295,25 +261,21 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, this.posZ += this.motionZ; f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) - { + for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } - while (this.rotationPitch - this.prevRotationPitch >= 180.0F) - { + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { this.prevRotationPitch += 360.0F; } - while (this.rotationYaw - this.prevRotationYaw < -180.0F) - { + while (this.rotationYaw - this.prevRotationYaw < -180.0F) { this.prevRotationYaw -= 360.0F; } - while (this.rotationYaw - this.prevRotationYaw >= 180.0F) - { + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { this.prevRotationYaw += 360.0F; } @@ -322,29 +284,25 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, float f3 = 0.99F; f1 = 0.05F; - if (this.isInWater()) - { - for (int l = 0; l < 4; ++l) - { + if (this.isInWater()) { + for (int l = 0; l < 4; ++l) { f4 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double) f4, this.posY - this.motionY * (double) f4, this.posZ - this.motionZ * (double) f4, this.motionX, this.motionY, this.motionZ); } f3 = 0.8F; } - if (this.isWet()) - { + if (this.isWet()) { this.extinguish(); } - this.motionX *= (double)f3; - this.motionY *= (double)f3; - this.motionZ *= (double)f3; + this.motionX *= (double) f3; + this.motionY *= (double) f3; + this.motionZ *= (double) f3; - if (this.wasInGround) - { - this.motionY -= this.wasInGround ? ((double)f1) : this.getGravityVelocity(); + if (this.wasInGround) { + this.motionY -= this.wasInGround ? ((double) f1) : this.getGravityVelocity(); } this.setPosition(this.posX, this.posY, this.posZ); @@ -352,68 +310,53 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, } } - public void onDartHit(MovingObjectPosition movingobjectposition) - { - if (movingobjectposition.entityHit != null) - { - float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); - int k = MathHelper.ceiling_double_int((double)f2 * this.damage); + public void onDartHit(MovingObjectPosition movingobjectposition) { + if (movingobjectposition.entityHit != null) { + float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + int k = MathHelper.ceiling_double_int((double) f2 * this.damage); DamageSource damagesource = null; - if (this.shootingEntity == null) - { + if (this.shootingEntity == null) { damagesource = EntityDartBase.causeDartDamage(this, this); - } - else - { + } else { damagesource = EntityDartBase.causeDartDamage(this, this.shootingEntity); } - if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) - { + if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { movingobjectposition.entityHit.setFire(5); } - if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)k)) - { - if (movingobjectposition.entityHit instanceof EntityLivingBase) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit; + if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float) k)) { + if (movingobjectposition.entityHit instanceof EntityLivingBase) { + EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit; - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); } float f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - if (f4 > 0.0F) - { - movingobjectposition.entityHit.addVelocity(this.motionX * 0.6000000238418579D / (double)f4, 0.1D, this.motionZ * 0.6000000238418579D / (double)f4); + if (f4 > 0.0F) { + movingobjectposition.entityHit.addVelocity(this.motionX * 0.6000000238418579D / (double) f4, 0.1D, this.motionZ * 0.6000000238418579D / (double) f4); } - if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) - { + if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); - EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase); + EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase); } - if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) - { - ((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); + if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { + ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); } } this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); - if (!(movingobjectposition.entityHit instanceof EntityEnderman)) - { + if (!(movingobjectposition.entityHit instanceof EntityEnderman)) { this.setDead(); } - } - else - { + } else { this.motionX *= -0.1D; this.motionY *= -0.1D; this.motionZ *= -0.1D; @@ -421,60 +364,54 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, this.prevRotationYaw += 180.0F; this.ticksInAir = 0; } - } - else - { + } else { this.tileX = movingobjectposition.blockX; this.tileY = movingobjectposition.blockY; this.tileZ = movingobjectposition.blockZ; this.inTile = this.worldObj.getBlock(this.tileX, this.tileY, this.tileZ); this.inData = this.worldObj.getBlockMetadata(this.tileX, this.tileY, this.tileZ); - this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX)); - this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY)); - this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ)); + this.motionX = (double) ((float) (movingobjectposition.hitVec.xCoord - this.posX)); + this.motionY = (double) ((float) (movingobjectposition.hitVec.yCoord - this.posY)); + this.motionZ = (double) ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); - this.posX -= this.motionX / (double)f2 * 0.05D; - this.posY -= this.motionY / (double)f2 * 0.05D; - this.posZ -= this.motionZ / (double)f2 * 0.05D; + this.posX -= this.motionX / (double) f2 * 0.05D; + this.posY -= this.motionY / (double) f2 * 0.05D; + this.posZ -= this.motionZ / (double) f2 * 0.05D; this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.inGround = true; this.wasInGround = true; this.dartShake = 7; - if (this.inTile.getMaterial() != Material.air) - { + if (this.inTile.getMaterial() != Material.air) { this.inTile.onEntityCollidedWithBlock(this.worldObj, this.tileX, this.tileY, this.tileZ, this); } } } - protected float getGravityVelocity() - { + protected float getGravityVelocity() { return 0.99F; } @Override - public void writeEntityToNBT(NBTTagCompound p_70014_1_) - { - p_70014_1_.setShort("xTile", (short)this.tileX); - p_70014_1_.setShort("yTile", (short)this.tileY); - p_70014_1_.setShort("zTile", (short)this.tileZ); - p_70014_1_.setShort("life", (short)this.ticksInGround); - p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.inTile)); - p_70014_1_.setByte("inData", (byte)this.inData); - p_70014_1_.setByte("shake", (byte)this.dartShake); - p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0)); - p_70014_1_.setByte("wasInGround", (byte)(this.wasInGround ? 1 : 0)); - p_70014_1_.setByte("pickup", (byte)this.canBePickedUp); + public void writeEntityToNBT(NBTTagCompound p_70014_1_) { + p_70014_1_.setShort("xTile", (short) this.tileX); + p_70014_1_.setShort("yTile", (short) this.tileY); + p_70014_1_.setShort("zTile", (short) this.tileZ); + p_70014_1_.setShort("life", (short) this.ticksInGround); + p_70014_1_.setByte("inTile", (byte) Block.getIdFromBlock(this.inTile)); + p_70014_1_.setByte("inData", (byte) this.inData); + p_70014_1_.setByte("shake", (byte) this.dartShake); + p_70014_1_.setByte("inGround", (byte) (this.inGround ? 1 : 0)); + p_70014_1_.setByte("wasInGround", (byte) (this.wasInGround ? 1 : 0)); + p_70014_1_.setByte("pickup", (byte) this.canBePickedUp); p_70014_1_.setDouble("damage", this.damage); } @Override - public void readEntityFromNBT(NBTTagCompound p_70037_1_) - { + public void readEntityFromNBT(NBTTagCompound p_70037_1_) { this.tileX = p_70037_1_.getShort("xTile"); this.tileY = p_70037_1_.getShort("yTile"); - this.tileZ = p_70037_1_.getShort("zTile"); + this.tileZ = p_70037_1_.getShort("zTile"); this.ticksInGround = p_70037_1_.getShort("life"); this.inTile = Block.getBlockById(p_70037_1_.getByte("inTile") & 255); this.inData = p_70037_1_.getByte("inData") & 255; @@ -482,35 +419,27 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, this.inGround = p_70037_1_.getByte("inGround") == 1; this.wasInGround = p_70037_1_.getByte("wasInGround") == 1; - if (p_70037_1_.hasKey("damage", 99)) - { + if (p_70037_1_.hasKey("damage", 99)) { this.damage = p_70037_1_.getDouble("damage"); } - if (p_70037_1_.hasKey("pickup", 99)) - { + if (p_70037_1_.hasKey("pickup", 99)) { this.canBePickedUp = p_70037_1_.getByte("pickup"); - } - else if (p_70037_1_.hasKey("player", 99)) - { + } else if (p_70037_1_.hasKey("player", 99)) { this.canBePickedUp = p_70037_1_.getBoolean("player") ? 1 : 0; } } @Override - public void onCollideWithPlayer(EntityPlayer player) - { - if (!this.worldObj.isRemote && this.inGround && this.dartShake <= 0) - { + public void onCollideWithPlayer(EntityPlayer player) { + if (!this.worldObj.isRemote && this.inGround && this.dartShake <= 0) { boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && player.capabilities.isCreativeMode; - if (this.canBePickedUp == 1 && !player.inventory.addItemStackToInventory(this.getStack())) - { + if (this.canBePickedUp == 1 && !player.inventory.addItemStackToInventory(this.getStack())) { flag = false; } - if (flag) - { + if (flag) { this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); player.onItemPickup(this, 1); this.setDead(); @@ -518,51 +447,43 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile, } } - protected abstract ItemStack getStack(); + protected abstract ItemStack getStack(); - public void setDamage(double p_70239_1_) - { + public void setDamage(double p_70239_1_) { this.damage = p_70239_1_; } - public double getDamage() - { + public double getDamage() { return this.damage; } @Override - public void setThrower(Entity entity) - { - this.shootingEntity = entity; - } + public void setThrower(Entity entity) { + this.shootingEntity = entity; + } @Override - public Entity getThrower() - { - return this.shootingEntity; - } + public Entity getThrower() { + return this.shootingEntity; + } @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return false; } @Override @SideOnly(Side.CLIENT) - public float getShadowSize() - { + public float getShadowSize() { return 0.0F; } @Override - public boolean canAttackWithItem() - { + public boolean canAttackWithItem() { return false; } - public static DamageSource causeDartDamage(EntityDartBase dart, Entity thrower) - { + public static DamageSource causeDartDamage(EntityDartBase dart, Entity thrower) { return (new EntityDamageSourceIndirect("aether_legacy.dart", dart, thrower)).setProjectile(); } diff --git a/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartEnchanted.java b/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartEnchanted.java index 203b8c7..8c6a8c8 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartEnchanted.java +++ b/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartEnchanted.java @@ -6,30 +6,25 @@ import net.minecraft.world.World; import com.legacy.aether.items.ItemsAether; -public class EntityDartEnchanted extends EntityDartBase -{ +public class EntityDartEnchanted extends EntityDartBase { - public EntityDartEnchanted(World worldIn) - { + public EntityDartEnchanted(World worldIn) { super(worldIn); } - public EntityDartEnchanted(World world, EntityLivingBase entity, float velocity) - { + public EntityDartEnchanted(World world, EntityLivingBase entity, float velocity) { super(world, entity, velocity); } - @Override - public void entityInit() - { + @Override + public void entityInit() { super.entityInit(); this.setDamage(6); } - @Override - protected ItemStack getStack() - { - return new ItemStack(ItemsAether.dart, 1, 2); - } + @Override + protected ItemStack getStack() { + return new ItemStack(ItemsAether.dart, 1, 2); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartGolden.java b/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartGolden.java index 5fc5f05..a3ad069 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartGolden.java +++ b/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartGolden.java @@ -6,30 +6,25 @@ import net.minecraft.world.World; import com.legacy.aether.items.ItemsAether; -public class EntityDartGolden extends EntityDartBase -{ +public class EntityDartGolden extends EntityDartBase { - public EntityDartGolden(World worldIn) - { + public EntityDartGolden(World worldIn) { super(worldIn); } - public EntityDartGolden(World world, EntityLivingBase entity, float velocity) - { - super(world, entity, velocity); - } + public EntityDartGolden(World world, EntityLivingBase entity, float velocity) { + super(world, entity, velocity); + } - @Override - public void entityInit() - { + @Override + public void entityInit() { super.entityInit(); this.setDamage(4); } - @Override - protected ItemStack getStack() - { - return new ItemStack(ItemsAether.dart, 1, 0); - } + @Override + protected ItemStack getStack() { + return new ItemStack(ItemsAether.dart, 1, 0); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartPoison.java b/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartPoison.java index 9188ce4..d6a9618 100644 --- a/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartPoison.java +++ b/src/main/java/com/legacy/aether/entities/projectile/darts/EntityDartPoison.java @@ -20,100 +20,82 @@ import com.legacy.aether.network.AetherNetwork; import com.legacy.aether.network.packets.PacketSendPoison; import com.legacy.aether.player.PlayerAether; -public class EntityDartPoison extends EntityDartBase -{ +public class EntityDartPoison extends EntityDartBase { - public EntityLivingBase victim; + public EntityLivingBase victim; - public AetherPoisonMovement poison; + public AetherPoisonMovement poison; - public EntityDartPoison(World worldIn) - { + public EntityDartPoison(World worldIn) { super(worldIn); } - public EntityDartPoison(World world, EntityLivingBase entity, float velocity) - { - super(world, entity, velocity); - } + public EntityDartPoison(World world, EntityLivingBase entity, float velocity) { + super(world, entity, velocity); + } - public void entityInit() - { + public void entityInit() { super.entityInit(); this.setDamage(0); } - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); - if (this.victim != null) - { - if (this.victim.isDead || this.poison.ticks == 0) - { - this.setDead(); + if (this.victim != null) { + if (this.victim.isDead || this.poison.ticks == 0) { + this.setDead(); - return; - } + return; + } - if (this.getThrower() != null) - { - if (this.getThrower().worldObj instanceof WorldServer) - { - ((WorldServer)this.getThrower().worldObj).func_147487_a("iconcrack_" + Item.getIdFromItem(Items.dye) + "_" + 1, this.victim.posX, this.victim.boundingBox.minY + this.victim.height * 0.8D, this.victim.posZ, 2, 0.0D, 0.0D, 0.0D, 0.0D); + if (this.getThrower() != null) { + if (this.getThrower().worldObj instanceof WorldServer) { + ((WorldServer) this.getThrower().worldObj).func_147487_a("iconcrack_" + Item.getIdFromItem(Items.dye) + "_" + 1, this.victim.posX, this.victim.boundingBox.minY + this.victim.height * 0.8D, this.victim.posZ, 2, 0.0D, 0.0D, 0.0D, 0.0D); } - } + } - this.isDead = false; - this.poison.onUpdate(); - this.setInvisible(true); - this.setPosition(this.victim.posX, this.victim.posY, this.victim.posZ); + this.isDead = false; + this.poison.onUpdate(); + this.setInvisible(true); + this.setPosition(this.victim.posX, this.victim.posY, this.victim.posZ); } } @Override - public void onCollideWithPlayer(EntityPlayer entity) - { - if (this.victim == null) - { - super.onCollideWithPlayer(entity); - } + public void onCollideWithPlayer(EntityPlayer entity) { + if (this.victim == null) { + super.onCollideWithPlayer(entity); + } } @Override - public void onDartHit(MovingObjectPosition movingobjectposition) - { - super.onDartHit(movingobjectposition); + public void onDartHit(MovingObjectPosition movingobjectposition) { + super.onDartHit(movingobjectposition); - if (movingobjectposition.entityHit instanceof EntityLivingBase) - { - Entity entity = movingobjectposition.entityHit; + if (movingobjectposition.entityHit instanceof EntityLivingBase) { + Entity entity = movingobjectposition.entityHit; - if (entity instanceof EntityPlayer) - { - EntityPlayer ent = (EntityPlayer)entity; + if (entity instanceof EntityPlayer) { + EntityPlayer ent = (EntityPlayer) entity; - if (!this.worldObj.isRemote) - { - PlayerAether.get(ent).inflictPoison(500); - AetherNetwork.sendTo(new PacketSendPoison(), (EntityPlayerMP) ent); + if (!this.worldObj.isRemote) { + PlayerAether.get(ent).inflictPoison(500); + AetherNetwork.sendTo(new PacketSendPoison(), (EntityPlayerMP) ent); } - } - else if (!(entity instanceof IAetherBoss) && !(entity instanceof EntityCockatrice) && !(entity instanceof EntityAechorPlant)) - { - this.victim = (EntityLivingBase) entity; - this.poison = new AetherPoisonMovement(this.victim); - this.poison.inflictPoison(500); - } + } else if (!(entity instanceof IAetherBoss) && !(entity instanceof EntityCockatrice) && !(entity instanceof EntityAechorPlant)) { + this.victim = (EntityLivingBase) entity; + this.poison = new AetherPoisonMovement(this.victim); + this.poison.inflictPoison(500); + } - this.isDead = false; - } + this.isDead = false; + } } - @Override - protected ItemStack getStack() - { - return new ItemStack(ItemsAether.dart, 1, 1); - } + @Override + protected ItemStack getStack() { + return new ItemStack(ItemsAether.dart, 1, 1); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/util/AetherMoaTypes.java b/src/main/java/com/legacy/aether/entities/util/AetherMoaTypes.java index 9b20955..671be0b 100644 --- a/src/main/java/com/legacy/aether/entities/util/AetherMoaTypes.java +++ b/src/main/java/com/legacy/aether/entities/util/AetherMoaTypes.java @@ -6,21 +6,18 @@ import com.legacy.aether.api.moa.AetherMoaType; import com.legacy.aether.api.moa.MoaProperties; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class AetherMoaTypes -{ +public class AetherMoaTypes { public static AetherMoaType blue, orange, white, black; - public static void initialization() - { + public static void initialization() { blue = register("blue", 0x7777FF, new MoaProperties(3, 0.3F)); orange = register("orange", -0xC3D78, new MoaProperties(2, 0.6F)); white = register("white", 0xFFFFFF, new MoaProperties(4, 0.3F)); black = register("black", 0x222222, new MoaProperties(8, 0.3F)); } - public static AetherMoaType register(String name, int hexColor, MoaProperties properties) - { + public static AetherMoaType register(String name, int hexColor, MoaProperties properties) { AetherMoaType moaType = new AetherMoaType(hexColor, properties, AetherCreativeTabs.misc); AetherAPI.instance().register(Aether.locate(name), moaType); diff --git a/src/main/java/com/legacy/aether/entities/util/AetherNameGen.java b/src/main/java/com/legacy/aether/entities/util/AetherNameGen.java index 6e4dbcb..a7ad2b6 100644 --- a/src/main/java/com/legacy/aether/entities/util/AetherNameGen.java +++ b/src/main/java/com/legacy/aether/entities/util/AetherNameGen.java @@ -2,90 +2,87 @@ package com.legacy.aether.entities.util; import java.util.Random; -public class AetherNameGen -{ +public class AetherNameGen { public static Random rand = new Random(); - public static String[] valkNamePrefix = { "Har", "Her", "Gon", "Sko", "Hil" }; + public static String[] valkNamePrefix = {"Har", "Her", "Gon", "Sko", "Hil"}; - public static String[] valkNameMiddix = { "fjo", "ska", "bri", "", ""}; + public static String[] valkNameMiddix = {"fjo", "ska", "bri", "", ""}; - public static String[] valkNameSuffix = { "tur", "pul", "dul", "gul", "or"}; + public static String[] valkNameSuffix = {"tur", "pul", "dul", "gul", "or"}; - public static String[] name1 = new String[] { "Del", "Ros", "Per", "Cyn", - "Flar", "Ba", "Lab", "Az", "Ob", "Al", "Pas", "Nun", "Ur", "Ter", - "Jar", "Est", "Car", "Houl", "In", "Kop", "Shot", "Vast", "Ael", - "Skal", "Geld", "Er", "Sald", "Sar", "Binthe", "Haur", "Syn", - "Kren", "Verd", "Pav", "Mart", "Yal", "Kor", "Lar", "Mel", - "Claune", "For", "Rusk", "Pan", "Dir", "Chies", "Kil", "Odas", - "Toc", "Plag", "Uld", "Yar", "Win", "Ry", "Harg", "Ty", "Druc", - "Vald", "Keld", "Ar", "Das", "Klab", "Wearn", "Pes", "Art", "Na", - "Harab", "Cal", "Ha", "Nev", "Wy", "Las", "Jes", "Kir", "Oc", - "Brow", "Nist", "Var", "Lor", "Naut", "Hab", "Ard", "Vard", "Nor", - "Tes", "Rol", "Ge", "Daf", "Tral", "Scaun", "Kol", "Star", "Ald", - "Nap", "Loc", "Cor", "Chy", "Hy", "Har", "Char", "Bay", "Rald", - "Yas", "Grave", "Dras", "Sep", "Shy", "Eth", "El", "Crac", "Hob", - "Zol", "Bel", "Bar", "Zald", "Hal", "Ryle", "Obr", "Dain", "Jast", - "Mold", "Bae", "As", "Ki", "Val", "Par", "Ash", "Ost", "Haith", - "I", "Ca", "Vad", "Ro", "Dez", "Kuv", "Vab", "Dar", "Ral", "Mar", - "Quarne", "Pulg", "Hor", "Ka", "Quer", "And", "Ny", "Ym", "Wal", - "Tarl", "Vart","Pro" }; + public static String[] name1 = new String[]{"Del", "Ros", "Per", "Cyn", + "Flar", "Ba", "Lab", "Az", "Ob", "Al", "Pas", "Nun", "Ur", "Ter", + "Jar", "Est", "Car", "Houl", "In", "Kop", "Shot", "Vast", "Ael", + "Skal", "Geld", "Er", "Sald", "Sar", "Binthe", "Haur", "Syn", + "Kren", "Verd", "Pav", "Mart", "Yal", "Kor", "Lar", "Mel", + "Claune", "For", "Rusk", "Pan", "Dir", "Chies", "Kil", "Odas", + "Toc", "Plag", "Uld", "Yar", "Win", "Ry", "Harg", "Ty", "Druc", + "Vald", "Keld", "Ar", "Das", "Klab", "Wearn", "Pes", "Art", "Na", + "Harab", "Cal", "Ha", "Nev", "Wy", "Las", "Jes", "Kir", "Oc", + "Brow", "Nist", "Var", "Lor", "Naut", "Hab", "Ard", "Vard", "Nor", + "Tes", "Rol", "Ge", "Daf", "Tral", "Scaun", "Kol", "Star", "Ald", + "Nap", "Loc", "Cor", "Chy", "Hy", "Har", "Char", "Bay", "Rald", + "Yas", "Grave", "Dras", "Sep", "Shy", "Eth", "El", "Crac", "Hob", + "Zol", "Bel", "Bar", "Zald", "Hal", "Ryle", "Obr", "Dain", "Jast", + "Mold", "Bae", "As", "Ki", "Val", "Par", "Ash", "Ost", "Haith", + "I", "Ca", "Vad", "Ro", "Dez", "Kuv", "Vab", "Dar", "Ral", "Mar", + "Quarne", "Pulg", "Hor", "Ka", "Quer", "And", "Ny", "Ym", "Wal", + "Tarl", "Vart", "Pro"}; - public static String[] name2 = new String[] { "cath", "yd", "rik", "nal", - "y", "ro", "stead", "carn", "tak", "chean", "ain", "ak", "loc", - "ras", "ien", "cuth", "alen", "is", "carad", "acy", "la", "asc", - "arn", "ayn", "sene", "art", "lyn", "cam", "mel", "ly", "eas", - "il", "oller", "bin", "a", "astar", "tuny", "iera", "aldy", "ene", - "in", "yne", "id", "aur", "era", "fyn", "om", "sume", "ir", "que", - "warty", "tan", "warne", "tar", "lene", "ron", "valer", "war", - "ant", "iam", "ew", "am", "ime", "varn", "orn", "quent", "geth", - "aver", "car", "lin", "luth", "as", "gant", "gine", "carth", - "ayne", "asty", "arik", "lir", "on", "codd", "az", "tyne", "wat", - "erry", "aryne", "ert", "quin", "rath", "ame", "tin", "ter", - "quine", "arth", "arne", "eth", "zane", "gar", "an", "yn", "gayn", - "ax", "ast", "azer", "ont", "or", "ian", "gur", "et", "er", "im", - "dar", "end", "doth", "en", "aller", "reth", "juin", "arny", "un", - "len", "ere", "ane", "aryn", "dy", "gary", "arry", "arty", "ydd", - "ris", "ar", "ance", "hen", "el", "air", "rum" }; + public static String[] name2 = new String[]{"cath", "yd", "rik", "nal", + "y", "ro", "stead", "carn", "tak", "chean", "ain", "ak", "loc", + "ras", "ien", "cuth", "alen", "is", "carad", "acy", "la", "asc", + "arn", "ayn", "sene", "art", "lyn", "cam", "mel", "ly", "eas", + "il", "oller", "bin", "a", "astar", "tuny", "iera", "aldy", "ene", + "in", "yne", "id", "aur", "era", "fyn", "om", "sume", "ir", "que", + "warty", "tan", "warne", "tar", "lene", "ron", "valer", "war", + "ant", "iam", "ew", "am", "ime", "varn", "orn", "quent", "geth", + "aver", "car", "lin", "luth", "as", "gant", "gine", "carth", + "ayne", "asty", "arik", "lir", "on", "codd", "az", "tyne", "wat", + "erry", "aryne", "ert", "quin", "rath", "ame", "tin", "ter", + "quine", "arth", "arne", "eth", "zane", "gar", "an", "yn", "gayn", + "ax", "ast", "azer", "ont", "or", "ian", "gur", "et", "er", "im", + "dar", "end", "doth", "en", "aller", "reth", "juin", "arny", "un", + "len", "ere", "ane", "aryn", "dy", "gary", "arry", "arty", "ydd", + "ris", "ar", "ance", "hen", "el", "air", "rum"}; - public static String[] name3 = new String[] { "cath", "carth", "ayne", - "yd", "arik", "asty", "rik", "lir", "dor", "nal", "on", "codd", - "y", "ber", "ro", "stead", "ta", "tyne", "wat", "carn", "erry", - "chean", "ain", "aryne", "al", "ak", "ert", "ras", "ien", "alen", - "is", "acy", "la", "ame", "ter", "arn", "quine", "ayn", "sene", - "art", "arth", "lyn", "mel", "arne", "ern", "eth", "ly", "zane", - "se", "gar", "eas", "ty", "an", "il", "yn", "oller", "gayn", "a", - "bin", "iel", "azer", "astar", "tuny", "ont", "iera", "aldy", - "ene", "ian", "or", "in", "sa", "yne", "era", "er", "fyn", "im", - "dar", "sume", "doth", "en", "aller", "ir", "reth", "que", "arny", - "ney", "warty", "un", "juin", "nik", "warne", "ere", "yr", "lene", - "ane", "valer", "war", "ant", "iam", "ew", "dy", "aryn", "gary", - "ime", "varn", "orn", "tha", "arty", "quent", "arry", "aver", - "geth", "car", "lin", "ydd", "ris", "nyd", "ance", "luth", "ar", - "dal", "gant", "el", "tyn", "air", "gine", "boo" }; + public static String[] name3 = new String[]{"cath", "carth", "ayne", + "yd", "arik", "asty", "rik", "lir", "dor", "nal", "on", "codd", + "y", "ber", "ro", "stead", "ta", "tyne", "wat", "carn", "erry", + "chean", "ain", "aryne", "al", "ak", "ert", "ras", "ien", "alen", + "is", "acy", "la", "ame", "ter", "arn", "quine", "ayn", "sene", + "art", "arth", "lyn", "mel", "arne", "ern", "eth", "ly", "zane", + "se", "gar", "eas", "ty", "an", "il", "yn", "oller", "gayn", "a", + "bin", "iel", "azer", "astar", "tuny", "ont", "iera", "aldy", + "ene", "ian", "or", "in", "sa", "yne", "era", "er", "fyn", "im", + "dar", "sume", "doth", "en", "aller", "ir", "reth", "que", "arny", + "ney", "warty", "un", "juin", "nik", "warne", "ere", "yr", "lene", + "ane", "valer", "war", "ant", "iam", "ew", "dy", "aryn", "gary", + "ime", "varn", "orn", "tha", "arty", "quent", "arry", "aver", + "geth", "car", "lin", "ydd", "ris", "nyd", "ance", "luth", "ar", + "dal", "gant", "el", "tyn", "air", "gine", "boo"}; - public static String gen() - { - String name = name1[rand.nextInt(name1.length)]; + public static String gen() { + String name = name1[rand.nextInt(name1.length)]; - int middle = 2 + rand.nextInt(2); - for (int i = 0; i < middle; i++) - name += name2[rand.nextInt(name2.length)]; + int middle = 2 + rand.nextInt(2); + for (int i = 0; i < middle; i++) + name += name2[rand.nextInt(name2.length)]; - return name + name3[rand.nextInt(name3.length)]; - } + return name + name3[rand.nextInt(name3.length)]; + } - public static String valkGen() - { + public static String valkGen() { - String result = ""; + String result = ""; - result += valkNamePrefix[rand.nextInt(valkNamePrefix.length)]; - result += valkNameMiddix[rand.nextInt(valkNameMiddix.length)]; - result += valkNameSuffix[rand.nextInt(valkNameSuffix.length)]; + result += valkNamePrefix[rand.nextInt(valkNamePrefix.length)]; + result += valkNameMiddix[rand.nextInt(valkNameMiddix.length)]; + result += valkNameSuffix[rand.nextInt(valkNameSuffix.length)]; - return result; - } + return result; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/util/EntityAetherItem.java b/src/main/java/com/legacy/aether/entities/util/EntityAetherItem.java index 555086e..7c1aceb 100644 --- a/src/main/java/com/legacy/aether/entities/util/EntityAetherItem.java +++ b/src/main/java/com/legacy/aether/entities/util/EntityAetherItem.java @@ -4,28 +4,23 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class EntityAetherItem extends EntityItem -{ +public class EntityAetherItem extends EntityItem { - public EntityAetherItem(World world) - { - super(world); - } + public EntityAetherItem(World world) { + super(world); + } - public EntityAetherItem(World world, double x, double y, double z) - { - super(world, x, y, z); - } + public EntityAetherItem(World world, double x, double y, double z) { + super(world, x, y, z); + } - public EntityAetherItem(World world, double x, double y, double z, ItemStack stack) - { - super(world, x, y, z, stack); - } + public EntityAetherItem(World world, double x, double y, double z, ItemStack stack) { + super(world, x, y, z, stack); + } - @Override - public boolean isEntityInvulnerable() - { - return true; - } + @Override + public boolean isEntityInvulnerable() { + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/entities/util/EntityHook.java b/src/main/java/com/legacy/aether/entities/util/EntityHook.java index 3a350ab..eb5cf4c 100644 --- a/src/main/java/com/legacy/aether/entities/util/EntityHook.java +++ b/src/main/java/com/legacy/aether/entities/util/EntityHook.java @@ -22,8 +22,7 @@ import com.legacy.aether.world.TeleporterAether; import cpw.mods.fml.common.FMLCommonHandler; -public class EntityHook implements IExtendedEntityProperties -{ +public class EntityHook implements IExtendedEntityProperties { private EntityLivingBase entity; @@ -32,127 +31,101 @@ public class EntityHook implements IExtendedEntityProperties public int teleportDirection; @Override - public void init(Entity entity, World world) - { + public void init(Entity entity, World world) { this.entity = (EntityLivingBase) entity; } @Override - public void saveNBTData(NBTTagCompound compound) - { + public void saveNBTData(NBTTagCompound compound) { } @Override - public void loadNBTData(NBTTagCompound compound) - { + public void loadNBTData(NBTTagCompound compound) { } - public void onUpdate() - { - this.entity.worldObj.theProfiler.startSection("portal"); + public void onUpdate() { + this.entity.worldObj.theProfiler.startSection("portal"); - if (this.entity.dimension == AetherConfig.getAetherDimensionID()) - { - if (this.entity.posY < -2 && this.entity.riddenByEntity == null && this.entity.ridingEntity == null) - { + if (this.entity.dimension == AetherConfig.getAetherDimensionID()) { + if (this.entity.posY < -2 && this.entity.riddenByEntity == null && this.entity.ridingEntity == null) { this.teleportEntity(false); } } - if (this.inPortal) - { - if (this.entity.ridingEntity == null) - { - this.entity.timeUntilPortal = this.entity.getPortalCooldown(); + if (this.inPortal) { + if (this.entity.ridingEntity == null) { + this.entity.timeUntilPortal = this.entity.getPortalCooldown(); - if (!this.entity.worldObj.isRemote) - { - this.teleportEntity(true); - } - } + if (!this.entity.worldObj.isRemote) { + this.teleportEntity(true); + } + } - this.inPortal = false; - } + this.inPortal = false; + } - if (this.entity.timeUntilPortal > 0) - { - --this.entity.timeUntilPortal; - } + if (this.entity.timeUntilPortal > 0) { + --this.entity.timeUntilPortal; + } - this.entity.worldObj.theProfiler.endSection(); + this.entity.worldObj.theProfiler.endSection(); - if (this.entity instanceof EntityLiving) - { + if (this.entity instanceof EntityLiving) { EntityLiving livingEntity = (EntityLiving) this.entity; - if (livingEntity.getAttackTarget() instanceof EntityPlayer) - { + if (livingEntity.getAttackTarget() instanceof EntityPlayer) { PlayerAether playerAether = PlayerAether.get((EntityPlayer) livingEntity.getAttackTarget()); - if (playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) - { + if (playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) { livingEntity.setAttackTarget(null); } } } - if (this.entity instanceof EntityCreature) - { + if (this.entity instanceof EntityCreature) { EntityCreature creature = (EntityCreature) this.entity; - if (creature.getEntityToAttack() instanceof EntityPlayer) - { + if (creature.getEntityToAttack() instanceof EntityPlayer) { PlayerAether playerAether = PlayerAether.get((EntityPlayer) creature.getEntityToAttack()); - if (playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) - { + if (playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) { creature.setTarget(null); } } } - if (this.entity.getAITarget() instanceof EntityPlayer) - { + if (this.entity.getAITarget() instanceof EntityPlayer) { PlayerAether playerAether = PlayerAether.get((EntityPlayer) this.entity.getAITarget()); - if (playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) - { + if (playerAether.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) { this.entity.setRevengeTarget(null); } } } - public void setInPortal() - { - if (this.entity instanceof IAetherBoss || this.entity instanceof IBossDisplayData) - { + public void setInPortal() { + if (this.entity instanceof IAetherBoss || this.entity instanceof IBossDisplayData) { return; } - if (this.entity.timeUntilPortal > 0) - { - this.entity.timeUntilPortal = this.entity.getPortalCooldown(); - } - else - { - double d0 = this.entity.prevPosX - this.entity.posX; - double d1 = this.entity.prevPosZ - this.entity.posZ; + if (this.entity.timeUntilPortal > 0) { + this.entity.timeUntilPortal = this.entity.getPortalCooldown(); + } else { + double d0 = this.entity.prevPosX - this.entity.posX; + double d1 = this.entity.prevPosZ - this.entity.posZ; - if (!this.entity.worldObj.isRemote && !this.inPortal) - { - this.teleportDirection = Direction.getMovementDirection(d0, d1); - } + if (!this.entity.worldObj.isRemote && !this.inPortal) { + this.teleportDirection = Direction.getMovementDirection(d0, d1); + } - this.inPortal = true; - } + this.inPortal = true; + } } - private void teleportEntity(boolean shouldSpawnPortal) - { - try - { + private void teleportEntity(boolean shouldSpawnPortal) { + try { int previousDimension = this.entity.dimension; int transferDimension = previousDimension == AetherConfig.getAetherDimensionID() ? AetherConfig.getTravelDimensionID() : AetherConfig.getAetherDimensionID(); MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); @@ -164,10 +137,8 @@ public class EntityHook implements IExtendedEntityProperties this.entity.isDead = false; server.getConfigurationManager().transferEntityToWorld(this.entity, previousWorldIn.provider.dimensionId, previousWorldIn, newWorldIn, new TeleporterAether(shouldSpawnPortal, newWorldIn)); - } - catch(Exception e) - { - + } catch (Exception e) { + } } diff --git a/src/main/java/com/legacy/aether/entities/util/EntityMountable.java b/src/main/java/com/legacy/aether/entities/util/EntityMountable.java index bb4f640..56bf93e 100644 --- a/src/main/java/com/legacy/aether/entities/util/EntityMountable.java +++ b/src/main/java/com/legacy/aether/entities/util/EntityMountable.java @@ -10,8 +10,7 @@ import net.minecraft.world.World; import com.legacy.aether.entities.passive.EntityAetherAnimal; import com.legacy.aether.player.PlayerAether; -public abstract class EntityMountable extends EntityAetherAnimal -{ +public abstract class EntityMountable extends EntityAetherAnimal { protected float jumpPower; @@ -23,14 +22,12 @@ public abstract class EntityMountable extends EntityAetherAnimal protected boolean canJumpMidAir = false; - public EntityMountable(World world) - { + public EntityMountable(World world) { super(world); } @Override - public void entityInit() - { + public void entityInit() { super.entityInit(); this.dataWatcher.addObject(17, new Byte((byte) 0)); //onGroundClient @@ -38,46 +35,37 @@ public abstract class EntityMountable extends EntityAetherAnimal } @Override - public boolean canRiderInteract() - { - return true; - } - - @Override - public boolean shouldDismountInWater(Entity rider) - { - return false; - } - - public boolean isOnGround() - { - return this.dataWatcher.getWatchableObjectByte(17) == (byte)1; + public boolean canRiderInteract() { + return true; } - private void setOnGround(boolean onGround) - { + @Override + public boolean shouldDismountInWater(Entity rider) { + return false; + } + + public boolean isOnGround() { + return this.dataWatcher.getWatchableObjectByte(17) == (byte) 1; + } + + private void setOnGround(boolean onGround) { this.dataWatcher.updateObject(17, (byte) (onGround ? 1 : 0)); } - public boolean isRiderSneaking() - { - return this.dataWatcher.getWatchableObjectByte(18) == (byte)1; + public boolean isRiderSneaking() { + return this.dataWatcher.getWatchableObjectByte(18) == (byte) 1; } - public void setRiderSneaking(boolean riderSneaking) - { + public void setRiderSneaking(boolean riderSneaking) { this.dataWatcher.updateObject(18, (byte) (riderSneaking ? 1 : 0)); } @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); - if (!this.worldObj.isRemote) - { - if (this.onGround != this.isOnGround()) - { + if (!this.worldObj.isRemote) { + if (this.onGround != this.isOnGround()) { this.setOnGround(this.onGround); } @@ -85,53 +73,42 @@ public abstract class EntityMountable extends EntityAetherAnimal } } - public void updateRider() - { - if (this.canDismount() && this.riddenByEntity instanceof EntityPlayer) - { + public void updateRider() { + if (this.canDismount() && this.riddenByEntity instanceof EntityPlayer) { PlayerAether playerAether = PlayerAether.get((EntityPlayer) this.riddenByEntity); - if (playerAether.isMountSneaking()) - { - if (this.onGround) - { + if (playerAether.isMountSneaking()) { + if (this.onGround) { this.riddenByEntity.mountEntity(null); playerAether.setMountSneaking(false); } this.setRiderSneaking(true); - } - else - { + } else { this.setRiderSneaking(false); } } } - private float updateRotation(float angle, float targetAngle, float maxIncrease) - { - float f = MathHelper.wrapAngleTo180_float(targetAngle - angle); + private float updateRotation(float angle, float targetAngle, float maxIncrease) { + float f = MathHelper.wrapAngleTo180_float(targetAngle - angle); - if (f > maxIncrease) - { - f = maxIncrease; - } + if (f > maxIncrease) { + f = maxIncrease; + } - if (f < -maxIncrease) - { - f = -maxIncrease; - } + if (f < -maxIncrease) { + f = -maxIncrease; + } - return angle + f; - } + return angle + f; + } @Override - public void moveEntityWithHeading(float par1, float par2) - { + public void moveEntityWithHeading(float par1, float par2) { Entity entity = this.riddenByEntity; - if (entity instanceof EntityPlayer) - { + if (entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; this.prevRotationYaw = this.rotationYaw = player.rotationYaw; @@ -142,33 +119,28 @@ public abstract class EntityMountable extends EntityAetherAnimal par1 = player.moveStrafing; par2 = player.moveForward; - if (par2 <= 0.0F) - { + if (par2 <= 0.0F) { par2 *= 0.25F; this.field_110285_bP = 0; } - double d01 = player.posX - this.posX; - double d2 = player.posZ - this.posZ; + double d01 = player.posX - this.posX; + double d2 = player.posZ - this.posZ; - float f = (float)(Math.atan2(d2, d01) * (180D / Math.PI)) - 90.0F; + float f = (float) (Math.atan2(d2, d01) * (180D / Math.PI)) - 90.0F; - if (player.moveStrafing != 0.0F && player.worldObj.isRemote) - { - this.rotationYaw = this.updateRotation(this.rotationYaw, f, 40.0F); + if (player.moveStrafing != 0.0F && player.worldObj.isRemote) { + this.rotationYaw = this.updateRotation(this.rotationYaw, f, 40.0F); } - if (PlayerAether.get(player).isJumping()) - { + if (PlayerAether.get(player).isJumping()) { onMountedJump(par1, par2); } - if (this.jumpPower > 0.0F && !this.isMountJumping() && (this.onGround || this.canJumpMidAir)) - { + if (this.jumpPower > 0.0F && !this.isMountJumping() && (this.onGround || this.canJumpMidAir)) { this.motionY = this.getMountJumpStrength() * (double) this.jumpPower; - if (this.isPotionActive(Potion.jump)) - { + if (this.isPotionActive(Potion.jump)) { this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F); } @@ -177,8 +149,7 @@ public abstract class EntityMountable extends EntityAetherAnimal this.jumpPower = 0.0F; - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { this.moveEntity(this.motionX, this.motionY, this.motionZ); } } @@ -188,14 +159,12 @@ public abstract class EntityMountable extends EntityAetherAnimal this.stepHeight = 1.0F; - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { this.jumpMovementFactor = this.getAIMoveSpeed() * 0.6F; super.moveEntityWithHeading(par1, par2); } - if (this.onGround) - { + if (this.onGround) { this.jumpPower = 0.0F; this.setMountJumping(false); } @@ -205,16 +174,13 @@ public abstract class EntityMountable extends EntityAetherAnimal double d1 = this.posZ - this.prevPosZ; float f4 = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F; - if (f4 > 1.0F) - { + if (f4 > 1.0F) { f4 = 1.0F; } this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F; this.limbSwing += this.limbSwingAmount; - } - else - { + } else { this.stepHeight = 0.5F; this.jumpMovementFactor = 0.02F; super.moveEntityWithHeading(par1, par2); @@ -222,44 +188,36 @@ public abstract class EntityMountable extends EntityAetherAnimal } @Override - public float getAIMoveSpeed() - { - return this.riddenByEntity != null ? this.getMountedMoveSpeed() : super.getAIMoveSpeed(); - } + public float getAIMoveSpeed() { + return this.riddenByEntity != null ? this.getMountedMoveSpeed() : super.getAIMoveSpeed(); + } @Override - protected void func_145780_a(int x, int y, int z, Block block) - { + protected void func_145780_a(int x, int y, int z, Block block) { - } + } - public float getMountedMoveSpeed() - { + public float getMountedMoveSpeed() { return 0.15F; } - protected double getMountJumpStrength() - { + protected double getMountJumpStrength() { return 1.0D; } - protected void setMountJumping(boolean mountJumping) - { + protected void setMountJumping(boolean mountJumping) { this.mountJumping = mountJumping; } - protected boolean isMountJumping() - { + protected boolean isMountJumping() { return this.mountJumping; } - public void onMountedJump(float par1, float par2) - { + public void onMountedJump(float par1, float par2) { this.jumpPower = 0.4F; } - public boolean canDismount() - { + public boolean canDismount() { return true; } diff --git a/src/main/java/com/legacy/aether/entities/util/EntitySaddleMount.java b/src/main/java/com/legacy/aether/entities/util/EntitySaddleMount.java index 70d3f7a..e4e264b 100644 --- a/src/main/java/com/legacy/aether/entities/util/EntitySaddleMount.java +++ b/src/main/java/com/legacy/aether/entities/util/EntitySaddleMount.java @@ -6,41 +6,32 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public abstract class EntitySaddleMount extends EntityMountable -{ +public abstract class EntitySaddleMount extends EntityMountable { - public EntitySaddleMount(World world) - { + public EntitySaddleMount(World world) { super(world); } @Override - public void entityInit() - { + public void entityInit() { super.entityInit(); this.dataWatcher.addObject(19, new Byte((byte) 0)); } @Override - public boolean interact(EntityPlayer entityplayer) - { - if (!this.canSaddle()) - { + public boolean interact(EntityPlayer entityplayer) { + if (!this.canSaddle()) { return super.interact(entityplayer); } - - if (!this.isSaddled()) - { - if (entityplayer.inventory.getCurrentItem() != null && (entityplayer.inventory.getCurrentItem().getItem() == Items.saddle) && !this.isChild()) - { - if (!entityplayer.capabilities.isCreativeMode) - { + + if (!this.isSaddled()) { + if (entityplayer.inventory.getCurrentItem() != null && (entityplayer.inventory.getCurrentItem().getItem() == Items.saddle) && !this.isChild()) { + if (!entityplayer.capabilities.isCreativeMode) { entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null); } - - if (entityplayer.worldObj.isRemote) - { + + if (entityplayer.worldObj.isRemote) { entityplayer.worldObj.playSoundAtEntity(this, "mob.horse.leather", 0.5F, 1.0F); } @@ -48,26 +39,21 @@ public abstract class EntitySaddleMount extends EntityMountable return true; } - } - else if (this.riddenByEntity == null) - { - if (!entityplayer.worldObj.isRemote) - { + } else if (this.riddenByEntity == null) { + if (!entityplayer.worldObj.isRemote) { entityplayer.mountEntity(this); entityplayer.prevRotationYaw = entityplayer.rotationYaw = this.rotationYaw; } return true; } - + return super.interact(entityplayer); } @Override - public boolean attackEntityFrom(DamageSource damagesource, float i) - { - if ((damagesource.getEntity() instanceof EntityPlayer) && (this.riddenByEntity == damagesource.getEntity())) - { + public boolean attackEntityFrom(DamageSource damagesource, float i) { + if ((damagesource.getEntity() instanceof EntityPlayer) && (this.riddenByEntity == damagesource.getEntity())) { return false; } @@ -75,66 +61,55 @@ public abstract class EntitySaddleMount extends EntityMountable } @Override - protected void dropFewItems(boolean recentlyHit, int lootLevel) - { + protected void dropFewItems(boolean recentlyHit, int lootLevel) { super.dropFewItems(recentlyHit, lootLevel); - if (this.isSaddled()) - { + if (this.isSaddled()) { this.dropItem(Items.saddle, 1); } } @Override - public boolean isEntityInsideOpaqueBlock() - { + public boolean isEntityInsideOpaqueBlock() { return this.riddenByEntity != null ? false : super.isEntityInsideOpaqueBlock(); } @Override - public boolean shouldRiderFaceForward(EntityPlayer player) - { + public boolean shouldRiderFaceForward(EntityPlayer player) { return false; } @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return this.onGround; } @Override - public boolean canBeSteered() - { + public boolean canBeSteered() { return true; } - public void setSaddled(boolean saddled) - { + public void setSaddled(boolean saddled) { this.dataWatcher.updateObject(19, (byte) (saddled ? 1 : 0)); } - public boolean isSaddled() - { - return this.dataWatcher.getWatchableObjectByte(19) == (byte)1; + public boolean isSaddled() { + return this.dataWatcher.getWatchableObjectByte(19) == (byte) 1; } - public boolean canSaddle() - { + public boolean canSaddle() { return true; } @Override - public void writeEntityToNBT(NBTTagCompound compound) - { + public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setBoolean("isSaddled", this.isSaddled()); } @Override - public void readEntityFromNBT(NBTTagCompound compound) - { + public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); this.setSaddled(compound.getBoolean("isSaddled")); diff --git a/src/main/java/com/legacy/aether/events/DialogueClickedEvent.java b/src/main/java/com/legacy/aether/events/DialogueClickedEvent.java index c119f56..21cfb2e 100644 --- a/src/main/java/com/legacy/aether/events/DialogueClickedEvent.java +++ b/src/main/java/com/legacy/aether/events/DialogueClickedEvent.java @@ -3,8 +3,7 @@ package com.legacy.aether.events; import net.minecraft.entity.player.EntityPlayer; import cpw.mods.fml.common.eventhandler.Event; -public class DialogueClickedEvent extends Event -{ +public class DialogueClickedEvent extends Event { private EntityPlayer player; @@ -12,25 +11,21 @@ public class DialogueClickedEvent extends Event private int dialogueId; - public DialogueClickedEvent(EntityPlayer player, String dialogueName, int dialogueId) - { + public DialogueClickedEvent(EntityPlayer player, String dialogueName, int dialogueId) { this.player = player; this.dialogueName = dialogueName; this.dialogueId = dialogueId; } - public EntityPlayer getPlayer() - { + public EntityPlayer getPlayer() { return this.player; } - public String getDialogueName() - { + public String getDialogueName() { return this.dialogueName; } - public int getDialogueId() - { + public int getDialogueId() { return this.dialogueId; } diff --git a/src/main/java/com/legacy/aether/inventory/ContainerAccessories.java b/src/main/java/com/legacy/aether/inventory/ContainerAccessories.java index 3f4ad15..7c17351 100644 --- a/src/main/java/com/legacy/aether/inventory/ContainerAccessories.java +++ b/src/main/java/com/legacy/aether/inventory/ContainerAccessories.java @@ -17,8 +17,7 @@ import com.legacy.aether.api.player.util.IAccessoryInventory; import com.legacy.aether.inventory.slots.SlotAccessory; import com.legacy.aether.player.PlayerAether; -public class ContainerAccessories extends ContainerPlayer -{ +public class ContainerAccessories extends ContainerPlayer { public EntityPlayer player; @@ -29,39 +28,31 @@ public class ContainerAccessories extends ContainerPlayer private ObjectIntIdentityMap orderedList = AccessoryType.createCompleteList(); @SuppressWarnings("unchecked") - public ContainerAccessories(IAccessoryInventory inventory, EntityPlayer player) - { + public ContainerAccessories(IAccessoryInventory inventory, EntityPlayer player) { super(player.inventory, !player.worldObj.isRemote, player); this.player = player; this.playerAether = PlayerAether.get(player); this.inventoryInstance = inventory; - for (Slot slot : (ArrayList) this.inventorySlots) - { - if (slot.slotNumber == 0) - { + for (Slot slot : (ArrayList) this.inventorySlots) { + if (slot.slotNumber == 0) { slot.xDisplayPosition += 10; slot.yDisplayPosition -= 8; - } - else if (slot.slotNumber > 0 && slot.slotNumber < 5) - { + } else if (slot.slotNumber > 0 && slot.slotNumber < 5) { slot.xDisplayPosition += 28; slot.yDisplayPosition -= 8; } - if (slot.slotNumber > 4 && slot.slotNumber < 9) - { + if (slot.slotNumber > 4 && slot.slotNumber < 9) { slot.xDisplayPosition += 51; } } int slotID = 0; - for (int x = 1; x < 3; x++) - { - for (int y = 0; y < 4; y++) - { + for (int x = 1; x < 3; x++) { + for (int y = 0; y < 4; y++) { AccessoryType type = (AccessoryType) this.orderedList.func_148745_a(slotID); this.addSlotToContainer(new SlotAccessory(inventoryInstance, slotID, type, 59 + x * 18, 8 + y * 18, player)); @@ -71,18 +62,14 @@ public class ContainerAccessories extends ContainerPlayer } @SuppressWarnings("unchecked") - public int getAccessorySlot(AccessoryType type) - { + public int getAccessorySlot(AccessoryType type) { int slotID = 0; - for (Slot checkSlot : (List) this.inventorySlots) - { - if (checkSlot instanceof SlotAccessory && !checkSlot.getHasStack()) - { + for (Slot checkSlot : (List) this.inventorySlots) { + if (checkSlot instanceof SlotAccessory && !checkSlot.getHasStack()) { SlotAccessory accessorySlot = (SlotAccessory) checkSlot; - if (accessorySlot.getAccessoryType() == type) - { + if (accessorySlot.getAccessoryType() == type) { return slotID; } } @@ -94,32 +81,26 @@ public class ContainerAccessories extends ContainerPlayer } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) - { + public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) { Slot slot = (Slot) this.inventorySlots.get(slotNumber); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack stack = slot.getStack(); - if (!(slot instanceof SlotAccessory) && !(slot instanceof SlotCrafting)) - { + if (!(slot instanceof SlotAccessory) && !(slot instanceof SlotCrafting)) { int newSlotIndex = -1; - if (AetherAPI.instance().isAccessory(stack)) - { + if (AetherAPI.instance().isAccessory(stack)) { AetherAccessory accessory = AetherAPI.instance().getAccessory(stack); newSlotIndex = this.getAccessorySlot(accessory.getAccessoryType()); - if (newSlotIndex == -1 && accessory.getExtraType() != null) - { + if (newSlotIndex == -1 && accessory.getExtraType() != null) { newSlotIndex = this.getAccessorySlot(accessory.getExtraType()); } } - if (newSlotIndex != -1) - { + if (newSlotIndex != -1) { Slot accessorySlot = (SlotAccessory) this.inventorySlots.get(newSlotIndex); accessorySlot.putStack(stack); slot.putStack(null); diff --git a/src/main/java/com/legacy/aether/inventory/ContainerEnchanter.java b/src/main/java/com/legacy/aether/inventory/ContainerEnchanter.java index 75212a5..d9cf345 100644 --- a/src/main/java/com/legacy/aether/inventory/ContainerEnchanter.java +++ b/src/main/java/com/legacy/aether/inventory/ContainerEnchanter.java @@ -14,169 +14,131 @@ import com.legacy.aether.tileentity.TileEntityEnchanter; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ContainerEnchanter extends Container -{ +public class ContainerEnchanter extends Container { private TileEntityEnchanter enchanter; public int progress, ticksRequired, powerRemaining; - public ContainerEnchanter(InventoryPlayer par1InventoryPlayer, TileEntityEnchanter tileEntityEnchanter) - { + public ContainerEnchanter(InventoryPlayer par1InventoryPlayer, TileEntityEnchanter tileEntityEnchanter) { this.enchanter = tileEntityEnchanter; this.addSlotToContainer(new Slot(tileEntityEnchanter, 0, 56, 17)); this.addSlotToContainer(new Slot(tileEntityEnchanter, 1, 56, 53)); this.addSlotToContainer(new SlotEnchanter(tileEntityEnchanter, 2, 116, 35)); int i; - for (i = 0; i < 3; ++i) - { - for (int j = 0; j < 9; ++j) - { + for (i = 0; i < 3; ++i) { + for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(par1InventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(par1InventoryPlayer, i, 8 + i * 18, 142)); } } @Override - public void addCraftingToCrafters(ICrafting listener) - { - super.addCraftingToCrafters(listener); + public void addCraftingToCrafters(ICrafting listener) { + super.addCraftingToCrafters(listener); - listener.sendProgressBarUpdate(this, 0, this.enchanter.progress); - listener.sendProgressBarUpdate(this, 1, this.enchanter.powerRemaining); - listener.sendProgressBarUpdate(this, 2, this.enchanter.ticksRequired); - } + listener.sendProgressBarUpdate(this, 0, this.enchanter.progress); + listener.sendProgressBarUpdate(this, 1, this.enchanter.powerRemaining); + listener.sendProgressBarUpdate(this, 2, this.enchanter.ticksRequired); + } @Override - public void detectAndSendChanges() - { - super.detectAndSendChanges(); + public void detectAndSendChanges() { + super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); - if (this.progress != this.enchanter.progress) - { - icrafting.sendProgressBarUpdate(this, 0, this.enchanter.progress); - } + if (this.progress != this.enchanter.progress) { + icrafting.sendProgressBarUpdate(this, 0, this.enchanter.progress); + } - if (this.powerRemaining != this.enchanter.powerRemaining) - { - icrafting.sendProgressBarUpdate(this, 1, this.enchanter.powerRemaining); - } + if (this.powerRemaining != this.enchanter.powerRemaining) { + icrafting.sendProgressBarUpdate(this, 1, this.enchanter.powerRemaining); + } - if (this.ticksRequired != this.enchanter.ticksRequired) - { - icrafting.sendProgressBarUpdate(this, 2, this.enchanter.ticksRequired); - } - } + if (this.ticksRequired != this.enchanter.ticksRequired) { + icrafting.sendProgressBarUpdate(this, 2, this.enchanter.ticksRequired); + } + } - this.progress = this.enchanter.progress; - this.powerRemaining = this.enchanter.powerRemaining; - this.ticksRequired = this.enchanter.ticksRequired; - } + this.progress = this.enchanter.progress; + this.powerRemaining = this.enchanter.powerRemaining; + this.ticksRequired = this.enchanter.ticksRequired; + } @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { - this.enchanter.progress = value; - } + @SideOnly(Side.CLIENT) + public void updateProgressBar(int id, int value) { + if (id == 0) { + this.enchanter.progress = value; + } - if (id == 1) - { - this.enchanter.powerRemaining = value; - } + if (id == 1) { + this.enchanter.powerRemaining = value; + } - if (id == 2) - { - this.enchanter.ticksRequired = value; - } - } + if (id == 2) { + this.enchanter.ticksRequired = value; + } + } @Override - public boolean canInteractWith(EntityPlayer par1EntityPlayer) - { + public boolean canInteractWith(EntityPlayer par1EntityPlayer) { return this.enchanter.isUseableByPlayer(par1EntityPlayer); } @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) - { + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(par2); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (par2 == 2) - { - if (!this.mergeItemStack(itemstack1, 3, 39, true)) - { + if (par2 == 2) { + if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); - } - else if (par2 != 1 && par2 != 0) - { - if (AetherAPI.instance().hasEnchantment(itemstack)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + } else if (par2 != 1 && par2 != 0) { + if (AetherAPI.instance().hasEnchantment(itemstack)) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (AetherAPI.instance().isEnchantmentFuel(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { + } else if (AetherAPI.instance().isEnchantmentFuel(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } - } - else if (par2 >= 3 && par2 < 30) - { - if (!this.mergeItemStack(itemstack1, 30, 39, false)) - { + } else if (par2 >= 3 && par2 < 30) { + if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } - } - else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) - { + } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 3, 39, false)) - { + } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) { return null; } - if (itemstack1.stackSize == 0) - { + if (itemstack1.stackSize == 0) { slot.putStack(null); - } - else - { + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } - slot.onPickupFromSlot(par1EntityPlayer, itemstack1); + slot.onPickupFromSlot(par1EntityPlayer, itemstack1); } return itemstack; diff --git a/src/main/java/com/legacy/aether/inventory/ContainerFreezer.java b/src/main/java/com/legacy/aether/inventory/ContainerFreezer.java index 9876c39..d7ca27e 100644 --- a/src/main/java/com/legacy/aether/inventory/ContainerFreezer.java +++ b/src/main/java/com/legacy/aether/inventory/ContainerFreezer.java @@ -14,15 +14,13 @@ import com.legacy.aether.tileentity.TileEntityFreezer; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ContainerFreezer extends Container -{ +public class ContainerFreezer extends Container { private TileEntityFreezer freezer; public int progress, ticksRequired, powerRemaining; - public ContainerFreezer(InventoryPlayer par1InventoryPlayer, TileEntityFreezer tileEntityFreezer) - { + public ContainerFreezer(InventoryPlayer par1InventoryPlayer, TileEntityFreezer tileEntityFreezer) { this.freezer = tileEntityFreezer; this.addSlotToContainer(new Slot(tileEntityFreezer, 0, 56, 17)); @@ -31,150 +29,114 @@ public class ContainerFreezer extends Container int i; - for (i = 0; i < 3; ++i) - { - for (int j = 0; j < 9; ++j) - { + for (i = 0; i < 3; ++i) { + for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(par1InventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(par1InventoryPlayer, i, 8 + i * 18, 142)); } } @Override - public void addCraftingToCrafters(ICrafting listener) - { - super.addCraftingToCrafters(listener); + public void addCraftingToCrafters(ICrafting listener) { + super.addCraftingToCrafters(listener); - listener.sendProgressBarUpdate(this, 0, this.freezer.progress); - listener.sendProgressBarUpdate(this, 1, this.freezer.powerRemaining); - listener.sendProgressBarUpdate(this, 2, this.freezer.ticksRequired); - } + listener.sendProgressBarUpdate(this, 0, this.freezer.progress); + listener.sendProgressBarUpdate(this, 1, this.freezer.powerRemaining); + listener.sendProgressBarUpdate(this, 2, this.freezer.ticksRequired); + } @Override - public void detectAndSendChanges() - { - super.detectAndSendChanges(); + public void detectAndSendChanges() { + super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); - if (this.progress != this.freezer.progress) - { - icrafting.sendProgressBarUpdate(this, 0, this.freezer.progress); - } + if (this.progress != this.freezer.progress) { + icrafting.sendProgressBarUpdate(this, 0, this.freezer.progress); + } - if (this.powerRemaining != this.freezer.powerRemaining) - { - icrafting.sendProgressBarUpdate(this, 1, this.freezer.powerRemaining); - } + if (this.powerRemaining != this.freezer.powerRemaining) { + icrafting.sendProgressBarUpdate(this, 1, this.freezer.powerRemaining); + } - if (this.ticksRequired != this.freezer.ticksRequired) - { - icrafting.sendProgressBarUpdate(this, 2, this.freezer.ticksRequired); - } - } + if (this.ticksRequired != this.freezer.ticksRequired) { + icrafting.sendProgressBarUpdate(this, 2, this.freezer.ticksRequired); + } + } - this.progress = this.freezer.progress; - this.powerRemaining = this.freezer.powerRemaining; - this.ticksRequired = this.freezer.ticksRequired; - } + this.progress = this.freezer.progress; + this.powerRemaining = this.freezer.powerRemaining; + this.ticksRequired = this.freezer.ticksRequired; + } @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { - this.freezer.progress = value; - } + @SideOnly(Side.CLIENT) + public void updateProgressBar(int id, int value) { + if (id == 0) { + this.freezer.progress = value; + } - if (id == 1) - { - this.freezer.powerRemaining = value; - } + if (id == 1) { + this.freezer.powerRemaining = value; + } - if (id == 2) - { - this.freezer.ticksRequired = value; - } - } + if (id == 2) { + this.freezer.ticksRequired = value; + } + } @Override - public boolean canInteractWith(EntityPlayer par1EntityPlayer) - { + public boolean canInteractWith(EntityPlayer par1EntityPlayer) { return this.freezer.isUseableByPlayer(par1EntityPlayer); } @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) - { + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(par2); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (par2 == 2) - { - if (!this.mergeItemStack(itemstack1, 3, 39, true)) - { + if (par2 == 2) { + if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); - } - else if (par2 != 1 && par2 != 0) - { - if (AetherAPI.instance().hasFreezable(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + } else if (par2 != 1 && par2 != 0) { + if (AetherAPI.instance().hasFreezable(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (AetherAPI.instance().isFreezableFuel(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { + } else if (AetherAPI.instance().isFreezableFuel(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } - } - else if (par2 >= 3 && par2 < 30) - { - if (!this.mergeItemStack(itemstack1, 30, 39, false)) - { + } else if (par2 >= 3 && par2 < 30) { + if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } - } - else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) - { + } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 3, 39, false)) - { + } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) { return null; } - if (itemstack1.stackSize == 0) - { + if (itemstack1.stackSize == 0) { slot.putStack(null); - } - else - { + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } diff --git a/src/main/java/com/legacy/aether/inventory/ContainerIncubator.java b/src/main/java/com/legacy/aether/inventory/ContainerIncubator.java index 2b0415c..366978e 100644 --- a/src/main/java/com/legacy/aether/inventory/ContainerIncubator.java +++ b/src/main/java/com/legacy/aether/inventory/ContainerIncubator.java @@ -16,144 +16,113 @@ import com.legacy.aether.tileentity.TileEntityIncubator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ContainerIncubator extends Container -{ +public class ContainerIncubator extends Container { private int progress, powerRemaining; - private TileEntityIncubator incubator; + private TileEntityIncubator incubator; - public ContainerIncubator(EntityPlayer player, InventoryPlayer inventory, TileEntityIncubator incubator) - { - this.incubator = incubator; + public ContainerIncubator(EntityPlayer player, InventoryPlayer inventory, TileEntityIncubator incubator) { + this.incubator = incubator; - this.addSlotToContainer(new SlotIncubator(incubator, 1, 73, 17, player)); - this.addSlotToContainer(new Slot(incubator, 0, 73, 53)); + this.addSlotToContainer(new SlotIncubator(incubator, 1, 73, 17, player)); + this.addSlotToContainer(new Slot(incubator, 0, 73, 53)); - for (int j = 0; j < 3; ++j) - { - for (int k = 0; k < 9; ++k) - { - this.addSlotToContainer(new Slot(inventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18)); - } - } + for (int j = 0; j < 3; ++j) { + for (int k = 0; k < 9; ++k) { + this.addSlotToContainer(new Slot(inventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18)); + } + } - for (int j = 0; j < 9; ++j) - { - this.addSlotToContainer(new Slot(inventory, j, 8 + j * 18, 142)); - } - } + for (int j = 0; j < 9; ++j) { + this.addSlotToContainer(new Slot(inventory, j, 8 + j * 18, 142)); + } + } @Override - public void addCraftingToCrafters(ICrafting listener) - { - super.addCraftingToCrafters(listener); + public void addCraftingToCrafters(ICrafting listener) { + super.addCraftingToCrafters(listener); - listener.sendProgressBarUpdate(this, 0, this.incubator.progress); - listener.sendProgressBarUpdate(this, 1, this.incubator.powerRemaining); - } + listener.sendProgressBarUpdate(this, 0, this.incubator.progress); + listener.sendProgressBarUpdate(this, 1, this.incubator.powerRemaining); + } @Override - public void detectAndSendChanges() - { - super.detectAndSendChanges(); + public void detectAndSendChanges() { + super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); - if (this.progress != this.incubator.progress) - { - icrafting.sendProgressBarUpdate(this, 0, this.incubator.progress); - } + if (this.progress != this.incubator.progress) { + icrafting.sendProgressBarUpdate(this, 0, this.incubator.progress); + } - if (this.powerRemaining != this.incubator.powerRemaining) - { - icrafting.sendProgressBarUpdate(this, 1, this.incubator.powerRemaining); - } - } + if (this.powerRemaining != this.incubator.powerRemaining) { + icrafting.sendProgressBarUpdate(this, 1, this.incubator.powerRemaining); + } + } - this.progress = this.incubator.progress; - this.powerRemaining = this.incubator.powerRemaining; - } + this.progress = this.incubator.progress; + this.powerRemaining = this.incubator.powerRemaining; + } @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { - this.incubator.progress = value; - } + @SideOnly(Side.CLIENT) + public void updateProgressBar(int id, int value) { + if (id == 0) { + this.incubator.progress = value; + } - if (id == 1) - { - this.incubator.powerRemaining = value; - } - } + if (id == 1) { + this.incubator.powerRemaining = value; + } + } @Override - public boolean canInteractWith(EntityPlayer entityplayer) - { - return this.incubator.isUseableByPlayer(entityplayer); - } + public boolean canInteractWith(EntityPlayer entityplayer) { + return this.incubator.isUseableByPlayer(entityplayer); + } @Override - public ItemStack transferStackInSlot(EntityPlayer entityplayer, int index) - { - ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(index); + public ItemStack transferStackInSlot(EntityPlayer entityplayer, int index) { + ItemStack itemstack = null; + Slot slot = (Slot) this.inventorySlots.get(index); - if (slot != null && slot.getHasStack()) - { - ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); + if (slot != null && slot.getHasStack()) { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); - if (index != 1 && index != 0) - { - if (itemstack.getItem() == Item.getItemFromBlock(BlocksAether.ambrosium_torch) && this.mergeItemStack(itemstack1, 1, 2, false)) - { + if (index != 1 && index != 0) { + if (itemstack.getItem() == Item.getItemFromBlock(BlocksAether.ambrosium_torch) && this.mergeItemStack(itemstack1, 1, 2, false)) { return itemstack; - } - else if (itemstack.getItem() == ItemsAether.moa_egg && this.mergeItemStack(itemstack1, 0, 1, false)) - { + } else if (itemstack.getItem() == ItemsAether.moa_egg && this.mergeItemStack(itemstack1, 0, 1, false)) { return itemstack; + } else if (index >= 2 && index < 29) { + if (!this.mergeItemStack(itemstack1, 29, 38, false)) { + return null; + } + } else if (index >= 29 && index < 37 && !this.mergeItemStack(itemstack1, 2, 29, false)) { + return null; } - else if (index >= 2 && index < 29) - { - if (!this.mergeItemStack(itemstack1, 29, 38, false)) - { - return null; - } - } - else if (index >= 29 && index < 37 && !this.mergeItemStack(itemstack1, 2, 29, false)) - { - return null; - } - } - else if (!this.mergeItemStack(itemstack1, 2, 38, false)) - { - return null; - } + } else if (!this.mergeItemStack(itemstack1, 2, 38, false)) { + return null; + } - if (itemstack1.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { - slot.onSlotChanged(); - } + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } - if (itemstack1.stackSize == itemstack.stackSize) - { - return null; - } + if (itemstack1.stackSize == itemstack.stackSize) { + return null; + } - slot.onPickupFromSlot(entityplayer, itemstack1); - } + slot.onPickupFromSlot(entityplayer, itemstack1); + } - return itemstack; - } + return itemstack; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/inventory/ContainerLore.java b/src/main/java/com/legacy/aether/inventory/ContainerLore.java index 0261602..1138448 100644 --- a/src/main/java/com/legacy/aether/inventory/ContainerLore.java +++ b/src/main/java/com/legacy/aether/inventory/ContainerLore.java @@ -7,81 +7,60 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerLore extends Container -{ +public class ContainerLore extends Container { - public IInventory loreSlot; + public IInventory loreSlot; - public ContainerLore(InventoryPlayer inventory) - { - this.loreSlot = new InventoryLore(inventory.player); + public ContainerLore(InventoryPlayer inventory) { + this.loreSlot = new InventoryLore(inventory.player); - this.addSlotToContainer(new Slot(this.loreSlot, 0, 104, -4)); + this.addSlotToContainer(new Slot(this.loreSlot, 0, 104, -4)); - for (int j = 0; j < 3; ++j) - { - for (int k = 0; k < 9; ++k) - { - this.addSlotToContainer(new Slot(inventory, k + j * 9 + 9, 48 + k * 18, 113 + j * 18)); - } - } + for (int j = 0; j < 3; ++j) { + for (int k = 0; k < 9; ++k) { + this.addSlotToContainer(new Slot(inventory, k + j * 9 + 9, 48 + k * 18, 113 + j * 18)); + } + } - for (int j = 0; j < 9; ++j) - { - this.addSlotToContainer(new Slot(inventory, j, 48 + j * 18, 171)); - } - } + for (int j = 0; j < 9; ++j) { + this.addSlotToContainer(new Slot(inventory, j, 48 + j * 18, 171)); + } + } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) - { + public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(slotNumber); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (slotNumber == 0) - { - if (!this.mergeItemStack(itemstack1, 1, 37, true)) - { + if (slotNumber == 0) { + if (!this.mergeItemStack(itemstack1, 1, 37, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); - } - else if (slotNumber != 0) - { - if (slotNumber >= 1 && slotNumber < 28) - { - if (!this.mergeItemStack(itemstack1, 28, 37, false)) - { + } else if (slotNumber != 0) { + if (slotNumber >= 1 && slotNumber < 28) { + if (!this.mergeItemStack(itemstack1, 28, 37, false)) { return null; } - } - else if (slotNumber >= 28 && slotNumber < 37 && !this.mergeItemStack(itemstack1, 1, 28, false)) - { + } else if (slotNumber >= 28 && slotNumber < 37 && !this.mergeItemStack(itemstack1, 1, 28, false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 1, 37, false)) - { + } else if (!this.mergeItemStack(itemstack1, 1, 37, false)) { return null; } - if (itemstack1.stackSize == 0) - { + if (itemstack1.stackSize == 0) { slot.putStack(null); - } - else - { + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } @@ -93,22 +72,19 @@ public class ContainerLore extends Container } @Override - public void onContainerClosed(EntityPlayer entityplayer) - { - ItemStack item = this.loreSlot.getStackInSlot(0); + public void onContainerClosed(EntityPlayer entityplayer) { + ItemStack item = this.loreSlot.getStackInSlot(0); - if (item != null) - { - entityplayer.entityDropItem(item, 1.0F); - } + if (item != null) { + entityplayer.entityDropItem(item, 1.0F); + } - super.onContainerClosed(entityplayer); - } + super.onContainerClosed(entityplayer); + } @Override - public boolean canInteractWith(EntityPlayer player) - { - return !player.isDead; - } + public boolean canInteractWith(EntityPlayer player) { + return !player.isDead; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/inventory/InventoryAccessories.java b/src/main/java/com/legacy/aether/inventory/InventoryAccessories.java index 79e0f53..24ee08c 100644 --- a/src/main/java/com/legacy/aether/inventory/InventoryAccessories.java +++ b/src/main/java/com/legacy/aether/inventory/InventoryAccessories.java @@ -23,8 +23,7 @@ import com.legacy.aether.util.FilledList; import cpw.mods.fml.common.network.ByteBufUtils; -public class InventoryAccessories implements IAccessoryInventory -{ +public class InventoryAccessories implements IAccessoryInventory { private final FilledList stacks = new FilledList(8, null); @@ -32,59 +31,49 @@ public class InventoryAccessories implements IAccessoryInventory private IPlayerAether playerAether; - public InventoryAccessories(IPlayerAether playerAether) - { + public InventoryAccessories(IPlayerAether playerAether) { this.playerAether = playerAether; } - public float getCurrentPlayerStrVsBlock(float original) - { + public float getCurrentPlayerStrVsBlock(float original) { float f = original; - if(this.wearingAccessory(new ItemStack(ItemsAether.zanite_pendant))) - { - f *= (1F + ((float)(this.getStackInSlot(AccessoryType.PENDANT).getItemDamage()) / ((float)(this.getStackInSlot(AccessoryType.PENDANT).getMaxDamage()) * 3F))); + if (this.wearingAccessory(new ItemStack(ItemsAether.zanite_pendant))) { + f *= (1F + ((float) (this.getStackInSlot(AccessoryType.PENDANT).getItemDamage()) / ((float) (this.getStackInSlot(AccessoryType.PENDANT).getMaxDamage()) * 3F))); } - if(this.getStackInSlot(AccessoryType.RING) != null && this.getStackInSlot(AccessoryType.RING).getItem() == ItemsAether.zanite_ring) - { - f *= (1F + ((float)(this.getStackInSlot(AccessoryType.RING).getItemDamage()) / ((float)(this.getStackInSlot(AccessoryType.RING).getMaxDamage()) * 3F))); + if (this.getStackInSlot(AccessoryType.RING) != null && this.getStackInSlot(AccessoryType.RING).getItem() == ItemsAether.zanite_ring) { + f *= (1F + ((float) (this.getStackInSlot(AccessoryType.RING).getItemDamage()) / ((float) (this.getStackInSlot(AccessoryType.RING).getMaxDamage()) * 3F))); } - if(this.getStackInSlot(AccessoryType.EXTRA_RING) != null && this.getStackInSlot(AccessoryType.EXTRA_RING).getItem() == ItemsAether.zanite_ring) - { - f *= (1F + ((float)(this.getStackInSlot(AccessoryType.EXTRA_RING).getItemDamage()) / ((float)(this.getStackInSlot(AccessoryType.EXTRA_RING).getMaxDamage()) * 3F))); + if (this.getStackInSlot(AccessoryType.EXTRA_RING) != null && this.getStackInSlot(AccessoryType.EXTRA_RING).getItem() == ItemsAether.zanite_ring) { + f *= (1F + ((float) (this.getStackInSlot(AccessoryType.EXTRA_RING).getItemDamage()) / ((float) (this.getStackInSlot(AccessoryType.EXTRA_RING).getMaxDamage()) * 3F))); } return f == original ? original : f + original; } @Override - public int getSizeInventory() - { + public int getSizeInventory() { return this.stacks.size(); } @Override - public ItemStack getStackInSlot(int slot) - { + public ItemStack getStackInSlot(int slot) { return this.stacks.get(slot); } @Override - public ItemStack decrStackSize(int slot, int size) - { + public ItemStack decrStackSize(int slot, int size) { ItemStack stack = this.getStackInSlot(slot); - if (stack.stackSize <= size) - { + if (stack.stackSize <= size) { this.setInventorySlotContents(slot, null); return stack; } - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { this.setInventorySlotContents(slot, null); } @@ -92,12 +81,10 @@ public class InventoryAccessories implements IAccessoryInventory } @Override - public ItemStack getStackInSlotOnClosing(int slot) - { + public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = this.getStackInSlot(slot); - if (this.getStackInSlot(slot) != null) - { + if (this.getStackInSlot(slot) != null) { this.setInventorySlotContents(slot, null); } @@ -105,77 +92,63 @@ public class InventoryAccessories implements IAccessoryInventory } @Override - public void setInventorySlotContents(int slot, ItemStack stack) - { + public void setInventorySlotContents(int slot, ItemStack stack) { this.stacks.set(slot, stack); this.markDirty(); } @Override - public String getInventoryName() - { + public String getInventoryName() { return "aether_legacy:accessories"; } @Override - public boolean hasCustomInventoryName() - { + public boolean hasCustomInventoryName() { return true; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 1; } @Override - public void markDirty() - { - if (!this.playerAether.getEntity().worldObj.isRemote && this.playerAether.getEntity() instanceof EntityPlayer) - { + public void markDirty() { + if (!this.playerAether.getEntity().worldObj.isRemote && this.playerAether.getEntity() instanceof EntityPlayer) { AetherNetwork.sendToAll(new PacketAccessory(this.playerAether)); } } @Override - public boolean isUseableByPlayer(EntityPlayer player) - { + public boolean isUseableByPlayer(EntityPlayer player) { return !player.isInsideOfMaterial(Material.portal) || !player.isDead; } @Override - public void openInventory() - { + public void openInventory() { } @Override - public void closeInventory() - { + public void closeInventory() { } @Override - public boolean isItemValidForSlot(int slot, ItemStack stack) - { - if (stack != null && stack.getItem() instanceof ItemAccessory) - { - return ((this.orderedList.func_148745_a(slot) == ((ItemAccessory)stack.getItem()).getType()) || (this.orderedList.func_148745_a(slot) == ((ItemAccessory)stack.getItem()).getExtraType())) && this.getStackInSlot(slot) == null; + public boolean isItemValidForSlot(int slot, ItemStack stack) { + if (stack != null && stack.getItem() instanceof ItemAccessory) { + return ((this.orderedList.func_148745_a(slot) == ((ItemAccessory) stack.getItem()).getType()) || (this.orderedList.func_148745_a(slot) == ((ItemAccessory) stack.getItem()).getExtraType())) && this.getStackInSlot(slot) == null; } return false; } @Override - public void dropAccessories() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { + public void dropAccessories() { + for (int i = 0; i < this.getSizeInventory(); ++i) { ItemStack stack = this.getStackInSlot(i); - if (stack != null) - { + if (stack != null) { this.playerAether.getEntity().dropItem(stack.getItem(), stack.stackSize); } } @@ -184,39 +157,32 @@ public class InventoryAccessories implements IAccessoryInventory } @Override - public void damageAccessory(int damage, AccessoryType type) - { + public void damageAccessory(int damage, AccessoryType type) { ItemStack stack = this.getStackInSlot(type); - if (stack != null) - { + if (stack != null) { stack.damageItem(damage, this.playerAether.getEntity()); } } @Override - public void damageWornStack(int damage, ItemStack search) - { + public void damageWornStack(int damage, ItemStack search) { int slot = -1; - for (int i = 0; i < this.stacks.size(); ++i) - { + for (int i = 0; i < this.stacks.size(); ++i) { ItemStack index = this.stacks.get(i); - if (slot == -1 && index != null && search.getItem() == index.getItem()) - { + if (slot == -1 && index != null && search.getItem() == index.getItem()) { slot = i; } } - if (slot != -1) - { + if (slot != -1) { this.stacks.get(slot).damageItem(damage, this.playerAether.getEntity()); ItemStack stack = this.stacks.get(slot); - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { this.setInventorySlotContents(slot, null); this.playerAether.getEntity().renderBrokenItemStack(stack); } @@ -224,34 +190,26 @@ public class InventoryAccessories implements IAccessoryInventory } @Override - public void setAccessorySlot(AccessoryType type, ItemStack stack) - { - if (stack.getItem() instanceof ItemAccessory) - { - if (this.getStackInSlot(type) == null) - { + public void setAccessorySlot(AccessoryType type, ItemStack stack) { + if (stack.getItem() instanceof ItemAccessory) { + if (this.getStackInSlot(type) == null) { this.setInventorySlotContents(this.orderedList.func_148747_b(type), stack); - } - else if (this.getStackInSlot(((ItemAccessory)stack.getItem()).getExtraType()) == null) - { - this.setAccessorySlot(((ItemAccessory)stack.getItem()).getExtraType(), stack); + } else if (this.getStackInSlot(((ItemAccessory) stack.getItem()).getExtraType()) == null) { + this.setAccessorySlot(((ItemAccessory) stack.getItem()).getExtraType(), stack); } } } @Override - public ItemStack getStackInSlot(AccessoryType type) - { + public ItemStack getStackInSlot(AccessoryType type) { return this.getStackInSlot(this.orderedList.func_148747_b(type)); } @Override - public ItemStack removeStackFromAccessorySlot(AccessoryType type) - { + public ItemStack removeStackFromAccessorySlot(AccessoryType type) { ItemStack stack = this.getStackInSlot(this.orderedList.func_148747_b(type)); - if (stack != null) - { + if (stack != null) { this.setAccessorySlot(type, null); } @@ -259,16 +217,13 @@ public class InventoryAccessories implements IAccessoryInventory } @Override - public int getAccessoryCount(ItemStack stack) - { + public int getAccessoryCount(ItemStack stack) { int count = 0; - for (int i = 0; i < this.getSizeInventory(); ++i) - { + for (int i = 0; i < this.getSizeInventory(); ++i) { ItemStack accessoryStack = this.getStackInSlot(i); - if (accessoryStack != null && accessoryStack.getItem() == stack.getItem()) - { + if (accessoryStack != null && accessoryStack.getItem() == stack.getItem()) { ++count; } } @@ -277,12 +232,9 @@ public class InventoryAccessories implements IAccessoryInventory } @Override - public boolean setAccessorySlot(ItemStack stack) - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - if (this.isItemValidForSlot(i, stack)) - { + public boolean setAccessorySlot(ItemStack stack) { + for (int i = 0; i < this.getSizeInventory(); ++i) { + if (this.isItemValidForSlot(i, stack)) { this.stacks.set(i, stack); this.markDirty(); @@ -294,16 +246,13 @@ public class InventoryAccessories implements IAccessoryInventory } @Override - public boolean wearingAccessory(ItemStack stack) - { + public boolean wearingAccessory(ItemStack stack) { boolean flag = false; - for (int i = 0; i < this.getSizeInventory(); ++i) - { + for (int i = 0; i < this.getSizeInventory(); ++i) { ItemStack accessoryStack = this.getStackInSlot(i); - if (!flag && accessoryStack != null && accessoryStack.getItem() == stack.getItem()) - { + if (!flag && accessoryStack != null && accessoryStack.getItem() == stack.getItem()) { flag = true; } } @@ -312,36 +261,28 @@ public class InventoryAccessories implements IAccessoryInventory } @Override - public boolean wearingArmor(ItemStack stack) - { - if (this.playerAether.getEntity() instanceof EntityPlayer) - { + public boolean wearingArmor(ItemStack stack) { + if (this.playerAether.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) this.playerAether.getEntity(); boolean flag = false; - for (int i = 0; i < player.inventory.armorInventory.length; ++i) - { + for (int i = 0; i < player.inventory.armorInventory.length; ++i) { ItemStack armorStack = player.getCurrentArmor(i); - if (!flag && armorStack != null && armorStack.getItem() == stack.getItem()) - { + if (!flag && armorStack != null && armorStack.getItem() == stack.getItem()) { flag = true; } } return flag; - } - else - { + } else { EntityLivingBase entityLiving = this.playerAether.getEntity(); boolean flag = false; - for (int i = 1; i < 5; ++i) - { + for (int i = 1; i < 5; ++i) { ItemStack armorStack = entityLiving.getEquipmentInSlot(i); - - if (!flag && armorStack != null && armorStack.getItem() == stack.getItem()) - { + + if (!flag && armorStack != null && armorStack.getItem() == stack.getItem()) { flag = true; } } @@ -351,104 +292,87 @@ public class InventoryAccessories implements IAccessoryInventory } @Override - public NBTTagList writeToNBT(NBTTagCompound compound) - { - NBTTagList nbttaglist = new NBTTagList(); + public NBTTagList writeToNBT(NBTTagCompound compound) { + NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < this.getSizeInventory(); ++i) - { - ItemStack stack = this.getStackInSlot(i); + for (int i = 0; i < this.getSizeInventory(); ++i) { + ItemStack stack = this.getStackInSlot(i); - if (stack != null) - { - NBTTagCompound stackCompound = new NBTTagCompound(); - stackCompound.setByte("Slot", (byte)i); - stack.writeToNBT(stackCompound); - nbttaglist.appendTag(stackCompound); - } - } + if (stack != null) { + NBTTagCompound stackCompound = new NBTTagCompound(); + stackCompound.setByte("Slot", (byte) i); + stack.writeToNBT(stackCompound); + nbttaglist.appendTag(stackCompound); + } + } - return nbttaglist; + return nbttaglist; } @Override - public void readFromNBT(NBTTagList list) - { - for (int i = 0; i < list.tagCount(); ++i) - { - NBTTagCompound stackCompound = list.getCompoundTagAt(i); - byte slot = stackCompound.getByte("Slot"); + public void readFromNBT(NBTTagList list) { + for (int i = 0; i < list.tagCount(); ++i) { + NBTTagCompound stackCompound = list.getCompoundTagAt(i); + byte slot = stackCompound.getByte("Slot"); - if (slot >= 0 && slot < this.getSizeInventory()) - { - this.stacks.set(slot, ItemStack.loadItemStackFromNBT(stackCompound)); - } - } - } - - @Override - public void writeData(ByteBuf buf) - { - buf.writeInt(this.getAccessories().size()); - - for (int i = 0; i < this.getSizeInventory(); ++i) - { - ItemStack stack = this.getStackInSlot(i); - - ByteBufUtils.writeItemStack(buf, stack); - } - } - - @Override - public void readData(ByteBuf buf) - { - int size = buf.readInt(); - - for (int i = 0; i < size; ++i) - { - this.stacks.set(i, ByteBufUtils.readItemStack(buf)); + if (slot >= 0 && slot < this.getSizeInventory()) { + this.stacks.set(slot, ItemStack.loadItemStackFromNBT(stackCompound)); + } } } @Override - public boolean isWearingZaniteSet() - { + public void writeData(ByteBuf buf) { + buf.writeInt(this.getAccessories().size()); + + for (int i = 0; i < this.getSizeInventory(); ++i) { + ItemStack stack = this.getStackInSlot(i); + + ByteBufUtils.writeItemStack(buf, stack); + } + } + + @Override + public void readData(ByteBuf buf) { + int size = buf.readInt(); + + for (int i = 0; i < size; ++i) { + this.stacks.set(i, ByteBufUtils.readItemStack(buf)); + } + } + + @Override + public boolean isWearingZaniteSet() { return wearingArmor(new ItemStack(ItemsAether.zanite_helmet)) && wearingArmor(new ItemStack(ItemsAether.zanite_chestplate)) && wearingArmor(new ItemStack(ItemsAether.zanite_leggings)) && wearingArmor(new ItemStack(ItemsAether.zanite_boots)) && wearingAccessory(new ItemStack(ItemsAether.zanite_gloves)); } @Override - public boolean isWearingGravititeSet() - { + public boolean isWearingGravititeSet() { return wearingArmor(new ItemStack(ItemsAether.gravitite_helmet)) && wearingArmor(new ItemStack(ItemsAether.gravitite_chestplate)) && wearingArmor(new ItemStack(ItemsAether.gravitite_leggings)) && wearingArmor(new ItemStack(ItemsAether.gravitite_boots)) && wearingAccessory(new ItemStack(ItemsAether.gravitite_gloves)); } @Override - public boolean isWearingNeptuneSet() - { + public boolean isWearingNeptuneSet() { return wearingArmor(new ItemStack(ItemsAether.neptune_helmet)) && wearingArmor(new ItemStack(ItemsAether.neptune_chestplate)) && wearingArmor(new ItemStack(ItemsAether.neptune_leggings)) && wearingArmor(new ItemStack(ItemsAether.neptune_boots)) && wearingAccessory(new ItemStack(ItemsAether.neptune_gloves)); } @Override - public boolean isWearingPhoenixSet() - { + public boolean isWearingPhoenixSet() { return wearingArmor(new ItemStack(ItemsAether.phoenix_helmet)) && wearingArmor(new ItemStack(ItemsAether.phoenix_chestplate)) && wearingArmor(new ItemStack(ItemsAether.phoenix_leggings)) && wearingArmor(new ItemStack(ItemsAether.phoenix_boots)) && wearingAccessory(new ItemStack(ItemsAether.phoenix_gloves)); } @Override - public boolean isWearingValkyrieSet() - { + public boolean isWearingValkyrieSet() { return wearingArmor(new ItemStack(ItemsAether.valkyrie_helmet)) && wearingArmor(new ItemStack(ItemsAether.valkyrie_chestplate)) && wearingArmor(new ItemStack(ItemsAether.valkyrie_leggings)) && wearingArmor(new ItemStack(ItemsAether.valkyrie_boots)) && wearingAccessory(new ItemStack(ItemsAether.valkyrie_gloves)); } @Override - public boolean isWearingObsidianSet() - { + public boolean isWearingObsidianSet() { return wearingArmor(new ItemStack(ItemsAether.obsidian_helmet)) && wearingArmor(new ItemStack(ItemsAether.obsidian_chestplate)) && wearingArmor(new ItemStack(ItemsAether.obsidian_leggings)) && wearingArmor(new ItemStack(ItemsAether.obsidian_boots)) && wearingAccessory(new ItemStack(ItemsAether.obsidian_gloves)); } @Override - public List getAccessories() - { + public List getAccessories() { return this.stacks; } diff --git a/src/main/java/com/legacy/aether/inventory/InventoryLore.java b/src/main/java/com/legacy/aether/inventory/InventoryLore.java index be0b88c..818b73e 100644 --- a/src/main/java/com/legacy/aether/inventory/InventoryLore.java +++ b/src/main/java/com/legacy/aether/inventory/InventoryLore.java @@ -9,27 +9,23 @@ import net.minecraft.item.ItemStack; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.achievements.AchievementsAether; -public class InventoryLore extends InventoryBasic -{ +public class InventoryLore extends InventoryBasic { private EntityPlayer player; - public InventoryLore(EntityPlayer player) - { + public InventoryLore(EntityPlayer player) { super("Lore Item", false, 1); this.player = player; } @Override - public void setInventorySlotContents(int index, @Nullable ItemStack stack) - { - if (stack != null && stack.getItem() == ItemsAether.lore_book) - { - this.player.triggerAchievement(AchievementsAether.loreception); - } + public void setInventorySlotContents(int index, @Nullable ItemStack stack) { + if (stack != null && stack.getItem() == ItemsAether.lore_book) { + this.player.triggerAchievement(AchievementsAether.loreception); + } - super.setInventorySlotContents(index, stack); - } + super.setInventorySlotContents(index, stack); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/inventory/slots/SlotAccessory.java b/src/main/java/com/legacy/aether/inventory/slots/SlotAccessory.java index 297d58a..a36894b 100644 --- a/src/main/java/com/legacy/aether/inventory/slots/SlotAccessory.java +++ b/src/main/java/com/legacy/aether/inventory/slots/SlotAccessory.java @@ -15,30 +15,25 @@ import com.legacy.aether.client.ClientProxy; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class SlotAccessory extends Slot -{ +public class SlotAccessory extends Slot { private EntityPlayer instance; private AccessoryType accessoryType; - public SlotAccessory(IInventory inventory, int slotID, AccessoryType accessoryType, int x, int y, EntityPlayer instance) - { + public SlotAccessory(IInventory inventory, int slotID, AccessoryType accessoryType, int x, int y, EntityPlayer instance) { super(inventory, slotID, x, y); - + this.instance = instance; this.accessoryType = accessoryType; } @Override - public boolean isItemValid(ItemStack stack) - { - if (AetherAPI.instance().isAccessory(stack)) - { + public boolean isItemValid(ItemStack stack) { + if (AetherAPI.instance().isAccessory(stack)) { AetherAccessory accessory = AetherAPI.instance().getAccessory(stack); - if (accessory.getAccessoryType() == this.getAccessoryType() || accessory.getExtraType() == this.getAccessoryType()) - { + if (accessory.getAccessoryType() == this.getAccessoryType() || accessory.getExtraType() == this.getAccessoryType()) { return AetherHooks.isValidAccessory(this.instance, accessory); } } @@ -47,14 +42,12 @@ public class SlotAccessory extends Slot } @Override - @SideOnly(Side.CLIENT) - public IIcon getBackgroundIconIndex() - { - return ClientProxy.ACCESSORY_ICONS[this.getSlotIndex()]; - } + @SideOnly(Side.CLIENT) + public IIcon getBackgroundIconIndex() { + return ClientProxy.ACCESSORY_ICONS[this.getSlotIndex()]; + } - public AccessoryType getAccessoryType() - { + public AccessoryType getAccessoryType() { return this.accessoryType; } diff --git a/src/main/java/com/legacy/aether/inventory/slots/SlotEnchanter.java b/src/main/java/com/legacy/aether/inventory/slots/SlotEnchanter.java index 49ba870..bca4262 100644 --- a/src/main/java/com/legacy/aether/inventory/slots/SlotEnchanter.java +++ b/src/main/java/com/legacy/aether/inventory/slots/SlotEnchanter.java @@ -4,17 +4,14 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotEnchanter extends Slot -{ +public class SlotEnchanter extends Slot { - public SlotEnchanter(IInventory inventoryIn, int index, int xPosition, int yPosition) - { + public SlotEnchanter(IInventory inventoryIn, int index, int xPosition, int yPosition) { super(inventoryIn, index, xPosition, yPosition); } @Override - public boolean isItemValid(ItemStack par1ItemStack) - { + public boolean isItemValid(ItemStack par1ItemStack) { return false; } diff --git a/src/main/java/com/legacy/aether/inventory/slots/SlotFreezer.java b/src/main/java/com/legacy/aether/inventory/slots/SlotFreezer.java index df7fe47..9ef1a41 100644 --- a/src/main/java/com/legacy/aether/inventory/slots/SlotFreezer.java +++ b/src/main/java/com/legacy/aether/inventory/slots/SlotFreezer.java @@ -4,17 +4,14 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotFreezer extends Slot -{ +public class SlotFreezer extends Slot { - public SlotFreezer(IInventory inventoryIn, int index, int xPosition, int yPosition) - { + public SlotFreezer(IInventory inventoryIn, int index, int xPosition, int yPosition) { super(inventoryIn, index, xPosition, yPosition); } @Override - public boolean isItemValid(ItemStack par1ItemStack) - { + public boolean isItemValid(ItemStack par1ItemStack) { return false; } diff --git a/src/main/java/com/legacy/aether/inventory/slots/SlotIncubator.java b/src/main/java/com/legacy/aether/inventory/slots/SlotIncubator.java index a2ad295..2393442 100644 --- a/src/main/java/com/legacy/aether/inventory/slots/SlotIncubator.java +++ b/src/main/java/com/legacy/aether/inventory/slots/SlotIncubator.java @@ -8,36 +8,31 @@ import net.minecraft.item.ItemStack; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.tileentity.TileEntityIncubator; -public class SlotIncubator extends Slot -{ +public class SlotIncubator extends Slot { private TileEntityIncubator incubator; private EntityPlayer player; - public SlotIncubator(TileEntityIncubator inv, int slot, int x, int y, EntityPlayer player) - { - super((IInventory) inv, slot, x, y); - this.incubator = (TileEntityIncubator) inv; - this.player = player; - } + public SlotIncubator(TileEntityIncubator inv, int slot, int x, int y, EntityPlayer player) { + super((IInventory) inv, slot, x, y); + this.incubator = (TileEntityIncubator) inv; + this.player = player; + } - public boolean isItemValid(ItemStack stack) - { - return stack.getItem() == ItemsAether.moa_egg; - } + public boolean isItemValid(ItemStack stack) { + return stack.getItem() == ItemsAether.moa_egg; + } - public int getSlotStackLimit() - { - return 1; - } + public int getSlotStackLimit() { + return 1; + } - @Override - public void putStack(ItemStack stack) - { - super.putStack(stack); + @Override + public void putStack(ItemStack stack) { + super.putStack(stack); - this.incubator.owner = player; - } + this.incubator.owner = player; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/ItemAetherDisc.java b/src/main/java/com/legacy/aether/items/ItemAetherDisc.java index a8a3153..3155590 100644 --- a/src/main/java/com/legacy/aether/items/ItemAetherDisc.java +++ b/src/main/java/com/legacy/aether/items/ItemAetherDisc.java @@ -6,8 +6,7 @@ import net.minecraft.util.ResourceLocation; import com.legacy.aether.Aether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemAetherDisc extends ItemRecord -{ +public class ItemAetherDisc extends ItemRecord { public String artistName; @@ -15,8 +14,7 @@ public class ItemAetherDisc extends ItemRecord public ResourceLocation songLocation; - public ItemAetherDisc(String s, String artist, String song) - { + public ItemAetherDisc(String s, String artist, String song) { super(s); this.artistName = artist; @@ -27,15 +25,13 @@ public class ItemAetherDisc extends ItemRecord } @Override - public String getRecordNameLocal() - { + public String getRecordNameLocal() { return this.artistName + " - " + this.songName; } @Override - public ResourceLocation getRecordResource(String name) - { - return this.songLocation; - } + public ResourceLocation getRecordResource(String name) { + return this.songLocation; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/ItemAetherSpawnEgg.java b/src/main/java/com/legacy/aether/items/ItemAetherSpawnEgg.java index 3d09dd9..e572b82 100644 --- a/src/main/java/com/legacy/aether/items/ItemAetherSpawnEgg.java +++ b/src/main/java/com/legacy/aether/items/ItemAetherSpawnEgg.java @@ -30,204 +30,166 @@ import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemAetherSpawnEgg extends Item -{ +public class ItemAetherSpawnEgg extends Item { - public static HashMap entityEggs = new LinkedHashMap(); + public static HashMap entityEggs = new LinkedHashMap(); - @SideOnly(Side.CLIENT) - private IIcon theIcon; + @SideOnly(Side.CLIENT) + private IIcon theIcon; - public ItemAetherSpawnEgg() - { - this.setHasSubtypes(true); - this.setCreativeTab(AetherCreativeTabs.misc); - } - - @Override - public String getItemStackDisplayName(ItemStack stack) - { - String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); - String s1 = EntitiesAether.getStringFromID(stack.getItemDamage()); - - if (s1 != null) - { - s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name"); - } - - return s; - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack p_82790_1_, int p_82790_2_) - { - EntityEggInfo entityegginfo = entityEggs.get(Integer.valueOf(p_82790_1_.getItemDamage())); - - return entityegginfo != null ? (p_82790_2_ == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215; - } - - @Override - public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) - { - if (p_77648_3_.isRemote) - { - return true; - } - else - { - Block block = p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_); - p_77648_4_ += Facing.offsetsXForSide[p_77648_7_]; - p_77648_5_ += Facing.offsetsYForSide[p_77648_7_]; - p_77648_6_ += Facing.offsetsZForSide[p_77648_7_]; - double d0 = 0.0D; - - if (p_77648_7_ == 1 && block.getRenderType() == 11) - { - d0 = 0.5D; - } - - Entity entity = spawnCreature(p_77648_3_, p_77648_1_.getItemDamage(), (double)p_77648_4_ + 0.5D, (double)p_77648_5_ + d0, (double)p_77648_6_ + 0.5D); - - if (entity != null) - { - if (entity instanceof EntityLivingBase && p_77648_1_.hasDisplayName()) - { - ((EntityLiving)entity).setCustomNameTag(p_77648_1_.getDisplayName()); - } - - if (!p_77648_2_.capabilities.isCreativeMode) - { - --p_77648_1_.stackSize; - } - } - - return true; - } - } - - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) - { - if (p_77659_2_.isRemote) - { - return p_77659_1_; - } - else - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(p_77659_2_, p_77659_3_, true); - - if (movingobjectposition == null) - { - return p_77659_1_; - } - else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!p_77659_2_.canMineBlock(p_77659_3_, i, j, k)) - { - return p_77659_1_; - } - - if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) - { - return p_77659_1_; - } - - if (p_77659_2_.getBlock(i, j, k) instanceof BlockLiquid) - { - Entity entity = spawnCreature(p_77659_2_, p_77659_1_.getItemDamage(), (double)i, (double)j, (double)k); - - if (entity != null) - { - if (entity instanceof EntityLivingBase && p_77659_1_.hasDisplayName()) - { - ((EntityLiving)entity).setCustomNameTag(p_77659_1_.getDisplayName()); - } - - if (!p_77659_3_.capabilities.isCreativeMode) - { - --p_77659_1_.stackSize; - } - } - } - } - - return p_77659_1_; - } - } - } - - public static Entity spawnCreature(World p_77840_0_, int p_77840_1_, double p_77840_2_, double p_77840_4_, double p_77840_6_) - { - if (!entityEggs.containsKey(Integer.valueOf(p_77840_1_))) - { - return null; - } - else - { - Entity entity = null; - - for (int j = 0; j < 1; ++j) - { - entity = EntitiesAether.createEntityByID(p_77840_1_, p_77840_0_); - - if (entity != null && entity instanceof EntityLivingBase) - { - EntityLiving entityliving = (EntityLiving)entity; - entity.setLocationAndAngles(p_77840_2_, p_77840_4_, p_77840_6_, MathHelper.wrapAngleTo180_float(p_77840_0_.rand.nextFloat() * 360.0F), 0.0F); - entityliving.rotationYawHead = entityliving.rotationYaw; - entityliving.renderYawOffset = entityliving.rotationYaw; - entityliving.onSpawnWithEgg((IEntityLivingData)null); - p_77840_0_.spawnEntityInWorld(entity); - entityliving.playLivingSound(); - } - } - - return entity; - } - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) - { - return p_77618_2_ > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(p_77618_1_, p_77618_2_); - } + public ItemAetherSpawnEgg() { + this.setHasSubtypes(true); + this.setCreativeTab(AetherCreativeTabs.misc); + } @Override - @SideOnly(Side.CLIENT) - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_) - { - Iterator iterator = entityEggs.values().iterator(); + public String getItemStackDisplayName(ItemStack stack) { + String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); + String s1 = EntitiesAether.getStringFromID(stack.getItemDamage()); - while (iterator.hasNext()) - { - EntityEggInfo entityegginfo = iterator.next(); - p_150895_3_.add(new ItemStack(p_150895_1_, 1, entityegginfo.spawnedID)); - } - } + if (s1 != null) { + s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name"); + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister p_94581_1_) - { - super.registerIcons(p_94581_1_); + return s; + } - this.theIcon = p_94581_1_.registerIcon(this.getIconString() + "_overlay"); - } + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack p_82790_1_, int p_82790_2_) { + EntityEggInfo entityegginfo = entityEggs.get(Integer.valueOf(p_82790_1_.getItemDamage())); + + return entityegginfo != null ? (p_82790_2_ == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215; + } + + @Override + public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + if (p_77648_3_.isRemote) { + return true; + } else { + Block block = p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_); + p_77648_4_ += Facing.offsetsXForSide[p_77648_7_]; + p_77648_5_ += Facing.offsetsYForSide[p_77648_7_]; + p_77648_6_ += Facing.offsetsZForSide[p_77648_7_]; + double d0 = 0.0D; + + if (p_77648_7_ == 1 && block.getRenderType() == 11) { + d0 = 0.5D; + } + + Entity entity = spawnCreature(p_77648_3_, p_77648_1_.getItemDamage(), (double) p_77648_4_ + 0.5D, (double) p_77648_5_ + d0, (double) p_77648_6_ + 0.5D); + + if (entity != null) { + if (entity instanceof EntityLivingBase && p_77648_1_.hasDisplayName()) { + ((EntityLiving) entity).setCustomNameTag(p_77648_1_.getDisplayName()); + } + + if (!p_77648_2_.capabilities.isCreativeMode) { + --p_77648_1_.stackSize; + } + } + + return true; + } + } + + @Override + public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { + if (p_77659_2_.isRemote) { + return p_77659_1_; + } else { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(p_77659_2_, p_77659_3_, true); + + if (movingobjectposition == null) { + return p_77659_1_; + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + if (!p_77659_2_.canMineBlock(p_77659_3_, i, j, k)) { + return p_77659_1_; + } + + if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) { + return p_77659_1_; + } + + if (p_77659_2_.getBlock(i, j, k) instanceof BlockLiquid) { + Entity entity = spawnCreature(p_77659_2_, p_77659_1_.getItemDamage(), (double) i, (double) j, (double) k); + + if (entity != null) { + if (entity instanceof EntityLivingBase && p_77659_1_.hasDisplayName()) { + ((EntityLiving) entity).setCustomNameTag(p_77659_1_.getDisplayName()); + } + + if (!p_77659_3_.capabilities.isCreativeMode) { + --p_77659_1_.stackSize; + } + } + } + } + + return p_77659_1_; + } + } + } + + public static Entity spawnCreature(World p_77840_0_, int p_77840_1_, double p_77840_2_, double p_77840_4_, double p_77840_6_) { + if (!entityEggs.containsKey(Integer.valueOf(p_77840_1_))) { + return null; + } else { + Entity entity = null; + + for (int j = 0; j < 1; ++j) { + entity = EntitiesAether.createEntityByID(p_77840_1_, p_77840_0_); + + if (entity != null && entity instanceof EntityLivingBase) { + EntityLiving entityliving = (EntityLiving) entity; + entity.setLocationAndAngles(p_77840_2_, p_77840_4_, p_77840_6_, MathHelper.wrapAngleTo180_float(p_77840_0_.rand.nextFloat() * 360.0F), 0.0F); + entityliving.rotationYawHead = entityliving.rotationYaw; + entityliving.renderYawOffset = entityliving.rotationYaw; + entityliving.onSpawnWithEgg((IEntityLivingData) null); + p_77840_0_.spawnEntityInWorld(entity); + entityliving.playLivingSound(); + } + } + + return entity; + } + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) { + return p_77618_2_ > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(p_77618_1_, p_77618_2_); + } + + @Override + @SideOnly(Side.CLIENT) + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_) { + Iterator iterator = entityEggs.values().iterator(); + + while (iterator.hasNext()) { + EntityEggInfo entityegginfo = iterator.next(); + p_150895_3_.add(new ItemStack(p_150895_1_, 1, entityegginfo.spawnedID)); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister p_94581_1_) { + super.registerIcons(p_94581_1_); + + this.theIcon = p_94581_1_.registerIcon(this.getIconString() + "_overlay"); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/ItemLoreBook.java b/src/main/java/com/legacy/aether/items/ItemLoreBook.java index 8ad5b4b..ea75b93 100644 --- a/src/main/java/com/legacy/aether/items/ItemLoreBook.java +++ b/src/main/java/com/legacy/aether/items/ItemLoreBook.java @@ -10,27 +10,23 @@ import com.legacy.aether.Aether; import com.legacy.aether.network.AetherGuiHandler; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemLoreBook extends Item -{ +public class ItemLoreBook extends Item { - public ItemLoreBook() - { + public ItemLoreBook() { this.setMaxStackSize(1); this.setCreativeTab(AetherCreativeTabs.misc); } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } @Override - public ItemStack onItemRightClick(ItemStack stackIn, World worldIn, EntityPlayer playerIn) - { - playerIn.openGui(Aether.instance, AetherGuiHandler.lore, worldIn, (int)playerIn.posX, (int)playerIn.posY, (int)playerIn.posZ); + public ItemStack onItemRightClick(ItemStack stackIn, World worldIn, EntityPlayer playerIn) { + playerIn.openGui(Aether.instance, AetherGuiHandler.lore, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ); - return playerIn.getHeldItem(); - } + return playerIn.getHeldItem(); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/ItemMoaEgg.java b/src/main/java/com/legacy/aether/items/ItemMoaEgg.java index cd7034e..f3ce0aa 100644 --- a/src/main/java/com/legacy/aether/items/ItemMoaEgg.java +++ b/src/main/java/com/legacy/aether/items/ItemMoaEgg.java @@ -20,81 +20,69 @@ import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemMoaEgg extends Item -{ +public class ItemMoaEgg extends Item { - @SideOnly(Side.CLIENT) - private IIcon spotIcon; + @SideOnly(Side.CLIENT) + private IIcon spotIcon; - public ItemMoaEgg() - { + public ItemMoaEgg() { this.setMaxStackSize(1); this.setCreativeTab(AetherCreativeTabs.misc); this.setTextureName(Aether.find("misc/egg/moa_egg")); } @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; - } + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) - { - return p_77618_2_ > 0 ? this.spotIcon : super.getIconFromDamageForRenderPass(p_77618_1_, p_77618_2_); - } + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) { + return p_77618_2_ > 0 ? this.spotIcon : super.getIconFromDamageForRenderPass(p_77618_1_, p_77618_2_); + } @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister registry) - { - super.registerIcons(registry); + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister registry) { + super.registerIcons(registry); - this.spotIcon = registry.registerIcon(Aether.find("misc/egg/moa_egg_spot")); - } + this.spotIcon = registry.registerIcon(Aether.find("misc/egg/moa_egg_spot")); + } @Override - public CreativeTabs[] getCreativeTabs() - { - return CreativeTabs.creativeTabArray; - } + public CreativeTabs[] getCreativeTabs() { + return CreativeTabs.creativeTabArray; + } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) - { - if (player.capabilities.isCreativeMode) - { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) { + if (player.capabilities.isCreativeMode) { EntityMoa moa = new EntityMoa(world, AetherAPI.instance().getMoaType(stack.getTagCompound().getInteger("typeId"))); moa.setPositionAndRotation(x, y + 1, z, 1.0F, 1.0F); moa.setPlayerGrown(true); - if (!world.isRemote) - { + if (!world.isRemote) { world.spawnEntityInWorld(moa); } - + return true; } - return super.onItemUse(stack, player, world, x, y, z, facing, hitX, hitY, hitZ); - } + return super.onItemUse(stack, player, world, x, y, z, facing, hitX, hitY, hitZ); + } @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubItems(Item item, CreativeTabs tab, List subItems) - { - for (int moaTypeSize = 0; moaTypeSize < AetherAPI.instance().getMoaTypeSize(); ++moaTypeSize) - { + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubItems(Item item, CreativeTabs tab, List subItems) { + for (int moaTypeSize = 0; moaTypeSize < AetherAPI.instance().getMoaTypeSize(); ++moaTypeSize) { ItemStack stack = new ItemStack(this); NBTTagCompound compound = new NBTTagCompound(); AetherMoaType moaType = AetherAPI.instance().getMoaType(moaTypeSize); - if (moaType.getCreativeTab() == tab || tab == null || tab == CreativeTabs.tabAllSearch) - { + if (moaType.getCreativeTab() == tab || tab == null || tab == CreativeTabs.tabAllSearch) { compound.setInteger("typeId", moaTypeSize); stack.setTagCompound(compound); @@ -104,18 +92,15 @@ public class ItemMoaEgg extends Item } @Override - public boolean getShareTag() - { + public boolean getShareTag() { return true; } @Override - public int getColorFromItemStack(ItemStack stack, int renderPass) - { + public int getColorFromItemStack(ItemStack stack, int renderPass) { NBTTagCompound tag = stack.getTagCompound(); - if (tag != null) - { + if (tag != null) { AetherMoaType moaType = AetherAPI.instance().getMoaType(tag.getInteger("typeId")); return moaType.getMoaEggColor(); @@ -124,12 +109,10 @@ public class ItemMoaEgg extends Item return AetherAPI.instance().getMoaType(0).getMoaEggColor(); } - public AetherMoaType getMoaTypeFromItemStack(ItemStack stack) - { + public AetherMoaType getMoaTypeFromItemStack(ItemStack stack) { NBTTagCompound tag = stack.getTagCompound(); - if (tag != null) - { + if (tag != null) { AetherMoaType moaType = AetherAPI.instance().getMoaType(tag.getInteger("typeId")); return moaType; @@ -139,12 +122,10 @@ public class ItemMoaEgg extends Item } @Override - public String getUnlocalizedName(ItemStack stack) - { + public String getUnlocalizedName(ItemStack stack) { NBTTagCompound tag = stack.getTagCompound(); - if (tag != null && stack.getTagCompound().hasKey("typeId")) - { + if (tag != null && stack.getTagCompound().hasKey("typeId")) { AetherMoaType moaType = AetherAPI.instance().getMoaType(tag.getInteger("typeId")); return "item." + moaType.getRegistryName().getResourcePath().replace(" ", "_").toLowerCase() + "_moa_egg.name"; @@ -154,13 +135,11 @@ public class ItemMoaEgg extends Item } @Override - public String getItemStackDisplayName(ItemStack stack) - { - return super.getItemStackDisplayName(stack).replace(".name", ""); - } + public String getItemStackDisplayName(ItemStack stack) { + return super.getItemStackDisplayName(stack).replace(".name", ""); + } - public static ItemStack getStackFromType(AetherMoaType type) - { + public static ItemStack getStackFromType(AetherMoaType type) { ItemStack stack = new ItemStack(ItemsAether.moa_egg); NBTTagCompound tag = new NBTTagCompound(); diff --git a/src/main/java/com/legacy/aether/items/ItemsAether.java b/src/main/java/com/legacy/aether/items/ItemsAether.java index 3eddd9e..20266f4 100644 --- a/src/main/java/com/legacy/aether/items/ItemsAether.java +++ b/src/main/java/com/legacy/aether/items/ItemsAether.java @@ -52,8 +52,7 @@ import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; import cpw.mods.fml.common.registry.GameRegistry; -public class ItemsAether -{ +public class ItemsAether { public static EnumRarity aether_loot = EnumHelper.addRarity("aether_legacy_loot", EnumChatFormatting.GREEN, "Aether Loot"); @@ -117,8 +116,7 @@ public class ItemsAether public static Item aether_spawn_egg; - public static void initialization() - { + public static void initialization() { zanite_gemstone = register("zanite_gemstone", new ItemAether(AetherCreativeTabs.material).setTextureName(Aether.find("misc/zanite_gemstone"))); ambrosium_shard = register("ambrosium_shard", new ItemAmbrosiumShard().setTextureName(Aether.find("misc/ambrosium_shard"))); golden_amber = register("golden_amber", new ItemAether(AetherCreativeTabs.material).setTextureName(Aether.find("misc/golden_amber"))); @@ -204,7 +202,7 @@ public class ItemsAether flaming_sword = register("flaming_sword", new ItemElementalSword().setTextureName(Aether.find("weapons/flaming_sword"))); lightning_sword = register("lightning_sword", new ItemElementalSword().setTextureName(Aether.find("weapons/lightning_sword"))); - holy_sword = register("holy_sword",new ItemElementalSword().setTextureName(Aether.find("weapons/holy_sword"))); + holy_sword = register("holy_sword", new ItemElementalSword().setTextureName(Aether.find("weapons/holy_sword"))); vampire_blade = register("vampire_blade", new ItemVampireBlade().setTextureName(Aether.find("weapons/vampire_blade"))); pig_slayer = register("pig_slayer", new ItemPigSlayer().setTextureName(Aether.find("weapons/pig_slayer"))); @@ -258,14 +256,13 @@ public class ItemsAether repulsion_shield = register("repulsion_shield", new ItemAccessory(AccessoryType.SHIELD).setTexture("repulsion").setDungeonLoot().setMaxDamage(512).setTextureName(Aether.find("accessories/repulsion_shield"))); lore_book = register("lore_book", new ItemLoreBook().setTextureName(Aether.find("misc/lore_book"))); - + developer_stick = register("developer_stick", new ItemDeveloperStick().setTextureName(Aether.find("skyroot_stick"))); aether_spawn_egg = register("aether_spawn_egg", new ItemAetherSpawnEgg().setTextureName("spawn_egg")); } - public static Item register(String name, Item item) - { + public static Item register(String name, Item item) { item.setUnlocalizedName(name); GameRegistry.registerItem(item, name, Aether.MOD_ID); diff --git a/src/main/java/com/legacy/aether/items/accessories/ItemAccessory.java b/src/main/java/com/legacy/aether/items/accessories/ItemAccessory.java index 0c4ef83..3315243 100644 --- a/src/main/java/com/legacy/aether/items/accessories/ItemAccessory.java +++ b/src/main/java/com/legacy/aether/items/accessories/ItemAccessory.java @@ -28,8 +28,7 @@ import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemAccessory extends Item -{ +public class ItemAccessory extends Item { public static final String ROOT = Aether.modAddress() + "textures/slots/slot_"; @@ -43,136 +42,117 @@ public class ItemAccessory extends Item private boolean isDungeonLoot = false; - public static final IBehaviorDispenseItem DISPENSER_BEHAVIOR = new BehaviorDefaultDispenseItem() - { - protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) - { - ItemStack itemstack = ItemAccessory.dispenseAccessory(source, stack); - return itemstack != null ? itemstack : super.dispenseStack(source, stack); - } - }; + public static final IBehaviorDispenseItem DISPENSER_BEHAVIOR = new BehaviorDefaultDispenseItem() { + protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { + ItemStack itemstack = ItemAccessory.dispenseAccessory(source, stack); + return itemstack != null ? itemstack : super.dispenseStack(source, stack); + } + }; - public ItemAccessory(AccessoryType type) - { + public ItemAccessory(AccessoryType type) { this.accessoryType = type; this.extraType = type == AccessoryType.RING ? AccessoryType.EXTRA_RING : type == AccessoryType.MISC ? AccessoryType.EXTRA_MISC : null; this.texture = Aether.locate("textures/armor/accessory_base.png"); this.setMaxStackSize(1); this.setCreativeTab(AetherCreativeTabs.accessories); - BlockDispenser.dispenseBehaviorRegistry.putObject(this, DISPENSER_BEHAVIOR); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, DISPENSER_BEHAVIOR); } @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister registry) - { - super.registerIcons(registry); + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister registry) { + super.registerIcons(registry); ObjectIntIdentityMap orderedList = AccessoryType.createCompleteList(); - for (int i = 0; i < ClientProxy.ACCESSORY_ICONS.length; ++i) - { - ClientProxy.ACCESSORY_ICONS[i] = registry.registerIcon(Aether.find("slots/" + ((AccessoryType)orderedList.func_148745_a(i)).getDisplayName())); + for (int i = 0; i < ClientProxy.ACCESSORY_ICONS.length; ++i) { + ClientProxy.ACCESSORY_ICONS[i] = registry.registerIcon(Aether.find("slots/" + ((AccessoryType) orderedList.func_148745_a(i)).getDisplayName())); } - } + } - @SuppressWarnings("unchecked") - public static ItemStack dispenseAccessory(IBlockSource blockSource, ItemStack stack) - { - EnumFacing enumfacing = BlockDispenser.func_149937_b(blockSource.getBlockMetadata()); - int i = blockSource.getXInt() + enumfacing.getFrontOffsetX(); - int j = blockSource.getYInt() + enumfacing.getFrontOffsetY(); - int k = blockSource.getZInt() + enumfacing.getFrontOffsetZ(); - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1)); + @SuppressWarnings("unchecked") + public static ItemStack dispenseAccessory(IBlockSource blockSource, ItemStack stack) { + EnumFacing enumfacing = BlockDispenser.func_149937_b(blockSource.getBlockMetadata()); + int i = blockSource.getXInt() + enumfacing.getFrontOffsetX(); + int j = blockSource.getYInt() + enumfacing.getFrontOffsetY(); + int k = blockSource.getZInt() + enumfacing.getFrontOffsetZ(); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1)); List list = blockSource.getWorld().getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb); - if (list.isEmpty()) - { - return null; - } + if (list.isEmpty()) { + return null; + } - EntityPlayer player = (EntityPlayer)list.get(0); + EntityPlayer player = (EntityPlayer) list.get(0); - ItemStack itemstack = stack.copy(); - itemstack.stackSize = 1; + ItemStack itemstack = stack.copy(); + itemstack.stackSize = 1; - PlayerAether playerAether = PlayerAether.get((EntityPlayer) player); + PlayerAether playerAether = PlayerAether.get((EntityPlayer) player); - if (!playerAether.getAccessoryInventory().setAccessorySlot(itemstack)) - { - return null; - } + if (!playerAether.getAccessoryInventory().setAccessorySlot(itemstack)) { + return null; + } - --stack.stackSize; + --stack.stackSize; - return stack; - } + return stack; + } - @Override - public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityPlayer player) - { - ItemStack heldItem = player.getHeldItem(); + @Override + public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityPlayer player) { + ItemStack heldItem = player.getHeldItem(); - if (heldItem != null) - { - if (PlayerAether.get(player).getAccessoryInventory().setAccessorySlot(heldItem.copy())) - { - --heldItem.stackSize; + if (heldItem != null) { + if (PlayerAether.get(player).getAccessoryInventory().setAccessorySlot(heldItem.copy())) { + --heldItem.stackSize; - return heldItem; - } - } + return heldItem; + } + } - return super.onItemRightClick(stack, worldIn, player); - } + return super.onItemRightClick(stack, worldIn, player); + } - public AccessoryType getExtraType() - { + public AccessoryType getExtraType() { return this.extraType; } - public AccessoryType getType() - { + public AccessoryType getType() { return this.accessoryType; } - public Item setColor(int color) - { - this.colorHex = color; - return this; - } + public Item setColor(int color) { + this.colorHex = color; + return this; + } - public int getColor() - { - return this.colorHex; - } + public int getColor() { + return this.colorHex; + } @Override - public EnumRarity getRarity(ItemStack stack) - { - return this.isDungeonLoot ? ItemsAether.aether_loot : super.getRarity(stack); - } + public EnumRarity getRarity(ItemStack stack) { + return this.isDungeonLoot ? ItemsAether.aether_loot : super.getRarity(stack); + } @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int meta) - { - return this.colorHex; - } + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int meta) { + return this.colorHex; + } - public ItemAccessory setDungeonLoot() - { - this.isDungeonLoot = true; + public ItemAccessory setDungeonLoot() { + this.isDungeonLoot = true; - return this; - } + return this; + } - public ItemAccessory setTexture(String location) - { - this.texture = Aether.locate("textures/armor/accessory_" + location + ".png"); + public ItemAccessory setTexture(String location) { + this.texture = Aether.locate("textures/armor/accessory_" + location + ".png"); - return this; - } + return this; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/accessories/ItemAccessoryDyed.java b/src/main/java/com/legacy/aether/items/accessories/ItemAccessoryDyed.java index 7cd574d..fe9d6ee 100644 --- a/src/main/java/com/legacy/aether/items/accessories/ItemAccessoryDyed.java +++ b/src/main/java/com/legacy/aether/items/accessories/ItemAccessoryDyed.java @@ -12,93 +12,78 @@ import com.legacy.aether.api.accessories.AccessoryType; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemAccessoryDyed extends ItemAccessory -{ +public class ItemAccessoryDyed extends ItemAccessory { - public ItemAccessoryDyed(AccessoryType type) - { + public ItemAccessoryDyed(AccessoryType type) { super(type); } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) - { + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = playerIn.getHeldItem(); - if (worldIn.getBlock(x, y, z) == Blocks.cauldron) - { - if (heldItem != null && heldItem.getItem() instanceof ItemAccessoryDyed) - { - int j1 = BlockCauldron.func_150027_b(worldIn.getBlockMetadata(x, y, z)); + if (worldIn.getBlock(x, y, z) == Blocks.cauldron) { + if (heldItem != null && heldItem.getItem() instanceof ItemAccessoryDyed) { + int j1 = BlockCauldron.func_150027_b(worldIn.getBlockMetadata(x, y, z)); - if (j1 > 0) - { - ((ItemAccessoryDyed)heldItem.getItem()).removeColor(heldItem); + if (j1 > 0) { + ((ItemAccessoryDyed) heldItem.getItem()).removeColor(heldItem); - Blocks.cauldron.func_150024_a(worldIn, x, y, z, j1 - 1); + Blocks.cauldron.func_150024_a(worldIn, x, y, z, j1 - 1); - return true; - } - } - } + return true; + } + } + } - return super.onItemUse(stack, playerIn, worldIn, x, y, z, facing, hitX, hitY, hitZ); - } + return super.onItemUse(stack, playerIn, worldIn, x, y, z, facing, hitX, hitY, hitZ); + } - public int getStackColor(ItemStack stack, int meta) - { - NBTTagCompound nbttagcompound = stack.getTagCompound(); + public int getStackColor(ItemStack stack, int meta) { + NBTTagCompound nbttagcompound = stack.getTagCompound(); - if (nbttagcompound == null) - { - return super.getColor(); - } + if (nbttagcompound == null) { + return super.getColor(); + } - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); - return nbttagcompound1 == null ? super.getColor() : (nbttagcompound1.hasKey("color", 3) ? nbttagcompound1.getInteger("color") : super.getColor()); + return nbttagcompound1 == null ? super.getColor() : (nbttagcompound1.hasKey("color", 3) ? nbttagcompound1.getInteger("color") : super.getColor()); } @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int meta) - { + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int meta) { return this.getStackColor(stack, meta); - } + } - public void removeColor(ItemStack stack) - { - NBTTagCompound nbttagcompound = stack.getTagCompound(); + public void removeColor(ItemStack stack) { + NBTTagCompound nbttagcompound = stack.getTagCompound(); - if (nbttagcompound != null) - { - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); + if (nbttagcompound != null) { + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); - if (nbttagcompound1.hasKey("color")) - { - nbttagcompound1.removeTag("color"); - } - } - } + if (nbttagcompound1.hasKey("color")) { + nbttagcompound1.removeTag("color"); + } + } + } - public void setColorTag(ItemStack stack, int color) - { - NBTTagCompound nbttagcompound = stack.getTagCompound(); + public void setColorTag(ItemStack stack, int color) { + NBTTagCompound nbttagcompound = stack.getTagCompound(); - if (nbttagcompound == null) - { - nbttagcompound = new NBTTagCompound(); - stack.setTagCompound(nbttagcompound); - } + if (nbttagcompound == null) { + nbttagcompound = new NBTTagCompound(); + stack.setTagCompound(nbttagcompound); + } - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); - if (!nbttagcompound.hasKey("display", 10)) - { - nbttagcompound.setTag("display", nbttagcompound1); - } + if (!nbttagcompound.hasKey("display", 10)) { + nbttagcompound.setTag("display", nbttagcompound1); + } - nbttagcompound1.setInteger("color", color); - } + nbttagcompound1.setInteger("color", color); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/armor/ItemAetherArmor.java b/src/main/java/com/legacy/aether/items/armor/ItemAetherArmor.java index ef2d85c..0016ad2 100644 --- a/src/main/java/com/legacy/aether/items/armor/ItemAetherArmor.java +++ b/src/main/java/com/legacy/aether/items/armor/ItemAetherArmor.java @@ -10,10 +10,9 @@ import com.legacy.aether.Aether; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemAetherArmor extends ItemArmor -{ +public class ItemAetherArmor extends ItemArmor { - private String[] defualt_location = new String[] {"textures/models/armor/iron_layer_1.png", "textures/models/armor/iron_layer_2.png"}; + private String[] defualt_location = new String[]{"textures/models/armor/iron_layer_1.png", "textures/models/armor/iron_layer_2.png"}; public boolean shouldDefualt = false; @@ -23,8 +22,7 @@ public class ItemAetherArmor extends ItemArmor private Item source = null; - public ItemAetherArmor(int armorType, ArmorMaterial material, String name, Item repair) - { + public ItemAetherArmor(int armorType, ArmorMaterial material, String name, Item repair) { super(material, 0, armorType); this.source = repair; @@ -32,8 +30,7 @@ public class ItemAetherArmor extends ItemArmor this.setCreativeTab(AetherCreativeTabs.armor); } - public ItemAetherArmor(int armorType, ArmorMaterial material, String name, Item repair, int hex) - { + public ItemAetherArmor(int armorType, ArmorMaterial material, String name, Item repair, int hex) { this(armorType, material, name, repair); this.source = repair; @@ -42,36 +39,31 @@ public class ItemAetherArmor extends ItemArmor this.shouldDefualt = true; } - @Override - public int getColor(ItemStack stack) - { - return this.colorization; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int renderPass) - { - return this.colorization != -1 ? this.colorization : 16777215; - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - boolean leggings = this.getUnlocalizedName().contains("leggings"); - String type1 = leggings ? "layer_2" : "layer_1"; - - return this.shouldDefualt ? (leggings ? defualt_location[1] : defualt_location[0]) : Aether.modAddress() + "textures/armor/" + this.armorName + "_" + type1 + ".png"; - } - - @Override - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { - return this.source == null ? false : repair.getItem() == this.source; + @Override + public int getColor(ItemStack stack) { + return this.colorization; } @Override - public EnumRarity getRarity(ItemStack stack) - { - return !this.armorName.contains("zanite") && !this.armorName.contains("gravitite")? ItemsAether.aether_loot : super.getRarity(stack); - } + public int getColorFromItemStack(ItemStack stack, int renderPass) { + return this.colorization != -1 ? this.colorization : 16777215; + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + boolean leggings = this.getUnlocalizedName().contains("leggings"); + String type1 = leggings ? "layer_2" : "layer_1"; + + return this.shouldDefualt ? (leggings ? defualt_location[1] : defualt_location[0]) : Aether.modAddress() + "textures/armor/" + this.armorName + "_" + type1 + ".png"; + } + + @Override + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { + return this.source == null ? false : repair.getItem() == this.source; + } + + @Override + public EnumRarity getRarity(ItemStack stack) { + return !this.armorName.contains("zanite") && !this.armorName.contains("gravitite") ? ItemsAether.aether_loot : super.getRarity(stack); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/armor/ItemZaniteArmor.java b/src/main/java/com/legacy/aether/items/armor/ItemZaniteArmor.java index 50d86a1..a6bd11e 100644 --- a/src/main/java/com/legacy/aether/items/armor/ItemZaniteArmor.java +++ b/src/main/java/com/legacy/aether/items/armor/ItemZaniteArmor.java @@ -7,103 +7,92 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraftforge.common.ISpecialArmor; -public class ItemZaniteArmor extends ItemAetherArmor implements ISpecialArmor -{ +public class ItemZaniteArmor extends ItemAetherArmor implements ISpecialArmor { - private final int[][] damageReductionAmountArray = new int[][] { new int[]{1, 2, 3, 1}, new int[]{1, 4, 5, 2}, new int[]{2, 5, 6, 2}, new int[]{3, 6, 8, 3}, new int[] {4, 8, 10, 4} }; + private final int[][] damageReductionAmountArray = new int[][]{new int[]{1, 2, 3, 1}, new int[]{1, 4, 5, 2}, new int[]{2, 5, 6, 2}, new int[]{3, 6, 8, 3}, new int[]{4, 8, 10, 4}}; - public ItemZaniteArmor(int armorType, ArmorMaterial material, String name, Item repair, int hex) - { + public ItemZaniteArmor(int armorType, ArmorMaterial material, String name, Item repair, int hex) { super(armorType, material, name, repair, hex); } @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) - { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { return new ArmorProperties(0, this.calculateIncrease(armor) / 25D, Integer.MAX_VALUE); } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) - { + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return (int) this.calculateIncrease(armor); } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) - { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { stack.damageItem(damage, entity); - } + } - private float calculateIncrease(ItemStack tool) - { - if (this.armorType == 0) - { - if (isBetween(tool, 0, 32)) - { return this.getDamageReductionAmount(4); } - else if (isBetween(tool, 33, 65)) - { return this.getDamageReductionAmount(3); } - else if (isBetween(tool, 66, 98)) - { return this.getDamageReductionAmount(2); } - else if (isBetween(tool, 99, 131)) - { return this.getDamageReductionAmount(1); } - else if (isBetween(tool, 132, 165)) - { return this.getDamageReductionAmount(0); } - } - else if (this.armorType == 1) - { - if (isBetween(tool, 0, 47)) - { return this.getDamageReductionAmount(4); } - else if (isBetween(tool, 48, 95)) - { return this.getDamageReductionAmount(3); } - else if (isBetween(tool, 96, 143)) - { return this.getDamageReductionAmount(2); } - else if (isBetween(tool, 144, 191)) - { return this.getDamageReductionAmount(1); } - else if (isBetween(tool, 192, 240)) - { return this.getDamageReductionAmount(0); } - } - else if (this.armorType == 2) - { - if (isBetween(tool, 0, 44)) - { return this.getDamageReductionAmount(4); } - else if (isBetween(tool, 45, 89)) - { return this.getDamageReductionAmount(3); } - else if (isBetween(tool, 90, 134)) - { return this.getDamageReductionAmount(2); } - else if (isBetween(tool, 135, 179)) - { return this.getDamageReductionAmount(1); } - else if (isBetween(tool, 180, 225)) - { return this.getDamageReductionAmount(0); } - } - else if (this.armorType == 3) - { - if (isBetween(tool, 0, 38)) - { return this.getDamageReductionAmount(4); } - else if (isBetween(tool, 39, 77)) - { return this.getDamageReductionAmount(3); } - else if (isBetween(tool, 78, 116)) - { return this.getDamageReductionAmount(2); } - else if (isBetween(tool, 117, 155)) - { return this.getDamageReductionAmount(1); } - else if (isBetween(tool, 156, 195)) - { return this.getDamageReductionAmount(0); } - } + private float calculateIncrease(ItemStack tool) { + if (this.armorType == 0) { + if (isBetween(tool, 0, 32)) { + return this.getDamageReductionAmount(4); + } else if (isBetween(tool, 33, 65)) { + return this.getDamageReductionAmount(3); + } else if (isBetween(tool, 66, 98)) { + return this.getDamageReductionAmount(2); + } else if (isBetween(tool, 99, 131)) { + return this.getDamageReductionAmount(1); + } else if (isBetween(tool, 132, 165)) { + return this.getDamageReductionAmount(0); + } + } else if (this.armorType == 1) { + if (isBetween(tool, 0, 47)) { + return this.getDamageReductionAmount(4); + } else if (isBetween(tool, 48, 95)) { + return this.getDamageReductionAmount(3); + } else if (isBetween(tool, 96, 143)) { + return this.getDamageReductionAmount(2); + } else if (isBetween(tool, 144, 191)) { + return this.getDamageReductionAmount(1); + } else if (isBetween(tool, 192, 240)) { + return this.getDamageReductionAmount(0); + } + } else if (this.armorType == 2) { + if (isBetween(tool, 0, 44)) { + return this.getDamageReductionAmount(4); + } else if (isBetween(tool, 45, 89)) { + return this.getDamageReductionAmount(3); + } else if (isBetween(tool, 90, 134)) { + return this.getDamageReductionAmount(2); + } else if (isBetween(tool, 135, 179)) { + return this.getDamageReductionAmount(1); + } else if (isBetween(tool, 180, 225)) { + return this.getDamageReductionAmount(0); + } + } else if (this.armorType == 3) { + if (isBetween(tool, 0, 38)) { + return this.getDamageReductionAmount(4); + } else if (isBetween(tool, 39, 77)) { + return this.getDamageReductionAmount(3); + } else if (isBetween(tool, 78, 116)) { + return this.getDamageReductionAmount(2); + } else if (isBetween(tool, 117, 155)) { + return this.getDamageReductionAmount(1); + } else if (isBetween(tool, 156, 195)) { + return this.getDamageReductionAmount(0); + } + } - return 0.0F; - } + return 0.0F; + } - public boolean isBetween(ItemStack tool, int max, int min) - { - int origin = tool.getItemDamage(); - int maxDamage = tool.getMaxDamage(); + public boolean isBetween(ItemStack tool, int max, int min) { + int origin = tool.getItemDamage(); + int maxDamage = tool.getMaxDamage(); - return origin <= maxDamage - max && origin >= maxDamage - min ? true : false; - } + return origin <= maxDamage - max && origin >= maxDamage - min ? true : false; + } - public int getDamageReductionAmount(int level) - { - return this.damageReductionAmountArray[level][this.armorType]; - } + public int getDamageReductionAmount(int level) { + return this.damageReductionAmountArray[level][this.armorType]; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/block/IColoredBlock.java b/src/main/java/com/legacy/aether/items/block/IColoredBlock.java index 7f838fd..93df367 100644 --- a/src/main/java/com/legacy/aether/items/block/IColoredBlock.java +++ b/src/main/java/com/legacy/aether/items/block/IColoredBlock.java @@ -2,9 +2,8 @@ package com.legacy.aether.items.block; import net.minecraft.item.ItemStack; -public interface IColoredBlock -{ +public interface IColoredBlock { - public int getColorFromItemStack(ItemStack stack, int pass); + public int getColorFromItemStack(ItemStack stack, int pass); } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/block/INamedBlock.java b/src/main/java/com/legacy/aether/items/block/INamedBlock.java index 61f6cd9..8a1e900 100644 --- a/src/main/java/com/legacy/aether/items/block/INamedBlock.java +++ b/src/main/java/com/legacy/aether/items/block/INamedBlock.java @@ -2,9 +2,8 @@ package com.legacy.aether.items.block; import net.minecraft.item.ItemStack; -public interface INamedBlock -{ +public interface INamedBlock { - public String getUnlocalizedName(ItemStack stack); + public String getUnlocalizedName(ItemStack stack); } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/block/ItemAetherSlab.java b/src/main/java/com/legacy/aether/items/block/ItemAetherSlab.java index c188161..90e9c20 100644 --- a/src/main/java/com/legacy/aether/items/block/ItemAetherSlab.java +++ b/src/main/java/com/legacy/aether/items/block/ItemAetherSlab.java @@ -2,11 +2,9 @@ package com.legacy.aether.items.block; import net.minecraft.item.ItemSlab; -public class ItemAetherSlab extends ItemSlab -{ +public class ItemAetherSlab extends ItemSlab { - public ItemAetherSlab(net.minecraft.block.Block p_i45355_1_, com.legacy.aether.blocks.decorative.BlockAetherSlab p_i45355_2_, com.legacy.aether.blocks.decorative.BlockAetherSlab p_i45355_3_, java.lang.Boolean p_i45355_4_) - { + public ItemAetherSlab(net.minecraft.block.Block p_i45355_1_, com.legacy.aether.blocks.decorative.BlockAetherSlab p_i45355_2_, com.legacy.aether.blocks.decorative.BlockAetherSlab p_i45355_3_, java.lang.Boolean p_i45355_4_) { super(p_i45355_1_, p_i45355_2_, p_i45355_3_, p_i45355_4_); } diff --git a/src/main/java/com/legacy/aether/items/block/ItemBlockMetadata.java b/src/main/java/com/legacy/aether/items/block/ItemBlockMetadata.java index f1b7471..f62be30 100644 --- a/src/main/java/com/legacy/aether/items/block/ItemBlockMetadata.java +++ b/src/main/java/com/legacy/aether/items/block/ItemBlockMetadata.java @@ -6,47 +6,40 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemBlockMetadata extends ItemBlock -{ +public class ItemBlockMetadata extends ItemBlock { - public ItemBlockMetadata(Block block) - { + public ItemBlockMetadata(Block block) { super(block); this.setHasSubtypes(true); } @Override - public int getMetadata(int meta) - { - return meta; - } + public int getMetadata(int meta) { + return meta; + } - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) - { - Block block = Block.getBlockFromItem(stack.getItem()); + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int pass) { + Block block = Block.getBlockFromItem(stack.getItem()); - if (block instanceof IColoredBlock) - { - return ((IColoredBlock)block).getColorFromItemStack(stack, pass); - } + if (block instanceof IColoredBlock) { + return ((IColoredBlock) block).getColorFromItemStack(stack, pass); + } - return super.getColorFromItemStack(stack, pass); - } + return super.getColorFromItemStack(stack, pass); + } - @Override - public String getUnlocalizedName(ItemStack stack) - { - Block block = Block.getBlockFromItem(stack.getItem()); + @Override + public String getUnlocalizedName(ItemStack stack) { + Block block = Block.getBlockFromItem(stack.getItem()); - if (block instanceof INamedBlock) - { - return "tile." + ((INamedBlock)block).getUnlocalizedName(stack); - } + if (block instanceof INamedBlock) { + return "tile." + ((INamedBlock) block).getUnlocalizedName(stack); + } - return super.getUnlocalizedName(stack); - } + return super.getUnlocalizedName(stack); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/dungeon/ItemDungeonKey.java b/src/main/java/com/legacy/aether/items/dungeon/ItemDungeonKey.java index 8869de3..c79d544 100644 --- a/src/main/java/com/legacy/aether/items/dungeon/ItemDungeonKey.java +++ b/src/main/java/com/legacy/aether/items/dungeon/ItemDungeonKey.java @@ -17,20 +17,18 @@ import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemDungeonKey extends Item -{ +public class ItemDungeonKey extends Item { - @SideOnly(Side.CLIENT) - private IIcon bronzeIcon; + @SideOnly(Side.CLIENT) + private IIcon bronzeIcon; - @SideOnly(Side.CLIENT) - private IIcon silverIcon; + @SideOnly(Side.CLIENT) + private IIcon silverIcon; - @SideOnly(Side.CLIENT) - private IIcon goldenIcon; + @SideOnly(Side.CLIENT) + private IIcon goldenIcon; - public ItemDungeonKey() - { + public ItemDungeonKey() { super(); this.setMaxStackSize(1); @@ -39,40 +37,34 @@ public class ItemDungeonKey extends Item } @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister registry) - { - this.bronzeIcon = registry.registerIcon(Aether.find("misc/keys/bronze_key")); - this.silverIcon = registry.registerIcon(Aether.find("misc/keys/silver_key")); - this.goldenIcon = registry.registerIcon(Aether.find("misc/keys/golden_key")); - } + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister registry) { + this.bronzeIcon = registry.registerIcon(Aether.find("misc/keys/bronze_key")); + this.silverIcon = registry.registerIcon(Aether.find("misc/keys/silver_key")); + this.goldenIcon = registry.registerIcon(Aether.find("misc/keys/golden_key")); + } @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { - return meta == 1 ? this.silverIcon : meta == 2 ? this.goldenIcon : this.bronzeIcon; - } + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return meta == 1 ? this.silverIcon : meta == 2 ? this.goldenIcon : this.bronzeIcon; + } @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubItems(Item item, CreativeTabs tab, List subItems) - { - for (int meta = 0; meta < EnumDungeonKeyType.values().length; ++meta) - { - subItems.add(new ItemStack(this, 1, meta)); - } - } + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubItems(Item item, CreativeTabs tab, List subItems) { + for (int meta = 0; meta < EnumDungeonKeyType.values().length; ++meta) { + subItems.add(new ItemStack(this, 1, meta)); + } + } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } @Override - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { int meta = itemstack.getItemDamage(); return this.getUnlocalizedName() + "_" + EnumDungeonKeyType.getType(meta).toString(); diff --git a/src/main/java/com/legacy/aether/items/dungeon/ItemVictoryMedal.java b/src/main/java/com/legacy/aether/items/dungeon/ItemVictoryMedal.java index 106d417..981a2e6 100644 --- a/src/main/java/com/legacy/aether/items/dungeon/ItemVictoryMedal.java +++ b/src/main/java/com/legacy/aether/items/dungeon/ItemVictoryMedal.java @@ -7,11 +7,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class ItemVictoryMedal extends Item -{ +public class ItemVictoryMedal extends Item { - public ItemVictoryMedal() - { + public ItemVictoryMedal() { super(); this.setMaxStackSize(10); @@ -19,9 +17,8 @@ public class ItemVictoryMedal extends Item } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/food/ItemAetherFood.java b/src/main/java/com/legacy/aether/items/food/ItemAetherFood.java index a6ddb09..397d08b 100644 --- a/src/main/java/com/legacy/aether/items/food/ItemAetherFood.java +++ b/src/main/java/com/legacy/aether/items/food/ItemAetherFood.java @@ -4,16 +4,13 @@ import net.minecraft.item.ItemFood; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemAetherFood extends ItemFood -{ - public ItemAetherFood(int healAmmount) - { +public class ItemAetherFood extends ItemFood { + public ItemAetherFood(int healAmmount) { super(healAmmount, false); this.setCreativeTab(AetherCreativeTabs.food); } - public ItemAetherFood(int healAmmount, float saturationAmmount) - { + public ItemAetherFood(int healAmmount, float saturationAmmount) { super(healAmmount, saturationAmmount, false); this.setCreativeTab(AetherCreativeTabs.food); } diff --git a/src/main/java/com/legacy/aether/items/food/ItemAmbrosiumShard.java b/src/main/java/com/legacy/aether/items/food/ItemAmbrosiumShard.java index 2756d8e..3a78b26 100644 --- a/src/main/java/com/legacy/aether/items/food/ItemAmbrosiumShard.java +++ b/src/main/java/com/legacy/aether/items/food/ItemAmbrosiumShard.java @@ -8,53 +8,45 @@ import net.minecraft.world.World; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemAmbrosiumShard extends Item -{ +public class ItemAmbrosiumShard extends Item { - public ItemAmbrosiumShard() - { + public ItemAmbrosiumShard() { this.setCreativeTab(AetherCreativeTabs.material); } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) - { + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = playerIn.getHeldItem(); - if (worldIn.getBlock(x, y, z) == BlocksAether.aether_grass) - { - if (!playerIn.capabilities.isCreativeMode) - { - --heldItem.stackSize; - } + if (worldIn.getBlock(x, y, z) == BlocksAether.aether_grass) { + if (!playerIn.capabilities.isCreativeMode) { + --heldItem.stackSize; + } - worldIn.setBlock(x, y, z, BlocksAether.enchanted_aether_grass); + worldIn.setBlock(x, y, z, BlocksAether.enchanted_aether_grass); - return true; - } + return true; + } - return true; - } + return true; + } @Override - public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn) - { + public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn) { ItemStack heldItem = playerIn.getHeldItem(); - if (playerIn.shouldHeal()) - { - if (!playerIn.capabilities.isCreativeMode) - { - --heldItem.stackSize; - } + if (playerIn.shouldHeal()) { + if (!playerIn.capabilities.isCreativeMode) { + --heldItem.stackSize; + } - playerIn.heal(2F); - playerIn.getFoodStats().addStats(1, 0.5F); + playerIn.heal(2F); + playerIn.getFoodStats().addStats(1, 0.5F); - return heldItem; - } + return heldItem; + } - return super.onItemRightClick(stack, worldIn, playerIn); - } + return super.onItemRightClick(stack, worldIn, playerIn); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/food/ItemGummySwet.java b/src/main/java/com/legacy/aether/items/food/ItemGummySwet.java index 2ed4598..2d11210 100644 --- a/src/main/java/com/legacy/aether/items/food/ItemGummySwet.java +++ b/src/main/java/com/legacy/aether/items/food/ItemGummySwet.java @@ -16,14 +16,12 @@ import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemGummySwet extends ItemAetherFood -{ +public class ItemGummySwet extends ItemAetherFood { - @SideOnly(Side.CLIENT) - private IIcon alternativeIcon; + @SideOnly(Side.CLIENT) + private IIcon alternativeIcon; - public ItemGummySwet() - { + public ItemGummySwet() { super(20); this.setHasSubtypes(true); @@ -31,51 +29,45 @@ public class ItemGummySwet extends ItemAetherFood this.setTextureName(Aether.find("food/golden_gummy_swet")); } - @Override - public String getUnlocalizedName(ItemStack stack) - { - String type = stack.getItemDamage() == 0 ? "blue" : "golden"; + @Override + public String getUnlocalizedName(ItemStack stack) { + String type = stack.getItemDamage() == 0 ? "blue" : "golden"; - return "item.gummy_swet_" + type; - } + return "item.gummy_swet_" + type; + } @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister registry) - { - super.registerIcons(registry); + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister registry) { + super.registerIcons(registry); - this.alternativeIcon = registry.registerIcon(Aether.find("food/blue_gummy_swet")); - } + this.alternativeIcon = registry.registerIcon(Aether.find("food/blue_gummy_swet")); + } @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { - return meta == 1 ? this.itemIcon : this.alternativeIcon; - } + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return meta == 1 ? this.itemIcon : this.alternativeIcon; + } @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubItems(Item item, CreativeTabs tab, List subItems) - { + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubItems(Item item, CreativeTabs tab, List subItems) { subItems.add(new ItemStack(this, 1, 0)); subItems.add(new ItemStack(this, 1, 1)); - } + } @Override - public ItemStack onItemRightClick(ItemStack stackIn, World worldIn, EntityPlayer playerIn) - { + public ItemStack onItemRightClick(ItemStack stackIn, World worldIn, EntityPlayer playerIn) { ItemStack heldItem = playerIn.getHeldItem(); - playerIn.heal(playerIn.getMaxHealth()); + playerIn.heal(playerIn.getMaxHealth()); - if (!playerIn.capabilities.isCreativeMode) - { - --heldItem.stackSize; - } + if (!playerIn.capabilities.isCreativeMode) { + --heldItem.stackSize; + } - return heldItem; - } + return heldItem; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/food/ItemHealingStone.java b/src/main/java/com/legacy/aether/items/food/ItemHealingStone.java index c12e162..2f639ef 100644 --- a/src/main/java/com/legacy/aether/items/food/ItemHealingStone.java +++ b/src/main/java/com/legacy/aether/items/food/ItemHealingStone.java @@ -7,32 +7,27 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -public class ItemHealingStone extends ItemAetherFood -{ +public class ItemHealingStone extends ItemAetherFood { - public ItemHealingStone() - { + public ItemHealingStone() { super(0); this.setAlwaysEdible(); } @Override - public EnumRarity getRarity(ItemStack stack) - { - return EnumRarity.rare; - } + public EnumRarity getRarity(ItemStack stack) { + return EnumRarity.rare; + } @Override - public boolean hasEffect(ItemStack stack, int pass) - { - return true; - } + public boolean hasEffect(ItemStack stack, int pass) { + return true; + } @Override - protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) - { - player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 610, 0)); - } + protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 610, 0)); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/food/ItemLifeShard.java b/src/main/java/com/legacy/aether/items/food/ItemLifeShard.java index 3a25e0b..6571d77 100644 --- a/src/main/java/com/legacy/aether/items/food/ItemLifeShard.java +++ b/src/main/java/com/legacy/aether/items/food/ItemLifeShard.java @@ -11,35 +11,29 @@ import com.legacy.aether.items.ItemsAether; import com.legacy.aether.player.PlayerAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemLifeShard extends Item -{ +public class ItemLifeShard extends Item { - public ItemLifeShard() - { + public ItemLifeShard() { super(); this.setMaxStackSize(1); this.setCreativeTab(AetherCreativeTabs.misc); } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } @Override - public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityPlayer player) - { + public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityPlayer player) { PlayerAether playerAether = PlayerAether.get(player); ItemStack heldItem = player.getHeldItem(); - if (worldIn.isRemote) - { + if (worldIn.isRemote) { return heldItem; } - if (playerAether.getShardsUsed() < playerAether.getMaxShardCount()) - { + if (playerAether.getShardsUsed() < playerAether.getMaxShardCount()) { playerAether.updateShardCount(playerAether.getShardsUsed() + 1); --heldItem.stackSize; diff --git a/src/main/java/com/legacy/aether/items/food/ItemWhiteApple.java b/src/main/java/com/legacy/aether/items/food/ItemWhiteApple.java index 5ed68a0..e3c65dc 100644 --- a/src/main/java/com/legacy/aether/items/food/ItemWhiteApple.java +++ b/src/main/java/com/legacy/aether/items/food/ItemWhiteApple.java @@ -6,20 +6,17 @@ import net.minecraft.world.World; import com.legacy.aether.player.PlayerAether; -public class ItemWhiteApple extends ItemAetherFood -{ +public class ItemWhiteApple extends ItemAetherFood { - public ItemWhiteApple() - { + public ItemWhiteApple() { super(0); this.setAlwaysEdible(); } @Override - protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) - { - PlayerAether.get(player).inflictCure(300); - } + protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { + PlayerAether.get(player).inflictCure(300); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/staffs/ItemCloudStaff.java b/src/main/java/com/legacy/aether/items/staffs/ItemCloudStaff.java index 4697c7d..5dc1095 100644 --- a/src/main/java/com/legacy/aether/items/staffs/ItemCloudStaff.java +++ b/src/main/java/com/legacy/aether/items/staffs/ItemCloudStaff.java @@ -11,11 +11,9 @@ import com.legacy.aether.items.ItemsAether; import com.legacy.aether.player.PlayerAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemCloudStaff extends Item -{ +public class ItemCloudStaff extends Item { - public ItemCloudStaff() - { + public ItemCloudStaff() { this.setFull3D(); this.setMaxDamage(60); this.setMaxStackSize(1); @@ -23,23 +21,19 @@ public class ItemCloudStaff extends Item } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer entityplayer) - { + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer entityplayer) { PlayerAether playerAether = PlayerAether.get(entityplayer); - if (world.isRemote) - { + if (world.isRemote) { return super.onItemRightClick(stack, world, entityplayer); } - if (playerAether.clouds.isEmpty()) - { + if (playerAether.clouds.isEmpty()) { EntityMiniCloud leftCloud = new EntityMiniCloud(world, entityplayer, 0); EntityMiniCloud rightCloud = new EntityMiniCloud(world, entityplayer, 1); @@ -52,7 +46,7 @@ public class ItemCloudStaff extends Item stack.damageItem(1, entityplayer); } - return stack; - } + return stack; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/staffs/ItemNatureStaff.java b/src/main/java/com/legacy/aether/items/staffs/ItemNatureStaff.java index 364a617..080bd07 100644 --- a/src/main/java/com/legacy/aether/items/staffs/ItemNatureStaff.java +++ b/src/main/java/com/legacy/aether/items/staffs/ItemNatureStaff.java @@ -4,11 +4,9 @@ import net.minecraft.item.Item; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemNatureStaff extends Item -{ +public class ItemNatureStaff extends Item { - public ItemNatureStaff() - { + public ItemNatureStaff() { this.setFull3D(); this.setMaxDamage(100); this.setMaxStackSize(1); diff --git a/src/main/java/com/legacy/aether/items/tools/ItemAetherParachute.java b/src/main/java/com/legacy/aether/items/tools/ItemAetherParachute.java index ef82b45..a13f61f 100644 --- a/src/main/java/com/legacy/aether/items/tools/ItemAetherParachute.java +++ b/src/main/java/com/legacy/aether/items/tools/ItemAetherParachute.java @@ -9,42 +9,34 @@ import com.legacy.aether.entities.passive.mountable.EntityParachute; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemAetherParachute extends Item -{ +public class ItemAetherParachute extends Item { - public ItemAetherParachute() - { + public ItemAetherParachute() { this.setMaxDamage(20); this.setMaxStackSize(1); this.setCreativeTab(AetherCreativeTabs.misc); - } + } - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer entityplayer) - { - ItemStack heldItem = entityplayer.getHeldItem(); + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer entityplayer) { + ItemStack heldItem = entityplayer.getHeldItem(); - if(EntityParachute.entityHasRoomForCloud(world, entityplayer)) - { - if(this == ItemsAether.golden_parachute) - { + if (EntityParachute.entityHasRoomForCloud(world, entityplayer)) { + if (this == ItemsAether.golden_parachute) { heldItem.damageItem(1, entityplayer); - } - else - { + } else { --heldItem.stackSize; } world.spawnEntityInWorld(new EntityParachute(world, entityplayer, this == ItemsAether.golden_parachute)); - return heldItem; - } + return heldItem; + } - return super.onItemRightClick(stack, world, entityplayer); - } + return super.onItemRightClick(stack, world, entityplayer); + } - public int getColorFromItemStack(ItemStack stack, int renderPass) - { - if(this == ItemsAether.golden_parachute) return 0xffff7f; + public int getColorFromItemStack(ItemStack stack, int renderPass) { + if (this == ItemsAether.golden_parachute) return 0xffff7f; return 0xffffff; } diff --git a/src/main/java/com/legacy/aether/items/tools/ItemAetherTool.java b/src/main/java/com/legacy/aether/items/tools/ItemAetherTool.java index c0be003..56e90f0 100644 --- a/src/main/java/com/legacy/aether/items/tools/ItemAetherTool.java +++ b/src/main/java/com/legacy/aether/items/tools/ItemAetherTool.java @@ -13,12 +13,11 @@ import com.google.common.collect.Multimap; import com.legacy.aether.items.util.EnumAetherToolType; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public abstract class ItemAetherTool extends ItemTool -{ +public abstract class ItemAetherTool extends ItemTool { - private static final float[] ATTACK_DAMAGES = new float[] {6.0F, 8.0F, 8.0F, 8.0F, 6.0F}; + private static final float[] ATTACK_DAMAGES = new float[]{6.0F, 8.0F, 8.0F, 8.0F, 6.0F}; - private float attackDamage; + private float attackDamage; private String toolClass; @@ -26,80 +25,66 @@ public abstract class ItemAetherTool extends ItemTool public EnumAetherToolType toolType; - public ItemAetherTool(ToolMaterial toolMaterial, EnumAetherToolType toolType) - { + public ItemAetherTool(ToolMaterial toolMaterial, EnumAetherToolType toolType) { super(1.0F, toolMaterial, toolType.getToolBlockSet()); this.toolType = toolType; - - if (toolType == EnumAetherToolType.PICKAXE) - { - this.toolClass = "pickaxe"; - this.attackDamage = 1.0F + toolMaterial.getDamageVsEntity(); - } - else if (toolType == EnumAetherToolType.AXE) - { - this.toolClass = "axe"; - this.attackDamage = ATTACK_DAMAGES[toolMaterial.ordinal()] + toolMaterial.getDamageVsEntity(); - } - else if (toolType == EnumAetherToolType.SHOVEL) - { - this.toolClass = "shovel"; - this.attackDamage = 1.5F + toolMaterial.getDamageVsEntity(); - } - this.setCreativeTab(AetherCreativeTabs.tools); + if (toolType == EnumAetherToolType.PICKAXE) { + this.toolClass = "pickaxe"; + this.attackDamage = 1.0F + toolMaterial.getDamageVsEntity(); + } else if (toolType == EnumAetherToolType.AXE) { + this.toolClass = "axe"; + this.attackDamage = ATTACK_DAMAGES[toolMaterial.ordinal()] + toolMaterial.getDamageVsEntity(); + } else if (toolType == EnumAetherToolType.SHOVEL) { + this.toolClass = "shovel"; + this.attackDamage = 1.5F + toolMaterial.getDamageVsEntity(); + } + + this.setCreativeTab(AetherCreativeTabs.tools); } @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - int level = super.getHarvestLevel(stack, toolClass); + public int getHarvestLevel(ItemStack stack, String toolClass) { + int level = super.getHarvestLevel(stack, toolClass); - if (level == -1 && toolClass != null && toolClass.equals(this.toolClass)) - { - return this.toolMaterial.getHarvestLevel(); - } + if (level == -1 && toolClass != null && toolClass.equals(this.toolClass)) { + return this.toolMaterial.getHarvestLevel(); + } - return level; - } + return level; + } @Override - public boolean canHarvestBlock(Block block, ItemStack stack) - { + public boolean canHarvestBlock(Block block, ItemStack stack) { return this.toolType.canHarvestBlock(this.toolMaterial, block); } @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - for (String type : getToolClasses(stack)) - { - if (block.isToolEffective(type, meta)) - return this.efficiencyOnProperMaterial; - } + public float getDigSpeed(ItemStack stack, Block block, int meta) { + for (String type : getToolClasses(stack)) { + if (block.isToolEffective(type, meta)) + return this.efficiencyOnProperMaterial; + } return this.toolType.getStrVsBlock(stack, block) == 4.0F ? this.efficiencyOnProperMaterial : 1.0F; } - @Override - public Set getToolClasses(ItemStack stack) - { - return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); - } + @Override + public Set getToolClasses(ItemStack stack) { + return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); + } @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Multimap getItemAttributeModifiers() - { - Multimap multimap = super.getItemAttributeModifiers(); - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.attackDamage, 0)); - return multimap; - } + @SuppressWarnings({"unchecked", "rawtypes"}) + public Multimap getItemAttributeModifiers() { + Multimap multimap = super.getItemAttributeModifiers(); + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", (double) this.attackDamage, 0)); + return multimap; + } - public float getEffectiveSpeed() - { - return this.efficiencyOnProperMaterial; - } + public float getEffectiveSpeed() { + return this.efficiencyOnProperMaterial; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/tools/ItemGravititeTool.java b/src/main/java/com/legacy/aether/items/tools/ItemGravititeTool.java index 1d60142..199c7ac 100644 --- a/src/main/java/com/legacy/aether/items/tools/ItemGravititeTool.java +++ b/src/main/java/com/legacy/aether/items/tools/ItemGravititeTool.java @@ -11,44 +11,37 @@ import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.entities.block.EntityFloatingBlock; import com.legacy.aether.items.util.EnumAetherToolType; -public class ItemGravititeTool extends ItemAetherTool -{ +public class ItemGravititeTool extends ItemAetherTool { - public ItemGravititeTool(EnumAetherToolType toolType) - { + public ItemGravititeTool(EnumAetherToolType toolType) { super(ToolMaterial.EMERALD, toolType); } @Override - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.getItem() == Item.getItemFromBlock(BlocksAether.enchanted_gravitite); } @Override - public boolean onItemUse(ItemStack heldItem, EntityPlayer player, World world, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) - { + public boolean onItemUse(ItemStack heldItem, EntityPlayer player, World world, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) { Block block = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); - EntityFloatingBlock entity = new EntityFloatingBlock(world, x, y, z, block, meta); + EntityFloatingBlock entity = new EntityFloatingBlock(world, x, y, z, block, meta); - if ((this.getDigSpeed(heldItem, block, meta) == this.efficiencyOnProperMaterial || ForgeHooks.isToolEffective(heldItem, block, meta)) && world.isAirBlock(x, y + 1, z)) - { - if (world.getTileEntity(x, y, z) != null || world.getBlock(x, y, z).getBlockHardness(world, x, y, z) == -1.0F) - { - return false; - } + if ((this.getDigSpeed(heldItem, block, meta) == this.efficiencyOnProperMaterial || ForgeHooks.isToolEffective(heldItem, block, meta)) && world.isAirBlock(x, y + 1, z)) { + if (world.getTileEntity(x, y, z) != null || world.getBlock(x, y, z).getBlockHardness(world, x, y, z) == -1.0F) { + return false; + } - if (!world.isRemote) - { - world.spawnEntityInWorld(entity); - world.setBlockToAir(x, y, z); - } + if (!world.isRemote) { + world.spawnEntityInWorld(entity); + world.setBlockToAir(x, y, z); + } - heldItem.damageItem(4, player); - } + heldItem.damageItem(4, player); + } - return true; - } + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/tools/ItemHolystoneTool.java b/src/main/java/com/legacy/aether/items/tools/ItemHolystoneTool.java index 9fdf5f1..e34a78b 100644 --- a/src/main/java/com/legacy/aether/items/tools/ItemHolystoneTool.java +++ b/src/main/java/com/legacy/aether/items/tools/ItemHolystoneTool.java @@ -11,25 +11,20 @@ import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.items.util.EnumAetherToolType; -public class ItemHolystoneTool extends ItemAetherTool -{ +public class ItemHolystoneTool extends ItemAetherTool { - public ItemHolystoneTool(EnumAetherToolType toolType) - { + public ItemHolystoneTool(EnumAetherToolType toolType) { super(ToolMaterial.STONE, toolType); } @Override - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.getItem() == Item.getItemFromBlock(BlocksAether.holystone); } @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) - { - if (!world.isRemote && world.rand.nextInt(100) <= 5) - { + public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) { + if (!world.isRemote && world.rand.nextInt(100) <= 5) { EntityItem entityItem = new EntityItem(world, x, y, z, new ItemStack(ItemsAether.ambrosium_shard, 1)); world.spawnEntityInWorld(entityItem); diff --git a/src/main/java/com/legacy/aether/items/tools/ItemSkyrootBucket.java b/src/main/java/com/legacy/aether/items/tools/ItemSkyrootBucket.java index 69df60c..2edc468 100644 --- a/src/main/java/com/legacy/aether/items/tools/ItemSkyrootBucket.java +++ b/src/main/java/com/legacy/aether/items/tools/ItemSkyrootBucket.java @@ -30,23 +30,21 @@ import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemSkyrootBucket extends Item -{ +public class ItemSkyrootBucket extends Item { - @SideOnly(Side.CLIENT) - private IIcon waterBucket; + @SideOnly(Side.CLIENT) + private IIcon waterBucket; - @SideOnly(Side.CLIENT) - private IIcon poisonBucket; + @SideOnly(Side.CLIENT) + private IIcon poisonBucket; - @SideOnly(Side.CLIENT) - private IIcon remedyBucket; + @SideOnly(Side.CLIENT) + private IIcon remedyBucket; - @SideOnly(Side.CLIENT) - private IIcon milkBucket; + @SideOnly(Side.CLIENT) + private IIcon milkBucket; - public ItemSkyrootBucket() - { + public ItemSkyrootBucket() { super(); this.setHasSubtypes(true); @@ -56,62 +54,53 @@ public class ItemSkyrootBucket extends Item } @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister registry) - { - super.registerIcons(registry); + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister registry) { + super.registerIcons(registry); - this.waterBucket = registry.registerIcon(Aether.find("misc/buckets/skyroot_water_bucket")); - this.poisonBucket = registry.registerIcon(Aether.find("misc/buckets/skyroot_poison_bucket")); - this.remedyBucket = registry.registerIcon(Aether.find("misc/buckets/skyroot_remedy_bucket")); - this.milkBucket = registry.registerIcon(Aether.find("misc/buckets/skyroot_milk_bucket")); - } + this.waterBucket = registry.registerIcon(Aether.find("misc/buckets/skyroot_water_bucket")); + this.poisonBucket = registry.registerIcon(Aether.find("misc/buckets/skyroot_poison_bucket")); + this.remedyBucket = registry.registerIcon(Aether.find("misc/buckets/skyroot_remedy_bucket")); + this.milkBucket = registry.registerIcon(Aether.find("misc/buckets/skyroot_milk_bucket")); + } @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { - return meta == 1 ? this.waterBucket : meta == 2 ? this.poisonBucket : meta == 3 ? this.remedyBucket : meta == 4 ? this.milkBucket : this.itemIcon; - } + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return meta == 1 ? this.waterBucket : meta == 2 ? this.poisonBucket : meta == 3 ? this.remedyBucket : meta == 4 ? this.milkBucket : this.itemIcon; + } @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubItems(Item item, CreativeTabs tab, List subItems) - { - for (int meta = 0; meta < EnumSkyrootBucketType.values().length; ++meta) - { - subItems.add(new ItemStack(this, 1, meta)); - } - } + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubItems(Item item, CreativeTabs tab, List subItems) { + for (int meta = 0; meta < EnumSkyrootBucketType.values().length; ++meta) { + subItems.add(new ItemStack(this, 1, meta)); + } + } @Override - public EnumRarity getRarity(ItemStack stack) - { - return stack.getItemDamage() == 3 ? EnumRarity.rare : super.getRarity(stack); - } + public EnumRarity getRarity(ItemStack stack) { + return stack.getItemDamage() == 3 ? EnumRarity.rare : super.getRarity(stack); + } @Override - public int getItemStackLimit(ItemStack stack) - { - return EnumSkyrootBucketType.getType(stack.getItemDamage()) == EnumSkyrootBucketType.Empty ? 16 : 1; - } + public int getItemStackLimit(ItemStack stack) { + return EnumSkyrootBucketType.getType(stack.getItemDamage()) == EnumSkyrootBucketType.Empty ? 16 : 1; + } @Override - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { int meta = itemstack.getItemDamage(); return this.getUnlocalizedName() + "_" + EnumSkyrootBucketType.getType(meta).toString(); } @Override - public ItemStack onItemRightClick(ItemStack heldItem, World world, EntityPlayer player) - { + public ItemStack onItemRightClick(ItemStack heldItem, World world, EntityPlayer player) { int meta = heldItem.getItemDamage(); /* Remedy and Poison Bucket checker */ - if (EnumSkyrootBucketType.getType(meta) != EnumSkyrootBucketType.Water && EnumSkyrootBucketType.getType(meta) != EnumSkyrootBucketType.Empty) - { + if (EnumSkyrootBucketType.getType(meta) != EnumSkyrootBucketType.Water && EnumSkyrootBucketType.getType(meta) != EnumSkyrootBucketType.Empty) { player.setItemInUse(heldItem, this.getMaxItemUseDuration(heldItem)); return heldItem; @@ -120,178 +109,126 @@ public class ItemSkyrootBucket extends Item /* Water and Empty Bucket Process */ boolean isEmpty = EnumSkyrootBucketType.getType(meta) == EnumSkyrootBucketType.Empty; - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - FillBucketEvent event = new FillBucketEvent(player, heldItem, world, movingobjectposition); + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + FillBucketEvent event = new FillBucketEvent(player, heldItem, world, movingobjectposition); - if (MinecraftForge.EVENT_BUS.post(event)) - { - return heldItem; - } + if (MinecraftForge.EVENT_BUS.post(event)) { + return heldItem; + } - if (movingobjectposition == null) - { - return heldItem; - } - else if (event.getResult() == Event.Result.ALLOW) - { - if (player.capabilities.isCreativeMode) - { - return heldItem; - } + if (movingobjectposition == null) { + return heldItem; + } else if (event.getResult() == Event.Result.ALLOW) { + if (player.capabilities.isCreativeMode) { + return heldItem; + } - if (--heldItem.stackSize <= 0) - { - return event.result; - } + if (--heldItem.stackSize <= 0) { + return event.result; + } - if (!player.inventory.addItemStackToInventory(event.result)) - { - player.dropPlayerItemWithRandomChoice(event.result, false); - } + if (!player.inventory.addItemStackToInventory(event.result)) { + player.dropPlayerItemWithRandomChoice(event.result, false); + } - return heldItem; - } - else if (movingobjectposition.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) - { - return heldItem; - } - else - { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; + return heldItem; + } else if (movingobjectposition.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) { + return heldItem; + } else { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; - if (!world.canMineBlock(player, i, j, k)) - { - return heldItem; - } - else if (isEmpty) - { - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, heldItem)) - { - return heldItem; - } - else - { - Block block = world.getBlock(i, j, k); - Material material = block.getMaterial(); - int l = world.getBlockMetadata(i, j, k); + if (!world.canMineBlock(player, i, j, k)) { + return heldItem; + } else if (isEmpty) { + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, heldItem)) { + return heldItem; + } else { + Block block = world.getBlock(i, j, k); + Material material = block.getMaterial(); + int l = world.getBlockMetadata(i, j, k); - if (material == Material.water && l == 0) - { - world.setBlock(i, j, k, Blocks.air, 0, 11); - player.addStat(StatList.objectUseStats[Item.getIdFromItem(this)], 1); + if (material == Material.water && l == 0) { + world.setBlock(i, j, k, Blocks.air, 0, 11); + player.addStat(StatList.objectUseStats[Item.getIdFromItem(this)], 1); - return this.fillBucket(heldItem, player, ItemsAether.skyroot_bucket); - } - else - { - return heldItem; - } - } - } - else - { - if (movingobjectposition.sideHit == 0) - { - --j; - } + return this.fillBucket(heldItem, player, ItemsAether.skyroot_bucket); + } else { + return heldItem; + } + } + } else { + if (movingobjectposition.sideHit == 0) { + --j; + } - if (movingobjectposition.sideHit == 1) - { - ++j; - } + if (movingobjectposition.sideHit == 1) { + ++j; + } - if (movingobjectposition.sideHit == 2) - { - --k; - } + if (movingobjectposition.sideHit == 2) { + --k; + } - if (movingobjectposition.sideHit == 3) - { - ++k; - } + if (movingobjectposition.sideHit == 3) { + ++k; + } - if (movingobjectposition.sideHit == 4) - { - --i; - } + if (movingobjectposition.sideHit == 4) { + --i; + } - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, heldItem)) - { - return heldItem; - } - else if (this.tryPlaceContainedLiquid(player, world, heldItem, i, j, k)) - { - player.addStat(StatList.objectUseStats[Item.getIdFromItem(this)], 1); - return !player.capabilities.isCreativeMode ? new ItemStack(ItemsAether.skyroot_bucket) : heldItem; - } - else - { - return heldItem; - } - } - } + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, heldItem)) { + return heldItem; + } else if (this.tryPlaceContainedLiquid(player, world, heldItem, i, j, k)) { + player.addStat(StatList.objectUseStats[Item.getIdFromItem(this)], 1); + return !player.capabilities.isCreativeMode ? new ItemStack(ItemsAether.skyroot_bucket) : heldItem; + } else { + return heldItem; + } + } + } } - private ItemStack fillBucket(ItemStack emptyBuckets, EntityPlayer player, Item fullBucket) - { - if (player.capabilities.isCreativeMode) - { - return emptyBuckets; - } - else - { - ItemStack result = new ItemStack(fullBucket, 1, 1); - --emptyBuckets.stackSize; + private ItemStack fillBucket(ItemStack emptyBuckets, EntityPlayer player, Item fullBucket) { + if (player.capabilities.isCreativeMode) { + return emptyBuckets; + } else { + ItemStack result = new ItemStack(fullBucket, 1, 1); + --emptyBuckets.stackSize; - if (emptyBuckets.stackSize <= 0) - { - return result; - } - else - { - if (!player.inventory.addItemStackToInventory(result)) - { - player.dropPlayerItemWithRandomChoice(result, false); - } - } + if (emptyBuckets.stackSize <= 0) { + return result; + } else { + if (!player.inventory.addItemStackToInventory(result)) { + player.dropPlayerItemWithRandomChoice(result, false); + } + } - return emptyBuckets; - } - } - - - public boolean tryPlaceContainedLiquid(EntityPlayer player, World world, ItemStack stack, int x, int y, int z) - { - if (EnumSkyrootBucketType.getType(stack.getItemDamage()) != EnumSkyrootBucketType.Water) - { - return false; + return emptyBuckets; } - else - { + } + + + public boolean tryPlaceContainedLiquid(EntityPlayer player, World world, ItemStack stack, int x, int y, int z) { + if (EnumSkyrootBucketType.getType(stack.getItemDamage()) != EnumSkyrootBucketType.Water) { + return false; + } else { Material material = world.getBlock(x, y, z).getMaterial(); boolean flag = !material.isSolid(); - if (!world.isAirBlock(x, y, z) && !flag) - { + if (!world.isAirBlock(x, y, z) && !flag) { return false; - } - else - { - if (world.provider.isHellWorld) - { + } else { + if (world.provider.isHellWorld) { world.playSoundEffect((double) x, (double) y, (double) z, "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); - for (int l = 0; l < 8; ++l) - { + for (int l = 0; l < 8; ++l) { world.spawnParticle("largesmoke", (double) x + Math.random(), (double) y + Math.random(), (double) z + Math.random(), 0.0D, 0.0D, 0.0D); } - } - else - { - if (!world.isRemote && flag && !material.isLiquid()) - { + } else { + if (!world.isRemote && flag && !material.isLiquid()) { world.func_147480_a(x, y, z, true); } @@ -304,64 +241,47 @@ public class ItemSkyrootBucket extends Item } @Override - public ItemStack onEaten(ItemStack stack, World worldIn, EntityPlayer entityLiving) - { + public ItemStack onEaten(ItemStack stack, World worldIn, EntityPlayer entityLiving) { return this.onBucketUsed(stack, worldIn, (EntityPlayer) entityLiving); - } + } - public ItemStack onBucketUsed(ItemStack itemstack, World world, EntityPlayer entityplayer) - { + public ItemStack onBucketUsed(ItemStack itemstack, World world, EntityPlayer entityplayer) { PlayerAether player = PlayerAether.get(entityplayer); int meta = itemstack.getItemDamage(); - if (!entityplayer.capabilities.isCreativeMode) - { + if (!entityplayer.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (EnumSkyrootBucketType.getType(meta) == EnumSkyrootBucketType.Poison) - { + if (EnumSkyrootBucketType.getType(meta) == EnumSkyrootBucketType.Poison) { player.inflictPoison(200); - } - else if (EnumSkyrootBucketType.getType(meta) == EnumSkyrootBucketType.Remedy) - { + } else if (EnumSkyrootBucketType.getType(meta) == EnumSkyrootBucketType.Remedy) { player.inflictCure(200); - } - else if (EnumSkyrootBucketType.getType(meta) == EnumSkyrootBucketType.Milk) - { - if (!world.isRemote) - { - entityplayer.curePotionEffects(new ItemStack(Items.milk_bucket)); - } + } else if (EnumSkyrootBucketType.getType(meta) == EnumSkyrootBucketType.Milk) { + if (!world.isRemote) { + entityplayer.curePotionEffects(new ItemStack(Items.milk_bucket)); + } } return itemstack.stackSize <= 0 ? new ItemStack(this, 1, 0) : itemstack; } - public int getMaxItemUseDuration(ItemStack itemstack) - { + public int getMaxItemUseDuration(ItemStack itemstack) { int meta = itemstack.getItemDamage(); - if (EnumSkyrootBucketType.getType(meta) != EnumSkyrootBucketType.Water) - { + if (EnumSkyrootBucketType.getType(meta) != EnumSkyrootBucketType.Water) { return 32; - } - else - { + } else { return 0; } } - public EnumAction getItemUseAction(ItemStack itemstack) - { + public EnumAction getItemUseAction(ItemStack itemstack) { int meta = itemstack.getItemDamage(); - if (EnumSkyrootBucketType.getType(meta) != EnumSkyrootBucketType.Water) - { + if (EnumSkyrootBucketType.getType(meta) != EnumSkyrootBucketType.Water) { return EnumAction.drink; - } - else - { + } else { return EnumAction.none; } } diff --git a/src/main/java/com/legacy/aether/items/tools/ItemSkyrootTool.java b/src/main/java/com/legacy/aether/items/tools/ItemSkyrootTool.java index 7d23a0a..69ab982 100644 --- a/src/main/java/com/legacy/aether/items/tools/ItemSkyrootTool.java +++ b/src/main/java/com/legacy/aether/items/tools/ItemSkyrootTool.java @@ -6,17 +6,14 @@ import net.minecraft.item.ItemStack; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.items.util.EnumAetherToolType; -public class ItemSkyrootTool extends ItemAetherTool -{ +public class ItemSkyrootTool extends ItemAetherTool { - public ItemSkyrootTool(EnumAetherToolType toolType) - { + public ItemSkyrootTool(EnumAetherToolType toolType) { super(ToolMaterial.WOOD, toolType); } @Override - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.getItem() == Item.getItemFromBlock(BlocksAether.skyroot_planks); } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/tools/ItemValkyrieTool.java b/src/main/java/com/legacy/aether/items/tools/ItemValkyrieTool.java index 3866ea0..d376753 100644 --- a/src/main/java/com/legacy/aether/items/tools/ItemValkyrieTool.java +++ b/src/main/java/com/legacy/aether/items/tools/ItemValkyrieTool.java @@ -13,32 +13,26 @@ import net.minecraft.util.Vec3; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.items.util.EnumAetherToolType; -public class ItemValkyrieTool extends ItemAetherTool -{ +public class ItemValkyrieTool extends ItemAetherTool { - public ItemValkyrieTool(EnumAetherToolType toolType) - { + public ItemValkyrieTool(EnumAetherToolType toolType) { super(ToolMaterial.EMERALD, toolType); } @Override - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return false; } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } @Override @SuppressWarnings("unchecked") - public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) - { - if (!(entityLiving instanceof EntityPlayer)) - { + public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { + if (!(entityLiving instanceof EntityPlayer)) { return false; } @@ -52,45 +46,38 @@ public class ItemValkyrieTool extends ItemAetherTool Entity found = null; double foundLen = 0.0D; - for (Object o : locatedEntities) - { - if (o == player) - { + for (Object o : locatedEntities) { + if (o == player) { continue; } Entity ent = (Entity) o; - if (!ent.canBeCollidedWith()) - { + if (!ent.canBeCollidedWith()) { continue; } Vec3 vec = Vec3.createVectorHelper(ent.posX - player.posX, ent.boundingBox.minY + ent.height / 2f - player.posY - player.getEyeHeight(), ent.posZ - player.posZ); double len = vec.lengthVector(); - if (len > 10.0F) - { + if (len > 10.0F) { continue; } vec = vec.normalize(); double dot = playerVision.dotProduct(vec); - if (dot < 1.0 - 0.125 / len || !player.canEntityBeSeen(ent)) - { + if (dot < 1.0 - 0.125 / len || !player.canEntityBeSeen(ent)) { continue; } - if (foundLen == 0.0 || len < foundLen) - { + if (foundLen == 0.0 || len < foundLen) { found = ent; foundLen = len; } } - if (found != null && player.ridingEntity != found) - { + if (found != null && player.ridingEntity != found) { stack.damageItem(1, player); player.attackTargetEntityWithCurrentItem(found); diff --git a/src/main/java/com/legacy/aether/items/tools/ItemZaniteTool.java b/src/main/java/com/legacy/aether/items/tools/ItemZaniteTool.java index 6a1871c..9ca1b29 100644 --- a/src/main/java/com/legacy/aether/items/tools/ItemZaniteTool.java +++ b/src/main/java/com/legacy/aether/items/tools/ItemZaniteTool.java @@ -6,65 +6,47 @@ import net.minecraft.item.ItemStack; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.items.util.EnumAetherToolType; -public class ItemZaniteTool extends ItemAetherTool -{ +public class ItemZaniteTool extends ItemAetherTool { - public float[] level = new float[] {2F, 4F, 6F, 8F, 12F}; + public float[] level = new float[]{2F, 4F, 6F, 8F, 12F}; - public ItemZaniteTool(EnumAetherToolType toolType) - { + public ItemZaniteTool(EnumAetherToolType toolType) { super(ToolMaterial.IRON, toolType); } @Override - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.getItem() == ItemsAether.zanite_gemstone; } - @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { + @Override + public float getDigSpeed(ItemStack stack, Block block, int meta) { return this.calculateIncrease(stack, this.toolType.getStrVsBlock(stack, block)); - } + } - private float calculateIncrease(ItemStack tool, float original) - { - boolean AllowedCalculations = original != 4.0F ? false : true; - int current = tool.getItemDamage(); + private float calculateIncrease(ItemStack tool, float original) { + boolean AllowedCalculations = original != 4.0F ? false : true; + int current = tool.getItemDamage(); - if (AllowedCalculations) - { - if (isBetween(tool.getMaxDamage(), current, tool.getMaxDamage() - 50)) - { - return level[4]; - } - else if (isBetween(tool.getMaxDamage() - 51, current, tool.getMaxDamage() - 110)) - { - return level[3]; - } - else if (isBetween(tool.getMaxDamage() - 111, current, tool.getMaxDamage() - 200)) - { - return level[2]; - } - else if (isBetween(tool.getMaxDamage() - 201, current, tool.getMaxDamage() - 239)) - { - return level[1]; - } - else - { - return level[0]; - } - } - else - { - return 1.0F; - } - } + if (AllowedCalculations) { + if (isBetween(tool.getMaxDamage(), current, tool.getMaxDamage() - 50)) { + return level[4]; + } else if (isBetween(tool.getMaxDamage() - 51, current, tool.getMaxDamage() - 110)) { + return level[3]; + } else if (isBetween(tool.getMaxDamage() - 111, current, tool.getMaxDamage() - 200)) { + return level[2]; + } else if (isBetween(tool.getMaxDamage() - 201, current, tool.getMaxDamage() - 239)) { + return level[1]; + } else { + return level[0]; + } + } else { + return 1.0F; + } + } - private boolean isBetween(int max, int origin, int min) - { - return origin <= max && origin >= min ? true : false; - } + private boolean isBetween(int max, int origin, int min) { + return origin <= max && origin >= min ? true : false; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/util/DoubleDropHelper.java b/src/main/java/com/legacy/aether/items/util/DoubleDropHelper.java index 311e0cb..c183ec1 100644 --- a/src/main/java/com/legacy/aether/items/util/DoubleDropHelper.java +++ b/src/main/java/com/legacy/aether/items/util/DoubleDropHelper.java @@ -9,50 +9,41 @@ import net.minecraft.stats.StatList; import com.legacy.aether.items.tools.ItemSkyrootTool; -public class DoubleDropHelper -{ +public class DoubleDropHelper { - public static void dropBlock(EntityPlayer player, int x, int y, int z, Block block, int meta) - { - player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); - player.addExhaustion(0.025F); + public static void dropBlock(EntityPlayer player, int x, int y, int z, Block block, int meta) { + player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); + player.addExhaustion(0.025F); - int size = meta == 0 ? 2 : 1; - ItemStack stack = player.inventory.getCurrentItem(); - boolean flag = true; + int size = meta == 0 ? 2 : 1; + ItemStack stack = player.inventory.getCurrentItem(); + boolean flag = true; - if (stack == null || !(stack.getItem() instanceof ItemSkyrootTool)) - { - flag = false; - } + if (stack == null || !(stack.getItem() instanceof ItemSkyrootTool)) { + flag = false; + } - if (block.canSilkHarvest(player.worldObj, player, x, y, z, meta) && EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0) - { - block.harvestBlock(player.worldObj, player, x, y, z, meta); + if (block.canSilkHarvest(player.worldObj, player, x, y, z, meta) && EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0) { + block.harvestBlock(player.worldObj, player, x, y, z, meta); - return; - } + return; + } - if (!flag) - { - block.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); + if (!flag) { + block.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - return; - } + return; + } - ItemSkyrootTool skyrootTool = (ItemSkyrootTool) stack.getItem(); + ItemSkyrootTool skyrootTool = (ItemSkyrootTool) stack.getItem(); - if (skyrootTool.getDigSpeed(stack, block, meta) == skyrootTool.getEffectiveSpeed()) - { - for (int i = 0; i < size; ++i) - { - block.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - } - } - else - { - block.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - } + if (skyrootTool.getDigSpeed(stack, block, meta) == skyrootTool.getEffectiveSpeed()) { + for (int i = 0; i < size; ++i) { + block.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); + } + } else { + block.dropBlockAsItem(player.worldObj, x, y, z, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); + } } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/util/EnumAetherToolType.java b/src/main/java/com/legacy/aether/items/util/EnumAetherToolType.java index 478f93a..c142c3b 100644 --- a/src/main/java/com/legacy/aether/items/util/EnumAetherToolType.java +++ b/src/main/java/com/legacy/aether/items/util/EnumAetherToolType.java @@ -11,35 +11,29 @@ import net.minecraft.item.ItemStack; import com.google.common.collect.Sets; import com.legacy.aether.blocks.BlocksAether; -public enum EnumAetherToolType -{ +public enum EnumAetherToolType { PICKAXE(Sets.newHashSet(new Block[] { - Blocks.cobblestone, Blocks.double_stone_slab, Blocks.stone_slab, - Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, - Blocks.iron_block, Blocks.coal_ore, Blocks.gold_ore, Blocks.gold_block, - Blocks.diamond_ore, Blocks.diamond_block, Blocks.ice, Blocks.netherrack, - Blocks.lapis_ore, Blocks.lapis_block, Blocks.redstone_ore, Blocks.lit_redstone_ore, - Blocks.rail, Blocks.detector_rail, Blocks.golden_rail, Blocks.activator_rail, Blocks.mob_spawner, - BlocksAether.holystone, BlocksAether.holystone_brick, BlocksAether.mossy_holystone, - BlocksAether.enchanter, BlocksAether.incubator, BlocksAether.enchanter, BlocksAether.ambrosium_ore, - BlocksAether.icestone, BlocksAether.aerogel, BlocksAether.carved_stone, BlocksAether.angelic_stone, - BlocksAether.hellfire_stone, BlocksAether.sentry_stone, BlocksAether.light_angelic_stone, - BlocksAether.light_hellfire_stone - })) - { + Blocks.cobblestone, Blocks.double_stone_slab, Blocks.stone_slab, + Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, + Blocks.iron_block, Blocks.coal_ore, Blocks.gold_ore, Blocks.gold_block, + Blocks.diamond_ore, Blocks.diamond_block, Blocks.ice, Blocks.netherrack, + Blocks.lapis_ore, Blocks.lapis_block, Blocks.redstone_ore, Blocks.lit_redstone_ore, + Blocks.rail, Blocks.detector_rail, Blocks.golden_rail, Blocks.activator_rail, Blocks.mob_spawner, + BlocksAether.holystone, BlocksAether.holystone_brick, BlocksAether.mossy_holystone, + BlocksAether.enchanter, BlocksAether.incubator, BlocksAether.enchanter, BlocksAether.ambrosium_ore, + BlocksAether.icestone, BlocksAether.aerogel, BlocksAether.carved_stone, BlocksAether.angelic_stone, + BlocksAether.hellfire_stone, BlocksAether.sentry_stone, BlocksAether.light_angelic_stone, + BlocksAether.light_hellfire_stone + })) { @Override - public boolean canHarvestBlock(ToolMaterial toolMaterial, Block state) - { + public boolean canHarvestBlock(ToolMaterial toolMaterial, Block state) { Block block = state; - if (block == BlocksAether.zanite_ore || block == BlocksAether.zanite_block || block == BlocksAether.icestone) - { + if (block == BlocksAether.zanite_ore || block == BlocksAether.zanite_block || block == BlocksAether.icestone) { return toolMaterial.getHarvestLevel() >= 1; - } - else if (block == BlocksAether.gravitite_ore || block == BlocksAether.enchanted_gravitite) - { + } else if (block == BlocksAether.gravitite_ore || block == BlocksAether.enchanted_gravitite) { return toolMaterial.getHarvestLevel() >= 2; } @@ -47,63 +41,54 @@ public enum EnumAetherToolType } @Override - public float getStrVsBlock(ItemStack stack, Block block) - { + public float getStrVsBlock(ItemStack stack, Block block) { return block != null && (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil || block.getMaterial() == Material.rock) ? this.efficiencyOnProperMaterial : super.getStrVsBlock(stack, block); } - }, + }, SHOVEL(Sets.newHashSet(new Block[] { - Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow, - Blocks.snow_layer, Blocks.clay, Blocks.farmland, Blocks.soul_sand, - Blocks.mycelium, BlocksAether.aether_dirt, BlocksAether.aether_grass, - BlocksAether.aercloud, BlocksAether.enchanted_aether_grass, BlocksAether.quicksoil - })) - { + Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow, + Blocks.snow_layer, Blocks.clay, Blocks.farmland, Blocks.soul_sand, + Blocks.mycelium, BlocksAether.aether_dirt, BlocksAether.aether_grass, + BlocksAether.aercloud, BlocksAether.enchanted_aether_grass, BlocksAether.quicksoil + })) { @Override - public boolean canHarvestBlock(ToolMaterial toolMaterial, Block block) - { + public boolean canHarvestBlock(ToolMaterial toolMaterial, Block block) { return block == Blocks.snow ? true : block == Blocks.snow_layer; } - }, + }, AXE(Sets.newHashSet(new Block[] { - Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.chest, - Blocks.double_stone_slab, Blocks.stone_slab, Blocks.pumpkin, - Blocks.lit_pumpkin, BlocksAether.skyroot_log, BlocksAether.golden_oak_log, BlocksAether.skyroot_planks, - BlocksAether.chest_mimic - })) - { + Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.chest, + Blocks.double_stone_slab, Blocks.stone_slab, Blocks.pumpkin, + Blocks.lit_pumpkin, BlocksAether.skyroot_log, BlocksAether.golden_oak_log, BlocksAether.skyroot_planks, + BlocksAether.chest_mimic + })) { @Override - public float getStrVsBlock(ItemStack stack, Block block) - { + public float getStrVsBlock(ItemStack stack, Block block) { return block != null && (block.getMaterial() == Material.wood || block.getMaterial() == Material.plants || block.getMaterial() == Material.vine) ? this.efficiencyOnProperMaterial : super.getStrVsBlock(stack, block); } - }; + }; - private Set toolBlockSet; + private Set toolBlockSet; - public float efficiencyOnProperMaterial = 4.0F; + public float efficiencyOnProperMaterial = 4.0F; - EnumAetherToolType(Set toolBlockSet) - { - this.toolBlockSet = toolBlockSet; - } + EnumAetherToolType(Set toolBlockSet) { + this.toolBlockSet = toolBlockSet; + } - public Set getToolBlockSet() - { - return this.toolBlockSet; - } + public Set getToolBlockSet() { + return this.toolBlockSet; + } - public boolean canHarvestBlock(ToolMaterial toolMaterial, Block block) - { - return false; - } + public boolean canHarvestBlock(ToolMaterial toolMaterial, Block block) { + return false; + } - public float getStrVsBlock(ItemStack stack, Block block) - { - return this.toolBlockSet.contains(block) ? this.efficiencyOnProperMaterial : 1.0F; - } + public float getStrVsBlock(ItemStack stack, Block block) { + return this.toolBlockSet.contains(block) ? this.efficiencyOnProperMaterial : 1.0F; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/util/EnumDartShooterType.java b/src/main/java/com/legacy/aether/items/util/EnumDartShooterType.java index 48548e6..c6f089b 100644 --- a/src/main/java/com/legacy/aether/items/util/EnumDartShooterType.java +++ b/src/main/java/com/legacy/aether/items/util/EnumDartShooterType.java @@ -1,7 +1,6 @@ package com.legacy.aether.items.util; -public enum EnumDartShooterType -{ +public enum EnumDartShooterType { Golden(0, "golden"), Poison(1, "poison"), Enchanted(2, "enchanted"); @@ -9,25 +8,21 @@ public enum EnumDartShooterType public String name; - EnumDartShooterType(int meta, String name) - { + EnumDartShooterType(int meta, String name) { this.meta = meta; this.name = name; } - public static EnumDartShooterType getType(int meta) - { - return meta == 1 ? Poison : meta == 2 ? Enchanted : Golden; + public static EnumDartShooterType getType(int meta) { + return meta == 1 ? Poison : meta == 2 ? Enchanted : Golden; } - public int getMeta() - { + public int getMeta() { return this.meta; } - public String toString() - { - return this.name; - } + public String toString() { + return this.name; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/util/EnumDartType.java b/src/main/java/com/legacy/aether/items/util/EnumDartType.java index d124bbe..a7e9d19 100644 --- a/src/main/java/com/legacy/aether/items/util/EnumDartType.java +++ b/src/main/java/com/legacy/aether/items/util/EnumDartType.java @@ -1,7 +1,6 @@ package com.legacy.aether.items.util; -public enum EnumDartType -{ +public enum EnumDartType { Golden(0, "golden"), Poison(1, "poison"), Enchanted(2, "enchanted"); @@ -9,25 +8,21 @@ public enum EnumDartType public String name; - EnumDartType(int meta, String name) - { + EnumDartType(int meta, String name) { this.meta = meta; this.name = name; } - public static EnumDartType getType(int meta) - { - return meta == 1 ? Poison : meta == 2 ? Enchanted : Golden; + public static EnumDartType getType(int meta) { + return meta == 1 ? Poison : meta == 2 ? Enchanted : Golden; } - public int getMeta() - { + public int getMeta() { return this.meta; } - public String toString() - { - return this.name; - } + public String toString() { + return this.name; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/util/EnumDungeonKeyType.java b/src/main/java/com/legacy/aether/items/util/EnumDungeonKeyType.java index 3a785ef..271d2a7 100644 --- a/src/main/java/com/legacy/aether/items/util/EnumDungeonKeyType.java +++ b/src/main/java/com/legacy/aether/items/util/EnumDungeonKeyType.java @@ -1,32 +1,27 @@ package com.legacy.aether.items.util; -public enum EnumDungeonKeyType -{ +public enum EnumDungeonKeyType { Bronze(0, "bronze"), Silver(1, "silver"), Golden(2, "golden"); private int meta; private String name; - EnumDungeonKeyType(int meta, String name) - { + EnumDungeonKeyType(int meta, String name) { this.meta = meta; this.name = name; } - public static EnumDungeonKeyType getType(int meta) - { - return meta == 1 ? Silver : meta == 2 ? Golden : Bronze; + public static EnumDungeonKeyType getType(int meta) { + return meta == 1 ? Silver : meta == 2 ? Golden : Bronze; } - public int getMeta() - { + public int getMeta() { return this.meta; } - public String toString() - { - return this.name; - } + public String toString() { + return this.name; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/util/EnumGummySwetType.java b/src/main/java/com/legacy/aether/items/util/EnumGummySwetType.java index 0d440b6..670fbdd 100644 --- a/src/main/java/com/legacy/aether/items/util/EnumGummySwetType.java +++ b/src/main/java/com/legacy/aether/items/util/EnumGummySwetType.java @@ -1,8 +1,7 @@ package com.legacy.aether.items.util; -public enum EnumGummySwetType -{ +public enum EnumGummySwetType { Blue(0, "blue"), Golden(1, "golden"); @@ -10,25 +9,22 @@ public enum EnumGummySwetType private String name; - EnumGummySwetType(int meta, String name) - { - this.meta = meta;; + EnumGummySwetType(int meta, String name) { + this.meta = meta; + ; this.name = name; } - public static EnumGummySwetType getType(int meta) - { + public static EnumGummySwetType getType(int meta) { return meta == 1 ? Golden : Blue; } - public int getMeta() - { + public int getMeta() { return this.meta; } - public String toString() - { - return this.name; - } + public String toString() { + return this.name; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/util/EnumSkyrootBucketType.java b/src/main/java/com/legacy/aether/items/util/EnumSkyrootBucketType.java index 9436e96..eb0b794 100644 --- a/src/main/java/com/legacy/aether/items/util/EnumSkyrootBucketType.java +++ b/src/main/java/com/legacy/aether/items/util/EnumSkyrootBucketType.java @@ -1,32 +1,27 @@ package com.legacy.aether.items.util; -public enum EnumSkyrootBucketType -{ +public enum EnumSkyrootBucketType { Empty(0, "empty"), Water(1, "water"), Poison(2, "poison"), Remedy(3, "remedy"), Milk(4, "milk"); public int meta; public String name; - EnumSkyrootBucketType(int meta, String name) - { + EnumSkyrootBucketType(int meta, String name) { this.meta = meta; this.name = name; } - public static EnumSkyrootBucketType getType(int meta) - { - return meta == 1 ? Water : meta == 2 ? Poison : meta == 3 ? Remedy : meta == 4 ? Milk : Empty; + public static EnumSkyrootBucketType getType(int meta) { + return meta == 1 ? Water : meta == 2 ? Poison : meta == 3 ? Remedy : meta == 4 ? Milk : Empty; } - public int getMeta() - { + public int getMeta() { return this.meta; } - public String toString() - { - return this.name; - } + public String toString() { + return this.name; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/util/ItemAether.java b/src/main/java/com/legacy/aether/items/util/ItemAether.java index aae5d9e..3e1b8d8 100644 --- a/src/main/java/com/legacy/aether/items/util/ItemAether.java +++ b/src/main/java/com/legacy/aether/items/util/ItemAether.java @@ -3,11 +3,9 @@ package com.legacy.aether.items.util; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; -public class ItemAether extends Item -{ +public class ItemAether extends Item { - public ItemAether(CreativeTabs tab) - { + public ItemAether(CreativeTabs tab) { this.setCreativeTab(tab); } diff --git a/src/main/java/com/legacy/aether/items/util/ItemDeveloperStick.java b/src/main/java/com/legacy/aether/items/util/ItemDeveloperStick.java index 0e9acdb..ab3ab4d 100644 --- a/src/main/java/com/legacy/aether/items/util/ItemDeveloperStick.java +++ b/src/main/java/com/legacy/aether/items/util/ItemDeveloperStick.java @@ -8,37 +8,29 @@ import net.minecraft.item.ItemStack; import com.legacy.aether.Aether; import com.legacy.aether.player.perks.AetherRankings; -public class ItemDeveloperStick extends Item -{ +public class ItemDeveloperStick extends Item { - public ItemDeveloperStick() - { + public ItemDeveloperStick() { this.setFull3D(); this.setCreativeTab(null); } - + @Override - public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) - { + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) { ItemStack heldItem = playerIn.getHeldItem(); - - if (AetherRankings.isRankedPlayer(playerIn.getUniqueID())) - { + + if (AetherRankings.isRankedPlayer(playerIn.getUniqueID())) { playerIn.mountEntity(target); return true; - } - else if (playerIn.getUniqueID().toString().equals("cf51ef47-04a8-439a-aa41-47d871b0b837")) - { + } else if (playerIn.getUniqueID().toString().equals("cf51ef47-04a8-439a-aa41-47d871b0b837")) { Aether.proxy.sendMessage(playerIn, "YOu a cheeto or somethin'?"); --heldItem.stackSize; return false; - } - else - { + } else { Aether.proxy.sendMessage(playerIn, "You aren't skilled enough to use this item!"); --heldItem.stackSize; return false; } - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/util/ItemSwettyBall.java b/src/main/java/com/legacy/aether/items/util/ItemSwettyBall.java index 1273180..7a8a51f 100644 --- a/src/main/java/com/legacy/aether/items/util/ItemSwettyBall.java +++ b/src/main/java/com/legacy/aether/items/util/ItemSwettyBall.java @@ -9,38 +9,29 @@ import net.minecraft.world.World; import com.legacy.aether.blocks.BlocksAether; -public class ItemSwettyBall extends Item -{ +public class ItemSwettyBall extends Item { - public ItemSwettyBall(CreativeTabs tab) - { + public ItemSwettyBall(CreativeTabs tab) { this.setCreativeTab(tab); } - + @Override - public boolean onItemUse(ItemStack stackIn, EntityPlayer playerIn, World worldIn, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) - { + public boolean onItemUse(ItemStack stackIn, EntityPlayer playerIn, World worldIn, int x, int y, int z, int facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = playerIn.getHeldItem(); - if (worldIn.getBlock(x, y, z) == BlocksAether.aether_dirt) - { - worldIn.setBlock(x, y, z, BlocksAether.aether_grass); - } - else if (worldIn.getBlock(x, y, z) == Blocks.dirt) - { - worldIn.setBlock(x, y, z, Blocks.grass); - } - else - { - return false; - } + if (worldIn.getBlock(x, y, z) == BlocksAether.aether_dirt) { + worldIn.setBlock(x, y, z, BlocksAether.aether_grass); + } else if (worldIn.getBlock(x, y, z) == Blocks.dirt) { + worldIn.setBlock(x, y, z, Blocks.grass); + } else { + return false; + } - if (!playerIn.capabilities.isCreativeMode) - { - --heldItem.stackSize; - } + if (!playerIn.capabilities.isCreativeMode) { + --heldItem.stackSize; + } - return true; - } + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemCandyCaneSword.java b/src/main/java/com/legacy/aether/items/weapons/ItemCandyCaneSword.java index e110868..21ef448 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemCandyCaneSword.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemCandyCaneSword.java @@ -10,38 +10,30 @@ import net.minecraft.item.ItemSword; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemCandyCaneSword extends ItemSword -{ +public class ItemCandyCaneSword extends ItemSword { - public ItemCandyCaneSword() - { - super(ToolMaterial.GOLD); - this.setCreativeTab(AetherCreativeTabs.weapons); - } + public ItemCandyCaneSword() { + super(ToolMaterial.GOLD); + this.setCreativeTab(AetherCreativeTabs.weapons); + } - @Override - public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack material) - { - return material.getItem() == ItemsAether.candy_cane; - } + @Override + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack material) { + return material.getItem() == ItemsAether.candy_cane; + } - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) - { - if (entityliving.deathTime > 0) - { - return true; - } - else - { - if ((new Random()).nextBoolean() && entityliving1 != null && entityliving1 instanceof EntityPlayer && !entityliving1.worldObj.isRemote && entityliving.hurtTime > 0) - { - entityliving.dropItem(ItemsAether.candy_cane, 1); - } + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) { + if (entityliving.deathTime > 0) { + return true; + } else { + if ((new Random()).nextBoolean() && entityliving1 != null && entityliving1 instanceof EntityPlayer && !entityliving1.worldObj.isRemote && entityliving.hurtTime > 0) { + entityliving.dropItem(ItemsAether.candy_cane, 1); + } - itemstack.damageItem(1, entityliving1); - return true; - } - } + itemstack.damageItem(1, entityliving1); + return true; + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemElementalSword.java b/src/main/java/com/legacy/aether/items/weapons/ItemElementalSword.java index 4d96da8..d3e048e 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemElementalSword.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemElementalSword.java @@ -10,11 +10,9 @@ import net.minecraft.util.DamageSource; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemElementalSword extends ItemSword -{ +public class ItemElementalSword extends ItemSword { - public ItemElementalSword() - { + public ItemElementalSword() { super(ToolMaterial.EMERALD); this.setMaxDamage(502); @@ -22,37 +20,29 @@ public class ItemElementalSword extends ItemSword } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) - { - if (this == ItemsAether.flaming_sword) - { + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) { + if (this == ItemsAether.flaming_sword) { entityliving.setFire(30); - } - else if (this == ItemsAether.lightning_sword) - { + } else if (this == ItemsAether.lightning_sword) { EntityLightningBolt lightning = new EntityLightningBolt(entityliving1.worldObj, entityliving.posX, entityliving.posY, entityliving.posZ); entityliving1.worldObj.spawnEntityInWorld(lightning); - } - else if (this == ItemsAether.holy_sword && entityliving.isEntityUndead()) - { + } else if (this == ItemsAether.holy_sword && entityliving.isEntityUndead()) { entityliving.attackEntityFrom(DamageSource.drown, 15.0F); itemstack.damageItem(10, entityliving1); } return super.hitEntity(itemstack, entityliving, entityliving1); - } + } @Override - public boolean getIsRepairable(ItemStack stack, ItemStack repairStack) - { - return false; - } + public boolean getIsRepairable(ItemStack stack, ItemStack repairStack) { + return false; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemGravititeSword.java b/src/main/java/com/legacy/aether/items/weapons/ItemGravititeSword.java index 8fe41e6..f05b430 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemGravititeSword.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemGravititeSword.java @@ -10,35 +10,29 @@ import net.minecraft.network.play.server.S12PacketEntityVelocity; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemGravititeSword extends ItemSword -{ +public class ItemGravititeSword extends ItemSword { - public ItemGravititeSword() - { - super(ToolMaterial.EMERALD); - this.setCreativeTab(AetherCreativeTabs.weapons); - } + public ItemGravititeSword() { + super(ToolMaterial.EMERALD); + this.setCreativeTab(AetherCreativeTabs.weapons); + } - @Override - public boolean getIsRepairable(ItemStack repairingItem, ItemStack material) - { - return material.getItem() == Item.getItemFromBlock(BlocksAether.enchanted_gravitite); - } + @Override + public boolean getIsRepairable(ItemStack repairingItem, ItemStack material) { + return material.getItem() == Item.getItemFromBlock(BlocksAether.enchanted_gravitite); + } - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase hitentity, EntityLivingBase player) - { - if ((hitentity.hurtTime > 0 || hitentity.deathTime > 0)) - { - hitentity.addVelocity(0.0D, 1.0D, 0.0D); - } + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase hitentity, EntityLivingBase player) { + if ((hitentity.hurtTime > 0 || hitentity.deathTime > 0)) { + hitentity.addVelocity(0.0D, 1.0D, 0.0D); + } - if (hitentity instanceof EntityPlayerMP) - { - ((EntityPlayerMP)hitentity).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(hitentity)); - } + if (hitentity instanceof EntityPlayerMP) { + ((EntityPlayerMP) hitentity).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(hitentity)); + } - return super.hitEntity(itemstack, hitentity, player); - } + return super.hitEntity(itemstack, hitentity, player); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemHolystoneSword.java b/src/main/java/com/legacy/aether/items/weapons/ItemHolystoneSword.java index fd0a1b2..ceb14a7 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemHolystoneSword.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemHolystoneSword.java @@ -12,34 +12,28 @@ import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemHolystoneSword extends ItemSword -{ +public class ItemHolystoneSword extends ItemSword { - public ItemHolystoneSword() - { - super(ToolMaterial.STONE); - this.setCreativeTab(AetherCreativeTabs.weapons); - } + public ItemHolystoneSword() { + super(ToolMaterial.STONE); + this.setCreativeTab(AetherCreativeTabs.weapons); + } - @Override - public boolean getIsRepairable(ItemStack repairingItem, ItemStack mateiral) - { - return mateiral.getItem() == Item.getItemFromBlock(BlocksAether.holystone); - } + @Override + public boolean getIsRepairable(ItemStack repairingItem, ItemStack mateiral) { + return mateiral.getItem() == Item.getItemFromBlock(BlocksAether.holystone); + } - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) - { - if ((new Random()).nextInt(20) == 0 && entityliving1 != null && entityliving1 instanceof EntityPlayer && entityliving.hurtTime > 0 && entityliving.deathTime <= 0) - { - if (!entityliving.worldObj.isRemote) - { - entityliving.dropItem(ItemsAether.ambrosium_shard, 1); - } - } + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) { + if ((new Random()).nextInt(20) == 0 && entityliving1 != null && entityliving1 instanceof EntityPlayer && entityliving.hurtTime > 0 && entityliving.deathTime <= 0) { + if (!entityliving.worldObj.isRemote) { + entityliving.dropItem(ItemsAether.ambrosium_shard, 1); + } + } - itemstack.damageItem(1, entityliving1); - return true; - } + itemstack.damageItem(1, entityliving1); + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemLightningKnife.java b/src/main/java/com/legacy/aether/items/weapons/ItemLightningKnife.java index 3844197..227993f 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemLightningKnife.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemLightningKnife.java @@ -10,40 +10,34 @@ import com.legacy.aether.entities.projectile.EntityLightningKnife; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemLightningKnife extends Item -{ - public ItemLightningKnife() - { - this.setMaxStackSize(16); - this.setCreativeTab(AetherCreativeTabs.weapons); - } +public class ItemLightningKnife extends Item { + public ItemLightningKnife() { + this.setMaxStackSize(16); + this.setCreativeTab(AetherCreativeTabs.weapons); + } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } - @Override - public ItemStack onItemRightClick(ItemStack heldItem, World worldIn, EntityPlayer playerIn) - { - if (!playerIn.capabilities.isCreativeMode) - { - --heldItem.stackSize; - } + @Override + public ItemStack onItemRightClick(ItemStack heldItem, World worldIn, EntityPlayer playerIn) { + if (!playerIn.capabilities.isCreativeMode) { + --heldItem.stackSize; + } - worldIn.playSoundEffect(playerIn.posX, playerIn.posY, playerIn.posZ, "aether_legacy:projectile.shoot", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F)); + worldIn.playSoundEffect(playerIn.posX, playerIn.posY, playerIn.posZ, "aether_legacy:projectile.shoot", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!worldIn.isRemote) - { - EntityLightningKnife lightningKnife = new EntityLightningKnife(worldIn, playerIn); + if (!worldIn.isRemote) { + EntityLightningKnife lightningKnife = new EntityLightningKnife(worldIn, playerIn); - lightningKnife.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); + lightningKnife.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); - worldIn.spawnEntityInWorld(lightningKnife); - } + worldIn.spawnEntityInWorld(lightningKnife); + } - return heldItem; - } + return heldItem; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemNotchHammer.java b/src/main/java/com/legacy/aether/items/weapons/ItemNotchHammer.java index 64241e7..7550ec8 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemNotchHammer.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemNotchHammer.java @@ -11,49 +11,39 @@ import com.legacy.aether.items.ItemsAether; import com.legacy.aether.player.PlayerAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemNotchHammer extends ItemSword -{ +public class ItemNotchHammer extends ItemSword { - public ItemNotchHammer() - { + public ItemNotchHammer() { super(ToolMaterial.IRON); - this.setCreativeTab(AetherCreativeTabs.weapons); + this.setCreativeTab(AetherCreativeTabs.weapons); } @Override - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return false; } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) - { - if (entityplayer.capabilities.isCreativeMode) - { + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { + if (entityplayer.capabilities.isCreativeMode) { world.playSound(entityplayer.posX, entityplayer.posY, entityplayer.posZ, "mob.ghast.fireball", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F), false); - if (!world.isRemote) - { + if (!world.isRemote) { EntityHammerProjectile hammerProjectile = new EntityHammerProjectile(world, entityplayer); hammerProjectile.shoot(entityplayer, entityplayer.rotationPitch, entityplayer.rotationYaw, 0.0F, 1.5F, 1.0F); world.spawnEntityInWorld(hammerProjectile); } - } - else if (PlayerAether.get(entityplayer).setHammerCooldown(200, itemstack.getDisplayName())) - { + } else if (PlayerAether.get(entityplayer).setHammerCooldown(200, itemstack.getDisplayName())) { itemstack.damageItem(1, entityplayer); world.playSound(entityplayer.posX, entityplayer.posY, entityplayer.posZ, "mob.ghast.fireball", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F), false); - if (!world.isRemote) - { + if (!world.isRemote) { EntityHammerProjectile hammerProjectile = new EntityHammerProjectile(world, entityplayer); hammerProjectile.shoot(entityplayer, entityplayer.rotationPitch, entityplayer.rotationYaw, 0.0F, 1.5F, 1.0F); world.spawnEntityInWorld(hammerProjectile); diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemPigSlayer.java b/src/main/java/com/legacy/aether/items/weapons/ItemPigSlayer.java index 0cc8b3b..a9842aa 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemPigSlayer.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemPigSlayer.java @@ -11,56 +11,47 @@ import net.minecraft.util.DamageSource; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemPigSlayer extends ItemSword -{ +public class ItemPigSlayer extends ItemSword { - public ItemPigSlayer() - { - super(ToolMaterial.IRON); - this.setMaxDamage(200); - this.setCreativeTab(AetherCreativeTabs.weapons); - } + public ItemPigSlayer() { + super(ToolMaterial.IRON); + this.setMaxDamage(200); + this.setCreativeTab(AetherCreativeTabs.weapons); + } @Override - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return false; } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) - { - if(entityliving == null || entityliving1 == null) - { + @Override + public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) { + if (entityliving == null || entityliving1 == null) { return false; } - String s = EntityList.getEntityString((Entity)entityliving); + String s = EntityList.getEntityString((Entity) entityliving); - if(s != null && (s.toLowerCase().contains("pig") || s.toLowerCase().contains("phyg") || s.toLowerCase().contains("taegore") || entityliving.getUniqueID().toString().equals("1d680bb6-2a9a-4f25-bf2f-a1af74361d69"))) - { - if(entityliving.getHealth() > 0) - { + if (s != null && (s.toLowerCase().contains("pig") || s.toLowerCase().contains("phyg") || s.toLowerCase().contains("taegore") || entityliving.getUniqueID().toString().equals("1d680bb6-2a9a-4f25-bf2f-a1af74361d69"))) { + if (entityliving.getHealth() > 0) { entityliving.attackEntityFrom(DamageSource.causeMobDamage(entityliving1), 9999); } - for(int j = 0; j < 20; j++) - { - double d = itemRand.nextGaussian() * 0.02D; - double d1 = itemRand.nextGaussian() * 0.02D; - double d2 = itemRand.nextGaussian() * 0.02D; - double d3 = 5D; - entityliving.worldObj.spawnParticle("flame", (entityliving.posX + (double)(itemRand.nextFloat() * entityliving.width * 2.0F)) - (double)entityliving.width - d * d3, (entityliving.posY + (double)(itemRand.nextFloat() * entityliving.height)) - d1 * d3, (entityliving.posZ + (double)(itemRand.nextFloat() * entityliving.width * 2.0F)) - (double)entityliving.width - d2 * d3, d, d1, d2); - } + for (int j = 0; j < 20; j++) { + double d = itemRand.nextGaussian() * 0.02D; + double d1 = itemRand.nextGaussian() * 0.02D; + double d2 = itemRand.nextGaussian() * 0.02D; + double d3 = 5D; + entityliving.worldObj.spawnParticle("flame", (entityliving.posX + (double) (itemRand.nextFloat() * entityliving.width * 2.0F)) - (double) entityliving.width - d * d3, (entityliving.posY + (double) (itemRand.nextFloat() * entityliving.height)) - d1 * d3, (entityliving.posZ + (double) (itemRand.nextFloat() * entityliving.width * 2.0F)) - (double) entityliving.width - d2 * d3, d, d1, d2); + } } - return super.hitEntity(itemstack, entityliving, entityliving1); - } + return super.hitEntity(itemstack, entityliving, entityliving1); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemSkyrootSword.java b/src/main/java/com/legacy/aether/items/weapons/ItemSkyrootSword.java index 183738d..9b4f2bb 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemSkyrootSword.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemSkyrootSword.java @@ -7,18 +7,15 @@ import net.minecraft.item.ItemSword; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemSkyrootSword extends ItemSword -{ +public class ItemSkyrootSword extends ItemSword { - public ItemSkyrootSword() - { + public ItemSkyrootSword() { super(ToolMaterial.WOOD); this.setCreativeTab(AetherCreativeTabs.weapons); } @Override - public boolean getIsRepairable(ItemStack repairingItem, ItemStack material) - { + public boolean getIsRepairable(ItemStack repairingItem, ItemStack material) { return material.getItem() == Item.getItemFromBlock(BlocksAether.golden_oak_log) || material.getItem() == Item.getItemFromBlock(BlocksAether.skyroot_log) || material.getItem() == Item.getItemFromBlock(BlocksAether.skyroot_planks); } diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemValkyrieLance.java b/src/main/java/com/legacy/aether/items/weapons/ItemValkyrieLance.java index 3eda648..21dbad0 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemValkyrieLance.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemValkyrieLance.java @@ -15,34 +15,28 @@ import net.minecraft.util.Vec3; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemValkyrieLance extends ItemSword -{ +public class ItemValkyrieLance extends ItemSword { - public ItemValkyrieLance() - { + public ItemValkyrieLance() { super(ToolMaterial.EMERALD); this.setCreativeTab(AetherCreativeTabs.weapons); } @Override - public EnumAction getItemUseAction(ItemStack stack) - { - return EnumAction.none; - } + public EnumAction getItemUseAction(ItemStack stack) { + return EnumAction.none; + } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } @Override @SuppressWarnings("unchecked") - public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) - { - if (!(entityLiving instanceof EntityPlayer)) - { + public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { + if (!(entityLiving instanceof EntityPlayer)) { return false; } @@ -56,45 +50,38 @@ public class ItemValkyrieLance extends ItemSword Entity found = null; double foundLen = 0.0D; - for (Object o : locatedEntities) - { - if (o == player) - { + for (Object o : locatedEntities) { + if (o == player) { continue; } Entity ent = (Entity) o; - if (!ent.canBeCollidedWith()) - { + if (!ent.canBeCollidedWith()) { continue; } Vec3 vec = Vec3.createVectorHelper(ent.posX - player.posX, ent.boundingBox.minY + ent.height / 2f - player.posY - player.getEyeHeight(), ent.posZ - player.posZ); double len = vec.lengthVector(); - if (len > 10.0F) - { + if (len > 10.0F) { continue; } vec = vec.normalize(); double dot = playerVision.dotProduct(vec); - if (dot < 1.0 - 0.125 / len || !player.canEntityBeSeen(ent)) - { + if (dot < 1.0 - 0.125 / len || !player.canEntityBeSeen(ent)) { continue; } - if (foundLen == 0.0 || len < foundLen) - { + if (foundLen == 0.0 || len < foundLen) { found = ent; foundLen = len; } } - if (found != null && player.ridingEntity != found) - { + if (found != null && player.ridingEntity != found) { stack.damageItem(1, player); player.attackTargetEntityWithCurrentItem(found); @@ -104,8 +91,7 @@ public class ItemValkyrieLance extends ItemSword } @Override - public boolean getIsRepairable(ItemStack repairingItem, ItemStack material) - { + public boolean getIsRepairable(ItemStack repairingItem, ItemStack material) { return false; } diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemVampireBlade.java b/src/main/java/com/legacy/aether/items/weapons/ItemVampireBlade.java index 3520d44..92ab4db 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemVampireBlade.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemVampireBlade.java @@ -9,39 +9,33 @@ import net.minecraft.item.ItemSword; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemVampireBlade extends ItemSword -{ +public class ItemVampireBlade extends ItemSword { - public ItemVampireBlade() - { - super(ToolMaterial.EMERALD); + public ItemVampireBlade() { + super(ToolMaterial.EMERALD); - this.setCreativeTab(AetherCreativeTabs.weapons); - } + this.setCreativeTab(AetherCreativeTabs.weapons); + } @Override - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return false; } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } - @Override - public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) - { - EntityPlayer player = (EntityPlayer)attacker; + @Override + public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { + EntityPlayer player = (EntityPlayer) attacker; - if(player.getHealth() < player.getMaxHealth()) - { + if (player.getHealth() < player.getMaxHealth()) { player.heal(1.0F); } - return super.hitEntity(stack, target, attacker); - } + return super.hitEntity(stack, target, attacker); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/ItemZaniteSword.java b/src/main/java/com/legacy/aether/items/weapons/ItemZaniteSword.java index 4f7d53f..c24a80d 100644 --- a/src/main/java/com/legacy/aether/items/weapons/ItemZaniteSword.java +++ b/src/main/java/com/legacy/aether/items/weapons/ItemZaniteSword.java @@ -11,77 +11,59 @@ import com.google.common.collect.Multimap; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; -public class ItemZaniteSword extends ItemSword -{ +public class ItemZaniteSword extends ItemSword { - public float[] level = new float[] {3.0F, 4.0F, 5.0F, 6.0F, 7.0F}; + public float[] level = new float[]{3.0F, 4.0F, 5.0F, 6.0F, 7.0F}; - public ItemZaniteSword() - { - super(ToolMaterial.IRON); - this.setCreativeTab(AetherCreativeTabs.weapons); - } + public ItemZaniteSword() { + super(ToolMaterial.IRON); + this.setCreativeTab(AetherCreativeTabs.weapons); + } - @Override - public Multimap getItemAttributeModifiers() - { - return null; - } + @Override + public Multimap getItemAttributeModifiers() { + return null; + } - @Override - public Multimap getAttributeModifiers(ItemStack stack) - { - Multimap multimap = HashMultimap.create(); + @Override + public Multimap getAttributeModifiers(ItemStack stack) { + Multimap multimap = HashMultimap.create(); - if (stack.getItem() instanceof ItemZaniteSword) - { - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.calculateIncrease(stack), 0)); - } + if (stack.getItem() instanceof ItemZaniteSword) { + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double) this.calculateIncrease(stack), 0)); + } - return multimap; - } + return multimap; + } - private float calculateIncrease(ItemStack tool) - { - int current = tool.getItemDamage(); + private float calculateIncrease(ItemStack tool) { + int current = tool.getItemDamage(); - if (isBetween(tool.getMaxDamage(), current, tool.getMaxDamage() - 50)) - { + if (isBetween(tool.getMaxDamage(), current, tool.getMaxDamage() - 50)) { return level[4]; - } - else if (isBetween(tool.getMaxDamage() - 51, current, tool.getMaxDamage() - 110)) - { + } else if (isBetween(tool.getMaxDamage() - 51, current, tool.getMaxDamage() - 110)) { return level[3]; - } - else if (isBetween(tool.getMaxDamage() - 111, current, tool.getMaxDamage() - 200)) - { + } else if (isBetween(tool.getMaxDamage() - 111, current, tool.getMaxDamage() - 200)) { return level[2]; - } - else if (isBetween(tool.getMaxDamage() - 201, current, tool.getMaxDamage() - 239)) - { + } else if (isBetween(tool.getMaxDamage() - 201, current, tool.getMaxDamage() - 239)) { return level[1]; - } - else - { + } else { return level[0]; } - } + } - private boolean isBetween(int max, int origin, int min) - { - return origin <= max && origin >= min ? true : false; - } + private boolean isBetween(int max, int origin, int min) { + return origin <= max && origin >= min ? true : false; + } - @Override - public boolean getIsRepairable(ItemStack repairingItem, ItemStack material) - { - return material.getItem() == ItemsAether.zanite_gemstone; - } + @Override + public boolean getIsRepairable(ItemStack repairingItem, ItemStack material) { + return material.getItem() == ItemsAether.zanite_gemstone; + } - @Override - public float getDigSpeed(ItemStack itemstack, Block block, int meta) - { - return super.getDigSpeed(itemstack, block, meta) * (2.0F * (float)itemstack.getItemDamage() / (float)itemstack.getMaxDamage() + 0.5F); - } + @Override + public float getDigSpeed(ItemStack itemstack, Block block, int meta) { + return super.getDigSpeed(itemstack, block, meta) * (2.0F * (float) itemstack.getItemDamage() / (float) itemstack.getMaxDamage() + 0.5F); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/projectile/ItemDart.java b/src/main/java/com/legacy/aether/items/weapons/projectile/ItemDart.java index 0c1871d..20d764b 100644 --- a/src/main/java/com/legacy/aether/items/weapons/projectile/ItemDart.java +++ b/src/main/java/com/legacy/aether/items/weapons/projectile/ItemDart.java @@ -16,64 +16,56 @@ import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemDart extends Item -{ +public class ItemDart extends Item { - @SideOnly(Side.CLIENT) - private IIcon goldenIcon; + @SideOnly(Side.CLIENT) + private IIcon goldenIcon; - @SideOnly(Side.CLIENT) - private IIcon poisonIcon; + @SideOnly(Side.CLIENT) + private IIcon poisonIcon; - @SideOnly(Side.CLIENT) - private IIcon enchantedIcon; + @SideOnly(Side.CLIENT) + private IIcon enchantedIcon; - public ItemDart() - { - super(); + public ItemDart() { + super(); - this.setHasSubtypes(true); - this.setCreativeTab(AetherCreativeTabs.weapons); - } + this.setHasSubtypes(true); + this.setCreativeTab(AetherCreativeTabs.weapons); + } @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister registry) - { - this.goldenIcon = registry.registerIcon(Aether.find("projectile/golden_dart")); - this.poisonIcon = registry.registerIcon(Aether.find("projectile/poison_dart")); - this.enchantedIcon = registry.registerIcon(Aether.find("projectile/enchanted_dart")); - } + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister registry) { + this.goldenIcon = registry.registerIcon(Aether.find("projectile/golden_dart")); + this.poisonIcon = registry.registerIcon(Aether.find("projectile/poison_dart")); + this.enchantedIcon = registry.registerIcon(Aether.find("projectile/enchanted_dart")); + } @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { - return meta == 1 ? this.poisonIcon : meta == 2 ? this.enchantedIcon : this.goldenIcon; - } + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return meta == 1 ? this.poisonIcon : meta == 2 ? this.enchantedIcon : this.goldenIcon; + } @Override - public EnumRarity getRarity(ItemStack stack) - { - return stack.getItemDamage() == 2 ? EnumRarity.rare : super.getRarity(stack); - } + public EnumRarity getRarity(ItemStack stack) { + return stack.getItemDamage() == 2 ? EnumRarity.rare : super.getRarity(stack); + } @Override - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { int i = itemstack.getItemDamage(); return this.getUnlocalizedName() + "_" + EnumDartType.values()[i].toString(); } @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubItems(Item item, CreativeTabs tab, List subItems) - { - for (int var4 = 0; var4 < EnumDartType.values().length ; ++var4) - { - subItems.add(new ItemStack(this, 1, var4)); - } - } + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubItems(Item item, CreativeTabs tab, List subItems) { + for (int var4 = 0; var4 < EnumDartType.values().length; ++var4) { + subItems.add(new ItemStack(this, 1, var4)); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/items/weapons/projectile/ItemDartShooter.java b/src/main/java/com/legacy/aether/items/weapons/projectile/ItemDartShooter.java index b690897..f9fccf7 100644 --- a/src/main/java/com/legacy/aether/items/weapons/projectile/ItemDartShooter.java +++ b/src/main/java/com/legacy/aether/items/weapons/projectile/ItemDartShooter.java @@ -24,91 +24,76 @@ import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemDartShooter extends Item -{ +public class ItemDartShooter extends Item { - @SideOnly(Side.CLIENT) - private IIcon goldenIcon; + @SideOnly(Side.CLIENT) + private IIcon goldenIcon; - @SideOnly(Side.CLIENT) - private IIcon poisonIcon; + @SideOnly(Side.CLIENT) + private IIcon poisonIcon; - @SideOnly(Side.CLIENT) - private IIcon enchantedIcon; + @SideOnly(Side.CLIENT) + private IIcon enchantedIcon; - public ItemDartShooter() - { + public ItemDartShooter() { super(); this.setMaxStackSize(1); this.setHasSubtypes(true); - this.setCreativeTab(AetherCreativeTabs.weapons); + this.setCreativeTab(AetherCreativeTabs.weapons); } @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister registry) - { - this.goldenIcon = registry.registerIcon(Aether.find("projectile/golden_dart_shooter")); - this.poisonIcon = registry.registerIcon(Aether.find("projectile/poison_dart_shooter")); - this.enchantedIcon = registry.registerIcon(Aether.find("projectile/enchanted_dart_shooter")); - } + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister registry) { + this.goldenIcon = registry.registerIcon(Aether.find("projectile/golden_dart_shooter")); + this.poisonIcon = registry.registerIcon(Aether.find("projectile/poison_dart_shooter")); + this.enchantedIcon = registry.registerIcon(Aether.find("projectile/enchanted_dart_shooter")); + } @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) - { - return meta == 1 ? this.poisonIcon : meta == 2 ? this.enchantedIcon : this.goldenIcon; - } + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return meta == 1 ? this.poisonIcon : meta == 2 ? this.enchantedIcon : this.goldenIcon; + } @Override - public boolean isFull3D() - { + public boolean isFull3D() { return false; } @Override - public EnumRarity getRarity(ItemStack stack) - { - return stack.getItemDamage() == 2 ? EnumRarity.rare : super.getRarity(stack); - } + public EnumRarity getRarity(ItemStack stack) { + return stack.getItemDamage() == 2 ? EnumRarity.rare : super.getRarity(stack); + } @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void getSubItems(Item item, CreativeTabs tab, List subItems) - { - for (int var4 = 0; var4 < EnumDartShooterType.values().length; ++var4) - { + @SuppressWarnings({"unchecked", "rawtypes"}) + public void getSubItems(Item item, CreativeTabs tab, List subItems) { + for (int var4 = 0; var4 < EnumDartShooterType.values().length; ++var4) { subItems.add(new ItemStack(this, 1, var4)); } } - private int consumeItem(EntityPlayer player, Item itemID, int maxDamage) - { + private int consumeItem(EntityPlayer player, Item itemID, int maxDamage) { IInventory inv = player.inventory; - for (int i = 0; i < inv.getSizeInventory(); i++) - { + for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if (stack == null) - { + if (stack == null) { continue; } int damage = stack.getItemDamage(); - if (maxDamage != 3) - { - if (stack.getItem() == itemID && stack.getItemDamage() == maxDamage) - { - if (!player.capabilities.isCreativeMode) - { + if (maxDamage != 3) { + if (stack.getItem() == itemID && stack.getItemDamage() == maxDamage) { + if (!player.capabilities.isCreativeMode) { --stack.stackSize; } - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { stack = null; } @@ -117,15 +102,12 @@ public class ItemDartShooter extends Item return damage; } } - if (maxDamage == 3 && stack.getItem() == itemID) - { - if (!player.capabilities.isCreativeMode) - { + if (maxDamage == 3 && stack.getItem() == itemID) { + if (!player.capabilities.isCreativeMode) { --stack.stackSize; } - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { stack = null; } @@ -139,54 +121,40 @@ public class ItemDartShooter extends Item } @Override - public String getUnlocalizedName(ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { return this.getUnlocalizedName() + "_" + EnumDartShooterType.getType(itemstack.getItemDamage()).toString(); } @Override - public ItemStack onItemRightClick(ItemStack heldItem, World world, EntityPlayer entityplayer) - { + public ItemStack onItemRightClick(ItemStack heldItem, World world, EntityPlayer entityplayer) { int consume; - if (!(entityplayer.capabilities.isCreativeMode)) - { + if (!(entityplayer.capabilities.isCreativeMode)) { consume = this.consumeItem(entityplayer, ItemsAether.dart, heldItem.getItemDamage()); - } - else - { + } else { consume = heldItem.getItemDamage(); } - if (consume != -1) - { + if (consume != -1) { world.playSoundEffect(entityplayer.posX, entityplayer.posY, entityplayer.posZ, "aether_legacy:projectile.dart_shooter.shoot", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F)); EntityDartBase dart = null; - if (consume == 1) - { + if (consume == 1) { dart = new EntityDartPoison(world, entityplayer, 1.0F); - } - else if (consume == 2) - { + } else if (consume == 2) { dart = new EntityDartEnchanted(world, entityplayer, 1.0F); - } - else if (consume == 0) - { + } else if (consume == 0) { dart = new EntityDartGolden(world, entityplayer, 1.0F); } - if (!world.isRemote) - { + if (!world.isRemote) { world.spawnEntityInWorld(dart); - if (!(entityplayer.capabilities.isCreativeMode)) - { + if (!(entityplayer.capabilities.isCreativeMode)) { dart.canBePickedUp = 1; } - if ((entityplayer.capabilities.isCreativeMode)) - { + if ((entityplayer.capabilities.isCreativeMode)) { dart.canBePickedUp = 2; } } diff --git a/src/main/java/com/legacy/aether/items/weapons/projectile/ItemPhoenixBow.java b/src/main/java/com/legacy/aether/items/weapons/projectile/ItemPhoenixBow.java index bf5cb8c..a4e477e 100644 --- a/src/main/java/com/legacy/aether/items/weapons/projectile/ItemPhoenixBow.java +++ b/src/main/java/com/legacy/aether/items/weapons/projectile/ItemPhoenixBow.java @@ -24,234 +24,197 @@ import com.legacy.aether.registry.creative_tabs.AetherCreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemPhoenixBow extends ItemBow -{ +public class ItemPhoenixBow extends ItemBow { - @SideOnly(Side.CLIENT) - private IIcon[] iconArray; + @SideOnly(Side.CLIENT) + private IIcon[] iconArray; - public ItemPhoenixBow() - { - super(); + public ItemPhoenixBow() { + super(); - this.maxStackSize = 1; - this.setMaxDamage(384); - this.setFull3D(); - this.setTextureName(Aether.find("weapons/bow")); - this.setCreativeTab(AetherCreativeTabs.weapons); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getItemIconForUseDuration(int p_94599_1_) - { - return this.iconArray[p_94599_1_]; - } - - @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - { - if (usingItem != null && stack.getItem() == ItemsAether.phoenix_bow) - { - int j = stack.getMaxItemUseDuration() - useRemaining; - - if (j >= 18) - { - return this.getItemIconForUseDuration(2); - } - - if (j > 13) - { - return this.getItemIconForUseDuration(1); - } - - if (j > 0) - { - return this.getItemIconForUseDuration(0); - } - } - - return getIcon(stack, renderPass); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister p_94581_1_) - { - this.itemIcon = p_94581_1_.registerIcon(Aether.find("weapons/phoenix_bow")); - this.iconArray = new IIcon[bowPullIconNameArray.length]; - - for (int i = 0; i < this.iconArray.length; ++i) - { - this.iconArray[i] = p_94581_1_.registerIcon(this.getIconString() + "_" + bowPullIconNameArray[i]); - } - } + this.maxStackSize = 1; + this.setMaxDamage(384); + this.setFull3D(); + this.setTextureName(Aether.find("weapons/bow")); + this.setCreativeTab(AetherCreativeTabs.weapons); + } @Override - public EnumRarity getRarity(ItemStack stack) - { - return ItemsAether.aether_loot; - } + @SideOnly(Side.CLIENT) + public IIcon getItemIconForUseDuration(int p_94599_1_) { + return this.iconArray[p_94599_1_]; + } - private ItemStack findAmmo(EntityPlayer player) - { - for (int i = 0; i < player.inventory.getSizeInventory(); ++i) - { - ItemStack itemstack = player.inventory.getStackInSlot(i); + @Override + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (usingItem != null && stack.getItem() == ItemsAether.phoenix_bow) { + int j = stack.getMaxItemUseDuration() - useRemaining; - if (this.isArrow(itemstack)) - { - return itemstack; - } - } + if (j >= 18) { + return this.getItemIconForUseDuration(2); + } - return null; - } + if (j > 13) { + return this.getItemIconForUseDuration(1); + } - protected boolean isArrow(ItemStack stack) - { - return stack != null && stack.getItem() == Items.arrow; - } + if (j > 0) { + return this.getItemIconForUseDuration(0); + } + } - @Override - public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer entityLiving, int timeLeft) - { - if (entityLiving instanceof EntityPlayer) - { - EntityPlayer entityplayer = (EntityPlayer)entityLiving; - boolean flag = entityplayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; - ItemStack itemstack = this.findAmmo(entityplayer); + return getIcon(stack, renderPass); + } - int i = this.getMaxItemUseDuration(stack) - timeLeft; - ArrowLooseEvent event = new ArrowLooseEvent(entityplayer, stack, i); - MinecraftForge.EVENT_BUS.post(event); + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister p_94581_1_) { + this.itemIcon = p_94581_1_.registerIcon(Aether.find("weapons/phoenix_bow")); + this.iconArray = new IIcon[bowPullIconNameArray.length]; - if (event.isCanceled()) - { - return; - } + for (int i = 0; i < this.iconArray.length; ++i) { + this.iconArray[i] = p_94581_1_.registerIcon(this.getIconString() + "_" + bowPullIconNameArray[i]); + } + } - i = event.charge; - if (i < 0) return; + @Override + public EnumRarity getRarity(ItemStack stack) { + return ItemsAether.aether_loot; + } - if (itemstack != null || flag) - { - if (itemstack == null) - { - itemstack = new ItemStack(Items.arrow); - } + private ItemStack findAmmo(EntityPlayer player) { + for (int i = 0; i < player.inventory.getSizeInventory(); ++i) { + ItemStack itemstack = player.inventory.getStackInSlot(i); - float f = getArrowVelocity(i); + if (this.isArrow(itemstack)) { + return itemstack; + } + } - if ((double)f >= 0.1D) - { - boolean flag1 = entityplayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; + return null; + } - if (!worldIn.isRemote) - { - EntityPhoenixArrow entityarrow = this.createArrow(worldIn, f * 2.0F, itemstack, entityplayer); + protected boolean isArrow(ItemStack stack) { + return stack != null && stack.getItem() == Items.arrow; + } - if (f == 1.0F) - { - entityarrow.setIsCritical(true); - } + @Override + public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer entityLiving, int timeLeft) { + if (entityLiving instanceof EntityPlayer) { + EntityPlayer entityplayer = (EntityPlayer) entityLiving; + boolean flag = entityplayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; + ItemStack itemstack = this.findAmmo(entityplayer); - int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); + int i = this.getMaxItemUseDuration(stack) - timeLeft; + ArrowLooseEvent event = new ArrowLooseEvent(entityplayer, stack, i); + MinecraftForge.EVENT_BUS.post(event); - if (j > 0) - { - entityarrow.setDamage(entityarrow.getDamage() + (double)j * 0.5D + 0.5D); - } + if (event.isCanceled()) { + return; + } - int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); + i = event.charge; + if (i < 0) return; - if (k > 0) - { - entityarrow.setKnockbackStrength(k); - } + if (itemstack != null || flag) { + if (itemstack == null) { + itemstack = new ItemStack(Items.arrow); + } - stack.damageItem(1, entityplayer); + float f = getArrowVelocity(i); - if (flag1) - { - entityarrow.canBePickedUp = 2; - } + if ((double) f >= 0.1D) { + boolean flag1 = entityplayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; - worldIn.spawnEntityInWorld(entityarrow); - } + if (!worldIn.isRemote) { + EntityPhoenixArrow entityarrow = this.createArrow(worldIn, f * 2.0F, itemstack, entityplayer); - worldIn.playSoundAtEntity(entityLiving, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); + if (f == 1.0F) { + entityarrow.setIsCritical(true); + } - if (!flag1) - { - --itemstack.stackSize; + int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); - if (itemstack.stackSize == 0) - { - entityplayer.inventory.consumeInventoryItem(itemstack.getItem()); - } - } - } - } - } - } + if (j > 0) { + entityarrow.setDamage(entityarrow.getDamage() + (double) j * 0.5D + 0.5D); + } - public EntityPhoenixArrow createArrow(World worldIn, float distance, ItemStack stack, EntityLivingBase shooter) - { - EntityPhoenixArrow entityPhoenixArrow = new EntityPhoenixArrow(worldIn, shooter, distance); + int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); - return entityPhoenixArrow; - } + if (k > 0) { + entityarrow.setKnockbackStrength(k); + } - public static float getArrowVelocity(int charge) - { - float f = (float)charge / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; + stack.damageItem(1, entityplayer); - if (f > 1.0F) - { - f = 1.0F; - } + if (flag1) { + entityarrow.canBePickedUp = 2; + } - return f; - } + worldIn.spawnEntityInWorld(entityarrow); + } - @Override - public int getMaxItemUseDuration(ItemStack stack) - { - return 72000; - } + worldIn.playSoundAtEntity(entityLiving, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); - @Override - public EnumAction getItemUseAction(ItemStack stack) - { - return EnumAction.bow; - } - - @Override - public ItemStack onItemRightClick(ItemStack heldItem, World worldIn, EntityPlayer playerIn) - { - boolean flag = this.findAmmo(playerIn) != null; + if (!flag1) { + --itemstack.stackSize; - ArrowNockEvent event = new ArrowNockEvent(playerIn, heldItem); - MinecraftForge.EVENT_BUS.post(event); - if (event.isCanceled()) - { - return event.result; - } + if (itemstack.stackSize == 0) { + entityplayer.inventory.consumeInventoryItem(itemstack.getItem()); + } + } + } + } + } + } - if (playerIn.capabilities.isCreativeMode || flag) - { - playerIn.setItemInUse(heldItem, this.getMaxItemUseDuration(heldItem)); - } + public EntityPhoenixArrow createArrow(World worldIn, float distance, ItemStack stack, EntityLivingBase shooter) { + EntityPhoenixArrow entityPhoenixArrow = new EntityPhoenixArrow(worldIn, shooter, distance); - return heldItem; - } + return entityPhoenixArrow; + } - @Override - public int getItemEnchantability() - { - return 1; - } + public static float getArrowVelocity(int charge) { + float f = (float) charge / 20.0F; + f = (f * f + f * 2.0F) / 3.0F; + + if (f > 1.0F) { + f = 1.0F; + } + + return f; + } + + @Override + public int getMaxItemUseDuration(ItemStack stack) { + return 72000; + } + + @Override + public EnumAction getItemUseAction(ItemStack stack) { + return EnumAction.bow; + } + + @Override + public ItemStack onItemRightClick(ItemStack heldItem, World worldIn, EntityPlayer playerIn) { + boolean flag = this.findAmmo(playerIn) != null; + + ArrowNockEvent event = new ArrowNockEvent(playerIn, heldItem); + MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) { + return event.result; + } + + if (playerIn.capabilities.isCreativeMode || flag) { + playerIn.setItemInUse(heldItem, this.getMaxItemUseDuration(heldItem)); + } + + return heldItem; + } + + @Override + public int getItemEnchantability() { + return 1; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/network/AetherGuiHandler.java b/src/main/java/com/legacy/aether/network/AetherGuiHandler.java index c52d01a..738c36a 100644 --- a/src/main/java/com/legacy/aether/network/AetherGuiHandler.java +++ b/src/main/java/com/legacy/aether/network/AetherGuiHandler.java @@ -26,36 +26,23 @@ import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class AetherGuiHandler implements IGuiHandler -{ +public class AetherGuiHandler implements IGuiHandler { public static final int accessories = 1, enchanter = 2, freezer = 3, incubator = 4, treasure_chest = 5, lore = 6; @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - if (ID == accessories) - { + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + if (ID == accessories) { return new ContainerAccessories(PlayerAether.get(player).getAccessoryInventory(), player); - } - else if (ID == enchanter) - { + } else if (ID == enchanter) { return new ContainerEnchanter(player.inventory, (TileEntityEnchanter) world.getTileEntity(x, y, z)); - } - else if (ID == freezer) - { + } else if (ID == freezer) { return new ContainerFreezer(player.inventory, (TileEntityFreezer) world.getTileEntity(x, y, z)); - } - else if (ID == incubator) - { + } else if (ID == incubator) { return new ContainerIncubator(player, player.inventory, (TileEntityIncubator) world.getTileEntity(x, y, z)); - } - else if (ID == treasure_chest) - { + } else if (ID == treasure_chest) { return new ContainerChest(player.inventory, (IInventory) world.getTileEntity(x, y, z)); - } - else if (ID == lore) - { + } else if (ID == lore) { return new ContainerLore(player.inventory); } @@ -64,30 +51,18 @@ public class AetherGuiHandler implements IGuiHandler @Override @SideOnly(Side.CLIENT) - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - if (ID == accessories) - { + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + if (ID == accessories) { return new GuiAccessories(PlayerAether.get(player)); - } - else if (ID == enchanter) - { + } else if (ID == enchanter) { return new GuiEnchanter(player.inventory, (TileEntityEnchanter) world.getTileEntity(x, y, z)); - } - else if (ID == freezer) - { + } else if (ID == freezer) { return new GuiFreezer(player.inventory, (TileEntityFreezer) world.getTileEntity(x, y, z)); - } - else if (ID == incubator) - { + } else if (ID == incubator) { return new GuiIncubator(player, player.inventory, (TileEntityIncubator) world.getTileEntity(x, y, z)); - } - else if (ID == treasure_chest) - { + } else if (ID == treasure_chest) { return new GuiTreasureChest(player.inventory, (TileEntityTreasureChest) world.getTileEntity(x, y, z)); - } - else if (ID == lore) - { + } else if (ID == lore) { return new GuiLore(player.inventory); } diff --git a/src/main/java/com/legacy/aether/network/AetherNetwork.java b/src/main/java/com/legacy/aether/network/AetherNetwork.java index a342891..05ccd7d 100644 --- a/src/main/java/com/legacy/aether/network/AetherNetwork.java +++ b/src/main/java/com/legacy/aether/network/AetherNetwork.java @@ -20,15 +20,13 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class AetherNetwork -{ +public class AetherNetwork { public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Aether.MOD_ID); private static int discriminant; - public static void preInitialization() - { + public static void preInitialization() { NetworkRegistry.INSTANCE.registerGuiHandler(Aether.MOD_ID, new AetherGuiHandler()); INSTANCE.registerMessage(PacketOpenContainer.class, PacketOpenContainer.class, discriminant++, Side.SERVER); @@ -52,19 +50,16 @@ public class AetherNetwork INSTANCE.registerMessage(PacketSendSneaking.class, PacketSendSneaking.class, discriminant++, Side.SERVER); } - public static void sendToAll(IMessage message) - { + public static void sendToAll(IMessage message) { INSTANCE.sendToAll(message); } @SideOnly(Side.CLIENT) - public static void sendToServer(IMessage message) - { + public static void sendToServer(IMessage message) { INSTANCE.sendToServer(message); } - public static void sendTo(IMessage message, EntityPlayerMP player) - { + public static void sendTo(IMessage message, EntityPlayerMP player) { INSTANCE.sendTo(message, player); } diff --git a/src/main/java/com/legacy/aether/network/packets/AetherPacket.java b/src/main/java/com/legacy/aether/network/packets/AetherPacket.java index d069651..604652a 100644 --- a/src/main/java/com/legacy/aether/network/packets/AetherPacket.java +++ b/src/main/java/com/legacy/aether/network/packets/AetherPacket.java @@ -9,18 +9,13 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; -public abstract class AetherPacket implements IMessage, IMessageHandler -{ +public abstract class AetherPacket implements IMessage, IMessageHandler { @Override - public Packet onMessage(Packet message, MessageContext context) - { - if (context.side == Side.CLIENT) - { + public Packet onMessage(Packet message, MessageContext context) { + if (context.side == Side.CLIENT) { this.handleClient(message, Aether.proxy.getPlayer()); - } - else if (context.side == Side.SERVER) - { + } else if (context.side == Side.SERVER) { this.handleServer(message, context.getServerHandler().playerEntity); } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketAccessory.java b/src/main/java/com/legacy/aether/network/packets/PacketAccessory.java index ea9cb53..75f4914 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketAccessory.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketAccessory.java @@ -8,8 +8,7 @@ import com.legacy.aether.api.player.util.IAccessoryInventory; import com.legacy.aether.inventory.InventoryAccessories; import com.legacy.aether.player.PlayerAether; -public class PacketAccessory extends AetherPacket -{ +public class PacketAccessory extends AetherPacket { private IAccessoryInventory accessories; @@ -17,40 +16,33 @@ public class PacketAccessory extends AetherPacket private int entityID; - public PacketAccessory() - { - + public PacketAccessory() { + } - public PacketAccessory(IPlayerAether player) - { + public PacketAccessory(IPlayerAether player) { this.accessories = player.getAccessoryInventory(); this.entityID = player.getEntity().getEntityId(); } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { this.entityID = buf.readInt(); this.readBuf = buf; } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { buf.writeInt(this.entityID); this.accessories.writeData(buf); } @Override - public void handleClient(PacketAccessory message, EntityPlayer player) - { - if (player != null && player.worldObj != null) - { + public void handleClient(PacketAccessory message, EntityPlayer player) { + if (player != null && player.worldObj != null) { EntityPlayer parent = (EntityPlayer) player.worldObj.getEntityByID(message.entityID); - if (parent != null) - { + if (parent != null) { InventoryAccessories newInventory = new InventoryAccessories(PlayerAether.get(parent)); newInventory.readData(message.readBuf); @@ -61,8 +53,7 @@ public class PacketAccessory extends AetherPacket } @Override - public void handleServer(PacketAccessory message, EntityPlayer player) - { + public void handleServer(PacketAccessory message, EntityPlayer player) { } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketAchievement.java b/src/main/java/com/legacy/aether/network/packets/PacketAchievement.java index 4f26709..c3aaadd 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketAchievement.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketAchievement.java @@ -3,42 +3,35 @@ package com.legacy.aether.network.packets; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; -public class PacketAchievement extends AetherPacket -{ +public class PacketAchievement extends AetherPacket { public int achievementType; - public PacketAchievement() - { - + public PacketAchievement() { + } - public PacketAchievement(int achievementType) - { + public PacketAchievement(int achievementType) { this.achievementType = achievementType; } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { this.achievementType = buf.readInt(); } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { buf.writeInt(this.achievementType); } @Override - public void handleClient(PacketAchievement message, EntityPlayer player) - { + public void handleClient(PacketAchievement message, EntityPlayer player) { net.minecraft.client.Minecraft.getMinecraft().getSoundHandler().playSound(com.legacy.aether.client.audio.AetherMusicHandler.getAchievementSound(message.achievementType)); } @Override - public void handleServer(PacketAchievement message, EntityPlayer player) - { + public void handleServer(PacketAchievement message, EntityPlayer player) { } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketDialogueClicked.java b/src/main/java/com/legacy/aether/network/packets/PacketDialogueClicked.java index cf6ce62..3f40b6d 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketDialogueClicked.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketDialogueClicked.java @@ -7,49 +7,41 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.network.ByteBufUtils; -public class PacketDialogueClicked extends AetherPacket -{ +public class PacketDialogueClicked extends AetherPacket { public String dialogueName; public int dialogueId; - public PacketDialogueClicked() - { - + public PacketDialogueClicked() { + } - public PacketDialogueClicked(String dialogueName, int dialogueId) - { + public PacketDialogueClicked(String dialogueName, int dialogueId) { this.dialogueName = dialogueName; this.dialogueId = dialogueId; } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { this.dialogueName = ByteBufUtils.readUTF8String(buf); this.dialogueId = buf.readInt(); } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, this.dialogueName); buf.writeInt(this.dialogueId); } @Override - public void handleClient(PacketDialogueClicked message, EntityPlayer player) - { + public void handleClient(PacketDialogueClicked message, EntityPlayer player) { } @Override - public void handleServer(PacketDialogueClicked message, EntityPlayer player) - { - if (player != null) - { + public void handleServer(PacketDialogueClicked message, EntityPlayer player) { + if (player != null) { MinecraftForge.EVENT_BUS.post(new DialogueClickedEvent(player, message.dialogueName, message.dialogueId)); } } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketDisplayDialogue.java b/src/main/java/com/legacy/aether/network/packets/PacketDisplayDialogue.java index 06152a7..cbe0bd2 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketDisplayDialogue.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketDisplayDialogue.java @@ -11,20 +11,17 @@ import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class PacketDisplayDialogue extends AetherPacket -{ +public class PacketDisplayDialogue extends AetherPacket { public String dialogueName, dialogue; public ArrayList dialogueText; - public PacketDisplayDialogue() - { - + public PacketDisplayDialogue() { + } - public PacketDisplayDialogue(String dialogueName, String dialogue, String... dialogueText) - { + public PacketDisplayDialogue(String dialogueName, String dialogue, String... dialogueText) { this(dialogueName, dialogue, (ArrayList) null); ArrayList array = new ArrayList(); @@ -34,51 +31,44 @@ public class PacketDisplayDialogue extends AetherPacket this.dialogueText = array; } - public PacketDisplayDialogue(String dialogueName, String dialogue, ArrayList dialogueText) - { + public PacketDisplayDialogue(String dialogueName, String dialogue, ArrayList dialogueText) { this.dialogueName = dialogueName; this.dialogue = dialogue; this.dialogueText = dialogueText; } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { this.dialogueName = ByteBufUtils.readUTF8String(buf); this.dialogue = ByteBufUtils.readUTF8String(buf); this.dialogueText = new ArrayList(); int size = buf.readInt(); - for (int data = 0; data < size; ++data) - { + for (int data = 0; data < size; ++data) { this.dialogueText.add(ByteBufUtils.readUTF8String(buf)); } } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, this.dialogue); ByteBufUtils.writeUTF8String(buf, this.dialogueName); buf.writeInt(this.dialogueText.size()); - for (String dialogueForOptions : this.dialogueText) - { + for (String dialogueForOptions : this.dialogueText) { ByteBufUtils.writeUTF8String(buf, dialogueForOptions); } } @Override @SideOnly(Side.CLIENT) - public void handleClient(PacketDisplayDialogue message, EntityPlayer player) - { + public void handleClient(PacketDisplayDialogue message, EntityPlayer player) { FMLClientHandler.instance().getClient().displayGuiScreen(new com.legacy.aether.client.gui.dialogue.server.GuiServerDialogue(message.dialogueName, message.dialogue, message.dialogueText)); } @Override - public void handleServer(PacketDisplayDialogue message, EntityPlayer player) - { + public void handleServer(PacketDisplayDialogue message, EntityPlayer player) { } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketInitiateValkyrieFight.java b/src/main/java/com/legacy/aether/network/packets/PacketInitiateValkyrieFight.java index 69ae051..331c272 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketInitiateValkyrieFight.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketInitiateValkyrieFight.java @@ -7,53 +7,45 @@ import net.minecraft.entity.player.EntityPlayer; import com.legacy.aether.entities.bosses.valkyrie_queen.EntityValkyrieQueen; import com.legacy.aether.player.PlayerAether; -public class PacketInitiateValkyrieFight extends AetherPacket -{ +public class PacketInitiateValkyrieFight extends AetherPacket { public int slotId, entityId; - public PacketInitiateValkyrieFight() - { - + public PacketInitiateValkyrieFight() { + } - public PacketInitiateValkyrieFight(int slotId, int entityId) - { + public PacketInitiateValkyrieFight(int slotId, int entityId) { this.slotId = slotId; this.entityId = entityId; } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { this.slotId = buf.readInt(); this.entityId = buf.readInt(); } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { buf.writeInt(this.slotId); buf.writeInt(this.entityId); } @Override - public void handleClient(PacketInitiateValkyrieFight message, EntityPlayer player) - { + public void handleClient(PacketInitiateValkyrieFight message, EntityPlayer player) { } @Override - public void handleServer(PacketInitiateValkyrieFight message, EntityPlayer player) - { + public void handleServer(PacketInitiateValkyrieFight message, EntityPlayer player) { player.inventory.setInventorySlotContents(message.slotId, null); Entity entity = player.worldObj.getEntityByID(message.entityId); - if (entity instanceof EntityValkyrieQueen) - { - ((EntityValkyrieQueen)entity).setBossReady(true); - PlayerAether.get(player).setFocusedBoss((EntityValkyrieQueen)entity); + if (entity instanceof EntityValkyrieQueen) { + ((EntityValkyrieQueen) entity).setBossReady(true); + PlayerAether.get(player).setFocusedBoss((EntityValkyrieQueen) entity); } } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketOpenContainer.java b/src/main/java/com/legacy/aether/network/packets/PacketOpenContainer.java index 98c1e03..6c0f985 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketOpenContainer.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketOpenContainer.java @@ -5,43 +5,35 @@ import net.minecraft.entity.player.EntityPlayer; import com.legacy.aether.Aether; -public class PacketOpenContainer extends AetherPacket -{ +public class PacketOpenContainer extends AetherPacket { public int id; - public PacketOpenContainer() - { - + public PacketOpenContainer() { + } - public PacketOpenContainer(int id) - { + public PacketOpenContainer(int id) { this.id = id; } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { id = buf.readInt(); } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { buf.writeInt(id); } @Override - public void handleClient(PacketOpenContainer message, EntityPlayer player) - { + public void handleClient(PacketOpenContainer message, EntityPlayer player) { } @Override - public void handleServer(PacketOpenContainer message, EntityPlayer player) - { - if (message.id == -1) - { + public void handleServer(PacketOpenContainer message, EntityPlayer player) { + if (message.id == -1) { player.openContainer.onContainerClosed(player); player.openContainer = player.inventoryContainer; } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketPerkChanged.java b/src/main/java/com/legacy/aether/network/packets/PacketPerkChanged.java index 8eff858..800b986 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketPerkChanged.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketPerkChanged.java @@ -8,8 +8,7 @@ import com.legacy.aether.player.PlayerAether; import com.legacy.aether.player.perks.util.DonatorMoaSkin; import com.legacy.aether.player.perks.util.EnumAetherPerkType; -public class PacketPerkChanged extends AetherPacket -{ +public class PacketPerkChanged extends AetherPacket { public int entityID; @@ -19,78 +18,60 @@ public class PacketPerkChanged extends AetherPacket public EnumAetherPerkType perkType; - public PacketPerkChanged() - { + public PacketPerkChanged() { } - public PacketPerkChanged(int entityID, EnumAetherPerkType type, boolean info) - { + public PacketPerkChanged(int entityID, EnumAetherPerkType type, boolean info) { this.entityID = entityID; this.perkType = type; - if (type == EnumAetherPerkType.Halo) - { + if (type == EnumAetherPerkType.Halo) { this.renderHalo = info; } } - public PacketPerkChanged(int entityID, EnumAetherPerkType type, DonatorMoaSkin moa) - { + public PacketPerkChanged(int entityID, EnumAetherPerkType type, DonatorMoaSkin moa) { this.entityID = entityID; this.moaSkin = moa; this.perkType = type; } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { this.perkType = EnumAetherPerkType.getPerkByID(buf.readInt()); this.entityID = buf.readInt(); - if (this.perkType == EnumAetherPerkType.Halo) - { + if (this.perkType == EnumAetherPerkType.Halo) { this.renderHalo = buf.readBoolean(); - } - else if (this.perkType == EnumAetherPerkType.Moa) - { + } else if (this.perkType == EnumAetherPerkType.Moa) { this.moaSkin = DonatorMoaSkin.readMoaSkin(buf); } } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { buf.writeInt(this.perkType.getPerkID()); buf.writeInt(this.entityID); - if (this.perkType == EnumAetherPerkType.Halo) - { + if (this.perkType == EnumAetherPerkType.Halo) { buf.writeBoolean(this.renderHalo); - } - else if (this.perkType == EnumAetherPerkType.Moa) - { + } else if (this.perkType == EnumAetherPerkType.Moa) { this.moaSkin.writeMoaSkin(buf); } } @Override - public void handleClient(PacketPerkChanged message, EntityPlayer player) - { - if (player != null && player.worldObj != null) - { + public void handleClient(PacketPerkChanged message, EntityPlayer player) { + if (player != null && player.worldObj != null) { EntityPlayer parent = (EntityPlayer) player.worldObj.getEntityByID(message.entityID); - if (parent != null) - { + if (parent != null) { PlayerAether instance = PlayerAether.get(parent); - if (message.perkType == EnumAetherPerkType.Halo) - { + if (message.perkType == EnumAetherPerkType.Halo) { instance.shouldRenderHalo = message.renderHalo; - } - else if (message.perkType == EnumAetherPerkType.Moa) - { + } else if (message.perkType == EnumAetherPerkType.Moa) { instance.donatorMoaSkin = message.moaSkin; } } @@ -98,22 +79,16 @@ public class PacketPerkChanged extends AetherPacket } @Override - public void handleServer(PacketPerkChanged message, EntityPlayer player) - { - if (player != null && player.worldObj != null && !player.worldObj.isRemote) - { + public void handleServer(PacketPerkChanged message, EntityPlayer player) { + if (player != null && player.worldObj != null && !player.worldObj.isRemote) { EntityPlayer parent = (EntityPlayer) player.worldObj.getEntityByID(message.entityID); - if (parent != null) - { + if (parent != null) { PlayerAether instance = PlayerAether.get(parent); - if (message.perkType == EnumAetherPerkType.Halo) - { + if (message.perkType == EnumAetherPerkType.Halo) { instance.shouldRenderHalo = message.renderHalo; - } - else if (message.perkType == EnumAetherPerkType.Moa) - { + } else if (message.perkType == EnumAetherPerkType.Moa) { instance.donatorMoaSkin = message.moaSkin; } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketSendPoison.java b/src/main/java/com/legacy/aether/network/packets/PacketSendPoison.java index 31140b7..09cf9ee 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketSendPoison.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketSendPoison.java @@ -5,43 +5,35 @@ import net.minecraft.entity.player.EntityPlayer; import com.legacy.aether.player.PlayerAether; -public class PacketSendPoison extends AetherPacket -{ +public class PacketSendPoison extends AetherPacket { + + public PacketSendPoison() { - public PacketSendPoison() - { - } - public PacketSendPoison(EntityPlayer thePlayer) - { + public PacketSendPoison(EntityPlayer thePlayer) { } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { } @Override - public void handleClient(PacketSendPoison message, EntityPlayer player) - { - if (player != null && player.worldObj != null) - { + public void handleClient(PacketSendPoison message, EntityPlayer player) { + if (player != null && player.worldObj != null) { PlayerAether.get(player).inflictPoison(500); } } @Override - public void handleServer(PacketSendPoison message, EntityPlayer player) - { + public void handleServer(PacketSendPoison message, EntityPlayer player) { } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketSendSneaking.java b/src/main/java/com/legacy/aether/network/packets/PacketSendSneaking.java index 4c2a13e..96f3b4b 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketSendSneaking.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketSendSneaking.java @@ -6,53 +6,44 @@ import net.minecraft.entity.player.EntityPlayer; import com.legacy.aether.player.PlayerAether; -public class PacketSendSneaking extends AetherPacket -{ +public class PacketSendSneaking extends AetherPacket { private int entityId; private boolean isSneaking; - public PacketSendSneaking() - { - + public PacketSendSneaking() { + } - public PacketSendSneaking(int entityId, boolean isSneaking) - { + public PacketSendSneaking(int entityId, boolean isSneaking) { this.entityId = entityId; this.isSneaking = isSneaking; } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { this.entityId = buf.readInt(); this.isSneaking = buf.readBoolean(); } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { buf.writeInt(this.entityId); buf.writeBoolean(this.isSneaking); } @Override - public void handleClient(PacketSendSneaking message, EntityPlayer player) - { + public void handleClient(PacketSendSneaking message, EntityPlayer player) { } @Override - public void handleServer(PacketSendSneaking message, EntityPlayer player) - { - if (player != null) - { + public void handleServer(PacketSendSneaking message, EntityPlayer player) { + if (player != null) { Entity entity = player.worldObj.getEntityByID(message.entityId); - if (entity instanceof EntityPlayer) - { + if (entity instanceof EntityPlayer) { PlayerAether.get((EntityPlayer) entity).setMountSneaking(message.isSneaking); } } diff --git a/src/main/java/com/legacy/aether/network/packets/PacketSetTime.java b/src/main/java/com/legacy/aether/network/packets/PacketSetTime.java index 13389c3..d998480 100644 --- a/src/main/java/com/legacy/aether/network/packets/PacketSetTime.java +++ b/src/main/java/com/legacy/aether/network/packets/PacketSetTime.java @@ -5,63 +5,54 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import cpw.mods.fml.common.FMLCommonHandler; -public class PacketSetTime extends AetherPacket -{ +public class PacketSetTime extends AetherPacket { public float timeVariable; public int dimensionId; - public PacketSetTime() - { - + public PacketSetTime() { + } - public PacketSetTime(float timeVariable, int dimensionId) - { + public PacketSetTime(float timeVariable, int dimensionId) { this.dimensionId = dimensionId; this.timeVariable = timeVariable; } @Override - public void fromBytes(ByteBuf buf) - { + public void fromBytes(ByteBuf buf) { this.dimensionId = buf.readInt(); this.timeVariable = buf.readFloat(); } @Override - public void toBytes(ByteBuf buf) - { + public void toBytes(ByteBuf buf) { buf.writeInt(this.dimensionId); buf.writeFloat(this.timeVariable); } @Override - public void handleClient(PacketSetTime message, EntityPlayer player) - { + public void handleClient(PacketSetTime message, EntityPlayer player) { } @Override - public void handleServer(PacketSetTime message, EntityPlayer player) - { + public void handleServer(PacketSetTime message, EntityPlayer player) { message.setTime(message.timeVariable, message.dimensionId); } - public void setTime(float sliderValue, int dimension) - { - MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); + public void setTime(float sliderValue, int dimension) { + MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); - for (int i = 0; i < server.worldServers.length; ++i) - { - long shouldTime = (long)(24000L * sliderValue); - long worldTime = server.worldServers[i].getWorldInfo().getWorldTime(); - long remainder = worldTime % 24000L; - long add = shouldTime > remainder ? shouldTime - remainder : shouldTime + 24000 - remainder; + for (int i = 0; i < server.worldServers.length; ++i) { + long shouldTime = (long) (24000L * sliderValue); + long worldTime = server.worldServers[i].getWorldInfo().getWorldTime(); + long remainder = worldTime % 24000L; + long add = shouldTime > remainder ? shouldTime - remainder : shouldTime + 24000 - remainder; - server.worldServers[i].setWorldTime(worldTime + add); - } - } + server.worldServers[i].setWorldTime(worldTime + add); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/player/PlayerAether.java b/src/main/java/com/legacy/aether/player/PlayerAether.java index 50a2868..1a9d0a0 100644 --- a/src/main/java/com/legacy/aether/player/PlayerAether.java +++ b/src/main/java/com/legacy/aether/player/PlayerAether.java @@ -39,8 +39,7 @@ import com.legacy.aether.world.TeleporterAether; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.ReflectionHelper; -public class PlayerAether implements IPlayerAether -{ +public class PlayerAether implements IPlayerAether { private EntityPlayer player; @@ -78,71 +77,55 @@ public class PlayerAether implements IPlayerAether public float wingSinage; - public PlayerAether() - { + public PlayerAether() { this.abilities.addAll(Arrays.asList(new AbilityAccessories(this), new AbilityArmor(this), new AbilityFlight(this), new AbilityRepulsion(this))); } - public static PlayerAether get(EntityPlayer player) - { + public static PlayerAether get(EntityPlayer player) { return (PlayerAether) player.getExtendedProperties("aether_legacy:player_aether"); } @Override - public void init(Entity entity, World world) - { + public void init(Entity entity, World world) { this.player = (EntityPlayer) entity; this.poisonMovement = new AetherPoisonMovement(this.player); } @Override - public void onUpdate() - { - for (int i = 0; i < this.getAbilities().size(); ++i) - { + public void onUpdate() { + for (int i = 0; i < this.getAbilities().size(); ++i) { IAetherAbility ability = this.getAbilities().get(i); - if (ability.shouldExecute()) - { + if (ability.shouldExecute()) { ability.onUpdate(); } } - for (int i = 0; i < this.clouds.size(); ++i) - { + for (int i = 0; i < this.clouds.size(); ++i) { Entity entity = this.clouds.get(i); - if (entity.isDead) - { + if (entity.isDead) { this.clouds.remove(i); } } - if (this.cooldown > 0) - { + if (this.cooldown > 0) { this.cooldown -= 2; } - if (this.isInsideBlock(BlocksAether.aercloud)) - { + if (this.isInsideBlock(BlocksAether.aercloud)) { this.getEntity().fallDistance = 0.0F; } - if (!this.getEntity().onGround) - { + if (!this.getEntity().onGround) { this.wingSinage += 0.75F; - } - else - { + } else { this.wingSinage += 0.15F; } - if (this.wingSinage > 3.141593F * 2F) - { + if (this.wingSinage > 3.141593F * 2F) { this.wingSinage -= 3.141593F * 2F; - } - else - { + } else { this.wingSinage += 0.1F; } @@ -152,136 +135,110 @@ public class PlayerAether implements IPlayerAether this.setJumping(hasJumped); - this.getEntity().worldObj.theProfiler.startSection("portal"); + this.getEntity().worldObj.theProfiler.startSection("portal"); - int i = this.getEntity().getMaxInPortalTime(); + int i = this.getEntity().getMaxInPortalTime(); - if (this.getEntity().dimension == AetherConfig.getAetherDimensionID()) - { - if (this.getEntity().posY < -2) - { + if (this.getEntity().dimension == AetherConfig.getAetherDimensionID()) { + if (this.getEntity().posY < -2) { this.teleportPlayer(false); } } - if (this.inPortal) - { - if (this.getEntity().ridingEntity == null && this.portalCounter++ >= i) - { - this.portalCounter = i; - this.getEntity().timeUntilPortal = this.getEntity().getPortalCooldown(); + if (this.inPortal) { + if (this.getEntity().ridingEntity == null && this.portalCounter++ >= i) { + this.portalCounter = i; + this.getEntity().timeUntilPortal = this.getEntity().getPortalCooldown(); - if (!this.getEntity().worldObj.isRemote) - { - this.teleportPlayer(true); - this.getEntity().triggerAchievement(AchievementsAether.enter_aether); - } - } + if (!this.getEntity().worldObj.isRemote) { + this.teleportPlayer(true); + this.getEntity().triggerAchievement(AchievementsAether.enter_aether); + } + } - this.inPortal = false; - } - else - { - if (this.portalCounter > 0) - { - this.portalCounter -= 4; - } + this.inPortal = false; + } else { + if (this.portalCounter > 0) { + this.portalCounter -= 4; + } - if (this.portalCounter < 0) - { - this.portalCounter = 0; - } - } + if (this.portalCounter < 0) { + this.portalCounter = 0; + } + } - if (this.getEntity().timeUntilPortal > 0) - { - --this.getEntity().timeUntilPortal; - } + if (this.getEntity().timeUntilPortal > 0) { + --this.getEntity().timeUntilPortal; + } - this.getEntity().worldObj.theProfiler.endSection(); + this.getEntity().worldObj.theProfiler.endSection(); - if (!this.getEntity().worldObj.isRemote) - { - ItemStack stack = this.getEntity().getCurrentEquippedItem(); + if (!this.getEntity().worldObj.isRemote) { + ItemStack stack = this.getEntity().getCurrentEquippedItem(); - double distance = this.getEntity().capabilities.isCreativeMode ? 5.0D : 4.5D; + double distance = this.getEntity().capabilities.isCreativeMode ? 5.0D : 4.5D; - if (stack != null && stack.getItem() instanceof ItemValkyrieTool) - { - distance = 10.0D; - } + if (stack != null && stack.getItem() instanceof ItemValkyrieTool) { + distance = 10.0D; + } - ((EntityPlayerMP)this.getEntity()).theItemInWorldManager.setBlockReachDistance(distance); - } + ((EntityPlayerMP) this.getEntity()).theItemInWorldManager.setBlockReachDistance(distance); + } } @Override - public void setInPortal() - { - if (this.getEntity().timeUntilPortal > 0) - { - this.getEntity().timeUntilPortal = this.getEntity().getPortalCooldown(); - } - else - { - double d0 = this.getEntity().prevPosX - this.getEntity().posX; - double d1 = this.getEntity().prevPosZ - this.getEntity().posZ; + public void setInPortal() { + if (this.getEntity().timeUntilPortal > 0) { + this.getEntity().timeUntilPortal = this.getEntity().getPortalCooldown(); + } else { + double d0 = this.getEntity().prevPosX - this.getEntity().posX; + double d1 = this.getEntity().prevPosZ - this.getEntity().posZ; - if (!this.getEntity().worldObj.isRemote && !this.inPortal) - { - this.teleportDirection = Direction.getMovementDirection(d0, d1); - } + if (!this.getEntity().worldObj.isRemote && !this.inPortal) { + this.teleportDirection = Direction.getMovementDirection(d0, d1); + } - this.inPortal = true; - } + this.inPortal = true; + } } - public boolean isInsideBlock(Block block) - { - AxisAlignedBB boundingBox = this.getEntity().boundingBox; - int i = MathHelper.floor_double(boundingBox.minX); - int j = MathHelper.floor_double(boundingBox.maxX + 1.0D); - int k = MathHelper.floor_double(boundingBox.minY); - int l = MathHelper.floor_double(boundingBox.maxY + 1.0D); - int i1 = MathHelper.floor_double(boundingBox.minZ); - int j1 = MathHelper.floor_double(boundingBox.maxZ + 1.0D); + public boolean isInsideBlock(Block block) { + AxisAlignedBB boundingBox = this.getEntity().boundingBox; + int i = MathHelper.floor_double(boundingBox.minX); + int j = MathHelper.floor_double(boundingBox.maxX + 1.0D); + int k = MathHelper.floor_double(boundingBox.minY); + int l = MathHelper.floor_double(boundingBox.maxY + 1.0D); + int i1 = MathHelper.floor_double(boundingBox.minZ); + int j1 = MathHelper.floor_double(boundingBox.maxZ + 1.0D); - for (int k1 = i; k1 < j; ++k1) - { - for (int l1 = k; l1 < l; ++l1) - { - for (int i2 = i1; i2 < j1; ++i2) - { - if (this.getEntity().worldObj.getBlock(k1, l1, i2) == block) - { - return true; - } - } - } - } + for (int k1 = i; k1 < j; ++k1) { + for (int l1 = k; l1 < l; ++l1) { + for (int i2 = i1; i2 < j1; ++i2) { + if (this.getEntity().worldObj.getBlock(k1, l1, i2) == block) { + return true; + } + } + } + } - return false; - } + return false; + } /* * The teleporter which sends the player to the Aether/Overworld */ - private void teleportPlayer(boolean shouldSpawnPortal) - { - if (this.getEntity() instanceof EntityPlayerMP) - { + private void teleportPlayer(boolean shouldSpawnPortal) { + if (this.getEntity() instanceof EntityPlayerMP) { int previousDimension = this.getEntity().dimension; int transferDimension = previousDimension == AetherConfig.getAetherDimensionID() ? AetherConfig.getTravelDimensionID() : AetherConfig.getAetherDimensionID(); MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); TeleporterAether teleporter = new TeleporterAether(shouldSpawnPortal, server.worldServerForDimension(transferDimension)); - if (this.getEntity().ridingEntity != null) - { + if (this.getEntity().ridingEntity != null) { this.getEntity().ridingEntity.mountEntity(null); } - if (this.getEntity().riddenByEntity != null) - { + if (this.getEntity().riddenByEntity != null) { this.getEntity().riddenByEntity.mountEntity(null); } @@ -290,8 +247,7 @@ public class PlayerAether implements IPlayerAether } @Override - public void saveNBTData(NBTTagCompound compound) - { + public void saveNBTData(NBTTagCompound compound) { NBTTagCompound aetherTag = new NBTTagCompound(); aetherTag.setInteger("shardCount", this.shardCount); @@ -301,8 +257,7 @@ public class PlayerAether implements IPlayerAether } @Override - public void loadNBTData(NBTTagCompound compound) - { + public void loadNBTData(NBTTagCompound compound) { NBTTagCompound aetherTag = compound.getCompoundTag("aetherI"); this.updateShardCount(aetherTag.getInteger("shardCount")); @@ -310,75 +265,63 @@ public class PlayerAether implements IPlayerAether } @Override - public void setFocusedBoss(IAetherBoss boss) - { + public void setFocusedBoss(IAetherBoss boss) { this.focusedBoss = boss; } @Override - public IAetherBoss getFocusedBoss() - { + public IAetherBoss getFocusedBoss() { return this.focusedBoss; } @Override - public void setAccessoryInventory(IAccessoryInventory inventory) - { + public void setAccessoryInventory(IAccessoryInventory inventory) { this.accessories = inventory; } @Override - public IAccessoryInventory getAccessoryInventory() - { + public IAccessoryInventory getAccessoryInventory() { return this.accessories; } @Override - public ArrayList getAbilities() - { + public ArrayList getAbilities() { return this.abilities; } @Override - public EntityPlayer getEntity() - { + public EntityPlayer getEntity() { return this.player; } @Override - public void inflictPoison(int ticks) - { + public void inflictPoison(int ticks) { this.poisonMovement.inflictPoison(ticks); } @Override - public boolean isPoisoned() - { + public boolean isPoisoned() { return this.poisonMovement.ticks > 0; } @Override - public void inflictCure(int ticks) - { + public void inflictCure(int ticks) { this.poisonMovement.inflictCure(ticks); } @Override - public boolean isCured() - { + public boolean isCured() { return this.poisonMovement.ticks < 0; } @Override - public void updateShardCount(int amount) - { + public void updateShardCount(int amount) { UUID uuid = UUID.fromString("df6eabe7-6947-4a56-9099-002f90370706"); AttributeModifier healthModifier = new AttributeModifier(uuid, "Aether Health Modifier", amount * 2.0D, 0); this.shardCount = amount; - if (this.getEntity().getEntityAttribute(SharedMonsterAttributes.maxHealth).getModifier(uuid) != null) - { + if (this.getEntity().getEntityAttribute(SharedMonsterAttributes.maxHealth).getModifier(uuid) != null) { this.getEntity().getEntityAttribute(SharedMonsterAttributes.maxHealth).removeModifier(healthModifier); } @@ -386,51 +329,42 @@ public class PlayerAether implements IPlayerAether } @Override - public int getShardsUsed() - { + public int getShardsUsed() { return this.shardCount; } @Override - public int getMaxShardCount() - { + public int getMaxShardCount() { return AetherConfig.getMaxLifeShards(); } @Override - public void setJumping(boolean isJumping) - { + public void setJumping(boolean isJumping) { this.isJumping = isJumping; } @Override - public boolean isJumping() - { + public boolean isJumping() { return this.isJumping; } @Override - public void setMountSneaking(boolean isSneaking) - { + public void setMountSneaking(boolean isSneaking) { this.isMountSneaking = isSneaking; } @Override - public boolean isMountSneaking() - { + public boolean isMountSneaking() { return this.isMountSneaking; } @Override - public boolean isDonator() - { + public boolean isDonator() { return true; } - public boolean setHammerCooldown(int cooldown, String hammerName) - { - if (this.cooldown <= 0) - { + public boolean setHammerCooldown(int cooldown, String hammerName) { + if (this.cooldown <= 0) { this.cooldown = cooldown; this.cooldownMax = cooldown; this.hammerName = hammerName; @@ -442,20 +376,17 @@ public class PlayerAether implements IPlayerAether } @Override - public String getHammerName() - { + public String getHammerName() { return this.hammerName; } @Override - public int getHammerCooldown() - { + public int getHammerCooldown() { return this.cooldown; } @Override - public int getHammerMaxCooldown() - { + public int getHammerMaxCooldown() { return this.cooldownMax; } diff --git a/src/main/java/com/legacy/aether/player/PlayerAetherEvents.java b/src/main/java/com/legacy/aether/player/PlayerAetherEvents.java index 23176f9..57c0fde 100644 --- a/src/main/java/com/legacy/aether/player/PlayerAetherEvents.java +++ b/src/main/java/com/legacy/aether/player/PlayerAetherEvents.java @@ -30,27 +30,20 @@ import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; -public class PlayerAetherEvents -{ +public class PlayerAetherEvents { @SubscribeEvent - public void onPlayerAetherConstructing(EntityConstructing event) - { - if (event.entity instanceof EntityPlayer) - { + public void onPlayerAetherConstructing(EntityConstructing event) { + if (event.entity instanceof EntityPlayer) { event.entity.registerExtendedProperties("aether_legacy:player_aether", new PlayerAether()); - } - else if (event.entity instanceof EntityLivingBase) - { + } else if (event.entity instanceof EntityLivingBase) { event.entity.registerExtendedProperties("aether_legacy:entity_hook", new EntityHook()); } } @SubscribeEvent - public void onPlayerAetherLoggedIn(PlayerLoggedInEvent event) - { - if (!event.player.worldObj.isRemote) - { + public void onPlayerAetherLoggedIn(PlayerLoggedInEvent event) { + if (!event.player.worldObj.isRemote) { PlayerAether playerAether = PlayerAether.get(event.player); AetherNetwork.sendTo(new PacketAccessory(playerAether), (EntityPlayerMP) event.player); @@ -59,24 +52,20 @@ public class PlayerAetherEvents } @SubscribeEvent - public void onPlayerAetherClone(Clone event) - { + public void onPlayerAetherClone(Clone event) { PlayerAether original = PlayerAether.get(event.original); PlayerAether playerAether = PlayerAether.get(event.entityPlayer); playerAether.updateShardCount(original.getShardsUsed()); - if (!event.wasDeath || event.entityPlayer.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) - { + if (!event.wasDeath || event.entityPlayer.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { playerAether.setAccessoryInventory(original.getAccessoryInventory()); } } @SubscribeEvent - public void onPlayerAetherRespawn(PlayerRespawnEvent event) - { - if (!event.player.worldObj.isRemote) - { + public void onPlayerAetherRespawn(PlayerRespawnEvent event) { + if (!event.player.worldObj.isRemote) { PlayerAether playerAether = PlayerAether.get(event.player); AetherNetwork.sendTo(new PacketAccessory(playerAether), (EntityPlayerMP) event.player); @@ -85,10 +74,8 @@ public class PlayerAetherEvents } @SubscribeEvent - public void onPlayerAetherChangedDimension(PlayerChangedDimensionEvent event) - { - if (!event.player.worldObj.isRemote) - { + public void onPlayerAetherChangedDimension(PlayerChangedDimensionEvent event) { + if (!event.player.worldObj.isRemote) { PlayerAether playerAether = PlayerAether.get(event.player); AetherNetwork.sendTo(new PacketAccessory(playerAether), (EntityPlayerMP) event.player); @@ -97,36 +84,28 @@ public class PlayerAetherEvents } @SubscribeEvent - public void onPlayerAetherDeath(LivingDeathEvent event) - { - if (event.entityLiving instanceof EntityPlayer && !event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) - { + public void onPlayerAetherDeath(LivingDeathEvent event) { + if (event.entityLiving instanceof EntityPlayer && !event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { PlayerAether.get((EntityPlayer) event.entityLiving).getAccessoryInventory().dropAccessories(); } } @SubscribeEvent - public void onPlayerAetherUpdate(LivingUpdateEvent event) - { - if (event.entityLiving instanceof EntityPlayer) - { - PlayerAether.get((EntityPlayer) event.entityLiving).onUpdate();; - } - else if (event.entityLiving instanceof EntityLivingBase) - { - ((EntityHook)event.entityLiving.getExtendedProperties("aether_legacy:entity_hook")).onUpdate(); + public void onPlayerAetherUpdate(LivingUpdateEvent event) { + if (event.entityLiving instanceof EntityPlayer) { + PlayerAether.get((EntityPlayer) event.entityLiving).onUpdate(); + ; + } else if (event.entityLiving instanceof EntityLivingBase) { + ((EntityHook) event.entityLiving.getExtendedProperties("aether_legacy:entity_hook")).onUpdate(); } } @SubscribeEvent - public void onLivingHurt(LivingHurtEvent event) - { - if (event.entityLiving instanceof EntityPlayer) - { + public void onLivingHurt(LivingHurtEvent event) { + if (event.entityLiving instanceof EntityPlayer) { PlayerAether playerAether = PlayerAether.get((EntityPlayer) event.entityLiving); - if (playerAether.getAccessoryInventory().isWearingObsidianSet()) - { + if (playerAether.getAccessoryInventory().isWearingObsidianSet()) { float original = event.ammount; event.ammount = original / 2; @@ -135,53 +114,41 @@ public class PlayerAetherEvents } @SubscribeEvent - public void onLivingAttack(LivingAttackEvent event) - { - if (event.entityLiving instanceof EntityPlayer) - { + public void onLivingAttack(LivingAttackEvent event) { + if (event.entityLiving instanceof EntityPlayer) { PlayerAether playerAether = PlayerAether.get((EntityPlayer) event.entityLiving); - if (playerAether.getAccessoryInventory().isWearingPhoenixSet() && event.source.isFireDamage()) - { + if (playerAether.getAccessoryInventory().isWearingPhoenixSet() && event.source.isFireDamage()) { event.setCanceled(true); - } - else if (playerAether.getAbilities().get(3).shouldExecute()) - { - event.setCanceled(((AbilityRepulsion)playerAether.getAbilities().get(3)).onPlayerAttacked(event.source)); + } else if (playerAether.getAbilities().get(3).shouldExecute()) { + event.setCanceled(((AbilityRepulsion) playerAether.getAbilities().get(3)).onPlayerAttacked(event.source)); } } } @SubscribeEvent - public void onUpdateBreakSpeed(BreakSpeed event) - { + public void onUpdateBreakSpeed(BreakSpeed event) { ((InventoryAccessories) PlayerAether.get(event.entityPlayer).getAccessoryInventory()).getCurrentPlayerStrVsBlock(event.newSpeed); } @SubscribeEvent - public void onAchievementGet(AchievementEvent event) - { + public void onAchievementGet(AchievementEvent event) { Achievement achievement = event.achievement; EntityPlayer player = event.entityPlayer; - if (!(achievement instanceof AetherAchievement)) - { + if (!(achievement instanceof AetherAchievement)) { return; } int achievementType = achievement == AchievementsAether.defeat_bronze ? 1 : achievement == AchievementsAether.defeat_silver ? 2 : 0; - if (!player.worldObj.isRemote && ((EntityPlayerMP)player).func_147099_x().canUnlockAchievement(achievement) && !((EntityPlayerMP)player).func_147099_x().hasAchievementUnlocked(achievement)) - { - if (event.achievement == AchievementsAether.enter_aether) - { - if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.lore_book))) - { + if (!player.worldObj.isRemote && ((EntityPlayerMP) player).func_147099_x().canUnlockAchievement(achievement) && !((EntityPlayerMP) player).func_147099_x().hasAchievementUnlocked(achievement)) { + if (event.achievement == AchievementsAether.enter_aether) { + if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.lore_book))) { player.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, new ItemStack(ItemsAether.lore_book))); } - if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.golden_parachute))) - { + if (!player.inventory.addItemStackToInventory(new ItemStack(ItemsAether.golden_parachute))) { player.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, new ItemStack(ItemsAether.golden_parachute))); } } diff --git a/src/main/java/com/legacy/aether/player/abilities/AbilityAccessories.java b/src/main/java/com/legacy/aether/player/abilities/AbilityAccessories.java index 0b9cc00..e8913d2 100644 --- a/src/main/java/com/legacy/aether/player/abilities/AbilityAccessories.java +++ b/src/main/java/com/legacy/aether/player/abilities/AbilityAccessories.java @@ -12,8 +12,7 @@ import com.legacy.aether.api.player.IPlayerAether; import com.legacy.aether.api.player.util.IAetherAbility; import com.legacy.aether.items.ItemsAether; -public class AbilityAccessories implements IAetherAbility -{ +public class AbilityAccessories implements IAetherAbility { private final IPlayerAether player; @@ -21,43 +20,34 @@ public class AbilityAccessories implements IAetherAbility private boolean stepUpdate; - public AbilityAccessories(IPlayerAether player) - { + public AbilityAccessories(IPlayerAether player) { this.player = player; } @Override - public boolean shouldExecute() - { + public boolean shouldExecute() { return true; } @Override - public void onUpdate() - { - if (this.player.getEntity().ticksExisted % 400 == 0) - { + public void onUpdate() { + if (this.player.getEntity().ticksExisted % 400 == 0) { this.player.getAccessoryInventory().damageWornStack(1, new ItemStack(ItemsAether.zanite_ring)); this.player.getAccessoryInventory().damageWornStack(1, new ItemStack(ItemsAether.zanite_pendant)); } - if (!this.player.getEntity().worldObj.isRemote && (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.ice_ring)) || this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.ice_pendant)))) - { + if (!this.player.getEntity().worldObj.isRemote && (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.ice_ring)) || this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.ice_pendant)))) { int i = MathHelper.floor_double(this.player.getEntity().posX); int j = MathHelper.floor_double(this.player.getEntity().boundingBox.minY); int k = MathHelper.floor_double(this.player.getEntity().posZ); - for (int x = i - 1; x <= i + 1; x++) - { - for (int y = j - 1; y <= j + 1; y++) - { - for (int z = k - 1; z <= k + 1; z++) - { + for (int x = i - 1; x <= i + 1; x++) { + for (int y = j - 1; y <= j + 1; y++) { + for (int z = k - 1; z <= k + 1; z++) { Block block = this.player.getEntity().worldObj.getBlock(x, y, z); Block setBlock = (block == Blocks.water || block == Blocks.flowing_water) ? Blocks.ice : (block == Blocks.lava || block == Blocks.flowing_lava) ? Blocks.obsidian : null; - if (setBlock != null) - { + if (setBlock != null) { this.player.getEntity().worldObj.setBlock(x, y, z, setBlock); this.player.getAccessoryInventory().damageWornStack(1, new ItemStack(ItemsAether.ice_ring)); this.player.getAccessoryInventory().damageWornStack(1, new ItemStack(ItemsAether.ice_pendant)); @@ -67,61 +57,46 @@ public class AbilityAccessories implements IAetherAbility } } - if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.iron_bubble))) - { + if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.iron_bubble))) { this.player.getEntity().setAir(0); } - if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.agility_cape))) - { + if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.agility_cape))) { this.player.getEntity().stepHeight = 1.0F; this.stepUpdate = true; - } - else - { - if (this.stepUpdate) - { + } else { + if (this.stepUpdate) { this.player.getEntity().stepHeight = 0.5F; this.stepUpdate = false; } } - if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) - { + if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape))) { this.player.getEntity().setInvisible(true); this.invisibilityUpdate = true; - } - else if (!this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape)) && !this.player.getEntity().isPotionActive(Potion.invisibility)) - { - if (this.invisibilityUpdate) - { + } else if (!this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.invisibility_cape)) && !this.player.getEntity().isPotionActive(Potion.invisibility)) { + if (this.invisibilityUpdate) { this.player.getEntity().setInvisible(false); this.invisibilityUpdate = false; } } - if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.regeneration_stone))) - { - if(this.player.getEntity().getHealth() < this.player.getEntity().getMaxHealth() && this.player.getEntity().getActivePotionEffect(Potion.regeneration) == null) - { + if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.regeneration_stone))) { + if (this.player.getEntity().getHealth() < this.player.getEntity().getMaxHealth() && this.player.getEntity().getActivePotionEffect(Potion.regeneration) == null) { this.player.getEntity().addPotionEffect(new PotionEffect(Potion.regeneration.id, 80, 0)); - } + } } - if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.phoenix_gloves)) && this.player.getEntity().isWet()) - { + if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.phoenix_gloves)) && this.player.getEntity().isWet()) { this.player.getAccessoryInventory().damageWornStack(1, new ItemStack(ItemsAether.phoenix_gloves)); - if (this.player.getAccessoryInventory().getStackInSlot(AccessoryType.GLOVES) == null) - { + if (this.player.getAccessoryInventory().getStackInSlot(AccessoryType.GLOVES) == null) { this.player.getAccessoryInventory().setAccessorySlot(AccessoryType.GLOVES, new ItemStack(ItemsAether.obsidian_gloves)); } } - if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.golden_feather))) - { - if (!this.player.getEntity().onGround && this.player.getEntity().motionY < 0.0D && !this.player.getEntity().isInWater() && !this.player.getEntity().isSneaking()) - { + if (this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.golden_feather))) { + if (!this.player.getEntity().onGround && this.player.getEntity().motionY < 0.0D && !this.player.getEntity().isInWater() && !this.player.getEntity().isSneaking()) { this.player.getEntity().motionY *= 0.59999999999999998D; } diff --git a/src/main/java/com/legacy/aether/player/abilities/AbilityArmor.java b/src/main/java/com/legacy/aether/player/abilities/AbilityArmor.java index 5e692b7..e8efe0f 100644 --- a/src/main/java/com/legacy/aether/player/abilities/AbilityArmor.java +++ b/src/main/java/com/legacy/aether/player/abilities/AbilityArmor.java @@ -13,8 +13,7 @@ import com.legacy.aether.api.player.util.IAetherAbility; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.player.movement.AetherLiquidMovement; -public class AbilityArmor implements IAetherAbility -{ +public class AbilityArmor implements IAetherAbility { private final AetherLiquidMovement player_movement; @@ -24,30 +23,24 @@ public class AbilityArmor implements IAetherAbility private boolean jumpBoosted; - public AbilityArmor(IPlayerAether player) - { + public AbilityArmor(IPlayerAether player) { this.player = player; this.player_movement = new AetherLiquidMovement(player); } @Override - public boolean shouldExecute() - { + public boolean shouldExecute() { return true; } @Override - public void onUpdate() - { - if (this.player.getAccessoryInventory().isWearingNeptuneSet()) - { + public void onUpdate() { + if (this.player.getAccessoryInventory().isWearingNeptuneSet()) { this.player_movement.onUpdate(); } - if (this.player.getAccessoryInventory().isWearingGravititeSet()) - { - if (this.player.isJumping() && !this.jumpBoosted) - { + if (this.player.getAccessoryInventory().isWearingGravititeSet()) { + if (this.player.isJumping() && !this.jumpBoosted) { this.player.getEntity().motionY = 1D; this.jumpBoosted = true; } @@ -55,63 +48,51 @@ public class AbilityArmor implements IAetherAbility this.player.getEntity().fallDistance = -1F; } - if (this.player.getEntity().isWet()) - { - if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.phoenix_boots))) - { + if (this.player.getEntity().isWet()) { + if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.phoenix_boots))) { this.damagePhoenixArmor(this.player.getEntity(), ItemsAether.obsidian_boots, 0); } - if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.phoenix_leggings))) - { + if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.phoenix_leggings))) { this.damagePhoenixArmor(this.player.getEntity(), ItemsAether.obsidian_leggings, 1); } - if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.phoenix_chestplate))) - { + if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.phoenix_chestplate))) { this.damagePhoenixArmor(this.player.getEntity(), ItemsAether.obsidian_chestplate, 2); } - if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.phoenix_helmet))) - { + if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.phoenix_helmet))) { this.damagePhoenixArmor(this.player.getEntity(), ItemsAether.obsidian_helmet, 3); } } - if (this.player.getAccessoryInventory().isWearingPhoenixSet()) - { + if (this.player.getAccessoryInventory().isWearingPhoenixSet()) { this.player.getEntity().extinguish(); this.player_movement.onUpdate(); - if (!this.player.getEntity().worldObj.isRemote) - { - ((WorldServer)this.player.getEntity().worldObj).func_147487_a("flame", this.player.getEntity().posX + (this.random.nextGaussian() / 5D), this.player.getEntity().posY + (this.random.nextGaussian() / 5D), this.player.getEntity().posZ + (this.random.nextGaussian() / 3D), 0, 0.0D, 0.0D, 0.0D, 0.0D); + if (!this.player.getEntity().worldObj.isRemote) { + ((WorldServer) this.player.getEntity().worldObj).func_147487_a("flame", this.player.getEntity().posX + (this.random.nextGaussian() / 5D), this.player.getEntity().posY + (this.random.nextGaussian() / 5D), this.player.getEntity().posZ + (this.random.nextGaussian() / 3D), 0, 0.0D, 0.0D, 0.0D, 0.0D); } } - if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.sentry_boots))) - { + if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.sentry_boots))) { this.player.getEntity().fallDistance = 0F; } - if (!this.player.isJumping() && this.player.getEntity().onGround) - { + if (!this.player.isJumping() && this.player.getEntity().onGround) { this.jumpBoosted = false; } } - public void damagePhoenixArmor(Entity entity, Item outcome, int slot) - { - if (entity instanceof EntityLivingBase) - { + public void damagePhoenixArmor(Entity entity, Item outcome, int slot) { + if (entity instanceof EntityLivingBase) { EntityLivingBase entityLiving = (EntityLivingBase) entity; ItemStack stack = entityLiving.getEquipmentInSlot(slot + 1); stack.damageItem(1, entityLiving); - if (stack.stackSize <= 0) - { + if (stack.stackSize <= 0) { entityLiving.setCurrentItemOrArmor(slot + 1, new ItemStack(outcome)); } } diff --git a/src/main/java/com/legacy/aether/player/abilities/AbilityFlight.java b/src/main/java/com/legacy/aether/player/abilities/AbilityFlight.java index e7f7bb8..2b05f9a 100644 --- a/src/main/java/com/legacy/aether/player/abilities/AbilityFlight.java +++ b/src/main/java/com/legacy/aether/player/abilities/AbilityFlight.java @@ -3,8 +3,7 @@ package com.legacy.aether.player.abilities; import com.legacy.aether.api.player.IPlayerAether; import com.legacy.aether.api.player.util.IAetherAbility; -public class AbilityFlight implements IAetherAbility -{ +public class AbilityFlight implements IAetherAbility { private int flightCount; @@ -16,51 +15,39 @@ public class AbilityFlight implements IAetherAbility private final IPlayerAether player; - public AbilityFlight(IPlayerAether player) - { + public AbilityFlight(IPlayerAether player) { this.player = player; } @Override - public boolean shouldExecute() - { + public boolean shouldExecute() { return this.player.getAccessoryInventory().isWearingValkyrieSet(); } @Override - public void onUpdate() - { - if (this.player.isJumping()) - { - if (this.flightMod >= this.maxFlightMod) - { + public void onUpdate() { + if (this.player.isJumping()) { + if (this.flightMod >= this.maxFlightMod) { this.flightMod = this.maxFlightMod; } - if (this.flightCount > 2) - { - if (this.flightCount < this.maxFlightCount) - { + if (this.flightCount > 2) { + if (this.flightCount < this.maxFlightCount) { this.flightMod += 0.25D; this.player.getEntity().motionY = 0.025D * this.flightMod; this.flightCount++; } - } - else - { + } else { this.flightCount++; } - } - else - { + } else { this.flightMod = 1.0D; } this.player.getEntity().fallDistance = -1F; - if (this.player.getEntity().onGround) - { + if (this.player.getEntity().onGround) { this.flightCount = 0; this.flightMod = 1.0D; } diff --git a/src/main/java/com/legacy/aether/player/abilities/AbilityRepulsion.java b/src/main/java/com/legacy/aether/player/abilities/AbilityRepulsion.java index 06c6107..ca3f18f 100644 --- a/src/main/java/com/legacy/aether/player/abilities/AbilityRepulsion.java +++ b/src/main/java/com/legacy/aether/player/abilities/AbilityRepulsion.java @@ -19,40 +19,33 @@ import com.legacy.aether.items.ItemsAether; import cpw.mods.fml.common.registry.IThrowableEntity; -public class AbilityRepulsion implements IAetherAbility -{ +public class AbilityRepulsion implements IAetherAbility { private Random rand = new Random(); private final IPlayerAether player; - public AbilityRepulsion(IPlayerAether player) - { + public AbilityRepulsion(IPlayerAether player) { this.player = player; } @Override - public boolean shouldExecute() - { + public boolean shouldExecute() { return this.player.getAccessoryInventory().wearingAccessory(new ItemStack(ItemsAether.repulsion_shield)); } @Override - public void onUpdate() - { - if (this.player.getEntity().worldObj.isRemote) - { + public void onUpdate() { + if (this.player.getEntity().worldObj.isRemote) { return; } List entities = this.player.getEntity().worldObj.getEntitiesWithinAABBExcludingEntity(this.player.getEntity(), this.player.getEntity().boundingBox.expand(3.0D, 3.0D, 3.0D)); - for (int size = 0; size < entities.size(); ++size) - { + for (int size = 0; size < entities.size(); ++size) { Entity projectile = (Entity) entities.get(size); - if (isProjectile(projectile) && this.getShooter(projectile) != this.player.getEntity()) - { + if (isProjectile(projectile) && this.getShooter(projectile) != this.player.getEntity()) { double x, y, z; Entity shooter = this.getShooter(projectile); @@ -63,7 +56,9 @@ public class AbilityRepulsion implements IAetherAbility double difference = -Math.sqrt((x * x) + (y * y) + (z * z)); - x /= difference; y /= difference; z /= difference; + x /= difference; + y /= difference; + z /= difference; projectile.setDead(); @@ -72,7 +67,7 @@ public class AbilityRepulsion implements IAetherAbility packY = (-projectile.motionY * 0.15F) + ((this.rand.nextFloat() - 0.5F) * 0.05F); packZ = (-projectile.motionZ * 0.15F) + ((this.rand.nextFloat() - 0.5F) * 0.05F); - ((WorldServer)this.player.getEntity().worldObj).func_147487_a("flame", projectile.posX, projectile.posY, projectile.posZ, 12, packX, packY, packZ, 0.625F); + ((WorldServer) this.player.getEntity().worldObj).func_147487_a("flame", projectile.posX, projectile.posY, projectile.posZ, 12, packX, packY, packZ, 0.625F); this.player.getEntity().worldObj.playSoundAtEntity(this.player.getEntity(), "note.snare", 1.0F, 1.0F); this.player.getAccessoryInventory().damageWornStack(1, new ItemStack(ItemsAether.repulsion_shield)); @@ -80,23 +75,19 @@ public class AbilityRepulsion implements IAetherAbility } } - public boolean onPlayerAttacked(DamageSource source) - { - if (isProjectile(source.getEntity())) - { + public boolean onPlayerAttacked(DamageSource source) { + if (isProjectile(source.getEntity())) { return true; } return false; } - private Entity getShooter(Entity ent) - { - return ent instanceof EntityArrow ? ((EntityArrow)ent).shootingEntity : ent instanceof EntityThrowable ? ((EntityThrowable)ent).getThrower() : ent instanceof EntityProjectileBase ? ((EntityProjectileBase)ent).getThrower() : ent instanceof EntityFireball ? ((EntityFireball)ent).shootingEntity : null; + private Entity getShooter(Entity ent) { + return ent instanceof EntityArrow ? ((EntityArrow) ent).shootingEntity : ent instanceof EntityThrowable ? ((EntityThrowable) ent).getThrower() : ent instanceof EntityProjectileBase ? ((EntityProjectileBase) ent).getThrower() : ent instanceof EntityFireball ? ((EntityFireball) ent).shootingEntity : null; } - public static boolean isProjectile(Entity entity) - { + public static boolean isProjectile(Entity entity) { return entity instanceof IProjectile || entity instanceof IThrowableEntity; } diff --git a/src/main/java/com/legacy/aether/player/movement/AetherLiquidMovement.java b/src/main/java/com/legacy/aether/player/movement/AetherLiquidMovement.java index d695e02..8516364 100644 --- a/src/main/java/com/legacy/aether/player/movement/AetherLiquidMovement.java +++ b/src/main/java/com/legacy/aether/player/movement/AetherLiquidMovement.java @@ -5,51 +5,39 @@ import net.minecraft.entity.EntityLivingBase; import com.legacy.aether.api.player.IPlayerAether; -public class AetherLiquidMovement -{ +public class AetherLiquidMovement { private IPlayerAether player; - public AetherLiquidMovement(IPlayerAether player) - { + public AetherLiquidMovement(IPlayerAether player) { this.player = player; } - public void onUpdate() - { + public void onUpdate() { Entity entity = this.player.getEntity(); - if (entity instanceof EntityLivingBase) - { + if (entity instanceof EntityLivingBase) { EntityLivingBase entityLiving = (EntityLivingBase) entity; float movementLR = this.negativeDifference(entityLiving, entityLiving.moveStrafing); float movementFB = this.negativeDifference(entityLiving, entityLiving.moveForward); - if (entityLiving.isInWater()) - { + if (entityLiving.isInWater()) { entityLiving.moveFlying(movementLR, movementFB, 0.03F); } - if (entityLiving.handleLavaMovement()) - { + if (entityLiving.handleLavaMovement()) { entityLiving.moveFlying(movementLR, movementFB, 0.06F); } } } - public float negativeDifference(EntityLivingBase entity, float number) - { - if (number < 0.0F) - { + public float negativeDifference(EntityLivingBase entity, float number) { + if (number < 0.0F) { return number + 0.1F; - } - else if (number > 0.0F) - { + } else if (number > 0.0F) { return number - 0.1F; - } - else - { + } else { return 0.0F; } } diff --git a/src/main/java/com/legacy/aether/player/perks/AetherRankings.java b/src/main/java/com/legacy/aether/player/perks/AetherRankings.java index b5ea9e8..79ebd50 100644 --- a/src/main/java/com/legacy/aether/player/perks/AetherRankings.java +++ b/src/main/java/com/legacy/aether/player/perks/AetherRankings.java @@ -3,17 +3,15 @@ package com.legacy.aether.player.perks; import java.util.HashMap; import java.util.UUID; -public class AetherRankings -{ +public class AetherRankings { public static HashMap ranks = new HashMap(); - public static void initialization() - { + public static void initialization() { //Developer addDeveloperRank("6a0e8505-1556-4ee9-bec0-6af32f05888d"); // 115kino addDeveloperRank("1d680bb6-2a9a-4f25-bf2f-a1af74361d69"); // Bailey Schaefer (KingPhygieBoo) - + //Retired Developer addRetiredRank("6e8be0ba-e4bb-46af-aea8-2c1f5eec5bc2"); // Brendan Freeman addRetiredRank("5f112332-0993-4f52-a5ab-9a55dc3173cb"); // JorgeQ @@ -24,7 +22,7 @@ public class AetherRankings addGGRank("6fb2f965-6b57-46de-9ef3-0ef4c9b9bdc6"); // Hugo Payn addGGRank("dc4cf9b2-f601-4eb4-9436-2924836b9f42"); // Jaryt Bustard addGGRank("c0643897-c500-4f61-a62a-8051801562a9"); // Christian Peterson - + //Retired Gilded Games addRetiredGGRank("4bfb28a3-005d-4fc9-9238-a55c6c17b575"); // Jon Lachney addRetiredGGRank("2afd6a1d-1531-4985-a104-399c0c19351d"); // Brandon Potts @@ -45,7 +43,7 @@ public class AetherRankings addTesterRank("869aed85-9dc0-4187-92d7-6064c202a844"); // SunflowerAspen addTesterRank("8ab9311e-6b8d-4633-80d5-e1798b1c6a96"); // Silver_David addTesterRank("c4fa4377-5147-43bd-b571-e0e0db46e4f6"); // Anabree - + //Contributor addContributor("6f8be24f-03f3-4288-9218-16c9ecc08c8f"); // Jonathing addContributor("c15c4d6d-9a80-4d6b-9eda-770859b5ed91"); // Everett1999 @@ -54,77 +52,55 @@ public class AetherRankings addContributor("2b5187c9-dc5d-480e-ab6f-e884e92fce45"); // ItzDennisz } - public static UUID getUUID(String string) - { + public static UUID getUUID(String string) { return UUID.fromString(string); } - public static boolean isRankedPlayer(UUID uuid) - { - if (ranks.get("Celeberity-" + uuid.toString()) != null) - { + public static boolean isRankedPlayer(UUID uuid) { + if (ranks.get("Celeberity-" + uuid.toString()) != null) { return true; - } - else if (ranks.get("Aether Legacy Developer-" + uuid.toString()) != null) - { + } else if (ranks.get("Aether Legacy Developer-" + uuid.toString()) != null) { return true; - } - else if (ranks.get("Aether Legacy Tester-" + uuid.toString()) != null) - { + } else if (ranks.get("Aether Legacy Tester-" + uuid.toString()) != null) { return true; - } - else if (ranks.get("Gilded Games-" + uuid.toString()) != null) - { + } else if (ranks.get("Gilded Games-" + uuid.toString()) != null) { return true; - } - else if (ranks.get("Retired Developer-" + uuid.toString()) != null) - { + } else if (ranks.get("Retired Developer-" + uuid.toString()) != null) { return true; - } - else if (ranks.get("Retired Gilded Games-" + uuid.toString()) != null) - { + } else if (ranks.get("Retired Gilded Games-" + uuid.toString()) != null) { return true; - } - else if (ranks.get("Aether Legacy Contributor-" + uuid.toString()) != null) - { + } else if (ranks.get("Aether Legacy Contributor-" + uuid.toString()) != null) { return true; } return false; } - public static void addCelebrityRank(String uuid) - { + public static void addCelebrityRank(String uuid) { ranks.put("Celeberity-" + uuid, getUUID(uuid)); } - public static void addDeveloperRank(String uuid) - { + public static void addDeveloperRank(String uuid) { ranks.put("Aether Legacy Developer-" + uuid, getUUID(uuid)); } - public static void addTesterRank(String uuid) - { + public static void addTesterRank(String uuid) { ranks.put("Aether Legacy Tester-" + uuid, getUUID(uuid)); } - public static void addGGRank(String uuid) - { + public static void addGGRank(String uuid) { ranks.put("Gilded Games-" + uuid, getUUID(uuid)); } - public static void addRetiredGGRank(String uuid) - { + public static void addRetiredGGRank(String uuid) { ranks.put("Retired Gilded Games-" + uuid, getUUID(uuid)); } - public static void addRetiredRank(String uuid) - { + public static void addRetiredRank(String uuid) { ranks.put("Retired Developer-" + uuid, getUUID(uuid)); } - - public static void addContributor(String uuid) - { + + public static void addContributor(String uuid) { ranks.put("Aether Legacy Contributor-" + uuid, getUUID(uuid)); } diff --git a/src/main/java/com/legacy/aether/player/perks/util/DonatorMoaSkin.java b/src/main/java/com/legacy/aether/player/perks/util/DonatorMoaSkin.java index fe31c28..13e31d2 100644 --- a/src/main/java/com/legacy/aether/player/perks/util/DonatorMoaSkin.java +++ b/src/main/java/com/legacy/aether/player/perks/util/DonatorMoaSkin.java @@ -2,122 +2,104 @@ package com.legacy.aether.player.perks.util; import io.netty.buffer.ByteBuf; -public class DonatorMoaSkin -{ +public class DonatorMoaSkin { - private boolean shouldDefualt; + private boolean shouldDefualt; - private int wingColor; + private int wingColor; - private int wingMarkingColor; + private int wingMarkingColor; - private int bodyColor; + private int bodyColor; - private int markingColor; + private int markingColor; - private int eyeColor; + private int eyeColor; - private int outsideColor; + private int outsideColor; - public DonatorMoaSkin() - { - this.shouldDefualt = true; - } + public DonatorMoaSkin() { + this.shouldDefualt = true; + } - public void writeMoaSkin(ByteBuf buf) - { - buf.writeBoolean(this.shouldDefualt); - buf.writeInt(this.wingColor); - buf.writeInt(this.wingMarkingColor); - buf.writeInt(this.bodyColor); - buf.writeInt(this.markingColor); - buf.writeInt(this.eyeColor); - buf.writeInt(this.outsideColor); - } + public void writeMoaSkin(ByteBuf buf) { + buf.writeBoolean(this.shouldDefualt); + buf.writeInt(this.wingColor); + buf.writeInt(this.wingMarkingColor); + buf.writeInt(this.bodyColor); + buf.writeInt(this.markingColor); + buf.writeInt(this.eyeColor); + buf.writeInt(this.outsideColor); + } - public static DonatorMoaSkin readMoaSkin(ByteBuf buf) - { - DonatorMoaSkin skin = new DonatorMoaSkin(); + public static DonatorMoaSkin readMoaSkin(ByteBuf buf) { + DonatorMoaSkin skin = new DonatorMoaSkin(); - skin.shouldUseDefualt(buf.readBoolean()); - skin.setWingColor(buf.readInt()); - skin.setWingMarkingColor(buf.readInt()); - skin.setBodyColor(buf.readInt()); - skin.setMarkingColor(buf.readInt()); - skin.setEyeColor(buf.readInt()); - skin.setOutsideColor(buf.readInt()); + skin.shouldUseDefualt(buf.readBoolean()); + skin.setWingColor(buf.readInt()); + skin.setWingMarkingColor(buf.readInt()); + skin.setBodyColor(buf.readInt()); + skin.setMarkingColor(buf.readInt()); + skin.setEyeColor(buf.readInt()); + skin.setOutsideColor(buf.readInt()); - return skin; - } + return skin; + } - public void setWingColor(int color) - { - this.wingColor = color; - } + public void setWingColor(int color) { + this.wingColor = color; + } - public int getWingColor() - { - return this.wingColor; - } + public int getWingColor() { + return this.wingColor; + } - public void setWingMarkingColor(int color) - { - this.wingMarkingColor = color; - } + public void setWingMarkingColor(int color) { + this.wingMarkingColor = color; + } - public int getWingMarkingColor() - { - return this.wingMarkingColor; - } + public int getWingMarkingColor() { + return this.wingMarkingColor; + } - public void setBodyColor(int color) - { - this.bodyColor = color; - } + public void setBodyColor(int color) { + this.bodyColor = color; + } - public int getBodyColor() - { - return this.bodyColor; - } + public int getBodyColor() { + return this.bodyColor; + } - public void setMarkingColor(int color) - { - this.markingColor = color; - } + public void setMarkingColor(int color) { + this.markingColor = color; + } - public int getMarkingColor() - { - return this.markingColor; - } + public int getMarkingColor() { + return this.markingColor; + } - public void setEyeColor(int color) - { - this.eyeColor = color; - } + public void setEyeColor(int color) { + this.eyeColor = color; + } - public int getEyeColor() - { - return this.eyeColor; - } + public int getEyeColor() { + return this.eyeColor; + } - public void setOutsideColor(int color) - { - this.outsideColor = color; - } + public void setOutsideColor(int color) { + this.outsideColor = color; + } - public int getOutsideColor() - { - return this.outsideColor; - } + public int getOutsideColor() { + return this.outsideColor; + } - public void shouldUseDefualt(boolean defualt) - { - this.shouldDefualt = defualt; - } + public void shouldUseDefualt(boolean defualt) { + this.shouldDefualt = defualt; + } - public boolean shouldUseDefualt() - { - return this.shouldDefualt; - } + public boolean shouldUseDefualt() { + return this.shouldDefualt; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/player/perks/util/EnumAetherPerkType.java b/src/main/java/com/legacy/aether/player/perks/util/EnumAetherPerkType.java index b7ac9d0..98fc00e 100644 --- a/src/main/java/com/legacy/aether/player/perks/util/EnumAetherPerkType.java +++ b/src/main/java/com/legacy/aether/player/perks/util/EnumAetherPerkType.java @@ -1,23 +1,19 @@ package com.legacy.aether.player.perks.util; -public enum EnumAetherPerkType -{ - Information(0), Halo(1), Moa(2); +public enum EnumAetherPerkType { + Information(0), Halo(1), Moa(2); - private int perkID; + private int perkID; - EnumAetherPerkType(int id) - { - this.perkID = id; - } + EnumAetherPerkType(int id) { + this.perkID = id; + } - public int getPerkID() - { - return this.perkID; - } + public int getPerkID() { + return this.perkID; + } - public static EnumAetherPerkType getPerkByID(int id) - { - return id == 0 ? Information : id == 1 ? Halo : Moa; - } + public static EnumAetherPerkType getPerkByID(int id) { + return id == 0 ? Information : id == 1 ? Halo : Moa; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/registry/AetherLore.java b/src/main/java/com/legacy/aether/registry/AetherLore.java index 145eaf7..2c28b01 100644 --- a/src/main/java/com/legacy/aether/registry/AetherLore.java +++ b/src/main/java/com/legacy/aether/registry/AetherLore.java @@ -12,142 +12,115 @@ import org.apache.commons.io.Charsets; import cpw.mods.fml.common.registry.GameRegistry; -public class AetherLore -{ +public class AetherLore { - public static String getLoreEntry(ItemStack stack) - { + public static String getLoreEntry(ItemStack stack) { String languageCode = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode(); ResourceLocation location = new ResourceLocation(GameRegistry.findUniqueIdentifierFor(stack.getItem()).modId, "lore/" + languageCode + "/" + stack.getUnlocalizedName().replace("item.", "").replace("tile.", "").replace(".", "_") + ".txt"); - BufferedReader bufferedreader = null; - boolean failed = false; + BufferedReader bufferedreader = null; + boolean failed = false; - try - { - StringBuilder stringBuilder = new StringBuilder(); - bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(), Charsets.UTF_8)); - String s; + try { + StringBuilder stringBuilder = new StringBuilder(); + bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(), Charsets.UTF_8)); + String s; - while ((s = bufferedreader.readLine()) != null) - { - s = " " + s.trim(); + while ((s = bufferedreader.readLine()) != null) { + s = " " + s.trim(); - if (!s.isEmpty()) - { - stringBuilder.append(s); - } - } + if (!s.isEmpty()) { + stringBuilder.append(s); + } + } - if (stringBuilder.length() != 0) - { - return stringBuilder.toString(); - } - } - catch (IOException ioexception1) - { - failed = true; - System.out.println("Cannot find lore entry for " + location.toString()); - } - finally - { - if (bufferedreader != null) - { - try - { - bufferedreader.close(); - } - catch (IOException ioexception) - { - ; - } - } - } + if (stringBuilder.length() != 0) { + return stringBuilder.toString(); + } + } catch (IOException ioexception1) { + failed = true; + System.out.println("Cannot find lore entry for " + location.toString()); + } finally { + if (bufferedreader != null) { + try { + bufferedreader.close(); + } catch (IOException ioexception) { + ; + } + } + } - location = new ResourceLocation(GameRegistry.findUniqueIdentifierFor(stack.getItem()).modId, "lore/en_US/" + stack.getUnlocalizedName().replace("item.", "").replace("tile.", "").replace(".", "_") + ".txt"); + location = new ResourceLocation(GameRegistry.findUniqueIdentifierFor(stack.getItem()).modId, "lore/en_US/" + stack.getUnlocalizedName().replace("item.", "").replace("tile.", "").replace(".", "_") + ".txt"); - if (failed && languageCode != "en_US") - { - try - { - StringBuilder stringBuilder = new StringBuilder(); - bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(), Charsets.UTF_8)); - String s; + if (failed && languageCode != "en_US") { + try { + StringBuilder stringBuilder = new StringBuilder(); + bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(), Charsets.UTF_8)); + String s; - while ((s = bufferedreader.readLine()) != null) - { - s = " " + s.trim(); + while ((s = bufferedreader.readLine()) != null) { + s = " " + s.trim(); - if (!s.isEmpty()) - { - stringBuilder.append(s); - } - } + if (!s.isEmpty()) { + stringBuilder.append(s); + } + } - if (stringBuilder.length() != 0) - { - return stringBuilder.toString(); - } - } - catch (IOException ioexception1) - { - System.out.println("Cannot find backup lore entry for " + location.toString()); - } - finally - { - if (bufferedreader != null) - { - try - { - bufferedreader.close(); - } - catch (IOException ioexception) - { - ; - } - } - } - } + if (stringBuilder.length() != 0) { + return stringBuilder.toString(); + } + } catch (IOException ioexception1) { + System.out.println("Cannot find backup lore entry for " + location.toString()); + } finally { + if (bufferedreader != null) { + try { + bufferedreader.close(); + } catch (IOException ioexception) { + ; + } + } + } + } - return "missingno"; + return "missingno"; } /*public static String getLoreEntry(ItemStack stack) { ResourceLocation location = new ResourceLocation(GameRegistry.findUniqueIdentifierFor(stack.getItem()).modId, "lore/" + Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode() + "/" + stack.getUnlocalizedName().replace("item.", "").replace("tile.", "").replace(".", "_") + ".txt"); - IResource iresource = null; + IResource iresource = null; - try - { - StringBuilder stringBuilder = new StringBuilder(); - iresource = Minecraft.getMinecraft().getResourceManager().getResource(location); - BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(iresource.getInputStream(), StandardCharsets.UTF_8)); - String s; + try + { + StringBuilder stringBuilder = new StringBuilder(); + iresource = Minecraft.getMinecraft().getResourceManager().getResource(location); + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(iresource.getInputStream(), StandardCharsets.UTF_8)); + String s; - while ((s = bufferedreader.readLine()) != null) - { - s = " " + s.trim(); + while ((s = bufferedreader.readLine()) != null) + { + s = " " + s.trim(); - if (!s.isEmpty()) - { - stringBuilder.append(s); - } - } + if (!s.isEmpty()) + { + stringBuilder.append(s); + } + } - if (stringBuilder.length() != 0) - { - return stringBuilder.toString(); - } - } - catch (IOException var8) - { - System.out.println("Cannot find lore entry for " + location.toString()); - } - finally - { - IOUtils.closeQuietly((Closeable)iresource); - } + if (stringBuilder.length() != 0) + { + return stringBuilder.toString(); + } + } + catch (IOException var8) + { + System.out.println("Cannot find lore entry for " + location.toString()); + } + finally + { + IOUtils.closeQuietly((Closeable)iresource); + } - return "missingno"; + return "missingno"; }*/ } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/registry/AetherRegistries.java b/src/main/java/com/legacy/aether/registry/AetherRegistries.java index fdd35f5..2fc8655 100644 --- a/src/main/java/com/legacy/aether/registry/AetherRegistries.java +++ b/src/main/java/com/legacy/aether/registry/AetherRegistries.java @@ -18,11 +18,9 @@ import com.legacy.aether.registry.recipe.RecipeAccessoryDyes; import cpw.mods.fml.common.registry.GameRegistry; -public class AetherRegistries -{ +public class AetherRegistries { - public static void initializeAccessories() - { + public static void initializeAccessories() { AetherAPI.instance().register(new AetherAccessory(ItemsAether.leather_gloves, AccessoryType.GLOVES)); AetherAPI.instance().register(new AetherAccessory(ItemsAether.iron_gloves, AccessoryType.GLOVES)); AetherAPI.instance().register(new AetherAccessory(ItemsAether.golden_gloves, AccessoryType.GLOVES)); @@ -58,8 +56,7 @@ public class AetherRegistries AetherAPI.instance().register(new AetherAccessory(ItemsAether.repulsion_shield, AccessoryType.SHIELD)); } - public static void initializeEnchantments() - { + public static void initializeEnchantments() { AetherAPI.instance().register(new AetherEnchantment(ItemsAether.skyroot_pickaxe, 225)); AetherAPI.instance().register(new AetherEnchantment(ItemsAether.skyroot_axe, 225)); AetherAPI.instance().register(new AetherEnchantment(ItemsAether.skyroot_shovel, 225)); @@ -166,13 +163,11 @@ public class AetherRegistries AetherAPI.instance().register(new AetherEnchantment(Items.diamond_boots, 10000)); } - public static void initializeEnchantmentFuel() - { + public static void initializeEnchantmentFuel() { AetherAPI.instance().register(new AetherEnchantmentFuel(ItemsAether.ambrosium_shard, 500)); } - public static void initializeFreezables() - { + public static void initializeFreezables() { AetherAPI.instance().register(new AetherFreezable(BlocksAether.aercloud, new ItemStack(BlocksAether.aercloud, 1, 1), 100)); AetherAPI.instance().register(new AetherFreezable(BlocksAether.skyroot_leaves, BlocksAether.crystal_leaves, 150)); AetherAPI.instance().register(new AetherFreezable(BlocksAether.golden_oak_leaves, BlocksAether.crystal_leaves, 150)); @@ -187,13 +182,11 @@ public class AetherRegistries AetherAPI.instance().register(new AetherFreezable(ItemsAether.golden_pendant, ItemsAether.ice_pendant, 2500)); } - public static void initializeFreezableFuel() - { + public static void initializeFreezableFuel() { AetherAPI.instance().register(new AetherFreezableFuel(BlocksAether.icestone, 500)); } - public static void register() - { + public static void register() { initializeAccessories(); initializeEnchantments(); initializeEnchantmentFuel(); @@ -208,8 +201,7 @@ public class AetherRegistries FurnaceRecipes.smelting().func_151394_a(new ItemStack(BlocksAether.golden_oak_log, 1, 1), new ItemStack(Items.coal, 1, 1), 0.15F); } - private static void initializeShapelessRecipes() - { + private static void initializeShapelessRecipes() { registerShapeless("poison_dart_shooter", new ItemStack(ItemsAether.dart_shooter, 1, 1), new ItemStack(ItemsAether.dart_shooter, 1, 0), new ItemStack(ItemsAether.skyroot_bucket, 1, 2)); registerShapeless("purple_dye", new ItemStack(Items.dye, 2, 5), BlocksAether.purple_flower); registerShapeless("skyroot_planks", new ItemStack(BlocksAether.skyroot_planks, 4), new ItemStack(BlocksAether.skyroot_log, 1, 1)); @@ -217,8 +209,7 @@ public class AetherRegistries registerShapeless("book_of_lore", new ItemStack(ItemsAether.lore_book), new ItemStack(Items.book), new ItemStack(ItemsAether.ambrosium_shard)); } - private static void initializeRecipes() - { + private static void initializeRecipes() { register("nature_staf", new ItemStack(ItemsAether.nature_staff), "Y", "X", 'Y', ItemsAether.zanite_gemstone, 'X', ItemsAether.skyroot_stick); register("skyroot_stick", new ItemStack(ItemsAether.skyroot_stick, 4), "X", "X", 'X', BlocksAether.skyroot_planks); register("trapdoor", new ItemStack(Blocks.trapdoor, 2), "XXX", "XXX", 'X', BlocksAether.skyroot_planks); @@ -237,7 +228,7 @@ public class AetherRegistries register("oak_door", new ItemStack(Items.wooden_door, 3), "XX", "XX", "XX", 'X', BlocksAether.skyroot_planks); register("sign", new ItemStack(Items.sign, 3), "XXX", "XXX", " Y ", 'X', BlocksAether.skyroot_planks, 'Y', ItemsAether.skyroot_stick); register("ambrosium_torch", new ItemStack(BlocksAether.ambrosium_torch, 2), "Z", "Y", 'Z', ItemsAether.ambrosium_shard, 'Y', ItemsAether.skyroot_stick); - register("lead", new ItemStack(Items.lead, 2), "YY ", "YX ", " Y", 'Y', Items.string, 'X', ItemsAether.swet_ball); + register("lead", new ItemStack(Items.lead, 2), "YY ", "YX ", " Y", 'Y', Items.string, 'X', ItemsAether.swet_ball); register("cloud_parachute", new ItemStack(ItemsAether.cloud_parachute, 1), "XX", "XX", 'X', new ItemStack(BlocksAether.aercloud, 1)); register("golden_parachute", new ItemStack(ItemsAether.golden_parachute, 1), "XX", "XX", 'X', new ItemStack(BlocksAether.aercloud, 1, 2)); @@ -311,14 +302,12 @@ public class AetherRegistries register("skyroot_stairs", new ItemStack(BlocksAether.skyroot_stairs, 4), "Z ", "ZZ ", "ZZZ", 'Z', new ItemStack(BlocksAether.skyroot_planks)); } - private static void register(String name, ItemStack stack, Object... recipe) - { + private static void register(String name, ItemStack stack, Object... recipe) { GameRegistry.addRecipe(stack, recipe); } - private static void registerShapeless(String name, ItemStack stack, Object... recipe) - { - GameRegistry.addShapelessRecipe(stack, recipe); + private static void registerShapeless(String name, ItemStack stack, Object... recipe) { + GameRegistry.addShapelessRecipe(stack, recipe); } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/registry/achievements/AchievementsAether.java b/src/main/java/com/legacy/aether/registry/achievements/AchievementsAether.java index e1d8195..85d2575 100644 --- a/src/main/java/com/legacy/aether/registry/achievements/AchievementsAether.java +++ b/src/main/java/com/legacy/aether/registry/achievements/AchievementsAether.java @@ -9,15 +9,13 @@ import net.minecraftforge.common.AchievementPage; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.items.ItemsAether; -public class AchievementsAether -{ +public class AchievementsAether { public static Achievement enter_aether, defeat_bronze, defeat_silver, defeat_gold, enchanter, incubator, grav_tools, blue_cloud, flying_pig, loreception; public static AchievementPage ACpage; - public static void initialization() - { + public static void initialization() { enter_aether = new AetherAchievement("achievement.enter_aether", "enter_aether", 0, 1, Blocks.glowstone, (Achievement) null).registerStat(); defeat_bronze = new AetherAchievement("achievement.bronze_dungeon", "bronze_dungeon", -2, 3, new ItemStack(ItemsAether.dungeon_key, 1, 0), enter_aether).registerStat(); defeat_silver = new AetherAchievement("achievement.silver_dungeon", "silver_dungeon", 0, 4, new ItemStack(ItemsAether.dungeon_key, 1, 1), enter_aether).registerStat(); diff --git a/src/main/java/com/legacy/aether/registry/achievements/AetherAchievement.java b/src/main/java/com/legacy/aether/registry/achievements/AetherAchievement.java index 790b5a2..7fc5a8a 100644 --- a/src/main/java/com/legacy/aether/registry/achievements/AetherAchievement.java +++ b/src/main/java/com/legacy/aether/registry/achievements/AetherAchievement.java @@ -7,27 +7,22 @@ import net.minecraft.stats.Achievement; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; -public class AetherAchievement extends Achievement -{ +public class AetherAchievement extends Achievement { - public AetherAchievement(String name, String desc, int length, int width, ItemStack stack, Achievement parentAchievement) - { + public AetherAchievement(String name, String desc, int length, int width, ItemStack stack, Achievement parentAchievement) { super(name, desc, length, width, stack, parentAchievement); } - public AetherAchievement(String name, String desc, int length, int width, Item item, Achievement parentAchievement) - { + public AetherAchievement(String name, String desc, int length, int width, Item item, Achievement parentAchievement) { this(name, desc, length, width, new ItemStack(item), parentAchievement); } - public AetherAchievement(String name, String desc, int length, int width, Block block, Achievement parentAchievement) - { + public AetherAchievement(String name, String desc, int length, int width, Block block, Achievement parentAchievement) { this(name, desc, length, width, new ItemStack(block), parentAchievement); } @Override - public IChatComponent func_150951_e() - { + public IChatComponent func_150951_e() { IChatComponent ichatcomponent = super.func_150951_e(); ichatcomponent.getChatStyle().setColor(EnumChatFormatting.AQUA); return ichatcomponent; diff --git a/src/main/java/com/legacy/aether/registry/creative_tabs/AetherCreativeTabs.java b/src/main/java/com/legacy/aether/registry/creative_tabs/AetherCreativeTabs.java index a0d7710..9081181 100644 --- a/src/main/java/com/legacy/aether/registry/creative_tabs/AetherCreativeTabs.java +++ b/src/main/java/com/legacy/aether/registry/creative_tabs/AetherCreativeTabs.java @@ -10,20 +10,18 @@ import com.legacy.aether.items.ItemsAether; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class AetherCreativeTabs -{ +public class AetherCreativeTabs { public static AetherTab blocks = new AetherTab("aether_blocks"), - tools = new AetherTab("aether_tools"), - weapons = new AetherTab("aether_weapons"), - armor = new AetherTab("aether_armor"), - food = new AetherTab("aether_food"), - accessories = new AetherTab("aether_accessories"), - material = new AetherTab("aether_material"), - misc = new AetherTab("aether_misc"); + tools = new AetherTab("aether_tools"), + weapons = new AetherTab("aether_weapons"), + armor = new AetherTab("aether_armor"), + food = new AetherTab("aether_food"), + accessories = new AetherTab("aether_accessories"), + material = new AetherTab("aether_material"), + misc = new AetherTab("aether_misc"); - public static void initialization() - { + public static void initialization() { blocks.setIcon(new ItemStack(BlocksAether.aether_grass)); tools.setIcon(new ItemStack(ItemsAether.gravitite_pickaxe)); weapons.setIcon(new ItemStack(ItemsAether.gravitite_sword)); @@ -33,46 +31,39 @@ public class AetherCreativeTabs material.setIcon(new ItemStack(ItemsAether.ambrosium_shard)); misc.setIcon(new ItemStack(ItemsAether.dungeon_key)); } - - public static class AetherTab extends CreativeTabs - { + + public static class AetherTab extends CreativeTabs { private ItemStack stack; - public AetherTab(String unlocalizedName) - { + public AetherTab(String unlocalizedName) { super(unlocalizedName); } - public AetherTab(String unlocalizedName, ItemStack stack) - { + public AetherTab(String unlocalizedName, ItemStack stack) { super(unlocalizedName); this.stack = stack; } - public void setIcon(ItemStack stack) - { + public void setIcon(ItemStack stack) { this.stack = stack; } - @SideOnly(Side.CLIENT) - public String getTranslatedTabLabel() - { - return "tab." + this.getTabLabel(); - } + @SideOnly(Side.CLIENT) + public String getTranslatedTabLabel() { + return "tab." + this.getTabLabel(); + } @Override - public ItemStack getIconItemStack() - { + public ItemStack getIconItemStack() { return stack; } @Override - public Item getTabIconItem() - { + public Item getTabIconItem() { return stack.getItem(); } - + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/registry/recipe/RecipeAccessoryDyes.java b/src/main/java/com/legacy/aether/registry/recipe/RecipeAccessoryDyes.java index 9ebb8df..40f10f0 100644 --- a/src/main/java/com/legacy/aether/registry/recipe/RecipeAccessoryDyes.java +++ b/src/main/java/com/legacy/aether/registry/recipe/RecipeAccessoryDyes.java @@ -12,138 +12,116 @@ import net.minecraft.world.World; import com.legacy.aether.items.accessories.ItemAccessoryDyed; -public class RecipeAccessoryDyes implements IRecipe -{ +public class RecipeAccessoryDyes implements IRecipe { - @Override - public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) - { - ItemStack itemstack = null; - ArrayList arraylist = new ArrayList(); + @Override + public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) { + ItemStack itemstack = null; + ArrayList arraylist = new ArrayList(); - for (int i = 0; i < p_77569_1_.getSizeInventory(); ++i) - { - ItemStack itemstack1 = p_77569_1_.getStackInSlot(i); + for (int i = 0; i < p_77569_1_.getSizeInventory(); ++i) { + ItemStack itemstack1 = p_77569_1_.getStackInSlot(i); - if (itemstack1 != null) - { - if (itemstack1.getItem() instanceof ItemAccessoryDyed) - { - if (itemstack != null) - { - return false; - } + if (itemstack1 != null) { + if (itemstack1.getItem() instanceof ItemAccessoryDyed) { + if (itemstack != null) { + return false; + } - itemstack = itemstack1; - } - else - { - if (itemstack1.getItem() != Items.dye) - { - return false; - } + itemstack = itemstack1; + } else { + if (itemstack1.getItem() != Items.dye) { + return false; + } - arraylist.add(itemstack1); - } - } - } + arraylist.add(itemstack1); + } + } + } - return itemstack != null && !arraylist.isEmpty(); - } + return itemstack != null && !arraylist.isEmpty(); + } - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) - { - ItemStack itemstack = null; - int[] aint = new int[3]; - int i = 0; - int j = 0; - ItemAccessoryDyed itemarmor = null; - int k; - int l; - float f; - float f1; - int l1; + @Override + public ItemStack getCraftingResult(InventoryCrafting inventory) { + ItemStack itemstack = null; + int[] aint = new int[3]; + int i = 0; + int j = 0; + ItemAccessoryDyed itemarmor = null; + int k; + int l; + float f; + float f1; + int l1; - for (k = 0; k < inventory.getSizeInventory(); ++k) - { - ItemStack itemstack1 = inventory.getStackInSlot(k); + for (k = 0; k < inventory.getSizeInventory(); ++k) { + ItemStack itemstack1 = inventory.getStackInSlot(k); - if (itemstack1 != null) - { - if (itemstack1.getItem() instanceof ItemAccessoryDyed) - { - itemarmor = (ItemAccessoryDyed) itemstack1.getItem(); + if (itemstack1 != null) { + if (itemstack1.getItem() instanceof ItemAccessoryDyed) { + itemarmor = (ItemAccessoryDyed) itemstack1.getItem(); - if (itemstack != null) - { - return null; - } + if (itemstack != null) { + return null; + } - itemstack = itemstack1.copy(); - itemstack.stackSize = 1; + itemstack = itemstack1.copy(); + itemstack.stackSize = 1; - l = itemarmor.getStackColor(itemstack, itemstack.getItemDamage()); - f = (float)(l >> 16 & 255) / 255.0F; - f1 = (float)(l >> 8 & 255) / 255.0F; - float f2 = (float)(l & 255) / 255.0F; - i = (int)((float)i + Math.max(f, Math.max(f1, f2)) * 255.0F); - aint[0] = (int)((float)aint[0] + f * 255.0F); - aint[1] = (int)((float)aint[1] + f1 * 255.0F); - aint[2] = (int)((float)aint[2] + f2 * 255.0F); - ++j; - } - else - { - if (itemstack1.getItem() != Items.dye) - { - return null; - } + l = itemarmor.getStackColor(itemstack, itemstack.getItemDamage()); + f = (float) (l >> 16 & 255) / 255.0F; + f1 = (float) (l >> 8 & 255) / 255.0F; + float f2 = (float) (l & 255) / 255.0F; + i = (int) ((float) i + Math.max(f, Math.max(f1, f2)) * 255.0F); + aint[0] = (int) ((float) aint[0] + f * 255.0F); + aint[1] = (int) ((float) aint[1] + f1 * 255.0F); + aint[2] = (int) ((float) aint[2] + f2 * 255.0F); + ++j; + } else { + if (itemstack1.getItem() != Items.dye) { + return null; + } - float[] afloat = EntitySheep.fleeceColorTable[BlockColored.func_150032_b(itemstack1.getItemDamage())]; - int j1 = (int)(afloat[0] * 255.0F); - int k1 = (int)(afloat[1] * 255.0F); - l1 = (int)(afloat[2] * 255.0F); - i += Math.max(j1, Math.max(k1, l1)); - aint[0] += j1; - aint[1] += k1; - aint[2] += l1; - ++j; - } - } - } + float[] afloat = EntitySheep.fleeceColorTable[BlockColored.func_150032_b(itemstack1.getItemDamage())]; + int j1 = (int) (afloat[0] * 255.0F); + int k1 = (int) (afloat[1] * 255.0F); + l1 = (int) (afloat[2] * 255.0F); + i += Math.max(j1, Math.max(k1, l1)); + aint[0] += j1; + aint[1] += k1; + aint[2] += l1; + ++j; + } + } + } - if (itemarmor == null) - { - return null; - } - else - { - k = aint[0] / j; - int i1 = aint[1] / j; - l = aint[2] / j; - f = (float)i / (float)j; - f1 = (float)Math.max(k, Math.max(i1, l)); - k = (int)((float)k * f / f1); - i1 = (int)((float)i1 * f / f1); - l = (int)((float)l * f / f1); - l1 = (k << 8) + i1; - l1 = (l1 << 8) + l; - itemarmor.setColorTag(itemstack, l1); - return itemstack; - } - } + if (itemarmor == null) { + return null; + } else { + k = aint[0] / j; + int i1 = aint[1] / j; + l = aint[2] / j; + f = (float) i / (float) j; + f1 = (float) Math.max(k, Math.max(i1, l)); + k = (int) ((float) k * f / f1); + i1 = (int) ((float) i1 * f / f1); + l = (int) ((float) l * f / f1); + l1 = (k << 8) + i1; + l1 = (l1 << 8) + l; + itemarmor.setColorTag(itemstack, l1); + return itemstack; + } + } - @Override - public int getRecipeSize() - { - return 10; - } + @Override + public int getRecipeSize() { + return 10; + } - @Override - public ItemStack getRecipeOutput() - { - return null; - } + @Override + public ItemStack getRecipeOutput() { + return null; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/tileentity/AetherTileEntities.java b/src/main/java/com/legacy/aether/tileentity/AetherTileEntities.java index af4d23a..da3d264 100644 --- a/src/main/java/com/legacy/aether/tileentity/AetherTileEntities.java +++ b/src/main/java/com/legacy/aether/tileentity/AetherTileEntities.java @@ -2,11 +2,9 @@ package com.legacy.aether.tileentity; import cpw.mods.fml.common.registry.GameRegistry; -public class AetherTileEntities -{ +public class AetherTileEntities { - public static void initialization() - { + public static void initialization() { GameRegistry.registerTileEntity(TileEntityEnchanter.class, "enchanter"); GameRegistry.registerTileEntity(TileEntityFreezer.class, "freezer"); GameRegistry.registerTileEntity(TileEntityIncubator.class, "incubator"); diff --git a/src/main/java/com/legacy/aether/tileentity/TileEntityChestMimic.java b/src/main/java/com/legacy/aether/tileentity/TileEntityChestMimic.java index 879a904..4d62308 100644 --- a/src/main/java/com/legacy/aether/tileentity/TileEntityChestMimic.java +++ b/src/main/java/com/legacy/aether/tileentity/TileEntityChestMimic.java @@ -2,7 +2,6 @@ package com.legacy.aether.tileentity; import net.minecraft.tileentity.TileEntityChest; -public class TileEntityChestMimic extends TileEntityChest -{ +public class TileEntityChestMimic extends TileEntityChest { } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/tileentity/TileEntityEnchanter.java b/src/main/java/com/legacy/aether/tileentity/TileEntityEnchanter.java index 3ed9cb6..ef690d4 100644 --- a/src/main/java/com/legacy/aether/tileentity/TileEntityEnchanter.java +++ b/src/main/java/com/legacy/aether/tileentity/TileEntityEnchanter.java @@ -19,8 +19,7 @@ import com.legacy.aether.util.FilledList; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class TileEntityEnchanter extends AetherTileEntity -{ +public class TileEntityEnchanter extends AetherTileEntity { public int progress, ticksRequired, powerRemaining; @@ -28,72 +27,54 @@ public class TileEntityEnchanter extends AetherTileEntity private AetherEnchantment currentEnchantment; - public TileEntityEnchanter() - { + public TileEntityEnchanter() { super("Altar"); } @Override - public List getTileInventory() - { + public List getTileInventory() { return this.enchantedItemStacks; } @Override - public void onSlotChanged(int index) - { + public void onSlotChanged(int index) { } @Override - public void updateEntity() - { + public void updateEntity() { boolean flag = this.isEnchanting(); - if (this.powerRemaining > 0) - { + if (this.powerRemaining > 0) { this.powerRemaining--; - if (this.currentEnchantment != null) - { - if (this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == BlocksAether.enchanted_gravitite) - { + if (this.currentEnchantment != null) { + if (this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == BlocksAether.enchanted_gravitite) { this.progress += 2.5F; - } - else - { + } else { this.progress++; } } } - if (this.currentEnchantment != null) - { - if (this.progress >= this.ticksRequired) - { - if (!this.worldObj.isRemote) - { + if (this.currentEnchantment != null) { + if (this.progress >= this.ticksRequired) { + if (!this.worldObj.isRemote) { ItemStack result = this.currentEnchantment.getOutput().copy(); EnchantmentHelper.setEnchantments(EnchantmentHelper.getEnchantments(this.getStackInSlot(0)), result); - if (this.getStackInSlot(2) != null) - { + if (this.getStackInSlot(2) != null) { result.stackSize += (this.getStackInSlot(2).stackSize + 1); this.setInventorySlotContents(2, result); - } - else - { + } else { this.setInventorySlotContents(2, result); } - if (this.getStackInSlot(0).getItem().hasContainerItem(this.getStackInSlot(0))) - { + if (this.getStackInSlot(0).getItem().hasContainerItem(this.getStackInSlot(0))) { this.setInventorySlotContents(0, this.getStackInSlot(0).getItem().getContainerItem(this.getStackInSlot(0))); - } - else - { + } else { this.decrStackSize(0, 1); } } @@ -102,39 +83,29 @@ public class TileEntityEnchanter extends AetherTileEntity AetherHooks.onItemEnchant(this, this.currentEnchantment); } - if (this.getStackInSlot(0) == null || (this.getStackInSlot(0) != null && AetherAPI.instance().getEnchantment(this.getStackInSlot(0)) != this.currentEnchantment)) - { + if (this.getStackInSlot(0) == null || (this.getStackInSlot(0) != null && AetherAPI.instance().getEnchantment(this.getStackInSlot(0)) != this.currentEnchantment)) { this.currentEnchantment = null; this.progress = 0; } - if (this.powerRemaining <= 0) - { - if (this.getStackInSlot(1) != null && AetherAPI.instance().isEnchantmentFuel(this.getStackInSlot(1))) - { + if (this.powerRemaining <= 0) { + if (this.getStackInSlot(1) != null && AetherAPI.instance().isEnchantmentFuel(this.getStackInSlot(1))) { this.powerRemaining += AetherAPI.instance().getEnchantmentFuel(this.getStackInSlot(1)).getTimeGiven(); - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { this.decrStackSize(1, 1); } - } - else - { + } else { this.currentEnchantment = null; this.progress = 0; } } - } - else if (this.getStackInSlot(0) != null) - { + } else if (this.getStackInSlot(0) != null) { ItemStack itemstack = this.getStackInSlot(0); AetherEnchantment enchantment = AetherAPI.instance().getEnchantment(itemstack); - if (enchantment != null) - { - if (this.getStackInSlot(2) == null || (enchantment.getOutput().getItem() == this.getStackInSlot(2).getItem() && enchantment.getOutput().getItemDamage() == this.getStackInSlot(2).getItemDamage())) - { + if (enchantment != null) { + if (this.getStackInSlot(2) == null || (enchantment.getOutput().getItem() == this.getStackInSlot(2).getItem() && enchantment.getOutput().getItemDamage() == this.getStackInSlot(2).getItemDamage())) { this.currentEnchantment = enchantment; this.ticksRequired = this.currentEnchantment.getTimeRequired(); this.addEnchantmentWeight(itemstack); @@ -143,32 +114,26 @@ public class TileEntityEnchanter extends AetherTileEntity } } - if (flag != this.isEnchanting()) - { + if (flag != this.isEnchanting()) { this.markDirty(); BlockAetherContainer.setState(this.worldObj, this.xCoord, this.yCoord, this.zCoord, this.isEnchanting()); } } @SuppressWarnings("unchecked") - public void addEnchantmentWeight(ItemStack stack) - { + public void addEnchantmentWeight(ItemStack stack) { Map enchantments = EnchantmentHelper.getEnchantments(stack); - if (!enchantments.isEmpty()) - { - for (int levels : enchantments.values()) - { + if (!enchantments.isEmpty()) { + for (int levels : enchantments.values()) { this.ticksRequired += (levels * 1250); } } } @SideOnly(Side.CLIENT) - public int getEnchantmentProgressScaled(int i) - { - if (this.ticksRequired == 0) - { + public int getEnchantmentProgressScaled(int i) { + if (this.ticksRequired == 0) { return 0; } @@ -176,19 +141,16 @@ public class TileEntityEnchanter extends AetherTileEntity } @SideOnly(Side.CLIENT) - public int getEnchantmentTimeRemaining(int i) - { + public int getEnchantmentTimeRemaining(int i) { return (this.powerRemaining * i) / 500; } - public boolean isEnchanting() - { + public boolean isEnchanting() { return this.powerRemaining > 0; } @Override - public void readFromNBT(NBTTagCompound compound) - { + public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.progress = compound.getInteger("progress"); @@ -197,8 +159,7 @@ public class TileEntityEnchanter extends AetherTileEntity } @Override - public void writeToNBT(NBTTagCompound compound) - { + public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("progress", this.progress); @@ -207,18 +168,12 @@ public class TileEntityEnchanter extends AetherTileEntity } @Override - public boolean isValidSlotItem(int slot, ItemStack stackInSlot) - { - if (slot == 2) - { + public boolean isValidSlotItem(int slot, ItemStack stackInSlot) { + if (slot == 2) { return false; - } - else if (slot == 1 && AetherAPI.instance().isEnchantmentFuel(stackInSlot)) - { + } else if (slot == 1 && AetherAPI.instance().isEnchantmentFuel(stackInSlot)) { return true; - } - else if (slot == 0 && AetherAPI.instance().hasEnchantment(stackInSlot)) - { + } else if (slot == 0 && AetherAPI.instance().hasEnchantment(stackInSlot)) { return true; } @@ -226,9 +181,8 @@ public class TileEntityEnchanter extends AetherTileEntity } @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return side == 0 ? new int[] {2} : new int[] {0, 1}; + public int[] getAccessibleSlotsFromSide(int side) { + return side == 0 ? new int[]{2} : new int[]{0, 1}; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/tileentity/TileEntityFreezer.java b/src/main/java/com/legacy/aether/tileentity/TileEntityFreezer.java index 7229116..e0be937 100644 --- a/src/main/java/com/legacy/aether/tileentity/TileEntityFreezer.java +++ b/src/main/java/com/legacy/aether/tileentity/TileEntityFreezer.java @@ -19,8 +19,7 @@ import com.legacy.aether.util.FilledList; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class TileEntityFreezer extends AetherTileEntity -{ +public class TileEntityFreezer extends AetherTileEntity { public int progress, ticksRequired, powerRemaining; @@ -28,72 +27,54 @@ public class TileEntityFreezer extends AetherTileEntity private AetherFreezable currentFreezable; - public TileEntityFreezer() - { + public TileEntityFreezer() { super("Freezer"); } @Override - public List getTileInventory() - { + public List getTileInventory() { return this.frozenItemStacks; } @Override - public void onSlotChanged(int index) - { + public void onSlotChanged(int index) { } @Override - public void updateEntity() - { + public void updateEntity() { boolean flag = this.isFreezing(); - if (this.powerRemaining > 0) - { + if (this.powerRemaining > 0) { this.powerRemaining--; - if (this.currentFreezable != null) - { - if (this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord) == BlocksAether.icestone) - { + if (this.currentFreezable != null) { + if (this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord) == BlocksAether.icestone) { this.progress += 2; - } - else - { + } else { this.progress++; } } } - if (this.currentFreezable != null) - { - if (this.progress >= this.currentFreezable.getTimeRequired()) - { - if (!this.worldObj.isRemote) - { + if (this.currentFreezable != null) { + if (this.progress >= this.currentFreezable.getTimeRequired()) { + if (!this.worldObj.isRemote) { ItemStack result = this.currentFreezable.getOutput().copy(); EnchantmentHelper.setEnchantments(EnchantmentHelper.getEnchantments(this.getStackInSlot(0)), result); - if (this.getStackInSlot(2) != null) - { + if (this.getStackInSlot(2) != null) { result.stackSize += (this.getStackInSlot(2).stackSize + 1); this.setInventorySlotContents(2, result); - } - else - { + } else { this.setInventorySlotContents(2, result); } - if (this.getStackInSlot(0).getItem().hasContainerItem(this.getStackInSlot(0))) - { + if (this.getStackInSlot(0).getItem().hasContainerItem(this.getStackInSlot(0))) { this.setInventorySlotContents(0, this.getStackInSlot(0).getItem().getContainerItem(this.getStackInSlot(0))); - } - else - { + } else { this.decrStackSize(0, 1); } } @@ -102,39 +83,29 @@ public class TileEntityFreezer extends AetherTileEntity AetherHooks.onItemFreeze(this, this.currentFreezable); } - if (this.getStackInSlot(0) == null || (this.getStackInSlot(0) != null && AetherAPI.instance().getFreezable(this.getStackInSlot(0)) != this.currentFreezable)) - { + if (this.getStackInSlot(0) == null || (this.getStackInSlot(0) != null && AetherAPI.instance().getFreezable(this.getStackInSlot(0)) != this.currentFreezable)) { this.currentFreezable = null; this.progress = 0; } - if (this.powerRemaining <= 0) - { - if (this.getStackInSlot(1) != null && AetherAPI.instance().isFreezableFuel(this.getStackInSlot(1))) - { + if (this.powerRemaining <= 0) { + if (this.getStackInSlot(1) != null && AetherAPI.instance().isFreezableFuel(this.getStackInSlot(1))) { this.powerRemaining += AetherAPI.instance().getFreezableFuel(this.getStackInSlot(1)).getTimeGiven(); - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { this.decrStackSize(1, 1); } - } - else - { + } else { this.currentFreezable = null; this.progress = 0; } } - } - else if (this.getStackInSlot(0) != null) - { + } else if (this.getStackInSlot(0) != null) { ItemStack itemstack = this.getStackInSlot(0); AetherFreezable freezable = AetherAPI.instance().getFreezable(itemstack); - if (freezable != null) - { - if (this.getStackInSlot(2) == null || (freezable.getOutput().getItem() == this.getStackInSlot(2).getItem() && freezable.getOutput().getItemDamage() == this.getStackInSlot(2).getItemDamage())) - { + if (freezable != null) { + if (this.getStackInSlot(2) == null || (freezable.getOutput().getItem() == this.getStackInSlot(2).getItem() && freezable.getOutput().getItemDamage() == this.getStackInSlot(2).getItemDamage())) { this.currentFreezable = freezable; this.ticksRequired = this.currentFreezable.getTimeRequired(); this.addEnchantmentWeight(itemstack); @@ -143,51 +114,42 @@ public class TileEntityFreezer extends AetherTileEntity } } - if (flag != this.isFreezing()) - { + if (flag != this.isFreezing()) { this.markDirty(); BlockAetherContainer.setState(this.worldObj, this.xCoord, this.yCoord, this.zCoord, this.isFreezing()); } } @SuppressWarnings("unchecked") - public void addEnchantmentWeight(ItemStack stack) - { + public void addEnchantmentWeight(ItemStack stack) { Map enchantments = EnchantmentHelper.getEnchantments(stack); - if (!enchantments.isEmpty()) - { - for (int levels : enchantments.values()) - { + if (!enchantments.isEmpty()) { + for (int levels : enchantments.values()) { this.ticksRequired += (levels * 1250); } } } @SideOnly(Side.CLIENT) - public int getFreezingProgressScaled(int i) - { - if (this.ticksRequired == 0) - { + public int getFreezingProgressScaled(int i) { + if (this.ticksRequired == 0) { return 0; } return (this.progress * i) / this.ticksRequired; } @SideOnly(Side.CLIENT) - public int getFreezingTimeRemaining(int i) - { + public int getFreezingTimeRemaining(int i) { return (this.powerRemaining * i) / 500; } - public boolean isFreezing() - { + public boolean isFreezing() { return this.powerRemaining > 0; } @Override - public void readFromNBT(NBTTagCompound compound) - { + public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.progress = compound.getInteger("progress"); @@ -196,8 +158,7 @@ public class TileEntityFreezer extends AetherTileEntity } @Override - public void writeToNBT(NBTTagCompound compound) - { + public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("progress", this.progress); @@ -206,16 +167,11 @@ public class TileEntityFreezer extends AetherTileEntity } @Override - public boolean isValidSlotItem(int slot, ItemStack stackInSlot) - { - if (stackInSlot != null) - { - if (AetherAPI.instance().hasFreezable(stackInSlot)) - { + public boolean isValidSlotItem(int slot, ItemStack stackInSlot) { + if (stackInSlot != null) { + if (AetherAPI.instance().hasFreezable(stackInSlot)) { return true; - } - else if (slot == 1 && AetherAPI.instance().isFreezableFuel(stackInSlot)) - { + } else if (slot == 1 && AetherAPI.instance().isFreezableFuel(stackInSlot)) { return true; } } @@ -224,9 +180,8 @@ public class TileEntityFreezer extends AetherTileEntity } @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return side == 0 ? new int[] {2} : new int[] {0, 1}; + public int[] getAccessibleSlotsFromSide(int side) { + return side == 0 ? new int[]{2} : new int[]{0, 1}; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/tileentity/TileEntityIncubator.java b/src/main/java/com/legacy/aether/tileentity/TileEntityIncubator.java index 4b7214b..4d64137 100644 --- a/src/main/java/com/legacy/aether/tileentity/TileEntityIncubator.java +++ b/src/main/java/com/legacy/aether/tileentity/TileEntityIncubator.java @@ -17,8 +17,7 @@ import com.legacy.aether.registry.achievements.AchievementsAether; import com.legacy.aether.tileentity.util.AetherTileEntity; import com.legacy.aether.util.FilledList; -public class TileEntityIncubator extends AetherTileEntity -{ +public class TileEntityIncubator extends AetherTileEntity { public EntityPlayer owner; @@ -30,29 +29,24 @@ public class TileEntityIncubator extends AetherTileEntity private final FilledList incubatorItemStacks = new FilledList(3, null); - public TileEntityIncubator() - { + public TileEntityIncubator() { super("Incubator"); } @Override - public List getTileInventory() - { + public List getTileInventory() { return this.incubatorItemStacks; } @Override - public void onSlotChanged(int index) - { - if (index == 1) - { + public void onSlotChanged(int index) { + if (index == 1) { this.progress = 0; } } @Override - public void readFromNBT(NBTTagCompound compound) - { + public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.progress = compound.getInteger("progress"); @@ -60,65 +54,53 @@ public class TileEntityIncubator extends AetherTileEntity } @Override - public void writeToNBT(NBTTagCompound compound) - { + public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("progress", this.progress); compound.setInteger("powerRemaining", this.powerRemaining); } - public int getProgressScaled(int i) - { + public int getProgressScaled(int i) { return (this.progress * i) / this.ticksRequired; } - public int getPowerTimeRemainingScaled(int i) - { + public int getPowerTimeRemainingScaled(int i) { return (this.powerRemaining * i) / 500; } - public boolean isIncubating() - { + public boolean isIncubating() { return this.powerRemaining > 0; } @Override - public void updateEntity() - { + public void updateEntity() { boolean flag = this.isIncubating(); - if (this.powerRemaining > 0) - { + if (this.powerRemaining > 0) { this.powerRemaining--; - if (this.getStackInSlot(1) != null) - { + if (this.getStackInSlot(1) != null) { this.progress++; } } - if (this.progress >= this.ticksRequired) - { - if (this.getStackInSlot(1).getItem() instanceof ItemMoaEgg) - { + if (this.progress >= this.ticksRequired) { + if (this.getStackInSlot(1).getItem() instanceof ItemMoaEgg) { ItemMoaEgg moaEgg = (ItemMoaEgg) this.getStackInSlot(1).getItem(); - if (this.owner != null) - { + if (this.owner != null) { this.owner.triggerAchievement(AchievementsAether.incubator); } - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { EntityMoa moa = new EntityMoa(this.worldObj); moa.setPlayerGrown(true); moa.setGrowingAge(-24000); moa.setMoaType(moaEgg.getMoaTypeFromItemStack(this.getStackInSlot(1))); - for (int safeY = 0; !this.worldObj.isAirBlock(this.xCoord, this.yCoord + safeY, this.zCoord); safeY++) - { + for (int safeY = 0; !this.worldObj.isAirBlock(this.xCoord, this.yCoord + safeY, this.zCoord); safeY++) { moa.setPositionAndUpdate(this.xCoord + 0.5D, this.yCoord + safeY + 1.5D, this.zCoord + 0.5D); } @@ -128,49 +110,40 @@ public class TileEntityIncubator extends AetherTileEntity AetherHooks.onMoaHatched(moaEgg.getMoaTypeFromItemStack(this.getStackInSlot(1)), this); } - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { this.decrStackSize(1, 1); } this.progress = 0; } - if (this.powerRemaining <= 0) - { - if (this.getStackInSlot(0) != null && this.getStackInSlot(1) != null && this.getStackInSlot(1).getItem() == ItemsAether.moa_egg && this.getStackInSlot(0).getItem() == Item.getItemFromBlock(BlocksAether.ambrosium_torch)) - { + if (this.powerRemaining <= 0) { + if (this.getStackInSlot(0) != null && this.getStackInSlot(1) != null && this.getStackInSlot(1).getItem() == ItemsAether.moa_egg && this.getStackInSlot(0).getItem() == Item.getItemFromBlock(BlocksAether.ambrosium_torch)) { this.powerRemaining += 1000; - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { this.decrStackSize(0, 1); } - } - else - { + } else { this.powerRemaining = 0; this.progress = 0; } } - if (flag != this.isIncubating()) - { + if (flag != this.isIncubating()) { this.markDirty(); BlockAetherContainer.setState(this.worldObj, this.xCoord, this.yCoord, this.zCoord, this.isIncubating()); } } @Override - public boolean isValidSlotItem(int index, ItemStack itemstack) - { + public boolean isValidSlotItem(int index, ItemStack itemstack) { return (index == 0 && itemstack.getItem() == Item.getItemFromBlock(BlocksAether.ambrosium_torch) ? true : (index == 1 && itemstack.getItem() == ItemsAether.moa_egg)); } @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return side == 0 ? new int[] {} : new int[] {0, 1}; + public int[] getAccessibleSlotsFromSide(int side) { + return side == 0 ? new int[]{} : new int[]{0, 1}; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/tileentity/TileEntityTreasureChest.java b/src/main/java/com/legacy/aether/tileentity/TileEntityTreasureChest.java index f7c90f1..d6dd735 100644 --- a/src/main/java/com/legacy/aether/tileentity/TileEntityTreasureChest.java +++ b/src/main/java/com/legacy/aether/tileentity/TileEntityTreasureChest.java @@ -16,121 +16,101 @@ import com.legacy.aether.world.gen.components.ComponentSilverDungeon; import cpw.mods.fml.common.FMLCommonHandler; -public class TileEntityTreasureChest extends TileEntityChest -{ +public class TileEntityTreasureChest extends TileEntityChest { - private boolean locked = true; + private boolean locked = true; - private int kind = 0; - - @Override - public void readFromNBT(NBTTagCompound compound) - { - super.readFromNBT(compound); - - this.locked = compound.getBoolean("locked"); - this.kind = compound.getInteger("dungeonType"); - } - - @Override - public void writeToNBT(NBTTagCompound compound) - { - super.writeToNBT(compound); - - compound.setBoolean("locked", this.locked); - compound.setInteger("dungeonType", this.kind); - } - - public void unlock(int kind) - { - this.kind = kind; - Random random = new Random(); - int p; - - if (kind == 0) - { - for (p = 0; p < 5 + random.nextInt(1); ++p) - { - this.setInventorySlotContents(random.nextInt(this.getSizeInventory()), BronzeDungeon.getBronzeLoot(random)); - } - } - - if (kind == 1) - { - for (p = 0; p < 5 + random.nextInt(1); ++p) - { - this.setInventorySlotContents(random.nextInt(this.getSizeInventory()), ComponentSilverDungeon.getSilverLoot(random)); - } - } - - if (kind == 2) - { - for (p = 0; p < 5 + random.nextInt(1); ++p) - { - this.setInventorySlotContents(random.nextInt(this.getSizeInventory()), ComponentGoldenDungeon.getGoldLoot(random)); - } - } - - this.locked = false; - - if (!this.worldObj.isRemote) - { - this.sendToAllInOurWorld(this.getDescriptionPacket()); - } - } + private int kind = 0; @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) - { + public void readFromNBT(NBTTagCompound compound) { + super.readFromNBT(compound); + + this.locked = compound.getBoolean("locked"); + this.kind = compound.getInteger("dungeonType"); + } + + @Override + public void writeToNBT(NBTTagCompound compound) { + super.writeToNBT(compound); + + compound.setBoolean("locked", this.locked); + compound.setInteger("dungeonType", this.kind); + } + + public void unlock(int kind) { + this.kind = kind; + Random random = new Random(); + int p; + + if (kind == 0) { + for (p = 0; p < 5 + random.nextInt(1); ++p) { + this.setInventorySlotContents(random.nextInt(this.getSizeInventory()), BronzeDungeon.getBronzeLoot(random)); + } + } + + if (kind == 1) { + for (p = 0; p < 5 + random.nextInt(1); ++p) { + this.setInventorySlotContents(random.nextInt(this.getSizeInventory()), ComponentSilverDungeon.getSilverLoot(random)); + } + } + + if (kind == 2) { + for (p = 0; p < 5 + random.nextInt(1); ++p) { + this.setInventorySlotContents(random.nextInt(this.getSizeInventory()), ComponentGoldenDungeon.getGoldLoot(random)); + } + } + + this.locked = false; + + if (!this.worldObj.isRemote) { + this.sendToAllInOurWorld(this.getDescriptionPacket()); + } + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); } @Override - public Packet getDescriptionPacket() - { + public Packet getDescriptionPacket() { NBTTagCompound var1 = new NBTTagCompound(); this.writeToNBT(var1); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, var1); } - @Override - public void openInventory() - { - super.openInventory(); - } + @Override + public void openInventory() { + super.openInventory(); + } - @Override - public void closeInventory() - { - --this.numPlayersUsing; - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - } + @Override + public void closeInventory() { + --this.numPlayersUsing; + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + } - private void sendToAllInOurWorld(Packet pkt) - { + private void sendToAllInOurWorld(Packet pkt) { ServerConfigurationManager scm = FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager(); - for (Object obj : scm.playerEntityList) - { + for (Object obj : scm.playerEntityList) { EntityPlayerMP player = (EntityPlayerMP) obj; - if (this.worldObj == player.worldObj) - { + if (this.worldObj == player.worldObj) { player.playerNetServerHandler.sendPacket(pkt); } } } - public boolean isLocked() - { - return this.locked; - } + public boolean isLocked() { + return this.locked; + } - public int getKind() - { - return this.kind; - } + public int getKind() { + return this.kind; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/tileentity/util/AetherTileEntity.java b/src/main/java/com/legacy/aether/tileentity/util/AetherTileEntity.java index e6911db..a8bca8d 100644 --- a/src/main/java/com/legacy/aether/tileentity/util/AetherTileEntity.java +++ b/src/main/java/com/legacy/aether/tileentity/util/AetherTileEntity.java @@ -10,63 +10,53 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -public abstract class AetherTileEntity extends TileEntity implements ISidedInventory, IInventory -{ +public abstract class AetherTileEntity extends TileEntity implements ISidedInventory, IInventory { private String name = "generic"; private String customTileName = null; - public AetherTileEntity(String name) - { + public AetherTileEntity(String name) { this.name = name; } public abstract List getTileInventory(); @Override - public String getInventoryName() - { + public String getInventoryName() { return this.hasCustomInventoryName() ? this.customTileName : this.name; } @Override - public boolean hasCustomInventoryName() - { + public boolean hasCustomInventoryName() { return this.customTileName != null && !this.customTileName.isEmpty(); } - public void setCustomName(String customTileName) - { + public void setCustomName(String customTileName) { this.customTileName = customTileName; } @Override - public int getSizeInventory() - { + public int getSizeInventory() { return this.getTileInventory().size(); } @Override - public ItemStack getStackInSlot(int index) - { + public ItemStack getStackInSlot(int index) { return this.getTileInventory().get(index); } @Override - public ItemStack decrStackSize(int index, int count) - { + public ItemStack decrStackSize(int index, int count) { ItemStack stack = this.getStackInSlot(index); - if (stack.stackSize <= count) - { + if (stack.stackSize <= count) { this.setInventorySlotContents(index, null); return stack; } - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { this.setInventorySlotContents(index, null); } @@ -74,12 +64,10 @@ public abstract class AetherTileEntity extends TileEntity implements ISidedInven } @Override - public ItemStack getStackInSlotOnClosing(int index) - { + public ItemStack getStackInSlotOnClosing(int index) { ItemStack stack = this.getStackInSlot(index); - if (this.getStackInSlot(index) != null) - { + if (this.getStackInSlot(index) != null) { this.setInventorySlotContents(index, null); } @@ -87,114 +75,100 @@ public abstract class AetherTileEntity extends TileEntity implements ISidedInven } @Override - public void setInventorySlotContents(int index, ItemStack stack) - { - boolean flag = stack != null && this.getStackInSlot(index) != null && stack.isItemEqual(this.getStackInSlot(index)) && ItemStack.areItemStackTagsEqual(stack, this.getStackInSlot(index)); + public void setInventorySlotContents(int index, ItemStack stack) { + boolean flag = stack != null && this.getStackInSlot(index) != null && stack.isItemEqual(this.getStackInSlot(index)) && ItemStack.areItemStackTagsEqual(stack, this.getStackInSlot(index)); this.getTileInventory().set(index, stack); - if (stack != null && stack.stackSize > this.getInventoryStackLimit()) - { + if (stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } - if (!flag) - { - this.onSlotChanged(index); + if (!flag) { + this.onSlotChanged(index); - this.markDirty(); - } + this.markDirty(); + } } public abstract void onSlotChanged(int index); @Override - public void readFromNBT(NBTTagCompound compound) - { + public void readFromNBT(NBTTagCompound compound) { NBTTagList list = compound.getTagList("Items", 10); - for (int i = 0; i < list.tagCount(); ++i) - { - NBTTagCompound stackCompound = list.getCompoundTagAt(i); - byte slot = stackCompound.getByte("Slot"); + for (int i = 0; i < list.tagCount(); ++i) { + NBTTagCompound stackCompound = list.getCompoundTagAt(i); + byte slot = stackCompound.getByte("Slot"); - if (slot >= 0 && slot < this.getTileInventory().size()) - { - this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackCompound)); - } - } + if (slot >= 0 && slot < this.getTileInventory().size()) { + this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackCompound)); + } + } - if (compound.hasKey("CustomName", 8)) - { - this.customTileName = compound.getString("CustomName"); - } + if (compound.hasKey("CustomName", 8)) { + this.customTileName = compound.getString("CustomName"); + } super.readFromNBT(compound); } @Override - public void writeToNBT(NBTTagCompound compound) - { - NBTTagList list = new NBTTagList(); + public void writeToNBT(NBTTagCompound compound) { + NBTTagList list = new NBTTagList(); - for (int i = 0; i < this.getTileInventory().size(); ++i) - { - ItemStack stack = this.getTileInventory().get(i); + for (int i = 0; i < this.getTileInventory().size(); ++i) { + ItemStack stack = this.getTileInventory().get(i); - if (stack != null) - { - NBTTagCompound stackCompound = new NBTTagCompound(); - stackCompound.setByte("Slot", (byte)i); - stack.writeToNBT(stackCompound); - list.appendTag(stackCompound); - } - } + if (stack != null) { + NBTTagCompound stackCompound = new NBTTagCompound(); + stackCompound.setByte("Slot", (byte) i); + stack.writeToNBT(stackCompound); + list.appendTag(stackCompound); + } + } - compound.setTag("Items", list); + compound.setTag("Items", list); - if (this.hasCustomInventoryName()) - { - compound.setString("CustomName", this.customTileName); - } + if (this.hasCustomInventoryName()) { + compound.setString("CustomName", this.customTileName); + } super.writeToNBT(compound); } @Override - public boolean isUseableByPlayer(EntityPlayer player) - { + public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 64; } @Override - public void openInventory() { } + public void openInventory() { + } @Override - public void closeInventory() { } + public void closeInventory() { + } @Override - public boolean isItemValidForSlot(int index, ItemStack stack) - { + public boolean isItemValidForSlot(int index, ItemStack stack) { return this.isValidSlotItem(index, stack); } public abstract boolean isValidSlotItem(int slot, ItemStack stackInSlot); @Override - public boolean canInsertItem(int index, ItemStack stack, int direction) - { - return this.isValidSlotItem(index, stack); - } + public boolean canInsertItem(int index, ItemStack stack, int direction) { + return this.isValidSlotItem(index, stack); + } @Override - public boolean canExtractItem(int index, ItemStack stack, int direction) - { + public boolean canExtractItem(int index, ItemStack stack, int direction) { return true; } diff --git a/src/main/java/com/legacy/aether/util/FilledList.java b/src/main/java/com/legacy/aether/util/FilledList.java index a95ddf0..a033729 100644 --- a/src/main/java/com/legacy/aether/util/FilledList.java +++ b/src/main/java/com/legacy/aether/util/FilledList.java @@ -4,16 +4,14 @@ import java.util.AbstractList; import java.util.Arrays; import java.util.List; -public class FilledList extends AbstractList -{ +public class FilledList extends AbstractList { private final List list; private E fillElement; @SuppressWarnings("unchecked") - public FilledList(int size, E fillIn) - { + public FilledList(int size, E fillIn) { this.fillElement = fillIn; Object[] objectList = new Object[size]; @@ -23,40 +21,33 @@ public class FilledList extends AbstractList } @Override - public E set(int index, E element) - { + public E set(int index, E element) { return this.list.set(index, element); } @Override - public void add(int index, E element) - { + public void add(int index, E element) { this.list.add(element); } @Override - public E get(int index) - { + public E get(int index) { return this.list.get(index); } @Override - public E remove(int index) - { + public E remove(int index) { return this.list.remove(index); } @Override - public int size() - { + public int size() { return this.list.size(); } @Override - public void clear() - { - for (int i = 0; i < this.size(); ++i) - { + public void clear() { + for (int i = 0; i < this.size(); ++i) { this.set(i, this.fillElement); } } diff --git a/src/main/java/com/legacy/aether/world/AetherWorld.java b/src/main/java/com/legacy/aether/world/AetherWorld.java index a9517a4..a62b3e4 100644 --- a/src/main/java/com/legacy/aether/world/AetherWorld.java +++ b/src/main/java/com/legacy/aether/world/AetherWorld.java @@ -15,13 +15,11 @@ import com.legacy.aether.world.gen.components.ComponentGoldenIslandStub; import com.legacy.aether.world.gen.components.ComponentLargeColdAercloud; import com.legacy.aether.world.gen.components.ComponentSilverDungeon; -public class AetherWorld -{ +public class AetherWorld { public static BiomeGenBase aether_biome = new AetherBiome(); - public static void initialization() - { + public static void initialization() { MapGenStructureIO.registerStructure(MapGenSilverDungeon.Start.class, "aether_legacy:silver_dungeon_start"); MapGenStructureIO.registerStructure(MapGenGoldenDungeon.Start.class, "aether_legacy:golden_dungeon_start"); diff --git a/src/main/java/com/legacy/aether/world/AetherWorldProvider.java b/src/main/java/com/legacy/aether/world/AetherWorldProvider.java index d56a598..e8492d3 100644 --- a/src/main/java/com/legacy/aether/world/AetherWorldProvider.java +++ b/src/main/java/com/legacy/aether/world/AetherWorldProvider.java @@ -9,31 +9,26 @@ import net.minecraftforge.client.IRenderHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class AetherWorldProvider extends WorldProvider -{ +public class AetherWorldProvider extends WorldProvider { private float[] colorsSunriseSunset = new float[4]; - public AetherWorldProvider() - { + public AetherWorldProvider() { super(); } @Override - protected void registerWorldChunkManager() - { + protected void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerAether(); } @Override - public float[] calcSunriseSunsetColors(float f, float f1) - { + public float[] calcSunriseSunsetColors(float f, float f1) { float f2 = 0.4F; float f3 = MathHelper.cos(f * 3.141593F * 2.0F) - 0.0F; float f4 = -0F; - if (f3 >= f4 - f2 && f3 <= f4 + f2) - { + if (f3 >= f4 - f2 && f3 <= f4 + f2) { float f5 = (f3 - f4) / f2 * 0.5F + 0.5F; float f6 = 1.0F - (1.0F - MathHelper.sin(f5 * 3.141593F)) * 0.99F; f6 *= f6; @@ -42,53 +37,43 @@ public class AetherWorldProvider extends WorldProvider this.colorsSunriseSunset[2] = f5 * f5 * 0.7F + 0.2F; this.colorsSunriseSunset[3] = f6; return this.colorsSunriseSunset; - } - else - { + } else { return null; } } @Override - public boolean canCoordinateBeSpawn(int i, int j) - { + public boolean canCoordinateBeSpawn(int i, int j) { return false; } @Override - public boolean canRespawnHere() - { + public boolean canRespawnHere() { return false; } @Override - public IChunkProvider createChunkGenerator() - { + public IChunkProvider createChunkGenerator() { return new ChunkProviderAether(this.worldObj, this.worldObj.getSeed()); } - public boolean canDoLightning(Chunk chunk) - { - return false; - } + public boolean canDoLightning(Chunk chunk) { + return false; + } - public boolean canDoRainSnowIce(Chunk chunk) - { - return false; - } + public boolean canDoRainSnowIce(Chunk chunk) { + return false; + } @Override - public Vec3 getFogColor(float f, float f1) - { + public Vec3 getFogColor(float f, float f1) { int i = 0x8080a0; float f2 = MathHelper.cos(f * 3.141593F * 2.0F) * 2.0F + 0.5F; - if (f2 < 0.0F) - { + if (f2 < 0.0F) { f2 = 0.0F; } - if (f2 > 1.0F) - { + if (f2 > 1.0F) { f2 = 1.0F; } float f3 = (i >> 16 & 0xff) / 255F; @@ -102,58 +87,49 @@ public class AetherWorldProvider extends WorldProvider } @Override - public String getSaveFolder() - { + public String getSaveFolder() { return "Dim-Aether"; } @Override - public double getVoidFogYFactor() - { + public double getVoidFogYFactor() { return 100; } @Override - public boolean doesXZShowFog(int x, int z) - { + public boolean doesXZShowFog(int x, int z) { return false; } @Override - public boolean isSkyColored() - { + public boolean isSkyColored() { return false; } @Override - public double getHorizon() - { + public double getHorizon() { return 0.0; } - @Override - public float getCloudHeight() - { - return 8F; - } + @Override + public float getCloudHeight() { + return 8F; + } @Override - public String getDimensionName() - { + public String getDimensionName() { return "the_aether"; } @Override @SideOnly(Side.CLIENT) - public net.minecraftforge.client.IRenderHandler getWeatherRenderer() - { - return new IRenderHandler() - { + public net.minecraftforge.client.IRenderHandler getWeatherRenderer() { + return new IRenderHandler() { @Override - public void render(float partialTicks, net.minecraft.client.multiplayer.WorldClient world, net.minecraft.client.Minecraft mc) - { + public void render(float partialTicks, net.minecraft.client.multiplayer.WorldClient world, net.minecraft.client.Minecraft mc) { - }}; - } + } + }; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/ChunkProviderAether.java b/src/main/java/com/legacy/aether/world/ChunkProviderAether.java index f03de97..0830227 100644 --- a/src/main/java/com/legacy/aether/world/ChunkProviderAether.java +++ b/src/main/java/com/legacy/aether/world/ChunkProviderAether.java @@ -23,8 +23,7 @@ import com.legacy.aether.world.gen.MapGenLargeColdAercloud; import com.legacy.aether.world.gen.MapGenQuicksoil; import com.legacy.aether.world.gen.MapGenSilverDungeon; -public class ChunkProviderAether implements IChunkProvider -{ +public class ChunkProviderAether implements IChunkProvider { private Random rand; @@ -36,18 +35,17 @@ public class ChunkProviderAether implements IChunkProvider double pnr[], ar[], br[]; - protected AetherDungeon dungeon_bronze = new BronzeDungeon(); + protected AetherDungeon dungeon_bronze = new BronzeDungeon(); - private MapGenQuicksoil quicksoilGen = new MapGenQuicksoil(); + private MapGenQuicksoil quicksoilGen = new MapGenQuicksoil(); - private MapGenSilverDungeon silverDungeonStructure = new MapGenSilverDungeon(); + private MapGenSilverDungeon silverDungeonStructure = new MapGenSilverDungeon(); - private MapGenGoldenDungeon goldenDungeonStructure = new MapGenGoldenDungeon(); + private MapGenGoldenDungeon goldenDungeonStructure = new MapGenGoldenDungeon(); - private MapGenLargeColdAercloud largeColdAercloudStructure = new MapGenLargeColdAercloud(); + private MapGenLargeColdAercloud largeColdAercloudStructure = new MapGenLargeColdAercloud(); - public ChunkProviderAether(World world, long seed) - { + public ChunkProviderAether(World world, long seed) { this.worldObj = world; this.rand = new Random(seed); @@ -56,228 +54,191 @@ public class ChunkProviderAether implements IChunkProvider this.perlinNoise1 = new NoiseGeneratorOctaves(this.rand, 8); } - public void setBlocksInChunk(int x, int z, Block[] blocks) - { - this.buffer = this.setupNoiseGenerators(this.buffer, x * 2, z * 2); + public void setBlocksInChunk(int x, int z, Block[] blocks) { + this.buffer = this.setupNoiseGenerators(this.buffer, x * 2, z * 2); - for(int i1 = 0; i1 < 2; i1++) - { - for(int j1 = 0; j1 < 2; j1++) - { - for(int k1 = 0; k1 < 32; k1++) - { - double d1 = this.buffer[(i1 * 3 + j1) * 33 + k1]; - double d2 = this.buffer[(i1 * 3 + (j1 + 1)) * 33 + k1]; - double d3 = this.buffer[((i1 + 1) * 3 + j1) * 33 + k1]; - double d4 = this.buffer[((i1 + 1) * 3 + (j1 + 1)) * 33 + k1]; + for (int i1 = 0; i1 < 2; i1++) { + for (int j1 = 0; j1 < 2; j1++) { + for (int k1 = 0; k1 < 32; k1++) { + double d1 = this.buffer[(i1 * 3 + j1) * 33 + k1]; + double d2 = this.buffer[(i1 * 3 + (j1 + 1)) * 33 + k1]; + double d3 = this.buffer[((i1 + 1) * 3 + j1) * 33 + k1]; + double d4 = this.buffer[((i1 + 1) * 3 + (j1 + 1)) * 33 + k1]; - double d5 = (this.buffer[(i1 * 3 + j1) * 33 + (k1 + 1)] - d1) * 0.25D; - double d6 = (this.buffer[(i1 * 3 + (j1 + 1)) * 33 + (k1 + 1)] - d2) * 0.25D; - double d7 = (this.buffer[((i1 + 1) * 3 + j1) * 33 + (k1 + 1)] - d3) * 0.25D; - double d8 = (this.buffer[((i1 + 1) * 3 + (j1 + 1)) * 33 + (k1 + 1)] - d4) * 0.25D; + double d5 = (this.buffer[(i1 * 3 + j1) * 33 + (k1 + 1)] - d1) * 0.25D; + double d6 = (this.buffer[(i1 * 3 + (j1 + 1)) * 33 + (k1 + 1)] - d2) * 0.25D; + double d7 = (this.buffer[((i1 + 1) * 3 + j1) * 33 + (k1 + 1)] - d3) * 0.25D; + double d8 = (this.buffer[((i1 + 1) * 3 + (j1 + 1)) * 33 + (k1 + 1)] - d4) * 0.25D; - for(int l1 = 0; l1 < 4; l1++) - { - double d10 = d1; - double d11 = d2; - double d12 = (d3 - d1) * 0.125D; - double d13 = (d4 - d2) * 0.125D; + for (int l1 = 0; l1 < 4; l1++) { + double d10 = d1; + double d11 = d2; + double d12 = (d3 - d1) * 0.125D; + double d13 = (d4 - d2) * 0.125D; - for(int i2 = 0; i2 < 8; i2++) - { - int j2 = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1; - char c = '\200'; - double d15 = d10; - double d16 = (d11 - d10) * 0.125D; + for (int i2 = 0; i2 < 8; i2++) { + int j2 = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1; + char c = '\200'; + double d15 = d10; + double d16 = (d11 - d10) * 0.125D; - for(int k2 = 0; k2 < 8; k2++) - { - Block filler = Blocks.air; + for (int k2 = 0; k2 < 8; k2++) { + Block filler = Blocks.air; - if(d15 > 0.0D) - { - filler = BlocksAether.holystone; - } + if (d15 > 0.0D) { + filler = BlocksAether.holystone; + } - blocks[j2] = filler; - j2 += c; - d15 += d16; - } + blocks[j2] = filler; + j2 += c; + d15 += d16; + } - d10 += d12; - d11 += d13; - } + d10 += d12; + d11 += d13; + } - d1 += d5; - d2 += d6; - d3 += d7; - d4 += d8; - } + d1 += d5; + d2 += d6; + d3 += d7; + d4 += d8; + } - } + } - } + } - } + } - } + } - public void buildSurfaces(int i, int j, Block[] blocks) - { - for(int k = 0; k < 16; k++) - { - for(int l = 0; l < 16; l++) - { - int j1 = -1; - int i1 = (int)(3.0D + this.rand.nextDouble() * 0.25D); + public void buildSurfaces(int i, int j, Block[] blocks) { + for (int k = 0; k < 16; k++) { + for (int l = 0; l < 16; l++) { + int j1 = -1; + int i1 = (int) (3.0D + this.rand.nextDouble() * 0.25D); - Block top = BlocksAether.aether_grass; - Block filler = BlocksAether.aether_dirt; + Block top = BlocksAether.aether_grass; + Block filler = BlocksAether.aether_dirt; - for (int k1 = 127; k1 >= 0; k1--) - { - int l1 = (l * 16 + k) * 128 + k1; + for (int k1 = 127; k1 >= 0; k1--) { + int l1 = (l * 16 + k) * 128 + k1; Block block = blocks[l1]; - if (block == Blocks.air) - { + if (block == Blocks.air) { j1 = -1; - } - else if (block == BlocksAether.holystone) - { - if (j1 == -1) - { - if (i1 <= 0) - { + } else if (block == BlocksAether.holystone) { + if (j1 == -1) { + if (i1 <= 0) { top = Blocks.air; filler = BlocksAether.holystone; } j1 = i1; - if (k1 >= 0) - { + if (k1 >= 0) { blocks[l1] = top; - } - else - { + } else { blocks[l1] = filler; } - } - else if (j1 > 0) - { + } else if (j1 > 0) { --j1; blocks[l1] = filler; } } } - } - } - } + } + } + } - private double[] setupNoiseGenerators(double buffer[], int x, int z) - { - if(buffer == null) - { - buffer = new double[3366]; - } + private double[] setupNoiseGenerators(double buffer[], int x, int z) { + if (buffer == null) { + buffer = new double[3366]; + } - double d = 1368.824D; - double d1 = 684.41200000000003D; + double d = 1368.824D; + double d1 = 684.41200000000003D; - this.pnr = this.perlinNoise1.generateNoiseOctaves(this.pnr, x, 0, z, 3, 33, 3, d / 80D, d1 / 160D, d / 80D); - this.ar = this.noiseGen1.generateNoiseOctaves(this.ar, x, 0, z, 3, 33, 3, d, d1, d); - this.br = this.noiseGen1.generateNoiseOctaves(this.br, x, 0, z, 3, 33, 3, d, d1, d); + this.pnr = this.perlinNoise1.generateNoiseOctaves(this.pnr, x, 0, z, 3, 33, 3, d / 80D, d1 / 160D, d / 80D); + this.ar = this.noiseGen1.generateNoiseOctaves(this.ar, x, 0, z, 3, 33, 3, d, d1, d); + this.br = this.noiseGen1.generateNoiseOctaves(this.br, x, 0, z, 3, 33, 3, d, d1, d); - int id = 0; + int id = 0; - for(int j2 = 0; j2 < 3; j2++) - { - for(int l2 = 0; l2 < 3; l2++) - { - for(int j3 = 0; j3 < 33; j3++) - { - double d8; + for (int j2 = 0; j2 < 3; j2++) { + for (int l2 = 0; l2 < 3; l2++) { + for (int j3 = 0; j3 < 33; j3++) { + double d8; - double d10 = this.ar[id] / 512D; - double d11 = this.br[id] / 512D; - double d12 = (this.pnr[id] / 10D + 1.0D) / 2D; + double d10 = this.ar[id] / 512D; + double d11 = this.br[id] / 512D; + double d12 = (this.pnr[id] / 10D + 1.0D) / 2D; - if(d12 < 0.0D) - { - d8 = d10; - } - else if(d12 > 1.0D) - { - d8 = d11; - } - else - { - d8 = d10 + (d11 - d10) * d12; - } + if (d12 < 0.0D) { + d8 = d10; + } else if (d12 > 1.0D) { + d8 = d11; + } else { + d8 = d10 + (d11 - d10) * d12; + } - d8 -= 8D; + d8 -= 8D; - if(j3 > 33 - 32) - { - double d13 = (float)(j3 - (33 - 32)) / ((float)32 - 1.0F); - d8 = d8 * (1.0D - d13) + -30D * d13; - } + if (j3 > 33 - 32) { + double d13 = (float) (j3 - (33 - 32)) / ((float) 32 - 1.0F); + d8 = d8 * (1.0D - d13) + -30D * d13; + } - if(j3 < 8) - { - double d14 = (float)(8 - j3) / ((float)8 - 1.0F); - d8 = d8 * (1.0D - d14) + -30D * d14; - } + if (j3 < 8) { + double d14 = (float) (8 - j3) / ((float) 8 - 1.0F); + d8 = d8 * (1.0D - d14) + -30D * d14; + } - buffer[id] = d8; + buffer[id] = d8; - id++; - } + id++; + } - } + } - } + } - return buffer; - } + return buffer; + } @Override - public Chunk provideChunk(int x, int z) - { - this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L); - Block[] ablock = new Block[32768]; + public Chunk provideChunk(int x, int z) { + this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L); + Block[] ablock = new Block[32768]; - this.setBlocksInChunk(x, z, ablock); - this.buildSurfaces(x, z, ablock); + this.setBlocksInChunk(x, z, ablock); + this.buildSurfaces(x, z, ablock); - this.quicksoilGen.func_151539_a(this, this.worldObj, x, z, ablock); + this.quicksoilGen.func_151539_a(this, this.worldObj, x, z, ablock); - this.largeColdAercloudStructure.func_151539_a(this, this.worldObj, x, z, ablock); + this.largeColdAercloudStructure.func_151539_a(this, this.worldObj, x, z, ablock); - this.silverDungeonStructure.func_151539_a(this, this.worldObj, x, z, ablock); - this.goldenDungeonStructure.func_151539_a(this, this.worldObj, x, z, ablock); + this.silverDungeonStructure.func_151539_a(this, this.worldObj, x, z, ablock); + this.goldenDungeonStructure.func_151539_a(this, this.worldObj, x, z, ablock); - Chunk chunk = new Chunk(this.worldObj, ablock, x, z); - chunk.generateSkylightMap(); + Chunk chunk = new Chunk(this.worldObj, ablock, x, z); + chunk.generateSkylightMap(); return chunk; } @Override @SuppressWarnings("rawtypes") - public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) - { + public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) { return this.worldObj.getBiomeGenForCoords(x, z).getSpawnableList(creatureType); } @Override - public void recreateStructures(int x, int z) - { - this.largeColdAercloudStructure.func_151539_a(this, this.worldObj, x, z, (Block[])null); - this.silverDungeonStructure.func_151539_a(this, this.worldObj, x, z, (Block[])null); - this.goldenDungeonStructure.func_151539_a(this, this.worldObj, x, z, (Block[])null); + public void recreateStructures(int x, int z) { + this.largeColdAercloudStructure.func_151539_a(this, this.worldObj, x, z, (Block[]) null); + this.silverDungeonStructure.func_151539_a(this, this.worldObj, x, z, (Block[]) null); + this.goldenDungeonStructure.func_151539_a(this, this.worldObj, x, z, (Block[]) null); } @Override @@ -287,77 +248,67 @@ public class ChunkProviderAether implements IChunkProvider } @Override - public void populate(IChunkProvider provider, int chunkX, int chunkZ) - { + public void populate(IChunkProvider provider, int chunkX, int chunkZ) { int x = chunkX * 16; int z = chunkZ * 16; BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(x + 16, z + 16); - this.rand.setSeed(this.worldObj.getSeed()); - long k = this.rand.nextLong() / 2L * 2L + 1L; - long l = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed((long)x * k + (long)z * l ^ this.worldObj.getSeed()); + this.rand.setSeed(this.worldObj.getSeed()); + long k = this.rand.nextLong() / 2L * 2L + 1L; + long l = this.rand.nextLong() / 2L * 2L + 1L; + this.rand.setSeed((long) x * k + (long) z * l ^ this.worldObj.getSeed()); this.largeColdAercloudStructure.generateStructuresInChunk(this.worldObj, this.rand, chunkX, chunkZ); - this.silverDungeonStructure.generateStructuresInChunk(this.worldObj, this.rand, chunkX, chunkZ); - this.goldenDungeonStructure.generateStructuresInChunk(this.worldObj, this.rand, chunkX, chunkZ); + this.silverDungeonStructure.generateStructuresInChunk(this.worldObj, this.rand, chunkX, chunkZ); + this.goldenDungeonStructure.generateStructuresInChunk(this.worldObj, this.rand, chunkX, chunkZ); biome.decorate(this.worldObj, this.rand, x, z); - if (this.rand.nextInt(10) == 0) - { - this.dungeon_bronze.generate(this.worldObj, this.rand, x + this.rand.nextInt(16), this.rand.nextInt(64) + 32, z + this.rand.nextInt(16)); - } + if (this.rand.nextInt(10) == 0) { + this.dungeon_bronze.generate(this.worldObj, this.rand, x + this.rand.nextInt(16), this.rand.nextInt(64) + 32, z + this.rand.nextInt(16)); + } SpawnerAnimals.performWorldGenSpawning(this.worldObj, biome, x + 8, z + 8, 16, 16, this.rand); } @Override - public Chunk loadChunk(int chunkX, int chunkZ) - { + public Chunk loadChunk(int chunkX, int chunkZ) { return this.provideChunk(chunkX, chunkZ); } @Override - public boolean chunkExists(int chunkX, int chunkZ) - { + public boolean chunkExists(int chunkX, int chunkZ) { return true; } @Override - public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_) - { + public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_) { return true; } @Override - public boolean unloadQueuedChunks() - { + public boolean unloadQueuedChunks() { return true; } @Override - public boolean canSave() - { + public boolean canSave() { return true; } @Override - public String makeString() - { + public String makeString() { return "AetherRandomLevelSource"; } @Override - public int getLoadedChunkCount() - { + public int getLoadedChunkCount() { return 0; } @Override - public void saveExtraData() - { + public void saveExtraData() { } diff --git a/src/main/java/com/legacy/aether/world/TeleporterAether.java b/src/main/java/com/legacy/aether/world/TeleporterAether.java index 6e277f9..6a2a1aa 100644 --- a/src/main/java/com/legacy/aether/world/TeleporterAether.java +++ b/src/main/java/com/legacy/aether/world/TeleporterAether.java @@ -20,478 +20,398 @@ import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.player.PlayerAether; import com.legacy.aether.world.util.AetherPortalPosition; -public class TeleporterAether extends Teleporter -{ +public class TeleporterAether extends Teleporter { private final boolean portalSpawn; - private final Random random; + private final Random random; - private final WorldServer worldServerInstance; + private final WorldServer worldServerInstance; - private final LongHashMap destinationCoordinateCache = new LongHashMap(); + private final LongHashMap destinationCoordinateCache = new LongHashMap(); - private final List destinationCoordinateKeys = new ArrayList(); + private final List destinationCoordinateKeys = new ArrayList(); - public TeleporterAether(boolean portalSpawn, WorldServer worldIn) - { - super(worldIn); + public TeleporterAether(boolean portalSpawn, WorldServer worldIn) { + super(worldIn); - this.portalSpawn = portalSpawn; - this.worldServerInstance = worldIn; - this.random = new Random(worldIn.getSeed()); - } + this.portalSpawn = portalSpawn; + this.worldServerInstance = worldIn; + this.random = new Random(worldIn.getSeed()); + } - public void placeInPortal(Entity entityIn, double x, double y, double z, float rotationYaw) - { - if (!this.portalSpawn) - { - entityIn.setPosition(entityIn.posX, 256, entityIn.posZ); + public void placeInPortal(Entity entityIn, double x, double y, double z, float rotationYaw) { + if (!this.portalSpawn) { + entityIn.setPosition(entityIn.posX, 256, entityIn.posZ); - return; - } + return; + } - if (!this.placeInExistingPortal(entityIn, x, y, z, rotationYaw)) - { - this.makePortal(entityIn); - this.placeInExistingPortal(entityIn, x, y, z, rotationYaw); - } - } + if (!this.placeInExistingPortal(entityIn, x, y, z, rotationYaw)) { + this.makePortal(entityIn); + this.placeInExistingPortal(entityIn, x, y, z, rotationYaw); + } + } - @Override - public boolean placeInExistingPortal(Entity entityIn, double x, double y, double z, float rotationYaw) - { - short short1 = 128; - double d3 = -1.0D; - int i = 0; - int j = 0; - int k = 0; - int l = MathHelper.floor_double(entityIn.posX); - int i1 = MathHelper.floor_double(entityIn.posZ); - long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1); - boolean flag = true; - double d7; - int l3; + @Override + public boolean placeInExistingPortal(Entity entityIn, double x, double y, double z, float rotationYaw) { + short short1 = 128; + double d3 = -1.0D; + int i = 0; + int j = 0; + int k = 0; + int l = MathHelper.floor_double(entityIn.posX); + int i1 = MathHelper.floor_double(entityIn.posZ); + long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1); + boolean flag = true; + double d7; + int l3; - if (this.destinationCoordinateCache.containsItem(j1)) - { - AetherPortalPosition portalposition = (AetherPortalPosition)this.destinationCoordinateCache.getValueByKey(j1); - d3 = 0.0D; - i = portalposition.posX; - j = portalposition.posY; - k = portalposition.posZ; - portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); - flag = false; - } - else - { - for (l3 = l - short1; l3 <= l + short1; ++l3) - { - double d4 = (double)l3 + 0.5D - entityIn.posX; + if (this.destinationCoordinateCache.containsItem(j1)) { + AetherPortalPosition portalposition = (AetherPortalPosition) this.destinationCoordinateCache.getValueByKey(j1); + d3 = 0.0D; + i = portalposition.posX; + j = portalposition.posY; + k = portalposition.posZ; + portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); + flag = false; + } else { + for (l3 = l - short1; l3 <= l + short1; ++l3) { + double d4 = (double) l3 + 0.5D - entityIn.posX; - for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) - { - double d5 = (double)l1 + 0.5D - entityIn.posZ; + for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) { + double d5 = (double) l1 + 0.5D - entityIn.posZ; - for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) - { - if (this.worldServerInstance.getBlock(l3, i2, l1) == BlocksAether.aether_portal) - { - while (this.worldServerInstance.getBlock(l3, i2 - 1, l1) == BlocksAether.aether_portal) - { - --i2; - } + for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) { + if (this.worldServerInstance.getBlock(l3, i2, l1) == BlocksAether.aether_portal) { + while (this.worldServerInstance.getBlock(l3, i2 - 1, l1) == BlocksAether.aether_portal) { + --i2; + } - d7 = (double)i2 + 0.5D - entityIn.posY; - double d8 = d4 * d4 + d7 * d7 + d5 * d5; + d7 = (double) i2 + 0.5D - entityIn.posY; + double d8 = d4 * d4 + d7 * d7 + d5 * d5; - if (d3 < 0.0D || d8 < d3) - { - d3 = d8; - i = l3; - j = i2; - k = l1; - } - } - } - } - } - } + if (d3 < 0.0D || d8 < d3) { + d3 = d8; + i = l3; + j = i2; + k = l1; + } + } + } + } + } + } - if (d3 >= 0.0D) - { - if (flag) - { - this.destinationCoordinateCache.add(j1, new AetherPortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime())); - this.destinationCoordinateKeys.add(Long.valueOf(j1)); - } + if (d3 >= 0.0D) { + if (flag) { + this.destinationCoordinateCache.add(j1, new AetherPortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime())); + this.destinationCoordinateKeys.add(Long.valueOf(j1)); + } - double d11 = (double)i + 0.5D; - double d6 = (double)j + 0.5D; - d7 = (double)k + 0.5D; - int i4 = -1; + double d11 = (double) i + 0.5D; + double d6 = (double) j + 0.5D; + d7 = (double) k + 0.5D; + int i4 = -1; - if (this.worldServerInstance.getBlock(i - 1, j, k) == BlocksAether.aether_portal) - { - i4 = 2; - } + if (this.worldServerInstance.getBlock(i - 1, j, k) == BlocksAether.aether_portal) { + i4 = 2; + } - if (this.worldServerInstance.getBlock(i + 1, j, k) == BlocksAether.aether_portal) - { - i4 = 0; - } + if (this.worldServerInstance.getBlock(i + 1, j, k) == BlocksAether.aether_portal) { + i4 = 0; + } - if (this.worldServerInstance.getBlock(i, j, k - 1) == BlocksAether.aether_portal) - { - i4 = 3; - } + if (this.worldServerInstance.getBlock(i, j, k - 1) == BlocksAether.aether_portal) { + i4 = 3; + } - if (this.worldServerInstance.getBlock(i, j, k + 1) == BlocksAether.aether_portal) - { - i4 = 1; - } + if (this.worldServerInstance.getBlock(i, j, k + 1) == BlocksAether.aether_portal) { + i4 = 1; + } - int j2 = entityIn.getTeleportDirection(); + int j2 = entityIn.getTeleportDirection(); - if (entityIn instanceof EntityPlayer) - { - j2 = PlayerAether.get((EntityPlayer) entityIn).teleportDirection; - } + if (entityIn instanceof EntityPlayer) { + j2 = PlayerAether.get((EntityPlayer) entityIn).teleportDirection; + } - if (i4 > -1) - { - int k2 = Direction.rotateLeft[i4]; - int l2 = Direction.offsetX[i4]; - int i3 = Direction.offsetZ[i4]; - int j3 = Direction.offsetX[k2]; - int k3 = Direction.offsetZ[k2]; - boolean flag1 = !this.worldServerInstance.isAirBlock(i + l2 + j3, j, k + i3 + k3) || !this.worldServerInstance.isAirBlock(i + l2 + j3, j + 1, k + i3 + k3); - boolean flag2 = !this.worldServerInstance.isAirBlock(i + l2, j, k + i3) || !this.worldServerInstance.isAirBlock(i + l2, j + 1, k + i3); + if (i4 > -1) { + int k2 = Direction.rotateLeft[i4]; + int l2 = Direction.offsetX[i4]; + int i3 = Direction.offsetZ[i4]; + int j3 = Direction.offsetX[k2]; + int k3 = Direction.offsetZ[k2]; + boolean flag1 = !this.worldServerInstance.isAirBlock(i + l2 + j3, j, k + i3 + k3) || !this.worldServerInstance.isAirBlock(i + l2 + j3, j + 1, k + i3 + k3); + boolean flag2 = !this.worldServerInstance.isAirBlock(i + l2, j, k + i3) || !this.worldServerInstance.isAirBlock(i + l2, j + 1, k + i3); - if (flag1 && flag2) - { - i4 = Direction.rotateOpposite[i4]; - k2 = Direction.rotateOpposite[k2]; - l2 = Direction.offsetX[i4]; - i3 = Direction.offsetZ[i4]; - j3 = Direction.offsetX[k2]; - k3 = Direction.offsetZ[k2]; - l3 = i - j3; - d11 -= (double)j3; - int k1 = k - k3; - d7 -= (double)k3; - flag1 = !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j, k1 + i3 + k3) || !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j + 1, k1 + i3 + k3); - flag2 = !this.worldServerInstance.isAirBlock(l3 + l2, j, k1 + i3) || !this.worldServerInstance.isAirBlock(l3 + l2, j + 1, k1 + i3); - } + if (flag1 && flag2) { + i4 = Direction.rotateOpposite[i4]; + k2 = Direction.rotateOpposite[k2]; + l2 = Direction.offsetX[i4]; + i3 = Direction.offsetZ[i4]; + j3 = Direction.offsetX[k2]; + k3 = Direction.offsetZ[k2]; + l3 = i - j3; + d11 -= (double) j3; + int k1 = k - k3; + d7 -= (double) k3; + flag1 = !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j, k1 + i3 + k3) || !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j + 1, k1 + i3 + k3); + flag2 = !this.worldServerInstance.isAirBlock(l3 + l2, j, k1 + i3) || !this.worldServerInstance.isAirBlock(l3 + l2, j + 1, k1 + i3); + } - float f1 = 0.5F; - float f2 = 0.5F; + float f1 = 0.5F; + float f2 = 0.5F; - if (!flag1 && flag2) - { - f1 = 1.0F; - } - else if (flag1 && !flag2) - { - f1 = 0.0F; - } - else if (flag1 && flag2) - { - f2 = 0.0F; - } + if (!flag1 && flag2) { + f1 = 1.0F; + } else if (flag1 && !flag2) { + f1 = 0.0F; + } else if (flag1 && flag2) { + f2 = 0.0F; + } - d11 += (double)((float)j3 * f1 + f2 * (float)l2); - d7 += (double)((float)k3 * f1 + f2 * (float)i3); - float f3 = 0.0F; - float f4 = 0.0F; - float f5 = 0.0F; - float f6 = 0.0F; + d11 += (double) ((float) j3 * f1 + f2 * (float) l2); + d7 += (double) ((float) k3 * f1 + f2 * (float) i3); + float f3 = 0.0F; + float f4 = 0.0F; + float f5 = 0.0F; + float f6 = 0.0F; - if (i4 == j2) - { - f3 = 1.0F; - f4 = 1.0F; - } - else if (i4 == Direction.rotateOpposite[j2]) - { - f3 = -1.0F; - f4 = -1.0F; - } - else if (i4 == Direction.rotateRight[j2]) - { - f5 = 1.0F; - f6 = -1.0F; - } - else - { - f5 = -1.0F; - f6 = 1.0F; - } + if (i4 == j2) { + f3 = 1.0F; + f4 = 1.0F; + } else if (i4 == Direction.rotateOpposite[j2]) { + f3 = -1.0F; + f4 = -1.0F; + } else if (i4 == Direction.rotateRight[j2]) { + f5 = 1.0F; + f6 = -1.0F; + } else { + f5 = -1.0F; + f6 = 1.0F; + } - double d9 = entityIn.motionX; - double d10 = entityIn.motionZ; - entityIn.motionX = d9 * (double)f3 + d10 * (double)f6; - entityIn.motionZ = d9 * (double)f5 + d10 * (double)f4; - entityIn.rotationYaw = rotationYaw - (float)(j2 * 90) + (float)(i4 * 90); - } - else - { - entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D; - } + double d9 = entityIn.motionX; + double d10 = entityIn.motionZ; + entityIn.motionX = d9 * (double) f3 + d10 * (double) f6; + entityIn.motionZ = d9 * (double) f5 + d10 * (double) f4; + entityIn.rotationYaw = rotationYaw - (float) (j2 * 90) + (float) (i4 * 90); + } else { + entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D; + } - entityIn.setLocationAndAngles(d11, d6, d7, entityIn.rotationYaw, entityIn.rotationPitch); - return true; - } - else - { - return false; - } - } + entityIn.setLocationAndAngles(d11, d6, d7, entityIn.rotationYaw, entityIn.rotationPitch); + return true; + } else { + return false; + } + } - @Override - public boolean makePortal(Entity entityIn) - { - byte b0 = 16; - double d0 = -1.0D; - int i = MathHelper.floor_double(entityIn.posX); - int j = MathHelper.floor_double(entityIn.posY); - int k = MathHelper.floor_double(entityIn.posZ); - int l = i; - int i1 = j; - int j1 = k; - int k1 = 0; - int l1 = this.random.nextInt(4); - int i2; - double d1; - int k2; - double d2; - int i3; - int j3; - int k3; - int l3; - int i4; - int j4; - int k4; - int l4; - int i5; - double d3; - double d4; + @Override + public boolean makePortal(Entity entityIn) { + byte b0 = 16; + double d0 = -1.0D; + int i = MathHelper.floor_double(entityIn.posX); + int j = MathHelper.floor_double(entityIn.posY); + int k = MathHelper.floor_double(entityIn.posZ); + int l = i; + int i1 = j; + int j1 = k; + int k1 = 0; + int l1 = this.random.nextInt(4); + int i2; + double d1; + int k2; + double d2; + int i3; + int j3; + int k3; + int l3; + int i4; + int j4; + int k4; + int l4; + int i5; + double d3; + double d4; - for (i2 = i - b0; i2 <= i + b0; ++i2) - { - d1 = (double)i2 + 0.5D - entityIn.posX; + for (i2 = i - b0; i2 <= i + b0; ++i2) { + d1 = (double) i2 + 0.5D - entityIn.posX; - for (k2 = k - b0; k2 <= k + b0; ++k2) - { - d2 = (double)k2 + 0.5D - entityIn.posZ; - label274: + for (k2 = k - b0; k2 <= k + b0; ++k2) { + d2 = (double) k2 + 0.5D - entityIn.posZ; + label274: - for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) - { - if (this.worldServerInstance.isAirBlock(i2, i3, k2)) - { - while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) - { - --i3; - } + for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { + if (this.worldServerInstance.isAirBlock(i2, i3, k2)) { + while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) { + --i3; + } - for (j3 = l1; j3 < l1 + 4; ++j3) - { - k3 = j3 % 2; - l3 = 1 - k3; + for (j3 = l1; j3 < l1 + 4; ++j3) { + k3 = j3 % 2; + l3 = 1 - k3; - if (j3 % 4 >= 2) - { - k3 = -k3; - l3 = -l3; - } + if (j3 % 4 >= 2) { + k3 = -k3; + l3 = -l3; + } - for (i4 = 0; i4 < 3; ++i4) - { - for (j4 = 0; j4 < 4; ++j4) - { - for (k4 = -1; k4 < 4; ++k4) - { - l4 = i2 + (j4 - 1) * k3 + i4 * l3; - i5 = i3 + k4; - int j5 = k2 + (j4 - 1) * l3 - i4 * k3; + for (i4 = 0; i4 < 3; ++i4) { + for (j4 = 0; j4 < 4; ++j4) { + for (k4 = -1; k4 < 4; ++k4) { + l4 = i2 + (j4 - 1) * k3 + i4 * l3; + i5 = i3 + k4; + int j5 = k2 + (j4 - 1) * l3 - i4 * k3; - if (k4 < 0 && !this.worldServerInstance.getBlock(l4, i5, j5).getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(l4, i5, j5)) - { - continue label274; - } - } - } - } + if (k4 < 0 && !this.worldServerInstance.getBlock(l4, i5, j5).getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(l4, i5, j5)) { + continue label274; + } + } + } + } - d3 = (double)i3 + 0.5D - entityIn.posY; - d4 = d1 * d1 + d3 * d3 + d2 * d2; + d3 = (double) i3 + 0.5D - entityIn.posY; + d4 = d1 * d1 + d3 * d3 + d2 * d2; - if (d0 < 0.0D || d4 < d0) - { - d0 = d4; - l = i2; - i1 = i3; - j1 = k2; - k1 = j3 % 4; - } - } - } - } - } - } + if (d0 < 0.0D || d4 < d0) { + d0 = d4; + l = i2; + i1 = i3; + j1 = k2; + k1 = j3 % 4; + } + } + } + } + } + } - if (d0 < 0.0D) - { - for (i2 = i - b0; i2 <= i + b0; ++i2) - { - d1 = (double)i2 + 0.5D - entityIn.posX; + if (d0 < 0.0D) { + for (i2 = i - b0; i2 <= i + b0; ++i2) { + d1 = (double) i2 + 0.5D - entityIn.posX; - for (k2 = k - b0; k2 <= k + b0; ++k2) - { - d2 = (double)k2 + 0.5D - entityIn.posZ; - label222: + for (k2 = k - b0; k2 <= k + b0; ++k2) { + d2 = (double) k2 + 0.5D - entityIn.posZ; + label222: - for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) - { - if (this.worldServerInstance.isAirBlock(i2, i3, k2)) - { - while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) - { - --i3; - } + for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { + if (this.worldServerInstance.isAirBlock(i2, i3, k2)) { + while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) { + --i3; + } - for (j3 = l1; j3 < l1 + 2; ++j3) - { - k3 = j3 % 2; - l3 = 1 - k3; + for (j3 = l1; j3 < l1 + 2; ++j3) { + k3 = j3 % 2; + l3 = 1 - k3; - for (i4 = 0; i4 < 4; ++i4) - { - for (j4 = -1; j4 < 4; ++j4) - { - k4 = i2 + (i4 - 1) * k3; - l4 = i3 + j4; - i5 = k2 + (i4 - 1) * l3; + for (i4 = 0; i4 < 4; ++i4) { + for (j4 = -1; j4 < 4; ++j4) { + k4 = i2 + (i4 - 1) * k3; + l4 = i3 + j4; + i5 = k2 + (i4 - 1) * l3; - if (j4 < 0 && !this.worldServerInstance.getBlock(k4, l4, i5).getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(k4, l4, i5)) - { - continue label222; - } - } - } + if (j4 < 0 && !this.worldServerInstance.getBlock(k4, l4, i5).getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(k4, l4, i5)) { + continue label222; + } + } + } - d3 = (double)i3 + 0.5D - entityIn.posY; - d4 = d1 * d1 + d3 * d3 + d2 * d2; + d3 = (double) i3 + 0.5D - entityIn.posY; + d4 = d1 * d1 + d3 * d3 + d2 * d2; - if (d0 < 0.0D || d4 < d0) - { - d0 = d4; - l = i2; - i1 = i3; - j1 = k2; - k1 = j3 % 2; - } - } - } - } - } - } - } + if (d0 < 0.0D || d4 < d0) { + d0 = d4; + l = i2; + i1 = i3; + j1 = k2; + k1 = j3 % 2; + } + } + } + } + } + } + } - int k5 = l; - int j2 = i1; - k2 = j1; - int l5 = k1 % 2; - int l2 = 1 - l5; + int k5 = l; + int j2 = i1; + k2 = j1; + int l5 = k1 % 2; + int l2 = 1 - l5; - if (k1 % 4 >= 2) - { - l5 = -l5; - l2 = -l2; - } + if (k1 % 4 >= 2) { + l5 = -l5; + l2 = -l2; + } - boolean flag; + boolean flag; - if (d0 < 0.0D) - { - if (i1 < 70) - { - i1 = 70; - } + if (d0 < 0.0D) { + if (i1 < 70) { + i1 = 70; + } - if (i1 > this.worldServerInstance.getActualHeight() - 10) - { - i1 = this.worldServerInstance.getActualHeight() - 10; - } + if (i1 > this.worldServerInstance.getActualHeight() - 10) { + i1 = this.worldServerInstance.getActualHeight() - 10; + } - j2 = i1; + j2 = i1; - for (i3 = -1; i3 <= 1; ++i3) - { - for (j3 = 1; j3 < 3; ++j3) - { - for (k3 = -1; k3 < 3; ++k3) - { - l3 = k5 + (j3 - 1) * l5 + i3 * l2; - i4 = j2 + k3; - j4 = k2 + (j3 - 1) * l2 - i3 * l5; - flag = k3 < 0; - this.worldServerInstance.setBlock(l3, i4, j4, flag ? Blocks.glowstone : Blocks.air); - } - } - } - } + for (i3 = -1; i3 <= 1; ++i3) { + for (j3 = 1; j3 < 3; ++j3) { + for (k3 = -1; k3 < 3; ++k3) { + l3 = k5 + (j3 - 1) * l5 + i3 * l2; + i4 = j2 + k3; + j4 = k2 + (j3 - 1) * l2 - i3 * l5; + flag = k3 < 0; + this.worldServerInstance.setBlock(l3, i4, j4, flag ? Blocks.glowstone : Blocks.air); + } + } + } + } - for (i3 = 0; i3 < 4; ++i3) - { - for (j3 = 0; j3 < 4; ++j3) - { - for (k3 = -1; k3 < 4; ++k3) - { - l3 = k5 + (j3 - 1) * l5; - i4 = j2 + k3; - j4 = k2 + (j3 - 1) * l2; - flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3; - this.worldServerInstance.setBlock(l3, i4, j4, (Block)(flag ? Blocks.glowstone : BlocksAether.aether_portal), 0, 2); - } - } + for (i3 = 0; i3 < 4; ++i3) { + for (j3 = 0; j3 < 4; ++j3) { + for (k3 = -1; k3 < 4; ++k3) { + l3 = k5 + (j3 - 1) * l5; + i4 = j2 + k3; + j4 = k2 + (j3 - 1) * l2; + flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3; + this.worldServerInstance.setBlock(l3, i4, j4, (Block) (flag ? Blocks.glowstone : BlocksAether.aether_portal), 0, 2); + } + } - for (j3 = 0; j3 < 4; ++j3) - { - for (k3 = -1; k3 < 4; ++k3) - { - l3 = k5 + (j3 - 1) * l5; - i4 = j2 + k3; - j4 = k2 + (j3 - 1) * l2; - this.worldServerInstance.notifyBlocksOfNeighborChange(l3, i4, j4, this.worldServerInstance.getBlock(l3, i4, j4)); - } - } - } + for (j3 = 0; j3 < 4; ++j3) { + for (k3 = -1; k3 < 4; ++k3) { + l3 = k5 + (j3 - 1) * l5; + i4 = j2 + k3; + j4 = k2 + (j3 - 1) * l2; + this.worldServerInstance.notifyBlocksOfNeighborChange(l3, i4, j4, this.worldServerInstance.getBlock(l3, i4, j4)); + } + } + } - return true; - } + return true; + } - @Override - public void removeStalePortalLocations(long worldTime) - { - if (worldTime % 100L == 0L) - { - Iterator iterator = this.destinationCoordinateKeys.iterator(); - long j = worldTime - 600L; + @Override + public void removeStalePortalLocations(long worldTime) { + if (worldTime % 100L == 0L) { + Iterator iterator = this.destinationCoordinateKeys.iterator(); + long j = worldTime - 600L; - while (iterator.hasNext()) - { - Long olong = (Long)iterator.next(); - Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue()); + while (iterator.hasNext()) { + Long olong = (Long) iterator.next(); + Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(olong.longValue()); - if (portalposition == null || portalposition.lastUpdateTime < j) - { - iterator.remove(); - this.destinationCoordinateCache.remove(olong.longValue()); - } - } - } - } + if (portalposition == null || portalposition.lastUpdateTime < j) { + iterator.remove(); + this.destinationCoordinateCache.remove(olong.longValue()); + } + } + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/WorldChunkManagerAether.java b/src/main/java/com/legacy/aether/world/WorldChunkManagerAether.java index c4291ef..f93770d 100644 --- a/src/main/java/com/legacy/aether/world/WorldChunkManagerAether.java +++ b/src/main/java/com/legacy/aether/world/WorldChunkManagerAether.java @@ -2,11 +2,9 @@ package com.legacy.aether.world; import net.minecraft.world.biome.WorldChunkManagerHell; -public class WorldChunkManagerAether extends WorldChunkManagerHell -{ +public class WorldChunkManagerAether extends WorldChunkManagerHell { - public WorldChunkManagerAether() - { + public WorldChunkManagerAether() { super(AetherWorld.aether_biome, 0.0F); } diff --git a/src/main/java/com/legacy/aether/world/biome/AetherBiome.java b/src/main/java/com/legacy/aether/world/biome/AetherBiome.java index a03d3c5..eddf887 100644 --- a/src/main/java/com/legacy/aether/world/biome/AetherBiome.java +++ b/src/main/java/com/legacy/aether/world/biome/AetherBiome.java @@ -1,4 +1,4 @@ - package com.legacy.aether.world.biome; +package com.legacy.aether.world.biome; import java.util.ArrayList; import java.util.Random; @@ -23,12 +23,10 @@ import com.legacy.aether.entities.passive.mountable.EntitySwet; import com.legacy.aether.world.biome.decoration.AetherGenOakTree; import com.legacy.aether.world.biome.decoration.AetherGenSkyrootTree; -public class AetherBiome extends BiomeGenBase -{ +public class AetherBiome extends BiomeGenBase { @SuppressWarnings("unchecked") - public AetherBiome() - { + public AetherBiome() { super(AetherConfig.getAetherBiomeID()); this.spawnableCaveCreatureList.clear(); @@ -58,8 +56,7 @@ public class AetherBiome extends BiomeGenBase this.setColor(0); } - private void addCreatureEntry(ArrayList list) - { + private void addCreatureEntry(ArrayList list) { list.add(new SpawnListEntry(EntitySwet.class, 10, 4, 4)); list.add(new SpawnListEntry(EntityAechorPlant.class, 8, 3, 3)); list.add(new SpawnListEntry(EntitySheepuff.class, 10, 4, 4)); @@ -69,8 +66,7 @@ public class AetherBiome extends BiomeGenBase list.add(new SpawnListEntry(EntityAerbunny.class, 11, 3, 3)); } - private void addMobEntry(ArrayList list) - { + private void addMobEntry(ArrayList list) { list.add(new SpawnListEntry(EntityWhirlwind.class, 8, 2, 2)); list.add(new SpawnListEntry(EntityCockatrice.class, 4, 4, 4)); list.add(new SpawnListEntry(EntityAerwhale.class, 7, 3, 3)); @@ -79,46 +75,39 @@ public class AetherBiome extends BiomeGenBase } @Override - public void addDefaultFlowers() - { - this.flowers.add(new FlowerEntry(BlocksAether.white_flower, 0, 20)); - this.flowers.add(new FlowerEntry(BlocksAether.purple_flower, 0, 10)); - } + public void addDefaultFlowers() { + this.flowers.add(new FlowerEntry(BlocksAether.white_flower, 0, 20)); + this.flowers.add(new FlowerEntry(BlocksAether.purple_flower, 0, 10)); + } @Override - public int getWaterColorMultiplier() - { - return 16777215; - } + public int getWaterColorMultiplier() { + return 16777215; + } @Override - public int getSkyColorByTemp(float currentTemperature) - { - return 0xC0C0FF; // Lavender Blue - } - - @Override - public int getBiomeGrassColor(int x, int y, int z) - { - return 0xb1ffcb; - } - - @Override - public int getBiomeFoliageColor(int x, int y, int z) - { - return 0xb1ffcb; - } + public int getSkyColorByTemp(float currentTemperature) { + return 0xC0C0FF; // Lavender Blue + } @Override - public BiomeDecorator createBiomeDecorator() - { - return new AetherBiomeDecorator(); - } + public int getBiomeGrassColor(int x, int y, int z) { + return 0xb1ffcb; + } @Override - public WorldGenAbstractTree func_150567_a(Random rand) - { - return (WorldGenAbstractTree)(rand.nextInt(20) == 0 ? new AetherGenOakTree() : new AetherGenSkyrootTree(false)); - } + public int getBiomeFoliageColor(int x, int y, int z) { + return 0xb1ffcb; + } + + @Override + public BiomeDecorator createBiomeDecorator() { + return new AetherBiomeDecorator(); + } + + @Override + public WorldGenAbstractTree func_150567_a(Random rand) { + return (WorldGenAbstractTree) (rand.nextInt(20) == 0 ? new AetherGenOakTree() : new AetherGenSkyrootTree(false)); + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/biome/AetherBiomeDecorator.java b/src/main/java/com/legacy/aether/world/biome/AetherBiomeDecorator.java index 13251d6..c35dafd 100644 --- a/src/main/java/com/legacy/aether/world/biome/AetherBiomeDecorator.java +++ b/src/main/java/com/legacy/aether/world/biome/AetherBiomeDecorator.java @@ -24,8 +24,7 @@ import com.legacy.aether.world.biome.decoration.AetherGenOakTree; import com.legacy.aether.world.biome.decoration.AetherGenQuicksoil; import com.legacy.aether.world.biome.decoration.AetherGenSkyrootTree; -public class AetherBiomeDecorator extends BiomeDecorator -{ +public class AetherBiomeDecorator extends BiomeDecorator { public World world; @@ -41,7 +40,7 @@ public class AetherBiomeDecorator extends BiomeDecorator public AetherGenQuicksoil quicksoil_patches = new AetherGenQuicksoil(); - public AetherGenFloatingIsland crystal_island = new AetherGenFloatingIsland(); + public AetherGenFloatingIsland crystal_island = new AetherGenFloatingIsland(); public AetherGenLiquids liquid_overhang = new AetherGenLiquids(); @@ -51,62 +50,53 @@ public class AetherBiomeDecorator extends BiomeDecorator public AetherGenClouds clouds = new AetherGenClouds(); - private final WorldGenDoublePlant double_grass = new WorldGenDoublePlant(); + private final WorldGenDoublePlant double_grass = new WorldGenDoublePlant(); - public AetherBiomeDecorator() - { + public AetherBiomeDecorator() { super(); } @Override - public void decorateChunk(World worldIn, Random random, BiomeGenBase biome, int x, int z) - { - if (this.world != null) - { - throw new RuntimeException("Already decorating"); - } - else - { - this.world = worldIn; - this.rand = random; - this.chunk_X = x; - this.chunk_Z = z; - this.aetherBiome = biome; - this.genDecorations(biome); - this.world = null; - this.rand = null; - } - } + public void decorateChunk(World worldIn, Random random, BiomeGenBase biome, int x, int z) { + if (this.world != null) { + throw new RuntimeException("Already decorating"); + } else { + this.world = worldIn; + this.rand = random; + this.chunk_X = x; + this.chunk_Z = z; + this.aetherBiome = biome; + this.genDecorations(biome); + this.world = null; + this.rand = null; + } + } @Override - protected void genDecorations(BiomeGenBase biome) - { - this.generateClouds(2, 4, 50, this.nextInt(64) + 96); - this.generateClouds(1, 8, 26, this.nextInt(64) + 32); - this.generateClouds(0, 16, 14, this.nextInt(64) + 64); + protected void genDecorations(BiomeGenBase biome) { + this.generateClouds(2, 4, 50, this.nextInt(64) + 96); + this.generateClouds(1, 8, 26, this.nextInt(64) + 32); + this.generateClouds(0, 16, 14, this.nextInt(64) + 64); - if (this.shouldSpawn(37)) - { - this.crystal_island.generate(this.world, this.rand, this.chunk_X + 8, this.nextInt(64) + 32, this.chunk_Z + 8); - } + if (this.shouldSpawn(37)) { + this.crystal_island.generate(this.world, this.rand, this.chunk_X + 8, this.nextInt(64) + 32, this.chunk_Z + 8); + } - if (this.shouldSpawn(3)) - { - this.spawnOre(BlocksAether.aether_dirt, 32, 20, 128); - } + if (this.shouldSpawn(3)) { + this.spawnOre(BlocksAether.aether_dirt, 32, 20, 128); + } - this.generateFoilage(BlocksAether.white_flower); - this.generateFoilage(BlocksAether.purple_flower); + this.generateFoilage(BlocksAether.white_flower); + this.generateFoilage(BlocksAether.purple_flower); - this.spawnOre(BlocksAether.icestone, 16, 10, 128); - this.spawnOre(BlocksAether.ambrosium_ore, 16, 15, 128); - this.spawnOre(BlocksAether.zanite_ore, 8, 15, 64); - this.spawnOre(BlocksAether.gravitite_ore, 6, 8, 32); + this.spawnOre(BlocksAether.icestone, 16, 10, 128); + this.spawnOre(BlocksAether.ambrosium_ore, 16, 15, 128); + this.spawnOre(BlocksAether.zanite_ore, 8, 15, 64); + this.spawnOre(BlocksAether.gravitite_ore, 6, 8, 32); - this.generateFoilage(BlocksAether.berry_bush); + this.generateFoilage(BlocksAether.berry_bush); - for (int i3 = 0; i3 < 3; ++i3) - { + for (int i3 = 0; i3 < 3; ++i3) { int x = this.chunk_X + this.nextInt(16) + 8; int z = this.chunk_Z + this.nextInt(16) + 8; int y = this.world.getHeightValue(x, z); @@ -114,10 +104,8 @@ public class AetherBiomeDecorator extends BiomeDecorator this.getTree().generate(this.world, this.rand, x, y, z); } - if (AetherConfig.shouldLoadHolidayContent()) - { - if (this.shouldSpawn(15)) - { + if (AetherConfig.shouldLoadHolidayContent()) { + if (this.shouldSpawn(15)) { int x = this.chunk_X + 8; int z = this.chunk_Z + 8; int y = this.world.getHeightValue(x, z); @@ -125,68 +113,56 @@ public class AetherBiomeDecorator extends BiomeDecorator } } - if (AetherConfig.tallgrassEnabled()) - { - for (int i3 = 0; i3 < 10; ++i3) - { - int j7 = this.chunk_X + this.rand.nextInt(16) + 8; - int i11 = this.chunk_Z + this.rand.nextInt(16) + 8; - int k14 = this.world.getHeight() * 2; + if (AetherConfig.tallgrassEnabled()) { + for (int i3 = 0; i3 < 10; ++i3) { + int j7 = this.chunk_X + this.rand.nextInt(16) + 8; + int i11 = this.chunk_Z + this.rand.nextInt(16) + 8; + int k14 = this.world.getHeight() * 2; - if (k14 > 0) - { - int l17 = this.rand.nextInt(k14); - this.aetherBiome.getRandomWorldGenForGrass(this.rand).generate(this.world, this.rand, j7, l17, i11); - } - } + if (k14 > 0) { + int l17 = this.rand.nextInt(k14); + this.aetherBiome.getRandomWorldGenForGrass(this.rand).generate(this.world, this.rand, j7, l17, i11); + } + } - if(net.minecraftforge.event.terraingen.TerrainGen.decorate(this.world, this.rand, this.chunk_X, this.chunk_Z, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) - for (int i = 0; i < 7; ++i) - { - int j = this.chunk_X + this.rand.nextInt(16) + 8; - int k = this.chunk_Z + this.rand.nextInt(16) + 8; - int l = this.rand.nextInt(this.world.getHeight() + 32); + if (net.minecraftforge.event.terraingen.TerrainGen.decorate(this.world, this.rand, this.chunk_X, this.chunk_Z, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) + for (int i = 0; i < 7; ++i) { + int j = this.chunk_X + this.rand.nextInt(16) + 8; + int k = this.chunk_Z + this.rand.nextInt(16) + 8; + int l = this.rand.nextInt(this.world.getHeight() + 32); - this.double_grass.func_150548_a(2); - this.double_grass.generate(this.world, rand, j, l, k); - } + this.double_grass.func_150548_a(2); + this.double_grass.generate(this.world, rand, j, l, k); + } } - if (this.shouldSpawn(10)) - { - (new WorldGenLakes(Blocks.water)).generate(this.world, this.rand, this.chunk_X + this.rand.nextInt(16) + 8, this.rand.nextInt(256), this.chunk_Z + this.rand.nextInt(16) + 8); + if (this.shouldSpawn(10)) { + (new WorldGenLakes(Blocks.water)).generate(this.world, this.rand, this.chunk_X + this.rand.nextInt(16) + 8, this.rand.nextInt(256), this.chunk_Z + this.rand.nextInt(16) + 8); } - } - - public int nextInt(int max) - { - return this.rand.nextInt(max); - } - - public boolean shouldSpawn(int chance) - { - return this.nextInt(chance) == 0; - } - - public WorldGenerator getTree() - { - return this.shouldSpawn(30) ? new AetherGenOakTree() : new AetherGenSkyrootTree(true); - } - - public void generateFoilage(Block block) - { - this.foilage.setPlantBlock(block); - - for(int n = 0; n < 2; n++) - { - this.foilage.generate(this.world, this.rand, this.chunk_X + this.nextInt(16) + 8, this.nextInt(128), this.chunk_Z + this.nextInt(16) + 8); - } } - public void generateClouds(int meta, int amount, int chance, int y) - { - if (this.shouldSpawn(chance)) - { + public int nextInt(int max) { + return this.rand.nextInt(max); + } + + public boolean shouldSpawn(int chance) { + return this.nextInt(chance) == 0; + } + + public WorldGenerator getTree() { + return this.shouldSpawn(30) ? new AetherGenOakTree() : new AetherGenSkyrootTree(true); + } + + public void generateFoilage(Block block) { + this.foilage.setPlantBlock(block); + + for (int n = 0; n < 2; n++) { + this.foilage.generate(this.world, this.rand, this.chunk_X + this.nextInt(16) + 8, this.nextInt(128), this.chunk_Z + this.nextInt(16) + 8); + } + } + + public void generateClouds(int meta, int amount, int chance, int y) { + if (this.shouldSpawn(chance)) { this.clouds.setCloudMeta(meta); this.clouds.setCloudAmount(amount); @@ -194,15 +170,13 @@ public class AetherBiomeDecorator extends BiomeDecorator } } - public void spawnOre(Block state, int size, int chance, int y) - { + public void spawnOre(Block state, int size, int chance, int y) { this.ores.setSize(size); this.ores.setBlock(state); - for (int chances = 0; chances < chance; chances++) - { - this.ores.generate(this.world, this.rand, this.chunk_X + this.nextInt(16), this.nextInt(y), this.chunk_Z + this.nextInt(16)); - } - } + for (int chances = 0; chances < chance; chances++) { + this.ores.generate(this.world, this.rand, this.chunk_X + this.nextInt(16), this.nextInt(y), this.chunk_Z + this.nextInt(16)); + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenCave.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenCave.java index b4252b4..418eee4 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenCave.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenCave.java @@ -9,76 +9,66 @@ import net.minecraft.world.gen.feature.WorldGenerator; import com.legacy.aether.blocks.BlocksAether; -public class AetherGenCave extends WorldGenerator -{ +public class AetherGenCave extends WorldGenerator { - private Block hollowBlock; + private Block hollowBlock; - private int size; + private int size; - public AetherGenCave(Block block, int size) - { - super(); + public AetherGenCave(Block block, int size) { + super(); - this.hollowBlock = block; - this.size = size; - } + this.hollowBlock = block; + this.size = size; + } - public boolean generate(World world, Random random, int x, int y, int z) - { - float f = random.nextFloat() * 3.141593F; - double d = (float)(x + 8) + (MathHelper.sin(f) * (float)this.size) / 8F; - double d1 = (float)(x + 8) - (MathHelper.sin(f) * (float)this.size) / 8F; - double d2 = (float)(z + 8) + (MathHelper.cos(f) * (float)this.size) / 8F; - double d3 = (float)(z + 8) - (MathHelper.cos(f) * (float)this.size) / 8F; - double d4 = y + random.nextInt(3) + 2; - double d5 = y + random.nextInt(3) + 2; + public boolean generate(World world, Random random, int x, int y, int z) { + float f = random.nextFloat() * 3.141593F; + double d = (float) (x + 8) + (MathHelper.sin(f) * (float) this.size) / 8F; + double d1 = (float) (x + 8) - (MathHelper.sin(f) * (float) this.size) / 8F; + double d2 = (float) (z + 8) + (MathHelper.cos(f) * (float) this.size) / 8F; + double d3 = (float) (z + 8) - (MathHelper.cos(f) * (float) this.size) / 8F; + double d4 = y + random.nextInt(3) + 2; + double d5 = y + random.nextInt(3) + 2; - for(int l = 0; l <= this.size; l++) - { - double d6 = d + ((d1 - d) * (double)l) / (double)this.size; - double d7 = d4 + ((d5 - d4) * (double)l) / (double)this.size; - double d8 = d2 + ((d3 - d2) * (double)l) / (double)this.size; - double d9 = (random.nextDouble() * (double)this.size) / 16D; - double d10 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)this.size) + 1.0F) * d9 + 1.0D; - double d11 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)this.size) + 1.0F) * d9 + 1.0D; - int i1 = (int)(d6 - d10 / 2D); - int j1 = (int)(d7 - d11 / 2D); - int k1 = (int)(d8 - d10 / 2D); - int l1 = (int)(d6 + d10 / 2D); - int i2 = (int)(d7 + d11 / 2D); - int j2 = (int)(d8 + d10 / 2D); + for (int l = 0; l <= this.size; l++) { + double d6 = d + ((d1 - d) * (double) l) / (double) this.size; + double d7 = d4 + ((d5 - d4) * (double) l) / (double) this.size; + double d8 = d2 + ((d3 - d2) * (double) l) / (double) this.size; + double d9 = (random.nextDouble() * (double) this.size) / 16D; + double d10 = (double) (MathHelper.sin(((float) l * 3.141593F) / (float) this.size) + 1.0F) * d9 + 1.0D; + double d11 = (double) (MathHelper.sin(((float) l * 3.141593F) / (float) this.size) + 1.0F) * d9 + 1.0D; + int i1 = (int) (d6 - d10 / 2D); + int j1 = (int) (d7 - d11 / 2D); + int k1 = (int) (d8 - d10 / 2D); + int l1 = (int) (d6 + d10 / 2D); + int i2 = (int) (d7 + d11 / 2D); + int j2 = (int) (d8 + d10 / 2D); - for(int k2 = i1; k2 <= l1; k2++) - { - double d12 = (((double)k2 + 0.5D) - d6) / (d10 / 2D); - if(d12 * d12 < 1.0D) - { - for(int l2 = j1; l2 <= i2; l2++) - { - double d13 = (((double)l2 + 0.5D) - d7) / (d11 / 2D); - if(d12 * d12 + d13 * d13 < 1.0D) - { - for(int i3 = k1; i3 <= j2; i3++) - { - double d14 = (((double)i3 + 0.5D) - d8) / (d10 / 2D); - Block block = world.getBlock(k2, l2, i3); + for (int k2 = i1; k2 <= l1; k2++) { + double d12 = (((double) k2 + 0.5D) - d6) / (d10 / 2D); + if (d12 * d12 < 1.0D) { + for (int l2 = j1; l2 <= i2; l2++) { + double d13 = (((double) l2 + 0.5D) - d7) / (d11 / 2D); + if (d12 * d12 + d13 * d13 < 1.0D) { + for (int i3 = k1; i3 <= j2; i3++) { + double d14 = (((double) i3 + 0.5D) - d8) / (d10 / 2D); + Block block = world.getBlock(k2, l2, i3); - if(d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block == BlocksAether.mossy_holystone || block == BlocksAether.holystone || block == BlocksAether.aether_grass || block == BlocksAether.aether_dirt)) - { - this.setBlockAndNotifyAdequately(world, k2, l2, i3, this.hollowBlock, 0); - } - } + if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block == BlocksAether.mossy_holystone || block == BlocksAether.holystone || block == BlocksAether.aether_grass || block == BlocksAether.aether_dirt)) { + this.setBlockAndNotifyAdequately(world, k2, l2, i3, this.hollowBlock, 0); + } + } - } - } + } + } - } - } + } + } - } + } - return true; - } + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenClouds.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenClouds.java index d2e3fbe..2fb5a94 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenClouds.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenClouds.java @@ -7,35 +7,29 @@ import com.legacy.aether.blocks.BlocksAether; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public class AetherGenClouds extends WorldGenerator -{ +public class AetherGenClouds extends WorldGenerator { private int cloudAmount; private int cloudMeta; - public AetherGenClouds() - { - + public AetherGenClouds() { + } - public void setCloudAmount(int amount) - { + public void setCloudAmount(int amount) { this.cloudAmount = amount; } - public void setCloudMeta(int meta) - { + public void setCloudMeta(int meta) { this.cloudMeta = meta; } @Override - public boolean generate(World worldIn, Random randIn, int xIn, int yIn, int zIn) - { + public boolean generate(World worldIn, Random randIn, int xIn, int yIn, int zIn) { yIn += randIn.nextInt(64); - for (int amount = 0; amount < this.cloudAmount; ++amount) - { + for (int amount = 0; amount < this.cloudAmount; ++amount) { boolean offsetY = randIn.nextBoolean(); int xOffset = randIn.nextInt(2); @@ -46,16 +40,11 @@ public class AetherGenClouds extends WorldGenerator yIn += yOffset; zIn += zOffset; - for (int x = xIn; x < xIn + randIn.nextInt(2) + 3; ++x) - { - for (int y = yIn; y < yIn + randIn.nextInt(1) + 2; ++y) - { - for (int z = zIn; z < zIn + randIn.nextInt(2) + 3; ++z) - { - if (worldIn.isAirBlock(x, y, z)) - { - if (Math.abs(x - xIn) + Math.abs(y - yIn) + Math.abs(z - zIn) < 4 + randIn.nextInt(2)) - { + for (int x = xIn; x < xIn + randIn.nextInt(2) + 3; ++x) { + for (int y = yIn; y < yIn + randIn.nextInt(1) + 2; ++y) { + for (int z = zIn; z < zIn + randIn.nextInt(2) + 3; ++z) { + if (worldIn.isAirBlock(x, y, z)) { + if (Math.abs(x - xIn) + Math.abs(y - yIn) + Math.abs(z - zIn) < 4 + randIn.nextInt(2)) { this.setBlockAndNotifyAdequately(worldIn, x, y, z, BlocksAether.aercloud, this.cloudMeta); } } diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenFloatingIsland.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenFloatingIsland.java index bf355c4..3296c3b 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenFloatingIsland.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenFloatingIsland.java @@ -9,60 +9,45 @@ import net.minecraft.world.gen.feature.WorldGenerator; import com.legacy.aether.blocks.BlocksAether; -public class AetherGenFloatingIsland extends WorldGenerator -{ +public class AetherGenFloatingIsland extends WorldGenerator { - public AetherGenFloatingIsland() - { + public AetherGenFloatingIsland() { - } + } - public boolean generate(World world, Random random, int j, int k, int l) - { + public boolean generate(World world, Random random, int j, int k, int l) { boolean cangen = true; - for(int x1 = j - 6; x1 < j + 12; x1++) - { - for(int y1 = k - 6; y1 < k + 17; y1++) - { - for(int z1 = l - 6 ; z1 < l + 12; z1++) - { - if(world.getBlock(x1, y1, z1) != Blocks.air) - { + for (int x1 = j - 6; x1 < j + 12; x1++) { + for (int y1 = k - 6; y1 < k + 17; y1++) { + for (int z1 = l - 6; z1 < l + 12; z1++) { + if (world.getBlock(x1, y1, z1) != Blocks.air) { cangen = false; - } + } } } } - if(k + 11 <= world.getHeight() && cangen) - { - for (int z = 1; z < 2; ++z) - { + if (k + 11 <= world.getHeight() && cangen) { + for (int z = 1; z < 2; ++z) { world.setBlock(j, k, l + z, BlocksAether.holystone); } - for (int x = -1; x < 2; ++x) - { + for (int x = -1; x < 2; ++x) { world.setBlock(x + j, k, l, BlocksAether.holystone); } - for (int z = -2; z < 3; ++z) - { + for (int z = -2; z < 3; ++z) { world.setBlock(j, k + 1, l + z, BlocksAether.holystone); } - for (int x = -2; x < 3; ++x) - { + for (int x = -2; x < 3; ++x) { world.setBlock(j + x, k + 1, l, BlocksAether.holystone); } - for (int x = -1; x < 2; ++x) - { - for (int z = 1; z > -2; --z) - { - if (x != 0 || z != 0) - { + for (int x = -1; x < 2; ++x) { + for (int z = 1; z > -2; --z) { + if (x != 0 || z != 0) { world.setBlock(j + x, k + 1, l + z, BlocksAether.holystone); } } @@ -71,22 +56,17 @@ public class AetherGenFloatingIsland extends WorldGenerator world.setBlock(j + 1, k + 1, l + 1, BlocksAether.holystone); world.setBlock(j - 1, k + 1, l - 1, BlocksAether.holystone); - for (int z = -2; z < 3; ++z) - { + for (int z = -2; z < 3; ++z) { world.setBlock(j, k + 2, l + z, BlocksAether.aether_grass); } - for (int x = -2; x < 3; ++x) - { + for (int x = -2; x < 3; ++x) { world.setBlock(x + j, k + 2, l, BlocksAether.aether_grass); } - for (int x = -1; x < 2; ++x) - { - for (int z = 1; z > -2; --z) - { - if (x != 0 || z != 0) - { + for (int x = -1; x < 2; ++x) { + for (int z = 1; z > -2; --z) { + if (x != 0 || z != 0) { world.setBlock(j + x, k + 2, l + z, BlocksAether.aether_grass); } } @@ -95,67 +75,55 @@ public class AetherGenFloatingIsland extends WorldGenerator world.setBlock(j + 1, k + 2, l + 1, BlocksAether.aether_grass); world.setBlock(j - 1, k + 2, l - 1, BlocksAether.aether_grass); - for(int y = k + 3; y <= k + 9; y++) - { + for (int y = k + 3; y <= k + 9; y++) { world.setBlock(j, y, l, BlocksAether.skyroot_log); } world.setBlock(j, k + 10, l, setRandomBlock(world, random)); - for (int z = -1; z < 2; ++z) - { + for (int z = -1; z < 2; ++z) { if (z != 0) - world.setBlock(j, k + 5, l + z, BlocksAether.skyroot_log); + world.setBlock(j, k + 5, l + z, BlocksAether.skyroot_log); } - for (int x = -1; x < 2; ++x) - { + for (int x = -1; x < 2; ++x) { if (x != 0) - world.setBlock(j + x, k + 5, l, BlocksAether.skyroot_log); + world.setBlock(j + x, k + 5, l, BlocksAether.skyroot_log); } - for (int z = -2; z < 3; ++z) - { + for (int z = -2; z < 3; ++z) { if (z != 0 || z != 1) - world.setBlock(j, k + 5, l + z, setRandomBlock(world, random)); + world.setBlock(j, k + 5, l + z, setRandomBlock(world, random)); } - for (int x = -2; x < 3; ++x) - { + for (int x = -2; x < 3; ++x) { if (x != 0 || x != 1) - world.setBlock(j + x, k + 5, l, setRandomBlock(world, random)); + world.setBlock(j + x, k + 5, l, setRandomBlock(world, random)); } - for (int x = -1; x < 2; ++x) - { + for (int x = -1; x < 2; ++x) { if (x != 0) - world.setBlock(j + x, k + 5, l - 2, setRandomBlock(world, random)); + world.setBlock(j + x, k + 5, l - 2, setRandomBlock(world, random)); } - for (int x = -1; x < 2; ++x) - { + for (int x = -1; x < 2; ++x) { if (x != 0) - world.setBlock(j + x, k + 5, l + 2, setRandomBlock(world, random)); + world.setBlock(j + x, k + 5, l + 2, setRandomBlock(world, random)); } - for (int z = -1; z < 2; ++z) - { + for (int z = -1; z < 2; ++z) { if (z != 0) - world.setBlock(j - 2, k + 5, l + z, setRandomBlock(world, random)); + world.setBlock(j - 2, k + 5, l + z, setRandomBlock(world, random)); } - for (int z = -1; z < 2; ++z) - { + for (int z = -1; z < 2; ++z) { if (z != 0) - world.setBlock(j + 2, k + 5, l + z, setRandomBlock(world, random)); + world.setBlock(j + 2, k + 5, l + z, setRandomBlock(world, random)); } - for (int x = -1; x < 2; ++x) - { - for (int z = 1; z > -2; --z) - { - if (x != 0 || z != 0) - { + for (int x = -1; x < 2; ++x) { + for (int z = 1; z > -2; --z) { + if (x != 0 || z != 0) { world.setBlock(j + x, k + 5, l + z, setRandomBlock(world, random)); } } @@ -164,24 +132,19 @@ public class AetherGenFloatingIsland extends WorldGenerator world.setBlock(j + 1, k + 5, l + 1, setRandomBlock(world, random)); world.setBlock(j - 1, k + 5, l - 1, setRandomBlock(world, random)); - for (int z = -2; z < 3; ++z) - { + for (int z = -2; z < 3; ++z) { if (z != 0 || z != 1) - world.setBlock(j, k + 6, l + z, setRandomBlock(world, random)); + world.setBlock(j, k + 6, l + z, setRandomBlock(world, random)); } - for (int x = -2; x < 3; ++x) - { + for (int x = -2; x < 3; ++x) { if (x != 0 || x != 1) - world.setBlock(j + x, k + 6, l, setRandomBlock(world, random)); + world.setBlock(j + x, k + 6, l, setRandomBlock(world, random)); } - for (int x = -1; x < 2; ++x) - { - for (int z = 1; z > -2; --z) - { - if (x != 0 || z != 0) - { + for (int x = -1; x < 2; ++x) { + for (int z = 1; z > -2; --z) { + if (x != 0 || z != 0) { world.setBlock(j + x, k + 6, l + z, setRandomBlock(world, random)); } } @@ -190,60 +153,49 @@ public class AetherGenFloatingIsland extends WorldGenerator world.setBlock(j + 1, k + 6, l + 1, setRandomBlock(world, random)); world.setBlock(j - 1, k + 6, l - 1, setRandomBlock(world, random)); - for (int z = -1; z < 2; ++z) - { + for (int z = -1; z < 2; ++z) { if (z != 0) - world.setBlock(j, k + 6, l + z, setRandomBlock(world, random)); + world.setBlock(j, k + 6, l + z, setRandomBlock(world, random)); } - for (int x = -1; x < 2; ++x) - { + for (int x = -1; x < 2; ++x) { if (x != 0) - world.setBlock(j + x, k + 6, l, setRandomBlock(world, random)); + world.setBlock(j + x, k + 6, l, setRandomBlock(world, random)); } - for (int z = -1; z < 2; ++z) - { + for (int z = -1; z < 2; ++z) { if (z != 0) - world.setBlock(j, k + 7, l + z, setRandomBlock(world, random)); + world.setBlock(j, k + 7, l + z, setRandomBlock(world, random)); } - for (int x = -1; x < 2; ++x) - { + for (int x = -1; x < 2; ++x) { if (x != 0) - world.setBlock(j + x, k + 7, l, setRandomBlock(world, random)); + world.setBlock(j + x, k + 7, l, setRandomBlock(world, random)); } - for (int z = -1; z < 2; ++z) - { + for (int z = -1; z < 2; ++z) { if (z != 0) - world.setBlock(j, k + 8, l + z, BlocksAether.skyroot_log); + world.setBlock(j, k + 8, l + z, BlocksAether.skyroot_log); } - for (int x = -1; x < 2; ++x) - { + for (int x = -1; x < 2; ++x) { if (x != 0) - world.setBlock(j + x, k + 8, l, BlocksAether.skyroot_log); + world.setBlock(j + x, k + 8, l, BlocksAether.skyroot_log); } - for (int z = -2; z < 3; ++z) - { + for (int z = -2; z < 3; ++z) { if (z != 0 || z != 1) - world.setBlock(j, k + 8, l + z, setRandomBlock(world, random)); + world.setBlock(j, k + 8, l + z, setRandomBlock(world, random)); } - for (int x = -2; x < 3; ++x) - { + for (int x = -2; x < 3; ++x) { if (x != 0 || x != 1) - world.setBlock(j + x, k + 8, l, setRandomBlock(world, random)); + world.setBlock(j + x, k + 8, l, setRandomBlock(world, random)); } - for (int x = -1; x < 2; ++x) - { - for (int z = 1; z > -2; --z) - { - if (x != 0 || z != 0) - { + for (int x = -1; x < 2; ++x) { + for (int z = 1; z > -2; --z) { + if (x != 0 || z != 0) { world.setBlock(j + x, k + 8, l + z, setRandomBlock(world, random)); } } @@ -252,30 +204,26 @@ public class AetherGenFloatingIsland extends WorldGenerator world.setBlock(j + 1, k + 8, l + 1, setRandomBlock(world, random)); world.setBlock(j - 1, k + 8, l - 1, setRandomBlock(world, random)); - for (int z = -1; z < 2; ++z) - { + for (int z = -1; z < 2; ++z) { if (z != 0) - world.setBlock(j, k + 9, l + z, setRandomBlock(world, random)); + world.setBlock(j, k + 9, l + z, setRandomBlock(world, random)); } - for (int x = -1; x < 2; ++x) - { + for (int x = -1; x < 2; ++x) { if (x != 0) - world.setBlock(j + x, k + 9, l, setRandomBlock(world, random)); + world.setBlock(j + x, k + 9, l, setRandomBlock(world, random)); } return true; - } - + } + return false; } - protected Block setRandomBlock(World world, Random random) - { + protected Block setRandomBlock(World world, Random random) { int nextInt = random.nextInt(3); - if (nextInt == 0) - { + if (nextInt == 0) { return BlocksAether.crystal_fruit_leaves; } diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenFoilage.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenFoilage.java index 7f4d41f..89da80b 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenFoilage.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenFoilage.java @@ -8,35 +8,29 @@ import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public class AetherGenFoilage extends WorldGenerator -{ +public class AetherGenFoilage extends WorldGenerator { - private Block plantState; + private Block plantState; - public AetherGenFoilage() - { - super(); - } + public AetherGenFoilage() { + super(); + } - public void setPlantBlock(Block state) - { - this.plantState = state; - } + public void setPlantBlock(Block state) { + this.plantState = state; + } @Override - public boolean generate(World world, Random random, int x, int y, int z) - { - for(int l = 0; l < 64; l++) - { - int i1 = (x + random.nextInt(8)) - random.nextInt(8); - int j1 = (y + random.nextInt(4)) - random.nextInt(4); - int k1 = (z + random.nextInt(8)) - random.nextInt(8); + public boolean generate(World world, Random random, int x, int y, int z) { + for (int l = 0; l < 64; l++) { + int i1 = (x + random.nextInt(8)) - random.nextInt(8); + int j1 = (y + random.nextInt(4)) - random.nextInt(4); + int k1 = (z + random.nextInt(8)) - random.nextInt(8); - if(world.isAirBlock(i1, j1, k1) && ((BlockAetherFlower)this.plantState).canBlockStay(world, i1, j1, k1)) - { - this.setBlockAndNotifyAdequately(world, i1, j1, k1, this.plantState, 0); - } - } + if (world.isAirBlock(i1, j1, k1) && ((BlockAetherFlower) this.plantState).canBlockStay(world, i1, j1, k1)) { + this.setBlockAndNotifyAdequately(world, i1, j1, k1, this.plantState, 0); + } + } return true; } diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenHolidayTree.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenHolidayTree.java index 67c9bb6..5b88273 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenHolidayTree.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenHolidayTree.java @@ -9,46 +9,33 @@ import net.minecraft.world.gen.feature.WorldGenerator; import com.legacy.aether.blocks.BlocksAether; -public class AetherGenHolidayTree extends WorldGenerator -{ +public class AetherGenHolidayTree extends WorldGenerator { - public AetherGenHolidayTree() - { + public AetherGenHolidayTree() { super(true); } @Override /* STILL No time and effort was made into fixing this ~Kino 11-12-18*/ - public boolean generate(World world, Random rand, int x, int y, int z) - { + public boolean generate(World world, Random rand, int x, int y, int z) { Block block = world.getBlock(x, y - 1, z); - if (block == BlocksAether.aether_grass) - { - for(int xss = x - 7; xss < x + 7; xss++) - { - for(int yss = z - 7; yss < z + 7; yss++) - { - if (((xss - x) * (xss - x) + (yss - z) * (yss - z)) < 29) - { + if (block == BlocksAether.aether_grass) { + for (int xss = x - 7; xss < x + 7; xss++) { + for (int yss = z - 7; yss < z + 7; yss++) { + if (((xss - x) * (xss - x) + (yss - z) * (yss - z)) < 29) { int x1 = xss; int z1 = yss; int y1 = world.getHeightValue(x1, z1); Block block1 = world.getBlock(x1, y1 - 1, z1); - if(block1 != Blocks.air) - { - if(rand.nextInt(80) == 0 && (block1 == BlocksAether.aether_grass)) - { + if (block1 != Blocks.air) { + if (rand.nextInt(80) == 0 && (block1 == BlocksAether.aether_grass)) { world.setBlock(x1, y1, z1, BlocksAether.present); - } - else if (block1 == Blocks.water) - { + } else if (block1 == Blocks.water) { world.setBlock(x1, y1 - 1, z1, Blocks.ice); world.setBlock(x1, y1, z1, Blocks.snow_layer); - } - else if (world.getBlock(x1, y1, z1) != Blocks.snow_layer || world.getBlock(x1, y1, z1) != BlocksAether.present) - { + } else if (world.getBlock(x1, y1, z1) != Blocks.snow_layer || world.getBlock(x1, y1, z1) != BlocksAether.present) { world.setBlock(x1, y1, z1, Blocks.snow_layer); } } @@ -56,8 +43,7 @@ public class AetherGenHolidayTree extends WorldGenerator } } - for(int y1 = 0; y1 <= 8; y1++) - { + for (int y1 = 0; y1 <= 8; y1++) { world.setBlock(x, y + y1, z, BlocksAether.skyroot_log); } @@ -310,31 +296,22 @@ public class AetherGenHolidayTree extends WorldGenerator world.setBlock(x, y - 1, z, BlocksAether.aether_dirt); - for(int xss = x - 7; xss < x + 7; xss++) - { - for(int yss = z - 7; yss < z + 7; yss++) - { - if (((xss - x) * (xss - x) + (yss - z) * (yss - z)) < 29) - { + for (int xss = x - 7; xss < x + 7; xss++) { + for (int yss = z - 7; yss < z + 7; yss++) { + if (((xss - x) * (xss - x) + (yss - z) * (yss - z)) < 29) { int x1 = xss; int z1 = yss; int y1 = world.getHeightValue(x1, z1); Block block1 = world.getBlock(x1, y1 - 1, z1); - if(block1 != Blocks.air) - { - if(rand.nextInt(40) == 0 && (block1 == BlocksAether.aether_grass)) - { + if (block1 != Blocks.air) { + if (rand.nextInt(40) == 0 && (block1 == BlocksAether.aether_grass)) { world.setBlock(x1, y1, z1, BlocksAether.present); - } - else if (block1 == Blocks.water) - { + } else if (block1 == Blocks.water) { world.setBlock(x1, y1 - 1, z1, Blocks.ice); world.setBlock(x1, y1, z1, Blocks.snow_layer); - } - else if (world.getBlock(x1, y1, z1) != Blocks.snow_layer || world.getBlock(x1, y1, z1) != BlocksAether.present) - { + } else if (world.getBlock(x1, y1, z1) != Blocks.snow_layer || world.getBlock(x1, y1, z1) != BlocksAether.present) { world.setBlock(x1, y1, z1, Blocks.snow_layer); } } @@ -346,8 +323,7 @@ public class AetherGenHolidayTree extends WorldGenerator return false; } - public Block getBlock(Random rand) - { + public Block getBlock(Random rand) { return rand.nextInt(4) == 0 ? BlocksAether.decorated_holiday_leaves : BlocksAether.holiday_leaves; } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenLakes.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenLakes.java index b1b1271..64b002a 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenLakes.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenLakes.java @@ -10,137 +10,108 @@ import net.minecraft.world.gen.feature.WorldGenerator; import com.legacy.aether.blocks.BlocksAether; -public class AetherGenLakes extends WorldGenerator -{ +public class AetherGenLakes extends WorldGenerator { - public AetherGenLakes() - { + public AetherGenLakes() { - } + } - @Override - public boolean generate(World world, Random random, int x, int y, int z) - { - x -= 8; + @Override + public boolean generate(World world, Random random, int x, int y, int z) { + x -= 8; - for (z -= 8; y > 5 && world.isAirBlock(x, y, z); --y) - { - ; - } + for (z -= 8; y > 5 && world.isAirBlock(x, y, z); --y) { + ; + } - if (y <= 4) - { - return false; - } - else - { - y -= 4; - boolean[] aboolean = new boolean[2048]; - int l = random.nextInt(4) + 4; - int i1; + if (y <= 4) { + return false; + } else { + y -= 4; + boolean[] aboolean = new boolean[2048]; + int l = random.nextInt(4) + 4; + int i1; - for (i1 = 0; i1 < l; ++i1) - { - double d0 = random.nextDouble() * 6.0D + 3.0D; - double d1 = random.nextDouble() * 4.0D + 2.0D; - double d2 = random.nextDouble() * 6.0D + 3.0D; - double d3 = random.nextDouble() * (16.0D - d0 - 2.0D) + 1.0D + d0 / 2.0D; - double d4 = random.nextDouble() * (8.0D - d1 - 4.0D) + 2.0D + d1 / 2.0D; - double d5 = random.nextDouble() * (16.0D - d2 - 2.0D) + 1.0D + d2 / 2.0D; + for (i1 = 0; i1 < l; ++i1) { + double d0 = random.nextDouble() * 6.0D + 3.0D; + double d1 = random.nextDouble() * 4.0D + 2.0D; + double d2 = random.nextDouble() * 6.0D + 3.0D; + double d3 = random.nextDouble() * (16.0D - d0 - 2.0D) + 1.0D + d0 / 2.0D; + double d4 = random.nextDouble() * (8.0D - d1 - 4.0D) + 2.0D + d1 / 2.0D; + double d5 = random.nextDouble() * (16.0D - d2 - 2.0D) + 1.0D + d2 / 2.0D; - for (int k1 = 1; k1 < 15; ++k1) - { - for (int l1 = 1; l1 < 15; ++l1) - { - for (int i2 = 1; i2 < 7; ++i2) - { - double d6 = ((double)k1 - d3) / (d0 / 2.0D); - double d7 = ((double)i2 - d4) / (d1 / 2.0D); - double d8 = ((double)l1 - d5) / (d2 / 2.0D); - double d9 = d6 * d6 + d7 * d7 + d8 * d8; + for (int k1 = 1; k1 < 15; ++k1) { + for (int l1 = 1; l1 < 15; ++l1) { + for (int i2 = 1; i2 < 7; ++i2) { + double d6 = ((double) k1 - d3) / (d0 / 2.0D); + double d7 = ((double) i2 - d4) / (d1 / 2.0D); + double d8 = ((double) l1 - d5) / (d2 / 2.0D); + double d9 = d6 * d6 + d7 * d7 + d8 * d8; - if (d9 < 1.0D) - { - aboolean[(k1 * 16 + l1) * 8 + i2] = true; - } - } - } - } - } + if (d9 < 1.0D) { + aboolean[(k1 * 16 + l1) * 8 + i2] = true; + } + } + } + } + } - int j1; - int j2; - boolean flag; + int j1; + int j2; + boolean flag; - for (i1 = 0; i1 < 16; ++i1) - { - for (j2 = 0; j2 < 16; ++j2) - { - for (j1 = 0; j1 < 8; ++j1) - { - flag = !aboolean[(i1 * 16 + j2) * 8 + j1] && (i1 < 15 && aboolean[((i1 + 1) * 16 + j2) * 8 + j1] || i1 > 0 && aboolean[((i1 - 1) * 16 + j2) * 8 + j1] || j2 < 15 && aboolean[(i1 * 16 + j2 + 1) * 8 + j1] || j2 > 0 && aboolean[(i1 * 16 + (j2 - 1)) * 8 + j1] || j1 < 7 && aboolean[(i1 * 16 + j2) * 8 + j1 + 1] || j1 > 0 && aboolean[(i1 * 16 + j2) * 8 + (j1 - 1)]); + for (i1 = 0; i1 < 16; ++i1) { + for (j2 = 0; j2 < 16; ++j2) { + for (j1 = 0; j1 < 8; ++j1) { + flag = !aboolean[(i1 * 16 + j2) * 8 + j1] && (i1 < 15 && aboolean[((i1 + 1) * 16 + j2) * 8 + j1] || i1 > 0 && aboolean[((i1 - 1) * 16 + j2) * 8 + j1] || j2 < 15 && aboolean[(i1 * 16 + j2 + 1) * 8 + j1] || j2 > 0 && aboolean[(i1 * 16 + (j2 - 1)) * 8 + j1] || j1 < 7 && aboolean[(i1 * 16 + j2) * 8 + j1 + 1] || j1 > 0 && aboolean[(i1 * 16 + j2) * 8 + (j1 - 1)]); - if (flag) - { - Material material = world.getBlock(x + i1, y + j1, z + j2).getMaterial(); + if (flag) { + Material material = world.getBlock(x + i1, y + j1, z + j2).getMaterial(); - if (j1 >= 4 && material.isLiquid()) - { - return false; - } + if (j1 >= 4 && material.isLiquid()) { + return false; + } - if (j1 < 4 && !material.isSolid() && world.getBlock(x + i1, y + j1, z + j2) != Blocks.water) - { - return false; - } - } - } - } - } + if (j1 < 4 && !material.isSolid() && world.getBlock(x + i1, y + j1, z + j2) != Blocks.water) { + return false; + } + } + } + } + } - for (i1 = 0; i1 < 16; ++i1) - { - for (j2 = 0; j2 < 16; ++j2) - { - for (j1 = 0; j1 < 8; ++j1) - { - if (aboolean[(i1 * 16 + j2) * 8 + j1]) - { - world.setBlock(x + i1, y + j1, z + j2, j1 >= 4 ? Blocks.air : Blocks.water, 0, 2); - } - } - } - } + for (i1 = 0; i1 < 16; ++i1) { + for (j2 = 0; j2 < 16; ++j2) { + for (j1 = 0; j1 < 8; ++j1) { + if (aboolean[(i1 * 16 + j2) * 8 + j1]) { + world.setBlock(x + i1, y + j1, z + j2, j1 >= 4 ? Blocks.air : Blocks.water, 0, 2); + } + } + } + } - for (i1 = 0; i1 < 16; ++i1) - { - for (j2 = 0; j2 < 16; ++j2) - { - for (j1 = 4; j1 < 8; ++j1) - { - if (aboolean[(i1 * 16 + j2) * 8 + j1] && world.getBlock(x + i1, y + j1 - 1, z + j2) == BlocksAether.aether_dirt && world.getSavedLightValue(EnumSkyBlock.Sky, x + i1, y + j1, z + j2) > 0) - { - world.setBlock(x + i1, y + j1 - 1, z + j2, BlocksAether.aether_grass, 0, 2); - } - } - } - } + for (i1 = 0; i1 < 16; ++i1) { + for (j2 = 0; j2 < 16; ++j2) { + for (j1 = 4; j1 < 8; ++j1) { + if (aboolean[(i1 * 16 + j2) * 8 + j1] && world.getBlock(x + i1, y + j1 - 1, z + j2) == BlocksAether.aether_dirt && world.getSavedLightValue(EnumSkyBlock.Sky, x + i1, y + j1, z + j2) > 0) { + world.setBlock(x + i1, y + j1 - 1, z + j2, BlocksAether.aether_grass, 0, 2); + } + } + } + } - for (i1 = 0; i1 < 16; ++i1) - { - for (j2 = 0; j2 < 16; ++j2) - { - byte b0 = 4; + for (i1 = 0; i1 < 16; ++i1) { + for (j2 = 0; j2 < 16; ++j2) { + byte b0 = 4; - if (world.isBlockFreezable(x + i1, y + b0, z + j2)) - { - world.setBlock(x + i1, y + b0, z + j2, Blocks.ice, 0, 2); - } - } - } + if (world.isBlockFreezable(x + i1, y + b0, z + j2)) { + world.setBlock(x + i1, y + b0, z + j2, Blocks.ice, 0, 2); + } + } + } - return true; - } - } + return true; + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenLiquids.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenLiquids.java index 793c28c..92528dd 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenLiquids.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenLiquids.java @@ -9,85 +9,66 @@ import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public class AetherGenLiquids extends WorldGenerator -{ +public class AetherGenLiquids extends WorldGenerator { - public AetherGenLiquids() - { - super(); - } + public AetherGenLiquids() { + super(); + } - @Override - public boolean generate(World world, Random random, int x, int y, int z) - { - if (world.getBlock(x, y + 1, z) != BlocksAether.holystone) - { - return false; - } - else if (world.getBlock(x, y - 1, z) != BlocksAether.holystone) - { - return false; - } - else if (world.getBlock(x, y, z).getMaterial() != Material.air && world.getBlock(x, y, z) != BlocksAether.holystone) - { - return false; - } - else - { - int l = 0; + @Override + public boolean generate(World world, Random random, int x, int y, int z) { + if (world.getBlock(x, y + 1, z) != BlocksAether.holystone) { + return false; + } else if (world.getBlock(x, y - 1, z) != BlocksAether.holystone) { + return false; + } else if (world.getBlock(x, y, z).getMaterial() != Material.air && world.getBlock(x, y, z) != BlocksAether.holystone) { + return false; + } else { + int l = 0; - if (world.getBlock(x - 1, y, z) == BlocksAether.holystone) - { - ++l; - } + if (world.getBlock(x - 1, y, z) == BlocksAether.holystone) { + ++l; + } - if (world.getBlock(x + 1, y, z) == BlocksAether.holystone) - { - ++l; - } + if (world.getBlock(x + 1, y, z) == BlocksAether.holystone) { + ++l; + } - if (world.getBlock(x, y, z - 1) == BlocksAether.holystone) - { - ++l; - } + if (world.getBlock(x, y, z - 1) == BlocksAether.holystone) { + ++l; + } - if (world.getBlock(x, y, z + 1) == BlocksAether.holystone) - { - ++l; - } + if (world.getBlock(x, y, z + 1) == BlocksAether.holystone) { + ++l; + } - int i1 = 0; + int i1 = 0; - if (world.isAirBlock(x - 1, y, z)) - { - ++i1; - } + if (world.isAirBlock(x - 1, y, z)) { + ++i1; + } - if (world.isAirBlock(x + 1, y, z)) - { - ++i1; - } + if (world.isAirBlock(x + 1, y, z)) { + ++i1; + } - if (world.isAirBlock(x, y, z - 1)) - { - ++i1; - } + if (world.isAirBlock(x, y, z - 1)) { + ++i1; + } - if (world.isAirBlock(x, y, z + 1)) - { - ++i1; - } + if (world.isAirBlock(x, y, z + 1)) { + ++i1; + } - if (l == 3 && i1 == 1) - { - world.setBlock(x, y, z, Blocks.water, 0, 2); - world.scheduledUpdatesAreImmediate = true; - Blocks.water.updateTick(world, x, y, z, random); - world.scheduledUpdatesAreImmediate = false; - } + if (l == 3 && i1 == 1) { + world.setBlock(x, y, z, Blocks.water, 0, 2); + world.scheduledUpdatesAreImmediate = true; + Blocks.water.updateTick(world, x, y, z, random); + world.scheduledUpdatesAreImmediate = false; + } - return true; - } - } + return true; + } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenMinable.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenMinable.java index d7af66f..2620abd 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenMinable.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenMinable.java @@ -9,81 +9,69 @@ import net.minecraft.world.gen.feature.WorldGenerator; import com.legacy.aether.blocks.BlocksAether; -public class AetherGenMinable extends WorldGenerator -{ +public class AetherGenMinable extends WorldGenerator { - private Block oreBlock; + private Block oreBlock; - private int numberOfBlocks; + private int numberOfBlocks; - public AetherGenMinable() - { - super(); - } + public AetherGenMinable() { + super(); + } - public void setSize(int size) - { - this.numberOfBlocks = size; - } + public void setSize(int size) { + this.numberOfBlocks = size; + } - public void setBlock(Block state) - { - this.oreBlock = state; - } + public void setBlock(Block state) { + this.oreBlock = state; + } - public boolean generate(World world, Random random, int x, int y, int z) - { - float f = random.nextFloat() * (float)Math.PI; - double d = (double)((float)(x + 8) + MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F); - double d1 = (double)((float)(x + 8) - MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F); - double d2 = (double)((float)(z + 8) + MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F); - double d3 = (double)((float)(z + 8) - MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F); - double d4 = (double)(y + random.nextInt(3) + 2); - double d5 = (double)(y + random.nextInt(3) + 2); + public boolean generate(World world, Random random, int x, int y, int z) { + float f = random.nextFloat() * (float) Math.PI; + double d = (double) ((float) (x + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F); + double d1 = (double) ((float) (x + 8) - MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F); + double d2 = (double) ((float) (z + 8) + MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F); + double d3 = (double) ((float) (z + 8) - MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F); + double d4 = (double) (y + random.nextInt(3) + 2); + double d5 = (double) (y + random.nextInt(3) + 2); - for (int l = 0; l <= this.numberOfBlocks; ++l) - { - double d6 = d + (d1 - d) * (double)l / (double)this.numberOfBlocks; - double d7 = d4 + (d5 - d4) * (double)l / (double)this.numberOfBlocks; - double d8 = d2 + (d3 - d2) * (double)l / (double)this.numberOfBlocks; - double d9 = random.nextDouble() * (double)this.numberOfBlocks / 16.0D; - double d10 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D; - double d11 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D; - int i1 = MathHelper.floor_double(d6 - d10 / 2.0D); - int j1 = MathHelper.floor_double(d7 - d11 / 2.0D); - int k1 = MathHelper.floor_double(d8 - d10 / 2.0D); - int l1 = MathHelper.floor_double(d6 + d10 / 2.0D); - int i2 = MathHelper.floor_double(d7 + d11 / 2.0D); - int j2 = MathHelper.floor_double(d8 + d10 / 2.0D); + for (int l = 0; l <= this.numberOfBlocks; ++l) { + double d6 = d + (d1 - d) * (double) l / (double) this.numberOfBlocks; + double d7 = d4 + (d5 - d4) * (double) l / (double) this.numberOfBlocks; + double d8 = d2 + (d3 - d2) * (double) l / (double) this.numberOfBlocks; + double d9 = random.nextDouble() * (double) this.numberOfBlocks / 16.0D; + double d10 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) this.numberOfBlocks) + 1.0F) * d9 + 1.0D; + double d11 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) this.numberOfBlocks) + 1.0F) * d9 + 1.0D; + int i1 = MathHelper.floor_double(d6 - d10 / 2.0D); + int j1 = MathHelper.floor_double(d7 - d11 / 2.0D); + int k1 = MathHelper.floor_double(d8 - d10 / 2.0D); + int l1 = MathHelper.floor_double(d6 + d10 / 2.0D); + int i2 = MathHelper.floor_double(d7 + d11 / 2.0D); + int j2 = MathHelper.floor_double(d8 + d10 / 2.0D); - for (int k2 = i1; k2 <= l1; ++k2) - { - double d12 = ((double)k2 + 0.5D - d6) / (d10 / 2.0D); + for (int k2 = i1; k2 <= l1; ++k2) { + double d12 = ((double) k2 + 0.5D - d6) / (d10 / 2.0D); - if (d12 * d12 < 1.0D) - { - for (int l2 = j1; l2 <= i2; ++l2) - { - double d13 = ((double)l2 + 0.5D - d7) / (d11 / 2.0D); + if (d12 * d12 < 1.0D) { + for (int l2 = j1; l2 <= i2; ++l2) { + double d13 = ((double) l2 + 0.5D - d7) / (d11 / 2.0D); - if (d12 * d12 + d13 * d13 < 1.0D) - { - for (int i3 = k1; i3 <= j2; ++i3) - { - double d14 = ((double)i3 + 0.5D - d8) / (d10 / 2.0D); + if (d12 * d12 + d13 * d13 < 1.0D) { + for (int i3 = k1; i3 <= j2; ++i3) { + double d14 = ((double) i3 + 0.5D - d8) / (d10 / 2.0D); - if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlock(k2, l2, i3) == BlocksAether.holystone) - { - this.setBlockAndNotifyAdequately(world, k2, l2, i3, this.oreBlock, 0); - } - } - } - } - } - } - } + if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlock(k2, l2, i3) == BlocksAether.holystone) { + this.setBlockAndNotifyAdequately(world, k2, l2, i3, this.oreBlock, 0); + } + } + } + } + } + } + } - return true; - } + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenOakTree.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenOakTree.java index 1d536dc..833d083 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenOakTree.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenOakTree.java @@ -7,32 +7,27 @@ import net.minecraft.world.gen.feature.WorldGenAbstractTree; import com.legacy.aether.blocks.BlocksAether; -public class AetherGenOakTree extends WorldGenAbstractTree -{ +public class AetherGenOakTree extends WorldGenAbstractTree { - public AetherGenOakTree() - { + public AetherGenOakTree() { super(true); } - public boolean branch(World world, Random random, int x, int y, int z, int slant) - { + public boolean branch(World world, Random random, int x, int y, int z, int slant) { int directionX = random.nextInt(3) - 1; int directionY = slant; int directionZ = random.nextInt(3) - 1; int i = x; int k = z; - for(int n = 0; n < random.nextInt(2); n++) - { + for (int n = 0; n < random.nextInt(2); n++) { x += directionX; y += directionY; z += directionZ; i -= directionX; k -= directionZ; - if(world.getBlock(x, y, z) == BlocksAether.golden_oak_leaves) - { + if (world.getBlock(x, y, z) == BlocksAether.golden_oak_leaves) { world.setBlock(x, y, z, BlocksAether.golden_oak_log); world.setBlock(i, y, k, BlocksAether.golden_oak_log); } @@ -42,35 +37,26 @@ public class AetherGenOakTree extends WorldGenAbstractTree } @Override - public boolean generate(World world, Random random, int x, int y, int z) - { - if(world.getBlock(x, y - 1, z) != BlocksAether.aether_grass && world.getBlock(x, y - 1, z) != BlocksAether.aether_dirt) - { + public boolean generate(World world, Random random, int x, int y, int z) { + if (world.getBlock(x, y - 1, z) != BlocksAether.aether_grass && world.getBlock(x, y - 1, z) != BlocksAether.aether_dirt) { return false; } int height = 9; - for(int x1 = x - 3; x1 < x + 4; x1++) - { - for(int y1 = y + 5; y1 < y + 12; y1++) - { - for(int z1 = z - 3; z1 < z + 4; z1++) - { - if((x1 - x) * (x1 - x) + (y1 - y - 8) * (y1 - y - 8) + (z1 - z) * (z1 - z) < 12 + random.nextInt(5) && world.isAirBlock(x1, y1, z1)) - { - world.setBlock(x1, y1, z1, BlocksAether.golden_oak_leaves); + for (int x1 = x - 3; x1 < x + 4; x1++) { + for (int y1 = y + 5; y1 < y + 12; y1++) { + for (int z1 = z - 3; z1 < z + 4; z1++) { + if ((x1 - x) * (x1 - x) + (y1 - y - 8) * (y1 - y - 8) + (z1 - z) * (z1 - z) < 12 + random.nextInt(5) && world.isAirBlock(x1, y1, z1)) { + world.setBlock(x1, y1, z1, BlocksAether.golden_oak_leaves); } } - } + } } - for(int n = 0; n < height; n++) - { - if(n > 4) - { - if(random.nextInt(3) > 0) - { + for (int n = 0; n < height; n++) { + if (n > 4) { + if (random.nextInt(3) > 0) { branch(world, random, x, y + n, z, n / 4 - 1); } } @@ -78,7 +64,7 @@ public class AetherGenOakTree extends WorldGenAbstractTree world.setBlock(x, y + n, z, BlocksAether.golden_oak_log); } - return true; - } + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenQuicksoil.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenQuicksoil.java index 4415888..293f90b 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenQuicksoil.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenQuicksoil.java @@ -8,28 +8,22 @@ import net.minecraft.world.gen.feature.WorldGenerator; import com.legacy.aether.blocks.BlocksAether; -public class AetherGenQuicksoil extends WorldGenerator -{ +public class AetherGenQuicksoil extends WorldGenerator { - public AetherGenQuicksoil() - { - super(); - } + public AetherGenQuicksoil() { + super(); + } - public boolean generate(World world, Random random, int x, int y, int z) - { - for(int x1 = x - 3; x1 < x + 4; x1++) - { - for(int z1 = z - 3; z1 < z + 4; z1++) - { - if(world.getBlock(x1, y, z1) == Blocks.air && ((x1 - x) * (x1 - x) + (z1 - z) * (z1 - z)) < 12) - { + public boolean generate(World world, Random random, int x, int y, int z) { + for (int x1 = x - 3; x1 < x + 4; x1++) { + for (int z1 = z - 3; z1 < z + 4; z1++) { + if (world.getBlock(x1, y, z1) == Blocks.air && ((x1 - x) * (x1 - x) + (z1 - z) * (z1 - z)) < 12) { this.setBlockAndNotifyAdequately(world, x1, y, z1, BlocksAether.quicksoil, 0); } } } return true; - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenSkyrootTree.java b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenSkyrootTree.java index fa6087a..b10181a 100644 --- a/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenSkyrootTree.java +++ b/src/main/java/com/legacy/aether/world/biome/decoration/AetherGenSkyrootTree.java @@ -9,61 +9,51 @@ import net.minecraft.world.gen.feature.WorldGenAbstractTree; import com.legacy.aether.blocks.BlocksAether; -public class AetherGenSkyrootTree extends WorldGenAbstractTree -{ +public class AetherGenSkyrootTree extends WorldGenAbstractTree { - public AetherGenSkyrootTree(boolean notify) - { - super(notify); - } + public AetherGenSkyrootTree(boolean notify) { + super(notify); + } - @Override - public boolean generate(World world, Random random, int x, int y, int z) - { - int l = random.nextInt(3) + 4; + @Override + public boolean generate(World world, Random random, int x, int y, int z) { + int l = random.nextInt(3) + 4; - Block j1 = world.getBlock(x, y - 1, z); + Block j1 = world.getBlock(x, y - 1, z); - if(j1 != BlocksAether.aether_grass && j1 != BlocksAether.aether_dirt) - { - return false; - } + if (j1 != BlocksAether.aether_grass && j1 != BlocksAether.aether_dirt) { + return false; + } - this.setBlockAndNotifyAdequately(world, x, y - 1, z, BlocksAether.aether_dirt, 0); + this.setBlockAndNotifyAdequately(world, x, y - 1, z, BlocksAether.aether_dirt, 0); - for(int k1 = (y - 3) + l; k1 <= y + l; k1++) - { - int j2 = k1 - (y + l); - int i3 = 1 - j2 / 2; + for (int k1 = (y - 3) + l; k1 <= y + l; k1++) { + int j2 = k1 - (y + l); + int i3 = 1 - j2 / 2; - for(int k3 = x - i3; k3 <= x + i3; k3++) - { - int l3 = k3 - x; + for (int k3 = x - i3; k3 <= x + i3; k3++) { + int l3 = k3 - x; - for(int i4 = z - i3; i4 <= z + i3; i4++) - { - int j4 = i4 - z; + for (int i4 = z - i3; i4 <= z + i3; i4++) { + int j4 = i4 - z; - if((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) && !world.getBlock(k3, k1, i4).isOpaqueCube()) - { - this.setBlockAndNotifyAdequately(world, k3, k1, i4, BlocksAether.skyroot_leaves, 0); - } - } + if ((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) && !world.getBlock(k3, k1, i4).isOpaqueCube()) { + this.setBlockAndNotifyAdequately(world, k3, k1, i4, BlocksAether.skyroot_leaves, 0); + } + } - } - } + } + } - for(int l1 = 0; l1 < l; l1++) - { - Block k2 = world.getBlock(x, y + l1, z); + for (int l1 = 0; l1 < l; l1++) { + Block k2 = world.getBlock(x, y + l1, z); - if(k2 == Blocks.air || k2 == BlocksAether.skyroot_leaves) - { - this.setBlockAndNotifyAdequately(world, x, y + l1, z, BlocksAether.skyroot_log, 0); - } - } + if (k2 == Blocks.air || k2 == BlocksAether.skyroot_leaves) { + this.setBlockAndNotifyAdequately(world, x, y + l1, z, BlocksAether.skyroot_log, 0); + } + } - return true; - } + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/dungeon/BronzeDungeon.java b/src/main/java/com/legacy/aether/world/dungeon/BronzeDungeon.java index 64805b1..6fb06fb 100644 --- a/src/main/java/com/legacy/aether/world/dungeon/BronzeDungeon.java +++ b/src/main/java/com/legacy/aether/world/dungeon/BronzeDungeon.java @@ -15,29 +15,25 @@ import com.legacy.aether.items.ItemsAether; import com.legacy.aether.world.dungeon.util.AetherDungeon; import com.legacy.aether.world.dungeon.util.PositionData; -public class BronzeDungeon extends AetherDungeon -{ +public class BronzeDungeon extends AetherDungeon { - private int numRooms = 4; + private int numRooms = 4; private int n; private boolean finished; - public BronzeDungeon() - { + public BronzeDungeon() { finished = false; - } + } @Override - public boolean generate(World world, Random random, int i, int j, int k) - { + public boolean generate(World world, Random random, int i, int j, int k) { replaceAir = true; replaceSolid = true; n = 0; - if(!isBoxSolid(world, new PositionData(i, j, k), new PositionData(16, 12, 16)) || !isBoxSolid(world, new PositionData(i + 20, j, k + 2), new PositionData(12, 12, 12))) - { + if (!isBoxSolid(world, new PositionData(i, j, k), new PositionData(16, 12, 16)) || !isBoxSolid(world, new PositionData(i + 20, j, k + 2), new PositionData(12, 12, 12))) { return false; } @@ -51,8 +47,7 @@ public class BronzeDungeon extends AetherDungeon slider.setPosition(i + 8, j + 2, k + 8); slider.setDungeon(slider.posX - 8, slider.posY - 2, slider.posZ - 8); - if (!world.isRemote) - { + if (!world.isRemote) { world.spawnEntityInWorld(slider); } @@ -66,8 +61,7 @@ public class BronzeDungeon extends AetherDungeon y = j; z = k + 2; - if(!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 12, 12))) - { + if (!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 12, 12))) { return true; } @@ -76,33 +70,28 @@ public class BronzeDungeon extends AetherDungeon setBlocks(this.fillerBlock(), this.fillerBlock1(), 5); - addSquareTube(world, random, new PositionData(x - 5, y, z + 3), new PositionData(6, 6, 6), 0); - - for(int p = x + 2; p < x + 10; p += 3) - { - for(int q = z + 2; q < z + 10; q += 3) - { + addSquareTube(world, random, new PositionData(x - 5, y, z + 3), new PositionData(6, 6, 6), 0); + + for (int p = x + 2; p < x + 10; p += 3) { + for (int q = z + 2; q < z + 10; q += 3) { world.setBlock(p, j, q, BlocksAether.carved_trap, 0, 2); } - } + } n++; generateNextRoom(world, random, new PositionData(x, y, z)); generateNextRoom(world, random, new PositionData(x, y, z)); - if(n > numRooms || !finished) - { + if (n > numRooms || !finished) { endCorridor(world, random, new PositionData(x, y, z)); } - return true; + return true; } - public boolean generateNextRoom(World world, Random random, PositionData pos) - { - if(n > numRooms && !finished) - { + public boolean generateNextRoom(World world, Random random, PositionData pos) { + if (n > numRooms && !finished) { endCorridor(world, random, pos); return false; } @@ -111,30 +100,22 @@ public class BronzeDungeon extends AetherDungeon int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); - - if(dir == 0) - { + + if (dir == 0) { x += 16; z += 0; - } - else if(dir == 1) - { + } else if (dir == 1) { x += 0; z += 16; - } - else if(dir == 2) - { + } else if (dir == 2) { x -= 16; z += 0; - } - else if(dir == 3) - { + } else if (dir == 3) { x += 0; z -= 16; } - if(!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 8, 12))) - { + if (!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 8, 12))) { return false; } @@ -142,24 +123,18 @@ public class BronzeDungeon extends AetherDungeon addHollowBox(world, random, new PositionData(x, y, z), new PositionData(12, 8, 12)); - for(int p = x; p < x + 12; p++) - { - for(int q = y; q < y + 8; q++) - { - for(int r = z; r < z + 12; r++) - { - if(world.getBlock(p, q, r) == this.mainBlock() && random.nextInt(100) == 0) - { + for (int p = x; p < x + 12; p++) { + for (int q = y; q < y + 8; q++) { + for (int r = z; r < z + 12; r++) { + if (world.getBlock(p, q, r) == this.mainBlock() && random.nextInt(100) == 0) { world.setBlock(p, q, r, BlocksAether.carved_trap); } } } } - for(int p = x + 2; p < x + 10; p += 7) - { - for(int q = z + 2; q < z + 10; q += 7) - { + for (int p = x + 2; p < x + 10; p += 7) { + for (int q = z + 2; q < z + 10; q += 7) { world.setBlock(p, pos.getY(), q, BlocksAether.carved_trap); } } @@ -169,67 +144,55 @@ public class BronzeDungeon extends AetherDungeon int p = x + 5 + random.nextInt(2); int q = z + 5 + random.nextInt(2); - switch(type) - { - case 0 : - { + switch (type) { + case 0: { world.setBlock(p, y + 2, q, BlocksAether.chest_mimic); break; } - case 1 : - { - if(world.getBlock(p, y + 2, q) == Blocks.air) - { + case 1: { + if (world.getBlock(p, y + 2, q) == Blocks.air) { world.setBlock(p, y + 2, q, Blocks.chest); - TileEntityChest chest = (TileEntityChest)world.getTileEntity(p, y + 2, q); - - for(p = 0; p < 3 + random.nextInt(3); p++) - { + TileEntityChest chest = (TileEntityChest) world.getTileEntity(p, y + 2, q); + + for (p = 0; p < 3 + random.nextInt(3); p++) { chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), this.getNormalLoot(random)); } } break; - } + } } setBlocks(this.fillerBlock(), this.fillerBlock1(), 5); - switch(dir) - { - case 0: - { - addSquareTube(world, random, new PositionData(x - 5, y, z + 3), new PositionData(6, 6, 6), 0); + switch (dir) { + case 0: { + addSquareTube(world, random, new PositionData(x - 5, y, z + 3), new PositionData(6, 6, 6), 0); break; } - case 1: - { - addSquareTube(world, random, new PositionData(x + 3, y, z - 5), new PositionData(6, 6, 6), 2); + case 1: { + addSquareTube(world, random, new PositionData(x + 3, y, z - 5), new PositionData(6, 6, 6), 2); break; } - case 2: - { - addSquareTube(world, random, new PositionData(x + 11, y, z + 3), new PositionData(6, 6, 6), 0); + case 2: { + addSquareTube(world, random, new PositionData(x + 11, y, z + 3), new PositionData(6, 6, 6), 0); break; } - case 3: - { - addSquareTube(world, random, new PositionData(x + 3, y, z + 11), new PositionData(6, 6, 6), 2); + case 3: { + addSquareTube(world, random, new PositionData(x + 3, y, z + 11), new PositionData(6, 6, 6), 2); break; } } n++; - if(!generateNextRoom(world, random, new PositionData(x, y, z))) - { + if (!generateNextRoom(world, random, new PositionData(x, y, z))) { return false; } return generateNextRoom(world, random, new PositionData(x, y, z)); } - public void endCorridor(World world, Random random, PositionData pos) - { + public void endCorridor(World world, Random random, PositionData pos) { replaceAir = false; boolean tunnelling = true; boolean flag; @@ -237,32 +200,25 @@ public class BronzeDungeon extends AetherDungeon int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); - if(dir == 0) - { + if (dir == 0) { x += 11; z += 3; - - while(tunnelling) - { - if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(1, 8, 6)) || x - pos.getX() > 100) - { + + while (tunnelling) { + if (isBoxEmpty(world, new PositionData(x, y, z), new PositionData(1, 8, 6)) || x - pos.getX() > 100) { tunnelling = false; } flag = true; - - while(flag && (world.getBlock(x, y, z) == this.mainBlock() || world.getBlock(x, y, z) == this.lockedBlock() || world.getBlock(x, y, z) == this.lockedLightBlock() || world.getBlock(x, y, z) == this.mainLightBlock())) - { - if(world.getBlock(x + 1, y, z) == this.mainBlock() || world.getBlock(x + 1, y, z) == this.lockedBlock() || world.getBlock(x + 1, y, z) == this.lockedLightBlock() || world.getBlock(x + 1, y, z) == this.mainLightBlock()) - { + + while (flag && (world.getBlock(x, y, z) == this.mainBlock() || world.getBlock(x, y, z) == this.lockedBlock() || world.getBlock(x, y, z) == this.lockedLightBlock() || world.getBlock(x, y, z) == this.mainLightBlock())) { + if (world.getBlock(x + 1, y, z) == this.mainBlock() || world.getBlock(x + 1, y, z) == this.lockedBlock() || world.getBlock(x + 1, y, z) == this.lockedLightBlock() || world.getBlock(x + 1, y, z) == this.mainLightBlock()) { x++; - } - else - { + } else { flag = false; } } - + setBlocks(this.fillerBlock(), this.fillerBlock1(), 5); addPlaneX(world, random, new PositionData(x, y, z), new PositionData(0, 8, 6)); @@ -271,32 +227,25 @@ public class BronzeDungeon extends AetherDungeon x++; } } - - if(dir == 1) - { + + if (dir == 1) { x += 3; z += 11; - while(tunnelling) - { - if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)) || z - pos.getZ() > 100) - { + while (tunnelling) { + if (isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)) || z - pos.getZ() > 100) { tunnelling = false; } - + flag = true; - - while(flag && (world.getBlock(x, y, z) == this.mainBlock() || world.getBlock(x, y, z) == this.lockedBlock() || world.getBlock(x, y, z) == this.lockedLightBlock() || world.getBlock(x, y, z) == this.mainLightBlock())) - { - if(world.getBlock(x, y, z + 1) == this.mainBlock() || world.getBlock(x, y, z + 1) == this.lockedBlock() || world.getBlock(x, y, z + 1) == this.lockedLightBlock() || world.getBlock(x, y, z + 1) == this.mainLightBlock()) - { + + while (flag && (world.getBlock(x, y, z) == this.mainBlock() || world.getBlock(x, y, z) == this.lockedBlock() || world.getBlock(x, y, z) == this.lockedLightBlock() || world.getBlock(x, y, z) == this.mainLightBlock())) { + if (world.getBlock(x, y, z + 1) == this.mainBlock() || world.getBlock(x, y, z + 1) == this.lockedBlock() || world.getBlock(x, y, z + 1) == this.lockedLightBlock() || world.getBlock(x, y, z + 1) == this.mainLightBlock()) { z++; - } - else - { + } else { flag = false; } } - + setBlocks(this.fillerBlock(), this.fillerBlock1(), 5); addPlaneZ(world, random, new PositionData(x, y, z), new PositionData(6, 8, 0)); setBlocks(Blocks.air, Blocks.air, 1); @@ -304,28 +253,21 @@ public class BronzeDungeon extends AetherDungeon z++; } } - - if(dir == 2) - { + + if (dir == 2) { x += 3; z -= 0; - while(tunnelling) - { - if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)) || pos.getY() - z > 100) - { + while (tunnelling) { + if (isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)) || pos.getY() - z > 100) { tunnelling = false; } - + flag = true; - - while(flag && (world.getBlock(x, y, z) == this.mainBlock() || world.getBlock(x, y, z) == this.lockedBlock() || world.getBlock(x, y, z) == this.lockedLightBlock() || world.getBlock(x, y, z) == this.mainLightBlock())) - { - if(world.getBlock(x, y, z - 1) == this.mainBlock() || world.getBlock(x, y, z - 1) == this.lockedBlock() || world.getBlock(x, y, z - 1) == this.lockedLightBlock() || world.getBlock(x, y, z - 1) == this.mainLightBlock()) - { + + while (flag && (world.getBlock(x, y, z) == this.mainBlock() || world.getBlock(x, y, z) == this.lockedBlock() || world.getBlock(x, y, z) == this.lockedLightBlock() || world.getBlock(x, y, z) == this.mainLightBlock())) { + if (world.getBlock(x, y, z - 1) == this.mainBlock() || world.getBlock(x, y, z - 1) == this.lockedBlock() || world.getBlock(x, y, z - 1) == this.lockedLightBlock() || world.getBlock(x, y, z - 1) == this.mainLightBlock()) { z--; - } - else - { + } else { flag = false; } } @@ -336,65 +278,55 @@ public class BronzeDungeon extends AetherDungeon addPlaneZ(world, random, new PositionData(x + 1, y + 1, z), new PositionData(4, 6, 0)); z--; } - } + } finished = true; } - private ItemStack getNormalLoot(Random random) - { + private ItemStack getNormalLoot(Random random) { int item = random.nextInt(15); - switch(item) - { - case 0 : + switch (item) { + case 0: return new ItemStack(ItemsAether.zanite_pickaxe); - case 1 : + case 1: return new ItemStack(ItemsAether.zanite_axe); - case 2 : + case 2: return new ItemStack(ItemsAether.zanite_sword); - case 3 : + case 3: return new ItemStack(ItemsAether.zanite_shovel); - case 4 : + case 4: return new ItemStack(ItemsAether.swet_cape); - case 5 : + case 5: return new ItemStack(ItemsAether.ambrosium_shard, random.nextInt(10) + 1); - case 6 : + case 6: return new ItemStack(ItemsAether.dart, random.nextInt(5) + 1, 0); - case 7 : + case 7: return new ItemStack(ItemsAether.dart, random.nextInt(3) + 1, 1); - case 8 : + case 8: return new ItemStack(ItemsAether.dart, random.nextInt(3) + 1, 2); - case 9 : - { - if(random.nextInt(20) == 0) - { + case 9: { + if (random.nextInt(20) == 0) { return new ItemStack(ItemsAether.aether_tune); } break; } - case 10 : + case 10: return new ItemStack(ItemsAether.skyroot_bucket, 1, 2); - case 11 : - { - if(random.nextInt(10) == 0) - { + case 11: { + if (random.nextInt(10) == 0) { return new ItemStack(Items.record_cat); } break; } - case 12 : - { - if(random.nextInt(4) == 0) - { + case 12: { + if (random.nextInt(4) == 0) { return new ItemStack(ItemsAether.iron_ring); } break; } - case 13 : - { - if(random.nextInt(10) == 0) - { + case 13: { + if (random.nextInt(10) == 0) { return new ItemStack(ItemsAether.golden_ring); } break; @@ -402,62 +334,54 @@ public class BronzeDungeon extends AetherDungeon } return new ItemStack(BlocksAether.ambrosium_torch); } - - public static ItemStack getBronzeLoot(Random random) - { + + public static ItemStack getBronzeLoot(Random random) { int item = random.nextInt(10); - switch(item) - { - case 0 : + switch (item) { + case 0: return new ItemStack(ItemsAether.gummy_swet, random.nextInt(7) + 1, random.nextInt(2)); - case 1 : + case 1: return new ItemStack(ItemsAether.phoenix_bow); - case 2 : + case 2: return new ItemStack(ItemsAether.flaming_sword); - case 3 : + case 3: return new ItemStack(ItemsAether.notch_hammer); - case 4 : + case 4: return new ItemStack(ItemsAether.lightning_knife, random.nextInt(15) + 1); - case 5 : + case 5: return new ItemStack(ItemsAether.valkyrie_lance); - case 6 : + case 6: return new ItemStack(ItemsAether.agility_cape); - case 7 : + case 7: return new ItemStack(ItemsAether.sentry_boots); - case 8 : + case 8: return new ItemStack(ItemsAether.repulsion_shield); } return new ItemStack(ItemsAether.cloud_staff); } - public Block lockedLightBlock() - { + public Block lockedLightBlock() { return BlocksAether.locked_sentry_stone; } - public Block lockedBlock() - { + public Block lockedBlock() { return BlocksAether.locked_carved_stone; } - public Block mainLightBlock() - { + public Block mainLightBlock() { return BlocksAether.sentry_stone; } - public Block mainBlock() - { + public Block mainBlock() { return BlocksAether.carved_stone; } - public Block fillerBlock() - { + public Block fillerBlock() { return BlocksAether.holystone; } - public Block fillerBlock1() - { + public Block fillerBlock1() { return BlocksAether.mossy_holystone; } diff --git a/src/main/java/com/legacy/aether/world/dungeon/util/AetherDungeon.java b/src/main/java/com/legacy/aether/world/dungeon/util/AetherDungeon.java index 73bdc49..b751f87 100644 --- a/src/main/java/com/legacy/aether/world/dungeon/util/AetherDungeon.java +++ b/src/main/java/com/legacy/aether/world/dungeon/util/AetherDungeon.java @@ -7,339 +7,263 @@ import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public abstract class AetherDungeon extends WorldGenerator -{ +public abstract class AetherDungeon extends WorldGenerator { protected final Random random = new Random(); - public int chance; + public int chance; - public Block airState = Blocks.air, blockState, extraBlockState; + public Block airState = Blocks.air, blockState, extraBlockState; - public boolean replaceAir, replaceSolid; + public boolean replaceAir, replaceSolid; - public AetherDungeon() - { - super(); - } + public AetherDungeon() { + super(); + } - public void setBlocks(Block blockState) - { - this.blockState = blockState; - this.extraBlockState = null; - this.chance = 0; - } + public void setBlocks(Block blockState) { + this.blockState = blockState; + this.extraBlockState = null; + this.chance = 0; + } - public void setBlocks(Block blockState, Block extraBlockState, int chances) - { - this.blockState = blockState; - this.extraBlockState = extraBlockState; - this.chance = chances; + public void setBlocks(Block blockState, Block extraBlockState, int chances) { + this.blockState = blockState; + this.extraBlockState = extraBlockState; + this.chance = chances; - if (this.chance < 1) - { - this.chance = 1; - } - } - - public void addLineX(World world, Random rand, PositionData pos, int radius) - { - for (int lineX = pos.getX(); lineX < pos.getX() + radius; lineX++) - { - Block block = world.getBlock(lineX, pos.getY(), pos.getZ()); - - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - if (this.chance == 0) - { - this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), pos.getZ(), this.blockState, 0); - - return; - } - - if (rand.nextInt(this.chance) == 0) - { - this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), pos.getZ(), this.extraBlockState, 0); - } - else - { - this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), pos.getZ(), this.blockState, 0); - } - } - } - } - - public void addLineY(World world, Random rand, PositionData pos, int radius) - { - for (int lineY = pos.getY(); lineY < pos.getY() + radius; lineY++) - { - Block block = world.getBlock(pos.getX(), lineY, pos.getZ()); - - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - if (this.chance == 0) - { - this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, pos.getZ(), this.blockState, 0); - - return; - } - - if (rand.nextInt(this.chance) == 0) - { - this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, pos.getZ(), this.extraBlockState, 0); - } - else - { - this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, pos.getZ(), this.blockState, 0); - } - } - } - } - - public void addLineZ(World world, Random rand, PositionData pos, int radius) - { - for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius; lineZ++) - { - Block block = world.getBlock(pos.getX(), pos.getY(), lineZ); - - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - if (this.chance == 0) - { - this.setBlockAndNotifyAdequately(world, pos.getX(), pos.getY(), lineZ, this.blockState, 0); - - return; - } - - if (rand.nextInt(this.chance) == 0) - { - this.setBlockAndNotifyAdequately(world, pos.getX(), pos.getY(), lineZ, this.extraBlockState, 0); - } - else - { - this.setBlockAndNotifyAdequately(world, pos.getX(), pos.getY(), lineZ, this.blockState, 0); - } - } - } - } - - public void addPlaneX(World world, Random rand, PositionData pos, PositionData radius) - { - for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) - { - for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) - { - Block block = world.getBlock(pos.getX(), lineY, lineZ); - - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - if (this.chance == 0) - { - this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, lineZ, this.blockState, 0); - - return; - } - - if (rand.nextInt(this.chance) == 0) - { - this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, lineZ, this.extraBlockState, 0); - } - else - { - this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, lineZ, this.blockState, 0); - } - } - } - } - } - - public void addPlaneY(World world, Random rand, PositionData pos, PositionData radius)//, int radiusX, int radiusZ) - { - for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) - { - for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) - { - Block block = world.getBlock(lineX, pos.getY(), lineZ); - - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - if (this.chance == 0) - { - this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), lineZ, this.blockState, 0); - - return; - } - - if (rand.nextInt(this.chance) == 0) - { - this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), lineZ, this.extraBlockState, 0); - } - else - { - this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), lineZ, this.blockState, 0); - } - } - } - } - } - - public void addPlaneZ(World world, Random rand, PositionData pos, PositionData radius)//, int radiusX, int radiusY) - { - for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) - { - for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) - { - Block block = world.getBlock(lineX, lineY, pos.getZ()); - - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - if (this.chance == 0) - { - this.setBlockAndNotifyAdequately(world, lineX, lineY, pos.getZ(), this.blockState, 0); - - return; - } - - if (rand.nextInt(this.chance) == 0) - { - this.setBlockAndNotifyAdequately(world, lineX, lineY, pos.getZ(), this.extraBlockState, 0); - } - else - { - this.setBlockAndNotifyAdequately(world, lineX, lineY, pos.getZ(), this.blockState, 0); - } - } - } - } - } - - public void addHollowBox(World world, Random rand, PositionData pos, PositionData radius) - { - Block temp1 = this.blockState; - Block temp2 = this.extraBlockState; - - this.setBlocks(this.airState, this.airState, this.chance); - this.addSolidBox(world, rand, pos, radius); - this.setBlocks(temp1, temp2, this.chance); - this.addPlaneY(world, rand, pos, radius); - this.addPlaneY(world, rand, new PositionData(pos.getX(), pos.getY() + (radius.getY() - 1), pos.getZ()), radius); - this.addPlaneX(world, rand, pos, radius); - this.addPlaneX(world, rand, new PositionData(pos.getX() + (radius.getX() - 1), pos.getY(), pos.getZ()), radius); - this.addPlaneZ(world, rand, pos, radius); - this.addPlaneZ(world, rand, new PositionData(pos.getX(), pos.getY(), pos.getZ() + (radius.getZ() - 1)), radius); - } - - public void addSquareTube(World world, Random rand, PositionData pos, PositionData radius, int angel) - { - Block temp1 = this.blockState; - Block temp2 = this.extraBlockState; - - this.setBlocks(this.airState, this.airState, this.chance); - this.addSolidBox(world, rand, pos, radius); - this.setBlocks(temp1, temp2, this.chance); - - if (angel == 0 || angel == 2) - { - this.addPlaneY(world, rand, pos, radius); - this.addPlaneY(world, rand, new PositionData(pos.getX(), pos.getY() + (radius.getY() - 1), pos.getZ()), radius); - } - - if (angel == 1 || angel == 2) - { - this.addPlaneX(world, rand, pos, radius); - this.addPlaneX(world, rand, new PositionData(pos.getX() + (radius.getX() - 1), pos.getY(), pos.getZ()), radius); - } - - if (angel == 0 || angel == 1) - { - this.addPlaneZ(world, rand, pos, radius); - this.addPlaneZ(world, rand, new PositionData(pos.getX(), pos.getY(), pos.getZ() + (radius.getZ() - 1)), radius); - } - } - - public void addSolidBox(World world, Random rand, PositionData pos, PositionData radius) - { - for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) - { - for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) - { - for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) - { - Block block = world.getBlock(lineX, lineY, lineZ); - - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - if (this.chance == 0) - { - this.setBlockAndNotifyAdequately(world, lineX, lineY, lineZ, this.blockState, 0); - - return; - } - - if (rand.nextInt(this.chance) == 0) - { - this.setBlockAndNotifyAdequately(world, lineX, lineY, lineZ, this.extraBlockState, 0); - } - else - { - this.setBlockAndNotifyAdequately(world, lineX, lineY, lineZ, this.blockState, 0); - } - } - } - } - } - } - - public boolean isBoxSolid(World world, PositionData pos, PositionData radius) - { - boolean flag = true; - - for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) - { - for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) - { - for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) - { - if (world.getBlock(lineX, lineY, lineZ) == Blocks.air) - { - flag = false; - } - } - } - } - - return flag; - } - - public boolean isBoxEmpty(World world, PositionData pos, PositionData radius) - { - boolean flag = true; - - for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) - { - for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) - { - for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) - { - if (world.getBlock(lineX, lineY, lineZ) != Blocks.air) - { - flag = false; - } - } - } - } - - return flag; - } - - protected void setBlock(World world, Random random, int x, int y, int z, Block state, Block extraState, int chance) - { - if(random.nextInt(chance) == 0) - { - this.setBlockAndNotifyAdequately(world, x, y, z, extraState, 0); + if (this.chance < 1) { + this.chance = 1; } - else - { + } + + public void addLineX(World world, Random rand, PositionData pos, int radius) { + for (int lineX = pos.getX(); lineX < pos.getX() + radius; lineX++) { + Block block = world.getBlock(lineX, pos.getY(), pos.getZ()); + + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + if (this.chance == 0) { + this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), pos.getZ(), this.blockState, 0); + + return; + } + + if (rand.nextInt(this.chance) == 0) { + this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), pos.getZ(), this.extraBlockState, 0); + } else { + this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), pos.getZ(), this.blockState, 0); + } + } + } + } + + public void addLineY(World world, Random rand, PositionData pos, int radius) { + for (int lineY = pos.getY(); lineY < pos.getY() + radius; lineY++) { + Block block = world.getBlock(pos.getX(), lineY, pos.getZ()); + + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + if (this.chance == 0) { + this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, pos.getZ(), this.blockState, 0); + + return; + } + + if (rand.nextInt(this.chance) == 0) { + this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, pos.getZ(), this.extraBlockState, 0); + } else { + this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, pos.getZ(), this.blockState, 0); + } + } + } + } + + public void addLineZ(World world, Random rand, PositionData pos, int radius) { + for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius; lineZ++) { + Block block = world.getBlock(pos.getX(), pos.getY(), lineZ); + + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + if (this.chance == 0) { + this.setBlockAndNotifyAdequately(world, pos.getX(), pos.getY(), lineZ, this.blockState, 0); + + return; + } + + if (rand.nextInt(this.chance) == 0) { + this.setBlockAndNotifyAdequately(world, pos.getX(), pos.getY(), lineZ, this.extraBlockState, 0); + } else { + this.setBlockAndNotifyAdequately(world, pos.getX(), pos.getY(), lineZ, this.blockState, 0); + } + } + } + } + + public void addPlaneX(World world, Random rand, PositionData pos, PositionData radius) { + for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) { + for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) { + Block block = world.getBlock(pos.getX(), lineY, lineZ); + + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + if (this.chance == 0) { + this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, lineZ, this.blockState, 0); + + return; + } + + if (rand.nextInt(this.chance) == 0) { + this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, lineZ, this.extraBlockState, 0); + } else { + this.setBlockAndNotifyAdequately(world, pos.getX(), lineY, lineZ, this.blockState, 0); + } + } + } + } + } + + public void addPlaneY(World world, Random rand, PositionData pos, PositionData radius)//, int radiusX, int radiusZ) + { + for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) { + for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) { + Block block = world.getBlock(lineX, pos.getY(), lineZ); + + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + if (this.chance == 0) { + this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), lineZ, this.blockState, 0); + + return; + } + + if (rand.nextInt(this.chance) == 0) { + this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), lineZ, this.extraBlockState, 0); + } else { + this.setBlockAndNotifyAdequately(world, lineX, pos.getY(), lineZ, this.blockState, 0); + } + } + } + } + } + + public void addPlaneZ(World world, Random rand, PositionData pos, PositionData radius)//, int radiusX, int radiusY) + { + for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) { + for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) { + Block block = world.getBlock(lineX, lineY, pos.getZ()); + + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + if (this.chance == 0) { + this.setBlockAndNotifyAdequately(world, lineX, lineY, pos.getZ(), this.blockState, 0); + + return; + } + + if (rand.nextInt(this.chance) == 0) { + this.setBlockAndNotifyAdequately(world, lineX, lineY, pos.getZ(), this.extraBlockState, 0); + } else { + this.setBlockAndNotifyAdequately(world, lineX, lineY, pos.getZ(), this.blockState, 0); + } + } + } + } + } + + public void addHollowBox(World world, Random rand, PositionData pos, PositionData radius) { + Block temp1 = this.blockState; + Block temp2 = this.extraBlockState; + + this.setBlocks(this.airState, this.airState, this.chance); + this.addSolidBox(world, rand, pos, radius); + this.setBlocks(temp1, temp2, this.chance); + this.addPlaneY(world, rand, pos, radius); + this.addPlaneY(world, rand, new PositionData(pos.getX(), pos.getY() + (radius.getY() - 1), pos.getZ()), radius); + this.addPlaneX(world, rand, pos, radius); + this.addPlaneX(world, rand, new PositionData(pos.getX() + (radius.getX() - 1), pos.getY(), pos.getZ()), radius); + this.addPlaneZ(world, rand, pos, radius); + this.addPlaneZ(world, rand, new PositionData(pos.getX(), pos.getY(), pos.getZ() + (radius.getZ() - 1)), radius); + } + + public void addSquareTube(World world, Random rand, PositionData pos, PositionData radius, int angel) { + Block temp1 = this.blockState; + Block temp2 = this.extraBlockState; + + this.setBlocks(this.airState, this.airState, this.chance); + this.addSolidBox(world, rand, pos, radius); + this.setBlocks(temp1, temp2, this.chance); + + if (angel == 0 || angel == 2) { + this.addPlaneY(world, rand, pos, radius); + this.addPlaneY(world, rand, new PositionData(pos.getX(), pos.getY() + (radius.getY() - 1), pos.getZ()), radius); + } + + if (angel == 1 || angel == 2) { + this.addPlaneX(world, rand, pos, radius); + this.addPlaneX(world, rand, new PositionData(pos.getX() + (radius.getX() - 1), pos.getY(), pos.getZ()), radius); + } + + if (angel == 0 || angel == 1) { + this.addPlaneZ(world, rand, pos, radius); + this.addPlaneZ(world, rand, new PositionData(pos.getX(), pos.getY(), pos.getZ() + (radius.getZ() - 1)), radius); + } + } + + public void addSolidBox(World world, Random rand, PositionData pos, PositionData radius) { + for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) { + for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) { + for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) { + Block block = world.getBlock(lineX, lineY, lineZ); + + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + if (this.chance == 0) { + this.setBlockAndNotifyAdequately(world, lineX, lineY, lineZ, this.blockState, 0); + + return; + } + + if (rand.nextInt(this.chance) == 0) { + this.setBlockAndNotifyAdequately(world, lineX, lineY, lineZ, this.extraBlockState, 0); + } else { + this.setBlockAndNotifyAdequately(world, lineX, lineY, lineZ, this.blockState, 0); + } + } + } + } + } + } + + public boolean isBoxSolid(World world, PositionData pos, PositionData radius) { + boolean flag = true; + + for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) { + for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) { + for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) { + if (world.getBlock(lineX, lineY, lineZ) == Blocks.air) { + flag = false; + } + } + } + } + + return flag; + } + + public boolean isBoxEmpty(World world, PositionData pos, PositionData radius) { + boolean flag = true; + + for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) { + for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) { + for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) { + if (world.getBlock(lineX, lineY, lineZ) != Blocks.air) { + flag = false; + } + } + } + } + + return flag; + } + + protected void setBlock(World world, Random random, int x, int y, int z, Block state, Block extraState, int chance) { + if (random.nextInt(chance) == 0) { + this.setBlockAndNotifyAdequately(world, x, y, z, extraState, 0); + } else { this.setBlockAndNotifyAdequately(world, x, y, z, state, 0); } } diff --git a/src/main/java/com/legacy/aether/world/dungeon/util/PositionData.java b/src/main/java/com/legacy/aether/world/dungeon/util/PositionData.java index ef25c4e..853f80b 100644 --- a/src/main/java/com/legacy/aether/world/dungeon/util/PositionData.java +++ b/src/main/java/com/legacy/aether/world/dungeon/util/PositionData.java @@ -1,29 +1,24 @@ package com.legacy.aether.world.dungeon.util; -public class PositionData -{ +public class PositionData { private int x, y, z; - public PositionData(int x, int y, int z) - { + public PositionData(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } - public int getX() - { + public int getX() { return this.x; } - public int getY() - { + public int getY() { return this.y; } - public int getZ() - { + public int getZ() { return this.z; } diff --git a/src/main/java/com/legacy/aether/world/gen/AetherGenUtils.java b/src/main/java/com/legacy/aether/world/gen/AetherGenUtils.java index a41d330..358aba2 100644 --- a/src/main/java/com/legacy/aether/world/gen/AetherGenUtils.java +++ b/src/main/java/com/legacy/aether/world/gen/AetherGenUtils.java @@ -5,61 +5,48 @@ import net.minecraft.block.material.Material; import com.legacy.aether.blocks.BlocksAether; -public class AetherGenUtils -{ +public class AetherGenUtils { - public static void generateFlower(AetherStructure structure, Block state, int meta, int offsetX, int offsetY, int offsetZ) - { - int x = offsetX; - int y = offsetY; - int z = offsetZ; + public static void generateFlower(AetherStructure structure, Block state, int meta, int offsetX, int offsetY, int offsetZ) { + int x = offsetX; + int y = offsetY; + int z = offsetZ; - for (int i = 0; i < 64; ++i) - { - x += structure.random.nextInt(8) - structure.random.nextInt(8); - y += structure.random.nextInt(4) - structure.random.nextInt(4); - z += structure.random.nextInt(8) - structure.random.nextInt(8); + for (int i = 0; i < 64; ++i) { + x += structure.random.nextInt(8) - structure.random.nextInt(8); + y += structure.random.nextInt(4) - structure.random.nextInt(4); + z += structure.random.nextInt(8) - structure.random.nextInt(8); - if (structure.getBlockStateWithOffset(x, y, z).getMaterial() == Material.air && y < 255 && structure.getBlockStateWithOffset(x, y - 1, z) == BlocksAether.aether_grass) - { - structure.setBlockWithOffset(x, y, z, state, meta); - } - } + if (structure.getBlockStateWithOffset(x, y, z).getMaterial() == Material.air && y < 255 && structure.getBlockStateWithOffset(x, y - 1, z) == BlocksAether.aether_grass) { + structure.setBlockWithOffset(x, y, z, state, meta); + } + } } - public static void generateGoldenOakTree(AetherStructure structure, int offsetX, int offsetY, int offsetZ) - { - int x = offsetX; - int y = offsetY; - int z = offsetZ; + public static void generateGoldenOakTree(AetherStructure structure, int offsetX, int offsetY, int offsetZ) { + int x = offsetX; + int y = offsetY; + int z = offsetZ; - if(structure.getBlockStateWithOffset(x, y - 1, z) != BlocksAether.aether_grass && structure.getBlockStateWithOffset(x, y - 1, z) != BlocksAether.aether_dirt) - { + if (structure.getBlockStateWithOffset(x, y - 1, z) != BlocksAether.aether_grass && structure.getBlockStateWithOffset(x, y - 1, z) != BlocksAether.aether_dirt) { return; } int height = 9; - for(int x1 = x - 3; x1 < x + 4; x1++) - { - for(int y1 = y + 5; y1 < y + 12; y1++) - { - for(int z1 = z - 3; z1 < z + 4; z1++) - { - if((x1 - x) * (x1 - x) + (y1 - y - 8) * (y1 - y - 8) + (z1 - z) * (z1 - z) < 12 + structure.random.nextInt(5)) - { + for (int x1 = x - 3; x1 < x + 4; x1++) { + for (int y1 = y + 5; y1 < y + 12; y1++) { + for (int z1 = z - 3; z1 < z + 4; z1++) { + if ((x1 - x) * (x1 - x) + (y1 - y - 8) * (y1 - y - 8) + (z1 - z) * (z1 - z) < 12 + structure.random.nextInt(5)) { structure.setBlockWithOffset(x1, y1, z1, BlocksAether.golden_oak_leaves, 0); } } - } + } } - for(int n = 0; n < height; n++) - { - if(n > 4) - { - if(structure.random.nextInt(3) > 0) - { + for (int n = 0; n < height; n++) { + if (n > 4) { + if (structure.random.nextInt(3) > 0) { goldenOakBranch(structure, x, y + n, z, n / 4 - 1); } } @@ -68,69 +55,57 @@ public class AetherGenUtils } } - private static void goldenOakBranch(AetherStructure structure, int x, int y, int z, int slant) - { + private static void goldenOakBranch(AetherStructure structure, int x, int y, int z, int slant) { int directionX = structure.random.nextInt(3) - 1; int directionY = slant; int directionZ = structure.random.nextInt(3) - 1; int i = x; int k = z; - for(int n = 0; n < structure.random.nextInt(2); n++) - { + for (int n = 0; n < structure.random.nextInt(2); n++) { x += directionX; y += directionY; z += directionZ; i -= directionX; k -= directionZ; - if(structure.getBlockStateWithOffset(x, y, z) == BlocksAether.golden_oak_leaves) - { + if (structure.getBlockStateWithOffset(x, y, z) == BlocksAether.golden_oak_leaves) { structure.setBlockWithOffset(x, y, z, BlocksAether.golden_oak_log, 0); structure.setBlockWithOffset(i, y, k, BlocksAether.golden_oak_log, 0); } } } - public static void generateClouds(AetherStructure structure, Block block, int meta, boolean isFlat, int cloudSize, int offsetX, int offsetY, int offsetZ, int xTendency, int zTendency) - { - int x = offsetX; - int y = offsetY; - int z = offsetZ; + public static void generateClouds(AetherStructure structure, Block block, int meta, boolean isFlat, int cloudSize, int offsetX, int offsetY, int offsetZ, int xTendency, int zTendency) { + int x = offsetX; + int y = offsetY; + int z = offsetZ; - if (block == null) - { - return; - } + if (block == null) { + return; + } - for (int n = 0; n < cloudSize; ++n) - { - x += structure.random.nextInt(3) - 1 + xTendency; + for (int n = 0; n < cloudSize; ++n) { + x += structure.random.nextInt(3) - 1 + xTendency; - if (structure.random.nextBoolean() && !isFlat || isFlat && structure.random.nextInt(10) == 0) - { - y += structure.random.nextInt(3) - 1; - } + if (structure.random.nextBoolean() && !isFlat || isFlat && structure.random.nextInt(10) == 0) { + y += structure.random.nextInt(3) - 1; + } - z += structure.random.nextInt(3) - 1 + zTendency; + z += structure.random.nextInt(3) - 1 + zTendency; - for (int x1 = x; x1 < x + structure.random.nextInt(4) + 3 * (isFlat ? 3 : 1); ++x1) - { - for (int y1 = y; y1 < y + structure.random.nextInt(1) + 2; ++y1) - { - for (int z1 = z; z1 < z + structure.random.nextInt(4) + 3 * (isFlat ? 3 : 1); ++z1) - { - if (structure.getBlockState(x1, y1, z1).getMaterial() == Material.air) - { - if (Math.abs(x1 - x) + Math.abs(y1 - y) + Math.abs(z1 - z) < 4 * (isFlat ? 3 : 1) + structure.random.nextInt(2)) - { - structure.setBlockWithOffset(x1, y1, z1, block, meta); - } - } - } - } - } - } + for (int x1 = x; x1 < x + structure.random.nextInt(4) + 3 * (isFlat ? 3 : 1); ++x1) { + for (int y1 = y; y1 < y + structure.random.nextInt(1) + 2; ++y1) { + for (int z1 = z; z1 < z + structure.random.nextInt(4) + 3 * (isFlat ? 3 : 1); ++z1) { + if (structure.getBlockState(x1, y1, z1).getMaterial() == Material.air) { + if (Math.abs(x1 - x) + Math.abs(y1 - y) + Math.abs(z1 - z) < 4 * (isFlat ? 3 : 1) + structure.random.nextInt(2)) { + structure.setBlockWithOffset(x1, y1, z1, block, meta); + } + } + } + } + } + } } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/gen/AetherStructure.java b/src/main/java/com/legacy/aether/world/gen/AetherStructure.java index d6ab0c1..0e4fb3e 100644 --- a/src/main/java/com/legacy/aether/world/gen/AetherStructure.java +++ b/src/main/java/com/legacy/aether/world/gen/AetherStructure.java @@ -12,375 +12,304 @@ import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; -public abstract class AetherStructure extends StructureComponent -{ +public abstract class AetherStructure extends StructureComponent { - public int chance; + public int chance; - public Block airState = Blocks.air, blockState, extraBlockState; + public Block airState = Blocks.air, blockState, extraBlockState; - public int meta, extraMeta; + public int meta, extraMeta; - public boolean replaceAir, replaceSolid; + public boolean replaceAir, replaceSolid; public Random random; - public World worldObj; + public World worldObj; - public StructureBoundingBox dungeonBoundingBox; + public StructureBoundingBox dungeonBoundingBox; - private int startX, startY, startZ; + private int startX, startY, startZ; - public void setBlocks(Block blockState, int meta) - { - this.blockState = blockState; - this.meta = 0; - this.extraBlockState = null; - this.extraMeta = 0; - this.chance = 0; - } + public void setBlocks(Block blockState, int meta) { + this.blockState = blockState; + this.meta = 0; + this.extraBlockState = null; + this.extraMeta = 0; + this.chance = 0; + } - public void setBlocks(Block blockState) - { - this.blockState = blockState; - this.extraBlockState = null; - this.chance = 0; - } + public void setBlocks(Block blockState) { + this.blockState = blockState; + this.extraBlockState = null; + this.chance = 0; + } - public void setBlocks(Block blockState, int meta, Block extraBlockState, int extraMeta, int chance) - { - this.blockState = blockState; - this.meta = meta; - this.extraBlockState = extraBlockState; - this.extraMeta = extraMeta; - this.chance = chance; + public void setBlocks(Block blockState, int meta, Block extraBlockState, int extraMeta, int chance) { + this.blockState = blockState; + this.meta = meta; + this.extraBlockState = extraBlockState; + this.extraMeta = extraMeta; + this.chance = chance; - if (this.chance < 1) - { - this.chance = 1; - } - } + if (this.chance < 1) { + this.chance = 1; + } + } - public void setBlocks(Block blockState, Block extraBlockState, int chance) - { - this.blockState = blockState; - this.meta = 0; - this.extraBlockState = extraBlockState; - this.extraMeta = 0; - this.chance = chance; + public void setBlocks(Block blockState, Block extraBlockState, int chance) { + this.blockState = blockState; + this.meta = 0; + this.extraBlockState = extraBlockState; + this.extraMeta = 0; + this.chance = chance; - if (this.chance < 1) - { - this.chance = 1; - } - } + if (this.chance < 1) { + this.chance = 1; + } + } - public void setStructureOffset(int x, int y, int z) - { - this.startX = x; - this.startY = y; - this.startZ = z; - } + public void setStructureOffset(int x, int y, int z) { + this.startX = x; + this.startY = y; + this.startZ = z; + } - public void addLineX(int x, int y, int z, int xRange) - { - for (int lineX = x; lineX < x + xRange; lineX++) - { - Block block = this.getBlockState(lineX + this.startX, y + this.startY, z + this.startZ); + public void addLineX(int x, int y, int z, int xRange) { + for (int lineX = x; lineX < x + xRange; lineX++) { + Block block = this.getBlockState(lineX + this.startX, y + this.startY, z + this.startZ); - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - this.setBlock(lineX + this.startX, y + this.startY, z + this.startZ); - } - } - } + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + this.setBlock(lineX + this.startX, y + this.startY, z + this.startZ); + } + } + } - public void addLineY(int x, int y, int z, int yRange) - { - for (int lineY = y; lineY < y + yRange; lineY++) - { - Block block = this.getBlockState(x + this.startX, lineY + this.startY, z + this.startZ); + public void addLineY(int x, int y, int z, int yRange) { + for (int lineY = y; lineY < y + yRange; lineY++) { + Block block = this.getBlockState(x + this.startX, lineY + this.startY, z + this.startZ); - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - this.setBlock(x + this.startX, lineY + this.startY, z + this.startZ); - } - } - } + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + this.setBlock(x + this.startX, lineY + this.startY, z + this.startZ); + } + } + } - public void addLineZ(int x, int y, int z, int zRange) - { - for (int lineZ = z; lineZ < z + zRange; lineZ++) - { - Block block = this.getBlockState(x + this.startX, y + this.startY, lineZ + this.startZ); + public void addLineZ(int x, int y, int z, int zRange) { + for (int lineZ = z; lineZ < z + zRange; lineZ++) { + Block block = this.getBlockState(x + this.startX, y + this.startY, lineZ + this.startZ); - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - this.setBlock(x + this.startX, y + this.startY, lineZ + this.startZ); - } - } - } + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + this.setBlock(x + this.startX, y + this.startY, lineZ + this.startZ); + } + } + } - public void addPlaneX(int x, int y, int z, int yRange, int zRange) - { - for (int lineY = y; lineY < y + yRange; lineY++) - { - for (int lineZ = z; lineZ < z + zRange; lineZ++) - { - Block block = this.getBlockState(x + this.startX, lineY + this.startY, lineZ + this.startZ); + public void addPlaneX(int x, int y, int z, int yRange, int zRange) { + for (int lineY = y; lineY < y + yRange; lineY++) { + for (int lineZ = z; lineZ < z + zRange; lineZ++) { + Block block = this.getBlockState(x + this.startX, lineY + this.startY, lineZ + this.startZ); - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - this.setBlock(x + this.startX, lineY + this.startY, lineZ + this.startZ); - } - } - } - } + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + this.setBlock(x + this.startX, lineY + this.startY, lineZ + this.startZ); + } + } + } + } - public void addPlaneY(int x, int y, int z, int xRange, int zRange) - { - for (int lineX = x; lineX < x + xRange; lineX++) - { - for (int lineZ = z; lineZ < z + zRange; lineZ++) - { - Block block = this.getBlockState(lineX + this.startX, y + this.startY, lineZ + this.startZ); + public void addPlaneY(int x, int y, int z, int xRange, int zRange) { + for (int lineX = x; lineX < x + xRange; lineX++) { + for (int lineZ = z; lineZ < z + zRange; lineZ++) { + Block block = this.getBlockState(lineX + this.startX, y + this.startY, lineZ + this.startZ); - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - this.setBlock(lineX + this.startX, y + this.startY, lineZ + this.startZ); - } - } - } - } + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + this.setBlock(lineX + this.startX, y + this.startY, lineZ + this.startZ); + } + } + } + } - public void addPlaneZ(int x, int y, int z, int xRange, int yRange) - { - for (int lineX = x; lineX < x + xRange; lineX++) - { - for (int lineY = y; lineY < y + yRange; lineY++) - { - Block block = this.getBlockState(lineX + this.startX, lineY + this.startY, z + this.startZ); + public void addPlaneZ(int x, int y, int z, int xRange, int yRange) { + for (int lineX = x; lineX < x + xRange; lineX++) { + for (int lineY = y; lineY < y + yRange; lineY++) { + Block block = this.getBlockState(lineX + this.startX, lineY + this.startY, z + this.startZ); - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - this.setBlock(lineX + this.startX, lineY + this.startY, z + this.startZ); - } - } - } - } + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + this.setBlock(lineX + this.startX, lineY + this.startY, z + this.startZ); + } + } + } + } - public void addHollowBox(int x, int y, int z, int xRange, int yRange, int zRange) - { - Block temp1 = this.blockState; - Block temp2 = this.extraBlockState; + public void addHollowBox(int x, int y, int z, int xRange, int yRange, int zRange) { + Block temp1 = this.blockState; + Block temp2 = this.extraBlockState; - this.setBlocks(this.airState, this.airState, this.chance); - this.addSolidBox(x, y, z, xRange, yRange, zRange); - this.setBlocks(temp1, temp2, this.chance); - this.addPlaneY(x, y, z, xRange, zRange); - this.addPlaneY(x, y + (yRange - 1), z, xRange, zRange); - this.addPlaneX(x, y, z, yRange, zRange); - this.addPlaneX(x + (xRange - 1), y, z, yRange, zRange); - this.addPlaneZ(x, y, z, xRange, yRange); - this.addPlaneZ(x, y, z + (zRange - 1), xRange, yRange); - } + this.setBlocks(this.airState, this.airState, this.chance); + this.addSolidBox(x, y, z, xRange, yRange, zRange); + this.setBlocks(temp1, temp2, this.chance); + this.addPlaneY(x, y, z, xRange, zRange); + this.addPlaneY(x, y + (yRange - 1), z, xRange, zRange); + this.addPlaneX(x, y, z, yRange, zRange); + this.addPlaneX(x + (xRange - 1), y, z, yRange, zRange); + this.addPlaneZ(x, y, z, xRange, yRange); + this.addPlaneZ(x, y, z + (zRange - 1), xRange, yRange); + } - public void addSquareTube(int x, int y, int z, int xRange, int yRange, int zRange, int angel) - { - Block temp1 = this.blockState; - Block temp2 = this.extraBlockState; + public void addSquareTube(int x, int y, int z, int xRange, int yRange, int zRange, int angel) { + Block temp1 = this.blockState; + Block temp2 = this.extraBlockState; - this.setBlocks(this.airState, this.airState, this.chance); - this.addSolidBox(x, y, z, xRange, yRange, zRange); - this.setBlocks(temp1, temp2, this.chance); + this.setBlocks(this.airState, this.airState, this.chance); + this.addSolidBox(x, y, z, xRange, yRange, zRange); + this.setBlocks(temp1, temp2, this.chance); - if (angel == 0 || angel == 2) - { - this.addPlaneY(x, y, z, xRange, zRange); - this.addPlaneY(x, y + (yRange - 1), z, xRange, zRange); - } + if (angel == 0 || angel == 2) { + this.addPlaneY(x, y, z, xRange, zRange); + this.addPlaneY(x, y + (yRange - 1), z, xRange, zRange); + } - if (angel == 1 || angel == 2) - { - this.addPlaneX(x, y, z, yRange, zRange); - this.addPlaneX(x + (xRange - 1), y, z, yRange, zRange); - } + if (angel == 1 || angel == 2) { + this.addPlaneX(x, y, z, yRange, zRange); + this.addPlaneX(x + (xRange - 1), y, z, yRange, zRange); + } - if (angel == 0 || angel == 1) - { - this.addPlaneZ(x, y, z, xRange, yRange); - this.addPlaneZ(x, y, z + (zRange - 1), xRange, yRange); - } - } + if (angel == 0 || angel == 1) { + this.addPlaneZ(x, y, z, xRange, yRange); + this.addPlaneZ(x, y, z + (zRange - 1), xRange, yRange); + } + } - public void addSolidBox(int x, int y, int z, int xRange, int yRange, int zRange) - { - for (int lineX = x; lineX < x + xRange; lineX++) - { - for (int lineY = y; lineY < y + yRange; lineY++) - { - for (int lineZ = z; lineZ < z + zRange; lineZ++) - { - Block block = this.getBlockState(lineX + this.startX, lineY + this.startY, lineZ + this.startZ); + public void addSolidBox(int x, int y, int z, int xRange, int yRange, int zRange) { + for (int lineX = x; lineX < x + xRange; lineX++) { + for (int lineY = y; lineY < y + yRange; lineY++) { + for (int lineZ = z; lineZ < z + zRange; lineZ++) { + Block block = this.getBlockState(lineX + this.startX, lineY + this.startY, lineZ + this.startZ); - if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) - { - this.setBlock(lineX + this.startX, lineY + this.startY, lineZ + this.startZ); - } - } - } - } - } + if ((this.replaceAir || block != Blocks.air) && (this.replaceSolid || block == Blocks.air)) { + this.setBlock(lineX + this.startX, lineY + this.startY, lineZ + this.startZ); + } + } + } + } + } - public boolean isBoxSolid(int x, int y, int z, int xRange, int yRange, int zRange) - { - boolean flag = true; + public boolean isBoxSolid(int x, int y, int z, int xRange, int yRange, int zRange) { + boolean flag = true; - for (int lineX = x; lineX < x + xRange; lineX++) - { - for (int lineY = y; lineY < y + yRange; lineY++) - { - for (int lineZ = z; lineZ < z + zRange; lineZ++) - { - if (this.getBlockState(lineX + this.startX, lineY + this.startY, lineZ + this.startZ) == Blocks.air) - { - flag = false; - } - } - } - } + for (int lineX = x; lineX < x + xRange; lineX++) { + for (int lineY = y; lineY < y + yRange; lineY++) { + for (int lineZ = z; lineZ < z + zRange; lineZ++) { + if (this.getBlockState(lineX + this.startX, lineY + this.startY, lineZ + this.startZ) == Blocks.air) { + flag = false; + } + } + } + } - return flag; - } + return flag; + } - public boolean isBoxEmpty(int x, int y, int z, int xRange, int yRange, int zRange) - { - boolean flag = true; + public boolean isBoxEmpty(int x, int y, int z, int xRange, int yRange, int zRange) { + boolean flag = true; - for (int lineX = x; lineX < x + xRange; lineX++) - { - for (int lineY = y; lineY < y + yRange; lineY++) - { - for (int lineZ = z; lineZ < z + zRange; lineZ++) - { - if (this.getBlockState(lineX + this.startX, lineY + this.startY, lineZ + this.startZ) != Blocks.air) - { - flag = false; - } - } - } - } + for (int lineX = x; lineX < x + xRange; lineX++) { + for (int lineY = y; lineY < y + yRange; lineY++) { + for (int lineZ = z; lineZ < z + zRange; lineZ++) { + if (this.getBlockState(lineX + this.startX, lineY + this.startY, lineZ + this.startZ) != Blocks.air) { + flag = false; + } + } + } + } - return flag; - } + return flag; + } - public TileEntity getTileEntityFromPosWithOffset(int x, int y, int z) - { - return !this.dungeonBoundingBox.isVecInside(this.getActualX(x, z), this.getActualY(y), this.getActualZ(x, z)) ? null : this.worldObj.getTileEntity(this.getActualX(x, z), this.getActualY(y), this.getActualZ(x, z)); - } + public TileEntity getTileEntityFromPosWithOffset(int x, int y, int z) { + return !this.dungeonBoundingBox.isVecInside(this.getActualX(x, z), this.getActualY(y), this.getActualZ(x, z)) ? null : this.worldObj.getTileEntity(this.getActualX(x, z), this.getActualY(y), this.getActualZ(x, z)); + } - public Block getBlockStateWithOffset(int x, int y, int z) - { - return this.getBlockAtCurrentPosition(this.worldObj, x + this.startX, y + this.startY, z + this.startZ, this.dungeonBoundingBox); - } + public Block getBlockStateWithOffset(int x, int y, int z) { + return this.getBlockAtCurrentPosition(this.worldObj, x + this.startX, y + this.startY, z + this.startZ, this.dungeonBoundingBox); + } - public Block getBlockState(int x, int y, int z) - { - return this.getBlockAtCurrentPosition(this.worldObj, x, y, z, this.dungeonBoundingBox); - } + public Block getBlockState(int x, int y, int z) { + return this.getBlockAtCurrentPosition(this.worldObj, x, y, z, this.dungeonBoundingBox); + } - public void setBlockWithOffset(int x, int y, int z, Block state, int meta) - { + public void setBlockWithOffset(int x, int y, int z, Block state, int meta) { this.placeBlockAtCurrentPosition(this.worldObj, state, meta, x + this.startX, y + this.startY, z + this.startZ, this.dungeonBoundingBox); } - public void setBlock(int x, int y, int z, Block state, int meta) - { + public void setBlock(int x, int y, int z, Block state, int meta) { this.placeBlockAtCurrentPosition(this.worldObj, state, meta, x, y, z, this.dungeonBoundingBox); } - public void setBlockWithOffset(int x, int y, int z) - { - if (this.chance == 0) - { + public void setBlockWithOffset(int x, int y, int z) { + if (this.chance == 0) { this.setBlock(x + this.startX, y + this.startY, z + this.startZ, this.blockState, this.meta); return; } - if(this.random.nextInt(this.chance) == 0) - { + if (this.random.nextInt(this.chance) == 0) { this.placeBlockAtCurrentPosition(this.worldObj, this.extraBlockState, this.extraMeta, x + this.startX, y + this.startY, z + this.startZ, this.dungeonBoundingBox); - } - else - { + } else { this.placeBlockAtCurrentPosition(this.worldObj, this.blockState, this.meta, x + this.startX, y + this.startY, z + this.startZ, this.dungeonBoundingBox); } } - public void setBlock(int x, int y, int z) - { - if (this.chance == 0) - { + public void setBlock(int x, int y, int z) { + if (this.chance == 0) { this.setBlock(x, y, z, this.blockState, this.meta); return; } - if(this.random.nextInt(this.chance) == 0) - { + if (this.random.nextInt(this.chance) == 0) { this.placeBlockAtCurrentPosition(this.worldObj, this.extraBlockState, this.extraMeta, x, y, z, this.dungeonBoundingBox); - } - else - { + } else { this.placeBlockAtCurrentPosition(this.worldObj, this.blockState, this.meta, x, y, z, this.dungeonBoundingBox); } } - public boolean spawnEntity(Entity entity, int structureX, int structureY, int structureZ) - { - int posX = this.getActualX(structureX, structureZ); - int posY = this.getActualY(structureY); - int posZ = this.getActualZ(structureX, structureZ); + public boolean spawnEntity(Entity entity, int structureX, int structureY, int structureZ) { + int posX = this.getActualX(structureX, structureZ); + int posY = this.getActualY(structureY); + int posZ = this.getActualZ(structureX, structureZ); - if (this.dungeonBoundingBox.isVecInside(posX, posY, posZ)) - { - entity.setLocationAndAngles((double)posX + 0.5D, (double)posY + 0.5D, (double)posZ + 0.5D, 0.0F, 0.0F); + if (this.dungeonBoundingBox.isVecInside(posX, posY, posZ)) { + entity.setLocationAndAngles((double) posX + 0.5D, (double) posY + 0.5D, (double) posZ + 0.5D, 0.0F, 0.0F); - if (entity instanceof EntityLivingBase) - { - EntityLivingBase livingEntity = ((EntityLivingBase)entity); + if (entity instanceof EntityLivingBase) { + EntityLivingBase livingEntity = ((EntityLivingBase) entity); - livingEntity.heal(livingEntity.getMaxHealth()); - } + livingEntity.heal(livingEntity.getMaxHealth()); + } - if (!this.worldObj.isRemote) //Not taking chances ~Kino - { - this.worldObj.spawnEntityInWorld(entity); - } + if (!this.worldObj.isRemote) //Not taking chances ~Kino + { + this.worldObj.spawnEntityInWorld(entity); + } - return true; - } + return true; + } - return false; - } + return false; + } - public int getActualX(int structureX, int structureZ) - { - return this.getXWithOffset(structureX + this.startX, structureZ + this.startZ); - } + public int getActualX(int structureX, int structureZ) { + return this.getXWithOffset(structureX + this.startX, structureZ + this.startZ); + } - public int getActualY(int structureY) - { - return this.getYWithOffset(structureY + this.startY); - } + public int getActualY(int structureY) { + return this.getYWithOffset(structureY + this.startY); + } - public int getActualZ(int structureX, int structureZ) - { - return this.getZWithOffset(structureX + this.startX, structureZ + this.startZ); - } + public int getActualZ(int structureX, int structureZ) { + return this.getZWithOffset(structureX + this.startX, structureZ + this.startZ); + } @Override - public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) - { + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { this.worldObj = worldIn; this.random = randomIn; this.dungeonBoundingBox = structureBoundingBoxIn; @@ -391,14 +320,12 @@ public abstract class AetherStructure extends StructureComponent public abstract boolean generate(); @Override - protected void func_143012_a(NBTTagCompound tagCompound) - { + protected void func_143012_a(NBTTagCompound tagCompound) { } @Override - protected void func_143011_b(NBTTagCompound tagCompound) - { + protected void func_143011_b(NBTTagCompound tagCompound) { } diff --git a/src/main/java/com/legacy/aether/world/gen/MapGenGoldenDungeon.java b/src/main/java/com/legacy/aether/world/gen/MapGenGoldenDungeon.java index 345300b..e50e490 100644 --- a/src/main/java/com/legacy/aether/world/gen/MapGenGoldenDungeon.java +++ b/src/main/java/com/legacy/aether/world/gen/MapGenGoldenDungeon.java @@ -12,113 +12,96 @@ import com.legacy.aether.world.gen.components.ComponentGoldenDungeon; import com.legacy.aether.world.gen.components.ComponentGoldenIsland; import com.legacy.aether.world.gen.components.ComponentGoldenIslandStub; -public class MapGenGoldenDungeon extends MapGenStructure -{ +public class MapGenGoldenDungeon extends MapGenStructure { - public MapGenGoldenDungeon() - { - } + public MapGenGoldenDungeon() { + } @Override - public String func_143025_a() - { + public String func_143025_a() { return "aether_legacy:golden_dungeon"; } @Override - protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) - { - int i = chunkX >> 4; - int j = chunkZ >> 4; - this.rand.setSeed((long)(i ^ j << 4) ^ this.worldObj.getSeed()); + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) { + int i = chunkX >> 4; + int j = chunkZ >> 4; + this.rand.setSeed((long) (i ^ j << 4) ^ this.worldObj.getSeed()); - if (this.rand.nextInt(6) != 0) - { - return false; - } - else if (chunkX != (i << 4) + 4 + this.rand.nextInt(8)) - { - return false; - } - else - { - return chunkZ == (j << 4) + 4 + this.rand.nextInt(8); - } - } + if (this.rand.nextInt(6) != 0) { + return false; + } else if (chunkX != (i << 4) + 4 + this.rand.nextInt(8)) { + return false; + } else { + return chunkZ == (j << 4) + 4 + this.rand.nextInt(8); + } + } @Override - protected StructureStart getStructureStart(int chunkX, int chunkZ) - { + protected StructureStart getStructureStart(int chunkX, int chunkZ) { return new Start(this.worldObj, this.rand, chunkX, chunkZ); } - public static class Start extends StructureStart - { - private int dungeonDirection; - private int stubIslandCount; + public static class Start extends StructureStart { + private int dungeonDirection; + private int stubIslandCount; - public Start() - { - } + public Start() { + } - public Start(World worldIn, Random random, int chunkX, int chunkZ) - { - super(chunkX, chunkZ); - this.create(worldIn, random, chunkX, chunkZ); - } + public Start(World worldIn, Random random, int chunkX, int chunkZ) { + super(chunkX, chunkZ); + this.create(worldIn, random, chunkX, chunkZ); + } - @SuppressWarnings("unchecked") - private void create(World worldIn, Random random, int chunkX, int chunkZ) - { - random.setSeed(worldIn.getSeed()); - long i = random.nextLong(); - long j = random.nextLong(); - long k = (long)chunkX * i; - long l = (long)chunkZ * j; - random.setSeed(k ^ l ^ worldIn.getSeed()); + @SuppressWarnings("unchecked") + private void create(World worldIn, Random random, int chunkX, int chunkZ) { + random.setSeed(worldIn.getSeed()); + long i = random.nextLong(); + long j = random.nextLong(); + long k = (long) chunkX * i; + long l = (long) chunkZ * j; + random.setSeed(k ^ l ^ worldIn.getSeed()); - ComponentGoldenIsland dungeon = new ComponentGoldenIsland((chunkX << 4) + 2, (chunkZ << 4) + 2); + ComponentGoldenIsland dungeon = new ComponentGoldenIsland((chunkX << 4) + 2, (chunkZ << 4) + 2); - this.dungeonDirection = random.nextInt(4); - this.stubIslandCount = 8 + random.nextInt(5); + this.dungeonDirection = random.nextInt(4); + this.stubIslandCount = 8 + random.nextInt(5); - this.components.add(dungeon); + this.components.add(dungeon); - for (int stubIslands = 0; stubIslands < this.stubIslandCount; ++stubIslands) - { - float f1 = 0.01745329F; - float f2 = random.nextFloat() * 360F; - float f3 = ((random.nextFloat() * 0.125F) + 0.7F) * 24.0F; - int l4 = MathHelper.floor_double(Math.cos(f1 * f2) * (double)f3); - int k5 = -MathHelper.floor_double(24.0D * (double)random.nextFloat() * 0.29999999999999999D); - int i6 = MathHelper.floor_double(-Math.sin(f1 * f2) * (double)f3); + for (int stubIslands = 0; stubIslands < this.stubIslandCount; ++stubIslands) { + float f1 = 0.01745329F; + float f2 = random.nextFloat() * 360F; + float f3 = ((random.nextFloat() * 0.125F) + 0.7F) * 24.0F; + int l4 = MathHelper.floor_double(Math.cos(f1 * f2) * (double) f3); + int k5 = -MathHelper.floor_double(24.0D * (double) random.nextFloat() * 0.29999999999999999D); + int i6 = MathHelper.floor_double(-Math.sin(f1 * f2) * (double) f3); - this.components.add(new ComponentGoldenIslandStub((chunkX << 4) + 2, (chunkZ << 4) + 2, l4, k5, i6, 8)); - } + this.components.add(new ComponentGoldenIslandStub((chunkX << 4) + 2, (chunkZ << 4) + 2, l4, k5, i6, 8)); + } - this.components.add(new ComponentGoldenDungeon((chunkX << 4) + 2, (chunkZ << 4) + 2, this.dungeonDirection)); + this.components.add(new ComponentGoldenDungeon((chunkX << 4) + 2, (chunkZ << 4) + 2, this.dungeonDirection)); - this.updateBoundingBox(); - } + this.updateBoundingBox(); + } - @Override - public void func_143022_a(NBTTagCompound tagCompound) - { - super.func_143022_a(tagCompound); + @Override + public void func_143022_a(NBTTagCompound tagCompound) { + super.func_143022_a(tagCompound); - tagCompound.setInteger("stubIslandCount", this.stubIslandCount); - tagCompound.setInteger("dungeonDirection", this.dungeonDirection); - } + tagCompound.setInteger("stubIslandCount", this.stubIslandCount); + tagCompound.setInteger("dungeonDirection", this.dungeonDirection); + } - @Override - public void func_143017_b(NBTTagCompound tagCompound) - { - super.func_143017_b(tagCompound); + @Override + public void func_143017_b(NBTTagCompound tagCompound) { + super.func_143017_b(tagCompound); - this.stubIslandCount = tagCompound.getInteger("stubIslandCount"); - this.dungeonDirection = tagCompound.getInteger("dungeonDirection"); - } + this.stubIslandCount = tagCompound.getInteger("stubIslandCount"); + this.dungeonDirection = tagCompound.getInteger("dungeonDirection"); + } - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/gen/MapGenLargeColdAercloud.java b/src/main/java/com/legacy/aether/world/gen/MapGenLargeColdAercloud.java index 8d2ad13..f7349e1 100644 --- a/src/main/java/com/legacy/aether/world/gen/MapGenLargeColdAercloud.java +++ b/src/main/java/com/legacy/aether/world/gen/MapGenLargeColdAercloud.java @@ -8,54 +8,45 @@ import net.minecraft.world.gen.structure.StructureStart; import com.legacy.aether.world.gen.components.ComponentLargeColdAercloud; -public class MapGenLargeColdAercloud extends MapGenStructure -{ +public class MapGenLargeColdAercloud extends MapGenStructure { - public MapGenLargeColdAercloud() - { + public MapGenLargeColdAercloud() { - } + } @Override - public String func_143025_a() - { + public String func_143025_a() { return "aether_legacy:cold_aercloud"; } @Override - protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) - { + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) { return this.rand.nextInt(50) == 0; - } + } @Override - protected StructureStart getStructureStart(int chunkX, int chunkZ) - { + protected StructureStart getStructureStart(int chunkX, int chunkZ) { return new Start(this.worldObj, this.rand, chunkX, chunkZ); } - public static class Start extends StructureStart - { - public Start() - { + public static class Start extends StructureStart { + public Start() { - } + } - public Start(World worldIn, Random random, int chunkX, int chunkZ) - { - super(chunkX, chunkZ); + public Start(World worldIn, Random random, int chunkX, int chunkZ) { + super(chunkX, chunkZ); - this.create(worldIn, random, chunkX, chunkZ); - } + this.create(worldIn, random, chunkX, chunkZ); + } - @SuppressWarnings("unchecked") - private void create(World worldIn, Random random, int chunkX, int chunkZ) - { - this.components.add(new ComponentLargeColdAercloud(random, (chunkX << 4) + 2, 0, (chunkZ << 4) + 2)); + @SuppressWarnings("unchecked") + private void create(World worldIn, Random random, int chunkX, int chunkZ) { + this.components.add(new ComponentLargeColdAercloud(random, (chunkX << 4) + 2, 0, (chunkZ << 4) + 2)); - this.updateBoundingBox(); - } + this.updateBoundingBox(); + } - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/gen/MapGenQuicksoil.java b/src/main/java/com/legacy/aether/world/gen/MapGenQuicksoil.java index 81b4915..61d9a01 100644 --- a/src/main/java/com/legacy/aether/world/gen/MapGenQuicksoil.java +++ b/src/main/java/com/legacy/aether/world/gen/MapGenQuicksoil.java @@ -8,24 +8,17 @@ import net.minecraft.world.gen.MapGenBase; import com.legacy.aether.blocks.BlocksAether; -public class MapGenQuicksoil extends MapGenBase -{ +public class MapGenQuicksoil extends MapGenBase { @Override - public void func_151539_a(IChunkProvider provider, World p_151539_2_, int p_151539_3_, int p_151539_4_, Block[] blocks) - { - if (this.rand.nextInt(10) == 0) - { - for (int x = 3; x < 12; x++) - { - for (int z = 3; z < 12; z++) - { - for (int n = 3; n < 48; n++) - { - int pos = (z * 16 + x) * 128 + n; + public void func_151539_a(IChunkProvider provider, World p_151539_2_, int p_151539_3_, int p_151539_4_, Block[] blocks) { + if (this.rand.nextInt(10) == 0) { + for (int x = 3; x < 12; x++) { + for (int z = 3; z < 12; z++) { + for (int n = 3; n < 48; n++) { + int pos = (z * 16 + x) * 128 + n; - if (blocks[pos] == Blocks.air && blocks[(z * 16 + x) * 128 + (n + 1)] == BlocksAether.aether_grass && blocks[(z * 16 + x) * 128 + (n + 2)] == Blocks.air) - { + if (blocks[pos] == Blocks.air && blocks[(z * 16 + x) * 128 + (n + 1)] == BlocksAether.aether_grass && blocks[(z * 16 + x) * 128 + (n + 2)] == Blocks.air) { this.generate(blocks, x, n, z); n += 128; } @@ -33,22 +26,18 @@ public class MapGenQuicksoil extends MapGenBase } } } - } + } - private void generate(Block[] blocks, int posX, int posY, int posZ) - { - for(int x = posX - 3; x < posX + 4; x++) - { - for(int z = posZ - 3; z < posZ + 4; z++) - { + private void generate(Block[] blocks, int posX, int posY, int posZ) { + for (int x = posX - 3; x < posX + 4; x++) { + for (int z = posZ - 3; z < posZ + 4; z++) { int position = (z * 16 + x) * 128 + posY; - if(blocks[position] == Blocks.air && ((x - posX) * (x - posX) + (z - posZ) * (z - posZ)) < 12) - { + if (blocks[position] == Blocks.air && ((x - posX) * (x - posX) + (z - posZ) * (z - posZ)) < 12) { blocks[position] = BlocksAether.quicksoil; } } } - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/gen/MapGenSilverDungeon.java b/src/main/java/com/legacy/aether/world/gen/MapGenSilverDungeon.java index 09e5888..96eff40 100644 --- a/src/main/java/com/legacy/aether/world/gen/MapGenSilverDungeon.java +++ b/src/main/java/com/legacy/aether/world/gen/MapGenSilverDungeon.java @@ -9,112 +9,96 @@ import net.minecraft.world.gen.structure.StructureStart; import com.legacy.aether.world.gen.components.ComponentSilverDungeon; -public class MapGenSilverDungeon extends MapGenStructure -{ +public class MapGenSilverDungeon extends MapGenStructure { - public MapGenSilverDungeon() - { - } + public MapGenSilverDungeon() { + } @Override - public String func_143025_a() - { + public String func_143025_a() { return "aether_legacy:silver_dungeon"; } @Override - protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) - { - int i = chunkX >> 4; - int j = chunkZ >> 4; - this.rand.setSeed((long)(i ^ j << 4) ^ this.worldObj.getSeed()); - this.rand.nextInt(); + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) { + int i = chunkX >> 4; + int j = chunkZ >> 4; + this.rand.setSeed((long) (i ^ j << 4) ^ this.worldObj.getSeed()); + this.rand.nextInt(); - if (this.rand.nextInt(4) != 0) - { - return false; - } - else if (chunkX != (i << 4) + 4 + this.rand.nextInt(8)) - { - return false; - } - else - { - return chunkZ == (j << 4) + 4 + this.rand.nextInt(8); - } - } + if (this.rand.nextInt(4) != 0) { + return false; + } else if (chunkX != (i << 4) + 4 + this.rand.nextInt(8)) { + return false; + } else { + return chunkZ == (j << 4) + 4 + this.rand.nextInt(8); + } + } @Override - protected StructureStart getStructureStart(int chunkX, int chunkZ) - { + protected StructureStart getStructureStart(int chunkX, int chunkZ) { return new Start(this.worldObj, this.rand, chunkX, chunkZ); } - public static class Start extends StructureStart - { - private int firstStaircaseZ, secondStaircaseZ, finalStaircaseZ; - private int xTendency, zTendency; + public static class Start extends StructureStart { + private int firstStaircaseZ, secondStaircaseZ, finalStaircaseZ; + private int xTendency, zTendency; - public Start() - { - } + public Start() { + } - public Start(World worldIn, Random random, int chunkX, int chunkZ) - { - super(chunkX, chunkZ); - this.create(worldIn, random, chunkX, chunkZ); - } + public Start(World worldIn, Random random, int chunkX, int chunkZ) { + super(chunkX, chunkZ); + this.create(worldIn, random, chunkX, chunkZ); + } - @SuppressWarnings("unchecked") - private void create(World worldIn, Random random, int chunkX, int chunkZ) - { - random.setSeed(worldIn.getSeed()); - long i = random.nextLong(); - long j = random.nextLong(); - long k = (long)chunkX * i; - long l = (long)chunkZ * j; - random.setSeed(k ^ l ^ worldIn.getSeed()); + @SuppressWarnings("unchecked") + private void create(World worldIn, Random random, int chunkX, int chunkZ) { + random.setSeed(worldIn.getSeed()); + long i = random.nextLong(); + long j = random.nextLong(); + long k = (long) chunkX * i; + long l = (long) chunkZ * j; + random.setSeed(k ^ l ^ worldIn.getSeed()); - ComponentSilverDungeon dungeon = new ComponentSilverDungeon((chunkX << 4) + 2, (chunkZ << 4) + 2); + ComponentSilverDungeon dungeon = new ComponentSilverDungeon((chunkX << 4) + 2, (chunkZ << 4) + 2); - this.firstStaircaseZ = random.nextInt(3); - this.secondStaircaseZ = random.nextInt(3); - this.finalStaircaseZ = random.nextInt(3); + this.firstStaircaseZ = random.nextInt(3); + this.secondStaircaseZ = random.nextInt(3); + this.finalStaircaseZ = random.nextInt(3); - this.xTendency = random.nextInt(3) - 1; - this.zTendency = random.nextInt(3) - 1; + this.xTendency = random.nextInt(3) - 1; + this.zTendency = random.nextInt(3) - 1; - dungeon.setStaircasePosition(this.firstStaircaseZ, this.secondStaircaseZ, this.finalStaircaseZ); - dungeon.setCloudTendencies(this.xTendency, this.zTendency); + dungeon.setStaircasePosition(this.firstStaircaseZ, this.secondStaircaseZ, this.finalStaircaseZ); + dungeon.setCloudTendencies(this.xTendency, this.zTendency); - this.components.add(dungeon); - this.updateBoundingBox(); - } + this.components.add(dungeon); + this.updateBoundingBox(); + } - @Override - public void func_143022_a(NBTTagCompound tagCompound) - { - super.func_143022_a(tagCompound); + @Override + public void func_143022_a(NBTTagCompound tagCompound) { + super.func_143022_a(tagCompound); - tagCompound.setInteger("firstStaircaseZ", this.firstStaircaseZ); - tagCompound.setInteger("secondStaircaseZ", this.secondStaircaseZ); - tagCompound.setInteger("finalStaircaseZ", this.finalStaircaseZ); - tagCompound.setInteger("xTendency", this.xTendency); - tagCompound.setInteger("zTendency", this.zTendency); - } + tagCompound.setInteger("firstStaircaseZ", this.firstStaircaseZ); + tagCompound.setInteger("secondStaircaseZ", this.secondStaircaseZ); + tagCompound.setInteger("finalStaircaseZ", this.finalStaircaseZ); + tagCompound.setInteger("xTendency", this.xTendency); + tagCompound.setInteger("zTendency", this.zTendency); + } - @Override - public void func_143017_b(NBTTagCompound tagCompound) - { - super.func_143017_b(tagCompound); + @Override + public void func_143017_b(NBTTagCompound tagCompound) { + super.func_143017_b(tagCompound); - this.firstStaircaseZ = tagCompound.getInteger("firstStaircaseZ"); - this.secondStaircaseZ = tagCompound.getInteger("secondStaircaseZ"); - this.finalStaircaseZ = tagCompound.getInteger("finalStaircaseZ"); - this.xTendency = tagCompound.getInteger("zTendency"); - this.zTendency = tagCompound.getInteger("zTendency"); - } + this.firstStaircaseZ = tagCompound.getInteger("firstStaircaseZ"); + this.secondStaircaseZ = tagCompound.getInteger("secondStaircaseZ"); + this.finalStaircaseZ = tagCompound.getInteger("finalStaircaseZ"); + this.xTendency = tagCompound.getInteger("zTendency"); + this.zTendency = tagCompound.getInteger("zTendency"); + } - } + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenDungeon.java b/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenDungeon.java index fc30a40..0656d18 100644 --- a/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenDungeon.java +++ b/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenDungeon.java @@ -11,80 +11,61 @@ import com.legacy.aether.entities.bosses.sun_spirit.EntitySunSpirit; import com.legacy.aether.items.ItemsAether; import com.legacy.aether.world.gen.AetherStructure; -public class ComponentGoldenDungeon extends AetherStructure -{ +public class ComponentGoldenDungeon extends AetherStructure { private int direction; - public ComponentGoldenDungeon() - { - + public ComponentGoldenDungeon() { + } - public ComponentGoldenDungeon(int chunkX, int chunkZ, int direction) - { + public ComponentGoldenDungeon(int chunkX, int chunkZ, int direction) { this.coordBaseMode = 0; - this.direction = direction; - this.boundingBox = new StructureBoundingBox(chunkX, 110, chunkZ, chunkX + 100, 146, chunkZ + 100); + this.direction = direction; + this.boundingBox = new StructureBoundingBox(chunkX, 110, chunkZ, chunkX + 100, 146, chunkZ + 100); } @Override - public boolean generate() - { + public boolean generate() { this.replaceAir = true; this.replaceSolid = true; this.setStructureOffset(60, 0, 60); int r = 24; - r = (int)Math.floor((double)r * 0.8D); - int wid = (int)Math.sqrt((r * r) / 2); + r = (int) Math.floor((double) r * 0.8D); + int wid = (int) Math.sqrt((r * r) / 2); this.setBlocks(BlocksAether.locked_hellfire_stone, BlocksAether.locked_light_hellfire_stone, 10); - for(int j = 4; j > -5; j--) - { + for (int j = 4; j > -5; j--) { int a = wid; - if(j >= 3 || j <= -3) - { + if (j >= 3 || j <= -3) { a--; } - if(j == 4 || j == -4) - { + if (j == 4 || j == -4) { a--; } - for(int i = -a; i <= a; i++) - { - for(int k = -a; k <= a; k++) - { - if(j == 4) - { + for (int i = -a; i <= a; i++) { + for (int k = -a; k <= a; k++) { + if (j == 4) { this.setBlockWithOffset(i, j, k); - } - else if(j > -4) - { - if(i == a || -i == a || k == a || -k == a) - { + } else if (j > -4) { + if (i == a || -i == a || k == a || -k == a) { this.setBlockWithOffset(i, j, k); - } - else - { + } else { this.setBlockWithOffset(i, j, k, Blocks.air, 0); - if(j == -2 && (i == (a - 1) || -i == (a - 1) || k == (a - 1) || -k == (a - 1)) && (i % 3 == 0 || k % 3 == 0)) - { + if (j == -2 && (i == (a - 1) || -i == (a - 1) || k == (a - 1) || -k == (a - 1)) && (i % 3 == 0 || k % 3 == 0)) { - } + } } - } - else - { + } else { this.setBlockWithOffset(i, j, k); - if((i == (a - 2) || -i == (a - 2)) && (k == (a - 2) || -k == (a - 2))) - { + if ((i == (a - 2) || -i == (a - 2)) && (k == (a - 2) || -k == (a - 2))) { this.setBlockWithOffset(i, j + 1, k, Blocks.netherrack, 0); this.setBlockWithOffset(i, j + 2, k, Blocks.fire, 0); } @@ -93,77 +74,52 @@ public class ComponentGoldenDungeon extends AetherStructure } } - for(int i = wid; i < wid + 32; i++) - { - for(int j = -3; j < 2; j++) - { - for(int k = -3; k < 4; k++) - { + for (int i = wid; i < wid + 32; i++) { + for (int j = -3; j < 2; j++) { + for (int k = -3; k < 4; k++) { int a, b; - if(this.direction / 2 == 0) - { + if (this.direction / 2 == 0) { a = i; b = k; - } - else - { + } else { a = k; b = i; } - if(this.direction % 2 == 0) - { + if (this.direction % 2 == 0) { a = -a; b = -b; } - if(!BlocksAether.isGood(this.getBlockStateWithOffset(a, j, b))) - { + if (!BlocksAether.isGood(this.getBlockStateWithOffset(a, j, b))) { this.setBlocks(BlocksAether.holystone, BlocksAether.mossy_holystone, 5); - if(j == -3) - { + if (j == -3) { this.setBlockWithOffset(a, j, b); - } - else if(j < 1) - { - if(i == wid) - { - if(k < 2 && k > -2 && j < 0) - { + } else if (j < 1) { + if (i == wid) { + if (k < 2 && k > -2 && j < 0) { this.setBlockWithOffset(a, j, b, Blocks.air, 0); - } - else - { + } else { this.setBlocks(BlocksAether.locked_hellfire_stone, BlocksAether.locked_light_hellfire_stone, 10); this.setBlockWithOffset(a, j, b); } - } - else - { - if(k == 3 || k == -3) - { + } else { + if (k == 3 || k == -3) { this.setBlockWithOffset(a, j, b); - } - else - { + } else { this.setBlockWithOffset(a, j, b, Blocks.air, 0); - if(j == -1 && (k == 2 || k == -2) && (i - wid - 2) % 3 == 0) - { + if (j == -1 && (k == 2 || k == -2) && (i - wid - 2) % 3 == 0) { } } } - } - else if(i == wid) - { + } else if (i == wid) { this.setBlocks(BlocksAether.locked_hellfire_stone, BlocksAether.locked_light_hellfire_stone, 10); this.setBlockWithOffset(a, j, b); - } - else - { + } else { this.setBlocks(BlocksAether.holystone, BlocksAether.mossy_holystone, 5); this.setBlockWithOffset(a, j, b); } @@ -174,52 +130,32 @@ public class ComponentGoldenDungeon extends AetherStructure this.setBlocks(BlocksAether.locked_hellfire_stone, BlocksAether.locked_light_hellfire_stone, 10); - if(i < wid + 6) - { - if(j == -3) - { + if (i < wid + 6) { + if (j == -3) { this.setBlockWithOffset(a, j, b); - } - else if(j < 1) - { - if(i == wid) - { - if(k < 2 && k > -2 && j < 0) - { + } else if (j < 1) { + if (i == wid) { + if (k < 2 && k > -2 && j < 0) { this.setBlockWithOffset(a, j, b); - } - else - { + } else { this.setBlockWithOffset(a, j, b); } - } - else if(i == wid + 5) - { + } else if (i == wid + 5) { this.setBlockWithOffset(a, j, b); - } - else - { - if(i == wid + 4 && k == 0 && j == -2) - { + } else { + if (i == wid + 4 && k == 0 && j == -2) { this.setBlockWithOffset(a, j, b, BlocksAether.treasure_chest, 0); - } - else if(k == 3 || k == -3) - { + } else if (k == 3 || k == -3) { this.setBlockWithOffset(a, j, b); - } - else - { + } else { this.setBlockWithOffset(a, j, b, Blocks.air, 0); - if(j == -1 && (k == 2 || k == -2) && (i - wid - 2) % 3 == 0) - { + if (j == -1 && (k == 2 || k == -2) && (i - wid - 2) % 3 == 0) { } } } - } - else - { + } else { this.setBlockWithOffset(a, j, b); } } @@ -235,80 +171,65 @@ public class ComponentGoldenDungeon extends AetherStructure return true; } - public static ItemStack getGoldLoot(Random random) - { + public static ItemStack getGoldLoot(Random random) { int item = random.nextInt(10); - switch(item) - { - case 0 : + switch (item) { + case 0: return new ItemStack(ItemsAether.iron_bubble); - case 1 : + case 1: return new ItemStack(ItemsAether.vampire_blade); - case 2 : + case 2: return new ItemStack(ItemsAether.pig_slayer); - case 3 : - { - if(random.nextBoolean()) - { + case 3: { + if (random.nextBoolean()) { return new ItemStack(ItemsAether.phoenix_helmet); } - if(random.nextBoolean()) - { + if (random.nextBoolean()) { return new ItemStack(ItemsAether.phoenix_leggings); } - if(random.nextBoolean()) - { + if (random.nextBoolean()) { return new ItemStack(ItemsAether.phoenix_chestplate); } break; } - case 4 : - { - if(random.nextBoolean()) - { + case 4: { + if (random.nextBoolean()) { return new ItemStack(ItemsAether.phoenix_boots); } return new ItemStack(ItemsAether.phoenix_gloves); } - case 5 : - { + case 5: { return new ItemStack(ItemsAether.life_shard); } - case 6 : - { - if(random.nextBoolean()) - { + case 6: { + if (random.nextBoolean()) { return new ItemStack(ItemsAether.gravitite_helmet); } - if(random.nextBoolean()) - { + if (random.nextBoolean()) { return new ItemStack(ItemsAether.gravitite_leggings); } - if(random.nextBoolean()) - { + if (random.nextBoolean()) { return new ItemStack(ItemsAether.gravitite_chestplate); } break; } - case 7 : - { - if(random.nextBoolean()) - { + case 7: { + if (random.nextBoolean()) { return new ItemStack(ItemsAether.gravitite_boots); } return new ItemStack(ItemsAether.gravitite_gloves); } - - case 8 : + + case 8: return new ItemStack(ItemsAether.chain_gloves); } diff --git a/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenIsland.java b/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenIsland.java index b08cec1..e5ffc93 100644 --- a/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenIsland.java +++ b/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenIsland.java @@ -9,23 +9,19 @@ import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.world.gen.AetherGenUtils; import com.legacy.aether.world.gen.AetherStructure; -public class ComponentGoldenIsland extends AetherStructure -{ +public class ComponentGoldenIsland extends AetherStructure { - public ComponentGoldenIsland() - { + public ComponentGoldenIsland() { - } + } - public ComponentGoldenIsland(int chunkX, int chunkZ) - { + public ComponentGoldenIsland(int chunkX, int chunkZ) { this.coordBaseMode = 0; - this.boundingBox = new StructureBoundingBox(chunkX, 110, chunkZ, chunkX + 100, 146, chunkZ + 100); + this.boundingBox = new StructureBoundingBox(chunkX, 110, chunkZ, chunkX + 100, 146, chunkZ + 100); } @Override - public boolean generate() - { + public boolean generate() { this.replaceAir = true; this.replaceSolid = true; this.setStructureOffset(60, 0, 60); @@ -33,100 +29,74 @@ public class ComponentGoldenIsland extends AetherStructure return true; } - public void generateBaseIsland() - { - int i1 = 0; - int j1 = 21; + public void generateBaseIsland() { + int i1 = 0; + int j1 = 21; - for(int k1 = -j1; k1 <= j1; k1++) - { - for(int l1 = 24; l1 >= -j1; l1--) - { - for(int k2 = -j1; k2 <= j1; k2++) - { - Block state = this.getBlockStateWithOffset(k1, l1, k2); - if(state == BlocksAether.locked_angelic_stone && ++i1 > 24 / 2) - { - return; - } - } + for (int k1 = -j1; k1 <= j1; k1++) { + for (int l1 = 24; l1 >= -j1; l1--) { + for (int k2 = -j1; k2 <= j1; k2++) { + Block state = this.getBlockStateWithOffset(k1, l1, k2); + if (state == BlocksAether.locked_angelic_stone && ++i1 > 24 / 2) { + return; + } + } - } - } + } + } - for(int i2 = -24; i2 <= 24; i2++) - { - for(int l2 = 24; l2 >= -24; l2--) - { - for(int i3 = -24; i3 <= 24; i3++) - { - int k3 = MathHelper.floor_double(i2 * (1 + l2 / 240) / 0.8D); - int i4 = l2; + for (int i2 = -24; i2 <= 24; i2++) { + for (int l2 = 24; l2 >= -24; l2--) { + for (int i3 = -24; i3 <= 24; i3++) { + int k3 = MathHelper.floor_double(i2 * (1 + l2 / 240) / 0.8D); + int i4 = l2; - if(l2 > 15) - { - i4 = MathHelper.floor_double((double)i4 * 1.375D); - i4 -= 6; - } - else if(l2 < -15) - { - i4 = MathHelper.floor_double((double)i4 * 1.3500000238418579D); - i4 += 6; - } + if (l2 > 15) { + i4 = MathHelper.floor_double((double) i4 * 1.375D); + i4 -= 6; + } else if (l2 < -15) { + i4 = MathHelper.floor_double((double) i4 * 1.3500000238418579D); + i4 += 6; + } - int k4 = MathHelper.floor_double(i3 * (1 + l2 / 240) / 0.8D); + int k4 = MathHelper.floor_double(i3 * (1 + l2 / 240) / 0.8D); - if(Math.sqrt(k3 * k3 + i4 * i4 + k4 * k4) <= 24.0D) - { - if(BlocksAether.isGood(this.getBlockStateWithOffset(i2, l2 + 1, i3)) && l2 > 4) - { - this.setBlockWithOffset(i2, l2, i3, BlocksAether.aether_grass, 0); - this.setBlockWithOffset(i2, l2 - 1, i3, BlocksAether.aether_dirt, 0); - this.setBlockWithOffset(i2, l2 - (1 + this.random.nextInt(2)), i3, BlocksAether.aether_dirt, 0); + if (Math.sqrt(k3 * k3 + i4 * i4 + k4 * k4) <= 24.0D) { + if (BlocksAether.isGood(this.getBlockStateWithOffset(i2, l2 + 1, i3)) && l2 > 4) { + this.setBlockWithOffset(i2, l2, i3, BlocksAether.aether_grass, 0); + this.setBlockWithOffset(i2, l2 - 1, i3, BlocksAether.aether_dirt, 0); + this.setBlockWithOffset(i2, l2 - (1 + this.random.nextInt(2)), i3, BlocksAether.aether_dirt, 0); - if(l2 >= 24 / 2) - { - int j5 = this.random.nextInt(48); + if (l2 >= 24 / 2) { + int j5 = this.random.nextInt(48); - if(j5 < 2) - { - AetherGenUtils.generateGoldenOakTree(this, i2, l2 + 1, i3); - } - else if(j5 == 3) - { - if(this.random.nextInt(2) == 0) - { - //new WorldGenLakes(Blocks.FLOWING_WATER).generate(world, random, new BlockPos.MutableBlockPos((i2 + i + random.nextInt(3)) - random.nextInt(3), l2 + j, (i3 + k + random.nextInt(3)) - random.nextInt(3))); - } - } - else if(j5 == 4) - { - if(this.random.nextInt(2) == 0) - { - AetherGenUtils.generateFlower(this, Blocks.red_flower, 0, (i2 + this.random.nextInt(3)) - this.random.nextInt(3), l2 + 1, (i3 + this.random.nextInt(3)) - this.random.nextInt(3)); - } - else - { - AetherGenUtils.generateFlower(this, Blocks.yellow_flower, 0, (i2 + this.random.nextInt(3)) - this.random.nextInt(3), l2 + 1, (i3 + this.random.nextInt(3)) - this.random.nextInt(3)); - } - } - } - } - else if(BlocksAether.isGood(this.getBlockStateWithOffset(i2, l2, i3))) - { - this.setBlockWithOffset(i2, l2, i3, BlocksAether.holystone, 0); - } - } - } + if (j5 < 2) { + AetherGenUtils.generateGoldenOakTree(this, i2, l2 + 1, i3); + } else if (j5 == 3) { + if (this.random.nextInt(2) == 0) { + //new WorldGenLakes(Blocks.FLOWING_WATER).generate(world, random, new BlockPos.MutableBlockPos((i2 + i + random.nextInt(3)) - random.nextInt(3), l2 + j, (i3 + k + random.nextInt(3)) - random.nextInt(3))); + } + } else if (j5 == 4) { + if (this.random.nextInt(2) == 0) { + AetherGenUtils.generateFlower(this, Blocks.red_flower, 0, (i2 + this.random.nextInt(3)) - this.random.nextInt(3), l2 + 1, (i3 + this.random.nextInt(3)) - this.random.nextInt(3)); + } else { + AetherGenUtils.generateFlower(this, Blocks.yellow_flower, 0, (i2 + this.random.nextInt(3)) - this.random.nextInt(3), l2 + 1, (i3 + this.random.nextInt(3)) - this.random.nextInt(3)); + } + } + } + } else if (BlocksAether.isGood(this.getBlockStateWithOffset(i2, l2, i3))) { + this.setBlockWithOffset(i2, l2, i3, BlocksAether.holystone, 0); + } + } + } - } + } - } + } int l3 = MathHelper.floor_double(24.0D * 0.75D); - for(int j4 = 0; j4 < l3; j4++) - { + for (int j4 = 0; j4 < l3; j4++) { int i5 = this.random.nextInt(24) - this.random.nextInt(24); int l5 = this.random.nextInt(24) - this.random.nextInt(24); int j6 = this.random.nextInt(24) - this.random.nextInt(24); @@ -135,58 +105,50 @@ public class ComponentGoldenIsland extends AetherStructure } } - public void generateCaves(int x, int y, int z, int size) - { - float f = this.random.nextFloat() * 3.141593F; + public void generateCaves(int x, int y, int z, int size) { + float f = this.random.nextFloat() * 3.141593F; - double d = (float)(x + 8) + (MathHelper.sin(f) * (float)size) / 8F; - double d1 = (float)(x + 8) - (MathHelper.sin(f) * (float)size) / 8F; - double d2 = (float)(z + 8) + (MathHelper.cos(f) * (float)size) / 8F; - double d3 = (float)(z + 8) - (MathHelper.cos(f) * (float)size) / 8F; - double d4 = y + this.random.nextInt(3) + 2; - double d5 = y + this.random.nextInt(3) + 2; + double d = (float) (x + 8) + (MathHelper.sin(f) * (float) size) / 8F; + double d1 = (float) (x + 8) - (MathHelper.sin(f) * (float) size) / 8F; + double d2 = (float) (z + 8) + (MathHelper.cos(f) * (float) size) / 8F; + double d3 = (float) (z + 8) - (MathHelper.cos(f) * (float) size) / 8F; + double d4 = y + this.random.nextInt(3) + 2; + double d5 = y + this.random.nextInt(3) + 2; - for(int l = 0; l <= size; l++) - { - double d6 = d + ((d1 - d) * (double)l) / (double)size; - double d7 = d4 + ((d5 - d4) * (double)l) / (double)size; - double d8 = d2 + ((d3 - d2) * (double)l) / (double)size; - double d9 = (this.random.nextDouble() * (double)size) / 16D; - double d10 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)size) + 1.0F) * d9 + 1.0D; - double d11 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)size) + 1.0F) * d9 + 1.0D; - int i1 = (int)(d6 - d10 / 2D); - int j1 = (int)(d7 - d11 / 2D); - int k1 = (int)(d8 - d10 / 2D); - int l1 = (int)(d6 + d10 / 2D); - int i2 = (int)(d7 + d11 / 2D); - int j2 = (int)(d8 + d10 / 2D); + for (int l = 0; l <= size; l++) { + double d6 = d + ((d1 - d) * (double) l) / (double) size; + double d7 = d4 + ((d5 - d4) * (double) l) / (double) size; + double d8 = d2 + ((d3 - d2) * (double) l) / (double) size; + double d9 = (this.random.nextDouble() * (double) size) / 16D; + double d10 = (double) (MathHelper.sin(((float) l * 3.141593F) / (float) size) + 1.0F) * d9 + 1.0D; + double d11 = (double) (MathHelper.sin(((float) l * 3.141593F) / (float) size) + 1.0F) * d9 + 1.0D; + int i1 = (int) (d6 - d10 / 2D); + int j1 = (int) (d7 - d11 / 2D); + int k1 = (int) (d8 - d10 / 2D); + int l1 = (int) (d6 + d10 / 2D); + int i2 = (int) (d7 + d11 / 2D); + int j2 = (int) (d8 + d10 / 2D); - for(int k2 = i1; k2 <= l1; k2++) - { - double d12 = (((double)k2 + 0.5D) - d6) / (d10 / 2D); - if(d12 * d12 < 1.0D) - { - for(int l2 = j1; l2 <= i2; l2++) - { - double d13 = (((double)l2 + 0.5D) - d7) / (d11 / 2D); - if(d12 * d12 + d13 * d13 < 1.0D) - { - for(int i3 = k1; i3 <= j2; i3++) - { - double d14 = (((double)i3 + 0.5D) - d8) / (d10 / 2D); + for (int k2 = i1; k2 <= l1; k2++) { + double d12 = (((double) k2 + 0.5D) - d6) / (d10 / 2D); + if (d12 * d12 < 1.0D) { + for (int l2 = j1; l2 <= i2; l2++) { + double d13 = (((double) l2 + 0.5D) - d7) / (d11 / 2D); + if (d12 * d12 + d13 * d13 < 1.0D) { + for (int i3 = k1; i3 <= j2; i3++) { + double d14 = (((double) i3 + 0.5D) - d8) / (d10 / 2D); - Block block = this.getBlockStateWithOffset(k2, l2, i3); + Block block = this.getBlockStateWithOffset(k2, l2, i3); - if(d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block == BlocksAether.mossy_holystone || block == BlocksAether.holystone || block == BlocksAether.aether_grass || block == BlocksAether.aether_dirt)) - { - this.setBlockWithOffset(k2, l2, i3, Blocks.air, 0); - } - } - } - } - } - } - } + if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block == BlocksAether.mossy_holystone || block == BlocksAether.holystone || block == BlocksAether.aether_grass || block == BlocksAether.aether_dirt)) { + this.setBlockWithOffset(k2, l2, i3, Blocks.air, 0); + } + } + } + } + } + } + } } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenIslandStub.java b/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenIslandStub.java index c78d394..19af492 100644 --- a/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenIslandStub.java +++ b/src/main/java/com/legacy/aether/world/gen/components/ComponentGoldenIslandStub.java @@ -7,92 +7,73 @@ import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.world.gen.AetherGenUtils; import com.legacy.aether.world.gen.AetherStructure; -public class ComponentGoldenIslandStub extends AetherStructure -{ +public class ComponentGoldenIslandStub extends AetherStructure { private int x, y, z; private int l; - public ComponentGoldenIslandStub() - { + public ComponentGoldenIslandStub() { - } + } - public ComponentGoldenIslandStub(int chunkX, int chunkZ, int x, int y, int z, int l) - { + public ComponentGoldenIslandStub(int chunkX, int chunkZ, int x, int y, int z, int l) { this.x = x; this.y = y; this.z = z; this.l = l; this.coordBaseMode = 0; - this.boundingBox = new StructureBoundingBox(chunkX, 110, chunkZ, chunkX + 100, 146, chunkZ + 100); + this.boundingBox = new StructureBoundingBox(chunkX, 110, chunkZ, chunkX + 100, 146, chunkZ + 100); } @Override - public boolean generate() - { + public boolean generate() { this.replaceAir = true; this.replaceSolid = true; this.setStructureOffset(60, 0, 60); - float f = 1.0F; + float f = 1.0F; - for(int i1 = -l; i1 <= l; i1++) - { - for(int k1 = l; k1 >= -l; k1--) - { - for(int i2 = -l; i2 <= l; i2++) - { - int k2 = MathHelper.floor_double((double)i1 / (double)f); - int i3 = k1; + for (int i1 = -l; i1 <= l; i1++) { + for (int k1 = l; k1 >= -l; k1--) { + for (int i2 = -l; i2 <= l; i2++) { + int k2 = MathHelper.floor_double((double) i1 / (double) f); + int i3 = k1; - if(k1 > 5) - { - i3 = MathHelper.floor_double((double)i3 * 1.375D); - i3 -= 2; - } - else if(k1 < -5) - { - i3 = MathHelper.floor_double((double)i3 * 1.3500000238418579D); - i3 += 2; - } + if (k1 > 5) { + i3 = MathHelper.floor_double((double) i3 * 1.375D); + i3 -= 2; + } else if (k1 < -5) { + i3 = MathHelper.floor_double((double) i3 * 1.3500000238418579D); + i3 += 2; + } - int k3 = MathHelper.floor_double((double)i2 / (double)f); + int k3 = MathHelper.floor_double((double) i2 / (double) f); - if(Math.sqrt(k2 * k2 + i3 * i3 + k3 * k3) <= 8.0D) - { - if(BlocksAether.isGood(this.getBlockStateWithOffset(i1 + x, k1 + y + 1, i2 + z)) && k1 > 1) - { - this.setBlockWithOffset(i1 + x, k1 + y, i2 + z, BlocksAether.aether_grass, 0); - this.setBlockWithOffset(i1 + x, (k1 + y) - 1, i2 + z, BlocksAether.aether_dirt, 0); - this.setBlockWithOffset(i1 + x, (k1 + y) - (1 + this.random.nextInt(2)), i2 + z, BlocksAether.aether_dirt, 0); + if (Math.sqrt(k2 * k2 + i3 * i3 + k3 * k3) <= 8.0D) { + if (BlocksAether.isGood(this.getBlockStateWithOffset(i1 + x, k1 + y + 1, i2 + z)) && k1 > 1) { + this.setBlockWithOffset(i1 + x, k1 + y, i2 + z, BlocksAether.aether_grass, 0); + this.setBlockWithOffset(i1 + x, (k1 + y) - 1, i2 + z, BlocksAether.aether_dirt, 0); + this.setBlockWithOffset(i1 + x, (k1 + y) - (1 + this.random.nextInt(2)), i2 + z, BlocksAether.aether_dirt, 0); - if(k1 >= 4) - { - int l3 = this.random.nextInt(64); + if (k1 >= 4) { + int l3 = this.random.nextInt(64); - if(l3 == 0) - { - AetherGenUtils.generateGoldenOakTree(this, i1 + x, k1 + y + 1, i2 + z); - } - else if(l3 == 5) - { - if(this.random.nextInt(3) == 0) - { - //new WorldGenLakes(Blocks.FLOWING_WATER).generate(world, random, new BlockPos.MutableBlockPos((i1 + i + random.nextInt(3)) - random.nextInt(3), k1 + j, (i2 + k + random.nextInt(3)) - random.nextInt(3))); - } - } - } - } - else if(BlocksAether.isGood(this.getBlockStateWithOffset(i1 + x, k1 + y, i2 + z))) - { - this.setBlockWithOffset(i1 + x, k1 + y, i2 + z, BlocksAether.holystone, 0); - } - } - } + if (l3 == 0) { + AetherGenUtils.generateGoldenOakTree(this, i1 + x, k1 + y + 1, i2 + z); + } else if (l3 == 5) { + if (this.random.nextInt(3) == 0) { + //new WorldGenLakes(Blocks.FLOWING_WATER).generate(world, random, new BlockPos.MutableBlockPos((i1 + i + random.nextInt(3)) - random.nextInt(3), k1 + j, (i2 + k + random.nextInt(3)) - random.nextInt(3))); + } + } + } + } else if (BlocksAether.isGood(this.getBlockStateWithOffset(i1 + x, k1 + y, i2 + z))) { + this.setBlockWithOffset(i1 + x, k1 + y, i2 + z, BlocksAether.holystone, 0); + } + } + } - } - } + } + } return true; } diff --git a/src/main/java/com/legacy/aether/world/gen/components/ComponentLargeColdAercloud.java b/src/main/java/com/legacy/aether/world/gen/components/ComponentLargeColdAercloud.java index 71cb82e..57b0a95 100644 --- a/src/main/java/com/legacy/aether/world/gen/components/ComponentLargeColdAercloud.java +++ b/src/main/java/com/legacy/aether/world/gen/components/ComponentLargeColdAercloud.java @@ -9,67 +9,60 @@ import net.minecraft.world.gen.structure.StructureBoundingBox; import com.legacy.aether.blocks.BlocksAether; import com.legacy.aether.world.gen.AetherStructure; -public class ComponentLargeColdAercloud extends AetherStructure -{ +public class ComponentLargeColdAercloud extends AetherStructure { private NBTTagCompound data = new NBTTagCompound(); private int xTendency, zTendency; - public ComponentLargeColdAercloud() - { + public ComponentLargeColdAercloud() { - } + } - public ComponentLargeColdAercloud(Random random, int chunkX, int chunkY, int chunkZ) - { + public ComponentLargeColdAercloud(Random random, int chunkX, int chunkY, int chunkZ) { this.coordBaseMode = 0; - this.xTendency = random.nextInt(3) - 1; - this.zTendency = random.nextInt(3) - 1; + this.xTendency = random.nextInt(3) - 1; + this.zTendency = random.nextInt(3) - 1; - this.boundingBox = new StructureBoundingBox(chunkX, 0, chunkZ, chunkX + 100, 255, chunkZ + 100); + this.boundingBox = new StructureBoundingBox(chunkX, 0, chunkZ, chunkX + 100, 255, chunkZ + 100); } @Override - public boolean generate() - { + public boolean generate() { this.replaceAir = true; - if (!this.data.hasKey("initialized")) - { + if (!this.data.hasKey("initialized")) { NBTTagCompound icd; - for (int n = 0; n < 64; ++n) - { - icd = new NBTTagCompound(); + for (int n = 0; n < 64; ++n) { + icd = new NBTTagCompound(); - byte xOffset = (byte) (this.random.nextInt(3) - 1); - byte yOffset = (byte) (this.random.nextInt(3) - 1); - byte zOffset = (byte) (this.random.nextInt(3) - 1); + byte xOffset = (byte) (this.random.nextInt(3) - 1); + byte yOffset = (byte) (this.random.nextInt(3) - 1); + byte zOffset = (byte) (this.random.nextInt(3) - 1); - icd.setByte("xOffset", xOffset); + icd.setByte("xOffset", xOffset); - if (this.random.nextInt(10) == 0) - { - icd.setByte("yOffset", yOffset); - } + if (this.random.nextInt(10) == 0) { + icd.setByte("yOffset", yOffset); + } - icd.setByte("zOffset", zOffset); + icd.setByte("zOffset", zOffset); - byte xMax = (byte) (this.random.nextInt(4) + 9); - byte yMax = (byte) (this.random.nextInt(1) + 2); - byte zMax = (byte) (this.random.nextInt(4) + 9); + byte xMax = (byte) (this.random.nextInt(4) + 9); + byte yMax = (byte) (this.random.nextInt(1) + 2); + byte zMax = (byte) (this.random.nextInt(4) + 9); - icd.setByte("xMax", xMax); - icd.setByte("yMax", yMax); - icd.setByte("zMax", zMax); - icd.setByte("shapeOffset", (byte) this.random.nextInt(2)); + icd.setByte("xMax", xMax); + icd.setByte("yMax", yMax); + icd.setByte("zMax", zMax); + icd.setByte("shapeOffset", (byte) this.random.nextInt(2)); - this.data.setTag("ICD_" + n, icd); - } + this.data.setTag("ICD_" + n, icd); + } - this.data.setByte("initialized", (byte) 1); + this.data.setByte("initialized", (byte) 1); } int x = 0, y = 0, z = 0; @@ -77,54 +70,45 @@ public class ComponentLargeColdAercloud extends AetherStructure this.setStructureOffset(50, 4, 100); - for (int n = 0; n < 64; ++n) - { - icd = this.data.getCompoundTag("ICD_" + n); + for (int n = 0; n < 64; ++n) { + icd = this.data.getCompoundTag("ICD_" + n); - x += icd.getByte("xOffset") + this.xTendency; + x += icd.getByte("xOffset") + this.xTendency; - if (icd.hasKey("yOffset")) - { - y += icd.getByte("yOffset"); - } + if (icd.hasKey("yOffset")) { + y += icd.getByte("yOffset"); + } - z += icd.getByte("zOffset") + this.zTendency; + z += icd.getByte("zOffset") + this.zTendency; - int xMax = icd.getByte("xMax"); - int yMax = icd.getByte("yMax"); - int zMax = icd.getByte("zMax"); - int shapeOffset = icd.getByte("shapeOffset"); + int xMax = icd.getByte("xMax"); + int yMax = icd.getByte("yMax"); + int zMax = icd.getByte("zMax"); + int shapeOffset = icd.getByte("shapeOffset"); - for (int x1 = x; x1 < x + xMax; ++x1) - { - for (int y1 = y; y1 < y + yMax; ++y1) - { - for (int z1 = z; z1 < z + zMax; ++z1) - { - if (this.getBlockStateWithOffset(x1, y1, z1) == Blocks.air) - { - if (Math.abs(x1 - x) + Math.abs(y1 - y) + Math.abs(z1 - z) < 12 + shapeOffset) - { - this.setBlockWithOffset(x1, y1, z1, BlocksAether.aercloud, 0); - } - } - } - } - } - } + for (int x1 = x; x1 < x + xMax; ++x1) { + for (int y1 = y; y1 < y + yMax; ++y1) { + for (int z1 = z; z1 < z + zMax; ++z1) { + if (this.getBlockStateWithOffset(x1, y1, z1) == Blocks.air) { + if (Math.abs(x1 - x) + Math.abs(y1 - y) + Math.abs(z1 - z) < 12 + shapeOffset) { + this.setBlockWithOffset(x1, y1, z1, BlocksAether.aercloud, 0); + } + } + } + } + } + } return true; } @Override - protected void func_143012_a(NBTTagCompound tagCompound) - { + protected void func_143012_a(NBTTagCompound tagCompound) { tagCompound.setTag("cloudData", this.data); } @Override - protected void func_143011_b(NBTTagCompound tagCompound) - { + protected void func_143011_b(NBTTagCompound tagCompound) { this.data = tagCompound.getCompoundTag("cloudData"); } diff --git a/src/main/java/com/legacy/aether/world/gen/components/ComponentSilverDungeon.java b/src/main/java/com/legacy/aether/world/gen/components/ComponentSilverDungeon.java index 4e352cb..430c369 100644 --- a/src/main/java/com/legacy/aether/world/gen/components/ComponentSilverDungeon.java +++ b/src/main/java/com/legacy/aether/world/gen/components/ComponentSilverDungeon.java @@ -18,8 +18,7 @@ import com.legacy.aether.items.ItemsAether; import com.legacy.aether.world.gen.AetherGenUtils; import com.legacy.aether.world.gen.AetherStructure; -public class ComponentSilverDungeon extends AetherStructure -{ +public class ComponentSilverDungeon extends AetherStructure { private static final Block LOCKED_ANGELIC_STONE = BlocksAether.locked_angelic_stone; @@ -31,39 +30,33 @@ public class ComponentSilverDungeon extends AetherStructure private int xTendency, zTendency; - public ComponentSilverDungeon() - { + public ComponentSilverDungeon() { - } - - public ComponentSilverDungeon(int chunkX, int chunkZ) - { - this.coordBaseMode = 0; - this.boundingBox = new StructureBoundingBox(chunkX, 100, chunkZ, chunkX + 100, 190, chunkZ + 100); } - public void setStaircasePosition(int first, int second, int third) - { + public ComponentSilverDungeon(int chunkX, int chunkZ) { + this.coordBaseMode = 0; + this.boundingBox = new StructureBoundingBox(chunkX, 100, chunkZ, chunkX + 100, 190, chunkZ + 100); + } + + public void setStaircasePosition(int first, int second, int third) { this.firstStaircaseZ = first; this.secondStaircaseZ = second; this.finalStaircaseZ = third; } - public void setCloudTendencies(int xTendency, int zTendency) - { + public void setCloudTendencies(int xTendency, int zTendency) { this.xTendency = xTendency; this.zTendency = zTendency; } @Override - public boolean generate() - { + public boolean generate() { this.replaceAir = true; this.setStructureOffset(21, 17, 20); - for (int tries = 0; tries < 100; tries++) - { + for (int tries = 0; tries < 100; tries++) { AetherGenUtils.generateClouds(this, BlocksAether.aercloud, 0, false, 10, this.random.nextInt(77), 0, this.random.nextInt(50), this.xTendency, this.zTendency); } @@ -75,20 +68,17 @@ public class ComponentSilverDungeon extends AetherStructure this.addSolidBox(0, -5, 0, 55, 5, 30); - for(int x = 0; x < 55; x += 4) - { + for (int x = 0; x < 55; x += 4) { this.generateColumn(x, 0, 0, 14); this.generateColumn(x, 0, 27, 14); } - for(int z = 0; z < 12; z += 4) - { + for (int z = 0; z < 12; z += 4) { this.generateColumn(0, 0, z, 14); this.generateColumn(52, 0, z, 14); } - for(int z = 19; z < 30; z += 4) - { + for (int z = 19; z < 30; z += 4) { this.generateColumn(0, 0, z, 14); this.generateColumn(52, 0, z, 14); } @@ -105,10 +95,8 @@ public class ComponentSilverDungeon extends AetherStructure this.addPlaneY(5, 4, 5, 20, 20); this.addPlaneY(5, 9, 5, 20, 20); - for(int y = 0; y < 2; y++) - { - for(int z = 14; z < 16; z++) - { + for (int y = 0; y < 2; y++) { + for (int z = 14; z < 16; z++) { this.setBlockWithOffset(4, y, z, Blocks.air, 0); } } @@ -121,8 +109,7 @@ public class ComponentSilverDungeon extends AetherStructure this.setBlocks(LOCKED_ANGELIC_STONE, LOCKED_LIGHT_ANGELIC_STONE, 15); - for(int y = 0; y < 7; y++) - { + for (int y = 0; y < 7; y++) { this.addPlaneY(-1, 15 + y, -1 + 2 * y, 57, 32 - 4 * y); } @@ -136,10 +123,8 @@ public class ComponentSilverDungeon extends AetherStructure int y; int z; - for(y = 0; y < 2; y++) - { - for(z = 7 + 7 * this.finalStaircaseZ; z < 9 + 7 * this.finalStaircaseZ; z++) - { + for (y = 0; y < 2; y++) { + for (z = 7 + 7 * this.finalStaircaseZ; z < 9 + 7 * this.finalStaircaseZ; z++) { this.setBlockWithOffset(x, y, z, Blocks.air, 0); } } @@ -151,203 +136,153 @@ public class ComponentSilverDungeon extends AetherStructure this.generateStaircase(5, 5, 5 + this.secondStaircaseZ * 7, 5); - this.rooms[0][1][this.secondStaircaseZ] = 1; + this.rooms[0][1][this.secondStaircaseZ] = 1; this.rooms[0][2][this.secondStaircaseZ] = 1; - for(int p = 0; p < 3; p++) - { - for(int q = 0; q < 3; q++) - { - for(int r = 0; r < 3; r++) - { - if (p == 0 && q != 0 && this.secondStaircaseZ == r) - { - if (r == 0) - { + for (int p = 0; p < 3; p++) { + for (int q = 0; q < 3; q++) { + for (int r = 0; r < 3; r++) { + if (p == 0 && q != 0 && this.secondStaircaseZ == r) { + if (r == 0) { this.generateDoorX(11 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); this.generateDoorZ(-3 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); - } - else if (r == 1) - { + } else if (r == 1) { this.generateDoorX(11 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); this.generateDoorZ(4 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); this.generateDoorZ(11 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); - } - else if (r == 2) - { + } else if (r == 2) { this.generateDoorX(11 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); this.generateDoorZ(4 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); } - } - else if (p == 1 && q != 2 && this.firstStaircaseZ == r) - { - if (this.firstStaircaseZ != this.finalStaircaseZ) - { + } else if (p == 1 && q != 2 && this.firstStaircaseZ == r) { + if (this.firstStaircaseZ != this.finalStaircaseZ) { this.generateDoorX(11 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); } - if (r == 0) - { + if (r == 0) { this.generateDoorZ(11 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); this.generateDoorX(4 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); - } - else if (r == 1) - { + } else if (r == 1) { this.generateDoorZ(4 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); this.generateDoorZ(11 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); this.generateDoorX(4 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); - } - else if (r == 2) - { + } else if (r == 2) { this.generateDoorZ(4 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); this.generateDoorX(4 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); } - } - else if (p == 2 && this.finalStaircaseZ == r) - { - if (q == 0) - { + } else if (p == 2 && this.finalStaircaseZ == r) { + if (q == 0) { this.generateDoorX(11 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); - } - else if (q == 2) - { - if (r == 0) - { + } else if (q == 2) { + if (r == 0) { this.generateDoorX(4 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); this.generateDoorZ(11 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); - } - else if (r == 1) - { + } else if (r == 1) { this.generateDoorX(4 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); this.generateDoorZ(4 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); this.generateDoorZ(11 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); - } - else if (r == 2) - { + } else if (r == 2) { this.generateDoorX(4 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); this.generateDoorZ(4 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); } } - } - else - { + } else { int type = this.rooms[p][q][r]; - if(p + 1 < 3) - { + if (p + 1 < 3) { int newType = this.rooms[p + 1][q][r]; - if(newType != 2 && !(newType == 1 && type == 1)) - { + if (newType != 2 && !(newType == 1 && type == 1)) { this.rooms[p][q][r] = 3; type = 3; this.generateDoorX(11 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); - } + } } - if(p - 1 > 0) - { + if (p - 1 > 0) { int newType = this.rooms[p - 1][q][r]; - if(newType != 2 && !(newType == 1 && type == 1)) - { + if (newType != 2 && !(newType == 1 && type == 1)) { this.rooms[p][q][r] = 4; type = 4; this.generateDoorX(4 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); - } + } } - if(r + 1 < 3) - { + if (r + 1 < 3) { int newType = this.rooms[p][q][r + 1]; - if(newType != 2 && !(newType == 1 && type == 1)) - { + if (newType != 2 && !(newType == 1 && type == 1)) { this.rooms[p][q][r] = 5; type = 5; this.generateDoorZ(11 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); - } + } } - if(r - 1 > 0) - { + if (r - 1 > 0) { int newType = this.rooms[p][q][r - 1]; - if(newType != 2 && !(newType == 1 && type == 1)) - { + if (newType != 2 && !(newType == 1 && type == 1)) { this.rooms[p][q][r] = 6; type = 6; this.generateDoorZ(4 + 7 * r, 7 + 7 * p, 5 * q, 2, 2); - } + } } int roomType = this.random.nextInt(3); - if(type >= 3) - { + if (type >= 3) { this.setBlockWithOffset(7 + p * 7, -1 + q * 5, 7 + r * 7, BlocksAether.angelic_trap, 0); - switch(roomType) - { - case 1: - { + switch (roomType) { + case 1: { this.addPlaneY(7 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); int u = 7 + 7 * p + this.random.nextInt(2); int v = 7 + 7 * r + this.random.nextInt(2); - if(this.getBlockState(u, 5 * q + 1, v).getMaterial() == Material.air) - { + if (this.getBlockState(u, 5 * q + 1, v).getMaterial() == Material.air) { this.setBlockWithOffset(u, 5 * q + 1, v, Blocks.chest, 0); TileEntity tileEntity = this.getTileEntityFromPosWithOffset(u, 5 * q + 1, v); - if (tileEntity instanceof TileEntityChest) - { - for(u = 0; u < 3 + random.nextInt(3); u++) - { - ((TileEntityChest)tileEntity).setInventorySlotContents(this.random.nextInt(((TileEntityChest)tileEntity).getSizeInventory()), this.getNormalLoot(this.random)); + if (tileEntity instanceof TileEntityChest) { + for (u = 0; u < 3 + random.nextInt(3); u++) { + ((TileEntityChest) tileEntity).setInventorySlotContents(this.random.nextInt(((TileEntityChest) tileEntity).getSizeInventory()), this.getNormalLoot(this.random)); } } } break; } - case 2: - { + case 2: { this.addPlaneY(7 + 7 * p, 5 * q, 7 + 7 * r, 2, 2); this.setBlockWithOffset(7 + 7 * p + this.random.nextInt(2), 5 * q + 1, 7 + 7 * r + this.random.nextInt(2), BlocksAether.chest_mimic, 0); - if (this.random.nextBoolean()) - { + if (this.random.nextBoolean()) { this.setBlockWithOffset(7 + 7 * p + this.random.nextInt(2), 5 * q + 1, 7 + 7 * r + this.random.nextInt(2), BlocksAether.chest_mimic, 0); } break; } } - } - } + } + } } } } - for(x = 0; x < 24; x++) - { - for(z = 0; z < 20; z++) - { - int distance = (int)(Math.sqrt(x * x + (z - 7) * (z - 7)) + Math.sqrt(x * x + (z - 12) * (z - 12))); + for (x = 0; x < 24; x++) { + for (z = 0; z < 20; z++) { + int distance = (int) (Math.sqrt(x * x + (z - 7) * (z - 7)) + Math.sqrt(x * x + (z - 12) * (z - 12))); - if(distance == 21) - { + if (distance == 21) { this.setBlockWithOffset(26 + x, 0, 5 + z, LOCKED_LIGHT_ANGELIC_STONE, 0); - } - else if(distance > 21) - { + } else if (distance > 21) { this.setBlockWithOffset(26 + x, 0, 5 + z, LOCKED_ANGELIC_STONE, 0); } } @@ -363,10 +298,8 @@ public class ComponentSilverDungeon extends AetherStructure this.setBlocks(Blocks.wool, 11, Blocks.wool, 11, 20); this.addPlaneY(47, 3, 14, 2, 2); - for(x = 0; x < 2; x++) - { - for(z = 0; z < 2; z++) - { + for (x = 0; x < 2; x++) { + for (z = 0; z < 2; z++) { this.setBlockWithOffset(44 + x * 5, 2, 11 + z * 7, BlocksAether.ambrosium_torch, 0); } } @@ -392,11 +325,9 @@ public class ComponentSilverDungeon extends AetherStructure this.setBlockWithOffset(40, 1, 7, LOCKED_ANGELIC_STONE, 0); this.setBlockWithOffset(35, 1, 22, LOCKED_ANGELIC_STONE, 0); this.setBlockWithOffset(40, 1, 22, LOCKED_ANGELIC_STONE, 0); - - for(x = 36; x < 40; x += 3) - { - for(z = 8; z < 22; z += 13) - { + + for (x = 36; x < 40; x += 3) { + for (z = 8; z < 22; z += 13) { this.setBlockWithOffset(x, 2, z, BlocksAether.ambrosium_torch, 0); } } @@ -409,7 +340,7 @@ public class ComponentSilverDungeon extends AetherStructure this.generateGoldenOakSapling(45, 1, 6); this.generateGoldenOakSapling(45, 1, 21); - EntityValkyrieQueen valkyrieQueen = new EntityValkyrieQueen(this.worldObj, (double)this.getActualX(40, 15), (double)this.getActualY(1) + 0.5D, (double)this.getActualZ(40, 15)); + EntityValkyrieQueen valkyrieQueen = new EntityValkyrieQueen(this.worldObj, (double) this.getActualX(40, 15), (double) this.getActualY(1) + 0.5D, (double) this.getActualZ(40, 15)); valkyrieQueen.setPosition(this.getActualX(40, 15), this.getActualY(2), this.getActualZ(40, 15)); valkyrieQueen.setDungeon(this.getActualX(26, 24), this.getActualY(0), this.getActualZ(26, 24)); @@ -427,48 +358,39 @@ public class ComponentSilverDungeon extends AetherStructure return true; } - public void generateGoldenOakSapling(int x, int y, int z) - { + public void generateGoldenOakSapling(int x, int y, int z) { this.setBlocks(LOCKED_ANGELIC_STONE, LOCKED_LIGHT_ANGELIC_STONE, 2); this.addPlaneY(x, y, z, 3, 3); this.setBlockWithOffset(x + 1, y, z + 1, BlocksAether.aether_dirt, 0); this.setBlockWithOffset(x + 1, y + 1, z + 1, BlocksAether.golden_oak_sapling, 0); - for(int lineX = x; lineX < x + 3; lineX += 2) - { - for(int lineZ = z; lineZ < z + 3; lineZ += 2) - { + for (int lineX = x; lineX < x + 3; lineX += 2) { + for (int lineZ = z; lineZ < z + 3; lineZ += 2) { this.setBlockWithOffset(lineX, y + 1, lineZ, BlocksAether.ambrosium_torch, 0); } } } - public void generateChandelier(int x, int y, int z, int height) - { - for (int lineY = y + (height + 3); lineY < y + (height + 6); lineY++) - { + public void generateChandelier(int x, int y, int z, int height) { + for (int lineY = y + (height + 3); lineY < y + (height + 6); lineY++) { this.setBlockWithOffset(x, lineY, z, Blocks.fence, 0); } - for (int lineX = (x - 1); lineX < (x + 2); lineX++) - { + for (int lineX = (x - 1); lineX < (x + 2); lineX++) { this.setBlockWithOffset(lineX, y + (height + 1), z, Blocks.glowstone, 0); } - for (int lineY = (y + height); lineY < y + (height + 3); lineY++) - { + for (int lineY = (y + height); lineY < y + (height + 3); lineY++) { this.setBlockWithOffset(x, lineY, z, Blocks.glowstone, 0); } - for (int lineZ = (z - 1); lineZ < (z + 2); lineZ++) - { + for (int lineZ = (z - 1); lineZ < (z + 2); lineZ++) { this.setBlockWithOffset(x, y + (height + 1), lineZ, Blocks.glowstone, 0); } } - public void generateColumn(int x, int y, int z, int yRange) - { + public void generateColumn(int x, int y, int z, int yRange) { this.setBlocks(LOCKED_ANGELIC_STONE, LOCKED_LIGHT_ANGELIC_STONE, 20); this.addPlaneY(x, y, z, 3, 3); this.addPlaneY(x, y + yRange, z, 3, 3); @@ -477,8 +399,7 @@ public class ComponentSilverDungeon extends AetherStructure this.setBlockWithOffset(x + 1, y + (yRange - 1), z + 1, BlocksAether.pillar_top, 0); } - public void generateStaircase(int x, int y, int z, int height) - { + public void generateStaircase(int x, int y, int z, int height) { this.setBlocks(Blocks.air, Blocks.air, 1); this.addSolidBox(x + 1, y, z + 1, 4, height, 4); this.setBlocks(LOCKED_ANGELIC_STONE, LOCKED_LIGHT_ANGELIC_STONE, 5); @@ -499,8 +420,7 @@ public class ComponentSilverDungeon extends AetherStructure this.setBlockWithOffset(x + 2, y + 4, z + 4, slab, 0); this.setBlockWithOffset(x + 1, y + 4, z + 4, double_slab, 0); - if(height == 5) - { + if (height == 5) { return; } @@ -516,89 +436,75 @@ public class ComponentSilverDungeon extends AetherStructure this.setBlockWithOffset(x + 3, y + 9, z + 4, double_slab, 0); } - public void generateDoorX(int x, int y, int z, int yF, int zF) - { - for(int yFinal = y; yFinal < y + yF; yFinal++) - { - for(int zFinal = z; zFinal < z + zF; zFinal++) - { + public void generateDoorX(int x, int y, int z, int yF, int zF) { + for (int yFinal = y; yFinal < y + yF; yFinal++) { + for (int zFinal = z; zFinal < z + zF; zFinal++) { this.setBlockWithOffset(x, yFinal, zFinal, Blocks.air, 0); } } - } + } - public void generateDoorZ(int z, int x, int y, int xF, int yF) - { - for(int xFinal = x; xFinal < x + xF; xFinal++) - { - for(int yFinal = y; yFinal < y + yF; yFinal++) - { + public void generateDoorZ(int z, int x, int y, int xF, int yF) { + for (int xFinal = x; xFinal < x + xF; xFinal++) { + for (int yFinal = y; yFinal < y + yF; yFinal++) { this.setBlockWithOffset(xFinal, yFinal, z, Blocks.air, 0); } } - } + } //Get loot for normal chests scattered around - private ItemStack getNormalLoot(Random random) - { + private ItemStack getNormalLoot(Random random) { int item = random.nextInt(16); - switch(item) - { - case 0 : + switch (item) { + case 0: return new ItemStack(ItemsAether.zanite_pickaxe); - case 1 : + case 1: return new ItemStack(ItemsAether.skyroot_bucket); - case 2 : + case 2: return new ItemStack(ItemsAether.dart_shooter); - case 3 : + case 3: return ItemMoaEgg.getStackFromType(AetherMoaTypes.white); - case 4 : + case 4: return new ItemStack(ItemsAether.ambrosium_shard, random.nextInt(10) + 1); - case 5 : + case 5: return new ItemStack(ItemsAether.dart, random.nextInt(5) + 1, 0); - case 6 : + case 6: return new ItemStack(ItemsAether.dart, random.nextInt(3) + 1, 1); - case 7 : + case 7: return new ItemStack(ItemsAether.dart, random.nextInt(3) + 1, 2); - case 8 : - { - if(random.nextInt(20) == 0) + case 8: { + if (random.nextInt(20) == 0) return new ItemStack(ItemsAether.aether_tune); break; } - case 9 : + case 9: return new ItemStack(ItemsAether.skyroot_bucket, 1, 2); - case 10 : - { - if(random.nextInt(10) == 0) + case 10: { + if (random.nextInt(10) == 0) return new ItemStack(ItemsAether.ascending_dawn); break; } - case 11 : - { - if(random.nextInt(2) == 0) + case 11: { + if (random.nextInt(2) == 0) return new ItemStack(ItemsAether.zanite_boots); - if(random.nextInt(2) == 0) + if (random.nextInt(2) == 0) return new ItemStack(ItemsAether.zanite_helmet); - if(random.nextInt(2) == 0) + if (random.nextInt(2) == 0) return new ItemStack(ItemsAether.zanite_leggings); - if(random.nextInt(2) == 0) + if (random.nextInt(2) == 0) return new ItemStack(ItemsAether.zanite_chestplate); break; } - case 12 : - { - if(random.nextInt(4) == 0) + case 12: { + if (random.nextInt(4) == 0) return new ItemStack(ItemsAether.iron_pendant); } - case 13 : - { - if(random.nextInt(10) == 0) + case 13: { + if (random.nextInt(10) == 0) return new ItemStack(ItemsAether.golden_pendant); } - case 14 : - { - if(random.nextInt(15) == 0) + case 14: { + if (random.nextInt(15) == 0) return new ItemStack(ItemsAether.zanite_ring); } } @@ -606,60 +512,54 @@ public class ComponentSilverDungeon extends AetherStructure return new ItemStack(BlocksAether.ambrosium_torch, random.nextInt(4) + 1); } - public static ItemStack getSilverLoot(Random random) - { + public static ItemStack getSilverLoot(Random random) { int item = random.nextInt(13); - switch(item) - { - case 0 : + switch (item) { + case 0: return new ItemStack(ItemsAether.gummy_swet, random.nextInt(15) + 1); - case 1 : + case 1: return new ItemStack(ItemsAether.lightning_sword); - case 2 : - { - if(random.nextBoolean()) + case 2: { + if (random.nextBoolean()) return new ItemStack(ItemsAether.valkyrie_axe); - if(random.nextBoolean()) + if (random.nextBoolean()) return new ItemStack(ItemsAether.valkyrie_shovel); - if(random.nextBoolean()) + if (random.nextBoolean()) return new ItemStack(ItemsAether.valkyrie_pickaxe); break; } - case 3 : + case 3: return new ItemStack(ItemsAether.holy_sword); - case 4 : - return new ItemStack(ItemsAether.valkyrie_helmet); - case 5 : + case 4: + return new ItemStack(ItemsAether.valkyrie_helmet); + case 5: return new ItemStack(ItemsAether.regeneration_stone); - case 6 : - { - if(random.nextBoolean()) + case 6: { + if (random.nextBoolean()) return new ItemStack(ItemsAether.neptune_helmet); - if(random.nextBoolean()) + if (random.nextBoolean()) return new ItemStack(ItemsAether.neptune_leggings); - if(random.nextBoolean()) + if (random.nextBoolean()) return new ItemStack(ItemsAether.neptune_chestplate); break; } - case 7 : - { - if(random.nextBoolean()) + case 7: { + if (random.nextBoolean()) return new ItemStack(ItemsAether.neptune_boots); return new ItemStack(ItemsAether.neptune_gloves); } - case 8 : + case 8: return new ItemStack(ItemsAether.invisibility_cape); - case 9 : - { - if(random.nextBoolean()) + case 9: { + if (random.nextBoolean()) return new ItemStack(ItemsAether.valkyrie_boots); return new ItemStack(ItemsAether.valkyrie_gloves); } - case 10 : + case 10: return new ItemStack(ItemsAether.valkyrie_leggings); - case 11 : - if(random.nextBoolean()) + case 11: + if (random.nextBoolean()) return new ItemStack(ItemsAether.valkyrie_chestplate); } return new ItemStack(ItemsAether.golden_feather); diff --git a/src/main/java/com/legacy/aether/world/util/AetherPortalPosition.java b/src/main/java/com/legacy/aether/world/util/AetherPortalPosition.java index f9ac569..d55fdbc 100644 --- a/src/main/java/com/legacy/aether/world/util/AetherPortalPosition.java +++ b/src/main/java/com/legacy/aether/world/util/AetherPortalPosition.java @@ -2,13 +2,11 @@ package com.legacy.aether.world.util; import net.minecraft.util.ChunkCoordinates; -public class AetherPortalPosition extends ChunkCoordinates -{ +public class AetherPortalPosition extends ChunkCoordinates { public long lastUpdateTime; - public AetherPortalPosition(int x, int y, int z, long lastUpdateTime) - { + public AetherPortalPosition(int x, int y, int z, long lastUpdateTime) { super(x, y, z); this.lastUpdateTime = lastUpdateTime;