diff --git a/.gitignore b/.gitignore index 63c3de5b..e4d0bcf0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,80 +1,82 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# ========================= -# MCP Files -# ========================= -.classpath -.gradle/2.0/taskArtifacts/cache.properties -.gradle/2.0/taskArtifacts/cache.properties.lock -*.bin -.gradle/gradle.log +### Windows ### + +thumbs.db +*.db + +### Java ### + +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear +*.txt + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Eclipse ### + +*.pydevproject +.metadata +.gradle +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +/eclipse +/run + +# Eclipse Core .project -.settings/org.eclipse.jdt.core.prefs -CREDITS-fml.txt -*.location -eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree -eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs -eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs -*.prefs -eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" *.launch -eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml -*.jar -forge-1.8-11.14.0.1299-changelog.txt -README.txt -MinecraftForge-License.txt -MinecraftForge-Credits.txt -gradlew + +# CDT-specific +.cproject + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Java annotation processor (APT) +.factorypath + +# PDT-specific +.buildpath + +# sbteclipse plugin +.target + +# TeXlipse plugin +.texlipse + +### Intellij IDEA ### + +*.iml +*.ipr +*.iws + +.idea/ +.idea_modules/ +classes/ + +/out/ gradle/wrapper/gradle-wrapper.properties -*.bat -LICENSE-fml.txt -forge-1.7.10-10.13.2.1230-changelog.txt -bin/* -eclipse/* -/bin/ +gradlew +gradlew.bat + +# Linux +*~ \ No newline at end of file diff --git a/.gradle/2.8/taskArtifacts/cache.properties b/.gradle/2.8/taskArtifacts/cache.properties deleted file mode 100644 index 5c200f6b..00000000 --- a/.gradle/2.8/taskArtifacts/cache.properties +++ /dev/null @@ -1 +0,0 @@ -#Sat Apr 09 04:34:14 EDT 2016 diff --git a/.gradle/2.8/taskArtifacts/cache.properties.lock b/.gradle/2.8/taskArtifacts/cache.properties.lock deleted file mode 100644 index 14a01380..00000000 Binary files a/.gradle/2.8/taskArtifacts/cache.properties.lock and /dev/null differ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..675c11dc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,34 @@ +sudo: required +dist: trusty + +language: java +jdk: oraclejdk8 + +before_cache: + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock + - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ + - rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/providedDummy.jar + - rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/compileDummy.jar +cache: + directories: + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ + +before_install: chmod +x gradlew +install: + - ./gradlew setupCIWorkspace -S +script: + - ./gradlew build + +deploy: + provider: releases + api_key: + secure: "eAH5VmzD1reEhytSz4vx37IehXfG4IiV3QAEGBvK0xCN3OW/9se6U80t/ymIOKpsxvSlTyuOF/yJ4Q6+VsUl0SjFhu93k3lgoO2iT39NIvnAR6R/cN+vWGUX7kjKV6+h1n71vFV6ok4k8GXqPNDits6DMg97j5lX0w5IUDzoCkz8sTE5ScmJFoMeG+jlETnSsmvkwZabdkta+KzpYDolzAHQ5VbBb0/gu9rSF56fxyXySs8D441eSY0Gc2vl5VC0pHVW0jlfXiGo+Njsb0SuGR2bqbIj122X6dk1rH1u2rYml7QW+jA3MWpPk8CRuRlI2yMnlf4yLRfIgnwa5PLOakici5vAlIvufHaEn16QOc1SpNO/LHRWvAtDCoUJARMrnjaWqGOguuEvhqoXEvl8OfX4CCwoaHGJ5O826G6qS8BjQbfxT6Ew8LZZzWqDhHPVfu3ySDquGNdXRrq8z3cKPkkg8ApLzPBaxDG0nf3AQDSxB/0wnYRZYKmii2wsWSbyC6AqaI1l24pocsCMV2hL1MBtouNl3nheTwfBaEbxVC/CzrTfSlGO0tyD+6oRRH9mRX+ZAWl+Evua7OmVNeVBZhbYVeInJGfwzjjAqCgbumOMcHqomkevEaCWqDU3wjExNL5USlwEh22yq9+uwAZDbio8UcgViMiFWkAIdwLEOMg=" + file_glob: true + file: $HOME/build/libs/* + skip_cleanup: true + on: + tags: true + +notifications: + email: false \ No newline at end of file diff --git a/Changelog.txt b/Changelog.txt deleted file mode 100644 index 088b7780..00000000 --- a/Changelog.txt +++ /dev/null @@ -1,3 +0,0 @@ -Alpha 2.6.13 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*Changed food values (balanced on a sugar/carbs/fats system) \ No newline at end of file diff --git a/README.md b/README.md index f830dd1f..59fd2e43 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ -# MineFantasy2 (2.6.10+) -Try keep it neat \ No newline at end of file +# MineFantasy2 Unofficial [![Travis CI](https://travis-ci.org/Sirse/MineFantasyII-Cont.svg?branch=master)](https://travis-ci.org/Sirse/MineFantasyII-Cont) [![CurseForge](http://cf.way2muchnoise.eu/minefantasy2.svg)](https://minecraft.curseforge.com/projects/minefantasy2) + +Unofficial, but approved MineFantasy 2 fork aimed for cross-mod integration, bug fixes, stability and perfomance tweaks. + +### Useful links: + +- Join a discussion at [our Minecraft forum thread](https://minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/wip-mods/2467203-minefantasy2-alpha) +- Downloads are avaliable on [releases page](https://github.com/Sirse/MineFantasyII-Cont/releases) +- Feedback are needed! If you found an issue, please, [report it!](https://github.com/Sirse/MineFantasyII-Cont/issues) + +#### Also, you are can support MineFantasy II Unofficial developing [via donation!](https://www.paypal.me/sirse) diff --git a/TODO/Dwarvenforged/DwarvenForgedStyle.java b/TODO/Dwarvenforged/DwarvenForgedStyle.java new file mode 100644 index 00000000..bfd18af6 --- /dev/null +++ b/TODO/Dwarvenforged/DwarvenForgedStyle.java @@ -0,0 +1,79 @@ +package minefantasy.mf2.item.list.styles; + +import minefantasy.mf2.api.armour.ArmourDesign; +import minefantasy.mf2.api.crafting.exotic.SpecialForging; +import minefantasy.mf2.item.archery.EnumBowType; +import minefantasy.mf2.item.archery.ItemBowMF; +import minefantasy.mf2.item.armour.ItemCustomArmour; +import minefantasy.mf2.item.list.CreativeTabMF; +import minefantasy.mf2.item.list.CustomArmourListMF; +import minefantasy.mf2.item.list.CustomToolListMF; +import minefantasy.mf2.item.tool.ItemAxeMF; +import minefantasy.mf2.item.tool.ItemHoeMF; +import minefantasy.mf2.item.tool.ItemPickMF; +import minefantasy.mf2.item.tool.ItemShearsMF; +import minefantasy.mf2.item.tool.ItemSpadeMF; +import minefantasy.mf2.item.tool.advanced.ItemHandpick; +import minefantasy.mf2.item.tool.advanced.ItemHvyPick; +import minefantasy.mf2.item.tool.advanced.ItemHvyShovel; +import minefantasy.mf2.item.tool.advanced.ItemLumberAxe; +import minefantasy.mf2.item.tool.advanced.ItemMattock; +import minefantasy.mf2.item.tool.advanced.ItemScythe; +import minefantasy.mf2.item.tool.advanced.ItemTrowMF; +import minefantasy.mf2.item.tool.crafting.ItemHammer; +import minefantasy.mf2.item.tool.crafting.ItemKnifeMF; +import minefantasy.mf2.item.tool.crafting.ItemNeedle; +import minefantasy.mf2.item.tool.crafting.ItemSaw; +import minefantasy.mf2.item.tool.crafting.ItemSpanner; +import minefantasy.mf2.item.tool.crafting.ItemTongs; +import minefantasy.mf2.item.weapon.ItemBattleaxeMF; +import minefantasy.mf2.item.weapon.ItemDagger; +import minefantasy.mf2.item.weapon.ItemGreatswordMF; +import minefantasy.mf2.item.weapon.ItemHalbeardMF; +import minefantasy.mf2.item.weapon.ItemKatanaMF; +import minefantasy.mf2.item.weapon.ItemLance; +import minefantasy.mf2.item.weapon.ItemMaceMF; +import minefantasy.mf2.item.weapon.ItemSpearMF; +import minefantasy.mf2.item.weapon.ItemSwordMF; +import minefantasy.mf2.item.weapon.ItemWaraxeMF; +import minefantasy.mf2.item.weapon.ItemWarhammerMF; +import minefantasy.mf2.item.weapon.ItemWeaponMF; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraftforge.common.util.EnumHelper; + +public class DwarvenForgedStyle { + public static ToolMaterial dwarvenforged = EnumHelper.addToolMaterial("dwarvenforged", 2, 225, 5.5F, 1.5F, 12); + + public static ItemWeaponMF dwarvenforged_longsword; + + public static ItemPickMF dwarvenforged_pick; + + + + + public static void load() { + String design = "dwarvenforged"; + CreativeTabs tab = CreativeTabMF.tabDwarvenforged; + ToolMaterial mat = dwarvenforged; + float ratingMod = 1.2F; + + + dwarvenforged_longsword = new ItemSwordMF(design + "_longsword", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + + + // Tools + dwarvenforged_pick = (ItemPickMF) new ItemPickMF(design + "_pick", mat, 0).setCustom(design).setCreativeTab(tab); + + + // Crafters + + + + } + + public static void loadCrafting() { + + } +} diff --git a/TODO/Unimplemented/Growthcraftforkdeer.java b/TODO/Unimplemented/Growthcraftforkdeer.java new file mode 100644 index 00000000..e2b7738d --- /dev/null +++ b/TODO/Unimplemented/Growthcraftforkdeer.java @@ -0,0 +1,306 @@ +package Mob; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +/** + * MFII/Growthcraft fork deer - Undefined + * Created using Tabula 5.1.0 + */ +public class MFII/Growthcraftforkdeer extends ModelBase { + public ModelRenderer Bodyfront; + public ModelRenderer Bodyback; + public ModelRenderer ShoulderR; + public ModelRenderer ShoulderL; + public ModelRenderer Neck1; + public ModelRenderer ThighR; + public ModelRenderer ThighL; + public ModelRenderer Tail1; + public ModelRenderer ShinR; + public ModelRenderer HeelR; + public ModelRenderer FootR; + public ModelRenderer shape33; + public ModelRenderer shape34; + public ModelRenderer ShinL; + public ModelRenderer HeelL; + public ModelRenderer FootL; + public ModelRenderer shape35; + public ModelRenderer shape36; + public ModelRenderer UpperarmR; + public ModelRenderer UnderarmR; + public ModelRenderer FootfrontR; + public ModelRenderer shape29; + public ModelRenderer shape30; + public ModelRenderer UpperarmL; + public ModelRenderer UnderarmL; + public ModelRenderer FootfrontL; + public ModelRenderer shape31; + public ModelRenderer shape32; + public ModelRenderer Neck2; + public ModelRenderer Neck3; + public ModelRenderer Head1; + public ModelRenderer Head2; + public ModelRenderer Lowerjaw; + public ModelRenderer AntlerbaseR; + public ModelRenderer Antlerbase; + public ModelRenderer shape73; + public ModelRenderer shape74; + public ModelRenderer Headtop; + public ModelRenderer AntlerR; + public ModelRenderer AntlerR2; + public ModelRenderer AntlerR3; + public ModelRenderer AntlerR7; + public ModelRenderer AntlerL; + public ModelRenderer AntlerL3; + public ModelRenderer AntlerL2; + public ModelRenderer AntlerL7; + + public MFII/Growthcraftforkdeer() { + this.textureWidth = 256; + this.textureHeight = 128; + this.shape34 = new ModelRenderer(this, 70, 75); + this.shape34.setRotationPoint(1.3F, 0.0F, -0.1F); + this.shape34.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape34, -0.18203784098300857F, -0.40980330836826856F, 0.0F); + this.Neck2 = new ModelRenderer(this, 5, 45); + this.Neck2.setRotationPoint(0.0F, 0.5F, -3.5F); + this.Neck2.addBox(-2.0F, 0.0F, -4.0F, 4, 5, 5, 0.0F); + this.setRotateAngle(Neck2, -0.40980330836826856F, 0.0F, 0.0F); + this.UnderarmL = new ModelRenderer(this, 70, 90); + this.UnderarmL.setRotationPoint(0.0F, 6.0F, -3.0F); + this.UnderarmL.addBox(-2.0F, 0.0F, 0.0F, 2, 6, 2, 0.0F); + this.setRotateAngle(UnderarmL, -0.091106186954104F, 0.0F, 0.0F); + this.shape31 = new ModelRenderer(this, 70, 75); + this.shape31.setRotationPoint(-1.2F, 0.0F, -0.2F); + this.shape31.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape31, -0.18203784098300857F, 0.40980330836826856F, 0.0F); + this.Tail1 = new ModelRenderer(this, 5, 25); + this.Tail1.setRotationPoint(0.0F, 0.3F, 11.0F); + this.Tail1.addBox(-1.5F, 0.0F, -2.0F, 3, 4, 2, 0.0F); + this.setRotateAngle(Tail1, 0.31869712141416456F, 0.0F, 0.0F); + this.AntlerR2 = new ModelRenderer(this, 70, 50); + this.AntlerR2.setRotationPoint(-0.01F, 0.5F, 0.8F); + this.AntlerR2.addBox(0.0F, 0.0F, -2.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(AntlerR2, -0.8196066167365371F, -0.045553093477052F, 0.0F); + this.AntlerL3 = new ModelRenderer(this, 72, 67); + this.AntlerL3.setRotationPoint(0.0F, 0.0F, 3.5F); + this.AntlerL3.addBox(-1.0F, 0.0F, 0.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(AntlerL3, 0.27314402793711257F, -0.27314402793711257F, 0.0F); + this.shape36 = new ModelRenderer(this, 70, 75); + this.shape36.setRotationPoint(-1.3F, 0.0F, -0.1F); + this.shape36.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape36, -0.18203784098300857F, 0.40980330836826856F, 0.0F); + this.Antlerbase = new ModelRenderer(this, 70, 45); + this.Antlerbase.setRotationPoint(1.5F, 0.0F, -2.1F); + this.Antlerbase.addBox(-1.0F, -1.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Antlerbase, -0.136659280431156F, -0.045553093477052F, 0.136659280431156F); + this.Lowerjaw = new ModelRenderer(this, 40, 30); + this.Lowerjaw.setRotationPoint(0.0F, 4.0F, -4.5F); + this.Lowerjaw.addBox(-1.0F, -1.0F, -5.0F, 2, 1, 5, 0.0F); + this.setRotateAngle(Lowerjaw, -0.091106186954104F, 0.0F, 0.0F); + this.UpperarmR = new ModelRenderer(this, 70, 100); + this.UpperarmR.setRotationPoint(0.2F, 6.0F, 4.5F); + this.UpperarmR.addBox(0.0F, 0.0F, -3.0F, 2, 7, 3, 0.0F); + this.setRotateAngle(UpperarmR, -0.31869712141416456F, -0.091106186954104F, -0.18203784098300857F); + this.FootL = new ModelRenderer(this, 100, 75); + this.FootL.setRotationPoint(0.0F, 8.0F, -2.0F); + this.FootL.addBox(-2.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F); + this.setRotateAngle(FootL, 0.22759093446006054F, 0.0F, 0.0F); + this.shape30 = new ModelRenderer(this, 70, 75); + this.shape30.setRotationPoint(1.2F, 0.0F, -0.2F); + this.shape30.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape30, -0.18203784098300857F, -0.40980330836826856F, 0.0F); + this.AntlerL7 = new ModelRenderer(this, 70, 55); + this.AntlerL7.setRotationPoint(-0.4F, 0.0F, 1.5F); + this.AntlerL7.addBox(0.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); + this.setRotateAngle(AntlerL7, 0.0F, -0.6373942428283291F, -0.27314402793711257F); + this.AntlerbaseR = new ModelRenderer(this, 70, 45); + this.AntlerbaseR.setRotationPoint(-1.5F, 0.0F, -2.1F); + this.AntlerbaseR.addBox(0.0F, -1.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(AntlerbaseR, -0.136659280431156F, 0.045553093477052F, -0.136659280431156F); + this.ThighR = new ModelRenderer(this, 100, 113); + this.ThighR.setRotationPoint(-4.6F, 2.0F, 3.9F); + this.ThighR.addBox(0.0F, 0.0F, 0.0F, 4, 8, 6, 0.0F); + this.setRotateAngle(ThighR, 0.091106186954104F, 0.0F, 0.136659280431156F); + this.FootR = new ModelRenderer(this, 100, 75); + this.FootR.setRotationPoint(0.0F, 8.0F, -2.0F); + this.FootR.addBox(0.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F); + this.setRotateAngle(FootR, 0.22759093446006054F, 0.0F, 0.0F); + this.shape35 = new ModelRenderer(this, 70, 75); + this.shape35.setRotationPoint(-0.8F, 0.0F, -0.2F); + this.shape35.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape35, -0.18203784098300857F, -0.36425021489121656F, 0.0F); + this.HeelL = new ModelRenderer(this, 100, 85); + this.HeelL.setRotationPoint(-0.5F, 8.0F, 3.8F); + this.HeelL.addBox(-2.0F, 0.0F, -2.0F, 2, 8, 2, 0.0F); + this.setRotateAngle(HeelL, -1.0471975511965976F, 0.0F, 0.0F); + this.Head2 = new ModelRenderer(this, 40, 40); + this.Head2.setRotationPoint(0.0F, 0.9F, -3.8F); + this.Head2.addBox(-1.0F, 0.0F, -6.0F, 2, 2, 6, 0.0F); + this.setRotateAngle(Head2, 0.045553093477052F, 0.0F, 0.0F); + this.shape73 = new ModelRenderer(this, 0, 0); + this.shape73.setRotationPoint(-1.5F, 0.1F, -0.5F); + this.shape73.addBox(0.0F, 0.0F, 0.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(shape73, 0.31869712141416456F, -0.136659280431156F, 0.0F); + this.Neck3 = new ModelRenderer(this, 5, 35); + this.Neck3.setRotationPoint(0.0F, 0.0F, -4.0F); + this.Neck3.addBox(-1.5F, 0.0F, -4.0F, 3, 4, 4, 0.0F); + this.setRotateAngle(Neck3, 0.22759093446006054F, 0.0F, 0.0F); + this.FootfrontR = new ModelRenderer(this, 70, 80); + this.FootfrontR.setRotationPoint(0.0F, 6.0F, 0.0F); + this.FootfrontR.addBox(0.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F); + this.setRotateAngle(FootfrontR, 0.22759093446006054F, 0.0F, 0.0F); + this.shape32 = new ModelRenderer(this, 70, 75); + this.shape32.setRotationPoint(-0.8F, 0.0F, -0.3F); + this.shape32.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape32, -0.18203784098300857F, -0.40980330836826856F, 0.0F); + this.AntlerR7 = new ModelRenderer(this, 70, 55); + this.AntlerR7.setRotationPoint(0.4F, 0.0F, 1.5F); + this.AntlerR7.addBox(-2.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); + this.setRotateAngle(AntlerR7, 0.0F, 0.6373942428283291F, 0.27314402793711257F); + this.AntlerR3 = new ModelRenderer(this, 72, 67); + this.AntlerR3.setRotationPoint(0.0F, 0.0F, 3.5F); + this.AntlerR3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(AntlerR3, 0.27314402793711257F, 0.27314402793711257F, 0.0F); + this.Head1 = new ModelRenderer(this, 40, 60); + this.Head1.setRotationPoint(0.0F, -0.4F, -3.5F); + this.Head1.addBox(-1.5F, 0.0F, -5.0F, 3, 4, 5, 0.0F); + this.setRotateAngle(Head1, 0.6373942428283291F, 0.0F, 0.0F); + this.Bodyfront = new ModelRenderer(this, 5, 100); + this.Bodyfront.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Bodyfront.addBox(-4.5F, 0.0F, 0.0F, 9, 10, 12, 0.0F); + this.setRotateAngle(Bodyfront, 0.091106186954104F, 0.0F, 0.0F); + this.shape74 = new ModelRenderer(this, 0, 0); + this.shape74.setRotationPoint(1.5F, -0.1F, -0.5F); + this.shape74.addBox(-1.0F, 0.0F, 0.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(shape74, 0.31869712141416456F, 0.136659280431156F, 0.0F); + this.ShoulderL = new ModelRenderer(this, 70, 115); + this.ShoulderL.setRotationPoint(5.0F, 3.5F, 2.0F); + this.ShoulderL.addBox(-3.0F, 0.0F, 0.0F, 3, 7, 5, 0.0F); + this.setRotateAngle(ShoulderL, 0.091106186954104F, 0.0F, -0.22759093446006054F); + this.ShinR = new ModelRenderer(this, 100, 100); + this.ShinR.setRotationPoint(0.5F, 8.0F, 0.0F); + this.ShinR.addBox(0.0F, 0.0F, 0.0F, 3, 8, 4, 0.0F); + this.setRotateAngle(ShinR, 0.8196066167365371F, 0.0F, -0.136659280431156F); + this.Headtop = new ModelRenderer(this, 40, 50); + this.Headtop.setRotationPoint(0.0F, -0.9F, -1.0F); + this.Headtop.addBox(-1.0F, 0.0F, -5.0F, 2, 1, 5, 0.0F); + this.setRotateAngle(Headtop, 0.18203784098300857F, 0.0F, 0.0F); + this.ThighL = new ModelRenderer(this, 100, 113); + this.ThighL.setRotationPoint(4.6F, 2.0F, 3.9F); + this.ThighL.addBox(-4.0F, 0.0F, 0.0F, 4, 8, 6, 0.0F); + this.setRotateAngle(ThighL, 0.091106186954104F, 0.0F, -0.136659280431156F); + this.FootfrontL = new ModelRenderer(this, 70, 80); + this.FootfrontL.setRotationPoint(0.0F, 6.0F, 0.0F); + this.FootfrontL.addBox(-2.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F); + this.setRotateAngle(FootfrontL, 0.22759093446006054F, 0.0F, 0.0F); + this.ShoulderR = new ModelRenderer(this, 70, 115); + this.ShoulderR.setRotationPoint(-5.0F, 3.5F, 2.0F); + this.ShoulderR.addBox(0.0F, 0.0F, 0.0F, 3, 7, 5, 0.0F); + this.setRotateAngle(ShoulderR, 0.045553093477052F, 0.0F, 0.22759093446006054F); + this.Bodyback = new ModelRenderer(this, 5, 75); + this.Bodyback.setRotationPoint(0.0F, 0.1F, 12.0F); + this.Bodyback.addBox(-4.0F, 0.0F, 0.0F, 8, 10, 11, 0.0F); + this.setRotateAngle(Bodyback, -0.18203784098300857F, 0.0F, 0.0F); + this.UpperarmL = new ModelRenderer(this, 70, 100); + this.UpperarmL.setRotationPoint(-0.2F, 6.0F, 4.5F); + this.UpperarmL.addBox(-2.0F, 0.0F, -3.0F, 2, 7, 3, 0.0F); + this.setRotateAngle(UpperarmL, -0.31869712141416456F, 0.091106186954104F, 0.18203784098300857F); + this.AntlerR = new ModelRenderer(this, 70, 65); + this.AntlerR.setRotationPoint(0.0F, -1.0F, 0.0F); + this.AntlerR.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(AntlerR, 0.4553564018453205F, -0.27314402793711257F, 0.0F); + this.HeelR = new ModelRenderer(this, 100, 85); + this.HeelR.setRotationPoint(0.5F, 8.0F, 3.8F); + this.HeelR.addBox(0.0F, 0.0F, -2.0F, 2, 8, 2, 0.0F); + this.setRotateAngle(HeelR, -1.0471975511965976F, 0.0F, 0.0F); + this.AntlerL2 = new ModelRenderer(this, 70, 50); + this.AntlerL2.setRotationPoint(0.01F, 0.5F, 0.8F); + this.AntlerL2.addBox(-1.0F, 0.0F, -2.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(AntlerL2, -0.8196066167365371F, 0.045553093477052F, 0.0F); + this.UnderarmR = new ModelRenderer(this, 70, 90); + this.UnderarmR.setRotationPoint(0.0F, 6.0F, -3.0F); + this.UnderarmR.addBox(0.0F, 0.0F, 0.0F, 2, 6, 2, 0.0F); + this.setRotateAngle(UnderarmR, -0.091106186954104F, 0.0F, 0.0F); + this.Neck1 = new ModelRenderer(this, 5, 60); + this.Neck1.setRotationPoint(0.0F, 1.0F, 3.0F); + this.Neck1.addBox(-2.5F, 0.0F, -5.0F, 5, 7, 5, 0.0F); + this.setRotateAngle(Neck1, -0.40980330836826856F, 0.0F, 0.0F); + this.shape33 = new ModelRenderer(this, 70, 75); + this.shape33.setRotationPoint(0.8F, 0.0F, -0.2F); + this.shape33.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape33, -0.09599310885968812F, 0.36425021489121656F, 0.0F); + this.ShinL = new ModelRenderer(this, 100, 100); + this.ShinL.setRotationPoint(-0.5F, 8.0F, 0.0F); + this.ShinL.addBox(-3.0F, 0.0F, 0.0F, 3, 8, 4, 0.0F); + this.setRotateAngle(ShinL, 0.8196066167365371F, 0.0F, 0.136659280431156F); + this.shape29 = new ModelRenderer(this, 70, 75); + this.shape29.setRotationPoint(0.8F, 0.0F, -0.3F); + this.shape29.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape29, -0.18203784098300857F, 0.40980330836826856F, 0.0F); + this.AntlerL = new ModelRenderer(this, 70, 65); + this.AntlerL.setRotationPoint(0.0F, -1.0F, 0.0F); + this.AntlerL.addBox(-1.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(AntlerL, 0.4553564018453205F, 0.27314402793711257F, 0.0F); + this.FootR.addChild(this.shape34); + this.Neck1.addChild(this.Neck2); + this.UpperarmL.addChild(this.UnderarmL); + this.FootfrontL.addChild(this.shape31); + this.Bodyback.addChild(this.Tail1); + this.AntlerR.addChild(this.AntlerR2); + this.AntlerL.addChild(this.AntlerL3); + this.FootL.addChild(this.shape36); + this.Head1.addChild(this.Antlerbase); + this.Head1.addChild(this.Lowerjaw); + this.ShoulderR.addChild(this.UpperarmR); + this.HeelL.addChild(this.FootL); + this.FootfrontR.addChild(this.shape30); + this.AntlerL.addChild(this.AntlerL7); + this.Head1.addChild(this.AntlerbaseR); + this.Bodyback.addChild(this.ThighR); + this.HeelR.addChild(this.FootR); + this.FootL.addChild(this.shape35); + this.ShinL.addChild(this.HeelL); + this.Head1.addChild(this.Head2); + this.Head1.addChild(this.shape73); + this.Neck2.addChild(this.Neck3); + this.UnderarmR.addChild(this.FootfrontR); + this.FootfrontL.addChild(this.shape32); + this.AntlerR.addChild(this.AntlerR7); + this.AntlerR.addChild(this.AntlerR3); + this.Neck3.addChild(this.Head1); + this.Head1.addChild(this.shape74); + this.Bodyfront.addChild(this.ShoulderL); + this.ThighR.addChild(this.ShinR); + this.Head2.addChild(this.Headtop); + this.Bodyback.addChild(this.ThighL); + this.UnderarmL.addChild(this.FootfrontL); + this.Bodyfront.addChild(this.ShoulderR); + this.Bodyfront.addChild(this.Bodyback); + this.ShoulderL.addChild(this.UpperarmL); + this.AntlerbaseR.addChild(this.AntlerR); + this.ShinR.addChild(this.HeelR); + this.AntlerL.addChild(this.AntlerL2); + this.UpperarmR.addChild(this.UnderarmR); + this.Bodyfront.addChild(this.Neck1); + this.FootR.addChild(this.shape33); + this.ThighL.addChild(this.ShinL); + this.FootfrontR.addChild(this.shape29); + this.Antlerbase.addChild(this.AntlerL); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.Bodyfront.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; + } +} diff --git a/TODO/Unimplemented/Hardoth-texture.png b/TODO/Unimplemented/Hardoth-texture.png new file mode 100644 index 00000000..5f4c3426 Binary files /dev/null and b/TODO/Unimplemented/Hardoth-texture.png differ diff --git a/TODO/Unimplemented/Hardoth.java b/TODO/Unimplemented/Hardoth.java new file mode 100644 index 00000000..e1222226 --- /dev/null +++ b/TODO/Unimplemented/Hardoth.java @@ -0,0 +1,273 @@ +package Mob; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +/** + * Hardoth - Undefined + * Created using Tabula 5.1.0 + */ +public class Hardoth extends ModelBase { + public ModelRenderer Torsoback; + public ModelRenderer Back; + public ModelRenderer Torsobelly; + public ModelRenderer ShoulderR; + public ModelRenderer ShoulderL; + public ModelRenderer Neck1; + public ModelRenderer Bellyback; + public ModelRenderer Tail1; + public ModelRenderer ThighR; + public ModelRenderer ThighL; + public ModelRenderer Tail2; + public ModelRenderer Tail3; + public ModelRenderer Tail4; + public ModelRenderer LegR; + public ModelRenderer FootR; + public ModelRenderer LegL; + public ModelRenderer FootL; + public ModelRenderer ArmR; + public ModelRenderer FrontfootR; + public ModelRenderer ArmL; + public ModelRenderer FrontfootL; + public ModelRenderer Neck2; + public ModelRenderer Neckunder; + public ModelRenderer Neck3; + public ModelRenderer Headneck; + public ModelRenderer Upperjaw; + public ModelRenderer Headtop1; + public ModelRenderer Gums; + public ModelRenderer Upperbeak1; + public ModelRenderer Beaktusk2; + public ModelRenderer Beaktusk1; + public ModelRenderer Upperbeak2; + public ModelRenderer Upperbeak3; + public ModelRenderer Headtop2; + public ModelRenderer shape41; + public ModelRenderer Headtop3; + public ModelRenderer Lowerjaw; + public ModelRenderer Lowerbeak1; + public ModelRenderer Lowerbeak2; + public ModelRenderer Lowerbeak3; + + public Hardoth() { + this.textureWidth = 256; + this.textureHeight = 256; + this.Lowerjaw = new ModelRenderer(this, 29, 40); + this.Lowerjaw.setRotationPoint(0.0F, 3.1F, 0.0F); + this.Lowerjaw.addBox(-2.0F, -2.0F, -7.0F, 4, 2, 7, 0.0F); + this.Upperbeak3 = new ModelRenderer(this, 35, 65); + this.Upperbeak3.setRotationPoint(2.5F, 0.7F, -7.2F); + this.Upperbeak3.addBox(-1.0F, 0.0F, 0.0F, 1, 2, 3, 0.0F); + this.setRotateAngle(Upperbeak3, 0.091106186954104F, 0.0F, -0.18203784098300857F); + this.Upperjaw = new ModelRenderer(this, 5, 49); + this.Upperjaw.setRotationPoint(0.0F, 2.7F, -3.65F); + this.Upperjaw.addBox(-2.5F, 0.0F, -8.0F, 5, 2, 8, 0.0F); + this.setRotateAngle(Upperjaw, -0.136659280431156F, 0.0F, 0.0F); + this.Lowerbeak1 = new ModelRenderer(this, 45, 75); + this.Lowerbeak1.setRotationPoint(0.0F, -0.2F, -7.0F); + this.Lowerbeak1.addBox(-1.5F, -2.0F, 0.0F, 3, 2, 1, 0.0F); + this.setRotateAngle(Lowerbeak1, 0.40980330836826856F, 0.0F, 0.0F); + this.Tail3 = new ModelRenderer(this, 5, 100); + this.Tail3.setRotationPoint(0.0F, 1.0F, 6.0F); + this.Tail3.addBox(-3.0F, 0.0F, 0.0F, 6, 8, 9, 0.0F); + this.setRotateAngle(Tail3, 0.091106186954104F, -6.200655107570901E-17F, 0.0F); + this.Neck3 = new ModelRenderer(this, 50, 105); + this.Neck3.setRotationPoint(0.0F, 1.0F, -4.0F); + this.Neck3.addBox(-3.0F, 0.0F, -5.0F, 6, 8, 5, 0.0F); + this.setRotateAngle(Neck3, -0.18203784098300857F, 0.0F, 0.0F); + this.Headneck = new ModelRenderer(this, 5, 60); + this.Headneck.setRotationPoint(-0.02F, 1.0F, -3.0F); + this.Headneck.addBox(-3.0F, 0.0F, -5.0F, 6, 7, 5, 0.0F); + this.setRotateAngle(Headneck, -0.22759093446006054F, 0.0F, 0.0F); + this.Lowerbeak3 = new ModelRenderer(this, 35, 75); + this.Lowerbeak3.setRotationPoint(2.0F, -0.3F, -7.0F); + this.Lowerbeak3.addBox(-1.0F, -2.0F, 0.0F, 1, 2, 3, 0.0F); + this.setRotateAngle(Lowerbeak3, -0.045553093477052F, 0.0F, 0.22759093446006054F); + this.Torsoback = new ModelRenderer(this, 5, 210); + this.Torsoback.setRotationPoint(0.0F, -11.5F, 0.0F); + this.Torsoback.addBox(-8.0F, 0.0F, -21.0F, 16, 20, 21, 0.0F); + this.setRotateAngle(Torsoback, 0.36425021489121656F, 0.0F, 0.0F); + this.FootL = new ModelRenderer(this, 140, 195); + this.FootL.mirror = true; + this.FootL.setRotationPoint(0.0F, 9.0F, 0.0F); + this.FootL.addBox(-5.0F, 0.0F, 0.0F, 5, 6, 7, 0.0F); + this.setRotateAngle(FootL, 0.136659280431156F, 0.0F, 0.136659280431156F); + this.Beaktusk1 = new ModelRenderer(this, 30, 70); + this.Beaktusk1.setRotationPoint(2.4F, 0.3F, -8.0F); + this.Beaktusk1.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(Beaktusk1, -0.18203784098300857F, 0.0F, -0.22759093446006054F); + this.Back = new ModelRenderer(this, 5, 160); + this.Back.setRotationPoint(0.0F, 1.0F, 0.0F); + this.Back.addBox(-7.5F, 0.0F, 0.0F, 15, 18, 27, 0.0F); + this.setRotateAngle(Back, -0.6373942428283291F, 0.0F, 0.0F); + this.Bellyback = new ModelRenderer(this, 100, 30); + this.Bellyback.setRotationPoint(0.0F, 23.800000000000004F, 8.5F); + this.Bellyback.addBox(-6.5F, -7.0F, 0.0F, 13, 7, 19, 0.0F); + this.setRotateAngle(Bellyback, 0.31869712141416456F, 0.0F, 0.0F); + this.Headtop1 = new ModelRenderer(this, 5, 40); + this.Headtop1.setRotationPoint(0.01F, 0.0F, -5.0F); + this.Headtop1.addBox(-2.5F, 0.0F, -3.0F, 5, 3, 3, 0.0F); + this.Neck1 = new ModelRenderer(this, 50, 140); + this.Neck1.setRotationPoint(0.0F, 0.3F, -20.0F); + this.Neck1.addBox(-4.5F, 0.0F, -6.0F, 9, 13, 6, 0.0F); + this.setRotateAngle(Neck1, 0.3186971214141647F, 0.0F, 0.0F); + this.FrontfootL = new ModelRenderer(this, 100, 195); + this.FrontfootL.mirror = true; + this.FrontfootL.setRotationPoint(-0.1F, 7.0F, 0.0F); + this.FrontfootL.addBox(-6.0F, 0.0F, 0.0F, 6, 7, 7, 0.0F); + this.setRotateAngle(FrontfootL, -0.136659280431156F, 0.0F, 0.18203784098300857F); + this.FrontfootR = new ModelRenderer(this, 100, 195); + this.FrontfootR.setRotationPoint(-0.1F, 7.0F, 0.0F); + this.FrontfootR.addBox(0.0F, 0.0F, 0.0F, 6, 7, 7, 0.0F); + this.setRotateAngle(FrontfootR, -0.136659280431156F, 0.0F, -0.18203784098300857F); + this.ThighL = new ModelRenderer(this, 140, 230); + this.ThighL.mirror = true; + this.ThighL.setRotationPoint(8.3F, 6.0F, 16.0F); + this.ThighL.addBox(-6.0F, 0.0F, 0.0F, 6, 10, 8, 0.0F); + this.setRotateAngle(ThighL, 0.0F, 0.0F, -0.36425021489121656F); + this.Lowerbeak2 = new ModelRenderer(this, 35, 75); + this.Lowerbeak2.setRotationPoint(-2.0F, -0.3F, -7.0F); + this.Lowerbeak2.addBox(0.0F, -2.0F, 0.0F, 1, 2, 3, 0.0F); + this.setRotateAngle(Lowerbeak2, -0.045553093477052F, 0.0F, -0.22759093446006054F); + this.Torsobelly = new ModelRenderer(this, 100, 5); + this.Torsobelly.setRotationPoint(0.0F, 20.0F, -19.0F); + this.Torsobelly.addBox(-7.5F, -8.0F, 0.0F, 15, 8, 13, 0.0F); + this.setRotateAngle(Torsobelly, -0.4098033083682685F, 0.0F, 0.0F); + this.Gums = new ModelRenderer(this, 55, 60); + this.Gums.setRotationPoint(0.0F, 3.5F, -4.0F); + this.Gums.addBox(-1.5F, -2.0F, -5.0F, 3, 4, 5, 0.0F); + this.setRotateAngle(Gums, -0.09110618695410407F, 0.0F, 0.0F); + this.Upperbeak1 = new ModelRenderer(this, 45, 65); + this.Upperbeak1.setRotationPoint(0.0F, 0.0F, -8.0F); + this.Upperbeak1.addBox(-1.5F, 0.0F, 0.0F, 3, 3, 1, 0.0F); + this.setRotateAngle(Upperbeak1, -0.27314402793711257F, 0.0F, 0.0F); + this.ShoulderR = new ModelRenderer(this, 100, 230); + this.ShoulderR.setRotationPoint(-9.0F, 7.1F, -16.0F); + this.ShoulderR.addBox(0.0F, 0.0F, 0.0F, 6, 11, 9, 0.0F); + this.setRotateAngle(ShoulderR, -0.091106186954104F, 0.0F, 0.40980330836826856F); + this.Tail1 = new ModelRenderer(this, 5, 138); + this.Tail1.setRotationPoint(0.0F, 1.0F, 26.3F); + this.Tail1.addBox(-5.0F, 0.0F, 0.0F, 10, 13, 8, 0.0F); + this.setRotateAngle(Tail1, -0.27314402793711257F, 0.0F, 0.0F); + this.ShoulderL = new ModelRenderer(this, 100, 230); + this.ShoulderL.mirror = true; + this.ShoulderL.setRotationPoint(9.0F, 7.1F, -16.0F); + this.ShoulderL.addBox(-6.0F, 0.0F, 0.0F, 6, 11, 9, 0.0F); + this.setRotateAngle(ShoulderL, -0.091106186954104F, 0.0F, -0.40980330836826856F); + this.ArmR = new ModelRenderer(this, 100, 210); + this.ArmR.setRotationPoint(0.4F, 10.0F, 0.5F); + this.ArmR.addBox(0.0F, 0.0F, 0.0F, 6, 8, 7, 0.0F); + this.setRotateAngle(ArmR, -0.136659280431156F, 0.0F, -0.18203784098300857F); + this.LegL = new ModelRenderer(this, 140, 210); + this.LegL.mirror = true; + this.LegL.setRotationPoint(-0.5F, 10.0F, 0.0F); + this.LegL.addBox(-5.0F, 0.0F, 0.0F, 5, 9, 7, 0.0F); + this.setRotateAngle(LegL, 0.136659280431156F, 0.0F, 0.18203784098300857F); + this.LegR = new ModelRenderer(this, 140, 210); + this.LegR.setRotationPoint(0.5F, 10.0F, 0.0F); + this.LegR.addBox(0.0F, 0.0F, 0.0F, 5, 9, 7, 0.0F); + this.setRotateAngle(LegR, 0.136659280431156F, 0.0F, -0.18203784098300857F); + this.Beaktusk2 = new ModelRenderer(this, 30, 70); + this.Beaktusk2.setRotationPoint(-2.4F, 0.3F, -8.0F); + this.Beaktusk2.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(Beaktusk2, -0.18203784098300857F, 0.0F, 0.22759093446006054F); + this.Tail2 = new ModelRenderer(this, 5, 119); + this.Tail2.setRotationPoint(0.0F, 1.0F, 6.0F); + this.Tail2.addBox(-4.0F, 0.0F, 0.0F, 8, 10, 8, 0.0F); + this.setRotateAngle(Tail2, 0.091106186954104F, 0.0F, 0.0F); + this.Headtop3 = new ModelRenderer(this, 30, 50); + this.Headtop3.setRotationPoint(0.0F, 0.0F, -2.0F); + this.Headtop3.addBox(-2.5F, 0.0F, -2.0F, 5, 2, 2, 0.0F); + this.setRotateAngle(Headtop3, 0.3124139361069849F, 0.0F, 0.0F); + this.FootR = new ModelRenderer(this, 140, 195); + this.FootR.setRotationPoint(0.0F, 9.0F, 0.0F); + this.FootR.addBox(0.0F, 0.0F, 0.0F, 5, 6, 7, 0.0F); + this.setRotateAngle(FootR, 0.136659280431156F, 0.0F, -0.136659280431156F); + this.Neck2 = new ModelRenderer(this, 50, 120); + this.Neck2.setRotationPoint(0.0F, 1.5F, -3.7F); + this.Neck2.addBox(-3.5F, 0.0F, -6.0F, 7, 10, 7, 0.0F); + this.setRotateAngle(Neck2, -0.04555309347705199F, 0.0F, 0.0F); + this.ThighR = new ModelRenderer(this, 140, 230); + this.ThighR.setRotationPoint(-8.3F, 6.0F, 16.0F); + this.ThighR.addBox(0.0F, 0.0F, 0.0F, 6, 10, 8, 0.0F); + this.setRotateAngle(ThighR, 0.0F, 0.0F, 0.36425021489121656F); + this.Neckunder = new ModelRenderer(this, 50, 80); + this.Neckunder.setRotationPoint(0.0F, 19.4F, -5.0F); + this.Neckunder.addBox(-2.5F, -5.0F, -17.0F, 5, 5, 16, 0.0F); + this.setRotateAngle(Neckunder, -0.8651597102135891F, 0.0F, 0.0F); + this.Upperbeak2 = new ModelRenderer(this, 35, 65); + this.Upperbeak2.setRotationPoint(-2.5F, 0.7F, -7.2F); + this.Upperbeak2.addBox(0.0F, 0.0F, 0.0F, 1, 2, 3, 0.0F); + this.setRotateAngle(Upperbeak2, 0.091106186954104F, 0.0F, 0.18203784098300857F); + this.Tail4 = new ModelRenderer(this, 5, 85); + this.Tail4.setRotationPoint(0.0F, 0.5F, 8.0F); + this.Tail4.addBox(-2.0F, 0.0F, 0.0F, 4, 6, 8, 0.0F); + this.setRotateAngle(Tail4, 0.091106186954104F, -1.2401310215141802E-16F, 0.0F); + this.ArmL = new ModelRenderer(this, 100, 210); + this.ArmL.mirror = true; + this.ArmL.setRotationPoint(-0.4F, 10.0F, 0.5F); + this.ArmL.addBox(-6.0F, 0.0F, 0.0F, 6, 8, 7, 0.0F); + this.setRotateAngle(ArmL, -0.136659280431156F, 0.0F, 0.18203784098300857F); + this.shape41 = new ModelRenderer(this, 5, 43); + this.shape41.setRotationPoint(-2.52F, 2.0F, -2.0F); + this.shape41.addBox(0.0F, 0.0F, 0.0F, 0, 1, 2, 0.0F); + this.Headtop2 = new ModelRenderer(this, 35, 55); + this.Headtop2.setRotationPoint(-0.02F, 0.0F, -3.0F); + this.Headtop2.addBox(-2.5F, 0.0F, -2.0F, 5, 2, 2, 0.0F); + this.setRotateAngle(Headtop2, 0.27314402793711257F, 0.0F, 0.0F); + this.Gums.addChild(this.Lowerjaw); + this.Upperjaw.addChild(this.Upperbeak3); + this.Headneck.addChild(this.Upperjaw); + this.Lowerjaw.addChild(this.Lowerbeak1); + this.Tail2.addChild(this.Tail3); + this.Neck2.addChild(this.Neck3); + this.Neck3.addChild(this.Headneck); + this.Lowerjaw.addChild(this.Lowerbeak3); + this.LegL.addChild(this.FootL); + this.Upperjaw.addChild(this.Beaktusk1); + this.Torsoback.addChild(this.Back); + this.Back.addChild(this.Bellyback); + this.Headneck.addChild(this.Headtop1); + this.Torsoback.addChild(this.Neck1); + this.ArmL.addChild(this.FrontfootL); + this.ArmR.addChild(this.FrontfootR); + this.Back.addChild(this.ThighL); + this.Lowerjaw.addChild(this.Lowerbeak2); + this.Torsoback.addChild(this.Torsobelly); + this.Headneck.addChild(this.Gums); + this.Upperjaw.addChild(this.Upperbeak1); + this.Torsoback.addChild(this.ShoulderR); + this.Back.addChild(this.Tail1); + this.Torsoback.addChild(this.ShoulderL); + this.ShoulderR.addChild(this.ArmR); + this.ThighL.addChild(this.LegL); + this.ThighR.addChild(this.LegR); + this.Upperjaw.addChild(this.Beaktusk2); + this.Tail1.addChild(this.Tail2); + this.Headtop2.addChild(this.Headtop3); + this.LegR.addChild(this.FootR); + this.Neck1.addChild(this.Neck2); + this.Back.addChild(this.ThighR); + this.Neck1.addChild(this.Neckunder); + this.Upperjaw.addChild(this.Upperbeak2); + this.Tail3.addChild(this.Tail4); + this.ShoulderL.addChild(this.ArmL); + this.Headtop1.addChild(this.shape41); + this.Headtop1.addChild(this.Headtop2); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.Torsoback.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; + } +} diff --git a/MF2VenomDragon.java b/TODO/Unimplemented/MF2VenomDragon.java similarity index 100% rename from MF2VenomDragon.java rename to TODO/Unimplemented/MF2VenomDragon.java diff --git a/TODO/Unimplemented/MFIIBasilisk-texture.png b/TODO/Unimplemented/MFIIBasilisk-texture.png new file mode 100644 index 00000000..dd105817 Binary files /dev/null and b/TODO/Unimplemented/MFIIBasilisk-texture.png differ diff --git a/TODO/Unimplemented/MFIIBasilisk.java b/TODO/Unimplemented/MFIIBasilisk.java new file mode 100644 index 00000000..af51274a --- /dev/null +++ b/TODO/Unimplemented/MFIIBasilisk.java @@ -0,0 +1,638 @@ +package Mob; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +/** + * MFIIBasilisk - Undefined + * Created using Tabula 5.1.0 + */ +public class MFIIBasilisk extends ModelBase { + public ModelRenderer Torso; + public ModelRenderer Backbody; + public ModelRenderer Neck1; + public ModelRenderer Shoulder1L; + public ModelRenderer Shoulder2L; + public ModelRenderer Shoulder1R; + public ModelRenderer Shoulder1R_1; + public ModelRenderer Tail1; + public ModelRenderer ThighL; + public ModelRenderer Shoulder1R_2; + public ModelRenderer Tail2; + public ModelRenderer Tail3; + public ModelRenderer Tail4; + public ModelRenderer ShinL; + public ModelRenderer FootL; + public ModelRenderer Toesole12L; + public ModelRenderer Toesole11L; + public ModelRenderer Toesole10L; + public ModelRenderer Toesole9L; + public ModelRenderer Toetop12L; + public ModelRenderer Toetop11L; + public ModelRenderer Toetop10L; + public ModelRenderer Toetop9L; + public ModelRenderer Arm1R; + public ModelRenderer Palm1R; + public ModelRenderer Toesole12R; + public ModelRenderer Toesole11R; + public ModelRenderer Toesole10R; + public ModelRenderer Toesole9R; + public ModelRenderer Toetop12R; + public ModelRenderer Toetop11R; + public ModelRenderer Toetop10R; + public ModelRenderer Toetop9R; + public ModelRenderer Neck2; + public ModelRenderer Neck3; + public ModelRenderer Head1; + public ModelRenderer Head2; + public ModelRenderer Tooth1; + public ModelRenderer Tooth2; + public ModelRenderer Tooth3; + public ModelRenderer Tooth4; + public ModelRenderer Headfront; + public ModelRenderer Upperjaw; + public ModelRenderer Lowerjaw; + public ModelRenderer Tooth5; + public ModelRenderer Tooth6; + public ModelRenderer Tooth7; + public ModelRenderer Tooth8; + public ModelRenderer Lowerjaw2; + public ModelRenderer Gums; + public ModelRenderer Lowerjaw3; + public ModelRenderer Tooth9; + public ModelRenderer Tooth10; + public ModelRenderer Tooth11; + public ModelRenderer Tooth12; + public ModelRenderer Tooth13; + public ModelRenderer Tooth14; + public ModelRenderer Tooth15; + public ModelRenderer Tooth16; + public ModelRenderer Tongue1; + public ModelRenderer Tongue2; + public ModelRenderer Arm1L; + public ModelRenderer Palm1L; + public ModelRenderer Toetop1L; + public ModelRenderer Toetop2L; + public ModelRenderer Toetop3L; + public ModelRenderer Toetop4L; + public ModelRenderer Toetop1L_1; + public ModelRenderer Toetop2L_1; + public ModelRenderer Toetop3L_1; + public ModelRenderer Toetop4L_1; + public ModelRenderer Arm2L; + public ModelRenderer Palm2L; + public ModelRenderer shape39; + public ModelRenderer shape39_1; + public ModelRenderer shape39_2; + public ModelRenderer shape39_3; + public ModelRenderer Toetop5L; + public ModelRenderer Toetop6L; + public ModelRenderer Toetop7L; + public ModelRenderer Toetop8L; + public ModelRenderer Arm1R_1; + public ModelRenderer Palm1R_1; + public ModelRenderer Toesole1R; + public ModelRenderer Toesole9R_1; + public ModelRenderer Toesole9R_2; + public ModelRenderer Toesole9R_3; + public ModelRenderer Toetop1R; + public ModelRenderer Toetop9R_1; + public ModelRenderer Toetop9R_2; + public ModelRenderer Toetop9R_3; + public ModelRenderer Arm1R_2; + public ModelRenderer Palm1R_2; + public ModelRenderer Toesole9R_4; + public ModelRenderer Toesole9R_5; + public ModelRenderer Toesole7R; + public ModelRenderer Toesole8R; + public ModelRenderer Toetop9R_4; + public ModelRenderer Toetop9R_5; + public ModelRenderer Toetop7R; + public ModelRenderer Toetop8R; + + public MFIIBasilisk() { + this.textureWidth = 512; + this.textureHeight = 256; + this.Toesole12R = new ModelRenderer(this, 205, 185); + this.Toesole12R.setRotationPoint(-0.5F, -1.0F, -3.0F); + this.Toesole12R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole12R, -1.9577358219620393F, 1.6390387005478748F, 0.0F); + this.Toesole12L = new ModelRenderer(this, 195, 185); + this.Toesole12L.setRotationPoint(0.5F, -1.0F, -3.0F); + this.Toesole12L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole12L, 1.9577358219620393F, 1.593485607070823F, 0.0F); + this.Toetop2L_1 = new ModelRenderer(this, 195, 185); + this.Toetop2L_1.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop2L_1.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop2L_1, 0.0F, -0.22759093446006054F, 0.0F); + this.Shoulder1R = new ModelRenderer(this, 170, 230); + this.Shoulder1R.mirror = true; + this.Shoulder1R.setRotationPoint(-7.0F, 9.0F, 1.0F); + this.Shoulder1R.addBox(-7.0F, 0.0F, 0.0F, 7, 5, 6, 0.0F); + this.setRotateAngle(Shoulder1R, 0.31869712141416456F, 0.4553564018453205F, -0.5918411493512771F); + this.shape39_3 = new ModelRenderer(this, 195, 185); + this.shape39_3.setRotationPoint(2.5F, 0.5F, -3.0F); + this.shape39_3.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(shape39_3, -1.0016444577195458F, 1.593485607070823F, 0.0F); + this.Shoulder1R_1 = new ModelRenderer(this, 205, 230); + this.Shoulder1R_1.mirror = true; + this.Shoulder1R_1.setRotationPoint(-7.0F, 9.3F, 13.0F); + this.Shoulder1R_1.addBox(-8.0F, 0.0F, 0.0F, 8, 5, 6, 0.0F); + this.setRotateAngle(Shoulder1R_1, 0.22759093446006054F, 0.22759093446006054F, -0.5462880558742251F); + this.ShinL = new ModelRenderer(this, 240, 210); + this.ShinL.setRotationPoint(8.0F, 0.3F, 0.0F); + this.ShinL.addBox(0.0F, 0.0F, -11.0F, 5, 4, 11, 0.0F); + this.setRotateAngle(ShinL, 0.045553093477052F, -2.4586453172844123F, 0.0F); + this.Toesole9R_4 = new ModelRenderer(this, 205, 185); + this.Toesole9R_4.setRotationPoint(-0.5F, 3.0F, -3.0F); + this.Toesole9R_4.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole9R_4, 0.36425021489121656F, 1.593485607070823F, 0.0F); + this.Toetop9R_3 = new ModelRenderer(this, 205, 185); + this.Toetop9R_3.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop9R_3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop9R_3, 0.0F, 0.22759093446006054F, 0.0F); + this.Toetop12R = new ModelRenderer(this, 205, 185); + this.Toetop12R.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop12R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop12R, 0.0F, 0.22759093446006054F, 0.0F); + this.Tooth15 = new ModelRenderer(this, 135, 160); + this.Tooth15.setRotationPoint(-2.0F, -1.0F, -4.9F); + this.Tooth15.addBox(0.0F, -2.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth15, 0.0F, 0.0F, -0.18203784098300857F); + this.Toetop7L = new ModelRenderer(this, 195, 185); + this.Toetop7L.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop7L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop7L, 0.0F, -0.22759093446006054F, 0.0F); + this.Tooth14 = new ModelRenderer(this, 135, 160); + this.Tooth14.setRotationPoint(2.0F, -1.0F, -3.0F); + this.Tooth14.addBox(-1.0F, -2.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth14, 0.091106186954104F, -0.045553093477052F, 0.18203784098300857F); + this.Toetop9R_2 = new ModelRenderer(this, 205, 185); + this.Toetop9R_2.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop9R_2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop9R_2, 0.0F, 0.22759093446006054F, 0.0F); + this.Toetop3L_1 = new ModelRenderer(this, 195, 185); + this.Toetop3L_1.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop3L_1.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop3L_1, 0.0F, -0.22759093446006054F, 0.0F); + this.Toetop9R = new ModelRenderer(this, 205, 185); + this.Toetop9R.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop9R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop9R, 0.0F, 0.22759093446006054F, 0.0F); + this.Tooth9 = new ModelRenderer(this, 135, 160); + this.Tooth9.setRotationPoint(-2.5F, 1.0F, -2.3F); + this.Tooth9.addBox(0.0F, -2.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth9, 0.091106186954104F, 0.045553093477052F, -0.18203784098300857F); + this.Shoulder1R_2 = new ModelRenderer(this, 240, 230); + this.Shoulder1R_2.setRotationPoint(-3.5F, 6.5F, 12.0F); + this.Shoulder1R_2.addBox(-8.0F, 0.0F, 0.0F, 8, 5, 7, 0.0F); + this.setRotateAngle(Shoulder1R_2, -0.27314402793711257F, -0.5009094953223726F, -0.5197590512439113F); + this.Palm1R_2 = new ModelRenderer(this, 205, 200); + this.Palm1R_2.setRotationPoint(4.99F, 0.0F, -10.0F); + this.Palm1R_2.addBox(-5.0F, 0.0F, -4.0F, 5, 4, 4, 0.0F); + this.setRotateAngle(Palm1R_2, 0.8651597102135892F, 0.0F, 0.0F); + this.Lowerjaw = new ModelRenderer(this, 100, 180); + this.Lowerjaw.setRotationPoint(0.0F, 6.5F, 5.2F); + this.Lowerjaw.addBox(-3.5F, 0.0F, -3.0F, 7, 3, 5, 0.0F); + this.setRotateAngle(Lowerjaw, -0.18203784098300857F, 0.0F, 0.0F); + this.Tongue2 = new ModelRenderer(this, 135, 150); + this.Tongue2.setRotationPoint(0.0F, 0.0F, -3.5F); + this.Tongue2.addBox(-1.0F, 0.0F, -5.0F, 2, 1, 5, 0.0F); + this.Toetop2L = new ModelRenderer(this, 195, 185); + this.Toetop2L.setRotationPoint(0.6F, 1.5F, -3.0F); + this.Toetop2L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop2L, -0.5009094953223726F, 1.593485607070823F, 0.0F); + this.Tooth10 = new ModelRenderer(this, 135, 160); + this.Tooth10.setRotationPoint(2.5F, 1.0F, -2.3F); + this.Tooth10.addBox(-1.0F, -2.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth10, 0.091106186954104F, 0.045553093477052F, 0.18203784098300857F); + this.Palm1R_1 = new ModelRenderer(this, 170, 200); + this.Palm1R_1.setRotationPoint(4.99F, 0.0F, -10.0F); + this.Palm1R_1.addBox(-5.0F, 0.0F, -4.0F, 5, 4, 4, 0.0F); + this.setRotateAngle(Palm1R_1, 0.7285004297824331F, 0.0F, 0.0F); + this.Toetop1L_1 = new ModelRenderer(this, 195, 185); + this.Toetop1L_1.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop1L_1.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop1L_1, 0.0F, -0.22759093446006054F, 0.0F); + this.Arm1R = new ModelRenderer(this, 240, 210); + this.Arm1R.mirror = true; + this.Arm1R.setRotationPoint(-8.0F, 0.3F, 0.0F); + this.Arm1R.addBox(-5.0F, 0.0F, -11.0F, 5, 4, 11, 0.0F); + this.setRotateAngle(Arm1R, 0.045553093477052F, 2.4586453172844123F, 0.0F); + this.Tooth8 = new ModelRenderer(this, 135, 160); + this.Tooth8.setRotationPoint(2.0F, 1.0F, 1.0F); + this.Tooth8.addBox(-1.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth8, -0.091106186954104F, 0.0F, -0.18203784098300857F); + this.ThighL = new ModelRenderer(this, 240, 230); + this.ThighL.setRotationPoint(3.5F, 6.5F, 12.0F); + this.ThighL.addBox(0.0F, 0.0F, 0.0F, 8, 5, 7, 0.0F); + this.setRotateAngle(ThighL, -0.27314402793711257F, 0.5009094953223726F, 0.5197590512439113F); + this.Toetop3L = new ModelRenderer(this, 195, 185); + this.Toetop3L.setRotationPoint(1.5F, 0.5F, -3.0F); + this.Toetop3L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop3L, -0.6373942428283291F, 1.593485607070823F, 0.0F); + this.Upperjaw = new ModelRenderer(this, 100, 170); + this.Upperjaw.setRotationPoint(0.0F, 2.45F, -5.6F); + this.Upperjaw.addBox(-2.5F, 0.0F, 0.0F, 5, 2, 6, 0.0F); + this.setRotateAngle(Upperjaw, -0.22759093446006054F, 0.0F, 0.0F); + this.Toesole10L = new ModelRenderer(this, 195, 185); + this.Toesole10L.setRotationPoint(3.5F, -0.8F, -3.0F); + this.Toesole10L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole10L, 2.504198410761464F, 1.593485607070823F, 0.0F); + this.Toetop9L = new ModelRenderer(this, 195, 185); + this.Toetop9L.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop9L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop9L, 0.0F, -0.22759093446006054F, 0.0F); + this.Palm2L = new ModelRenderer(this, 205, 200); + this.Palm2L.setRotationPoint(-4.99F, 0.0F, -10.0F); + this.Palm2L.addBox(0.0F, 0.0F, -4.0F, 5, 4, 4, 0.0F); + this.setRotateAngle(Palm2L, 0.8651597102135892F, 0.0F, 0.0F); + this.shape39_1 = new ModelRenderer(this, 195, 185); + this.shape39_1.setRotationPoint(0.6F, 1.5F, -3.0F); + this.shape39_1.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(shape39_1, -0.5009094953223726F, 1.593485607070823F, 0.0F); + this.Toetop8R = new ModelRenderer(this, 205, 185); + this.Toetop8R.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop8R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop8R, 0.0F, 0.22759093446006054F, 0.0F); + this.Toetop9R_4 = new ModelRenderer(this, 205, 185); + this.Toetop9R_4.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop9R_4.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop9R_4, 0.0F, 0.22759093446006054F, 0.0F); + this.Lowerjaw3 = new ModelRenderer(this, 135, 170); + this.Lowerjaw3.setRotationPoint(0.0F, 2.0F, -3.7F); + this.Lowerjaw3.addBox(-2.5F, -2.0F, -5.0F, 5, 2, 5, 0.0F); + this.setRotateAngle(Lowerjaw3, -0.091106186954104F, 0.0F, 0.0F); + this.Toesole9R_2 = new ModelRenderer(this, 205, 185); + this.Toesole9R_2.setRotationPoint(-1.5F, 0.5F, -3.0F); + this.Toesole9R_2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole9R_2, 0.6373942428283291F, 1.593485607070823F, 0.0F); + this.Lowerjaw2 = new ModelRenderer(this, 135, 180); + this.Lowerjaw2.setRotationPoint(0.0F, 0.5F, -2.8F); + this.Lowerjaw2.addBox(-3.0F, 0.0F, -4.0F, 6, 2, 4, 0.0F); + this.setRotateAngle(Lowerjaw2, 0.045553093477052F, 0.0F, 0.0F); + this.Toetop1L = new ModelRenderer(this, 195, 185); + this.Toetop1L.setRotationPoint(0.5F, 3.0F, -3.0F); + this.Toetop1L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop1L, -0.36425021489121656F, 1.593485607070823F, 0.0F); + this.Toetop5L = new ModelRenderer(this, 195, 185); + this.Toetop5L.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop5L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop5L, 0.0F, -0.22759093446006054F, 0.0F); + this.Toesole9R_5 = new ModelRenderer(this, 205, 185); + this.Toesole9R_5.setRotationPoint(-0.5F, 1.5F, -3.0F); + this.Toesole9R_5.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole9R_5, 0.5009094953223726F, 1.593485607070823F, 0.0F); + this.Neck1 = new ModelRenderer(this, 100, 230); + this.Neck1.setRotationPoint(0.0F, 0.9F, 2.0F); + this.Neck1.addBox(-5.0F, 0.0F, -6.0F, 10, 12, 6, 0.0F); + this.Tooth6 = new ModelRenderer(this, 135, 160); + this.Tooth6.setRotationPoint(2.0F, 1.0F, 3.3F); + this.Tooth6.addBox(-1.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth6, -0.045553093477052F, 0.0F, -0.18203784098300857F); + this.Tooth11 = new ModelRenderer(this, 135, 160); + this.Tooth11.setRotationPoint(-2.1F, 1.0F, -4.3F); + this.Tooth11.addBox(0.0F, -2.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth11, 0.136659280431156F, -0.091106186954104F, -0.18203784098300857F); + this.Tooth4 = new ModelRenderer(this, 135, 160); + this.Tooth4.setRotationPoint(2.5F, 5.0F, -3.5F); + this.Tooth4.addBox(-1.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth4, -0.18203784098300857F, 0.0F, -0.18203784098300857F); + this.Tooth7 = new ModelRenderer(this, 135, 160); + this.Tooth7.setRotationPoint(-2.0F, 1.0F, 1.2F); + this.Tooth7.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth7, -0.091106186954104F, 0.0F, 0.18203784098300857F); + this.Tooth5 = new ModelRenderer(this, 135, 160); + this.Tooth5.setRotationPoint(-2.0F, 1.0F, 3.3F); + this.Tooth5.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth5, -0.045553093477052F, 0.0F, 0.18203784098300857F); + this.Toetop4L_1 = new ModelRenderer(this, 195, 185); + this.Toetop4L_1.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop4L_1.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop4L_1, 0.0F, -0.22759093446006054F, 0.0F); + this.Toetop6L = new ModelRenderer(this, 195, 185); + this.Toetop6L.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop6L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop6L, 0.0F, -0.22759093446006054F, 0.0F); + this.Toetop9R_5 = new ModelRenderer(this, 205, 185); + this.Toetop9R_5.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop9R_5.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop9R_5, 0.0F, 0.22759093446006054F, 0.0F); + this.Toesole11R = new ModelRenderer(this, 205, 185); + this.Toesole11R.setRotationPoint(-2.5F, -0.5F, -3.0F); + this.Toesole11R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole11R, -2.1399481958702475F, 1.593485607070823F, 0.0F); + this.Toetop10R = new ModelRenderer(this, 205, 185); + this.Toetop10R.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop10R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop10R, 0.0F, 0.22759093446006054F, 0.0F); + this.Toesole9R_3 = new ModelRenderer(this, 205, 185); + this.Toesole9R_3.setRotationPoint(-2.5F, 0.5F, -3.0F); + this.Toesole9R_3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole9R_3, 1.0016444577195458F, 1.593485607070823F, 0.0F); + this.Tail4 = new ModelRenderer(this, 5, 75); + this.Tail4.setRotationPoint(0.0F, 1.0F, 12.0F); + this.Tail4.addBox(-2.5F, 0.0F, 0.0F, 5, 6, 13, 0.0F); + this.setRotateAngle(Tail4, 0.045553093477052F, 0.0F, 0.0F); + this.Gums = new ModelRenderer(this, 100, 135); + this.Gums.setRotationPoint(0.0F, -2.5F, 0.2F); + this.Gums.addBox(-2.5F, 0.0F, -3.0F, 5, 5, 3, 0.0F); + this.setRotateAngle(Gums, -0.091106186954104F, 0.0F, 0.0F); + this.Toesole9R_1 = new ModelRenderer(this, 205, 185); + this.Toesole9R_1.setRotationPoint(-0.5F, 1.5F, -3.0F); + this.Toesole9R_1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole9R_1, 0.5009094953223726F, 1.593485607070823F, 0.0F); + this.Shoulder1L = new ModelRenderer(this, 170, 230); + this.Shoulder1L.setRotationPoint(7.0F, 9.0F, 1.0F); + this.Shoulder1L.addBox(0.0F, 0.0F, 0.0F, 7, 5, 6, 0.0F); + this.setRotateAngle(Shoulder1L, 0.31869712141416456F, -0.4553564018453205F, 0.5918411493512771F); + this.FootL = new ModelRenderer(this, 240, 200); + this.FootL.setRotationPoint(5.01F, 0.0F, -11.0F); + this.FootL.addBox(0.0F, -4.0F, -4.0F, 5, 4, 4, 0.0F); + this.setRotateAngle(FootL, -0.8196066167365371F, 0.0F, 3.141592653589793F); + this.Headfront = new ModelRenderer(this, 100, 150); + this.Headfront.setRotationPoint(-0.01F, 0.0F, -4.0F); + this.Headfront.addBox(-2.5F, 0.0F, -3.0F, 5, 3, 3, 0.0F); + this.setRotateAngle(Headfront, 1.0016444577195458F, 0.0F, 0.0F); + this.Toesole9L = new ModelRenderer(this, 195, 185); + this.Toesole9L.setRotationPoint(3.5F, -2.5F, -3.0F); + this.Toesole9L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole9L, 2.7317893452215247F, 1.593485607070823F, 0.0F); + this.Head1 = new ModelRenderer(this, 135, 190); + this.Head1.setRotationPoint(0.0F, 0.0F, -5.0F); + this.Head1.addBox(-3.0F, 0.0F, -4.0F, 6, 6, 4, 0.0F); + this.setRotateAngle(Head1, 0.045553093477052F, 0.0F, 0.0F); + this.Head2 = new ModelRenderer(this, 100, 160); + this.Head2.setRotationPoint(-0.01F, 0.3F, -4.0F); + this.Head2.addBox(-2.5F, 0.0F, -4.0F, 5, 4, 4, 0.0F); + this.setRotateAngle(Head2, 0.22759093446006054F, 0.0F, 0.0F); + this.Tail1 = new ModelRenderer(this, 5, 150); + this.Tail1.setRotationPoint(0.0F, 1.0F, 18.0F); + this.Tail1.addBox(-5.5F, 0.0F, 0.0F, 11, 12, 11, 0.0F); + this.setRotateAngle(Tail1, -0.091106186954104F, 0.0F, 0.0F); + this.Tooth1 = new ModelRenderer(this, 135, 160); + this.Tooth1.setRotationPoint(-2.5F, 5.0F, -1.8F); + this.Tooth1.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth1, 0.091106186954104F, 0.0F, 0.18203784098300857F); + this.Toetop4L = new ModelRenderer(this, 195, 185); + this.Toetop4L.setRotationPoint(2.5F, 0.5F, -3.0F); + this.Toetop4L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop4L, -1.0016444577195458F, 1.593485607070823F, 0.0F); + this.Tooth3 = new ModelRenderer(this, 135, 160); + this.Tooth3.setRotationPoint(-2.5F, 5.0F, -3.5F); + this.Tooth3.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth3, -0.091106186954104F, 0.0F, 0.18203784098300857F); + this.Toesole7R = new ModelRenderer(this, 205, 185); + this.Toesole7R.setRotationPoint(-1.5F, 0.5F, -3.0F); + this.Toesole7R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole7R, 0.6373942428283291F, 1.593485607070823F, 0.0F); + this.Arm2L = new ModelRenderer(this, 205, 210); + this.Arm2L.setRotationPoint(8.0F, 0.3F, 6.0F); + this.Arm2L.addBox(-5.0F, 0.0F, -10.0F, 5, 4, 10, 0.0F); + this.setRotateAngle(Arm2L, 0.045553093477052F, -0.9105382707654417F, 0.0F); + this.Toesole8R = new ModelRenderer(this, 205, 185); + this.Toesole8R.setRotationPoint(-2.5F, 0.5F, -3.0F); + this.Toesole8R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole8R, 1.0016444577195458F, 1.593485607070823F, 0.0F); + this.Toetop7R = new ModelRenderer(this, 205, 185); + this.Toetop7R.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop7R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop7R, 0.0F, 0.22759093446006054F, 0.0F); + this.Shoulder2L = new ModelRenderer(this, 205, 230); + this.Shoulder2L.setRotationPoint(7.0F, 9.3F, 13.0F); + this.Shoulder2L.addBox(0.0F, 0.0F, 0.0F, 8, 5, 6, 0.0F); + this.setRotateAngle(Shoulder2L, 0.22759093446006054F, -0.22759093446006054F, 0.5462880558742251F); + this.Tooth2 = new ModelRenderer(this, 135, 160); + this.Tooth2.setRotationPoint(2.5F, 5.0F, -1.8F); + this.Tooth2.addBox(-1.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth2, 0.091106186954104F, 0.0F, -0.18203784098300857F); + this.Toetop12L = new ModelRenderer(this, 195, 185); + this.Toetop12L.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop12L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop12L, 0.0F, -0.22759093446006054F, 0.0F); + this.Tail2 = new ModelRenderer(this, 5, 125); + this.Tail2.setRotationPoint(0.0F, 1.0F, 9.0F); + this.Tail2.addBox(-4.5F, 0.0F, 0.0F, 9, 10, 12, 0.0F); + this.setRotateAngle(Tail2, 0.045553093477052F, 0.0F, 0.0F); + this.Toesole9R = new ModelRenderer(this, 205, 185); + this.Toesole9R.setRotationPoint(-3.5F, -2.5F, -3.0F); + this.Toesole9R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole9R, -2.7317893452215247F, 1.593485607070823F, 0.0F); + this.Arm1R_2 = new ModelRenderer(this, 205, 210); + this.Arm1R_2.mirror = true; + this.Arm1R_2.setRotationPoint(-8.0F, 0.3F, 6.0F); + this.Arm1R_2.addBox(0.0F, 0.0F, -10.0F, 5, 4, 10, 0.0F); + this.setRotateAngle(Arm1R_2, 0.045553093477052F, 0.9105382707654417F, 0.0F); + this.Toesole10R = new ModelRenderer(this, 205, 185); + this.Toesole10R.setRotationPoint(-3.5F, -0.8F, -3.0F); + this.Toesole10R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole10R, -2.5953045977155678F, 1.593485607070823F, 0.0F); + this.Toetop11L = new ModelRenderer(this, 195, 185); + this.Toetop11L.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop11L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop11L, 0.0F, -0.22759093446006054F, 0.0F); + this.Toesole11L = new ModelRenderer(this, 195, 185); + this.Toesole11L.setRotationPoint(2.5F, -0.5F, -3.0F); + this.Toesole11L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole11L, 2.1399481958702475F, 1.593485607070823F, 0.0F); + this.Tooth16 = new ModelRenderer(this, 135, 160); + this.Tooth16.setRotationPoint(2.0F, -1.0F, -4.9F); + this.Tooth16.addBox(-1.0F, -2.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth16, 0.0F, 0.0F, 0.18203784098300857F); + this.Neck2 = new ModelRenderer(this, 100, 210); + this.Neck2.setRotationPoint(0.0F, 0.5F, -5.0F); + this.Neck2.addBox(-4.0F, 0.0F, -5.0F, 8, 10, 5, 0.0F); + this.Tooth13 = new ModelRenderer(this, 135, 160); + this.Tooth13.setRotationPoint(-2.0F, -1.0F, -3.0F); + this.Tooth13.addBox(0.0F, -2.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth13, 0.091106186954104F, -0.045553093477052F, -0.18203784098300857F); + this.Backbody = new ModelRenderer(this, 5, 180); + this.Backbody.setRotationPoint(0.0F, 0.0F, 17.0F); + this.Backbody.addBox(-6.5F, 0.0F, 0.0F, 13, 15, 18, 0.0F); + this.setRotateAngle(Backbody, -0.136659280431156F, 0.0F, 0.0F); + this.Toetop11R = new ModelRenderer(this, 205, 185); + this.Toetop11R.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop11R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop11R, 0.0F, 0.22759093446006054F, 0.0F); + this.Toetop9R_1 = new ModelRenderer(this, 205, 185); + this.Toetop9R_1.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop9R_1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop9R_1, 0.0F, 0.22759093446006054F, 0.0F); + this.Neck3 = new ModelRenderer(this, 100, 190); + this.Neck3.setRotationPoint(0.0F, 0.5F, -3.0F); + this.Neck3.addBox(-3.5F, 0.0F, -5.0F, 7, 6, 5, 0.0F); + this.setRotateAngle(Neck3, 0.091106186954104F, 0.0F, 0.0F); + this.Toetop1R = new ModelRenderer(this, 205, 185); + this.Toetop1R.setRotationPoint(-1.0F, 0.0F, 0.2F); + this.Toetop1R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop1R, 0.0F, 0.22759093446006054F, 0.0F); + this.Torso = new ModelRenderer(this, 5, 220); + this.Torso.setRotationPoint(0.0F, 3.0F, -14.0F); + this.Torso.addBox(-7.0F, 0.0F, 0.0F, 14, 15, 17, 0.0F); + this.setRotateAngle(Torso, 0.091106186954104F, 0.0F, 0.0F); + this.shape39_2 = new ModelRenderer(this, 195, 185); + this.shape39_2.setRotationPoint(1.5F, 0.5F, -3.0F); + this.shape39_2.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(shape39_2, -0.6373942428283291F, 1.593485607070823F, 0.0F); + this.Tail3 = new ModelRenderer(this, 5, 100); + this.Tail3.setRotationPoint(0.0F, 1.0F, 11.0F); + this.Tail3.addBox(-3.5F, 0.0F, 0.0F, 7, 8, 13, 0.0F); + this.setRotateAngle(Tail3, 0.045553093477052F, 0.0F, 0.0F); + this.Tooth12 = new ModelRenderer(this, 135, 160); + this.Tooth12.setRotationPoint(2.1F, 1.0F, -4.3F); + this.Tooth12.addBox(-1.0F, -2.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Tooth12, 0.136659280431156F, 0.091106186954104F, 0.18203784098300857F); + this.Arm1L = new ModelRenderer(this, 170, 210); + this.Arm1L.setRotationPoint(7.0F, 0.3F, 6.0F); + this.Arm1L.addBox(-5.0F, 0.0F, -10.0F, 5, 4, 10, 0.0F); + this.setRotateAngle(Arm1L, 0.045553093477052F, -0.7285004297824331F, 0.0F); + this.Arm1R_1 = new ModelRenderer(this, 170, 210); + this.Arm1R_1.mirror = true; + this.Arm1R_1.setRotationPoint(-7.0F, 0.3F, 6.0F); + this.Arm1R_1.addBox(0.0F, 0.0F, -10.0F, 5, 4, 10, 0.0F); + this.setRotateAngle(Arm1R_1, 0.045553093477052F, 0.7285004297824331F, 0.0F); + this.Toesole1R = new ModelRenderer(this, 205, 185); + this.Toesole1R.setRotationPoint(-0.5F, 3.0F, -3.0F); + this.Toesole1R.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toesole1R, 0.36425021489121656F, 1.593485607070823F, 0.0F); + this.shape39 = new ModelRenderer(this, 195, 185); + this.shape39.setRotationPoint(0.5F, 3.0F, -3.0F); + this.shape39.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(shape39, -0.36425021489121656F, 1.593485607070823F, 0.0F); + this.Toetop8L = new ModelRenderer(this, 195, 185); + this.Toetop8L.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop8L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop8L, 0.0F, -0.22759093446006054F, 0.0F); + this.Palm1R = new ModelRenderer(this, 240, 200); + this.Palm1R.setRotationPoint(-5.01F, 0.0F, -11.0F); + this.Palm1R.addBox(-5.0F, -4.0F, -4.0F, 5, 4, 4, 0.0F); + this.setRotateAngle(Palm1R, -0.8196066167365371F, 0.0F, 3.141592653589793F); + this.Tongue1 = new ModelRenderer(this, 135, 140); + this.Tongue1.setRotationPoint(0.0F, 2.0F, -2.0F); + this.Tongue1.addBox(-1.5F, 0.0F, -4.0F, 3, 1, 4, 0.0F); + this.setRotateAngle(Tongue1, 0.136659280431156F, 0.0F, 0.0F); + this.Palm1L = new ModelRenderer(this, 170, 200); + this.Palm1L.setRotationPoint(-4.99F, 0.0F, -10.0F); + this.Palm1L.addBox(0.0F, 0.0F, -4.0F, 5, 4, 4, 0.0F); + this.setRotateAngle(Palm1L, 0.7285004297824331F, 0.0F, 0.0F); + this.Toetop10L = new ModelRenderer(this, 195, 185); + this.Toetop10L.setRotationPoint(-1.0F, 0.0F, -0.2F); + this.Toetop10L.addBox(0.0F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(Toetop10L, 0.0F, -0.22759093446006054F, 0.0F); + this.Palm1R.addChild(this.Toesole12R); + this.FootL.addChild(this.Toesole12L); + this.Toetop2L.addChild(this.Toetop2L_1); + this.Torso.addChild(this.Shoulder1R); + this.Palm2L.addChild(this.shape39_3); + this.Torso.addChild(this.Shoulder1R_1); + this.ThighL.addChild(this.ShinL); + this.Palm1R_2.addChild(this.Toesole9R_4); + this.Toesole9R_3.addChild(this.Toetop9R_3); + this.Toesole12R.addChild(this.Toetop12R); + this.Lowerjaw3.addChild(this.Tooth15); + this.shape39_2.addChild(this.Toetop7L); + this.Lowerjaw3.addChild(this.Tooth14); + this.Toesole9R_2.addChild(this.Toetop9R_2); + this.Toetop3L.addChild(this.Toetop3L_1); + this.Toesole9R.addChild(this.Toetop9R); + this.Lowerjaw2.addChild(this.Tooth9); + this.Backbody.addChild(this.Shoulder1R_2); + this.Arm1R_2.addChild(this.Palm1R_2); + this.Head2.addChild(this.Lowerjaw); + this.Tongue1.addChild(this.Tongue2); + this.Palm1L.addChild(this.Toetop2L); + this.Lowerjaw2.addChild(this.Tooth10); + this.Arm1R_1.addChild(this.Palm1R_1); + this.Toetop1L.addChild(this.Toetop1L_1); + this.Shoulder1R_2.addChild(this.Arm1R); + this.Upperjaw.addChild(this.Tooth8); + this.Backbody.addChild(this.ThighL); + this.Palm1L.addChild(this.Toetop3L); + this.Head2.addChild(this.Upperjaw); + this.FootL.addChild(this.Toesole10L); + this.Toesole9L.addChild(this.Toetop9L); + this.Arm2L.addChild(this.Palm2L); + this.Palm2L.addChild(this.shape39_1); + this.Toesole8R.addChild(this.Toetop8R); + this.Toesole9R_4.addChild(this.Toetop9R_4); + this.Lowerjaw2.addChild(this.Lowerjaw3); + this.Palm1R_1.addChild(this.Toesole9R_2); + this.Lowerjaw.addChild(this.Lowerjaw2); + this.Palm1L.addChild(this.Toetop1L); + this.shape39.addChild(this.Toetop5L); + this.Palm1R_2.addChild(this.Toesole9R_5); + this.Torso.addChild(this.Neck1); + this.Upperjaw.addChild(this.Tooth6); + this.Lowerjaw2.addChild(this.Tooth11); + this.Head1.addChild(this.Tooth4); + this.Upperjaw.addChild(this.Tooth7); + this.Upperjaw.addChild(this.Tooth5); + this.Toetop4L.addChild(this.Toetop4L_1); + this.shape39_1.addChild(this.Toetop6L); + this.Toesole9R_5.addChild(this.Toetop9R_5); + this.Palm1R.addChild(this.Toesole11R); + this.Toesole10R.addChild(this.Toetop10R); + this.Palm1R_1.addChild(this.Toesole9R_3); + this.Tail3.addChild(this.Tail4); + this.Lowerjaw.addChild(this.Gums); + this.Palm1R_1.addChild(this.Toesole9R_1); + this.Torso.addChild(this.Shoulder1L); + this.ShinL.addChild(this.FootL); + this.Head2.addChild(this.Headfront); + this.FootL.addChild(this.Toesole9L); + this.Neck3.addChild(this.Head1); + this.Head1.addChild(this.Head2); + this.Backbody.addChild(this.Tail1); + this.Head1.addChild(this.Tooth1); + this.Palm1L.addChild(this.Toetop4L); + this.Head1.addChild(this.Tooth3); + this.Palm1R_2.addChild(this.Toesole7R); + this.Shoulder2L.addChild(this.Arm2L); + this.Palm1R_2.addChild(this.Toesole8R); + this.Toesole7R.addChild(this.Toetop7R); + this.Torso.addChild(this.Shoulder2L); + this.Head1.addChild(this.Tooth2); + this.Toesole12L.addChild(this.Toetop12L); + this.Tail1.addChild(this.Tail2); + this.Palm1R.addChild(this.Toesole9R); + this.Shoulder1R_1.addChild(this.Arm1R_2); + this.Palm1R.addChild(this.Toesole10R); + this.Toesole11L.addChild(this.Toetop11L); + this.FootL.addChild(this.Toesole11L); + this.Lowerjaw3.addChild(this.Tooth16); + this.Neck1.addChild(this.Neck2); + this.Lowerjaw3.addChild(this.Tooth13); + this.Torso.addChild(this.Backbody); + this.Toesole11R.addChild(this.Toetop11R); + this.Toesole9R_1.addChild(this.Toetop9R_1); + this.Neck2.addChild(this.Neck3); + this.Toesole1R.addChild(this.Toetop1R); + this.Palm2L.addChild(this.shape39_2); + this.Tail2.addChild(this.Tail3); + this.Lowerjaw2.addChild(this.Tooth12); + this.Shoulder1L.addChild(this.Arm1L); + this.Shoulder1R.addChild(this.Arm1R_1); + this.Palm1R_1.addChild(this.Toesole1R); + this.Palm2L.addChild(this.shape39); + this.shape39_3.addChild(this.Toetop8L); + this.Arm1R.addChild(this.Palm1R); + this.Gums.addChild(this.Tongue1); + this.Arm1L.addChild(this.Palm1L); + this.Toesole10L.addChild(this.Toetop10L); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.Torso.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; + } +} diff --git a/TODO/Unimplemented/Mesatunneler-texture.png b/TODO/Unimplemented/Mesatunneler-texture.png new file mode 100644 index 00000000..f0cd03f8 Binary files /dev/null and b/TODO/Unimplemented/Mesatunneler-texture.png differ diff --git a/TODO/Unimplemented/Mesatunneler.java b/TODO/Unimplemented/Mesatunneler.java new file mode 100644 index 00000000..d97ef08a --- /dev/null +++ b/TODO/Unimplemented/Mesatunneler.java @@ -0,0 +1,647 @@ +package Mob; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +/** + * Mesatunneler - Undefined + * Created using Tabula 5.1.0 + */ +public class Mesatunneler extends ModelBase { + public ModelRenderer Frontbody; + public ModelRenderer Backbody; + public ModelRenderer Shoulderpart; + public ModelRenderer BackplateR5; + public ModelRenderer BackplateR6; + public ModelRenderer BackplateR7; + public ModelRenderer Hippart; + public ModelRenderer BackplateR8; + public ModelRenderer BackplateR9; + public ModelRenderer BackplateR10; + public ModelRenderer Tail11; + public ModelRenderer ThighL; + public ModelRenderer ThighR; + public ModelRenderer BackplateR11; + public ModelRenderer Tail12; + public ModelRenderer BackplateR12; + public ModelRenderer Tail21; + public ModelRenderer Tail22; + public ModelRenderer BackplateR13; + public ModelRenderer Tail31; + public ModelRenderer Tail32; + public ModelRenderer Tail41; + public ModelRenderer Tail42; + public ModelRenderer Tail51; + public ModelRenderer Tail52; + public ModelRenderer BackplateL13; + public ModelRenderer BackplateL12; + public ModelRenderer ShinL; + public ModelRenderer HeelL; + public ModelRenderer LBToesole1; + public ModelRenderer LBToesole2; + public ModelRenderer LBToesole3; + public ModelRenderer LBToesole4; + public ModelRenderer LBToesole5; + public ModelRenderer RBToetop1; + public ModelRenderer RBToetop2; + public ModelRenderer RBToetop3; + public ModelRenderer RBToetop4; + public ModelRenderer ShinR; + public ModelRenderer HeelR; + public ModelRenderer RBToesole1; + public ModelRenderer RBToesole2; + public ModelRenderer RBToesole3; + public ModelRenderer RBToesole4; + public ModelRenderer RBToesole5; + public ModelRenderer RBToetop1_1; + public ModelRenderer RBToetop2_1; + public ModelRenderer RBToetop3_1; + public ModelRenderer RBToetop4_1; + public ModelRenderer BackplateL11; + public ModelRenderer BackplateL8; + public ModelRenderer BackplateL9; + public ModelRenderer BackplateL10; + public ModelRenderer Neck1; + public ModelRenderer LUpperarm; + public ModelRenderer RUpperarm; + public ModelRenderer BackplateR3; + public ModelRenderer BackplateR4; + public ModelRenderer Headtop1; + public ModelRenderer BackplateR2; + public ModelRenderer Headtop2; + public ModelRenderer Upperjaw1; + public ModelRenderer BackplateR1; + public ModelRenderer BrowL; + public ModelRenderer BrowR; + public ModelRenderer Eye; + public ModelRenderer Upperjaw2; + public ModelRenderer Backmouth; + public ModelRenderer TeethR1; + public ModelRenderer TeethL1; + public ModelRenderer Lowerjaw1; + public ModelRenderer Lowerjaw2; + public ModelRenderer shape131; + public ModelRenderer shape132; + public ModelRenderer BackplateL1; + public ModelRenderer BackplateL2; + public ModelRenderer LLowerarm; + public ModelRenderer Lhand; + public ModelRenderer LFToesole1; + public ModelRenderer LFToesole2; + public ModelRenderer LFToesole3; + public ModelRenderer LFToesole4; + public ModelRenderer LFToesole5; + public ModelRenderer LFToetop1; + public ModelRenderer LFToetop1_1; + public ModelRenderer LFToetop3; + public ModelRenderer LFToetop4; + public ModelRenderer LFToetop5; + public ModelRenderer Rlowerarm; + public ModelRenderer Rhand; + public ModelRenderer RFToesole1; + public ModelRenderer RFToesole2; + public ModelRenderer RFToesole3; + public ModelRenderer RFToesole4; + public ModelRenderer RFToesole5; + public ModelRenderer RFToetop1; + public ModelRenderer RFToetop2; + public ModelRenderer RFToetop3; + public ModelRenderer RFToetop4; + public ModelRenderer RFToetop5; + public ModelRenderer BackplateL3; + public ModelRenderer BackplateL4; + public ModelRenderer BackplateL5; + public ModelRenderer BackplateL6; + public ModelRenderer BackplateL7; + + public Mesatunneler() { + this.textureWidth = 512; + this.textureHeight = 256; + this.BackplateR2 = new ModelRenderer(this, 100, 170); + this.BackplateR2.setRotationPoint(0.0F, -3.5F, -1.0F); + this.BackplateR2.addBox(0.0F, 0.0F, 0.0F, 2, 5, 4, 0.0F); + this.setRotateAngle(BackplateR2, -1.0471975511965976F, -0.40980330836826856F, 0.6373942428283291F); + this.ShinL = new ModelRenderer(this, 130, 220); + this.ShinL.mirror = true; + this.ShinL.setRotationPoint(7.0F, 0.1F, 0.0F); + this.ShinL.addBox(0.0F, 0.0F, 0.0F, 7, 3, 3, 0.0F); + this.setRotateAngle(ShinL, 0.0F, -0.9105382707654417F, 0.0F); + this.BackplateR5 = new ModelRenderer(this, 100, 220); + this.BackplateR5.setRotationPoint(-0.01F, -6.9F, 4.18F); + this.BackplateR5.addBox(0.0F, 0.0F, 0.0F, 2, 7, 7, 0.0F); + this.setRotateAngle(BackplateR5, -1.0016444577195458F, -0.49131018443640373F, 0.6248278722139698F); + this.HeelR = new ModelRenderer(this, 130, 210); + this.HeelR.setRotationPoint(-6.99F, 0.0F, 0.0F); + this.HeelR.addBox(0.0F, 0.0F, 0.0F, 3, 3, 3, 0.0F); + this.setRotateAngle(HeelR, 0.0F, 0.0F, 0.27314402793711257F); + this.Backmouth = new ModelRenderer(this, 70, 160); + this.Backmouth.setRotationPoint(0.0F, -0.1F, 0.2F); + this.Backmouth.addBox(-1.5F, 0.0F, -3.0F, 3, 3, 3, 0.0F); + this.RBToesole4 = new ModelRenderer(this, 200, 190); + this.RBToesole4.setRotationPoint(0.5F, 2.0F, 0.9F); + this.RBToesole4.addBox(-0.5F, 0.0F, -5.0F, 1, 1, 5, 0.0F); + this.setRotateAngle(RBToesole4, 0.0F, 0.40980330836826856F, 0.0F); + this.LFToetop1_1 = new ModelRenderer(this, 200, 200); + this.LFToetop1_1.setRotationPoint(0.0F, -0.9F, -0.1F); + this.LFToetop1_1.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToetop1_1, 0.27314402793711257F, 0.0F, 0.0F); + this.LBToesole5 = new ModelRenderer(this, 200, 200); + this.LBToesole5.setRotationPoint(-1.0F, 2.0F, 2.5F); + this.LBToesole5.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LBToesole5, 0.0F, -0.9560913642424937F, 0.0F); + this.shape131 = new ModelRenderer(this, 0, 0); + this.shape131.setRotationPoint(-1.7F, -1.0F, -2.0F); + this.shape131.addBox(0.0F, -1.0F, -7.0F, 0, 1, 7, 0.0F); + this.setRotateAngle(shape131, 0.0F, -0.136659280431156F, 0.0F); + this.LFToetop4 = new ModelRenderer(this, 200, 200); + this.LFToetop4.setRotationPoint(0.0F, -0.9F, -0.1F); + this.LFToetop4.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToetop4, 0.27314402793711257F, 0.0F, 0.0F); + this.Rlowerarm = new ModelRenderer(this, 160, 215); + this.Rlowerarm.setRotationPoint(-7.0F, 0.1F, 4.0F); + this.Rlowerarm.addBox(0.0F, 0.0F, -8.0F, 3, 3, 8, 0.0F); + this.setRotateAngle(Rlowerarm, 0.0F, 0.36425021489121656F, 0.0F); + this.RFToetop3 = new ModelRenderer(this, 200, 200); + this.RFToetop3.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RFToetop3.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToetop3, 0.27314402793711257F, 0.0F, 0.0F); + this.LBToesole1 = new ModelRenderer(this, 200, 170); + this.LBToesole1.setRotationPoint(-2.5F, 2.0F, 0.5F); + this.LBToesole1.addBox(-0.5F, 0.0F, -2.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(LBToesole1, 0.0F, 0.5918411493512771F, 0.0F); + this.BackplateL12 = new ModelRenderer(this, 100, 185); + this.BackplateL12.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL12.addBox(-2.0F, 0.0F, 0.0F, 2, 8, 5, 0.0F); + this.setRotateAngle(BackplateL12, 0.0F, 1.5707963267948966F, 0.0F); + this.Lowerjaw2 = new ModelRenderer(this, 70, 140); + this.Lowerjaw2.setRotationPoint(0.0F, 0.0F, -5.0F); + this.Lowerjaw2.addBox(-1.5F, -1.0F, -4.0F, 3, 1, 4, 0.0F); + this.Tail52 = new ModelRenderer(this, 5, 50); + this.Tail52.setRotationPoint(0.01F, -0.01F, 5.0F); + this.Tail52.addBox(-1.5F, 0.0F, 0.0F, 3, 2, 5, 0.0F); + this.Headtop1 = new ModelRenderer(this, 70, 190); + this.Headtop1.setRotationPoint(0.0F, 0.1F, -5.0F); + this.Headtop1.addBox(-2.0F, 0.0F, -5.0F, 4, 2, 5, 0.0F); + this.setRotateAngle(Headtop1, 0.091106186954104F, 0.0F, 0.0F); + this.Tail12 = new ModelRenderer(this, 5, 140); + this.Tail12.setRotationPoint(0.01F, -0.01F, 3.0F); + this.Tail12.addBox(-3.5F, 0.0F, 0.0F, 7, 6, 4, 0.0F); + this.LFToesole1 = new ModelRenderer(this, 200, 200); + this.LFToesole1.setRotationPoint(0.5F, 2.0F, 2.3F); + this.LFToesole1.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToesole1, 0.0F, 1.5481070465189704F, 0.0F); + this.Tail21 = new ModelRenderer(this, 5, 125); + this.Tail21.setRotationPoint(0.0F, 0.7F, 4.0F); + this.Tail21.addBox(-3.0F, 0.0F, 0.0F, 6, 5, 5, 0.0F); + this.BackplateL3 = new ModelRenderer(this, 100, 185); + this.BackplateL3.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL3.addBox(-2.0F, 0.0F, 0.0F, 2, 7, 5, 0.0F); + this.setRotateAngle(BackplateL3, 0.0F, 1.5707963267948966F, 0.0F); + this.BackplateR13 = new ModelRenderer(this, 100, 185); + this.BackplateR13.setRotationPoint(0.0F, -2.7F, 3.0F); + this.BackplateR13.addBox(0.0F, 0.0F, 0.0F, 2, 8, 5, 0.0F); + this.setRotateAngle(BackplateR13, -1.593485607070823F, 0.0F, 0.7740535232594852F); + this.TeethR1 = new ModelRenderer(this, 0, 0); + this.TeethR1.setRotationPoint(-1.7F, 1.6F, -2.7F); + this.TeethR1.addBox(0.0F, 0.0F, -6.0F, 0, 1, 7, 0.0F); + this.setRotateAngle(TeethR1, 0.0F, -0.136659280431156F, 0.0F); + this.BackplateL2 = new ModelRenderer(this, 100, 170); + this.BackplateL2.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL2.addBox(-2.0F, 0.0F, 0.0F, 2, 5, 4, 0.0F); + this.setRotateAngle(BackplateL2, 0.0F, 1.5707963267948966F, 0.0F); + this.Rhand = new ModelRenderer(this, 160, 205); + this.Rhand.setRotationPoint(3.01F, 0.0F, -7.99F); + this.Rhand.addBox(-3.0F, 0.0F, 0.0F, 3, 3, 3, 0.0F); + this.setRotateAngle(Rhand, -0.22759093446006054F, 0.0F, 0.0F); + this.RBToesole1 = new ModelRenderer(this, 200, 170); + this.RBToesole1.setRotationPoint(2.5F, 2.0F, 0.5F); + this.RBToesole1.addBox(-0.5F, 0.0F, -2.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(RBToesole1, 0.0F, -0.5918411493512771F, 0.0F); + this.BackplateL1 = new ModelRenderer(this, 100, 160); + this.BackplateL1.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL1.addBox(-2.0F, 0.0F, 0.0F, 2, 4, 3, 0.0F); + this.setRotateAngle(BackplateL1, 0.0F, 1.5707963267948966F, 0.0F); + this.LFToesole2 = new ModelRenderer(this, 200, 200); + this.LFToesole2.setRotationPoint(0.5F, 2.0F, 1.3F); + this.LFToesole2.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToesole2, 0.0F, 1.1838568316277536F, 0.0F); + this.BackplateR3 = new ModelRenderer(this, 100, 185); + this.BackplateR3.setRotationPoint(-0.12F, -4.0F, -4.0F); + this.BackplateR3.addBox(0.0F, 0.0F, 0.0F, 2, 7, 5, 0.0F); + this.setRotateAngle(BackplateR3, -0.8651597102135892F, -0.5510004448546099F, 0.5462880558742251F); + this.BackplateL6 = new ModelRenderer(this, 100, 220); + this.BackplateL6.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL6.addBox(-2.0F, 0.0F, 0.0F, 2, 9, 7, 0.0F); + this.setRotateAngle(BackplateL6, 0.0F, 1.5707963267948966F, 0.0F); + this.Shoulderpart = new ModelRenderer(this, 70, 230); + this.Shoulderpart.setRotationPoint(0.0F, 0.5F, 0.5F); + this.Shoulderpart.addBox(-3.5F, 0.0F, -6.0F, 7, 6, 6, 0.0F); + this.Headtop2 = new ModelRenderer(this, 70, 180); + this.Headtop2.setRotationPoint(0.0F, 0.0F, -4.9F); + this.Headtop2.addBox(-1.5F, 0.0F, -4.0F, 3, 2, 4, 0.0F); + this.setRotateAngle(Headtop2, 0.136659280431156F, 0.0F, 0.0F); + this.Tail31 = new ModelRenderer(this, 5, 100); + this.Tail31.setRotationPoint(0.0F, 0.7F, 4.0F); + this.Tail31.addBox(-2.5F, 0.0F, 0.0F, 5, 4, 5, 0.0F); + this.LFToesole5 = new ModelRenderer(this, 200, 200); + this.LFToesole5.setRotationPoint(2.5F, 2.0F, 0.5F); + this.LFToesole5.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToesole5, 0.0F, -0.091106186954104F, 0.0F); + this.LUpperarm = new ModelRenderer(this, 160, 230); + this.LUpperarm.mirror = true; + this.LUpperarm.setRotationPoint(2.5F, 2.2F, -6.0F); + this.LUpperarm.addBox(0.0F, 0.0F, 0.0F, 7, 3, 4, 0.0F); + this.setRotateAngle(LUpperarm, 0.18203784098300857F, -0.5918411493512771F, 0.091106186954104F); + this.BackplateL9 = new ModelRenderer(this, 100, 220); + this.BackplateL9.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL9.addBox(-2.0F, 0.0F, 0.0F, 2, 12, 7, 0.0F); + this.setRotateAngle(BackplateL9, 0.0F, 1.5707963267948966F, 0.0F); + this.BackplateL4 = new ModelRenderer(this, 100, 200); + this.BackplateL4.setRotationPoint(0.02F, 0.0F, -0.01F); + this.BackplateL4.addBox(-2.0F, 0.0F, 0.0F, 2, 7, 6, 0.0F); + this.setRotateAngle(BackplateL4, 0.0F, 1.5707963267948966F, 0.0F); + this.BackplateR11 = new ModelRenderer(this, 100, 200); + this.BackplateR11.setRotationPoint(0.0F, -5.0F, 5.0F); + this.BackplateR11.addBox(0.0F, 0.0F, 0.0F, 2, 8, 6, 0.0F); + this.setRotateAngle(BackplateR11, -1.4570008595648662F, -0.136659280431156F, 0.7740535232594852F); + this.RUpperarm = new ModelRenderer(this, 160, 230); + this.RUpperarm.setRotationPoint(-2.5F, 2.2F, -6.0F); + this.RUpperarm.addBox(-7.0F, 0.0F, 0.0F, 7, 3, 4, 0.0F); + this.setRotateAngle(RUpperarm, 0.18203784098300857F, 0.5918411493512771F, -0.091106186954104F); + this.ThighR = new ModelRenderer(this, 130, 230); + this.ThighR.setRotationPoint(-1.0F, 1.0F, 1.0F); + this.ThighR.addBox(-7.0F, 0.0F, 0.0F, 7, 3, 4, 0.0F); + this.setRotateAngle(ThighR, -0.136659280431156F, -0.22759093446006054F, -0.18203784098300857F); + this.RBToetop1_1 = new ModelRenderer(this, 200, 170); + this.RBToetop1_1.setRotationPoint(0.0F, -0.6F, -0.1F); + this.RBToetop1_1.addBox(-0.5F, 0.0F, -2.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(RBToetop1_1, 0.27314402793711257F, 0.0F, 0.0F); + this.TeethL1 = new ModelRenderer(this, 0, 0); + this.TeethL1.setRotationPoint(1.7F, 1.6F, -2.7F); + this.TeethL1.addBox(0.0F, 0.0F, -6.0F, 0, 1, 7, 0.0F); + this.setRotateAngle(TeethL1, 0.0F, 0.136659280431156F, 0.0F); + this.LBToesole3 = new ModelRenderer(this, 200, 180); + this.LBToesole3.setRotationPoint(-1.0F, 2.0F, 1.0F); + this.LBToesole3.addBox(-0.5F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(LBToesole3, 0.0F, -0.045553093477052F, 0.0F); + this.LFToetop1 = new ModelRenderer(this, 200, 200); + this.LFToetop1.setRotationPoint(0.0F, -0.9F, -0.1F); + this.LFToetop1.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToetop1, 0.27314402793711257F, 0.0F, 0.0F); + this.BackplateL5 = new ModelRenderer(this, 100, 220); + this.BackplateL5.setRotationPoint(0.01F, 0.0F, -0.02F); + this.BackplateL5.addBox(-2.0F, 0.0F, 0.0F, 2, 7, 7, 0.0F); + this.setRotateAngle(BackplateL5, 0.0F, 1.5707963267948966F, 0.0F); + this.shape132 = new ModelRenderer(this, 0, 0); + this.shape132.setRotationPoint(1.7F, -2.0F, -3.0F); + this.shape132.addBox(0.0F, 0.0F, -6.0F, 0, 1, 7, 0.0F); + this.setRotateAngle(shape132, 0.0F, 0.136659280431156F, 0.0F); + this.BackplateR8 = new ModelRenderer(this, 100, 220); + this.BackplateR8.setRotationPoint(0.01F, -9.5F, 5.0F); + this.BackplateR8.addBox(0.0F, 0.0F, 0.0F, 2, 12, 7, 0.0F); + this.setRotateAngle(BackplateR8, -0.9105382707654417F, -0.5462880558742251F, 0.5918411493512771F); + this.RBToetop3_1 = new ModelRenderer(this, 200, 180); + this.RBToetop3_1.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RBToetop3_1.addBox(-0.5F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(RBToetop3_1, 0.18203784098300857F, 0.0F, 0.0F); + this.HeelL = new ModelRenderer(this, 130, 210); + this.HeelL.mirror = true; + this.HeelL.setRotationPoint(7.01F, 0.0F, 0.0F); + this.HeelL.addBox(-3.0F, 0.0F, 0.0F, 3, 3, 3, 0.0F); + this.setRotateAngle(HeelL, 0.0F, 0.0F, -0.27314402793711257F); + this.RBToetop2 = new ModelRenderer(this, 200, 200); + this.RBToetop2.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RBToetop2.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RBToetop2, 0.27314402793711257F, 0.0F, 0.0F); + this.RFToetop1 = new ModelRenderer(this, 200, 200); + this.RFToetop1.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RFToetop1.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToetop1, 0.27314402793711257F, 0.0F, 0.0F); + this.Tail42 = new ModelRenderer(this, 5, 70); + this.Tail42.setRotationPoint(0.01F, -0.01F, 4.0F); + this.Tail42.addBox(-2.0F, 0.0F, 0.0F, 4, 3, 5, 0.0F); + this.RBToetop4 = new ModelRenderer(this, 200, 190); + this.RBToetop4.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RBToetop4.addBox(-0.5F, 0.0F, -5.0F, 1, 1, 5, 0.0F); + this.setRotateAngle(RBToetop4, 0.18203784098300857F, 0.0F, 0.0F); + this.Frontbody = new ModelRenderer(this, 7, 232); + this.Frontbody.setRotationPoint(0.0F, 17.0F, -11.0F); + this.Frontbody.addBox(-4.5F, 0.0F, 0.0F, 9, 7, 11, 0.0F); + this.BrowL = new ModelRenderer(this, 70, 170); + this.BrowL.setRotationPoint(0.9F, 0.2F, -4.5F); + this.BrowL.addBox(0.0F, 0.0F, 0.0F, 1, 1, 5, 0.0F); + this.setRotateAngle(BrowL, 0.0F, 0.22759093446006054F, -0.136659280431156F); + this.RFToesole4 = new ModelRenderer(this, 200, 200); + this.RFToesole4.setRotationPoint(-1.6F, 2.0F, 0.4F); + this.RFToesole4.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToesole4, 0.0F, -0.27314402793711257F, 0.0F); + this.BrowR = new ModelRenderer(this, 70, 170); + this.BrowR.setRotationPoint(-0.9F, 0.2F, -4.5F); + this.BrowR.addBox(-1.0F, 0.0F, 0.0F, 1, 1, 5, 0.0F); + this.setRotateAngle(BrowR, 0.0F, -0.22759093446006054F, 0.136659280431156F); + this.BackplateL8 = new ModelRenderer(this, 100, 220); + this.BackplateL8.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL8.addBox(-2.0F, 0.0F, 0.0F, 2, 12, 7, 0.0F); + this.setRotateAngle(BackplateL8, 0.0F, 1.5707963267948966F, 0.0F); + this.BackplateL13 = new ModelRenderer(this, 100, 185); + this.BackplateL13.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL13.addBox(-2.0F, 0.0F, 0.0F, 2, 8, 5, 0.0F); + this.setRotateAngle(BackplateL13, 0.0F, 1.5707963267948966F, 0.0F); + this.BackplateR7 = new ModelRenderer(this, 100, 220); + this.BackplateR7.setRotationPoint(0.0F, -10.5F, 10.0F); + this.BackplateR7.addBox(0.0F, 0.0F, 0.0F, 2, 12, 7, 0.0F); + this.setRotateAngle(BackplateR7, -0.8196066167365371F, -0.5462880558742251F, 0.5462880558742251F); + this.BackplateL10 = new ModelRenderer(this, 100, 200); + this.BackplateL10.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL10.addBox(-2.0F, 0.0F, 0.0F, 2, 12, 6, 0.0F); + this.setRotateAngle(BackplateL10, 0.0F, 1.5707963267948966F, 0.0F); + this.Upperjaw1 = new ModelRenderer(this, 70, 210); + this.Upperjaw1.setRotationPoint(-0.01F, 1.8F, 0.0F); + this.Upperjaw1.addBox(-2.0F, 0.0F, -5.0F, 4, 2, 5, 0.0F); + this.setRotateAngle(Upperjaw1, -0.136659280431156F, 0.0F, 0.0F); + this.ThighL = new ModelRenderer(this, 130, 230); + this.ThighL.mirror = true; + this.ThighL.setRotationPoint(1.0F, 1.0F, 1.0F); + this.ThighL.addBox(0.0F, 0.0F, 0.0F, 7, 3, 4, 0.0F); + this.setRotateAngle(ThighL, -0.136659280431156F, 0.22759093446006054F, 0.18203784098300857F); + this.Tail51 = new ModelRenderer(this, 5, 60); + this.Tail51.setRotationPoint(0.0F, 0.7F, 5.0F); + this.Tail51.addBox(-1.5F, 0.0F, 0.0F, 3, 2, 6, 0.0F); + this.RFToesole5 = new ModelRenderer(this, 200, 200); + this.RFToesole5.setRotationPoint(-2.5F, 2.0F, 0.5F); + this.RFToesole5.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToesole5, 0.0F, 0.091106186954104F, 0.0F); + this.Eye = new ModelRenderer(this, 71, 194); + this.Eye.setRotationPoint(-2.02F, 1.0F, -3.0F); + this.Eye.addBox(0.0F, 0.0F, 0.0F, 1, 1, 2, 0.0F); + this.LBToesole4 = new ModelRenderer(this, 200, 190); + this.LBToesole4.setRotationPoint(-0.5F, 2.0F, 0.9F); + this.LBToesole4.addBox(-0.5F, 0.0F, -5.0F, 1, 1, 5, 0.0F); + this.setRotateAngle(LBToesole4, 0.0F, -0.40980330836826856F, 0.0F); + this.LFToetop5 = new ModelRenderer(this, 200, 200); + this.LFToetop5.setRotationPoint(0.0F, -0.9F, -0.1F); + this.LFToetop5.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToetop5, 0.27314402793711257F, 0.0F, 0.0F); + this.LFToesole3 = new ModelRenderer(this, 200, 200); + this.LFToesole3.setRotationPoint(0.8F, 2.0F, 0.7F); + this.LFToesole3.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToesole3, 0.0F, 0.6829473363053812F, 0.0F); + this.BackplateR6 = new ModelRenderer(this, 100, 220); + this.BackplateR6.setRotationPoint(0.01F, -8.9F, 6.49F); + this.BackplateR6.addBox(0.0F, 0.0F, 0.0F, 2, 9, 7, 0.0F); + this.setRotateAngle(BackplateR6, -0.6829473363053812F, -0.6373942428283291F, 0.4553564018453205F); + this.BackplateR9 = new ModelRenderer(this, 100, 220); + this.BackplateR9.setRotationPoint(0.0F, -7.5F, 10.01F); + this.BackplateR9.addBox(0.0F, 0.0F, 0.0F, 2, 12, 7, 0.0F); + this.setRotateAngle(BackplateR9, -1.2292353921796064F, -0.36425021489121656F, 0.7285004297824331F); + this.Lhand = new ModelRenderer(this, 160, 205); + this.Lhand.mirror = true; + this.Lhand.setRotationPoint(-2.99F, 0.0F, -7.99F); + this.Lhand.addBox(0.0F, 0.0F, 0.0F, 3, 3, 3, 0.0F); + this.setRotateAngle(Lhand, -0.22759093446006054F, 0.0F, 0.0F); + this.RBToetop3 = new ModelRenderer(this, 200, 180); + this.RBToetop3.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RBToetop3.addBox(-0.5F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(RBToetop3, 0.18203784098300857F, 0.0F, 0.0F); + this.LFToetop3 = new ModelRenderer(this, 200, 200); + this.LFToetop3.setRotationPoint(0.0F, -0.9F, -0.1F); + this.LFToetop3.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToetop3, 0.27314402793711257F, 0.0F, 0.0F); + this.ShinR = new ModelRenderer(this, 130, 220); + this.ShinR.setRotationPoint(-7.0F, 0.1F, 0.0F); + this.ShinR.addBox(-7.0F, 0.0F, 0.0F, 7, 3, 3, 0.0F); + this.setRotateAngle(ShinR, 0.0F, 0.9105382707654417F, 0.0F); + this.Lowerjaw1 = new ModelRenderer(this, 70, 150); + this.Lowerjaw1.setRotationPoint(0.0F, 3.1F, 0.1F); + this.Lowerjaw1.addBox(-2.0F, -1.0F, -5.0F, 4, 1, 5, 0.0F); + this.Upperjaw2 = new ModelRenderer(this, 70, 200); + this.Upperjaw2.setRotationPoint(0.0F, 0.0F, -5.0F); + this.Upperjaw2.addBox(-1.5F, 0.0F, -4.0F, 3, 2, 4, 0.0F); + this.RBToesole3 = new ModelRenderer(this, 200, 180); + this.RBToesole3.setRotationPoint(1.0F, 2.0F, 1.0F); + this.RBToesole3.addBox(-0.5F, 0.0F, -4.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(RBToesole3, 0.0F, 0.045553093477052F, 0.0F); + this.LBToesole2 = new ModelRenderer(this, 200, 200); + this.LBToesole2.setRotationPoint(-1.7F, 2.0F, 0.5F); + this.LBToesole2.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LBToesole2, 0.0F, 0.22759093446006054F, 0.0F); + this.Tail41 = new ModelRenderer(this, 5, 80); + this.Tail41.setRotationPoint(0.0F, 0.7F, 5.0F); + this.Tail41.addBox(-2.0F, 0.0F, 0.0F, 4, 3, 5, 0.0F); + this.RBToesole2 = new ModelRenderer(this, 200, 200); + this.RBToesole2.setRotationPoint(1.7F, 2.0F, 0.5F); + this.RBToesole2.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RBToesole2, 0.0F, -0.22759093446006054F, 0.0F); + this.LFToesole4 = new ModelRenderer(this, 200, 200); + this.LFToesole4.setRotationPoint(1.6F, 2.0F, 0.4F); + this.LFToesole4.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(LFToesole4, 0.0F, 0.27314402793711257F, 0.0F); + this.Neck1 = new ModelRenderer(this, 70, 220); + this.Neck1.setRotationPoint(0.0F, 0.5F, -5.0F); + this.Neck1.addBox(-3.0F, 0.0F, -5.0F, 6, 5, 5, 0.0F); + this.setRotateAngle(Neck1, 0.045553093477052F, 0.0F, 0.0F); + this.BackplateR1 = new ModelRenderer(this, 100, 160); + this.BackplateR1.setRotationPoint(0.0F, -2.0F, 2.0F); + this.BackplateR1.addBox(0.0F, 0.0F, 0.0F, 2, 4, 3, 0.0F); + this.setRotateAngle(BackplateR1, -1.1838568316277536F, -0.36425021489121656F, 0.7285004297824331F); + this.BackplateR10 = new ModelRenderer(this, 100, 200); + this.BackplateR10.setRotationPoint(0.0F, -6.2F, 15.99F); + this.BackplateR10.addBox(0.0F, 0.0F, 0.0F, 2, 12, 6, 0.0F); + this.setRotateAngle(BackplateR10, -1.4114477660878142F, -0.18203784098300857F, 0.7740535232594852F); + this.LLowerarm = new ModelRenderer(this, 160, 215); + this.LLowerarm.mirror = true; + this.LLowerarm.setRotationPoint(7.0F, 0.1F, 4.0F); + this.LLowerarm.addBox(-3.0F, 0.0F, -8.0F, 3, 3, 8, 0.0F); + this.setRotateAngle(LLowerarm, 0.0F, -0.36425021489121656F, 0.0F); + this.BackplateR4 = new ModelRenderer(this, 100, 200); + this.BackplateR4.setRotationPoint(-0.02F, -5.8F, -1.02F); + this.BackplateR4.addBox(0.0F, 0.0F, 0.0F, 2, 7, 6, 0.0F); + this.setRotateAngle(BackplateR4, -0.8651597102135892F, -0.5462880558742251F, 0.5462880558742251F); + this.BackplateL7 = new ModelRenderer(this, 100, 220); + this.BackplateL7.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL7.addBox(-2.0F, 0.0F, 0.0F, 2, 12, 7, 0.0F); + this.setRotateAngle(BackplateL7, 0.0F, 1.5707963267948966F, 0.0F); + this.BackplateL11 = new ModelRenderer(this, 100, 200); + this.BackplateL11.setRotationPoint(0.01F, 0.0F, -0.01F); + this.BackplateL11.addBox(-2.0F, 0.0F, 0.0F, 2, 8, 6, 0.0F); + this.setRotateAngle(BackplateL11, 0.0F, 1.5707963267948966F, 0.0F); + this.BackplateR12 = new ModelRenderer(this, 100, 185); + this.BackplateR12.setRotationPoint(0.0F, -3.5F, 4.0F); + this.BackplateR12.addBox(0.0F, 0.0F, 0.0F, 2, 8, 5, 0.0F); + this.setRotateAngle(BackplateR12, -1.5481070465189704F, -0.045553093477052F, 0.7740535232594852F); + this.RFToesole1 = new ModelRenderer(this, 200, 200); + this.RFToesole1.setRotationPoint(-0.5F, 2.0F, 2.3F); + this.RFToesole1.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToesole1, 0.0F, -1.5481070465189704F, 0.0F); + this.RFToetop4 = new ModelRenderer(this, 200, 200); + this.RFToetop4.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RFToetop4.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToetop4, 0.27314402793711257F, 0.0F, 0.0F); + this.RBToetop4_1 = new ModelRenderer(this, 200, 190); + this.RBToetop4_1.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RBToetop4_1.addBox(-0.5F, 0.0F, -5.0F, 1, 1, 5, 0.0F); + this.setRotateAngle(RBToetop4_1, 0.18203784098300857F, 0.0F, 0.0F); + this.Tail22 = new ModelRenderer(this, 5, 110); + this.Tail22.setRotationPoint(0.01F, -0.01F, 4.0F); + this.Tail22.addBox(-3.0F, 0.0F, 0.0F, 6, 5, 5, 0.0F); + this.RBToesole5 = new ModelRenderer(this, 200, 200); + this.RBToesole5.setRotationPoint(1.0F, 2.0F, 2.5F); + this.RBToesole5.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RBToesole5, 0.0F, 0.9560913642424937F, 0.0F); + this.Hippart = new ModelRenderer(this, 5, 180); + this.Hippart.setRotationPoint(0.0F, 0.5F, 14.0F); + this.Hippart.addBox(-3.0F, 0.0F, 0.0F, 6, 6, 5, 0.0F); + this.RBToetop2_1 = new ModelRenderer(this, 200, 200); + this.RBToetop2_1.setRotationPoint(0.0F, -0.6F, 0.0F); + this.RBToetop2_1.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RBToetop2_1, 0.18203784098300857F, 0.0F, 0.0F); + this.RFToesole3 = new ModelRenderer(this, 200, 200); + this.RFToesole3.setRotationPoint(-0.8F, 2.0F, 0.7F); + this.RFToesole3.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToesole3, 0.0F, -0.6829473363053812F, 0.0F); + this.RFToesole2 = new ModelRenderer(this, 200, 200); + this.RFToesole2.setRotationPoint(-0.5F, 2.0F, 1.3F); + this.RFToesole2.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToesole2, 0.0F, -1.0471975511965976F, 0.0F); + this.Tail32 = new ModelRenderer(this, 5, 90); + this.Tail32.setRotationPoint(0.01F, -0.01F, 4.0F); + this.Tail32.addBox(-2.5F, 0.0F, 0.0F, 5, 4, 5, 0.0F); + this.RBToetop1 = new ModelRenderer(this, 200, 200); + this.RBToetop1.setRotationPoint(0.0F, -0.6F, -0.1F); + this.RBToetop1.addBox(-0.5F, 0.0F, -2.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(RBToetop1, 0.27314402793711257F, 0.0F, 0.0F); + this.Backbody = new ModelRenderer(this, 5, 200); + this.Backbody.setRotationPoint(-0.01F, -0.01F, 9.0F); + this.Backbody.addBox(-4.5F, 0.0F, 0.0F, 9, 7, 14, 0.0F); + this.RFToetop5 = new ModelRenderer(this, 200, 200); + this.RFToetop5.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RFToetop5.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToetop5, 0.27314402793711257F, 0.0F, 0.0F); + this.RFToetop2 = new ModelRenderer(this, 200, 200); + this.RFToetop2.setRotationPoint(0.0F, -0.9F, -0.1F); + this.RFToetop2.addBox(-0.5F, 0.0F, -3.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(RFToetop2, 0.27314402793711257F, 0.0F, 0.0F); + this.Tail11 = new ModelRenderer(this, 5, 160); + this.Tail11.setRotationPoint(0.0F, 0.0F, 5.0F); + this.Tail11.addBox(-3.5F, 0.0F, 0.0F, 7, 6, 4, 0.0F); + this.Neck1.addChild(this.BackplateR2); + this.ThighL.addChild(this.ShinL); + this.Frontbody.addChild(this.BackplateR5); + this.ShinR.addChild(this.HeelR); + this.Upperjaw1.addChild(this.Backmouth); + this.HeelR.addChild(this.RBToesole4); + this.LFToesole2.addChild(this.LFToetop1_1); + this.HeelL.addChild(this.LBToesole5); + this.Lowerjaw1.addChild(this.shape131); + this.LFToesole4.addChild(this.LFToetop4); + this.RUpperarm.addChild(this.Rlowerarm); + this.RFToesole3.addChild(this.RFToetop3); + this.HeelL.addChild(this.LBToesole1); + this.BackplateR12.addChild(this.BackplateL12); + this.Lowerjaw1.addChild(this.Lowerjaw2); + this.Tail51.addChild(this.Tail52); + this.Neck1.addChild(this.Headtop1); + this.Tail11.addChild(this.Tail12); + this.Lhand.addChild(this.LFToesole1); + this.Tail12.addChild(this.Tail21); + this.BackplateR3.addChild(this.BackplateL3); + this.Tail21.addChild(this.BackplateR13); + this.Upperjaw1.addChild(this.TeethR1); + this.BackplateR2.addChild(this.BackplateL2); + this.Rlowerarm.addChild(this.Rhand); + this.HeelR.addChild(this.RBToesole1); + this.BackplateR1.addChild(this.BackplateL1); + this.Lhand.addChild(this.LFToesole2); + this.Shoulderpart.addChild(this.BackplateR3); + this.BackplateR6.addChild(this.BackplateL6); + this.Frontbody.addChild(this.Shoulderpart); + this.Headtop1.addChild(this.Headtop2); + this.Tail22.addChild(this.Tail31); + this.Lhand.addChild(this.LFToesole5); + this.Shoulderpart.addChild(this.LUpperarm); + this.BackplateR9.addChild(this.BackplateL9); + this.BackplateR4.addChild(this.BackplateL4); + this.Hippart.addChild(this.BackplateR11); + this.Shoulderpart.addChild(this.RUpperarm); + this.Hippart.addChild(this.ThighR); + this.RBToesole1.addChild(this.RBToetop1_1); + this.Upperjaw1.addChild(this.TeethL1); + this.HeelL.addChild(this.LBToesole3); + this.LFToesole1.addChild(this.LFToetop1); + this.BackplateR5.addChild(this.BackplateL5); + this.Lowerjaw1.addChild(this.shape132); + this.Backbody.addChild(this.BackplateR8); + this.RBToesole3.addChild(this.RBToetop3_1); + this.ShinL.addChild(this.HeelL); + this.LBToesole2.addChild(this.RBToetop2); + this.RFToesole1.addChild(this.RFToetop1); + this.Tail41.addChild(this.Tail42); + this.LBToesole4.addChild(this.RBToetop4); + this.Headtop1.addChild(this.BrowL); + this.Rhand.addChild(this.RFToesole4); + this.Headtop1.addChild(this.BrowR); + this.BackplateR8.addChild(this.BackplateL8); + this.BackplateR13.addChild(this.BackplateL13); + this.Frontbody.addChild(this.BackplateR7); + this.BackplateR10.addChild(this.BackplateL10); + this.Headtop1.addChild(this.Upperjaw1); + this.Hippart.addChild(this.ThighL); + this.Tail42.addChild(this.Tail51); + this.Rhand.addChild(this.RFToesole5); + this.Headtop1.addChild(this.Eye); + this.HeelL.addChild(this.LBToesole4); + this.LFToesole5.addChild(this.LFToetop5); + this.Lhand.addChild(this.LFToesole3); + this.Frontbody.addChild(this.BackplateR6); + this.Backbody.addChild(this.BackplateR9); + this.LLowerarm.addChild(this.Lhand); + this.LBToesole3.addChild(this.RBToetop3); + this.LFToesole3.addChild(this.LFToetop3); + this.ThighR.addChild(this.ShinR); + this.Backmouth.addChild(this.Lowerjaw1); + this.Upperjaw1.addChild(this.Upperjaw2); + this.HeelR.addChild(this.RBToesole3); + this.HeelL.addChild(this.LBToesole2); + this.Tail32.addChild(this.Tail41); + this.HeelR.addChild(this.RBToesole2); + this.Lhand.addChild(this.LFToesole4); + this.Shoulderpart.addChild(this.Neck1); + this.Headtop1.addChild(this.BackplateR1); + this.Backbody.addChild(this.BackplateR10); + this.LUpperarm.addChild(this.LLowerarm); + this.Shoulderpart.addChild(this.BackplateR4); + this.BackplateR7.addChild(this.BackplateL7); + this.BackplateR11.addChild(this.BackplateL11); + this.Tail11.addChild(this.BackplateR12); + this.Rhand.addChild(this.RFToesole1); + this.RFToesole4.addChild(this.RFToetop4); + this.RBToesole4.addChild(this.RBToetop4_1); + this.Tail21.addChild(this.Tail22); + this.HeelR.addChild(this.RBToesole5); + this.Backbody.addChild(this.Hippart); + this.RBToesole2.addChild(this.RBToetop2_1); + this.Rhand.addChild(this.RFToesole3); + this.Rhand.addChild(this.RFToesole2); + this.Tail31.addChild(this.Tail32); + this.LBToesole1.addChild(this.RBToetop1); + this.Frontbody.addChild(this.Backbody); + this.RFToesole5.addChild(this.RFToetop5); + this.RFToesole2.addChild(this.RFToetop2); + this.Hippart.addChild(this.Tail11); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.Frontbody.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; + } +} diff --git a/TODO/Unimplemented/readme.txt b/TODO/Unimplemented/readme.txt new file mode 100644 index 00000000..07194447 --- /dev/null +++ b/TODO/Unimplemented/readme.txt @@ -0,0 +1 @@ +Models by @basiliskboy (http://www.minecraftforum.net/members/basiliskboy) \ No newline at end of file diff --git a/TODO/Unimplemented/stag.java b/TODO/Unimplemented/stag.java new file mode 100644 index 00000000..b0327894 --- /dev/null +++ b/TODO/Unimplemented/stag.java @@ -0,0 +1,342 @@ +package Mob; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +/** + * stag - Undefined + * Created using Tabula 5.1.0 + */ +public class stag extends ModelBase { + public ModelRenderer Bodyfront; + public ModelRenderer Bodyback; + public ModelRenderer ShoulderR; + public ModelRenderer ShoulderL; + public ModelRenderer Neck1; + public ModelRenderer ThighR; + public ModelRenderer ThighL; + public ModelRenderer Tail1; + public ModelRenderer ShinR; + public ModelRenderer HeelR; + public ModelRenderer FootR; + public ModelRenderer shape33; + public ModelRenderer shape34; + public ModelRenderer ShinL; + public ModelRenderer HeelL; + public ModelRenderer FootL; + public ModelRenderer shape35; + public ModelRenderer shape36; + public ModelRenderer UpperarmR; + public ModelRenderer UnderarmR; + public ModelRenderer FootfrontR; + public ModelRenderer shape29; + public ModelRenderer shape30; + public ModelRenderer UpperarmL; + public ModelRenderer UnderarmL; + public ModelRenderer FootfrontL; + public ModelRenderer shape31; + public ModelRenderer shape32; + public ModelRenderer Neck2; + public ModelRenderer Neck3; + public ModelRenderer Head1; + public ModelRenderer Head2; + public ModelRenderer Lowerjaw; + public ModelRenderer AntlerbaseR; + public ModelRenderer Antlerbase; + public ModelRenderer shape73; + public ModelRenderer shape74; + public ModelRenderer Headtop; + public ModelRenderer AntlerR; + public ModelRenderer AntlerR2; + public ModelRenderer AntlerR3; + public ModelRenderer AntlerR7; + public ModelRenderer AntlerR4; + public ModelRenderer AntlerR6; + public ModelRenderer AntlerR5; + public ModelRenderer AntlerL; + public ModelRenderer AntlerL3; + public ModelRenderer AntlerL2; + public ModelRenderer AntlerL7; + public ModelRenderer AntlerL4; + public ModelRenderer AntlerL6; + public ModelRenderer AntlerL5; + + public stag() { + this.textureWidth = 256; + this.textureHeight = 128; + this.AntlerR6 = new ModelRenderer(this, 70, 55); + this.AntlerR6.setRotationPoint(0.0F, 0.0F, 3.0F); + this.AntlerR6.addBox(-2.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); + this.setRotateAngle(AntlerR6, 0.0F, 0.9560913642424937F, 0.0F); + this.Lowerjaw = new ModelRenderer(this, 40, 30); + this.Lowerjaw.setRotationPoint(0.0F, 4.0F, -4.5F); + this.Lowerjaw.addBox(-1.0F, -1.0F, -5.0F, 2, 1, 5, 0.0F); + this.setRotateAngle(Lowerjaw, -0.045553093477052F, 0.0F, 0.0F); + this.Head1 = new ModelRenderer(this, 40, 60); + this.Head1.setRotationPoint(0.0F, -0.4F, -3.5F); + this.Head1.addBox(-1.5F, 0.0F, -5.0F, 3, 4, 5, 0.0F); + this.setRotateAngle(Head1, 0.6373942428283291F, 0.0F, 0.0F); + this.shape32 = new ModelRenderer(this, 70, 75); + this.shape32.setRotationPoint(-0.8F, 0.0F, -0.3F); + this.shape32.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape32, -0.18203784098300857F, -0.40980330836826856F, 0.0F); + this.shape74 = new ModelRenderer(this, 0, 0); + this.shape74.setRotationPoint(1.5F, -0.1F, -0.5F); + this.shape74.addBox(-1.0F, 0.0F, 0.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(shape74, 0.31869712141416456F, 0.136659280431156F, 0.0F); + this.AntlerR2 = new ModelRenderer(this, 70, 50); + this.AntlerR2.setRotationPoint(-0.01F, 0.5F, 0.8F); + this.AntlerR2.addBox(0.0F, 0.0F, -2.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(AntlerR2, -0.8196066167365371F, -0.045553093477052F, 0.0F); + this.Bodyback = new ModelRenderer(this, 5, 75); + this.Bodyback.setRotationPoint(0.0F, 0.1F, 12.0F); + this.Bodyback.addBox(-4.0F, 0.0F, 0.0F, 8, 10, 11, 0.0F); + this.setRotateAngle(Bodyback, -0.18203784098300857F, 0.0F, 0.0F); + this.Neck1 = new ModelRenderer(this, 5, 60); + this.Neck1.setRotationPoint(0.0F, 1.0F, 3.0F); + this.Neck1.addBox(-2.5F, 0.0F, -5.0F, 5, 7, 5, 0.0F); + this.setRotateAngle(Neck1, -0.40980330836826856F, 0.0F, 0.0F); + this.Neck3 = new ModelRenderer(this, 5, 35); + this.Neck3.setRotationPoint(0.0F, 0.0F, -4.0F); + this.Neck3.addBox(-1.5F, 0.0F, -4.0F, 3, 4, 4, 0.0F); + this.setRotateAngle(Neck3, 0.22759093446006054F, 0.0F, 0.0F); + this.AntlerL5 = new ModelRenderer(this, 70, 55); + this.AntlerL5.setRotationPoint(-0.6F, 0.0F, 0.4F); + this.AntlerL5.addBox(-2.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); + this.setRotateAngle(AntlerL5, -0.091106186954104F, 0.36425021489121656F, 0.22759093446006054F); + this.Head2 = new ModelRenderer(this, 40, 40); + this.Head2.setRotationPoint(0.0F, 0.9F, -3.8F); + this.Head2.addBox(-1.0F, 0.0F, -6.0F, 2, 2, 6, 0.0F); + this.setRotateAngle(Head2, 0.045553093477052F, 0.0F, 0.0F); + this.HeelL = new ModelRenderer(this, 100, 85); + this.HeelL.setRotationPoint(-0.5F, 8.0F, 3.8F); + this.HeelL.addBox(-2.0F, 0.0F, -2.0F, 2, 8, 2, 0.0F); + this.setRotateAngle(HeelL, -1.0471975511965976F, 0.0F, 0.0F); + this.ShoulderR = new ModelRenderer(this, 70, 115); + this.ShoulderR.setRotationPoint(-5.0F, 3.5F, 2.0F); + this.ShoulderR.addBox(0.0F, 0.0F, 0.0F, 3, 7, 5, 0.0F); + this.setRotateAngle(ShoulderR, 0.045553093477052F, 0.0F, 0.22759093446006054F); + this.Neck2 = new ModelRenderer(this, 5, 45); + this.Neck2.setRotationPoint(0.0F, 0.5F, -3.5F); + this.Neck2.addBox(-2.0F, 0.0F, -4.0F, 4, 5, 5, 0.0F); + this.setRotateAngle(Neck2, -0.40980330836826856F, 0.0F, 0.0F); + this.AntlerL2 = new ModelRenderer(this, 70, 50); + this.AntlerL2.setRotationPoint(0.01F, 0.5F, 0.8F); + this.AntlerL2.addBox(-1.0F, 0.0F, -2.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(AntlerL2, -0.8196066167365371F, 0.045553093477052F, 0.0F); + this.HeelR = new ModelRenderer(this, 100, 85); + this.HeelR.setRotationPoint(0.5F, 8.0F, 3.8F); + this.HeelR.addBox(0.0F, 0.0F, -2.0F, 2, 8, 2, 0.0F); + this.setRotateAngle(HeelR, -1.0471975511965976F, 0.0F, 0.0F); + this.AntlerL7 = new ModelRenderer(this, 70, 55); + this.AntlerL7.setRotationPoint(-0.4F, 0.0F, 1.5F); + this.AntlerL7.addBox(0.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); + this.setRotateAngle(AntlerL7, 0.0F, -0.6373942428283291F, -0.27314402793711257F); + this.UnderarmR = new ModelRenderer(this, 70, 90); + this.UnderarmR.setRotationPoint(0.0F, 6.0F, -3.0F); + this.UnderarmR.addBox(0.0F, 0.0F, 0.0F, 2, 6, 2, 0.0F); + this.setRotateAngle(UnderarmR, -0.091106186954104F, 0.0F, 0.0F); + this.shape33 = new ModelRenderer(this, 70, 75); + this.shape33.setRotationPoint(0.8F, 0.0F, -0.2F); + this.shape33.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape33, -0.09599310885968812F, 0.36425021489121656F, 0.0F); + this.AntlerR = new ModelRenderer(this, 70, 65); + this.AntlerR.setRotationPoint(0.0F, -1.0F, 0.0F); + this.AntlerR.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(AntlerR, 0.4553564018453205F, -0.27314402793711257F, 0.0F); + this.UpperarmR = new ModelRenderer(this, 70, 100); + this.UpperarmR.setRotationPoint(0.2F, 6.0F, 4.5F); + this.UpperarmR.addBox(0.0F, 0.0F, -3.0F, 2, 7, 3, 0.0F); + this.setRotateAngle(UpperarmR, -0.31869712141416456F, -0.091106186954104F, -0.18203784098300857F); + this.AntlerL3 = new ModelRenderer(this, 70, 65); + this.AntlerL3.setRotationPoint(0.0F, 0.0F, 3.5F); + this.AntlerL3.addBox(-1.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(AntlerL3, 0.27314402793711257F, -0.27314402793711257F, 0.0F); + this.FootR = new ModelRenderer(this, 100, 75); + this.FootR.setRotationPoint(0.0F, 8.0F, -2.0F); + this.FootR.addBox(0.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F); + this.setRotateAngle(FootR, 0.22759093446006054F, 0.0F, 0.0F); + this.FootfrontR = new ModelRenderer(this, 70, 80); + this.FootfrontR.setRotationPoint(0.0F, 6.0F, 0.0F); + this.FootfrontR.addBox(0.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F); + this.setRotateAngle(FootfrontR, 0.22759093446006054F, 0.0F, 0.0F); + this.shape73 = new ModelRenderer(this, 0, 0); + this.shape73.setRotationPoint(-1.5F, 0.1F, -0.5F); + this.shape73.addBox(0.0F, 0.0F, 0.0F, 1, 1, 2, 0.0F); + this.setRotateAngle(shape73, 0.31869712141416456F, -0.136659280431156F, 0.0F); + this.UnderarmL = new ModelRenderer(this, 70, 90); + this.UnderarmL.setRotationPoint(0.0F, 6.0F, -3.0F); + this.UnderarmL.addBox(-2.0F, 0.0F, 0.0F, 2, 6, 2, 0.0F); + this.setRotateAngle(UnderarmL, -0.091106186954104F, 0.0F, 0.0F); + this.shape36 = new ModelRenderer(this, 70, 75); + this.shape36.setRotationPoint(-1.3F, 0.0F, -0.1F); + this.shape36.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape36, -0.18203784098300857F, 0.40980330836826856F, 0.0F); + this.ThighL = new ModelRenderer(this, 100, 113); + this.ThighL.setRotationPoint(4.6F, 2.0F, 3.9F); + this.ThighL.addBox(-4.0F, 0.0F, 0.0F, 4, 8, 6, 0.0F); + this.setRotateAngle(ThighL, 0.091106186954104F, 0.0F, -0.136659280431156F); + this.shape31 = new ModelRenderer(this, 70, 75); + this.shape31.setRotationPoint(-1.2F, 0.0F, -0.2F); + this.shape31.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape31, -0.18203784098300857F, 0.40980330836826856F, 0.0F); + this.AntlerR4 = new ModelRenderer(this, 70, 60); + this.AntlerR4.setRotationPoint(0.0F, 0.0F, 3.7F); + this.AntlerR4.addBox(0.0F, 0.0F, 0.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(AntlerR4, 0.27314402793711257F, 0.5462880558742251F, 0.0F); + this.shape35 = new ModelRenderer(this, 70, 75); + this.shape35.setRotationPoint(-0.8F, 0.0F, -0.2F); + this.shape35.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape35, -0.18203784098300857F, -0.36425021489121656F, 0.0F); + this.UpperarmL = new ModelRenderer(this, 70, 100); + this.UpperarmL.setRotationPoint(-0.2F, 6.0F, 4.5F); + this.UpperarmL.addBox(-2.0F, 0.0F, -3.0F, 2, 7, 3, 0.0F); + this.setRotateAngle(UpperarmL, -0.31869712141416456F, 0.091106186954104F, 0.18203784098300857F); + this.ThighR = new ModelRenderer(this, 100, 113); + this.ThighR.setRotationPoint(-4.6F, 2.0F, 3.9F); + this.ThighR.addBox(0.0F, 0.0F, 0.0F, 4, 8, 6, 0.0F); + this.setRotateAngle(ThighR, 0.091106186954104F, 0.0F, 0.136659280431156F); + this.shape34 = new ModelRenderer(this, 70, 75); + this.shape34.setRotationPoint(1.3F, 0.0F, -0.1F); + this.shape34.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape34, -0.18203784098300857F, -0.40980330836826856F, 0.0F); + this.ShoulderL = new ModelRenderer(this, 70, 115); + this.ShoulderL.setRotationPoint(5.0F, 3.5F, 2.0F); + this.ShoulderL.addBox(-3.0F, 0.0F, 0.0F, 3, 7, 5, 0.0F); + this.setRotateAngle(ShoulderL, 0.091106186954104F, 0.0F, -0.22759093446006054F); + this.ShinR = new ModelRenderer(this, 100, 100); + this.ShinR.setRotationPoint(0.5F, 8.0F, 0.0F); + this.ShinR.addBox(0.0F, 0.0F, 0.0F, 3, 8, 4, 0.0F); + this.setRotateAngle(ShinR, 0.8196066167365371F, 0.0F, -0.136659280431156F); + this.AntlerbaseR = new ModelRenderer(this, 70, 45); + this.AntlerbaseR.setRotationPoint(-1.5F, 0.0F, -2.1F); + this.AntlerbaseR.addBox(0.0F, -1.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(AntlerbaseR, -0.136659280431156F, -0.136659280431156F, -0.136659280431156F); + this.shape29 = new ModelRenderer(this, 70, 75); + this.shape29.setRotationPoint(0.8F, 0.0F, -0.3F); + this.shape29.addBox(-1.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape29, -0.18203784098300857F, 0.40980330836826856F, 0.0F); + this.shape30 = new ModelRenderer(this, 70, 75); + this.shape30.setRotationPoint(1.2F, 0.0F, -0.2F); + this.shape30.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.setRotateAngle(shape30, -0.18203784098300857F, -0.40980330836826856F, 0.0F); + this.Headtop = new ModelRenderer(this, 40, 50); + this.Headtop.setRotationPoint(0.0F, -0.9F, -1.0F); + this.Headtop.addBox(-1.0F, 0.0F, -5.0F, 2, 1, 5, 0.0F); + this.setRotateAngle(Headtop, 0.18203784098300857F, 0.0F, 0.0F); + this.FootfrontL = new ModelRenderer(this, 70, 80); + this.FootfrontL.setRotationPoint(0.0F, 6.0F, 0.0F); + this.FootfrontL.addBox(-2.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F); + this.setRotateAngle(FootfrontL, 0.22759093446006054F, 0.0F, 0.0F); + this.Tail1 = new ModelRenderer(this, 5, 25); + this.Tail1.setRotationPoint(0.0F, 0.3F, 11.0F); + this.Tail1.addBox(-1.5F, 0.0F, -2.0F, 3, 4, 2, 0.0F); + this.setRotateAngle(Tail1, 0.31869712141416456F, 0.0F, 0.0F); + this.ShinL = new ModelRenderer(this, 100, 100); + this.ShinL.setRotationPoint(-0.5F, 8.0F, 0.0F); + this.ShinL.addBox(-3.0F, 0.0F, 0.0F, 3, 8, 4, 0.0F); + this.setRotateAngle(ShinL, 0.8196066167365371F, 0.0F, 0.136659280431156F); + this.AntlerR7 = new ModelRenderer(this, 70, 55); + this.AntlerR7.setRotationPoint(0.4F, 0.0F, 1.5F); + this.AntlerR7.addBox(-2.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); + this.setRotateAngle(AntlerR7, 0.0F, 0.6373942428283291F, 0.27314402793711257F); + this.AntlerR3 = new ModelRenderer(this, 70, 65); + this.AntlerR3.setRotationPoint(0.0F, 0.0F, 3.5F); + this.AntlerR3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(AntlerR3, 0.27314402793711257F, 0.27314402793711257F, 0.0F); + this.AntlerL6 = new ModelRenderer(this, 70, 55); + this.AntlerL6.setRotationPoint(0.0F, 0.0F, 3.0F); + this.AntlerL6.addBox(0.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); + this.setRotateAngle(AntlerL6, 0.0F, -0.9560913642424937F, 0.0F); + this.Bodyfront = new ModelRenderer(this, 5, 100); + this.Bodyfront.setRotationPoint(0.0F, 0.0F, -10.0F); + this.Bodyfront.addBox(-4.5F, 0.0F, 0.0F, 9, 10, 12, 0.0F); + this.setRotateAngle(Bodyfront, 0.091106186954104F, 0.0F, 0.0F); + this.FootL = new ModelRenderer(this, 100, 75); + this.FootL.setRotationPoint(0.0F, 8.0F, -2.0F); + this.FootL.addBox(-2.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F); + this.setRotateAngle(FootL, 0.22759093446006054F, 0.0F, 0.0F); + this.Antlerbase = new ModelRenderer(this, 70, 45); + this.Antlerbase.setRotationPoint(1.5F, 0.0F, -2.1F); + this.Antlerbase.addBox(-1.0F, -1.0F, 0.0F, 1, 2, 1, 0.0F); + this.setRotateAngle(Antlerbase, -0.136659280431156F, 0.136659280431156F, 0.136659280431156F); + this.AntlerR5 = new ModelRenderer(this, 70, 55); + this.AntlerR5.setRotationPoint(0.6F, 0.0F, 0.4F); + this.AntlerR5.addBox(0.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); + this.setRotateAngle(AntlerR5, -0.091106186954104F, -0.36425021489121656F, -0.22759093446006054F); + this.AntlerL = new ModelRenderer(this, 70, 65); + this.AntlerL.setRotationPoint(0.0F, -1.0F, 0.0F); + this.AntlerL.addBox(-1.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.setRotateAngle(AntlerL, 0.4553564018453205F, 0.27314402793711257F, 0.0F); + this.AntlerL4 = new ModelRenderer(this, 70, 60); + this.AntlerL4.setRotationPoint(0.0F, 0.0F, 3.7F); + this.AntlerL4.addBox(-1.0F, 0.0F, 0.0F, 1, 1, 3, 0.0F); + this.setRotateAngle(AntlerL4, 0.27314402793711257F, -0.5462880558742251F, 0.0F); + this.AntlerR3.addChild(this.AntlerR6); + this.Head1.addChild(this.Lowerjaw); + this.Neck3.addChild(this.Head1); + this.FootfrontL.addChild(this.shape32); + this.Head1.addChild(this.shape74); + this.AntlerR.addChild(this.AntlerR2); + this.Bodyfront.addChild(this.Bodyback); + this.Bodyfront.addChild(this.Neck1); + this.Neck2.addChild(this.Neck3); + this.AntlerL4.addChild(this.AntlerL5); + this.Head1.addChild(this.Head2); + this.ShinL.addChild(this.HeelL); + this.Bodyfront.addChild(this.ShoulderR); + this.Neck1.addChild(this.Neck2); + this.AntlerL.addChild(this.AntlerL2); + this.ShinR.addChild(this.HeelR); + this.AntlerL.addChild(this.AntlerL7); + this.UpperarmR.addChild(this.UnderarmR); + this.FootR.addChild(this.shape33); + this.AntlerbaseR.addChild(this.AntlerR); + this.ShoulderR.addChild(this.UpperarmR); + this.AntlerL.addChild(this.AntlerL3); + this.HeelR.addChild(this.FootR); + this.UnderarmR.addChild(this.FootfrontR); + this.Head1.addChild(this.shape73); + this.UpperarmL.addChild(this.UnderarmL); + this.FootL.addChild(this.shape36); + this.Bodyback.addChild(this.ThighL); + this.FootfrontL.addChild(this.shape31); + this.AntlerR3.addChild(this.AntlerR4); + this.FootL.addChild(this.shape35); + this.ShoulderL.addChild(this.UpperarmL); + this.Bodyback.addChild(this.ThighR); + this.FootR.addChild(this.shape34); + this.Bodyfront.addChild(this.ShoulderL); + this.ThighR.addChild(this.ShinR); + this.Head1.addChild(this.AntlerbaseR); + this.FootfrontR.addChild(this.shape29); + this.FootfrontR.addChild(this.shape30); + this.Head2.addChild(this.Headtop); + this.UnderarmL.addChild(this.FootfrontL); + this.Bodyback.addChild(this.Tail1); + this.ThighL.addChild(this.ShinL); + this.AntlerR.addChild(this.AntlerR7); + this.AntlerR.addChild(this.AntlerR3); + this.AntlerL3.addChild(this.AntlerL6); + this.HeelL.addChild(this.FootL); + this.Head1.addChild(this.Antlerbase); + this.AntlerR4.addChild(this.AntlerR5); + this.Antlerbase.addChild(this.AntlerL); + this.AntlerL3.addChild(this.AntlerL4); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.Bodyfront.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; + } +} diff --git a/TODO/Unimplemented/stagOrDeer-texture.png b/TODO/Unimplemented/stagOrDeer-texture.png new file mode 100644 index 00000000..afc375b8 Binary files /dev/null and b/TODO/Unimplemented/stagOrDeer-texture.png differ diff --git a/build.gradle b/build.gradle index cf226c95..3c7fc178 100644 --- a/build.gradle +++ b/build.gradle @@ -16,40 +16,56 @@ buildscript { } apply plugin: 'forge' +apply plugin: 'idea' -version = "2.8.12" -group= "minefantasy.mf2.minefantasy2" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +version = "2.8.14.5u" +group= "minefantasy.mf2.minefantasy2" archivesBaseName = "MineFantasyII" -minecraft { - version = "1.7.10-10.13.2.1230" - runDir = "eclipse" +sourceCompatibility = targetCompatibility = '1.8' +compileJava { + sourceCompatibility = targetCompatibility = '1.8' } -task deobfJar(type: Jar) { - from sourceSets.main.output - classifier = 'deobf' +minecraft { + version = "1.7.10-10.13.4.1614-1.7.10" + runDir = "run" + replace "@VERSION@", project.version } +idea { module { inheritOutputDirs = true } } -tasks.build.dependsOn('deobfJar') +repositories { + maven { + name = "chickenbones" + url = "http://chickenbones.net/maven/" + } + + ivy { + name "MineTweaker3" + artifactPattern "http://minetweaker3.powerofbytes.com/download/[module]-[revision].[ext]" + } + + flatDir { + dirs 'lib' + } +} dependencies { - // you may put jars on which you depend on in ./libs - // or you may define them like so.. - //compile "some.group:artifact:version:classifier" - //compile "some.group:artifact:version" - - // real examples - //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // for more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html + compile name: 'bukkit-1.7.10' + compile name: 'MineTweaker3', version: "Dev-1.7.10-3.0.10B", ext: 'jar' + compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev" + compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev" + compile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev" +} +task deobfJar(type: Jar) { + from sourceSets.main.output + classifier = 'deobf' } +tasks.build.dependsOn('deobfJar') + processResources { // this will ensure that this task is redone when the versions change. diff --git a/gradlew b/gradlew new file mode 100644 index 00000000..91a7e269 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/libs/textures/blocks/base/angmallen_block.png b/libs/textures/blocks/base/angmallen_block.png new file mode 100644 index 00000000..39207d83 Binary files /dev/null and b/libs/textures/blocks/base/angmallen_block.png differ diff --git a/libs/textures/blocks/base/angmallen_brick.png b/libs/textures/blocks/base/angmallen_brick.png new file mode 100644 index 00000000..b5c60b7a Binary files /dev/null and b/libs/textures/blocks/base/angmallen_brick.png differ diff --git a/libs/textures/blocks/base/angmallen_molten_flow.png b/libs/textures/blocks/base/angmallen_molten_flow.png new file mode 100644 index 00000000..708a8a2d Binary files /dev/null and b/libs/textures/blocks/base/angmallen_molten_flow.png differ diff --git a/libs/textures/blocks/base/angmallen_molten_flow.png.mcmeta b/libs/textures/blocks/base/angmallen_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/base/angmallen_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/base/angmallen_molten_still.png b/libs/textures/blocks/base/angmallen_molten_still.png new file mode 100644 index 00000000..7116580d Binary files /dev/null and b/libs/textures/blocks/base/angmallen_molten_still.png differ diff --git a/libs/textures/blocks/base/angmallen_molten_still.png.mcmeta b/libs/textures/blocks/base/angmallen_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/base/angmallen_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/base/bronze_block.png b/libs/textures/blocks/base/bronze_block.png new file mode 100644 index 00000000..2ecf2128 Binary files /dev/null and b/libs/textures/blocks/base/bronze_block.png differ diff --git a/libs/textures/blocks/base/bronze_brick.png b/libs/textures/blocks/base/bronze_brick.png new file mode 100644 index 00000000..e4d6b808 Binary files /dev/null and b/libs/textures/blocks/base/bronze_brick.png differ diff --git a/libs/textures/blocks/base/bronze_molten_flow.png b/libs/textures/blocks/base/bronze_molten_flow.png new file mode 100644 index 00000000..35d7fc0c Binary files /dev/null and b/libs/textures/blocks/base/bronze_molten_flow.png differ diff --git a/libs/textures/blocks/base/bronze_molten_flow.png.mcmeta b/libs/textures/blocks/base/bronze_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/base/bronze_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/base/bronze_molten_still.png b/libs/textures/blocks/base/bronze_molten_still.png new file mode 100644 index 00000000..51f32e3d Binary files /dev/null and b/libs/textures/blocks/base/bronze_molten_still.png differ diff --git a/libs/textures/blocks/base/bronze_molten_still.png.mcmeta b/libs/textures/blocks/base/bronze_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/base/bronze_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/base/copper_block.png b/libs/textures/blocks/base/copper_block.png new file mode 100644 index 00000000..77213c5d Binary files /dev/null and b/libs/textures/blocks/base/copper_block.png differ diff --git a/libs/textures/blocks/base/copper_brick.png b/libs/textures/blocks/base/copper_brick.png new file mode 100644 index 00000000..ab455efb Binary files /dev/null and b/libs/textures/blocks/base/copper_brick.png differ diff --git a/libs/textures/blocks/base/copper_molten_flow.png b/libs/textures/blocks/base/copper_molten_flow.png new file mode 100644 index 00000000..dda5f8bb Binary files /dev/null and b/libs/textures/blocks/base/copper_molten_flow.png differ diff --git a/libs/textures/blocks/base/copper_molten_flow.png.mcmeta b/libs/textures/blocks/base/copper_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/base/copper_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/base/copper_molten_still.png b/libs/textures/blocks/base/copper_molten_still.png new file mode 100644 index 00000000..1c10c4be Binary files /dev/null and b/libs/textures/blocks/base/copper_molten_still.png differ diff --git a/libs/textures/blocks/base/copper_molten_still.png.mcmeta b/libs/textures/blocks/base/copper_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/base/copper_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/base/copper_ore.png b/libs/textures/blocks/base/copper_ore.png new file mode 100644 index 00000000..291223d2 Binary files /dev/null and b/libs/textures/blocks/base/copper_ore.png differ diff --git a/libs/textures/blocks/base/copper_ore_overlay.png b/libs/textures/blocks/base/copper_ore_overlay.png new file mode 100644 index 00000000..9aad404b Binary files /dev/null and b/libs/textures/blocks/base/copper_ore_overlay.png differ diff --git a/libs/textures/blocks/base/damascus_steel_block.png b/libs/textures/blocks/base/damascus_steel_block.png new file mode 100644 index 00000000..54209826 Binary files /dev/null and b/libs/textures/blocks/base/damascus_steel_block.png differ diff --git a/libs/textures/blocks/base/damascus_steel_brick.png b/libs/textures/blocks/base/damascus_steel_brick.png new file mode 100644 index 00000000..cce4cb8d Binary files /dev/null and b/libs/textures/blocks/base/damascus_steel_brick.png differ diff --git a/libs/textures/blocks/base/damascus_steel_molten_flow.png b/libs/textures/blocks/base/damascus_steel_molten_flow.png new file mode 100644 index 00000000..133da8fb Binary files /dev/null and b/libs/textures/blocks/base/damascus_steel_molten_flow.png differ diff --git a/libs/textures/blocks/base/damascus_steel_molten_flow.png.mcmeta b/libs/textures/blocks/base/damascus_steel_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/base/damascus_steel_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/base/damascus_steel_molten_still.png b/libs/textures/blocks/base/damascus_steel_molten_still.png new file mode 100644 index 00000000..cf8d9441 Binary files /dev/null and b/libs/textures/blocks/base/damascus_steel_molten_still.png differ diff --git a/libs/textures/blocks/base/damascus_steel_molten_still.png.mcmeta b/libs/textures/blocks/base/damascus_steel_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/base/damascus_steel_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/base/hepatizon_block.png b/libs/textures/blocks/base/hepatizon_block.png new file mode 100644 index 00000000..c321788b Binary files /dev/null and b/libs/textures/blocks/base/hepatizon_block.png differ diff --git a/libs/textures/blocks/base/hepatizon_brick.png b/libs/textures/blocks/base/hepatizon_brick.png new file mode 100644 index 00000000..2f03596d Binary files /dev/null and b/libs/textures/blocks/base/hepatizon_brick.png differ diff --git a/libs/textures/blocks/base/hepatizon_molten_flow.png b/libs/textures/blocks/base/hepatizon_molten_flow.png new file mode 100644 index 00000000..2ec1d145 Binary files /dev/null and b/libs/textures/blocks/base/hepatizon_molten_flow.png differ diff --git a/libs/textures/blocks/base/hepatizon_molten_flow.png.mcmeta b/libs/textures/blocks/base/hepatizon_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/base/hepatizon_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/base/hepatizon_molten_still.png b/libs/textures/blocks/base/hepatizon_molten_still.png new file mode 100644 index 00000000..890d9d83 Binary files /dev/null and b/libs/textures/blocks/base/hepatizon_molten_still.png differ diff --git a/libs/textures/blocks/base/hepatizon_molten_still.png.mcmeta b/libs/textures/blocks/base/hepatizon_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/base/hepatizon_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/base/manganese_block.png b/libs/textures/blocks/base/manganese_block.png new file mode 100644 index 00000000..f4c325d0 Binary files /dev/null and b/libs/textures/blocks/base/manganese_block.png differ diff --git a/libs/textures/blocks/base/manganese_brick.png b/libs/textures/blocks/base/manganese_brick.png new file mode 100644 index 00000000..352c2273 Binary files /dev/null and b/libs/textures/blocks/base/manganese_brick.png differ diff --git a/libs/textures/blocks/base/manganese_molten_flow.png b/libs/textures/blocks/base/manganese_molten_flow.png new file mode 100644 index 00000000..e2156143 Binary files /dev/null and b/libs/textures/blocks/base/manganese_molten_flow.png differ diff --git a/libs/textures/blocks/base/manganese_molten_flow.png.mcmeta b/libs/textures/blocks/base/manganese_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/base/manganese_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/base/manganese_molten_still.png b/libs/textures/blocks/base/manganese_molten_still.png new file mode 100644 index 00000000..13bc049e Binary files /dev/null and b/libs/textures/blocks/base/manganese_molten_still.png differ diff --git a/libs/textures/blocks/base/manganese_molten_still.png.mcmeta b/libs/textures/blocks/base/manganese_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/base/manganese_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/base/manganese_ore.png b/libs/textures/blocks/base/manganese_ore.png new file mode 100644 index 00000000..188a1a95 Binary files /dev/null and b/libs/textures/blocks/base/manganese_ore.png differ diff --git a/libs/textures/blocks/base/manganese_ore_overlay.png b/libs/textures/blocks/base/manganese_ore_overlay.png new file mode 100644 index 00000000..35eb0a6e Binary files /dev/null and b/libs/textures/blocks/base/manganese_ore_overlay.png differ diff --git a/libs/textures/blocks/base/steel_block.png b/libs/textures/blocks/base/steel_block.png new file mode 100644 index 00000000..5c58fb68 Binary files /dev/null and b/libs/textures/blocks/base/steel_block.png differ diff --git a/libs/textures/blocks/base/steel_brick.png b/libs/textures/blocks/base/steel_brick.png new file mode 100644 index 00000000..b86fe2ee Binary files /dev/null and b/libs/textures/blocks/base/steel_brick.png differ diff --git a/libs/textures/blocks/base/steel_molten_flow.png b/libs/textures/blocks/base/steel_molten_flow.png new file mode 100644 index 00000000..5ab46853 Binary files /dev/null and b/libs/textures/blocks/base/steel_molten_flow.png differ diff --git a/libs/textures/blocks/base/steel_molten_flow.png.mcmeta b/libs/textures/blocks/base/steel_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/base/steel_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/base/steel_molten_still.png b/libs/textures/blocks/base/steel_molten_still.png new file mode 100644 index 00000000..c4ce8252 Binary files /dev/null and b/libs/textures/blocks/base/steel_molten_still.png differ diff --git a/libs/textures/blocks/base/steel_molten_still.png.mcmeta b/libs/textures/blocks/base/steel_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/base/steel_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/base/tin_block.png b/libs/textures/blocks/base/tin_block.png new file mode 100644 index 00000000..8cc3d939 Binary files /dev/null and b/libs/textures/blocks/base/tin_block.png differ diff --git a/libs/textures/blocks/base/tin_brick.png b/libs/textures/blocks/base/tin_brick.png new file mode 100644 index 00000000..919cc209 Binary files /dev/null and b/libs/textures/blocks/base/tin_brick.png differ diff --git a/libs/textures/blocks/base/tin_molten_flow.png b/libs/textures/blocks/base/tin_molten_flow.png new file mode 100644 index 00000000..9edf562d Binary files /dev/null and b/libs/textures/blocks/base/tin_molten_flow.png differ diff --git a/libs/textures/blocks/base/tin_molten_flow.png.mcmeta b/libs/textures/blocks/base/tin_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/base/tin_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/base/tin_molten_still.png b/libs/textures/blocks/base/tin_molten_still.png new file mode 100644 index 00000000..b783ad54 Binary files /dev/null and b/libs/textures/blocks/base/tin_molten_still.png differ diff --git a/libs/textures/blocks/base/tin_molten_still.png.mcmeta b/libs/textures/blocks/base/tin_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/base/tin_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/base/tin_ore.png b/libs/textures/blocks/base/tin_ore.png new file mode 100644 index 00000000..f68a6e47 Binary files /dev/null and b/libs/textures/blocks/base/tin_ore.png differ diff --git a/libs/textures/blocks/base/tin_ore_overlay.png b/libs/textures/blocks/base/tin_ore_overlay.png new file mode 100644 index 00000000..d8ec9c94 Binary files /dev/null and b/libs/textures/blocks/base/tin_ore_overlay.png differ diff --git a/libs/textures/blocks/ender/desichalkos_block.png b/libs/textures/blocks/ender/desichalkos_block.png new file mode 100644 index 00000000..7d549fad Binary files /dev/null and b/libs/textures/blocks/ender/desichalkos_block.png differ diff --git a/libs/textures/blocks/ender/desichalkos_brick.png b/libs/textures/blocks/ender/desichalkos_brick.png new file mode 100644 index 00000000..26be924c Binary files /dev/null and b/libs/textures/blocks/ender/desichalkos_brick.png differ diff --git a/libs/textures/blocks/ender/desichalkos_molten_flow.png b/libs/textures/blocks/ender/desichalkos_molten_flow.png new file mode 100644 index 00000000..8cd39311 Binary files /dev/null and b/libs/textures/blocks/ender/desichalkos_molten_flow.png differ diff --git a/libs/textures/blocks/ender/desichalkos_molten_flow.png.mcmeta b/libs/textures/blocks/ender/desichalkos_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/ender/desichalkos_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/ender/desichalkos_molten_still.png b/libs/textures/blocks/ender/desichalkos_molten_still.png new file mode 100644 index 00000000..87e4cf46 Binary files /dev/null and b/libs/textures/blocks/ender/desichalkos_molten_still.png differ diff --git a/libs/textures/blocks/ender/desichalkos_molten_still.png.mcmeta b/libs/textures/blocks/ender/desichalkos_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/ender/desichalkos_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/ender/eximite_block.png b/libs/textures/blocks/ender/eximite_block.png new file mode 100644 index 00000000..5ab2254c Binary files /dev/null and b/libs/textures/blocks/ender/eximite_block.png differ diff --git a/libs/textures/blocks/ender/eximite_brick.png b/libs/textures/blocks/ender/eximite_brick.png new file mode 100644 index 00000000..fbe5bfe8 Binary files /dev/null and b/libs/textures/blocks/ender/eximite_brick.png differ diff --git a/libs/textures/blocks/ender/eximite_molten_flow.png b/libs/textures/blocks/ender/eximite_molten_flow.png new file mode 100644 index 00000000..d21dee2f Binary files /dev/null and b/libs/textures/blocks/ender/eximite_molten_flow.png differ diff --git a/libs/textures/blocks/ender/eximite_molten_flow.png.mcmeta b/libs/textures/blocks/ender/eximite_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/ender/eximite_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/ender/eximite_molten_still.png b/libs/textures/blocks/ender/eximite_molten_still.png new file mode 100644 index 00000000..f8e13099 Binary files /dev/null and b/libs/textures/blocks/ender/eximite_molten_still.png differ diff --git a/libs/textures/blocks/ender/eximite_molten_still.png.mcmeta b/libs/textures/blocks/ender/eximite_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/ender/eximite_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/ender/eximite_ore.png b/libs/textures/blocks/ender/eximite_ore.png new file mode 100644 index 00000000..5ec710bf Binary files /dev/null and b/libs/textures/blocks/ender/eximite_ore.png differ diff --git a/libs/textures/blocks/ender/meutoite_block.png b/libs/textures/blocks/ender/meutoite_block.png new file mode 100644 index 00000000..74292c58 Binary files /dev/null and b/libs/textures/blocks/ender/meutoite_block.png differ diff --git a/libs/textures/blocks/ender/meutoite_brick.png b/libs/textures/blocks/ender/meutoite_brick.png new file mode 100644 index 00000000..e4872f33 Binary files /dev/null and b/libs/textures/blocks/ender/meutoite_brick.png differ diff --git a/libs/textures/blocks/ender/meutoite_molten_flow.png b/libs/textures/blocks/ender/meutoite_molten_flow.png new file mode 100644 index 00000000..390e82bb Binary files /dev/null and b/libs/textures/blocks/ender/meutoite_molten_flow.png differ diff --git a/libs/textures/blocks/ender/meutoite_molten_flow.png.mcmeta b/libs/textures/blocks/ender/meutoite_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/ender/meutoite_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/ender/meutoite_molten_still.png b/libs/textures/blocks/ender/meutoite_molten_still.png new file mode 100644 index 00000000..201e5d71 Binary files /dev/null and b/libs/textures/blocks/ender/meutoite_molten_still.png differ diff --git a/libs/textures/blocks/ender/meutoite_molten_still.png.mcmeta b/libs/textures/blocks/ender/meutoite_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/ender/meutoite_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/ender/meutoite_ore.png b/libs/textures/blocks/ender/meutoite_ore.png new file mode 100644 index 00000000..60cfd748 Binary files /dev/null and b/libs/textures/blocks/ender/meutoite_ore.png differ diff --git a/libs/textures/blocks/fantasy/adamantine_block.png b/libs/textures/blocks/fantasy/adamantine_block.png new file mode 100644 index 00000000..fec981c7 Binary files /dev/null and b/libs/textures/blocks/fantasy/adamantine_block.png differ diff --git a/libs/textures/blocks/fantasy/adamantine_brick.png b/libs/textures/blocks/fantasy/adamantine_brick.png new file mode 100644 index 00000000..352b207d Binary files /dev/null and b/libs/textures/blocks/fantasy/adamantine_brick.png differ diff --git a/libs/textures/blocks/fantasy/adamantine_molten_flow.png b/libs/textures/blocks/fantasy/adamantine_molten_flow.png new file mode 100644 index 00000000..a94be973 Binary files /dev/null and b/libs/textures/blocks/fantasy/adamantine_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/adamantine_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/adamantine_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/adamantine_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/adamantine_molten_still.png b/libs/textures/blocks/fantasy/adamantine_molten_still.png new file mode 100644 index 00000000..3c88c5c2 Binary files /dev/null and b/libs/textures/blocks/fantasy/adamantine_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/adamantine_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/adamantine_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/adamantine_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/adamantine_ore.png b/libs/textures/blocks/fantasy/adamantine_ore.png new file mode 100644 index 00000000..a20908dd Binary files /dev/null and b/libs/textures/blocks/fantasy/adamantine_ore.png differ diff --git a/libs/textures/blocks/fantasy/adamantine_ore_overlay.png b/libs/textures/blocks/fantasy/adamantine_ore_overlay.png new file mode 100644 index 00000000..51e19d14 Binary files /dev/null and b/libs/textures/blocks/fantasy/adamantine_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/astral_silver_block.png b/libs/textures/blocks/fantasy/astral_silver_block.png new file mode 100644 index 00000000..3a0d9769 Binary files /dev/null and b/libs/textures/blocks/fantasy/astral_silver_block.png differ diff --git a/libs/textures/blocks/fantasy/astral_silver_brick.png b/libs/textures/blocks/fantasy/astral_silver_brick.png new file mode 100644 index 00000000..03a40bda Binary files /dev/null and b/libs/textures/blocks/fantasy/astral_silver_brick.png differ diff --git a/libs/textures/blocks/fantasy/astral_silver_molten_flow.png b/libs/textures/blocks/fantasy/astral_silver_molten_flow.png new file mode 100644 index 00000000..1fb10d13 Binary files /dev/null and b/libs/textures/blocks/fantasy/astral_silver_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/astral_silver_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/astral_silver_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/astral_silver_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/astral_silver_molten_still.png b/libs/textures/blocks/fantasy/astral_silver_molten_still.png new file mode 100644 index 00000000..2e97e3a1 Binary files /dev/null and b/libs/textures/blocks/fantasy/astral_silver_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/astral_silver_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/astral_silver_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/astral_silver_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/astral_silver_ore.png b/libs/textures/blocks/fantasy/astral_silver_ore.png new file mode 100644 index 00000000..a9fa0175 Binary files /dev/null and b/libs/textures/blocks/fantasy/astral_silver_ore.png differ diff --git a/libs/textures/blocks/fantasy/astral_silver_ore_overlay.png b/libs/textures/blocks/fantasy/astral_silver_ore_overlay.png new file mode 100644 index 00000000..61c3061a Binary files /dev/null and b/libs/textures/blocks/fantasy/astral_silver_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/atlarus_block.png b/libs/textures/blocks/fantasy/atlarus_block.png new file mode 100644 index 00000000..baeb95a4 Binary files /dev/null and b/libs/textures/blocks/fantasy/atlarus_block.png differ diff --git a/libs/textures/blocks/fantasy/atlarus_brick.png b/libs/textures/blocks/fantasy/atlarus_brick.png new file mode 100644 index 00000000..3d6fc2b7 Binary files /dev/null and b/libs/textures/blocks/fantasy/atlarus_brick.png differ diff --git a/libs/textures/blocks/fantasy/atlarus_molten_flow.png b/libs/textures/blocks/fantasy/atlarus_molten_flow.png new file mode 100644 index 00000000..7523fd29 Binary files /dev/null and b/libs/textures/blocks/fantasy/atlarus_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/atlarus_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/atlarus_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/atlarus_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/atlarus_molten_still.png b/libs/textures/blocks/fantasy/atlarus_molten_still.png new file mode 100644 index 00000000..331ef031 Binary files /dev/null and b/libs/textures/blocks/fantasy/atlarus_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/atlarus_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/atlarus_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/atlarus_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/atlarus_ore.png b/libs/textures/blocks/fantasy/atlarus_ore.png new file mode 100644 index 00000000..a21644f9 Binary files /dev/null and b/libs/textures/blocks/fantasy/atlarus_ore.png differ diff --git a/libs/textures/blocks/fantasy/atlarus_ore_overlay.png b/libs/textures/blocks/fantasy/atlarus_ore_overlay.png new file mode 100644 index 00000000..bb60bf5d Binary files /dev/null and b/libs/textures/blocks/fantasy/atlarus_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/black_steel_block.png b/libs/textures/blocks/fantasy/black_steel_block.png new file mode 100644 index 00000000..af2f86fc Binary files /dev/null and b/libs/textures/blocks/fantasy/black_steel_block.png differ diff --git a/libs/textures/blocks/fantasy/black_steel_brick.png b/libs/textures/blocks/fantasy/black_steel_brick.png new file mode 100644 index 00000000..7c318c85 Binary files /dev/null and b/libs/textures/blocks/fantasy/black_steel_brick.png differ diff --git a/libs/textures/blocks/fantasy/black_steel_molten_flow.png b/libs/textures/blocks/fantasy/black_steel_molten_flow.png new file mode 100644 index 00000000..79ea3256 Binary files /dev/null and b/libs/textures/blocks/fantasy/black_steel_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/black_steel_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/black_steel_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/black_steel_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/black_steel_molten_still.png b/libs/textures/blocks/fantasy/black_steel_molten_still.png new file mode 100644 index 00000000..d2ee217e Binary files /dev/null and b/libs/textures/blocks/fantasy/black_steel_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/black_steel_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/black_steel_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/black_steel_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/carmot_block.png b/libs/textures/blocks/fantasy/carmot_block.png new file mode 100644 index 00000000..7f343eb4 Binary files /dev/null and b/libs/textures/blocks/fantasy/carmot_block.png differ diff --git a/libs/textures/blocks/fantasy/carmot_brick.png b/libs/textures/blocks/fantasy/carmot_brick.png new file mode 100644 index 00000000..2bba2668 Binary files /dev/null and b/libs/textures/blocks/fantasy/carmot_brick.png differ diff --git a/libs/textures/blocks/fantasy/carmot_molten_flow.png b/libs/textures/blocks/fantasy/carmot_molten_flow.png new file mode 100644 index 00000000..5e558d11 Binary files /dev/null and b/libs/textures/blocks/fantasy/carmot_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/carmot_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/carmot_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/carmot_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/carmot_molten_still.png b/libs/textures/blocks/fantasy/carmot_molten_still.png new file mode 100644 index 00000000..6d437742 Binary files /dev/null and b/libs/textures/blocks/fantasy/carmot_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/carmot_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/carmot_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/carmot_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/carmot_ore.png b/libs/textures/blocks/fantasy/carmot_ore.png new file mode 100644 index 00000000..b3eb5a8b Binary files /dev/null and b/libs/textures/blocks/fantasy/carmot_ore.png differ diff --git a/libs/textures/blocks/fantasy/carmot_ore_overlay.png b/libs/textures/blocks/fantasy/carmot_ore_overlay.png new file mode 100644 index 00000000..a999858c Binary files /dev/null and b/libs/textures/blocks/fantasy/carmot_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/celenegil_block.png b/libs/textures/blocks/fantasy/celenegil_block.png new file mode 100644 index 00000000..b952bef7 Binary files /dev/null and b/libs/textures/blocks/fantasy/celenegil_block.png differ diff --git a/libs/textures/blocks/fantasy/celenegil_brick.png b/libs/textures/blocks/fantasy/celenegil_brick.png new file mode 100644 index 00000000..bb54f71e Binary files /dev/null and b/libs/textures/blocks/fantasy/celenegil_brick.png differ diff --git a/libs/textures/blocks/fantasy/celenegil_molten_flow.png b/libs/textures/blocks/fantasy/celenegil_molten_flow.png new file mode 100644 index 00000000..ee7a86a3 Binary files /dev/null and b/libs/textures/blocks/fantasy/celenegil_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/celenegil_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/celenegil_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/celenegil_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/celenegil_molten_still.png b/libs/textures/blocks/fantasy/celenegil_molten_still.png new file mode 100644 index 00000000..c3a2b382 Binary files /dev/null and b/libs/textures/blocks/fantasy/celenegil_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/celenegil_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/celenegil_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/celenegil_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/deep_iron_block.png b/libs/textures/blocks/fantasy/deep_iron_block.png new file mode 100644 index 00000000..11a9497e Binary files /dev/null and b/libs/textures/blocks/fantasy/deep_iron_block.png differ diff --git a/libs/textures/blocks/fantasy/deep_iron_brick.png b/libs/textures/blocks/fantasy/deep_iron_brick.png new file mode 100644 index 00000000..f9ea4a05 Binary files /dev/null and b/libs/textures/blocks/fantasy/deep_iron_brick.png differ diff --git a/libs/textures/blocks/fantasy/deep_iron_molten_flow.png b/libs/textures/blocks/fantasy/deep_iron_molten_flow.png new file mode 100644 index 00000000..e917a495 Binary files /dev/null and b/libs/textures/blocks/fantasy/deep_iron_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/deep_iron_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/deep_iron_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/deep_iron_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/deep_iron_molten_still.png b/libs/textures/blocks/fantasy/deep_iron_molten_still.png new file mode 100644 index 00000000..16b368f0 Binary files /dev/null and b/libs/textures/blocks/fantasy/deep_iron_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/deep_iron_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/deep_iron_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/deep_iron_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/deep_iron_ore.png b/libs/textures/blocks/fantasy/deep_iron_ore.png new file mode 100644 index 00000000..46b46bc5 Binary files /dev/null and b/libs/textures/blocks/fantasy/deep_iron_ore.png differ diff --git a/libs/textures/blocks/fantasy/deep_iron_ore_overlay.png b/libs/textures/blocks/fantasy/deep_iron_ore_overlay.png new file mode 100644 index 00000000..3e755099 Binary files /dev/null and b/libs/textures/blocks/fantasy/deep_iron_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/haderoth_block.png b/libs/textures/blocks/fantasy/haderoth_block.png new file mode 100644 index 00000000..ddfee0fd Binary files /dev/null and b/libs/textures/blocks/fantasy/haderoth_block.png differ diff --git a/libs/textures/blocks/fantasy/haderoth_brick.png b/libs/textures/blocks/fantasy/haderoth_brick.png new file mode 100644 index 00000000..b02d9c5f Binary files /dev/null and b/libs/textures/blocks/fantasy/haderoth_brick.png differ diff --git a/libs/textures/blocks/fantasy/haderoth_molten_flow.png b/libs/textures/blocks/fantasy/haderoth_molten_flow.png new file mode 100644 index 00000000..2f021034 Binary files /dev/null and b/libs/textures/blocks/fantasy/haderoth_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/haderoth_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/haderoth_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/haderoth_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/haderoth_molten_still.png b/libs/textures/blocks/fantasy/haderoth_molten_still.png new file mode 100644 index 00000000..fe336a09 Binary files /dev/null and b/libs/textures/blocks/fantasy/haderoth_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/haderoth_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/haderoth_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/haderoth_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/infuscolium_block.png b/libs/textures/blocks/fantasy/infuscolium_block.png new file mode 100644 index 00000000..2bfffbb6 Binary files /dev/null and b/libs/textures/blocks/fantasy/infuscolium_block.png differ diff --git a/libs/textures/blocks/fantasy/infuscolium_brick.png b/libs/textures/blocks/fantasy/infuscolium_brick.png new file mode 100644 index 00000000..c5057ae8 Binary files /dev/null and b/libs/textures/blocks/fantasy/infuscolium_brick.png differ diff --git a/libs/textures/blocks/fantasy/infuscolium_molten_flow.png b/libs/textures/blocks/fantasy/infuscolium_molten_flow.png new file mode 100644 index 00000000..4dc0f8c5 Binary files /dev/null and b/libs/textures/blocks/fantasy/infuscolium_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/infuscolium_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/infuscolium_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/infuscolium_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/infuscolium_molten_still.png b/libs/textures/blocks/fantasy/infuscolium_molten_still.png new file mode 100644 index 00000000..82323ed0 Binary files /dev/null and b/libs/textures/blocks/fantasy/infuscolium_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/infuscolium_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/infuscolium_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/infuscolium_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/infuscolium_ore.png b/libs/textures/blocks/fantasy/infuscolium_ore.png new file mode 100644 index 00000000..af405655 Binary files /dev/null and b/libs/textures/blocks/fantasy/infuscolium_ore.png differ diff --git a/libs/textures/blocks/fantasy/infuscolium_ore_overlay.png b/libs/textures/blocks/fantasy/infuscolium_ore_overlay.png new file mode 100644 index 00000000..d5e0fa88 Binary files /dev/null and b/libs/textures/blocks/fantasy/infuscolium_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/mithril_block.png b/libs/textures/blocks/fantasy/mithril_block.png new file mode 100644 index 00000000..c1bfab99 Binary files /dev/null and b/libs/textures/blocks/fantasy/mithril_block.png differ diff --git a/libs/textures/blocks/fantasy/mithril_brick.png b/libs/textures/blocks/fantasy/mithril_brick.png new file mode 100644 index 00000000..1b60ef02 Binary files /dev/null and b/libs/textures/blocks/fantasy/mithril_brick.png differ diff --git a/libs/textures/blocks/fantasy/mithril_molten_flow.png b/libs/textures/blocks/fantasy/mithril_molten_flow.png new file mode 100644 index 00000000..57b7e542 Binary files /dev/null and b/libs/textures/blocks/fantasy/mithril_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/mithril_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/mithril_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/mithril_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/mithril_molten_still.png b/libs/textures/blocks/fantasy/mithril_molten_still.png new file mode 100644 index 00000000..a1cb6b47 Binary files /dev/null and b/libs/textures/blocks/fantasy/mithril_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/mithril_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/mithril_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/mithril_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/mithril_ore_overlay.png b/libs/textures/blocks/fantasy/mithril_ore_overlay.png new file mode 100644 index 00000000..ff34ed50 Binary files /dev/null and b/libs/textures/blocks/fantasy/mithril_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/orichalcum_block.png b/libs/textures/blocks/fantasy/orichalcum_block.png new file mode 100644 index 00000000..451d4009 Binary files /dev/null and b/libs/textures/blocks/fantasy/orichalcum_block.png differ diff --git a/libs/textures/blocks/fantasy/orichalcum_brick.png b/libs/textures/blocks/fantasy/orichalcum_brick.png new file mode 100644 index 00000000..85a15fe9 Binary files /dev/null and b/libs/textures/blocks/fantasy/orichalcum_brick.png differ diff --git a/libs/textures/blocks/fantasy/orichalcum_molten_flow.png b/libs/textures/blocks/fantasy/orichalcum_molten_flow.png new file mode 100644 index 00000000..1e96459f Binary files /dev/null and b/libs/textures/blocks/fantasy/orichalcum_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/orichalcum_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/orichalcum_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/orichalcum_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/orichalcum_molten_still.png b/libs/textures/blocks/fantasy/orichalcum_molten_still.png new file mode 100644 index 00000000..17e6cccd Binary files /dev/null and b/libs/textures/blocks/fantasy/orichalcum_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/orichalcum_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/orichalcum_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/orichalcum_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/orichalcum_ore.png b/libs/textures/blocks/fantasy/orichalcum_ore.png new file mode 100644 index 00000000..f1de74d2 Binary files /dev/null and b/libs/textures/blocks/fantasy/orichalcum_ore.png differ diff --git a/libs/textures/blocks/fantasy/orichalcum_ore_overlay.png b/libs/textures/blocks/fantasy/orichalcum_ore_overlay.png new file mode 100644 index 00000000..fa306e0a Binary files /dev/null and b/libs/textures/blocks/fantasy/orichalcum_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/oureclase_block.png b/libs/textures/blocks/fantasy/oureclase_block.png new file mode 100644 index 00000000..b56591d3 Binary files /dev/null and b/libs/textures/blocks/fantasy/oureclase_block.png differ diff --git a/libs/textures/blocks/fantasy/oureclase_brick.png b/libs/textures/blocks/fantasy/oureclase_brick.png new file mode 100644 index 00000000..22ff3ab5 Binary files /dev/null and b/libs/textures/blocks/fantasy/oureclase_brick.png differ diff --git a/libs/textures/blocks/fantasy/oureclase_molten_flow.png b/libs/textures/blocks/fantasy/oureclase_molten_flow.png new file mode 100644 index 00000000..c0c4f39f Binary files /dev/null and b/libs/textures/blocks/fantasy/oureclase_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/oureclase_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/oureclase_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/oureclase_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/oureclase_molten_still.png b/libs/textures/blocks/fantasy/oureclase_molten_still.png new file mode 100644 index 00000000..c4e91ccb Binary files /dev/null and b/libs/textures/blocks/fantasy/oureclase_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/oureclase_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/oureclase_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/oureclase_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/oureclase_ore.png b/libs/textures/blocks/fantasy/oureclase_ore.png new file mode 100644 index 00000000..11cd67f5 Binary files /dev/null and b/libs/textures/blocks/fantasy/oureclase_ore.png differ diff --git a/libs/textures/blocks/fantasy/oureclase_ore_overlay.png b/libs/textures/blocks/fantasy/oureclase_ore_overlay.png new file mode 100644 index 00000000..269bc4db Binary files /dev/null and b/libs/textures/blocks/fantasy/oureclase_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/prometheum_block.png b/libs/textures/blocks/fantasy/prometheum_block.png new file mode 100644 index 00000000..66622ab0 Binary files /dev/null and b/libs/textures/blocks/fantasy/prometheum_block.png differ diff --git a/libs/textures/blocks/fantasy/prometheum_brick.png b/libs/textures/blocks/fantasy/prometheum_brick.png new file mode 100644 index 00000000..58bdb65c Binary files /dev/null and b/libs/textures/blocks/fantasy/prometheum_brick.png differ diff --git a/libs/textures/blocks/fantasy/prometheum_molten_flow.png b/libs/textures/blocks/fantasy/prometheum_molten_flow.png new file mode 100644 index 00000000..fd687825 Binary files /dev/null and b/libs/textures/blocks/fantasy/prometheum_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/prometheum_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/prometheum_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/prometheum_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/prometheum_molten_still.png b/libs/textures/blocks/fantasy/prometheum_molten_still.png new file mode 100644 index 00000000..e34eb170 Binary files /dev/null and b/libs/textures/blocks/fantasy/prometheum_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/prometheum_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/prometheum_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/prometheum_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/prometheum_ore.png b/libs/textures/blocks/fantasy/prometheum_ore.png new file mode 100644 index 00000000..c9bf87f0 Binary files /dev/null and b/libs/textures/blocks/fantasy/prometheum_ore.png differ diff --git a/libs/textures/blocks/fantasy/prometheum_ore_overlay.png b/libs/textures/blocks/fantasy/prometheum_ore_overlay.png new file mode 100644 index 00000000..d4338fed Binary files /dev/null and b/libs/textures/blocks/fantasy/prometheum_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/quicksilver_block.png b/libs/textures/blocks/fantasy/quicksilver_block.png new file mode 100644 index 00000000..10cf755c Binary files /dev/null and b/libs/textures/blocks/fantasy/quicksilver_block.png differ diff --git a/libs/textures/blocks/fantasy/quicksilver_brick.png b/libs/textures/blocks/fantasy/quicksilver_brick.png new file mode 100644 index 00000000..493d8ff1 Binary files /dev/null and b/libs/textures/blocks/fantasy/quicksilver_brick.png differ diff --git a/libs/textures/blocks/fantasy/quicksilver_molten_flow.png b/libs/textures/blocks/fantasy/quicksilver_molten_flow.png new file mode 100644 index 00000000..ffec2326 Binary files /dev/null and b/libs/textures/blocks/fantasy/quicksilver_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/quicksilver_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/quicksilver_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/quicksilver_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/quicksilver_molten_still.png b/libs/textures/blocks/fantasy/quicksilver_molten_still.png new file mode 100644 index 00000000..59c6e45b Binary files /dev/null and b/libs/textures/blocks/fantasy/quicksilver_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/quicksilver_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/quicksilver_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/quicksilver_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/rubracium_block.png b/libs/textures/blocks/fantasy/rubracium_block.png new file mode 100644 index 00000000..1885bccf Binary files /dev/null and b/libs/textures/blocks/fantasy/rubracium_block.png differ diff --git a/libs/textures/blocks/fantasy/rubracium_brick.png b/libs/textures/blocks/fantasy/rubracium_brick.png new file mode 100644 index 00000000..9e44fbcb Binary files /dev/null and b/libs/textures/blocks/fantasy/rubracium_brick.png differ diff --git a/libs/textures/blocks/fantasy/rubracium_molten_flow.png b/libs/textures/blocks/fantasy/rubracium_molten_flow.png new file mode 100644 index 00000000..11d1211d Binary files /dev/null and b/libs/textures/blocks/fantasy/rubracium_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/rubracium_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/rubracium_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/rubracium_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/rubracium_molten_still.png b/libs/textures/blocks/fantasy/rubracium_molten_still.png new file mode 100644 index 00000000..d74fa300 Binary files /dev/null and b/libs/textures/blocks/fantasy/rubracium_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/rubracium_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/rubracium_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/rubracium_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/fantasy/rubracium_ore.png b/libs/textures/blocks/fantasy/rubracium_ore.png new file mode 100644 index 00000000..91810157 Binary files /dev/null and b/libs/textures/blocks/fantasy/rubracium_ore.png differ diff --git a/libs/textures/blocks/fantasy/rubracium_ore_overlay.png b/libs/textures/blocks/fantasy/rubracium_ore_overlay.png new file mode 100644 index 00000000..4a17f5e6 Binary files /dev/null and b/libs/textures/blocks/fantasy/rubracium_ore_overlay.png differ diff --git a/libs/textures/blocks/fantasy/tartarite_block.png b/libs/textures/blocks/fantasy/tartarite_block.png new file mode 100644 index 00000000..423b3fd6 Binary files /dev/null and b/libs/textures/blocks/fantasy/tartarite_block.png differ diff --git a/libs/textures/blocks/fantasy/tartarite_brick.png b/libs/textures/blocks/fantasy/tartarite_brick.png new file mode 100644 index 00000000..ca725123 Binary files /dev/null and b/libs/textures/blocks/fantasy/tartarite_brick.png differ diff --git a/libs/textures/blocks/fantasy/tartarite_molten_flow.png b/libs/textures/blocks/fantasy/tartarite_molten_flow.png new file mode 100644 index 00000000..4c4b053f Binary files /dev/null and b/libs/textures/blocks/fantasy/tartarite_molten_flow.png differ diff --git a/libs/textures/blocks/fantasy/tartarite_molten_flow.png.mcmeta b/libs/textures/blocks/fantasy/tartarite_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/fantasy/tartarite_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/fantasy/tartarite_molten_still.png b/libs/textures/blocks/fantasy/tartarite_molten_still.png new file mode 100644 index 00000000..9a2a42ca Binary files /dev/null and b/libs/textures/blocks/fantasy/tartarite_molten_still.png differ diff --git a/libs/textures/blocks/fantasy/tartarite_molten_still.png.mcmeta b/libs/textures/blocks/fantasy/tartarite_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/fantasy/tartarite_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/machines/alloyer_bottom.png b/libs/textures/blocks/machines/alloyer_bottom.png new file mode 100644 index 00000000..f440c7dc Binary files /dev/null and b/libs/textures/blocks/machines/alloyer_bottom.png differ diff --git a/libs/textures/blocks/machines/alloyer_front.png b/libs/textures/blocks/machines/alloyer_front.png new file mode 100644 index 00000000..9172adbe Binary files /dev/null and b/libs/textures/blocks/machines/alloyer_front.png differ diff --git a/libs/textures/blocks/machines/alloyer_side.png b/libs/textures/blocks/machines/alloyer_side.png new file mode 100644 index 00000000..ac000af1 Binary files /dev/null and b/libs/textures/blocks/machines/alloyer_side.png differ diff --git a/libs/textures/blocks/machines/alloyer_top.png b/libs/textures/blocks/machines/alloyer_top.png new file mode 100644 index 00000000..180ad778 Binary files /dev/null and b/libs/textures/blocks/machines/alloyer_top.png differ diff --git a/libs/textures/blocks/machines/crusher_front.png b/libs/textures/blocks/machines/crusher_front.png new file mode 100644 index 00000000..f2413732 Binary files /dev/null and b/libs/textures/blocks/machines/crusher_front.png differ diff --git a/libs/textures/blocks/machines/foundry_bottom.png b/libs/textures/blocks/machines/foundry_bottom.png new file mode 100644 index 00000000..288803f5 Binary files /dev/null and b/libs/textures/blocks/machines/foundry_bottom.png differ diff --git a/libs/textures/blocks/machines/foundry_front.png b/libs/textures/blocks/machines/foundry_front.png new file mode 100644 index 00000000..88db9a9b Binary files /dev/null and b/libs/textures/blocks/machines/foundry_front.png differ diff --git a/libs/textures/blocks/machines/foundry_side.png b/libs/textures/blocks/machines/foundry_side.png new file mode 100644 index 00000000..81794b71 Binary files /dev/null and b/libs/textures/blocks/machines/foundry_side.png differ diff --git a/libs/textures/blocks/machines/foundry_top.png b/libs/textures/blocks/machines/foundry_top.png new file mode 100644 index 00000000..9a9f9103 Binary files /dev/null and b/libs/textures/blocks/machines/foundry_top.png differ diff --git a/libs/textures/blocks/machines/mframe_bottom.png b/libs/textures/blocks/machines/mframe_bottom.png new file mode 100644 index 00000000..0e6ee16f Binary files /dev/null and b/libs/textures/blocks/machines/mframe_bottom.png differ diff --git a/libs/textures/blocks/machines/mframe_side.png b/libs/textures/blocks/machines/mframe_side.png new file mode 100644 index 00000000..df4da5c0 Binary files /dev/null and b/libs/textures/blocks/machines/mframe_side.png differ diff --git a/libs/textures/blocks/machines/mframe_top.png b/libs/textures/blocks/machines/mframe_top.png new file mode 100644 index 00000000..504e322e Binary files /dev/null and b/libs/textures/blocks/machines/mframe_top.png differ diff --git a/libs/textures/blocks/machines/smelter_bottom.png b/libs/textures/blocks/machines/smelter_bottom.png new file mode 100644 index 00000000..6acf51e7 Binary files /dev/null and b/libs/textures/blocks/machines/smelter_bottom.png differ diff --git a/libs/textures/blocks/machines/smelter_front.png b/libs/textures/blocks/machines/smelter_front.png new file mode 100644 index 00000000..24c6b587 Binary files /dev/null and b/libs/textures/blocks/machines/smelter_front.png differ diff --git a/libs/textures/blocks/machines/smelter_side.png b/libs/textures/blocks/machines/smelter_side.png new file mode 100644 index 00000000..a3327180 Binary files /dev/null and b/libs/textures/blocks/machines/smelter_side.png differ diff --git a/libs/textures/blocks/machines/smelter_side_connected.png b/libs/textures/blocks/machines/smelter_side_connected.png new file mode 100644 index 00000000..d8275273 Binary files /dev/null and b/libs/textures/blocks/machines/smelter_side_connected.png differ diff --git a/libs/textures/blocks/machines/smelter_top.png b/libs/textures/blocks/machines/smelter_top.png new file mode 100644 index 00000000..8f4964ba Binary files /dev/null and b/libs/textures/blocks/machines/smelter_top.png differ diff --git a/libs/textures/blocks/metal_block_default.png b/libs/textures/blocks/metal_block_default.png new file mode 100644 index 00000000..bc0d898c Binary files /dev/null and b/libs/textures/blocks/metal_block_default.png differ diff --git a/libs/textures/blocks/misc/charcoal_block.png b/libs/textures/blocks/misc/charcoal_block.png new file mode 100644 index 00000000..19e6a65c Binary files /dev/null and b/libs/textures/blocks/misc/charcoal_block.png differ diff --git a/libs/textures/blocks/misc/de_tnt_bottom.png b/libs/textures/blocks/misc/de_tnt_bottom.png new file mode 100644 index 00000000..f27bc0db Binary files /dev/null and b/libs/textures/blocks/misc/de_tnt_bottom.png differ diff --git a/libs/textures/blocks/misc/de_tnt_side.png b/libs/textures/blocks/misc/de_tnt_side.png new file mode 100644 index 00000000..935e2252 Binary files /dev/null and b/libs/textures/blocks/misc/de_tnt_side.png differ diff --git a/libs/textures/blocks/misc/de_tnt_top.png b/libs/textures/blocks/misc/de_tnt_top.png new file mode 100644 index 00000000..1f172938 Binary files /dev/null and b/libs/textures/blocks/misc/de_tnt_top.png differ diff --git a/libs/textures/blocks/misc/he_tnt_bottom.png b/libs/textures/blocks/misc/he_tnt_bottom.png new file mode 100644 index 00000000..8afd4681 Binary files /dev/null and b/libs/textures/blocks/misc/he_tnt_bottom.png differ diff --git a/libs/textures/blocks/misc/he_tnt_side.png b/libs/textures/blocks/misc/he_tnt_side.png new file mode 100644 index 00000000..d8cc7c7b Binary files /dev/null and b/libs/textures/blocks/misc/he_tnt_side.png differ diff --git a/libs/textures/blocks/misc/he_tnt_top.png b/libs/textures/blocks/misc/he_tnt_top.png new file mode 100644 index 00000000..5a2780a4 Binary files /dev/null and b/libs/textures/blocks/misc/he_tnt_top.png differ diff --git a/libs/textures/blocks/misc/le_tnt_bottom.png b/libs/textures/blocks/misc/le_tnt_bottom.png new file mode 100644 index 00000000..5c37d4b5 Binary files /dev/null and b/libs/textures/blocks/misc/le_tnt_bottom.png differ diff --git a/libs/textures/blocks/misc/le_tnt_side.png b/libs/textures/blocks/misc/le_tnt_side.png new file mode 100644 index 00000000..0809bcef Binary files /dev/null and b/libs/textures/blocks/misc/le_tnt_side.png differ diff --git a/libs/textures/blocks/misc/le_tnt_top.png b/libs/textures/blocks/misc/le_tnt_top.png new file mode 100644 index 00000000..c5ef7426 Binary files /dev/null and b/libs/textures/blocks/misc/le_tnt_top.png differ diff --git a/libs/textures/blocks/misc/m_tnt_bottom.png b/libs/textures/blocks/misc/m_tnt_bottom.png new file mode 100644 index 00000000..3ecea585 Binary files /dev/null and b/libs/textures/blocks/misc/m_tnt_bottom.png differ diff --git a/libs/textures/blocks/misc/m_tnt_side.png b/libs/textures/blocks/misc/m_tnt_side.png new file mode 100644 index 00000000..cdd98630 Binary files /dev/null and b/libs/textures/blocks/misc/m_tnt_side.png differ diff --git a/libs/textures/blocks/misc/m_tnt_top.png b/libs/textures/blocks/misc/m_tnt_top.png new file mode 100644 index 00000000..62fcd787 Binary files /dev/null and b/libs/textures/blocks/misc/m_tnt_top.png differ diff --git a/libs/textures/blocks/misc/pe_tnt_bottom.png b/libs/textures/blocks/misc/pe_tnt_bottom.png new file mode 100644 index 00000000..30730884 Binary files /dev/null and b/libs/textures/blocks/misc/pe_tnt_bottom.png differ diff --git a/libs/textures/blocks/misc/pe_tnt_side.png b/libs/textures/blocks/misc/pe_tnt_side.png new file mode 100644 index 00000000..151f7107 Binary files /dev/null and b/libs/textures/blocks/misc/pe_tnt_side.png differ diff --git a/libs/textures/blocks/misc/pe_tnt_top.png b/libs/textures/blocks/misc/pe_tnt_top.png new file mode 100644 index 00000000..9256f1cd Binary files /dev/null and b/libs/textures/blocks/misc/pe_tnt_top.png differ diff --git a/libs/textures/blocks/nether/alduorite_block.png b/libs/textures/blocks/nether/alduorite_block.png new file mode 100644 index 00000000..293efe7b Binary files /dev/null and b/libs/textures/blocks/nether/alduorite_block.png differ diff --git a/libs/textures/blocks/nether/alduorite_brick.png b/libs/textures/blocks/nether/alduorite_brick.png new file mode 100644 index 00000000..7f9d5ddf Binary files /dev/null and b/libs/textures/blocks/nether/alduorite_brick.png differ diff --git a/libs/textures/blocks/nether/alduorite_molten_flow.png b/libs/textures/blocks/nether/alduorite_molten_flow.png new file mode 100644 index 00000000..fc5aec42 Binary files /dev/null and b/libs/textures/blocks/nether/alduorite_molten_flow.png differ diff --git a/libs/textures/blocks/nether/alduorite_molten_flow.png.mcmeta b/libs/textures/blocks/nether/alduorite_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/alduorite_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/alduorite_molten_still.png b/libs/textures/blocks/nether/alduorite_molten_still.png new file mode 100644 index 00000000..4fa0a6cd Binary files /dev/null and b/libs/textures/blocks/nether/alduorite_molten_still.png differ diff --git a/libs/textures/blocks/nether/alduorite_molten_still.png.mcmeta b/libs/textures/blocks/nether/alduorite_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/alduorite_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/alduorite_ore.png b/libs/textures/blocks/nether/alduorite_ore.png new file mode 100644 index 00000000..79a37db8 Binary files /dev/null and b/libs/textures/blocks/nether/alduorite_ore.png differ diff --git a/libs/textures/blocks/nether/amordrine_block.png b/libs/textures/blocks/nether/amordrine_block.png new file mode 100644 index 00000000..a2fcd197 Binary files /dev/null and b/libs/textures/blocks/nether/amordrine_block.png differ diff --git a/libs/textures/blocks/nether/amordrine_brick.png b/libs/textures/blocks/nether/amordrine_brick.png new file mode 100644 index 00000000..a9a31443 Binary files /dev/null and b/libs/textures/blocks/nether/amordrine_brick.png differ diff --git a/libs/textures/blocks/nether/amordrine_molten_flow.png b/libs/textures/blocks/nether/amordrine_molten_flow.png new file mode 100644 index 00000000..e98818ea Binary files /dev/null and b/libs/textures/blocks/nether/amordrine_molten_flow.png differ diff --git a/libs/textures/blocks/nether/amordrine_molten_flow.png.mcmeta b/libs/textures/blocks/nether/amordrine_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/amordrine_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/amordrine_molten_still.png b/libs/textures/blocks/nether/amordrine_molten_still.png new file mode 100644 index 00000000..c757df3b Binary files /dev/null and b/libs/textures/blocks/nether/amordrine_molten_still.png differ diff --git a/libs/textures/blocks/nether/amordrine_molten_still.png.mcmeta b/libs/textures/blocks/nether/amordrine_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/amordrine_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/ceruclase_block.png b/libs/textures/blocks/nether/ceruclase_block.png new file mode 100644 index 00000000..7dc2a024 Binary files /dev/null and b/libs/textures/blocks/nether/ceruclase_block.png differ diff --git a/libs/textures/blocks/nether/ceruclase_brick.png b/libs/textures/blocks/nether/ceruclase_brick.png new file mode 100644 index 00000000..97cc7fce Binary files /dev/null and b/libs/textures/blocks/nether/ceruclase_brick.png differ diff --git a/libs/textures/blocks/nether/ceruclase_molten_flow.png b/libs/textures/blocks/nether/ceruclase_molten_flow.png new file mode 100644 index 00000000..00775b36 Binary files /dev/null and b/libs/textures/blocks/nether/ceruclase_molten_flow.png differ diff --git a/libs/textures/blocks/nether/ceruclase_molten_flow.png.mcmeta b/libs/textures/blocks/nether/ceruclase_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/ceruclase_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/ceruclase_molten_still.png b/libs/textures/blocks/nether/ceruclase_molten_still.png new file mode 100644 index 00000000..ba6aa119 Binary files /dev/null and b/libs/textures/blocks/nether/ceruclase_molten_still.png differ diff --git a/libs/textures/blocks/nether/ceruclase_molten_still.png.mcmeta b/libs/textures/blocks/nether/ceruclase_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/ceruclase_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/ceruclase_ore.png b/libs/textures/blocks/nether/ceruclase_ore.png new file mode 100644 index 00000000..02d3ce5f Binary files /dev/null and b/libs/textures/blocks/nether/ceruclase_ore.png differ diff --git a/libs/textures/blocks/nether/ignatius_block.png b/libs/textures/blocks/nether/ignatius_block.png new file mode 100644 index 00000000..89ab5792 Binary files /dev/null and b/libs/textures/blocks/nether/ignatius_block.png differ diff --git a/libs/textures/blocks/nether/ignatius_brick.png b/libs/textures/blocks/nether/ignatius_brick.png new file mode 100644 index 00000000..a8f7ce35 Binary files /dev/null and b/libs/textures/blocks/nether/ignatius_brick.png differ diff --git a/libs/textures/blocks/nether/ignatius_molten_flow.png b/libs/textures/blocks/nether/ignatius_molten_flow.png new file mode 100644 index 00000000..ec6f7b32 Binary files /dev/null and b/libs/textures/blocks/nether/ignatius_molten_flow.png differ diff --git a/libs/textures/blocks/nether/ignatius_molten_flow.png.mcmeta b/libs/textures/blocks/nether/ignatius_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/ignatius_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/ignatius_molten_still.png b/libs/textures/blocks/nether/ignatius_molten_still.png new file mode 100644 index 00000000..cf907c1d Binary files /dev/null and b/libs/textures/blocks/nether/ignatius_molten_still.png differ diff --git a/libs/textures/blocks/nether/ignatius_molten_still.png.mcmeta b/libs/textures/blocks/nether/ignatius_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/ignatius_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/ignatius_ore.png b/libs/textures/blocks/nether/ignatius_ore.png new file mode 100644 index 00000000..ae8a7ffb Binary files /dev/null and b/libs/textures/blocks/nether/ignatius_ore.png differ diff --git a/libs/textures/blocks/nether/inolashite_block.png b/libs/textures/blocks/nether/inolashite_block.png new file mode 100644 index 00000000..512368b1 Binary files /dev/null and b/libs/textures/blocks/nether/inolashite_block.png differ diff --git a/libs/textures/blocks/nether/inolashite_brick.png b/libs/textures/blocks/nether/inolashite_brick.png new file mode 100644 index 00000000..ee501e78 Binary files /dev/null and b/libs/textures/blocks/nether/inolashite_brick.png differ diff --git a/libs/textures/blocks/nether/inolashite_molten_flow.png b/libs/textures/blocks/nether/inolashite_molten_flow.png new file mode 100644 index 00000000..16cd1653 Binary files /dev/null and b/libs/textures/blocks/nether/inolashite_molten_flow.png differ diff --git a/libs/textures/blocks/nether/inolashite_molten_flow.png.mcmeta b/libs/textures/blocks/nether/inolashite_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/inolashite_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/inolashite_molten_still.png b/libs/textures/blocks/nether/inolashite_molten_still.png new file mode 100644 index 00000000..0b059933 Binary files /dev/null and b/libs/textures/blocks/nether/inolashite_molten_still.png differ diff --git a/libs/textures/blocks/nether/inolashite_molten_still.png.mcmeta b/libs/textures/blocks/nether/inolashite_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/inolashite_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/kalendrite_block.png b/libs/textures/blocks/nether/kalendrite_block.png new file mode 100644 index 00000000..2103ad95 Binary files /dev/null and b/libs/textures/blocks/nether/kalendrite_block.png differ diff --git a/libs/textures/blocks/nether/kalendrite_brick.png b/libs/textures/blocks/nether/kalendrite_brick.png new file mode 100644 index 00000000..303fe06e Binary files /dev/null and b/libs/textures/blocks/nether/kalendrite_brick.png differ diff --git a/libs/textures/blocks/nether/kalendrite_molten_flow.png b/libs/textures/blocks/nether/kalendrite_molten_flow.png new file mode 100644 index 00000000..13c5ad84 Binary files /dev/null and b/libs/textures/blocks/nether/kalendrite_molten_flow.png differ diff --git a/libs/textures/blocks/nether/kalendrite_molten_flow.png.mcmeta b/libs/textures/blocks/nether/kalendrite_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/kalendrite_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/kalendrite_molten_still.png b/libs/textures/blocks/nether/kalendrite_molten_still.png new file mode 100644 index 00000000..bb3a14bd Binary files /dev/null and b/libs/textures/blocks/nether/kalendrite_molten_still.png differ diff --git a/libs/textures/blocks/nether/kalendrite_molten_still.png.mcmeta b/libs/textures/blocks/nether/kalendrite_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/kalendrite_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/kalendrite_ore.png b/libs/textures/blocks/nether/kalendrite_ore.png new file mode 100644 index 00000000..8e462cc8 Binary files /dev/null and b/libs/textures/blocks/nether/kalendrite_ore.png differ diff --git a/libs/textures/blocks/nether/lemurite_block.png b/libs/textures/blocks/nether/lemurite_block.png new file mode 100644 index 00000000..e5aa56a7 Binary files /dev/null and b/libs/textures/blocks/nether/lemurite_block.png differ diff --git a/libs/textures/blocks/nether/lemurite_brick.png b/libs/textures/blocks/nether/lemurite_brick.png new file mode 100644 index 00000000..049d29f4 Binary files /dev/null and b/libs/textures/blocks/nether/lemurite_brick.png differ diff --git a/libs/textures/blocks/nether/lemurite_molten_flow.png b/libs/textures/blocks/nether/lemurite_molten_flow.png new file mode 100644 index 00000000..0d692c42 Binary files /dev/null and b/libs/textures/blocks/nether/lemurite_molten_flow.png differ diff --git a/libs/textures/blocks/nether/lemurite_molten_flow.png.mcmeta b/libs/textures/blocks/nether/lemurite_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/lemurite_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/lemurite_molten_still.png b/libs/textures/blocks/nether/lemurite_molten_still.png new file mode 100644 index 00000000..bdaa26a2 Binary files /dev/null and b/libs/textures/blocks/nether/lemurite_molten_still.png differ diff --git a/libs/textures/blocks/nether/lemurite_molten_still.png.mcmeta b/libs/textures/blocks/nether/lemurite_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/lemurite_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/lemurite_ore.png b/libs/textures/blocks/nether/lemurite_ore.png new file mode 100644 index 00000000..01c82b5f Binary files /dev/null and b/libs/textures/blocks/nether/lemurite_ore.png differ diff --git a/libs/textures/blocks/nether/midasium_block.png b/libs/textures/blocks/nether/midasium_block.png new file mode 100644 index 00000000..1fabba6f Binary files /dev/null and b/libs/textures/blocks/nether/midasium_block.png differ diff --git a/libs/textures/blocks/nether/midasium_brick.png b/libs/textures/blocks/nether/midasium_brick.png new file mode 100644 index 00000000..afee6477 Binary files /dev/null and b/libs/textures/blocks/nether/midasium_brick.png differ diff --git a/libs/textures/blocks/nether/midasium_molten_flow.png b/libs/textures/blocks/nether/midasium_molten_flow.png new file mode 100644 index 00000000..88c7c5b2 Binary files /dev/null and b/libs/textures/blocks/nether/midasium_molten_flow.png differ diff --git a/libs/textures/blocks/nether/midasium_molten_flow.png.mcmeta b/libs/textures/blocks/nether/midasium_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/midasium_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/midasium_molten_still.png b/libs/textures/blocks/nether/midasium_molten_still.png new file mode 100644 index 00000000..5124af4f Binary files /dev/null and b/libs/textures/blocks/nether/midasium_molten_still.png differ diff --git a/libs/textures/blocks/nether/midasium_molten_still.png.mcmeta b/libs/textures/blocks/nether/midasium_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/midasium_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/midasium_ore.png b/libs/textures/blocks/nether/midasium_ore.png new file mode 100644 index 00000000..a76f5f24 Binary files /dev/null and b/libs/textures/blocks/nether/midasium_ore.png differ diff --git a/libs/textures/blocks/nether/sanguinite_block.png b/libs/textures/blocks/nether/sanguinite_block.png new file mode 100644 index 00000000..0c300f77 Binary files /dev/null and b/libs/textures/blocks/nether/sanguinite_block.png differ diff --git a/libs/textures/blocks/nether/sanguinite_brick.png b/libs/textures/blocks/nether/sanguinite_brick.png new file mode 100644 index 00000000..355dbcb8 Binary files /dev/null and b/libs/textures/blocks/nether/sanguinite_brick.png differ diff --git a/libs/textures/blocks/nether/sanguinite_molten_flow.png b/libs/textures/blocks/nether/sanguinite_molten_flow.png new file mode 100644 index 00000000..f5147b5a Binary files /dev/null and b/libs/textures/blocks/nether/sanguinite_molten_flow.png differ diff --git a/libs/textures/blocks/nether/sanguinite_molten_flow.png.mcmeta b/libs/textures/blocks/nether/sanguinite_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/sanguinite_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/sanguinite_molten_still.png b/libs/textures/blocks/nether/sanguinite_molten_still.png new file mode 100644 index 00000000..14bd1263 Binary files /dev/null and b/libs/textures/blocks/nether/sanguinite_molten_still.png differ diff --git a/libs/textures/blocks/nether/sanguinite_molten_still.png.mcmeta b/libs/textures/blocks/nether/sanguinite_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/sanguinite_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/sanguinite_ore.png b/libs/textures/blocks/nether/sanguinite_ore.png new file mode 100644 index 00000000..aa886fbf Binary files /dev/null and b/libs/textures/blocks/nether/sanguinite_ore.png differ diff --git a/libs/textures/blocks/nether/shadow_iron_block.png b/libs/textures/blocks/nether/shadow_iron_block.png new file mode 100644 index 00000000..30b8bd5f Binary files /dev/null and b/libs/textures/blocks/nether/shadow_iron_block.png differ diff --git a/libs/textures/blocks/nether/shadow_iron_brick.png b/libs/textures/blocks/nether/shadow_iron_brick.png new file mode 100644 index 00000000..44d44687 Binary files /dev/null and b/libs/textures/blocks/nether/shadow_iron_brick.png differ diff --git a/libs/textures/blocks/nether/shadow_iron_molten_flow.png b/libs/textures/blocks/nether/shadow_iron_molten_flow.png new file mode 100644 index 00000000..3953d00a Binary files /dev/null and b/libs/textures/blocks/nether/shadow_iron_molten_flow.png differ diff --git a/libs/textures/blocks/nether/shadow_iron_molten_flow.png.mcmeta b/libs/textures/blocks/nether/shadow_iron_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/shadow_iron_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/shadow_iron_molten_still.png b/libs/textures/blocks/nether/shadow_iron_molten_still.png new file mode 100644 index 00000000..6b6461db Binary files /dev/null and b/libs/textures/blocks/nether/shadow_iron_molten_still.png differ diff --git a/libs/textures/blocks/nether/shadow_iron_molten_still.png.mcmeta b/libs/textures/blocks/nether/shadow_iron_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/shadow_iron_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/shadow_iron_ore.png b/libs/textures/blocks/nether/shadow_iron_ore.png new file mode 100644 index 00000000..f4941dce Binary files /dev/null and b/libs/textures/blocks/nether/shadow_iron_ore.png differ diff --git a/libs/textures/blocks/nether/shadow_steel_block.png b/libs/textures/blocks/nether/shadow_steel_block.png new file mode 100644 index 00000000..612ef228 Binary files /dev/null and b/libs/textures/blocks/nether/shadow_steel_block.png differ diff --git a/libs/textures/blocks/nether/shadow_steel_brick.png b/libs/textures/blocks/nether/shadow_steel_brick.png new file mode 100644 index 00000000..87467807 Binary files /dev/null and b/libs/textures/blocks/nether/shadow_steel_brick.png differ diff --git a/libs/textures/blocks/nether/shadow_steel_molten_flow.png b/libs/textures/blocks/nether/shadow_steel_molten_flow.png new file mode 100644 index 00000000..9533dd70 Binary files /dev/null and b/libs/textures/blocks/nether/shadow_steel_molten_flow.png differ diff --git a/libs/textures/blocks/nether/shadow_steel_molten_flow.png.mcmeta b/libs/textures/blocks/nether/shadow_steel_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/shadow_steel_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/shadow_steel_molten_still.png b/libs/textures/blocks/nether/shadow_steel_molten_still.png new file mode 100644 index 00000000..90e41df3 Binary files /dev/null and b/libs/textures/blocks/nether/shadow_steel_molten_still.png differ diff --git a/libs/textures/blocks/nether/shadow_steel_molten_still.png.mcmeta b/libs/textures/blocks/nether/shadow_steel_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/shadow_steel_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/vulcanite_block.png b/libs/textures/blocks/nether/vulcanite_block.png new file mode 100644 index 00000000..bfa76d01 Binary files /dev/null and b/libs/textures/blocks/nether/vulcanite_block.png differ diff --git a/libs/textures/blocks/nether/vulcanite_brick.png b/libs/textures/blocks/nether/vulcanite_brick.png new file mode 100644 index 00000000..a5958800 Binary files /dev/null and b/libs/textures/blocks/nether/vulcanite_brick.png differ diff --git a/libs/textures/blocks/nether/vulcanite_molten_flow.png b/libs/textures/blocks/nether/vulcanite_molten_flow.png new file mode 100644 index 00000000..a97ec70c Binary files /dev/null and b/libs/textures/blocks/nether/vulcanite_molten_flow.png differ diff --git a/libs/textures/blocks/nether/vulcanite_molten_flow.png.mcmeta b/libs/textures/blocks/nether/vulcanite_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/vulcanite_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/vulcanite_molten_still.png b/libs/textures/blocks/nether/vulcanite_molten_still.png new file mode 100644 index 00000000..84aa4702 Binary files /dev/null and b/libs/textures/blocks/nether/vulcanite_molten_still.png differ diff --git a/libs/textures/blocks/nether/vulcanite_molten_still.png.mcmeta b/libs/textures/blocks/nether/vulcanite_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/vulcanite_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/vulcanite_ore.png b/libs/textures/blocks/nether/vulcanite_ore.png new file mode 100644 index 00000000..0e86bfb3 Binary files /dev/null and b/libs/textures/blocks/nether/vulcanite_ore.png differ diff --git a/libs/textures/blocks/nether/vyroxeres_block.png b/libs/textures/blocks/nether/vyroxeres_block.png new file mode 100644 index 00000000..6c0ea709 Binary files /dev/null and b/libs/textures/blocks/nether/vyroxeres_block.png differ diff --git a/libs/textures/blocks/nether/vyroxeres_brick.png b/libs/textures/blocks/nether/vyroxeres_brick.png new file mode 100644 index 00000000..8f7a9a4c Binary files /dev/null and b/libs/textures/blocks/nether/vyroxeres_brick.png differ diff --git a/libs/textures/blocks/nether/vyroxeres_molten_flow.png b/libs/textures/blocks/nether/vyroxeres_molten_flow.png new file mode 100644 index 00000000..760d8048 Binary files /dev/null and b/libs/textures/blocks/nether/vyroxeres_molten_flow.png differ diff --git a/libs/textures/blocks/nether/vyroxeres_molten_flow.png.mcmeta b/libs/textures/blocks/nether/vyroxeres_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/nether/vyroxeres_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/nether/vyroxeres_molten_still.png b/libs/textures/blocks/nether/vyroxeres_molten_still.png new file mode 100644 index 00000000..23dc54ff Binary files /dev/null and b/libs/textures/blocks/nether/vyroxeres_molten_still.png differ diff --git a/libs/textures/blocks/nether/vyroxeres_molten_still.png.mcmeta b/libs/textures/blocks/nether/vyroxeres_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/nether/vyroxeres_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/nether/vyroxeres_ore.png b/libs/textures/blocks/nether/vyroxeres_ore.png new file mode 100644 index 00000000..c428ae84 Binary files /dev/null and b/libs/textures/blocks/nether/vyroxeres_ore.png differ diff --git a/libs/textures/blocks/precious/brass_block.png b/libs/textures/blocks/precious/brass_block.png new file mode 100644 index 00000000..7445ddbb Binary files /dev/null and b/libs/textures/blocks/precious/brass_block.png differ diff --git a/libs/textures/blocks/precious/brass_brick.png b/libs/textures/blocks/precious/brass_brick.png new file mode 100644 index 00000000..5844e509 Binary files /dev/null and b/libs/textures/blocks/precious/brass_brick.png differ diff --git a/libs/textures/blocks/precious/brass_molten_flow.png b/libs/textures/blocks/precious/brass_molten_flow.png new file mode 100644 index 00000000..6b0aed2b Binary files /dev/null and b/libs/textures/blocks/precious/brass_molten_flow.png differ diff --git a/libs/textures/blocks/precious/brass_molten_flow.png.mcmeta b/libs/textures/blocks/precious/brass_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/precious/brass_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/precious/brass_molten_still.png b/libs/textures/blocks/precious/brass_molten_still.png new file mode 100644 index 00000000..c096c713 Binary files /dev/null and b/libs/textures/blocks/precious/brass_molten_still.png differ diff --git a/libs/textures/blocks/precious/brass_molten_still.png.mcmeta b/libs/textures/blocks/precious/brass_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/precious/brass_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/precious/electrum_block.png b/libs/textures/blocks/precious/electrum_block.png new file mode 100644 index 00000000..19b1b070 Binary files /dev/null and b/libs/textures/blocks/precious/electrum_block.png differ diff --git a/libs/textures/blocks/precious/electrum_brick.png b/libs/textures/blocks/precious/electrum_brick.png new file mode 100644 index 00000000..f3d94fc5 Binary files /dev/null and b/libs/textures/blocks/precious/electrum_brick.png differ diff --git a/libs/textures/blocks/precious/electrum_molten_flow.png b/libs/textures/blocks/precious/electrum_molten_flow.png new file mode 100644 index 00000000..71a6f181 Binary files /dev/null and b/libs/textures/blocks/precious/electrum_molten_flow.png differ diff --git a/libs/textures/blocks/precious/electrum_molten_flow.png.mcmeta b/libs/textures/blocks/precious/electrum_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/precious/electrum_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/precious/electrum_molten_still.png b/libs/textures/blocks/precious/electrum_molten_still.png new file mode 100644 index 00000000..ebdf4c9a Binary files /dev/null and b/libs/textures/blocks/precious/electrum_molten_still.png differ diff --git a/libs/textures/blocks/precious/electrum_molten_still.png.mcmeta b/libs/textures/blocks/precious/electrum_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/precious/electrum_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/precious/platinum_block.png b/libs/textures/blocks/precious/platinum_block.png new file mode 100644 index 00000000..cda88320 Binary files /dev/null and b/libs/textures/blocks/precious/platinum_block.png differ diff --git a/libs/textures/blocks/precious/platinum_brick.png b/libs/textures/blocks/precious/platinum_brick.png new file mode 100644 index 00000000..b0326864 Binary files /dev/null and b/libs/textures/blocks/precious/platinum_brick.png differ diff --git a/libs/textures/blocks/precious/platinum_molten_flow.png b/libs/textures/blocks/precious/platinum_molten_flow.png new file mode 100644 index 00000000..e709948f Binary files /dev/null and b/libs/textures/blocks/precious/platinum_molten_flow.png differ diff --git a/libs/textures/blocks/precious/platinum_molten_flow.png.mcmeta b/libs/textures/blocks/precious/platinum_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/precious/platinum_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/precious/platinum_molten_still.png b/libs/textures/blocks/precious/platinum_molten_still.png new file mode 100644 index 00000000..663cbf7b Binary files /dev/null and b/libs/textures/blocks/precious/platinum_molten_still.png differ diff --git a/libs/textures/blocks/precious/platinum_molten_still.png.mcmeta b/libs/textures/blocks/precious/platinum_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/precious/platinum_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/precious/platinum_ore.png b/libs/textures/blocks/precious/platinum_ore.png new file mode 100644 index 00000000..a1f1b026 Binary files /dev/null and b/libs/textures/blocks/precious/platinum_ore.png differ diff --git a/libs/textures/blocks/precious/platinum_ore_overlay.png b/libs/textures/blocks/precious/platinum_ore_overlay.png new file mode 100644 index 00000000..0032da37 Binary files /dev/null and b/libs/textures/blocks/precious/platinum_ore_overlay.png differ diff --git a/libs/textures/blocks/precious/silver_block.png b/libs/textures/blocks/precious/silver_block.png new file mode 100644 index 00000000..3b698323 Binary files /dev/null and b/libs/textures/blocks/precious/silver_block.png differ diff --git a/libs/textures/blocks/precious/silver_brick.png b/libs/textures/blocks/precious/silver_brick.png new file mode 100644 index 00000000..2d4048b0 Binary files /dev/null and b/libs/textures/blocks/precious/silver_brick.png differ diff --git a/libs/textures/blocks/precious/silver_molten_flow.png b/libs/textures/blocks/precious/silver_molten_flow.png new file mode 100644 index 00000000..c9904b8e Binary files /dev/null and b/libs/textures/blocks/precious/silver_molten_flow.png differ diff --git a/libs/textures/blocks/precious/silver_molten_flow.png.mcmeta b/libs/textures/blocks/precious/silver_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/precious/silver_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/precious/silver_molten_still.png b/libs/textures/blocks/precious/silver_molten_still.png new file mode 100644 index 00000000..33691c33 Binary files /dev/null and b/libs/textures/blocks/precious/silver_molten_still.png differ diff --git a/libs/textures/blocks/precious/silver_molten_still.png.mcmeta b/libs/textures/blocks/precious/silver_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/precious/silver_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/precious/silver_ore.png b/libs/textures/blocks/precious/silver_ore.png new file mode 100644 index 00000000..2b0e4d2c Binary files /dev/null and b/libs/textures/blocks/precious/silver_ore.png differ diff --git a/libs/textures/blocks/precious/silver_ore_overlay.png b/libs/textures/blocks/precious/silver_ore_overlay.png new file mode 100644 index 00000000..bd418f0c Binary files /dev/null and b/libs/textures/blocks/precious/silver_ore_overlay.png differ diff --git a/libs/textures/blocks/precious/zinc_block.png b/libs/textures/blocks/precious/zinc_block.png new file mode 100644 index 00000000..1d71aa5c Binary files /dev/null and b/libs/textures/blocks/precious/zinc_block.png differ diff --git a/libs/textures/blocks/precious/zinc_brick.png b/libs/textures/blocks/precious/zinc_brick.png new file mode 100644 index 00000000..6ae2a20b Binary files /dev/null and b/libs/textures/blocks/precious/zinc_brick.png differ diff --git a/libs/textures/blocks/precious/zinc_molten_flow.png b/libs/textures/blocks/precious/zinc_molten_flow.png new file mode 100644 index 00000000..48bcd288 Binary files /dev/null and b/libs/textures/blocks/precious/zinc_molten_flow.png differ diff --git a/libs/textures/blocks/precious/zinc_molten_flow.png.mcmeta b/libs/textures/blocks/precious/zinc_molten_flow.png.mcmeta new file mode 100644 index 00000000..8e55e43b --- /dev/null +++ b/libs/textures/blocks/precious/zinc_molten_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/libs/textures/blocks/precious/zinc_molten_still.png b/libs/textures/blocks/precious/zinc_molten_still.png new file mode 100644 index 00000000..7962c040 Binary files /dev/null and b/libs/textures/blocks/precious/zinc_molten_still.png differ diff --git a/libs/textures/blocks/precious/zinc_molten_still.png.mcmeta b/libs/textures/blocks/precious/zinc_molten_still.png.mcmeta new file mode 100644 index 00000000..7ceb3639 --- /dev/null +++ b/libs/textures/blocks/precious/zinc_molten_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/libs/textures/blocks/precious/zinc_ore.png b/libs/textures/blocks/precious/zinc_ore.png new file mode 100644 index 00000000..57b05c00 Binary files /dev/null and b/libs/textures/blocks/precious/zinc_ore.png differ diff --git a/libs/textures/blocks/precious/zinc_ore_overlay.png b/libs/textures/blocks/precious/zinc_ore_overlay.png new file mode 100644 index 00000000..e28c46e5 Binary files /dev/null and b/libs/textures/blocks/precious/zinc_ore_overlay.png differ diff --git a/libs/textures/blocks/utility/bitumen_block.png b/libs/textures/blocks/utility/bitumen_block.png new file mode 100644 index 00000000..02d9339b Binary files /dev/null and b/libs/textures/blocks/utility/bitumen_block.png differ diff --git a/libs/textures/blocks/utility/bitumen_ore.png b/libs/textures/blocks/utility/bitumen_ore.png new file mode 100644 index 00000000..ab0f72d8 Binary files /dev/null and b/libs/textures/blocks/utility/bitumen_ore.png differ diff --git a/libs/textures/blocks/utility/bitumen_ore_overlay.png b/libs/textures/blocks/utility/bitumen_ore_overlay.png new file mode 100644 index 00000000..ed41f0c6 Binary files /dev/null and b/libs/textures/blocks/utility/bitumen_ore_overlay.png differ diff --git a/libs/textures/blocks/utility/magnesium_block.png b/libs/textures/blocks/utility/magnesium_block.png new file mode 100644 index 00000000..4150fa92 Binary files /dev/null and b/libs/textures/blocks/utility/magnesium_block.png differ diff --git a/libs/textures/blocks/utility/magnesium_ore.png b/libs/textures/blocks/utility/magnesium_ore.png new file mode 100644 index 00000000..42376cb5 Binary files /dev/null and b/libs/textures/blocks/utility/magnesium_ore.png differ diff --git a/libs/textures/blocks/utility/magnesium_ore_overlay.png b/libs/textures/blocks/utility/magnesium_ore_overlay.png new file mode 100644 index 00000000..e28eb312 Binary files /dev/null and b/libs/textures/blocks/utility/magnesium_ore_overlay.png differ diff --git a/libs/textures/blocks/utility/phosphorite_block.png b/libs/textures/blocks/utility/phosphorite_block.png new file mode 100644 index 00000000..38520828 Binary files /dev/null and b/libs/textures/blocks/utility/phosphorite_block.png differ diff --git a/libs/textures/blocks/utility/phosphorite_ore.png b/libs/textures/blocks/utility/phosphorite_ore.png new file mode 100644 index 00000000..f62bccf8 Binary files /dev/null and b/libs/textures/blocks/utility/phosphorite_ore.png differ diff --git a/libs/textures/blocks/utility/phosphorite_ore_overlay.png b/libs/textures/blocks/utility/phosphorite_ore_overlay.png new file mode 100644 index 00000000..7cabb67a Binary files /dev/null and b/libs/textures/blocks/utility/phosphorite_ore_overlay.png differ diff --git a/libs/textures/blocks/utility/potash_block.png b/libs/textures/blocks/utility/potash_block.png new file mode 100644 index 00000000..83c786f4 Binary files /dev/null and b/libs/textures/blocks/utility/potash_block.png differ diff --git a/libs/textures/blocks/utility/potash_ore.png b/libs/textures/blocks/utility/potash_ore.png new file mode 100644 index 00000000..505a2b06 Binary files /dev/null and b/libs/textures/blocks/utility/potash_ore.png differ diff --git a/libs/textures/blocks/utility/potash_ore_overlay.png b/libs/textures/blocks/utility/potash_ore_overlay.png new file mode 100644 index 00000000..7f1750a3 Binary files /dev/null and b/libs/textures/blocks/utility/potash_ore_overlay.png differ diff --git a/libs/textures/blocks/utility/saltpeter_block.png b/libs/textures/blocks/utility/saltpeter_block.png new file mode 100644 index 00000000..e4121244 Binary files /dev/null and b/libs/textures/blocks/utility/saltpeter_block.png differ diff --git a/libs/textures/blocks/utility/saltpeter_ore.png b/libs/textures/blocks/utility/saltpeter_ore.png new file mode 100644 index 00000000..a1d50e80 Binary files /dev/null and b/libs/textures/blocks/utility/saltpeter_ore.png differ diff --git a/libs/textures/blocks/utility/saltpeter_ore_overlay.png b/libs/textures/blocks/utility/saltpeter_ore_overlay.png new file mode 100644 index 00000000..4ee3a84c Binary files /dev/null and b/libs/textures/blocks/utility/saltpeter_ore_overlay.png differ diff --git a/libs/textures/blocks/utility/sulfur_block.png b/libs/textures/blocks/utility/sulfur_block.png new file mode 100644 index 00000000..5341e317 Binary files /dev/null and b/libs/textures/blocks/utility/sulfur_block.png differ diff --git a/libs/textures/blocks/utility/sulfur_ore.png b/libs/textures/blocks/utility/sulfur_ore.png new file mode 100644 index 00000000..83cd86d3 Binary files /dev/null and b/libs/textures/blocks/utility/sulfur_ore.png differ diff --git a/libs/textures/blocks/utility/sulfur_ore_overlay.png b/libs/textures/blocks/utility/sulfur_ore_overlay.png new file mode 100644 index 00000000..1f35fef9 Binary files /dev/null and b/libs/textures/blocks/utility/sulfur_ore_overlay.png differ diff --git a/libs/textures/blocks/vanilla/gold_brick.png b/libs/textures/blocks/vanilla/gold_brick.png new file mode 100644 index 00000000..1660f39c Binary files /dev/null and b/libs/textures/blocks/vanilla/gold_brick.png differ diff --git a/libs/textures/blocks/vanilla/iron_brick.png b/libs/textures/blocks/vanilla/iron_brick.png new file mode 100644 index 00000000..a9b4b639 Binary files /dev/null and b/libs/textures/blocks/vanilla/iron_brick.png differ diff --git a/libs/textures/gui/alloyer.png b/libs/textures/gui/alloyer.png new file mode 100644 index 00000000..8cb73393 Binary files /dev/null and b/libs/textures/gui/alloyer.png differ diff --git a/libs/textures/gui/crusher-minium.png b/libs/textures/gui/crusher-minium.png new file mode 100644 index 00000000..d0e838eb Binary files /dev/null and b/libs/textures/gui/crusher-minium.png differ diff --git a/libs/textures/gui/crusher.png b/libs/textures/gui/crusher.png new file mode 100644 index 00000000..ab363a32 Binary files /dev/null and b/libs/textures/gui/crusher.png differ diff --git a/libs/textures/gui/drawer.png b/libs/textures/gui/drawer.png new file mode 100644 index 00000000..863b71cc Binary files /dev/null and b/libs/textures/gui/drawer.png differ diff --git a/libs/textures/gui/forge.png b/libs/textures/gui/forge.png new file mode 100644 index 00000000..c6bafa30 Binary files /dev/null and b/libs/textures/gui/forge.png differ diff --git a/libs/textures/gui/nei_alloyer.png b/libs/textures/gui/nei_alloyer.png new file mode 100644 index 00000000..bfb4e831 Binary files /dev/null and b/libs/textures/gui/nei_alloyer.png differ diff --git a/libs/textures/gui/nei_crusher.png b/libs/textures/gui/nei_crusher.png new file mode 100644 index 00000000..72c88e04 Binary files /dev/null and b/libs/textures/gui/nei_crusher.png differ diff --git a/libs/textures/items/base/angmallen_axe.png b/libs/textures/items/base/angmallen_axe.png new file mode 100644 index 00000000..42eeb609 Binary files /dev/null and b/libs/textures/items/base/angmallen_axe.png differ diff --git a/libs/textures/items/base/angmallen_boots.png b/libs/textures/items/base/angmallen_boots.png new file mode 100644 index 00000000..3deaf578 Binary files /dev/null and b/libs/textures/items/base/angmallen_boots.png differ diff --git a/libs/textures/items/base/angmallen_bucket_fill.png b/libs/textures/items/base/angmallen_bucket_fill.png new file mode 100644 index 00000000..e38b0218 Binary files /dev/null and b/libs/textures/items/base/angmallen_bucket_fill.png differ diff --git a/libs/textures/items/base/angmallen_chest.png b/libs/textures/items/base/angmallen_chest.png new file mode 100644 index 00000000..24f1f250 Binary files /dev/null and b/libs/textures/items/base/angmallen_chest.png differ diff --git a/libs/textures/items/base/angmallen_dust.png b/libs/textures/items/base/angmallen_dust.png new file mode 100644 index 00000000..1243d91a Binary files /dev/null and b/libs/textures/items/base/angmallen_dust.png differ diff --git a/libs/textures/items/base/angmallen_helmet.png b/libs/textures/items/base/angmallen_helmet.png new file mode 100644 index 00000000..6f3d6155 Binary files /dev/null and b/libs/textures/items/base/angmallen_helmet.png differ diff --git a/libs/textures/items/base/angmallen_hoe.png b/libs/textures/items/base/angmallen_hoe.png new file mode 100644 index 00000000..d3ccc020 Binary files /dev/null and b/libs/textures/items/base/angmallen_hoe.png differ diff --git a/libs/textures/items/base/angmallen_ingot.png b/libs/textures/items/base/angmallen_ingot.png new file mode 100644 index 00000000..24f8380e Binary files /dev/null and b/libs/textures/items/base/angmallen_ingot.png differ diff --git a/libs/textures/items/base/angmallen_legs.png b/libs/textures/items/base/angmallen_legs.png new file mode 100644 index 00000000..770d47e0 Binary files /dev/null and b/libs/textures/items/base/angmallen_legs.png differ diff --git a/libs/textures/items/base/angmallen_pick.png b/libs/textures/items/base/angmallen_pick.png new file mode 100644 index 00000000..164ccdb8 Binary files /dev/null and b/libs/textures/items/base/angmallen_pick.png differ diff --git a/libs/textures/items/base/angmallen_shovel.png b/libs/textures/items/base/angmallen_shovel.png new file mode 100644 index 00000000..d5fb7eb2 Binary files /dev/null and b/libs/textures/items/base/angmallen_shovel.png differ diff --git a/libs/textures/items/base/angmallen_sword.png b/libs/textures/items/base/angmallen_sword.png new file mode 100644 index 00000000..bcc25337 Binary files /dev/null and b/libs/textures/items/base/angmallen_sword.png differ diff --git a/libs/textures/items/base/bronze_axe.png b/libs/textures/items/base/bronze_axe.png new file mode 100644 index 00000000..92213cea Binary files /dev/null and b/libs/textures/items/base/bronze_axe.png differ diff --git a/libs/textures/items/base/bronze_boots.png b/libs/textures/items/base/bronze_boots.png new file mode 100644 index 00000000..98e2f0c9 Binary files /dev/null and b/libs/textures/items/base/bronze_boots.png differ diff --git a/libs/textures/items/base/bronze_bucket_fill.png b/libs/textures/items/base/bronze_bucket_fill.png new file mode 100644 index 00000000..3a8e9573 Binary files /dev/null and b/libs/textures/items/base/bronze_bucket_fill.png differ diff --git a/libs/textures/items/base/bronze_chest.png b/libs/textures/items/base/bronze_chest.png new file mode 100644 index 00000000..1cb9baa0 Binary files /dev/null and b/libs/textures/items/base/bronze_chest.png differ diff --git a/libs/textures/items/base/bronze_dust.png b/libs/textures/items/base/bronze_dust.png new file mode 100644 index 00000000..fd8ebbb0 Binary files /dev/null and b/libs/textures/items/base/bronze_dust.png differ diff --git a/libs/textures/items/base/bronze_helmet.png b/libs/textures/items/base/bronze_helmet.png new file mode 100644 index 00000000..2903299e Binary files /dev/null and b/libs/textures/items/base/bronze_helmet.png differ diff --git a/libs/textures/items/base/bronze_hoe.png b/libs/textures/items/base/bronze_hoe.png new file mode 100644 index 00000000..f209b61a Binary files /dev/null and b/libs/textures/items/base/bronze_hoe.png differ diff --git a/libs/textures/items/base/bronze_ingot.png b/libs/textures/items/base/bronze_ingot.png new file mode 100644 index 00000000..f67a946b Binary files /dev/null and b/libs/textures/items/base/bronze_ingot.png differ diff --git a/libs/textures/items/base/bronze_legs.png b/libs/textures/items/base/bronze_legs.png new file mode 100644 index 00000000..b33a002f Binary files /dev/null and b/libs/textures/items/base/bronze_legs.png differ diff --git a/libs/textures/items/base/bronze_pick.png b/libs/textures/items/base/bronze_pick.png new file mode 100644 index 00000000..abaa2b43 Binary files /dev/null and b/libs/textures/items/base/bronze_pick.png differ diff --git a/libs/textures/items/base/bronze_shovel.png b/libs/textures/items/base/bronze_shovel.png new file mode 100644 index 00000000..e1ea6936 Binary files /dev/null and b/libs/textures/items/base/bronze_shovel.png differ diff --git a/libs/textures/items/base/bronze_sword.png b/libs/textures/items/base/bronze_sword.png new file mode 100644 index 00000000..6585ba9d Binary files /dev/null and b/libs/textures/items/base/bronze_sword.png differ diff --git a/libs/textures/items/base/copper_axe.png b/libs/textures/items/base/copper_axe.png new file mode 100644 index 00000000..6d4156d4 Binary files /dev/null and b/libs/textures/items/base/copper_axe.png differ diff --git a/libs/textures/items/base/copper_boots.png b/libs/textures/items/base/copper_boots.png new file mode 100644 index 00000000..4c87008d Binary files /dev/null and b/libs/textures/items/base/copper_boots.png differ diff --git a/libs/textures/items/base/copper_bucket_fill.png b/libs/textures/items/base/copper_bucket_fill.png new file mode 100644 index 00000000..44d993ff Binary files /dev/null and b/libs/textures/items/base/copper_bucket_fill.png differ diff --git a/libs/textures/items/base/copper_chest.png b/libs/textures/items/base/copper_chest.png new file mode 100644 index 00000000..1d358763 Binary files /dev/null and b/libs/textures/items/base/copper_chest.png differ diff --git a/libs/textures/items/base/copper_dust.png b/libs/textures/items/base/copper_dust.png new file mode 100644 index 00000000..abadcf20 Binary files /dev/null and b/libs/textures/items/base/copper_dust.png differ diff --git a/libs/textures/items/base/copper_helmet.png b/libs/textures/items/base/copper_helmet.png new file mode 100644 index 00000000..68955374 Binary files /dev/null and b/libs/textures/items/base/copper_helmet.png differ diff --git a/libs/textures/items/base/copper_hoe.png b/libs/textures/items/base/copper_hoe.png new file mode 100644 index 00000000..a63d0f82 Binary files /dev/null and b/libs/textures/items/base/copper_hoe.png differ diff --git a/libs/textures/items/base/copper_ingot.png b/libs/textures/items/base/copper_ingot.png new file mode 100644 index 00000000..0dc65bca Binary files /dev/null and b/libs/textures/items/base/copper_ingot.png differ diff --git a/libs/textures/items/base/copper_legs.png b/libs/textures/items/base/copper_legs.png new file mode 100644 index 00000000..e3a38ad5 Binary files /dev/null and b/libs/textures/items/base/copper_legs.png differ diff --git a/libs/textures/items/base/copper_pick.png b/libs/textures/items/base/copper_pick.png new file mode 100644 index 00000000..ec8f9d91 Binary files /dev/null and b/libs/textures/items/base/copper_pick.png differ diff --git a/libs/textures/items/base/copper_shovel.png b/libs/textures/items/base/copper_shovel.png new file mode 100644 index 00000000..5ad6b769 Binary files /dev/null and b/libs/textures/items/base/copper_shovel.png differ diff --git a/libs/textures/items/base/copper_sword.png b/libs/textures/items/base/copper_sword.png new file mode 100644 index 00000000..b6a51b5e Binary files /dev/null and b/libs/textures/items/base/copper_sword.png differ diff --git a/libs/textures/items/base/damascus_steel_axe.png b/libs/textures/items/base/damascus_steel_axe.png new file mode 100644 index 00000000..7dce853a Binary files /dev/null and b/libs/textures/items/base/damascus_steel_axe.png differ diff --git a/libs/textures/items/base/damascus_steel_boots.png b/libs/textures/items/base/damascus_steel_boots.png new file mode 100644 index 00000000..35ff2d89 Binary files /dev/null and b/libs/textures/items/base/damascus_steel_boots.png differ diff --git a/libs/textures/items/base/damascus_steel_bucket_fill.png b/libs/textures/items/base/damascus_steel_bucket_fill.png new file mode 100644 index 00000000..ae7f53fb Binary files /dev/null and b/libs/textures/items/base/damascus_steel_bucket_fill.png differ diff --git a/libs/textures/items/base/damascus_steel_chest.png b/libs/textures/items/base/damascus_steel_chest.png new file mode 100644 index 00000000..d6df99b1 Binary files /dev/null and b/libs/textures/items/base/damascus_steel_chest.png differ diff --git a/libs/textures/items/base/damascus_steel_dust.png b/libs/textures/items/base/damascus_steel_dust.png new file mode 100644 index 00000000..223a70d6 Binary files /dev/null and b/libs/textures/items/base/damascus_steel_dust.png differ diff --git a/libs/textures/items/base/damascus_steel_helmet.png b/libs/textures/items/base/damascus_steel_helmet.png new file mode 100644 index 00000000..424f277f Binary files /dev/null and b/libs/textures/items/base/damascus_steel_helmet.png differ diff --git a/libs/textures/items/base/damascus_steel_hoe.png b/libs/textures/items/base/damascus_steel_hoe.png new file mode 100644 index 00000000..cfb65731 Binary files /dev/null and b/libs/textures/items/base/damascus_steel_hoe.png differ diff --git a/libs/textures/items/base/damascus_steel_ingot.png b/libs/textures/items/base/damascus_steel_ingot.png new file mode 100644 index 00000000..571420f9 Binary files /dev/null and b/libs/textures/items/base/damascus_steel_ingot.png differ diff --git a/libs/textures/items/base/damascus_steel_legs.png b/libs/textures/items/base/damascus_steel_legs.png new file mode 100644 index 00000000..b396b56d Binary files /dev/null and b/libs/textures/items/base/damascus_steel_legs.png differ diff --git a/libs/textures/items/base/damascus_steel_pick.png b/libs/textures/items/base/damascus_steel_pick.png new file mode 100644 index 00000000..162d50ed Binary files /dev/null and b/libs/textures/items/base/damascus_steel_pick.png differ diff --git a/libs/textures/items/base/damascus_steel_shovel.png b/libs/textures/items/base/damascus_steel_shovel.png new file mode 100644 index 00000000..7d99d938 Binary files /dev/null and b/libs/textures/items/base/damascus_steel_shovel.png differ diff --git a/libs/textures/items/base/damascus_steel_sword.png b/libs/textures/items/base/damascus_steel_sword.png new file mode 100644 index 00000000..fe18c000 Binary files /dev/null and b/libs/textures/items/base/damascus_steel_sword.png differ diff --git a/libs/textures/items/base/hepatizon_axe.png b/libs/textures/items/base/hepatizon_axe.png new file mode 100644 index 00000000..15f34314 Binary files /dev/null and b/libs/textures/items/base/hepatizon_axe.png differ diff --git a/libs/textures/items/base/hepatizon_boots.png b/libs/textures/items/base/hepatizon_boots.png new file mode 100644 index 00000000..17522605 Binary files /dev/null and b/libs/textures/items/base/hepatizon_boots.png differ diff --git a/libs/textures/items/base/hepatizon_bucket_fill.png b/libs/textures/items/base/hepatizon_bucket_fill.png new file mode 100644 index 00000000..4f02897d Binary files /dev/null and b/libs/textures/items/base/hepatizon_bucket_fill.png differ diff --git a/libs/textures/items/base/hepatizon_chest.png b/libs/textures/items/base/hepatizon_chest.png new file mode 100644 index 00000000..2ab06cd7 Binary files /dev/null and b/libs/textures/items/base/hepatizon_chest.png differ diff --git a/libs/textures/items/base/hepatizon_dust.png b/libs/textures/items/base/hepatizon_dust.png new file mode 100644 index 00000000..338c2c93 Binary files /dev/null and b/libs/textures/items/base/hepatizon_dust.png differ diff --git a/libs/textures/items/base/hepatizon_helmet.png b/libs/textures/items/base/hepatizon_helmet.png new file mode 100644 index 00000000..6e071e2d Binary files /dev/null and b/libs/textures/items/base/hepatizon_helmet.png differ diff --git a/libs/textures/items/base/hepatizon_hoe.png b/libs/textures/items/base/hepatizon_hoe.png new file mode 100644 index 00000000..1c89bd4c Binary files /dev/null and b/libs/textures/items/base/hepatizon_hoe.png differ diff --git a/libs/textures/items/base/hepatizon_ingot.png b/libs/textures/items/base/hepatizon_ingot.png new file mode 100644 index 00000000..a7d7ab5c Binary files /dev/null and b/libs/textures/items/base/hepatizon_ingot.png differ diff --git a/libs/textures/items/base/hepatizon_legs.png b/libs/textures/items/base/hepatizon_legs.png new file mode 100644 index 00000000..f5a5b4c4 Binary files /dev/null and b/libs/textures/items/base/hepatizon_legs.png differ diff --git a/libs/textures/items/base/hepatizon_pick.png b/libs/textures/items/base/hepatizon_pick.png new file mode 100644 index 00000000..5dd89488 Binary files /dev/null and b/libs/textures/items/base/hepatizon_pick.png differ diff --git a/libs/textures/items/base/hepatizon_shovel.png b/libs/textures/items/base/hepatizon_shovel.png new file mode 100644 index 00000000..4f226bb6 Binary files /dev/null and b/libs/textures/items/base/hepatizon_shovel.png differ diff --git a/libs/textures/items/base/hepatizon_sword.png b/libs/textures/items/base/hepatizon_sword.png new file mode 100644 index 00000000..97d2c1e4 Binary files /dev/null and b/libs/textures/items/base/hepatizon_sword.png differ diff --git a/libs/textures/items/base/manganese_bucket_fill.png b/libs/textures/items/base/manganese_bucket_fill.png new file mode 100644 index 00000000..b36fc302 Binary files /dev/null and b/libs/textures/items/base/manganese_bucket_fill.png differ diff --git a/libs/textures/items/base/manganese_dust.png b/libs/textures/items/base/manganese_dust.png new file mode 100644 index 00000000..c4f8c70e Binary files /dev/null and b/libs/textures/items/base/manganese_dust.png differ diff --git a/libs/textures/items/base/manganese_ingot.png b/libs/textures/items/base/manganese_ingot.png new file mode 100644 index 00000000..3edf16eb Binary files /dev/null and b/libs/textures/items/base/manganese_ingot.png differ diff --git a/libs/textures/items/base/steel_axe.png b/libs/textures/items/base/steel_axe.png new file mode 100644 index 00000000..dba5e199 Binary files /dev/null and b/libs/textures/items/base/steel_axe.png differ diff --git a/libs/textures/items/base/steel_boots.png b/libs/textures/items/base/steel_boots.png new file mode 100644 index 00000000..e7b3ffdb Binary files /dev/null and b/libs/textures/items/base/steel_boots.png differ diff --git a/libs/textures/items/base/steel_bucket_fill.png b/libs/textures/items/base/steel_bucket_fill.png new file mode 100644 index 00000000..4cb665cd Binary files /dev/null and b/libs/textures/items/base/steel_bucket_fill.png differ diff --git a/libs/textures/items/base/steel_chest.png b/libs/textures/items/base/steel_chest.png new file mode 100644 index 00000000..b9bddf79 Binary files /dev/null and b/libs/textures/items/base/steel_chest.png differ diff --git a/libs/textures/items/base/steel_dust.png b/libs/textures/items/base/steel_dust.png new file mode 100644 index 00000000..f08d7d2b Binary files /dev/null and b/libs/textures/items/base/steel_dust.png differ diff --git a/libs/textures/items/base/steel_helmet.png b/libs/textures/items/base/steel_helmet.png new file mode 100644 index 00000000..fab66dfa Binary files /dev/null and b/libs/textures/items/base/steel_helmet.png differ diff --git a/libs/textures/items/base/steel_hoe.png b/libs/textures/items/base/steel_hoe.png new file mode 100644 index 00000000..1f4a7b37 Binary files /dev/null and b/libs/textures/items/base/steel_hoe.png differ diff --git a/libs/textures/items/base/steel_ingot.png b/libs/textures/items/base/steel_ingot.png new file mode 100644 index 00000000..ba2f881d Binary files /dev/null and b/libs/textures/items/base/steel_ingot.png differ diff --git a/libs/textures/items/base/steel_legs.png b/libs/textures/items/base/steel_legs.png new file mode 100644 index 00000000..1ec37512 Binary files /dev/null and b/libs/textures/items/base/steel_legs.png differ diff --git a/libs/textures/items/base/steel_pick.png b/libs/textures/items/base/steel_pick.png new file mode 100644 index 00000000..a2c8644b Binary files /dev/null and b/libs/textures/items/base/steel_pick.png differ diff --git a/libs/textures/items/base/steel_shovel.png b/libs/textures/items/base/steel_shovel.png new file mode 100644 index 00000000..db1de8d8 Binary files /dev/null and b/libs/textures/items/base/steel_shovel.png differ diff --git a/libs/textures/items/base/steel_sword.png b/libs/textures/items/base/steel_sword.png new file mode 100644 index 00000000..2101f0a5 Binary files /dev/null and b/libs/textures/items/base/steel_sword.png differ diff --git a/libs/textures/items/base/tin_bucket_fill.png b/libs/textures/items/base/tin_bucket_fill.png new file mode 100644 index 00000000..92d05e9d Binary files /dev/null and b/libs/textures/items/base/tin_bucket_fill.png differ diff --git a/libs/textures/items/base/tin_dust.png b/libs/textures/items/base/tin_dust.png new file mode 100644 index 00000000..6b6b5476 Binary files /dev/null and b/libs/textures/items/base/tin_dust.png differ diff --git a/libs/textures/items/base/tin_ingot.png b/libs/textures/items/base/tin_ingot.png new file mode 100644 index 00000000..3a9c4cb7 Binary files /dev/null and b/libs/textures/items/base/tin_ingot.png differ diff --git a/libs/textures/items/ender/desichalkos_axe.png b/libs/textures/items/ender/desichalkos_axe.png new file mode 100644 index 00000000..6f8662b7 Binary files /dev/null and b/libs/textures/items/ender/desichalkos_axe.png differ diff --git a/libs/textures/items/ender/desichalkos_boots.png b/libs/textures/items/ender/desichalkos_boots.png new file mode 100644 index 00000000..afb76d12 Binary files /dev/null and b/libs/textures/items/ender/desichalkos_boots.png differ diff --git a/libs/textures/items/ender/desichalkos_bucket_fill.png b/libs/textures/items/ender/desichalkos_bucket_fill.png new file mode 100644 index 00000000..6a18dc9a Binary files /dev/null and b/libs/textures/items/ender/desichalkos_bucket_fill.png differ diff --git a/libs/textures/items/ender/desichalkos_chest.png b/libs/textures/items/ender/desichalkos_chest.png new file mode 100644 index 00000000..4c286a16 Binary files /dev/null and b/libs/textures/items/ender/desichalkos_chest.png differ diff --git a/libs/textures/items/ender/desichalkos_dust.png b/libs/textures/items/ender/desichalkos_dust.png new file mode 100644 index 00000000..19edff68 Binary files /dev/null and b/libs/textures/items/ender/desichalkos_dust.png differ diff --git a/libs/textures/items/ender/desichalkos_helmet.png b/libs/textures/items/ender/desichalkos_helmet.png new file mode 100644 index 00000000..0175767f Binary files /dev/null and b/libs/textures/items/ender/desichalkos_helmet.png differ diff --git a/libs/textures/items/ender/desichalkos_hoe.png b/libs/textures/items/ender/desichalkos_hoe.png new file mode 100644 index 00000000..44008bb3 Binary files /dev/null and b/libs/textures/items/ender/desichalkos_hoe.png differ diff --git a/libs/textures/items/ender/desichalkos_ingot.png b/libs/textures/items/ender/desichalkos_ingot.png new file mode 100644 index 00000000..62397e5a Binary files /dev/null and b/libs/textures/items/ender/desichalkos_ingot.png differ diff --git a/libs/textures/items/ender/desichalkos_legs.png b/libs/textures/items/ender/desichalkos_legs.png new file mode 100644 index 00000000..c7caadae Binary files /dev/null and b/libs/textures/items/ender/desichalkos_legs.png differ diff --git a/libs/textures/items/ender/desichalkos_pick.png b/libs/textures/items/ender/desichalkos_pick.png new file mode 100644 index 00000000..3a3422f9 Binary files /dev/null and b/libs/textures/items/ender/desichalkos_pick.png differ diff --git a/libs/textures/items/ender/desichalkos_shovel.png b/libs/textures/items/ender/desichalkos_shovel.png new file mode 100644 index 00000000..c11599e3 Binary files /dev/null and b/libs/textures/items/ender/desichalkos_shovel.png differ diff --git a/libs/textures/items/ender/desichalkos_sword.png b/libs/textures/items/ender/desichalkos_sword.png new file mode 100644 index 00000000..2686584d Binary files /dev/null and b/libs/textures/items/ender/desichalkos_sword.png differ diff --git a/libs/textures/items/ender/eximite_axe.png b/libs/textures/items/ender/eximite_axe.png new file mode 100644 index 00000000..14624e17 Binary files /dev/null and b/libs/textures/items/ender/eximite_axe.png differ diff --git a/libs/textures/items/ender/eximite_boots.png b/libs/textures/items/ender/eximite_boots.png new file mode 100644 index 00000000..c4d0290b Binary files /dev/null and b/libs/textures/items/ender/eximite_boots.png differ diff --git a/libs/textures/items/ender/eximite_bucket_fill.png b/libs/textures/items/ender/eximite_bucket_fill.png new file mode 100644 index 00000000..41ce86d8 Binary files /dev/null and b/libs/textures/items/ender/eximite_bucket_fill.png differ diff --git a/libs/textures/items/ender/eximite_chest.png b/libs/textures/items/ender/eximite_chest.png new file mode 100644 index 00000000..57815f3d Binary files /dev/null and b/libs/textures/items/ender/eximite_chest.png differ diff --git a/libs/textures/items/ender/eximite_dust.png b/libs/textures/items/ender/eximite_dust.png new file mode 100644 index 00000000..37c06780 Binary files /dev/null and b/libs/textures/items/ender/eximite_dust.png differ diff --git a/libs/textures/items/ender/eximite_helmet.png b/libs/textures/items/ender/eximite_helmet.png new file mode 100644 index 00000000..6edad7c6 Binary files /dev/null and b/libs/textures/items/ender/eximite_helmet.png differ diff --git a/libs/textures/items/ender/eximite_hoe.png b/libs/textures/items/ender/eximite_hoe.png new file mode 100644 index 00000000..25553964 Binary files /dev/null and b/libs/textures/items/ender/eximite_hoe.png differ diff --git a/libs/textures/items/ender/eximite_ingot.png b/libs/textures/items/ender/eximite_ingot.png new file mode 100644 index 00000000..ac940963 Binary files /dev/null and b/libs/textures/items/ender/eximite_ingot.png differ diff --git a/libs/textures/items/ender/eximite_legs.png b/libs/textures/items/ender/eximite_legs.png new file mode 100644 index 00000000..eefe0875 Binary files /dev/null and b/libs/textures/items/ender/eximite_legs.png differ diff --git a/libs/textures/items/ender/eximite_pick.png b/libs/textures/items/ender/eximite_pick.png new file mode 100644 index 00000000..5bc8a232 Binary files /dev/null and b/libs/textures/items/ender/eximite_pick.png differ diff --git a/libs/textures/items/ender/eximite_shovel.png b/libs/textures/items/ender/eximite_shovel.png new file mode 100644 index 00000000..28a424e4 Binary files /dev/null and b/libs/textures/items/ender/eximite_shovel.png differ diff --git a/libs/textures/items/ender/eximite_sword.png b/libs/textures/items/ender/eximite_sword.png new file mode 100644 index 00000000..889ef2c0 Binary files /dev/null and b/libs/textures/items/ender/eximite_sword.png differ diff --git a/libs/textures/items/ender/meutoite_bucket_fill.png b/libs/textures/items/ender/meutoite_bucket_fill.png new file mode 100644 index 00000000..cb683276 Binary files /dev/null and b/libs/textures/items/ender/meutoite_bucket_fill.png differ diff --git a/libs/textures/items/ender/meutoite_dust.png b/libs/textures/items/ender/meutoite_dust.png new file mode 100644 index 00000000..e886d6b4 Binary files /dev/null and b/libs/textures/items/ender/meutoite_dust.png differ diff --git a/libs/textures/items/ender/meutoite_ingot.png b/libs/textures/items/ender/meutoite_ingot.png new file mode 100644 index 00000000..cbdede75 Binary files /dev/null and b/libs/textures/items/ender/meutoite_ingot.png differ diff --git a/libs/textures/items/fantasy/adamantine_axe.png b/libs/textures/items/fantasy/adamantine_axe.png new file mode 100644 index 00000000..2dec357b Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_axe.png differ diff --git a/libs/textures/items/fantasy/adamantine_boots.png b/libs/textures/items/fantasy/adamantine_boots.png new file mode 100644 index 00000000..49fa71d2 Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_boots.png differ diff --git a/libs/textures/items/fantasy/adamantine_bucket_fill.png b/libs/textures/items/fantasy/adamantine_bucket_fill.png new file mode 100644 index 00000000..8854a1f9 Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/adamantine_chest.png b/libs/textures/items/fantasy/adamantine_chest.png new file mode 100644 index 00000000..4c2474c4 Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_chest.png differ diff --git a/libs/textures/items/fantasy/adamantine_dust.png b/libs/textures/items/fantasy/adamantine_dust.png new file mode 100644 index 00000000..d7704471 Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_dust.png differ diff --git a/libs/textures/items/fantasy/adamantine_helmet.png b/libs/textures/items/fantasy/adamantine_helmet.png new file mode 100644 index 00000000..6a7ee8e0 Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_helmet.png differ diff --git a/libs/textures/items/fantasy/adamantine_hoe.png b/libs/textures/items/fantasy/adamantine_hoe.png new file mode 100644 index 00000000..30d47d2c Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_hoe.png differ diff --git a/libs/textures/items/fantasy/adamantine_ingot.png b/libs/textures/items/fantasy/adamantine_ingot.png new file mode 100644 index 00000000..60e19cff Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_ingot.png differ diff --git a/libs/textures/items/fantasy/adamantine_legs.png b/libs/textures/items/fantasy/adamantine_legs.png new file mode 100644 index 00000000..590e2b0c Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_legs.png differ diff --git a/libs/textures/items/fantasy/adamantine_pick.png b/libs/textures/items/fantasy/adamantine_pick.png new file mode 100644 index 00000000..742cd75b Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_pick.png differ diff --git a/libs/textures/items/fantasy/adamantine_shovel.png b/libs/textures/items/fantasy/adamantine_shovel.png new file mode 100644 index 00000000..69f7281d Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_shovel.png differ diff --git a/libs/textures/items/fantasy/adamantine_sword.png b/libs/textures/items/fantasy/adamantine_sword.png new file mode 100644 index 00000000..6b33254d Binary files /dev/null and b/libs/textures/items/fantasy/adamantine_sword.png differ diff --git a/libs/textures/items/fantasy/astral_silver_axe.png b/libs/textures/items/fantasy/astral_silver_axe.png new file mode 100644 index 00000000..8b89d985 Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_axe.png differ diff --git a/libs/textures/items/fantasy/astral_silver_boots.png b/libs/textures/items/fantasy/astral_silver_boots.png new file mode 100644 index 00000000..70b24750 Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_boots.png differ diff --git a/libs/textures/items/fantasy/astral_silver_bucket_fill.png b/libs/textures/items/fantasy/astral_silver_bucket_fill.png new file mode 100644 index 00000000..59414de9 Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/astral_silver_chest.png b/libs/textures/items/fantasy/astral_silver_chest.png new file mode 100644 index 00000000..62c2fd49 Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_chest.png differ diff --git a/libs/textures/items/fantasy/astral_silver_dust.png b/libs/textures/items/fantasy/astral_silver_dust.png new file mode 100644 index 00000000..5c0454d1 Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_dust.png differ diff --git a/libs/textures/items/fantasy/astral_silver_helmet.png b/libs/textures/items/fantasy/astral_silver_helmet.png new file mode 100644 index 00000000..2fe1a389 Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_helmet.png differ diff --git a/libs/textures/items/fantasy/astral_silver_hoe.png b/libs/textures/items/fantasy/astral_silver_hoe.png new file mode 100644 index 00000000..15b003b3 Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_hoe.png differ diff --git a/libs/textures/items/fantasy/astral_silver_ingot.png b/libs/textures/items/fantasy/astral_silver_ingot.png new file mode 100644 index 00000000..84cc4f3e Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_ingot.png differ diff --git a/libs/textures/items/fantasy/astral_silver_legs.png b/libs/textures/items/fantasy/astral_silver_legs.png new file mode 100644 index 00000000..7676bfa3 Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_legs.png differ diff --git a/libs/textures/items/fantasy/astral_silver_pick.png b/libs/textures/items/fantasy/astral_silver_pick.png new file mode 100644 index 00000000..af9357cd Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_pick.png differ diff --git a/libs/textures/items/fantasy/astral_silver_shovel.png b/libs/textures/items/fantasy/astral_silver_shovel.png new file mode 100644 index 00000000..476231d0 Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_shovel.png differ diff --git a/libs/textures/items/fantasy/astral_silver_sword.png b/libs/textures/items/fantasy/astral_silver_sword.png new file mode 100644 index 00000000..0825528b Binary files /dev/null and b/libs/textures/items/fantasy/astral_silver_sword.png differ diff --git a/libs/textures/items/fantasy/atlarus_axe.png b/libs/textures/items/fantasy/atlarus_axe.png new file mode 100644 index 00000000..bc797c93 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_axe.png differ diff --git a/libs/textures/items/fantasy/atlarus_boots.png b/libs/textures/items/fantasy/atlarus_boots.png new file mode 100644 index 00000000..bc81e52e Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_boots.png differ diff --git a/libs/textures/items/fantasy/atlarus_bucket_fill.png b/libs/textures/items/fantasy/atlarus_bucket_fill.png new file mode 100644 index 00000000..82bfffde Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/atlarus_chest.png b/libs/textures/items/fantasy/atlarus_chest.png new file mode 100644 index 00000000..da256d13 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_chest.png differ diff --git a/libs/textures/items/fantasy/atlarus_dust.png b/libs/textures/items/fantasy/atlarus_dust.png new file mode 100644 index 00000000..e18e41d8 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_dust.png differ diff --git a/libs/textures/items/fantasy/atlarus_helmet.png b/libs/textures/items/fantasy/atlarus_helmet.png new file mode 100644 index 00000000..13b226f1 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_helmet.png differ diff --git a/libs/textures/items/fantasy/atlarus_hoe.png b/libs/textures/items/fantasy/atlarus_hoe.png new file mode 100644 index 00000000..87faa0b7 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_hoe.png differ diff --git a/libs/textures/items/fantasy/atlarus_ingot.png b/libs/textures/items/fantasy/atlarus_ingot.png new file mode 100644 index 00000000..ac1daa94 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_ingot.png differ diff --git a/libs/textures/items/fantasy/atlarus_legs.png b/libs/textures/items/fantasy/atlarus_legs.png new file mode 100644 index 00000000..1c0422e7 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_legs.png differ diff --git a/libs/textures/items/fantasy/atlarus_pick.png b/libs/textures/items/fantasy/atlarus_pick.png new file mode 100644 index 00000000..f3d08535 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_pick.png differ diff --git a/libs/textures/items/fantasy/atlarus_shovel.png b/libs/textures/items/fantasy/atlarus_shovel.png new file mode 100644 index 00000000..46e4f132 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_shovel.png differ diff --git a/libs/textures/items/fantasy/atlarus_sword.png b/libs/textures/items/fantasy/atlarus_sword.png new file mode 100644 index 00000000..062bf6b4 Binary files /dev/null and b/libs/textures/items/fantasy/atlarus_sword.png differ diff --git a/libs/textures/items/fantasy/black_steel_axe.png b/libs/textures/items/fantasy/black_steel_axe.png new file mode 100644 index 00000000..ab968cfc Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_axe.png differ diff --git a/libs/textures/items/fantasy/black_steel_boots.png b/libs/textures/items/fantasy/black_steel_boots.png new file mode 100644 index 00000000..01611b9e Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_boots.png differ diff --git a/libs/textures/items/fantasy/black_steel_bucket_fill.png b/libs/textures/items/fantasy/black_steel_bucket_fill.png new file mode 100644 index 00000000..a505565a Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/black_steel_chest.png b/libs/textures/items/fantasy/black_steel_chest.png new file mode 100644 index 00000000..f8b861cf Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_chest.png differ diff --git a/libs/textures/items/fantasy/black_steel_dust.png b/libs/textures/items/fantasy/black_steel_dust.png new file mode 100644 index 00000000..83d257b0 Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_dust.png differ diff --git a/libs/textures/items/fantasy/black_steel_helmet.png b/libs/textures/items/fantasy/black_steel_helmet.png new file mode 100644 index 00000000..9549a3e7 Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_helmet.png differ diff --git a/libs/textures/items/fantasy/black_steel_hoe.png b/libs/textures/items/fantasy/black_steel_hoe.png new file mode 100644 index 00000000..6e792993 Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_hoe.png differ diff --git a/libs/textures/items/fantasy/black_steel_ingot.png b/libs/textures/items/fantasy/black_steel_ingot.png new file mode 100644 index 00000000..5cdab56e Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_ingot.png differ diff --git a/libs/textures/items/fantasy/black_steel_legs.png b/libs/textures/items/fantasy/black_steel_legs.png new file mode 100644 index 00000000..8b03f0d0 Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_legs.png differ diff --git a/libs/textures/items/fantasy/black_steel_pick.png b/libs/textures/items/fantasy/black_steel_pick.png new file mode 100644 index 00000000..81eeb0f5 Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_pick.png differ diff --git a/libs/textures/items/fantasy/black_steel_shovel.png b/libs/textures/items/fantasy/black_steel_shovel.png new file mode 100644 index 00000000..98a23b47 Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_shovel.png differ diff --git a/libs/textures/items/fantasy/black_steel_sword.png b/libs/textures/items/fantasy/black_steel_sword.png new file mode 100644 index 00000000..ee64cc44 Binary files /dev/null and b/libs/textures/items/fantasy/black_steel_sword.png differ diff --git a/libs/textures/items/fantasy/carmot_axe.png b/libs/textures/items/fantasy/carmot_axe.png new file mode 100644 index 00000000..eb3fe567 Binary files /dev/null and b/libs/textures/items/fantasy/carmot_axe.png differ diff --git a/libs/textures/items/fantasy/carmot_boots.png b/libs/textures/items/fantasy/carmot_boots.png new file mode 100644 index 00000000..35e9c253 Binary files /dev/null and b/libs/textures/items/fantasy/carmot_boots.png differ diff --git a/libs/textures/items/fantasy/carmot_bucket_fill.png b/libs/textures/items/fantasy/carmot_bucket_fill.png new file mode 100644 index 00000000..0bb75ca9 Binary files /dev/null and b/libs/textures/items/fantasy/carmot_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/carmot_chest.png b/libs/textures/items/fantasy/carmot_chest.png new file mode 100644 index 00000000..4d096b05 Binary files /dev/null and b/libs/textures/items/fantasy/carmot_chest.png differ diff --git a/libs/textures/items/fantasy/carmot_dust.png b/libs/textures/items/fantasy/carmot_dust.png new file mode 100644 index 00000000..5a4e3d4c Binary files /dev/null and b/libs/textures/items/fantasy/carmot_dust.png differ diff --git a/libs/textures/items/fantasy/carmot_helmet.png b/libs/textures/items/fantasy/carmot_helmet.png new file mode 100644 index 00000000..813056ab Binary files /dev/null and b/libs/textures/items/fantasy/carmot_helmet.png differ diff --git a/libs/textures/items/fantasy/carmot_hoe.png b/libs/textures/items/fantasy/carmot_hoe.png new file mode 100644 index 00000000..ff1468ab Binary files /dev/null and b/libs/textures/items/fantasy/carmot_hoe.png differ diff --git a/libs/textures/items/fantasy/carmot_ingot.png b/libs/textures/items/fantasy/carmot_ingot.png new file mode 100644 index 00000000..119085b5 Binary files /dev/null and b/libs/textures/items/fantasy/carmot_ingot.png differ diff --git a/libs/textures/items/fantasy/carmot_legs.png b/libs/textures/items/fantasy/carmot_legs.png new file mode 100644 index 00000000..cc7b457d Binary files /dev/null and b/libs/textures/items/fantasy/carmot_legs.png differ diff --git a/libs/textures/items/fantasy/carmot_pick.png b/libs/textures/items/fantasy/carmot_pick.png new file mode 100644 index 00000000..1581df42 Binary files /dev/null and b/libs/textures/items/fantasy/carmot_pick.png differ diff --git a/libs/textures/items/fantasy/carmot_shovel.png b/libs/textures/items/fantasy/carmot_shovel.png new file mode 100644 index 00000000..88d2d5a1 Binary files /dev/null and b/libs/textures/items/fantasy/carmot_shovel.png differ diff --git a/libs/textures/items/fantasy/carmot_sword.png b/libs/textures/items/fantasy/carmot_sword.png new file mode 100644 index 00000000..ab7eb110 Binary files /dev/null and b/libs/textures/items/fantasy/carmot_sword.png differ diff --git a/libs/textures/items/fantasy/celenegil_axe.png b/libs/textures/items/fantasy/celenegil_axe.png new file mode 100644 index 00000000..a24eb466 Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_axe.png differ diff --git a/libs/textures/items/fantasy/celenegil_boots.png b/libs/textures/items/fantasy/celenegil_boots.png new file mode 100644 index 00000000..6fe066ee Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_boots.png differ diff --git a/libs/textures/items/fantasy/celenegil_bucket_fill.png b/libs/textures/items/fantasy/celenegil_bucket_fill.png new file mode 100644 index 00000000..1b8dc0e5 Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/celenegil_chest.png b/libs/textures/items/fantasy/celenegil_chest.png new file mode 100644 index 00000000..93062a43 Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_chest.png differ diff --git a/libs/textures/items/fantasy/celenegil_dust.png b/libs/textures/items/fantasy/celenegil_dust.png new file mode 100644 index 00000000..17f13f8a Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_dust.png differ diff --git a/libs/textures/items/fantasy/celenegil_helmet.png b/libs/textures/items/fantasy/celenegil_helmet.png new file mode 100644 index 00000000..c27a5222 Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_helmet.png differ diff --git a/libs/textures/items/fantasy/celenegil_hoe.png b/libs/textures/items/fantasy/celenegil_hoe.png new file mode 100644 index 00000000..a84730f3 Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_hoe.png differ diff --git a/libs/textures/items/fantasy/celenegil_ingot.png b/libs/textures/items/fantasy/celenegil_ingot.png new file mode 100644 index 00000000..15287f61 Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_ingot.png differ diff --git a/libs/textures/items/fantasy/celenegil_legs.png b/libs/textures/items/fantasy/celenegil_legs.png new file mode 100644 index 00000000..644f8fc7 Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_legs.png differ diff --git a/libs/textures/items/fantasy/celenegil_pick.png b/libs/textures/items/fantasy/celenegil_pick.png new file mode 100644 index 00000000..859077ac Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_pick.png differ diff --git a/libs/textures/items/fantasy/celenegil_shovel.png b/libs/textures/items/fantasy/celenegil_shovel.png new file mode 100644 index 00000000..4f20d5ad Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_shovel.png differ diff --git a/libs/textures/items/fantasy/celenegil_sword.png b/libs/textures/items/fantasy/celenegil_sword.png new file mode 100644 index 00000000..06d2fd21 Binary files /dev/null and b/libs/textures/items/fantasy/celenegil_sword.png differ diff --git a/libs/textures/items/fantasy/deep_iron_axe.png b/libs/textures/items/fantasy/deep_iron_axe.png new file mode 100644 index 00000000..4717d99f Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_axe.png differ diff --git a/libs/textures/items/fantasy/deep_iron_boots.png b/libs/textures/items/fantasy/deep_iron_boots.png new file mode 100644 index 00000000..7d502053 Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_boots.png differ diff --git a/libs/textures/items/fantasy/deep_iron_bucket_fill.png b/libs/textures/items/fantasy/deep_iron_bucket_fill.png new file mode 100644 index 00000000..b6e4e44e Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/deep_iron_chest.png b/libs/textures/items/fantasy/deep_iron_chest.png new file mode 100644 index 00000000..1ccd837d Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_chest.png differ diff --git a/libs/textures/items/fantasy/deep_iron_dust.png b/libs/textures/items/fantasy/deep_iron_dust.png new file mode 100644 index 00000000..35deb020 Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_dust.png differ diff --git a/libs/textures/items/fantasy/deep_iron_helmet.png b/libs/textures/items/fantasy/deep_iron_helmet.png new file mode 100644 index 00000000..10d5ba6d Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_helmet.png differ diff --git a/libs/textures/items/fantasy/deep_iron_hoe.png b/libs/textures/items/fantasy/deep_iron_hoe.png new file mode 100644 index 00000000..9e52eda8 Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_hoe.png differ diff --git a/libs/textures/items/fantasy/deep_iron_ingot.png b/libs/textures/items/fantasy/deep_iron_ingot.png new file mode 100644 index 00000000..43bb4a43 Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_ingot.png differ diff --git a/libs/textures/items/fantasy/deep_iron_legs.png b/libs/textures/items/fantasy/deep_iron_legs.png new file mode 100644 index 00000000..5b30ddd6 Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_legs.png differ diff --git a/libs/textures/items/fantasy/deep_iron_pick.png b/libs/textures/items/fantasy/deep_iron_pick.png new file mode 100644 index 00000000..f8340f76 Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_pick.png differ diff --git a/libs/textures/items/fantasy/deep_iron_shovel.png b/libs/textures/items/fantasy/deep_iron_shovel.png new file mode 100644 index 00000000..dabbadc2 Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_shovel.png differ diff --git a/libs/textures/items/fantasy/deep_iron_sword.png b/libs/textures/items/fantasy/deep_iron_sword.png new file mode 100644 index 00000000..db9d3839 Binary files /dev/null and b/libs/textures/items/fantasy/deep_iron_sword.png differ diff --git a/libs/textures/items/fantasy/haderoth_axe.png b/libs/textures/items/fantasy/haderoth_axe.png new file mode 100644 index 00000000..b9e0701b Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_axe.png differ diff --git a/libs/textures/items/fantasy/haderoth_boots.png b/libs/textures/items/fantasy/haderoth_boots.png new file mode 100644 index 00000000..b37ba6b5 Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_boots.png differ diff --git a/libs/textures/items/fantasy/haderoth_bucket_fill.png b/libs/textures/items/fantasy/haderoth_bucket_fill.png new file mode 100644 index 00000000..35b446a6 Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/haderoth_chest.png b/libs/textures/items/fantasy/haderoth_chest.png new file mode 100644 index 00000000..35b16abe Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_chest.png differ diff --git a/libs/textures/items/fantasy/haderoth_dust.png b/libs/textures/items/fantasy/haderoth_dust.png new file mode 100644 index 00000000..0295de98 Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_dust.png differ diff --git a/libs/textures/items/fantasy/haderoth_helmet.png b/libs/textures/items/fantasy/haderoth_helmet.png new file mode 100644 index 00000000..98e08b5c Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_helmet.png differ diff --git a/libs/textures/items/fantasy/haderoth_hoe.png b/libs/textures/items/fantasy/haderoth_hoe.png new file mode 100644 index 00000000..25c87cd7 Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_hoe.png differ diff --git a/libs/textures/items/fantasy/haderoth_ingot.png b/libs/textures/items/fantasy/haderoth_ingot.png new file mode 100644 index 00000000..e83b12d0 Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_ingot.png differ diff --git a/libs/textures/items/fantasy/haderoth_legs.png b/libs/textures/items/fantasy/haderoth_legs.png new file mode 100644 index 00000000..f6fc7fd1 Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_legs.png differ diff --git a/libs/textures/items/fantasy/haderoth_pick.png b/libs/textures/items/fantasy/haderoth_pick.png new file mode 100644 index 00000000..c8e02304 Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_pick.png differ diff --git a/libs/textures/items/fantasy/haderoth_shovel.png b/libs/textures/items/fantasy/haderoth_shovel.png new file mode 100644 index 00000000..22250062 Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_shovel.png differ diff --git a/libs/textures/items/fantasy/haderoth_sword.png b/libs/textures/items/fantasy/haderoth_sword.png new file mode 100644 index 00000000..23197b6f Binary files /dev/null and b/libs/textures/items/fantasy/haderoth_sword.png differ diff --git a/libs/textures/items/fantasy/infuscolium_bucket_fill.png b/libs/textures/items/fantasy/infuscolium_bucket_fill.png new file mode 100644 index 00000000..f920e05c Binary files /dev/null and b/libs/textures/items/fantasy/infuscolium_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/infuscolium_dust.png b/libs/textures/items/fantasy/infuscolium_dust.png new file mode 100644 index 00000000..a2e2d952 Binary files /dev/null and b/libs/textures/items/fantasy/infuscolium_dust.png differ diff --git a/libs/textures/items/fantasy/infuscolium_ingot.png b/libs/textures/items/fantasy/infuscolium_ingot.png new file mode 100644 index 00000000..7d268ef9 Binary files /dev/null and b/libs/textures/items/fantasy/infuscolium_ingot.png differ diff --git a/libs/textures/items/fantasy/mithril_axe.png b/libs/textures/items/fantasy/mithril_axe.png new file mode 100644 index 00000000..bd013980 Binary files /dev/null and b/libs/textures/items/fantasy/mithril_axe.png differ diff --git a/libs/textures/items/fantasy/mithril_boots.png b/libs/textures/items/fantasy/mithril_boots.png new file mode 100644 index 00000000..d1e35dc4 Binary files /dev/null and b/libs/textures/items/fantasy/mithril_boots.png differ diff --git a/libs/textures/items/fantasy/mithril_bucket_fill.png b/libs/textures/items/fantasy/mithril_bucket_fill.png new file mode 100644 index 00000000..de48b32a Binary files /dev/null and b/libs/textures/items/fantasy/mithril_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/mithril_chest.png b/libs/textures/items/fantasy/mithril_chest.png new file mode 100644 index 00000000..5c0cad3b Binary files /dev/null and b/libs/textures/items/fantasy/mithril_chest.png differ diff --git a/libs/textures/items/fantasy/mithril_dust.png b/libs/textures/items/fantasy/mithril_dust.png new file mode 100644 index 00000000..b67d81cb Binary files /dev/null and b/libs/textures/items/fantasy/mithril_dust.png differ diff --git a/libs/textures/items/fantasy/mithril_helmet.png b/libs/textures/items/fantasy/mithril_helmet.png new file mode 100644 index 00000000..1fc0eac2 Binary files /dev/null and b/libs/textures/items/fantasy/mithril_helmet.png differ diff --git a/libs/textures/items/fantasy/mithril_hoe.png b/libs/textures/items/fantasy/mithril_hoe.png new file mode 100644 index 00000000..e33400e4 Binary files /dev/null and b/libs/textures/items/fantasy/mithril_hoe.png differ diff --git a/libs/textures/items/fantasy/mithril_ingot.png b/libs/textures/items/fantasy/mithril_ingot.png new file mode 100644 index 00000000..8f52374b Binary files /dev/null and b/libs/textures/items/fantasy/mithril_ingot.png differ diff --git a/libs/textures/items/fantasy/mithril_legs.png b/libs/textures/items/fantasy/mithril_legs.png new file mode 100644 index 00000000..15ea2e77 Binary files /dev/null and b/libs/textures/items/fantasy/mithril_legs.png differ diff --git a/libs/textures/items/fantasy/mithril_pick.png b/libs/textures/items/fantasy/mithril_pick.png new file mode 100644 index 00000000..78ce5f3c Binary files /dev/null and b/libs/textures/items/fantasy/mithril_pick.png differ diff --git a/libs/textures/items/fantasy/mithril_shovel.png b/libs/textures/items/fantasy/mithril_shovel.png new file mode 100644 index 00000000..cafd4df9 Binary files /dev/null and b/libs/textures/items/fantasy/mithril_shovel.png differ diff --git a/libs/textures/items/fantasy/mithril_sword.png b/libs/textures/items/fantasy/mithril_sword.png new file mode 100644 index 00000000..059e16e6 Binary files /dev/null and b/libs/textures/items/fantasy/mithril_sword.png differ diff --git a/libs/textures/items/fantasy/orichalcum_axe.png b/libs/textures/items/fantasy/orichalcum_axe.png new file mode 100644 index 00000000..309c2043 Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_axe.png differ diff --git a/libs/textures/items/fantasy/orichalcum_boots.png b/libs/textures/items/fantasy/orichalcum_boots.png new file mode 100644 index 00000000..c6e98bc5 Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_boots.png differ diff --git a/libs/textures/items/fantasy/orichalcum_bucket_fill.png b/libs/textures/items/fantasy/orichalcum_bucket_fill.png new file mode 100644 index 00000000..e9c7203e Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/orichalcum_chest.png b/libs/textures/items/fantasy/orichalcum_chest.png new file mode 100644 index 00000000..1012aba5 Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_chest.png differ diff --git a/libs/textures/items/fantasy/orichalcum_dust.png b/libs/textures/items/fantasy/orichalcum_dust.png new file mode 100644 index 00000000..10b1828b Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_dust.png differ diff --git a/libs/textures/items/fantasy/orichalcum_helmet.png b/libs/textures/items/fantasy/orichalcum_helmet.png new file mode 100644 index 00000000..d0a5384a Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_helmet.png differ diff --git a/libs/textures/items/fantasy/orichalcum_hoe.png b/libs/textures/items/fantasy/orichalcum_hoe.png new file mode 100644 index 00000000..16524358 Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_hoe.png differ diff --git a/libs/textures/items/fantasy/orichalcum_ingot.png b/libs/textures/items/fantasy/orichalcum_ingot.png new file mode 100644 index 00000000..6996cb39 Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_ingot.png differ diff --git a/libs/textures/items/fantasy/orichalcum_legs.png b/libs/textures/items/fantasy/orichalcum_legs.png new file mode 100644 index 00000000..b8a487ff Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_legs.png differ diff --git a/libs/textures/items/fantasy/orichalcum_pick.png b/libs/textures/items/fantasy/orichalcum_pick.png new file mode 100644 index 00000000..ad29293f Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_pick.png differ diff --git a/libs/textures/items/fantasy/orichalcum_shovel.png b/libs/textures/items/fantasy/orichalcum_shovel.png new file mode 100644 index 00000000..636296eb Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_shovel.png differ diff --git a/libs/textures/items/fantasy/orichalcum_sword.png b/libs/textures/items/fantasy/orichalcum_sword.png new file mode 100644 index 00000000..ae6b4da7 Binary files /dev/null and b/libs/textures/items/fantasy/orichalcum_sword.png differ diff --git a/libs/textures/items/fantasy/oureclase_axe.png b/libs/textures/items/fantasy/oureclase_axe.png new file mode 100644 index 00000000..3a54efa3 Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_axe.png differ diff --git a/libs/textures/items/fantasy/oureclase_boots.png b/libs/textures/items/fantasy/oureclase_boots.png new file mode 100644 index 00000000..c99f1745 Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_boots.png differ diff --git a/libs/textures/items/fantasy/oureclase_bucket_fill.png b/libs/textures/items/fantasy/oureclase_bucket_fill.png new file mode 100644 index 00000000..778a80c0 Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/oureclase_chest.png b/libs/textures/items/fantasy/oureclase_chest.png new file mode 100644 index 00000000..4549a5b4 Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_chest.png differ diff --git a/libs/textures/items/fantasy/oureclase_dust.png b/libs/textures/items/fantasy/oureclase_dust.png new file mode 100644 index 00000000..4a2be18b Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_dust.png differ diff --git a/libs/textures/items/fantasy/oureclase_helmet.png b/libs/textures/items/fantasy/oureclase_helmet.png new file mode 100644 index 00000000..6b9f2c53 Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_helmet.png differ diff --git a/libs/textures/items/fantasy/oureclase_hoe.png b/libs/textures/items/fantasy/oureclase_hoe.png new file mode 100644 index 00000000..0fee3024 Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_hoe.png differ diff --git a/libs/textures/items/fantasy/oureclase_ingot.png b/libs/textures/items/fantasy/oureclase_ingot.png new file mode 100644 index 00000000..37f334ac Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_ingot.png differ diff --git a/libs/textures/items/fantasy/oureclase_legs.png b/libs/textures/items/fantasy/oureclase_legs.png new file mode 100644 index 00000000..c6d1cd8a Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_legs.png differ diff --git a/libs/textures/items/fantasy/oureclase_pick.png b/libs/textures/items/fantasy/oureclase_pick.png new file mode 100644 index 00000000..852f777c Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_pick.png differ diff --git a/libs/textures/items/fantasy/oureclase_shovel.png b/libs/textures/items/fantasy/oureclase_shovel.png new file mode 100644 index 00000000..3c295f6a Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_shovel.png differ diff --git a/libs/textures/items/fantasy/oureclase_sword.png b/libs/textures/items/fantasy/oureclase_sword.png new file mode 100644 index 00000000..7c1c490c Binary files /dev/null and b/libs/textures/items/fantasy/oureclase_sword.png differ diff --git a/libs/textures/items/fantasy/prometheum_axe.png b/libs/textures/items/fantasy/prometheum_axe.png new file mode 100644 index 00000000..a4a748d7 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_axe.png differ diff --git a/libs/textures/items/fantasy/prometheum_boots.png b/libs/textures/items/fantasy/prometheum_boots.png new file mode 100644 index 00000000..257129f0 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_boots.png differ diff --git a/libs/textures/items/fantasy/prometheum_bucket_fill.png b/libs/textures/items/fantasy/prometheum_bucket_fill.png new file mode 100644 index 00000000..b3110a69 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/prometheum_chest.png b/libs/textures/items/fantasy/prometheum_chest.png new file mode 100644 index 00000000..f5a0d744 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_chest.png differ diff --git a/libs/textures/items/fantasy/prometheum_dust.png b/libs/textures/items/fantasy/prometheum_dust.png new file mode 100644 index 00000000..9417f5e7 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_dust.png differ diff --git a/libs/textures/items/fantasy/prometheum_helmet.png b/libs/textures/items/fantasy/prometheum_helmet.png new file mode 100644 index 00000000..df0d21ec Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_helmet.png differ diff --git a/libs/textures/items/fantasy/prometheum_hoe.png b/libs/textures/items/fantasy/prometheum_hoe.png new file mode 100644 index 00000000..27d5d208 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_hoe.png differ diff --git a/libs/textures/items/fantasy/prometheum_ingot.png b/libs/textures/items/fantasy/prometheum_ingot.png new file mode 100644 index 00000000..acc5c79e Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_ingot.png differ diff --git a/libs/textures/items/fantasy/prometheum_legs.png b/libs/textures/items/fantasy/prometheum_legs.png new file mode 100644 index 00000000..206f8e57 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_legs.png differ diff --git a/libs/textures/items/fantasy/prometheum_pick.png b/libs/textures/items/fantasy/prometheum_pick.png new file mode 100644 index 00000000..f48b2d21 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_pick.png differ diff --git a/libs/textures/items/fantasy/prometheum_shovel.png b/libs/textures/items/fantasy/prometheum_shovel.png new file mode 100644 index 00000000..fcd09046 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_shovel.png differ diff --git a/libs/textures/items/fantasy/prometheum_sword.png b/libs/textures/items/fantasy/prometheum_sword.png new file mode 100644 index 00000000..8d595430 Binary files /dev/null and b/libs/textures/items/fantasy/prometheum_sword.png differ diff --git a/libs/textures/items/fantasy/quicksilver_axe.png b/libs/textures/items/fantasy/quicksilver_axe.png new file mode 100644 index 00000000..a13594a5 Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_axe.png differ diff --git a/libs/textures/items/fantasy/quicksilver_boots.png b/libs/textures/items/fantasy/quicksilver_boots.png new file mode 100644 index 00000000..79abf0e2 Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_boots.png differ diff --git a/libs/textures/items/fantasy/quicksilver_bucket_fill.png b/libs/textures/items/fantasy/quicksilver_bucket_fill.png new file mode 100644 index 00000000..26261417 Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/quicksilver_chest.png b/libs/textures/items/fantasy/quicksilver_chest.png new file mode 100644 index 00000000..98815946 Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_chest.png differ diff --git a/libs/textures/items/fantasy/quicksilver_dust.png b/libs/textures/items/fantasy/quicksilver_dust.png new file mode 100644 index 00000000..0a665f3f Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_dust.png differ diff --git a/libs/textures/items/fantasy/quicksilver_helmet.png b/libs/textures/items/fantasy/quicksilver_helmet.png new file mode 100644 index 00000000..2fbaf7fc Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_helmet.png differ diff --git a/libs/textures/items/fantasy/quicksilver_hoe.png b/libs/textures/items/fantasy/quicksilver_hoe.png new file mode 100644 index 00000000..8769d615 Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_hoe.png differ diff --git a/libs/textures/items/fantasy/quicksilver_ingot.png b/libs/textures/items/fantasy/quicksilver_ingot.png new file mode 100644 index 00000000..0fee7e30 Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_ingot.png differ diff --git a/libs/textures/items/fantasy/quicksilver_legs.png b/libs/textures/items/fantasy/quicksilver_legs.png new file mode 100644 index 00000000..653915e8 Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_legs.png differ diff --git a/libs/textures/items/fantasy/quicksilver_pick.png b/libs/textures/items/fantasy/quicksilver_pick.png new file mode 100644 index 00000000..7c95e368 Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_pick.png differ diff --git a/libs/textures/items/fantasy/quicksilver_shovel.png b/libs/textures/items/fantasy/quicksilver_shovel.png new file mode 100644 index 00000000..01c3c978 Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_shovel.png differ diff --git a/libs/textures/items/fantasy/quicksilver_sword.png b/libs/textures/items/fantasy/quicksilver_sword.png new file mode 100644 index 00000000..e60dbbfe Binary files /dev/null and b/libs/textures/items/fantasy/quicksilver_sword.png differ diff --git a/libs/textures/items/fantasy/rubracium_bucket_fill.png b/libs/textures/items/fantasy/rubracium_bucket_fill.png new file mode 100644 index 00000000..b17d5c8b Binary files /dev/null and b/libs/textures/items/fantasy/rubracium_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/rubracium_dust.png b/libs/textures/items/fantasy/rubracium_dust.png new file mode 100644 index 00000000..6f6a925b Binary files /dev/null and b/libs/textures/items/fantasy/rubracium_dust.png differ diff --git a/libs/textures/items/fantasy/rubracium_ingot.png b/libs/textures/items/fantasy/rubracium_ingot.png new file mode 100644 index 00000000..99987347 Binary files /dev/null and b/libs/textures/items/fantasy/rubracium_ingot.png differ diff --git a/libs/textures/items/fantasy/tartarite_axe.png b/libs/textures/items/fantasy/tartarite_axe.png new file mode 100644 index 00000000..c5a33183 Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_axe.png differ diff --git a/libs/textures/items/fantasy/tartarite_boots.png b/libs/textures/items/fantasy/tartarite_boots.png new file mode 100644 index 00000000..7d3faefb Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_boots.png differ diff --git a/libs/textures/items/fantasy/tartarite_bucket_fill.png b/libs/textures/items/fantasy/tartarite_bucket_fill.png new file mode 100644 index 00000000..5dbdc80d Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_bucket_fill.png differ diff --git a/libs/textures/items/fantasy/tartarite_chest.png b/libs/textures/items/fantasy/tartarite_chest.png new file mode 100644 index 00000000..d16433c3 Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_chest.png differ diff --git a/libs/textures/items/fantasy/tartarite_dust.png b/libs/textures/items/fantasy/tartarite_dust.png new file mode 100644 index 00000000..74c69c59 Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_dust.png differ diff --git a/libs/textures/items/fantasy/tartarite_helmet.png b/libs/textures/items/fantasy/tartarite_helmet.png new file mode 100644 index 00000000..b4e31968 Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_helmet.png differ diff --git a/libs/textures/items/fantasy/tartarite_hoe.png b/libs/textures/items/fantasy/tartarite_hoe.png new file mode 100644 index 00000000..bd50894b Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_hoe.png differ diff --git a/libs/textures/items/fantasy/tartarite_ingot.png b/libs/textures/items/fantasy/tartarite_ingot.png new file mode 100644 index 00000000..287a3fd1 Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_ingot.png differ diff --git a/libs/textures/items/fantasy/tartarite_legs.png b/libs/textures/items/fantasy/tartarite_legs.png new file mode 100644 index 00000000..544a9d36 Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_legs.png differ diff --git a/libs/textures/items/fantasy/tartarite_pick.png b/libs/textures/items/fantasy/tartarite_pick.png new file mode 100644 index 00000000..df2c199d Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_pick.png differ diff --git a/libs/textures/items/fantasy/tartarite_shovel.png b/libs/textures/items/fantasy/tartarite_shovel.png new file mode 100644 index 00000000..519b22e9 Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_shovel.png differ diff --git a/libs/textures/items/fantasy/tartarite_sword.png b/libs/textures/items/fantasy/tartarite_sword.png new file mode 100644 index 00000000..9a35809a Binary files /dev/null and b/libs/textures/items/fantasy/tartarite_sword.png differ diff --git a/libs/textures/items/metal_item_default.png b/libs/textures/items/metal_item_default.png new file mode 100644 index 00000000..a6e6768e Binary files /dev/null and b/libs/textures/items/metal_item_default.png differ diff --git a/libs/textures/items/misc/fertilizer.png b/libs/textures/items/misc/fertilizer.png new file mode 100644 index 00000000..fa14fe15 Binary files /dev/null and b/libs/textures/items/misc/fertilizer.png differ diff --git a/libs/textures/items/misc/tar.png b/libs/textures/items/misc/tar.png new file mode 100644 index 00000000..68fb2e09 Binary files /dev/null and b/libs/textures/items/misc/tar.png differ diff --git a/libs/textures/items/nether/alduorite_bucket_fill.png b/libs/textures/items/nether/alduorite_bucket_fill.png new file mode 100644 index 00000000..0302e29a Binary files /dev/null and b/libs/textures/items/nether/alduorite_bucket_fill.png differ diff --git a/libs/textures/items/nether/alduorite_dust.png b/libs/textures/items/nether/alduorite_dust.png new file mode 100644 index 00000000..54c96dbf Binary files /dev/null and b/libs/textures/items/nether/alduorite_dust.png differ diff --git a/libs/textures/items/nether/alduorite_ingot.png b/libs/textures/items/nether/alduorite_ingot.png new file mode 100644 index 00000000..e0f2a0be Binary files /dev/null and b/libs/textures/items/nether/alduorite_ingot.png differ diff --git a/libs/textures/items/nether/amordrine_axe.png b/libs/textures/items/nether/amordrine_axe.png new file mode 100644 index 00000000..46ef7a46 Binary files /dev/null and b/libs/textures/items/nether/amordrine_axe.png differ diff --git a/libs/textures/items/nether/amordrine_boots.png b/libs/textures/items/nether/amordrine_boots.png new file mode 100644 index 00000000..9bed9804 Binary files /dev/null and b/libs/textures/items/nether/amordrine_boots.png differ diff --git a/libs/textures/items/nether/amordrine_bucket_fill.png b/libs/textures/items/nether/amordrine_bucket_fill.png new file mode 100644 index 00000000..b1d90f36 Binary files /dev/null and b/libs/textures/items/nether/amordrine_bucket_fill.png differ diff --git a/libs/textures/items/nether/amordrine_chest.png b/libs/textures/items/nether/amordrine_chest.png new file mode 100644 index 00000000..6877f7ae Binary files /dev/null and b/libs/textures/items/nether/amordrine_chest.png differ diff --git a/libs/textures/items/nether/amordrine_dust.png b/libs/textures/items/nether/amordrine_dust.png new file mode 100644 index 00000000..f441b495 Binary files /dev/null and b/libs/textures/items/nether/amordrine_dust.png differ diff --git a/libs/textures/items/nether/amordrine_helmet.png b/libs/textures/items/nether/amordrine_helmet.png new file mode 100644 index 00000000..7e268e85 Binary files /dev/null and b/libs/textures/items/nether/amordrine_helmet.png differ diff --git a/libs/textures/items/nether/amordrine_hoe.png b/libs/textures/items/nether/amordrine_hoe.png new file mode 100644 index 00000000..65c20f7d Binary files /dev/null and b/libs/textures/items/nether/amordrine_hoe.png differ diff --git a/libs/textures/items/nether/amordrine_ingot.png b/libs/textures/items/nether/amordrine_ingot.png new file mode 100644 index 00000000..6bd60d98 Binary files /dev/null and b/libs/textures/items/nether/amordrine_ingot.png differ diff --git a/libs/textures/items/nether/amordrine_legs.png b/libs/textures/items/nether/amordrine_legs.png new file mode 100644 index 00000000..90c61ec8 Binary files /dev/null and b/libs/textures/items/nether/amordrine_legs.png differ diff --git a/libs/textures/items/nether/amordrine_pick.png b/libs/textures/items/nether/amordrine_pick.png new file mode 100644 index 00000000..13b89ee9 Binary files /dev/null and b/libs/textures/items/nether/amordrine_pick.png differ diff --git a/libs/textures/items/nether/amordrine_shovel.png b/libs/textures/items/nether/amordrine_shovel.png new file mode 100644 index 00000000..80e03fcc Binary files /dev/null and b/libs/textures/items/nether/amordrine_shovel.png differ diff --git a/libs/textures/items/nether/amordrine_sword.png b/libs/textures/items/nether/amordrine_sword.png new file mode 100644 index 00000000..100fa6df Binary files /dev/null and b/libs/textures/items/nether/amordrine_sword.png differ diff --git a/libs/textures/items/nether/ceruclase_axe.png b/libs/textures/items/nether/ceruclase_axe.png new file mode 100644 index 00000000..8d01817c Binary files /dev/null and b/libs/textures/items/nether/ceruclase_axe.png differ diff --git a/libs/textures/items/nether/ceruclase_boots.png b/libs/textures/items/nether/ceruclase_boots.png new file mode 100644 index 00000000..430dd935 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_boots.png differ diff --git a/libs/textures/items/nether/ceruclase_bucket_fill.png b/libs/textures/items/nether/ceruclase_bucket_fill.png new file mode 100644 index 00000000..a74f85d7 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_bucket_fill.png differ diff --git a/libs/textures/items/nether/ceruclase_chest.png b/libs/textures/items/nether/ceruclase_chest.png new file mode 100644 index 00000000..72990e84 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_chest.png differ diff --git a/libs/textures/items/nether/ceruclase_dust.png b/libs/textures/items/nether/ceruclase_dust.png new file mode 100644 index 00000000..683ff2d0 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_dust.png differ diff --git a/libs/textures/items/nether/ceruclase_helmet.png b/libs/textures/items/nether/ceruclase_helmet.png new file mode 100644 index 00000000..724eea47 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_helmet.png differ diff --git a/libs/textures/items/nether/ceruclase_hoe.png b/libs/textures/items/nether/ceruclase_hoe.png new file mode 100644 index 00000000..e0bf6e47 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_hoe.png differ diff --git a/libs/textures/items/nether/ceruclase_ingot.png b/libs/textures/items/nether/ceruclase_ingot.png new file mode 100644 index 00000000..5278668f Binary files /dev/null and b/libs/textures/items/nether/ceruclase_ingot.png differ diff --git a/libs/textures/items/nether/ceruclase_legs.png b/libs/textures/items/nether/ceruclase_legs.png new file mode 100644 index 00000000..103486d9 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_legs.png differ diff --git a/libs/textures/items/nether/ceruclase_pick.png b/libs/textures/items/nether/ceruclase_pick.png new file mode 100644 index 00000000..6ac08233 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_pick.png differ diff --git a/libs/textures/items/nether/ceruclase_shovel.png b/libs/textures/items/nether/ceruclase_shovel.png new file mode 100644 index 00000000..42df7912 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_shovel.png differ diff --git a/libs/textures/items/nether/ceruclase_sword.png b/libs/textures/items/nether/ceruclase_sword.png new file mode 100644 index 00000000..0be685b2 Binary files /dev/null and b/libs/textures/items/nether/ceruclase_sword.png differ diff --git a/libs/textures/items/nether/ignatius_axe.png b/libs/textures/items/nether/ignatius_axe.png new file mode 100644 index 00000000..4a5df5c7 Binary files /dev/null and b/libs/textures/items/nether/ignatius_axe.png differ diff --git a/libs/textures/items/nether/ignatius_boots.png b/libs/textures/items/nether/ignatius_boots.png new file mode 100644 index 00000000..64b8890b Binary files /dev/null and b/libs/textures/items/nether/ignatius_boots.png differ diff --git a/libs/textures/items/nether/ignatius_bucket_fill.png b/libs/textures/items/nether/ignatius_bucket_fill.png new file mode 100644 index 00000000..d4258d46 Binary files /dev/null and b/libs/textures/items/nether/ignatius_bucket_fill.png differ diff --git a/libs/textures/items/nether/ignatius_chest.png b/libs/textures/items/nether/ignatius_chest.png new file mode 100644 index 00000000..72ae2d07 Binary files /dev/null and b/libs/textures/items/nether/ignatius_chest.png differ diff --git a/libs/textures/items/nether/ignatius_dust.png b/libs/textures/items/nether/ignatius_dust.png new file mode 100644 index 00000000..0fc7aae8 Binary files /dev/null and b/libs/textures/items/nether/ignatius_dust.png differ diff --git a/libs/textures/items/nether/ignatius_helmet.png b/libs/textures/items/nether/ignatius_helmet.png new file mode 100644 index 00000000..5df30a82 Binary files /dev/null and b/libs/textures/items/nether/ignatius_helmet.png differ diff --git a/libs/textures/items/nether/ignatius_hoe.png b/libs/textures/items/nether/ignatius_hoe.png new file mode 100644 index 00000000..6e8dcfa6 Binary files /dev/null and b/libs/textures/items/nether/ignatius_hoe.png differ diff --git a/libs/textures/items/nether/ignatius_ingot.png b/libs/textures/items/nether/ignatius_ingot.png new file mode 100644 index 00000000..c3cdfb21 Binary files /dev/null and b/libs/textures/items/nether/ignatius_ingot.png differ diff --git a/libs/textures/items/nether/ignatius_legs.png b/libs/textures/items/nether/ignatius_legs.png new file mode 100644 index 00000000..29d1c6f9 Binary files /dev/null and b/libs/textures/items/nether/ignatius_legs.png differ diff --git a/libs/textures/items/nether/ignatius_pick.png b/libs/textures/items/nether/ignatius_pick.png new file mode 100644 index 00000000..b74957a6 Binary files /dev/null and b/libs/textures/items/nether/ignatius_pick.png differ diff --git a/libs/textures/items/nether/ignatius_shovel.png b/libs/textures/items/nether/ignatius_shovel.png new file mode 100644 index 00000000..3c5387b4 Binary files /dev/null and b/libs/textures/items/nether/ignatius_shovel.png differ diff --git a/libs/textures/items/nether/ignatius_sword.png b/libs/textures/items/nether/ignatius_sword.png new file mode 100644 index 00000000..a119b591 Binary files /dev/null and b/libs/textures/items/nether/ignatius_sword.png differ diff --git a/libs/textures/items/nether/inolashite_axe.png b/libs/textures/items/nether/inolashite_axe.png new file mode 100644 index 00000000..e3dd24f6 Binary files /dev/null and b/libs/textures/items/nether/inolashite_axe.png differ diff --git a/libs/textures/items/nether/inolashite_boots.png b/libs/textures/items/nether/inolashite_boots.png new file mode 100644 index 00000000..309fb66d Binary files /dev/null and b/libs/textures/items/nether/inolashite_boots.png differ diff --git a/libs/textures/items/nether/inolashite_bucket_fill.png b/libs/textures/items/nether/inolashite_bucket_fill.png new file mode 100644 index 00000000..b0b7020e Binary files /dev/null and b/libs/textures/items/nether/inolashite_bucket_fill.png differ diff --git a/libs/textures/items/nether/inolashite_chest.png b/libs/textures/items/nether/inolashite_chest.png new file mode 100644 index 00000000..5758d860 Binary files /dev/null and b/libs/textures/items/nether/inolashite_chest.png differ diff --git a/libs/textures/items/nether/inolashite_dust.png b/libs/textures/items/nether/inolashite_dust.png new file mode 100644 index 00000000..eba62950 Binary files /dev/null and b/libs/textures/items/nether/inolashite_dust.png differ diff --git a/libs/textures/items/nether/inolashite_helmet.png b/libs/textures/items/nether/inolashite_helmet.png new file mode 100644 index 00000000..b037be57 Binary files /dev/null and b/libs/textures/items/nether/inolashite_helmet.png differ diff --git a/libs/textures/items/nether/inolashite_hoe.png b/libs/textures/items/nether/inolashite_hoe.png new file mode 100644 index 00000000..831e6eb9 Binary files /dev/null and b/libs/textures/items/nether/inolashite_hoe.png differ diff --git a/libs/textures/items/nether/inolashite_ingot.png b/libs/textures/items/nether/inolashite_ingot.png new file mode 100644 index 00000000..041ab03d Binary files /dev/null and b/libs/textures/items/nether/inolashite_ingot.png differ diff --git a/libs/textures/items/nether/inolashite_legs.png b/libs/textures/items/nether/inolashite_legs.png new file mode 100644 index 00000000..ef6d96e2 Binary files /dev/null and b/libs/textures/items/nether/inolashite_legs.png differ diff --git a/libs/textures/items/nether/inolashite_pick.png b/libs/textures/items/nether/inolashite_pick.png new file mode 100644 index 00000000..42a46006 Binary files /dev/null and b/libs/textures/items/nether/inolashite_pick.png differ diff --git a/libs/textures/items/nether/inolashite_shovel.png b/libs/textures/items/nether/inolashite_shovel.png new file mode 100644 index 00000000..0a92671a Binary files /dev/null and b/libs/textures/items/nether/inolashite_shovel.png differ diff --git a/libs/textures/items/nether/inolashite_sword.png b/libs/textures/items/nether/inolashite_sword.png new file mode 100644 index 00000000..c0a0eea9 Binary files /dev/null and b/libs/textures/items/nether/inolashite_sword.png differ diff --git a/libs/textures/items/nether/kalendrite_axe.png b/libs/textures/items/nether/kalendrite_axe.png new file mode 100644 index 00000000..f8d10470 Binary files /dev/null and b/libs/textures/items/nether/kalendrite_axe.png differ diff --git a/libs/textures/items/nether/kalendrite_boots.png b/libs/textures/items/nether/kalendrite_boots.png new file mode 100644 index 00000000..1511cb7e Binary files /dev/null and b/libs/textures/items/nether/kalendrite_boots.png differ diff --git a/libs/textures/items/nether/kalendrite_bucket_fill.png b/libs/textures/items/nether/kalendrite_bucket_fill.png new file mode 100644 index 00000000..c74dd4ee Binary files /dev/null and b/libs/textures/items/nether/kalendrite_bucket_fill.png differ diff --git a/libs/textures/items/nether/kalendrite_chest.png b/libs/textures/items/nether/kalendrite_chest.png new file mode 100644 index 00000000..a79ca547 Binary files /dev/null and b/libs/textures/items/nether/kalendrite_chest.png differ diff --git a/libs/textures/items/nether/kalendrite_dust.png b/libs/textures/items/nether/kalendrite_dust.png new file mode 100644 index 00000000..8fd76156 Binary files /dev/null and b/libs/textures/items/nether/kalendrite_dust.png differ diff --git a/libs/textures/items/nether/kalendrite_helmet.png b/libs/textures/items/nether/kalendrite_helmet.png new file mode 100644 index 00000000..622cc614 Binary files /dev/null and b/libs/textures/items/nether/kalendrite_helmet.png differ diff --git a/libs/textures/items/nether/kalendrite_hoe.png b/libs/textures/items/nether/kalendrite_hoe.png new file mode 100644 index 00000000..6c25da3d Binary files /dev/null and b/libs/textures/items/nether/kalendrite_hoe.png differ diff --git a/libs/textures/items/nether/kalendrite_ingot.png b/libs/textures/items/nether/kalendrite_ingot.png new file mode 100644 index 00000000..5364ff9d Binary files /dev/null and b/libs/textures/items/nether/kalendrite_ingot.png differ diff --git a/libs/textures/items/nether/kalendrite_legs.png b/libs/textures/items/nether/kalendrite_legs.png new file mode 100644 index 00000000..f101a531 Binary files /dev/null and b/libs/textures/items/nether/kalendrite_legs.png differ diff --git a/libs/textures/items/nether/kalendrite_pick.png b/libs/textures/items/nether/kalendrite_pick.png new file mode 100644 index 00000000..0f2b4ada Binary files /dev/null and b/libs/textures/items/nether/kalendrite_pick.png differ diff --git a/libs/textures/items/nether/kalendrite_shovel.png b/libs/textures/items/nether/kalendrite_shovel.png new file mode 100644 index 00000000..6094f09d Binary files /dev/null and b/libs/textures/items/nether/kalendrite_shovel.png differ diff --git a/libs/textures/items/nether/kalendrite_sword.png b/libs/textures/items/nether/kalendrite_sword.png new file mode 100644 index 00000000..ec9050ce Binary files /dev/null and b/libs/textures/items/nether/kalendrite_sword.png differ diff --git a/libs/textures/items/nether/lemurite_bucket_fill.png b/libs/textures/items/nether/lemurite_bucket_fill.png new file mode 100644 index 00000000..1f209664 Binary files /dev/null and b/libs/textures/items/nether/lemurite_bucket_fill.png differ diff --git a/libs/textures/items/nether/lemurite_dust.png b/libs/textures/items/nether/lemurite_dust.png new file mode 100644 index 00000000..e3addbee Binary files /dev/null and b/libs/textures/items/nether/lemurite_dust.png differ diff --git a/libs/textures/items/nether/lemurite_ingot.png b/libs/textures/items/nether/lemurite_ingot.png new file mode 100644 index 00000000..aecded4e Binary files /dev/null and b/libs/textures/items/nether/lemurite_ingot.png differ diff --git a/libs/textures/items/nether/midasium_axe.png b/libs/textures/items/nether/midasium_axe.png new file mode 100644 index 00000000..232a738f Binary files /dev/null and b/libs/textures/items/nether/midasium_axe.png differ diff --git a/libs/textures/items/nether/midasium_boots.png b/libs/textures/items/nether/midasium_boots.png new file mode 100644 index 00000000..d8969a74 Binary files /dev/null and b/libs/textures/items/nether/midasium_boots.png differ diff --git a/libs/textures/items/nether/midasium_bucket_fill.png b/libs/textures/items/nether/midasium_bucket_fill.png new file mode 100644 index 00000000..32c00a0f Binary files /dev/null and b/libs/textures/items/nether/midasium_bucket_fill.png differ diff --git a/libs/textures/items/nether/midasium_chest.png b/libs/textures/items/nether/midasium_chest.png new file mode 100644 index 00000000..3783eb79 Binary files /dev/null and b/libs/textures/items/nether/midasium_chest.png differ diff --git a/libs/textures/items/nether/midasium_dust.png b/libs/textures/items/nether/midasium_dust.png new file mode 100644 index 00000000..5f461a88 Binary files /dev/null and b/libs/textures/items/nether/midasium_dust.png differ diff --git a/libs/textures/items/nether/midasium_helmet.png b/libs/textures/items/nether/midasium_helmet.png new file mode 100644 index 00000000..e619a68a Binary files /dev/null and b/libs/textures/items/nether/midasium_helmet.png differ diff --git a/libs/textures/items/nether/midasium_hoe.png b/libs/textures/items/nether/midasium_hoe.png new file mode 100644 index 00000000..82745fbd Binary files /dev/null and b/libs/textures/items/nether/midasium_hoe.png differ diff --git a/libs/textures/items/nether/midasium_ingot.png b/libs/textures/items/nether/midasium_ingot.png new file mode 100644 index 00000000..cb765d9f Binary files /dev/null and b/libs/textures/items/nether/midasium_ingot.png differ diff --git a/libs/textures/items/nether/midasium_legs.png b/libs/textures/items/nether/midasium_legs.png new file mode 100644 index 00000000..a2037a4b Binary files /dev/null and b/libs/textures/items/nether/midasium_legs.png differ diff --git a/libs/textures/items/nether/midasium_pick.png b/libs/textures/items/nether/midasium_pick.png new file mode 100644 index 00000000..9bece978 Binary files /dev/null and b/libs/textures/items/nether/midasium_pick.png differ diff --git a/libs/textures/items/nether/midasium_shovel.png b/libs/textures/items/nether/midasium_shovel.png new file mode 100644 index 00000000..88051e53 Binary files /dev/null and b/libs/textures/items/nether/midasium_shovel.png differ diff --git a/libs/textures/items/nether/midasium_sword.png b/libs/textures/items/nether/midasium_sword.png new file mode 100644 index 00000000..0c6c3b95 Binary files /dev/null and b/libs/textures/items/nether/midasium_sword.png differ diff --git a/libs/textures/items/nether/sanguinite_axe.png b/libs/textures/items/nether/sanguinite_axe.png new file mode 100644 index 00000000..391ee5cb Binary files /dev/null and b/libs/textures/items/nether/sanguinite_axe.png differ diff --git a/libs/textures/items/nether/sanguinite_boots.png b/libs/textures/items/nether/sanguinite_boots.png new file mode 100644 index 00000000..50372439 Binary files /dev/null and b/libs/textures/items/nether/sanguinite_boots.png differ diff --git a/libs/textures/items/nether/sanguinite_bucket_fill.png b/libs/textures/items/nether/sanguinite_bucket_fill.png new file mode 100644 index 00000000..6e42e69d Binary files /dev/null and b/libs/textures/items/nether/sanguinite_bucket_fill.png differ diff --git a/libs/textures/items/nether/sanguinite_chest.png b/libs/textures/items/nether/sanguinite_chest.png new file mode 100644 index 00000000..1c0518c6 Binary files /dev/null and b/libs/textures/items/nether/sanguinite_chest.png differ diff --git a/libs/textures/items/nether/sanguinite_dust.png b/libs/textures/items/nether/sanguinite_dust.png new file mode 100644 index 00000000..cbc0d80d Binary files /dev/null and b/libs/textures/items/nether/sanguinite_dust.png differ diff --git a/libs/textures/items/nether/sanguinite_helmet.png b/libs/textures/items/nether/sanguinite_helmet.png new file mode 100644 index 00000000..bd6043d4 Binary files /dev/null and b/libs/textures/items/nether/sanguinite_helmet.png differ diff --git a/libs/textures/items/nether/sanguinite_hoe.png b/libs/textures/items/nether/sanguinite_hoe.png new file mode 100644 index 00000000..6bccc499 Binary files /dev/null and b/libs/textures/items/nether/sanguinite_hoe.png differ diff --git a/libs/textures/items/nether/sanguinite_ingot.png b/libs/textures/items/nether/sanguinite_ingot.png new file mode 100644 index 00000000..db80d761 Binary files /dev/null and b/libs/textures/items/nether/sanguinite_ingot.png differ diff --git a/libs/textures/items/nether/sanguinite_legs.png b/libs/textures/items/nether/sanguinite_legs.png new file mode 100644 index 00000000..b28d93ef Binary files /dev/null and b/libs/textures/items/nether/sanguinite_legs.png differ diff --git a/libs/textures/items/nether/sanguinite_pick.png b/libs/textures/items/nether/sanguinite_pick.png new file mode 100644 index 00000000..42f43761 Binary files /dev/null and b/libs/textures/items/nether/sanguinite_pick.png differ diff --git a/libs/textures/items/nether/sanguinite_shovel.png b/libs/textures/items/nether/sanguinite_shovel.png new file mode 100644 index 00000000..58cdb4be Binary files /dev/null and b/libs/textures/items/nether/sanguinite_shovel.png differ diff --git a/libs/textures/items/nether/sanguinite_sword.png b/libs/textures/items/nether/sanguinite_sword.png new file mode 100644 index 00000000..e1c37f43 Binary files /dev/null and b/libs/textures/items/nether/sanguinite_sword.png differ diff --git a/libs/textures/items/nether/shadow_iron_axe.png b/libs/textures/items/nether/shadow_iron_axe.png new file mode 100644 index 00000000..d50d4ac5 Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_axe.png differ diff --git a/libs/textures/items/nether/shadow_iron_boots.png b/libs/textures/items/nether/shadow_iron_boots.png new file mode 100644 index 00000000..a6173588 Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_boots.png differ diff --git a/libs/textures/items/nether/shadow_iron_bucket_fill.png b/libs/textures/items/nether/shadow_iron_bucket_fill.png new file mode 100644 index 00000000..92751f17 Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_bucket_fill.png differ diff --git a/libs/textures/items/nether/shadow_iron_chest.png b/libs/textures/items/nether/shadow_iron_chest.png new file mode 100644 index 00000000..d3e0edfa Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_chest.png differ diff --git a/libs/textures/items/nether/shadow_iron_dust.png b/libs/textures/items/nether/shadow_iron_dust.png new file mode 100644 index 00000000..fb16de62 Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_dust.png differ diff --git a/libs/textures/items/nether/shadow_iron_helmet.png b/libs/textures/items/nether/shadow_iron_helmet.png new file mode 100644 index 00000000..df2a255a Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_helmet.png differ diff --git a/libs/textures/items/nether/shadow_iron_hoe.png b/libs/textures/items/nether/shadow_iron_hoe.png new file mode 100644 index 00000000..85f81f46 Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_hoe.png differ diff --git a/libs/textures/items/nether/shadow_iron_ingot.png b/libs/textures/items/nether/shadow_iron_ingot.png new file mode 100644 index 00000000..4328ef98 Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_ingot.png differ diff --git a/libs/textures/items/nether/shadow_iron_legs.png b/libs/textures/items/nether/shadow_iron_legs.png new file mode 100644 index 00000000..35ad0eb1 Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_legs.png differ diff --git a/libs/textures/items/nether/shadow_iron_pick.png b/libs/textures/items/nether/shadow_iron_pick.png new file mode 100644 index 00000000..feb73c3b Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_pick.png differ diff --git a/libs/textures/items/nether/shadow_iron_shovel.png b/libs/textures/items/nether/shadow_iron_shovel.png new file mode 100644 index 00000000..2456dc50 Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_shovel.png differ diff --git a/libs/textures/items/nether/shadow_iron_sword.png b/libs/textures/items/nether/shadow_iron_sword.png new file mode 100644 index 00000000..4f03b611 Binary files /dev/null and b/libs/textures/items/nether/shadow_iron_sword.png differ diff --git a/libs/textures/items/nether/shadow_steel_axe.png b/libs/textures/items/nether/shadow_steel_axe.png new file mode 100644 index 00000000..d583f9af Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_axe.png differ diff --git a/libs/textures/items/nether/shadow_steel_boots.png b/libs/textures/items/nether/shadow_steel_boots.png new file mode 100644 index 00000000..99ccf335 Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_boots.png differ diff --git a/libs/textures/items/nether/shadow_steel_bucket_fill.png b/libs/textures/items/nether/shadow_steel_bucket_fill.png new file mode 100644 index 00000000..de344574 Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_bucket_fill.png differ diff --git a/libs/textures/items/nether/shadow_steel_chest.png b/libs/textures/items/nether/shadow_steel_chest.png new file mode 100644 index 00000000..d6d4276b Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_chest.png differ diff --git a/libs/textures/items/nether/shadow_steel_dust.png b/libs/textures/items/nether/shadow_steel_dust.png new file mode 100644 index 00000000..9e3dc35e Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_dust.png differ diff --git a/libs/textures/items/nether/shadow_steel_helmet.png b/libs/textures/items/nether/shadow_steel_helmet.png new file mode 100644 index 00000000..7d758c88 Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_helmet.png differ diff --git a/libs/textures/items/nether/shadow_steel_hoe.png b/libs/textures/items/nether/shadow_steel_hoe.png new file mode 100644 index 00000000..812d6c18 Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_hoe.png differ diff --git a/libs/textures/items/nether/shadow_steel_ingot.png b/libs/textures/items/nether/shadow_steel_ingot.png new file mode 100644 index 00000000..44eb79ee Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_ingot.png differ diff --git a/libs/textures/items/nether/shadow_steel_legs.png b/libs/textures/items/nether/shadow_steel_legs.png new file mode 100644 index 00000000..1ffcc977 Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_legs.png differ diff --git a/libs/textures/items/nether/shadow_steel_pick.png b/libs/textures/items/nether/shadow_steel_pick.png new file mode 100644 index 00000000..26c33291 Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_pick.png differ diff --git a/libs/textures/items/nether/shadow_steel_shovel.png b/libs/textures/items/nether/shadow_steel_shovel.png new file mode 100644 index 00000000..72225518 Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_shovel.png differ diff --git a/libs/textures/items/nether/shadow_steel_sword.png b/libs/textures/items/nether/shadow_steel_sword.png new file mode 100644 index 00000000..8a003a78 Binary files /dev/null and b/libs/textures/items/nether/shadow_steel_sword.png differ diff --git a/libs/textures/items/nether/vulcanite_axe.png b/libs/textures/items/nether/vulcanite_axe.png new file mode 100644 index 00000000..99a4aba8 Binary files /dev/null and b/libs/textures/items/nether/vulcanite_axe.png differ diff --git a/libs/textures/items/nether/vulcanite_boots.png b/libs/textures/items/nether/vulcanite_boots.png new file mode 100644 index 00000000..af683e67 Binary files /dev/null and b/libs/textures/items/nether/vulcanite_boots.png differ diff --git a/libs/textures/items/nether/vulcanite_bucket_fill.png b/libs/textures/items/nether/vulcanite_bucket_fill.png new file mode 100644 index 00000000..3497afad Binary files /dev/null and b/libs/textures/items/nether/vulcanite_bucket_fill.png differ diff --git a/libs/textures/items/nether/vulcanite_chest.png b/libs/textures/items/nether/vulcanite_chest.png new file mode 100644 index 00000000..1023b15f Binary files /dev/null and b/libs/textures/items/nether/vulcanite_chest.png differ diff --git a/libs/textures/items/nether/vulcanite_dust.png b/libs/textures/items/nether/vulcanite_dust.png new file mode 100644 index 00000000..18554a00 Binary files /dev/null and b/libs/textures/items/nether/vulcanite_dust.png differ diff --git a/libs/textures/items/nether/vulcanite_helmet.png b/libs/textures/items/nether/vulcanite_helmet.png new file mode 100644 index 00000000..ff959b91 Binary files /dev/null and b/libs/textures/items/nether/vulcanite_helmet.png differ diff --git a/libs/textures/items/nether/vulcanite_hoe.png b/libs/textures/items/nether/vulcanite_hoe.png new file mode 100644 index 00000000..1424d1eb Binary files /dev/null and b/libs/textures/items/nether/vulcanite_hoe.png differ diff --git a/libs/textures/items/nether/vulcanite_ingot.png b/libs/textures/items/nether/vulcanite_ingot.png new file mode 100644 index 00000000..8803dabe Binary files /dev/null and b/libs/textures/items/nether/vulcanite_ingot.png differ diff --git a/libs/textures/items/nether/vulcanite_legs.png b/libs/textures/items/nether/vulcanite_legs.png new file mode 100644 index 00000000..2f9e4164 Binary files /dev/null and b/libs/textures/items/nether/vulcanite_legs.png differ diff --git a/libs/textures/items/nether/vulcanite_pick.png b/libs/textures/items/nether/vulcanite_pick.png new file mode 100644 index 00000000..d72a9b09 Binary files /dev/null and b/libs/textures/items/nether/vulcanite_pick.png differ diff --git a/libs/textures/items/nether/vulcanite_shovel.png b/libs/textures/items/nether/vulcanite_shovel.png new file mode 100644 index 00000000..9c729bdc Binary files /dev/null and b/libs/textures/items/nether/vulcanite_shovel.png differ diff --git a/libs/textures/items/nether/vulcanite_sword.png b/libs/textures/items/nether/vulcanite_sword.png new file mode 100644 index 00000000..5ca08229 Binary files /dev/null and b/libs/textures/items/nether/vulcanite_sword.png differ diff --git a/libs/textures/items/nether/vyroxeres_axe.png b/libs/textures/items/nether/vyroxeres_axe.png new file mode 100644 index 00000000..be24a3e7 Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_axe.png differ diff --git a/libs/textures/items/nether/vyroxeres_boots.png b/libs/textures/items/nether/vyroxeres_boots.png new file mode 100644 index 00000000..082c040e Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_boots.png differ diff --git a/libs/textures/items/nether/vyroxeres_bucket_fill.png b/libs/textures/items/nether/vyroxeres_bucket_fill.png new file mode 100644 index 00000000..c34ce198 Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_bucket_fill.png differ diff --git a/libs/textures/items/nether/vyroxeres_chest.png b/libs/textures/items/nether/vyroxeres_chest.png new file mode 100644 index 00000000..3b84b236 Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_chest.png differ diff --git a/libs/textures/items/nether/vyroxeres_dust.png b/libs/textures/items/nether/vyroxeres_dust.png new file mode 100644 index 00000000..2b47f073 Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_dust.png differ diff --git a/libs/textures/items/nether/vyroxeres_helmet.png b/libs/textures/items/nether/vyroxeres_helmet.png new file mode 100644 index 00000000..336fcf87 Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_helmet.png differ diff --git a/libs/textures/items/nether/vyroxeres_hoe.png b/libs/textures/items/nether/vyroxeres_hoe.png new file mode 100644 index 00000000..04c26dd1 Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_hoe.png differ diff --git a/libs/textures/items/nether/vyroxeres_ingot.png b/libs/textures/items/nether/vyroxeres_ingot.png new file mode 100644 index 00000000..2b4a645f Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_ingot.png differ diff --git a/libs/textures/items/nether/vyroxeres_legs.png b/libs/textures/items/nether/vyroxeres_legs.png new file mode 100644 index 00000000..4f52c913 Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_legs.png differ diff --git a/libs/textures/items/nether/vyroxeres_pick.png b/libs/textures/items/nether/vyroxeres_pick.png new file mode 100644 index 00000000..0a391c80 Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_pick.png differ diff --git a/libs/textures/items/nether/vyroxeres_shovel.png b/libs/textures/items/nether/vyroxeres_shovel.png new file mode 100644 index 00000000..69d6a7af Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_shovel.png differ diff --git a/libs/textures/items/nether/vyroxeres_sword.png b/libs/textures/items/nether/vyroxeres_sword.png new file mode 100644 index 00000000..89ca5dce Binary files /dev/null and b/libs/textures/items/nether/vyroxeres_sword.png differ diff --git a/libs/textures/items/precious/brass_axe.png b/libs/textures/items/precious/brass_axe.png new file mode 100644 index 00000000..120e8f69 Binary files /dev/null and b/libs/textures/items/precious/brass_axe.png differ diff --git a/libs/textures/items/precious/brass_boots.png b/libs/textures/items/precious/brass_boots.png new file mode 100644 index 00000000..564a55c6 Binary files /dev/null and b/libs/textures/items/precious/brass_boots.png differ diff --git a/libs/textures/items/precious/brass_bucket_fill.png b/libs/textures/items/precious/brass_bucket_fill.png new file mode 100644 index 00000000..ddbddafb Binary files /dev/null and b/libs/textures/items/precious/brass_bucket_fill.png differ diff --git a/libs/textures/items/precious/brass_chest.png b/libs/textures/items/precious/brass_chest.png new file mode 100644 index 00000000..dd730dfc Binary files /dev/null and b/libs/textures/items/precious/brass_chest.png differ diff --git a/libs/textures/items/precious/brass_dust.png b/libs/textures/items/precious/brass_dust.png new file mode 100644 index 00000000..d3783d70 Binary files /dev/null and b/libs/textures/items/precious/brass_dust.png differ diff --git a/libs/textures/items/precious/brass_helmet.png b/libs/textures/items/precious/brass_helmet.png new file mode 100644 index 00000000..994b1673 Binary files /dev/null and b/libs/textures/items/precious/brass_helmet.png differ diff --git a/libs/textures/items/precious/brass_hoe.png b/libs/textures/items/precious/brass_hoe.png new file mode 100644 index 00000000..c99ea47c Binary files /dev/null and b/libs/textures/items/precious/brass_hoe.png differ diff --git a/libs/textures/items/precious/brass_ingot.png b/libs/textures/items/precious/brass_ingot.png new file mode 100644 index 00000000..17905679 Binary files /dev/null and b/libs/textures/items/precious/brass_ingot.png differ diff --git a/libs/textures/items/precious/brass_legs.png b/libs/textures/items/precious/brass_legs.png new file mode 100644 index 00000000..acad433f Binary files /dev/null and b/libs/textures/items/precious/brass_legs.png differ diff --git a/libs/textures/items/precious/brass_pick.png b/libs/textures/items/precious/brass_pick.png new file mode 100644 index 00000000..505baa93 Binary files /dev/null and b/libs/textures/items/precious/brass_pick.png differ diff --git a/libs/textures/items/precious/brass_shovel.png b/libs/textures/items/precious/brass_shovel.png new file mode 100644 index 00000000..1b96e5ea Binary files /dev/null and b/libs/textures/items/precious/brass_shovel.png differ diff --git a/libs/textures/items/precious/brass_sword.png b/libs/textures/items/precious/brass_sword.png new file mode 100644 index 00000000..78f780dd Binary files /dev/null and b/libs/textures/items/precious/brass_sword.png differ diff --git a/libs/textures/items/precious/electrum_axe.png b/libs/textures/items/precious/electrum_axe.png new file mode 100644 index 00000000..14a431b5 Binary files /dev/null and b/libs/textures/items/precious/electrum_axe.png differ diff --git a/libs/textures/items/precious/electrum_boots.png b/libs/textures/items/precious/electrum_boots.png new file mode 100644 index 00000000..2dab2203 Binary files /dev/null and b/libs/textures/items/precious/electrum_boots.png differ diff --git a/libs/textures/items/precious/electrum_bucket_fill.png b/libs/textures/items/precious/electrum_bucket_fill.png new file mode 100644 index 00000000..8f02fa44 Binary files /dev/null and b/libs/textures/items/precious/electrum_bucket_fill.png differ diff --git a/libs/textures/items/precious/electrum_chest.png b/libs/textures/items/precious/electrum_chest.png new file mode 100644 index 00000000..ff2c69ec Binary files /dev/null and b/libs/textures/items/precious/electrum_chest.png differ diff --git a/libs/textures/items/precious/electrum_dust.png b/libs/textures/items/precious/electrum_dust.png new file mode 100644 index 00000000..f3ba3263 Binary files /dev/null and b/libs/textures/items/precious/electrum_dust.png differ diff --git a/libs/textures/items/precious/electrum_helmet.png b/libs/textures/items/precious/electrum_helmet.png new file mode 100644 index 00000000..26ab39b5 Binary files /dev/null and b/libs/textures/items/precious/electrum_helmet.png differ diff --git a/libs/textures/items/precious/electrum_hoe.png b/libs/textures/items/precious/electrum_hoe.png new file mode 100644 index 00000000..942698af Binary files /dev/null and b/libs/textures/items/precious/electrum_hoe.png differ diff --git a/libs/textures/items/precious/electrum_ingot.png b/libs/textures/items/precious/electrum_ingot.png new file mode 100644 index 00000000..c8130517 Binary files /dev/null and b/libs/textures/items/precious/electrum_ingot.png differ diff --git a/libs/textures/items/precious/electrum_legs.png b/libs/textures/items/precious/electrum_legs.png new file mode 100644 index 00000000..b827eb2e Binary files /dev/null and b/libs/textures/items/precious/electrum_legs.png differ diff --git a/libs/textures/items/precious/electrum_pick.png b/libs/textures/items/precious/electrum_pick.png new file mode 100644 index 00000000..ea2fe87c Binary files /dev/null and b/libs/textures/items/precious/electrum_pick.png differ diff --git a/libs/textures/items/precious/electrum_shovel.png b/libs/textures/items/precious/electrum_shovel.png new file mode 100644 index 00000000..34cb47ca Binary files /dev/null and b/libs/textures/items/precious/electrum_shovel.png differ diff --git a/libs/textures/items/precious/electrum_sword.png b/libs/textures/items/precious/electrum_sword.png new file mode 100644 index 00000000..9fe9a30a Binary files /dev/null and b/libs/textures/items/precious/electrum_sword.png differ diff --git a/libs/textures/items/precious/platinum_axe.png b/libs/textures/items/precious/platinum_axe.png new file mode 100644 index 00000000..3eb7f48b Binary files /dev/null and b/libs/textures/items/precious/platinum_axe.png differ diff --git a/libs/textures/items/precious/platinum_boots.png b/libs/textures/items/precious/platinum_boots.png new file mode 100644 index 00000000..c3dc6f6b Binary files /dev/null and b/libs/textures/items/precious/platinum_boots.png differ diff --git a/libs/textures/items/precious/platinum_bucket_fill.png b/libs/textures/items/precious/platinum_bucket_fill.png new file mode 100644 index 00000000..5d2fdf9f Binary files /dev/null and b/libs/textures/items/precious/platinum_bucket_fill.png differ diff --git a/libs/textures/items/precious/platinum_chest.png b/libs/textures/items/precious/platinum_chest.png new file mode 100644 index 00000000..d0f0b579 Binary files /dev/null and b/libs/textures/items/precious/platinum_chest.png differ diff --git a/libs/textures/items/precious/platinum_dust.png b/libs/textures/items/precious/platinum_dust.png new file mode 100644 index 00000000..19828547 Binary files /dev/null and b/libs/textures/items/precious/platinum_dust.png differ diff --git a/libs/textures/items/precious/platinum_helmet.png b/libs/textures/items/precious/platinum_helmet.png new file mode 100644 index 00000000..186746c0 Binary files /dev/null and b/libs/textures/items/precious/platinum_helmet.png differ diff --git a/libs/textures/items/precious/platinum_hoe.png b/libs/textures/items/precious/platinum_hoe.png new file mode 100644 index 00000000..3e9a1a13 Binary files /dev/null and b/libs/textures/items/precious/platinum_hoe.png differ diff --git a/libs/textures/items/precious/platinum_ingot.png b/libs/textures/items/precious/platinum_ingot.png new file mode 100644 index 00000000..b087f54a Binary files /dev/null and b/libs/textures/items/precious/platinum_ingot.png differ diff --git a/libs/textures/items/precious/platinum_legs.png b/libs/textures/items/precious/platinum_legs.png new file mode 100644 index 00000000..ce34b12e Binary files /dev/null and b/libs/textures/items/precious/platinum_legs.png differ diff --git a/libs/textures/items/precious/platinum_pick.png b/libs/textures/items/precious/platinum_pick.png new file mode 100644 index 00000000..f665a6d5 Binary files /dev/null and b/libs/textures/items/precious/platinum_pick.png differ diff --git a/libs/textures/items/precious/platinum_shovel.png b/libs/textures/items/precious/platinum_shovel.png new file mode 100644 index 00000000..289e8293 Binary files /dev/null and b/libs/textures/items/precious/platinum_shovel.png differ diff --git a/libs/textures/items/precious/platinum_sword.png b/libs/textures/items/precious/platinum_sword.png new file mode 100644 index 00000000..78fe415c Binary files /dev/null and b/libs/textures/items/precious/platinum_sword.png differ diff --git a/libs/textures/items/precious/silver_axe.png b/libs/textures/items/precious/silver_axe.png new file mode 100644 index 00000000..6b36f0ca Binary files /dev/null and b/libs/textures/items/precious/silver_axe.png differ diff --git a/libs/textures/items/precious/silver_boots.png b/libs/textures/items/precious/silver_boots.png new file mode 100644 index 00000000..f1f420a5 Binary files /dev/null and b/libs/textures/items/precious/silver_boots.png differ diff --git a/libs/textures/items/precious/silver_bucket_fill.png b/libs/textures/items/precious/silver_bucket_fill.png new file mode 100644 index 00000000..bbc441af Binary files /dev/null and b/libs/textures/items/precious/silver_bucket_fill.png differ diff --git a/libs/textures/items/precious/silver_chest.png b/libs/textures/items/precious/silver_chest.png new file mode 100644 index 00000000..dcb86b22 Binary files /dev/null and b/libs/textures/items/precious/silver_chest.png differ diff --git a/libs/textures/items/precious/silver_dust.png b/libs/textures/items/precious/silver_dust.png new file mode 100644 index 00000000..9a964eed Binary files /dev/null and b/libs/textures/items/precious/silver_dust.png differ diff --git a/libs/textures/items/precious/silver_helmet.png b/libs/textures/items/precious/silver_helmet.png new file mode 100644 index 00000000..56349059 Binary files /dev/null and b/libs/textures/items/precious/silver_helmet.png differ diff --git a/libs/textures/items/precious/silver_hoe.png b/libs/textures/items/precious/silver_hoe.png new file mode 100644 index 00000000..90780bc6 Binary files /dev/null and b/libs/textures/items/precious/silver_hoe.png differ diff --git a/libs/textures/items/precious/silver_ingot.png b/libs/textures/items/precious/silver_ingot.png new file mode 100644 index 00000000..d03f669b Binary files /dev/null and b/libs/textures/items/precious/silver_ingot.png differ diff --git a/libs/textures/items/precious/silver_legs.png b/libs/textures/items/precious/silver_legs.png new file mode 100644 index 00000000..25132894 Binary files /dev/null and b/libs/textures/items/precious/silver_legs.png differ diff --git a/libs/textures/items/precious/silver_pick.png b/libs/textures/items/precious/silver_pick.png new file mode 100644 index 00000000..35169e27 Binary files /dev/null and b/libs/textures/items/precious/silver_pick.png differ diff --git a/libs/textures/items/precious/silver_shovel.png b/libs/textures/items/precious/silver_shovel.png new file mode 100644 index 00000000..7f3f671c Binary files /dev/null and b/libs/textures/items/precious/silver_shovel.png differ diff --git a/libs/textures/items/precious/silver_sword.png b/libs/textures/items/precious/silver_sword.png new file mode 100644 index 00000000..f62ff018 Binary files /dev/null and b/libs/textures/items/precious/silver_sword.png differ diff --git a/libs/textures/items/precious/zinc_bucket_fill.png b/libs/textures/items/precious/zinc_bucket_fill.png new file mode 100644 index 00000000..e8ad0201 Binary files /dev/null and b/libs/textures/items/precious/zinc_bucket_fill.png differ diff --git a/libs/textures/items/precious/zinc_dust.png b/libs/textures/items/precious/zinc_dust.png new file mode 100644 index 00000000..b1e440b9 Binary files /dev/null and b/libs/textures/items/precious/zinc_dust.png differ diff --git a/libs/textures/items/precious/zinc_ingot.png b/libs/textures/items/precious/zinc_ingot.png new file mode 100644 index 00000000..1f03aea4 Binary files /dev/null and b/libs/textures/items/precious/zinc_ingot.png differ diff --git a/libs/textures/items/utility/bitumen.png b/libs/textures/items/utility/bitumen.png new file mode 100644 index 00000000..d553f4e8 Binary files /dev/null and b/libs/textures/items/utility/bitumen.png differ diff --git a/libs/textures/items/utility/magnesium.png b/libs/textures/items/utility/magnesium.png new file mode 100644 index 00000000..4a7be8a4 Binary files /dev/null and b/libs/textures/items/utility/magnesium.png differ diff --git a/libs/textures/items/utility/phosphorus.png b/libs/textures/items/utility/phosphorus.png new file mode 100644 index 00000000..cb643fd1 Binary files /dev/null and b/libs/textures/items/utility/phosphorus.png differ diff --git a/libs/textures/items/utility/potash.png b/libs/textures/items/utility/potash.png new file mode 100644 index 00000000..a265bb22 Binary files /dev/null and b/libs/textures/items/utility/potash.png differ diff --git a/libs/textures/items/utility/saltpeter.png b/libs/textures/items/utility/saltpeter.png new file mode 100644 index 00000000..dd0a6413 Binary files /dev/null and b/libs/textures/items/utility/saltpeter.png differ diff --git a/libs/textures/items/utility/sulfur.png b/libs/textures/items/utility/sulfur.png new file mode 100644 index 00000000..6d686510 Binary files /dev/null and b/libs/textures/items/utility/sulfur.png differ diff --git a/libs/textures/items/vanilla/gold_dust.png b/libs/textures/items/vanilla/gold_dust.png new file mode 100644 index 00000000..71af5d26 Binary files /dev/null and b/libs/textures/items/vanilla/gold_dust.png differ diff --git a/libs/textures/items/vanilla/iron_dust.png b/libs/textures/items/vanilla/iron_dust.png new file mode 100644 index 00000000..163d169d Binary files /dev/null and b/libs/textures/items/vanilla/iron_dust.png differ diff --git a/libs/textures/models/armor/base/angmallen_layer_1.png b/libs/textures/models/armor/base/angmallen_layer_1.png new file mode 100644 index 00000000..e83be738 Binary files /dev/null and b/libs/textures/models/armor/base/angmallen_layer_1.png differ diff --git a/libs/textures/models/armor/base/angmallen_layer_2.png b/libs/textures/models/armor/base/angmallen_layer_2.png new file mode 100644 index 00000000..b1f58db3 Binary files /dev/null and b/libs/textures/models/armor/base/angmallen_layer_2.png differ diff --git a/libs/textures/models/armor/base/bronze_layer_1.png b/libs/textures/models/armor/base/bronze_layer_1.png new file mode 100644 index 00000000..561b1aca Binary files /dev/null and b/libs/textures/models/armor/base/bronze_layer_1.png differ diff --git a/libs/textures/models/armor/base/bronze_layer_2.png b/libs/textures/models/armor/base/bronze_layer_2.png new file mode 100644 index 00000000..21c7cd52 Binary files /dev/null and b/libs/textures/models/armor/base/bronze_layer_2.png differ diff --git a/libs/textures/models/armor/base/copper_layer_1.png b/libs/textures/models/armor/base/copper_layer_1.png new file mode 100644 index 00000000..71f2ffe8 Binary files /dev/null and b/libs/textures/models/armor/base/copper_layer_1.png differ diff --git a/libs/textures/models/armor/base/copper_layer_2.png b/libs/textures/models/armor/base/copper_layer_2.png new file mode 100644 index 00000000..e0674c38 Binary files /dev/null and b/libs/textures/models/armor/base/copper_layer_2.png differ diff --git a/libs/textures/models/armor/base/damascus_steel_layer_1.png b/libs/textures/models/armor/base/damascus_steel_layer_1.png new file mode 100644 index 00000000..a692a353 Binary files /dev/null and b/libs/textures/models/armor/base/damascus_steel_layer_1.png differ diff --git a/libs/textures/models/armor/base/damascus_steel_layer_2.png b/libs/textures/models/armor/base/damascus_steel_layer_2.png new file mode 100644 index 00000000..99e7e27a Binary files /dev/null and b/libs/textures/models/armor/base/damascus_steel_layer_2.png differ diff --git a/libs/textures/models/armor/base/hepatizon_layer_1.png b/libs/textures/models/armor/base/hepatizon_layer_1.png new file mode 100644 index 00000000..033c9962 Binary files /dev/null and b/libs/textures/models/armor/base/hepatizon_layer_1.png differ diff --git a/libs/textures/models/armor/base/hepatizon_layer_2.png b/libs/textures/models/armor/base/hepatizon_layer_2.png new file mode 100644 index 00000000..906942fc Binary files /dev/null and b/libs/textures/models/armor/base/hepatizon_layer_2.png differ diff --git a/libs/textures/models/armor/base/steel_layer_1.png b/libs/textures/models/armor/base/steel_layer_1.png new file mode 100644 index 00000000..42f82b53 Binary files /dev/null and b/libs/textures/models/armor/base/steel_layer_1.png differ diff --git a/libs/textures/models/armor/base/steel_layer_2.png b/libs/textures/models/armor/base/steel_layer_2.png new file mode 100644 index 00000000..bb1939df Binary files /dev/null and b/libs/textures/models/armor/base/steel_layer_2.png differ diff --git a/libs/textures/models/armor/ender/desichalkos_layer_1.png b/libs/textures/models/armor/ender/desichalkos_layer_1.png new file mode 100644 index 00000000..927ae5ad Binary files /dev/null and b/libs/textures/models/armor/ender/desichalkos_layer_1.png differ diff --git a/libs/textures/models/armor/ender/desichalkos_layer_2.png b/libs/textures/models/armor/ender/desichalkos_layer_2.png new file mode 100644 index 00000000..c23ca0b5 Binary files /dev/null and b/libs/textures/models/armor/ender/desichalkos_layer_2.png differ diff --git a/libs/textures/models/armor/ender/eximite_layer_1.png b/libs/textures/models/armor/ender/eximite_layer_1.png new file mode 100644 index 00000000..8d3ad162 Binary files /dev/null and b/libs/textures/models/armor/ender/eximite_layer_1.png differ diff --git a/libs/textures/models/armor/ender/eximite_layer_2.png b/libs/textures/models/armor/ender/eximite_layer_2.png new file mode 100644 index 00000000..e2b43af9 Binary files /dev/null and b/libs/textures/models/armor/ender/eximite_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/adamantine_layer_1.png b/libs/textures/models/armor/fantasy/adamantine_layer_1.png new file mode 100644 index 00000000..b1c5c60e Binary files /dev/null and b/libs/textures/models/armor/fantasy/adamantine_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/adamantine_layer_2.png b/libs/textures/models/armor/fantasy/adamantine_layer_2.png new file mode 100644 index 00000000..43c7c9e8 Binary files /dev/null and b/libs/textures/models/armor/fantasy/adamantine_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/astral_silver_layer_1.png b/libs/textures/models/armor/fantasy/astral_silver_layer_1.png new file mode 100644 index 00000000..98696ac1 Binary files /dev/null and b/libs/textures/models/armor/fantasy/astral_silver_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/astral_silver_layer_2.png b/libs/textures/models/armor/fantasy/astral_silver_layer_2.png new file mode 100644 index 00000000..c1e8f107 Binary files /dev/null and b/libs/textures/models/armor/fantasy/astral_silver_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/atlarus_layer_1.png b/libs/textures/models/armor/fantasy/atlarus_layer_1.png new file mode 100644 index 00000000..2492a995 Binary files /dev/null and b/libs/textures/models/armor/fantasy/atlarus_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/atlarus_layer_2.png b/libs/textures/models/armor/fantasy/atlarus_layer_2.png new file mode 100644 index 00000000..8b3d91d5 Binary files /dev/null and b/libs/textures/models/armor/fantasy/atlarus_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/black_steel_layer_1.png b/libs/textures/models/armor/fantasy/black_steel_layer_1.png new file mode 100644 index 00000000..41edf922 Binary files /dev/null and b/libs/textures/models/armor/fantasy/black_steel_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/black_steel_layer_2.png b/libs/textures/models/armor/fantasy/black_steel_layer_2.png new file mode 100644 index 00000000..625fa3a5 Binary files /dev/null and b/libs/textures/models/armor/fantasy/black_steel_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/carmot_layer_1.png b/libs/textures/models/armor/fantasy/carmot_layer_1.png new file mode 100644 index 00000000..b8be3010 Binary files /dev/null and b/libs/textures/models/armor/fantasy/carmot_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/carmot_layer_2.png b/libs/textures/models/armor/fantasy/carmot_layer_2.png new file mode 100644 index 00000000..65e60bb2 Binary files /dev/null and b/libs/textures/models/armor/fantasy/carmot_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/celenegil_layer_1.png b/libs/textures/models/armor/fantasy/celenegil_layer_1.png new file mode 100644 index 00000000..d038a70c Binary files /dev/null and b/libs/textures/models/armor/fantasy/celenegil_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/celenegil_layer_2.png b/libs/textures/models/armor/fantasy/celenegil_layer_2.png new file mode 100644 index 00000000..865f3261 Binary files /dev/null and b/libs/textures/models/armor/fantasy/celenegil_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/deep_iron_layer_1.png b/libs/textures/models/armor/fantasy/deep_iron_layer_1.png new file mode 100644 index 00000000..fe896c01 Binary files /dev/null and b/libs/textures/models/armor/fantasy/deep_iron_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/deep_iron_layer_2.png b/libs/textures/models/armor/fantasy/deep_iron_layer_2.png new file mode 100644 index 00000000..96d2586d Binary files /dev/null and b/libs/textures/models/armor/fantasy/deep_iron_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/haderoth_layer_1.png b/libs/textures/models/armor/fantasy/haderoth_layer_1.png new file mode 100644 index 00000000..0a6396fa Binary files /dev/null and b/libs/textures/models/armor/fantasy/haderoth_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/haderoth_layer_2.png b/libs/textures/models/armor/fantasy/haderoth_layer_2.png new file mode 100644 index 00000000..9f524dfa Binary files /dev/null and b/libs/textures/models/armor/fantasy/haderoth_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/mithril_layer_1.png b/libs/textures/models/armor/fantasy/mithril_layer_1.png new file mode 100644 index 00000000..8e98b78a Binary files /dev/null and b/libs/textures/models/armor/fantasy/mithril_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/mithril_layer_2.png b/libs/textures/models/armor/fantasy/mithril_layer_2.png new file mode 100644 index 00000000..7aa15ca0 Binary files /dev/null and b/libs/textures/models/armor/fantasy/mithril_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/orichalcum_layer_1.png b/libs/textures/models/armor/fantasy/orichalcum_layer_1.png new file mode 100644 index 00000000..d7f51a63 Binary files /dev/null and b/libs/textures/models/armor/fantasy/orichalcum_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/orichalcum_layer_2.png b/libs/textures/models/armor/fantasy/orichalcum_layer_2.png new file mode 100644 index 00000000..5bc0677d Binary files /dev/null and b/libs/textures/models/armor/fantasy/orichalcum_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/oureclase_layer_1.png b/libs/textures/models/armor/fantasy/oureclase_layer_1.png new file mode 100644 index 00000000..34594b85 Binary files /dev/null and b/libs/textures/models/armor/fantasy/oureclase_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/oureclase_layer_2.png b/libs/textures/models/armor/fantasy/oureclase_layer_2.png new file mode 100644 index 00000000..892671db Binary files /dev/null and b/libs/textures/models/armor/fantasy/oureclase_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/prometheum_layer_1.png b/libs/textures/models/armor/fantasy/prometheum_layer_1.png new file mode 100644 index 00000000..615205b3 Binary files /dev/null and b/libs/textures/models/armor/fantasy/prometheum_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/prometheum_layer_2.png b/libs/textures/models/armor/fantasy/prometheum_layer_2.png new file mode 100644 index 00000000..9920c9e6 Binary files /dev/null and b/libs/textures/models/armor/fantasy/prometheum_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/quicksilver_layer_1.png b/libs/textures/models/armor/fantasy/quicksilver_layer_1.png new file mode 100644 index 00000000..790375a3 Binary files /dev/null and b/libs/textures/models/armor/fantasy/quicksilver_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/quicksilver_layer_2.png b/libs/textures/models/armor/fantasy/quicksilver_layer_2.png new file mode 100644 index 00000000..fd0bb472 Binary files /dev/null and b/libs/textures/models/armor/fantasy/quicksilver_layer_2.png differ diff --git a/libs/textures/models/armor/fantasy/tartarite_layer_1.png b/libs/textures/models/armor/fantasy/tartarite_layer_1.png new file mode 100644 index 00000000..fe3158c0 Binary files /dev/null and b/libs/textures/models/armor/fantasy/tartarite_layer_1.png differ diff --git a/libs/textures/models/armor/fantasy/tartarite_layer_2.png b/libs/textures/models/armor/fantasy/tartarite_layer_2.png new file mode 100644 index 00000000..f03ed96a Binary files /dev/null and b/libs/textures/models/armor/fantasy/tartarite_layer_2.png differ diff --git a/libs/textures/models/armor/nether/amordrine_layer_1.png b/libs/textures/models/armor/nether/amordrine_layer_1.png new file mode 100644 index 00000000..304583a1 Binary files /dev/null and b/libs/textures/models/armor/nether/amordrine_layer_1.png differ diff --git a/libs/textures/models/armor/nether/amordrine_layer_2.png b/libs/textures/models/armor/nether/amordrine_layer_2.png new file mode 100644 index 00000000..10685158 Binary files /dev/null and b/libs/textures/models/armor/nether/amordrine_layer_2.png differ diff --git a/libs/textures/models/armor/nether/ceruclase_layer_1.png b/libs/textures/models/armor/nether/ceruclase_layer_1.png new file mode 100644 index 00000000..6465b5c5 Binary files /dev/null and b/libs/textures/models/armor/nether/ceruclase_layer_1.png differ diff --git a/libs/textures/models/armor/nether/ceruclase_layer_2.png b/libs/textures/models/armor/nether/ceruclase_layer_2.png new file mode 100644 index 00000000..7eee0670 Binary files /dev/null and b/libs/textures/models/armor/nether/ceruclase_layer_2.png differ diff --git a/libs/textures/models/armor/nether/ignatius_layer_1.png b/libs/textures/models/armor/nether/ignatius_layer_1.png new file mode 100644 index 00000000..35967b9c Binary files /dev/null and b/libs/textures/models/armor/nether/ignatius_layer_1.png differ diff --git a/libs/textures/models/armor/nether/ignatius_layer_2.png b/libs/textures/models/armor/nether/ignatius_layer_2.png new file mode 100644 index 00000000..1570ed50 Binary files /dev/null and b/libs/textures/models/armor/nether/ignatius_layer_2.png differ diff --git a/libs/textures/models/armor/nether/inolashite_layer_1.png b/libs/textures/models/armor/nether/inolashite_layer_1.png new file mode 100644 index 00000000..82a248f3 Binary files /dev/null and b/libs/textures/models/armor/nether/inolashite_layer_1.png differ diff --git a/libs/textures/models/armor/nether/inolashite_layer_2.png b/libs/textures/models/armor/nether/inolashite_layer_2.png new file mode 100644 index 00000000..7e00dc15 Binary files /dev/null and b/libs/textures/models/armor/nether/inolashite_layer_2.png differ diff --git a/libs/textures/models/armor/nether/kalendrite_layer_1.png b/libs/textures/models/armor/nether/kalendrite_layer_1.png new file mode 100644 index 00000000..0202f9d1 Binary files /dev/null and b/libs/textures/models/armor/nether/kalendrite_layer_1.png differ diff --git a/libs/textures/models/armor/nether/kalendrite_layer_2.png b/libs/textures/models/armor/nether/kalendrite_layer_2.png new file mode 100644 index 00000000..09795fac Binary files /dev/null and b/libs/textures/models/armor/nether/kalendrite_layer_2.png differ diff --git a/libs/textures/models/armor/nether/midasium_layer_1.png b/libs/textures/models/armor/nether/midasium_layer_1.png new file mode 100644 index 00000000..0deb9ef8 Binary files /dev/null and b/libs/textures/models/armor/nether/midasium_layer_1.png differ diff --git a/libs/textures/models/armor/nether/midasium_layer_2.png b/libs/textures/models/armor/nether/midasium_layer_2.png new file mode 100644 index 00000000..033d14e8 Binary files /dev/null and b/libs/textures/models/armor/nether/midasium_layer_2.png differ diff --git a/libs/textures/models/armor/nether/sanguinite_layer_1.png b/libs/textures/models/armor/nether/sanguinite_layer_1.png new file mode 100644 index 00000000..c182c097 Binary files /dev/null and b/libs/textures/models/armor/nether/sanguinite_layer_1.png differ diff --git a/libs/textures/models/armor/nether/sanguinite_layer_2.png b/libs/textures/models/armor/nether/sanguinite_layer_2.png new file mode 100644 index 00000000..2748d932 Binary files /dev/null and b/libs/textures/models/armor/nether/sanguinite_layer_2.png differ diff --git a/libs/textures/models/armor/nether/shadow_iron_layer_1.png b/libs/textures/models/armor/nether/shadow_iron_layer_1.png new file mode 100644 index 00000000..7c338040 Binary files /dev/null and b/libs/textures/models/armor/nether/shadow_iron_layer_1.png differ diff --git a/libs/textures/models/armor/nether/shadow_iron_layer_2.png b/libs/textures/models/armor/nether/shadow_iron_layer_2.png new file mode 100644 index 00000000..eb134956 Binary files /dev/null and b/libs/textures/models/armor/nether/shadow_iron_layer_2.png differ diff --git a/libs/textures/models/armor/nether/shadow_steel_layer_1.png b/libs/textures/models/armor/nether/shadow_steel_layer_1.png new file mode 100644 index 00000000..ff14d9c5 Binary files /dev/null and b/libs/textures/models/armor/nether/shadow_steel_layer_1.png differ diff --git a/libs/textures/models/armor/nether/shadow_steel_layer_2.png b/libs/textures/models/armor/nether/shadow_steel_layer_2.png new file mode 100644 index 00000000..712ec6b1 Binary files /dev/null and b/libs/textures/models/armor/nether/shadow_steel_layer_2.png differ diff --git a/libs/textures/models/armor/nether/vulcanite_layer_1.png b/libs/textures/models/armor/nether/vulcanite_layer_1.png new file mode 100644 index 00000000..57b140a0 Binary files /dev/null and b/libs/textures/models/armor/nether/vulcanite_layer_1.png differ diff --git a/libs/textures/models/armor/nether/vulcanite_layer_2.png b/libs/textures/models/armor/nether/vulcanite_layer_2.png new file mode 100644 index 00000000..fd14e59e Binary files /dev/null and b/libs/textures/models/armor/nether/vulcanite_layer_2.png differ diff --git a/libs/textures/models/armor/nether/vyroxeres_layer_1.png b/libs/textures/models/armor/nether/vyroxeres_layer_1.png new file mode 100644 index 00000000..a7e6d42d Binary files /dev/null and b/libs/textures/models/armor/nether/vyroxeres_layer_1.png differ diff --git a/libs/textures/models/armor/nether/vyroxeres_layer_2.png b/libs/textures/models/armor/nether/vyroxeres_layer_2.png new file mode 100644 index 00000000..9e14e229 Binary files /dev/null and b/libs/textures/models/armor/nether/vyroxeres_layer_2.png differ diff --git a/libs/textures/models/armor/precious/brass_layer_1.png b/libs/textures/models/armor/precious/brass_layer_1.png new file mode 100644 index 00000000..b31c2b9f Binary files /dev/null and b/libs/textures/models/armor/precious/brass_layer_1.png differ diff --git a/libs/textures/models/armor/precious/brass_layer_2.png b/libs/textures/models/armor/precious/brass_layer_2.png new file mode 100644 index 00000000..14057ca9 Binary files /dev/null and b/libs/textures/models/armor/precious/brass_layer_2.png differ diff --git a/libs/textures/models/armor/precious/electrum_layer_1.png b/libs/textures/models/armor/precious/electrum_layer_1.png new file mode 100644 index 00000000..908791a6 Binary files /dev/null and b/libs/textures/models/armor/precious/electrum_layer_1.png differ diff --git a/libs/textures/models/armor/precious/electrum_layer_2.png b/libs/textures/models/armor/precious/electrum_layer_2.png new file mode 100644 index 00000000..3b3f2624 Binary files /dev/null and b/libs/textures/models/armor/precious/electrum_layer_2.png differ diff --git a/libs/textures/models/armor/precious/platinum_layer_1.png b/libs/textures/models/armor/precious/platinum_layer_1.png new file mode 100644 index 00000000..de246a6e Binary files /dev/null and b/libs/textures/models/armor/precious/platinum_layer_1.png differ diff --git a/libs/textures/models/armor/precious/platinum_layer_2.png b/libs/textures/models/armor/precious/platinum_layer_2.png new file mode 100644 index 00000000..c55501c6 Binary files /dev/null and b/libs/textures/models/armor/precious/platinum_layer_2.png differ diff --git a/libs/textures/models/armor/precious/silver_layer_1.png b/libs/textures/models/armor/precious/silver_layer_1.png new file mode 100644 index 00000000..84f77f6a Binary files /dev/null and b/libs/textures/models/armor/precious/silver_layer_1.png differ diff --git a/libs/textures/models/armor/precious/silver_layer_2.png b/libs/textures/models/armor/precious/silver_layer_2.png new file mode 100644 index 00000000..c0cf2e06 Binary files /dev/null and b/libs/textures/models/armor/precious/silver_layer_2.png differ diff --git a/libs/textures/particles/m_particles.png b/libs/textures/particles/m_particles.png new file mode 100644 index 00000000..1570a876 Binary files /dev/null and b/libs/textures/particles/m_particles.png differ diff --git a/src/api/java/buildcraft/api/tools/IToolWrench.java b/src/api/java/buildcraft/api/tools/IToolWrench.java new file mode 100644 index 00000000..9bf98db9 --- /dev/null +++ b/src/api/java/buildcraft/api/tools/IToolWrench.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011-2017, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. + * Please check the contents of the license, which should be located + * as "LICENSE.API" in the BuildCraft source code distribution. + */ +package buildcraft.api.tools; + +import net.minecraft.entity.player.EntityPlayer; + +/*** + * Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft + */ +public interface IToolWrench { + + /*** + * Called to ensure that the wrench can be used. To get the ItemStack that is used, check player.inventory.getCurrentItem() + * + * @param player + * - The player doing the wrenching + * @param x + * ,y,z - The coordinates for the block being wrenched + * + * @return true if wrenching is allowed, false if not + */ + boolean canWrench(EntityPlayer player, int x, int y, int z); + + /*** + * Callback after the wrench has been used. This can be used to decrease durability or for other purposes. To get the ItemStack that was used, check + * player.inventory.getCurrentItem() + * + * @param player + * - The player doing the wrenching + * @param x + * ,y,z - The coordinates of the block being wrenched + */ + void wrenchUsed(EntityPlayer player, int x, int y, int z); +} diff --git a/src/api/java/cofh/api/item/IToolHammer.java b/src/api/java/cofh/api/item/IToolHammer.java new file mode 100644 index 00000000..f1b4bb9b --- /dev/null +++ b/src/api/java/cofh/api/item/IToolHammer.java @@ -0,0 +1,44 @@ +package cofh.api.item; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +/** + * Implement this interface on subclasses of Item to have that item work as a tool for CoFH mods. + */ +public interface IToolHammer { + + /** + * Called to ensure that the tool can be used. + * + * @param item + * The itemstack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools) + * @param user + * The entity using the tool + * @param x + * X location of the block/tile + * @param y + * Y location of the block/tile + * @param z + * Z location of the block/tile + * @return True if this tool can be used + */ + boolean isUsable(ItemStack item, EntityLivingBase user, int x, int y, int z); + + /** + * Callback for when the tool has been used reactively. + * + * @param item + * The ItemStack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools) + * @param user + * The entity using the tool + * @param x + * X location of the block/tile + * @param y + * Y location of the block/tile + * @param z + * Z location of the block/tile + */ + void toolUsed(ItemStack item, EntityLivingBase user, int x, int y, int z); + +} diff --git a/src/main/java/minefantasy/mf2/MineFantasyII.java b/src/main/java/minefantasy/mf2/MineFantasyII.java index 36d06f19..e9609b9c 100644 --- a/src/main/java/minefantasy/mf2/MineFantasyII.java +++ b/src/main/java/minefantasy/mf2/MineFantasyII.java @@ -1,15 +1,12 @@ package minefantasy.mf2; -import java.io.File; - import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.network.FMLEventChannel; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; @@ -18,7 +15,9 @@ import minefantasy.mf2.api.armour.ArmourDesign; import minefantasy.mf2.api.armour.CustomArmourEntry; import minefantasy.mf2.block.list.BlockListMF; +import minefantasy.mf2.commands.CommandMF; import minefantasy.mf2.config.*; +import minefantasy.mf2.integration.minetweaker.MTCompat; import minefantasy.mf2.item.gadget.ItemLootSack; import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.item.list.ToolListMF; @@ -32,163 +31,166 @@ import minefantasy.mf2.network.packet.PacketHandlerMF; import minefantasy.mf2.recipe.BasicRecipesMF; import minefantasy.mf2.recipe.RecipeRemover; +import minefantasy.mf2.util.BukkitUtils; import minefantasy.mf2.util.MFLogUtil; +import net.minecraft.client.Minecraft; import net.minecraft.init.Items; +import net.minecraft.server.MinecraftServer; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; +import java.io.File; + /** * @author Anonymous Productions */ -@Mod(modid = MineFantasyII.MODID, name = MineFantasyII.NAME, dependencies = "required-after:Forge@[7.0,);required-after:FML@[5.0.5,)", version = MineFantasyII.VERSION) -public class MineFantasyII -{ - public static final String MODID = "minefantasy2"; - public static final String NAME = "MineFantasyII"; - public static final String VERSION = "Alpha_2.8.12"; - public static final WorldGenMFBase worldGenManager = new WorldGenMFBase(); - +@Mod(modid = MineFantasyII.MODID, name = MineFantasyII.NAME, dependencies = "required-after:Forge@[7.0,);" + "required-after:FML@[5.0.5,);" + "after:NotEnoughItems;" + "after:MineTweaker3;" + "after:BuildCraft|Core;" + "after:CoFHCore;" + "after:battlegear2", version = MineFantasyII.VERSION) +public class MineFantasyII { + public static final String MODID = "minefantasy2"; + public static final String NAME = "MineFantasyII EbK"; + public static final String VERSION = "0.5"; + public static final WorldGenMFBase worldGenManager = new WorldGenMFBase(); + @SidedProxy(clientSide = "minefantasy.mf2.network.ClientProxyMF", serverSide = "minefantasy.mf2.network.CommonProxyMF") public static CommonProxyMF proxy; public static PacketHandlerMF packetHandler; - + @Instance(MODID) public static MineFantasyII instance; - + + private static boolean isBukkitServer; + + private static Configuration getCfg(FMLPreInitializationEvent event, String name) { + return new Configuration(new File(event.getModConfigurationDirectory(), "MineFantasyII/" + name + ".cfg")); + } + + public static boolean isBukkitServer() { + return isBukkitServer; + } + + public static boolean setIsBukkitServer() { + try { + Class.forName("org.spigotmc.SpigotConfig"); + } catch (ClassNotFoundException e) { + return false; + } + return true; + } + + public static boolean isDebug() { + return ConfigExperiment.debug.equals("AU32-Db42-Acf6-Ggh9-9E8d"); + } + + /** + * Determines if a player name is that of a MF modder + */ + public static boolean isNameModder(String name) { + return name.equals("Galactic_Hiker") || name.equals("tim4200") || name.equals("Sirse"); + } + @EventHandler - public void preInit(FMLPreInitializationEvent event) - { - NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); - if(FMLCommonHandler.instance().getSide() == Side.CLIENT) - { - new ConfigClient().setConfig(getCfg(event, "Client")); - } - new ConfigArmour().setConfig(getCfg(event, "Armours")); - new ConfigExperiment().setConfig(getCfg(event, "Specials")); - new ConfigHardcore().setConfig(getCfg(event, "Hardcore")); - new ConfigTools().setConfig(getCfg(event, "Tools")); - new ConfigWeapon().setConfig(getCfg(event, "Weapons")); - new ConfigStamina().setConfig(getCfg(event, "Stamina_System")); - new ConfigItemRegistry().setConfig(getCfg(event, "Item_Registry")); - new ConfigFarming().setConfig(getCfg(event, "Farming")); - new ConfigWorldGen().setConfig(getCfg(event, "WorldGen")); - new ConfigCrafting().setConfig(getCfg(event, "Crafting")); - new ConfigMobs().setConfig(getCfg(event, "Mobs")); - - BaseMaterialMF.init(); - MineFantasyAPI.isInDebugMode = isDebug(); - MFLogUtil.log("API Debug mode updated: " + MineFantasyAPI.isInDebugMode); - - addModFlags(); - proxy.preInit(); - - RecipeRemover.removeRecipes(); - ToolListMF.load(); - ComponentListMF.load(); + public void preInit(FMLPreInitializationEvent event) { + NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); + if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { + new ConfigClient().setConfig(getCfg(event, "Client")); + } + new ConfigArmour().setConfig(getCfg(event, "Armours")); + new ConfigExperiment().setConfig(getCfg(event, "Specials")); + new ConfigHardcore().setConfig(getCfg(event, "Hardcore")); + new ConfigIntegration().setConfig(getCfg(event, "Integration")); + new ConfigTools().setConfig(getCfg(event, "Tools")); + new ConfigWeapon().setConfig(getCfg(event, "Weapons")); + new ConfigStamina().setConfig(getCfg(event, "Stamina_System")); + new ConfigItemRegistry().setConfig(getCfg(event, "Item_Registry")); + new ConfigFarming().setConfig(getCfg(event, "Farming")); + new ConfigWorldGen().setConfig(getCfg(event, "WorldGen")); + new ConfigCrafting().setConfig(getCfg(event, "Crafting")); + new ConfigMobs().setConfig(getCfg(event, "Mobs")); + + BaseMaterialMF.init(); + MineFantasyAPI.isInDebugMode = isDebug(); + MFLogUtil.log("API Debug mode updated: " + MineFantasyAPI.isInDebugMode); + + addModFlags(); + proxy.preInit(); + + RecipeRemover.removeRecipes(); + ToolListMF.load(); + ComponentListMF.load(); } @EventHandler - public void load(FMLInitializationEvent evt) - { + public void load(FMLInitializationEvent evt) { MinecraftForge.EVENT_BUS.register(this); proxy.registerMain(); GameRegistry.registerWorldGenerator(worldGenManager, 0); - + packetHandler = new PacketHandlerMF(); FMLEventChannel eventChannel; - for(String channel:packetHandler.packetList.keySet()) - { + for (String channel : packetHandler.packetList.keySet()) { eventChannel = NetworkRegistry.INSTANCE.newEventDrivenChannel(channel); eventChannel.register(packetHandler); packetHandler.channels.put(channel, eventChannel); } } - + @EventHandler - public void modsLoaded(FMLPostInitializationEvent evt) - { - CustomArmourEntry.registerItem(Items.leather_helmet, ArmourDesign.LEATHER); - CustomArmourEntry.registerItem(Items.leather_chestplate, ArmourDesign.LEATHER); - CustomArmourEntry.registerItem(Items.leather_leggings, ArmourDesign.LEATHER); - CustomArmourEntry.registerItem(Items.leather_boots, ArmourDesign.LEATHER); - - CustomArmourEntry.registerItem(Items.chainmail_helmet, ArmourDesign.MAIL); - CustomArmourEntry.registerItem(Items.chainmail_chestplate, ArmourDesign.MAIL); - CustomArmourEntry.registerItem(Items.chainmail_leggings, ArmourDesign.MAIL); - CustomArmourEntry.registerItem(Items.chainmail_boots, ArmourDesign.MAIL); - - CustomArmourEntry.registerItem(Items.golden_helmet, ArmourDesign.SOLID, 1.5F, "medium"); - CustomArmourEntry.registerItem(Items.golden_chestplate, ArmourDesign.SOLID, 1.5F, "medium"); - CustomArmourEntry.registerItem(Items.golden_leggings, ArmourDesign.SOLID, 1.5F, "medium"); - CustomArmourEntry.registerItem(Items.golden_boots, ArmourDesign.SOLID, 1.5F, "medium"); - - ConfigItemRegistry.readCustoms(); - - for(BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) - { - registerBiomeStuff(biome); - } - KnowledgeListMF.init(); - ArtefactListMF.init(); - BasicRecipesMF.init(); - ItemLootSack.addItems(); - proxy.postInit(); - proxy.registerTickHandlers(); - MetalMaterial.addHeatables(); + public void modsLoaded(FMLPostInitializationEvent evt) { + CustomArmourEntry.registerItem(Items.leather_helmet, ArmourDesign.LEATHER); + CustomArmourEntry.registerItem(Items.leather_chestplate, ArmourDesign.LEATHER); + CustomArmourEntry.registerItem(Items.leather_leggings, ArmourDesign.LEATHER); + CustomArmourEntry.registerItem(Items.leather_boots, ArmourDesign.LEATHER); + + CustomArmourEntry.registerItem(Items.chainmail_helmet, ArmourDesign.MAIL); + CustomArmourEntry.registerItem(Items.chainmail_chestplate, ArmourDesign.MAIL); + CustomArmourEntry.registerItem(Items.chainmail_leggings, ArmourDesign.MAIL); + CustomArmourEntry.registerItem(Items.chainmail_boots, ArmourDesign.MAIL); + + CustomArmourEntry.registerItem(Items.golden_helmet, ArmourDesign.SOLID, 1.5F, "medium"); + CustomArmourEntry.registerItem(Items.golden_chestplate, ArmourDesign.SOLID, 1.5F, "medium"); + CustomArmourEntry.registerItem(Items.golden_leggings, ArmourDesign.SOLID, 1.5F, "medium"); + CustomArmourEntry.registerItem(Items.golden_boots, ArmourDesign.SOLID, 1.5F, "medium"); + + ConfigItemRegistry.readCustoms(); + + for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) { + registerBiomeStuff(biome); + } + KnowledgeListMF.init(); + ArtefactListMF.init(); + BasicRecipesMF.init(); + ItemLootSack.addItems(); + proxy.postInit(); + proxy.registerTickHandlers(); + MetalMaterial.addHeatables(); + } + + @EventHandler + public void serverLoad(FMLServerStartingEvent event) { + event.registerServerCommand(new CommandMF()); + } + + @EventHandler + public final void serverStarted(FMLServerStartedEvent event) { + if (event.getSide() != Side.CLIENT && isBukkitServer()) { + MFLogUtil.log("Bukkit has been detected"); + BukkitUtils.onServerStarted(); + } + + if (Loader.isModLoaded("MineTweaker3") && ConfigIntegration.mtIntegration) { + MTCompat.registerCommands(); + } + } + + private void registerBiomeStuff(BiomeGenBase biome) { + if (WorldGenBiological.isBiomeInConstraint(biome, ConfigWorldGen.berryMinTemp, ConfigWorldGen.berryMaxTemp, + ConfigWorldGen.berryMinRain, ConfigWorldGen.berryMaxRain)) { + biome.addFlower(BlockListMF.berryBush, 0, 5); + } } - private void registerBiomeStuff(BiomeGenBase biome) - { - if(WorldGenBiological.isBiomeInConstraint(biome, ConfigWorldGen.berryMinTemp, ConfigWorldGen.berryMaxTemp, ConfigWorldGen.berryMinRain, ConfigWorldGen.berryMaxRain)) - { - biome.addFlower(BlockListMF.berryBush, 0, 5); - } - } - - private static Configuration getCfg(FMLPreInitializationEvent event, String name) - { - return new Configuration(new File(event.getModConfigurationDirectory(), "MineFantasyII/"+name + ".cfg")); + private void addModFlags() { + isBukkitServer = setIsBukkitServer(); } - - - - - - private void addModFlags() - { - isBGLoaded = setIsBGLoaded(); - } - public static boolean isBGLoaded() - { - return isBGLoaded; - } - public static boolean setIsBGLoaded() - { - try - { - Class.forName("mods.battlegear2.Battlegear"); - //return Loader.isModLoaded("battlegear2"); - } - catch (ClassNotFoundException e) - { - return false; - } - return true; - } - - public static boolean isDebug() - { - return ConfigExperiment.debug.equals("AU32-Db42-Acf6-Ggh9-9E8d"); - } - - private static boolean isBGLoaded; - - /** - * Determines if a player name is that of a MF modder - */ - public static boolean isNameModder(String name) - { - return name.equals("Galactic_Hiker") || name.equals("tim4200"); - } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/api/MineFantasyAPI.java b/src/main/java/minefantasy/mf2/api/MineFantasyAPI.java index 25991791..a083a165 100644 --- a/src/main/java/minefantasy/mf2/api/MineFantasyAPI.java +++ b/src/main/java/minefantasy/mf2/api/MineFantasyAPI.java @@ -1,12 +1,6 @@ package minefantasy.mf2.api; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; - import com.google.common.collect.Lists; - import cpw.mods.fml.common.IFuelHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -23,505 +17,536 @@ import minefantasy.mf2.api.refine.BigFurnaceRecipes; import minefantasy.mf2.api.refine.BlastFurnaceRecipes; import minefantasy.mf2.api.rpg.Skill; -import minefantasy.mf2.item.archery.ItemArrowMF; import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.IRecipe; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.oredict.OreDictionary; -public class MineFantasyAPI -{ - /** - * This variable saves if MineFantasy is in debug mode - */ - public static boolean isInDebugMode; - - @SideOnly(Side.CLIENT) - public static void init() - { - } - public static void debugMsg(String msg) - { - MFLogUtil.logDebug(msg); - } - - public static void removeAllRecipes(Item result) - { - List recipeList = CraftingManager.getInstance().getRecipeList(); - for(int i = 0; i < recipeList.size(); i++) - { - IRecipe recipe = (IRecipe)recipeList.get(i); - if(recipe != null && recipe.getRecipeOutput() != null && recipe.getRecipeOutput().getItem() == result) - { - debugMsg("Removed Recipe for " + recipe.getRecipeOutput().getDisplayName()); - } - } - } - - /** - * Adds a shaped recipe for anvils with all variables - * - * @param result The output item - * @param hot True if the result is hot(Does not apply to blocks) - * @param experiance the experiance gained from crafting - * @param toolType the tool type required to hit ("hammer", "hvyHammer", etc) - * @param hammerType the hammer tier required for creation: - * @param anvil the anvil required bronze 0, iron 1, steel 2 - * @param forgeTime The time taken to forge(default is 200. each hit is about 100) - * @param input The input for the item (Exactly the same as regular recipes) - */ - public static void addAnvilRecipe(Skill skill, ItemStack result, boolean hot, String toolType, int hammerType, int anvil, int forgeTime, Object... input) - { - CraftingManagerAnvil.getInstance().addRecipe(result, skill, "", hot, 0F, toolType, hammerType, anvil, forgeTime, input); - } - /** {@link MineFantasyAPI#addCarpenterRecipe} */ - public static void addAnvilRecipe(Skill skill, ItemStack result, boolean hot, int hammerType, int anvil, int forgeTime, Object... input) - { - addAnvilRecipe(skill, result, hot, "hammer", hammerType, anvil, forgeTime, input); - } - - /** - * Adds a shaped recipe for anvils with all variables - * - * @param result The output item - * @param research The research required - * @param hot True if the result is hot(Does not apply to blocks) - * @param experiance the experiance gained from crafting - * @param toolType the tool type required to hit ("hammer", "hvyHammer", etc) - * @param hammerType the hammer tier required for creation: - * @param anvil the anvil required bronze 0, iron 1, steel 2 - * @param forgeTime The time taken to forge(default is 200. each hit is about 100) - * @param input The input for the item (Exactly the same as regular recipes) - */ - public static IAnvilRecipe addAnvilRecipe(Skill skill, ItemStack result, String research, boolean hot, String toolType, int hammerType, int anvil, int forgeTime, Object... input) - { - return CraftingManagerAnvil.getInstance().addRecipe(result, skill, research, hot, 0F, toolType, hammerType, anvil, forgeTime, input); - } - /** {@link MineFantasyAPI#addCarpenterRecipe} */ - public static IAnvilRecipe addAnvilRecipe(Skill skill, ItemStack result, String research, boolean hot, int hammerType, int anvil, int forgeTime, Object... input) - { - return addAnvilRecipe(skill, result, research, hot, "hammer", hammerType, anvil, forgeTime, input); - } - /** - * A special tier-sensitive recipe system for tools - * @param skill the Skill used - * @param result what item comes out (basic itemstack) - * @param research what research is used - * @param hot whether it requires quenching - * @param toolType the tool used (hammer or hvyHammer) - * @param hammerType the tier of hammer - * @param anvil the tier of anvil - * @param forgeTime the time it takes to forge - * @param input the items input - * @return - */ - public static IAnvilRecipe addAnvilToolRecipe(Skill skill, ItemStack result, String research, boolean hot, String toolType, int hammerType, int anvil, int forgeTime, Object... input) - { - return CraftingManagerAnvil.getInstance().addToolRecipe(result, skill, research, hot, 0F, toolType, hammerType, anvil, forgeTime, input); - } - public static IAnvilRecipe addAnvilToolRecipe(Skill skill, Item result, String research, boolean hot, String toolType, int hammerType, int anvil, int forgeTime, Object... input) - { - return addAnvilToolRecipe(skill, new ItemStack(result), research, hot, toolType, hammerType, anvil, forgeTime, input); - } - - /** - * Adds a shaped recipe for carpenter benches sensetive to tiers - * - * @param result The output item (basic itemstack) - * @param sound The sound it makes ("minefantasy2:blocks.carpentermallet"), "step.wood", etc - * @param experience the experience gained from crafting - * @param toolType the tool type required to hit - * @param toolTier the tools tier required for creation: - * @param craftTime The time taken to craft(default is 200. each hit is about 100) - * @param input The input for the item (Exactly the same as regular recipes) - */ - public static ICarpenterRecipe addCarpenterToolRecipe(Skill skill, ItemStack result, String research, String sound, String toolType, int toolTier, int craftTime, Object... input) - { - return CraftingManagerCarpenter.getInstance().addToolRecipe(result, skill, research, sound, 0F, toolType, toolTier, -1, craftTime, input); - } - public static ICarpenterRecipe addCarpenterToolRecipe(Skill skill, Item result, String research, String sound, String toolType, int toolTier, int craftTime, Object... input) - { - return CraftingManagerCarpenter.getInstance().addToolRecipe(new ItemStack(result), skill, research, sound, 0F, toolType, toolTier, -1, craftTime, input); - } - public static ICarpenterRecipe addCarpenterToolRecipe(Skill skill, Item result, String research, String sound, int craftTime, Object... input) - { - return CraftingManagerCarpenter.getInstance().addToolRecipe(new ItemStack(result), skill, research, sound, 0F, "hands", -1, -1, craftTime, input); - } - - /** - * Adds a shaped recipe for carpenter benches with all variables - * - * @param result The output item - * @param sound The sound it makes ("minefantasy2:blocks.carpentermallet"), "step.wood", etc - * @param experience the experience gained from crafting - * @param toolType the tool type required to hit - * @param toolTier the tools tier required for creation: - * @param craftTime The time taken to craft(default is 200. each hit is about 100) - * @param input The input for the item (Exactly the same as regular recipes) - */ - public static void addCarpenterRecipe(Skill skill, ItemStack result, String sound, String toolType, int toolTier, int craftTime, Object... input) - { - CraftingManagerCarpenter.getInstance().addRecipe(result, skill, "", sound, 0F, toolType, toolTier, -1, craftTime, input); - } - /** {@link MineFantasyAPI#addCarpenterRecipe} */ - public static void addCarpenterRecipe(Skill skill, ItemStack result, String sound, int craftTime, Object... input) - { - addCarpenterRecipe(skill, result, "", sound, "hands", -1, craftTime, input); - } - /** {@link MineFantasyAPI#addCarpenterRecipe} */ - public static void addShapelessCarpenterRecipe(Skill skill, ItemStack result, String sound, String toolType, int toolTier, int craftTime, Object... input) - { - CraftingManagerCarpenter.getInstance().addShapelessRecipe(result, skill, "", sound, 0F, toolType, toolTier, -1, craftTime, input); - } - /** {@link MineFantasyAPI#addCarpenterRecipe} */ - public static void addShapelessCarpenterRecipe(Skill skill, ItemStack result, String sound, int craftTime, Object... input) - { - addShapelessCarpenterRecipe(skill, result, sound, "hands", -1, craftTime, input); - } - - /** - * Adds a basic carpenter recipe similar to regular crafting - * This uses a single hit with bare hands - */ - public static ICarpenterRecipe addBasicCarpenterRecipe(ItemStack result, Object... input) - { - return CraftingManagerCarpenter.getInstance().addRecipe(result, null, "", "dig.wood", 0F, "hands", -1, -1, 1, input); - } - /** - * Adds a shaped recipe for carpenter benches with all variables - * - * @param result The output item - * @param research The research required - * @param sound The sound it makes ("minefantasy2:blocks.carpentermallet"), "step.wood", etc - * @param experience the experience gained from crafting - * @param toolType the tool type required to hit - * @param toolTier the tools tier required for creation: - * @param craftTime The time taken to craft(default is 200. each hit is about 100) - * @param input The input for the item (Exactly the same as regular recipes) - */ - public static ICarpenterRecipe addCarpenterRecipe(Skill skill, ItemStack result, String research, String sound, String toolType, int toolTier, int craftTime, Object... input) - { - return CraftingManagerCarpenter.getInstance().addRecipe(result, skill, research, sound, 0F, toolType, toolTier, -1, craftTime, input); - } - /** {@link MineFantasyAPI#addCarpenterRecipe} */ - public static ICarpenterRecipe addCarpenterRecipe(Skill skill, ItemStack result, String research, String sound, int craftTime, Object... input) - { - return addCarpenterRecipe(skill, result, research, sound, "hands", -1, craftTime, input); - } - /** {@link MineFantasyAPI#addCarpenterRecipe} */ - public static ICarpenterRecipe addShapelessCarpenterRecipe(Skill skill, ItemStack result, String research, String sound, String toolType, int toolTier, int craftTime, Object... input) - { - return CraftingManagerCarpenter.getInstance().addShapelessRecipe(result, skill, research, sound, 0F, toolType, toolTier, -1, craftTime, input); - } - /** {@link MineFantasyAPI#addCarpenterRecipe} */ - public static ICarpenterRecipe addShapelessCarpenterRecipe(Skill skill, ItemStack result, String research, String sound, int craftTime, Object... input) - { - return addShapelessCarpenterRecipe(skill, result, research, sound, "hands", -1, craftTime, input); - } - - public static void addBlastFurnaceRecipe(Block input, ItemStack output) - { - BlastFurnaceRecipes.smelting().addRecipe(input, output); - } - public static void addBlastFurnaceRecipe(Item input, ItemStack output) - { - BlastFurnaceRecipes.smelting().addRecipe(input, output); - } - public static void addBlastFurnaceRecipe(ItemStack input, ItemStack output) - { - BlastFurnaceRecipes.smelting().addRecipe(input, output); - } - /** - * This fuel handler is for MineFantasy equipment, it uses real fuel(like coal) not wood - */ - private static List fuelHandlers = Lists.newArrayList(); - public static void registerFuelHandler(IFuelHandler handler) - { +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; + +public class MineFantasyAPI { + /** + * This variable saves if MineFantasy is in debug mode + */ + public static boolean isInDebugMode; + /** + * This fuel handler is for MineFantasy equipment, it uses real fuel(like coal) + * not wood + */ + private static List fuelHandlers = Lists.newArrayList(); + + @SideOnly(Side.CLIENT) + public static void init() { + } + + public static void debugMsg(String msg) { + MFLogUtil.logDebug(msg); + } + + public static void removeAllRecipes(Item result) { + List recipeList = CraftingManager.getInstance().getRecipeList(); + for (int i = 0; i < recipeList.size(); i++) { + IRecipe recipe = (IRecipe) recipeList.get(i); + if (recipe != null && recipe.getRecipeOutput() != null && recipe.getRecipeOutput().getItem() == result) { + debugMsg("Removed Recipe for " + recipe.getRecipeOutput().getDisplayName()); + } + } + } + + /** + * Adds a shaped recipe for anvils with all variables + * + * @param result The output item + * @param hot True if the result is hot(Does not apply to blocks) + * @param experiance the experiance gained from crafting + * @param toolType the tool type required to hit ("hammer", "hvyHammer", etc) + * @param hammerType the hammer tier required for creation: + * @param anvil the anvil required bronze 0, iron 1, steel 2 + * @param forgeTime The time taken to forge(default is 200. each hit is about 100) + * @param input The input for the item (Exactly the same as regular recipes) + */ + public static void addAnvilRecipe(Skill skill, ItemStack result, boolean hot, String toolType, int hammerType, + int anvil, int forgeTime, Object... input) { + CraftingManagerAnvil.getInstance().addRecipe(result, skill, "", hot, 0F, toolType, hammerType, anvil, forgeTime, + input); + } + + /** + * {@link MineFantasyAPI#addCarpenterRecipe} + */ + public static void addAnvilRecipe(Skill skill, ItemStack result, boolean hot, int hammerType, int anvil, + int forgeTime, Object... input) { + addAnvilRecipe(skill, result, hot, "hammer", hammerType, anvil, forgeTime, input); + } + + /** + * Adds a shaped recipe for anvils with all variables + * + * @param result The output item + * @param research The research required + * @param hot True if the result is hot(Does not apply to blocks) + * @param experiance the experiance gained from crafting + * @param toolType the tool type required to hit ("hammer", "hvyHammer", etc) + * @param hammerType the hammer tier required for creation: + * @param anvil the anvil required bronze 0, iron 1, steel 2 + * @param forgeTime The time taken to forge(default is 200. each hit is about 100) + * @param input The input for the item (Exactly the same as regular recipes) + */ + public static IAnvilRecipe addAnvilRecipe(Skill skill, ItemStack result, String research, boolean hot, + String toolType, int hammerType, int anvil, int forgeTime, Object... input) { + return CraftingManagerAnvil.getInstance().addRecipe(result, skill, research, hot, 0F, toolType, hammerType, + anvil, forgeTime, input); + } + + /** + * {@link MineFantasyAPI#addCarpenterRecipe} + */ + public static IAnvilRecipe addAnvilRecipe(Skill skill, ItemStack result, String research, boolean hot, + int hammerType, int anvil, int forgeTime, Object... input) { + return addAnvilRecipe(skill, result, research, hot, "hammer", hammerType, anvil, forgeTime, input); + } + + /** + * A special tier-sensitive recipe system for tools + * + * @param skill the Skill used + * @param result what item comes out (basic itemstack) + * @param research what research is used + * @param hot whether it requires quenching + * @param toolType the tool used (hammer or hvyHammer) + * @param hammerType the tier of hammer + * @param anvil the tier of anvil + * @param forgeTime the time it takes to forge + * @param input the items input + * @return + */ + public static IAnvilRecipe addAnvilToolRecipe(Skill skill, ItemStack result, String research, boolean hot, + String toolType, int hammerType, int anvil, int forgeTime, Object... input) { + return CraftingManagerAnvil.getInstance().addToolRecipe(result, skill, research, hot, 0F, toolType, hammerType, + anvil, forgeTime, input); + } + + public static IAnvilRecipe addAnvilToolRecipe(Skill skill, Item result, String research, boolean hot, + String toolType, int hammerType, int anvil, int forgeTime, Object... input) { + return addAnvilToolRecipe(skill, new ItemStack(result), research, hot, toolType, hammerType, anvil, forgeTime, + input); + } + + /** + * Adds a shaped recipe for carpenter benches sensetive to tiers + * + * @param result The output item (basic itemstack) + * @param sound The sound it makes ("minefantasy2:blocks.carpentermallet"), + * "step.wood", etc + * @param experience the experience gained from crafting + * @param toolType the tool type required to hit + * @param toolTier the tools tier required for creation: + * @param craftTime The time taken to craft(default is 200. each hit is about 100) + * @param input The input for the item (Exactly the same as regular recipes) + */ + public static ICarpenterRecipe addCarpenterToolRecipe(Skill skill, ItemStack result, String research, String sound, + String toolType, int toolTier, int craftTime, Object... input) { + return CraftingManagerCarpenter.getInstance().addToolRecipe(result, skill, research, sound, 0F, toolType, + toolTier, -1, craftTime, input); + } + + public static ICarpenterRecipe addCarpenterToolRecipe(Skill skill, Item result, String research, String sound, + String toolType, int toolTier, int craftTime, Object... input) { + return CraftingManagerCarpenter.getInstance().addToolRecipe(new ItemStack(result), skill, research, sound, 0F, + toolType, toolTier, -1, craftTime, input); + } + + public static ICarpenterRecipe addCarpenterToolRecipe(Skill skill, Item result, String research, String sound, + int craftTime, Object... input) { + return CraftingManagerCarpenter.getInstance().addToolRecipe(new ItemStack(result), skill, research, sound, 0F, + "hands", -1, -1, craftTime, input); + } + + /** + * Adds a shaped recipe for carpenter benches with all variables + * + * @param result The output item + * @param sound The sound it makes ("minefantasy2:blocks.carpentermallet"), + * "step.wood", etc + * @param experience the experience gained from crafting + * @param toolType the tool type required to hit + * @param toolTier the tools tier required for creation: + * @param craftTime The time taken to craft(default is 200. each hit is about 100) + * @param input The input for the item (Exactly the same as regular recipes) + */ + public static void addCarpenterRecipe(Skill skill, ItemStack result, String sound, String toolType, int toolTier, + int craftTime, Object... input) { + CraftingManagerCarpenter.getInstance().addRecipe(result, skill, "", sound, 0F, toolType, toolTier, -1, + craftTime, input); + } + + /** + * {@link MineFantasyAPI#addCarpenterRecipe} + */ + public static void addCarpenterRecipe(Skill skill, ItemStack result, String sound, int craftTime, Object... input) { + addCarpenterRecipe(skill, result, "", sound, "hands", -1, craftTime, input); + } + + /** + * {@link MineFantasyAPI#addCarpenterRecipe} + */ + public static void addShapelessCarpenterRecipe(Skill skill, ItemStack result, String sound, String toolType, + int toolTier, int craftTime, Object... input) { + CraftingManagerCarpenter.getInstance().addShapelessRecipe(result, skill, "", sound, 0F, toolType, toolTier, -1, + craftTime, input); + } + + /** + * {@link MineFantasyAPI#addCarpenterRecipe} + */ + public static void addShapelessCarpenterRecipe(Skill skill, ItemStack result, String sound, int craftTime, + Object... input) { + addShapelessCarpenterRecipe(skill, result, sound, "hands", -1, craftTime, input); + } + + /** + * Adds a basic carpenter recipe similar to regular crafting This uses a single + * hit with bare hands + */ + public static ICarpenterRecipe addBasicCarpenterRecipe(ItemStack result, Object... input) { + return CraftingManagerCarpenter.getInstance().addRecipe(result, null, "", "dig.wood", 0F, "hands", -1, -1, 1, + input); + } + + /** + * Adds a shaped recipe for carpenter benches with all variables + * + * @param result The output item + * @param research The research required + * @param sound The sound it makes ("minefantasy2:blocks.carpentermallet"), + * "step.wood", etc + * @param experience the experience gained from crafting + * @param toolType the tool type required to hit + * @param toolTier the tools tier required for creation: + * @param craftTime The time taken to craft(default is 200. each hit is about 100) + * @param input The input for the item (Exactly the same as regular recipes) + */ + public static ICarpenterRecipe addCarpenterRecipe(Skill skill, ItemStack result, String research, String sound, + String toolType, int toolTier, int craftTime, Object... input) { + return CraftingManagerCarpenter.getInstance().addRecipe(result, skill, research, sound, 0F, toolType, toolTier, + -1, craftTime, input); + } + + /** + * {@link MineFantasyAPI#addCarpenterRecipe} + */ + public static ICarpenterRecipe addCarpenterRecipe(Skill skill, ItemStack result, String research, String sound, + int craftTime, Object... input) { + return addCarpenterRecipe(skill, result, research, sound, "hands", -1, craftTime, input); + } + + /** + * {@link MineFantasyAPI#addCarpenterRecipe} + */ + public static ICarpenterRecipe addShapelessCarpenterRecipe(Skill skill, ItemStack result, String research, + String sound, String toolType, int toolTier, int craftTime, Object... input) { + return CraftingManagerCarpenter.getInstance().addShapelessRecipe(result, skill, research, sound, 0F, toolType, + toolTier, -1, craftTime, input); + } + + /** + * {@link MineFantasyAPI#addCarpenterRecipe} + */ + public static ICarpenterRecipe addShapelessCarpenterRecipe(Skill skill, ItemStack result, String research, + String sound, int craftTime, Object... input) { + return addShapelessCarpenterRecipe(skill, result, research, sound, "hands", -1, craftTime, input); + } + + public static void addBlastFurnaceRecipe(Block input, ItemStack output) { + BlastFurnaceRecipes.smelting().addRecipe(input, output); + } + + public static void addBlastFurnaceRecipe(Item input, ItemStack output) { + BlastFurnaceRecipes.smelting().addRecipe(input, output); + } + + public static void addBlastFurnaceRecipe(ItemStack input, ItemStack output) { + BlastFurnaceRecipes.smelting().addRecipe(input, output); + } + + public static void registerFuelHandler(IFuelHandler handler) { fuelHandlers.add(handler); } - public static int getFuelValue(ItemStack itemStack) - { + + public static int getFuelValue(ItemStack itemStack) { int fuelValue = 0; - for (IFuelHandler handler : fuelHandlers) - { + for (IFuelHandler handler : fuelHandlers) { fuelValue = Math.max(fuelValue, handler.getBurnTime(itemStack)); } return fuelValue; } - + + /** + * Adds an alloy for any Crucible + * + * @param out The result + * @param in The list of required items + */ + public static void addAlloy(ItemStack out, Object... in) { + AlloyRecipes.addAlloy(out, convertList(in)); + } + + /** + * Adds an alloy with a minimal furnace level + * + * @param out The result + * @param level The minimal furnace level + * @param in The list of required items + */ + public static void addAlloy(ItemStack out, int level, Object... in) { + AlloyRecipes.addAlloy(out, level, convertList(in)); + } + + /** + * Adds an alloy with a minimal furnace level + * + * @param dupe the amount of times the ratio can be added + * @param out The result + * @param level The minimal furnace level + * @param in The list of required items + */ + public static Alloy[] addRatioAlloy(int dupe, ItemStack out, int level, Object... in) { + return AlloyRecipes.addRatioRecipe(out, level, convertList(in), dupe); + } + + /** + * Adds an alloy with any smelter + * + * @param dupe the amount of times the ratio can be added + * @param out The result + * @param level The minimal furnace level + * @param in The list of required items + */ + public static Alloy[] addRatioAlloy(int dupe, ItemStack out, Object... in) { + return AlloyRecipes.addRatioRecipe(out, 0, convertList(in), dupe); + } + /** - * Adds an alloy for any Crucible - * @param out The result - * @param in The list of required items - */ - public static void addAlloy(ItemStack out, Object... in) - { - AlloyRecipes.addAlloy(out, convertList(in)); - } - - /** - * Adds an alloy with a minimal furnace level - * @param out The result - * @param level The minimal furnace level - * @param in The list of required items - */ - public static void addAlloy(ItemStack out, int level, Object... in) - { - AlloyRecipes.addAlloy(out, level, convertList(in)); - } - - - /** - * Adds an alloy with a minimal furnace level - * @param dupe the amount of times the ratio can be added - * @param out The result - * @param level The minimal furnace level - * @param in The list of required items - */ - public static Alloy[] addRatioAlloy(int dupe, ItemStack out, int level, Object... in) - { - return AlloyRecipes.addRatioRecipe(out, level, convertList(in), dupe); - } - - /** - * Adds an alloy with any smelter - * @param dupe the amount of times the ratio can be added - * @param out The result - * @param level The minimal furnace level - * @param in The list of required items - */ - public static Alloy[] addRatioAlloy(int dupe, ItemStack out, Object... in) - { - return AlloyRecipes.addRatioRecipe(out, 0, convertList(in), dupe); - } - - /** - * Adds a custom alloy - * @param alloy the Alloy to add - * Use this if you want your alloy to have special properties - * @see Alloy - */ - public static void addAlloy(Alloy alloy) - { - AlloyRecipes.addAlloy(alloy); - } - - private static List convertList(Object[] in) - { - ArrayList arraylist = new ArrayList(); + * Adds a custom alloy + * + * @param alloy the Alloy to add Use this if you want your alloy to have special + * properties + * @see Alloy + */ + public static void addAlloy(Alloy alloy) { + AlloyRecipes.addAlloy(alloy); + } + + private static List convertList(Object[] in) { + ArrayList arraylist = new ArrayList(); Object[] aobject = in; int i = in.length; - for (int j = 0; j < i; ++j) - { + for (int j = 0; j < i; ++j) { Object object1 = aobject[j]; - if (object1 instanceof ItemStack) - { - arraylist.add(((ItemStack)object1).copy()); - } - else if (object1 instanceof Item) - { - arraylist.add(new ItemStack((Item)object1)); - } - else - { - if (!(object1 instanceof Block)) - { + if (object1 instanceof ItemStack) { + arraylist.add(((ItemStack) object1).copy()); + } else if (object1 instanceof Item) { + arraylist.add(new ItemStack((Item) object1)); + } else { + if (!(object1 instanceof Block)) { throw new RuntimeException("MineFantasy: Invalid alloy!"); } - arraylist.add(new ItemStack((Block)object1)); + arraylist.add(new ItemStack((Block) object1)); } } - + return arraylist; - } - - /** - * Allows an item to be heated - * - * @param item the item to heat - * @param min the minimum heat to forge with(celcius) - * @param max the maximum heat until the item is ruined(celcius) - * @param unstable when the ingot is unstable(celcius) - */ - public static void setHeatableStats(ItemStack item, int min, int unstable, int max) - { - Heatable.addItem(item, min, unstable, max); - } - - /** - * Allows an item to be heated ignoring subId - * - * @param id the item to heat - * @param min the minimum heat to forge with(celcius) - * @param max the maximum heat until the item is ruined(celcius) - * @param unstable when the ingot is unstable(celcius) - */ - public static void setHeatableStats(Item id, int min, int unstable, int max) - { - Heatable.addItem(new ItemStack(id, 1, OreDictionary.WILDCARD_VALUE), min, unstable, max); - } - - public static void setHeatableStats(String oredict, int min, int unstable, int max) - { - for(ItemStack item : OreDictionary.getOres(oredict)) - { - setHeatableStats(item, min, unstable, max); - } - } - - private static ItemStack convertItem(Object object) - { - if(object instanceof ItemStack) - { - return ((ItemStack)object); - } - if(object instanceof Item) - { - return new ItemStack((Item)object, 1, OreDictionary.WILDCARD_VALUE); - } - if(object instanceof Block) - { - return new ItemStack((Block)object, 1, OreDictionary.WILDCARD_VALUE); - } - return null; - } - - /** - * Adds a crossbow part Make sure to do this when adding the item - */ - public static void registerCrossbowPart(ICrossbowPart part) - { - ICrossbowPart.components.put(part.getComponentType()+part.getID(), part); - } - /** - * For Hardcore Crafting: Can remove smelting recipes - * @param input can be an "Item", "Block" or "ItemStack" - */ - public static boolean removeSmelting(Object input) - { - ItemStack object = null; - if(input instanceof Item) - { - object = new ItemStack((Item)input, 1, 32767); - } - else if(input instanceof Block) - { - object = new ItemStack((Block)input, 1, 32767); - } - else if(input instanceof ItemStack) - { - object = (ItemStack)input; - } - if(object != null) - { - return removeFurnaceInput(object); - } - return false; - } - private static boolean removeFurnaceInput(ItemStack input) - { + } + + /** + * Allows an item to be heated + * + * @param item the item to heat + * @param min the minimum heat to forge with(celcius) + * @param max the maximum heat until the item is ruined(celcius) + * @param unstable when the ingot is unstable(celcius) + */ + public static void setHeatableStats(ItemStack item, int min, int unstable, int max) { + Heatable.addItem(item, min, unstable, max); + } + + /** + * Allows an item to be heated ignoring subId + * + * @param id the item to heat + * @param min the minimum heat to forge with(celcius) + * @param max the maximum heat until the item is ruined(celcius) + * @param unstable when the ingot is unstable(celcius) + */ + public static void setHeatableStats(Item id, int min, int unstable, int max) { + Heatable.addItem(new ItemStack(id, 1, OreDictionary.WILDCARD_VALUE), min, unstable, max); + } + + public static void setHeatableStats(String oredict, int min, int unstable, int max) { + for (ItemStack item : OreDictionary.getOres(oredict)) { + setHeatableStats(item, min, unstable, max); + } + } + + private static ItemStack convertItem(Object object) { + if (object instanceof ItemStack) { + return ((ItemStack) object); + } + if (object instanceof Item) { + return new ItemStack((Item) object, 1, OreDictionary.WILDCARD_VALUE); + } + if (object instanceof Block) { + return new ItemStack((Block) object, 1, OreDictionary.WILDCARD_VALUE); + } + return null; + } + + /** + * Adds a crossbow part Make sure to do this when adding the item + */ + public static void registerCrossbowPart(ICrossbowPart part) { + ICrossbowPart.components.put(part.getComponentType() + part.getID(), part); + } + + /** + * For Hardcore Crafting: Can remove smelting recipes + * + * @param input can be an "Item", "Block" or "ItemStack" + */ + public static boolean removeSmelting(Object input) { + ItemStack object = null; + if (input instanceof Item) { + object = new ItemStack((Item) input, 1, 32767); + } else if (input instanceof Block) { + object = new ItemStack((Block) input, 1, 32767); + } else if (input instanceof ItemStack) { + object = (ItemStack) input; + } + if (object != null) { + return removeFurnaceInput(object); + } + return false; + } + + private static boolean removeFurnaceInput(ItemStack input) { Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator(); Entry entry; - do - { - if (!iterator.hasNext()) - { + do { + if (!iterator.hasNext()) { return false; } - entry = (Entry)iterator.next(); - } - while (!checkMatch(input, (ItemStack)entry.getKey())); + entry = (Entry) iterator.next(); + } while (!checkMatch(input, (ItemStack) entry.getKey())); FurnaceRecipes.smelting().getSmeltingList().remove(entry.getKey()); return true; } - private static boolean checkMatch(ItemStack item1, ItemStack item2) - { - return item2.getItem() == item1.getItem() && (item2.getItemDamage() == 32767 || item2.getItemDamage() == item1.getItemDamage()); - } - - /** - * Add a cooking recipe - * @param input what goes in - * @param output what is made - * @param min_temperature minimal temperature to work - * @param max_temperature maximum temperature until burn - * @param time how many ticks until it finishes - * @param requireBaking whether it needs to be in an oven - */ - public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, int min_temperature, int max_temperature, int time, boolean requireBaking) - { - return CookRecipe.addRecipe(input, output, min_temperature, max_temperature, time, requireBaking, true); - } - - /** - * Add a cooking recipe - * @param input what goes in - * @param output what is made - * @param min_temperature minimal temperature to work - * @param max_temperature maximum temperature until burn - * @param time how many ticks until it finishes - * @param requireBaking whether it needs to be in an oven - * @param canBurn false if it cannot burn by traditional means (such as if its in a container) - */ - public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, int min_temperature, int max_temperature, int time, boolean requireBaking, boolean canBurn) - { - return CookRecipe.addRecipe(input, output, min_temperature, max_temperature, time, requireBaking, canBurn); - } - /** - * Add a cooking recipe - * @param input what goes in - * @param output what is made - * @param min_temperature minimal temperature to work - * @param max_temperature maximum temperature until burn - * @param time how many ticks until it finishes - * @param requireBaking whether it needs to be in an oven - * @param canBurn false if it cannot burn by traditional means (such as if its in a container) - */ - public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, ItemStack burnItem, int min_temperature, int max_temperature, int time, boolean requireBaking) - { - return CookRecipe.addRecipe(input, output, burnItem, min_temperature, max_temperature, time, requireBaking, true); - } - - /** - * Add a cooking recipe - * @param input what goes in - * @param output what is made - * @param min_temperature minimal temperature to work - * @param max_temperature maximum temperature until burn - * @param time how many ticks until it finishes - * @param burn_time how long until a finished product burns - * @param requireBaking whether it needs to be in an oven - * @param canBurn false if it cannot burn by traditional means (such as if its in a container) - */ - public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, ItemStack burnItem, int min_temperature, int max_temperature, int time, int burn_time, boolean requireBaking) - { - return CookRecipe.addRecipe(input, output, burnItem, min_temperature, max_temperature, time, burn_time, requireBaking, true); - } - - public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, ItemStack burnItem, int min_temperature, int max_temperature, int time, int burn_time, boolean requireBaking, boolean canBurn) - { - return CookRecipe.addRecipe(input, output, burnItem, min_temperature, max_temperature, time, burn_time, requireBaking, canBurn); - } - - public static QuernRecipes addQuernRecipe(ItemStack input, ItemStack output) - { - return QuernRecipes.addRecipe(input, output, 1); - } - public static BigFurnaceRecipes addFurnaceRecipe(ItemStack input, ItemStack output, int tier) - { - return BigFurnaceRecipes.addRecipe(input, output, tier); - } + + private static boolean checkMatch(ItemStack item1, ItemStack item2) { + return item2.getItem() == item1.getItem() + && (item2.getItemDamage() == 32767 || item2.getItemDamage() == item1.getItemDamage()); + } + + /** + * Add a cooking recipe + * + * @param input what goes in + * @param output what is made + * @param min_temperature minimal temperature to work + * @param max_temperature maximum temperature until burn + * @param time how many ticks until it finishes + * @param requireBaking whether it needs to be in an oven + */ + public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, int min_temperature, + int max_temperature, int time, boolean requireBaking) { + return CookRecipe.addRecipe(input, output, min_temperature, max_temperature, time, requireBaking, true); + } + + /** + * Add a cooking recipe + * + * @param input what goes in + * @param output what is made + * @param min_temperature minimal temperature to work + * @param max_temperature maximum temperature until burn + * @param time how many ticks until it finishes + * @param requireBaking whether it needs to be in an oven + * @param canBurn false if it cannot burn by traditional means (such as if its in a + * container) + */ + public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, int min_temperature, + int max_temperature, int time, boolean requireBaking, boolean canBurn) { + return CookRecipe.addRecipe(input, output, min_temperature, max_temperature, time, requireBaking, canBurn); + } + + /** + * Add a cooking recipe + * + * @param input what goes in + * @param output what is made + * @param min_temperature minimal temperature to work + * @param max_temperature maximum temperature until burn + * @param time how many ticks until it finishes + * @param requireBaking whether it needs to be in an oven + * @param canBurn false if it cannot burn by traditional means (such as if its in a + * container) + */ + public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, ItemStack burnItem, + int min_temperature, int max_temperature, int time, boolean requireBaking) { + return CookRecipe.addRecipe(input, output, burnItem, min_temperature, max_temperature, time, requireBaking, + true); + } + + /** + * Add a cooking recipe + * + * @param input what goes in + * @param output what is made + * @param min_temperature minimal temperature to work + * @param max_temperature maximum temperature until burn + * @param time how many ticks until it finishes + * @param burn_time how long until a finished product burns + * @param requireBaking whether it needs to be in an oven + * @param canBurn false if it cannot burn by traditional means (such as if its in a + * container) + */ + public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, ItemStack burnItem, + int min_temperature, int max_temperature, int time, int burn_time, boolean requireBaking) { + return CookRecipe.addRecipe(input, output, burnItem, min_temperature, max_temperature, time, burn_time, + requireBaking, true); + } + + public static CookRecipe addCookingRecipe(ItemStack input, ItemStack output, ItemStack burnItem, + int min_temperature, int max_temperature, int time, int burn_time, boolean requireBaking, boolean canBurn) { + return CookRecipe.addRecipe(input, output, burnItem, min_temperature, max_temperature, time, burn_time, + requireBaking, canBurn); + } + + public static QuernRecipes addQuernRecipe(ItemStack input, ItemStack output) { + return addQuernRecipe(input, output, 1, true); + } + + public static QuernRecipes addQuernRecipe(ItemStack input, ItemStack output, int tier) { + return addQuernRecipe(input, output, tier, true); + } + + public static QuernRecipes addQuernRecipe(ItemStack input, ItemStack output, int tier, boolean consumePot) { + return QuernRecipes.addRecipe(input, output, tier, consumePot); + } + + public static BigFurnaceRecipes addFurnaceRecipe(ItemStack input, ItemStack output, int tier) { + return BigFurnaceRecipes.addRecipe(input, output, tier); + } } diff --git a/src/main/java/minefantasy/mf2/api/archery/AmmoMechanicsMF.java b/src/main/java/minefantasy/mf2/api/archery/AmmoMechanicsMF.java index a54fd9d6..ae8b0908 100644 --- a/src/main/java/minefantasy/mf2/api/archery/AmmoMechanicsMF.java +++ b/src/main/java/minefantasy/mf2/api/archery/AmmoMechanicsMF.java @@ -1,8 +1,5 @@ package minefantasy.mf2.api.archery; -import java.util.ArrayList; -import java.util.List; - import minefantasy.mf2.block.decor.BlockAmmoBox; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -15,268 +12,235 @@ import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; -public class AmmoMechanicsMF -{ - /** - * List of fireable arrows - */ - public static List arrows = new ArrayList(); - /** - * List of handlers - */ - public static List handlers = new ArrayList(); - - /** - * Adds an arrow that can be fired - */ - public static void addArrow(ItemStack item) - { - arrows.add(item); - } - - /** - * Adds an arrow that can be fired not considering sub Ids - */ - public static void addArrow(Item item) - { - addArrow(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE)); - } - - /** - * Adds a handler - */ - public static void addHandler(IArrowHandler handler) - { - handlers.add(handler); - } - - public static void putAmmoOnFirearm(ItemStack weapon, ItemStack ammo) - { - NBTTagCompound save = new NBTTagCompound(); - if(ammo == null) - { - getNBT(weapon).removeTag(arrowOnBowNBT); - return; - } - ammo.writeToNBT(save); - getNBT(weapon).setTag(arrowOnBowNBT, save); - } - /** - * Gets the arrow loaded on the bow used for rendering and firing - */ - public static ItemStack getArrowOnBow(ItemStack bow) - { - if(bow != null && bow.hasTagCompound()) - { - if(bow.getTagCompound().hasKey(arrowOnBowNBT)) - { - return ItemStack.loadItemStackFromNBT(bow.getTagCompound().getCompoundTag(arrowOnBowNBT)); - } - } - return null; - } - - public static final String arrowOnBowNBT = "loadedArrow"; - public static final String savedAmmoNBT = "MF_PresetArrow"; - /** - * Gets a loaded arrow from a bow - */ - public static ItemStack reloadBow(ItemStack bow) - { - if(!bow.hasTagCompound()) - { - return null; - } - if(bow.getTagCompound().hasKey(savedAmmoNBT)) - { - ItemStack ammo = ItemStack.loadItemStackFromNBT(bow.getTagCompound().getCompoundTag(savedAmmoNBT)); - - if(ammo != null) - { - ItemStack arrow = ammo.copy(); - arrow.stackSize = 1; - return arrow; - } - } - return null; - } - /** - * Removes 1 from the ammo - */ - public static void consumeAmmo(EntityPlayer user, ItemStack bow) - { - ItemStack ammo = getAmmo(bow); - if(user.capabilities.isCreativeMode) - { - return; - } - if(ammo != null) - { - --ammo.stackSize; - if(ammo.stackSize > 0) - { - setAmmo(bow, ammo); - } - else - { - getNBT(bow).removeTag(savedAmmoNBT); - } - } - } - /** - * Gets what ammo is loaded - */ - public static ItemStack getAmmo(ItemStack bow) - { - if(!bow.hasTagCompound()) - { - return null; - } - if(bow.getTagCompound().hasKey(savedAmmoNBT)) - { - return ItemStack.loadItemStackFromNBT(bow.getTagCompound().getCompoundTag(savedAmmoNBT)); - } - return null; - } - /** - * Sets the ammo for the bow - */ - public static void setAmmo(ItemStack bow, ItemStack ammo) - { - NBTTagCompound nbt = getNBT(bow); - - if(ammo != null) - { - NBTTagCompound save = new NBTTagCompound(); - ammo.writeToNBT(save); - nbt.setTag(savedAmmoNBT, save); - } - else - { - nbt.removeTag(savedAmmoNBT); - } - } +import java.util.ArrayList; +import java.util.List; + +public class AmmoMechanicsMF { + public static final String arrowOnBowNBT = "loadedArrow"; + public static final String savedAmmoNBT = "MF_PresetArrow"; + private static final String ammoNBT = "MFammo"; + /** + * List of fireable arrows + */ + public static List arrows = new ArrayList(); + /** + * List of handlers + */ + public static List handlers = new ArrayList(); + + /** + * Adds an arrow that can be fired + */ + public static void addArrow(ItemStack item) { + arrows.add(item); + } + + /** + * Adds an arrow that can be fired not considering sub Ids + */ + public static void addArrow(Item item) { + addArrow(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE)); + } + + /** + * Adds a handler + */ + public static void addHandler(IArrowHandler handler) { + handlers.add(handler); + } + + public static void putAmmoOnFirearm(ItemStack weapon, ItemStack ammo) { + NBTTagCompound save = new NBTTagCompound(); + if (ammo == null) { + getNBT(weapon).removeTag(arrowOnBowNBT); + return; + } + ammo.writeToNBT(save); + getNBT(weapon).setTag(arrowOnBowNBT, save); + } + + /** + * Gets the arrow loaded on the bow used for rendering and firing + */ + public static ItemStack getArrowOnBow(ItemStack bow) { + if (bow != null && bow.hasTagCompound()) { + if (bow.getTagCompound().hasKey(arrowOnBowNBT)) { + return ItemStack.loadItemStackFromNBT(bow.getTagCompound().getCompoundTag(arrowOnBowNBT)); + } + } + return null; + } + + /** + * Gets a loaded arrow from a bow + */ + public static ItemStack reloadBow(ItemStack bow) { + if (!bow.hasTagCompound()) { + return null; + } + if (bow.getTagCompound().hasKey(savedAmmoNBT)) { + ItemStack ammo = ItemStack.loadItemStackFromNBT(bow.getTagCompound().getCompoundTag(savedAmmoNBT)); - public static NBTTagCompound getNBT(ItemStack item) - { - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - return item.getTagCompound(); - } + if (ammo != null) { + ItemStack arrow = ammo.copy(); + arrow.stackSize = 1; + return arrow; + } + } + return null; + } - public static void removeAmmo(ItemStack bow) - { - getNBT(bow).removeTag(savedAmmoNBT); - } - - public static boolean isDepleted(ItemStack firearm) - { - return getGunAmmoCount(firearm) == 0 && getAmmo(firearm) == null && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, firearm) == 0; - } - - public static boolean isFirearmLoaded(ItemStack firearm) - { - return getGunAmmoCount(firearm)>0; - } - public static void modifyAmmo(ItemStack item, int value) - { - int ammo = getGunAmmoCount(item) + value; - setGunAmmoCount(item, ammo); - } - private static final String ammoNBT = "MFammo"; - public static void setGunAmmoCount(ItemStack item, int ammo) - { - NBTTagCompound nbt = getNBT(item); - nbt.setInteger(ammoNBT, ammo); - } - public static int getGunAmmoCount(ItemStack item) - { - if(getArrowOnBow(item) == null){return 0;} - NBTTagCompound nbt = getNBT(item); - - if(nbt.hasKey(ammoNBT)) - { - return nbt.getInteger(ammoNBT); - } - return 1; - } + /** + * Removes 1 from the ammo + */ + public static void consumeAmmo(EntityPlayer user, ItemStack bow) { + ItemStack ammo = getAmmo(bow); + if (user.capabilities.isCreativeMode) { + return; + } + if (ammo != null) { + --ammo.stackSize; + if (ammo.stackSize > 0) { + setAmmo(bow, ammo); + } else { + getNBT(bow).removeTag(savedAmmoNBT); + } + } + } - public static void dropAmmoCrate(World world, ItemStack crate, double x, double y, double z) - { - ItemStack drop = BlockAmmoBox.getHeld(crate, true); - int stock = BlockAmmoBox.getStock(crate, true); - if(drop != null) - { - while(stock > 0) - { - int stackSize = Math.min(stock, drop.getMaxStackSize()); - stock -= stackSize; - ItemStack newdrop = drop.copy(); - newdrop.stackSize = stackSize; - entityDropItem(world,x, y, z, newdrop); - } - } - } - /** - * Drops the loaded and storred ammo for an item, from coords - */ - public static void dropAmmo(World world, ItemStack firearm, double x, double y, double z) - { - ItemStack ammo = AmmoMechanicsMF.getAmmo(firearm); - ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(firearm); - if(ammo != null) - { - entityDropItem(world,x, y, z, ammo); - AmmoMechanicsMF.setAmmo(firearm, null); - } - if(loaded != null) - { - entityDropItem(world, x, y, z, loaded); - AmmoMechanicsMF.putAmmoOnFirearm(firearm, null); - } - } - /** - * Drops the loaded and storred ammo for an item from a user - */ - public static void dropContents(World world, ItemStack firearm, EntityLivingBase user) - { - dropAmmo(world, firearm, user.posX, user.posY+user.getEyeHeight(), user.posZ); - dropAmmoCrate(world, firearm, user.posX, user.posY+user.getEyeHeight(), user.posZ); - } - private static EntityItem entityDropItem(World world, double x, double y, double z, ItemStack item) - { - if (item.stackSize != 0 && item.getItem() != null) - { + /** + * Gets what ammo is loaded + */ + public static ItemStack getAmmo(ItemStack bow) { + if (!bow.hasTagCompound()) { + return null; + } + if (bow.getTagCompound().hasKey(savedAmmoNBT)) { + return ItemStack.loadItemStackFromNBT(bow.getTagCompound().getCompoundTag(savedAmmoNBT)); + } + return null; + } + + /** + * Sets the ammo for the bow + */ + public static void setAmmo(ItemStack bow, ItemStack ammo) { + NBTTagCompound nbt = getNBT(bow); + + if (ammo != null) { + NBTTagCompound save = new NBTTagCompound(); + ammo.writeToNBT(save); + nbt.setTag(savedAmmoNBT, save); + } else { + nbt.removeTag(savedAmmoNBT); + } + } + + public static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + return item.getTagCompound(); + } + + public static void removeAmmo(ItemStack bow) { + getNBT(bow).removeTag(savedAmmoNBT); + } + + public static boolean isDepleted(ItemStack firearm) { + return getGunAmmoCount(firearm) == 0 && getAmmo(firearm) == null + && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, firearm) == 0; + } + + public static boolean isFirearmLoaded(ItemStack firearm) { + return getGunAmmoCount(firearm) > 0; + } + + public static void modifyAmmo(ItemStack item, int value) { + int ammo = getGunAmmoCount(item) + value; + setGunAmmoCount(item, ammo); + } + + public static void setGunAmmoCount(ItemStack item, int ammo) { + NBTTagCompound nbt = getNBT(item); + nbt.setInteger(ammoNBT, ammo); + } + + public static int getGunAmmoCount(ItemStack item) { + if (getArrowOnBow(item) == null) { + return 0; + } + NBTTagCompound nbt = getNBT(item); + + if (nbt.hasKey(ammoNBT)) { + return nbt.getInteger(ammoNBT); + } + return 1; + } + + public static void dropAmmoCrate(World world, ItemStack crate, double x, double y, double z) { + ItemStack drop = BlockAmmoBox.getHeld(crate, true); + int stock = BlockAmmoBox.getStock(crate, true); + if (drop != null) { + while (stock > 0) { + int stackSize = Math.min(stock, drop.getMaxStackSize()); + stock -= stackSize; + ItemStack newdrop = drop.copy(); + newdrop.stackSize = stackSize; + entityDropItem(world, x, y, z, newdrop); + } + } + } + + /** + * Drops the loaded and storred ammo for an item, from coords + */ + public static void dropAmmo(World world, ItemStack firearm, double x, double y, double z) { + ItemStack ammo = AmmoMechanicsMF.getAmmo(firearm); + ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(firearm); + if (ammo != null) { + entityDropItem(world, x, y, z, ammo); + AmmoMechanicsMF.setAmmo(firearm, null); + } + if (loaded != null) { + entityDropItem(world, x, y, z, loaded); + AmmoMechanicsMF.putAmmoOnFirearm(firearm, null); + } + } + + /** + * Drops the loaded and storred ammo for an item from a user + */ + public static void dropContents(World world, ItemStack firearm, EntityLivingBase user) { + dropAmmo(world, firearm, user.posX, user.posY + user.getEyeHeight(), user.posZ); + dropAmmoCrate(world, firearm, user.posX, user.posY + user.getEyeHeight(), user.posZ); + } + + private static EntityItem entityDropItem(World world, double x, double y, double z, ItemStack item) { + if (item.stackSize != 0 && item.getItem() != null) { EntityItem entityitem = new EntityItem(world, x, y, z, item); entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); return entityitem; - } - else - { + } else { return null; } } - public static void damageContainer(ItemStack item, EntityPlayer user) - { - damageContainer(item, user, 1); - } - /** - * Damages a firearm, dropping inventory if broken - */ - public static void damageContainer(ItemStack item, EntityPlayer user, int dam) - { - item.damageItem(dam, user); - if(!user.capabilities.isCreativeMode && item.stackSize == 0) - { - if(!user.worldObj.isRemote) - { - dropContents(user.worldObj, item, user); - } - user.setCurrentItemOrArmor(0, null); - } - } + public static void damageContainer(ItemStack item, EntityPlayer user) { + damageContainer(item, user, 1); + } + + /** + * Damages a firearm, dropping inventory if broken + */ + public static void damageContainer(ItemStack item, EntityPlayer user, int dam) { + item.damageItem(dam, user); + if (!user.capabilities.isCreativeMode && item.stackSize == 0) { + if (!user.worldObj.isRemote) { + dropContents(user.worldObj, item, user); + } + user.setCurrentItemOrArmor(0, null); + } + } } diff --git a/src/main/java/minefantasy/mf2/api/archery/IAmmo.java b/src/main/java/minefantasy/mf2/api/archery/IAmmo.java index 9f2f772e..a956ff31 100644 --- a/src/main/java/minefantasy/mf2/api/archery/IAmmo.java +++ b/src/main/java/minefantasy/mf2/api/archery/IAmmo.java @@ -2,10 +2,9 @@ import net.minecraft.item.ItemStack; -public interface IAmmo -{ - /** - * What ammo is it (arrow, bolt, bullet, etc) - */ - public String getAmmoType(ItemStack arrow); +public interface IAmmo { + /** + * What ammo is it (arrow, bolt, bullet, etc) + */ + public String getAmmoType(ItemStack arrow); } diff --git a/src/main/java/minefantasy/mf2/api/archery/IArrowHandler.java b/src/main/java/minefantasy/mf2/api/archery/IArrowHandler.java index 7260a672..65bff953 100644 --- a/src/main/java/minefantasy/mf2/api/archery/IArrowHandler.java +++ b/src/main/java/minefantasy/mf2/api/archery/IArrowHandler.java @@ -4,11 +4,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public interface IArrowHandler -{ - /** - * Fires an arrow - * @return true if the arrow has been fired - */ - public boolean onFireArrow(World world, ItemStack arrow, ItemStack bow, EntityPlayer user, float charge, boolean infinite); +public interface IArrowHandler { + /** + * Fires an arrow + * + * @return true if the arrow has been fired + */ + public boolean onFireArrow(World world, ItemStack arrow, ItemStack bow, EntityPlayer user, float charge, + boolean infinite); } diff --git a/src/main/java/minefantasy/mf2/api/archery/IArrowMF.java b/src/main/java/minefantasy/mf2/api/archery/IArrowMF.java index 8ef73f22..33afe3e5 100644 --- a/src/main/java/minefantasy/mf2/api/archery/IArrowMF.java +++ b/src/main/java/minefantasy/mf2/api/archery/IArrowMF.java @@ -3,22 +3,22 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; -public interface IArrowMF -{ - /** - * Gets the damage modifier (1.0 = Flint arrow) - */ - public abstract float getDamageModifier(ItemStack arrow); - - /** - * Gets the weight (1.0 = regular fall speed) - */ - public abstract float getGravityModifier(ItemStack arrow); - - /** - * Gets the chance the arrow will break on impace (0.0 = no chance, 1.0 = 100% chance) - */ - public abstract float getBreakChance(Entity entityArrow, ItemStack arrow); - - public abstract void onHitEntity(Entity arrowInstance, Entity shooter, Entity hit, float damage); +public interface IArrowMF { + /** + * Gets the damage modifier (1.0 = Flint arrow) + */ + public abstract float getDamageModifier(ItemStack arrow); + + /** + * Gets the weight (1.0 = regular fall speed) + */ + public abstract float getGravityModifier(ItemStack arrow); + + /** + * Gets the chance the arrow will break on impace (0.0 = no chance, 1.0 = 100% + * chance) + */ + public abstract float getBreakChance(Entity entityArrow, ItemStack arrow); + + public abstract void onHitEntity(Entity arrowInstance, Entity shooter, Entity hit, float damage); } diff --git a/src/main/java/minefantasy/mf2/api/archery/IArrowRetrieve.java b/src/main/java/minefantasy/mf2/api/archery/IArrowRetrieve.java index fdd01c41..99eaaa28 100644 --- a/src/main/java/minefantasy/mf2/api/archery/IArrowRetrieve.java +++ b/src/main/java/minefantasy/mf2/api/archery/IArrowRetrieve.java @@ -2,16 +2,15 @@ import net.minecraft.item.ItemStack; -public interface IArrowRetrieve -{ - /** - * Gets if the arrow will be dropped by a killed mob - * (this pretty much connects to the canBePickedUp variable) - */ - public boolean canBePickedUp(); - - /** - * Gets the item dropped when the enemy is killed (the arrow item used) - */ - public ItemStack getDroppedItem(); +public interface IArrowRetrieve { + /** + * Gets if the arrow will be dropped by a killed mob (this pretty much connects + * to the canBePickedUp variable) + */ + public boolean canBePickedUp(); + + /** + * Gets the item dropped when the enemy is killed (the arrow item used) + */ + public ItemStack getDroppedItem(); } diff --git a/src/main/java/minefantasy/mf2/api/archery/IDisplayMFAmmo.java b/src/main/java/minefantasy/mf2/api/archery/IDisplayMFAmmo.java index b9d09ccd..1ebf1dfe 100644 --- a/src/main/java/minefantasy/mf2/api/archery/IDisplayMFAmmo.java +++ b/src/main/java/minefantasy/mf2/api/archery/IDisplayMFAmmo.java @@ -4,9 +4,9 @@ /** * Implement this to your bow item so it displays the preset arrow when wielded - * *Note that the preset arrow only fires if you implement MineFantasy's arrow firer + * *Note that the preset arrow only fires if you implement MineFantasy's arrow + * firer */ -public interface IDisplayMFAmmo -{ - public int getAmmoCapacity(ItemStack item); +public interface IDisplayMFAmmo { + public int getAmmoCapacity(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/archery/IFirearm.java b/src/main/java/minefantasy/mf2/api/archery/IFirearm.java index 808b7279..b5fa2409 100644 --- a/src/main/java/minefantasy/mf2/api/archery/IFirearm.java +++ b/src/main/java/minefantasy/mf2/api/archery/IFirearm.java @@ -2,12 +2,13 @@ import net.minecraft.item.ItemStack; -public interface IFirearm -{ - /** - * Determines the type of firing mechanism used (such as arrow, bolt, bullet, etc) - * @param weapon the item that is being accessed - * @param ammo the ammo type that weapon is being loaded with - */ - public boolean canAcceptAmmo(ItemStack weapon, String ammo); +public interface IFirearm { + /** + * Determines the type of firing mechanism used (such as arrow, bolt, bullet, + * etc) + * + * @param weapon the item that is being accessed + * @param ammo the ammo type that weapon is being loaded with + */ + public boolean canAcceptAmmo(ItemStack weapon, String ammo); } diff --git a/src/main/java/minefantasy/mf2/api/archery/ISpecialBow.java b/src/main/java/minefantasy/mf2/api/archery/ISpecialBow.java index 49fb82d5..42cba538 100644 --- a/src/main/java/minefantasy/mf2/api/archery/ISpecialBow.java +++ b/src/main/java/minefantasy/mf2/api/archery/ISpecialBow.java @@ -3,18 +3,21 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; -public interface ISpecialBow -{ - /** - * This is called when an arrow is fired from a bow - * if you have your own arrows firing, call this method when spawning it in world - * - * Allows to modify an arrow when fired from this bow - * @param arrow the arrow fired(use a cast to determine what class it is) - * @return the same arrow, but modified - */ - public Entity modifyArrow(ItemStack bow, Entity arrow); - public float getMaxCharge(); - public float getRange(ItemStack bow); - public float getSpread(ItemStack bow); +public interface ISpecialBow { + /** + * This is called when an arrow is fired from a bow if you have your own arrows + * firing, call this method when spawning it in world + *

+ * Allows to modify an arrow when fired from this bow + * + * @param arrow the arrow fired(use a cast to determine what class it is) + * @return the same arrow, but modified + */ + public Entity modifyArrow(ItemStack bow, Entity arrow); + + public float getMaxCharge(); + + public float getRange(ItemStack bow); + + public float getSpread(ItemStack bow); } diff --git a/src/main/java/minefantasy/mf2/api/armour/ArmourDesign.java b/src/main/java/minefantasy/mf2/api/armour/ArmourDesign.java index 0d656fcf..abb11fb8 100644 --- a/src/main/java/minefantasy/mf2/api/armour/ArmourDesign.java +++ b/src/main/java/minefantasy/mf2/api/armour/ArmourDesign.java @@ -2,119 +2,125 @@ import java.util.HashMap; -import minefantasy.mf2.api.helpers.ArmourCalculator; - - -public class ArmourDesign -{ - public static final String light = "light"; - public static final String medium = "medium"; - public static final String heavy = "heavy"; - //Weight: Above 50kg slows down and increases stamina decay, and classes as heavy armour - //Bulk: Above 0.0 means it slows stamina regen - public static HashMapdesigns = new HashMap(); - // Reg Name Prot Dura Weight Bulk Ctg Bnt Png - public static final ArmourDesign CLOTH = new ArmourDesign( "clothing", "Clothing", 1.0F, 1.0F, 0F, 0.25F).calibrateTraits(0.5F, 1.0F, 0.5F).setWeightGroup(light);//Weak - public static final ArmourDesign SOLID = new ArmourDesign( "default", "Basic", 1.0F, 1.0F, 40F, 1.00F).setWeightGroup(medium);//Basic Armour - public static final ArmourDesign MAIL = new ArmourDesign( "mail", "Mail", 1.0F, 1.0F, 35F, 0.75F).calibrateTraits(1.0F, 0.7F, 0.9F).setWeightGroup(medium);//Vulnerable to blunt - public static final ArmourDesign PLATE = new ArmourDesign( "plate", "Plate", 1.5F, 1.0F, 60F, 1.00F).calibrateTraits(1.0F, 1.0F, 0.6F).setWeightGroup(heavy);//Vulnerable to piercing - - //LIGHT ARMOUR - public static final ArmourDesign LEATHER = new ArmourDesign( "leather", "Leather", 1.0F, 1.0F, 10F, 0.25F).calibrateTraits(0.7F, 1.0F, 0.5F).setWeightGroup(light);//Slightly better blunt - public static final ArmourDesign PADDING = new ArmourDesign( "padding", "Padding", 1.0F, 1.0F, 10F, 1.00F).calibrateTraits(0.6F, 1.2F, 0.4F).setWeightGroup(light);//10kg, Blunt resistent - public static final ArmourDesign STUDDED = new ArmourDesign("studded", "Studded", 0.8F, 1.0F, 10F , 0.25F).calibrateTraits(0.85F, 1.0F, 0.9F).setWeightGroup(light);//10kg, Vulnerable to blunt - //MEDIUM ARMOUR - public static final ArmourDesign SCALEMAIL = new ArmourDesign("scalemail", "Scalemail", 1.0F, 1.0F, 8F, 0.30F).calibrateTraits(1.00F, 1.00F, 1.00F).setWeightGroup(medium);//20kg, Average - public static final ArmourDesign CHAINMAIL = new ArmourDesign("chainmail", "Chainmail", 1.0F, 1.0F, 8F, 0.65F).calibrateTraits(1.20F, 0.60F, 1.20F).setWeightGroup(medium);//20kg, Less blunt more piercing - //HEAVY ARMOUR - public static final ArmourDesign SPLINTMAIL = new ArmourDesign("splintmail","Splintmail", 1.2F, 1.0F, 12F, 0.75F).calibrateTraits(1.00F, 1.00F, 1.00F).setWeightGroup(heavy);//30kg, Average - public static final ArmourDesign FIELDPLATE = new ArmourDesign("fieldplate", "Fieldplate", 1.2F, 1.0F, 16F, 1.00F).calibrateTraits(1.25F, 1.25F, 1.00F).setWeightGroup(heavy);//40kg, Vulnerable to piercing - - public static final ArmourDesign COGWORK = new ArmourDesign("cogwork", "Cogwork", 4.0F, 8.0F, 30F, 2.00F).calibrateTraits(1.00F, 1.00F, 1.00F).setWeightGroup(heavy);//>120kg, Massive Protection - //ArmourCalculator - private String name; - private float durability; - private float armourWeight; - - private float baseProtection; - - private float cuttingModifier = 1.0F; - private float piercingModifier = 1.0F; - private float bluntModifier = 1.0F; - - private float bulk; - - /** - * - * @param register The string that it is registered under (For config) - * @param name The name of the Design - * @param prot The protection against basic damage (1.0F = normal protection for tier) - * @param dura The durability modifier - * @param weight the weight in Kg of the suit - * @param bulk the bulk of the suit (1.0 = plate, 0.5 = splint, etc) - */ - public ArmourDesign(String register, String name, float prot, float dura, float weight, float bulk) - { - designs.put(register, this); - this.name=name; - baseProtection = prot; - - durability = dura; - armourWeight = weight; - - this.bulk = bulk; - } - - /** - * These traits only apply when armours are coded to take them - */ - public ArmourDesign calibrateTraits(float cutting, float blunt, float pierce) - { - cuttingModifier = cutting; - bluntModifier = blunt; - piercingModifier = pierce; - - return this; - } - - public String getName() - { - return name; - } - public float getDurability() - { - return durability; - } - public float getWeight() - { - return armourWeight; - } - public float getRating() - { - return baseProtection; - } - public float[] getProtectiveTraits() - { - return new float[]{cuttingModifier, bluntModifier, piercingModifier}; - } - public float getBulk() - { - return bulk; - } - /** - * @param group "light" "medium" or "heavy" - */ - public ArmourDesign setWeightGroup(String group) - { - weightGroup = group; - return this; - } - private String weightGroup = "medium"; - /** - * @return "light" "medium" or "heavy" - */ - public String getGroup() - { - return weightGroup; - } +public class ArmourDesign { + public static HashMap designs = new HashMap(); + + public static final String light = "light"; + public static final String medium = "medium"; + public static final String heavy = "heavy"; + // Weight: Above 50kg slows down and increases stamina decay, and classes as + // heavy armour + // Bulk: Above 0.0 means it slows stamina regen + // Reg Name Prot Dura Weight Bulk Ctg Bnt Png + public static final ArmourDesign CLOTH = new ArmourDesign("clothing", "Clothing", 1.0F, 1.0F, 0F, 0.25F) + .calibrateTraits(0.5F, 1.0F, 0.5F).setWeightGroup(light);// Weak + public static final ArmourDesign SOLID = new ArmourDesign("default", "Basic", 1.0F, 1.0F, 40F, 1.00F) + .setWeightGroup(medium);// Basic Armour + public static final ArmourDesign MAIL = new ArmourDesign("mail", "Mail", 1.0F, 1.0F, 35F, 0.75F) + .calibrateTraits(1.0F, 0.7F, 0.9F).setWeightGroup(medium);// Vulnerable to blunt + public static final ArmourDesign PLATE = new ArmourDesign("plate", "Plate", 1.5F, 1.0F, 60F, 1.00F) + .calibrateTraits(1.0F, 1.0F, 0.6F).setWeightGroup(heavy);// Vulnerable to piercing + // LIGHT ARMOUR + public static final ArmourDesign LEATHER = new ArmourDesign("leather", "Leather", 1.0F, 1.0F, 10F, 0.25F) + .calibrateTraits(0.7F, 1.0F, 0.5F).setWeightGroup(light);// Slightly better blunt + public static final ArmourDesign PADDING = new ArmourDesign("padding", "Padding", 1.0F, 1.0F, 10F, 1.00F) + .calibrateTraits(0.85F, 0.9F, 0.6F).setWeightGroup(light);// 10kg, Cutting resistant + public static final ArmourDesign STUDDED = new ArmourDesign("studded", "Studded", 0.8F, 1.0F, 10F, 0.25F) + .calibrateTraits(0.6F, 1.2F, 0.9F).setWeightGroup(light);// 10kg, Blunt protection + // MEDIUM ARMOUR + public static final ArmourDesign SCALEMAIL = new ArmourDesign("scalemail", "Scalemail", 1.0F, 1.0F, 8F, 0.30F) + .calibrateTraits(1.00F, 1.00F, 1.00F).setWeightGroup(medium);// 20kg, Average + public static final ArmourDesign CHAINMAIL = new ArmourDesign("chainmail", "Chainmail", 1.0F, 1.0F, 8F, 0.65F) + .calibrateTraits(1.20F, 0.60F, 1.20F).setWeightGroup(medium);// 20kg, Less blunt more piercing + // HEAVY ARMOUR + public static final ArmourDesign SPLINTMAIL = new ArmourDesign("splintmail", "Splintmail", 1.2F, 1.0F, 12F, 0.75F) + .calibrateTraits(1.00F, 1.00F, 1.00F).setWeightGroup(heavy);// 30kg, Average + public static final ArmourDesign FIELDPLATE = new ArmourDesign("fieldplate", "Fieldplate", 1.2F, 1.0F, 16F, 1.00F) + .calibrateTraits(1.25F, 1.25F, 1.00F).setWeightGroup(heavy);// 40kg, Vulnerable to piercing + public static final ArmourDesign COGWORK = new ArmourDesign("cogwork", "Cogwork", 4.0F, 8.0F, 30F, 2.00F) + .calibrateTraits(1.00F, 1.00F, 1.00F).setWeightGroup(heavy);// >120kg, Massive Protection + + // ArmourCalculator + private String name; + private float durability; + private float armourWeight; + + private float baseProtection; + + private float cuttingModifier = 1.0F; + private float piercingModifier = 1.0F; + private float bluntModifier = 1.0F; + + private float bulk; + private String weightGroup = "medium"; + + /** + * @param register The string that it is registered under (For config) + * @param name The name of the Design + * @param prot The protection against basic damage (1.0F = normal protection for + * tier) + * @param dura The durability modifier + * @param weight the weight in Kg of the suit + * @param bulk the bulk of the suit (1.0 = plate, 0.5 = splint, etc) + */ + public ArmourDesign(String register, String name, float prot, float dura, float weight, float bulk) { + designs.put(register, this); + this.name = name; + baseProtection = prot; + + durability = dura; + armourWeight = weight; + + this.bulk = bulk; + } + + /** + * These traits only apply when armours are coded to take them + */ + public ArmourDesign calibrateTraits(float cutting, float blunt, float pierce) { + cuttingModifier = cutting; + bluntModifier = blunt; + piercingModifier = pierce; + + return this; + } + + public String getName() { + return name; + } + + public float getDurability() { + return durability; + } + + public float getWeight() { + return armourWeight; + } + + public float getRating() { + return baseProtection; + } + + public float[] getProtectiveTraits() { + return new float[]{cuttingModifier, bluntModifier, piercingModifier}; + } + + public float getBulk() { + return bulk; + } + + /** + * @param group "light" "medium" or "heavy" + */ + public ArmourDesign setWeightGroup(String group) { + weightGroup = group; + return this; + } + + /** + * @return "light" "medium" or "heavy" + */ + public String getGroup() { + return weightGroup; + } } diff --git a/src/main/java/minefantasy/mf2/api/armour/ArmourMaterialMF.java b/src/main/java/minefantasy/mf2/api/armour/ArmourMaterialMF.java index 9024de28..5d324bd9 100644 --- a/src/main/java/minefantasy/mf2/api/armour/ArmourMaterialMF.java +++ b/src/main/java/minefantasy/mf2/api/armour/ArmourMaterialMF.java @@ -1,47 +1,41 @@ package minefantasy.mf2.api.armour; -public class ArmourMaterialMF -{ - /**EnumArmorMaterial - * VANILLA GUIDE: - * Leather_____28% Ratio: 1.3 - * Chain_______48% Ratio: 1.9 - * Iron________60% Ratio: 2.5 - * Gold________44% Ratio: 1.7 - * Diamond_____80% Ratio: 5.0 - */ - public final String name; - public final int durability; - public final float baseAR; - public final int enchantment; - public final float armourWeight; - public boolean isMythic = false; +public class ArmourMaterialMF { + /** + * EnumArmorMaterial VANILLA GUIDE: Leather_____28% Ratio: 1.3 Chain_______48% + * Ratio: 1.9 Iron________60% Ratio: 2.5 Gold________44% Ratio: 1.7 + * Diamond_____80% Ratio: 5.0 + */ + public final String name; + public final int durability; + public final float baseAR; + public final int enchantment; + public final float armourWeight; + public boolean isMythic = false; - public float magicResistanceModifier = 0F; - public float fireResistanceModifier = 0F; - - public ArmourMaterialMF(String title, int dura, float AC, int enchant, float weight) - { - name = title; - durability = dura; - baseAR = AC; - enchantment = enchant; - armourWeight = weight; - } - - public ArmourMaterialMF setMagicResistance(float magic) - { - magicResistanceModifier = magic; - return this; - } - public ArmourMaterialMF setFireResistance(float fire) - { - fireResistanceModifier = fire; - return this; - } - public ArmourMaterialMF setMythic(boolean flag) - { - isMythic = flag; - return this; - } + public float magicResistanceModifier = 0F; + public float fireResistanceModifier = 0F; + + public ArmourMaterialMF(String title, int dura, float AC, int enchant, float weight) { + name = title; + durability = dura; + baseAR = AC; + enchantment = enchant; + armourWeight = weight; + } + + public ArmourMaterialMF setMagicResistance(float magic) { + magicResistanceModifier = magic; + return this; + } + + public ArmourMaterialMF setFireResistance(float fire) { + fireResistanceModifier = fire; + return this; + } + + public ArmourMaterialMF setMythic(boolean flag) { + isMythic = flag; + return this; + } } diff --git a/src/main/java/minefantasy/mf2/api/armour/CustomArmourEntry.java b/src/main/java/minefantasy/mf2/api/armour/CustomArmourEntry.java index 710bdc40..fe94feb1 100644 --- a/src/main/java/minefantasy/mf2/api/armour/CustomArmourEntry.java +++ b/src/main/java/minefantasy/mf2/api/armour/CustomArmourEntry.java @@ -1,163 +1,154 @@ package minefantasy.mf2.api.armour; -import java.util.HashMap; - import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.helpers.ArmourCalculator; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; -public class CustomArmourEntry -{ - /** - * Registers an item to a template of an ArmourDesign, while dividing the suit into the 4 pieces - * If it's unable to divide it, it simply quarters it's value - * @param piece the item to register - * @param template the ArmourDesign to work off - */ - public static void registerItem(Item piece, ArmourDesign template) - { - registerItem(piece, template, 1.0F, template.getGroup()); - } - /** - * Registers an item to a template of an ArmourDesign, while dividing the suit into the 4 pieces - * If it's unable to divide it, it simply quarters it's value - * @param piece the item to register - * @param template the ArmourDesign to work off - * @param weightMod the multiplier for the tier weight if a tier is heavier or lighter - */ - public static void registerItem(Item piece, ArmourDesign template, float weightMod, String weightType) - { - float divider = 0.25F; - if(piece instanceof ItemArmor) - { - divider = ArmourCalculator.sizes[((ItemArmor)piece).armorType]; - } - registerItem(piece, template.getWeight() * weightMod, template.getBulk()*divider, weightType); - } - /** - * Registeres a piece (called by code or config) - * @param piece the item to list - * @param weight the weight of the piece (Kg) - * @param bulk the bulk of the piece - */ - public static void registerItem(Item piece, float weight, float bulk, String AC) - { - registerItem(piece, weight, bulk, true, AC); - } - - /** - * Registeres a piece (called by code or config) - * @param piece the item to list - * @param weight the weight of the piece (Kg) - * @param bulk the bulk of the piece - * @param alterSpeed if the armour's weight slows you down - */ - public static void registerItem(Item piece, float weight, float bulk, boolean alterSpeed, String AC) - { - int id = Item.getIdFromItem(piece); - - MineFantasyAPI.debugMsg("Added Custom "+AC+" armour: " + piece.getUnlocalizedName() + "(" + id + ") Traits = " + weight + "," + bulk + " alter speed = " + alterSpeed); - entries.put(id, new CustomArmourEntry(id, weight, bulk, alterSpeed, AC)); - } - - /** - * Returns the "Armour Class" Weight type Light, Medium or Heavy - */ - public static String getArmourClass(ItemStack piece) - { - CustomArmourEntry entry = getEntry(piece); - if(entry != null) - { - return entry.AC; - } - ArmourDesign deft = ArmourCalculator.getDefaultAD(piece); - return deft.getGroup(); - } - - /** - * Gets the variables for the item if there are any: order is weight, bulk - * @param deft the default preset if not present - */ - public static float[] getEntryVars(ItemStack piece) - { - CustomArmourEntry entry = getEntry(piece); - if(entry != null) - { - return new float[]{entry.weight, entry.bulkiness}; - } - ArmourDesign deft = ArmourCalculator.getDefaultAD(piece); - return new float[]{deft.getWeight(), deft.getBulk()}; - } - - /** - * Determines if a piece can slow you down - */ - public static boolean doesPieceSlowDown(ItemStack piece) - { - if(piece != null) - { - CustomArmourEntry entry = getEntry(piece); - if(entry != null) - { - return entry.alterSpeed; - } - } - return false; - } - /** - * Gets the entry for an item - * @param piece the armour item - * @return the entry(if there is one), else null - */ - public static CustomArmourEntry getEntry(ItemStack piece) - { - return getEntry(piece.getItem()); - } - /** - * Gets the entry for an item - * @param piece the armour item - * @return the entry(if there is one), else null - */ - public static CustomArmourEntry getEntry(Item piece) - { - if(piece != null) - { - int id = Item.getIdFromItem(piece); - if(entries.containsKey(id)) - { - return entries.get(id); - } - } - return null; - } - - public boolean alterSpeed; - - public int itemID; - /** - * The Weight of the piece(not suit) - */ - public float weight; - /** - * The Bulk of the piece(not suit) - */ - public float bulkiness; - - /** - * Light Medium or Heavy - */ - public String AC; - - public static HashMapentries = new HashMap(); - - private CustomArmourEntry(int id, float weight, float bulk, boolean alterSpeed, String AC) - { - this.alterSpeed = alterSpeed; - this.itemID = id; - this.weight = weight; - this.bulkiness = bulk; - this.AC = AC; - } +import java.util.HashMap; + +public class CustomArmourEntry { + public static HashMap entries = new HashMap(); + public boolean alterSpeed; + public int itemID; + /** + * The Weight of the piece(not suit) + */ + public float weight; + /** + * The Bulk of the piece(not suit) + */ + public float bulkiness; + /** + * Light Medium or Heavy + */ + public String AC; + + private CustomArmourEntry(int id, float weight, float bulk, boolean alterSpeed, String AC) { + this.alterSpeed = alterSpeed; + this.itemID = id; + this.weight = weight; + this.bulkiness = bulk; + this.AC = AC; + } + + /** + * Registers an item to a template of an ArmourDesign, while dividing the suit + * into the 4 pieces If it's unable to divide it, it simply quarters it's value + * + * @param piece the item to register + * @param template the ArmourDesign to work off + */ + public static void registerItem(Item piece, ArmourDesign template) { + registerItem(piece, template, 1.0F, template.getGroup()); + } + + /** + * Registers an item to a template of an ArmourDesign, while dividing the suit + * into the 4 pieces If it's unable to divide it, it simply quarters it's value + * + * @param piece the item to register + * @param template the ArmourDesign to work off + * @param weightMod the multiplier for the tier weight if a tier is heavier or lighter + */ + public static void registerItem(Item piece, ArmourDesign template, float weightMod, String weightType) { + float divider = 0.25F; + if (piece instanceof ItemArmor) { + divider = ArmourCalculator.sizes[((ItemArmor) piece).armorType]; + } + registerItem(piece, template.getWeight() * weightMod, template.getBulk() * divider, weightType); + } + + /** + * Registeres a piece (called by code or config) + * + * @param piece the item to list + * @param weight the weight of the piece (Kg) + * @param bulk the bulk of the piece + */ + public static void registerItem(Item piece, float weight, float bulk, String AC) { + registerItem(piece, weight, bulk, true, AC); + } + + /** + * Registeres a piece (called by code or config) + * + * @param piece the item to list + * @param weight the weight of the piece (Kg) + * @param bulk the bulk of the piece + * @param alterSpeed if the armour's weight slows you down + */ + public static void registerItem(Item piece, float weight, float bulk, boolean alterSpeed, String AC) { + int id = Item.getIdFromItem(piece); + + MineFantasyAPI.debugMsg("Added Custom " + AC + " armour: " + piece.getUnlocalizedName() + "(" + id + + ") Traits = " + weight + "," + bulk + " alter speed = " + alterSpeed); + entries.put(id, new CustomArmourEntry(id, weight, bulk, alterSpeed, AC)); + } + + /** + * Returns the "Armour Class" Weight type Light, Medium or Heavy + */ + public static String getArmourClass(ItemStack piece) { + CustomArmourEntry entry = getEntry(piece); + if (entry != null) { + return entry.AC; + } + ArmourDesign deft = ArmourCalculator.getDefaultAD(piece); + return deft.getGroup(); + } + + /** + * Gets the variables for the item if there are any: order is weight, bulk + * + * @param deft the default preset if not present + */ + public static float[] getEntryVars(ItemStack piece) { + CustomArmourEntry entry = getEntry(piece); + if (entry != null) { + return new float[]{entry.weight, entry.bulkiness}; + } + ArmourDesign deft = ArmourCalculator.getDefaultAD(piece); + return new float[]{deft.getWeight(), deft.getBulk()}; + } + + /** + * Determines if a piece can slow you down + */ + public static boolean doesPieceSlowDown(ItemStack piece) { + if (piece != null) { + CustomArmourEntry entry = getEntry(piece); + if (entry != null) { + return entry.alterSpeed; + } + } + return false; + } + + /** + * Gets the entry for an item + * + * @param piece the armour item + * @return the entry(if there is one), else null + */ + public static CustomArmourEntry getEntry(ItemStack piece) { + return getEntry(piece.getItem()); + } + + /** + * Gets the entry for an item + * + * @param piece the armour item + * @return the entry(if there is one), else null + */ + public static CustomArmourEntry getEntry(Item piece) { + if (piece != null) { + int id = Item.getIdFromItem(piece); + if (entries.containsKey(id)) { + return entries.get(id); + } + } + return null; + } } diff --git a/src/main/java/minefantasy/mf2/api/armour/CustomDamageRatioEntry.java b/src/main/java/minefantasy/mf2/api/armour/CustomDamageRatioEntry.java index 5e2d0d6f..d0d9203a 100644 --- a/src/main/java/minefantasy/mf2/api/armour/CustomDamageRatioEntry.java +++ b/src/main/java/minefantasy/mf2/api/armour/CustomDamageRatioEntry.java @@ -1,72 +1,67 @@ package minefantasy.mf2.api.armour; +import net.minecraft.item.Item; + import java.util.HashMap; -import net.minecraft.item.Item; +public class CustomDamageRatioEntry { + public static HashMap entries = new HashMap(); + public static HashMap entriesProj = new HashMap(); + + public float[] vars; + + private CustomDamageRatioEntry(float[] vars) { + this.vars = vars; + } + + /** + * Register a weapon to give variables + * + * @param item the item + * @param vars the damage type ratio cutting:blunt + */ + public static void registerItem(Item item, float[] vars) { + registerItem(Item.getIdFromItem(item), vars); + } + + /** + * Register a weapon to give variables + * + * @param id the item id + * @param vars the damage type ratio cutting:blunt + */ + public static void registerItem(int id, float[] vars) { + entries.put(id, new CustomDamageRatioEntry(vars)); + } + + /** + * Register an entity (like arrows) to give variables + * + * @param id the entity id + * @param vars the damage type ratio cutting:blunt + */ + public static void registerEntity(String id, float[] vars) { + entriesProj.put(id, new CustomDamageRatioEntry(vars)); + } -public class CustomDamageRatioEntry -{ - public static HashMap entries = new HashMap(); - public static HashMap entriesProj = new HashMap(); - - public float[] vars; - - /** - * Register a weapon to give variables - * @param item the item - * @param vars the damage type ratio cutting:blunt - */ - public static void registerItem(Item item, float[] vars) - { - registerItem(Item.getIdFromItem(item), vars); - } - - /** - * Register a weapon to give variables - * @param id the item id - * @param vars the damage type ratio cutting:blunt - */ - public static void registerItem(int id, float[] vars) - { - entries.put(id, new CustomDamageRatioEntry(vars)); - } - + /** + * Gets the ratio for an item, null if it's not found + */ + public static float[] getTraits(Item item) { + return getTraits(Item.getIdFromItem(item)); + } - /** - * Register an entity (like arrows) to give variables - * @param id the entity id - * @param vars the damage type ratio cutting:blunt - */ - public static void registerEntity(String id, float[] vars) - { - entriesProj.put(id, new CustomDamageRatioEntry(vars)); - } - - /** - * Gets the ratio for an item, null if it's not found - */ - public static float[] getTraits(Item item) - { - return getTraits(Item.getIdFromItem(item)); - } - /** - * Gets the ratio for an item, null if it's not found - */ - public static float[] getTraits(int id) - { - return entries.get(id) != null ? entries.get(id).vars : null; - } - - /** - * Gets the ratio for an entity, null if it's not found - */ - public static float[] getTraits(String id) - { - return entriesProj.get(id) != null ? entriesProj.get(id).vars : new float[]{1, 1, 1}; - } + /** + * Gets the ratio for an item, null if it's not found + */ + public static float[] getTraits(int id) { + return entries.get(id) != null ? entries.get(id).vars : null; + } - private CustomDamageRatioEntry(float[] vars) - { - this.vars = vars; - } + /** + * Gets the ratio for an entity, null if it's not found + */ + public static float[] getTraits(String id) { + return entriesProj.get(id) != null ? entriesProj.get(id).vars : new float[]{1, 1, 1}; + } } diff --git a/src/main/java/minefantasy/mf2/api/armour/IArmourMF.java b/src/main/java/minefantasy/mf2/api/armour/IArmourMF.java index bd749eff..32f8ae87 100644 --- a/src/main/java/minefantasy/mf2/api/armour/IArmourMF.java +++ b/src/main/java/minefantasy/mf2/api/armour/IArmourMF.java @@ -1,19 +1,21 @@ package minefantasy.mf2.api.armour; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.item.ItemStack; -public interface IArmourMF -{ - //NOTE: "Slot" Variable works 0=Helmet, 1=Chest, 2=Legs, 3=Boots - /** - * Gets how heavy the piece is. (mesured in Kg). this is used for slowing movement, and stamina decay - */ - public float getPieceWeight(ItemStack item, int slot); - /** - * This is if the suit is light or heavy armour (pretty much anything above 50kg is heavy) - * @return "light" "medium" or "heavy" - */ - public String getSuitWeigthType(ItemStack item); +public interface IArmourMF { + // NOTE: "Slot" Variable works 0=Helmet, 1=Chest, 2=Legs, 3=Boots + + /** + * Gets how heavy the piece is. (mesured in Kg). this is used for slowing + * movement, and stamina decay + */ + public float getPieceWeight(ItemStack item, int slot); + + /** + * This is if the suit is light or heavy armour (pretty much anything above 50kg + * is heavy) + * + * @return "light" "medium" or "heavy" + */ + public String getSuitWeigthType(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/armour/IArmourPenetrationMob.java b/src/main/java/minefantasy/mf2/api/armour/IArmourPenetrationMob.java index d970a1e5..46f9c4dc 100644 --- a/src/main/java/minefantasy/mf2/api/armour/IArmourPenetrationMob.java +++ b/src/main/java/minefantasy/mf2/api/armour/IArmourPenetrationMob.java @@ -1,6 +1,5 @@ package minefantasy.mf2.api.armour; -public interface IArmourPenetrationMob -{ - public float[] getHitTraits(); +public interface IArmourPenetrationMob { + public float[] getHitTraits(); } diff --git a/src/main/java/minefantasy/mf2/api/armour/IArmourRating.java b/src/main/java/minefantasy/mf2/api/armour/IArmourRating.java index 7ced5d3a..8e784ae6 100644 --- a/src/main/java/minefantasy/mf2/api/armour/IArmourRating.java +++ b/src/main/java/minefantasy/mf2/api/armour/IArmourRating.java @@ -2,10 +2,10 @@ import net.minecraft.item.ItemStack; -public interface IArmourRating -{ - /** - * Gets the scale in relation for the total suit (0-4 = head, chest, legs, boots) - */ - public float scalePiece(ItemStack item); +public interface IArmourRating { + /** + * Gets the scale in relation for the total suit (0-4 = head, chest, legs, + * boots) + */ + public float scalePiece(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/armour/IArmouredEntity.java b/src/main/java/minefantasy/mf2/api/armour/IArmouredEntity.java index 0ed30fa9..d4f785c3 100644 --- a/src/main/java/minefantasy/mf2/api/armour/IArmouredEntity.java +++ b/src/main/java/minefantasy/mf2/api/armour/IArmouredEntity.java @@ -2,7 +2,6 @@ import net.minecraft.util.DamageSource; -public interface IArmouredEntity -{ - public float getThreshold(DamageSource src); +public interface IArmouredEntity { + public float getThreshold(DamageSource src); } diff --git a/src/main/java/minefantasy/mf2/api/armour/IElementalResistance.java b/src/main/java/minefantasy/mf2/api/armour/IElementalResistance.java index b2338f32..27d2447d 100644 --- a/src/main/java/minefantasy/mf2/api/armour/IElementalResistance.java +++ b/src/main/java/minefantasy/mf2/api/armour/IElementalResistance.java @@ -3,27 +3,28 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -public interface IElementalResistance -{ - /** - * @return this determines the chance an item is to deflect arrows. more damage means less chance - */ - public float getArrowDeflection(ItemStack item, DamageSource source); - /** - * @return the Magic resistance percent (0-100) (for the whole suit) - * -values mean weakness - */ - public float getMagicResistance(ItemStack item, DamageSource source); - - /** - * @return the Magic resistance percent (0-100) (for the whole suit) - * -values mean weakness - */ - public float getFireResistance(ItemStack item, DamageSource source); - - /** - * @return the Base resistance percent for non magic/fire(0-100) (for the whole suit) - * -values mean weakness - */ - public float getBaseResistance(ItemStack item, DamageSource source); +public interface IElementalResistance { + /** + * @return this determines the chance an item is to deflect arrows. more damage + * means less chance + */ + public float getArrowDeflection(ItemStack item, DamageSource source); + + /** + * @return the Magic resistance percent (0-100) (for the whole suit) -values + * mean weakness + */ + public float getMagicResistance(ItemStack item, DamageSource source); + + /** + * @return the Magic resistance percent (0-100) (for the whole suit) -values + * mean weakness + */ + public float getFireResistance(ItemStack item, DamageSource source); + + /** + * @return the Base resistance percent for non magic/fire(0-100) (for the whole + * suit) -values mean weakness + */ + public float getBaseResistance(ItemStack item, DamageSource source); } diff --git a/src/main/java/minefantasy/mf2/api/armour/IGasProtector.java b/src/main/java/minefantasy/mf2/api/armour/IGasProtector.java index d98c3fc4..156bffaf 100644 --- a/src/main/java/minefantasy/mf2/api/armour/IGasProtector.java +++ b/src/main/java/minefantasy/mf2/api/armour/IGasProtector.java @@ -2,10 +2,10 @@ import net.minecraft.item.ItemStack; -public interface IGasProtector -{ - /** - * Applies ONLY to helmets, gets the percentage (1-100) of gas protection from smoke - */ - public float getGasProtection(ItemStack item); +public interface IGasProtector { + /** + * Applies ONLY to helmets, gets the percentage (1-100) of gas protection from + * smoke + */ + public float getGasProtection(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/armour/IPowerArmour.java b/src/main/java/minefantasy/mf2/api/armour/IPowerArmour.java index 1e7b4e7c..ea294b59 100644 --- a/src/main/java/minefantasy/mf2/api/armour/IPowerArmour.java +++ b/src/main/java/minefantasy/mf2/api/armour/IPowerArmour.java @@ -5,16 +5,17 @@ public interface IPowerArmour { - boolean isFullyArmoured(); + boolean isFullyArmoured(); - float modifyDamage(EntityLivingBase user, float damage, DamageSource src); + float modifyDamage(EntityLivingBase user, float damage, DamageSource src); - boolean isPowered(); + boolean isPowered(); - /** - * Is armour covering a particular limb - * @param limb (head, body, left_arm, right_arm, left_leg, right_leg) - */ - boolean isArmoured(String limb); + /** + * Is armour covering a particular limb + * + * @param limb (head, body, left_arm, right_arm, left_leg, right_leg) + */ + boolean isArmoured(String limb); } diff --git a/src/main/java/minefantasy/mf2/api/armour/ISpecialArmourMF.java b/src/main/java/minefantasy/mf2/api/armour/ISpecialArmourMF.java index 9f08c2e5..17943475 100644 --- a/src/main/java/minefantasy/mf2/api/armour/ISpecialArmourMF.java +++ b/src/main/java/minefantasy/mf2/api/armour/ISpecialArmourMF.java @@ -6,19 +6,20 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -public interface ISpecialArmourMF -{ - public float getDTValue(EntityLivingBase user, ItemStack armour, DamageSource src); - @SideOnly(Side.CLIENT) - /** - * DamageType: 0=cutting, 1=blunt, 2=piercing - */ - public float getDTDisplay(ItemStack armour, int damageType); - - public float getDRValue(EntityLivingBase user, ItemStack armour, DamageSource src); - @SideOnly(Side.CLIENT) - /** - * DamageType: 0=cutting, 1=blunt, 2=piercing - */ - public float getDRDisplay(ItemStack armour, int damageType); +public interface ISpecialArmourMF { + public float getDTValue(EntityLivingBase user, ItemStack armour, DamageSource src); + + @SideOnly(Side.CLIENT) + /** + * DamageType: 0=cutting, 1=blunt, 2=piercing + */ + public float getDTDisplay(ItemStack armour, int damageType); + + public float getDRValue(EntityLivingBase user, ItemStack armour, DamageSource src); + + @SideOnly(Side.CLIENT) + /** + * DamageType: 0=cutting, 1=blunt, 2=piercing + */ + public float getDRDisplay(ItemStack armour, int damageType); } diff --git a/src/main/java/minefantasy/mf2/api/armour/ItemArmourMFBase.java b/src/main/java/minefantasy/mf2/api/armour/ItemArmourMFBase.java index 922876fd..e2bf1e32 100644 --- a/src/main/java/minefantasy/mf2/api/armour/ItemArmourMFBase.java +++ b/src/main/java/minefantasy/mf2/api/armour/ItemArmourMFBase.java @@ -1,8 +1,5 @@ package minefantasy.mf2.api.armour; -import java.text.DecimalFormat; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.ArmourCalculator; @@ -18,283 +15,257 @@ import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.util.EnumHelper; -public class ItemArmourMFBase extends ItemArmor implements ISpecialArmor, IArmourMF, IArmourRating, ISpecialArmourMF -{ - public static ArmorMaterial baseMaterial = EnumHelper.addArmorMaterial("MF Armour Base", 0, new int[]{2, 6, 5, 2}, 0); - private int piece; - private int baseRating; - public float baseAR; - public int enchantment; - public String texture; - public float armourWeight; - public ArmourMaterialMF material; - public ArmourDesign design; - protected float suitBulk; - public float DT; - - public static final DecimalFormat decimal_format = new DecimalFormat("#.#"); - - public ItemArmourMFBase(String name, ArmourMaterialMF material, ArmourDesign AD, int slot, String tex) - { - super(baseMaterial, 0, slot); - this.material = material; - baseAR = material.baseAR; - armourWeight = AD.getWeight() * material.armourWeight; - enchantment = material.enchantment; - this.piece = slot; - design = AD; - suitBulk = design.getBulk(); - texture = tex; - float baseDura = material.durability * design.getDurability()/2F; - float dura = baseDura /2F + (baseDura /2F * ArmourCalculator.sizes[slot] / ArmourCalculator.sizes[1]); - this.setMaxDamage((int)dura); - this.setUnlocalizedName(name); - setDT(getBaseAC()*scalePiece()); - - baseRating = ArmourCalculator.translateToVanillaAR(getBaseAC()+1F, baseMaterial.getDamageReductionAmount(slot), 15); - } - public ItemArmourMFBase setDT(float DT) - { - this.DT = DT; - return this; - } - /* Piece | Slot - * 0 | 3 - * 1 | 2 - * 2 | 1 - * 3 | 0 */ - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) - { - initArmourDamage(entity, stack, (float)damage); - } - public void initArmourDamage(EntityLivingBase user, ItemStack armour, float damage) - { - armour.damageItem((int)(damage/5F)+1, user); - } - - @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armour, int slot) - { - float max = (float)armour.getMaxDamage(); - float dam = max - (float)armour.getItemDamage(); - - return (int)Math.round(5F / max * dam); - } - - @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armour, DamageSource source, double damage, int slot) - { - float AC = getProtectionRatio(armour); - AC = ArmourCalculator.getArmourValueMod(armour, AC); - - if(ArmourCalculator.advancedDamageTypes && !player.worldObj.isRemote) - { - AC = ArmourCalculator.adjustACForDamage(source, AC, getProtectiveTrait(armour, 0), getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); - } - - AC *= getACModifier(player, armour, source, damage); - - if(source == DamageSource.fall && design == ArmourDesign.PLATE) - { - AC = 1F/material.armourWeight; - } - else if(source.isMagicDamage()) - { - AC = getMagicAC(AC, source, damage, player); - } - else if(source == DamageSource.onFire) - { - AC *= getACForBurn(); - } - else if(source.isUnblockable()) - { - AC *= getUnblockableResistance(armour, source); - } - AC *= getSpecialModifier(armour, source); - - if(player.getEntityData().hasKey("MF_ZombieArmour")) - { - AC -= 1.5F; - if(AC < 0)AC = 0; - } - AC++;//because 1.0AC = no armour so it adds ontop of this - - double totalPercent = ArmourCalculator.convertToPercent(AC); - double maxPercent = 0.99D;//max percentage is 99% damage to avoid immunity - - if(totalPercent > maxPercent) - { - totalPercent = maxPercent; - } - double percent = totalPercent*scalePiece(); - if(percent < 0) - { - percent = 0; - } - - return new ArmorProperties(0, percent, Integer.MAX_VALUE); - } - - protected float getSpecialModifier(ItemStack armour, DamageSource source) { - return 1.0F; - } - private float getACForBurn() - { - return armourWeight >= ArmourCalculator.encumberanceArray[1] ? 0.1F : armourWeight >= ArmourCalculator.encumberanceArray[0] ? 0.05F : 0F; - } - public float getUnblockableResistance(ItemStack item, DamageSource source) - { - return 0F; - } - - public float getMagicAC(float AC, DamageSource source, double damage, EntityLivingBase player) - { - return 0F; - } - protected float getACModifier(EntityLivingBase player, ItemStack armour, DamageSource source, double damage) - { - return 1.0F; - } - public float scalePiece() - { - return ArmourCalculator.sizes[piece]; - } - - protected float getProtectionRatio(ItemStack item) - { - return getBaseAC(); - } - protected float getBaseAC() - { - return material.baseAR*design.getRating(); - } - - private void addModifier(List list, ItemStack item, float ratio, String name) - { - if(getProtectionRatio(item) != ratio) - { - if(getProtectionRatio(item) > ratio) - { - float percent = (ratio / getProtectionRatio(item))-1F; - list.add(EnumChatFormatting.RED+ - StatCollector.translateToLocalFormatted("attribute.modifier.take."+ 1, - decimal_format.format(-percent * 100), - StatCollector.translateToLocal("attribute.armour."+name))); - }else - { - float percent = (ratio / getProtectionRatio(item))-1F; - list.add(EnumChatFormatting.DARK_GREEN+ - StatCollector.translateToLocalFormatted("attribute.modifier.plus."+ 1, - decimal_format.format(percent * 100), - StatCollector.translateToLocal("attribute.armour."+name))); +import java.text.DecimalFormat; +import java.util.List; + +public class ItemArmourMFBase extends ItemArmor implements ISpecialArmor, IArmourMF, IArmourRating, ISpecialArmourMF { + public static final DecimalFormat decimal_format = new DecimalFormat("#.#"); + private static final float[] AC = new float[]{40F, 60F}; + public static ArmorMaterial baseMaterial = EnumHelper.addArmorMaterial("MF Armour Base", 0, + new int[]{2, 6, 5, 2}, 0); + public float baseAR; + public int enchantment; + public String texture; + public float armourWeight; + public ArmourMaterialMF material; + public ArmourDesign design; + public float DT; + protected float suitBulk; + private int piece; + private int baseRating; + + public ItemArmourMFBase(String name, ArmourMaterialMF material, ArmourDesign AD, int slot, String tex) { + super(baseMaterial, 0, slot); + this.material = material; + baseAR = material.baseAR; + armourWeight = AD.getWeight() * material.armourWeight; + enchantment = material.enchantment; + this.piece = slot; + design = AD; + suitBulk = design.getBulk(); + texture = tex; + float baseDura = material.durability * design.getDurability() / 2F; + float dura = baseDura / 2F + (baseDura / 2F * ArmourCalculator.sizes[slot] / ArmourCalculator.sizes[1]); + this.setMaxDamage((int) dura); + this.setUnlocalizedName(name); + setDT(getBaseAC() * scalePiece()); + + baseRating = ArmourCalculator.translateToVanillaAR(getBaseAC() + 1F, + baseMaterial.getDamageReductionAmount(slot), 15); + } + + public ItemArmourMFBase setDT(float DT) { + this.DT = DT; + return this; + } + + /* + * Piece | Slot 0 | 3 1 | 2 2 | 1 3 | 0 + */ + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + initArmourDamage(entity, stack, damage); + } + + public void initArmourDamage(EntityLivingBase user, ItemStack armour, float damage) { + armour.damageItem((int) (damage / 5F) + 1, user); + } + + @Override + public int getArmorDisplay(EntityPlayer player, ItemStack armour, int slot) { + float max = armour.getMaxDamage(); + float dam = max - armour.getItemDamage(); + + return Math.round(5F / max * dam); + } + + @Override + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armour, DamageSource source, double damage, + int slot) { + float AC = getProtectionRatio(armour); + AC = ArmourCalculator.getArmourValueMod(armour, AC); + + if (ArmourCalculator.advancedDamageTypes && !player.worldObj.isRemote) { + AC = ArmourCalculator.adjustACForDamage(source, AC, getProtectiveTrait(armour, 0), + getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); + } + + AC *= getACModifier(player, armour, source, damage); + + if (source == DamageSource.fall && design == ArmourDesign.PLATE) { + AC = 1F / material.armourWeight; + } else if (source.isMagicDamage()) { + AC = getMagicAC(AC, source, damage, player); + } else if (source == DamageSource.onFire) { + AC *= getACForBurn(); + } else if (source.isUnblockable()) { + AC *= getUnblockableResistance(armour, source); + } + AC *= getSpecialModifier(armour, source); + + if (player.getEntityData().hasKey("MF_ZombieArmour")) { + AC -= 1.5F; + if (AC < 0) + AC = 0; + } + AC++;// because 1.0AC = no armour so it adds ontop of this + + double totalPercent = ArmourCalculator.convertToPercent(AC); + double maxPercent = 0.99D;// max percentage is 99% damage to avoid immunity + + if (totalPercent > maxPercent) { + totalPercent = maxPercent; + } + double percent = totalPercent * scalePiece(); + if (percent < 0) { + percent = 0; + } + + return new ArmorProperties(0, percent, Integer.MAX_VALUE); + } + + protected float getSpecialModifier(ItemStack armour, DamageSource source) { + return 1.0F; + } + + private float getACForBurn() { + return armourWeight >= ArmourCalculator.encumberanceArray[1] ? 0.1F + : armourWeight >= ArmourCalculator.encumberanceArray[0] ? 0.05F : 0F; + } + + public float getUnblockableResistance(ItemStack item, DamageSource source) { + return 0F; + } + + public float getMagicAC(float AC, DamageSource source, double damage, EntityLivingBase player) { + return 0F; + } + + protected float getACModifier(EntityLivingBase player, ItemStack armour, DamageSource source, double damage) { + return 1.0F; + } + + public float scalePiece() { + return ArmourCalculator.sizes[piece]; + } + + protected float getProtectionRatio(ItemStack item) { + return getBaseAC(); + } + + protected float getBaseAC() { + return material.baseAR * design.getRating(); + } + + private void addModifier(List list, ItemStack item, float ratio, String name) { + if (getProtectionRatio(item) != ratio) { + if (getProtectionRatio(item) > ratio) { + float percent = (ratio / getProtectionRatio(item)) - 1F; + list.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted( + "attribute.modifier.take." + 1, decimal_format.format(-percent * 100), + StatCollector.translateToLocal("attribute.armour." + name))); + } else { + float percent = (ratio / getProtectionRatio(item)) - 1F; + list.add(EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocalFormatted( + "attribute.modifier.plus." + 1, decimal_format.format(percent * 100), + StatCollector.translateToLocal("attribute.armour." + name))); } } - } - public ArmourMaterialMF getMaterial() - { - return this.material; - } - - @Override - public int getMaxDamage(ItemStack stack) - { - if(isUnbreakable()) - { - setUnbreakable(stack); - } - return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); - } - - protected boolean isUnbreakable() - { - return false; - } - - @Override - public float scalePiece(ItemStack item) - { - return scalePiece(); - } - - @Override - public int getItemEnchantability() - { - return material.enchantment; - } - - @Override - public float getPieceWeight(ItemStack item, int slot) - { - return armourWeight * ArmourCalculator.sizes[slot]; - } - - public static void setUnbreakable(ItemStack tool) - { - if(!tool.hasTagCompound()) - { - tool.setTagCompound(new NBTTagCompound()); - } - tool.getTagCompound().setBoolean("Unbreakable", true); - } - - private static final float[] AC = new float[]{40F, 60F}; - - @Override - public String getSuitWeigthType(ItemStack item) - { - return design.getGroup(); - } - @Override - public float getDTValue(EntityLivingBase user, ItemStack armour, DamageSource src) - { - float DT2 = DT; - - if(ArmourCalculator.advancedDamageTypes && !user.worldObj.isRemote) - { - DT2 = ArmourCalculator.adjustACForDamage(src, DT2, getProtectiveTrait(armour, 0), getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); - } - return DT2; - } - @Override - @SideOnly(Side.CLIENT) - public float getDTDisplay(ItemStack armour, int damageType) - { - return design.getProtectiveTraits()[damageType]*DT; - } - @Override - public float getDRValue(EntityLivingBase user, ItemStack armour, DamageSource src) - { - float DR = getProtectionRatio(armour)*scalePiece(); - - if(ArmourCalculator.advancedDamageTypes && !user.worldObj.isRemote) - { - DR = ArmourCalculator.adjustACForDamage(src, DR, getProtectiveTrait(armour, 0), getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); - } - return DR; - } - @Override - @SideOnly(Side.CLIENT) - public float getDRDisplay(ItemStack armour, int damageType) - { - float DR = getProtectionRatio(armour)*scalePiece(); - - if(ArmourCalculator.advancedDamageTypes) - { - DR = ArmourCalculator.modifyACForType(damageType, DR, getProtectiveTrait(armour, 0), getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); - } - return DR; - } - public float getProtectiveTrait(ItemStack item, int dtype) - { - return design.getProtectiveTraits()[dtype]; - } - /** - * Gets a modifier, improving resistances against the elements - * @param hazard is the type of damage, like "fire" - */ - public float getResistanceModifier(ItemStack item, String hazard) - { - return 1.0F; - } + } + + public ArmourMaterialMF getMaterial() { + return this.material; + } + + @Override + public int getMaxDamage(ItemStack stack) { + if (isUnbreakable()) { + setUnbreakable(stack); + } + return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); + } + + protected boolean isUnbreakable() { + return false; + } + + public static void setUnbreakable(ItemStack tool) { + if (!tool.hasTagCompound()) { + tool.setTagCompound(new NBTTagCompound()); + } + tool.getTagCompound().setBoolean("Unbreakable", true); + } + + @Override + public float scalePiece(ItemStack item) { + return scalePiece(); + } + + @Override + public int getItemEnchantability() { + return material.enchantment; + } + + @Override + public float getPieceWeight(ItemStack item, int slot) { + return armourWeight * ArmourCalculator.sizes[slot]; + } + + @Override + public String getSuitWeigthType(ItemStack item) { + return design.getGroup(); + } + + @Override + public float getDTValue(EntityLivingBase user, ItemStack armour, DamageSource src) { + float DT2 = DT; + + if (ArmourCalculator.advancedDamageTypes && !user.worldObj.isRemote) { + DT2 = ArmourCalculator.adjustACForDamage(src, DT2, getProtectiveTrait(armour, 0), + getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); + } + return DT2; + } + + @Override + @SideOnly(Side.CLIENT) + public float getDTDisplay(ItemStack armour, int damageType) { + return design.getProtectiveTraits()[damageType] * DT; + } + + @Override + public float getDRValue(EntityLivingBase user, ItemStack armour, DamageSource src) { + float DR = getProtectionRatio(armour) * scalePiece(); + + if (ArmourCalculator.advancedDamageTypes && !user.worldObj.isRemote) { + DR = ArmourCalculator.adjustACForDamage(src, DR, getProtectiveTrait(armour, 0), + getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); + } + return DR; + } + + @Override + @SideOnly(Side.CLIENT) + public float getDRDisplay(ItemStack armour, int damageType) { + float DR = getProtectionRatio(armour) * scalePiece(); + + if (ArmourCalculator.advancedDamageTypes) { + DR = ArmourCalculator.modifyACForType(damageType, DR, getProtectiveTrait(armour, 0), + getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); + } + return DR; + } + + public float getProtectiveTrait(ItemStack item, int dtype) { + return design.getProtectiveTraits()[dtype]; + } + + /** + * Gets a modifier, improving resistances against the elements + * + * @param hazard is the type of damage, like "fire" + */ + public float getResistanceModifier(ItemStack item, String hazard) { + return 1.0F; + } } diff --git a/src/main/java/minefantasy/mf2/api/cooking/CookRecipe.java b/src/main/java/minefantasy/mf2/api/cooking/CookRecipe.java index d0194bba..6eb7d2af 100644 --- a/src/main/java/minefantasy/mf2/api/cooking/CookRecipe.java +++ b/src/main/java/minefantasy/mf2/api/cooking/CookRecipe.java @@ -1,96 +1,86 @@ package minefantasy.mf2.api.cooking; -import java.util.HashMap; - import minefantasy.mf2.api.helpers.CustomToolHelper; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; -public class CookRecipe -{ - public static Item burnt_food = null; - private static final HashMaprecipeList = new HashMap(); - - public static CookRecipe addRecipe(ItemStack in, ItemStack out, int min, int max, int time, boolean bake, boolean canBurn) - { - return addRecipe(in, out, new ItemStack(burnt_food), min, max, time, bake, canBurn); - } - /** - * Add a recipe - * @param output The result item - * @param min the limit temperature for cooking - * @param max the max temperature before burning - * @param time the time in ticks taken - * @param bake whether it needs to be enclosed in an oven - */ - public static CookRecipe addRecipe(ItemStack in, ItemStack out, ItemStack burnt, int min, int max, int time, boolean bake, boolean canBurn) - { - return addRecipe(in, out, burnt, min, max, time, time/2, bake, canBurn); - } - /** - * Add a recipe - * @param output The result item - * @param min the limit temperature for cooking - * @param max the max temperature before burning - * @param time the time in ticks taken - * @param bake whether it needs to be enclosed in an oven - */ - public static CookRecipe addRecipe(ItemStack in, ItemStack out, ItemStack burnt, int min, int max, int time, int burntime, boolean bake, boolean canBurn) - { - CookRecipe recipe = new CookRecipe(out, burnt, min, max, time, bake, canBurn); - recipeList.put(CustomToolHelper.getReferenceName(in), recipe); - - if(canBurn) - { - addRecipe(out, burnt, null, min, max, burntime, bake, false); - } - return recipe; - } - - public final int maxTemperature, minTemperature, time; - public final boolean isBaking; - public final ItemStack output, burnt; - public final boolean canBurn; +import java.util.HashMap; + +public class CookRecipe { + public static final HashMap recipeList = new HashMap(); + public static Item burnt_food = null; + public static boolean canCookBasics = true; + public final int maxTemperature, minTemperature, time; + public final boolean isBaking; + public final ItemStack output, burnt; + public final boolean canBurn; + + public CookRecipe(ItemStack output, ItemStack burnt, int min, int max, int time, boolean bake, boolean burn) { + this.output = output; + this.burnt = burnt; + this.minTemperature = min; + this.maxTemperature = max; + this.time = time; + this.isBaking = bake; + this.canBurn = burn; + } + + public static CookRecipe addRecipe(ItemStack in, ItemStack out, int min, int max, int time, boolean bake, + boolean canBurn) { + return addRecipe(in, out, new ItemStack(burnt_food), min, max, time, bake, canBurn); + } + + /** + * Add a recipe + * + * @param output The result item + * @param min the limit temperature for cooking + * @param max the max temperature before burning + * @param time the time in ticks taken + * @param bake whether it needs to be enclosed in an oven + */ + public static CookRecipe addRecipe(ItemStack in, ItemStack out, ItemStack burnt, int min, int max, int time, + boolean bake, boolean canBurn) { + return addRecipe(in, out, burnt, min, max, time, time / 2, bake, canBurn); + } + + /** + * Add a recipe + * + * @param output The result item + * @param min the limit temperature for cooking + * @param max the max temperature before burning + * @param time the time in ticks taken + * @param bake whether it needs to be enclosed in an oven + */ + public static CookRecipe addRecipe(ItemStack in, ItemStack out, ItemStack burnt, int min, int max, int time, + int burntime, boolean bake, boolean canBurn) { + CookRecipe recipe = new CookRecipe(out, burnt, min, max, time, bake, canBurn); + recipeList.put(CustomToolHelper.getReferenceName(in), recipe); + + if (canBurn) { + addRecipe(out, burnt, null, min, max, burntime, bake, false); + } + return recipe; + } + + public static CookRecipe getResult(ItemStack item, boolean oven) { + if (item == null) + return null; + + CookRecipe result = recipeList.get(CustomToolHelper.getReferenceName(item)); + if (result != null && result.isBaking == oven) { + return result; + } - public CookRecipe(ItemStack output, ItemStack burnt, int min, int max, int time, boolean bake, boolean burn) - { - this.output=output; - this.burnt = burnt; - this.minTemperature = min; - this.maxTemperature = max; - this.time = time; - this.isBaking = bake; - this.canBurn = burn; - } - - public static CookRecipe getResult(ItemStack item, boolean oven) - { - if(item == null)return null; - - CookRecipe result = recipeList.get(CustomToolHelper.getReferenceName(item)); - if(result != null && !result.isBaking || oven) - { - return result; - } - else - { - result = recipeList.get(CustomToolHelper.getReferenceName(item)); - if(result != null&& !result.isBaking || oven) - { - return result; - } - } - if(canCookBasics) - { - ItemStack recipe = FurnaceRecipes.smelting().getSmeltingResult(item); - if(recipe != null && recipe.getItem() instanceof ItemFood) - { - return new CookRecipe(recipe, new ItemStack(burnt_food), 100, 300, 20, false, true); - } - } - return null; - } - public static boolean canCookBasics = true; + if (canCookBasics) { + ItemStack recipe = FurnaceRecipes.smelting().getSmeltingResult(item); + if (recipe != null && recipe.getItem() instanceof ItemFood) { + return new CookRecipe(recipe, new ItemStack(burnt_food), 100, 300, 20, false, true); + } + } + return null; + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/BasicTierRecipe.java b/src/main/java/minefantasy/mf2/api/crafting/BasicTierRecipe.java index 74629b84..6c96880c 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/BasicTierRecipe.java +++ b/src/main/java/minefantasy/mf2/api/crafting/BasicTierRecipe.java @@ -1,137 +1,43 @@ package minefantasy.mf2.api.crafting; -import java.util.HashMap; - import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.api.helpers.CustomToolHelper; import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.world.World; -public class BasicTierRecipe extends ShapedRecipes -{ - - public BasicTierRecipe(int width, int height, ItemStack[] input, ItemStack output) - { - super(width, height, input, output); - } - - @Override - public boolean matches(InventoryCrafting matrix, World world) - { - for (int i = 0; i <= 3 - this.recipeWidth; ++i) - { - for (int j = 0; j <= 3 - this.recipeHeight; ++j) - { - if (this.checkTierMatch(matrix, i, j, true)) - { - return true; - } +import java.util.HashMap; - if (this.checkTierMatch(matrix, i, j, false)) - { - return true; - } - } - } +public class BasicTierRecipe extends ShapedRecipes { - return false; + public BasicTierRecipe(int width, int height, ItemStack[] input, ItemStack output) { + super(width, height, input, output); } - /** - * Checks if the region of a crafting inventory is match for the recipe. - */ - private boolean checkTierMatch(InventoryCrafting matrix, int x, int y, boolean mirror) - { - String wood = null; - String metal = null; - for (int k = 0; k < 3; ++k) - { - for (int l = 0; l < 3; ++l) - { - int i1 = k - x; - int j1 = l - y; - ItemStack itemstack = null; - - if (i1 >= 0 && j1 >= 0 && i1 < this.recipeWidth && j1 < this.recipeHeight) - { - if (mirror) - { - itemstack = this.recipeItems[this.recipeWidth - i1 - 1 + j1 * this.recipeWidth]; - } - else - { - itemstack = this.recipeItems[i1 + j1 * this.recipeWidth]; - } - } - - ItemStack itemstack1 = matrix.getStackInRowAndColumn(k, l); - - if (itemstack1 != null || itemstack != null) - { - //String recipe_wood = CustomToolHelper.getComponentMaterial(itemstack, "wood"); - String recipe_metal = CustomToolHelper.getComponentMaterial(itemstack, "metal"); - - //String component_wood = CustomToolHelper.getComponentMaterial(itemstack1, "wood"); - String component_metal = CustomToolHelper.getComponentMaterial(itemstack1, "metal"); - - if(recipe_metal != null) - { - if(component_metal == null)return false; - if(!component_metal.equalsIgnoreCase(recipe_metal))return false; - } - - if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null) - { - return false; - } - - if (itemstack.getItem() != itemstack1.getItem()) - { - return false; - } - - if (itemstack.getItemDamage() != 32767 && itemstack.getItemDamage() != itemstack1.getItemDamage()) - { - return false; - } - } - } - } - - return true; - } - public static BasicTierRecipe add(ItemStack result, Object ... input) - { + public static BasicTierRecipe add(ItemStack result, Object... input) { String var3 = ""; int var4 = 0; int var5 = 0; int var6 = 0; int var9; - if (input[var4] instanceof String[]) - { - String[] var7 = ((String[])input[var4++]); + if (input[var4] instanceof String[]) { + String[] var7 = ((String[]) input[var4++]); String[] var8 = var7; var9 = var7.length; - for (int var10 = 0; var10 < var9; ++var10) - { + for (int var10 = 0; var10 < var9; ++var10) { String var11 = var8[var10]; ++var6; var5 = var11.length(); var3 = var3 + var11; } - } - else - { - while (input[var4] instanceof String) - { - String var13 = (String)input[var4++]; + } else { + while (input[var4] instanceof String) { + String var13 = (String) input[var4++]; ++var6; var5 = var13.length(); var3 = var3 + var13; @@ -140,22 +46,16 @@ public static BasicTierRecipe add(ItemStack result, Object ... input) HashMap var14; - for (var14 = new HashMap(); var4 < input.length; var4 += 2) - { - Character var16 = (Character)input[var4]; + for (var14 = new HashMap(); var4 < input.length; var4 += 2) { + Character var16 = (Character) input[var4]; ItemStack var17 = null; - if (input[var4 + 1] instanceof Item) - { - var17 = new ItemStack((Item)input[var4 + 1], 1, 32767); - } - else if (input[var4 + 1] instanceof Block) - { - var17 = new ItemStack((Block)input[var4 + 1], 1, 32767); - } - else if (input[var4 + 1] instanceof ItemStack) - { - var17 = (ItemStack)input[var4 + 1]; + if (input[var4 + 1] instanceof Item) { + var17 = new ItemStack((Item) input[var4 + 1], 1, 32767); + } else if (input[var4 + 1] instanceof Block) { + var17 = new ItemStack((Block) input[var4 + 1], 1, 32767); + } else if (input[var4 + 1] instanceof ItemStack) { + var17 = (ItemStack) input[var4 + 1]; } var14.put(var16, var17); @@ -163,22 +63,91 @@ else if (input[var4 + 1] instanceof ItemStack) ItemStack[] var15 = new ItemStack[var5 * var6]; - for (var9 = 0; var9 < var5 * var6; ++var9) - { + for (var9 = 0; var9 < var5 * var6; ++var9) { char var18 = var3.charAt(var9); - if (var14.containsKey(Character.valueOf(var18))) - { - var15[var9] = ((ItemStack)var14.get(Character.valueOf(var18))).copy(); - } - else - { + if (var14.containsKey(Character.valueOf(var18))) { + var15[var9] = ((ItemStack) var14.get(Character.valueOf(var18))).copy(); + } else { var15[var9] = null; } } - BasicTierRecipe recipe = new BasicTierRecipe(var5, var6, var15, result); - GameRegistry.addRecipe(recipe); - return recipe; + BasicTierRecipe recipe = new BasicTierRecipe(var5, var6, var15, result); + GameRegistry.addRecipe(recipe); + return recipe; + } + + @Override + public boolean matches(InventoryCrafting matrix, World world) { + for (int i = 0; i <= 3 - this.recipeWidth; ++i) { + for (int j = 0; j <= 3 - this.recipeHeight; ++j) { + if (this.checkTierMatch(matrix, i, j, true)) { + return true; + } + + if (this.checkTierMatch(matrix, i, j, false)) { + return true; + } + } + } + + return false; + } + + /** + * Checks if the region of a crafting inventory is match for the recipe. + */ + private boolean checkTierMatch(InventoryCrafting matrix, int x, int y, boolean mirror) { + String wood = null; + String metal = null; + for (int k = 0; k < 3; ++k) { + for (int l = 0; l < 3; ++l) { + int i1 = k - x; + int j1 = l - y; + ItemStack itemstack = null; + + if (i1 >= 0 && j1 >= 0 && i1 < this.recipeWidth && j1 < this.recipeHeight) { + if (mirror) { + itemstack = this.recipeItems[this.recipeWidth - i1 - 1 + j1 * this.recipeWidth]; + } else { + itemstack = this.recipeItems[i1 + j1 * this.recipeWidth]; + } + } + + ItemStack itemstack1 = matrix.getStackInRowAndColumn(k, l); + + if (itemstack1 != null || itemstack != null) { + // String recipe_wood = CustomToolHelper.getComponentMaterial(itemstack, + // "wood"); + String recipe_metal = CustomToolHelper.getComponentMaterial(itemstack, "metal"); + + // String component_wood = CustomToolHelper.getComponentMaterial(itemstack1, + // "wood"); + String component_metal = CustomToolHelper.getComponentMaterial(itemstack1, "metal"); + + if (recipe_metal != null) { + if (component_metal == null) + return false; + if (!component_metal.equalsIgnoreCase(recipe_metal)) + return false; + } + + if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null) { + return false; + } + + if (itemstack.getItem() != itemstack1.getItem()) { + return false; + } + + if (itemstack.getItemDamage() != 32767 && itemstack.getItemDamage() != itemstack1.getItemDamage()) { + return false; + } + } + } + } + + return true; } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/CustomCrafterEntry.java b/src/main/java/minefantasy/mf2/api/crafting/CustomCrafterEntry.java index 7b278e91..61d2fa7f 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/CustomCrafterEntry.java +++ b/src/main/java/minefantasy/mf2/api/crafting/CustomCrafterEntry.java @@ -1,94 +1,86 @@ package minefantasy.mf2.api.crafting; -import java.util.HashMap; - -import minefantasy.mf2.api.MineFantasyAPI; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class CustomCrafterEntry -{ - /** - * Registeres a piece (called by code or config) - * @param piece the item to list - * @param type the crafter type - */ - public static void registerItem(Item piece, String type, float efficiency, int tier) - { - entries.put(piece, new CustomCrafterEntry(piece, type, efficiency, tier)); - } - - /** - * Gets the variables for the item if there are any: order is weight, bulk - */ - public static String getEntryType(ItemStack piece) - { - CustomCrafterEntry entry = getEntry(piece); - if(entry != null) - { - return entry.type; - } - return "nothing"; - } - public static float getEntryEfficiency(ItemStack piece) - { - CustomCrafterEntry entry = getEntry(piece); - if(entry != null) - { - return entry.efficiency; - } - return 2.0F; - } - public static int getEntryTier(ItemStack piece) - { - CustomCrafterEntry entry = getEntry(piece); - if(entry != null) - { - return entry.tier; - } - return -1; - } - /** - * Gets the entry for an item - * @param piece the armour item - * @return the entry(if there is one), else null - */ - public static CustomCrafterEntry getEntry(ItemStack piece) - { - return getEntry(piece.getItem()); - } - /** - * Gets the entry for an item - * @param piece the armour item - * @return the entry(if there is one), else null - */ - public static CustomCrafterEntry getEntry(Item piece) - { - if(piece != null) - { - if(entries.containsKey(piece)) - { - return entries.get(piece); - } - } - return null; - } - - public Item itemID; - /** - * The Efficiency(same variable as dig speed) - */ - public String type; - public float efficiency; - public int tier; - - public static HashMapentries = new HashMap(); - - private CustomCrafterEntry(Item id, String type, float efficiency, int tier) - { - this.itemID = id; - this.type = type; - this.efficiency = efficiency; - this.tier = tier; - } +import java.util.HashMap; + +public class CustomCrafterEntry { + public static HashMap entries = new HashMap(); + public Item itemID; + /** + * The Efficiency(same variable as dig speed) + */ + public String type; + public float efficiency; + public int tier; + + private CustomCrafterEntry(Item id, String type, float efficiency, int tier) { + this.itemID = id; + this.type = type; + this.efficiency = efficiency; + this.tier = tier; + } + + /** + * Registeres a piece (called by code or config) + * + * @param piece the item to list + * @param type the crafter type + */ + public static void registerItem(Item piece, String type, float efficiency, int tier) { + entries.put(piece, new CustomCrafterEntry(piece, type, efficiency, tier)); + } + + /** + * Gets the variables for the item if there are any: order is weight, bulk + */ + public static String getEntryType(ItemStack piece) { + CustomCrafterEntry entry = getEntry(piece); + if (entry != null) { + return entry.type; + } + return "nothing"; + } + + public static float getEntryEfficiency(ItemStack piece) { + CustomCrafterEntry entry = getEntry(piece); + if (entry != null) { + return entry.efficiency; + } + return 2.0F; + } + + public static int getEntryTier(ItemStack piece) { + CustomCrafterEntry entry = getEntry(piece); + if (entry != null) { + return entry.tier; + } + return -1; + } + + /** + * Gets the entry for an item + * + * @param piece the armour item + * @return the entry(if there is one), else null + */ + public static CustomCrafterEntry getEntry(ItemStack piece) { + return getEntry(piece.getItem()); + } + + /** + * Gets the entry for an item + * + * @param piece the armour item + * @return the entry(if there is one), else null + */ + public static CustomCrafterEntry getEntry(Item piece) { + if (piece != null) { + if (entries.containsKey(piece)) { + return entries.get(piece); + } + } + return null; + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/IBasicMetre.java b/src/main/java/minefantasy/mf2/api/crafting/IBasicMetre.java index 4ffd9285..cb6833e8 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/IBasicMetre.java +++ b/src/main/java/minefantasy/mf2/api/crafting/IBasicMetre.java @@ -1,8 +1,9 @@ package minefantasy.mf2.api.crafting; -public interface IBasicMetre -{ - int getMetreScale(int size); - boolean shouldShowMetre(); - String getLocalisedName(); +public interface IBasicMetre { + int getMetreScale(int size); + + boolean shouldShowMetre(); + + String getLocalisedName(); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/IHeatSource.java b/src/main/java/minefantasy/mf2/api/crafting/IHeatSource.java index 3e78c87f..037ec50e 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/IHeatSource.java +++ b/src/main/java/minefantasy/mf2/api/crafting/IHeatSource.java @@ -1,7 +1,7 @@ package minefantasy.mf2.api.crafting; -public interface IHeatSource -{ - public boolean canPlaceAbove(); - public int getHeat(); +public interface IHeatSource { + public boolean canPlaceAbove(); + + public int getHeat(); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/IHeatUser.java b/src/main/java/minefantasy/mf2/api/crafting/IHeatUser.java index dd221cf1..9f78dcd0 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/IHeatUser.java +++ b/src/main/java/minefantasy/mf2/api/crafting/IHeatUser.java @@ -3,5 +3,5 @@ import net.minecraft.tileentity.TileEntity; public interface IHeatUser { - public boolean canAccept(TileEntity tile); + public boolean canAccept(TileEntity tile); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/IQualityBalance.java b/src/main/java/minefantasy/mf2/api/crafting/IQualityBalance.java index 77cd695b..fd41f7c0 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/IQualityBalance.java +++ b/src/main/java/minefantasy/mf2/api/crafting/IQualityBalance.java @@ -1,9 +1,11 @@ package minefantasy.mf2.api.crafting; -public interface IQualityBalance -{ - float getMarkerPosition(); - float getThresholdPosition(); - float getSuperThresholdPosition(); - boolean shouldShowMetre(); +public interface IQualityBalance { + float getMarkerPosition(); + + float getThresholdPosition(); + + float getSuperThresholdPosition(); + + boolean shouldShowMetre(); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/ISalvageDrop.java b/src/main/java/minefantasy/mf2/api/crafting/ISalvageDrop.java index 823c897a..413d4a58 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/ISalvageDrop.java +++ b/src/main/java/minefantasy/mf2/api/crafting/ISalvageDrop.java @@ -3,8 +3,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -public interface ISalvageDrop -{ - public boolean canSalvage(EntityPlayer user, ItemStack item); - +public interface ISalvageDrop { + public boolean canSalvage(EntityPlayer user, ItemStack item); + } diff --git a/src/main/java/minefantasy/mf2/api/crafting/ISpecialSalvage.java b/src/main/java/minefantasy/mf2/api/crafting/ISpecialSalvage.java index 6afd8e32..c76230f1 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/ISpecialSalvage.java +++ b/src/main/java/minefantasy/mf2/api/crafting/ISpecialSalvage.java @@ -2,11 +2,11 @@ import net.minecraft.item.ItemStack; -public interface ISpecialSalvage -{ - /** - * Returns a list of Items, Blocks, or ItemStacks dropped by salvage (similar to the regular function) - */ - public Object[] getSalvage(ItemStack item); - +public interface ISpecialSalvage { + /** + * Returns a list of Items, Blocks, or ItemStacks dropped by salvage (similar to + * the regular function) + */ + public Object[] getSalvage(ItemStack item); + } diff --git a/src/main/java/minefantasy/mf2/api/crafting/ITieredComponent.java b/src/main/java/minefantasy/mf2/api/crafting/ITieredComponent.java index c8f0755d..7fcdd02f 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/ITieredComponent.java +++ b/src/main/java/minefantasy/mf2/api/crafting/ITieredComponent.java @@ -2,10 +2,9 @@ import net.minecraft.item.ItemStack; -public interface ITieredComponent -{ - /** - * is it made of "wood", "metal", etc - */ - public String getMaterialType(ItemStack item); +public interface ITieredComponent { + /** + * is it made of "wood", "metal", etc + */ + public String getMaterialType(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/MineFantasyFuels.java b/src/main/java/minefantasy/mf2/api/crafting/MineFantasyFuels.java index f5ae7822..488d8250 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/MineFantasyFuels.java +++ b/src/main/java/minefantasy/mf2/api/crafting/MineFantasyFuels.java @@ -7,88 +7,78 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class MineFantasyFuels -{ - public static void addForgeFuel(Object input, float time, int temperature) - { - addForgeFuel(input, time, temperature, false, false); - } - public static void addForgeFuel(Object input, float time, int temperature, boolean willLight) - { - addForgeFuel(input, time, temperature, willLight, false); - } - public static void addForgeFuel(Object input, float time, int temperature, boolean willLight, boolean refined) - { - ItemStack item = convert(input); - if(item != null) - { - ForgeItemHandler.forgeFuel.add(new ForgeFuel(item, time, temperature, willLight, refined)); - if ((int) (temperature * 1.25) > ForgeItemHandler.forgeMaxTemp) - { - ForgeItemHandler.forgeMaxTemp = (int) (temperature * 1.25); - } - } - } - /** - * Adds a carbon item for smelting - * @param input Item Block or ItemStack - * @param uses - */ - public static void addCarbon(Object input, int uses) - { - ItemStack itemstack = convert(input); - - if(itemstack != null) - { - OreDictionary.registerOre("Carbon-"+uses, itemstack); - } - } - /** - * How many smelts (blast furn or bloomery) this can give as carbon - */ - public static int getCarbon(ItemStack item) - { - if(item == null)return 0; - - for(int i: OreDictionary.getOreIDs(item)) - { - String name = OreDictionary.getOreName(i); - if(name != null && name.startsWith("Carbon-")) - { - String s = name.substring(7); - int uses = Integer.parseInt(s); - return uses; - } - } - - return 0; - } - /** - * Determines if the item can be used for carbon in smelting. - */ - public static boolean isCarbon(ItemStack item) - { - return getCarbon(item)>0; - } - - public static ItemStack convert(Object input) - { - if(input == null)return null; - - ItemStack itemstack = null; - if(input instanceof ItemStack) - { - return (ItemStack)input; - } - else if(input instanceof Block) - { - return new ItemStack((Block)input); - } - else if(input instanceof Item) - { - return new ItemStack((Item)input); - } - - return null; - } +public class MineFantasyFuels { + public static void addForgeFuel(Object input, float time, int temperature) { + addForgeFuel(input, time, temperature, false, false); + } + + public static void addForgeFuel(Object input, float time, int temperature, boolean willLight) { + addForgeFuel(input, time, temperature, willLight, false); + } + + public static void addForgeFuel(Object input, float time, int temperature, boolean willLight, boolean refined) { + ItemStack item = convert(input); + if (item != null) { + ForgeItemHandler.forgeFuel.add(new ForgeFuel(item, time, temperature, willLight, refined)); + if ((int) (temperature * 1.25) > ForgeItemHandler.forgeMaxTemp) { + ForgeItemHandler.forgeMaxTemp = (int) (temperature * 1.25); + } + } + } + + /** + * Adds a carbon item for smelting + * + * @param input Item Block or ItemStack + * @param uses + */ + public static void addCarbon(Object input, int uses) { + ItemStack itemstack = convert(input); + + if (itemstack != null) { + OreDictionary.registerOre("Carbon-" + uses, itemstack); + } + } + + /** + * How many smelts (blast furn or bloomery) this can give as carbon + */ + public static int getCarbon(ItemStack item) { + if (item == null) + return 0; + + for (int i : OreDictionary.getOreIDs(item)) { + String name = OreDictionary.getOreName(i); + if (name != null && name.startsWith("Carbon-")) { + String s = name.substring(7); + int uses = Integer.parseInt(s); + return uses; + } + } + + return 0; + } + + /** + * Determines if the item can be used for carbon in smelting. + */ + public static boolean isCarbon(ItemStack item) { + return getCarbon(item) > 0; + } + + public static ItemStack convert(Object input) { + if (input == null) + return null; + + ItemStack itemstack = null; + if (input instanceof ItemStack) { + return (ItemStack) input; + } else if (input instanceof Block) { + return new ItemStack((Block) input); + } else if (input instanceof Item) { + return new ItemStack((Item) input); + } + + return null; + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/Salvage.java b/src/main/java/minefantasy/mf2/api/crafting/Salvage.java index 2a724667..2a790a46 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/Salvage.java +++ b/src/main/java/minefantasy/mf2/api/crafting/Salvage.java @@ -1,160 +1,138 @@ package minefantasy.mf2.api.crafting; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; -import java.util.Random; - import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.util.MFLogUtil; +import minefantasy.mf2.util.XSTRandom; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class Salvage -{ - private static Random random = new Random(); - private static HashMap salvageList = new HashMap(); - private static HashMapsharedSalvage = new HashMap(); - - public static void shareSalvage(Item item1, Item item2) - { - sharedSalvage.put(CustomToolHelper.getSimpleReferenceName(item1), item2); - } - public static void addSalvage(Block input, Object... components) - { - addSalvage(Item.getItemFromBlock(input), components); - } - public static void addSalvage(Item input, Object... components) - { - salvageList.put(CustomToolHelper.getSimpleReferenceName(input), components); - } - public static void addSalvage(ItemStack item, Object...components) - { - if(item.isItemStackDamageable()) - { - item.setItemDamage(OreDictionary.WILDCARD_VALUE); - } - salvageList.put(CustomToolHelper.getReferenceName(item), components); +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class Salvage { + public static HashMap salvageList = new HashMap(); + public static HashMap sharedSalvage = new HashMap(); + private static XSTRandom random = new XSTRandom(); + + public static void shareSalvage(Item item1, Item item2) { + sharedSalvage.put(CustomToolHelper.getSimpleReferenceName(item1), item2); + } + + public static void addSalvage(Block input, Object... components) { + addSalvage(Item.getItemFromBlock(input), components); + } + + public static void addSalvage(Item input, Object... components) { + salvageList.put(CustomToolHelper.getSimpleReferenceName(input), components); + } + + public static void addSalvage(ItemStack item, Object... components) { + if (item.isItemStackDamageable()) { + item.setItemDamage(OreDictionary.WILDCARD_VALUE); + } + salvageList.put(CustomToolHelper.getReferenceName(item), components); + } + + /** + * Break an item to its parts + * + * @return a list of items + */ + public static List salvage(EntityPlayer user, ItemStack item) { + return salvage(user, item, 1.0F); } - /** - * Break an item to its parts - * @return a list of items - */ - public static List salvage(EntityPlayer user, ItemStack item) - { - return salvage(user, item, 1.0F); + public static List salvage(EntityPlayer user, ItemStack item, float dropRate) { + Object[] entryList = getSalvage(item); + if (entryList == null) { + return null; + } + + float durability = 1F; + if (item.isItemDamaged()) { + durability = (float) (item.getMaxDamage() - item.getItemDamage()) / (float) item.getMaxDamage(); + } + + float chanceModifier = 1.25F;// 80% Succcess rate + float chance = dropRate * durability;// Modifier for skill and durability + + return dropItems(item, user, entryList, chanceModifier, chance); } - - public static List salvage(EntityPlayer user, ItemStack item, float dropRate) - { - Object[] entryList = getSalvage(item); - if(entryList == null) - { - return null; - } - - float durability = 1F; - if(item.isItemDamaged()) - { - durability = (float)(item.getMaxDamage() - item.getItemDamage()) / (float)item.getMaxDamage(); - } - - float chanceModifier = 1.25F;//80% Succcess rate - float chance = dropRate*durability;//Modifier for skill and durability - - return dropItems(item, user, entryList, chanceModifier, chance); + + private static List dropItems(ItemStack mainItem, EntityPlayer user, Object[] entryList, + float chanceModifier, float chance) { + List items = new ArrayList(); + for (Object entry : entryList) { + if (entry != null) { + if (entry instanceof Item && random.nextFloat() * chanceModifier < chance) { + items = dropItemStack(mainItem, user, items, new ItemStack((Item) entry), chanceModifier, chance); + } + if (entry instanceof Block && random.nextFloat() * chanceModifier < chance) { + items = dropItemStack(mainItem, user, items, new ItemStack((Block) entry), chanceModifier, chance); + } + if (entry instanceof ItemStack) { + items = dropItemStack(mainItem, user, items, (ItemStack) entry, chanceModifier, chance); + } + } + } + return items; + } + + private static List dropItemStack(ItemStack mainItem, EntityPlayer user, List items, + ItemStack entry, float chanceModifier, float chance) { + for (int a = 0; a < entry.stackSize; a++) { + if (random.nextFloat() * chanceModifier < chance) { + boolean canSalvage = true; + + if (entry.getItem() instanceof ISalvageDrop) { + canSalvage = ((ISalvageDrop) entry.getItem()).canSalvage(user, entry); + } + if (canSalvage) { + ItemStack newitem = entry.copy(); + newitem.stackSize = 1; + newitem = CustomToolHelper.tryDeconstruct(newitem, mainItem); + items.add(newitem); + } + } + } + return items; } - private static List dropItems(ItemStack mainItem, EntityPlayer user, Object[] entryList, float chanceModifier, float chance) - { - Listitems = new ArrayList(); - for(Object entry : entryList) - { - if(entry != null) - { - if(entry instanceof Item && random.nextFloat()*chanceModifier < chance) - { - items = dropItemStack(mainItem, user, items, new ItemStack((Item)entry), chanceModifier, chance); - } - if(entry instanceof Block && random.nextFloat()*chanceModifier < chance) - { - items = dropItemStack(mainItem, user, items, new ItemStack((Block)entry), chanceModifier, chance); - } - if(entry instanceof ItemStack) - { - items = dropItemStack(mainItem, user, items, (ItemStack)entry, chanceModifier, chance); - } - } - } - return items; - } - - private static List dropItemStack(ItemStack mainItem, EntityPlayer user, Listitems, ItemStack entry, float chanceModifier, float chance) - { - for(int a = 0; a < entry.stackSize; a++) - { - if(random.nextFloat()*chanceModifier < chance) - { - boolean canSalvage = true; - - if(entry.getItem() instanceof ISalvageDrop) - { - canSalvage = ((ISalvageDrop)entry.getItem()).canSalvage(user, entry); - } - if(canSalvage) - { - ItemStack newitem = entry.copy(); - newitem.stackSize = 1; - newitem = CustomToolHelper.tryDeconstruct(newitem, mainItem); - items.add(newitem); - } - } - } - return items; - } - public static Object[] getSalvage(ItemStack item) - { - //SHARED - Item shared = sharedSalvage.get(CustomToolHelper.getReferenceName(item, "any", false)); - if(shared != null) - { - MFLogUtil.logDebug("Found shared: " + shared.getUnlocalizedName()); - return getSalvage(new ItemStack(shared)); - } - - if(item != null && item.getItem() instanceof ISpecialSalvage) - { - Object[] special = ((ISpecialSalvage)item.getItem()).getSalvage(item); - if(special != null) - { - return special; - } - } - Object[] specific = salvageList.get(CustomToolHelper.getReferenceName(item)); - if(specific != null) - { - return specific; - } - Object[] specific2 = salvageList.get(CustomToolHelper.getReferenceName(item, "any")); - if(specific2 != null) - { - return specific2; - } - - return salvageList.get(CustomToolHelper.getReferenceName(item, "any", false)); + public static Object[] getSalvage(ItemStack item) { + // SHARED + Item shared = sharedSalvage.get(CustomToolHelper.getReferenceName(item, "any", false)); + if (shared != null) { + MFLogUtil.logDebug("Found shared: " + shared.getUnlocalizedName()); + return getSalvage(new ItemStack(shared)); + } + + if (item != null && item.getItem() instanceof ISpecialSalvage) { + Object[] special = ((ISpecialSalvage) item.getItem()).getSalvage(item); + if (special != null) { + return special; + } + } + Object[] specific = salvageList.get(CustomToolHelper.getReferenceName(item)); + if (specific != null) { + return specific; + } + Object[] specific2 = salvageList.get(CustomToolHelper.getReferenceName(item, "any")); + if (specific2 != null) { + return specific2; + } + + return salvageList.get(CustomToolHelper.getReferenceName(item, "any", false)); } - private static boolean doesMatch(ItemStack item1, ItemStack item2) - { - if(!CustomToolHelper.doesMatchForRecipe(item1, item2)) - { - return false; + + private static boolean doesMatch(ItemStack item1, ItemStack item2) { + if (!CustomToolHelper.doesMatchForRecipe(item1, item2)) { + return false; } - return item2.getItem() == item1.getItem() && (item2.getItemDamage() == OreDictionary.WILDCARD_VALUE || item2.getItemDamage() == item1.getItemDamage()); + return item2.getItem() == item1.getItem() && (item2.getItemDamage() == OreDictionary.WILDCARD_VALUE + || item2.getItemDamage() == item1.getItemDamage()); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/api/crafting/anvil/AnvilCraftMatrix.java b/src/main/java/minefantasy/mf2/api/crafting/anvil/AnvilCraftMatrix.java index 398117b3..9799ca04 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/anvil/AnvilCraftMatrix.java +++ b/src/main/java/minefantasy/mf2/api/crafting/anvil/AnvilCraftMatrix.java @@ -1,35 +1,32 @@ package minefantasy.mf2.api.crafting.anvil; -import minefantasy.mf2.api.crafting.anvil.IAnvil; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCrafting; -public class AnvilCraftMatrix extends InventoryCrafting -{ - private IAnvil anvil; - public AnvilCraftMatrix(IAnvil anvil, Container instance, int xSize, int ySize) - { - super(instance, xSize, ySize); - this.anvil = anvil; - } - - public void modifyTier(int hammerTier, int anvilTier, int craftTime) - { - anvil.setHammerUsed(hammerTier); - anvil.setRequiredAnvil(anvilTier); - anvil.setForgeTime(craftTime); - } - public void modifyResearch(String name) - { - anvil.setResearch(name); - } - - public int getTier() { - return anvil.getRecipeHammer(); - } - - public int getAnvilTier() { - return anvil.getRecipeAnvil(); - } +public class AnvilCraftMatrix extends InventoryCrafting { + private IAnvil anvil; + + public AnvilCraftMatrix(IAnvil anvil, Container instance, int xSize, int ySize) { + super(instance, xSize, ySize); + this.anvil = anvil; + } + + public void modifyTier(int hammerTier, int anvilTier, int craftTime) { + anvil.setHammerUsed(hammerTier); + anvil.setRequiredAnvil(anvilTier); + anvil.setForgeTime(craftTime); + } + + public void modifyResearch(String name) { + anvil.setResearch(name); + } + + public int getTier() { + return anvil.getRecipeHammer(); + } + + public int getAnvilTier() { + return anvil.getRecipeAnvil(); + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/anvil/CraftingManagerAnvil.java b/src/main/java/minefantasy/mf2/api/crafting/anvil/CraftingManagerAnvil.java index 7e5258b8..28f7289c 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/anvil/CraftingManagerAnvil.java +++ b/src/main/java/minefantasy/mf2/api/crafting/anvil/CraftingManagerAnvil.java @@ -1,82 +1,74 @@ package minefantasy.mf2.api.crafting.anvil; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.rpg.Skill; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import java.util.*; + /** - * * @author AnonymousProductions - * */ -public class CraftingManagerAnvil -{ - /** The static instance of this class */ +public class CraftingManagerAnvil { + /** + * The static instance of this class + */ private static final CraftingManagerAnvil instance = new CraftingManagerAnvil(); - /** A list of all the recipes added */ + /** + * A list of all the recipes added + */ public List recipes = new ArrayList(); + private CraftingManagerAnvil() { + Collections.sort(this.recipes, new RecipeSorterAnvil(this)); + System.out.println("MineFantasy: Anvil recipes initiating"); + } + /** * Returns the static instance of this class */ - public static CraftingManagerAnvil getInstance() - { + public static CraftingManagerAnvil getInstance() { return instance; } - private CraftingManagerAnvil() - { - Collections.sort(this.recipes, new RecipeSorterAnvil(this)); - System.out.println("MineFantasy: Anvil recipes initiating"); + public IAnvilRecipe addRecipe(ItemStack result, Skill skill, String research, boolean hot, float exp, String tool, + int hammer, int anvil, int time, Object... input) { + return addRecipe(result, skill, research, hot, exp, tool, hammer, anvil, time, (byte) 0, input); } - public IAnvilRecipe addRecipe(ItemStack result, Skill skill, String research, boolean hot, float exp, String tool, int hammer, int anvil, int time, Object ... input) - { - return addRecipe(result, skill, research, hot, exp, tool, hammer, anvil, time, (byte)0, input); - } - public IAnvilRecipe addToolRecipe(ItemStack result, Skill skill, String research, boolean hot, float exp, String tool, int hammer, int anvil, int time, Object ... input) - { - return addRecipe(result, skill, research, hot, exp, tool, hammer, anvil, time, (byte)1, input); + public IAnvilRecipe addToolRecipe(ItemStack result, Skill skill, String research, boolean hot, float exp, + String tool, int hammer, int anvil, int time, Object... input) { + return addRecipe(result, skill, research, hot, exp, tool, hammer, anvil, time, (byte) 1, input); } + /** * Adds a recipe. See spreadsheet on first page for details. */ - private IAnvilRecipe addRecipe(ItemStack result, Skill skill, String research, boolean hot, float exp, String tool, int hammer, int anvil, int time, byte recipeType, Object ... input) - { + private IAnvilRecipe addRecipe(ItemStack result, Skill skill, String research, boolean hot, float exp, String tool, + int hammer, int anvil, int time, byte recipeType, Object... input) { String var3 = ""; int var4 = 0; int var5 = 0; int var6 = 0; int var9; - if (input[var4] instanceof String[]) - { - String[] var7 = ((String[])input[var4++]); + if (input[var4] instanceof String[]) { + String[] var7 = ((String[]) input[var4++]); String[] var8 = var7; var9 = var7.length; - for (int var10 = 0; var10 < var9; ++var10) - { + for (int var10 = 0; var10 < var9; ++var10) { String var11 = var8[var10]; ++var6; var5 = var11.length(); var3 = var3 + var11; } - } - else - { - while (input[var4] instanceof String) - { - String var13 = (String)input[var4++]; + } else { + while (input[var4] instanceof String) { + String var13 = (String) input[var4++]; ++var6; var5 = var13.length(); var3 = var3 + var13; @@ -85,22 +77,16 @@ private IAnvilRecipe addRecipe(ItemStack result, Skill skill, String research, b HashMap var14; - for (var14 = new HashMap(); var4 < input.length; var4 += 2) - { - Character var16 = (Character)input[var4]; + for (var14 = new HashMap(); var4 < input.length; var4 += 2) { + Character var16 = (Character) input[var4]; ItemStack var17 = null; - if (input[var4 + 1] instanceof Item) - { - var17 = new ItemStack((Item)input[var4 + 1], 1, 32767); - } - else if (input[var4 + 1] instanceof Block) - { - var17 = new ItemStack((Block)input[var4 + 1], 1, 32767); - } - else if (input[var4 + 1] instanceof ItemStack) - { - var17 = (ItemStack)input[var4 + 1]; + if (input[var4 + 1] instanceof Item) { + var17 = new ItemStack((Item) input[var4 + 1], 1, 32767); + } else if (input[var4 + 1] instanceof Block) { + var17 = new ItemStack((Block) input[var4 + 1], 1, 32767); + } else if (input[var4 + 1] instanceof ItemStack) { + var17 = (ItemStack) input[var4 + 1]; } var14.put(var16, var17); @@ -108,85 +94,70 @@ else if (input[var4 + 1] instanceof ItemStack) ItemStack[] var15 = new ItemStack[var5 * var6]; - for (var9 = 0; var9 < var5 * var6; ++var9) - { + for (var9 = 0; var9 < var5 * var6; ++var9) { char var18 = var3.charAt(var9); - if (var14.containsKey(Character.valueOf(var18))) - { - var15[var9] = ((ItemStack)var14.get(Character.valueOf(var18))).copy(); - } - else - { + if (var14.containsKey(Character.valueOf(var18))) { + var15[var9] = ((ItemStack) var14.get(Character.valueOf(var18))).copy(); + } else { var15[var9] = null; } } IAnvilRecipe recipe; - if(recipeType == (byte)1) - { - recipe = new CustomToolRecipe(var5, var6, var15, result, tool, time, hammer, anvil, exp, hot, research, skill); - } - else - { - recipe = new ShapedAnvilRecipes(var5, var6, var15, result, tool, time, hammer, anvil, exp, hot, research, skill); + if (recipeType == (byte) 1) { + recipe = new CustomToolRecipe(var5, var6, var15, result, tool, time, hammer, anvil, exp, hot, research, + skill); + } else { + recipe = new ShapedAnvilRecipes(var5, var6, var15, result, tool, time, hammer, anvil, exp, hot, research, + skill); } this.recipes.add(recipe); return recipe; } - public IAnvilRecipe addShapelessRecipe(ItemStack output, Skill skill, String research, boolean hot, float experience, String tool, int hammer, int anvil, int time, Object ... input) - { + public IAnvilRecipe addShapelessRecipe(ItemStack output, Skill skill, String research, boolean hot, + float experience, String tool, int hammer, int anvil, int time, Object... input) { ArrayList var3 = new ArrayList(); Object[] var4 = input; int var5 = input.length; - for (int var6 = 0; var6 < var5; ++var6) - { + for (int var6 = 0; var6 < var5; ++var6) { Object var7 = var4[var6]; - if (var7 instanceof ItemStack) - { - var3.add(((ItemStack)var7).copy()); - } - else if (var7 instanceof Item) - { - var3.add(new ItemStack((Item)var7)); - } - else - { - if (!(var7 instanceof Block)) - { + if (var7 instanceof ItemStack) { + var3.add(((ItemStack) var7).copy()); + } else if (var7 instanceof Item) { + var3.add(new ItemStack((Item) var7)); + } else { + if (!(var7 instanceof Block)) { throw new RuntimeException("MineFantasy: Invalid shapeless anvil recipe!"); } - var3.add(new ItemStack((Block)var7)); + var3.add(new ItemStack((Block) var7)); } } - IAnvilRecipe recipe = new ShapelessAnvilRecipes(output, tool, experience, hammer, anvil, time, var3, hot, research, skill); + IAnvilRecipe recipe = new ShapelessAnvilRecipes(output, tool, experience, hammer, anvil, time, var3, hot, + research, skill); this.recipes.add(recipe); return recipe; } - public ItemStack findMatchingRecipe(AnvilCraftMatrix matrix) - { + + public ItemStack findMatchingRecipe(AnvilCraftMatrix matrix) { int var2 = 0; ItemStack var3 = null; ItemStack var4 = null; - for (int var5 = 0; var5 < matrix.getSizeInventory(); ++var5) - { + for (int var5 = 0; var5 < matrix.getSizeInventory(); ++var5) { ItemStack var6 = matrix.getStackInSlot(var5); - if (var6 != null) - { - if (var2 == 0) - { + if (var6 != null) { + if (var2 == 0) { var3 = var6; } - if (var2 == 1) - { + if (var2 == 1) { var4 = var6; } @@ -194,80 +165,65 @@ public ItemStack findMatchingRecipe(AnvilCraftMatrix matrix) } } - if (var2 == 2 && canRepair(var3, var4)) - { + if (var2 == 2 && canRepair(var3, var4)) { Item var10 = var3.getItem(); int var12 = var10.getMaxDamage() - var3.getItemDamageForDisplay(); int var7 = var10.getMaxDamage() - var4.getItemDamageForDisplay(); int var8 = var12 + var7 + var10.getMaxDamage() * 10 / 100; - int var9 = var10.getMaxDamage() - (var8)*2; + int var9 = var10.getMaxDamage() - (var8) * 2; - if (var9 < 0) - { + if (var9 < 0) { var9 = 0; } return new ItemStack(var3.getItem(), 1, var9); - } - else - { + } else { Iterator var11 = this.recipes.iterator(); IAnvilRecipe var13; - do - { - if (!var11.hasNext()) - { + do { + if (!var11.hasNext()) { return null; } - var13 = (IAnvilRecipe)var11.next(); - } - while (!var13.matches(matrix)); + var13 = (IAnvilRecipe) var11.next(); + } while (!var13.matches(matrix)); return var13.getCraftingResult(matrix); } } - - - - private boolean canRepair(ItemStack item1, ItemStack item2) - { - if(item1.getItem() == item2.getItem() && item1.stackSize == 1 && item2.stackSize == 1 && item1.getItem().isRepairable()) - { - return true; - } - if(item1.getItem() == item2.getItem() && item1.stackSize == 1 && item2.stackSize == 1 && item1.isItemDamaged() && CustomToolHelper.areToolsSame(item1, item2)) - { - return true; - } - return false; - } - - public ItemStack findMatchingRecipe(IAnvil anvil, AnvilCraftMatrix matrix) - { - int time = 200; - int anvi = 1; - boolean hot = false; - int hammer = 0; + + private boolean canRepair(ItemStack item1, ItemStack item2) { + if (item1.getItem() == item2.getItem() && item1.stackSize == 1 && item2.stackSize == 1 + && item1.getItem().isRepairable()) { + return true; + } + if (item1.getItem() == item2.getItem() && item1.stackSize == 1 && item2.stackSize == 1 && item1.isItemDamaged() + && CustomToolHelper.areToolsSame(item1, item2)) { + return true; + } + return false; + } + + public ItemStack findMatchingRecipe(IAnvil anvil, AnvilCraftMatrix matrix) { + int time = 200; + int anvi = 1; + boolean hot = false; + int hammer = 0; int var2 = 0; String toolType = "hammer"; ItemStack var3 = null; ItemStack var4 = null; - for (int var5 = 0; var5 < matrix.getSizeInventory(); ++var5) - { + for (int var5 = 0; var5 < matrix.getSizeInventory(); ++var5) { ItemStack var6 = matrix.getStackInSlot(var5); - if (var6 != null) - { - if (var2 == 0) - { + if (var6 != null) { + if (var2 == 0) { var3 = var6; } - if (var2 == 1) - { + if (var2 == 1) { var4 = var6; } @@ -275,59 +231,51 @@ public ItemStack findMatchingRecipe(IAnvil anvil, AnvilCraftMatrix matrix) } } - if (var2 == 2 && var3.getItem() == var4.getItem() && var3.stackSize == 1 && var4.stackSize == 1 && var3.getItem().isRepairable()) - { + if (var2 == 2 && var3.getItem() == var4.getItem() && var3.stackSize == 1 && var4.stackSize == 1 + && var3.getItem().isRepairable()) { Item var10 = var3.getItem(); int var12 = var10.getMaxDamage() - var3.getItemDamageForDisplay(); int var7 = var10.getMaxDamage() - var4.getItemDamageForDisplay(); int var8 = var12 + var7 + var10.getMaxDamage() * 10 / 100; int var9 = var10.getMaxDamage() - var8; - if (var9 < 0) - { + if (var9 < 0) { var9 = 0; } return new ItemStack(var3.getItem(), 1, var9); - } - else - { + } else { Iterator var11 = this.recipes.iterator(); IAnvilRecipe var13 = null; - while(var11.hasNext()) - { - IAnvilRecipe rec = (IAnvilRecipe)var11.next(); - - if(rec.matches(matrix)) - { - var13 = rec; - } + while (var11.hasNext()) { + IAnvilRecipe rec = (IAnvilRecipe) var11.next(); + + if (rec.matches(matrix)) { + var13 = rec; + } } - if(var13 != null) - { - time = var13.getCraftTime(); - hammer = var13.getRecipeHammer(); - anvi = var13.getAnvil(); - hot = var13.outputHot(); - toolType = var13.getToolType(); - - if(!var13.useCustomTiers()) - { - anvil.setForgeTime(time); - anvil.setHammerUsed(hammer); - anvil.setRequiredAnvil(anvi); - } - anvil.setHotOutput(hot); - anvil.setToolType(toolType); - if(!var13.getResearch().equalsIgnoreCase("tier")) - { - anvil.setResearch(var13.getResearch()); - } - anvil.setSkill(var13.getSkill()); - - return var13.getCraftingResult(matrix); + if (var13 != null) { + time = var13.getCraftTime(); + hammer = var13.getRecipeHammer(); + anvi = var13.getAnvil(); + hot = var13.outputHot(); + toolType = var13.getToolType(); + + if (!var13.useCustomTiers()) { + anvil.setForgeTime(time); + anvil.setHammerUsed(hammer); + anvil.setRequiredAnvil(anvi); + } + anvil.setHotOutput(hot); + anvil.setToolType(toolType); + if (!var13.getResearch().equalsIgnoreCase("tier")) { + anvil.setResearch(var13.getResearch()); + } + anvil.setSkill(var13.getSkill()); + + return var13.getCraftingResult(matrix); } return null; } @@ -336,8 +284,7 @@ public ItemStack findMatchingRecipe(IAnvil anvil, AnvilCraftMatrix matrix) /** * returns the List<> of all recipes */ - public List getRecipeList() - { + public List getRecipeList() { return this.recipes; } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/anvil/CustomToolRecipe.java b/src/main/java/minefantasy/mf2/api/crafting/anvil/CustomToolRecipe.java index acf95dad..95990197 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/anvil/CustomToolRecipe.java +++ b/src/main/java/minefantasy/mf2/api/crafting/anvil/CustomToolRecipe.java @@ -1,183 +1,151 @@ package minefantasy.mf2.api.crafting.anvil; import minefantasy.mf2.api.heating.Heatable; -import minefantasy.mf2.api.heating.IHotItem; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.rpg.Skill; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.oredict.OreDictionary; /** - * * @author AnonymousProductions - * */ -public class CustomToolRecipe extends ShapedAnvilRecipes -{ - public CustomToolRecipe(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, int time, int hammer, int anvi, float exp, boolean hot, String research, Skill skill) - { - super(wdth, heit, inputs, output, toolType, time, hammer, anvi, exp, hot, research, skill); +public class CustomToolRecipe extends ShapedAnvilRecipes { + public CustomToolRecipe(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, int time, + int hammer, int anvi, float exp, boolean hot, String research, Skill skill) { + super(wdth, heit, inputs, output, toolType, time, hammer, anvi, exp, hot, research, skill); } /** * Checks if the region of a crafting inventory is match for the recipe. */ @Override - protected boolean checkMatch(AnvilCraftMatrix matrix, int x, int y, boolean b) - { - String wood = null; - String metal = null; - for (int var5 = 0; var5 < ShapelessAnvilRecipes.globalWidth; ++var5) - { - for (int var6 = 0; var6 < ShapelessAnvilRecipes.globalHeight; ++var6) - { + protected boolean checkMatch(AnvilCraftMatrix matrix, int x, int y, boolean b) { + String wood = null; + String metal = null; + for (int var5 = 0; var5 < ShapelessAnvilRecipes.globalWidth; ++var5) { + for (int var6 = 0; var6 < ShapelessAnvilRecipes.globalHeight; ++var6) { int var7 = var5 - x; int var8 = var6 - y; ItemStack recipeItem = null; - if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) - { - if (b) - { + if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) { + if (b) { recipeItem = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth]; - } - else - { + } else { recipeItem = this.recipeItems[var7 + var8 * this.recipeWidth]; } } ItemStack inputItem = matrix.getStackInRowAndColumn(var5, var6); - if (inputItem != null || recipeItem != null) - { - String component_wood = CustomToolHelper.getComponentMaterial(inputItem, "wood"); - String component_metal = CustomToolHelper.getComponentMaterial(inputItem, "metal"); - - if(component_metal != null)//CHECK CUSTOM METAL - { - if(metal == null) - { - metal = component_metal; - } - else - { - if(!metal.equalsIgnoreCase(component_metal)) - { - return false; - } - } - } - - if(component_wood != null)//CHECK CUSTOM WOOD - { - if(wood == null) - { - wood = component_wood; - } - else - { - if(!wood.equalsIgnoreCase(component_wood)) - { - return false; - } - } - } - //HEATING - if (Heatable.requiresHeating && Heatable.canHeatItem(inputItem)) - { - return false; - } - if(!Heatable.isWorkable(inputItem)) - { - return false; - } - inputItem = getHotItem(inputItem); - - if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) + if (inputItem != null || recipeItem != null) { + String component_wood = CustomToolHelper.getComponentMaterial(inputItem, "wood"); + String component_metal = CustomToolHelper.getComponentMaterial(inputItem, "metal"); + + if (component_metal != null)// CHECK CUSTOM METAL { - return false; + if (metal == null) { + metal = component_metal; + } else { + if (!metal.equalsIgnoreCase(component_metal)) { + return false; + } + } } - - if(inputItem == null) + + if (component_wood != null)// CHECK CUSTOM WOOD { - return false; + if (wood == null) { + wood = component_wood; + } else { + if (!wood.equalsIgnoreCase(component_wood)) { + return false; + } + } + } + // HEATING + if (Heatable.requiresHeating && Heatable.canHeatItem(inputItem)) { + return false; + } + if (!Heatable.isWorkable(inputItem)) { + return false; } + inputItem = getHotItem(inputItem); - if (recipeItem.getItem() != inputItem.getItem()) - { + if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) { return false; } - if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE && recipeItem.getItemDamage() != inputItem.getItemDamage()) - { + if (inputItem == null) { return false; } - if(!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) - { - return false; + + if (recipeItem.getItem() != inputItem.getItem()) { + return false; + } + + if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE + && recipeItem.getItemDamage() != inputItem.getItemDamage()) { + return false; + } + if (!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) { + return false; } } } } - if(!modifyTiers(matrix, metal, true)) - { - modifyTiers(matrix, wood, false); - } + if (!modifyTiers(matrix, metal, true)) { + modifyTiers(matrix, wood, false); + } return true; } - private boolean modifyTiers(AnvilCraftMatrix matrix, String tier, boolean isMain) - { - CustomMaterial material = CustomMaterial.getMaterial(tier); - if(material != null) - { - int newTier = recipeHammer <0 ? material.crafterTier : recipeHammer; - int newAnvil = anvil <0 ? material.crafterAnvilTier : anvil; - matrix.modifyTier(newTier, newAnvil, (int)(recipeTime * material.craftTimeModifier)); - if(isMain) - { - matrix.modifyResearch("smelt"+material.name); - } - return true; - } - return false; - } - - /** + private boolean modifyTiers(AnvilCraftMatrix matrix, String tier, boolean isMain) { + CustomMaterial material = CustomMaterial.getMaterial(tier); + if (material != null) { + int newTier = recipeHammer < 0 ? material.crafterTier : recipeHammer; + int newAnvil = anvil < 0 ? material.crafterAnvilTier : anvil; + matrix.modifyTier(newTier, newAnvil, (int) (recipeTime * material.craftTimeModifier)); + if (isMain) { + matrix.modifyResearch("smelt" + material.name); + } + return true; + } + return false; + } + + /** * Returns an Item that is the result of this recipe */ @Override - public ItemStack getCraftingResult(AnvilCraftMatrix matrix) - { + public ItemStack getCraftingResult(AnvilCraftMatrix matrix) { ItemStack result = super.getCraftingResult(matrix); - + String wood = null; String metal = null; - for(int i = 0; i < matrix.getSizeInventory(); i++) - { - ItemStack item = matrix.getStackInSlot(i); - String component_wood = CustomToolHelper.getComponentMaterial(item, "wood"); - String component_metal = CustomToolHelper.getComponentMaterial(item, "metal"); - if(wood == null && component_wood != null){wood = component_wood;} - if(metal == null && component_metal != null){metal = component_metal;} + for (int i = 0; i < matrix.getSizeInventory(); i++) { + ItemStack item = matrix.getStackInSlot(i); + String component_wood = CustomToolHelper.getComponentMaterial(item, "wood"); + String component_metal = CustomToolHelper.getComponentMaterial(item, "metal"); + if (wood == null && component_wood != null) { + wood = component_wood; + } + if (metal == null && component_metal != null) { + metal = component_metal; + } } - if(metal != null) - { - CustomMaterial.addMaterial(result, CustomToolHelper.slot_main, metal); + if (metal != null) { + CustomMaterial.addMaterial(result, CustomToolHelper.slot_main, metal); } - if(wood != null) - { - CustomMaterial.addMaterial(result, CustomToolHelper.slot_haft, wood); + if (wood != null) { + CustomMaterial.addMaterial(result, CustomToolHelper.slot_haft, wood); } return result; } - - @Override - public boolean useCustomTiers() - { - return true; - } + + @Override + public boolean useCustomTiers() { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/anvil/IAnvil.java b/src/main/java/minefantasy/mf2/api/crafting/anvil/IAnvil.java index 741f9a25..9375f55c 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/anvil/IAnvil.java +++ b/src/main/java/minefantasy/mf2/api/crafting/anvil/IAnvil.java @@ -3,20 +3,25 @@ import minefantasy.mf2.api.rpg.Skill; /** - * - * @author AnonymousProductions - * This interface is used by the anvil in MineFantasy so - * it can be referred to without importing the mod - * + * @author AnonymousProductions This interface is used by the anvil in + * MineFantasy so it can be referred to without importing the mod */ public interface IAnvil { - void setForgeTime(int i); - void setHammerUsed(int i); - void setRequiredAnvil(int i); - void setHotOutput(boolean i); - void setToolType(String toolType); - void setSkill(Skill skill); - public void setResearch(String research); - int getRecipeHammer(); - int getRecipeAnvil(); + void setForgeTime(int i); + + void setHammerUsed(int i); + + void setRequiredAnvil(int i); + + void setHotOutput(boolean i); + + void setToolType(String toolType); + + void setSkill(Skill skill); + + public void setResearch(String research); + + int getRecipeHammer(); + + int getRecipeAnvil(); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/anvil/IAnvilRecipe.java b/src/main/java/minefantasy/mf2/api/crafting/anvil/IAnvilRecipe.java index 90e8d024..47b8676b 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/anvil/IAnvilRecipe.java +++ b/src/main/java/minefantasy/mf2/api/crafting/anvil/IAnvilRecipe.java @@ -4,12 +4,9 @@ import net.minecraft.item.ItemStack; /** - * * @author AnonymousProductions - * */ -public interface IAnvilRecipe -{ +public interface IAnvilRecipe { /** * Used to check if a recipe matches current crafting inventory */ @@ -19,27 +16,29 @@ public interface IAnvilRecipe * Returns an Item that is the result of this recipe */ ItemStack getCraftingResult(AnvilCraftMatrix var1); + int getCraftTime(); + /** * Returns the size of the recipe area */ int getRecipeSize(); - + int getRecipeHammer(); - + float getExperiance(); - + int getAnvil(); - + boolean outputHot(); - + String getToolType(); - + String getResearch(); - + ItemStack getRecipeOutput(); - + Skill getSkill(); - + boolean useCustomTiers(); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/anvil/RecipeSorterAnvil.java b/src/main/java/minefantasy/mf2/api/crafting/anvil/RecipeSorterAnvil.java index ac0630eb..89feef90 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/anvil/RecipeSorterAnvil.java +++ b/src/main/java/minefantasy/mf2/api/crafting/anvil/RecipeSorterAnvil.java @@ -3,27 +3,24 @@ import java.util.Comparator; /** - * * @author AnonymousProductions - * */ -class RecipeSorterAnvil implements Comparator -{ +class RecipeSorterAnvil implements Comparator { final CraftingManagerAnvil craftingManager; - RecipeSorterAnvil(CraftingManagerAnvil manager) - { + RecipeSorterAnvil(CraftingManagerAnvil manager) { this.craftingManager = manager; } - public int compareRecipes(IAnvilRecipe recipe1, IAnvilRecipe recipe2) - { - return recipe1 instanceof ShapelessAnvilRecipes && recipe2 instanceof ShapedAnvilRecipes ? 1 : (recipe2 instanceof ShapelessAnvilRecipes && recipe1 instanceof ShapedAnvilRecipes ? -1 : (recipe2.getRecipeSize() < recipe1.getRecipeSize() ? -1 : (recipe2.getRecipeSize() > recipe1.getRecipeSize() ? 1 : 0))); + public int compareRecipes(IAnvilRecipe recipe1, IAnvilRecipe recipe2) { + return recipe1 instanceof ShapelessAnvilRecipes && recipe2 instanceof ShapedAnvilRecipes ? 1 + : (recipe2 instanceof ShapelessAnvilRecipes && recipe1 instanceof ShapedAnvilRecipes ? -1 + : (recipe2.getRecipeSize() < recipe1.getRecipeSize() ? -1 + : (recipe2.getRecipeSize() > recipe1.getRecipeSize() ? 1 : 0))); } @Override - public int compare(Object input1, Object input2) - { - return this.compareRecipes((IAnvilRecipe)input1, (IAnvilRecipe)input2); + public int compare(Object input1, Object input2) { + return this.compareRecipes((IAnvilRecipe) input1, (IAnvilRecipe) input2); } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/anvil/ShapedAnvilRecipes.java b/src/main/java/minefantasy/mf2/api/crafting/anvil/ShapedAnvilRecipes.java index faf73f2a..6a653bf8 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/anvil/ShapedAnvilRecipes.java +++ b/src/main/java/minefantasy/mf2/api/crafting/anvil/ShapedAnvilRecipes.java @@ -9,39 +9,40 @@ import net.minecraftforge.oredict.OreDictionary; /** - * * @author AnonymousProductions - * */ -public class ShapedAnvilRecipes implements IAnvilRecipe -{ - /** How many horizontal slots this recipe is wide. */ - public int recipeWidth; - - public final int recipeHammer; - - public final boolean outputHot; - /** How many vertical slots this recipe uses. */ - public int recipeHeight; - - /** The Anvil needed to craft */ - public final int anvil; - - /** Is a array of ItemStack that composes the recipe. */ - public ItemStack[] recipeItems; - - /** Is the ItemStack that you get when craft the recipe. */ - public ItemStack recipeOutput; - - public final int recipeTime; - public final float recipeExperiance; - public final String toolType; - public final String research; - public final Skill skillUsed; - - public ShapedAnvilRecipes(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, int time, int hammer, int anvi, float exp, boolean hot, String research, Skill skill) - { - this.outputHot = hot; +public class ShapedAnvilRecipes implements IAnvilRecipe { + public final int recipeHammer; + public final boolean outputHot; + /** + * The Anvil needed to craft + */ + public final int anvil; + public final int recipeTime; + public final float recipeExperiance; + public final String toolType; + public final String research; + public final Skill skillUsed; + /** + * How many horizontal slots this recipe is wide. + */ + public int recipeWidth; + /** + * How many vertical slots this recipe uses. + */ + public int recipeHeight; + /** + * Is a array of ItemStack that composes the recipe. + */ + public ItemStack[] recipeItems; + /** + * Is the ItemStack that you get when craft the recipe. + */ + public ItemStack recipeOutput; + + public ShapedAnvilRecipes(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, int time, + int hammer, int anvi, float exp, boolean hot, String research, Skill skill) { + this.outputHot = hot; this.recipeWidth = wdth; this.anvil = anvi; this.recipeHeight = heit; @@ -55,44 +56,40 @@ public ShapedAnvilRecipes(int wdth, int heit, ItemStack[] inputs, ItemStack outp this.skillUsed = skill; } + private static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) + item.setTagCompound(new NBTTagCompound()); + return item.getTagCompound(); + } + @Override - public ItemStack getRecipeOutput() - { + public ItemStack getRecipeOutput() { return this.recipeOutput; } + @Override - public int getCraftTime() - { - return recipeTime; + public int getCraftTime() { + return recipeTime; } + @Override - public float getExperiance() - { - return this.recipeExperiance; + public float getExperiance() { + return this.recipeExperiance; } + @Override - public int getRecipeHammer() - { - return recipeHammer; + public int getRecipeHammer() { + return recipeHammer; } /** * Used to check if a recipe matches current crafting inventory */ @Override - public boolean matches(AnvilCraftMatrix matrix) - { - for (int var2 = 0; var2 <= ShapelessAnvilRecipes.globalWidth - this.recipeWidth; ++var2) - { - for (int var3 = 0; var3 <= ShapelessAnvilRecipes.globalHeight - this.recipeHeight; ++var3) - { - if (this.checkMatch(matrix, var2, var3, true)) - { - return true; - } - - if (this.checkMatch(matrix, var2, var3, false)) - { + public boolean matches(AnvilCraftMatrix matrix) { + for (int x = 0; x <= ShapelessAnvilRecipes.globalWidth - this.recipeWidth; ++x) { + for (int y = 0; y <= ShapelessAnvilRecipes.globalHeight - this.recipeHeight; ++y) { + if (this.checkMatch(matrix, x, y, true) || this.checkMatch(matrix, x, y, false)) { return true; } } @@ -104,65 +101,51 @@ public boolean matches(AnvilCraftMatrix matrix) /** * Checks if the region of a crafting inventory is match for the recipe. */ - protected boolean checkMatch(AnvilCraftMatrix matrix, int x, int y, boolean b) - { - for (int var5 = 0; var5 < ShapelessAnvilRecipes.globalWidth; ++var5) - { - for (int var6 = 0; var6 < ShapelessAnvilRecipes.globalHeight; ++var6) - { - int var7 = var5 - x; - int var8 = var6 - y; + protected boolean checkMatch(AnvilCraftMatrix matrix, int x, int y, boolean b) { + for (int matrixX = 0; matrixX < ShapelessAnvilRecipes.globalWidth; ++matrixX) { + for (int matrixY = 0; matrixY < ShapelessAnvilRecipes.globalHeight; ++matrixY) { + int recipeX = matrixX - x; + int recipeY = matrixY - y; ItemStack recipeItem = null; - if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) - { - if (b) - { - recipeItem = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth]; - } - else - { - recipeItem = this.recipeItems[var7 + var8 * this.recipeWidth]; + if (recipeX >= 0 && recipeY >= 0 && recipeX < this.recipeWidth && recipeY < this.recipeHeight) { + if (b) { + recipeItem = this.recipeItems[this.recipeWidth - recipeX - 1 + recipeY * this.recipeWidth]; + } else { + recipeItem = this.recipeItems[recipeX + recipeY * this.recipeWidth]; } } - ItemStack inputItem = matrix.getStackInRowAndColumn(var5, var6); - - if (inputItem != null || recipeItem != null) - { - //HEATING - if (Heatable.requiresHeating && Heatable.canHeatItem(inputItem)) - { - return false; - } - if(!Heatable.isWorkable(inputItem)) - { - return false; - } - inputItem = getHotItem(inputItem); - - if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) - { + ItemStack inputItem = matrix.getStackInRowAndColumn(matrixX, matrixY); + + if (inputItem != null || recipeItem != null) { + // HEATING + if (Heatable.requiresHeating && Heatable.canHeatItem(inputItem)) { return false; } - - if(inputItem == null) - { - return false; + if (!Heatable.isWorkable(inputItem)) { + return false; } + inputItem = getHotItem(inputItem); - if (recipeItem.getItem() != inputItem.getItem()) - { + if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) { return false; } - if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE && recipeItem.getItemDamage() != inputItem.getItemDamage()) - { + if (inputItem == null) { return false; } - if(!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) - { - return false; + + if (recipeItem.getItem() != inputItem.getItem()) { + return false; + } + + if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE + && recipeItem.getItemDamage() != inputItem.getItemDamage()) { + return false; + } + if (!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) { + return false; } } } @@ -171,36 +154,27 @@ protected boolean checkMatch(AnvilCraftMatrix matrix, int x, int y, boolean b) return true; } - protected ItemStack getHotItem(ItemStack item) - { - if(item == null)return null; - if(!(item.getItem() instanceof IHotItem)) - { - return item; - } - - ItemStack hotItem = Heatable.getItem(item); - - if (hotItem != null) - { - return hotItem; - } - - return item; - } - - private static NBTTagCompound getNBT(ItemStack item) { - if (!item.hasTagCompound()) - item.setTagCompound(new NBTTagCompound()); - return item.getTagCompound(); - } - - /** + protected ItemStack getHotItem(ItemStack item) { + if (item == null) + return null; + if (!(item.getItem() instanceof IHotItem)) { + return item; + } + + ItemStack hotItem = Heatable.getItem(item); + + if (hotItem != null) { + return hotItem; + } + + return item; + } + + /** * Returns an Item that is the result of this recipe */ @Override - public ItemStack getCraftingResult(AnvilCraftMatrix matrix) - { + public ItemStack getCraftingResult(AnvilCraftMatrix matrix) { return recipeOutput.copy(); } @@ -208,42 +182,37 @@ public ItemStack getCraftingResult(AnvilCraftMatrix matrix) * Returns the size of the recipe area */ @Override - public int getRecipeSize() - { + public int getRecipeSize() { return this.recipeWidth * this.recipeHeight; } - @Override - public int getAnvil() { - return anvil; - } - - @Override - public boolean outputHot() { - return this.outputHot; - } - - @Override - public String getToolType() - { - return toolType; - } - - @Override - public String getResearch() - { - return research; - } - - @Override - public Skill getSkill() - { - return skillUsed; - } - - @Override - public boolean useCustomTiers() - { - return false; - } + @Override + public int getAnvil() { + return anvil; + } + + @Override + public boolean outputHot() { + return this.outputHot; + } + + @Override + public String getToolType() { + return toolType; + } + + @Override + public String getResearch() { + return research; + } + + @Override + public Skill getSkill() { + return skillUsed; + } + + @Override + public boolean useCustomTiers() { + return false; + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/anvil/ShapelessAnvilRecipes.java b/src/main/java/minefantasy/mf2/api/crafting/anvil/ShapelessAnvilRecipes.java index b029a00e..8cf8ef3d 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/anvil/ShapelessAnvilRecipes.java +++ b/src/main/java/minefantasy/mf2/api/crafting/anvil/ShapelessAnvilRecipes.java @@ -1,9 +1,5 @@ package minefantasy.mf2.api.crafting.anvil; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import minefantasy.mf2.api.heating.Heatable; import minefantasy.mf2.api.heating.IHotItem; import minefantasy.mf2.api.helpers.CustomToolHelper; @@ -12,37 +8,41 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.oredict.OreDictionary; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** - * * @author AnonymousProductions - * */ -public class ShapelessAnvilRecipes implements IAnvilRecipe -{ - public static final int globalWidth = 6; - public static final int globalHeight = 4; +public class ShapelessAnvilRecipes implements IAnvilRecipe { + public static final int globalWidth = 6; + public static final int globalHeight = 4; - /** Is the ItemStack that you get when craft the recipe. */ + /** + * Is the ItemStack that you get when craft the recipe. + */ public final ItemStack recipeOutput; public final boolean outputHot; - /** Is a List of ItemStack that composes the recipe. */ + /** + * Is a List of ItemStack that composes the recipe. + */ public final List recipeItems; - - private final int recipeHammer; - - /** The anvil Required */ + /** + * The anvil Required + */ public final int anvil; - public final int recipeTime; public final float recipeExperiance; public final String toolType; public final String research; public final Skill skillUsed; + private final int recipeHammer; - public ShapelessAnvilRecipes(ItemStack output, String toolType, float exp, int hammer, int anvi, int time, List components, boolean hot, String research, Skill skill) - { - this.outputHot = hot; + public ShapelessAnvilRecipes(ItemStack output, String toolType, float exp, int hammer, int anvi, int time, + List components, boolean hot, String research, Skill skill) { + this.outputHot = hot; this.recipeOutput = output; this.anvil = anvi; this.recipeItems = components; @@ -54,9 +54,14 @@ public ShapelessAnvilRecipes(ItemStack output, String toolType, float exp, int h this.skillUsed = skill; } + private static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) + item.setTagCompound(new NBTTagCompound()); + return item.getTagCompound(); + } + @Override - public ItemStack getRecipeOutput() - { + public ItemStack getRecipeOutput() { return this.recipeOutput; } @@ -64,54 +69,45 @@ public ItemStack getRecipeOutput() * Used to check if a recipe matches current crafting inventory */ @Override - public boolean matches(AnvilCraftMatrix matrix) - { + public boolean matches(AnvilCraftMatrix matrix) { ArrayList var2 = new ArrayList(this.recipeItems); - for (int var3 = 0; var3 <= globalWidth; ++var3) - { - for (int var4 = 0; var4 <= globalHeight; ++var4) - { + for (int var3 = 0; var3 <= globalWidth; ++var3) { + for (int var4 = 0; var4 <= globalHeight; ++var4) { ItemStack inputItem = matrix.getStackInRowAndColumn(var4, var3); - if (inputItem != null) - { + if (inputItem != null) { boolean var6 = false; Iterator var7 = var2.iterator(); - while (var7.hasNext()) - { - ItemStack recipeItem = (ItemStack)var7.next(); - - //HEATING - if (Heatable.requiresHeating && Heatable.canHeatItem(inputItem)) - { - return false; - } - if(!Heatable.isWorkable(inputItem)) - { - return false; - } - inputItem = getHotItem(inputItem); - - if(inputItem == null) - { - return false; + while (var7.hasNext()) { + ItemStack recipeItem = (ItemStack) var7.next(); + + // HEATING + if (Heatable.requiresHeating && Heatable.canHeatItem(inputItem)) { + return false; + } + if (!Heatable.isWorkable(inputItem)) { + return false; + } + inputItem = getHotItem(inputItem); + + if (inputItem == null) { + return false; } - if(!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) - { - return false; + if (!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) { + return false; } - if (inputItem.getItem() == recipeItem.getItem() && (recipeItem.getItemDamage() == OreDictionary.WILDCARD_VALUE || inputItem.getItemDamage() == recipeItem.getItemDamage())) - { + if (inputItem.getItem() == recipeItem.getItem() + && (recipeItem.getItemDamage() == OreDictionary.WILDCARD_VALUE + || inputItem.getItemDamage() == recipeItem.getItemDamage())) { var6 = true; var2.remove(recipeItem); break; } } - if (!var6) - { + if (!var6) { return false; } } @@ -120,36 +116,28 @@ public boolean matches(AnvilCraftMatrix matrix) return var2.isEmpty(); } - - protected ItemStack getHotItem(ItemStack item) - { - if(item == null)return null; - if(!(item.getItem() instanceof IHotItem)) - { - return item; - } - - ItemStack hotItem = Heatable.getItem(item); - - if (hotItem != null) - { - return hotItem; - } - - return item; - } - - private static NBTTagCompound getNBT(ItemStack item) { - if (!item.hasTagCompound()) - item.setTagCompound(new NBTTagCompound()); - return item.getTagCompound(); - } + + protected ItemStack getHotItem(ItemStack item) { + if (item == null) + return null; + if (!(item.getItem() instanceof IHotItem)) { + return item; + } + + ItemStack hotItem = Heatable.getItem(item); + + if (hotItem != null) { + return hotItem; + } + + return item; + } + /** * Returns an Item that is the result of this recipe */ @Override - public ItemStack getCraftingResult(AnvilCraftMatrix par1AnvilCraftMatrix) - { + public ItemStack getCraftingResult(AnvilCraftMatrix par1AnvilCraftMatrix) { return this.recipeOutput.copy(); } @@ -157,57 +145,52 @@ public ItemStack getCraftingResult(AnvilCraftMatrix par1AnvilCraftMatrix) * Returns the size of the recipe area */ @Override - public int getRecipeSize() - { + public int getRecipeSize() { return this.recipeItems.size(); } - @Override - public int getCraftTime() { - return this.recipeTime; - } - - @Override - public int getRecipeHammer() { - return this.recipeHammer; - } - - @Override - public float getExperiance() { - return this.recipeExperiance; - } - - @Override - public int getAnvil() { - return this.anvil; - } - - @Override - public boolean outputHot() { - return outputHot; - } - - @Override - public String getToolType() - { - return toolType; - } - - @Override - public String getResearch() - { - return research; - } - - @Override - public Skill getSkill() - { - return skillUsed; - } - - @Override - public boolean useCustomTiers() - { - return false; - } + @Override + public int getCraftTime() { + return this.recipeTime; + } + + @Override + public int getRecipeHammer() { + return this.recipeHammer; + } + + @Override + public float getExperiance() { + return this.recipeExperiance; + } + + @Override + public int getAnvil() { + return this.anvil; + } + + @Override + public boolean outputHot() { + return outputHot; + } + + @Override + public String getToolType() { + return toolType; + } + + @Override + public String getResearch() { + return research; + } + + @Override + public Skill getSkill() { + return skillUsed; + } + + @Override + public boolean useCustomTiers() { + return false; + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/carpenter/CarpenterCraftMatrix.java b/src/main/java/minefantasy/mf2/api/crafting/carpenter/CarpenterCraftMatrix.java index c7b3373c..b3ae7f03 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/carpenter/CarpenterCraftMatrix.java +++ b/src/main/java/minefantasy/mf2/api/crafting/carpenter/CarpenterCraftMatrix.java @@ -1,22 +1,19 @@ package minefantasy.mf2.api.crafting.carpenter; -import minefantasy.mf2.api.crafting.anvil.IAnvil; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCrafting; -public class CarpenterCraftMatrix extends InventoryCrafting -{ - private ICarpenter crafter; - public CarpenterCraftMatrix(ICarpenter crafter, Container instance, int xSize, int ySize) - { - super(instance, xSize, ySize); - this.crafter = crafter; - } - - public void modifyTier(int hammerTier, int craftTime) - { - crafter.setToolTier(hammerTier); - crafter.setForgeTime(craftTime); - } +public class CarpenterCraftMatrix extends InventoryCrafting { + private ICarpenter crafter; + + public CarpenterCraftMatrix(ICarpenter crafter, Container instance, int xSize, int ySize) { + super(instance, xSize, ySize); + this.crafter = crafter; + } + + public void modifyTier(int hammerTier, int craftTime) { + crafter.setToolTier(hammerTier); + crafter.setForgeTime(craftTime); + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/carpenter/CraftingManagerCarpenter.java b/src/main/java/minefantasy/mf2/api/crafting/carpenter/CraftingManagerCarpenter.java index 6543cdce..8365d1a3 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/carpenter/CraftingManagerCarpenter.java +++ b/src/main/java/minefantasy/mf2/api/crafting/carpenter/CraftingManagerCarpenter.java @@ -1,84 +1,76 @@ package minefantasy.mf2.api.crafting.carpenter; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - import minefantasy.mf2.api.rpg.Skill; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import java.util.*; + /** - * * @author AnonymousProductions - * */ -public class CraftingManagerCarpenter -{ - /** The static instance of this class */ +public class CraftingManagerCarpenter { + /** + * The static instance of this class + */ private static final CraftingManagerCarpenter instance = new CraftingManagerCarpenter(); - /** A list of all the recipes added */ + /** + * A list of all the recipes added + */ public List recipes = new ArrayList(); + private CraftingManagerCarpenter() { + Collections.sort(this.recipes, new RecipeSorterCarpenter(this)); + System.out.println("MineFantasy: Anvil recipes initiating"); + } + /** * Returns the static instance of this class */ - public static CraftingManagerCarpenter getInstance() - { + public static CraftingManagerCarpenter getInstance() { return instance; } - private CraftingManagerCarpenter() - { - Collections.sort(this.recipes, new RecipeSorterCarpenter(this)); - System.out.println("MineFantasy: Anvil recipes initiating"); - } - /** * Adds a recipe. See spreadsheet on first page for details. */ - public ICarpenterRecipe addRecipe(ItemStack result, Skill skill, String research, String sound, float exp, String tool, int hammer, int anvil, int time, Object ... input) - { - return addRecipe(result, skill, research, sound, exp, tool, hammer, anvil, time, (byte)0, input); + public ICarpenterRecipe addRecipe(ItemStack result, Skill skill, String research, String sound, float exp, + String tool, int hammer, int anvil, int time, Object... input) { + return addRecipe(result, skill, research, sound, exp, tool, hammer, anvil, time, (byte) 0, input); } - public ICarpenterRecipe addToolRecipe(ItemStack result, Skill skill, String research, String sound, float exp, String tool, int hammer, int anvil, int time, Object ... input) - { - return addRecipe(result, skill, research, sound, exp, tool, hammer, anvil, time, (byte)1, input); + + public ICarpenterRecipe addToolRecipe(ItemStack result, Skill skill, String research, String sound, float exp, + String tool, int hammer, int anvil, int time, Object... input) { + return addRecipe(result, skill, research, sound, exp, tool, hammer, anvil, time, (byte) 1, input); } + /** * Adds a recipe. See spreadsheet on first page for details. */ - public ICarpenterRecipe addRecipe(ItemStack result, Skill skill, String research, String sound, float exp, String tool, int hammer, int anvil, int time, byte id, Object ... input) - { + public ICarpenterRecipe addRecipe(ItemStack result, Skill skill, String research, String sound, float exp, + String tool, int hammer, int anvil, int time, byte id, Object... input) { String var3 = ""; int var4 = 0; int var5 = 0; int var6 = 0; int var9; - if (input[var4] instanceof String[]) - { - String[] var7 = ((String[])input[var4++]); + if (input[var4] instanceof String[]) { + String[] var7 = ((String[]) input[var4++]); String[] var8 = var7; var9 = var7.length; - for (int var10 = 0; var10 < var9; ++var10) - { + for (int var10 = 0; var10 < var9; ++var10) { String var11 = var8[var10]; ++var6; var5 = var11.length(); var3 = var3 + var11; } - } - else - { - while (input[var4] instanceof String) - { - String var13 = (String)input[var4++]; + } else { + while (input[var4] instanceof String) { + String var13 = (String) input[var4++]; ++var6; var5 = var13.length(); var3 = var3 + var13; @@ -87,22 +79,16 @@ public ICarpenterRecipe addRecipe(ItemStack result, Skill skill, String research HashMap var14; - for (var14 = new HashMap(); var4 < input.length; var4 += 2) - { - Character var16 = (Character)input[var4]; + for (var14 = new HashMap(); var4 < input.length; var4 += 2) { + Character var16 = (Character) input[var4]; ItemStack var17 = null; - if (input[var4 + 1] instanceof Item) - { - var17 = new ItemStack((Item)input[var4 + 1], 1, 32767); - } - else if (input[var4 + 1] instanceof Block) - { - var17 = new ItemStack((Block)input[var4 + 1], 1, 32767); - } - else if (input[var4 + 1] instanceof ItemStack) - { - var17 = (ItemStack)input[var4 + 1]; + if (input[var4 + 1] instanceof Item) { + var17 = new ItemStack((Item) input[var4 + 1], 1, 32767); + } else if (input[var4 + 1] instanceof Block) { + var17 = new ItemStack((Block) input[var4 + 1], 1, 32767); + } else if (input[var4 + 1] instanceof ItemStack) { + var17 = (ItemStack) input[var4 + 1]; } var14.put(var16, var17); @@ -110,85 +96,70 @@ else if (input[var4 + 1] instanceof ItemStack) ItemStack[] var15 = new ItemStack[var5 * var6]; - for (var9 = 0; var9 < var5 * var6; ++var9) - { + for (var9 = 0; var9 < var5 * var6; ++var9) { char var18 = var3.charAt(var9); - if (var14.containsKey(Character.valueOf(var18))) - { - var15[var9] = ((ItemStack)var14.get(Character.valueOf(var18))).copy(); - } - else - { + if (var14.containsKey(Character.valueOf(var18))) { + var15[var9] = ((ItemStack) var14.get(Character.valueOf(var18))).copy(); + } else { var15[var9] = null; } } ICarpenterRecipe recipe; - - if(id == (byte)1) - { - recipe = new CustomToolRecipeCarpenter(var5, var6, var15, result, tool, time, hammer, anvil, exp, false, sound, research, skill); - } - else - { - recipe = new ShapedCarpenterRecipes(var5, var6, var15, result, tool, time, hammer, anvil, exp, false, sound, research, skill); + + if (id == (byte) 1) { + recipe = new CustomToolRecipeCarpenter(var5, var6, var15, result, tool, time, hammer, anvil, exp, false, + sound, research, skill); + } else { + recipe = new ShapedCarpenterRecipes(var5, var6, var15, result, tool, time, hammer, anvil, exp, false, sound, + research, skill); } this.recipes.add(recipe); return recipe; } - public ICarpenterRecipe addShapelessRecipe(ItemStack output, Skill skill, String research, String sound, float experience, String tool, int hammer, int anvil, int time, Object ... input) - { + public ICarpenterRecipe addShapelessRecipe(ItemStack output, Skill skill, String research, String sound, + float experience, String tool, int hammer, int anvil, int time, Object... input) { ArrayList var3 = new ArrayList(); Object[] var4 = input; int var5 = input.length; - for (int var6 = 0; var6 < var5; ++var6) - { + for (int var6 = 0; var6 < var5; ++var6) { Object var7 = var4[var6]; - if (var7 instanceof ItemStack) - { - var3.add(((ItemStack)var7).copy()); - } - else if (var7 instanceof Item) - { - var3.add(new ItemStack((Item)var7)); - } - else - { - if (!(var7 instanceof Block)) - { + if (var7 instanceof ItemStack) { + var3.add(((ItemStack) var7).copy()); + } else if (var7 instanceof Item) { + var3.add(new ItemStack((Item) var7)); + } else { + if (!(var7 instanceof Block)) { throw new RuntimeException("MineFantasy: Invalid shapeless anvil recipe!"); } - var3.add(new ItemStack((Block)var7)); + var3.add(new ItemStack((Block) var7)); } } - ICarpenterRecipe recipe = new ShapelessCarpenterRecipes(output, tool, experience, hammer, anvil, time, var3, false, sound, research, skill); + ICarpenterRecipe recipe = new ShapelessCarpenterRecipes(output, tool, experience, hammer, anvil, time, var3, + false, sound, research, skill); this.recipes.add(recipe); return recipe; } - public ItemStack findMatchingRecipe(CarpenterCraftMatrix matrix) - { + + public ItemStack findMatchingRecipe(CarpenterCraftMatrix matrix) { int var2 = 0; ItemStack var3 = null; ItemStack var4 = null; - for (int var5 = 0; var5 < matrix.getSizeInventory(); ++var5) - { + for (int var5 = 0; var5 < matrix.getSizeInventory(); ++var5) { ItemStack var6 = matrix.getStackInSlot(var5); - if (var6 != null) - { - if (var2 == 0) - { + if (var6 != null) { + if (var2 == 0) { var3 = var6; } - if (var2 == 1) - { + if (var2 == 1) { var4 = var6; } @@ -196,68 +167,55 @@ public ItemStack findMatchingRecipe(CarpenterCraftMatrix matrix) } } - if (var2 == 2 && var3.getItem() == var4.getItem() && var3.stackSize == 1 && var4.stackSize == 1 && var3.getItem().isRepairable()) - { + if (var2 == 2 && var3.getItem() == var4.getItem() && var3.stackSize == 1 && var4.stackSize == 1 + && var3.getItem().isRepairable()) { Item var10 = var3.getItem(); int var12 = var10.getMaxDamage() - var3.getItemDamageForDisplay(); int var7 = var10.getMaxDamage() - var4.getItemDamageForDisplay(); int var8 = var12 + var7 + var10.getMaxDamage() * 10 / 100; - int var9 = var10.getMaxDamage() - (var8)*2; + int var9 = var10.getMaxDamage() - (var8) * 2; - if (var9 < 0) - { + if (var9 < 0) { var9 = 0; } return new ItemStack(var3.getItem(), 1, var9); - } - else - { + } else { Iterator var11 = this.recipes.iterator(); ICarpenterRecipe var13; - do - { - if (!var11.hasNext()) - { + do { + if (!var11.hasNext()) { return null; } - var13 = (ICarpenterRecipe)var11.next(); - } - while (!var13.matches(matrix)); + var13 = (ICarpenterRecipe) var11.next(); + } while (!var13.matches(matrix)); return var13.getCraftingResult(matrix); } } - - - - public ItemStack findMatchingRecipe(ICarpenter bench, CarpenterCraftMatrix matrix) - { - int time = 200; - int anvi = 1; - boolean hot = false; - int hammer = 0; + + public ItemStack findMatchingRecipe(ICarpenter bench, CarpenterCraftMatrix matrix) { + int time = 200; + int anvi = 1; + boolean hot = false; + int hammer = 0; int var2 = 0; String toolType = "hands"; String sound = "basic"; ItemStack var3 = null; ItemStack var4 = null; - for (int var5 = 0; var5 < matrix.getSizeInventory(); ++var5) - { + for (int var5 = 0; var5 < matrix.getSizeInventory(); ++var5) { ItemStack var6 = matrix.getStackInSlot(var5); - if (var6 != null) - { - if (var2 == 0) - { + if (var6 != null) { + if (var2 == 0) { var3 = var6; } - if (var2 == 1) - { + if (var2 == 1) { var4 = var6; } @@ -265,55 +223,49 @@ public ItemStack findMatchingRecipe(ICarpenter bench, CarpenterCraftMatrix matri } } - if (var2 == 2 && var3.getItem() == var4.getItem() && var3.stackSize == 1 && var4.stackSize == 1 && var3.getItem().isRepairable()) - { + if (var2 == 2 && var3.getItem() == var4.getItem() && var3.stackSize == 1 && var4.stackSize == 1 + && var3.getItem().isRepairable()) { Item var10 = var3.getItem(); int var12 = var10.getMaxDamage() - var3.getItemDamageForDisplay(); int var7 = var10.getMaxDamage() - var4.getItemDamageForDisplay(); int var8 = var12 + var7 + var10.getMaxDamage() * 10 / 100; int var9 = var10.getMaxDamage() - var8; - if (var9 < 0) - { + if (var9 < 0) { var9 = 0; } return new ItemStack(var3.getItem(), 1, var9); - } - else - { + } else { Iterator var11 = this.recipes.iterator(); ICarpenterRecipe var13 = null; - while(var11.hasNext()) - { - ICarpenterRecipe rec = (ICarpenterRecipe)var11.next(); - - if(rec.matches(matrix)) - { - var13 = rec; - } + while (var11.hasNext()) { + ICarpenterRecipe rec = (ICarpenterRecipe) var11.next(); + + if (rec.matches(matrix)) { + var13 = rec; + } } - if(var13 != null) - { - time = var13.getCraftTime(); - hammer = var13.getRecipeHammer(); - anvi = var13.getAnvil(); - hot = var13.outputHot(); - toolType = var13.getToolType(); - sound = var13.getSound(); - - bench.setForgeTime(time); - bench.setToolTier(hammer); - bench.setRequiredCarpenter(anvi); - bench.setHotOutput(hot); - bench.setToolType(toolType); - bench.setCraftingSound(sound); - bench.setResearch(var13.getResearch()); - bench.setSkill(var13.getSkill()); - - return var13.getCraftingResult(matrix); + if (var13 != null) { + time = var13.getCraftTime(); + hammer = var13.getRecipeHammer(); + anvi = var13.getAnvil(); + hot = var13.outputHot(); + toolType = var13.getToolType(); + sound = var13.getSound(); + + bench.setForgeTime(time); + bench.setToolTier(hammer); + bench.setRequiredCarpenter(anvi); + bench.setHotOutput(hot); + bench.setToolType(toolType); + bench.setCraftingSound(sound); + bench.setResearch(var13.getResearch()); + bench.setSkill(var13.getSkill()); + + return var13.getCraftingResult(matrix); } return null; } @@ -322,8 +274,7 @@ public ItemStack findMatchingRecipe(ICarpenter bench, CarpenterCraftMatrix matri /** * returns the List<> of all recipes */ - public List getRecipeList() - { + public List getRecipeList() { return this.recipes; } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/carpenter/CustomToolRecipeCarpenter.java b/src/main/java/minefantasy/mf2/api/crafting/carpenter/CustomToolRecipeCarpenter.java index d5bc3983..a537a53a 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/carpenter/CustomToolRecipeCarpenter.java +++ b/src/main/java/minefantasy/mf2/api/crafting/carpenter/CustomToolRecipeCarpenter.java @@ -7,145 +7,120 @@ import net.minecraftforge.oredict.OreDictionary; /** - * * @author AnonymousProductions - * */ -public class CustomToolRecipeCarpenter extends ShapedCarpenterRecipes -{ - public CustomToolRecipeCarpenter(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, int time, int toolTier, int blockTier, float exp, boolean hot, String sound, String research, Skill skill) - { - super(wdth, heit, inputs, output, toolType, time, toolTier, blockTier, exp, hot, sound, research, skill); +public class CustomToolRecipeCarpenter extends ShapedCarpenterRecipes { + public CustomToolRecipeCarpenter(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, + int time, int toolTier, int blockTier, float exp, boolean hot, String sound, String research, Skill skill) { + super(wdth, heit, inputs, output, toolType, time, toolTier, blockTier, exp, hot, sound, research, skill); } - private boolean checkMatch(CarpenterCraftMatrix matrix, int x, int y, boolean b) - { - String wood = null; - String metal = null; - for (int var5 = 0; var5 < ShapelessCarpenterRecipes.globalWidth; ++var5) - { - for (int var6 = 0; var6 < ShapelessCarpenterRecipes.globalHeight; ++var6) - { + private boolean checkMatch(CarpenterCraftMatrix matrix, int x, int y, boolean b) { + String wood = null; + String metal = null; + for (int var5 = 0; var5 < ShapelessCarpenterRecipes.globalWidth; ++var5) { + for (int var6 = 0; var6 < ShapelessCarpenterRecipes.globalHeight; ++var6) { int var7 = var5 - x; int var8 = var6 - y; ItemStack recipeItem = null; - if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) - { - if (b) - { + if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) { + if (b) { recipeItem = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth]; - } - else - { + } else { recipeItem = this.recipeItems[var7 + var8 * this.recipeWidth]; } } ItemStack inputItem = matrix.getStackInRowAndColumn(var5, var6); - if (inputItem != null || recipeItem != null) - { - String component_wood = CustomToolHelper.getComponentMaterial(inputItem, "wood"); - String component_metal = CustomToolHelper.getComponentMaterial(inputItem, "metal"); - - if(component_metal != null)//CHECK CUSTOM METAL - { - if(metal == null) - { - metal = component_metal; - } - else - { - if(!metal.equalsIgnoreCase(component_metal)) - { - return false; - } - } - } - - if(component_wood != null)//CHECK CUSTOM WOOD - { - if(wood == null) - { - wood = component_wood; - } - else - { - if(!wood.equalsIgnoreCase(component_wood)) - { - return false; - } - } - } - - if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) + if (inputItem != null || recipeItem != null) { + String component_wood = CustomToolHelper.getComponentMaterial(inputItem, "wood"); + String component_metal = CustomToolHelper.getComponentMaterial(inputItem, "metal"); + + if (component_metal != null)// CHECK CUSTOM METAL { - return false; + if (metal == null) { + metal = component_metal; + } else { + if (!metal.equalsIgnoreCase(component_metal)) { + return false; + } + } } - - if(inputItem == null) + + if (component_wood != null)// CHECK CUSTOM WOOD { - return false; + if (wood == null) { + wood = component_wood; + } else { + if (!wood.equalsIgnoreCase(component_wood)) { + return false; + } + } } - if (recipeItem.getItem() != inputItem.getItem()) - { + if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) { return false; } - if(!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) - { - return false; + + if (inputItem == null) { + return false; } - if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE && recipeItem.getItemDamage() != inputItem.getItemDamage()) - { + + if (recipeItem.getItem() != inputItem.getItem()) { + return false; + } + if (!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) { + return false; + } + if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE + && recipeItem.getItemDamage() != inputItem.getItemDamage()) { return false; } } } } - if(!modifyTiers(matrix, metal)) - { - modifyTiers(matrix, wood); - } + if (!modifyTiers(matrix, metal)) { + modifyTiers(matrix, wood); + } return true; } - private boolean modifyTiers(CarpenterCraftMatrix matrix, String tier) - { - CustomMaterial material = CustomMaterial.getMaterial(tier); - if(material != null) - { - int newTier = recipeHammer <0 ? material.crafterTier : recipeHammer; - matrix.modifyTier(newTier, (int)(recipeTime * material.craftTimeModifier)); - return true; - } - return false; - } - - @Override - public ItemStack getCraftingResult(CarpenterCraftMatrix matrix) - { + private boolean modifyTiers(CarpenterCraftMatrix matrix, String tier) { + CustomMaterial material = CustomMaterial.getMaterial(tier); + if (material != null) { + int newTier = recipeHammer < 0 ? material.crafterTier : recipeHammer; + matrix.modifyTier(newTier, (int) (recipeTime * material.craftTimeModifier)); + return true; + } + return false; + } + + @Override + public ItemStack getCraftingResult(CarpenterCraftMatrix matrix) { ItemStack result = super.getCraftingResult(matrix); - + String wood = null; String metal = null; - for(int i = 0; i < matrix.getSizeInventory(); i++) - { - ItemStack item = matrix.getStackInSlot(i); - String component_wood = CustomToolHelper.getComponentMaterial(item, "wood"); - String component_metal = CustomToolHelper.getComponentMaterial(item, "metal"); - if(wood == null && component_wood != null){wood = component_wood;} - if(metal == null && component_metal != null){metal = component_metal;} + for (int i = 0; i < matrix.getSizeInventory(); i++) { + ItemStack item = matrix.getStackInSlot(i); + String component_wood = CustomToolHelper.getComponentMaterial(item, "wood"); + String component_metal = CustomToolHelper.getComponentMaterial(item, "metal"); + if (wood == null && component_wood != null) { + wood = component_wood; + } + if (metal == null && component_metal != null) { + metal = component_metal; + } } - if(metal != null) - { - CustomMaterial.addMaterial(result, CustomToolHelper.slot_main, metal); + if (metal != null) { + CustomMaterial.addMaterial(result, CustomToolHelper.slot_main, metal); } - if(wood != null) - { - CustomMaterial.addMaterial(result, metal == null ? CustomToolHelper.slot_main : CustomToolHelper.slot_haft, wood); + if (wood != null) { + CustomMaterial.addMaterial(result, metal == null ? CustomToolHelper.slot_main : CustomToolHelper.slot_haft, + wood); } return result; } diff --git a/src/main/java/minefantasy/mf2/api/crafting/carpenter/ICarpenter.java b/src/main/java/minefantasy/mf2/api/crafting/carpenter/ICarpenter.java index 6b3a6cb2..c8bf7e00 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/carpenter/ICarpenter.java +++ b/src/main/java/minefantasy/mf2/api/crafting/carpenter/ICarpenter.java @@ -3,19 +3,23 @@ import minefantasy.mf2.api.rpg.Skill; /** - * - * @author AnonymousProductions - * This interface is used by the anvil in MineFantasy so - * it can be referred to without importing the mod - * + * @author AnonymousProductions This interface is used by the anvil in + * MineFantasy so it can be referred to without importing the mod */ public interface ICarpenter { - void setForgeTime(int i); - void setToolTier(int i); - void setRequiredCarpenter(int i); - void setHotOutput(boolean i); - void setToolType(String toolType); - void setCraftingSound(String trade); - void setResearch(String research); - void setSkill(Skill skill); + void setForgeTime(int i); + + void setToolTier(int i); + + void setRequiredCarpenter(int i); + + void setHotOutput(boolean i); + + void setToolType(String toolType); + + void setCraftingSound(String trade); + + void setResearch(String research); + + void setSkill(Skill skill); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/carpenter/ICarpenterRecipe.java b/src/main/java/minefantasy/mf2/api/crafting/carpenter/ICarpenterRecipe.java index 4ffcb656..72532103 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/carpenter/ICarpenterRecipe.java +++ b/src/main/java/minefantasy/mf2/api/crafting/carpenter/ICarpenterRecipe.java @@ -4,12 +4,9 @@ import net.minecraft.item.ItemStack; /** - * * @author AnonymousProductions - * */ -public interface ICarpenterRecipe -{ +public interface ICarpenterRecipe { /** * Used to check if a recipe matches current crafting inventory */ @@ -19,27 +16,29 @@ public interface ICarpenterRecipe * Returns an Item that is the result of this recipe */ ItemStack getCraftingResult(CarpenterCraftMatrix var1); + int getCraftTime(); + /** * Returns the size of the recipe area */ int getRecipeSize(); - + int getRecipeHammer(); - + float getExperiance(); - + int getAnvil(); - + boolean outputHot(); - + String getToolType(); - + String getSound(); - + ItemStack getRecipeOutput(); - String getResearch(); - - Skill getSkill(); + String getResearch(); + + Skill getSkill(); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/carpenter/RecipeSorterCarpenter.java b/src/main/java/minefantasy/mf2/api/crafting/carpenter/RecipeSorterCarpenter.java index 85e6bfa0..d7a0400a 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/carpenter/RecipeSorterCarpenter.java +++ b/src/main/java/minefantasy/mf2/api/crafting/carpenter/RecipeSorterCarpenter.java @@ -3,27 +3,24 @@ import java.util.Comparator; /** - * * @author AnonymousProductions - * */ -class RecipeSorterCarpenter implements Comparator -{ +class RecipeSorterCarpenter implements Comparator { final CraftingManagerCarpenter craftingManager; - RecipeSorterCarpenter(CraftingManagerCarpenter manager) - { + RecipeSorterCarpenter(CraftingManagerCarpenter manager) { this.craftingManager = manager; } - public int compareRecipes(ICarpenterRecipe recipe1, ICarpenterRecipe recipe2) - { - return recipe1 instanceof ShapelessCarpenterRecipes && recipe2 instanceof ShapedCarpenterRecipes ? 1 : (recipe2 instanceof ShapelessCarpenterRecipes && recipe1 instanceof ShapedCarpenterRecipes ? -1 : (recipe2.getRecipeSize() < recipe1.getRecipeSize() ? -1 : (recipe2.getRecipeSize() > recipe1.getRecipeSize() ? 1 : 0))); + public int compareRecipes(ICarpenterRecipe recipe1, ICarpenterRecipe recipe2) { + return recipe1 instanceof ShapelessCarpenterRecipes && recipe2 instanceof ShapedCarpenterRecipes ? 1 + : (recipe2 instanceof ShapelessCarpenterRecipes && recipe1 instanceof ShapedCarpenterRecipes ? -1 + : (recipe2.getRecipeSize() < recipe1.getRecipeSize() ? -1 + : (recipe2.getRecipeSize() > recipe1.getRecipeSize() ? 1 : 0))); } @Override - public int compare(Object input1, Object input2) - { - return this.compareRecipes((ICarpenterRecipe)input1, (ICarpenterRecipe)input2); + public int compare(Object input1, Object input2) { + return this.compareRecipes((ICarpenterRecipe) input1, (ICarpenterRecipe) input2); } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/carpenter/ShapedCarpenterRecipes.java b/src/main/java/minefantasy/mf2/api/crafting/carpenter/ShapedCarpenterRecipes.java index 829022a9..f7c8bc9b 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/carpenter/ShapedCarpenterRecipes.java +++ b/src/main/java/minefantasy/mf2/api/crafting/carpenter/ShapedCarpenterRecipes.java @@ -7,41 +7,42 @@ import net.minecraftforge.oredict.OreDictionary; /** - * * @author AnonymousProductions - * */ -public class ShapedCarpenterRecipes implements ICarpenterRecipe -{ - /** How many horizontal slots this recipe is wide. */ - public int recipeWidth; - +public class ShapedCarpenterRecipes implements ICarpenterRecipe { public final int recipeHammer; - public final boolean outputHot; - /** How many vertical slots this recipe uses. */ - public int recipeHeight; - - /** The Block Tier needed to craft */ + /** + * The Block Tier needed to craft + */ public final int blockTier; - - /** Is a array of ItemStack that composes the recipe. */ - public ItemStack[] recipeItems; - - /** Is the ItemStack that you get when craft the recipe. */ - public ItemStack recipeOutput; - public final int recipeTime; - public final float recipeExperiance; + public final float recipeExperience; public final String toolType; public final String soundOfCraft; public final String research; public final Skill skillUsed; - - public ShapedCarpenterRecipes(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, int time, int hammer, int anvi, float exp, boolean hot, String sound, String research, Skill skill) - { - this.research = research; - this.outputHot = hot; + /** + * How many horizontal slots this recipe is wide. + */ + public int recipeWidth; + /** + * How many vertical slots this recipe uses. + */ + public int recipeHeight; + /** + * Is a array of ItemStack that composes the recipe. + */ + public ItemStack[] recipeItems; + /** + * Is the ItemStack that you get when craft the recipe. + */ + public ItemStack recipeOutput; + + public ShapedCarpenterRecipes(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, int time, + int hammer, int anvi, float exp, boolean hot, String sound, String research, Skill skill) { + this.research = research; + this.outputHot = hot; this.recipeWidth = wdth; this.blockTier = anvi; this.recipeHeight = heit; @@ -49,50 +50,44 @@ public ShapedCarpenterRecipes(int wdth, int heit, ItemStack[] inputs, ItemStack this.recipeOutput = output; this.recipeTime = time; this.recipeHammer = hammer; - this.recipeExperiance = exp; + this.recipeExperience = exp; this.toolType = toolType; this.soundOfCraft = sound; this.skillUsed = skill; } @Override - public ItemStack getRecipeOutput() - { + public ItemStack getRecipeOutput() { return this.recipeOutput; } + @Override - public int getCraftTime() - { - return recipeTime; + public int getCraftTime() { + return recipeTime; } + @Override - public float getExperiance() - { - return this.recipeExperiance; + public float getExperiance() { + return this.recipeExperience; } + @Override - public int getRecipeHammer() - { - return recipeHammer; + public int getRecipeHammer() { + return recipeHammer; } /** * Used to check if a recipe matches current crafting inventory */ @Override - public boolean matches(CarpenterCraftMatrix matrix) - { - for (int var2 = 0; var2 <= ShapelessCarpenterRecipes.globalWidth - this.recipeWidth; ++var2) - { - for (int var3 = 0; var3 <= ShapelessCarpenterRecipes.globalHeight - this.recipeHeight; ++var3) - { - if (this.checkMatch(matrix, var2, var3, true)) - { + public boolean matches(CarpenterCraftMatrix matrix) { + for (int var2 = 0; var2 <= ShapelessCarpenterRecipes.globalWidth - this.recipeWidth; ++var2) { + for (int var3 = 0; var3 <= ShapelessCarpenterRecipes.globalHeight - this.recipeHeight; ++var3) { + if (this.checkMatch(matrix, var2, var3, true)) { return true; } - if (this.checkMatch(matrix, var2, var3, false)) - { + if (this.checkMatch(matrix, var2, var3, false)) { return true; } } @@ -104,52 +99,40 @@ public boolean matches(CarpenterCraftMatrix matrix) /** * Checks if the region of a crafting inventory is match for the recipe. */ - private boolean checkMatch(InventoryCrafting matrix, int x, int y, boolean b) - { - for (int var5 = 0; var5 < ShapelessCarpenterRecipes.globalWidth; ++var5) - { - for (int var6 = 0; var6 < ShapelessCarpenterRecipes.globalHeight; ++var6) - { + private boolean checkMatch(InventoryCrafting matrix, int x, int y, boolean b) { + for (int var5 = 0; var5 < ShapelessCarpenterRecipes.globalWidth; ++var5) { + for (int var6 = 0; var6 < ShapelessCarpenterRecipes.globalHeight; ++var6) { int var7 = var5 - x; int var8 = var6 - y; ItemStack recipeItem = null; - if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) - { - if (b) - { + if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) { + if (b) { recipeItem = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth]; - } - else - { + } else { recipeItem = this.recipeItems[var7 + var8 * this.recipeWidth]; } } ItemStack inputItem = matrix.getStackInRowAndColumn(var5, var6); - if (inputItem != null || recipeItem != null) - { - if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) - { + if (inputItem != null || recipeItem != null) { + if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) { return false; } - - if(inputItem == null) - { - return false; + + if (inputItem == null) { + return false; } - if (recipeItem.getItem() != inputItem.getItem()) - { + if (recipeItem.getItem() != inputItem.getItem()) { return false; } - if(!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) - { - return false; + if (!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) { + return false; } - if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE && recipeItem.getItemDamage() != inputItem.getItemDamage()) - { + if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE + && recipeItem.getItemDamage() != inputItem.getItemDamage()) { return false; } } @@ -159,12 +142,11 @@ private boolean checkMatch(InventoryCrafting matrix, int x, int y, boolean b) return true; } - /** + /** * Returns an Item that is the result of this recipe */ @Override - public ItemStack getCraftingResult(CarpenterCraftMatrix matrix) - { + public ItemStack getCraftingResult(CarpenterCraftMatrix matrix) { return recipeOutput.copy(); } @@ -172,42 +154,37 @@ public ItemStack getCraftingResult(CarpenterCraftMatrix matrix) * Returns the size of the recipe area */ @Override - public int getRecipeSize() - { + public int getRecipeSize() { return this.recipeWidth * this.recipeHeight; } - @Override - public int getAnvil() { - return blockTier; - } - - @Override - public boolean outputHot() { - return this.outputHot; - } - - @Override - public String getToolType() - { - return toolType; - } - - @Override - public String getSound() - { - return soundOfCraft; - } - - @Override - public String getResearch() - { - return research; - } - - @Override - public Skill getSkill() - { - return skillUsed; - } + @Override + public int getAnvil() { + return blockTier; + } + + @Override + public boolean outputHot() { + return this.outputHot; + } + + @Override + public String getToolType() { + return toolType; + } + + @Override + public String getSound() { + return soundOfCraft; + } + + @Override + public String getResearch() { + return research; + } + + @Override + public Skill getSkill() { + return skillUsed; + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/carpenter/ShapelessCarpenterRecipes.java b/src/main/java/minefantasy/mf2/api/crafting/carpenter/ShapelessCarpenterRecipes.java index 20cffe3c..0e618fd5 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/carpenter/ShapelessCarpenterRecipes.java +++ b/src/main/java/minefantasy/mf2/api/crafting/carpenter/ShapelessCarpenterRecipes.java @@ -1,48 +1,48 @@ package minefantasy.mf2.api.crafting.carpenter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.rpg.Skill; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.oredict.OreDictionary; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** - * * @author AnonymousProductions - * */ -public class ShapelessCarpenterRecipes implements ICarpenterRecipe -{ - public static final int globalWidth = 4; - public static final int globalHeight = 4; - - /** Is the ItemStack that you get when craft the recipe. */ +public class ShapelessCarpenterRecipes implements ICarpenterRecipe { + public static final int globalWidth = 4; + public static final int globalHeight = 4; + /** + * Is a List of ItemStack that composes the recipe. + */ + public final List recipeItems; + /** + * Is the ItemStack that you get when craft the recipe. + */ private final ItemStack recipeOutput; - private final boolean outputHot; - /** Is a List of ItemStack that composes the recipe. */ - public final List recipeItems; - private final int recipeHammer; - - /** The Block Tier Required */ + + /** + * The Block Tier Required + */ private final int blockTier; - + private final int recipeTime; private final float recipeExperiance; private final String toolType; private final String soundOfCraft; private final String research; private final Skill skillUsed; - - public ShapelessCarpenterRecipes(ItemStack output, String toolType, float exp, int hammer, int anvi, int time, List components, boolean hot, String sound, String research, Skill skill) - { - this.research = research; - this.outputHot = hot; + + public ShapelessCarpenterRecipes(ItemStack output, String toolType, float exp, int hammer, int anvi, int time, + List components, boolean hot, String sound, String research, Skill skill) { + this.research = research; + this.outputHot = hot; this.recipeOutput = output; this.blockTier = anvi; this.recipeItems = components; @@ -54,9 +54,23 @@ public ShapelessCarpenterRecipes(ItemStack output, String toolType, float exp, i this.skillUsed = skill; } + public static int getTemp(ItemStack item) { + NBTTagCompound tag = getNBT(item); + + if (tag.hasKey("MFtemp")) + return tag.getInteger("MFtemp"); + + return 0; + } + + private static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) + item.setTagCompound(new NBTTagCompound()); + return item.getTagCompound(); + } + @Override - public ItemStack getRecipeOutput() - { + public ItemStack getRecipeOutput() { return this.recipeOutput; } @@ -64,43 +78,36 @@ public ItemStack getRecipeOutput() * Used to check if a recipe matches current crafting inventory */ @Override - public boolean matches(CarpenterCraftMatrix par1InventoryCrafting) - { + public boolean matches(CarpenterCraftMatrix par1InventoryCrafting) { ArrayList var2 = new ArrayList(this.recipeItems); - for (int var3 = 0; var3 <= globalWidth; ++var3) - { - for (int var4 = 0; var4 <= globalHeight; ++var4) - { + for (int var3 = 0; var3 <= globalWidth; ++var3) { + for (int var4 = 0; var4 <= globalHeight; ++var4) { ItemStack inputItem = par1InventoryCrafting.getStackInRowAndColumn(var4, var3); - if (inputItem != null) - { + if (inputItem != null) { boolean var6 = false; Iterator var7 = var2.iterator(); - while (var7.hasNext()) - { - ItemStack recipeItem = (ItemStack)var7.next(); + while (var7.hasNext()) { + ItemStack recipeItem = (ItemStack) var7.next(); - if(inputItem == null) - { - return false; + if (inputItem == null) { + return false; } - if(!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) - { - return false; + if (!CustomToolHelper.doesMatchForRecipe(recipeItem, inputItem)) { + return false; } - if (inputItem.getItem() == recipeItem.getItem() && (recipeItem.getItemDamage() == OreDictionary.WILDCARD_VALUE || inputItem.getItemDamage() == recipeItem.getItemDamage())) - { + if (inputItem.getItem() == recipeItem.getItem() + && (recipeItem.getItemDamage() == OreDictionary.WILDCARD_VALUE + || inputItem.getItemDamage() == recipeItem.getItemDamage())) { var6 = true; var2.remove(recipeItem); break; } } - if (!var6) - { + if (!var6) { return false; } } @@ -109,27 +116,12 @@ public boolean matches(CarpenterCraftMatrix par1InventoryCrafting) return var2.isEmpty(); } - public static int getTemp(ItemStack item) - { - NBTTagCompound tag = getNBT(item); - - if(tag.hasKey("MFtemp"))return tag.getInteger("MFtemp"); - - return 0; - } - - private static NBTTagCompound getNBT(ItemStack item) - { - if(!item.hasTagCompound())item.setTagCompound(new NBTTagCompound()); - return item.getTagCompound(); - } - + /** * Returns an Item that is the result of this recipe */ @Override - public ItemStack getCraftingResult(CarpenterCraftMatrix par1InventoryCrafting) - { + public ItemStack getCraftingResult(CarpenterCraftMatrix par1InventoryCrafting) { return this.recipeOutput.copy(); } @@ -137,57 +129,52 @@ public ItemStack getCraftingResult(CarpenterCraftMatrix par1InventoryCrafting) * Returns the size of the recipe area */ @Override - public int getRecipeSize() - { + public int getRecipeSize() { return this.recipeItems.size(); } - @Override - public int getCraftTime() { - return this.recipeTime; - } - - @Override - public int getRecipeHammer() { - return this.recipeHammer; - } - - @Override - public float getExperiance() { - return this.recipeExperiance; - } - - @Override - public int getAnvil() { - return this.blockTier; - } - - @Override - public boolean outputHot() { - return outputHot; - } - - @Override - public String getToolType() - { - return toolType; - } - - @Override - public String getSound() - { - return soundOfCraft; - } - - @Override - public String getResearch() - { - return research; - } - - @Override - public Skill getSkill() - { - return skillUsed; - } + @Override + public int getCraftTime() { + return this.recipeTime; + } + + @Override + public int getRecipeHammer() { + return this.recipeHammer; + } + + @Override + public float getExperiance() { + return this.recipeExperiance; + } + + @Override + public int getAnvil() { + return this.blockTier; + } + + @Override + public boolean outputHot() { + return outputHot; + } + + @Override + public String getToolType() { + return toolType; + } + + @Override + public String getSound() { + return soundOfCraft; + } + + @Override + public String getResearch() { + return research; + } + + @Override + public Skill getSkill() { + return skillUsed; + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/engineer/IBombComponent.java b/src/main/java/minefantasy/mf2/api/crafting/engineer/IBombComponent.java index ba020763..6144f577 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/engineer/IBombComponent.java +++ b/src/main/java/minefantasy/mf2/api/crafting/engineer/IBombComponent.java @@ -1,10 +1,14 @@ package minefantasy.mf2.api.crafting.engineer; -public interface IBombComponent -{ - - /** The type of component only supported types (minecase, bombcase, filling)*/ - public String getComponentType(); - /** The tier, this depends on the component type */ - public byte getTier(); +public interface IBombComponent { + + /** + * The type of component only supported types (minecase, bombcase, filling) + */ + public String getComponentType(); + + /** + * The tier, this depends on the component type + */ + public byte getTier(); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/engineer/ICrossbowPart.java b/src/main/java/minefantasy/mf2/api/crafting/engineer/ICrossbowPart.java index 71c9830a..9529603b 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/engineer/ICrossbowPart.java +++ b/src/main/java/minefantasy/mf2/api/crafting/engineer/ICrossbowPart.java @@ -1,28 +1,43 @@ package minefantasy.mf2.api.crafting.engineer; -import java.util.HashMap; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.util.IIcon; -public interface ICrossbowPart -{ - public static final HashMap components = new HashMap(); - - /** The type of component only supported types (minecase, bombcase, filling)*/ - public String getComponentType(); - /** The id, this depends on the component type */ - public int getID(); - /** The Icon for the finished Model*/ - @SideOnly(Side.CLIENT) - public IIcon getIcon(); - /** Gets the name for the part (mostly an adjective like "Heavy" or "Repeating") */ - public String getUnlocalisedName(); - /** Modifies a value by name (such as "power" or "spread"), "capacity" is treated as an int */ - public float getModifier(String type); - /** - * Only for stocks, whether it's defined as a hand crossbow - */ - public boolean makesSmallWeapon(); +import java.util.HashMap; + +public interface ICrossbowPart { + public static final HashMap components = new HashMap(); + + /** + * The type of component only supported types (minecase, bombcase, filling) + */ + public String getComponentType(); + + /** + * The id, this depends on the component type + */ + public int getID(); + + /** + * The Icon for the finished Model + */ + @SideOnly(Side.CLIENT) + public IIcon getIcon(); + + /** + * Gets the name for the part (mostly an adjective like "Heavy" or "Repeating") + */ + public String getUnlocalisedName(); + + /** + * Modifies a value by name (such as "power" or "spread"), "capacity" is treated + * as an int + */ + public float getModifier(String type); + + /** + * Only for stocks, whether it's defined as a hand crossbow + */ + public boolean makesSmallWeapon(); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/exotic/ISpecialCraftItem.java b/src/main/java/minefantasy/mf2/api/crafting/exotic/ISpecialCraftItem.java index 73509672..28b5d8cf 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/exotic/ISpecialCraftItem.java +++ b/src/main/java/minefantasy/mf2/api/crafting/exotic/ISpecialCraftItem.java @@ -2,7 +2,6 @@ import net.minecraft.item.ItemStack; -public interface ISpecialCraftItem -{ - public String getDesign(ItemStack item); +public interface ISpecialCraftItem { + public String getDesign(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/exotic/ISpecialDesign.java b/src/main/java/minefantasy/mf2/api/crafting/exotic/ISpecialDesign.java index 3a7aaab5..1d6df496 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/exotic/ISpecialDesign.java +++ b/src/main/java/minefantasy/mf2/api/crafting/exotic/ISpecialDesign.java @@ -2,7 +2,6 @@ import net.minecraft.item.ItemStack; -public interface ISpecialDesign -{ - String getDesign(ItemStack item); +public interface ISpecialDesign { + String getDesign(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/crafting/exotic/SpecialForging.java b/src/main/java/minefantasy/mf2/api/crafting/exotic/SpecialForging.java index a49f7640..ecb472e4 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/exotic/SpecialForging.java +++ b/src/main/java/minefantasy/mf2/api/crafting/exotic/SpecialForging.java @@ -1,65 +1,56 @@ package minefantasy.mf2.api.crafting.exotic; -import java.util.HashMap; - import minefantasy.mf2.api.crafting.Salvage; import minefantasy.mf2.api.helpers.CustomToolHelper; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class SpecialForging -{ - public static HashMapdragonforgeCrafts = new HashMap(); - public static HashMapspecialCrafts = new HashMap(); - - public static void addDragonforgeCraft(Block blackSteel, Block dragon) - { - addDragonforgeCraft(Item.getItemFromBlock(blackSteel), Item.getItemFromBlock(dragon)); - } - public static void addDragonforgeCraft(Item base, Item dragon) - { - dragonforgeCrafts.put(base, dragon); - Salvage.shareSalvage(dragon, base); - } - public static Item getDragonCraft(ItemStack blacksteel) - { - if(dragonforgeCrafts.containsKey(blacksteel.getItem())) - { - return dragonforgeCrafts.get(blacksteel.getItem()); - } - return null; - } - - public static void addSpecialCraft(String special, Item base, Item output) - { - specialCrafts.put(getIdentifier(base, special), output); - Salvage.shareSalvage(output, base); - } - public static Item getSpecialCraft(String special, ItemStack input) - { - if(input != null) - { - String id = getIdentifier(input.getItem(), special); - if(specialCrafts.containsKey(id)) - { - return specialCrafts.get(id); - } - } - return null; - } - - private static String getIdentifier(Item item, String special) - { - return "["+special+"]" + CustomToolHelper.getSimpleReferenceName(item); - } - - public static String getItemDesign(ItemStack item) - { - if(item != null && item.getItem() instanceof ISpecialCraftItem) - { - return ((ISpecialCraftItem)item.getItem()).getDesign(item); - } - return null; - } +import java.util.HashMap; + +public class SpecialForging { + public static HashMap dragonforgeCrafts = new HashMap(); + public static HashMap specialCrafts = new HashMap(); + + public static void addDragonforgeCraft(Block blackSteel, Block dragon) { + addDragonforgeCraft(Item.getItemFromBlock(blackSteel), Item.getItemFromBlock(dragon)); + } + + public static void addDragonforgeCraft(Item base, Item dragon) { + dragonforgeCrafts.put(base, dragon); + Salvage.shareSalvage(dragon, base); + } + + public static Item getDragonCraft(ItemStack blacksteel) { + if (dragonforgeCrafts.containsKey(blacksteel.getItem())) { + return dragonforgeCrafts.get(blacksteel.getItem()); + } + return null; + } + + public static void addSpecialCraft(String special, Item base, Item output) { + specialCrafts.put(getIdentifier(base, special), output); + Salvage.shareSalvage(output, base); + } + + public static Item getSpecialCraft(String special, ItemStack input) { + if (input != null) { + String id = getIdentifier(input.getItem(), special); + if (specialCrafts.containsKey(id)) { + return specialCrafts.get(id); + } + } + return null; + } + + private static String getIdentifier(Item item, String special) { + return "[" + special + "]" + CustomToolHelper.getSimpleReferenceName(item); + } + + public static String getItemDesign(ItemStack item) { + if (item != null && item.getItem() instanceof ISpecialCraftItem) { + return ((ISpecialCraftItem) item.getItem()).getDesign(item); + } + return null; + } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/refine/BloomRecipe.java b/src/main/java/minefantasy/mf2/api/crafting/refine/BloomRecipe.java index 29a9f423..99a20d72 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/refine/BloomRecipe.java +++ b/src/main/java/minefantasy/mf2/api/crafting/refine/BloomRecipe.java @@ -1,63 +1,55 @@ package minefantasy.mf2.api.crafting.refine; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class BloomRecipe -{//FurnaceRecipes - public static HashMap recipeList = new HashMap(); - - public static void addRecipe(ItemStack input, ItemStack output) - { - recipeList.put(input, output); - } - public static void addRecipe(Block input, ItemStack output) - { - addRecipe(Item.getItemFromBlock(input), output); - } - public static void addRecipe(Item input, ItemStack output) - { - addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output); - } - - - public ItemStack result; - public int time; - public String research; - - public BloomRecipe(ItemStack result, int time, String research) - { - this.result = result; - this.time = time; - this.research = research; - } - - public static ItemStack getSmeltingResult(ItemStack item) - { +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; + +public class BloomRecipe {// FurnaceRecipes + public static HashMap recipeList = new HashMap(); + public ItemStack result; + public int time; + public String research; + + public BloomRecipe(ItemStack result, int time, String research) { + this.result = result; + this.time = time; + this.research = research; + } + + public static void addRecipe(ItemStack input, ItemStack output) { + recipeList.put(input, output); + } + + public static void addRecipe(Block input, ItemStack output) { + addRecipe(Item.getItemFromBlock(input), output); + } + + public static void addRecipe(Item input, ItemStack output) { + addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output); + } + + public static ItemStack getSmeltingResult(ItemStack item) { Iterator iterator = recipeList.entrySet().iterator(); Entry entry; - do - { - if (!iterator.hasNext()) - { + do { + if (!iterator.hasNext()) { return null; } - entry = (Entry)iterator.next(); - } - while (!doesMatch(item, (ItemStack)entry.getKey())); + entry = (Entry) iterator.next(); + } while (!doesMatch(item, (ItemStack) entry.getKey())); - return (ItemStack)entry.getValue(); + return (ItemStack) entry.getValue(); } - private static boolean doesMatch(ItemStack item1, ItemStack item2) - { - return item2.getItem() == item1.getItem() && (item2.getItemDamage() == OreDictionary.WILDCARD_VALUE || item2.getItemDamage() == item1.getItemDamage()); + + private static boolean doesMatch(ItemStack item1, ItemStack item2) { + return item2.getItem() == item1.getItem() && (item2.getItemDamage() == OreDictionary.WILDCARD_VALUE + || item2.getItemDamage() == item1.getItemDamage()); } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/refine/PaintOilRecipe.java b/src/main/java/minefantasy/mf2/api/crafting/refine/PaintOilRecipe.java index d70c4ab7..ae470d8b 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/refine/PaintOilRecipe.java +++ b/src/main/java/minefantasy/mf2/api/crafting/refine/PaintOilRecipe.java @@ -1,60 +1,54 @@ package minefantasy.mf2.api.crafting.refine; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; +public class PaintOilRecipe {// FurnaceRecipes + public static HashMap recipeList = new HashMap(); -public class PaintOilRecipe -{//FurnaceRecipes - public static HashMap recipeList = new HashMap(); - - /** - * Turn one specific meta block to another - */ - public static void addRecipe(Block input, int inMeta, Block output, int outMeta) - { - recipeList.put(new ItemStack(input, 1, inMeta), new ItemStack(output, 1, outMeta)); - } - /** - * Turn a block to a specific meta - */ - public static void addRecipe(Block input, Block output, int meta) - { - addRecipe(input, OreDictionary.WILDCARD_VALUE, output, meta); - } - /** - * Turn a block to a block without a meta change - */ - public static void addRecipe(Block input, Block output) - { - addRecipe(input, OreDictionary.WILDCARD_VALUE, output, OreDictionary.WILDCARD_VALUE); - } - - public static ItemStack getPaintResult(ItemStack item) - { + /** + * Turn one specific meta block to another + */ + public static void addRecipe(Block input, int inMeta, Block output, int outMeta) { + recipeList.put(new ItemStack(input, 1, inMeta), new ItemStack(output, 1, outMeta)); + } + + /** + * Turn a block to a specific meta + */ + public static void addRecipe(Block input, Block output, int meta) { + addRecipe(input, OreDictionary.WILDCARD_VALUE, output, meta); + } + + /** + * Turn a block to a block without a meta change + */ + public static void addRecipe(Block input, Block output) { + addRecipe(input, OreDictionary.WILDCARD_VALUE, output, OreDictionary.WILDCARD_VALUE); + } + + public static ItemStack getPaintResult(ItemStack item) { Iterator iterator = recipeList.entrySet().iterator(); Entry entry; - do - { - if (!iterator.hasNext()) - { + do { + if (!iterator.hasNext()) { return null; } - entry = (Entry)iterator.next(); - } - while (!doesMatch(item, (ItemStack)entry.getKey())); + entry = (Entry) iterator.next(); + } while (!doesMatch(item, (ItemStack) entry.getKey())); - return (ItemStack)entry.getValue(); + return (ItemStack) entry.getValue(); } - private static boolean doesMatch(ItemStack item1, ItemStack item2) - { - return item2.getItem() == item1.getItem() && (item2.getItemDamage() == OreDictionary.WILDCARD_VALUE || item2.getItemDamage() == item1.getItemDamage()); + + private static boolean doesMatch(ItemStack item1, ItemStack item2) { + return item2.getItem() == item1.getItem() && (item2.getItemDamage() == OreDictionary.WILDCARD_VALUE + || item2.getItemDamage() == item1.getItemDamage()); } } diff --git a/src/main/java/minefantasy/mf2/api/crafting/refine/QuernRecipes.java b/src/main/java/minefantasy/mf2/api/crafting/refine/QuernRecipes.java index 52483f88..f3ee6647 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/refine/QuernRecipes.java +++ b/src/main/java/minefantasy/mf2/api/crafting/refine/QuernRecipes.java @@ -1,46 +1,48 @@ package minefantasy.mf2.api.crafting.refine; -import java.util.HashMap; - -import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.util.Utils; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class QuernRecipes -{ - public static HashMaprecipeList = new HashMap(); - - public static QuernRecipes addRecipe(Block input, ItemStack output, int tier) - { - return addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output, tier); - } - public static QuernRecipes addRecipe(Item input, ItemStack output, int tier) - { - return addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output, tier); - } - public static QuernRecipes addRecipe(ItemStack input, ItemStack output, int tier) - { - QuernRecipes recipe = new QuernRecipes(input, output, tier); - recipeList.put(CustomToolHelper.getReferenceName(input), recipe); - return recipe; - } - public static QuernRecipes getResult(ItemStack input) - { - if(input == null)return null; - - QuernRecipes specific = recipeList.get(CustomToolHelper.getReferenceName(input)); - if(specific != null)return specific; - - return recipeList.get(CustomToolHelper.getReferenceName(input, "any")); - } - - public final ItemStack result; - public final int tier; - public QuernRecipes(ItemStack input, ItemStack output, int tier) - { - this.result = output; - this.tier = tier; - } -} +import java.util.HashSet; + +public class QuernRecipes { + public static HashSet recipeList = new HashSet(); + public final ItemStack input, result; + public final boolean consumePot; + public final int tier; + + public QuernRecipes(ItemStack input, ItemStack output, int tier, boolean consumePot) { + this.input = input; + this.result = output; + this.consumePot = consumePot; + this.tier = tier; + } + + public static QuernRecipes addRecipe(Block input, ItemStack output, int tier, boolean consumePot) { + return addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output, tier, consumePot); + } + + public static QuernRecipes addRecipe(Item input, ItemStack output, int tier, boolean consumePot) { + return addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output, tier, consumePot); + } + + public static QuernRecipes addRecipe(ItemStack input, ItemStack output, int tier, boolean consumePot) { + QuernRecipes recipe = new QuernRecipes(input, output, tier, consumePot); + recipeList.add(recipe); + return recipe; + } + + public static QuernRecipes getResult(ItemStack input) { + if (input != null) { + for (QuernRecipes recipes : recipeList) { + if (Utils.doesMatch(input, recipes.input)) { + return recipes; + } + } + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/api/crafting/tanning/TanningRecipe.java b/src/main/java/minefantasy/mf2/api/crafting/tanning/TanningRecipe.java index aee0997e..10885d94 100644 --- a/src/main/java/minefantasy/mf2/api/crafting/tanning/TanningRecipe.java +++ b/src/main/java/minefantasy/mf2/api/crafting/tanning/TanningRecipe.java @@ -1,76 +1,69 @@ package minefantasy.mf2.api.crafting.tanning; -import java.util.ArrayList; - import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class TanningRecipe -{ - public static final ArrayListrecipeList = new ArrayList(); - - public static void addRecipe(Object input, float time, ItemStack output) - { - addRecipe(input, time, -1, output); - } - public static void addRecipe(Object input, float time, int tier, ItemStack output) - { - addRecipe(input, time, tier, "knife", output); - } - public static void addRecipe(Object input, float time, int tier, String toolType, ItemStack output) - { - recipeList.add(new TanningRecipe(convertItem(input), time, tier, toolType, output)); - } - - public static ItemStack convertItem(Object input) - { - if(input instanceof ItemStack) - { - return (ItemStack)input; - } - if(input instanceof Item) - { - return new ItemStack((Item)input, 1, OreDictionary.WILDCARD_VALUE); - } - if(input instanceof Block) - { - return new ItemStack((Block)input, 1, OreDictionary.WILDCARD_VALUE); - } - MFLogUtil.logWarn("Tanning Recipe found invalid item!"); - return null; - } - public static TanningRecipe getRecipe(ItemStack item) - { - if(item == null)return null; - - for(int a = 0; a < recipeList.size(); a++) - { - TanningRecipe recipe = recipeList.get(a); - if(recipe.input.getItem() == item.getItem()) - { - if(recipe.input.getItemDamage() == OreDictionary.WILDCARD_VALUE || recipe.input.getItemDamage() == item.getItemDamage()) - { - return recipe; - } - } - } - return null; - } - - public int tier; - public float time; - public ItemStack input, output; - public String toolType; - - public TanningRecipe(ItemStack input, float time, int tier, String toolType, ItemStack output) - { - this.time = time; - this.tier = tier; - this.input = input; - this.output = output; - this.toolType = toolType; - } +import java.util.ArrayList; + +public class TanningRecipe { + public static final ArrayList recipeList = new ArrayList(); + public int tier; + public float time; + public ItemStack input, output; + public String toolType; + + public TanningRecipe(ItemStack input, float time, int tier, String toolType, ItemStack output) { + this.time = time; + this.tier = tier; + this.input = input; + this.output = output; + this.toolType = toolType; + } + + public static TanningRecipe addRecipe(Object input, float time, ItemStack output) { + return addRecipe(input, time, -1, output); + } + + public static TanningRecipe addRecipe(Object input, float time, int tier, ItemStack output) { + return addRecipe(input, time, tier, "knife", output); + } + + public static TanningRecipe addRecipe(Object input, float time, int tier, String toolType, ItemStack output) { + TanningRecipe recipe = new TanningRecipe(convertItem(input), time, tier, toolType, output); + recipeList.add(recipe); + return recipe; + } + + public static ItemStack convertItem(Object input) { + if (input instanceof ItemStack) { + return (ItemStack) input; + } + if (input instanceof Item) { + return new ItemStack((Item) input, 1, OreDictionary.WILDCARD_VALUE); + } + if (input instanceof Block) { + return new ItemStack((Block) input, 1, OreDictionary.WILDCARD_VALUE); + } + MFLogUtil.logWarn("Tanning Recipe found invalid item!"); + return null; + } + + public static TanningRecipe getRecipe(ItemStack item) { + if (item == null) + return null; + + for (int a = 0; a < recipeList.size(); a++) { + TanningRecipe recipe = recipeList.get(a); + if (recipe.input.getItem() == item.getItem()) { + if (recipe.input.getItemDamage() == OreDictionary.WILDCARD_VALUE + || recipe.input.getItemDamage() == item.getItemDamage()) { + return recipe; + } + } + } + return null; + } } diff --git a/src/main/java/minefantasy/mf2/api/farming/CustomHoeEntry.java b/src/main/java/minefantasy/mf2/api/farming/CustomHoeEntry.java index f84e6993..9cef9ffe 100644 --- a/src/main/java/minefantasy/mf2/api/farming/CustomHoeEntry.java +++ b/src/main/java/minefantasy/mf2/api/farming/CustomHoeEntry.java @@ -1,78 +1,73 @@ package minefantasy.mf2.api.farming; -import java.util.HashMap; - import minefantasy.mf2.api.MineFantasyAPI; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class CustomHoeEntry -{ - /** - * Registeres a piece (called by code or config) - * @param piece the item to list - * @param weight the weight of the piece (Kg) - * @param bulk the bulk of the piece - * @param alterSpeed if the armour's weight slows you down - */ - public static void registerItem(Item piece, float efficiency) - { - int id = Item.getIdFromItem(piece); - - MineFantasyAPI.debugMsg("Added Custom hoe: " + piece.getUnlocalizedName() + " Efficiency = " + efficiency); - entries.put(id, new CustomHoeEntry(id, efficiency)); - } - - /** - * Gets the variables for the item if there are any: order is weight, bulk - */ - public static float getEntryEfficiency(ItemStack piece, float Default) - { - CustomHoeEntry entry = getEntry(piece); - if(entry != null) - { - return entry.efficiency; - } - return Default; - } - /** - * Gets the entry for an item - * @param piece the armour item - * @return the entry(if there is one), else null - */ - public static CustomHoeEntry getEntry(ItemStack piece) - { - return getEntry(piece.getItem()); - } - /** - * Gets the entry for an item - * @param piece the armour item - * @return the entry(if there is one), else null - */ - public static CustomHoeEntry getEntry(Item piece) - { - if(piece != null) - { - int id = Item.getIdFromItem(piece); - if(entries.containsKey(id)) - { - return entries.get(id); - } - } - return null; - } - - public int itemID; - /** - * The Efficiency(same variable as dig speed) - */ - public float efficiency; - - public static HashMapentries = new HashMap(); - - private CustomHoeEntry(int id, float efficiency) - { - this.itemID = id; - this.efficiency = efficiency; - } +import java.util.HashMap; + +public class CustomHoeEntry { + public static HashMap entries = new HashMap(); + public int itemID; + /** + * The Efficiency(same variable as dig speed) + */ + public float efficiency; + + private CustomHoeEntry(int id, float efficiency) { + this.itemID = id; + this.efficiency = efficiency; + } + + /** + * Registeres a piece (called by code or config) + * + * @param piece the item to list + * @param weight the weight of the piece (Kg) + * @param bulk the bulk of the piece + * @param alterSpeed if the armour's weight slows you down + */ + public static void registerItem(Item piece, float efficiency) { + int id = Item.getIdFromItem(piece); + + MineFantasyAPI.debugMsg("Added Custom hoe: " + piece.getUnlocalizedName() + " Efficiency = " + efficiency); + entries.put(id, new CustomHoeEntry(id, efficiency)); + } + + /** + * Gets the variables for the item if there are any: order is weight, bulk + */ + public static float getEntryEfficiency(ItemStack piece, float Default) { + CustomHoeEntry entry = getEntry(piece); + if (entry != null) { + return entry.efficiency; + } + return Default; + } + + /** + * Gets the entry for an item + * + * @param piece the armour item + * @return the entry(if there is one), else null + */ + public static CustomHoeEntry getEntry(ItemStack piece) { + return getEntry(piece.getItem()); + } + + /** + * Gets the entry for an item + * + * @param piece the armour item + * @return the entry(if there is one), else null + */ + public static CustomHoeEntry getEntry(Item piece) { + if (piece != null) { + int id = Item.getIdFromItem(piece); + if (entries.containsKey(id)) { + return entries.get(id); + } + } + return null; + } } diff --git a/src/main/java/minefantasy/mf2/api/heating/ForgeFuel.java b/src/main/java/minefantasy/mf2/api/heating/ForgeFuel.java index 329a13bd..44a787ab 100644 --- a/src/main/java/minefantasy/mf2/api/heating/ForgeFuel.java +++ b/src/main/java/minefantasy/mf2/api/heating/ForgeFuel.java @@ -2,30 +2,28 @@ import net.minecraft.item.ItemStack; -public class ForgeFuel -{ - public ItemStack fuel; - public float duration; - public int baseHeat; - /** - * Some sources only accept refined fuel - */ - public boolean isRefined; - /** - * Applied to lava, auto-lights the forge when placed - */ - public boolean doesLight; +public class ForgeFuel { + public ItemStack fuel; + public float duration; + public int baseHeat; + /** + * Some sources only accept refined fuel + */ + public boolean isRefined; + /** + * Applied to lava, auto-lights the forge when placed + */ + public boolean doesLight; - public ForgeFuel(ItemStack item, float dura, int heat, boolean light) - { - this(item, dura, heat, light, false); - } - public ForgeFuel(ItemStack item, float dura, int heat, boolean light, boolean refined) - { - this.fuel = item; - this.duration = dura; - this.baseHeat = heat; - this.doesLight = light; - this.isRefined = refined; - } + public ForgeFuel(ItemStack item, float dura, int heat, boolean light) { + this(item, dura, heat, light, false); + } + + public ForgeFuel(ItemStack item, float dura, int heat, boolean light, boolean refined) { + this.fuel = item; + this.duration = dura; + this.baseHeat = heat; + this.doesLight = light; + this.isRefined = refined; + } } diff --git a/src/main/java/minefantasy/mf2/api/heating/ForgeItemHandler.java b/src/main/java/minefantasy/mf2/api/heating/ForgeItemHandler.java index 0650c922..e6b5e705 100644 --- a/src/main/java/minefantasy/mf2/api/heating/ForgeItemHandler.java +++ b/src/main/java/minefantasy/mf2/api/heating/ForgeItemHandler.java @@ -1,153 +1,146 @@ package minefantasy.mf2.api.heating; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class ForgeItemHandler -{ - public static List forgeFuel = new ArrayList(); - public static int forgeMaxTemp = 0; - - public static void addFuel(ItemStack item, int fuel, int heat, boolean willLight) - { - forgeFuel.add(new ForgeFuel(item, fuel, heat, willLight)); - } - public static ForgeFuel getStats(ItemStack item) - { - if (item == null) - return null; - - for (ForgeFuel fuel : forgeFuel) - { - if (fuel != null) - { - if (fuel.fuel.getItem() == item.getItem()) - { - if (fuel.fuel.getItemDamage() == OreDictionary.WILDCARD_VALUE || fuel.fuel.getItemDamage() == item.getItemDamage()) { - return fuel; - } - } - } - } - return null; - } - /** - * Gets the amount of smelts for an item - * - * @param item - * The item in the fuel slot - * @return The amount of smelts it has(will not consume if its 0) - */ - public static float getForgeFuel(ItemStack item) - { - if (item == null) - return 0; - - for (ForgeFuel fuel : forgeFuel) - { - if (fuel != null) - { - if (fuel.fuel.getItem() == item.getItem()) - { - if (fuel.fuel.getItemDamage() == OreDictionary.WILDCARD_VALUE || fuel.fuel.getItemDamage() == item.getItemDamage()) { - return fuel.duration; - } - } - } - } - return 0; - } - - public static boolean willLight(ItemStack item) { - if (item == null) { - return false; - } - - for (ForgeFuel fuel : forgeFuel) { - if (fuel != null) { - if (fuel.fuel.getItem() == item.getItem()) { - if (fuel.fuel.getItemDamage() == OreDictionary.WILDCARD_VALUE || fuel.fuel.getItemDamage() == item.getItemDamage()) { - return fuel.doesLight; - } - } - } - } - return false; - } - - /** - * Gets the amount of smelts for an item - * - * @param item - * The item id in the fuel slot - * @return The amount of smelts it has(will not consume if its 0) - */ - public static float getForgeFuelWithoutSubid(Item id) { - for (ForgeFuel fuel : forgeFuel) { - if (fuel != null) { - if (fuel.fuel.getItem() == id) { - return fuel.baseHeat; - } - } - } - return 0; - } - - /** - * Gets the base temperature for an item - * - * @param item - * The item in the fuel slot - * @return The amount of smelts it has(will not consume if its 0) - */ - public static int getForgeHeat(ItemStack item) { - if (item == null) - return 0; - - for (ForgeFuel fuel : forgeFuel) { - if (fuel != null) { - if (fuel.fuel.getItem() == item.getItem()) { - if (fuel.fuel.getItemDamage() == OreDictionary.WILDCARD_VALUE || fuel.fuel.getItemDamage() == item.getItemDamage()) { - return fuel.baseHeat; - } - } - } - } - return 0; - } - - /** - * Gets the base temperature for an item - * - * @param item - * The item id in the fuel slot - * @return The amount of smelts it has(will not consume if its 0) - */ - public static int getForgeHeat(Item item) { - for (ForgeFuel fuel : forgeFuel) { - if (fuel != null && fuel.fuel.getItem() == item) { - return fuel.baseHeat; - } - } - return 0; - } - - private static boolean matches(ItemStack item, ItemStack compare) { - if (item == null || compare == null) { - return false; - } - - if (item.getItem() != compare.getItem()) { - return false; - } - - if (item.getItemDamage() != compare.getItemDamage() && compare.getItemDamage() != OreDictionary.WILDCARD_VALUE && item.getItemDamage() != OreDictionary.WILDCARD_VALUE) { - return false; - } - return true; - } +import java.util.ArrayList; +import java.util.List; + +public class ForgeItemHandler { + public static List forgeFuel = new ArrayList(); + public static int forgeMaxTemp = 0; + + public static void addFuel(ItemStack item, int fuel, int heat, boolean willLight) { + forgeFuel.add(new ForgeFuel(item, fuel, heat, willLight)); + } + + public static ForgeFuel getStats(ItemStack item) { + if (item == null) + return null; + + for (ForgeFuel fuel : forgeFuel) { + if (fuel != null) { + if (fuel.fuel.getItem() == item.getItem()) { + if (fuel.fuel.getItemDamage() == OreDictionary.WILDCARD_VALUE + || fuel.fuel.getItemDamage() == item.getItemDamage()) { + return fuel; + } + } + } + } + return null; + } + + /** + * Gets the amount of smelts for an item + * + * @param item The item in the fuel slot + * @return The amount of smelts it has(will not consume if its 0) + */ + public static float getForgeFuel(ItemStack item) { + if (item == null) + return 0; + + for (ForgeFuel fuel : forgeFuel) { + if (fuel != null) { + if (fuel.fuel.getItem() == item.getItem()) { + if (fuel.fuel.getItemDamage() == OreDictionary.WILDCARD_VALUE + || fuel.fuel.getItemDamage() == item.getItemDamage()) { + return fuel.duration; + } + } + } + } + return 0; + } + + public static boolean willLight(ItemStack item) { + if (item == null) { + return false; + } + + for (ForgeFuel fuel : forgeFuel) { + if (fuel != null) { + if (fuel.fuel.getItem() == item.getItem()) { + if (fuel.fuel.getItemDamage() == OreDictionary.WILDCARD_VALUE + || fuel.fuel.getItemDamage() == item.getItemDamage()) { + return fuel.doesLight; + } + } + } + } + return false; + } + + /** + * Gets the amount of smelts for an item + * + * @param item The item id in the fuel slot + * @return The amount of smelts it has(will not consume if its 0) + */ + public static float getForgeFuelWithoutSubid(Item id) { + for (ForgeFuel fuel : forgeFuel) { + if (fuel != null) { + if (fuel.fuel.getItem() == id) { + return fuel.baseHeat; + } + } + } + return 0; + } + + /** + * Gets the base temperature for an item + * + * @param item The item in the fuel slot + * @return The amount of smelts it has(will not consume if its 0) + */ + public static int getForgeHeat(ItemStack item) { + if (item == null) + return 0; + + for (ForgeFuel fuel : forgeFuel) { + if (fuel != null) { + if (fuel.fuel.getItem() == item.getItem()) { + if (fuel.fuel.getItemDamage() == OreDictionary.WILDCARD_VALUE + || fuel.fuel.getItemDamage() == item.getItemDamage()) { + return fuel.baseHeat; + } + } + } + } + return 0; + } + + /** + * Gets the base temperature for an item + * + * @param item The item id in the fuel slot + * @return The amount of smelts it has(will not consume if its 0) + */ + public static int getForgeHeat(Item item) { + for (ForgeFuel fuel : forgeFuel) { + if (fuel != null && fuel.fuel.getItem() == item) { + return fuel.baseHeat; + } + } + return 0; + } + + private static boolean matches(ItemStack item, ItemStack compare) { + if (item == null || compare == null) { + return false; + } + + if (item.getItem() != compare.getItem()) { + return false; + } + + if (item.getItemDamage() != compare.getItemDamage() && compare.getItemDamage() != OreDictionary.WILDCARD_VALUE + && item.getItemDamage() != OreDictionary.WILDCARD_VALUE) { + return false; + } + return true; + } } diff --git a/src/main/java/minefantasy/mf2/api/heating/Heatable.java b/src/main/java/minefantasy/mf2/api/heating/Heatable.java index b110074c..175d05fa 100644 --- a/src/main/java/minefantasy/mf2/api/heating/Heatable.java +++ b/src/main/java/minefantasy/mf2/api/heating/Heatable.java @@ -1,246 +1,218 @@ package minefantasy.mf2.api.heating; -import java.util.HashMap; - import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.oredict.OreDictionary; -public class Heatable -{ - public static final int forgeMaximumMetalHeat = 5000; - public static boolean requiresHeating = true; - public static HashMap registerList = new HashMap(); - /** - * The min heat the ingot must be to forge with mesured in celcius - */ - private final int minTemperature; - - /** - * The heat when it becomes unstable mesured in celcius - */ - private final int unstableTemperature; - - /** - * The max heat until the ingot is destroyed mesured in celcius - */ - private final int maxTemperature; - - /** - * The item that's used - */ - protected ItemStack object; - - public Heatable(ItemStack item, int min, int unstable, int max) { - this.object = item; - this.minTemperature = min; - this.unstableTemperature = unstable; - this.maxTemperature = max; - } - - public static void addItem(ItemStack item, int min, int unstable, int max) - { - registerList.put(getRegistrationForItem(item), new Heatable(item, min, unstable, max)); - } - - public static boolean canHeatItem(ItemStack item) { - return loadStats(item) != null; - } - - public static Heatable loadStats(ItemStack item) - { - if (item == null) - return null; - - if (registerList.isEmpty()) - return null; - - Heatable stats = findRegister(item); - if (stats != null) - { - if (stats.object.getItemDamage() == OreDictionary.WILDCARD_VALUE) - { - if (stats.object.getItem() == item.getItem()) - { - return stats; - } - } - else if (stats.object.isItemEqual(item)) - { - return stats; - } - } - - return null; - } - - public static final String NBT_Item = "MFHeatable_ItemSave"; - //public static final String NBT_ItemID = "MFHeatable_ItemID"; - //public static final String NBT_SubID = "MFHeatable_SubID"; - public static final String NBT_ShouldDisplay = "MFHeatable_DisplayTemperature"; - - public static final String NBT_CurrentTemp = "MFHeatable_Temperature"; - public static final String NBT_WorkableTemp = "MFHeatable_WorkTemp"; - public static final String NBT_UnstableTemp = "MFHeatable_UnstableTemp"; - /** - * 0 = nothing, 1 = soft, 2 = unstable - */ - public static byte getHeatableStage(ItemStack item) - { - if(item == null || !(item.getItem() instanceof IHotItem)) - { - return 0; - } - if (item != null && item.hasTagCompound()) - { - int temp = getTemp(item); - int work = item.getTagCompound().getInteger(NBT_WorkableTemp); - int unstable = item.getTagCompound().getInteger(NBT_UnstableTemp); - if (temp > unstable) - return (byte) 2; - if (temp > work) - return (byte) 1; - } - return (byte) 0; - } - - public static int getWorkTemp(ItemStack item) - { - if(item == null || !(item.getItem() instanceof IHotItem)) - { - return 0; - } - NBTTagCompound tag = getNBT(item); - - if (tag.hasKey(NBT_WorkableTemp)) - return tag.getInteger(NBT_WorkableTemp); - - return 0; - } - public static int getUnstableTemp(ItemStack item) - { - if(item == null || !(item.getItem() instanceof IHotItem)) - { - return 0; - } - NBTTagCompound tag = getNBT(item); - - if (tag.hasKey(NBT_UnstableTemp)) - return tag.getInteger(NBT_UnstableTemp); - - return 0; - } - public static int getTemp(ItemStack item) - { - if(item == null || !(item.getItem() instanceof IHotItem)) - { - return 0; - } - NBTTagCompound tag = getNBT(item); - - if (tag.hasKey(NBT_CurrentTemp)) - return tag.getInteger(NBT_CurrentTemp); - - return 0; - } - /** - * Hardcore Crafting: Should quencing in inproper sources damage items - */ - public static boolean HCCquenchRuin = true; - - /** - * Gets a hot item - * @param item the hot item - * @param hazard the amount the source is hazardous (damaging the item): usually a percent dura loss - * @return what item is heated - */ - public static ItemStack getQuenchedItem(ItemStack item, float hazard) - { - ItemStack cold = Heatable.getItem(item); - - if(HCCquenchRuin && cold.isItemStackDamageable() && hazard > 0) - { - cold.setItemDamage((int) (cold.getMaxDamage()*hazard/100F)); - } - - return cold; - } - - public static ItemStack getItem(ItemStack item) - { - if(item == null || !(item.getItem() instanceof IHotItem)) - { - return null; - } - NBTTagCompound tag = getNBT(item); - - if (tag.hasKey(NBT_Item)) - { - return ItemStack.loadItemStackFromNBT(tag.getCompoundTag(NBT_Item)); - } - - return null; - } - private static NBTTagCompound getNBT(ItemStack item) { - if (!item.hasTagCompound()) - item.setTagCompound(new NBTTagCompound()); - return item.getTagCompound(); - } - - public static boolean isWorkable(ItemStack inputItem) - { - if(inputItem == null || !(inputItem.getItem() instanceof IHotItem)) - { - return true; - } - if(inputItem != null && inputItem.getItem() instanceof IHotItem) - { - return getHeatableStage(inputItem) == 1; - } - return true; - } - - private static Heatable findRegister(ItemStack item) - { - Heatable specific = registerList.get(item.getItem().getUnlocalizedName() + "_" + item.getItemDamage());//Try Specific first - if(specific != null) - { - return specific; - } - return registerList.get(item.getUnlocalizedName() + "_any");//Try Any; - } - public static String getRegistrationForItem(ItemStack item) - { - String s; - if(item.getItemDamage() == OreDictionary.WILDCARD_VALUE) - { - s = item.getItem().getUnlocalizedName() + "_any"; - } - else - { - s = item.getItem().getUnlocalizedName() + "_"+item.getItemDamage(); - } - return s; - } - - public int getWorkableStat(ItemStack item) - { - if(this.minTemperature == -1) - { - CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); - if(material != null)return material.getHeatableStats()[0]; - } - return this.minTemperature; - } - public int getUnstableStat(ItemStack item) - { - if(this.unstableTemperature == -1) - { - CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); - if(material != null)return material.getHeatableStats()[1]; - } - return this.unstableTemperature; - } +import java.util.HashMap; + +public class Heatable { + public static final int forgeMaximumMetalHeat = 5000; + public static final String NBT_Item = "MFHeatable_ItemSave"; + // public static final String NBT_ItemID = "MFHeatable_ItemID"; + // public static final String NBT_SubID = "MFHeatable_SubID"; + public static final String NBT_ShouldDisplay = "MFHeatable_DisplayTemperature"; + public static final String NBT_CurrentTemp = "MFHeatable_Temperature"; + public static final String NBT_WorkableTemp = "MFHeatable_WorkTemp"; + public static final String NBT_UnstableTemp = "MFHeatable_UnstableTemp"; + public static boolean requiresHeating = true; + public static HashMap registerList = new HashMap(); + /** + * Hardcore Crafting: Should quencing in inproper sources damage items + */ + public static boolean HCCquenchRuin = true; + /** + * The min heat the ingot must be to forge with mesured in celcius + */ + private final int minTemperature; + /** + * The heat when it becomes unstable mesured in celcius + */ + private final int unstableTemperature; + /** + * The max heat until the ingot is destroyed mesured in celcius + */ + private final int maxTemperature; + /** + * The item that's used + */ + protected ItemStack object; + + public Heatable(ItemStack item, int min, int unstable, int max) { + this.object = item; + this.minTemperature = min; + this.unstableTemperature = unstable; + this.maxTemperature = max; + } + + public static void addItem(ItemStack item, int min, int unstable, int max) { + registerList.put(getRegistrationForItem(item), new Heatable(item, min, unstable, max)); + } + + public static boolean canHeatItem(ItemStack item) { + return loadStats(item) != null; + } + + public static Heatable loadStats(ItemStack item) { + if (item == null) + return null; + + if (registerList.isEmpty()) + return null; + + Heatable stats = findRegister(item); + if (stats != null) { + if (stats.object.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + if (stats.object.getItem() == item.getItem()) { + return stats; + } + } else if (stats.object.isItemEqual(item)) { + return stats; + } + } + + return null; + } + + /** + * 0 = nothing, 1 = soft, 2 = unstable + */ + public static byte getHeatableStage(ItemStack item) { + if (item == null || !(item.getItem() instanceof IHotItem)) { + return 0; + } + if (item != null && item.hasTagCompound()) { + int temp = getTemp(item); + int work = item.getTagCompound().getInteger(NBT_WorkableTemp); + int unstable = item.getTagCompound().getInteger(NBT_UnstableTemp); + if (temp > unstable) + return (byte) 2; + if (temp > work) + return (byte) 1; + } + return (byte) 0; + } + + public static int getWorkTemp(ItemStack item) { + if (item == null || !(item.getItem() instanceof IHotItem)) { + return 0; + } + NBTTagCompound tag = getNBT(item); + + if (tag.hasKey(NBT_WorkableTemp)) + return tag.getInteger(NBT_WorkableTemp); + + return 0; + } + + public static int getUnstableTemp(ItemStack item) { + if (item == null || !(item.getItem() instanceof IHotItem)) { + return 0; + } + NBTTagCompound tag = getNBT(item); + + if (tag.hasKey(NBT_UnstableTemp)) + return tag.getInteger(NBT_UnstableTemp); + + return 0; + } + + public static int getTemp(ItemStack item) { + if (item == null || !(item.getItem() instanceof IHotItem)) { + return 0; + } + NBTTagCompound tag = getNBT(item); + + if (tag.hasKey(NBT_CurrentTemp)) + return tag.getInteger(NBT_CurrentTemp); + + return 0; + } + + /** + * Gets a hot item + * + * @param item the hot item + * @param hazard the amount the source is hazardous (damaging the item): usually a + * percent dura loss + * @return what item is heated + */ + public static ItemStack getQuenchedItem(ItemStack item, float hazard) { + ItemStack cold = Heatable.getItem(item); + + if (HCCquenchRuin && cold.isItemStackDamageable() && hazard > 0) { + cold.setItemDamage((int) (cold.getMaxDamage() * hazard / 100F)); + } + + return cold; + } + + public static ItemStack getItem(ItemStack item) { + if (item == null || !(item.getItem() instanceof IHotItem)) { + return null; + } + NBTTagCompound tag = getNBT(item); + + if (tag.hasKey(NBT_Item)) { + return ItemStack.loadItemStackFromNBT(tag.getCompoundTag(NBT_Item)); + } + + return null; + } + + private static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) + item.setTagCompound(new NBTTagCompound()); + return item.getTagCompound(); + } + + public static boolean isWorkable(ItemStack inputItem) { + if (inputItem == null || !(inputItem.getItem() instanceof IHotItem)) { + return true; + } + if (inputItem != null && inputItem.getItem() instanceof IHotItem) { + return getHeatableStage(inputItem) == 1; + } + return true; + } + + private static Heatable findRegister(ItemStack item) { + Heatable specific = registerList.get(item.getItem().getUnlocalizedName() + "_" + item.getItemDamage());// Try + // Specific + // first + if (specific != null) { + return specific; + } + return registerList.get(item.getUnlocalizedName() + "_any");// Try Any; + } + + public static String getRegistrationForItem(ItemStack item) { + String s; + if (item.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + s = item.getItem().getUnlocalizedName() + "_any"; + } else { + s = item.getItem().getUnlocalizedName() + "_" + item.getItemDamage(); + } + return s; + } + + public int getWorkableStat(ItemStack item) { + if (this.minTemperature == -1) { + CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); + if (material != null) + return material.getHeatableStats()[0]; + } + return this.minTemperature; + } + + public int getUnstableStat(ItemStack item) { + if (this.unstableTemperature == -1) { + CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); + if (material != null) + return material.getHeatableStats()[1]; + } + return this.unstableTemperature; + } } diff --git a/src/main/java/minefantasy/mf2/api/heating/IHotItem.java b/src/main/java/minefantasy/mf2/api/heating/IHotItem.java index 6315c492..59622ba7 100644 --- a/src/main/java/minefantasy/mf2/api/heating/IHotItem.java +++ b/src/main/java/minefantasy/mf2/api/heating/IHotItem.java @@ -3,13 +3,13 @@ import net.minecraft.item.ItemStack; public interface IHotItem { - /** - * Determines if an item is hot(requiring tongs to pick up) - */ - boolean isHot(ItemStack item); + /** + * Determines if an item is hot(requiring tongs to pick up) + */ + boolean isHot(ItemStack item); - /** - * Determines if an item can be cooled - */ - boolean isCoolable(ItemStack item); + /** + * Determines if an item can be cooled + */ + boolean isCoolable(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/heating/IQuenchBlock.java b/src/main/java/minefantasy/mf2/api/heating/IQuenchBlock.java index 0c1ca58f..6026e0e8 100644 --- a/src/main/java/minefantasy/mf2/api/heating/IQuenchBlock.java +++ b/src/main/java/minefantasy/mf2/api/heating/IQuenchBlock.java @@ -1,10 +1,10 @@ package minefantasy.mf2.api.heating; -public interface IQuenchBlock -{ - /** - * Quench an item - * @return 0 means success, 1-100 means item is damaged, <0 means fail. - */ - public float quench(); +public interface IQuenchBlock { + /** + * Quench an item + * + * @return 0 means success, 1-100 means item is damaged, <0 means fail. + */ + public float quench(); } diff --git a/src/main/java/minefantasy/mf2/api/heating/TongsHelper.java b/src/main/java/minefantasy/mf2/api/heating/TongsHelper.java index 0bccc1db..6b5b4842 100644 --- a/src/main/java/minefantasy/mf2/api/heating/TongsHelper.java +++ b/src/main/java/minefantasy/mf2/api/heating/TongsHelper.java @@ -3,162 +3,141 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public class TongsHelper -{ - /** - * Determines if an item is held - */ - public static boolean hasHeldItem(ItemStack tongs) - { - NBTTagCompound nbt = getNBT(tongs); +public class TongsHelper { + /** + * Determines if an item is held + */ + public static boolean hasHeldItem(ItemStack tongs) { + NBTTagCompound nbt = getNBT(tongs); - return nbt.hasKey("Held") && nbt.getBoolean("Held"); - } + return nbt.hasKey("Held") && nbt.getBoolean("Held"); + } - /** - * Empties the item - * - * @return - */ - public static ItemStack clearHeldItem(ItemStack tongs, EntityLivingBase user) - { - if (!user.worldObj.isRemote) - { - NBTTagCompound nbt = getNBT(tongs); - nbt.setBoolean("Held", false); - } - tongs.damageItem(1, user); + /** + * Empties the item + * + * @return + */ + public static ItemStack clearHeldItem(ItemStack tongs, EntityLivingBase user) { + if (!user.worldObj.isRemote) { + NBTTagCompound nbt = getNBT(tongs); + nbt.setBoolean("Held", false); + } + tongs.damageItem(1, user); - return tongs; - } + return tongs; + } - /** - * Picks up an item - */ - public static boolean trySetHeldItem(ItemStack tongs, ItemStack item) - { - if (item == null || item.getItem() == null || !isHotItem(item) || item.getItem() instanceof ItemBlock) - { - return false; - } - NBTTagCompound nbt = getNBT(tongs); - nbt.setBoolean("Held", true); - NBTTagCompound save = new NBTTagCompound(); - item.writeToNBT(save); - nbt.setTag("Saved", save); + /** + * Picks up an item + */ + public static boolean trySetHeldItem(ItemStack tongs, ItemStack item) { + if (item == null || item.getItem() == null || !isHotItem(item) || item.getItem() instanceof ItemBlock) { + return false; + } + NBTTagCompound nbt = getNBT(tongs); + nbt.setBoolean("Held", true); + NBTTagCompound save = new NBTTagCompound(); + item.writeToNBT(save); + nbt.setTag("Saved", save); - return true; - } + return true; + } - /** - * Used to determine if an item burns you when held, and if tongs can pick - * it up - */ - public static boolean isHotItem(ItemStack item) - { - if (item.getItem() instanceof IHotItem) - { - return ((IHotItem) item.getItem()).isHot(item); - } - return false; - } + /** + * Used to determine if an item burns you when held, and if tongs can pick it up + */ + public static boolean isHotItem(ItemStack item) { + if (item.getItem() instanceof IHotItem) { + return ((IHotItem) item.getItem()).isHot(item); + } + return false; + } - /** - * Determines if it can be cooled in a water source - */ - public static boolean isCoolableItem(ItemStack item) - { - if (item.getItem() instanceof IHotItem) - { - return ((IHotItem) item.getItem()).isCoolable(item); - } - return false; - } + /** + * Determines if it can be cooled in a water source + */ + public static boolean isCoolableItem(ItemStack item) { + if (item.getItem() instanceof IHotItem) { + return ((IHotItem) item.getItem()).isCoolable(item); + } + return false; + } - /** - * Gets the item picked up - */ - public static ItemStack getHeldItem(ItemStack tongs) { - NBTTagCompound nbt = getNBT(tongs); - if (nbt.hasKey("Held")) - { - if (nbt.getBoolean("Held")) - { - if(nbt.hasKey("Saved")) - { - NBTTagCompound save = nbt.getCompoundTag("Saved"); - return ItemStack.loadItemStackFromNBT(save); - } - } - } - return null; - } + /** + * Gets the item picked up + */ + public static ItemStack getHeldItem(ItemStack tongs) { + NBTTagCompound nbt = getNBT(tongs); + if (nbt.hasKey("Held")) { + if (nbt.getBoolean("Held")) { + if (nbt.hasKey("Saved")) { + NBTTagCompound save = nbt.getCompoundTag("Saved"); + return ItemStack.loadItemStackFromNBT(save); + } + } + } + return null; + } - /** - * Gets the item held from tongs - * - * @param tongs - * the itemstack used - */ - public static ItemStack getHeldItemTongs(ItemStack tongs) { - NBTTagCompound nbt = getNBT(tongs); - if (nbt.hasKey("Held")) { - if (nbt.getBoolean("Held")) - { - if(nbt.hasKey("Saved")) - { - NBTTagCompound save = nbt.getCompoundTag("Saved"); - return ItemStack.loadItemStackFromNBT(save); - } - } - } - return null; - } + /** + * Gets the item held from tongs + * + * @param tongs the itemstack used + */ + public static ItemStack getHeldItemTongs(ItemStack tongs) { + NBTTagCompound nbt = getNBT(tongs); + if (nbt.hasKey("Held")) { + if (nbt.getBoolean("Held")) { + if (nbt.hasKey("Saved")) { + NBTTagCompound save = nbt.getCompoundTag("Saved"); + return ItemStack.loadItemStackFromNBT(save); + } + } + } + return null; + } - /** - * Used for getting the NBT for itemstacks, if none exists; it creates one - */ - public static NBTTagCompound getNBT(ItemStack item) { - if (!item.hasTagCompound()) { - item.setTagCompound(new NBTTagCompound()); - } - return item.getTagCompound(); - } - - public static float getWaterSource(World world, int i, int j, int k) - { - float special = TongsHelper.getQuenced(world, i, j, k); - if(special >= 0) - { - return special; - } - if (world.getBlock(i, j, k).getMaterial() == Material.water) - { - world.setBlockToAir(i, j, k); - return 25F; - } - if (isCauldron(world, i, j, k)) { - return 10F; - } - return -1F; - } - public static boolean isCauldron(World world, int x, int y, int z) { - return world.getBlock(x, y, z) == Blocks.cauldron && world.getBlockMetadata(x, y, z) > 0; - } - public static float getQuenced(World world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof IQuenchBlock) - { - return ((IQuenchBlock)tile).quench(); - } - return -1F; - } + /** + * Used for getting the NBT for itemstacks, if none exists; it creates one + */ + public static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + return item.getTagCompound(); + } + + public static float getWaterSource(World world, int i, int j, int k) { + float special = TongsHelper.getQuenced(world, i, j, k); + if (special >= 0) { + return special; + } + if (world.getBlock(i, j, k).getMaterial() == Material.water) { + world.setBlockToAir(i, j, k); + return 25F; + } + if (isCauldron(world, i, j, k)) { + return 10F; + } + return -1F; + } + + public static boolean isCauldron(World world, int x, int y, int z) { + return world.getBlock(x, y, z) == Blocks.cauldron && world.getBlockMetadata(x, y, z) > 0; + } + + public static float getQuenced(World world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof IQuenchBlock) { + return ((IQuenchBlock) tile).quench(); + } + return -1F; + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/ArmourCalculator.java b/src/main/java/minefantasy/mf2/api/helpers/ArmourCalculator.java index 6577614b..d6753a55 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/ArmourCalculator.java +++ b/src/main/java/minefantasy/mf2/api/helpers/ArmourCalculator.java @@ -2,680 +2,569 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.armour.ArmourDesign; -import minefantasy.mf2.api.armour.CustomArmourEntry; -import minefantasy.mf2.api.armour.CustomDamageRatioEntry; -import minefantasy.mf2.api.armour.IArmourPenetrationMob; -import minefantasy.mf2.api.armour.IArmourMF; -import minefantasy.mf2.api.armour.IArmourRating; -import minefantasy.mf2.api.armour.IArmouredEntity; -import minefantasy.mf2.api.armour.ISpecialArmourMF; +import minefantasy.mf2.api.armour.*; import minefantasy.mf2.api.weapon.IDamageType; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.monster.EntitySpider; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor; +import net.minecraft.item.*; import net.minecraft.item.ItemArmor.ArmorMaterial; -import net.minecraft.item.ItemAxe; -import net.minecraft.item.ItemHoe; -import net.minecraft.item.ItemPickaxe; -import net.minecraft.item.ItemSpade; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; -import net.minecraftforge.common.ISpecialArmor; -import net.minecraftforge.common.ISpecialArmor.ArmorProperties; /** - * This class is used to calculate armour values like classes and weight + * This class is used to calculate armour values like classes and weight */ -public class ArmourCalculator -{ - public static boolean advancedDamageTypes = true; - /** - * This is the scale for helmet, chest, legs and boots. Use this with 'slot' to scale things like weight and DT distribution - */ - public static final float[]sizes = new float[]{0.2F, 0.3F, 0.3F, 0.2F}; - - /** - * For the percentage based armour, how much is ratio 2(50%) viewed as - */ - public static final float armourRatingScale = 100; - /** - * What affects stamina regen, and what affects stamina cost - */ - public static final float[]encumberanceArray = new float[]{10F, 40F}; - /** - * When your movement starts and peaks at slowing down - */ - public static final float slowAmount = 10F; - public static final float[] moveSpeedThreshold = new float[]{30F, 40F}; - - /** - * Gets the default using the items ArmourClass - */ - private static float getDefaultSuitWeight(ItemStack armour) - { - return CustomArmourEntry.getEntryVars(armour)[0]; - } - - private static float getDefaultBulk(ItemStack armour) - { - return CustomArmourEntry.getEntryVars(armour)[1]; - } - - - public static ArmourDesign getDefaultAD(ItemStack armour) - { - return ArmourDesign.SOLID; - } - - public static float slowRate = 1.0F; - - /** - * Converts a hit:damage ratio into vanilla AR(rounding off as it is an int) - */ - public static int translateToVanillaAR(float ratio) - { - return (int)Math.min(24, 25F*convertToPercent(ratio)); - } - - /** - * Converting a single piece to vanilla AR (rounding off as it is an int) Then it divides on the slot. Used for armour bar - */ - public static int translateToVanillaAR(float ratio, int piece, int max) - { - float scale = (float)piece/(float)max; - - return (int)Math.min(24, 25F*convertToPercent(ratio) * scale); - } - - /** - * Converts a hit:damage ratio into a decimal percentage - */ - public static float convertToPercent(float ratio) - { - return (1F - (1F/ratio)); - } - - /** - * Estimates the distribution of stats over a piece - */ - private static float estimateScale(ItemStack item, int slot) - { - if(item == null) - { - return 0; - } - - if(item.getItem() instanceof ItemArmor) - { - ItemArmor armour = (ItemArmor)item.getItem(); - ArmorMaterial material = armour.getArmorMaterial(); - - //gets the total added for all 4 pieces - int totalProtection = material.getDamageReductionAmount(0) + material.getDamageReductionAmount(1) + material.getDamageReductionAmount(2) + material.getDamageReductionAmount(3); - - if(totalProtection > 0) - { - float singlePointWorth = 1F / totalProtection; - return material.getDamageReductionAmount(slot) * singlePointWorth; - } - } - return sizes[slot]; - } - - public static float getSpeedModForWeight(EntityLivingBase user) - { - float mod = 0.0F; - float min = moveSpeedThreshold[0]; - float max = moveSpeedThreshold[1]-min; - float mass = getTotalWeightOfWorn(user, true) - min; - if(mass > 0 && max > 0) - { - mod -= (mass/max)*slowAmount*slowRate; - } - return mod; - } - - private static final String weightNBT = "MF_Worn_Weight"; - private static final String weightNBTNS = "MF_Worn_Weight_NS"; - - /** - * Gets the total worn weight of a user: this updates every 20 ticks - */ - public static float getTotalWeightOfWorn(EntityLivingBase user, boolean considerSpeed) - { - String tag = considerSpeed ? weightNBTNS : weightNBT; - if(!user.getEntityData().hasKey(tag)) - { - return setTotalWeightOfWorn(user, considerSpeed); - } - else - { - return user.getEntityData().getFloat(tag); - } - } - public static void updateWeights(EntityLivingBase user) - { - setTotalWeightOfWorn(user, true); - setTotalWeightOfWorn(user, false); - } - /** - * @param considerSpeed if true: some pieces will be ignored, ment for speed calculations - */ - public static float setTotalWeightOfWorn(EntityLivingBase user, boolean considerSpeed) - { - String tag = considerSpeed ? weightNBTNS : weightNBT; - float weight = 0.0F; - - for(int a = 0; a < 4; a ++) - { - ItemStack armour = user.getEquipmentInSlot(4-a); - - if(!considerSpeed || shouldArmourAlterSpeed(armour)) - { - weight += getPieceWeight(armour, a); - } - } - user.getEntityData().setFloat(tag, weight); - return weight; - } - - public static float getPieceWeight(ItemStack item, int slot) - { - if(item == null) - { - return 0.0F; - } - if(item.getItem() instanceof IArmourMF) - { - return ((IArmourMF)item.getItem()).getPieceWeight(item, slot); - } - if(slot >= sizes.length) - { - return 0F; - } - return getDefaultSuitWeight(item) * sizes[slot]; - } - - private static boolean shouldArmourAlterSpeed(ItemStack armour) - { - if(armour == null) - { - return false; - } - - return armour.getItem() instanceof IArmourMF || CustomArmourEntry.doesPieceSlowDown(armour); - } - - public static float convertKgToIbs(float kg) - { - return kg*2.5F; - } - public static float convertIbsToKg(float pounds) - { - return pounds/2.5F; - } - /** - * Modifes a value for resistence - * @param src the source (breaks down to ratio) - * @param value the variable to modify - * @param cuttingProt the cutting resistence - * @param bluntProt the blunt resistence - * @param pierceProt the piercing resistence - * @return - */ - public static float adjustACForDamage(DamageSource src, float value, float cuttingProt, float bluntProt, float pierceProt) - { - float[] ratio = getRatioForSource(src); - if(ratio == null) - { - return value;//Null means undefined - } - - return modifyACForType(value, ratio[0], ratio[1], ratio[2], cuttingProt, bluntProt, pierceProt, getArmourPenetration(src)); - } - public static float modifyACForType(int type, float value, float cuttingProt, float bluntProt, float pierceProt) - { - float[] f = new float[]{0F, 0F, 0F}; - f[type] = 1.0F; - return modifyACForType(value, f[0], f[1], f[2], cuttingProt, bluntProt, pierceProt, 0F); - } - public static float modifyACForType(float value, float cutting, float blunt, float pierce, float cuttingProt, float bluntProt, float pierceProt, float specialAP) - { - if(advancedDamageTypes) - { - //Averages the ratio between cutting and blunt, while modifying it by the armour traits - value *= (((cutting*cuttingProt) + (blunt*bluntProt) + (pierce*pierceProt)) / (cutting+blunt+pierce)); - } - float ACModifier = 1.0F + specialAP; - value *= ACModifier; - return value > 0F ? value: 0F; - } - - public static float getArmourPenetration(DamageSource source) - { - if(source != null && source.getEntity() != null) - { - Entity user = source.getEntity();//The attacker - Entity damager = source.getSourceOfDamage();//The thing causing damage(like arrows) - - if(user == damager && user instanceof EntityLivingBase && ((EntityLivingBase)user).getHeldItem() != null) - { - if(((EntityLivingBase)user).getHeldItem().getItem() instanceof IDamageType) - { - return ((IDamageType)((EntityLivingBase)user).getHeldItem().getItem()).getPenetrationLevel(((EntityLivingBase)user).getHeldItem()); - } - } - if(user != damager) - { - if(damager instanceof IDamageType) - { - return ((IDamageType)damager).getPenetrationLevel(damager); - } - } - } - return 0F; - } - public static float[] getRatioForSource(DamageSource source) - { - if(source.isMagicDamage() || source.isFireDamage() || source == DamageSource.starve) - { - return null; - } - - if(source.isExplosion() || source == DamageSource.anvil || source == DamageSource.fallingBlock) - { - return new float[]{0, 1, 0};//blunt - } - if(source == DamageSource.cactus) - { - return new float[]{0, 0, 1};//pierce - } - if(source != null && source.getSourceOfDamage() != null && source.getEntity() != null) - { - Entity user = source.getEntity();//The attacker - Entity damager = source.getSourceOfDamage();//The thing causing damage(like arrows) - - if(user == damager && user instanceof EntityLivingBase) - { - return getRatioForMelee((EntityLivingBase)user, ((EntityLivingBase)user).getHeldItem()); - } - return getRatioForIndirect(damager); - } - - return new float[]{0, 1, 0}; - } - - private static float[] getRatioForIndirect(Entity damager) - { - if(damager == null) - { - return new float[]{1,1,1};//No damage type. - } - if(damager instanceof IDamageType) - { - return ((IDamageType)damager).getDamageRatio(damager); - } - if(damager instanceof EntityArrow) - { - return new float[]{0, 0, 1}; - } - - if(useConfigIndirectDmg) - { - return CustomDamageRatioEntry.getTraits(getEntityRegisterName(damager)); - } - return new float[]{1, 1, 1}; - } - public static boolean useConfigIndirectDmg = true; - - public static float[] getRatioForMelee(EntityLivingBase user, ItemStack weapon) - { - if(weapon == null) - { - return getMobDefault(user); - } - return getRatioForWeapon(user, weapon); - } - public static float[] getRatioForWeapon(ItemStack weapon) - { - return getRatioForWeapon(null, weapon); - } - public static float[] getRatioForWeapon(EntityLivingBase user, ItemStack weapon) - { - Item item = weapon.getItem(); - - if(item instanceof IDamageType) - { - return user != null ? ((IDamageType)item).getDamageRatio(weapon, user) : ((IDamageType)item).getDamageRatio(weapon); - } - if(item instanceof ItemSword) - { - return new float[]{1, 0, 0};//sword is cutting by default - } - if(item instanceof ItemAxe) - { - return new float[]{3, 1, 0};//Axe Ratio is about 3:1 (25%blunt) - } - if(item instanceof ItemPickaxe) - { - return new float[]{0, 0, 1};//Picks are pierce - } - if(item instanceof ItemHoe || item instanceof ItemSpade) - { - return new float[]{0, 1, 0};//Tools are blunt - } - - return CustomDamageRatioEntry.getTraits(item); - } - - private static float[] getMobDefault(EntityLivingBase user) - { - if(user instanceof EntitySpider) - { - return new float[]{20F, 10F, 80F};//10% blunt, 20% slash, 80% pierce - } - if(user instanceof IArmourPenetrationMob) - { - return ((IArmourPenetrationMob)user).getHitTraits(); - } - return new float[]{0, 1, 0}; - } - - public static String getEntityRegisterName(Entity entity) - { - if(entity == null) - { - return "genetic"; - } +public class ArmourCalculator { + /** + * This is the scale for helmet, chest, legs and boots. Use this with 'slot' to + * scale things like weight and DT distribution + */ + public static final float[] sizes = new float[]{0.2F, 0.3F, 0.3F, 0.2F}; + /** + * For the percentage based armour, how much is ratio 2(50%) viewed as + */ + public static final float armourRatingScale = 100; + /** + * What affects stamina regen, and what affects stamina cost + */ + public static final float[] encumberanceArray = new float[]{10F, 40F}; + /** + * When your movement starts and peaks at slowing down + */ + public static final float slowAmount = 10F; + public static final float[] moveSpeedThreshold = new float[]{30F, 40F}; + private static final String weightNBT = "MF_Worn_Weight"; + private static final String weightNBTNS = "MF_Worn_Weight_NS"; + public static boolean advancedDamageTypes = true; + public static float slowRate = 1.0F; + public static boolean useConfigIndirectDmg = true; + + /** + * Gets the default using the items ArmourClass + */ + private static float getDefaultSuitWeight(ItemStack armour) { + return CustomArmourEntry.getEntryVars(armour)[0]; + } + + private static float getDefaultBulk(ItemStack armour) { + return CustomArmourEntry.getEntryVars(armour)[1]; + } + + public static ArmourDesign getDefaultAD(ItemStack armour) { + return ArmourDesign.SOLID; + } + + /** + * Converts a hit:damage ratio into vanilla AR(rounding off as it is an int) + */ + public static int translateToVanillaAR(float ratio) { + return (int) Math.min(24, 25F * convertToPercent(ratio)); + } + + /** + * Converting a single piece to vanilla AR (rounding off as it is an int) Then + * it divides on the slot. Used for armour bar + */ + public static int translateToVanillaAR(float ratio, int piece, int max) { + float scale = (float) piece / (float) max; + + return (int) Math.min(24, 25F * convertToPercent(ratio) * scale); + } + + /** + * Converts a hit:damage ratio into a decimal percentage + */ + public static float convertToPercent(float ratio) { + return (1F - (1F / ratio)); + } + + /** + * Estimates the distribution of stats over a piece + */ + private static float estimateScale(ItemStack item, int slot) { + if (item == null) { + return 0; + } + + if (item.getItem() instanceof ItemArmor) { + ItemArmor armour = (ItemArmor) item.getItem(); + ArmorMaterial material = armour.getArmorMaterial(); + + // gets the total added for all 4 pieces + int totalProtection = material.getDamageReductionAmount(0) + material.getDamageReductionAmount(1) + + material.getDamageReductionAmount(2) + material.getDamageReductionAmount(3); + + if (totalProtection > 0) { + float singlePointWorth = 1F / totalProtection; + return material.getDamageReductionAmount(slot) * singlePointWorth; + } + } + return sizes[slot]; + } + + public static float getSpeedModForWeight(EntityLivingBase user) { + float mod = 0.0F; + float min = moveSpeedThreshold[0]; + float max = moveSpeedThreshold[1] - min; + float mass = getTotalWeightOfWorn(user, true) - min; + if (mass > 0 && max > 0) { + mod -= (mass / max) * slowAmount * slowRate; + } + return mod; + } + + /** + * Gets the total worn weight of a user: this updates every 20 ticks + */ + public static float getTotalWeightOfWorn(EntityLivingBase user, boolean considerSpeed) { + String tag = considerSpeed ? weightNBTNS : weightNBT; + if (!user.getEntityData().hasKey(tag)) { + return setTotalWeightOfWorn(user, considerSpeed); + } else { + return user.getEntityData().getFloat(tag); + } + } + + public static void updateWeights(EntityLivingBase user) { + setTotalWeightOfWorn(user, true); + setTotalWeightOfWorn(user, false); + } + + /** + * @param considerSpeed if true: some pieces will be ignored, ment for speed calculations + */ + public static float setTotalWeightOfWorn(EntityLivingBase user, boolean considerSpeed) { + String tag = considerSpeed ? weightNBTNS : weightNBT; + float weight = 0.0F; + + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(4 - a); + + if (!considerSpeed || shouldArmourAlterSpeed(armour)) { + weight += getPieceWeight(armour, a); + } + } + user.getEntityData().setFloat(tag, weight); + return weight; + } + + public static float getPieceWeight(ItemStack item, int slot) { + if (item == null) { + return 0.0F; + } + if (item.getItem() instanceof IArmourMF) { + return ((IArmourMF) item.getItem()).getPieceWeight(item, slot); + } + if (slot >= sizes.length) { + return 0F; + } + return getDefaultSuitWeight(item) * sizes[slot]; + } + + private static boolean shouldArmourAlterSpeed(ItemStack armour) { + if (armour == null) { + return false; + } + + return armour.getItem() instanceof IArmourMF || CustomArmourEntry.doesPieceSlowDown(armour); + } + + public static float convertKgToIbs(float kg) { + return kg * 2.5F; + } + + public static float convertIbsToKg(float pounds) { + return pounds / 2.5F; + } + + /** + * Modifes a value for resistence + * + * @param src the source (breaks down to ratio) + * @param value the variable to modify + * @param cuttingProt the cutting resistence + * @param bluntProt the blunt resistence + * @param pierceProt the piercing resistence + * @return + */ + public static float adjustACForDamage(DamageSource src, float value, float cuttingProt, float bluntProt, + float pierceProt) { + float[] ratio = getRatioForSource(src); + if (ratio == null) { + return value;// Null means undefined + } + + return modifyACForType(value, ratio[0], ratio[1], ratio[2], cuttingProt, bluntProt, pierceProt, + getArmourPenetration(src)); + } + + public static float modifyACForType(int type, float value, float cuttingProt, float bluntProt, float pierceProt) { + float[] f = new float[]{0F, 0F, 0F}; + f[type] = 1.0F; + return modifyACForType(value, f[0], f[1], f[2], cuttingProt, bluntProt, pierceProt, 0F); + } + + public static float modifyACForType(float value, float cutting, float blunt, float pierce, float cuttingProt, + float bluntProt, float pierceProt, float specialAP) { + if (advancedDamageTypes) { + // Averages the ratio between cutting and blunt, while modifying it by the + // armour traits + value *= (((cutting * cuttingProt) + (blunt * bluntProt) + (pierce * pierceProt)) + / (cutting + blunt + pierce)); + } + float ACModifier = 1.0F + specialAP; + value *= ACModifier; + return value > 0F ? value : 0F; + } + + public static float getArmourPenetration(DamageSource source) { + if (source != null && source.getEntity() != null) { + Entity user = source.getEntity();// The attacker + Entity damager = source.getSourceOfDamage();// The thing causing damage(like arrows) + + if (user == damager && user instanceof EntityLivingBase + && ((EntityLivingBase) user).getHeldItem() != null) { + if (((EntityLivingBase) user).getHeldItem().getItem() instanceof IDamageType) { + return ((IDamageType) ((EntityLivingBase) user).getHeldItem().getItem()) + .getPenetrationLevel(((EntityLivingBase) user).getHeldItem()); + } + } + if (user != damager) { + if (damager instanceof IDamageType) { + return ((IDamageType) damager).getPenetrationLevel(damager); + } + } + } + return 0F; + } + + public static float[] getRatioForSource(DamageSource source) { + if (source.isMagicDamage() || source.isFireDamage() || source == DamageSource.starve) { + return null; + } + + if (source.isExplosion() || source == DamageSource.anvil || source == DamageSource.fallingBlock) { + return new float[]{0, 1, 0};// blunt + } + if (source == DamageSource.cactus) { + return new float[]{0, 0, 1};// pierce + } + if (source != null && source.getSourceOfDamage() != null && source.getEntity() != null) { + Entity user = source.getEntity();// The attacker + Entity damager = source.getSourceOfDamage();// The thing causing damage(like arrows) + + if (user == damager && user instanceof EntityLivingBase) { + return getRatioForMelee((EntityLivingBase) user, ((EntityLivingBase) user).getHeldItem()); + } + return getRatioForIndirect(damager); + } + + return new float[]{0, 1, 0}; + } + + private static float[] getRatioForIndirect(Entity damager) { + if (damager == null) { + return new float[]{1, 1, 1};// No damage type. + } + if (damager instanceof IDamageType) { + return ((IDamageType) damager).getDamageRatio(damager); + } + if (damager instanceof EntityArrow) { + return new float[]{0, 0, 1}; + } + + if (useConfigIndirectDmg) { + return CustomDamageRatioEntry.getTraits(getEntityRegisterName(damager)); + } + return new float[]{1, 1, 1}; + } + + public static float[] getRatioForMelee(EntityLivingBase user, ItemStack weapon) { + if (weapon == null) { + return getMobDefault(user); + } + return getRatioForWeapon(user, weapon); + } + + public static float[] getRatioForWeapon(ItemStack weapon) { + return getRatioForWeapon(null, weapon); + } + + public static float[] getRatioForWeapon(EntityLivingBase user, ItemStack weapon) { + Item item = weapon.getItem(); + + if (item instanceof IDamageType) { + return user != null ? ((IDamageType) item).getDamageRatio(weapon, user) + : ((IDamageType) item).getDamageRatio(weapon); + } + if (item instanceof ItemSword) { + return new float[]{1, 0, 0};// sword is cutting by default + } + if (item instanceof ItemAxe) { + return new float[]{3, 1, 0};// Axe Ratio is about 3:1 (25%blunt) + } + if (item instanceof ItemPickaxe) { + return new float[]{0, 0, 1};// Picks are pierce + } + if (item instanceof ItemHoe || item instanceof ItemSpade) { + return new float[]{0, 1, 0};// Tools are blunt + } + + return CustomDamageRatioEntry.getTraits(item); + } + + private static float[] getMobDefault(EntityLivingBase user) { + if (user instanceof EntitySpider) { + return new float[]{20F, 10F, 80F};// 10% blunt, 20% slash, 80% pierce + } + if (user instanceof IArmourPenetrationMob) { + return ((IArmourPenetrationMob) user).getHitTraits(); + } + return new float[]{0, 1, 0}; + } + + public static String getEntityRegisterName(Entity entity) { + if (entity == null) { + return "genetic"; + } String s = EntityList.getEntityString(entity); - if (s == null) - { + if (s == null) { s = "generic"; } return s; } - public static float getTotalBulk(EntityLivingBase user) - { - if(PowerArmour.isWearingCogwork(user)) - { - return 5F; - } - return getEquipmentBulk(user); - } - /** - * Defined by Light/Medium/Heavy armour average - * 0 for light, 1 for full medium, 2 for full heavy - */ - public static float getEquipmentBulk(EntityLivingBase user) - { - float bulk = 0.0F; - for(int a = 0; a < 4; a ++) - { - String s = getArmourClass(user.getEquipmentInSlot(4-a)); - if(s != null) - { - if(s.equalsIgnoreCase("Medium")) - { - bulk += 1; - } - if(s.equalsIgnoreCase("Heavy")) - { - bulk += 2; - } - } - - } - return bulk/4; - } - public static String getArmourClass(ItemStack armour) - { - if(armour == null) - { - return null; - } - if(armour.getItem() instanceof IArmourMF) - { - return ((IArmourMF)armour.getItem()).getSuitWeigthType(armour); - } - return CustomArmourEntry.getArmourClass(armour); - } - - //THRESHOLD - @SideOnly(Side.CLIENT) - /** - * CLIENT WHOLE ENTITY: - * Gets the total DT of an entity by damage type: Used by the Screen renderer - */ - public static float getDTDisplay(EntityLivingBase user, int id) - { - float armourDT = 0; - for(int a = 0; a < 4; a++) - { - ItemStack armour = user.getEquipmentInSlot(a+1); - if(armour != null && armour.getItem() instanceof ISpecialArmourMF) - { - float threshold = getArmourValueMod(armour, ((ISpecialArmourMF)armour.getItem()).getDTDisplay(armour, id)); - armourDT += threshold; - } - } - return armourDT; - } - - @SideOnly(Side.CLIENT) - /** - * CLIENT SINGLE PIECE: - * Gets a stat for a single piece: Used by Tooltips - */ - public static float getDTForDisplayPiece(ItemStack armour, int id) - { - if(armour != null && armour.getItem() instanceof ISpecialArmourMF) - { - return getArmourValueMod(armour, ((ISpecialArmourMF)armour.getItem()).getDTDisplay(armour, id)); - } - return 0F; - } - @SideOnly(Side.CLIENT) - /** - * CLIENT SINGLE PIECE: - * Gets a stat for a single piece: Used by Tooltips - */ - public static float getDRForDisplayPiece(ItemStack armour, int id) - { - if(armour == null) - { - return 0F; - } - if(armour.getItem() instanceof ISpecialArmourMF) - { - return getArmourValueMod(armour, ((ISpecialArmourMF)armour.getItem()).getDRDisplay(armour, id)); - } - return 0F; - } - @SideOnly(Side.CLIENT) - /** - * CLIENT WHOLE ENTITY: - * Gets the total DT of an entity by damage type: Used by the Screen renderer - */ - public static float getDRDisplay(EntityLivingBase user, int id) - { - float armourDT = 0; - for(int a = 0; a < 4; a++) - { - ItemStack armour = user.getEquipmentInSlot(a+1); - if(armour != null && armour.getItem() instanceof ISpecialArmourMF) - { - float threshold = getArmourValueMod(armour, ((ISpecialArmourMF)armour.getItem()).getDRDisplay(armour, id)); - armourDT += threshold; - } - } - return armourDT; - } - /** - * MECHANIC WHOLE ENTITY: - * Gets the threshold of a whole entity - */ - public static float getACThreshold(EntityLivingBase user, DamageSource src) - { - float naturalAC = getACForMob(user); - - if(user instanceof IArmouredEntity) - { - naturalAC = ((IArmouredEntity)user).getThreshold(src); - } - - float armourDT = 0; - for(int a = 0; a < 4; a++) - { - ItemStack armour = user.getEquipmentInSlot(a+1); - if(armour != null && armour.getItem() instanceof ISpecialArmourMF) - { - float threshold = getArmourValueMod(armour, ((ISpecialArmourMF)armour.getItem()).getDTValue(user, armour, src)); - armourDT += threshold; - } - } - return naturalAC + armourDT; - } - - /** - * MECHANIC DT MODIFIER: - * Gets the DT Modifier for durability loss - */ - private static float modifyDTOnDura(ItemStack armour) - { - float percentQuality = getPercentQuality(armour); - - float reduction = 0.8F; - - if(percentQuality < reduction) - { - float mod = Math.max(0.1F, percentQuality / reduction); - - return mod; - } - return 1.0F; - } - - /** - * MECHANIC DAMAGE FINDER: - * Gets the percent durability of an item - */ - private static float getPercentQuality(ItemStack armour) - { - return 1F - ((float)armour.getItemDamage() / (float)armour.getMaxDamage()); - } - - /** - * MECHANIC DT CALCULATOR: - * Gets the natural DT of an entity - */ - private static float getACForMob(EntityLivingBase user) - { - if(user.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD) - { - return user.getMaxHealth()/10F;//1.6AC for spiders - } - return 0F; - } - /** - * MECHANIC DT CALCULATOR: - * Gets the modifiers based on the itemstack (such as damage and NBT) DT OR DR - */ - public static float getArmourValueMod(ItemStack armour, float DT) - { - float initDT = DT; - if(armour.hasTagCompound() && armour.getTagCompound().hasKey("MF_Inferior")) - { - DT *= (armour.getTagCompound().getBoolean("MF_Inferior") ? 0.8F : 1.2F); - } - DT *= modifyDTOnDura(armour); - return DT; - } - /** - * MECHANIC DT CALCULATOR: - * How much is armour damaged by a hit - */ - public static int getDamageToDura(EntityLivingBase user, DamageSource source, ItemStack armour, float dam) - { - if(source.isUnblockable()) - { - return 0; - } - if(source.getSourceOfDamage() != null && source.getSourceOfDamage() == source.getEntity()) - { - dam *= getMobArmourDamage(source.getSourceOfDamage()); - } - if(getPercentQuality(armour) > 0.1F) - { - dam = Math.max(1.0F, dam/4F); - } - return (int)dam; - } - /** - * MECHANIC DT CALCULATOR: - * How much armour damage the entity does - */ - private static float getMobArmourDamage(Entity src) - { - if(src instanceof EntitySpider) - { - return 3.0F; - } - return 0.5F; - } - - public static void damageArmour(EntityLivingBase user, int dura) - { - for(int a = 0; a < 4; a++) - { - ItemStack armour = user.getEquipmentInSlot(a+1); - if(armour != null) - { - if(!user.worldObj.isRemote) - { - if(armour.getItemDamage() + dura < armour.getMaxDamage()) - { - armour.damageItem(dura, user); - } - else - { - armour.setItemDamage(armour.getMaxDamage()); - } - } - if(armour.getItemDamage() >= armour.getMaxDamage()) - { - user.setCurrentItemOrArmor(a+1, null); - user.worldObj.playSoundEffect(user.posX, user.posY+user.getEyeHeight() - (0.4F*a), user.posZ, "random.break", 1.0F, 1.0F); - } - } - } - } - - /** - * Determines how much armour reduces parrying ability - */ - public static float getParryModifier(EntityLivingBase user) - { - float bulk = getTotalBulk(user); - - return 1.0F / ( (bulk*0.5F) + 1);//50% in heavy - } - - public static int modifyParryCooldown(EntityLivingBase user, int ticks) - { - float bulk = getTotalBulk(user); - - return (int) Math.max(5, ticks + (bulk*5));//plate adds 5t - } + + public static float getTotalBulk(EntityLivingBase user) { + if (PowerArmour.isWearingCogwork(user)) { + return 5F; + } + return getEquipmentBulk(user); + } + + /** + * Defined by Light/Medium/Heavy armour average 0 for light, 1 for full medium, + * 2 for full heavy + */ + public static float getEquipmentBulk(EntityLivingBase user) { + float bulk = 0.0F; + for (int a = 0; a < 4; a++) { + String s = getArmourClass(user.getEquipmentInSlot(4 - a)); + if (s != null) { + if (s.equalsIgnoreCase("Medium")) { + bulk += 1; + } + if (s.equalsIgnoreCase("Heavy")) { + bulk += 2; + } + } + + } + return bulk / 4; + } + + public static String getArmourClass(ItemStack armour) { + if (armour == null) { + return null; + } + if (armour.getItem() instanceof IArmourMF) { + return ((IArmourMF) armour.getItem()).getSuitWeigthType(armour); + } + return CustomArmourEntry.getArmourClass(armour); + } + + // THRESHOLD + @SideOnly(Side.CLIENT) + /** + * CLIENT WHOLE ENTITY: Gets the total DT of an entity by damage type: Used by + * the Screen renderer + */ + public static float getDTDisplay(EntityLivingBase user, int id) { + float armourDT = 0; + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(a + 1); + if (armour != null && armour.getItem() instanceof ISpecialArmourMF) { + float threshold = getArmourValueMod(armour, + ((ISpecialArmourMF) armour.getItem()).getDTDisplay(armour, id)); + armourDT += threshold; + } + } + return armourDT; + } + + @SideOnly(Side.CLIENT) + /** + * CLIENT SINGLE PIECE: Gets a stat for a single piece: Used by Tooltips + */ + public static float getDTForDisplayPiece(ItemStack armour, int id) { + if (armour != null && armour.getItem() instanceof ISpecialArmourMF) { + return getArmourValueMod(armour, ((ISpecialArmourMF) armour.getItem()).getDTDisplay(armour, id)); + } + return 0F; + } + + @SideOnly(Side.CLIENT) + /** + * CLIENT SINGLE PIECE: Gets a stat for a single piece: Used by Tooltips + */ + public static float getDRForDisplayPiece(ItemStack armour, int id) { + if (armour == null) { + return 0F; + } + if (armour.getItem() instanceof ISpecialArmourMF) { + return getArmourValueMod(armour, ((ISpecialArmourMF) armour.getItem()).getDRDisplay(armour, id)); + } + return 0F; + } + + @SideOnly(Side.CLIENT) + /** + * CLIENT WHOLE ENTITY: Gets the total DT of an entity by damage type: Used by + * the Screen renderer + */ + public static float getDRDisplay(EntityLivingBase user, int id) { + float armourDT = 0; + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(a + 1); + if (armour != null && armour.getItem() instanceof ISpecialArmourMF) { + float threshold = getArmourValueMod(armour, + ((ISpecialArmourMF) armour.getItem()).getDRDisplay(armour, id)); + armourDT += threshold; + } + } + return armourDT; + } + + /** + * MECHANIC WHOLE ENTITY: Gets the threshold of a whole entity + */ + public static float getACThreshold(EntityLivingBase user, DamageSource src) { + float naturalAC = getACForMob(user); + + if (user instanceof IArmouredEntity) { + naturalAC = ((IArmouredEntity) user).getThreshold(src); + } + + float armourDT = 0; + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(a + 1); + if (armour != null && armour.getItem() instanceof ISpecialArmourMF) { + float threshold = getArmourValueMod(armour, + ((ISpecialArmourMF) armour.getItem()).getDTValue(user, armour, src)); + armourDT += threshold; + } + } + return naturalAC + armourDT; + } + + /** + * MECHANIC DT MODIFIER: Gets the DT Modifier for durability loss + */ + private static float modifyDTOnDura(ItemStack armour) { + float percentQuality = getPercentQuality(armour); + + float reduction = 0.8F; + + if (percentQuality < reduction) { + float mod = Math.max(0.1F, percentQuality / reduction); + + return mod; + } + return 1.0F; + } + + /** + * MECHANIC DAMAGE FINDER: Gets the percent durability of an item + */ + private static float getPercentQuality(ItemStack armour) { + return 1F - ((float) armour.getItemDamage() / (float) armour.getMaxDamage()); + } + + /** + * MECHANIC DT CALCULATOR: Gets the natural DT of an entity + */ + private static float getACForMob(EntityLivingBase user) { + if (user.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD) { + return user.getMaxHealth() / 10F;// 1.6AC for spiders + } + return 0F; + } + + /** + * MECHANIC DT CALCULATOR: Gets the modifiers based on the itemstack (such as + * damage and NBT) DT OR DR + */ + public static float getArmourValueMod(ItemStack armour, float DT) { + float initDT = DT; + if (armour.hasTagCompound() && armour.getTagCompound().hasKey("MF_Inferior")) { + DT *= (armour.getTagCompound().getBoolean("MF_Inferior") ? 0.8F : 1.2F); + } + DT *= modifyDTOnDura(armour); + return DT; + } + + /** + * MECHANIC DT CALCULATOR: How much is armour damaged by a hit + */ + public static int getDamageToDura(EntityLivingBase user, DamageSource source, ItemStack armour, float dam) { + if (source.isUnblockable()) { + return 0; + } + if (source.getSourceOfDamage() != null && source.getSourceOfDamage() == source.getEntity()) { + dam *= getMobArmourDamage(source.getSourceOfDamage()); + } + if (getPercentQuality(armour) > 0.1F) { + dam = Math.max(1.0F, dam / 4F); + } + return (int) dam; + } + + /** + * MECHANIC DT CALCULATOR: How much armour damage the entity does + */ + private static float getMobArmourDamage(Entity src) { + if (src instanceof EntitySpider) { + return 3.0F; + } + return 0.5F; + } + + public static void damageArmour(EntityLivingBase user, int dura) { + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(a + 1); + if (armour != null) { + if (!user.worldObj.isRemote) { + if (armour.getItemDamage() + dura < armour.getMaxDamage()) { + armour.damageItem(dura, user); + } else { + armour.setItemDamage(armour.getMaxDamage()); + } + } + if (armour.getItemDamage() >= armour.getMaxDamage()) { + user.setCurrentItemOrArmor(a + 1, null); + user.worldObj.playSoundEffect(user.posX, user.posY + user.getEyeHeight() - (0.4F * a), user.posZ, + "random.break", 1.0F, 1.0F); + } + } + } + } + + /** + * Determines how much armour reduces parrying ability + */ + public static float getParryModifier(EntityLivingBase user) { + float bulk = getTotalBulk(user); + + return 1.0F / ((bulk * 0.5F) + 1);// 50% in heavy + } + + public static int modifyParryCooldown(EntityLivingBase user, int ticks) { + float bulk = getTotalBulk(user); + + return (int) Math.max(5, ticks + (bulk * 5));// plate adds 5t + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/ArrowEffectsMF.java b/src/main/java/minefantasy/mf2/api/helpers/ArrowEffectsMF.java index d7cb3b77..4eb05ca0 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/ArrowEffectsMF.java +++ b/src/main/java/minefantasy/mf2/api/helpers/ArrowEffectsMF.java @@ -1,8 +1,5 @@ package minefantasy.mf2.api.helpers; -import java.util.ArrayList; -import java.util.List; - import minefantasy.mf2.api.archery.IArrowRetrieve; import net.minecraft.entity.Entity; import net.minecraft.entity.projectile.EntityArrow; @@ -10,110 +7,105 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -public class ArrowEffectsMF -{ - //THE ARROW STICKING CODE IS EXPERIMENTAL AND NOT ACTIVE BY DEFAULT - /** - * Sticks an arrow into an entity THIS WILL ONLY BE DROPPED ON LIVING ENTITIES. - * (This does not render arrows, simply drops them when an enemy is killed) - * @param hit the entity the arrow hit - * @param projectile the arrow entity, it will get the item to drop - */ - public static void stickArrowIn(Entity hit, Entity projectile) - { - stickArrowIn(hit, getDroppedArrow(projectile) ,projectile); - } - /** - * Sticks an arrow into an entity THIS WILL ONLY BE DROPPED ON LIVING ENTITIES. - * (This does not render arrows, simply drops them when an enemy is killed) - * @param hit the entity the arrow hit - * @param arrow the item that gets dropped when "hit" is killed - * @param projectile the arrow entity - */ - public static void stickArrowIn(Entity hit, ItemStack arrow, Entity projectile) - { - if(!shouldArrowStick(projectile)) - { - return; - } - NBTTagCompound nbt = hit.getEntityData(); - - int slot = 0; - if(nbt.hasKey("stuckArrowCountMF")) - { - slot = hit.getEntityData().getInteger("stuckArrowCountMF"); - } - - NBTTagCompound stuckArrow = new NBTTagCompound();//makes the arrow instance - arrow.writeToNBT(stuckArrow);//put arrow in instance - - nbt.setTag("StuckArrowMF"+slot, stuckArrow);//save arrow list - nbt.setInteger("stuckArrowCountMF", slot+1);//Slot increases - } - - /** - * Gets the arrow dropped when an enemy is killed. - * MODS NEED TO ADD THEIR OWN SUPPORT - * @param arrow the arrow fired - */ - public static ItemStack getDroppedArrow(Entity arrow) - { - if(arrow instanceof IArrowRetrieve)//implement this method in your entity arrow classes - { - return ((IArrowRetrieve)arrow).getDroppedItem(); - } - if(arrow.getEntityData().hasKey("MF_ArrowItem")) - { - NBTTagCompound heldArrow = arrow.getEntityData().getCompoundTag("MF_ArrowItem"); - return ItemStack.loadItemStackFromNBT(heldArrow); - } - return new ItemStack(Items.arrow); - } - - /** - * Gets if an arrow entity will drop items when the enemy is killed. - * @param projectile the arrow entity fired - */ - public static boolean shouldArrowStick(Entity projectile) - { - if(projectile instanceof IArrowRetrieve) - { - return ((IArrowRetrieve)projectile).canBePickedUp(); - } - if(projectile instanceof EntityArrow) - { - return ((EntityArrow)projectile).canBePickedUp == 1; - } - return true; - } +import java.util.ArrayList; +import java.util.List; + +public class ArrowEffectsMF { + // THE ARROW STICKING CODE IS EXPERIMENTAL AND NOT ACTIVE BY DEFAULT + + /** + * Sticks an arrow into an entity THIS WILL ONLY BE DROPPED ON LIVING ENTITIES. + * (This does not render arrows, simply drops them when an enemy is killed) + * + * @param hit the entity the arrow hit + * @param projectile the arrow entity, it will get the item to drop + */ + public static void stickArrowIn(Entity hit, Entity projectile) { + stickArrowIn(hit, getDroppedArrow(projectile), projectile); + } + + /** + * Sticks an arrow into an entity THIS WILL ONLY BE DROPPED ON LIVING ENTITIES. + * (This does not render arrows, simply drops them when an enemy is killed) + * + * @param hit the entity the arrow hit + * @param arrow the item that gets dropped when "hit" is killed + * @param projectile the arrow entity + */ + public static void stickArrowIn(Entity hit, ItemStack arrow, Entity projectile) { + if (!shouldArrowStick(projectile)) { + return; + } + NBTTagCompound nbt = hit.getEntityData(); + + int slot = 0; + if (nbt.hasKey("stuckArrowCountMF")) { + slot = hit.getEntityData().getInteger("stuckArrowCountMF"); + } + + NBTTagCompound stuckArrow = new NBTTagCompound();// makes the arrow instance + arrow.writeToNBT(stuckArrow);// put arrow in instance + + nbt.setTag("StuckArrowMF" + slot, stuckArrow);// save arrow list + nbt.setInteger("stuckArrowCountMF", slot + 1);// Slot increases + } + + /** + * Gets the arrow dropped when an enemy is killed. MODS NEED TO ADD THEIR OWN + * SUPPORT + * + * @param arrow the arrow fired + */ + public static ItemStack getDroppedArrow(Entity arrow) { + if (arrow instanceof IArrowRetrieve)// implement this method in your entity arrow classes + { + return ((IArrowRetrieve) arrow).getDroppedItem(); + } + if (arrow.getEntityData().hasKey("MF_ArrowItem")) { + NBTTagCompound heldArrow = arrow.getEntityData().getCompoundTag("MF_ArrowItem"); + return ItemStack.loadItemStackFromNBT(heldArrow); + } + return new ItemStack(Items.arrow); + } + + /** + * Gets if an arrow entity will drop items when the enemy is killed. + * + * @param projectile the arrow entity fired + */ + public static boolean shouldArrowStick(Entity projectile) { + if (projectile instanceof IArrowRetrieve) { + return ((IArrowRetrieve) projectile).canBePickedUp(); + } + if (projectile instanceof EntityArrow) { + return ((EntityArrow) projectile).canBePickedUp == 1; + } + return true; + } + + /** + * Gets the list of items that arrows have stuck in from the "stickArrowIn" + * method; THIS IS ONLY CALLED BY LIVING ENTITIES + * + * @param entity the entity killed + */ + public static List getStuckArrows(Entity entity) { + List arrows = new ArrayList(); + NBTTagCompound nbt = entity.getEntityData(); + + int arrowCount = 0; + if (nbt.hasKey("stuckArrowCountMF")) { + arrowCount = entity.getEntityData().getInteger("stuckArrowCountMF"); + } - /** - * Gets the list of items that arrows have stuck in from the "stickArrowIn" method; - * THIS IS ONLY CALLED BY LIVING ENTITIES - * @param entity the entity killed - */ - public static List getStuckArrows(Entity entity) - { - List arrows = new ArrayList(); - NBTTagCompound nbt = entity.getEntityData(); - - int arrowCount = 0; - if(nbt.hasKey("stuckArrowCountMF")) - { - arrowCount = entity.getEntityData().getInteger("stuckArrowCountMF"); - } - - if(arrowCount > 0) - { - for(int a = 0; a < arrowCount; a ++) - { - NBTTagCompound stuckArrow = (NBTTagCompound) nbt.getTag("StuckArrowMF"+a); - if(stuckArrow != null) - { - arrows.add(ItemStack.loadItemStackFromNBT(stuckArrow)); - } - } - } - return arrows; - } + if (arrowCount > 0) { + for (int a = 0; a < arrowCount; a++) { + NBTTagCompound stuckArrow = (NBTTagCompound) nbt.getTag("StuckArrowMF" + a); + if (stuckArrow != null) { + arrows.add(ItemStack.loadItemStackFromNBT(stuckArrow)); + } + } + } + return arrows; + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/BlockPositionHelper.java b/src/main/java/minefantasy/mf2/api/helpers/BlockPositionHelper.java index 7749a573..568ab60a 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/BlockPositionHelper.java +++ b/src/main/java/minefantasy/mf2/api/helpers/BlockPositionHelper.java @@ -1,96 +1,89 @@ package minefantasy.mf2.api.helpers; -import net.minecraft.util.MathHelper; import net.minecraftforge.common.util.ForgeDirection; -public class BlockPositionHelper -{ - //private static ForgeDirection[] FD = new ForgeDirection[]{ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.NORTH, ForgeDirection.EAST}; +public class BlockPositionHelper { + // private static ForgeDirection[] FD = new + // ForgeDirection[]{ForgeDirection.SOUTH, ForgeDirection.WEST, + // ForgeDirection.NORTH, ForgeDirection.EAST}; - /** - * Gets the Grid slot in relation to mouse click - * @param clickX the area clicked on X (called in blockActivated) - * @param clickY the area clicked on Y (called in blockActivated) - * @param xBound the x boundry of the block - * @param xBound2 the x max boundry of the block - * @param yBound the y boundry of the block - * @param yBound2 the y max boundry of the block - * @param xSlots the slot count x - * @param ySlots the slot count y - * @param direction the direction the block is facing - */ - public static int[] getCoordsFor(float clickX, float clickY, float xBound, float xBound2, float yBound, float yBound2, int xSlots, int ySlots, int direction) - { - if(clickX < xBound || clickX > xBound2 || clickY < yBound || clickY > yBound2) - { - return null; - } - - clickX -= xBound; - clickY -= yBound; - - float xMax = xBound2 - xBound; - float yMax = yBound2 - yBound; - - int xSlot = 0; - int ySlot = 0; - - float xSpace = xMax / (float)xSlots; - float ySpace = yMax / (float)ySlots; - - for(int xT = 0; xT < xSlots; xT ++) - { - float MinSpace = xSpace * xT; - float MaxSpace = xSpace * (xT+1); - if(clickX < MaxSpace && clickX > MinSpace) - { - xSlot = xT; - } - } - - for(int yT = 0; yT < ySlots; yT ++) - { - float MinSpace = ySpace * yT; - float MaxSpace = ySpace * (yT+1); - if(clickY < MaxSpace && clickY > MinSpace) - { - ySlot = yT; - } - } - return translateCoords(xSlot, ySlot, xSlots, ySlots, direction); - } - - /** - * Translates the coords on angles (NORTH is default) - * @param x the slot x - * @param y the slot y - * @param maxX the slot count x - * @param maxY the slot count y - * @param dir the facing direction - */ - public static int[] translateCoords(int x, int y, int maxX, int maxY, int direction) - { - ForgeDirection dir = ForgeDirection.getOrientation(direction); - if(dir == ForgeDirection.NORTH) - { - int newX = (maxX - x - 1); - int newY = (maxY - y - 1); - return new int[]{newX, newY}; - } - - if(dir == ForgeDirection.WEST) - { - int newX = (y); - int newY = (maxX - x - 1); - return new int[]{newX, newY}; - } - if(dir == ForgeDirection.EAST) - { - int newY = (x); - int newX = (maxY - y - 1); - return new int[]{newX, newY}; - } - - return new int[]{x, y}; - } + /** + * Gets the Grid slot in relation to mouse click + * + * @param clickX the area clicked on X (called in blockActivated) + * @param clickY the area clicked on Y (called in blockActivated) + * @param xBound the x boundry of the block + * @param xBound2 the x max boundry of the block + * @param yBound the y boundry of the block + * @param yBound2 the y max boundry of the block + * @param xSlots the slot count x + * @param ySlots the slot count y + * @param direction the direction the block is facing + */ + public static int[] getCoordsFor(float clickX, float clickY, float xBound, float xBound2, float yBound, + float yBound2, int xSlots, int ySlots, int direction) { + if (clickX < xBound || clickX > xBound2 || clickY < yBound || clickY > yBound2) { + return null; + } + + clickX -= xBound; + clickY -= yBound; + + float xMax = xBound2 - xBound; + float yMax = yBound2 - yBound; + + int xSlot = 0; + int ySlot = 0; + + float xSpace = xMax / xSlots; + float ySpace = yMax / ySlots; + + for (int xT = 0; xT < xSlots; xT++) { + float MinSpace = xSpace * xT; + float MaxSpace = xSpace * (xT + 1); + if (clickX < MaxSpace && clickX > MinSpace) { + xSlot = xT; + } + } + + for (int yT = 0; yT < ySlots; yT++) { + float MinSpace = ySpace * yT; + float MaxSpace = ySpace * (yT + 1); + if (clickY < MaxSpace && clickY > MinSpace) { + ySlot = yT; + } + } + return translateCoords(xSlot, ySlot, xSlots, ySlots, direction); + } + + /** + * Translates the coords on angles (NORTH is default) + * + * @param x the slot x + * @param y the slot y + * @param maxX the slot count x + * @param maxY the slot count y + * @param dir the facing direction + */ + public static int[] translateCoords(int x, int y, int maxX, int maxY, int direction) { + ForgeDirection dir = ForgeDirection.getOrientation(direction); + if (dir == ForgeDirection.NORTH) { + int newX = (maxX - x - 1); + int newY = (maxY - y - 1); + return new int[]{newX, newY}; + } + + if (dir == ForgeDirection.WEST) { + int newX = (y); + int newY = (maxX - x - 1); + return new int[]{newX, newY}; + } + if (dir == ForgeDirection.EAST) { + int newY = (x); + int newX = (maxY - y - 1); + return new int[]{newX, newY}; + } + + return new int[]{x, y}; + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/ClientTickHandler.java b/src/main/java/minefantasy/mf2/api/helpers/ClientTickHandler.java index c975cd80..8874327f 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/ClientTickHandler.java +++ b/src/main/java/minefantasy/mf2/api/helpers/ClientTickHandler.java @@ -1,47 +1,37 @@ package minefantasy.mf2.api.helpers; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; public class ClientTickHandler { - public static int pageFlipTicks = 0; - public static int ticksInGame = 0; - public static float partialTicks = 0; - - @SubscribeEvent - public void renderTickStart(RenderTickEvent event) - { - if(event.phase == Phase.START) - partialTicks = event.renderTickTime; - } - - @SubscribeEvent - public void clientTickEnd(ClientTickEvent event) - { - if(event.phase == Phase.END) - { - GuiScreen gui = Minecraft.getMinecraft().currentScreen; - if(gui == null || !gui.doesGuiPauseGame()) - { - ticksInGame++; - } - } - } - - public static void notifyPageChange() { - if(pageFlipTicks == 0) - pageFlipTicks = 5; - } + public static int pageFlipTicks = 0; + public static int ticksInGame = 0; + public static float partialTicks = 0; + + public static void notifyPageChange() { + if (pageFlipTicks == 0) + pageFlipTicks = 5; + } + + @SubscribeEvent + public void renderTickStart(RenderTickEvent event) { + if (event.phase == Phase.START) + partialTicks = event.renderTickTime; + } + + @SubscribeEvent + public void clientTickEnd(ClientTickEvent event) { + if (event.phase == Phase.END) { + GuiScreen gui = Minecraft.getMinecraft().currentScreen; + if (gui == null || !gui.doesGuiPauseGame()) { + ticksInGame++; + } + } + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/CustomToolHelper.java b/src/main/java/minefantasy/mf2/api/helpers/CustomToolHelper.java index 40a2d938..c8f230e4 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/CustomToolHelper.java +++ b/src/main/java/minefantasy/mf2/api/helpers/CustomToolHelper.java @@ -1,7 +1,5 @@ package minefantasy.mf2.api.helpers; -import java.util.List; - import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -18,583 +16,524 @@ import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; -public class CustomToolHelper -{ - public static final String slot_main = "main_metal"; - public static final String slot_haft = "haft_wood"; - /** - * A bit of the new system, gets custom materials for the head - */ - public static CustomMaterial getCustomPrimaryMaterial(ItemStack item) - { - if(item == null)return null; - - CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_main); - if(material != null) - { - return material; - } - return null; - } - public static CustomMaterial getCustomSecondaryMaterial(ItemStack item) - { - if(item == null)return null; - - CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_haft); - if(material != null) - { - return material; - } - return null; - } - - public static ItemStack construct(Item base, String main) - { - return construct(base,main,"OakWood"); - } - - public static ItemStack construct(Item base, String main, String haft) - { - ItemStack item = new ItemStack(base); - CustomMaterial.addMaterial(item, slot_main, main.toLowerCase()); - if(haft != null) - { - CustomMaterial.addMaterial(item, slot_haft, haft.toLowerCase()); - } - return item; - } - - public static ItemStack constructSingleColoredLayer(Item base, String main) - { - return constructSingleColoredLayer(base, main, 1); - } - public static ItemStack constructSingleColoredLayer(Item base, String main, int stacksize) - { - ItemStack item = new ItemStack(base, stacksize); - CustomMaterial.addMaterial(item, slot_main, main.toLowerCase()); - return item; - } - /** - * Gets the rarity for a custom item - * @param itemRarity is the default id - */ - public static EnumRarity getRarity(ItemStack item, int itemRarity) - { - int lvl = itemRarity+1; - CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_main); - if(material != null) - { - lvl = material.rarityID+1; - } - - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= rarity.length) - { - lvl = rarity.length-1; - } - return rarity[lvl]; - } - public static EnumRarity poor = EnumHelper.addRarity("Poor", EnumChatFormatting.DARK_GRAY, "poor"); - public static EnumRarity[] rarity = new EnumRarity[]{poor, EnumRarity.common, EnumRarity.uncommon, EnumRarity.rare, EnumRarity.epic}; - /** - * Gets the max durability - * @param dura is the default dura - */ - public static int getMaxDamage(ItemStack stack, int dura) - { - CustomMaterial head = getCustomPrimaryMaterial(stack); - CustomMaterial haft = getCustomSecondaryMaterial(stack); - if(head != null) - { - dura = (int)(head.durability * 100); - } - if(haft != null) - { - dura += (int)(haft.durability * 100);//Hafts add 50% to the durability - } - return ToolHelper.setDuraOnQuality(stack, dura); - } - - /** - * Gets the colour for a layer - * @param base is default colour - * 0 is base - * 1 is haft - * 2 is detail - */ - public static int getColourFromItemStack(ItemStack item, int layer, int base) - { - if(layer == 0) - { - CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_main); - if(material != null) - { - return material.getColourInt(); - } - } - if(layer == 1) - { - CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_haft); - if(material != null) - { - return material.getColourInt(); - } - } - return base; - } - - public static float getWeightModifier(ItemStack item, float base) - { - CustomMaterial metal = getCustomPrimaryMaterial(item); - CustomMaterial wood = getCustomSecondaryMaterial(item); - - if(metal != null) - { - base = (metal.density/2.5F) * base; - } - if(wood != null) - { - base += (wood.density/2.5F); - } - return base; - } - - /** - * Gets the material modifier if it exists - * @param defaultModifier default if no material exists - */ - public static float getMeleeDamage(ItemStack item, float defaultModifier) - { - CustomMaterial custom = getCustomPrimaryMaterial(item); - if(custom != null) - { - return custom.sharpness; - } - return defaultModifier; - } - public static float getBowDamage(ItemStack item, float defaultModifier) - { - CustomMaterial base = getCustomSecondaryMaterial(item); - CustomMaterial joints = getCustomPrimaryMaterial(item); - - if(base != null) - { - defaultModifier = base.flexibility; - } - if(joints != null) - { - defaultModifier *= joints.flexibility; - } - return defaultModifier; - } - /** - * The total damage of a bow and arrow - */ - public static float getBaseDamages(ItemStack item, float defaultModifier) - { - CustomMaterial custom = getCustomPrimaryMaterial(item); - if(custom != null) - { - return getBaseDamage(custom.sharpness*custom.flexibility); - } - return getBaseDamage(defaultModifier); - } - /** - * The damage a bow and arrow should do (same as a sword) - */ - public static float getBaseDamage(float modifier) - { - return 4F + modifier; - } - - public static float getEfficiencyForHds(ItemStack item, float value, float mod) - { - CustomMaterial custom = getCustomPrimaryMaterial(item); - if(custom != null) - { - value = 2.0F + (custom.hardness*4F);//Efficiency starts at 2 and each point of sharpness adds 2 - } - return ToolHelper.modifyDigOnQuality(item, value) * mod; - } - - public static float getEfficiency(ItemStack item, float value, float mod) - { - CustomMaterial custom = getCustomPrimaryMaterial(item); - if(custom != null) - { - value = 2.0F + (custom.sharpness*2F);//Efficiency starts at 2 and each point of sharpness adds 2 - } - return ToolHelper.modifyDigOnQuality(item, value) * mod; - } - - public static int getCrafterTier(ItemStack item, int value) - { - CustomMaterial custom = getCustomPrimaryMaterial(item); - if(custom != null) - { - return custom.crafterTier; - } - return value; - } - - public static int getHarvestLevel(ItemStack item, int value) - { - if(value <= 0) - { - return value;//If its not effective - } - - CustomMaterial custom = getCustomPrimaryMaterial(item); - if(custom != null) - { - if(custom.tier == 0)return 1; - if(custom.tier <= 2)return 2; - return Math.max(custom.tier, 2); - } - return value; - } - - @SideOnly(Side.CLIENT) - public static void addInformation(ItemStack item, List list) - { - CustomMaterial haft = getCustomSecondaryMaterial(item); - - if(materialOnTooltip()) - { - CustomMaterial main = getCustomPrimaryMaterial(item); - if(main != null) - { - String matName = StatCollector.translateToLocal(StatCollector.translateToLocal("material."+main.name.toLowerCase() + ".name")); - list.add(EnumChatFormatting.GOLD + matName); - } - } - - if(haft != null) - { - String matName = StatCollector.translateToLocalFormatted("item.mod_haft.name", StatCollector.translateToLocal("material."+haft.name.toLowerCase() + ".name")); - list.add(EnumChatFormatting.GOLD + matName); - } - - } - - /** - * Gets if the language puts tiers in the tooltip, leaving the name blank - * @return - */ - public static boolean materialOnTooltip() - { - String cfg = StatCollector.translateToLocal("languagecfg.tooltiptier"); - return cfg.equalsIgnoreCase("true"); - } - @SideOnly(Side.CLIENT) - public static void addBowInformation(ItemStack item, List list) - { - - CustomMaterial metals = getCustomPrimaryMaterial(item); - if(metals != null) - { - String matName = StatCollector.translateToLocalFormatted("item.mod_joint.name", StatCollector.translateToLocal("material."+metals.name.toLowerCase() + ".name")); - list.add(EnumChatFormatting.GOLD + matName); - } - - } - - public static String getWoodenLocalisedName(ItemStack item, String unlocalName) - { - if(materialOnTooltip()) - { - StatCollector.translateToLocal(unlocalName); - } - - CustomMaterial base = getCustomSecondaryMaterial(item); - String name = "any"; - if(base != null) - { - name = base.name.toLowerCase(); - } - return StatCollector.translateToLocalFormatted(unlocalName, StatCollector.translateToLocal("material."+name + ".name")); - } - - public static String getLocalisedName(ItemStack item, String unlocalName) - { - if(materialOnTooltip()) - { - StatCollector.translateToLocal(unlocalName); - } - - CustomMaterial base = getCustomPrimaryMaterial(item); - String name = "any"; - if(base != null) - { - name = base.name.toLowerCase(); - } - return StatCollector.translateToLocalFormatted(unlocalName, StatCollector.translateToLocal("material."+name + ".name")); - } - public static boolean areEqual(ItemStack recipeItem, ItemStack inputItem) - { - if(recipeItem == null) - { - return inputItem == null; - } - if(inputItem == null)return false; - - return recipeItem.isItemEqual(inputItem) && doesMainMatchForRecipe(recipeItem, inputItem) && doesHaftMatchForRecipe(recipeItem, inputItem); - } - /** - * Checks if two items' materials match - */ - public static boolean doesMatchForRecipe(ItemStack recipeItem, ItemStack inputItem) - { - return doesMainMatchForRecipe(recipeItem, inputItem) && doesHaftMatchForRecipe(recipeItem, inputItem); - } - public static boolean doesMainMatchForRecipe(ItemStack recipeItem, ItemStack inputItem) - { - CustomMaterial recipeMat = CustomToolHelper.getCustomPrimaryMaterial(recipeItem); +import java.util.List; + +public class CustomToolHelper { + public static final String slot_main = "main_metal"; + public static final String slot_haft = "haft_wood"; + public static EnumRarity poor = EnumHelper.addRarity("Poor", EnumChatFormatting.DARK_GRAY, "poor"); + public static EnumRarity[] rarity = new EnumRarity[]{poor, EnumRarity.common, EnumRarity.uncommon, + EnumRarity.rare, EnumRarity.epic}; + + /** + * A bit of the new system, gets custom materials for the head + */ + public static CustomMaterial getCustomPrimaryMaterial(ItemStack item) { + if (item == null) + return null; + + CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_main); + if (material != null) { + return material; + } + return null; + } + + public static CustomMaterial getCustomSecondaryMaterial(ItemStack item) { + if (item == null) + return null; + + CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_haft); + if (material != null) { + return material; + } + return null; + } + + public static ItemStack construct(Item base, String main) { + return construct(base, main, "OakWood"); + } + + public static ItemStack construct(Item base, String main, String haft) { + ItemStack item = new ItemStack(base); + CustomMaterial.addMaterial(item, slot_main, main.toLowerCase()); + if (haft != null) { + CustomMaterial.addMaterial(item, slot_haft, haft.toLowerCase()); + } + return item; + } + + public static ItemStack constructSingleColoredLayer(Item base, String main) { + return constructSingleColoredLayer(base, main, 1); + } + + public static ItemStack constructSingleColoredLayer(Item base, String main, int stacksize) { + ItemStack item = new ItemStack(base, stacksize); + CustomMaterial.addMaterial(item, slot_main, main.toLowerCase()); + return item; + } + + /** + * Gets the rarity for a custom item + * + * @param itemRarity is the default id + */ + public static EnumRarity getRarity(ItemStack item, int itemRarity) { + int lvl = itemRarity + 1; + CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_main); + if (material != null) { + lvl = material.rarityID + 1; + } + + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (lvl >= rarity.length) { + lvl = rarity.length - 1; + } + return rarity[lvl]; + } + + /** + * Gets the max durability + * + * @param dura is the default dura + */ + public static int getMaxDamage(ItemStack stack, int dura) { + CustomMaterial head = getCustomPrimaryMaterial(stack); + CustomMaterial haft = getCustomSecondaryMaterial(stack); + if (head != null) { + dura = (int) (head.durability * 100); + } + if (haft != null) { + dura += (int) (haft.durability * 100);// Hafts add 50% to the durability + } + return ToolHelper.setDuraOnQuality(stack, dura); + } + + /** + * Gets the colour for a layer + * + * @param base is default colour 0 is base 1 is haft 2 is detail + */ + public static int getColourFromItemStack(ItemStack item, int layer, int base) { + if (layer == 0) { + CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_main); + if (material != null) { + return material.getColourInt(); + } + } + if (layer == 1) { + CustomMaterial material = CustomMaterial.getMaterialFor(item, slot_haft); + if (material != null) { + return material.getColourInt(); + } + } + return base; + } + + public static float getWeightModifier(ItemStack item, float base) { + CustomMaterial metal = getCustomPrimaryMaterial(item); + CustomMaterial wood = getCustomSecondaryMaterial(item); + + if (metal != null) { + base = (metal.density / 2.5F) * base; + } + if (wood != null) { + base += (wood.density / 2.5F); + } + return base; + } + + /** + * Gets the material modifier if it exists + * + * @param defaultModifier default if no material exists + */ + public static float getMeleeDamage(ItemStack item, float defaultModifier) { + CustomMaterial custom = getCustomPrimaryMaterial(item); + if (custom != null) { + return custom.sharpness; + } + return defaultModifier; + } + + public static float getBowDamage(ItemStack item, float defaultModifier) { + CustomMaterial base = getCustomSecondaryMaterial(item); + CustomMaterial joints = getCustomPrimaryMaterial(item); + + if (base != null) { + defaultModifier = base.flexibility; + } + if (joints != null) { + defaultModifier *= joints.flexibility; + } + return defaultModifier; + } + + /** + * The total damage of a bow and arrow + */ + public static float getBaseDamages(ItemStack item, float defaultModifier) { + CustomMaterial custom = getCustomPrimaryMaterial(item); + if (custom != null) { + return getBaseDamage(custom.sharpness * custom.flexibility); + } + return getBaseDamage(defaultModifier); + } + + /** + * The damage a bow and arrow should do (same as a sword) + */ + public static float getBaseDamage(float modifier) { + return 4F + modifier; + } + + public static float getEfficiencyForHds(ItemStack item, float value, float mod) { + CustomMaterial custom = getCustomPrimaryMaterial(item); + if (custom != null) { + value = 2.0F + (custom.hardness * 4F);// Efficiency starts at 2 and each point of sharpness adds 2 + } + return ToolHelper.modifyDigOnQuality(item, value) * mod; + } + + public static float getEfficiency(ItemStack item, float value, float mod) { + CustomMaterial custom = getCustomPrimaryMaterial(item); + if (custom != null) { + value = 2.0F + (custom.sharpness * 2F);// Efficiency starts at 2 and each point of sharpness adds 2 + } + return ToolHelper.modifyDigOnQuality(item, value) * mod; + } + + public static int getCrafterTier(ItemStack item, int value) { + CustomMaterial custom = getCustomPrimaryMaterial(item); + if (custom != null) { + return custom.crafterTier; + } + return value; + } + + public static int getHarvestLevel(ItemStack item, int value) { + if (value <= 0) { + return value;// If its not effective + } + + CustomMaterial custom = getCustomPrimaryMaterial(item); + if (custom != null) { + if (custom.tier == 0) + return 1; + if (custom.tier <= 2) + return 2; + return Math.max(custom.tier, 2); + } + return value; + } + + @SideOnly(Side.CLIENT) + public static void addInformation(ItemStack item, List list) { + CustomMaterial haft = getCustomSecondaryMaterial(item); + + if (materialOnTooltip()) { + CustomMaterial main = getCustomPrimaryMaterial(item); + if (main != null) { + String matName = StatCollector.translateToLocal( + StatCollector.translateToLocal("material." + main.name.toLowerCase() + ".name")); + list.add(EnumChatFormatting.GOLD + matName); + } + } + + if (haft != null) { + String matName = StatCollector.translateToLocalFormatted("item.mod_haft.name", + StatCollector.translateToLocal("material." + haft.name.toLowerCase() + ".name")); + list.add(EnumChatFormatting.GOLD + matName); + } + + } + + /** + * Gets if the language puts tiers in the tooltip, leaving the name blank + * + * @return + */ + public static boolean materialOnTooltip() { + String cfg = StatCollector.translateToLocal("languagecfg.tooltiptier"); + return cfg.equalsIgnoreCase("true"); + } + + @SideOnly(Side.CLIENT) + public static void addBowInformation(ItemStack item, List list) { + + CustomMaterial metals = getCustomPrimaryMaterial(item); + if (metals != null) { + String matName = StatCollector.translateToLocalFormatted("item.mod_joint.name", + StatCollector.translateToLocal("material." + metals.name.toLowerCase() + ".name")); + list.add(EnumChatFormatting.GOLD + matName); + } + + } + + public static String getWoodenLocalisedName(ItemStack item, String unlocalName) { + if (materialOnTooltip()) { + StatCollector.translateToLocal(unlocalName); + } + + CustomMaterial base = getCustomSecondaryMaterial(item); + String name = "any"; + if (base != null) { + name = base.name.toLowerCase(); + } + return StatCollector.translateToLocalFormatted(unlocalName, + StatCollector.translateToLocal("material." + name + ".name")); + } + + public static String getLocalisedName(ItemStack item, String unlocalName) { + if (materialOnTooltip()) { + StatCollector.translateToLocal(unlocalName); + } + + CustomMaterial base = getCustomPrimaryMaterial(item); + String name = "any"; + if (base != null) { + name = base.name.toLowerCase(); + } + return StatCollector.translateToLocalFormatted(unlocalName, + StatCollector.translateToLocal("material." + name + ".name")); + } + + public static boolean areEqual(ItemStack recipeItem, ItemStack inputItem) { + if (recipeItem == null) { + return inputItem == null; + } + if (inputItem == null) + return false; + + return recipeItem.isItemEqual(inputItem) && doesMainMatchForRecipe(recipeItem, inputItem) + && doesHaftMatchForRecipe(recipeItem, inputItem); + } + + /** + * Checks if two items' materials match + */ + public static boolean doesMatchForRecipe(ItemStack recipeItem, ItemStack inputItem) { + return doesMainMatchForRecipe(recipeItem, inputItem) && doesHaftMatchForRecipe(recipeItem, inputItem); + } + + public static boolean doesMainMatchForRecipe(ItemStack recipeItem, ItemStack inputItem) { + CustomMaterial recipeMat = CustomToolHelper.getCustomPrimaryMaterial(recipeItem); CustomMaterial inputMat = CustomToolHelper.getCustomPrimaryMaterial(inputItem); - - if(recipeMat == null) - { - return true; - } - - if (inputMat == null && recipeMat != null) - { + + if (recipeMat == null) { + return true; + } + + if (inputMat == null && recipeMat != null) { return false; } - if(recipeMat != inputMat) - { - return false; - } - return true; - } - public static boolean doesHaftMatchForRecipe(ItemStack recipeItem, ItemStack inputItem) - { - CustomMaterial recipeMat = CustomToolHelper.getCustomSecondaryMaterial(recipeItem); + if (recipeMat != inputMat) { + return false; + } + return true; + } + + public static boolean doesHaftMatchForRecipe(ItemStack recipeItem, ItemStack inputItem) { + CustomMaterial recipeMat = CustomToolHelper.getCustomSecondaryMaterial(recipeItem); CustomMaterial inputMat = CustomToolHelper.getCustomSecondaryMaterial(inputItem); - - if(recipeMat == null) - { - return true; - } - - if (inputMat == null && recipeMat != null) - { + + if (recipeMat == null) { + return true; + } + + if (inputMat == null && recipeMat != null) { + return false; + } + if (recipeMat != inputMat) { + return false; + } + return true; + } + + public static void addComponentString(ItemStack tool, List list, CustomMaterial base) { + addComponentString(tool, list, base, 1); + } + + public static void addComponentString(ItemStack tool, List list, CustomMaterial base, float units) { + if (base != null) { + float mass = base.density * units; + list.add(EnumChatFormatting.GOLD + base.getMaterialString()); + if (mass > 0) + list.add(CustomMaterial.getWeightString(mass)); + + if (base.isHeatable()) { + int maxTemp = base.getHeatableStats()[0]; + int beyondMax = base.getHeatableStats()[1]; + list.add(StatCollector.translateToLocalFormatted("materialtype.workable.name", maxTemp, beyondMax)); + } + } + } + + public static float getBurnModifier(ItemStack fuel) { + CustomMaterial mat = CustomMaterial.getMaterialFor(fuel, slot_main); + if (mat != null && mat.type.equalsIgnoreCase("wood")) { + return (2 * mat.density) + 0.5F; + } + return 1.0F; + } + + public static String getReferenceName(ItemStack item) { + String dam = "any"; + int d = item.getItemDamage(); + if (d != OreDictionary.WILDCARD_VALUE) { + dam = "" + d; + } + + return getReferenceName(item, dam); + } + + public static String getReferenceName(ItemStack item, String dam) { + return getReferenceName(item, dam, true); + } + + public static String getReferenceName(ItemStack item, String dam, boolean tiered) { + String reference = getSimpleReferenceName(item.getItem(), dam); + + if (tiered) { + CustomMaterial base = getCustomPrimaryMaterial(item); + CustomMaterial haft = getCustomSecondaryMaterial(item); + + if (base != null) { + reference += "_" + base.name.toLowerCase(); + } + if (haft != null) { + reference += "_" + haft.name.toLowerCase(); + } + } + + return reference; + } + + public static String getSimpleReferenceName(Item item, String dam) { + String reference = Item.itemRegistry.getNameForObject(item).toLowerCase() + "_@" + dam; + return reference; + } + + public static String getSimpleReferenceName(Item item) { + return getSimpleReferenceName(item, "any"); + } + + public static boolean areToolsSame(ItemStack item1, ItemStack item2) { + CustomMaterial main1 = getCustomPrimaryMaterial(item1); + CustomMaterial main2 = getCustomSecondaryMaterial(item2); + CustomMaterial haft1 = getCustomPrimaryMaterial(item1); + CustomMaterial haft2 = getCustomSecondaryMaterial(item2); + if ((main1 == null && main2 != null) || (main2 == null && main1 != null)) + return false; + if ((haft1 == null && haft2 != null) || (haft2 == null && haft1 != null)) + return false; + + if (main1 != null && main2 != null && main1 != main2) return false; + if (haft1 != null && haft2 != null && haft1 != haft2) + return false; + + return true; + } + + public static boolean isMythic(ItemStack result) { + CustomMaterial main1 = getCustomPrimaryMaterial(result); + CustomMaterial haft1 = getCustomPrimaryMaterial(result); + if (main1 != null && main1.isUnbrekable()) { + return true; + } + if (haft1 != null && haft1.isUnbrekable()) { + return true; + } + return false; + } + + public static void writeToPacket(ByteBuf packet, ItemStack stack) { + packet.writeInt(stack != null ? Item.getIdFromItem(stack.getItem()) : 0); + packet.writeInt(stack != null ? stack.stackSize : 0); + packet.writeInt(stack != null ? stack.getItemDamage() : 0); + packet.writeInt((stack != null && stack.isItemEnchanted()) ? 1 : 0); + + CustomMaterial main1 = getCustomPrimaryMaterial(stack); + CustomMaterial haft1 = getCustomSecondaryMaterial(stack); + + ByteBufUtils.writeUTF8String(packet, main1 != null ? main1.name : "null"); + ByteBufUtils.writeUTF8String(packet, haft1 != null ? haft1.name : "null"); + } + + public static ItemStack readFromPacket(ByteBuf packet) { + int id = packet.readInt(); + int ss = packet.readInt(); + int md = packet.readInt(); + boolean ec = packet.readInt() == 1; + String main1 = ByteBufUtils.readUTF8String(packet); + String haft1 = ByteBufUtils.readUTF8String(packet); + Item item = Item.getItemById(id); + + if (item != null && ss > 0) { + ItemStack stack = new ItemStack(item, ss, md); + if (!main1.equalsIgnoreCase("null")) { + CustomMaterial.addMaterial(stack, slot_main, main1); + } + if (!haft1.equalsIgnoreCase("null")) { + CustomMaterial.addMaterial(stack, slot_haft, haft1); + } + return stack; + } + + return null; + } + + public static String getComponentMaterial(ItemStack item, String type) { + if (item == null || type == null) + return null; + + if (item.getItem() instanceof ItemHeated) { + return getComponentMaterial(ItemHeated.getItem(item), type); + } + + CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); + if (material != null) { + return material.type.equalsIgnoreCase(type) ? material.name : null; + } + return null; + } + + public static boolean hasAnyMaterial(ItemStack item) { + return getCustomPrimaryMaterial(item) != null || getCustomSecondaryMaterial(item) != null; + } + + public static ItemStack tryDeconstruct(ItemStack newitem, ItemStack mainItem) { + String type = null; + if (newitem != null && newitem.getItem() instanceof ITieredComponent) { + type = ((ITieredComponent) newitem.getItem()).getMaterialType(newitem); + } + + if (type != null) { + CustomMaterial primary = CustomToolHelper.getCustomPrimaryMaterial(mainItem); + CustomMaterial secondary = CustomToolHelper.getCustomSecondaryMaterial(mainItem); + + if (primary != null && primary.type.equalsIgnoreCase(type)) { + CustomMaterial.addMaterial(newitem, slot_main, primary.name); + } else { + if (secondary != null && secondary.type.equalsIgnoreCase(type)) { + CustomMaterial.addMaterial(newitem, slot_main, secondary.name); + } + } } - if(recipeMat != inputMat) - { - return false; - } - return true; - } - public static void addComponentString(ItemStack tool, List list, CustomMaterial base) - { - addComponentString(tool, list, base, 1); - } - public static void addComponentString(ItemStack tool, List list, CustomMaterial base, float units) - { - if(base != null) - { - float mass = base.density * units; - list.add(EnumChatFormatting.GOLD + base.getMaterialString()); - if(mass > 0) - list.add(CustomMaterial.getWeightString(mass)); - - if(base.isHeatable()) - { - int maxTemp = base.getHeatableStats()[0]; - int beyondMax = base.getHeatableStats()[1]; - list.add(StatCollector.translateToLocalFormatted("materialtype.workable.name", maxTemp, beyondMax)); - } - } - } - public static float getBurnModifier(ItemStack fuel) - { - CustomMaterial mat = CustomMaterial.getMaterialFor(fuel, slot_main); - if(mat != null && mat.type.equalsIgnoreCase("wood")) - { - return (2*mat.density) + 0.5F; - } - return 1.0F; - } - public static String getReferenceName(ItemStack item) - { - String dam = "any"; - int d = item.getItemDamage(); - if(d != OreDictionary.WILDCARD_VALUE) - { - dam = ""+d; - } - - return getReferenceName(item, dam); - } - - - public static String getReferenceName(ItemStack item, String dam) - { - return getReferenceName(item, dam, true); - } - public static String getReferenceName(ItemStack item, String dam, boolean tiered) - { - String reference = getSimpleReferenceName(item.getItem(), dam); - - if(tiered) - { - CustomMaterial base = getCustomPrimaryMaterial(item); - CustomMaterial haft = getCustomSecondaryMaterial(item); - - if(base != null) - { - reference += "_"+base.name.toLowerCase(); - } - if(haft != null) - { - reference += "_"+haft.name.toLowerCase(); - } - } - - return reference; - } - public static String getSimpleReferenceName(Item item, String dam) - { - String reference = Item.itemRegistry.getNameForObject(item).toLowerCase() + "_@" + dam; - return reference; - } - - public static String getSimpleReferenceName(Item item) - { - return getSimpleReferenceName(item, "any"); - } - - public static boolean areToolsSame(ItemStack item1, ItemStack item2) - { - CustomMaterial main1 = getCustomPrimaryMaterial(item1); - CustomMaterial main2 = getCustomSecondaryMaterial(item2); - CustomMaterial haft1 = getCustomPrimaryMaterial(item1); - CustomMaterial haft2 = getCustomSecondaryMaterial(item2); - if((main1 == null && main2 != null) || (main2 == null && main1 != null))return false; - if((haft1 == null && haft2 != null) || (haft2 == null && haft1 != null))return false; - - if(main1 != null && main2 != null && main1 != main2)return false; - if(haft1 != null && haft2 != null && haft1 != haft2)return false; - - return true; - } - public static boolean isMythic(ItemStack result) - { - CustomMaterial main1 = getCustomPrimaryMaterial(result); - CustomMaterial haft1 = getCustomPrimaryMaterial(result); - if(main1 != null && main1.isUnbrekable()) - { - return true; - } - if(haft1 != null && haft1.isUnbrekable()) - { - return true; - } - return false; - } - public static void writeToPacket(ByteBuf packet, ItemStack stack) - { - packet.writeInt(stack != null ? Item.getIdFromItem(stack.getItem()) : 0); - packet.writeInt(stack != null ? stack.stackSize : 0); - packet.writeInt(stack != null ? stack.getItemDamage() : 0); - packet.writeInt( (stack != null && stack.isItemEnchanted()) ? 1 : 0); - - CustomMaterial main1 = getCustomPrimaryMaterial(stack); - CustomMaterial haft1 = getCustomSecondaryMaterial(stack); - - ByteBufUtils.writeUTF8String(packet, main1 != null ? main1.name : "null"); - ByteBufUtils.writeUTF8String(packet, haft1 != null ? haft1.name : "null"); - } - public static ItemStack readFromPacket(ByteBuf packet) - { - int id = packet.readInt(); - int ss = packet.readInt(); - int md = packet.readInt(); - boolean ec = packet.readInt() == 1; - String main1 = ByteBufUtils.readUTF8String(packet); - String haft1 = ByteBufUtils.readUTF8String(packet); - Item item = Item.getItemById(id); - - if(item != null && ss > 0) - { - ItemStack stack = new ItemStack(item, ss, md); - if(!main1.equalsIgnoreCase("null")) - { - CustomMaterial.addMaterial(stack, slot_main, main1); - } - if(!haft1.equalsIgnoreCase("null")) - { - CustomMaterial.addMaterial(stack, slot_haft, haft1); - } - return stack; - } - - return null; - } - - public static String getComponentMaterial(ItemStack item, String type) - { - if(item == null || type == null) return null; - - if(item.getItem() instanceof ItemHeated) - { - return getComponentMaterial(ItemHeated.getItem(item), type); - } - - CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); - if(material != null) - { - return material.type.equalsIgnoreCase(type) ? material.name : null; - } - return null; - } - public static boolean hasAnyMaterial(ItemStack item) - { - return getCustomPrimaryMaterial(item) != null || getCustomSecondaryMaterial(item) != null; - } - public static ItemStack tryDeconstruct(ItemStack newitem, ItemStack mainItem) - { - String type = null; - if(newitem != null && newitem.getItem() instanceof ITieredComponent) - { - type = ((ITieredComponent)newitem.getItem()).getMaterialType(newitem); - } - - if(type != null) - { - CustomMaterial primary = CustomToolHelper.getCustomPrimaryMaterial(mainItem); - CustomMaterial secondary = CustomToolHelper.getCustomSecondaryMaterial(mainItem); - - if(primary != null && primary.type.equalsIgnoreCase(type)) - { - CustomMaterial.addMaterial(newitem, slot_main, primary.name); - } - else - { - if(secondary != null && secondary.type.equalsIgnoreCase(type)) - { - CustomMaterial.addMaterial(newitem, slot_main, secondary.name); - } - } - } - return newitem; - } - public static String getCustomStyle(ItemStack weapon) - { - if(weapon != null && weapon.getItem() instanceof ISpecialDesign) - { - return ((ISpecialDesign)weapon.getItem()).getDesign(weapon); - } - return null; - } - + return newitem; + } + + public static String getCustomStyle(ItemStack weapon) { + if (weapon != null && weapon.getItem() instanceof ISpecialDesign) { + return ((ISpecialDesign) weapon.getItem()).getDesign(weapon); + } + return null; + } + } diff --git a/src/main/java/minefantasy/mf2/api/helpers/EntityHelper.java b/src/main/java/minefantasy/mf2/api/helpers/EntityHelper.java index 04ac7a2b..14b944de 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/EntityHelper.java +++ b/src/main/java/minefantasy/mf2/api/helpers/EntityHelper.java @@ -3,23 +3,19 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -public class EntityHelper -{ - public static final String MFNBT = "MineFantasy_KeptNBT"; +public class EntityHelper { + public static final String MFNBT = "MineFantasy_KeptNBT"; - public static NBTTagCompound getMFNBT(EntityPlayer player) - { - if(!player.getEntityData().hasKey(MFNBT)) - { - player.getEntityData().setTag(MFNBT, new NBTTagCompound()); - } - return player.getEntityData().getCompoundTag(MFNBT); - } - public static void cloneNBT(EntityPlayer origin, EntityPlayer spawn) - { - if(origin.getEntityData().hasKey(MFNBT)) - { - spawn.getEntityData().setTag(MFNBT, origin.getEntityData().getTag(MFNBT).copy()); - } - } + public static NBTTagCompound getMFNBT(EntityPlayer player) { + if (!player.getEntityData().hasKey(MFNBT)) { + player.getEntityData().setTag(MFNBT, new NBTTagCompound()); + } + return player.getEntityData().getCompoundTag(MFNBT); + } + + public static void cloneNBT(EntityPlayer origin, EntityPlayer spawn) { + if (origin.getEntityData().hasKey(MFNBT)) { + spawn.getEntityData().setTag(MFNBT, origin.getEntityData().getTag(MFNBT).copy()); + } + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/Functions.java b/src/main/java/minefantasy/mf2/api/helpers/Functions.java index 8e741a60..eba06339 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/Functions.java +++ b/src/main/java/minefantasy/mf2/api/helpers/Functions.java @@ -1,31 +1,31 @@ package minefantasy.mf2.api.helpers; -public class Functions -{ - /** - * f(x) = cos(xPi/(f/2))*(m/2) + (m/2) + c - * Create a wave output from c to m and back between x=f - * @param x the running variable - * @param p period: time between waves (in 20ths of seconds) - * @param a amplitude: the max point at f/2 - * @param c constant: the min point at f==0 - */ - public static int getIntervalWave1_i(int x, int p, int a, int c) - { - double fx = Math.cos(x*Math.PI/ (p/2)) * ((a-c)/2) + ((a-c)/2) + c; - return (int)fx; - } - /** - * f(x) = cos(xPi/(f/2))*(m/2) + (m/2) + c - * Create a wave output from c to m and back between x=f - * @param x the running variable - * @param p period: time between waves (in 20ths of seconds) - * @param a amplitude: the max point at f/2 - * @param c constant: the min point at f==0 - */ - public static double getIntervalWave1_d(double x, double p, double a, double c) - { - double fx = Math.cos(x*Math.PI/ (p/2)) * ((a-c)/2) + ((a-c)/2) + c; - return fx; - } +public class Functions { + /** + * f(x) = cos(xPi/(f/2))*(m/2) + (m/2) + c Create a wave output from c to m and + * back between x=f + * + * @param x the running variable + * @param p period: time between waves (in 20ths of seconds) + * @param a amplitude: the max point at f/2 + * @param c constant: the min point at f==0 + */ + public static int getIntervalWave1_i(int x, int p, int a, int c) { + double fx = Math.cos(x * Math.PI / (p / 2)) * ((a - c) / 2) + ((a - c) / 2) + c; + return (int) fx; + } + + /** + * f(x) = cos(xPi/(f/2))*(m/2) + (m/2) + c Create a wave output from c to m and + * back between x=f + * + * @param x the running variable + * @param p period: time between waves (in 20ths of seconds) + * @param a amplitude: the max point at f/2 + * @param c constant: the min point at f==0 + */ + public static double getIntervalWave1_d(double x, double p, double a, double c) { + double fx = Math.cos(x * Math.PI / (p / 2)) * ((a - c) / 2) + ((a - c) / 2) + c; + return fx; + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/GuiHelper.java b/src/main/java/minefantasy/mf2/api/helpers/GuiHelper.java index 05f4bab6..5379a10b 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/GuiHelper.java +++ b/src/main/java/minefantasy/mf2/api/helpers/GuiHelper.java @@ -1,92 +1,77 @@ package minefantasy.mf2.api.helpers; -import org.lwjgl.opengl.GL11; - -import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; +import org.lwjgl.opengl.GL11; + +public class GuiHelper { + private static final Minecraft mc = Minecraft.getMinecraft(); -public class GuiHelper -{ - private static final Minecraft mc = Minecraft.getMinecraft(); - public static void renderToolIcon(Gui screen, String toolType, int tier, int x, int y, boolean available) - { - renderToolIcon(screen, toolType, tier, x, y, false, available); - } - public static void renderToolIcon(Gui screen, String toolType, int tier, int x, int y, boolean outline, boolean available) - { - if(!available) - { - GL11.glColor3f(1.0F, 0.3F, 0.3F); - } - mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/icons.png")); + public static void renderToolIcon(Gui screen, String toolType, int tier, int x, int y, boolean available) { + renderToolIcon(screen, toolType, tier, x, y, false, available); + } + + public static void renderToolIcon(Gui screen, String toolType, int tier, int x, int y, boolean outline, + boolean available) { + if (!available) { + GL11.glColor3f(1.0F, 0.3F, 0.3F); + } + mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/icons.png")); int[] icon = getToolTypeIcon(toolType); screen.drawTexturedModalRect(x, y, outline ? 20 : 0, 0, 20, 20); - screen.drawTexturedModalRect(x, y, icon[0], icon[1]+20, 20, 20); - if(tier > -1) - mc.fontRenderer.drawStringWithShadow(""+tier, x + 4, y + 10, 16777215); + screen.drawTexturedModalRect(x, y, icon[0], icon[1] + 20, 20, 20); + if (tier > -1) + mc.fontRenderer.drawStringWithShadow("" + tier, x + 4, y + 10, 16777215); GL11.glColor3f(1F, 1F, 1F); - } - public static int[] getToolTypeIcon(String s) - { - int width = 20; - int height = 20; - if(s.equalsIgnoreCase("hands")) - { - return new int[]{0, 0}; - } - if(s.equalsIgnoreCase("knife")) - { - return new int[]{width*1, height*0}; - } - if(s.equalsIgnoreCase("saw")) - { - return new int[]{width*2, height*0}; - } - if(s.equalsIgnoreCase("mallet")) - { - return new int[]{width*3, height*0}; - } - if(s.equalsIgnoreCase("needle")) - { - return new int[]{width*4, height*0}; - } - if(s.equalsIgnoreCase("hammer")) - { - return new int[]{width*5, height*0}; - } - if(s.equalsIgnoreCase("hvyHammer")) - { - return new int[]{width*6, height*0}; - } - if(s.equalsIgnoreCase("spoon")) - { - return new int[]{width*7, height*0}; - } - if(s.equalsIgnoreCase("shears")) - { - return new int[]{width*8, height*0}; - } - if(s.equalsIgnoreCase("spanner")) - { - return new int[]{width*9, height*0}; - } - if(s.equalsIgnoreCase("brush")) - { - return new int[]{width*11, height*0}; - } - - if(s.equalsIgnoreCase("anvil")) - { - return new int[]{0, height*2}; - } - if(s.equalsIgnoreCase("carpenter")) - { - return new int[]{width*1, height*2}; - } - return new int[]{0, 0}; - } - public static int getColourForRGB(int red, int green, int blue) { - return (red << 16) + (green << 8) + blue; - } + } + + public static int[] getToolTypeIcon(String s) { + int width = 20; + int height = 20; + if (s.equalsIgnoreCase("hands")) { + return new int[]{0, 0}; + } + if (s.equalsIgnoreCase("knife")) { + return new int[]{width * 1, height * 0}; + } + if (s.equalsIgnoreCase("saw")) { + return new int[]{width * 2, height * 0}; + } + if (s.equalsIgnoreCase("mallet")) { + return new int[]{width * 3, height * 0}; + } + if (s.equalsIgnoreCase("needle")) { + return new int[]{width * 4, height * 0}; + } + if (s.equalsIgnoreCase("hammer")) { + return new int[]{width * 5, height * 0}; + } + if (s.equalsIgnoreCase("hvyHammer")) { + return new int[]{width * 6, height * 0}; + } + if (s.equalsIgnoreCase("spoon")) { + return new int[]{width * 7, height * 0}; + } + if (s.equalsIgnoreCase("shears")) { + return new int[]{width * 8, height * 0}; + } + if (s.equalsIgnoreCase("spanner")) { + return new int[]{width * 9, height * 0}; + } + if (s.equalsIgnoreCase("brush")) { + return new int[]{width * 11, height * 0}; + } + + if (s.equalsIgnoreCase("anvil")) { + return new int[]{0, height * 2}; + } + if (s.equalsIgnoreCase("carpenter")) { + return new int[]{width * 1, height * 2}; + } + return new int[]{0, 0}; + } + + public static int getColourForRGB(int red, int green, int blue) { + return (red << 16) + (green << 8) + blue; + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/PlayerTagData.java b/src/main/java/minefantasy/mf2/api/helpers/PlayerTagData.java index 4b247317..820b32bc 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/PlayerTagData.java +++ b/src/main/java/minefantasy/mf2/api/helpers/PlayerTagData.java @@ -3,32 +3,27 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -public class PlayerTagData -{ - /** - * Saves a custom integer - */ - public static void setPersistedVariable(EntityPlayer user, String name, int lvl) - { - NBTTagCompound nbt = getPersistedData(user); - nbt.setInteger(name, lvl); - } - /** - * Gets a custom integer saved - */ - public static int getPersistedVariable(EntityPlayer user, String name) - { - NBTTagCompound nbt = getPersistedData(user); - return nbt.hasKey(name) ? nbt.getInteger(name) : 0; - } - - - public static NBTTagCompound getPersistedData(EntityPlayer user) - { - if(!user.getEntityData().hasKey(EntityPlayer.PERSISTED_NBT_TAG)) - { - user.getEntityData().setTag(EntityPlayer.PERSISTED_NBT_TAG, new NBTTagCompound()); - } - return (NBTTagCompound) (user.getEntityData().getTag(EntityPlayer.PERSISTED_NBT_TAG)); - } +public class PlayerTagData { + /** + * Saves a custom integer + */ + public static void setPersistedVariable(EntityPlayer user, String name, int lvl) { + NBTTagCompound nbt = getPersistedData(user); + nbt.setInteger(name, lvl); + } + + /** + * Gets a custom integer saved + */ + public static int getPersistedVariable(EntityPlayer user, String name) { + NBTTagCompound nbt = getPersistedData(user); + return nbt.hasKey(name) ? nbt.getInteger(name) : 0; + } + + public static NBTTagCompound getPersistedData(EntityPlayer user) { + if (!user.getEntityData().hasKey(EntityPlayer.PERSISTED_NBT_TAG)) { + user.getEntityData().setTag(EntityPlayer.PERSISTED_NBT_TAG, new NBTTagCompound()); + } + return (NBTTagCompound) (user.getEntityData().getTag(EntityPlayer.PERSISTED_NBT_TAG)); + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/PowerArmour.java b/src/main/java/minefantasy/mf2/api/helpers/PowerArmour.java index 8ad779f0..79fd77f3 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/PowerArmour.java +++ b/src/main/java/minefantasy/mf2/api/helpers/PowerArmour.java @@ -10,85 +10,83 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public class PowerArmour -{ - public static boolean isWearingCogwork(EntityLivingBase user) - { - return user.ridingEntity != null && user.ridingEntity instanceof IPowerArmour; - } - public static boolean isPowered(EntityLivingBase user) - { - if(user.ridingEntity != null && user.ridingEntity instanceof IPowerArmour) - { - return ((IPowerArmour)user.ridingEntity).isPowered(); - } - return false; - } - public static boolean isFullyArmoured(EntityLivingBase user) - { - if(user.ridingEntity != null && user.ridingEntity instanceof IPowerArmour) - { - return ((IPowerArmour)user.ridingEntity).isFullyArmoured(); - } - return false; - } - public static float modifyDamage(EntityLivingBase user, float dam, DamageSource src) - { - if(user.ridingEntity != null) - { - if(user.ridingEntity instanceof IPowerArmour) - { - return ((IPowerArmour)user.ridingEntity).modifyDamage(user, dam, src); - } - } - return dam; - } - public static boolean allowDamageToBlock(DamageSource src) - { - if(src == DamageSource.starve || src == DamageSource.outOfWorld || src == DamageSource.drown) - { - return false; - } - return true; - } - public static float getFuelValue(ItemStack item) - { - ForgeFuel stats = ForgeItemHandler.getStats(item); - if(stats != null && stats.isRefined) - { - return stats.duration; - } - return 0; - } - public static boolean isStationBlock(World world, int x, int y, int z) - { - Block block = world.getBlock(x, y, z); - return isBasicStationFrame(world, x, y, z) && block instanceof BlockFrame && ((BlockFrame)block).isCogworkHolder; - } - public static boolean isBasicStationFrame(World world, int x, int y, int z) - { - if(!(world.getBlock(x, y, z) instanceof BlockFrame)) - { - return false; - } - int shafts = 0; - - if(isShaft(world, x+1, y, z)){++shafts;} - if(isShaft(world, x-1, y, z)){++shafts;} - if(isShaft(world, x, y, z+1)){++shafts;} - if(isShaft(world, x, y, z-1)){++shafts;} - - return shafts == 3; - } - public static boolean isShaft(World world, int x, int y, int z) - { - for(int y2 = 0; y2 < 4; y2 ++) - { - if(! (world.getBlock(x, y, z) instanceof BlockFrame)) - { - return false; - } - } - return true; - } +public class PowerArmour { + public static boolean isWearingCogwork(EntityLivingBase user) { + return user.ridingEntity != null && user.ridingEntity instanceof IPowerArmour; + } + + public static boolean isPowered(EntityLivingBase user) { + if (user.ridingEntity != null && user.ridingEntity instanceof IPowerArmour) { + return ((IPowerArmour) user.ridingEntity).isPowered(); + } + return false; + } + + public static boolean isFullyArmoured(EntityLivingBase user) { + if (user.ridingEntity != null && user.ridingEntity instanceof IPowerArmour) { + return ((IPowerArmour) user.ridingEntity).isFullyArmoured(); + } + return false; + } + + public static float modifyDamage(EntityLivingBase user, float dam, DamageSource src) { + if (user.ridingEntity != null) { + if (user.ridingEntity instanceof IPowerArmour) { + return ((IPowerArmour) user.ridingEntity).modifyDamage(user, dam, src); + } + } + return dam; + } + + public static boolean allowDamageToBlock(DamageSource src) { + if (src == DamageSource.starve || src == DamageSource.outOfWorld || src == DamageSource.drown) { + return false; + } + return true; + } + + public static float getFuelValue(ItemStack item) { + ForgeFuel stats = ForgeItemHandler.getStats(item); + if (stats != null && stats.isRefined) { + return stats.duration; + } + return 0; + } + + public static boolean isStationBlock(World world, int x, int y, int z) { + Block block = world.getBlock(x, y, z); + return isBasicStationFrame(world, x, y, z) && block instanceof BlockFrame + && ((BlockFrame) block).isCogworkHolder; + } + + public static boolean isBasicStationFrame(World world, int x, int y, int z) { + if (!(world.getBlock(x, y, z) instanceof BlockFrame)) { + return false; + } + int shafts = 0; + + if (isShaft(world, x + 1, y, z)) { + ++shafts; + } + if (isShaft(world, x - 1, y, z)) { + ++shafts; + } + if (isShaft(world, x, y, z + 1)) { + ++shafts; + } + if (isShaft(world, x, y, z - 1)) { + ++shafts; + } + + return shafts == 3; + } + + public static boolean isShaft(World world, int x, int y, int z) { + for (int y2 = 0; y2 < 4; y2++) { + if (!(world.getBlock(x, y, z) instanceof BlockFrame)) { + return false; + } + } + return true; + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/RenderHelper.java b/src/main/java/minefantasy/mf2/api/helpers/RenderHelper.java index 1f605720..f14ac38a 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/RenderHelper.java +++ b/src/main/java/minefantasy/mf2/api/helpers/RenderHelper.java @@ -1,145 +1,137 @@ package minefantasy.mf2.api.helpers; -import java.util.List; -import java.util.Random; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.settings.KeyBinding; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; -public final class RenderHelper -{ - - public static void renderTooltip(int x, int y, List tooltipData) - { - int color = 0x505000ff; - int color2 = 0xf0100010; - - renderTooltip(x, y, tooltipData, color, color2); - } - - public static void renderTooltipOrange(int x, int y, List tooltipData) - { - int color = 0x50a06600; - int color2 = 0xf01e1200; - - renderTooltip(x, y, tooltipData, color, color2); - } - - public static void renderTooltipGreen(int x, int y, List tooltipData) - { - int color = 0x5000a000; - int color2 = 0xf0001e00; - - renderTooltip(x, y, tooltipData, color, color2); - } - - public static void renderTooltip(int x, int y, List tooltipData, int colour, int color2) { - boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING); - if(lighting) - net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); - - if (!tooltipData.isEmpty()) { - int var5 = 0; - int var6; - int var7; - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - for (var6 = 0; var6 < tooltipData.size(); ++var6) { - var7 = fontRenderer.getStringWidth(tooltipData.get(var6)); - if (var7 > var5) - var5 = var7; - } - var6 = x + 12; - var7 = y - 12; - int var9 = 8; - if (tooltipData.size() > 1) - var9 += 2 + (tooltipData.size() - 1) * 10; - float z = 300F; - drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2); - drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2); - drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2); - drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2); - drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2); - int var12 = (colour & 0xFFFFFF) >> 1 | colour & -16777216; - drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, colour, var12); - drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, colour, var12); - drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, colour, colour); - drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12); - - GL11.glDisable(GL11.GL_DEPTH_TEST); - for (int var13 = 0; var13 < tooltipData.size(); ++var13) { - String var14 = tooltipData.get(var13); - fontRenderer.drawStringWithShadow(var14, var6, var7, -1); - if (var13 == 0) - var7 += 2; - var7 += 10; - } - GL11.glEnable(GL11.GL_DEPTH_TEST); - } - if(!lighting) - net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); - GL11.glColor4f(1F, 1F, 1F, 1F); - } - - public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { - float var7 = (par5 >> 24 & 255) / 255F; - float var8 = (par5 >> 16 & 255) / 255F; - float var9 = (par5 >> 8 & 255) / 255F; - float var10 = (par5 & 255) / 255F; - float var11 = (par6 >> 24 & 255) / 255F; - float var12 = (par6 >> 16 & 255) / 255F; - float var13 = (par6 >> 8 & 255) / 255F; - float var14 = (par6 & 255) / 255F; - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glShadeModel(GL11.GL_SMOOTH); - Tessellator var15 = Tessellator.instance; - var15.startDrawingQuads(); - var15.setColorRGBA_F(var8, var9, var10, var7); - var15.addVertex(par3, par2, z); - var15.addVertex(par1, par2, z); - var15.setColorRGBA_F(var12, var13, var14, var11); - var15.addVertex(par1, par4, z); - var15.addVertex(par3, par4, z); - var15.draw(); - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { - drawTexturedModalRect(par1, par2, z, par3, par4, par5, par6, 0.00390625F, 0.00390625F); - } - - public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6, float f, float f1) { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(par1 + 0, par2 + par6, z, (par3 + 0) * f, (par4 + par6) * f1); - tessellator.addVertexWithUV(par1 + par5, par2 + par6, z, (par3 + par5) * f, (par4 + par6) * f1); - tessellator.addVertexWithUV(par1 + par5, par2 + 0, z, (par3 + par5) * f, (par4 + 0) * f1); - tessellator.addVertexWithUV(par1 + 0, par2 + 0, z, (par3 + 0) * f, (par4 + 0) * f1); - tessellator.draw(); - } - - public static String getKeyDisplayString(String keyName) { - String key = null; - KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings; - for(KeyBinding otherKey : keys) - if(otherKey.getKeyDescription().equals(keyName)) { - key = Keyboard.getKeyName(otherKey.getKeyCode()); - break; - } - - return key; - } +import java.util.List; + +public final class RenderHelper { + + public static void renderTooltip(int x, int y, List tooltipData) { + int color = 0x505000ff; + int color2 = 0xf0100010; + + renderTooltip(x, y, tooltipData, color, color2); + } + + public static void renderTooltipOrange(int x, int y, List tooltipData) { + int color = 0x50a06600; + int color2 = 0xf01e1200; + + renderTooltip(x, y, tooltipData, color, color2); + } + + public static void renderTooltipGreen(int x, int y, List tooltipData) { + int color = 0x5000a000; + int color2 = 0xf0001e00; + + renderTooltip(x, y, tooltipData, color, color2); + } + + public static void renderTooltip(int x, int y, List tooltipData, int colour, int color2) { + boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING); + if (lighting) + net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); + + if (!tooltipData.isEmpty()) { + int var5 = 0; + int var6; + int var7; + FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; + for (var6 = 0; var6 < tooltipData.size(); ++var6) { + var7 = fontRenderer.getStringWidth(tooltipData.get(var6)); + if (var7 > var5) + var5 = var7; + } + var6 = x + 12; + var7 = y - 12; + int var9 = 8; + if (tooltipData.size() > 1) + var9 += 2 + (tooltipData.size() - 1) * 10; + float z = 300F; + drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2); + drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2); + drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2); + drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2); + drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2); + int var12 = (colour & 0xFFFFFF) >> 1 | colour & -16777216; + drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, colour, var12); + drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, colour, var12); + drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, colour, colour); + drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12); + + GL11.glDisable(GL11.GL_DEPTH_TEST); + for (int var13 = 0; var13 < tooltipData.size(); ++var13) { + String var14 = tooltipData.get(var13); + fontRenderer.drawStringWithShadow(var14, var6, var7, -1); + if (var13 == 0) + var7 += 2; + var7 += 10; + } + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + if (!lighting) + net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); + GL11.glColor4f(1F, 1F, 1F, 1F); + } + + public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { + float var7 = (par5 >> 24 & 255) / 255F; + float var8 = (par5 >> 16 & 255) / 255F; + float var9 = (par5 >> 8 & 255) / 255F; + float var10 = (par5 & 255) / 255F; + float var11 = (par6 >> 24 & 255) / 255F; + float var12 = (par6 >> 16 & 255) / 255F; + float var13 = (par6 >> 8 & 255) / 255F; + float var14 = (par6 & 255) / 255F; + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glShadeModel(GL11.GL_SMOOTH); + Tessellator var15 = Tessellator.instance; + var15.startDrawingQuads(); + var15.setColorRGBA_F(var8, var9, var10, var7); + var15.addVertex(par3, par2, z); + var15.addVertex(par1, par2, z); + var15.setColorRGBA_F(var12, var13, var14, var11); + var15.addVertex(par1, par4, z); + var15.addVertex(par3, par4, z); + var15.draw(); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { + drawTexturedModalRect(par1, par2, z, par3, par4, par5, par6, 0.00390625F, 0.00390625F); + } + + public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6, + float f, float f1) { + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(par1 + 0, par2 + par6, z, (par3 + 0) * f, (par4 + par6) * f1); + tessellator.addVertexWithUV(par1 + par5, par2 + par6, z, (par3 + par5) * f, (par4 + par6) * f1); + tessellator.addVertexWithUV(par1 + par5, par2 + 0, z, (par3 + par5) * f, (par4 + 0) * f1); + tessellator.addVertexWithUV(par1 + 0, par2 + 0, z, (par3 + 0) * f, (par4 + 0) * f1); + tessellator.draw(); + } + + public static String getKeyDisplayString(String keyName) { + String key = null; + KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings; + for (KeyBinding otherKey : keys) + if (otherKey.getKeyDescription().equals(keyName)) { + key = Keyboard.getKeyName(otherKey.getKeyCode()); + break; + } + + return key; + } } diff --git a/src/main/java/minefantasy/mf2/api/helpers/TacticalManager.java b/src/main/java/minefantasy/mf2/api/helpers/TacticalManager.java index 20f1dfee..d79002c7 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/TacticalManager.java +++ b/src/main/java/minefantasy/mf2/api/helpers/TacticalManager.java @@ -1,7 +1,5 @@ package minefantasy.mf2.api.helpers; -import java.util.Random; - import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.armour.IElementalResistance; import minefantasy.mf2.api.knowledge.ResearchLogic; @@ -23,532 +21,472 @@ import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.util.MathHelper; +import java.util.Random; + /** - * This calculates different tactical contexts for combat like flanking and blocking + * This calculates different tactical contexts for combat like flanking and + * blocking */ -public class TacticalManager -{ - private static Random rand = new Random(); - public static boolean shouldSlow = true; - public static float minWeightSpeed = 10F; - public static float arrowDeflectChance = 1.0F; - - /** - * Determines if you cant block with no stamina - */ - public static boolean shouldStaminaBlock = false; - /** - * Determines if the defender is hit in the front (180degree arc) - * @param attacker the attacker - * @param defender the defender - * @return true if the hit is on the front - */ - public static boolean canBlock(Entity attacker, EntityLivingBase defender) - { - return canBlock(attacker, defender, 180); - } - /** - * Determines if the defender is hit in the front with a custom arc - * @param attacker the attacker - * @param defender the defender - * @param arc the arc that can be blocked - * @return true if the hit is on the front - */ - public static boolean canBlock(Entity attacker, EntityLivingBase defender, float blockAngle) - { - if(attacker == null || defender == null)return false; - - float yaw = calculateHitAngle(attacker, defender); - +public class TacticalManager { + public static boolean shouldSlow = true; + public static float minWeightSpeed = 10F; + public static float arrowDeflectChance = 1.0F; + /** + * Determines if you cant block with no stamina + */ + public static boolean shouldStaminaBlock = false; + public static boolean newBalanceSystem = false; + private static Random rand = new Random(); + + /** + * Determines if the defender is hit in the front (180degree arc) + * + * @param attacker the attacker + * @param defender the defender + * @return true if the hit is on the front + */ + public static boolean canBlock(Entity attacker, EntityLivingBase defender) { + return canBlock(attacker, defender, 180); + } + + /** + * Determines if the defender is hit in the front with a custom arc + * + * @param attacker the attacker + * @param defender the defender + * @param arc the arc that can be blocked + * @return true if the hit is on the front + */ + public static boolean canBlock(Entity attacker, EntityLivingBase defender, float blockAngle) { + if (attacker == null || defender == null) + return false; + + float yaw = calculateHitAngle(attacker, defender); + return yaw < blockAngle && yaw > -blockAngle; - } - - /** - * Determines if an entity is flanking another - * @param source the source of the attack - * @param attacker the attacking entity - * @param defender the entity on view is questioned - * @param angle the angle the defender is flanked by - * @return true if the attacker hit within the back of defender between the angle - */ - public static boolean isFlankedBy(Entity attacker, EntityLivingBase defender, float angle) - { - float yaw = calculateHitAngle(attacker, defender); - float blockAngle = (360-angle)/2; - - return !(yaw < blockAngle && yaw > -blockAngle);//Flanking is like reverse block - } - - public static boolean canParry(DamageSource source, EntityLivingBase user, Entity entityHitting, ItemStack weapon) - { - boolean autoParry = false; - if(shouldStaminaBlock && StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user) && !StaminaBar.isAnyStamina(user, false)) - { - return false; - } - if(user.getHeldItem() != null && !canWeaponBlock(user.getHeldItem())) - { - return false; - } - if(user instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)user; - autoParry = ResearchLogic.hasInfoUnlocked(player, "autoparry") && !player.isBlocking(); - - if(!player.isBlocking() && !autoParry) - { - return false; - } - } - else - { - if(!isMobBlocking(user) && didParrySucceed(user, source)) - { - return false; - } - } - - if(!CombatMechanics.isParryAvailable(user)) - { - return false; - } - int confusion = 0; - if(user.getActivePotionEffect(Potion.confusion) != null) - { - confusion = user.getActivePotionEffect(Potion.confusion).getAmplifier() +1; - } - float arc = 20;//DEFAULT - - if(weapon != null && weapon.getItem() instanceof IParryable) - { - IParryable parry = (IParryable)weapon.getItem(); - if(!parry.canUserParry(user)) - { - return false; - } - arc = parry.getParryAngle(source, user, weapon); - - if(!parry.canParry(source, user, weapon)) - { - return false; - } - } - if(source.isProjectile()) - { - arc *= 0.75F; - } - - arc *= getHighgroundModifier(user, entityHitting, 1.5F); - arc = ArmourCalculator.adjustACForDamage(source, arc, 1.0F, 1.0F, 0.5F);//Harder to block piercing - if(autoParry) - { - arc *= 0.5F; - } - arc *= ArmourCalculator.getParryModifier(user); - if(confusion > 0 && rand.nextInt(confusion+1) != 0) - { - return false; - } - return arc > 0 && canBlock(entityHitting, user, arc); - } - private static boolean canWeaponBlock(ItemStack item) - { - return item.getItem() instanceof ItemSword || item.getItem() instanceof IParryable; - } - private static boolean isMobBlocking(EntityLivingBase user) - { - if(!user.isImmuneToFire() && user.isBurning()) - { - return false;//If burning and can't take the heat.. can't block! - } - if(user.getHeldItem() != null) - { - return user.getHeldItem().getItem().getItemUseAction(user.getHeldItem()) == EnumAction.block; - } - return false; - } - private static boolean didParrySucceed(EntityLivingBase user, DamageSource source) - { - if(user instanceof ISpecialCombatMob) - { - return ((ISpecialCombatMob)user).canParry(source); - } - return rand.nextInt(5) != 0; - } - - public static float getHighgroundModifier(Entity target, Entity hitter, float value) - { - if(target == null || hitter == null) - { - return 1.0F; - } - float gap = 0.5F; - if(target.posY > hitter.posY + gap)//Blocker on high ground - { - return 1.0F * value; - } - if(target.posY < hitter.posY - gap)//Attacker on high ground - { - return 1.0F / value; - } - return 1.0F; - } - /** - * Knocks the target back from the source - * @param target the enemy to be knocked back - * @param source the source of the knockback - * @param power the power a - pulls - * @param height the height they jump - */ - public static void knockbackEntity(Entity target, Entity source, float power, float height) - { - target.addVelocity(-MathHelper.sin(source.rotationYaw * (float) Math.PI / 180.0F) * power * 0.5F, height, MathHelper.cos(source.rotationYaw * (float) Math.PI / 180.0F) * power * 0.5F); } - - /** - * Causes the attacker to fly towards the target - * @param attacker the entity that moves - * @param target the target attacker aims for - * @param power the forward momentum - * @param height the height of the jump - */ - public static void lungeEntity(Entity attacker, Entity target, float power, float height) - { - attacker.addVelocity(-MathHelper.sin(attacker.rotationYaw * (float) Math.PI / 180.0F) * power * 0.5F, height, MathHelper.cos(attacker.rotationYaw * (float) Math.PI / 180.0F) * power * 0.5F); + + /** + * Determines if an entity is flanking another + * + * @param source the source of the attack + * @param attacker the attacking entity + * @param defender the entity on view is questioned + * @param angle the angle the defender is flanked by + * @return true if the attacker hit within the back of defender between the + * angle + */ + public static boolean isFlankedBy(Entity attacker, EntityLivingBase defender, float angle) { + float yaw = calculateHitAngle(attacker, defender); + float blockAngle = (360 - angle) / 2; + + return !(yaw < blockAngle && yaw > -blockAngle);// Flanking is like reverse block + } + + public static boolean canParry(DamageSource source, EntityLivingBase user, Entity entityHitting, ItemStack weapon) { + boolean autoParry = false; + if (shouldStaminaBlock && StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user) + && !StaminaBar.isAnyStamina(user, false)) { + return false; + } + if (user.getHeldItem() != null && !canWeaponBlock(user.getHeldItem())) { + return false; + } + if (user instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) user; + autoParry = ResearchLogic.hasInfoUnlocked(player, "autoparry") && !player.isBlocking(); + + if (!player.isBlocking() && !autoParry) { + return false; + } + } else { + if (!isMobBlocking(user) && didParrySucceed(user, source)) { + return false; + } + } + + if (!CombatMechanics.isParryAvailable(user)) { + return false; + } + int confusion = 0; + if (user.getActivePotionEffect(Potion.confusion) != null) { + confusion = user.getActivePotionEffect(Potion.confusion).getAmplifier() + 1; + } + float arc = 20;// DEFAULT + + if (weapon != null && weapon.getItem() instanceof IParryable) { + IParryable parry = (IParryable) weapon.getItem(); + if (!parry.canUserParry(user)) { + return false; + } + arc = parry.getParryAngle(source, user, weapon); + + if (!parry.canParry(source, user, weapon)) { + return false; + } + } + if (source.isProjectile()) { + arc *= 0.75F; + } + + arc *= getHighgroundModifier(user, entityHitting, 1.5F); + arc = ArmourCalculator.adjustACForDamage(source, arc, 1.0F, 1.0F, 0.5F);// Harder to block piercing + if (autoParry) { + arc *= 0.5F; + } + arc *= ArmourCalculator.getParryModifier(user); + if (confusion > 0 && rand.nextInt(confusion + 1) != 0) { + return false; + } + return arc > 0 && canBlock(entityHitting, user, arc); + } + + private static boolean canWeaponBlock(ItemStack item) { + return item.getItem() instanceof ItemSword || item.getItem() instanceof IParryable; + } + + private static boolean isMobBlocking(EntityLivingBase user) { + if (!user.isImmuneToFire() && user.isBurning()) { + return false;// If burning and can't take the heat.. can't block! + } + if (user.getHeldItem() != null) { + return user.getHeldItem().getItem().getItemUseAction(user.getHeldItem()) == EnumAction.block; + } + return false; } - - public static boolean isRanged(DamageSource source) - { - if(source == null) - { - return false; - } - if(source.isProjectile() || source instanceof EntityDamageSourceIndirect) - { - return true; - } - if(source.getEntity() != null && source.getSourceOfDamage() != null) - { - return source.getEntity() != source.getSourceOfDamage(); - } - return false; - } - - /** - * This gets the angle that "attacker" hit "defender" relating 0 to front - * @param attacker the entity that hit defender - * @param defender the hit entity in question - * @return the angle defender was hit (0 = front) - */ - private static float calculateHitAngle(Entity attacker, EntityLivingBase defender) - { - if(attacker == null) - { - return 0F; - } - double xGap = attacker.posX - defender.posX; - double zGap; - for (zGap = attacker.posZ - defender.posZ; xGap * xGap + zGap * zGap < 1.0E-4D; zGap = (Math.random() - Math.random()) * 0.01D) + private static boolean didParrySucceed(EntityLivingBase user, DamageSource source) { + if (user instanceof ISpecialCombatMob) { + return ((ISpecialCombatMob) user).canParry(source); + } + return rand.nextInt(5) != 0; + } + + public static float getHighgroundModifier(Entity target, Entity hitter, float value) { + if (target == null || hitter == null) { + return 1.0F; + } + float gap = 0.5F; + if (target.posY > hitter.posY + gap)// Blocker on high ground { - xGap = (Math.random() - Math.random()) * 0.01D; //makes the zgap + return 1.0F * value; } + if (target.posY < hitter.posY - gap)// Attacker on high ground + { + return 1.0F / value; + } + return 1.0F; + } + + /** + * Knocks the target back from the source + * + * @param target the enemy to be knocked back + * @param source the source of the knockback + * @param power the power a - pulls + * @param height the height they jump + */ + public static void knockbackEntity(Entity target, Entity source, float power, float height) { + target.addVelocity(-MathHelper.sin(source.rotationYaw * (float) Math.PI / 180.0F) * power * 0.5F, height, + MathHelper.cos(source.rotationYaw * (float) Math.PI / 180.0F) * power * 0.5F); + } - float yaw = (float)(Math.atan2(zGap, xGap) * 180.0D / Math.PI) - defender.rotationYaw; + /** + * Causes the attacker to fly towards the target + * + * @param attacker the entity that moves + * @param target the target attacker aims for + * @param power the forward momentum + * @param height the height of the jump + */ + public static void lungeEntity(Entity attacker, Entity target, float power, float height) { + attacker.addVelocity(-MathHelper.sin(attacker.rotationYaw * (float) Math.PI / 180.0F) * power * 0.5F, height, + MathHelper.cos(attacker.rotationYaw * (float) Math.PI / 180.0F) * power * 0.5F); + } + + public static boolean isRanged(DamageSource source) { + if (source == null) { + return false; + } + if (source.isProjectile() || source instanceof EntityDamageSourceIndirect) { + return true; + } + if (source.getEntity() != null && source.getSourceOfDamage() != null) { + return source.getEntity() != source.getSourceOfDamage(); + } + return false; + } + + /** + * This gets the angle that "attacker" hit "defender" relating 0 to front + * + * @param attacker the entity that hit defender + * @param defender the hit entity in question + * @return the angle defender was hit (0 = front) + */ + private static float calculateHitAngle(Entity attacker, EntityLivingBase defender) { + if (attacker == null) { + return 0F; + } + double xGap = attacker.posX - defender.posX; + double zGap; + + for (zGap = attacker.posZ - defender.posZ; xGap * xGap + + zGap * zGap < 1.0E-4D; zGap = (Math.random() - Math.random()) * 0.01D) { + xGap = (Math.random() - Math.random()) * 0.01D; // makes the zgap + } + + float yaw = (float) (Math.atan2(zGap, xGap) * 180.0D / Math.PI) - defender.rotationYaw; yaw = yaw - 90; - - //CONVERTS THE ANGLES - while(yaw < -180) - { + // CONVERTS THE ANGLES + while (yaw < -180) { yaw += 360; } - while(yaw >= 180) - { + while (yaw >= 180) { yaw -= 360; } - + return yaw; - } - - /** - * Modifies the movement of an entity based on armour - */ - public static void applyArmourWeight(EntityLivingBase entityLiving) - { - if(entityLiving instanceof EntityPlayer && ((EntityPlayer)entityLiving).capabilities.isCreativeMode) - { - return; - } - //Default speed is 100% - float totalSpeed = 100F; - - if(shouldSlow && !isImmuneToWeight(entityLiving)) - { - - totalSpeed += ArmourCalculator.getSpeedModForWeight(entityLiving); - //Limit the slowest speed to 1% - if(totalSpeed <= minWeightSpeed) - { - totalSpeed = minWeightSpeed; - } - } - //apply speed mod - if(totalSpeed != 100F && entityLiving.onGround) - { - entityLiving.motionX *= (totalSpeed/100F); - entityLiving.motionZ *= (totalSpeed/100F); - } - } - /** - * Gets the modifer for magic resistance 1.0=no effect - */ - public static float resistMagic(EntityLivingBase user, DamageSource source) - { - float resistance = 100F; - - for(int a = 0; a < 4; a ++) - { - ItemStack armour = user.getEquipmentInSlot(a+1); - if(armour != null && armour.getItem() instanceof IElementalResistance) - { - float modifier = ((IElementalResistance)armour.getItem()).getMagicResistance(armour, source); - modifier *= ArmourCalculator.sizes[3-a]; - resistance -= modifier; - } - } - - return resistance/100F; - } - - /** - * Gets the modifer for fire resistance 1.0=no effect - */ - public static float resistFire(EntityLivingBase user, DamageSource source) - { - float resistance = 100F; - - for(int a = 0; a < 4; a ++) - { - ItemStack armour = user.getEquipmentInSlot(a+1); - if(armour != null && armour.getItem() instanceof IElementalResistance) - { - float modifier = ((IElementalResistance)armour.getItem()).getFireResistance(armour, source); - modifier *= ArmourCalculator.sizes[3-a]; - - resistance -= modifier; - } - } - - return resistance/100F; - } - public static boolean resistArrow(EntityLivingBase user, DamageSource source, float dam) - { - Entity hitter = source.getSourceOfDamage(); - if(hitter == null || !isArrow(hitter)) - { - return false; - } - - float threshold = 0.25F; - float resistance = 1.0F; - - for(int a = 0; a < 4; a ++) - { - ItemStack armour = user.getEquipmentInSlot(4-a); - if(armour != null && armour.getItem() instanceof IElementalResistance) - { - float modifier = ((IElementalResistance)armour.getItem()).getArrowDeflection(armour, source); - modifier *= ArmourCalculator.sizes[a]; - - resistance += modifier; - } - } - threshold *= resistance; - - if(!user.worldObj.isRemote) - MineFantasyAPI.debugMsg("Arrow Damage: " + dam + " Projectile Threshold: " + threshold); - - return dam <= threshold && dam > 0; - } - - /** - * This tries to see if the projectile is an arrow, just so certain projectiles dont do the armour bouncy thing - */ - public static boolean isArrow(Entity hitter) - { - return hitter instanceof EntityArrow || hitter instanceof EntityArrowMF; - } - /** - * Gets the modifer for base resistance(non magic/fire) - */ - public static float resistBase(EntityLivingBase user, DamageSource source) - { - float resistance = 100F; - - for(int a = 0; a < 4; a ++) - { - ItemStack armour = user.getEquipmentInSlot(a+1); - if(armour != null && armour.getItem() instanceof IElementalResistance) - { - float modifier = ((IElementalResistance)armour.getItem()).getBaseResistance(armour, source); - modifier *= ArmourCalculator.sizes[3-a]; - resistance -= modifier; - } - } - return resistance/100F; - } - - - public static float getResistance(EntityLivingBase user, DamageSource source) - { - if(source.isFireDamage()) - { - return resistFire(user, source); - } - if(source.isMagicDamage() || source == DamageSource.wither) - { - return resistMagic(user, source); - } - return resistBase(user, source); - } - - /** - * Returns if a target should not be set - * @param entity the attacker - * @param target the target chosen - */ - public static boolean shouldNotAttack(Entity attacker, EntityLivingBase target) - { - //TODO aggro - return false; - } - public static void throwPlayerOffBalance(EntityPlayer entityPlayer, float balance, boolean throwDown) - { - float amplify = 30.0F; - - float offsetX = -balance/2; - float offsetY = balance; - - float yawBalance = offsetX*amplify; - float pitchBalance = offsetY*amplify; - entityPlayer.moveStrafing += offsetX; - if(offsetY > 0) - { - entityPlayer.moveForward += offsetY; - } - if(newBalanceSystem) - { - entityPlayer.getEntityData().setFloat("MF_Balance_Pitch", pitchBalance); - entityPlayer.getEntityData().setFloat("MF_Balance_Yaw", yawBalance); - } - else - { - entityPlayer.rotationPitch += pitchBalance; - entityPlayer.rotationYaw += yawBalance; - } - } - - public static boolean newBalanceSystem = false; - - public static boolean isEntityMoving(EntityLivingBase player) - { - return player.moveForward != 0 || player.moveStrafing != 0; - } - public static boolean isMelee(DamageSource source) - { - if(source.getEntity() != null && source.getSourceOfDamage() != null) - { - return source.getEntity() == source.getSourceOfDamage() && !source.isProjectile(); - } - return false; - } - public static boolean isUnholyCreature(Entity entityHit) - { - if(entityHit == null || !(entityHit instanceof EntityLivingBase)) - { - return false; - } - - if(((EntityLivingBase)entityHit).isEntityUndead()) - { - return true; - } - if(entityHit instanceof EntityWitch) - { - return true; - } - if(entityHit.getClass().getName().contains("Wraith")) - { - return true; - } - if(entityHit.getClass().getName().contains("Werewolf")) - { - return true; - } - return false; - } - public static boolean isDragon(Entity entityHit) - { - if(entityHit == null || !(entityHit instanceof EntityLivingBase)) - { - return false; - } - if(entityHit instanceof net.minecraft.entity.boss.EntityDragon) - { - return true; - } - if(entityHit instanceof minefantasy.mf2.entity.mob.EntityDragon) - { - return true; - } - return false; - } - - /** - * Simply drops an item - */ - public static boolean tryDisarm(EntityLivingBase target) - { - return tryDisarm(null, target, false); - } - /** - * Try to disarm the target - * @param attacker Who is attacking (can be null) - * @param target Who is wielding - * @param steal If the attacker should wield the target's weapon - */ - public static boolean tryDisarm(EntityLivingBase attacker, EntityLivingBase target, boolean steal) - { - if(target.getHeldItem() == null) - { - return false; - } - - if(attacker != null && steal && attacker.getHeldItem() == null) - { - attacker.setCurrentItemOrArmor(0, target.getHeldItem().copy()); - } - else - { - target.entityDropItem(target.getHeldItem(), 1.0F); - } - target.setCurrentItemOrArmor(0, null); - return true; - } - - - /** - * Checks if Armour Debuffs are Ignored - */ - public static boolean isImmuneToWeight(EntityLivingBase entityLiving) - { - return PowerArmour.isPowered(entityLiving); - } - - public static void leap(Entity target, float angle, float power, float height) - { - target.addVelocity(-MathHelper.sin(angle * (float) Math.PI / 180.0F) * power, height, MathHelper.cos(angle * (float) Math.PI / 180.0F) * power); } - + + /** + * Modifies the movement of an entity based on armour + */ + public static void applyArmourWeight(EntityLivingBase entityLiving) { + if (entityLiving instanceof EntityPlayer && ((EntityPlayer) entityLiving).capabilities.isCreativeMode) { + return; + } + // Default speed is 100% + float totalSpeed = 100F; + + if (shouldSlow && !isImmuneToWeight(entityLiving)) { + + totalSpeed += ArmourCalculator.getSpeedModForWeight(entityLiving); + // Limit the slowest speed to 1% + if (totalSpeed <= minWeightSpeed) { + totalSpeed = minWeightSpeed; + } + } + // apply speed mod + if (totalSpeed != 100F && entityLiving.onGround) { + entityLiving.motionX *= (totalSpeed / 100F); + entityLiving.motionZ *= (totalSpeed / 100F); + } + } + + /** + * Gets the modifer for magic resistance 1.0=no effect + */ + public static float resistMagic(EntityLivingBase user, DamageSource source) { + float resistance = 100F; + + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(a + 1); + if (armour != null && armour.getItem() instanceof IElementalResistance) { + float modifier = ((IElementalResistance) armour.getItem()).getMagicResistance(armour, source); + modifier *= ArmourCalculator.sizes[3 - a]; + resistance -= modifier; + } + } + + return resistance / 100F; + } + + /** + * Gets the modifer for fire resistance 1.0=no effect + */ + public static float resistFire(EntityLivingBase user, DamageSource source) { + float resistance = 100F; + + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(a + 1); + if (armour != null && armour.getItem() instanceof IElementalResistance) { + float modifier = ((IElementalResistance) armour.getItem()).getFireResistance(armour, source); + modifier *= ArmourCalculator.sizes[3 - a]; + + resistance -= modifier; + } + } + + return resistance / 100F; + } + + public static boolean resistArrow(EntityLivingBase user, DamageSource source, float dam) { + Entity hitter = source.getSourceOfDamage(); + if (hitter == null || !isArrow(hitter)) { + return false; + } + + float threshold = 0.25F; + float resistance = 1.0F; + + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(4 - a); + if (armour != null && armour.getItem() instanceof IElementalResistance) { + float modifier = ((IElementalResistance) armour.getItem()).getArrowDeflection(armour, source); + modifier *= ArmourCalculator.sizes[a]; + + resistance += modifier; + } + } + threshold *= resistance; + + if (!user.worldObj.isRemote) + MineFantasyAPI.debugMsg("Arrow Damage: " + dam + " Projectile Threshold: " + threshold); + + return dam <= threshold && dam > 0; + } + + /** + * This tries to see if the projectile is an arrow, just so certain projectiles + * dont do the armour bouncy thing + */ + public static boolean isArrow(Entity hitter) { + return hitter instanceof EntityArrow || hitter instanceof EntityArrowMF; + } + + /** + * Gets the modifer for base resistance(non magic/fire) + */ + public static float resistBase(EntityLivingBase user, DamageSource source) { + float resistance = 100F; + + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(a + 1); + if (armour != null && armour.getItem() instanceof IElementalResistance) { + float modifier = ((IElementalResistance) armour.getItem()).getBaseResistance(armour, source); + modifier *= ArmourCalculator.sizes[3 - a]; + resistance -= modifier; + } + } + return resistance / 100F; + } + + public static float getResistance(EntityLivingBase user, DamageSource source) { + if (source.isFireDamage()) { + return resistFire(user, source); + } + if (source.isMagicDamage() || source == DamageSource.wither) { + return resistMagic(user, source); + } + return resistBase(user, source); + } + + /** + * Returns if a target should not be set + * + * @param entity the attacker + * @param target the target chosen + */ + public static boolean shouldNotAttack(Entity attacker, EntityLivingBase target) { + // TODO aggro + return false; + } + + public static void throwPlayerOffBalance(EntityPlayer entityPlayer, float balance, boolean throwDown) { + float amplify = 30.0F; + + float offsetX = -balance / 2; + float offsetY = balance; + + float yawBalance = offsetX * amplify; + float pitchBalance = offsetY * amplify; + entityPlayer.moveStrafing += offsetX; + if (offsetY > 0) { + entityPlayer.moveForward += offsetY; + } + if (newBalanceSystem) { + entityPlayer.getEntityData().setFloat("MF_Balance_Pitch", pitchBalance); + entityPlayer.getEntityData().setFloat("MF_Balance_Yaw", yawBalance); + } else { + entityPlayer.rotationPitch += pitchBalance; + entityPlayer.rotationYaw += yawBalance; + } + } + + public static boolean isEntityMoving(EntityLivingBase player) { + return player.moveForward != 0 || player.moveStrafing != 0; + } + + public static boolean isMelee(DamageSource source) { + if (source.getEntity() != null && source.getSourceOfDamage() != null) { + return source.getEntity() == source.getSourceOfDamage() && !source.isProjectile(); + } + return false; + } + + public static boolean isUnholyCreature(Entity entityHit) { + if (entityHit == null || !(entityHit instanceof EntityLivingBase)) { + return false; + } + + if (((EntityLivingBase) entityHit).isEntityUndead()) { + return true; + } + if (entityHit instanceof EntityWitch) { + return true; + } + if (entityHit.getClass().getName().contains("Wraith")) { + return true; + } + if (entityHit.getClass().getName().contains("Werewolf")) { + return true; + } + return false; + } + + public static boolean isDragon(Entity entityHit) { + if (entityHit == null || !(entityHit instanceof EntityLivingBase)) { + return false; + } + if (entityHit instanceof net.minecraft.entity.boss.EntityDragon) { + return true; + } + if (entityHit instanceof minefantasy.mf2.entity.mob.EntityDragon) { + return true; + } + return false; + } + + /** + * Simply drops an item + */ + public static boolean tryDisarm(EntityLivingBase target) { + return tryDisarm(null, target, false); + } + + /** + * Try to disarm the target + * + * @param attacker Who is attacking (can be null) + * @param target Who is wielding + * @param steal If the attacker should wield the target's weapon + */ + public static boolean tryDisarm(EntityLivingBase attacker, EntityLivingBase target, boolean steal) { + if (target.getHeldItem() == null) { + return false; + } + + if (attacker != null && steal && attacker.getHeldItem() == null) { + attacker.setCurrentItemOrArmor(0, target.getHeldItem().copy()); + } else { + target.entityDropItem(target.getHeldItem(), 1.0F); + } + target.setCurrentItemOrArmor(0, null); + return true; + } + + /** + * Checks if Armour Debuffs are Ignored + */ + public static boolean isImmuneToWeight(EntityLivingBase entityLiving) { + return PowerArmour.isPowered(entityLiving); + } + + public static void leap(Entity target, float angle, float power, float height) { + target.addVelocity(-MathHelper.sin(angle * (float) Math.PI / 180.0F) * power, height, + MathHelper.cos(angle * (float) Math.PI / 180.0F) * power); + } + } diff --git a/src/main/java/minefantasy/mf2/api/helpers/TextureHelperMF.java b/src/main/java/minefantasy/mf2/api/helpers/TextureHelperMF.java index b1cc985a..16c1cb56 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/TextureHelperMF.java +++ b/src/main/java/minefantasy/mf2/api/helpers/TextureHelperMF.java @@ -1,45 +1,38 @@ package minefantasy.mf2.api.helpers; -import java.util.Map; - +import com.google.common.collect.Maps; +import cpw.mods.fml.client.FMLClientHandler; +import minefantasy.mf2.util.MFLogUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; -import com.google.common.collect.Maps; +import java.util.Map; -import cpw.mods.fml.client.FMLClientHandler; +public class TextureHelperMF { + public static final ResourceLocation ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); + private static final Map resourceList = Maps.newHashMap(); + + /** + * This gets the resource location from just a simple directory(Beats the shit + * you have to do nower days!) + */ + public static ResourceLocation getResource(String directory) { + ResourceLocation resourcelocation = (ResourceLocation) resourceList.get(directory); -public class TextureHelperMF -{ - private static final Map resourceList = Maps.newHashMap(); - public static final ResourceLocation ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); - - /** - * This gets the resource location from just a simple directory(Beats the shit you have to do nower days!) - */ - public static ResourceLocation getResource(String directory) - { - ResourceLocation resourcelocation = (ResourceLocation)resourceList.get(directory); + if (resourcelocation == null) { + MFLogUtil.logDebug("MineFantasy: Added Resource: " + directory); - if (resourcelocation == null) - { - System.out.println("MineFantasy: Added Resource: " + directory); - resourcelocation = new ResourceLocation("minefantasy2", directory); resourceList.put(directory, resourcelocation); } - + return resourcelocation; } - - - public static void renderEnchantmentEffects(Tessellator tessellator) - { + + public static void renderEnchantmentEffects(Tessellator tessellator) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); FMLClientHandler.instance().getClient().renderEngine.bindTexture(ITEM_GLINT); diff --git a/src/main/java/minefantasy/mf2/api/helpers/ToolHelper.java b/src/main/java/minefantasy/mf2/api/helpers/ToolHelper.java index 981f7c19..24e2b792 100644 --- a/src/main/java/minefantasy/mf2/api/helpers/ToolHelper.java +++ b/src/main/java/minefantasy/mf2/api/helpers/ToolHelper.java @@ -1,361 +1,300 @@ package minefantasy.mf2.api.helpers; -import java.util.ArrayList; - import minefantasy.mf2.api.crafting.CustomCrafterEntry; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.api.tool.IToolMF; import minefantasy.mf2.api.weapon.ISharpenable; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemTool; import net.minecraft.nbt.NBTTagCompound; -public class ToolHelper -{ - //CRAFTER TOOLS// - - public static boolean shouldShowTooltip(ItemStack tool) - { - String type = getCrafterTool(tool); - - return type != null && !type.equalsIgnoreCase("nothing") && !type.equalsIgnoreCase("hands"); - } - public static float getCrafterEfficiency(ItemStack tool) - { - if(tool == null) - { - return 1F; - } - if(tool.getItem() instanceof IToolMF) - { - return ((IToolMF)tool.getItem()).getEfficiency(tool); - } - return CustomCrafterEntry.getEntryEfficiency(tool); - } - public static int getCrafterTier(ItemStack tool) - { - if(tool == null) - { - return 0; - } - if(tool.getItem() instanceof IToolMF) - { - return ((IToolMF)tool.getItem()).getTier(tool); - } - return CustomCrafterEntry.getEntryTier(tool); - } - public static String getCrafterTool(ItemStack tool) - { - if(tool == null) - { - return "hands"; - } - if(tool.getItem() instanceof IToolMF) - { - return ((IToolMF)tool.getItem()).getToolType(tool); - } - return CustomCrafterEntry.getEntryType(tool); - } - - - - //MATERIALS// - - /** - * Compares an itemstack to see if the item is made from the said material - * ONLY APPLIES TO IToolMaterial in api. - */ - public static boolean isItemMaterial(ItemStack stack, ToolMaterial material) - { - if(stack != null) - { - //You need the item to implement this so it can see - if(stack.getItem() instanceof IToolMaterial) - { - IToolMaterial mat = (IToolMaterial)stack.getItem(); - - return mat.getMaterial() != null && mat.getMaterial() == material; - } +import java.util.ArrayList; + +public class ToolHelper { + // CRAFTER TOOLS// + + public static final String sharpnessLevelNBT = "MF_Sharpness_Level"; + private static String specialItem = "MF_SpecialItemType"; + + public static boolean shouldShowTooltip(ItemStack tool) { + String type = getCrafterTool(tool); + + return type != null && !type.equalsIgnoreCase("nothing") && !type.equalsIgnoreCase("hands"); + } + + public static float getCrafterEfficiency(ItemStack tool) { + if (tool == null) { + return 1F; + } + if (tool.getItem() instanceof IToolMF) { + return ((IToolMF) tool.getItem()).getEfficiency(tool); + } + return CustomCrafterEntry.getEntryEfficiency(tool); + } + + // MATERIALS// + + public static int getCrafterTier(ItemStack tool) { + if (tool == null) { + return 0; + } + if (tool.getItem() instanceof IToolMF) { + return ((IToolMF) tool.getItem()).getTier(tool); + } + return CustomCrafterEntry.getEntryTier(tool); + } + + // QUALITY// + + public static String getCrafterTool(ItemStack tool) { + if (tool == null) { + return "hands"; + } + if (tool.getItem() instanceof IToolMF) { + return ((IToolMF) tool.getItem()).getToolType(tool); + } + return CustomCrafterEntry.getEntryType(tool); + } + + /** + * Compares an itemstack to see if the item is made from the said material ONLY + * APPLIES TO IToolMaterial in api. + */ + public static boolean isItemMaterial(ItemStack stack, ToolMaterial material) { + if (stack != null) { + // You need the item to implement this so it can see + if (stack.getItem() instanceof IToolMaterial) { + IToolMaterial mat = (IToolMaterial) stack.getItem(); + + return mat.getMaterial() != null && mat.getMaterial() == material; + } + } + return false; + } + + public static ItemStack setQuality(ItemStack item, float qualityLvl) { + if (item.getMaxStackSize() > 0) + return item; + + NBTTagCompound nbt = getOrCreateNBT(item); + nbt.setFloat("MFCraftQuality", qualityLvl); + + return item; + } + + /** + * Gets how well an item has been crafted: 100 is default ranging from 0-200 + */ + public static float getQualityLevel(ItemStack stack) { + if (stack.getMaxStackSize() == 1) { + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("MFCraftQuality")) { + return stack.getTagCompound().getFloat("MFCraftQuality"); + } + } + return 100.0F; + } + + public static int setDuraOnQuality(ItemStack item, int dura) { + float quality = getQualityLevel(item); + if (item.hasTagCompound() && item.getTagCompound().hasKey("MF_Inferior")) { + if (item.getTagCompound().getBoolean("MF_Inferior")) { + dura /= 2; + } else { + dura *= 2; + } + } + + if (quality > 100) { + dura += ((dura) / 100F * (quality - 100));// This means 100+ adds to 2x durability at level 200 + } + if (quality < 100) { + dura -= ((dura * 0.75) / 100 * (100F - quality));// This means 100- takes upto 75% from it's max durability + // lvl0 is 25%dura + } + return dura; + } + + public static float modifyDigOnQuality(ItemStack item, float digspeed) { + if (item.hasTagCompound() && item.getTagCompound().hasKey("MF_Inferior")) { + if (item.getTagCompound().getBoolean("MF_Inferior")) { + digspeed /= 1.25F; + } else { + digspeed *= 1.25F; + } + } + float quality = getQualityLevel(item); + + if (quality > 100) { + digspeed += ((digspeed * 0.5F) / 100F * (quality - 100));// This means 100+ adds 50% speed at level 200 + } + if (quality < 100) { + digspeed -= ((digspeed * 0.5) / 100 * (100F - quality));// This means 100- takes upto 50% from it's max + // speed lvl0 is 50% speed + } + return digspeed; + } + + // NBT// + + public static float modifyDamOnQuality(ItemStack item, float damage) { + float quality = getQualityLevel(item); + if (item.hasTagCompound() && item.getTagCompound().hasKey("MF_Inferior")) { + if (item.getTagCompound().getBoolean("MF_Inferior")) { + damage /= 1.25F; + } else { + damage *= 1.25F; + } + } + if (quality > 100) { + damage += ((damage * 0.25F) / 100F * (quality - 100));// This means 100+ adds 25% damage at level 200 + } + if (quality < 100) { + damage -= ((damage * 0.25) / 100 * (100F - quality));// This means 100- takes upto 25% from it's max damage + // lvl0 is 75% damage + } + return damage; + } + + public static float modifyArmourRating(ItemStack item, float rating) { + float quality = getQualityLevel(item); + if (item.hasTagCompound() && item.getTagCompound().hasKey("MF_Inferior")) { + if (item.getTagCompound().getBoolean("MF_Inferior")) { + rating /= 1.25F; + } else { + rating *= 1.25F; + } + } + + if (quality > 100) { + rating += ((rating * 0.5F) / 100F * (quality - 100));// This means 100+ adds 50% armour at level 200 + } + if (quality < 100) { + rating -= ((rating * 0.5) / 100 * (100F - quality));// This means 100- takes upto 50% from it's max armour + // lvl0 is 50% armour + } + return rating; + } + + private static NBTTagCompound getOrCreateNBT(ItemStack item) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + + return item.getTagCompound(); + } + + public static boolean hasCustomQualityTag(ItemStack item) { + return item.hasTagCompound() && item.getTagCompound().hasKey("MFCraftQuality"); + } + + public static void setSpecial(ItemStack item, String type) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + item.getTagCompound().setString(specialItem, type); + } + + public static boolean isSpecial(ItemStack item, String type) { + return getSpecial(item) != null && getSpecial(item).equals(type); + } + + public static String getSpecial(ItemStack item) { + if (item.hasTagCompound() && item.getTagCompound().hasKey(specialItem)) { + return item.getTagCompound().getString(specialItem); + } + return null; + } + + public static void setToolSharpness(ItemStack item, float level) { + NBTTagCompound nbt = getOrCreateNBT(item); + float currentLevel = getSharpnessLevel(item); + float maxLevel = getMaxSharpness(item); + nbt.setFloat(sharpnessLevelNBT, Math.min(maxLevel, currentLevel + level)); + } + + public static float getSharpnessLevel(ItemStack item) { + NBTTagCompound nbt = item.getTagCompound(); + if (nbt != null && nbt.hasKey(sharpnessLevelNBT)) { + return nbt.getFloat(sharpnessLevelNBT); + } + return 0F; + } + + public static boolean canBeSharpened(ItemStack itemstack, float level) { + if (itemstack == null) + return false; + return false; + } + + /** + * The max amount of uses of sharpness + */ + public static float getMaxSharpness(ItemStack item) { + return getSharpnessTraits(item)[0]; + } + + /** + * The max percent that it can increase damage + */ + public static float getMaxSharpnessPercent(ItemStack item) { + return getSharpnessTraits(item)[1]; + } + + /** + * The modifier for how much percent is added each use + */ + public static float getSharpUsesModifier(ItemStack item) { + return getSharpnessTraits(item)[2]; + } + + // maxSharpness, maxBuff, sharpnessModifier + public static float[] getSharpnessTraits(ItemStack item) { + float[] list = new float[]{100, 20F, 3F}; + + if (item != null && item.getItem() instanceof ISharpenable) { + ISharpenable instance = (ISharpenable) item.getItem(); + list[0] = instance.getMaxSharpness(item); + list[1] = instance.getDamagePercentMax(item); + list[2] = instance.getSharpUsesModifier(item); + } + return list; + } + + public static String[] breakdownLineForResearchArray(String string) { + String temp = ""; + ArrayList entries = new ArrayList(); + + for (int a = 0; a < string.length(); a++) { + if (a == string.length() - 1) { + temp = temp + string.charAt(a); + } + if (string.charAt(a) == " ".charAt(0) || a == string.length() - 1) { + entries.add(temp); + } else { + if (string.charAt(a) != " ".charAt(0)) { + temp = temp + string.charAt(a); + } + } + } + int size = entries.size(); + String[] stringList = new String[size]; + for (int i = 0; i < size; i++) { + stringList[i] = entries.get(i); + } + return stringList; + } + + public static boolean isToolSufficient(ItemStack heldItem, String toolNeeded, int toolTierNeeded) { + String toolType = getCrafterTool(heldItem); + int tier = getCrafterTier(heldItem); + + return toolType.equalsIgnoreCase(toolNeeded) && tier >= toolTierNeeded; + } + + public static void setUnbreakable(ItemStack tool, boolean isUnbreakable) { + if (!tool.hasTagCompound()) { + tool.setTagCompound(new NBTTagCompound()); } - return false; - } - - //QUALITY// - - public static ItemStack setQuality(ItemStack item, float qualityLvl) - { - if(item.getMaxStackSize() > 0)return item; - - NBTTagCompound nbt = getOrCreateNBT(item); - nbt.setFloat("MFCraftQuality", qualityLvl); - - return item; - } - - /** - * Gets how well an item has been crafted: 100 is default ranging from 0-200 - */ - public static float getQualityLevel(ItemStack stack) - { - if(stack.getMaxStackSize() == 1) - { - if(stack.hasTagCompound() && stack.getTagCompound().hasKey("MFCraftQuality")) - { - return stack.getTagCompound().getFloat("MFCraftQuality"); - } - } - return 100.0F; - } - - public static int setDuraOnQuality(ItemStack item, int dura) - { - float quality = getQualityLevel(item); - if(item.hasTagCompound() && item.getTagCompound().hasKey("MF_Inferior")) - { - if(item.getTagCompound().getBoolean("MF_Inferior")) - { - dura /= 2; - } - else - { - dura *= 2; - } - } - - if(quality > 100) - { - dura += ((dura) / 100F * (quality-100) );//This means 100+ adds to 2x durability at level 200 - } - if(quality < 100) - { - dura -= ((dura*0.75) / 100 * (100F - quality));//This means 100- takes upto 75% from it's max durability lvl0 is 25%dura - } - return dura; - } - - public static float modifyDigOnQuality(ItemStack item, float digspeed) - { - if(item.hasTagCompound() && item.getTagCompound().hasKey("MF_Inferior")) - { - if(item.getTagCompound().getBoolean("MF_Inferior")) - { - digspeed /= 1.25F; - } - else - { - digspeed *= 1.25F; - } - } - float quality = getQualityLevel(item); - - if(quality > 100) - { - digspeed += ((digspeed*0.5F) / 100F * (quality-100) );//This means 100+ adds 50% speed at level 200 - } - if(quality < 100) - { - digspeed -= ((digspeed*0.5) / 100 * (100F - quality));//This means 100- takes upto 50% from it's max speed lvl0 is 50% speed - } - return digspeed; - } - - public static float modifyDamOnQuality(ItemStack item, float damage) - { - float quality = getQualityLevel(item); - if(item.hasTagCompound() && item.getTagCompound().hasKey("MF_Inferior")) - { - if(item.getTagCompound().getBoolean("MF_Inferior")) - { - damage /= 1.25F; - } - else - { - damage *= 1.25F; - } - } - if(quality > 100) - { - damage += ((damage*0.25F) / 100F * (quality-100) );//This means 100+ adds 25% damage at level 200 - } - if(quality < 100) - { - damage -= ((damage*0.25) / 100 * (100F - quality));//This means 100- takes upto 25% from it's max damage lvl0 is 75% damage - } - return damage; - } - - public static float modifyArmourRating(ItemStack item, float rating) - { - float quality = getQualityLevel(item); - if(item.hasTagCompound() && item.getTagCompound().hasKey("MF_Inferior")) - { - if(item.getTagCompound().getBoolean("MF_Inferior")) - { - rating /= 1.25F; - } - else - { - rating *= 1.25F; - } - } - - if(quality > 100) - { - rating += ((rating*0.5F) / 100F * (quality-100) );//This means 100+ adds 50% armour at level 200 - } - if(quality < 100) - { - rating -= ((rating*0.5) / 100 * (100F - quality));//This means 100- takes upto 50% from it's max armour lvl0 is 50% armour - } - return rating; - } - - //NBT// - - private static NBTTagCompound getOrCreateNBT(ItemStack item) - { - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - - return item.getTagCompound(); - } - - public static boolean hasCustomQualityTag(ItemStack item) - { - return item.hasTagCompound() && item.getTagCompound().hasKey("MFCraftQuality"); - } - - private static String specialItem = "MF_SpecialItemType"; - public static void setSpecial(ItemStack item, String type) - { - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - item.getTagCompound().setString(specialItem, type); - } - public static boolean isSpecial(ItemStack item, String type) - { - return getSpecial(item)!= null && getSpecial(item).equals(type); - } - public static String getSpecial(ItemStack item) - { - if(item.hasTagCompound() && item.getTagCompound().hasKey(specialItem)) - { - return item.getTagCompound().getString(specialItem); - } - return null; - } - - public static void setToolSharpness(ItemStack item, float level) - { - NBTTagCompound nbt = getOrCreateNBT(item); - float currentLevel = getSharpnessLevel(item); - float maxLevel = getMaxSharpness(item); - nbt.setFloat(sharpnessLevelNBT, Math.min(maxLevel, currentLevel+level)); - } - - public static float getSharpnessLevel(ItemStack item) - { - NBTTagCompound nbt = item.getTagCompound(); - if(nbt != null && nbt.hasKey(sharpnessLevelNBT)) - { - return nbt.getFloat(sharpnessLevelNBT); - } - return 0F; - } - - public static final String sharpnessLevelNBT = "MF_Sharpness_Level"; - - public static boolean canBeSharpened(ItemStack itemstack, float level) - { - if(itemstack == null)return false; - return false; - } - - /** - * The max amount of uses of sharpness - */ - public static float getMaxSharpness(ItemStack item) - { - return getSharpnessTraits(item)[0]; - } - /** - * The max percent that it can increase damage - */ - public static float getMaxSharpnessPercent(ItemStack item) - { - return getSharpnessTraits(item)[1]; - } - /** - * The modifier for how much percent is added each use - */ - public static float getSharpUsesModifier(ItemStack item) - { - return getSharpnessTraits(item)[2]; - } - //maxSharpness, maxBuff, sharpnessModifier - public static float[] getSharpnessTraits(ItemStack item) - { - float[] list = new float[]{100, 20F, 3F}; - - if(item != null && item.getItem() instanceof ISharpenable) - { - ISharpenable instance = (ISharpenable)item.getItem(); - list[0] = instance.getMaxSharpness(item); - list[1] = instance.getDamagePercentMax(item); - list[2] = instance.getSharpUsesModifier(item); - } - return list; - } - - public static String[] breakdownLineForResearchArray(String string) - { - String temp = ""; - ArrayList entries = new ArrayList(); - - for(int a = 0; a < string.length(); a ++) - { - if(a == string.length()-1) - { - temp = temp + string.charAt(a); - } - if(string.charAt(a) == " ".charAt(0) || a == string.length()-1) - { - entries.add(temp); - } - else - { - if(string.charAt(a) != " ".charAt(0)) - { - temp = temp + string.charAt(a); - } - } - } - int size = entries.size(); - String[] stringList = new String[size]; - for(int i = 0; i < size; i++) - { - stringList[i] = entries.get(i); - } - return stringList; - } - public static boolean isToolSufficient(ItemStack heldItem, String toolNeeded, int toolTierNeeded) - { - String toolType = getCrafterTool(heldItem); - int tier = getCrafterTier(heldItem); - - return toolType.equalsIgnoreCase(toolNeeded) && tier >= toolTierNeeded; - } - public static void setUnbreakable(ItemStack tool) - { - if(!tool.hasTagCompound()) - { - tool.setTagCompound(new NBTTagCompound()); - } - tool.getTagCompound().setBoolean("Unbreakable", true); - } + tool.getTagCompound().setBoolean("Unbreakable", isUnbreakable); + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/IArtefact.java b/src/main/java/minefantasy/mf2/api/knowledge/IArtefact.java index 221a8656..680cc897 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/IArtefact.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/IArtefact.java @@ -2,7 +2,6 @@ import net.minecraft.item.ItemStack; -public interface IArtefact -{ - public int getStudyTime(ItemStack item); +public interface IArtefact { + public int getStudyTime(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/InformationBase.java b/src/main/java/minefantasy/mf2/api/knowledge/InformationBase.java index 373f9591..0a206a08 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/InformationBase.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/InformationBase.java @@ -1,8 +1,7 @@ package minefantasy.mf2.api.knowledge; -import java.util.ArrayList; - -import minefantasy.mf2.api.crafting.anvil.IAnvilRecipe; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.knowledge.client.EntryPage; import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.api.rpg.Skill; @@ -12,104 +11,109 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.IStatStringFormat; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.StatCollector; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class InformationBase -{ - public static boolean easyResearch = false; - public static boolean unlockAll = false; - public int ID = 0; - private static int nextID = 0; - private boolean startedUnlocked = false; +import java.util.ArrayList; + +public class InformationBase { + public static boolean easyResearch = false; + public static boolean unlockAll = false; + public static Item scroll; + private static int nextID = 0; public final int displayColumn; public final int displayRow; public final InformationBase parentInfo; + public final ItemStack theItemStack; private final String description; + private final String idName; + public int ID = 0; + public String[] requirements = null; + /** + * Returns the fully description of the achievement - ready to be displayed on + * screen. + */ + public Object[] descriptValues; + private boolean startedUnlocked = false; @SideOnly(Side.CLIENT) private IStatStringFormat statStringFormatter; - public final ItemStack theItemStack; private boolean isSpecial; private boolean isPerk; - private final String idName; private ArrayList skills = new ArrayList(); - public String[] requirements = null; private int artefactCount = 0; + private ArrayList pages = new ArrayList(); - public InformationBase(String name, int x, int y, int artefacts, Item icon, InformationBase parent) - { + public InformationBase(String name, int x, int y, int artefacts, Item icon, InformationBase parent) { this(name, x, y, artefacts, new ItemStack(icon), parent); } - public InformationBase(String name, int x, int y, int artefacts, Block icon, InformationBase parent) - { + + public InformationBase(String name, int x, int y, int artefacts, Block icon, InformationBase parent) { this(name, x, y, artefacts, new ItemStack(icon), parent); } - public InformationBase(String name, int x, int y, int artefacts, ItemStack icon, InformationBase parent) - { - this.idName = name; + public InformationBase(String name, int x, int y, int artefacts, ItemStack icon, InformationBase parent) { + this.idName = name; this.theItemStack = icon; this.description = "knowledge." + idName + ".desc"; this.displayColumn = x; this.displayRow = y; - if (x < InformationList.minDisplayColumn) - { + if (x < InformationList.minDisplayColumn) { InformationList.minDisplayColumn = x; } - if (y < InformationList.minDisplayRow) - { + if (y < InformationList.minDisplayRow) { InformationList.minDisplayRow = y; } - if (x > InformationList.maxDisplayColumn) - { + if (x > InformationList.maxDisplayColumn) { InformationList.maxDisplayColumn = x; } - if (y > InformationList.maxDisplayRow) - { + if (y > InformationList.maxDisplayRow) { InformationList.maxDisplayRow = y; } this.parentInfo = parent; this.artefactCount = Math.max(0, artefacts); } - - public InformationBase addSkill(Skill skill, int level) - { - if(RPGElements.isSystemActive) - { - skills.add(new SkillRequirement(skill, level)); - } - return this; + + public InformationBase addSkill(Skill skill, int level) { + if (RPGElements.isSystemActive) { + skills.add(new SkillRequirement(skill, level)); + } + return this; } - - - public InformationBase setUnlocked() - { - startedUnlocked = true; - return this; + + public InformationBase setUnlocked() { + startedUnlocked = true; + return this; } - public InformationBase setPage(InformationPage page) - { - page.addInfo(this); - return this; + + public InformationBase setPage(InformationPage page) { + page.addInfo(this); + return this; } + /* + * public IChatComponent func_150951_e() { IChatComponent ichatcomponent = + * super.func_150951_e(); + * ichatcomponent.getChatStyle().setColor(this.getSpecial() ? + * EnumChatFormatting.DARK_PURPLE : EnumChatFormatting.GREEN); return + * ichatcomponent; } + * + * public InformationBase func_150953_b(Class p_150953_1_) { return + * (InformationBase)super.func_150953_b(p_150953_1_); } + */ + /** - * Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to - * achieve. + * Special achievements have a 'spiked' (on normal texture pack) frame, special + * achievements are the hardest ones to achieve. */ - public InformationBase setSpecial() - { + public InformationBase setSpecial() { this.isSpecial = true; return this; } - public InformationBase setPerk() - { + + public InformationBase setPerk() { this.isPerk = true; return this; } @@ -117,197 +121,157 @@ public InformationBase setPerk() /** * Register the stat into StatList. */ - public InformationBase registerStat() - { - ID = nextID; - nextID++; + public InformationBase registerStat() { + ID = nextID; + nextID++; InformationList.knowledgeList.add(this); InformationList.nameMap.put(idName.toLowerCase(), this); return this; } -/* - public IChatComponent func_150951_e() - { - IChatComponent ichatcomponent = super.func_150951_e(); - ichatcomponent.getChatStyle().setColor(this.getSpecial() ? EnumChatFormatting.DARK_PURPLE : EnumChatFormatting.GREEN); - return ichatcomponent; + public InformationBase setDescriptValues(Object... values) { + descriptValues = values; + return this; } - public InformationBase func_150953_b(Class p_150953_1_) - { - return (InformationBase)super.func_150953_b(p_150953_1_); - } -*/ - /** - * Returns the fully description of the achievement - ready to be displayed on screen. - */ - public Object[] descriptValues; - public InformationBase setDescriptValues(Object... values) - { - descriptValues = values; - return this; - } @SideOnly(Side.CLIENT) - public String getDescription() - { - String localised = StatCollector.translateToLocal(this.description); - if(descriptValues != null && descriptValues.length > 0) - { - localised = StatCollector.translateToLocalFormatted(description, descriptValues); - } + public String getDescription() { + String localised = StatCollector.translateToLocal(this.description); + if (descriptValues != null && descriptValues.length > 0) { + localised = StatCollector.translateToLocalFormatted(description, descriptValues); + } String text = this.statStringFormatter != null ? this.statStringFormatter.formatString(localised) : localised; - - if(RPGElements.isSystemActive) - { - String[] requirements = getRequiredSkills(); - if(requirements != null && requirements.length > 0) - { - text += "\n\n"; - for(String s : requirements) - { - text += s + "\n"; - } - } - } + + if (RPGElements.isSystemActive) { + String[] requirements = getRequiredSkills(); + if (requirements != null && requirements.length > 0) { + text += "\n\n"; + for (String s : requirements) { + text += s + "\n"; + } + } + } return text; } + @SideOnly(Side.CLIENT) - public String getDisplayName() - { - String name = this.statStringFormatter != null ? this.statStringFormatter.formatString(StatCollector.translateToLocal("knowledge."+this.idName)) : StatCollector.translateToLocal("knowledge."+this.idName); - - if(!easyResearch) - { - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if(player != null && !ResearchLogic.hasInfoUnlocked(player, this)) - { - int artefacts = ResearchLogic.getArtefactCount(this.idName, player); - int max = this.getArtefactCount(); - name += StatCollector.translateToLocalFormatted("research.cluecount", artefacts, max); - } + public String getDisplayName() { + String name = this.statStringFormatter != null + ? this.statStringFormatter.formatString(StatCollector.translateToLocal("knowledge." + this.idName)) + : StatCollector.translateToLocal("knowledge." + this.idName); + + if (!easyResearch) { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if (player != null && !ResearchLogic.hasInfoUnlocked(player, this)) { + int artefacts = ResearchLogic.getArtefactCount(this.idName, player); + int max = this.getArtefactCount(); + name += StatCollector.translateToLocalFormatted("research.cluecount", artefacts, max); + } } - + return name; } /** - * Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to - * achieve. + * Special achievements have a 'spiked' (on normal texture pack) frame, special + * achievements are the hardest ones to achieve. */ - public boolean getSpecial() - { + public boolean getSpecial() { return this.isSpecial; } - public boolean getPerk() - { + + public boolean getPerk() { return this.isPerk; } - public boolean onPurchase(EntityPlayer user) - { - if(!hasSkillsUnlocked(user)) - { - return false; - } - - boolean success = ResearchLogic.canPurchase(user, this); - if(success && !user.worldObj.isRemote) - { - user.worldObj.playSoundAtEntity(user, "minefantasy2:updateResearch", 1.0F, 1.0F); - if(getPerk()) - { - user.worldObj.playSoundAtEntity(user, "random.levelup", 1.0F, 1.0F); - } - } - - if(isEasy()) - { - ResearchLogic.tryUnlock(user, this); - } - else - { - } - return true; - } - public static Item scroll; - - public boolean hasSkillsUnlocked(EntityPlayer player) - { - if(skills == null)return true; - for(int id = 0; id < skills.size(); id++) - { - SkillRequirement requirement = skills.get(id); - if(!requirement.isAvailable(player)) - { - return false; - } - } - return true; - } - public String getUnlocalisedName() - { - return idName; - } - - private ArrayList pages = new ArrayList(); - public void addPages(EntryPage... info) - { - for(EntryPage page: info) - { - pages.add(page); - } - } - public ArrayList getPages() - { - return pages; - } - - public boolean isUnlocked(int id, EntityPlayer player) - { - if(this.skills != null) - { - return skills.get(id) != null && skills.get(id).isAvailable(player); - } - return true; - } - public String[] getRequiredSkills() - { - if(this.requirements == null) - { - requirements = new String[skills.size()]; - for(int id = 0; id < skills.size(); id++) - { - SkillRequirement requirement = skills.get(id); - requirements[id] = StatCollector.translateToLocalFormatted("rpg.required", requirement.level, requirement.skill.getDisplayName()); - } - } - return requirements; - } - - public boolean isPreUnlocked() - { - return !getPerk() && (unlockAll || startedUnlocked); - } - public int getArtefactCount() - { - return artefactCount; - } - public boolean isEasy() - { - return getPerk() || this.getArtefactCount() == 0 || easyResearch; - } + + public boolean onPurchase(EntityPlayer user) { + if (!hasSkillsUnlocked(user)) { + return false; + } + + boolean success = ResearchLogic.canPurchase(user, this); + if (success && !user.worldObj.isRemote) { + user.worldObj.playSoundAtEntity(user, "minefantasy2:updateResearch", 1.0F, 1.0F); + if (getPerk()) { + user.worldObj.playSoundAtEntity(user, "random.levelup", 1.0F, 1.0F); + } + } + + if (isEasy()) { + ResearchLogic.tryUnlock(user, this); + } else { + } + return true; + } + + public boolean hasSkillsUnlocked(EntityPlayer player) { + if (skills == null) + return true; + for (int id = 0; id < skills.size(); id++) { + SkillRequirement requirement = skills.get(id); + if (!requirement.isAvailable(player)) { + return false; + } + } + return true; + } + + public String getUnlocalisedName() { + return idName; + } + + public void addPages(EntryPage... info) { + for (EntryPage page : info) { + pages.add(page); + } + } + + public ArrayList getPages() { + return pages; + } + + public boolean isUnlocked(int id, EntityPlayer player) { + if (this.skills != null) { + return skills.get(id) != null && skills.get(id).isAvailable(player); + } + return true; + } + + public String[] getRequiredSkills() { + if (this.requirements == null) { + requirements = new String[skills.size()]; + for (int id = 0; id < skills.size(); id++) { + SkillRequirement requirement = skills.get(id); + requirements[id] = StatCollector.translateToLocalFormatted("rpg.required", requirement.level, + requirement.skill.getDisplayName()); + } + } + return requirements; + } + + public boolean isPreUnlocked() { + return !getPerk() && (unlockAll || startedUnlocked); + } + + public int getArtefactCount() { + return artefactCount; + } + + public boolean isEasy() { + return getPerk() || this.getArtefactCount() == 0 || easyResearch; + } } -class SkillRequirement -{ - protected Skill skill; - protected int level; - SkillRequirement(Skill skill, int level) - { - this.skill = skill; - this.level = level; - } - public boolean isAvailable(EntityPlayer player) - { - return RPGElements.hasLevel(player, skill, level); - } + +class SkillRequirement { + protected Skill skill; + protected int level; + + SkillRequirement(Skill skill, int level) { + this.skill = skill; + this.level = level; + } + + public boolean isAvailable(EntityPlayer player) { + return RPGElements.hasLevel(player, skill, level); + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/InformationList.java b/src/main/java/minefantasy/mf2/api/knowledge/InformationList.java index c4f5c405..7007acfe 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/InformationList.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/InformationList.java @@ -1,32 +1,47 @@ package minefantasy.mf2.api.knowledge; +import minefantasy.mf2.api.rpg.SkillList; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import minefantasy.mf2.api.rpg.SkillList; +public class InformationList { + public static InformationPage artisanry = new InformationPage("infoPage.artisanry", SkillList.artisanry) + .registerInfoPage(); + public static InformationPage construction = new InformationPage("infoPage.construction", SkillList.construction) + .registerInfoPage(); + public static InformationPage provisioning = new InformationPage("infoPage.provisioning", SkillList.provisioning) + .registerInfoPage(); + public static InformationPage engineering = new InformationPage("infoPage.engineering", SkillList.engineering) + .registerInfoPage(); + public static InformationPage mastery = new InformationPage("infoPage.mastery", null).registerInfoPage(); -public class InformationList -{ - public static InformationPage artisanry = new InformationPage("infoPage.artisanry", SkillList.artisanry).registerInfoPage(); - public static InformationPage construction = new InformationPage("infoPage.construction", SkillList.construction).registerInfoPage(); - public static InformationPage provisioning = new InformationPage("infoPage.provisioning", SkillList.provisioning).registerInfoPage(); - public static InformationPage engineering = new InformationPage("infoPage.engineering", SkillList.engineering).registerInfoPage(); - public static InformationPage mastery = new InformationPage("infoPage.mastery", null).registerInfoPage(); - - /** Is the smallest column used to display a achievement on the GUI. */ + /** + * Is the smallest column used to display a achievement on the GUI. + */ public static int minDisplayColumn; - /** Is the smallest row used to display a achievement on the GUI. */ + /** + * Is the smallest row used to display a achievement on the GUI. + */ public static int minDisplayRow; - /** Is the biggest column used to display a achievement on the GUI. */ + /** + * Is the biggest column used to display a achievement on the GUI. + */ public static int maxDisplayColumn; - /** Is the biggest row used to display a achievement on the GUI. */ + /** + * Is the biggest row used to display a achievement on the GUI. + */ public static int maxDisplayRow; - /** Holds a list of all registered achievements. */ - public static List knowledgeList = new ArrayList(); - public static HashMapnameMap = new HashMap(); + /** + * Holds a list of all registered achievements. + */ + public static List knowledgeList = new ArrayList(); + public static HashMap nameMap = new HashMap(); + /** * A stub functions called to make the static initializer for this class run. */ - public static void init() {} + public static void init() { + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/api/knowledge/InformationPage.java b/src/main/java/minefantasy/mf2/api/knowledge/InformationPage.java index e6b32ba5..75e064a2 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/InformationPage.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/InformationPage.java @@ -1,122 +1,106 @@ package minefantasy.mf2.api.knowledge; -import java.util.Arrays; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - import minefantasy.mf2.api.rpg.Skill; import net.minecraft.util.StatCollector; -public class InformationPage -{ +import java.util.*; + +public class InformationPage { + private static LinkedList infoPages = new LinkedList(); + public final Skill baseSkill; private String name; private LinkedList entries; - public final Skill baseSkill; - public InformationPage(String name, Skill skill, InformationBase... achievements) - { + public InformationPage(String name, Skill skill, InformationBase... achievements) { this.name = name; this.baseSkill = skill; this.entries = new LinkedList(Arrays.asList(achievements)); } - public String getName() - { - return name; - } - - public List getInfoList() - { - return entries; - } - - private static LinkedList infoPages = new LinkedList(); - /** * Registers an achievement page. + * * @param page The page. */ - public static void registerInfoPage(InformationPage page) - { - if (getInfoPage(page.getName()) != null) - { + public static void registerInfoPage(InformationPage page) { + if (getInfoPage(page.getName()) != null) { throw new RuntimeException("Duplicate achievement page name \"" + page.getName() + "\"!"); } infoPages.add(page); } - + /** * Will return an achievement page by its index on the list. + * * @param index The page's index. - * @return the achievement page corresponding to the index or null if invalid index + * @return the achievement page corresponding to the index or null if invalid + * index */ - public static InformationPage getInfoPage(int index) - { + public static InformationPage getInfoPage(int index) { return infoPages.get(index); } - + /** * Will return an achievement page by its name. + * * @param name The page's name. * @return the achievement page with the given name or null if no such page */ - public static InformationPage getInfoPage(String name) - { - for (InformationPage page : infoPages) - { - if (page.getName().equals(name)) - { + public static InformationPage getInfoPage(String name) { + for (InformationPage page : infoPages) { + if (page.getName().equals(name)) { return page; } } return null; } - + /** * Will return the list of achievement pages. + * * @return the list's size */ - public static Set getInfoPages() - { + public static Set getInfoPages() { return new HashSet(infoPages); } - + /** * Will return whether an achievement is in any page or not. + * * @param achievement The achievement. */ - public static boolean isInfoInPages(InformationBase achievement) - { - for (InformationPage page : infoPages) - { - if (page.getInfoList().contains(achievement)) - { + public static boolean isInfoInPages(InformationBase achievement) { + for (InformationPage page : infoPages) { + if (page.getInfoList().contains(achievement)) { return true; } } return false; } - - public static String getTitle(int index) - { - return StatCollector.translateToLocal(index == -1 ? "Basic" : getInfoPage(index).getName()); + + public static String getTitle(int index) { + return StatCollector.translateToLocal(index == -1 ? "infoPage.basic" : getInfoPage(index).getName()); } - public static Skill getSkill(int index) - { + + public static Skill getSkill(int index) { return index == -1 ? null : getInfoPage(index).baseSkill; } - public void addInfo(InformationBase entry) - { - entries.add(entry); - } + public String getName() { + return name; + } + + public List getInfoList() { + return entries; + } + + public void addInfo(InformationBase entry) { + entries.add(entry); + } - public InformationPage registerInfoPage() - { - registerInfoPage(this); - return this; - } + public InformationPage registerInfoPage() { + registerInfoPage(this); + return this; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/api/knowledge/KnowledgeType.java b/src/main/java/minefantasy/mf2/api/knowledge/KnowledgeType.java index b35e392b..f48b36bd 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/KnowledgeType.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/KnowledgeType.java @@ -4,17 +4,17 @@ public class KnowledgeType { - public final String id; - public final EnumChatFormatting color; - public final boolean autoUnlock; + public final String id; + public final EnumChatFormatting color; + public final boolean autoUnlock; - public KnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) { - this.id = id; - this.color = color; - this.autoUnlock = autoUnlock; - } + public KnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) { + this.id = id; + this.color = color; + this.autoUnlock = autoUnlock; + } - public String getUnlocalizedName() { - return "botania.knowledge." + id; - } + public String getUnlocalizedName() { + return "botania.knowledge." + id; + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/ResearchArtefacts.java b/src/main/java/minefantasy/mf2/api/knowledge/ResearchArtefacts.java index b6409023..2f6467e6 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/ResearchArtefacts.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/ResearchArtefacts.java @@ -1,75 +1,64 @@ package minefantasy.mf2.api.knowledge; -import java.util.ArrayList; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class ResearchArtefacts -{ - public static void addArtefact(Object input, InformationBase research) - { - addArtefact(input, research.getUnlocalisedName()); - } - public static void addArtefact(Object input, String research) - { - ItemStack itemstack = convert(input); - - if(itemstack != null) - { - OreDictionary.registerOre("Artefact-"+research, itemstack); - } - } +import java.util.ArrayList; + +public class ResearchArtefacts { + public static void addArtefact(Object input, InformationBase research) { + addArtefact(input, research.getUnlocalisedName()); + } + + public static void addArtefact(Object input, String research) { + ItemStack itemstack = convert(input); + + if (itemstack != null) { + OreDictionary.registerOre("Artefact-" + research, itemstack); + } + } + + public static ArrayList getResearchNames(ItemStack item) { + ArrayList names = new ArrayList(); + if (item == null) + return names; + + for (int i : OreDictionary.getOreIDs(item)) { + String name = OreDictionary.getOreName(i); + if (name != null && name.startsWith("Artefact-")) { + String str = name.substring(9); + names.add(str); + } + } + return names; + } + + public static ItemStack convert(Object input) { + if (input == null) + return null; + + ItemStack itemstack = null; + if (input instanceof ItemStack) { + return (ItemStack) input; + } else if (input instanceof Block) { + return new ItemStack((Block) input, 1, OreDictionary.WILDCARD_VALUE); + } else if (input instanceof Item) { + return new ItemStack((Item) input, 1, OreDictionary.WILDCARD_VALUE); + } + + return null; + } - public static ArrayList getResearchNames(ItemStack item) - { - ArrayListnames = new ArrayList(); - if(item == null)return names; - - for(int i: OreDictionary.getOreIDs(item)) - { - String name = OreDictionary.getOreName(i); - if(name != null && name.startsWith("Artefact-")) - { - String str = name.substring(9); - names.add(str); - } - } - return names; - } - - public static ItemStack convert(Object input) - { - if(input == null)return null; - - ItemStack itemstack = null; - if(input instanceof ItemStack) - { - return (ItemStack)input; - } - else if(input instanceof Block) - { - return new ItemStack((Block)input, 1, OreDictionary.WILDCARD_VALUE); - } - else if(input instanceof Item) - { - return new ItemStack((Item)input, 1, OreDictionary.WILDCARD_VALUE); - } - - return null; - } - public static int useArtefact(ItemStack itemStack, InformationBase base, EntityPlayer user) - { - int artefacts = ResearchLogic.addArtefact(base.getUnlocalisedName().toLowerCase(), user); - ResearchLogic.addArtefactUsed(user, base, itemStack); - if(artefacts >= base.getArtefactCount()) - { - ResearchLogic.tryUnlock(user, base); - return -1; - } - return artefacts; - } + public static int useArtefact(ItemStack itemStack, InformationBase base, EntityPlayer user) { + int artefacts = ResearchLogic.addArtefact(base.getUnlocalisedName().toLowerCase(), user); + ResearchLogic.addArtefactUsed(user, base, itemStack); + if (artefacts >= base.getArtefactCount()) { + ResearchLogic.tryUnlock(user, base); + return -1; + } + return artefacts; + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/ResearchLogic.java b/src/main/java/minefantasy/mf2/api/knowledge/ResearchLogic.java index 941a3e07..be3765b0 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/ResearchLogic.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/ResearchLogic.java @@ -9,176 +9,152 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.WorldServer; -public class ResearchLogic -{ - public static boolean canPurchase(EntityPlayer player, InformationBase base) - { - if(base.isPreUnlocked() || !canUnlockInfo(player, base)) - { - return false; - } - NBTTagCompound nbt = getNBT(player); - if(!nbt.hasKey("Research_" + base.getUnlocalisedName())) - { - return true; - } - return false; - } - public static void forceUnlock(EntityPlayer player, InformationBase base) - { - NBTTagCompound nbt = getNBT(player); - nbt.setBoolean("Research_" + base.getUnlocalisedName(), true); - } - - public static boolean tryUnlock(EntityPlayer player, InformationBase base) - { - if(base.isPreUnlocked() || !canUnlockInfo(player, base)) - { - return false; - } - NBTTagCompound nbt = getNBT(player); - if(!nbt.hasKey("Research_" + base.getUnlocalisedName())) - { - nbt.setBoolean("Research_" + base.getUnlocalisedName(), true); - return true; - } - return false; - } - - public static boolean hasInfoUnlocked(EntityPlayer player, InformationBase base) - { - if(base.isPreUnlocked())return base.parentInfo == null || hasInfoUnlocked(player, base.parentInfo); - - NBTTagCompound nbt = getNBT(player); - String basename = base.getUnlocalisedName(); - if(nbt.hasKey("Research_" + basename)) - { - return nbt.getBoolean("Research_" + basename); - } +public class ResearchLogic { + public static final String KnowledgeNBT = "Knowledge"; + public static int knowledgelyr = 0; + + public static boolean canPurchase(EntityPlayer player, InformationBase base) { + if (base.isPreUnlocked() || !canUnlockInfo(player, base)) { + return false; + } + NBTTagCompound nbt = getNBT(player); + if (!nbt.hasKey("Research_" + base.getUnlocalisedName())) { + return true; + } return false; } - - public static boolean hasInfoUnlocked(EntityPlayer player, String basename) - { - InformationBase base = getResearch(basename); - if(base != null) - { - return hasInfoUnlocked(player, base); - } + + public static void forceUnlock(EntityPlayer player, InformationBase base) { + NBTTagCompound nbt = getNBT(player); + nbt.setBoolean("Research_" + base.getUnlocalisedName(), true); + } + + public static boolean tryUnlock(EntityPlayer player, InformationBase base) { + if (base.isPreUnlocked() || !canUnlockInfo(player, base)) { + return false; + } + NBTTagCompound nbt = getNBT(player); + if (!nbt.hasKey("Research_" + base.getUnlocalisedName())) { + nbt.setBoolean("Research_" + base.getUnlocalisedName(), true); + return true; + } + return false; + } + + public static boolean hasInfoUnlocked(EntityPlayer player, InformationBase base) { + if (base.isPreUnlocked()) + return base.parentInfo == null || hasInfoUnlocked(player, base.parentInfo); + + NBTTagCompound nbt = getNBT(player); + String basename = base.getUnlocalisedName(); + if (nbt.hasKey("Research_" + basename)) { + return nbt.getBoolean("Research_" + basename); + } + return false; + } + + public static boolean hasInfoUnlocked(EntityPlayer player, String basename) { + InformationBase base = getResearch(basename); + if (base != null) { + return hasInfoUnlocked(player, base); + } return true; } - - public static boolean hasInfoUnlocked(EntityPlayer player, String[] basenames) - { - for(String basename : basenames) - { - InformationBase base = InformationList.nameMap.get(basename); - if(base != null) - { - if(!hasInfoUnlocked(player, base)) - { - return false; - } - } - } + + public static boolean hasInfoUnlocked(EntityPlayer player, String[] basenames) { + for (String basename : basenames) { + InformationBase base = InformationList.nameMap.get(basename); + if (base != null) { + if (!hasInfoUnlocked(player, base)) { + return false; + } + } + } return true; } - private static NBTTagCompound getNBT(EntityPlayer player) - { - NBTTagCompound persistant = PlayerTagData.getPersistedData(player); - if(!persistant.hasKey(KnowledgeNBT)) - { - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("Layer", knowledgelyr); - persistant.setTag(KnowledgeNBT, tag); - } - NBTTagCompound load = persistant.getCompoundTag(KnowledgeNBT); - if(load.getInteger("Layer") != knowledgelyr) - { - persistant.removeTag(KnowledgeNBT); - - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("Layer", knowledgelyr); - persistant.setTag(KnowledgeNBT, tag); - } - return load; - } - - /** + private static NBTTagCompound getNBT(EntityPlayer player) { + NBTTagCompound persistant = PlayerTagData.getPersistedData(player); + if (!persistant.hasKey(KnowledgeNBT)) { + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("Layer", knowledgelyr); + persistant.setTag(KnowledgeNBT, tag); + } + NBTTagCompound load = persistant.getCompoundTag(KnowledgeNBT); + if (load.getInteger("Layer") != knowledgelyr) { + persistant.removeTag(KnowledgeNBT); + + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("Layer", knowledgelyr); + persistant.setTag(KnowledgeNBT, tag); + } + return load; + } + + /** * Returns true if the parent has been unlocked, or there is no parent */ - public static boolean canUnlockInfo(EntityPlayer player, InformationBase base) - { + public static boolean canUnlockInfo(EntityPlayer player, InformationBase base) { return base.parentInfo == null || hasInfoUnlocked(player, base.parentInfo); } - + @SideOnly(Side.CLIENT) - public static int func_150874_c(EntityPlayer player, InformationBase base) - { - if (hasInfoUnlocked(player, base)) - { + public static int func_150874_c(EntityPlayer player, InformationBase base) { + if (hasInfoUnlocked(player, base)) { return 0; - } - else - { + } else { int i = 0; - for (InformationBase knowledge1 = base.parentInfo; knowledge1 != null && !hasInfoUnlocked(player, knowledge1); ++i) - { + for (InformationBase knowledge1 = base.parentInfo; knowledge1 != null + && !hasInfoUnlocked(player, knowledge1); ++i) { knowledge1 = knowledge1.parentInfo; } return i; } } - - public static final String KnowledgeNBT = "Knowledge"; - public static int knowledgelyr = 0; - public static void syncData(EntityPlayer player) - { - if(!player.worldObj.isRemote) - { - ((WorldServer)player.worldObj).getEntityTracker().func_151248_b(player, new KnowledgePacket(player).generatePacket()); - } - } - public static InformationBase getResearch(String researchName) - { - return InformationList.nameMap.get(researchName.toLowerCase()); - } - - public static int getArtefactCount(String research, EntityPlayer user) - { - NBTTagCompound nbt = getNBT(user); - return nbt.getInteger("ArtefactCount-"+research); - } - public static void setArtefactCount(String research, EntityPlayer user, int count) - { - NBTTagCompound nbt = getNBT(user); - nbt.setInteger("ArtefactCount-"+research, count); - } - public static int addArtefact(String research, EntityPlayer user) - { - int count = getArtefactCount(research, user); - ++count; - setArtefactCount(research, user, count); - return count; - } - public static void addArtefactUsed(EntityPlayer user, InformationBase base, ItemStack item) - { - NBTTagCompound nbt = getNBT(user); - nbt.setBoolean(getKeyName(item, base), true); - } - public static boolean alreadyUsedArtefact(EntityPlayer user, InformationBase base, ItemStack item) - { - NBTTagCompound nbt = getNBT(user); - if(nbt.hasKey(getKeyName(item, base))) - { - return true; - } - return false; - } - private static String getKeyName(ItemStack item, InformationBase base) - { - return "research_"+base.getUnlocalisedName() + "_" + item.getUnlocalizedName() + "_" + item.getItemDamage(); - } + + public static void syncData(EntityPlayer player) { + if (!player.worldObj.isRemote) { + ((WorldServer) player.worldObj).getEntityTracker().func_151248_b(player, + new KnowledgePacket(player).generatePacket()); + } + } + + public static InformationBase getResearch(String researchName) { + return InformationList.nameMap.get(researchName.toLowerCase()); + } + + public static int getArtefactCount(String research, EntityPlayer user) { + NBTTagCompound nbt = getNBT(user); + return nbt.getInteger("ArtefactCount-" + research); + } + + public static void setArtefactCount(String research, EntityPlayer user, int count) { + NBTTagCompound nbt = getNBT(user); + nbt.setInteger("ArtefactCount-" + research, count); + } + + public static int addArtefact(String research, EntityPlayer user) { + int count = getArtefactCount(research, user); + ++count; + setArtefactCount(research, user, count); + return count; + } + + public static void addArtefactUsed(EntityPlayer user, InformationBase base, ItemStack item) { + NBTTagCompound nbt = getNBT(user); + nbt.setBoolean(getKeyName(item, base), true); + } + + public static boolean alreadyUsedArtefact(EntityPlayer user, InformationBase base, ItemStack item) { + NBTTagCompound nbt = getNBT(user); + if (nbt.hasKey(getKeyName(item, base))) { + return true; + } + return false; + } + + private static String getKeyName(ItemStack item, InformationBase base) { + return "research_" + base.getUnlocalisedName() + "_" + item.getUnlocalizedName() + "_" + item.getItemDamage(); + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPage.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPage.java index 385b2f1e..d8179ca9 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPage.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPage.java @@ -1,17 +1,16 @@ package minefantasy.mf2.api.knowledge.client; -import net.minecraft.client.gui.GuiScreen; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.gui.GuiScreen; @SideOnly(Side.CLIENT) -public abstract class EntryPage -{ - public static final int universalBookImageWidth = 178; - public static final int universalBookImageHeight = 227; - - public abstract void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick); - public abstract void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick); - - public static int[]recipeOffsets = new int[]{15, 22}; +public abstract class EntryPage { + public static final int universalBookImageWidth = 178; + public static final int universalBookImageHeight = 227; + public static int[] recipeOffsets = new int[]{15, 22}; + + public abstract void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick); + + public abstract void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick); } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageBlastFurnace.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageBlastFurnace.java index 96d68fb0..7aa364a4 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageBlastFurnace.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageBlastFurnace.java @@ -1,17 +1,5 @@ package minefantasy.mf2.api.knowledge.client; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.MineFantasyAPI; -import minefantasy.mf2.api.helpers.ClientTickHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -19,117 +7,112 @@ import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class EntryPageBlastFurnace extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private ItemStack input, output; - - public EntryPageBlastFurnace(ItemStack in, ItemStack out) - { - this.input = in; - this.output = out; - } - - public EntryPageBlastFurnace(Item i1, ItemStack i2) - { - this(new ItemStack(i1), i2); - } - - public EntryPageBlastFurnace(Item i1, Item i2) - { - this(new ItemStack(i1), new ItemStack(i2)); - } - - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - tooltipStack = null; - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/blastfurnaceGrid.png")); - parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); - +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class EntryPageBlastFurnace extends EntryPage { + private Minecraft mc = Minecraft.getMinecraft(); + private ItemStack input, output; + private ItemStack tooltipStack; + + public EntryPageBlastFurnace(ItemStack in, ItemStack out) { + this.input = in; + this.output = out; + } + + public EntryPageBlastFurnace(Item i1, ItemStack i2) { + this(new ItemStack(i1), i2); + } + + public EntryPageBlastFurnace(Item i1, Item i2) { + this(new ItemStack(i1), new ItemStack(i2)); + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + tooltipStack = null; + + this.mc.getTextureManager() + .bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/blastfurnaceGrid.png")); + parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); + String cft = "<" + StatCollector.translateToLocal("method.blastfurnace") + ">"; - mc.fontRenderer.drawSplitString(cft, posX+(universalBookImageWidth/2) - (mc.fontRenderer.getStringWidth(cft)/2), posY+150, 117, 0); - + mc.fontRenderer.drawSplitString(cft, + posX + (universalBookImageWidth / 2) - (mc.fontRenderer.getStringWidth(cft) / 2), posY + 150, 117, 0); + renderRecipe(parent, x, y, f, posX, posY); - if(tooltipStack != null) - { - List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - List parsedTooltip = new ArrayList(); - boolean first = true; - - for(String s : tooltipData) - { - String s_ = s; - if(!first) - s_ = EnumChatFormatting.GRAY + s; - parsedTooltip.add(s_); - first = false; - } - - minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); - } - - } - - private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY) - { - renderResult(parent, output, false, posX, posY+74, mx, my); - renderResult(parent, input, false, posX, posY, mx, my); - } - - public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - int xPos = xOrigin + 80; - int yPos = yOrigin + 41; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); - } - - private ItemStack tooltipStack; - public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, int my) - { - RenderItem render = new RenderItem(); - if(mx > xPos && mx < (xPos+16) && my > yPos && my < (yPos+16)) - { - tooltipStack = stack; - } - boolean mouseDown = Mouse.isButtonDown(0); - - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_DEPTH_TEST); - render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - - GL11.glDisable(GL11.GL_LIGHTING); - } - - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } + if (tooltipStack != null) { + List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + List parsedTooltip = new ArrayList(); + boolean first = true; + + for (String s : tooltipData) { + String s_ = s; + if (!first) + s_ = EnumChatFormatting.GRAY + s; + parsedTooltip.add(s_); + first = false; + } + + minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); + } + + } + + private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY) { + renderResult(parent, output, false, posX, posY + 74, mx, my); + renderResult(parent, input, false, posX, posY, mx, my); + } + + public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, + int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = xOrigin + 80; + int yPos = yOrigin + 41; + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); + } + + public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, + int my) { + RenderItem render = new RenderItem(); + if (mx > xPos && mx < (xPos + 16) && my > yPos && my < (yPos + 16)) { + tooltipStack = stack; + } + boolean mouseDown = Mouse.isButtonDown(0); + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_DEPTH_TEST); + render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + + GL11.glDisable(GL11.GL_LIGHTING); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageCraft.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageCraft.java index eb8bc97d..cb5b36f7 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageCraft.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageCraft.java @@ -1,66 +1,47 @@ package minefantasy.mf2.api.knowledge.client; -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; -public class EntryPageCraft extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private IRecipe[] recipes = new IRecipe[]{}; - public static int switchRate = 15; - private int recipeID; - - public EntryPageCraft(IRecipe... recipes) - { - this.recipes = recipes; - } - - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - if(onTick) - { - tickRecipes(); - } - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/craftGrid.png")); +public class EntryPageCraft extends EntryPage { + public static int switchRate = 15; + private Minecraft mc = Minecraft.getMinecraft(); + private IRecipe[] recipes = new IRecipe[]{}; + private int recipeID; + + public EntryPageCraft(IRecipe... recipes) { + this.recipes = recipes; + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + if (onTick) { + tickRecipes(); + } + + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/craftGrid.png")); parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); - + IRecipe recipe = recipes[recipeID]; renderRecipe(parent, x, y, f, posX, posY, recipe); - - } - private void renderRecipe(GuiScreen parent, int x, int y, float f, int posX, int posY, IRecipe recipe) - { - //TODO: Render Grid - } + } + + private void renderRecipe(GuiScreen parent, int x, int y, float f, int posX, int posY, IRecipe recipe) { + // TODO: Render Grid + } - private void tickRecipes() - { - if(recipeID < recipes.length-1) - { - ++recipeID; - } - else - { - recipeID = 0; - } - } + private void tickRecipes() { + if (recipeID < recipes.length - 1) { + ++recipeID; + } else { + recipeID = 0; + } + } - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageCrucible.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageCrucible.java index a1cbc8e3..19d737e2 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageCrucible.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageCrucible.java @@ -1,17 +1,5 @@ package minefantasy.mf2.api.knowledge.client; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.MineFantasyAPI; -import minefantasy.mf2.api.helpers.ClientTickHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.api.refine.Alloy; import net.minecraft.client.Minecraft; @@ -19,170 +7,158 @@ import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class EntryPageCrucible extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private Alloy[] recipes = new Alloy[]{}; - public static int switchRate = 15; - private int recipeID; - private boolean shapelessRecipe = false; - private boolean oreDictRecipe = false; - - public EntryPageCrucible(Alloy... recipes) - { - this.recipes = recipes; - } - - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - if(onTick) - { - tickRecipes(); - } - tooltipStack = null; - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/crucible.png")); - parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); - +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class EntryPageCrucible extends EntryPage { + public static int switchRate = 15; + private Minecraft mc = Minecraft.getMinecraft(); + private Alloy[] recipes = new Alloy[]{}; + private int recipeID; + private boolean shapelessRecipe = false; + private boolean oreDictRecipe = false; + private int currTier; + private ItemStack tooltipStack; + + public EntryPageCrucible(Alloy... recipes) { + this.recipes = recipes; + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + if (onTick) { + tickRecipes(); + } + tooltipStack = null; + + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/crucible.png")); + parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); + Alloy recipe = recipes[recipeID]; - String cft = "<" + StatCollector.translateToLocal("method."+getName()+"") + ">"; - mc.fontRenderer.drawSplitString(cft, posX+(universalBookImageWidth/2) - (mc.fontRenderer.getStringWidth(cft)/2), posY+175, 117, 0); - if(recipe != null) - { - currTier = recipe.getLevel(); + String cft = "<" + StatCollector.translateToLocal("method." + getName() + "") + ">"; + mc.fontRenderer.drawSplitString(cft, + posX + (universalBookImageWidth / 2) - (mc.fontRenderer.getStringWidth(cft) / 2), posY + 175, 117, 0); + if (recipe != null) { + currTier = recipe.getLevel(); } renderRecipe(parent, x, y, f, posX, posY, recipe); - - if(tooltipStack != null) + + if (tooltipStack != null) { + List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + List parsedTooltip = new ArrayList(); + boolean first = true; + + for (String s : tooltipData) { + String s_ = s; + if (!first) + s_ = EnumChatFormatting.GRAY + s; + parsedTooltip.add(s_); + first = false; + } + + minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); + } + } + + protected String getName() { + return currTier == 3 ? "crucibleT4" : currTier == 2 ? "crucibleT3" : currTier == 1 ? "crucibleT2" : "crucible"; + } + + private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY, Alloy recipe) { + drawGrid: { - List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - List parsedTooltip = new ArrayList(); - boolean first = true; - - for(String s : tooltipData) - { - String s_ = s; - if(!first) - s_ = EnumChatFormatting.GRAY + s; - parsedTooltip.add(s_); - first = false; - } - - minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); - } - } - private int currTier; - - protected String getName() - { - return currTier == 3 ? "crucibleT4" : currTier == 2 ? "crucibleT3" : currTier == 1 ? "crucibleT2" : "crucible"; - } - - private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY, Alloy recipe) - { - drawGrid: - { - for(int y = 0; y < 3; y++) - { - for(int x = 0; x < 3; x++) - { - int index = y * 3 + x; - - if(index >= recipe.recipeItems.size()) - { - break drawGrid; - } - - renderItemAtGridPos(parent, 1 + x, (3-y), (ItemStack) recipe.recipeItems.get(index), true, posX, posY, mx, my); - } - } - } - - renderResult(parent, recipe.getRecipeOutput(), false, posX, posY, mx, my); - } - private void tickRecipes() - { - if(recipeID < recipes.length-1) - { - ++recipeID; - } - else - { - recipeID = 0; - } - } - - public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - int xPos = xOrigin + 80; - int yPos = yOrigin + 144; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); - } - - public void renderItemAtGridPos(GuiScreen gui, int x, int y, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - int xPos = xOrigin + x * 29 + 7 + (y == 0 && x == 3 ? 10 : 0); - int yPos = yOrigin + y * 29 - 9 - (y == 0 ? 7 : 0); - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos+15, yPos+22, stack1, accountForContainer, mx, my); - } - - private ItemStack tooltipStack; - public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, int my) - { - RenderItem render = new RenderItem(); - if(mx > xPos && mx < (xPos+16) && my > yPos && my < (yPos+16)) - { - tooltipStack = stack; - } - boolean mouseDown = Mouse.isButtonDown(0); - - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_DEPTH_TEST); - render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - - GL11.glDisable(GL11.GL_LIGHTING); - } - - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 3; x++) { + int index = y * 3 + x; + + if (index >= recipe.recipeItems.size()) { + break drawGrid; + } + + renderItemAtGridPos(parent, 1 + x, (3 - y), (ItemStack) recipe.recipeItems.get(index), true, posX, + posY, mx, my); + } + } + } + + renderResult(parent, recipe.getRecipeOutput(), false, posX, posY, mx, my); + } + + private void tickRecipes() { + if (recipeID < recipes.length - 1) { + ++recipeID; + } else { + recipeID = 0; + } + } + + public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, + int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = xOrigin + 80; + int yPos = yOrigin + 144; + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); + } + + public void renderItemAtGridPos(GuiScreen gui, int x, int y, ItemStack stack, boolean accountForContainer, + int xOrigin, int yOrigin, int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = xOrigin + x * 29 + 7 + (y == 0 && x == 3 ? 10 : 0); + int yPos = yOrigin + y * 29 - 9 - (y == 0 ? 7 : 0); + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos + 15, yPos + 22, stack1, accountForContainer, mx, my); + } + + public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, + int my) { + RenderItem render = new RenderItem(); + if (mx > xPos && mx < (xPos + 16) && my > yPos && my < (yPos + 16)) { + tooltipStack = stack; + } + boolean mouseDown = Mouse.isButtonDown(0); + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_DEPTH_TEST); + render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + + GL11.glDisable(GL11.GL_LIGHTING); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageGrind.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageGrind.java index 61866bfa..a3618780 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageGrind.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageGrind.java @@ -1,17 +1,5 @@ package minefantasy.mf2.api.knowledge.client; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.MineFantasyAPI; -import minefantasy.mf2.api.helpers.ClientTickHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -19,112 +7,107 @@ import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class EntryPageGrind extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private ItemStack input, output; - - public EntryPageGrind(ItemStack in, ItemStack out) - { - this.input = in; - this.output = out; - } - - public EntryPageGrind(Item in, Item out) - { - this(new ItemStack(in), new ItemStack(out)); - } - - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - tooltipStack = null; - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/grindGrid.png")); - parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); - +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class EntryPageGrind extends EntryPage { + private Minecraft mc = Minecraft.getMinecraft(); + private ItemStack input, output; + private ItemStack tooltipStack; + + public EntryPageGrind(ItemStack in, ItemStack out) { + this.input = in; + this.output = out; + } + + public EntryPageGrind(Item in, Item out) { + this(new ItemStack(in), new ItemStack(out)); + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + tooltipStack = null; + + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/grindGrid.png")); + parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); + String cft = "<" + StatCollector.translateToLocal("method.quern") + ">"; - mc.fontRenderer.drawSplitString(cft, posX+(universalBookImageWidth/2) - (mc.fontRenderer.getStringWidth(cft)/2), posY+150, 117, 0); - + mc.fontRenderer.drawSplitString(cft, + posX + (universalBookImageWidth / 2) - (mc.fontRenderer.getStringWidth(cft) / 2), posY + 150, 117, 0); + renderRecipe(parent, x, y, f, posX, posY); - if(tooltipStack != null) - { - List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - List parsedTooltip = new ArrayList(); - boolean first = true; - - for(String s : tooltipData) - { - String s_ = s; - if(!first) - s_ = EnumChatFormatting.GRAY + s; - parsedTooltip.add(s_); - first = false; - } - - minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); - } - - } - - private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY) - { - renderResult(parent, output, false, posX, posY+74, mx, my); - renderResult(parent, input, false, posX, posY, mx, my); - } - - public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - int xPos = xOrigin + 80; - int yPos = yOrigin + 41; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); - } - - private ItemStack tooltipStack; - public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, int my) - { - RenderItem render = new RenderItem(); - if(mx > xPos && mx < (xPos+16) && my > yPos && my < (yPos+16)) - { - tooltipStack = stack; - } - boolean mouseDown = Mouse.isButtonDown(0); - - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_DEPTH_TEST); - render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - - GL11.glDisable(GL11.GL_LIGHTING); - } - - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } + if (tooltipStack != null) { + List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + List parsedTooltip = new ArrayList(); + boolean first = true; + + for (String s : tooltipData) { + String s_ = s; + if (!first) + s_ = EnumChatFormatting.GRAY + s; + parsedTooltip.add(s_); + first = false; + } + + minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); + } + + } + + private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY) { + renderResult(parent, output, false, posX, posY + 74, mx, my); + renderResult(parent, input, false, posX, posY, mx, my); + } + + public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, + int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = xOrigin + 80; + int yPos = yOrigin + 41; + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); + } + + public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, + int my) { + RenderItem render = new RenderItem(); + if (mx > xPos && mx < (xPos + 16) && my > yPos && my < (yPos + 16)) { + tooltipStack = stack; + } + boolean mouseDown = Mouse.isButtonDown(0); + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_DEPTH_TEST); + render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + + GL11.glDisable(GL11.GL_LIGHTING); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageImage.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageImage.java index b99216df..89119b73 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageImage.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageImage.java @@ -1,7 +1,5 @@ package minefantasy.mf2.api.knowledge.client; -import org.lwjgl.opengl.GL11; - import minefantasy.mf2.api.helpers.RenderHelper; import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; @@ -9,93 +7,73 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -public class EntryPageImage extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private String paragraph; - /** - * Recommend size: 48x48 - */ - private String image; - private int[] sizes; - - public EntryPageImage(String tex, String paragraphs) - { - this(tex, 128, 128, paragraphs); - } - public EntryPageImage(String tex, int width, int height, String paragraphs) - { - this.paragraph = paragraphs; - this.image = tex; - this.sizes = new int[]{width, height}; - } - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - String local = StatCollector.translateToLocal(paragraph); - String text = ""; - String temp = ""; - boolean prefix = false; - for(int a = 0; a < local.length(); a++) - { - char c = local.charAt(a); - if(a == local.length()-1) - { - text = text + temp + c; - temp = ""; - } - else if(prefix) - { - if(c == "h".charAt(0)) - { - text = text + temp + EnumChatFormatting.DARK_BLUE + EnumChatFormatting.BOLD; - temp = ""; - } - else if(c == "d".charAt(0)) - { - text = text + temp + EnumChatFormatting.DARK_RED; - temp = ""; - } - else if(c == "y".charAt(0)) - { - text = text + temp + EnumChatFormatting.GOLD; - temp = ""; - } - else if(c == "u".charAt(0)) - { - text = text + temp + EnumChatFormatting.UNDERLINE; - temp = ""; - } - else if(c == "r".charAt(0)) - { - text = text + temp + EnumChatFormatting.RESET + EnumChatFormatting.BLACK; - temp = ""; - } - prefix = false; - } - else if(c == "^".charAt(0)) - { - text = text + temp + "\n\n"; - temp = ""; - } - else if(c == "$".charAt(0)) - { - prefix = true; - } - else - { - temp = temp + c; - } - } - - mc.fontRenderer.drawSplitString(text, posX+14, posY+117, 155, 0); - } - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - mc.renderEngine.bindTexture(TextureHelperMF.getResource(image)); - int xOffset = (universalBookImageWidth - sizes[0]) /2; - RenderHelper.drawTexturedModalRect(posX + xOffset, posY+15, 2, 0, 0, sizes[0], sizes[1], 1F/(float)sizes[0], 1F/(float)sizes[1]); - } +public class EntryPageImage extends EntryPage { + private Minecraft mc = Minecraft.getMinecraft(); + private String paragraph; + /** + * Recommend size: 48x48 + */ + private String image; + private int[] sizes; + + public EntryPageImage(String tex, String paragraphs) { + this(tex, 128, 128, paragraphs); + } + + public EntryPageImage(String tex, int width, int height, String paragraphs) { + this.paragraph = paragraphs; + this.image = tex; + this.sizes = new int[]{width, height}; + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + String local = StatCollector.translateToLocal(paragraph); + String text = ""; + String temp = ""; + boolean prefix = false; + for (int a = 0; a < local.length(); a++) { + char c = local.charAt(a); + if (a == local.length() - 1) { + text = text + temp + c; + temp = ""; + } else if (prefix) { + if (c == "h".charAt(0)) { + text = text + temp + EnumChatFormatting.DARK_BLUE + EnumChatFormatting.BOLD; + temp = ""; + } else if (c == "d".charAt(0)) { + text = text + temp + EnumChatFormatting.DARK_RED; + temp = ""; + } else if (c == "y".charAt(0)) { + text = text + temp + EnumChatFormatting.GOLD; + temp = ""; + } else if (c == "u".charAt(0)) { + text = text + temp + EnumChatFormatting.UNDERLINE; + temp = ""; + } else if (c == "r".charAt(0)) { + text = text + temp + EnumChatFormatting.RESET + EnumChatFormatting.BLACK; + temp = ""; + } + prefix = false; + } else if (c == "^".charAt(0)) { + text = text + temp + "\n\n"; + temp = ""; + } else if (c == "$".charAt(0)) { + prefix = true; + } else { + temp = temp + c; + } + } + + mc.fontRenderer.drawSplitString(text, posX + 14, posY + 117, 155, 0); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + mc.renderEngine.bindTexture(TextureHelperMF.getResource(image)); + int xOffset = (universalBookImageWidth - sizes[0]) / 2; + RenderHelper.drawTexturedModalRect(posX + xOffset, posY + 15, 2, 0, 0, sizes[0], sizes[1], 1F / sizes[0], + 1F / sizes[1]); + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeAnvil.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeAnvil.java index b4d6c96b..8f2593f6 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeAnvil.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeAnvil.java @@ -1,24 +1,11 @@ package minefantasy.mf2.api.knowledge.client; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.crafting.anvil.IAnvilRecipe; import minefantasy.mf2.api.crafting.anvil.ShapedAnvilRecipes; import minefantasy.mf2.api.crafting.anvil.ShapelessAnvilRecipes; import minefantasy.mf2.api.heating.Heatable; -import minefantasy.mf2.api.helpers.ClientTickHandler; import minefantasy.mf2.api.helpers.GuiHelper; import minefantasy.mf2.api.helpers.TextureHelperMF; -import minefantasy.mf2.item.list.ComponentListMF; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.RenderHelper; @@ -26,203 +13,193 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class EntryPageRecipeAnvil extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private IAnvilRecipe[] recipes = new IAnvilRecipe[]{}; - public static int switchRate = 15; - private int recipeID; - private boolean shapelessRecipe = false; - private boolean oreDictRecipe = false; - - public EntryPageRecipeAnvil(List recipes) - { - IAnvilRecipe[] array = new IAnvilRecipe[recipes.size()]; - for(int a = 0; a < recipes.size(); a++) - { - array[a] = recipes.get(a); - } - this.recipes = array; - - } - public EntryPageRecipeAnvil(IAnvilRecipe... recipes) - { - this.recipes = recipes; - } - - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - tooltipStack = null; - if(onTick) - { - tickRecipes(); - } - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/anvilGrid.png")); - parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); - +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class EntryPageRecipeAnvil extends EntryPage { + public static int switchRate = 15; + private Minecraft mc = Minecraft.getMinecraft(); + private IAnvilRecipe[] recipes = new IAnvilRecipe[]{}; + private int recipeID; + private boolean shapelessRecipe = false; + private boolean oreDictRecipe = false; + private ItemStack tooltipStack; + + public EntryPageRecipeAnvil(List recipes) { + IAnvilRecipe[] array = new IAnvilRecipe[recipes.size()]; + for (int a = 0; a < recipes.size(); a++) { + array[a] = recipes.get(a); + } + this.recipes = array; + + } + + public EntryPageRecipeAnvil(IAnvilRecipe... recipes) { + this.recipes = recipes; + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + tooltipStack = null; + if (onTick) { + tickRecipes(); + } + + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/anvilGrid.png")); + parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); + IAnvilRecipe recipe = recipes[recipeID]; String cft = "<" + StatCollector.translateToLocal("method.anvil") + ">"; - mc.fontRenderer.drawSplitString(cft, posX+(universalBookImageWidth/2) - (mc.fontRenderer.getStringWidth(cft)/2), posY+150, 117, 0); + mc.fontRenderer.drawSplitString(cft, + posX + (universalBookImageWidth / 2) - (mc.fontRenderer.getStringWidth(cft) / 2), posY + 150, 117, 0); renderRecipe(parent, x, y, f, posX, posY, recipe); - - if(tooltipStack != null) - { - List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - List parsedTooltip = new ArrayList(); - boolean first = true; - - for(String s : tooltipData) - { - String s_ = s; - if(!first) - s_ = EnumChatFormatting.GRAY + s; - parsedTooltip.add(s_); - first = false; - } - - minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); - } - - } - - private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY, IAnvilRecipe recipe) - { - if(recipe == null)return; - shapelessRecipe = false; - oreDictRecipe = false; - - GL11.glColor3f(255, 255, 255); - GuiHelper.renderToolIcon(parent, recipe.getToolType(), recipe.getRecipeHammer(), posX+34, posY+51, true, true); - GuiHelper.renderToolIcon(parent, "anvil", recipe.getAnvil(), posX+124, posY+51, true, true); - - if(recipe instanceof ShapedAnvilRecipes) - { - ShapedAnvilRecipes shaped = (ShapedAnvilRecipes)recipe; - - for(int y = 0; y < shaped.recipeHeight; y++) - { - for(int x = 0; x < shaped.recipeWidth; x++) - { - renderItemAtGridPos(parent, 1 + x, 1 + y, shaped.recipeItems[y * shaped.recipeWidth + x], true, posX, posY, mx, my); - } - } - } - else if(recipe instanceof ShapelessAnvilRecipes) - { - ShapelessAnvilRecipes shapeless = (ShapelessAnvilRecipes) recipe; - - drawGrid : - { - for(int y = 0; y < 6; y++) - { - for(int x = 0; x < 4; x++) - { - int index = y * 6 + x; - - if(index >= shapeless.recipeItems.size()) - break drawGrid; - - renderItemAtGridPos(parent, 1 + x, 1 + y, (ItemStack) shapeless.recipeItems.get(index), true, posX, posY, mx, my); - } - } - } - - shapelessRecipe = true; - } - renderResult(parent, recipe.getRecipeOutput(), false, posX, posY, mx, my, recipe.outputHot()); - } - private void tickRecipes() - { - if(recipeID < recipes.length-1) - { - ++recipeID; - } - else - { - recipeID = 0; - } - } - - public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my, boolean hot) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - if(stack.getItemDamage() == -1) - stack.setItemDamage(0); - - int xPos = xOrigin + 80; - int yPos = yOrigin + 42; - - renderItem(gui, xPos, yPos, stack, accountForContainer, mx, my, hot); - } - - public void renderItemAtGridPos(GuiScreen gui, int x, int y, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - - boolean heatable = Heatable.canHeatItem(stack); - - stack = stack.copy(); - - int gridSize = 18; - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - if(stack.getItemDamage() == -1) - stack.setItemDamage(0); - - x-=1; - y-=1; - int xPos = xOrigin + (x * gridSize) + 36; - int yPos = yOrigin + (y * gridSize) + 76; - - renderItem(gui, xPos, yPos, stack, accountForContainer, mx, my, heatable); - } - - private ItemStack tooltipStack; - public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, int my, boolean heatable) - { - if(heatable) - { - GL11.glPushMatrix(); - GL11.glColor3f(255, 255, 255); - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/anvilGrid.png")); - gui.drawTexturedModalRect(xPos, yPos, 248, 0, 8,8); - GL11.glPopMatrix(); - } - - RenderItem render = new RenderItem(); - if(mx > xPos && mx < (xPos+16) && my > yPos && my < (yPos+16)) - { - tooltipStack = stack; - } - - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_DEPTH_TEST); - render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - - GL11.glDisable(GL11.GL_LIGHTING); - } - - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } + + if (tooltipStack != null) { + List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + List parsedTooltip = new ArrayList(); + boolean first = true; + + for (String s : tooltipData) { + String s_ = s; + if (!first) + s_ = EnumChatFormatting.GRAY + s; + parsedTooltip.add(s_); + first = false; + } + + minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); + } + + } + + private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY, IAnvilRecipe recipe) { + if (recipe == null) + return; + shapelessRecipe = false; + oreDictRecipe = false; + + GL11.glColor3f(255, 255, 255); + GuiHelper.renderToolIcon(parent, recipe.getToolType(), recipe.getRecipeHammer(), posX + 34, posY + 51, true, + true); + GuiHelper.renderToolIcon(parent, "anvil", recipe.getAnvil(), posX + 124, posY + 51, true, true); + + if (recipe instanceof ShapedAnvilRecipes) { + ShapedAnvilRecipes shaped = (ShapedAnvilRecipes) recipe; + + for (int y = 0; y < shaped.recipeHeight; y++) { + for (int x = 0; x < shaped.recipeWidth; x++) { + renderItemAtGridPos(parent, 1 + x, 1 + y, shaped.recipeItems[y * shaped.recipeWidth + x], true, + posX, posY, mx, my); + } + } + } else if (recipe instanceof ShapelessAnvilRecipes) { + ShapelessAnvilRecipes shapeless = (ShapelessAnvilRecipes) recipe; + + drawGrid: + { + for (int y = 0; y < 6; y++) { + for (int x = 0; x < 4; x++) { + int index = y * 6 + x; + + if (index >= shapeless.recipeItems.size()) + break drawGrid; + + renderItemAtGridPos(parent, 1 + x, 1 + y, (ItemStack) shapeless.recipeItems.get(index), true, + posX, posY, mx, my); + } + } + } + + shapelessRecipe = true; + } + renderResult(parent, recipe.getRecipeOutput(), false, posX, posY, mx, my, recipe.outputHot()); + } + + private void tickRecipes() { + if (recipeID < recipes.length - 1) { + ++recipeID; + } else { + recipeID = 0; + } + } + + public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, + int mx, int my, boolean hot) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + if (stack.getItemDamage() == -1) + stack.setItemDamage(0); + + int xPos = xOrigin + 80; + int yPos = yOrigin + 42; + + renderItem(gui, xPos, yPos, stack, accountForContainer, mx, my, hot); + } + + public void renderItemAtGridPos(GuiScreen gui, int x, int y, ItemStack stack, boolean accountForContainer, + int xOrigin, int yOrigin, int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + + boolean heatable = Heatable.canHeatItem(stack); + + stack = stack.copy(); + + int gridSize = 18; + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + if (stack.getItemDamage() == -1) + stack.setItemDamage(0); + + x -= 1; + y -= 1; + int xPos = xOrigin + (x * gridSize) + 36; + int yPos = yOrigin + (y * gridSize) + 76; + + renderItem(gui, xPos, yPos, stack, accountForContainer, mx, my, heatable); + } + + public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, + int my, boolean heatable) { + if (heatable) { + GL11.glPushMatrix(); + GL11.glColor3f(255, 255, 255); + this.mc.getTextureManager() + .bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/anvilGrid.png")); + gui.drawTexturedModalRect(xPos, yPos, 248, 0, 8, 8); + GL11.glPopMatrix(); + } + + RenderItem render = new RenderItem(); + if (mx > xPos && mx < (xPos + 16) && my > yPos && my < (yPos + 16)) { + tooltipStack = stack; + } + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_DEPTH_TEST); + render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + + GL11.glDisable(GL11.GL_LIGHTING); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeBase.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeBase.java index abc94a02..bc1c14a9 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeBase.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeBase.java @@ -1,17 +1,6 @@ package minefantasy.mf2.api.knowledge.client; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.MineFantasyAPI; -import minefantasy.mf2.api.helpers.ClientTickHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -25,235 +14,220 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class EntryPageRecipeBase extends EntryPage { + public static int switchRate = 15; + private Minecraft mc = Minecraft.getMinecraft(); + private IRecipe[] recipes = new IRecipe[]{}; + private int recipeID; + private boolean shapelessRecipe = false; + private boolean oreDictRecipe = false; + private ItemStack tooltipStack; + + public EntryPageRecipeBase(List recipes) { + IRecipe[] array = new IRecipe[recipes.size()]; + for (int a = 0; a < recipes.size(); a++) { + array[a] = recipes.get(a); + } + this.recipes = array; + + } + + public EntryPageRecipeBase(IRecipe... recipes) { + this.recipes = recipes; + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + if (onTick) { + tickRecipes(); + } + tooltipStack = null; + + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/craftGrid.png")); + parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); -public class EntryPageRecipeBase extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private IRecipe[] recipes = new IRecipe[]{}; - public static int switchRate = 15; - private int recipeID; - private boolean shapelessRecipe = false; - private boolean oreDictRecipe = false; - - public EntryPageRecipeBase(List recipes) - { - IRecipe[] array = new IRecipe[recipes.size()]; - for(int a = 0; a < recipes.size(); a++) - { - array[a] = recipes.get(a); - } - this.recipes = array; - - } - - public EntryPageRecipeBase(IRecipe... recipes) - { - this.recipes = recipes; - } - - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - if(onTick) - { - tickRecipes(); - } - tooltipStack = null; - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/craftGrid.png")); - parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); - IRecipe recipe = recipes[recipeID]; String cft = "<" + StatCollector.translateToLocal("method.workbench") + ">"; - mc.fontRenderer.drawSplitString(cft, posX+(universalBookImageWidth/2) - (mc.fontRenderer.getStringWidth(cft)/2), posY+175, 117, 0); + mc.fontRenderer.drawSplitString(cft, + posX + (universalBookImageWidth / 2) - (mc.fontRenderer.getStringWidth(cft) / 2), posY + 175, 117, 0); renderRecipe(parent, x, y, f, posX, posY, recipe); - - if(tooltipStack != null) - { - List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - List parsedTooltip = new ArrayList(); - boolean first = true; - - for(String s : tooltipData) - { - String s_ = s; - if(!first) - s_ = EnumChatFormatting.GRAY + s; - parsedTooltip.add(s_); - first = false; - } - - minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); - } - } - - private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY, IRecipe recipe) - { - shapelessRecipe = false; - oreDictRecipe = false; - - if(recipe instanceof ShapedRecipes) - { - ShapedRecipes shaped = (ShapedRecipes)recipe; - - for(int y = 0; y < shaped.recipeHeight; y++) - { - for(int x = 0; x < shaped.recipeWidth; x++) - { - renderItemAtGridPos(parent, x, y, shaped.recipeItems[y * shaped.recipeWidth + x], true, posX, posY, mx, my); - } - } - } - else if(recipe instanceof ShapedOreRecipe) - { - ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; - int width = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4); - int height = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5); - - for(int y = 0; y < height; y++) - { - for(int x = 0; x < width; x++) - { - Object input = shaped.getInput()[y * width + x]; - if(input != null) - renderItemAtGridPos(parent, x, y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList) input).get(0), true, posX, posY, mx, my); - } - } - - oreDictRecipe = true; - } - else if(recipe instanceof ShapelessRecipes) - { - ShapelessRecipes shapeless = (ShapelessRecipes) recipe; - - drawGrid : - { - for(int y = 0; y < 3; y++) - { - for(int x = 0; x < 3; x++) - { - int index = y * 3 + x; - - if(index >= shapeless.recipeItems.size()) - break drawGrid; - - renderItemAtGridPos(parent, x, y, (ItemStack) shapeless.recipeItems.get(index), true, posX, posY, mx, my); - } - } - } - - shapelessRecipe = true; - } - else if(recipe instanceof ShapelessOreRecipe) - { - ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; - - drawGrid : - { - for(int y = 0; y < 3; y++) - { - for(int x = 0; x < 3; x++) - { - int index = y * 3 + x; - - if(index >= shapeless.getRecipeSize()) - break drawGrid; - - Object input = shapeless.getInput().get(index); - if(input != null) - renderItemAtGridPos(parent, x, y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList) input).get(0), true, posX, posY, mx, my); - } - } - } - - shapelessRecipe = true; - oreDictRecipe = true; - } - - renderResult(parent, recipe.getRecipeOutput(), false, posX, posY, mx, my); - } - private void tickRecipes() - { - if(recipeID < recipes.length-1) - { - ++recipeID; - } - else - { - recipeID = 0; - } - } - - public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - int xPos = xOrigin + 80; - int yPos = yOrigin + 42; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); - } - - public void renderItemAtGridPos(GuiScreen gui, int x, int y, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - int xPos = xOrigin + (x * 29) + 51; - int yPos = yOrigin + (y * 29) + 86; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); - } - - public int getGridX() - { - return 7; - } - public int getGridY() - { - return 36; - } - private ItemStack tooltipStack; - public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, int my) - { - RenderItem render = new RenderItem(); - if(mx > xPos && mx < (xPos+16) && my > yPos && my < (yPos+16)) - { - tooltipStack = stack; - } - boolean mouseDown = Mouse.isButtonDown(0); - - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_DEPTH_TEST); - render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - - GL11.glDisable(GL11.GL_LIGHTING); - } - - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } + + if (tooltipStack != null) { + List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + List parsedTooltip = new ArrayList(); + boolean first = true; + + for (String s : tooltipData) { + String s_ = s; + if (!first) + s_ = EnumChatFormatting.GRAY + s; + parsedTooltip.add(s_); + first = false; + } + + minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); + } + } + + private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY, IRecipe recipe) { + shapelessRecipe = false; + oreDictRecipe = false; + + if (recipe instanceof ShapedRecipes) { + ShapedRecipes shaped = (ShapedRecipes) recipe; + + for (int y = 0; y < shaped.recipeHeight; y++) { + for (int x = 0; x < shaped.recipeWidth; x++) { + renderItemAtGridPos(parent, x, y, shaped.recipeItems[y * shaped.recipeWidth + x], true, posX, posY, + mx, my); + } + } + } else if (recipe instanceof ShapedOreRecipe) { + ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; + int width = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4); + int height = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5); + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + Object input = shaped.getInput()[y * width + x]; + if (input != null) + renderItemAtGridPos(parent, x, y, + input instanceof ItemStack ? (ItemStack) input : ((ArrayList) input).get(0), + true, posX, posY, mx, my); + } + } + + oreDictRecipe = true; + } else if (recipe instanceof ShapelessRecipes) { + ShapelessRecipes shapeless = (ShapelessRecipes) recipe; + + drawGrid: + { + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 3; x++) { + int index = y * 3 + x; + + if (index >= shapeless.recipeItems.size()) + break drawGrid; + + renderItemAtGridPos(parent, x, y, (ItemStack) shapeless.recipeItems.get(index), true, posX, + posY, mx, my); + } + } + } + + shapelessRecipe = true; + } else if (recipe instanceof ShapelessOreRecipe) { + ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; + + drawGrid: + { + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 3; x++) { + int index = y * 3 + x; + + if (index >= shapeless.getRecipeSize()) + break drawGrid; + + Object input = shapeless.getInput().get(index); + if (input != null) + renderItemAtGridPos(parent, x, y, input instanceof ItemStack ? (ItemStack) input + : ((ArrayList) input).get(0), true, posX, posY, mx, my); + } + } + } + + shapelessRecipe = true; + oreDictRecipe = true; + } + + renderResult(parent, recipe.getRecipeOutput(), false, posX, posY, mx, my); + } + + private void tickRecipes() { + if (recipeID < recipes.length - 1) { + ++recipeID; + } else { + recipeID = 0; + } + } + + public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, + int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = xOrigin + 80; + int yPos = yOrigin + 42; + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); + } + + public void renderItemAtGridPos(GuiScreen gui, int x, int y, ItemStack stack, boolean accountForContainer, + int xOrigin, int yOrigin, int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = xOrigin + (x * 29) + 51; + int yPos = yOrigin + (y * 29) + 86; + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); + } + + public int getGridX() { + return 7; + } + + public int getGridY() { + return 36; + } + + public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, + int my) { + RenderItem render = new RenderItem(); + if (mx > xPos && mx < (xPos + 16) && my > yPos && my < (yPos + 16)) { + tooltipStack = stack; + } + boolean mouseDown = Mouse.isButtonDown(0); + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_DEPTH_TEST); + render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + + GL11.glDisable(GL11.GL_LIGHTING); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeBloom.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeBloom.java index 13b00544..5404724f 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeBloom.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeBloom.java @@ -1,17 +1,5 @@ package minefantasy.mf2.api.knowledge.client; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.MineFantasyAPI; -import minefantasy.mf2.api.helpers.ClientTickHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -19,114 +7,108 @@ import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class EntryPageRecipeBloom extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private ItemStack input, output; - - public EntryPageRecipeBloom(ItemStack in, ItemStack out) - { - this.input = in; - this.output = out; - } - - public EntryPageRecipeBloom(Item in, Item out) - { - this(new ItemStack(in), new ItemStack(out)); - } - - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - tooltipStack = null; - - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/bloomeryGrid.png")); - parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); - +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class EntryPageRecipeBloom extends EntryPage { + private Minecraft mc = Minecraft.getMinecraft(); + private ItemStack input, output; + private ItemStack tooltipStack; + + public EntryPageRecipeBloom(ItemStack in, ItemStack out) { + this.input = in; + this.output = out; + } + + public EntryPageRecipeBloom(Item in, Item out) { + this(new ItemStack(in), new ItemStack(out)); + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + tooltipStack = null; + + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/bloomeryGrid.png")); + parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); + String cft = "<" + StatCollector.translateToLocal("method.bloomery") + ">"; - mc.fontRenderer.drawSplitString(cft, posX+(universalBookImageWidth/2) - (mc.fontRenderer.getStringWidth(cft)/2), posY+150, 117, 0); - + mc.fontRenderer.drawSplitString(cft, + posX + (universalBookImageWidth / 2) - (mc.fontRenderer.getStringWidth(cft) / 2), posY + 150, 117, 0); + renderRecipe(parent, x, y, f, posX, posY); - if(tooltipStack != null) - { - List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - List parsedTooltip = new ArrayList(); - boolean first = true; - - for(String s : tooltipData) - { - String s_ = s; - if(!first) - s_ = EnumChatFormatting.GRAY + s; - parsedTooltip.add(s_); - first = false; - } - - minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); - - } - - } - - private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY) - { - renderResult(parent, output, false, posX, posY+74, mx, my); - renderResult(parent, input, false, posX, posY, mx, my); - } - - public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - int xPos = xOrigin + 80; - int yPos = yOrigin + 41; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); - } - - private ItemStack tooltipStack; - public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, int my) - { - RenderItem render = new RenderItem(); - if(mx > xPos && mx < (xPos+16) && my > yPos && my < (yPos+16)) - { - tooltipStack = stack; - } - boolean mouseDown = Mouse.isButtonDown(0); - - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_DEPTH_TEST); - render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - - GL11.glDisable(GL11.GL_LIGHTING); - } - - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } + if (tooltipStack != null) { + List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + List parsedTooltip = new ArrayList(); + boolean first = true; + + for (String s : tooltipData) { + String s_ = s; + if (!first) + s_ = EnumChatFormatting.GRAY + s; + parsedTooltip.add(s_); + first = false; + } + + minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); + + } + + } + + private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY) { + renderResult(parent, output, false, posX, posY + 74, mx, my); + renderResult(parent, input, false, posX, posY, mx, my); + } + + public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, + int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = xOrigin + 80; + int yPos = yOrigin + 41; + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); + } + + public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, + int my) { + RenderItem render = new RenderItem(); + if (mx > xPos && mx < (xPos + 16) && my > yPos && my < (yPos + 16)) { + tooltipStack = stack; + } + boolean mouseDown = Mouse.isButtonDown(0); + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_DEPTH_TEST); + render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + + GL11.glDisable(GL11.GL_LIGHTING); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeCarpenter.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeCarpenter.java index e33bb432..23832137 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeCarpenter.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageRecipeCarpenter.java @@ -1,20 +1,8 @@ package minefantasy.mf2.api.knowledge.client; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.crafting.carpenter.ICarpenterRecipe; import minefantasy.mf2.api.crafting.carpenter.ShapedCarpenterRecipes; import minefantasy.mf2.api.crafting.carpenter.ShapelessCarpenterRecipes; -import minefantasy.mf2.api.helpers.ClientTickHandler; import minefantasy.mf2.api.helpers.GuiHelper; import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; @@ -24,195 +12,188 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class EntryPageRecipeCarpenter extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private ICarpenterRecipe[] recipes = new ICarpenterRecipe[]{}; - public static int switchRate = 15; - private int recipeID; - private boolean shapelessRecipe = false; - private boolean oreDictRecipe = false; - - public EntryPageRecipeCarpenter(List recipes) - { - ICarpenterRecipe[] array = new ICarpenterRecipe[recipes.size()]; - for(int a = 0; a < recipes.size(); a++) - { - array[a] = recipes.get(a); - } - this.recipes = array; - - } - public EntryPageRecipeCarpenter(ICarpenterRecipe... recipes) - { - this.recipes = recipes; - } - - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - if(onTick) - { - tickRecipes(); - } - tooltipStack = null; - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/carpenterGrid.png")); - parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); - +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class EntryPageRecipeCarpenter extends EntryPage { + public static int switchRate = 15; + private Minecraft mc = Minecraft.getMinecraft(); + private ICarpenterRecipe[] recipes = new ICarpenterRecipe[]{}; + private int recipeID; + private boolean shapelessRecipe = false; + private boolean oreDictRecipe = false; + private ItemStack tooltipStack; + + public EntryPageRecipeCarpenter(List recipes) { + ICarpenterRecipe[] array = new ICarpenterRecipe[recipes.size()]; + for (int a = 0; a < recipes.size(); a++) { + array[a] = recipes.get(a); + } + this.recipes = array; + + } + + public EntryPageRecipeCarpenter(ICarpenterRecipe... recipes) { + this.recipes = recipes; + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + if (onTick) { + tickRecipes(); + } + tooltipStack = null; + + this.mc.getTextureManager() + .bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/carpenterGrid.png")); + parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); + ICarpenterRecipe recipe = recipes[recipeID]; String cft = "<" + StatCollector.translateToLocal("method.carpenter") + ">"; - mc.fontRenderer.drawSplitString(cft, posX+(universalBookImageWidth/2) - (mc.fontRenderer.getStringWidth(cft)/2), posY+175, 117, 0); + mc.fontRenderer.drawSplitString(cft, + posX + (universalBookImageWidth / 2) - (mc.fontRenderer.getStringWidth(cft) / 2), posY + 175, 117, 0); renderRecipe(parent, x, y, f, posX, posY, recipe); - - if(tooltipStack != null) - { - List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - List parsedTooltip = new ArrayList(); - boolean first = true; - - for(String s : tooltipData) - { - String s_ = s; - if(!first) - s_ = EnumChatFormatting.GRAY + s; - parsedTooltip.add(s_); - first = false; - } - - minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); - } - - } - - private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY, ICarpenterRecipe recipe) - { - if(parent == null)return; - if(recipe == null)return; - shapelessRecipe = false; - oreDictRecipe = false; - - GL11.glColor3f(255, 255, 255); - GuiHelper.renderToolIcon(parent, recipe.getToolType(), recipe.getRecipeHammer(), posX+34, posY+51, true, true); - GuiHelper.renderToolIcon(parent, "carpenter", recipe.getAnvil(), posX+124, posY+51, true, true); - - if(recipe instanceof ShapedCarpenterRecipes) - { - ShapedCarpenterRecipes shaped = (ShapedCarpenterRecipes)recipe; - - for(int y = 0; y < shaped.recipeHeight; y++) - { - for(int x = 0; x < shaped.recipeWidth; x++) - { - renderItemAtGridPos(parent, 1 + x, 1 + y, shaped.recipeItems[y * shaped.recipeWidth + x], true, posX, posY, mx, my); - } - } - } - else if(recipe instanceof ShapelessCarpenterRecipes) - { - ShapelessCarpenterRecipes shapeless = (ShapelessCarpenterRecipes) recipe; - - drawGrid : - { - for(int y = 0; y < 4; y++) - { - for(int x = 0; x < 4; x++) - { - int index = y * 4 + x; - - if(index >= shapeless.recipeItems.size()) - break drawGrid; - - renderItemAtGridPos(parent, 1 + x, 1 + y, (ItemStack) shapeless.recipeItems.get(index), true, posX, posY, mx, my); - } - } - } - - shapelessRecipe = true; - } - renderResult(parent, recipe.getRecipeOutput(), false, posX, posY, mx, my); - } - private void tickRecipes() - { - if(recipeID < recipes.length-1) - { - ++recipeID; - } - else - { - recipeID = 0; - } - } - - public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - int xPos = xOrigin + 80; - int yPos = yOrigin + 42; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); - } - - public void renderItemAtGridPos(GuiScreen gui, int x, int y, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - int gridSize = 23; - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - x-=1; - y-=1; - int xPos = xOrigin + (x * gridSize) + 46; - int yPos = yOrigin + (y * gridSize) + 80; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); - } - - private ItemStack tooltipStack; - public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, int my) - { - RenderItem render = new RenderItem(); - if(mx > xPos && mx < (xPos+16) && my > yPos && my < (yPos+16)) - { - tooltipStack = stack; - } - boolean mouseDown = Mouse.isButtonDown(0); - - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_DEPTH_TEST); - render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - - GL11.glDisable(GL11.GL_LIGHTING); - } - - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } + + if (tooltipStack != null) { + List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + List parsedTooltip = new ArrayList(); + boolean first = true; + + for (String s : tooltipData) { + String s_ = s; + if (!first) + s_ = EnumChatFormatting.GRAY + s; + parsedTooltip.add(s_); + first = false; + } + + minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); + } + + } + + private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY, ICarpenterRecipe recipe) { + if (parent == null) + return; + if (recipe == null) + return; + shapelessRecipe = false; + oreDictRecipe = false; + + GL11.glColor3f(255, 255, 255); + GuiHelper.renderToolIcon(parent, recipe.getToolType(), recipe.getRecipeHammer(), posX + 34, posY + 51, true, + true); + GuiHelper.renderToolIcon(parent, "carpenter", recipe.getAnvil(), posX + 124, posY + 51, true, true); + + if (recipe instanceof ShapedCarpenterRecipes) { + ShapedCarpenterRecipes shaped = (ShapedCarpenterRecipes) recipe; + + for (int y = 0; y < shaped.recipeHeight; y++) { + for (int x = 0; x < shaped.recipeWidth; x++) { + renderItemAtGridPos(parent, 1 + x, 1 + y, shaped.recipeItems[y * shaped.recipeWidth + x], true, + posX, posY, mx, my); + } + } + } else if (recipe instanceof ShapelessCarpenterRecipes) { + ShapelessCarpenterRecipes shapeless = (ShapelessCarpenterRecipes) recipe; + + drawGrid: + { + for (int y = 0; y < 4; y++) { + for (int x = 0; x < 4; x++) { + int index = y * 4 + x; + + if (index >= shapeless.recipeItems.size()) + break drawGrid; + + renderItemAtGridPos(parent, 1 + x, 1 + y, (ItemStack) shapeless.recipeItems.get(index), true, + posX, posY, mx, my); + } + } + } + + shapelessRecipe = true; + } + renderResult(parent, recipe.getRecipeOutput(), false, posX, posY, mx, my); + } + + private void tickRecipes() { + if (recipeID < recipes.length - 1) { + ++recipeID; + } else { + recipeID = 0; + } + } + + public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, + int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = xOrigin + 80; + int yPos = yOrigin + 42; + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); + } + + public void renderItemAtGridPos(GuiScreen gui, int x, int y, ItemStack stack, boolean accountForContainer, + int xOrigin, int yOrigin, int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + int gridSize = 23; + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + x -= 1; + y -= 1; + int xPos = xOrigin + (x * gridSize) + 46; + int yPos = yOrigin + (y * gridSize) + 80; + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); + } + + public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, + int my) { + RenderItem render = new RenderItem(); + if (mx > xPos && mx < (xPos + 16) && my > yPos && my < (yPos + 16)) { + tooltipStack = stack; + } + boolean mouseDown = Mouse.isButtonDown(0); + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_DEPTH_TEST); + render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + + GL11.glDisable(GL11.GL_LIGHTING); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageSmelting.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageSmelting.java index 14f5cc64..7b94a685 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageSmelting.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageSmelting.java @@ -1,17 +1,5 @@ package minefantasy.mf2.api.knowledge.client; -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.MineFantasyAPI; -import minefantasy.mf2.api.helpers.ClientTickHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -19,113 +7,107 @@ import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class EntryPageSmelting extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private ItemStack input, output; - - public EntryPageSmelting(ItemStack in, ItemStack out) - { - this.input = in; - this.output = out; - } - - public EntryPageSmelting(Item in, Item out) - { - this(new ItemStack(in), new ItemStack(out)); - } - - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - tooltipStack = null; - - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/furnaceGrid.png")); - parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); - +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class EntryPageSmelting extends EntryPage { + private Minecraft mc = Minecraft.getMinecraft(); + private ItemStack input, output; + private ItemStack tooltipStack; + + public EntryPageSmelting(ItemStack in, ItemStack out) { + this.input = in; + this.output = out; + } + + public EntryPageSmelting(Item in, Item out) { + this(new ItemStack(in), new ItemStack(out)); + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + tooltipStack = null; + + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/furnaceGrid.png")); + parent.drawTexturedModalRect(posX, posY, 0, 0, this.universalBookImageWidth, this.universalBookImageHeight); + String cft = "<" + StatCollector.translateToLocal("method.furnace") + ">"; - mc.fontRenderer.drawSplitString(cft, posX+(universalBookImageWidth/2) - (mc.fontRenderer.getStringWidth(cft)/2), posY+150, 117, 0); - + mc.fontRenderer.drawSplitString(cft, + posX + (universalBookImageWidth / 2) - (mc.fontRenderer.getStringWidth(cft) / 2), posY + 150, 117, 0); + renderRecipe(parent, x, y, f, posX, posY); - if(tooltipStack != null) - { - List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - List parsedTooltip = new ArrayList(); - boolean first = true; - - for(String s : tooltipData) - { - String s_ = s; - if(!first) - s_ = EnumChatFormatting.GRAY + s; - parsedTooltip.add(s_); - first = false; - } - - minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); - } - - } - - private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY) - { - renderResult(parent, output, false, posX, posY+74, mx, my); - renderResult(parent, input, false, posX, posY, mx, my); - } - - public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, int mx, int my) - { - if(stack == null || stack.getItem() == null) - return; - stack = stack.copy(); - - if(stack.getItemDamage() == Short.MAX_VALUE) - stack.setItemDamage(0); - - int xPos = xOrigin + 80; - int yPos = yOrigin + 41; - ItemStack stack1 = stack.copy(); - if(stack1.getItemDamage() == -1) - stack1.setItemDamage(0); - - renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); - } - - private ItemStack tooltipStack; - public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, int my) - { - RenderItem render = new RenderItem(); - if(mx > xPos && mx < (xPos+16) && my > yPos && my < (yPos+16)) - { - tooltipStack = stack; - } - boolean mouseDown = Mouse.isButtonDown(0); - - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_DEPTH_TEST); - render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); - RenderHelper.disableStandardItemLighting(); - GL11.glPopMatrix(); - - GL11.glDisable(GL11.GL_LIGHTING); - } - - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } + if (tooltipStack != null) { + List tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + List parsedTooltip = new ArrayList(); + boolean first = true; + + for (String s : tooltipData) { + String s_ = s; + if (!first) + s_ = EnumChatFormatting.GRAY + s; + parsedTooltip.add(s_); + first = false; + } + + minefantasy.mf2.api.helpers.RenderHelper.renderTooltip(x, y, parsedTooltip); + } + + } + + private void renderRecipe(GuiScreen parent, int mx, int my, float f, int posX, int posY) { + renderResult(parent, output, false, posX, posY + 74, mx, my); + renderResult(parent, input, false, posX, posY, mx, my); + } + + public void renderResult(GuiScreen gui, ItemStack stack, boolean accountForContainer, int xOrigin, int yOrigin, + int mx, int my) { + if (stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if (stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = xOrigin + 80; + int yPos = yOrigin + 41; + ItemStack stack1 = stack.copy(); + if (stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, accountForContainer, mx, my); + } + + public void renderItem(GuiScreen gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer, int mx, + int my) { + RenderItem render = new RenderItem(); + if (mx > xPos && mx < (xPos + 16) && my > yPos && my < (yPos + 16)) { + tooltipStack = stack; + } + boolean mouseDown = Mouse.isButtonDown(0); + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_DEPTH_TEST); + render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); + RenderHelper.disableStandardItemLighting(); + GL11.glPopMatrix(); + + GL11.glDisable(GL11.GL_LIGHTING); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageText.java b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageText.java index b2c2cc60..776e2dda 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageText.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/EntryPageText.java @@ -1,95 +1,69 @@ package minefantasy.mf2.api.knowledge.client; -import minefantasy.mf2.api.armour.ArmourDesign; -import minefantasy.mf2.api.armour.CustomArmourEntry; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.item.Item; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -public class EntryPageText extends EntryPage -{ - private Minecraft mc = Minecraft.getMinecraft(); - private String paragraph; - private Object[] additional; - - public EntryPageText(String paragraph, Object...additional) - { - this(paragraph); - this.additional = additional; - } - public EntryPageText(String paragraph) - { - this.paragraph = paragraph; - } - @Override - public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - String local = StatCollector.translateToLocal(paragraph); - if(additional != null && additional.length > 0) - { - local = StatCollector.translateToLocalFormatted(paragraph, additional); - } - String text = ""; - String temp = ""; - boolean prefix = false; - for(int a = 0; a < local.length(); a++) - { - char c = local.charAt(a); - if(a == local.length()-1) - { - text = text + temp + c; - temp = ""; - } - else if(prefix) - { - if(c == "h".charAt(0)) - { - text = text + temp + EnumChatFormatting.DARK_BLUE + EnumChatFormatting.BOLD; - temp = ""; - } - else if(c == "d".charAt(0)) - { - text = text + temp + EnumChatFormatting.DARK_RED; - temp = ""; - } - else if(c == "y".charAt(0)) - { - text = text + temp + EnumChatFormatting.GOLD; - temp = ""; - } - else if(c == "u".charAt(0)) - { - text = text + temp + EnumChatFormatting.UNDERLINE; - temp = ""; - } - else if(c == "r".charAt(0)) - { - text = text + temp + EnumChatFormatting.RESET + EnumChatFormatting.BLACK; - temp = ""; - } - prefix = false; - } - else if(c == "^".charAt(0)) - { - text = text + temp + "\n\n"; - temp = ""; - } - else if(c == "$".charAt(0)) - { - prefix = true; - } - else - { - temp = temp + c; - } - } - mc.fontRenderer.drawSplitString(text, posX+14, posY+15, 155, 0); - } - @Override - public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) - { - } +public class EntryPageText extends EntryPage { + private Minecraft mc = Minecraft.getMinecraft(); + private String paragraph; + private Object[] additional; + + public EntryPageText(String paragraph, Object... additional) { + this(paragraph); + this.additional = additional; + } + + public EntryPageText(String paragraph) { + this.paragraph = paragraph; + } + + @Override + public void render(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + String local = StatCollector.translateToLocal(paragraph); + if (additional != null && additional.length > 0) { + local = StatCollector.translateToLocalFormatted(paragraph, additional); + } + String text = ""; + String temp = ""; + boolean prefix = false; + for (int a = 0; a < local.length(); a++) { + char c = local.charAt(a); + if (a == local.length() - 1) { + text = text + temp + c; + temp = ""; + } else if (prefix) { + if (c == "h".charAt(0)) { + text = text + temp + EnumChatFormatting.DARK_BLUE + EnumChatFormatting.BOLD; + temp = ""; + } else if (c == "d".charAt(0)) { + text = text + temp + EnumChatFormatting.DARK_RED; + temp = ""; + } else if (c == "y".charAt(0)) { + text = text + temp + EnumChatFormatting.GOLD; + temp = ""; + } else if (c == "u".charAt(0)) { + text = text + temp + EnumChatFormatting.UNDERLINE; + temp = ""; + } else if (c == "r".charAt(0)) { + text = text + temp + EnumChatFormatting.RESET + EnumChatFormatting.BLACK; + temp = ""; + } + prefix = false; + } else if (c == "^".charAt(0)) { + text = text + temp + "\n\n"; + temp = ""; + } else if (c == "$".charAt(0)) { + prefix = true; + } else { + temp = temp + c; + } + } + mc.fontRenderer.drawSplitString(text, posX + 14, posY + 15, 155, 0); + } + + @Override + public void preRender(GuiScreen parent, int x, int y, float f, int posX, int posY, boolean onTick) { + } } diff --git a/src/main/java/minefantasy/mf2/api/knowledge/client/IGuiRecipebook.java b/src/main/java/minefantasy/mf2/api/knowledge/client/IGuiRecipebook.java index 15fcd8ee..92772dbc 100644 --- a/src/main/java/minefantasy/mf2/api/knowledge/client/IGuiRecipebook.java +++ b/src/main/java/minefantasy/mf2/api/knowledge/client/IGuiRecipebook.java @@ -1,14 +1,13 @@ package minefantasy.mf2.api.knowledge.client; -public interface IGuiRecipebook -{ +public interface IGuiRecipebook { - int getWidth(); + int getWidth(); - int getHeight(); + int getHeight(); - int getLeft(); + int getLeft(); - int getTop(); + int getTop(); } diff --git a/src/main/java/minefantasy/mf2/api/material/CustomMaterial.java b/src/main/java/minefantasy/mf2/api/material/CustomMaterial.java index 12709f37..b45cb95c 100644 --- a/src/main/java/minefantasy/mf2/api/material/CustomMaterial.java +++ b/src/main/java/minefantasy/mf2/api/material/CustomMaterial.java @@ -1,306 +1,298 @@ package minefantasy.mf2.api.material; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; - -import net.minecraft.item.EnumRarity; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import java.util.Iterator; - -public class CustomMaterial -{ - public static final String NBTBase = "MF_CustomMaterials"; - public static HashMap materialList = new HashMap(); - public static HashMap> typeList = new HashMap>(); - - public ArrayListitems = new ArrayList(); - /** The material colour*/ - public int[] colourRGB = new int[]{255, 255, 255}; - /** Base threshold for armour rating*/ - public float hardness; - /** The Modifier for durability (1pt per 250 uses)*/ - public float durability; - /** used for bow power.. >1 weakens blunt prot, <1 weakens piercing prot*/ - public float flexibility; - /** The Efficiency modifier (Like ToolMaterial) Also does damage*/ - public float sharpness; - /** The modifier to resist elements like fire and corrosion)*/ - public float resistance; - /** The weight Kg/U (Kilogram per unit)*/ - public float density; - public int tier; - public final String type, name; - private float[] armourProtection = new float[]{1.0F, 1.0F, 1.0F}; - public int rarityID = 0; - - public int crafterTier = 0; - public int crafterAnvilTier = 0; - public float craftTimeModifier = 1.0F; - - public CustomMaterial(String name, String type, int tier, float hardness, float durability, float flexibility, float resistance, float sharpness, float density) - { - this.name = name; - this.type = type; - this.tier = tier; - this.hardness = hardness; - this.durability = durability; - this.flexibility = flexibility; - this.sharpness = sharpness; - this.density = density; - this.resistance = resistance; - this.craftTimeModifier = 2F + (sharpness * 2F); - } - public CustomMaterial setCrafterTiers(int tier) - { - this.crafterTier = tier; - this.crafterAnvilTier = Math.min(tier, 4); - return this; - } - public CustomMaterial modifyCraftTime(float time) - { - this.craftTimeModifier *= time; - return this; - } - public CustomMaterial setArmourStats(float cutting, float blunt, float piercing) - { - armourProtection = new float[]{cutting, blunt, piercing}; - return this; - } - public CustomMaterial setRarity(int id) - { - rarityID = id; - return this; - } - public CustomMaterial setColour(int red, int green, int blue) - { - colourRGB = new int[]{red, green, blue}; - return this; - } - - public CustomMaterial register() - { - materialList.put(name.toLowerCase(), this); - getList(type).add(this); - return this; - } - public int getColourInt() - { - return (colourRGB[0] << 16) + (colourRGB[1] << 8) + colourRGB[2]; - } - - /** - * Gets a material by name - */ - public static CustomMaterial getMaterial(String name) - { - if(name == null)return null; - - return materialList.get(name.toLowerCase()); - } - - /** - * Adds a new material - * @param name The name of the material (and registration) - * @param type What it is (Metal, Wood, etc) - * @param tier The tier of the material - * @param hardness How hard the material is to break - * @param flexibility How well the material can bend and retract - * @param sharpness How well it can be sharpened - * @param resistance How well it can handle destructive elements like fire and corrosion, and increased heating temperature - * @param density how dense the element is, increasing mass per unit. (KG/Units) - */ - public static CustomMaterial getOrAddMaterial(String name, String type, int tier, float hardness, float durability, float flexibility, float sharpness, float resistance, float density, int red, int green, int blue) - { - if(getMaterial(name) != null) - { - return getMaterial(name); - } - return new CustomMaterial(name, type, tier, hardness, durability, flexibility, sharpness, resistance, density).setColour(red, green, blue).register(); - } - - public static void addMaterial(ItemStack item, String slot, String material) - { - if(material == null || material.isEmpty()) - { - return; - } - NBTTagCompound nbt = getNBT(item, true); - nbt.setString(slot, material); - } - public static CustomMaterial getMaterialFor(ItemStack item, String slot) - { - NBTTagCompound nbt = getNBT(item, false); - if(nbt != null) - { - if(nbt.hasKey(slot)) - { - return getMaterial(nbt.getString(slot)); - } - } - return null; - } - public static NBTTagCompound getNBT(ItemStack item, boolean createNew) - { - if(item != null && item.hasTagCompound() && item.getTagCompound().hasKey(NBTBase)) - { - return (NBTTagCompound) item.getTagCompound().getTag(NBTBase); - } - if(createNew) - { - NBTTagCompound nbt = new NBTTagCompound(); - NBTTagCompound nbt2 = new NBTTagCompound(); - item.setTagCompound(nbt); - nbt.setTag(NBTBase, nbt2); - return nbt2; - } - return null; - } - - public static ArrayList getList(String type) - { - if(typeList.get(type) == null) - { - typeList.put(type, new ArrayList()); - } - return typeList.get(type); - } - - public static void addOreDict(String material, String name) - { - if(getMaterial(name) != null) - { - getMaterial(name).addOreDict(material); - } - } - public void addOreDict(String name) - { - for(ItemStack item: OreDictionary.getOres(name)) - { - items.add(item); - } - } - public boolean isItemApplicable(ItemStack item) - { - return this.items.contains(item); - } - @SideOnly(Side.CLIENT) - public static String getWeightString(float mass) - { - DecimalFormat df = decimal_format; - String s = "attribute.weightKg.name"; - if(mass > 0 && mass < 1.0F) - { - s = "attribute.weightg.name"; - df = decimal_format_grams; - mass = (int)(mass*1000F); - } - else if(mass > 1000) - { - s = "attribute.weightt.name"; - mass = (int)(mass/1000F); - } - return StatCollector.translateToLocalFormatted(s, decimal_format.format(mass)); - } - public static final DecimalFormat decimal_format = new DecimalFormat("#.#"); - public static final DecimalFormat decimal_format_grams = new DecimalFormat("#"); - @SideOnly(Side.CLIENT) - public String getMaterialString() - { - return StatCollector.translateToLocalFormatted("materialtype."+this.type+".name", this.crafterTier); - } - - public float getArmourProtection(int id) - { - return armourProtection[id]; - } - - public ItemStack getItem() - { - return null; - } - public CustomMaterial setMeltingPoint(float heat) - { - meltingPoint = heat; - return this; - } - public float getFireResistance() - { - if(meltingPoint > flameResistArray[0]) - { - float max = flameResistArray[1] - flameResistArray[0]; - float heat = meltingPoint - flameResistArray[0]; - - int res = (int)(heat / max * 100F); - return Math.min(100, res); - } - return 0F; - } - public float meltingPoint; - public int[] getHeatableStats() - { - int workableTemp = (int) meltingPoint; - int unstableTemp = (int) (workableTemp * 1.5F); - int maxTemp = (int) (workableTemp * 2F); - return new int[]{workableTemp, unstableTemp, maxTemp}; - } - /** - * Min and Max workable temps - */ - public static final int[] flameResistArray = new int[]{100, 300}; - - -//-----------------------------------BOW FUNCTIONS----------------------------------------\\ - - //Returns if the material is a hard wood - // false is a non-unique value, this should not be used when youre not sure if the material is a wood - public boolean isHardwood(){ - if(this.name.toLowerCase().contains("wood")) - { - if(this.name.toLowerCase().contains("yew")) - {//Yew is a softwood but has a higher hardness value - return false; - } - return this.hardness>3.3; - } - return false; - } - - - //Returns a rating for how well a would would serve as a bow. - //Answers are in irrelevant physical units, so this is scaled in a later function which is meant to be used. - //Bow rating is proportional to power of the bow - //With regular woods, this value is from 6.4 to 11.5 - //A rating BELOW 8.0 means that the wood is not suitable for a bow and this funtion will return zero - private float getBowRating() - { - if(this.name.toLowerCase().contains("wood")) - { - float mid =(0.83F*(this.durability/this.flexibility)); - float result = (10F*this.flexibility*mid*mid)/this.density; - return result > 8.0F? result:0; - } - return 0; - } - - public boolean isHeatable() { - return type.equalsIgnoreCase("metal"); - } - public CustomMaterial setUnbreakable() - { - unbreakable = true; - return this; - } - private boolean unbreakable = false; - public boolean isUnbrekable() { - return unbreakable; - } +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; + +public class CustomMaterial { + public static final String NBTBase = "MF_CustomMaterials"; + public static final DecimalFormat decimal_format = new DecimalFormat("#.#"); + public static final DecimalFormat decimal_format_grams = new DecimalFormat("#"); + /** + * Min and Max workable temps + */ + public static final int[] flameResistArray = new int[]{100, 300}; + public static HashMap materialList = new HashMap(); + public static HashMap> typeList = new HashMap>(); + public final String type, name; + public ArrayList items = new ArrayList(); + /** + * The material colour + */ + public int[] colourRGB = new int[]{255, 255, 255}; + /** + * Base threshold for armour rating + */ + public float hardness; + /** + * The Modifier for durability (1pt per 250 uses) + */ + public float durability; + /** + * used for bow power.. >1 weakens blunt prot, <1 weakens piercing prot + */ + public float flexibility; + /** + * The Efficiency modifier (Like ToolMaterial) Also does damage + */ + public float sharpness; + /** + * The modifier to resist elements like fire and corrosion) + */ + public float resistance; + /** + * The weight Kg/U (Kilogram per unit) + */ + public float density; + public int tier; + public int rarityID = 0; + public int crafterTier = 0; + public int crafterAnvilTier = 0; + public float craftTimeModifier = 1.0F; + public float meltingPoint; + private float[] armourProtection = new float[]{1.0F, 1.0F, 1.0F}; + private boolean unbreakable = false; + + public CustomMaterial(String name, String type, int tier, float hardness, float durability, float flexibility, + float resistance, float sharpness, float density) { + this.name = name; + this.type = type; + this.tier = tier; + this.hardness = hardness; + this.durability = durability; + this.flexibility = flexibility; + this.sharpness = sharpness; + this.density = density; + this.resistance = resistance; + this.craftTimeModifier = 2F + (sharpness * 2F); + } + + /** + * Gets a material by name + */ + public static CustomMaterial getMaterial(String name) { + if (name == null) + return null; + + return materialList.get(name.toLowerCase()); + } + + /** + * Adds a new material + * + * @param name The name of the material (and registration) + * @param type What it is (Metal, Wood, etc) + * @param tier The tier of the material + * @param hardness How hard the material is to break + * @param flexibility How well the material can bend and retract + * @param sharpness How well it can be sharpened + * @param resistance How well it can handle destructive elements like fire and + * corrosion, and increased heating temperature + * @param density how dense the element is, increasing mass per unit. (KG/Units) + */ + public static CustomMaterial getOrAddMaterial(String name, String type, int tier, float hardness, float durability, + float flexibility, float sharpness, float resistance, float density, int red, int green, int blue) { + if (getMaterial(name) != null) { + return getMaterial(name); + } + return new CustomMaterial(name, type, tier, hardness, durability, flexibility, sharpness, resistance, density) + .setColour(red, green, blue).register(); + } + + public static void addMaterial(ItemStack item, String slot, String material) { + if (material == null || material.isEmpty()) { + return; + } + NBTTagCompound nbt = getNBT(item, true); + nbt.setString(slot, material); + } + + public static CustomMaterial getMaterialFor(ItemStack item, String slot) { + NBTTagCompound nbt = getNBT(item, false); + if (nbt != null) { + if (nbt.hasKey(slot)) { + if (nbt.getString(slot).equalsIgnoreCase("refinediron")) { // fix old namings, it can be removed later + nbt.setString(slot, "pigiron"); + } + return getMaterial(nbt.getString(slot)); + } + } + return null; + } + + public static NBTTagCompound getNBT(ItemStack item, boolean createNew) { + if (item != null && item.hasTagCompound() && item.getTagCompound().hasKey(NBTBase)) { + return (NBTTagCompound) item.getTagCompound().getTag(NBTBase); + } + if (createNew) { + NBTTagCompound nbt = new NBTTagCompound(); + NBTTagCompound nbt2 = new NBTTagCompound(); + item.setTagCompound(nbt); + nbt.setTag(NBTBase, nbt2); + return nbt2; + } + return null; + } + + public static ArrayList getList(String type) { + if (typeList.get(type) == null) { + typeList.put(type, new ArrayList()); + } + return typeList.get(type); + } + + public static void addOreDict(String material, String name) { + if (getMaterial(name) != null) { + getMaterial(name).addOreDict(material); + } + } + + @SideOnly(Side.CLIENT) + public static String getWeightString(float mass) { + DecimalFormat df = decimal_format; + String s = "attribute.weightKg.name"; + if (mass > 0 && mass < 1.0F) { + s = "attribute.weightg.name"; + df = decimal_format_grams; + mass = (int) (mass * 1000F); + } else if (mass > 1000) { + s = "attribute.weightt.name"; + mass = (int) (mass / 1000F); + } + return StatCollector.translateToLocalFormatted(s, decimal_format.format(mass)); + } + + public CustomMaterial setCrafterTiers(int tier) { + this.crafterTier = tier; + this.crafterAnvilTier = Math.min(tier, 4); + return this; + } + + public CustomMaterial modifyCraftTime(float time) { + this.craftTimeModifier *= time; + return this; + } + + public CustomMaterial setArmourStats(float cutting, float blunt, float piercing) { + armourProtection = new float[]{cutting, blunt, piercing}; + return this; + } + + public CustomMaterial setRarity(int id) { + rarityID = id; + return this; + } + + public CustomMaterial setColour(int red, int green, int blue) { + colourRGB = new int[]{red, green, blue}; + return this; + } + + public CustomMaterial register() { + materialList.put(name.toLowerCase(), this); + getList(type).add(this); + return this; + } + + public int getColourInt() { + return (colourRGB[0] << 16) + (colourRGB[1] << 8) + colourRGB[2]; + } + + public void addOreDict(String name) { + for (ItemStack item : OreDictionary.getOres(name)) { + items.add(item); + } + } + + public boolean isItemApplicable(ItemStack item) { + return this.items.contains(item); + } + + @SideOnly(Side.CLIENT) + public String getMaterialString() { + return StatCollector.translateToLocalFormatted("materialtype." + this.type + ".name", this.crafterTier); + } + + public float getArmourProtection(int id) { + return armourProtection[id]; + } + + public ItemStack getItem() { + return null; + } + + public CustomMaterial setMeltingPoint(float heat) { + meltingPoint = heat; + return this; + } + + public float getFireResistance() { + if (meltingPoint > flameResistArray[0]) { + float max = flameResistArray[1] - flameResistArray[0]; + float heat = meltingPoint - flameResistArray[0]; + + int res = (int) (heat / max * 100F); + return Math.min(100, res); + } + return 0F; + } + + // -----------------------------------BOW + // FUNCTIONS----------------------------------------\\ + + public int[] getHeatableStats() { + int workableTemp = (int) meltingPoint; + int unstableTemp = (int) (workableTemp * 1.5F); + int maxTemp = (int) (workableTemp * 2F); + return new int[]{workableTemp, unstableTemp, maxTemp}; + } + + // Returns if the material is a hard wood + // false is a non-unique value, this should not be used when youre not sure if + // the material is a wood + public boolean isHardwood() { + if (this.name.toLowerCase().contains("wood")) { + if (this.name.toLowerCase().contains("yew")) {// Yew is a softwood but has a higher hardness value + return false; + } + return this.hardness > 3.3; + } + return false; + } + + // Returns a rating for how well a would would serve as a bow. + // Answers are in irrelevant physical units, so this is scaled in a later + // function which is meant to be used. + // Bow rating is proportional to power of the bow + // With regular woods, this value is from 6.4 to 11.5 + // A rating BELOW 8.0 means that the wood is not suitable for a bow and this + // funtion will return zero + private float getBowRating() { + if (this.name.toLowerCase().contains("wood")) { + float mid = (0.83F * (this.durability / this.flexibility)); + float result = (10F * this.flexibility * mid * mid) / this.density; + return result > 8.0F ? result : 0; + } + return 0; + } + + public boolean isHeatable() { + return type.equalsIgnoreCase("metal"); + } + + public CustomMaterial setUnbreakable() { + unbreakable = true; + return this; + } + + public boolean isUnbrekable() { + return unbreakable; + } } diff --git a/src/main/java/minefantasy/mf2/api/mining/RandomDigs.java b/src/main/java/minefantasy/mf2/api/mining/RandomDigs.java index 79c1f55e..776964a0 100644 --- a/src/main/java/minefantasy/mf2/api/mining/RandomDigs.java +++ b/src/main/java/minefantasy/mf2/api/mining/RandomDigs.java @@ -1,103 +1,96 @@ package minefantasy.mf2.api.mining; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + import java.util.ArrayList; import java.util.Iterator; import java.util.Random; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; +public class RandomDigs { + public static ArrayList drops = new ArrayList(); + + private final ItemStack loot; + private final float chanceToDrop; + private final Block block; + private final int blockSub; + private final int harvestLvl; + private final int minHeight; + private final int maxHeight; + private final boolean doesSilktouchDisable; + + public RandomDigs(ItemStack drop, float chance, Block base, int meta, int harvestLevel, int min, int max, + boolean silkDisable) { + doesSilktouchDisable = silkDisable; + minHeight = min; + maxHeight = max; + loot = drop; + chanceToDrop = chance; + harvestLvl = harvestLevel; + + block = base; + blockSub = meta; + } + + /** + * Adds an ore to drop + * + * @param drop the item dropped + * @param chance the chance as a percentage to drop + * @param block the block it drops from (ID, Block, or stack) + */ + public static void addOre(ItemStack drop, float chance, Block block, int meta, int harvestLevel, int min, int max, + boolean silkDisable) { + drops.add(new RandomDigs(drop, chance / 100F, block, meta, harvestLevel, min, max, silkDisable)); + } + + public static void addOre(ItemStack drop, float chance, Block block, int harvestLevel, int min, int max, + boolean silkDisable) { + drops.add(new RandomDigs(drop, chance / 100F, block, OreDictionary.WILDCARD_VALUE, harvestLevel, min, max, + silkDisable)); + } + + public static ArrayList getDroppedItems(Block base, int meta, int harvest, int fortune, + boolean silktouch, int y) { + ArrayList loot = new ArrayList(); + + if (!drops.isEmpty()) { + Iterator list = drops.iterator(); + + while (list.hasNext()) { + RandomDigs ore = (RandomDigs) list.next(); + if (matchesOre(ore, base, meta, harvest, fortune / 2F + 1F, silktouch, y)) { + loot.add(ore.loot); + } + } + } + + return loot; + } + + private static boolean matchesOre(RandomDigs ore, Block base, int meta, int harvest, float multiplier, + boolean silktouch, int y) { + Random random = new Random(); -public class RandomDigs -{ - public static ArrayList drops = new ArrayList(); - - private final ItemStack loot; - private final float chanceToDrop; - private final Block block; - private final int blockSub; - private final int harvestLvl; - private final int minHeight; - private final int maxHeight; - private final boolean doesSilktouchDisable; - - /** - * Adds an ore to drop - * @param drop the item dropped - * @param chance the chance as a percentage to drop - * @param block the block it drops from (ID, Block, or stack) - */ - public static void addOre(ItemStack drop, float chance, Block block, int meta, int harvestLevel, int min, int max, boolean silkDisable) - { - drops.add(new RandomDigs(drop, chance/100F, block, meta, harvestLevel, min, max, silkDisable)); - } - public static void addOre(ItemStack drop, float chance, Block block, int harvestLevel, int min, int max, boolean silkDisable) - { - drops.add(new RandomDigs(drop, chance/100F, block, OreDictionary.WILDCARD_VALUE, harvestLevel, min, max, silkDisable)); - } - - public static ArrayListgetDroppedItems(Block base, int meta, int harvest, int fortune, boolean silktouch, int y) - { - ArrayListloot = new ArrayList(); - - if(!drops.isEmpty()) - { - Iterator list = drops.iterator(); - - while(list.hasNext()) - { - RandomDigs ore = (RandomDigs) list.next(); - if(matchesOre(ore, base, meta, harvest, fortune / 2F + 1F, silktouch, y)) - { - loot.add(ore.loot); - } - } - } - - return loot; - } - - private static boolean matchesOre(RandomDigs ore, Block base, int meta, int harvest, float multiplier, boolean silktouch, int y) - { - Random random = new Random(); - - if(ore.doesSilktouchDisable && silktouch) - { - return false; - } - - if(!(ore.minHeight == -1 && ore.maxHeight == -1)) - { - if(y < ore.minHeight || y > ore.maxHeight) - { - return false; - } - } - if(ore.block != base) - { - return false; - } - if(ore.blockSub != meta && ore.blockSub != OreDictionary.WILDCARD_VALUE) - { - return false; - } - if(ore.harvestLvl > harvest) - { - return false; - } - return random.nextFloat() < (ore.chanceToDrop * multiplier); - } + if (ore.doesSilktouchDisable && silktouch) { + return false; + } - public RandomDigs(ItemStack drop, float chance, Block base, int meta, int harvestLevel, int min, int max, boolean silkDisable) - { - doesSilktouchDisable = silkDisable; - minHeight = min; - maxHeight = max; - loot = drop; - chanceToDrop = chance; - harvestLvl = harvestLevel; - - block = base; - blockSub = meta; - } + if (!(ore.minHeight == -1 && ore.maxHeight == -1)) { + if (y < ore.minHeight || y > ore.maxHeight) { + return false; + } + } + if (ore.block != base) { + return false; + } + if (ore.blockSub != meta && ore.blockSub != OreDictionary.WILDCARD_VALUE) { + return false; + } + if (ore.harvestLvl > harvest) { + return false; + } + return random.nextFloat() < (ore.chanceToDrop * multiplier); + } } diff --git a/src/main/java/minefantasy/mf2/api/mining/RandomOre.java b/src/main/java/minefantasy/mf2/api/mining/RandomOre.java index 65c19408..5810205e 100644 --- a/src/main/java/minefantasy/mf2/api/mining/RandomOre.java +++ b/src/main/java/minefantasy/mf2/api/mining/RandomOre.java @@ -1,9 +1,5 @@ package minefantasy.mf2.api.mining; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Random; - import minefantasy.mf2.api.knowledge.ResearchLogic; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; @@ -11,114 +7,111 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class RandomOre -{ - public static ArrayList drops = new ArrayList(); - - private final ItemStack loot; - private final float chanceToDrop; - private final Block block; - private final int blockSub; - private final int harvestLvl; - private final int minHeight; - private final int maxHeight; - private final boolean doesSilktouchDisable; - private final String research; - - /** - * Adds an ore to drop - * @param drop the item dropped - * @param chance the chance as a percentage to drop - * @param block the block it drops from (ID, Block, or stack) - */ - public static void addOre(ItemStack drop, float chance, Block block, int meta, int harvestLevel, int min, int max, boolean silkDisable) - { - drops.add(new RandomOre(drop, chance/100F, block, meta, harvestLevel, min, max, silkDisable)); - } - public static void addOre(ItemStack drop, float chance, Block block, int harvestLevel, int min, int max, boolean silkDisable) - { - drops.add(new RandomOre(drop, chance/100F, block, OreDictionary.WILDCARD_VALUE, harvestLevel, min, max, silkDisable)); - } - - public static void addOre(ItemStack drop, float chance, Block block, int harvestLevel, int min, int max, boolean silkDisable, String research) - { - drops.add(new RandomOre(drop, chance/100F, block, OreDictionary.WILDCARD_VALUE, harvestLevel, min, max, silkDisable, research)); - } - - public static ArrayListgetDroppedItems(EntityLivingBase user, Block base, int meta, int harvest, int fortune, boolean silktouch, int y) - { - ArrayListloot = new ArrayList(); - - if(!drops.isEmpty()) - { - Iterator list = drops.iterator(); - - while(list.hasNext()) - { - RandomOre ore = (RandomOre) list.next(); - if(matchesOre(user, ore, base, meta, harvest, fortune / 2F + 1F, silktouch, y)) - { - loot.add(ore.loot); - } - } - } - - return loot; - } - - private static boolean matchesOre(EntityLivingBase user, RandomOre ore, Block base, int meta, int harvest, float multiplier, boolean silktouch, int y) - { - Random random = new Random(); - - if(ore.doesSilktouchDisable && silktouch) - { - return false; - } - if(user instanceof EntityPlayer && ore.research != null) - { - if(!ResearchLogic.hasInfoUnlocked((EntityPlayer)user, ore.research)) - { - return false; - } - } - - if(!(ore.minHeight == -1 && ore.maxHeight == -1)) - { - if(y < ore.minHeight || y > ore.maxHeight) - { - return false; - } - } - if(ore.block != base) - { - return false; - } - if(ore.blockSub != meta && ore.blockSub != OreDictionary.WILDCARD_VALUE) - { - return false; - } - if(ore.harvestLvl > harvest) - { - return false; - } - return random.nextFloat() < (ore.chanceToDrop * multiplier); - } - - public RandomOre(ItemStack drop, float chance, Block base, int meta, int harvestLevel, int min, int max, boolean silkDisable) - { - this(drop, chance, base, meta, harvestLevel, min, max, silkDisable, null); - } - public RandomOre(ItemStack drop, float chance, Block base, int meta, int harvestLevel, int min, int max, boolean silkDisable, String research) - { - doesSilktouchDisable = silkDisable; - minHeight = min; - maxHeight = max; - loot = drop; - chanceToDrop = chance; - harvestLvl = harvestLevel; - - block = base; - blockSub = meta; - this.research = research; - } +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Random; + +public class RandomOre { + public static ArrayList drops = new ArrayList(); + + private final ItemStack loot; + private final float chanceToDrop; + private final Block block; + private final int blockSub; + private final int harvestLvl; + private final int minHeight; + private final int maxHeight; + private final boolean doesSilktouchDisable; + private final String research; + + public RandomOre(ItemStack drop, float chance, Block base, int meta, int harvestLevel, int min, int max, + boolean silkDisable) { + this(drop, chance, base, meta, harvestLevel, min, max, silkDisable, null); + } + + public RandomOre(ItemStack drop, float chance, Block base, int meta, int harvestLevel, int min, int max, + boolean silkDisable, String research) { + doesSilktouchDisable = silkDisable; + minHeight = min; + maxHeight = max; + loot = drop; + chanceToDrop = chance; + harvestLvl = harvestLevel; + + block = base; + blockSub = meta; + this.research = research; + } + + /** + * Adds an ore to drop + * + * @param drop the item dropped + * @param chance the chance as a percentage to drop + * @param block the block it drops from (ID, Block, or stack) + */ + public static void addOre(ItemStack drop, float chance, Block block, int meta, int harvestLevel, int min, int max, + boolean silkDisable) { + drops.add(new RandomOre(drop, chance / 100F, block, meta, harvestLevel, min, max, silkDisable)); + } + + public static void addOre(ItemStack drop, float chance, Block block, int harvestLevel, int min, int max, + boolean silkDisable) { + drops.add(new RandomOre(drop, chance / 100F, block, OreDictionary.WILDCARD_VALUE, harvestLevel, min, max, + silkDisable)); + } + + public static void addOre(ItemStack drop, float chance, Block block, int harvestLevel, int min, int max, + boolean silkDisable, String research) { + drops.add(new RandomOre(drop, chance / 100F, block, OreDictionary.WILDCARD_VALUE, harvestLevel, min, max, + silkDisable, research)); + } + + public static ArrayList getDroppedItems(EntityLivingBase user, Block base, int meta, int harvest, + int fortune, boolean silktouch, int y) { + ArrayList loot = new ArrayList(); + + if (!drops.isEmpty()) { + Iterator list = drops.iterator(); + + while (list.hasNext()) { + RandomOre ore = (RandomOre) list.next(); + if (matchesOre(user, ore, base, meta, harvest, fortune / 2F + 1F, silktouch, y)) { + loot.add(ore.loot); + } + } + } + + return loot; + } + + private static boolean matchesOre(EntityLivingBase user, RandomOre ore, Block base, int meta, int harvest, + float multiplier, boolean silktouch, int y) { + Random random = new Random(); + + if (ore.doesSilktouchDisable && silktouch) { + return false; + } + if (user instanceof EntityPlayer && ore.research != null) { + if (!ResearchLogic.hasInfoUnlocked((EntityPlayer) user, ore.research)) { + return false; + } + } + + if (!(ore.minHeight == -1 && ore.maxHeight == -1)) { + if (y < ore.minHeight || y > ore.maxHeight) { + return false; + } + } + if (ore.block != base) { + return false; + } + if (ore.blockSub != meta && ore.blockSub != OreDictionary.WILDCARD_VALUE) { + return false; + } + if (ore.harvestLvl > harvest) { + return false; + } + return random.nextFloat() < (ore.chanceToDrop * multiplier); + } } diff --git a/src/main/java/minefantasy/mf2/api/refine/Alloy.java b/src/main/java/minefantasy/mf2/api/refine/Alloy.java index ea043067..2d9df482 100644 --- a/src/main/java/minefantasy/mf2/api/refine/Alloy.java +++ b/src/main/java/minefantasy/mf2/api/refine/Alloy.java @@ -1,11 +1,5 @@ package minefantasy.mf2.api.refine; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - import minefantasy.mf2.api.crafting.MineFantasyFuels; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; @@ -13,119 +7,108 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class Alloy{ - public final List recipeItems; - private final ItemStack recipeOutput; - private final int level; - private Map props = new HashMap(); - - public Alloy(ItemStack output, int requiredLevel, List items) - { - recipeItems = items; - recipeOutput = output; - level = requiredLevel; - } - - public ItemStack getRecipeOutput() - { +import java.util.*; + +public class Alloy { + public final List recipeItems; + public final ItemStack recipeOutput; + public final int level; + private Map props = new HashMap(); + + public Alloy(ItemStack output, int requiredLevel, List items) { + recipeItems = items; + recipeOutput = output; + level = requiredLevel; + } + + public ItemStack getRecipeOutput() { return this.recipeOutput; } - - public Alloy addProperty(String id, Object prop) - { - props.put(id, prop); - return this; - } - public Object getProperty(String id) - { - return props.get(id); - } + + public Alloy addProperty(String id, Object prop) { + props.put(id, prop); + return this; + } + + public Object getProperty(String id) { + return props.get(id); + } /** * Used to check if a recipe matches current crafting inventory */ - public boolean matches(ItemStack[] inventory) { - ArrayList checkRecipe = new ArrayList(this.recipeItems); - - for (ItemStack itemstack : inventory) - { - if (itemstack != null) - { - boolean matches = false; - Iterator iterator = checkRecipe.iterator(); - - while (iterator.hasNext()) - { - ItemStack checkItem = (ItemStack) iterator.next(); - - if (itemstack.isItemEqual(checkItem) && areMaterialsEqual(itemstack, checkItem) - && (checkItem.getItemDamage() == OreDictionary.WILDCARD_VALUE || itemstack.getItemDamage() == checkItem.getItemDamage())) - { - matches = true; - checkRecipe.remove(checkItem); - break; - } - if (areBothCarbon(itemstack, checkItem)) - { - matches = true; - checkRecipe.remove(checkItem); - break; - } - } - - if (!matches) - { - return false; - } - } - } - - return checkRecipe.isEmpty(); - } - - private boolean areMaterialsEqual(ItemStack itemstack, ItemStack checkItem) - { - CustomMaterial material1 = CustomToolHelper.getCustomPrimaryMaterial(itemstack); - CustomMaterial material2 = CustomToolHelper.getCustomPrimaryMaterial(checkItem); - if(material1 == null && material2 == null) - { - return true; - } - if(material1 != null && material2 != null) - { - return material1 == material2; - } - return false; - } - - private boolean areBothCarbon(ItemStack item1, ItemStack item2) - { - return MineFantasyFuels.isCarbon(item1) && MineFantasyFuels.isCarbon(item2); - } - - /** + public boolean matches(ItemStack[] inventory) { + ArrayList checkRecipe = new ArrayList(this.recipeItems); + + for (ItemStack itemstack : inventory) { + if (itemstack != null) { + boolean matches = false; + Iterator iterator = checkRecipe.iterator(); + + while (iterator.hasNext()) { + ItemStack checkItem = (ItemStack) iterator.next(); + + if (itemstack.isItemEqual(checkItem) && areMaterialsEqual(itemstack, checkItem) + && (checkItem.getItemDamage() == OreDictionary.WILDCARD_VALUE + || itemstack.getItemDamage() == checkItem.getItemDamage())) { + matches = true; + checkRecipe.remove(checkItem); + break; + } + if (areBothCarbon(itemstack, checkItem)) { + matches = true; + checkRecipe.remove(checkItem); + break; + } + } + + if (!matches) { + return false; + } + } + } + + return checkRecipe.isEmpty(); + } + + private boolean areMaterialsEqual(ItemStack itemstack, ItemStack checkItem) { + CustomMaterial material1 = CustomToolHelper.getCustomPrimaryMaterial(itemstack); + CustomMaterial material2 = CustomToolHelper.getCustomPrimaryMaterial(checkItem); + if (material1 == null && material2 == null) { + return true; + } + if (material1 != null && material2 != null) { + return material1 == material2; + } + return false; + } + + public boolean areBothCarbon(ItemStack item1, ItemStack item2) { + return MineFantasyFuels.isCarbon(item1) && MineFantasyFuels.isCarbon(item2); + } + + /** * Returns an Item that is the result of this recipe */ - public ItemStack getCraftingResult(InventoryCrafting inv) - { + public ItemStack getCraftingResult(InventoryCrafting inv) { return this.recipeOutput.copy(); } /** * Returns the size of the recipe area */ - public int getRecipeSize() - { + public int getRecipeSize() { return this.recipeItems.size(); } - + /** * Gets the level of the Alloy, requiring a more powerful smelter - * @return the minimal level required to make (crucible is 0, alloy forge = 1, etc) + * + * @return the minimal level required to make (crucible is 0, alloy forge = 1, + * etc) */ - public int getLevel() - { - return level; + public int getLevel() { + return level; } - + } diff --git a/src/main/java/minefantasy/mf2/api/refine/AlloyRecipes.java b/src/main/java/minefantasy/mf2/api/refine/AlloyRecipes.java index 80285412..24160c8d 100644 --- a/src/main/java/minefantasy/mf2/api/refine/AlloyRecipes.java +++ b/src/main/java/minefantasy/mf2/api/refine/AlloyRecipes.java @@ -1,77 +1,69 @@ package minefantasy.mf2.api.refine; +import net.minecraft.item.ItemStack; + import java.util.ArrayList; import java.util.List; -import net.minecraft.item.ItemStack; - public class AlloyRecipes { - private static Listalloys = new ArrayList(); - - public static Alloy addAlloy(ItemStack out, int level, List in) - { - Alloy alloy = new Alloy(out, level, in); - alloys.add(alloy); - return alloy; - } - public static void addAlloy(ItemStack out, List in) - { - addAlloy(out, 0, in); - } - public static void addAlloy(Alloy alloy) - { - alloys.add(alloy); - } - - public static Alloy getResult(ItemStack[] inv) - { - for(Alloy alloy : alloys) - { - if(alloy.matches(inv)) - { - return alloy; - } - } - return null; - } - - /** - * Adds an alloy, and duplicates it so the ratio can be copied - * eg a recipe with 2 'x' ore and 1 'y' ore can be made with 4 'x' ore and 2 'y' ore... - * @param the amount of times the ratio can be added - */ - public static Alloy[] addRatioRecipe(ItemStack out, int level, List in, int levels) - { - levels = (int)(9F / in.size()); - Alloy[] alloys = new Alloy[levels]; - for(int a = 1; a <= levels; a ++) - { - List list2 = createDupeList(in, a); - ItemStack out2 = out.copy(); - int ss = Math.min(out2.getMaxStackSize(), out2.stackSize * a); - out2.stackSize = ss; - alloys[a-1] = addAlloy(out2, level, list2); - } - return alloys; - } - public static List createDupeList(List list) - { - return createDupeList(list, 2); - } - public static List createDupeList(List list, int dupe) - { - if(dupe == 0) - { - dupe = 1; - } - List list2 = new ArrayList(); - for(int a = 0; a < dupe; a ++) - { - for(int b = 0; b < list.size(); b ++) - { - list2.add(list.get(b)); - } - } - return list2; - } + public static List alloys = new ArrayList(); + + public static Alloy addAlloy(ItemStack out, int level, List in) { + Alloy alloy = new Alloy(out, level, in); + alloys.add(alloy); + return alloy; + } + + public static void addAlloy(ItemStack out, List in) { + addAlloy(out, 0, in); + } + + public static void addAlloy(Alloy alloy) { + alloys.add(alloy); + } + + public static Alloy getResult(ItemStack[] inv) { + for (Alloy alloy : alloys) { + if (alloy.matches(inv)) { + return alloy; + } + } + return null; + } + + /** + * Adds an alloy, and duplicates it so the ratio can be copied eg a recipe with + * 2 'x' ore and 1 'y' ore can be made with 4 'x' ore and 2 'y' ore... + * + * @param the amount of times the ratio can be added + */ + public static Alloy[] addRatioRecipe(ItemStack out, int level, List in, int levels) { + levels = (int) (9F / in.size()); + Alloy[] alloys = new Alloy[levels]; + for (int a = 1; a <= levels; a++) { + List list2 = createDupeList(in, a); + ItemStack out2 = out.copy(); + int ss = Math.min(out2.getMaxStackSize(), out2.stackSize * a); + out2.stackSize = ss; + alloys[a - 1] = addAlloy(out2, level, list2); + } + return alloys; + } + + public static List createDupeList(List list) { + return createDupeList(list, 2); + } + + public static List createDupeList(List list, int dupe) { + if (dupe == 0) { + dupe = 1; + } + List list2 = new ArrayList(); + for (int a = 0; a < dupe; a++) { + for (int b = 0; b < list.size(); b++) { + list2.add(list.get(b)); + } + } + return list2; + } } diff --git a/src/main/java/minefantasy/mf2/api/refine/BigFurnaceRecipes.java b/src/main/java/minefantasy/mf2/api/refine/BigFurnaceRecipes.java index 62c70175..9c6bee90 100644 --- a/src/main/java/minefantasy/mf2/api/refine/BigFurnaceRecipes.java +++ b/src/main/java/minefantasy/mf2/api/refine/BigFurnaceRecipes.java @@ -1,46 +1,46 @@ package minefantasy.mf2.api.refine; -import java.util.HashMap; - import minefantasy.mf2.api.helpers.CustomToolHelper; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class BigFurnaceRecipes -{ - public static HashMaprecipeList = new HashMap(); - - public static BigFurnaceRecipes addRecipe(Block input, ItemStack output, int tier) - { - return addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output, tier); - } - public static BigFurnaceRecipes addRecipe(Item input, ItemStack output, int tier) - { - return addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output, tier); - } - public static BigFurnaceRecipes addRecipe(ItemStack input, ItemStack output, int tier) - { - BigFurnaceRecipes recipe = new BigFurnaceRecipes(input, output, tier); - recipeList.put(CustomToolHelper.getReferenceName(input), recipe); - return recipe; - } - public static BigFurnaceRecipes getResult(ItemStack input) - { - if(input == null)return null; - - BigFurnaceRecipes specific = recipeList.get(CustomToolHelper.getReferenceName(input)); - if(specific != null)return specific; - - return recipeList.get(CustomToolHelper.getReferenceName(input, "any")); - } - - public final ItemStack result; - public final int tier; - public BigFurnaceRecipes(ItemStack input, ItemStack output, int tier) - { - this.result = output; - this.tier = tier; - } +import java.util.HashMap; + +public class BigFurnaceRecipes { + public static HashMap recipeList = new HashMap(); + public final ItemStack input, result; + public final int tier; + + public BigFurnaceRecipes(ItemStack input, ItemStack output, int tier) { + this.input = input; + this.result = output; + this.tier = tier; + } + + public static BigFurnaceRecipes addRecipe(Block input, ItemStack output, int tier) { + return addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output, tier); + } + + public static BigFurnaceRecipes addRecipe(Item input, ItemStack output, int tier) { + return addRecipe(new ItemStack(input, 1, OreDictionary.WILDCARD_VALUE), output, tier); + } + + public static BigFurnaceRecipes addRecipe(ItemStack input, ItemStack output, int tier) { + BigFurnaceRecipes recipe = new BigFurnaceRecipes(input, output, tier); + recipeList.put(CustomToolHelper.getReferenceName(input), recipe); + return recipe; + } + + public static BigFurnaceRecipes getResult(ItemStack input) { + if (input == null) + return null; + + BigFurnaceRecipes specific = recipeList.get(CustomToolHelper.getReferenceName(input)); + if (specific != null) + return specific; + + return recipeList.get(CustomToolHelper.getReferenceName(input, "any")); + } } diff --git a/src/main/java/minefantasy/mf2/api/refine/BlastFurnaceRecipes.java b/src/main/java/minefantasy/mf2/api/refine/BlastFurnaceRecipes.java index 98432252..58872d8a 100644 --- a/src/main/java/minefantasy/mf2/api/refine/BlastFurnaceRecipes.java +++ b/src/main/java/minefantasy/mf2/api/refine/BlastFurnaceRecipes.java @@ -1,78 +1,67 @@ package minefantasy.mf2.api.refine; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class BlastFurnaceRecipes -{ +public class BlastFurnaceRecipes { private static final BlastFurnaceRecipes smeltingBase = new BlastFurnaceRecipes(); - /** The list of smelting results. */ - private Map smeltingList = new HashMap(); + /** + * The list of smelting results. + */ + private Map smeltingList = new HashMap(); + + private BlastFurnaceRecipes() { + } /** * Used to call methods addSmelting and getSmeltingResult. */ - public static BlastFurnaceRecipes smelting() - { + public static BlastFurnaceRecipes smelting() { return smeltingBase; } - private BlastFurnaceRecipes() - { - } - - public void addRecipe(Block input, ItemStack output) - { + public void addRecipe(Block input, ItemStack output) { this.addRecipe(Item.getItemFromBlock(input), output); } - public void addRecipe(Item input, ItemStack output) - { + public void addRecipe(Item input, ItemStack output) { this.addRecipe(new ItemStack(input, 1, 32767), output); } - public void addRecipe(ItemStack input, ItemStack output) - { + public void addRecipe(ItemStack input, ItemStack output) { this.smeltingList.put(input, output); } /** * Returns the smelting result of an item. */ - public ItemStack getSmeltingResult(ItemStack input) - { + public ItemStack getSmeltingResult(ItemStack input) { Iterator iterator = this.smeltingList.entrySet().iterator(); Entry entry; - do - { - if (!iterator.hasNext()) - { + do { + if (!iterator.hasNext()) { return null; } - entry = (Entry)iterator.next(); - } - while (!this.func_151397_a(input, (ItemStack)entry.getKey())); + entry = (Entry) iterator.next(); + } while (!this.func_151397_a(input, (ItemStack) entry.getKey())); - return (ItemStack)entry.getValue(); + return (ItemStack) entry.getValue(); } - private boolean func_151397_a(ItemStack p_151397_1_, ItemStack p_151397_2_) - { - return p_151397_2_.getItem() == p_151397_1_.getItem() && (p_151397_2_.getItemDamage() == 32767 || p_151397_2_.getItemDamage() == p_151397_1_.getItemDamage()); + private boolean func_151397_a(ItemStack p_151397_1_, ItemStack p_151397_2_) { + return p_151397_2_.getItem() == p_151397_1_.getItem() + && (p_151397_2_.getItemDamage() == 32767 || p_151397_2_.getItemDamage() == p_151397_1_.getItemDamage()); } - public Map getSmeltingList() - { + public Map getSmeltingList() { return this.smeltingList; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/api/refine/IBellowsUseable.java b/src/main/java/minefantasy/mf2/api/refine/IBellowsUseable.java index 73ef4755..042ebe0b 100644 --- a/src/main/java/minefantasy/mf2/api/refine/IBellowsUseable.java +++ b/src/main/java/minefantasy/mf2/api/refine/IBellowsUseable.java @@ -2,6 +2,6 @@ public interface IBellowsUseable { - void onUsedWithBellows(float powerLevel); + void onUsedWithBellows(float powerLevel); } diff --git a/src/main/java/minefantasy/mf2/api/refine/ISmokeCarrier.java b/src/main/java/minefantasy/mf2/api/refine/ISmokeCarrier.java index a282265c..0262f7f8 100644 --- a/src/main/java/minefantasy/mf2/api/refine/ISmokeCarrier.java +++ b/src/main/java/minefantasy/mf2/api/refine/ISmokeCarrier.java @@ -1,9 +1,11 @@ package minefantasy.mf2.api.refine; -public interface ISmokeCarrier -{ - public int getSmokeValue(); - public void setSmokeValue(int smoke); - public int getMaxSmokeStorage(); - public boolean canAbsorbIndirect(); +public interface ISmokeCarrier { + public int getSmokeValue(); + + public void setSmokeValue(int smoke); + + public int getMaxSmokeStorage(); + + public boolean canAbsorbIndirect(); } diff --git a/src/main/java/minefantasy/mf2/api/refine/ISmokeHandler.java b/src/main/java/minefantasy/mf2/api/refine/ISmokeHandler.java index 3e0799ad..1b7a3172 100644 --- a/src/main/java/minefantasy/mf2/api/refine/ISmokeHandler.java +++ b/src/main/java/minefantasy/mf2/api/refine/ISmokeHandler.java @@ -3,9 +3,9 @@ import net.minecraft.world.World; /** - * This is only implemented once by MineFantasy just a hook to allow MF entities to be used + * This is only implemented once by MineFantasy just a hook to allow MF entities + * to be used */ -public interface ISmokeHandler -{ - void spawnSmoke(World world, double x, double y, double z, int value); +public interface ISmokeHandler { + void spawnSmoke(World world, double x, double y, double z, int value); } diff --git a/src/main/java/minefantasy/mf2/api/refine/SmokeMechanics.java b/src/main/java/minefantasy/mf2/api/refine/SmokeMechanics.java index b433b40a..02e5bdb9 100644 --- a/src/main/java/minefantasy/mf2/api/refine/SmokeMechanics.java +++ b/src/main/java/minefantasy/mf2/api/refine/SmokeMechanics.java @@ -1,170 +1,148 @@ package minefantasy.mf2.api.refine; -import java.util.Random; - import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class SmokeMechanics -{ - /** - * Emits smoke from a carrying block - * @param max the maximum smoke emitted each tick (-1 for infinite) - * @return true if it's successful - */ - public static boolean emitSmokeFromCarrier(World world, int x, int y, int z, ISmokeCarrier tile, int max) - { - int value = tile.getSmokeValue(); - - if(max >= 0 && value > max) - { - value = max; - } - if(value <= 0) - { - return true;//yes it succeeded because it doesn't need to... it just really means nothing went wrong - } - boolean success = emitSmoke(world, x, y, z, value) != -1; - - if(success) - { - modifySmoke(tile, -value); - } - return success; - } - /** - * Tries to emit smoke, sends it to chimneys if possible - * Returns -1 for fail, 0 for shared, 1 for success - */ - public static int emitSmoke(World world, int x, int y, int z, int value) - { - TileEntity tile = world.getTileEntity(x, y+1, z);//The above block - if(tile == null) //No TileEntity above - { - if(world.isSideSolid(x, y+1, z, ForgeDirection.DOWN))//if solid above - { - return -1; - } - //if(world.canBlockSeeTheSky(x, y+1, z)) - { - spawnSmoke(world, x, y+1, z, value); - return 1; - } - } - else - { - if(tile instanceof ISmokeCarrier) - { - if(((ISmokeCarrier)tile).getSmokeValue() < ((ISmokeCarrier)tile).getMaxSmokeStorage()) - { - modifySmoke((ISmokeCarrier)tile, value); - return 0; - } - } - else - { - if(world.isSideSolid(x, y+1, z, ForgeDirection.DOWN))//if solid above - { - return -1; - } - } - } - return -1; - } +import java.util.Random; + +public class SmokeMechanics { + public static ISmokeHandler handler; + /** + * Do not use this from blocks, use emitSmoke instead Spawns smoke + */ + private static Random rand = new Random(); + + /** + * Emits smoke from a carrying block + * + * @param max the maximum smoke emitted each tick (-1 for infinite) + * @return true if it's successful + */ + public static boolean emitSmokeFromCarrier(World world, int x, int y, int z, ISmokeCarrier tile, int max) { + int value = tile.getSmokeValue(); + + if (max >= 0 && value > max) { + value = max; + } + if (value <= 0) { + return true;// yes it succeeded because it doesn't need to... it just really means nothing + // went wrong + } + boolean success = emitSmoke(world, x, y, z, value) != -1; + + if (success) { + modifySmoke(tile, -value); + } + return success; + } + + /** + * Tries to emit smoke, sends it to chimneys if possible Returns -1 for fail, 0 + * for shared, 1 for success + */ + public static int emitSmoke(World world, int x, int y, int z, int value) { + TileEntity tile = world.getTileEntity(x, y + 1, z);// The above block + if (tile == null) // No TileEntity above + { + if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))// if solid above + { + return -1; + } + // if(world.canBlockSeeTheSky(x, y+1, z)) + { + spawnSmoke(world, x, y + 1, z, value); + return 1; + } + } else { + if (tile instanceof ISmokeCarrier) { + if (((ISmokeCarrier) tile).getSmokeValue() < ((ISmokeCarrier) tile).getMaxSmokeStorage()) { + modifySmoke((ISmokeCarrier) tile, value); + return 0; + } + } else { + if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))// if solid above + { + return -1; + } + } + } + return -1; + } + + public static void modifySmoke(ISmokeCarrier tile, int value) { + tile.setSmokeValue(tile.getSmokeValue() + value); + if (tile.getSmokeValue() <= 0) { + tile.setSmokeValue(0); + } + } + + /** + * Emits smoke to a coord, ignoring chimneys + */ + public static void spawnSmoke(World world, int x, int y, int z, int value) { + spawnSmokeD(world, x + 0.5D, y + 0.5D, z + 0.5D, value); + } + + /** + * Emits smoke, ignoring chimneys + */ + public static void spawnSmokeD(World world, double x, double y, double z, int value) { + if (!world.isRemote && handler != null) { + handler.spawnSmoke(world, x, y, z, value); + } + + for (int a = 0; a < value; a++) { + float sprayRange = 0.2F; + float sprayX = (rand.nextFloat() * sprayRange) - (sprayRange / 2); + float sprayZ = (rand.nextFloat() * sprayRange) - (sprayRange / 2); + float height = 0.2F; + world.spawnParticle("smoke", x, y, z, sprayX, height, sprayZ); + } + } + + /** + * Checks if smoke can go through a chimney + */ + public static boolean tryUseChimney(World world, int x, int y, int z, int value) { + return tryUseChimney(world, x, y, z, value, true); + } + + /** + * Checks if smoke can go through a chimney + */ + public static boolean tryUseChimney(World world, int x, int y, int z, int value, boolean indirect) { + TileEntity tile = world.getTileEntity(x, y, z);// The block + if (tile != null) { + if (tile instanceof ISmokeCarrier) { + ISmokeCarrier chimney = (ISmokeCarrier) tile; + if ((!indirect || chimney.canAbsorbIndirect()) + && chimney.getSmokeValue() < chimney.getMaxSmokeStorage()) { + modifySmoke(chimney, value); + return true; + } + } + } + return false; + } - public static void modifySmoke(ISmokeCarrier tile, int value) - { - tile.setSmokeValue(tile.getSmokeValue() + value); - if(tile.getSmokeValue() <= 0) - { - tile.setSmokeValue(0); - } - } + /** + * Emits smoke from a source, or goes through a chimney + */ + public static void emitSmokeIndirect(World world, int xCoord, int yCoord, int zCoord, int value) { + if (tryUseChimney(world, xCoord, yCoord, zCoord, value)) { + return; + } - /** - * Do not use this from blocks, use emitSmoke instead - * Spawns smoke - */ - private static Random rand = new Random(); - public static ISmokeHandler handler; - /** - * Emits smoke to a coord, ignoring chimneys - */ - public static void spawnSmoke(World world, int x, int y, int z, int value) - { - spawnSmokeD(world, x+0.5D, y+0.5D, z+0.5D, value); - } - /** - * Emits smoke, ignoring chimneys - */ - public static void spawnSmokeD(World world, double x, double y, double z, int value) - { - if(!world.isRemote && handler != null) - { - handler.spawnSmoke(world, x, y, z, value); - } - - for(int a = 0; a < value; a++) - { - float sprayRange = 0.2F; - float sprayX = (rand.nextFloat()*sprayRange) - (sprayRange/2); - float sprayZ = (rand.nextFloat()*sprayRange) - (sprayRange/2); - float height = 0.2F; - world.spawnParticle("smoke",x, y, z, sprayX, height, sprayZ); - } - } - - /** - * Checks if smoke can go through a chimney - */ - public static boolean tryUseChimney(World world, int x, int y, int z, int value) - { - return tryUseChimney(world, x, y, z, value, true); - } - /** - * Checks if smoke can go through a chimney - */ - public static boolean tryUseChimney(World world, int x, int y, int z, int value, boolean indirect) - { - TileEntity tile = world.getTileEntity(x, y, z);//The block - if(tile != null) - { - if(tile instanceof ISmokeCarrier) - { - ISmokeCarrier chimney = (ISmokeCarrier) tile; - if((!indirect || chimney.canAbsorbIndirect()) && chimney.getSmokeValue() < chimney.getMaxSmokeStorage()) - { - modifySmoke(chimney, value); - return true; - } - } - } - return false; - } - /** - * Emits smoke from a source, or goes through a chimney - */ - public static void emitSmokeIndirect(World world, int xCoord, int yCoord, int zCoord, int value) - { - if(tryUseChimney(world, xCoord, yCoord, zCoord, value)) - { - return; - } - - for(int x = -1; x <= 1; x++) - { - for(int y = 0; y <= 1; y++) - { - for(int z = -1; z <= 1; z++) - { - if(tryUseChimney(world, xCoord + x, yCoord + y, zCoord + z, value)) - { - return; - } - } - } - } - spawnSmoke(world, xCoord, yCoord, zCoord, value); - } + for (int x = -1; x <= 1; x++) { + for (int y = 0; y <= 1; y++) { + for (int z = -1; z <= 1; z++) { + if (tryUseChimney(world, xCoord + x, yCoord + y, zCoord + z, value)) { + return; + } + } + } + } + spawnSmoke(world, xCoord, yCoord, zCoord, value); + } } diff --git a/src/main/java/minefantasy/mf2/api/rpg/LevelupEvent.java b/src/main/java/minefantasy/mf2/api/rpg/LevelupEvent.java index ca181868..b86645bc 100644 --- a/src/main/java/minefantasy/mf2/api/rpg/LevelupEvent.java +++ b/src/main/java/minefantasy/mf2/api/rpg/LevelupEvent.java @@ -3,18 +3,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.event.entity.living.LivingEvent; -public class LevelupEvent extends LivingEvent -{ - public final EntityPlayer thePlayer; - public final Skill theSkill; - public final int theLevel; - - public LevelupEvent(EntityPlayer player, Skill skill, int newlvl) - { - super(player); - this.thePlayer = player; - this.theSkill = skill; - this.theLevel = newlvl; - } +public class LevelupEvent extends LivingEvent { + public final EntityPlayer thePlayer; + public final Skill theSkill; + public final int theLevel; + + public LevelupEvent(EntityPlayer player, Skill skill, int newlvl) { + super(player); + this.thePlayer = player; + this.theSkill = skill; + this.theLevel = newlvl; + } } diff --git a/src/main/java/minefantasy/mf2/api/rpg/RPGElements.java b/src/main/java/minefantasy/mf2/api/rpg/RPGElements.java index 6443d390..97a339ab 100644 --- a/src/main/java/minefantasy/mf2/api/rpg/RPGElements.java +++ b/src/main/java/minefantasy/mf2/api/rpg/RPGElements.java @@ -1,143 +1,120 @@ package minefantasy.mf2.api.rpg; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Random; - -import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.helpers.PlayerTagData; +import minefantasy.mf2.util.XSTRandom; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -public class RPGElements -{ - public static boolean isSystemActive = true; - public static float levelSpeedModifier = 1.0F; - public static float levelUpModifier = 1.5F; - - private static HashMapskillsMap = new HashMap(); - private static ArrayListskillsList = new ArrayList(); - - public static void addSkill(String name) - { - addSkill(new Skill(name)); - } - public static void addSkill(Skill skill) - { - skillsMap.put(skill.skillName, skill); - skillsList.add(skill); - } - private static final String statsName = "RPGStats_MF"; - public static NBTTagCompound getTagData(EntityPlayer player) - { - NBTTagCompound nbt = PlayerTagData.getPersistedData(player); - if(!nbt.hasKey(statsName)) - { - nbt.setTag(statsName, new NBTTagCompound()); - } - return nbt.getCompoundTag(statsName); - } - - public static NBTTagCompound getSkill(EntityPlayer player, String skillname) - { - NBTTagCompound nbt = getTagData(player); - if(!nbt.hasKey(skillname)) - { - NBTTagCompound tag = new NBTTagCompound(); - - Skill skill = skillsMap.get(skillname); - if(skill != null) - { - skill.init(tag, player); - } - nbt.setTag(skillname, tag); - } - return nbt.getCompoundTag(skillname); - } - - public static void initSkills(EntityPlayer player) - { - for(int id = 0; id < skillsList.size(); id++) - { - Skill skill = skillsList.get(id); - skill.sync(player); - } - } - - static - { - if(isSystemActive) - { - SkillList.init(); - } - } - - public static Skill getSkillByName(String name) - { - return skillsMap.get(name); - } - public static int getLevel(EntityPlayer player, Skill skill) - { - return RPGElements.getSkill(player, skill.skillName).getInteger("level"); - } - - /** - * Modifies the stamina cost for an ability (-1 means impossible) - */ - public static float getStaminaCostModifier(EntityPlayer player, Skill skill, int minLevel) - { - NBTTagCompound stat = getSkill(player, skill.skillName); - int level = stat.getInteger("level"); - - if(level < minLevel) - { - return -1; - } - else - { - if(skill.getMaxLevel()-minLevel <= 0) - { - return 1.0F; - } - float progress = (level-minLevel) / (skill.getMaxLevel()-minLevel); - return 1.5F - progress; - } - } - public static float getWeaponModifier(EntityPlayer player, Skill skill) - { - int minSkill = 25;//No bonus damage until level 25+ - int level = getLevel(player, skill); - if(level <= minSkill) - { - return 1.0F; - } - - float progress = ((float)level-minSkill) / ((float)skill.getMaxLevel()-minSkill); - return 1.0F + (progress); - } - public static boolean hasLevel(EntityPlayer player, Skill skill, int requirement) - { - return getSkill(player, skill.skillName).getInteger("level") >= requirement; - } - private static Random rand = new Random(); - public static Skill getRandomSkill() - { - int id = rand.nextInt(skillsList.size()); - return skillsList.get(id); - } - public static void syncAll(EntityPlayer user) - { - if(!user.worldObj.isRemote) - { - for(int a = 0; a < skillsList.size(); a++) - { - Skill skill = skillsList.get(a); - if(skill != null) - { - skill.sync(user); - } - } - } - } + +import java.util.ArrayList; +import java.util.HashMap; + +public class RPGElements { + private static final String statsName = "RPGStats_MF"; + public static boolean isSystemActive = true; + public static float levelSpeedModifier = 1.0F; + public static float levelUpModifier = 1.5F; + public static ArrayList skillsList = new ArrayList(); + private static HashMap skillsMap = new HashMap(); + private static XSTRandom rand = new XSTRandom(); + + static { + if (isSystemActive) { + SkillList.init(); + } + } + + public static void addSkill(String name) { + addSkill(new Skill(name)); + } + + public static void addSkill(Skill skill) { + skillsMap.put(skill.skillName, skill); + skillsList.add(skill); + } + + public static NBTTagCompound getTagData(EntityPlayer player) { + NBTTagCompound nbt = PlayerTagData.getPersistedData(player); + if (!nbt.hasKey(statsName)) { + nbt.setTag(statsName, new NBTTagCompound()); + } + return nbt.getCompoundTag(statsName); + } + + public static NBTTagCompound getSkill(EntityPlayer player, String skillname) { + NBTTagCompound nbt = getTagData(player); + if (!nbt.hasKey(skillname)) { + NBTTagCompound tag = new NBTTagCompound(); + + Skill skill = skillsMap.get(skillname); + if (skill != null) { + skill.init(tag, player); + } + nbt.setTag(skillname, tag); + } + return nbt.getCompoundTag(skillname); + } + + public static void initSkills(EntityPlayer player) { + for (int id = 0; id < skillsList.size(); id++) { + Skill skill = skillsList.get(id); + skill.sync(player); + } + } + + public static Skill getSkillByName(String name) { + return skillsMap.get(name.toLowerCase()); + } + + public static int getLevel(EntityPlayer player, Skill skill) { + return RPGElements.getSkill(player, skill.skillName).getInteger("level"); + } + + /** + * Modifies the stamina cost for an ability (-1 means impossible) + */ + public static float getStaminaCostModifier(EntityPlayer player, Skill skill, int minLevel) { + NBTTagCompound stat = getSkill(player, skill.skillName); + int level = stat.getInteger("level"); + + if (level < minLevel) { + return -1; + } else { + if (skill.getMaxLevel() - minLevel <= 0) { + return 1.0F; + } + float progress = (level - minLevel) / (skill.getMaxLevel() - minLevel); + return 1.5F - progress; + } + } + + public static float getWeaponModifier(EntityPlayer player, Skill skill) { + int minSkill = 25;// No bonus damage until level 25+ + int level = getLevel(player, skill); + if (level <= minSkill) { + return 1.0F; + } + + float progress = ((float) level - minSkill) / ((float) skill.getMaxLevel() - minSkill); + return 1.0F + (progress); + } + + public static boolean hasLevel(EntityPlayer player, Skill skill, int requirement) { + return getSkill(player, skill.skillName).getInteger("level") >= requirement; + } + + public static Skill getRandomSkill() { + int id = rand.nextInt(skillsList.size()); + return skillsList.get(id); + } + + public static void syncAll(EntityPlayer user) { + if (!user.worldObj.isRemote) { + for (int a = 0; a < skillsList.size(); a++) { + Skill skill = skillsList.get(a); + if (skill != null) { + skill.sync(user); + } + } + } + } } diff --git a/src/main/java/minefantasy/mf2/api/rpg/Skill.java b/src/main/java/minefantasy/mf2/api/rpg/Skill.java index 6def82ec..0ef66ed4 100644 --- a/src/main/java/minefantasy/mf2/api/rpg/Skill.java +++ b/src/main/java/minefantasy/mf2/api/rpg/Skill.java @@ -3,144 +3,132 @@ import minefantasy.mf2.api.MineFantasyAPI; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.StatCollector; import net.minecraftforge.common.MinecraftForge; -public class Skill -{ - public final String skillName; - public Skill(String name) - { - this.skillName = name; - } - public int getMaxLevel() - { - return 100; - } - public int getStartLevel() - { - return 1; - } - public Skill register() - { - RPGElements.addSkill(this); - return this; - } - - /** - * Gets how much xp needed to level up - */ - public int getLvlXP(int level, EntityPlayer user) - { - float rise = 0.2F * RPGElements.levelUpModifier;//20% rize each level - return (int) Math.floor(10F * (1.0F + (rise*(level-1)))); - } - - public int[] getXP(EntityPlayer player) - { - NBTTagCompound skill = RPGElements.getSkill(player, skillName); - - if(skill != null) - { - int value = skill.getInteger("xp"); - int max = skill.getInteger("xpMax"); - return new int[]{value, max}; - } - return new int[]{0, 0}; - } - - public void manualLvlUp(EntityPlayer player, int newLevel) - { - NBTTagCompound skill = RPGElements.getSkill(player, skillName); - if(skill == null)return; - - skill.setInteger("xp", 0); - - skill.setInteger("level", newLevel); - skill.setInteger("xp", 0); - skill.setInteger("xpMax", getLvlXP(newLevel, player)); - levelUp(player, newLevel); - } - - /** - * Adds xp to the skill, negative values take xp away - */ - public void addXP(EntityPlayer player, int xp) - { - xp = (int)(RPGElements.levelSpeedModifier * xp); - NBTTagCompound skill = RPGElements.getSkill(player, skillName); - if(skill == null)return; - - int value = skill.getInteger("xp"); - int max = skill.getInteger("xpMax"); - int curLvl = RPGElements.getLevel(player, this); - - if(max <= 0 || curLvl >= getMaxLevel()) - { - return; - } - value += xp; - skill.setInteger("xp", value); - - if(value >= max) - { - value -= max; - int level = skill.getInteger("level") + 1; - skill.setInteger("level", level); - skill.setInteger("xp", value); - skill.setInteger("xpMax", getLvlXP(level, player)); - levelUp(player, level); - } - else - { - if(value < 0) - { - int level = skill.getInteger("level") - 1; - if(level < 1)return; - - skill.setInteger("level", level); - - int newMax = getLvlXP(level, player); - skill.setInteger("xp", value+newMax); - skill.setInteger("xpMax", newMax); - } - } - } - private void levelUp(EntityPlayer player, int newlvl) - { - if(!player.worldObj.isRemote) - { - MineFantasyAPI.debugMsg("Level up detected for " + skillName); - MinecraftForge.EVENT_BUS.post(new LevelupEvent(player, this, newlvl)); - } - } - /** - * This is a universal way to tell a skill to do something - * @param functionID a string representing what to do, depends on the skill - */ - public void callFunction(EntityPlayer user, String functionID) - { - } - - public void init(NBTTagCompound tag, EntityPlayer player) - { - int start = getStartLevel(); - tag.setInteger("level", start); - tag.setInteger("xp", 0); - tag.setInteger("xpMax", getLvlXP(start, player)); - } - public void sync(EntityPlayer player) - { - if(!player.worldObj.isRemote) - { - MineFantasyAPI.debugMsg("Sync skill: " + skillName); - MinecraftForge.EVENT_BUS.post(new SyncSkillEvent(player, this)); - } - } - - public String getDisplayName() - { - return StatCollector.translateToLocal("skill."+skillName+".name"); - } +public class Skill { + public final String skillName; + + public Skill(String name) { + this.skillName = name; + } + + public int getMaxLevel() { + return 100; + } + + public int getStartLevel() { + return 1; + } + + public Skill register() { + RPGElements.addSkill(this); + return this; + } + + /** + * Gets how much xp needed to level up + */ + public int getLvlXP(int level, EntityPlayer user) { + float rise = 0.2F * RPGElements.levelUpModifier;// 20% rize each level + return (int) Math.floor(10F * (1.0F + (rise * (level - 1)))); + } + + public int[] getXP(EntityPlayer player) { + NBTTagCompound skill = RPGElements.getSkill(player, skillName); + + if (skill != null) { + int value = skill.getInteger("xp"); + int max = skill.getInteger("xpMax"); + return new int[]{value, max}; + } + return new int[]{0, 0}; + } + + public void manualLvlUp(EntityPlayer player, int newLevel) { + NBTTagCompound skill = RPGElements.getSkill(player, skillName); + if (skill == null) + return; + + skill.setInteger("xp", 0); + + skill.setInteger("level", newLevel); + skill.setInteger("xp", 0); + skill.setInteger("xpMax", getLvlXP(newLevel, player)); + levelUp(player, newLevel); + } + + /** + * Adds xp to the skill, negative values take xp away + */ + public void addXP(EntityPlayer player, int xp) { + xp = (int) (RPGElements.levelSpeedModifier * xp); + NBTTagCompound skill = RPGElements.getSkill(player, skillName); + if (skill == null) + return; + + int value = skill.getInteger("xp"); + int max = skill.getInteger("xpMax"); + int curLvl = RPGElements.getLevel(player, this); + + if (max <= 0 || curLvl >= getMaxLevel()) { + return; + } + value += xp; + skill.setInteger("xp", value); + + if (value >= max) { + value -= max; + int level = skill.getInteger("level") + 1; + skill.setInteger("level", level); + skill.setInteger("xp", value); + skill.setInteger("xpMax", getLvlXP(level, player)); + levelUp(player, level); + } else { + if (value < 0) { + int level = skill.getInteger("level") - 1; + if (level < 1) + return; + + skill.setInteger("level", level); + + int newMax = getLvlXP(level, player); + skill.setInteger("xp", value + newMax); + skill.setInteger("xpMax", newMax); + } + } + } + + private void levelUp(EntityPlayer player, int newlvl) { + if (!player.worldObj.isRemote) { + MineFantasyAPI.debugMsg("Level up detected for " + skillName); + MinecraftForge.EVENT_BUS.post(new LevelupEvent(player, this, newlvl)); + } + } + + /** + * This is a universal way to tell a skill to do something + * + * @param functionID a string representing what to do, depends on the skill + */ + public void callFunction(EntityPlayer user, String functionID) { + } + + public void init(NBTTagCompound tag, EntityPlayer player) { + int start = getStartLevel(); + tag.setInteger("level", start); + tag.setInteger("xp", 0); + tag.setInteger("xpMax", getLvlXP(start, player)); + } + + public void sync(EntityPlayer player) { + if (!player.worldObj.isRemote) { + MineFantasyAPI.debugMsg("Sync skill: " + skillName); + MinecraftForge.EVENT_BUS.post(new SyncSkillEvent(player, this)); + } + } + + public String getDisplayName() { + return StatCollector.translateToLocal("skill." + skillName + ".name"); + } } diff --git a/src/main/java/minefantasy/mf2/api/rpg/SkillList.java b/src/main/java/minefantasy/mf2/api/rpg/SkillList.java index b48351ae..7c8bb1f1 100644 --- a/src/main/java/minefantasy/mf2/api/rpg/SkillList.java +++ b/src/main/java/minefantasy/mf2/api/rpg/SkillList.java @@ -1,35 +1,33 @@ package minefantasy.mf2.api.rpg; -public class SkillList -{ - //MOVEMENT - //public static Skill athletics = new Skill("athletics").register(); - //public static Skill acrobatics = new Skill("acrobatics").register(); - //public static Skill sneak = new Skill("sneak").register(); - - //CRAFTING - public static Skill artisanry = new Skill("artisanry").register(); - public static Skill engineering = new Skill("engineering").register(); - public static Skill construction = new Skill("construction").register(); - public static Skill provisioning = new Skill("provisioning").register(); - public static Skill combat = new Skill("combat").register(); - - //OFFENSE - //public static Skill unarmed = new Skill("unarmed").register(); - //public static Skill blade = new Skill("blade").register(); - //public static Skill blunt = new Skill("blunt").register(); - //public static Skill axe = new Skill("axe").register(); - //public static Skill polearm = new Skill("polearm").register(); - //public static Skill exotic = new Skill("exotic").register(); - //public static Skill archery = new Skill("archery").register(); - - //DEFENCE - //public static Skill lightarmour = new Skill("lightarmour").register(); - //public static Skill mediumarmour = new Skill("mediumarmour").register(); - //public static Skill heavyarmour = new Skill("heavyarmour").register(); - //public static Skill block = new Skill("block").register(); - - public static void init() - { - } +public class SkillList { + // MOVEMENT + // public static Skill athletics = new Skill("athletics").register(); + // public static Skill acrobatics = new Skill("acrobatics").register(); + // public static Skill sneak = new Skill("sneak").register(); + + // CRAFTING + public static Skill artisanry = new Skill("artisanry").register(); + public static Skill engineering = new Skill("engineering").register(); + public static Skill construction = new Skill("construction").register(); + public static Skill provisioning = new Skill("provisioning").register(); + public static Skill combat = new Skill("combat").register(); + + // OFFENSE + // public static Skill unarmed = new Skill("unarmed").register(); + // public static Skill blade = new Skill("blade").register(); + // public static Skill blunt = new Skill("blunt").register(); + // public static Skill axe = new Skill("axe").register(); + // public static Skill polearm = new Skill("polearm").register(); + // public static Skill exotic = new Skill("exotic").register(); + // public static Skill archery = new Skill("archery").register(); + + // DEFENCE + // public static Skill lightarmour = new Skill("lightarmour").register(); + // public static Skill mediumarmour = new Skill("mediumarmour").register(); + // public static Skill heavyarmour = new Skill("heavyarmour").register(); + // public static Skill block = new Skill("block").register(); + + public static void init() { + } } diff --git a/src/main/java/minefantasy/mf2/api/rpg/SyncSkillEvent.java b/src/main/java/minefantasy/mf2/api/rpg/SyncSkillEvent.java index 72d8790d..91be9e51 100644 --- a/src/main/java/minefantasy/mf2/api/rpg/SyncSkillEvent.java +++ b/src/main/java/minefantasy/mf2/api/rpg/SyncSkillEvent.java @@ -3,16 +3,14 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.event.entity.living.LivingEvent; -public class SyncSkillEvent extends LivingEvent -{ - public final EntityPlayer thePlayer; - public final Skill theSkill; - - public SyncSkillEvent(EntityPlayer player, Skill skill) - { - super(player); - this.thePlayer = player; - this.theSkill = skill; - } +public class SyncSkillEvent extends LivingEvent { + public final EntityPlayer thePlayer; + public final Skill theSkill; + + public SyncSkillEvent(EntityPlayer player, Skill skill) { + super(player); + this.thePlayer = player; + this.theSkill = skill; + } } diff --git a/src/main/java/minefantasy/mf2/api/stamina/IHeldStaminaItem.java b/src/main/java/minefantasy/mf2/api/stamina/IHeldStaminaItem.java index ed91a653..1f6af2c9 100644 --- a/src/main/java/minefantasy/mf2/api/stamina/IHeldStaminaItem.java +++ b/src/main/java/minefantasy/mf2/api/stamina/IHeldStaminaItem.java @@ -3,9 +3,10 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface IHeldStaminaItem -{ - float getDecayMod(EntityLivingBase user, ItemStack item); - float getRegenModifier(EntityLivingBase user, ItemStack item); - float getIdleModifier(EntityLivingBase user, ItemStack item); +public interface IHeldStaminaItem { + float getDecayMod(EntityLivingBase user, ItemStack item); + + float getRegenModifier(EntityLivingBase user, ItemStack item); + + float getIdleModifier(EntityLivingBase user, ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/stamina/IStaminaWeapon.java b/src/main/java/minefantasy/mf2/api/stamina/IStaminaWeapon.java index 0e6d575a..b6d5899f 100644 --- a/src/main/java/minefantasy/mf2/api/stamina/IStaminaWeapon.java +++ b/src/main/java/minefantasy/mf2/api/stamina/IStaminaWeapon.java @@ -3,7 +3,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface IStaminaWeapon -{ - public float getStaminaDrainOnHit(EntityLivingBase user, ItemStack item); +public interface IStaminaWeapon { + public float getStaminaDrainOnHit(EntityLivingBase user, ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/stamina/IWornStaminaItem.java b/src/main/java/minefantasy/mf2/api/stamina/IWornStaminaItem.java index 5193d776..5466117d 100644 --- a/src/main/java/minefantasy/mf2/api/stamina/IWornStaminaItem.java +++ b/src/main/java/minefantasy/mf2/api/stamina/IWornStaminaItem.java @@ -3,18 +3,22 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface IWornStaminaItem -{ - /** - * This adds up between armour pieces: a - value takes off points while a + adds to them - */ - float getDecayModifier(EntityLivingBase user, ItemStack item); - /** - * This adds up between armour pieces: a - value takes off points while a + adds to them - */ - float getRegenModifier(EntityLivingBase user, ItemStack item); - /** - * This adds up between armour pieces: a - value takes off points while a + adds to them - */ - float getIdleModifier(EntityLivingBase user, ItemStack item); +public interface IWornStaminaItem { + /** + * This adds up between armour pieces: a - value takes off points while a + adds + * to them + */ + float getDecayModifier(EntityLivingBase user, ItemStack item); + + /** + * This adds up between armour pieces: a - value takes off points while a + adds + * to them + */ + float getRegenModifier(EntityLivingBase user, ItemStack item); + + /** + * This adds up between armour pieces: a - value takes off points while a + adds + * to them + */ + float getIdleModifier(EntityLivingBase user, ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/stamina/StaminaBar.java b/src/main/java/minefantasy/mf2/api/stamina/StaminaBar.java index b840fc15..f021ee89 100644 --- a/src/main/java/minefantasy/mf2/api/stamina/StaminaBar.java +++ b/src/main/java/minefantasy/mf2/api/stamina/StaminaBar.java @@ -12,658 +12,565 @@ import net.minecraft.potion.Potion; import net.minecraft.world.World; -public class StaminaBar -{ - /** - * This is the main variable for the entire stamina feature - */ - public static boolean isSystemActive = true; - - public static float defaultMax = 100F; - - public static final String staminaRegenName = "MineFantasy_staminaRegen"; - public static final String staminaRegenTicksName = "MineFantasy_staminaRegenTicks"; - - public static final String staminaBonusName = "MineFantasy_staminaMaxAddon"; - public static final String staminaBonusTicksName = "MineFantasy_staminaMaxAddonTicks"; - public static final String staminaMaxName = "MineFantasy_staminaMax"; - public static final String staminaValueName = "MineFantasy_staminaValue"; - public static final String staminaIdleName = "MineFantasy_staminaIdle"; - public static final String staminaFlashName = "MineFantasy_staminaFlashing"; - - /** - * Modifies the decay speed for armour, this scales to what a full suit of plate does - */ - private static final float armourWeightModifier = 1.0F; - private static final float armourWeightModifierClimbing = 5.0F; - /** - * Modifies the regen rate slowdown for armour - */ - private static float bulkModifier = 1.0F; - public static float regenModifier = 1.5F; - - //CONFIG VARS - /** - * The decay modifier before being scaled by difficulty - */ - public static float decayModifierCfg = 1.0F; - public static float decayModifierBase = 0.5F; - public static float configRegenModifier = 1.0F; - public static float pauseModifier = 1.0F; - public static float configArmourWeightModifier = 1.0F; - public static float configBulk = 1.0F; - public static boolean scaleDifficulty = true; - - public static boolean levelUp = false; - - public static float levelAmount = 5F; - - //MAX STAMINA// - public static float getTotalMaxStamina(EntityLivingBase user) - { - return getBaseMaxStamina(user) + getBonusStamina(user); - } - public static float getBaseMaxStamina(EntityLivingBase user) - { - float bonus = getStaminaLevelBoost(user); - if(user.getEntityData() != null) - { - if(!user.getEntityData().hasKey(staminaMaxName)) - { - setMaxStamina(user, getDefaultMax(user) + bonus); - } - return user.getEntityData().getFloat(staminaMaxName) +bonus; - } - return getDefaultMax(user) + bonus; - } - public static float getDefaultMax(EntityLivingBase user) - { - return defaultMax; - } - public static void setMaxStamina(EntityLivingBase user, float value) - { - if(user.getEntityData() != null) - { - user.getEntityData().setFloat(staminaMaxName, value); - } - } - public static void modifyMaxStamina(EntityLivingBase user, float mod) - { - setMaxStamina(user, getBaseMaxStamina(user)+mod); - - if(getStaminaValue(user) < 0) - { - setStaminaValue(user, 0); - } - } - //REGEN BUFF STAMINA// - public static float getBonusStaminaRegen(EntityLivingBase user) - { - float level = 0F; - if(user.getEntityData() != null) - { - if(!user.getEntityData().hasKey(staminaRegenName)) - { - setBonusStaminaRegen(user, 0F); - } - level += user.getEntityData().getFloat(staminaRegenName); - } - if(user.getActivePotionEffect(Potion.regeneration) != null) - { - level += (user.getActivePotionEffect(Potion.regeneration).getAmplifier()+1)*2.5F; - } - return level; - } - public static void setBonusStaminaRegen(EntityLivingBase user, float value) - { - if(user.getEntityData() != null) - { - user.getEntityData().setFloat(staminaRegenName, value); - } - } - - public static int getBonusStaminaRegenTicks(EntityLivingBase user) - { - if(user.getEntityData() != null) - { - if(!user.getEntityData().hasKey(staminaRegenTicksName)) - { - setBonusStaminaRegenTicks(user, 0); - } - return user.getEntityData().getInteger(staminaRegenTicksName); - } - return 0; - } - public static void setBonusStaminaRegenTicks(EntityLivingBase user, int value) - { - if(user.getEntityData() != null) - { - user.getEntityData().setInteger(staminaRegenTicksName, value); - } - } - public static float getRegenBonus(EntityLivingBase user) - { - return getBonusStaminaRegen(user)/20F; - } - - //TEMP STAMINA// - public static float getBonusStamina(EntityLivingBase user) - { - if(user.getEntityData() != null) - { - if(!user.getEntityData().hasKey(staminaBonusName)) - { - setBonusStamina(user, 0F); - } - return user.getEntityData().getFloat(staminaBonusName); - } - return 0F; - } - private static float getStaminaLevelBoost(EntityLivingBase user) - { - if(user.worldObj.isRemote)return 0; - - float amount = 0F; - if(user instanceof EntityPlayer && levelUp && levelAmount > 0) - { - EntityPlayer player = (EntityPlayer)user; - if(player.experienceLevel > 0) - { - amount += (player.experienceLevel*levelAmount); - } - } - return amount; - } - public static void setBonusStamina(EntityLivingBase user, float value) - { - if(user.getEntityData() != null) - { - user.getEntityData().setFloat(staminaBonusName, value); - } - } - - public static int getBonusStaminaTicks(EntityLivingBase user) - { - if(user.getEntityData() != null) - { - if(!user.getEntityData().hasKey(staminaBonusTicksName)) - { - setBonusStaminaTicks(user, 0); - } - return user.getEntityData().getInteger(staminaBonusTicksName); - } - return 0; - } - public static void setBonusStaminaTicks(EntityLivingBase user, int value) - { - if(user.getEntityData() != null) - { - user.getEntityData().setInteger(staminaBonusTicksName, value); - } - } - - public static void tickBonus(EntityLivingBase user) - { - if(user.worldObj.isRemote)return; - - int currentTicks = getBonusStaminaTicks(user); - currentTicks --; - if(currentTicks <= 0) - { - setBonusStaminaTicks(user, 0); - setBonusStamina(user, 0); - - if(getStaminaValue(user) > getTotalMaxStamina(user)) - { - setStaminaValue(user, getTotalMaxStamina(user)); - } - return; - } - setBonusStaminaTicks(user, currentTicks); - } - public static void tickBonusRegen(EntityLivingBase user) - { - if(user.worldObj.isRemote)return; - - int currentTicks = getBonusStaminaRegenTicks(user); - currentTicks --; - if(currentTicks <= 0) - { - setBonusStaminaRegenTicks(user, 0); - setBonusStaminaRegen(user, 0); - return; - } - setBonusStaminaRegenTicks(user, currentTicks); - } - - /** - * Call this to buff stamina temporarily, it will not override more potent effects - * @param user the entity to buff - * @param mod the amount of stamina added - * @param seconds the time it takes to wear off - * @return true if either time or modification is applied. - */ - public static boolean buffStamina(EntityLivingBase user, float mod, int seconds) - { - if(!isSystemActive) - { - return false; - } - boolean success = false; - int ticks = seconds * 20; - - float current = getBonusStamina(user); - int currentTicks = getBonusStaminaTicks(user); - if(mod >= current) - { - success = true; - setBonusStaminaTicks(user, ticks); - setBonusStamina(user, mod); - } - return false; - } - public static boolean buffStaminaRegen(EntityLivingBase user, float mod, int seconds) - { - if(!isSystemActive) - { - return false; - } - boolean success = false; - int ticks = seconds * 20; - - float current = getBonusStaminaRegen(user); - int currentTicks = getBonusStaminaRegenTicks(user); - if(mod >= current && ticks >= currentTicks) - { - success = true; - setBonusStaminaRegenTicks(user, ticks); - setBonusStaminaRegen(user, mod); - } - return false; - } - /** - * This increases the users max stamina - * @param user the user - * @param value the amount to add to max stamina - * @param maxBonus the maximum this can achieve (not counting base stamina), <0 means no limit - */ - public static boolean incrStaminaMax(EntityLivingBase user, float value, float maxBonus) - { - float current = getBaseMaxStamina(user); - if(maxBonus > 0 && current >= maxBonus) - { - return false; - } - setMaxStamina(user, Math.min(maxBonus, current+value)); - MineFantasyAPI.debugMsg("Increased Max Stamina by " + value); - return true; - } - - //STAMINA VALUE// - public static float getStaminaValue(EntityLivingBase user) - { - if(user.getEntityData() != null) - { - if(!user.getEntityData().hasKey(staminaValueName)) - { - setStaminaValue(user, getDefaultMax(user)); - } - return user.getEntityData().getFloat(staminaValueName); - } - return getDefaultMax(user); - } - public static void setStaminaValue(EntityLivingBase user, float value) - { - if(user.getEntityData() != null) - { - user.getEntityData().setFloat(staminaValueName, value); - } - } - public static void modifyStaminaValue(EntityLivingBase user, float mod) - { - if(mod < 0 && PowerArmour.isPowered(user)) - { - return; - } - setStaminaValue(user, getStaminaValue(user)+mod); - - if(mod < 0 && getStaminaValue(user) < 0) - { - setStaminaValue(user, 0); - } - float max = getTotalMaxStamina(user); - if(getStaminaValue(user) > max) - { - setStaminaValue(user, max); - } - } - - //DECIMAL PERCENT VALUE// - public static float getStaminaDecimal(EntityLivingBase user) - { - return getStaminaValue(user) / getTotalMaxStamina(user); - } - //INIT// - public static void refreshSystem(EntityLivingBase user) - { - if(user.getEntityData() != null) - { - NBTTagCompound nbt = user.getEntityData(); - - if(!nbt.hasKey(staminaMaxName)) - { - nbt.setFloat(staminaMaxName, getDefaultMax(user)); - } - if(!nbt.hasKey(staminaValueName)) - { - nbt.setFloat(staminaValueName, getDefaultMax(user)); - } - if(!nbt.hasKey(staminaFlashName)) - { - nbt.setFloat(staminaFlashName, 0); - } - } - } - - //STAMINA IDLE// - public static float getIdleTime(EntityLivingBase user) - { - if(user.getEntityData() != null) - { - if(!user.getEntityData().hasKey(staminaIdleName)) - { - setIdleTime(user, 0); - } - return user.getEntityData().getFloat(staminaIdleName); - } - return 0; - } - public static void setIdleTime(EntityLivingBase user, float value) - { - if(user.getEntityData() != null) - { - user.getEntityData().setFloat(staminaIdleName, value); - } - } - public static void ModifyIdleTime(EntityLivingBase user, float mod) - { - setIdleTime(user, getIdleTime(user)+mod); - } - - - //STAMINA FLASH// - public static float getFlashTime(EntityLivingBase user) - { - if(user.getEntityData() != null) - { - if(!user.getEntityData().hasKey(staminaFlashName)) - { - setFlashTime(user, 0); - } - return user.getEntityData().getFloat(staminaFlashName); - } - return 0; - } - public static void setFlashTime(EntityLivingBase user, float value) - { - if(!(user instanceof EntityPlayer)) - { - return; - } - if(user.getEntityData() != null) - { - user.getEntityData().setFloat(staminaFlashName, value); - } - } - public static void ModifyFlashTime(EntityLivingBase user, float mod) - { - setFlashTime(user, getFlashTime(user)+mod); - } - - /** - * determines if the stamina can take a specific value - */ - /** - * Checks if stamina is available - * @param onUse whether or not stamina is trying to be used - * @return - */ - public static boolean isStaminaAvailable(EntityLivingBase user, float level, boolean onUse) - { - if(getStaminaValue(user) >= level) - { - return true; - } - if(onUse) - { - setFlashTime(user, 40); - } - return false; - } - public static boolean isAnyStamina(EntityLivingBase user, boolean flash) - { - return isStaminaAvailable(user, 1, flash); - } - public static boolean isPercentStamAvailable(EntityLivingBase user, float decimal, boolean flash) - { - if(PowerArmour.isPowered(user)) - { - return true;//Cogwork infinite power - } - - return isStaminaAvailable(user, getTotalMaxStamina(user)*decimal, flash); - } - - public static float getBaseDecayModifier(EntityLivingBase user, boolean countArmour, boolean countHeld) - { - if(PowerArmour.isPowered(user)) - { - return 0F; - } - float value = getDecayModifier(user.worldObj); - float AM = 1.0F; - if(user instanceof EntityPlayer) - { - value *= getBasePerkStaminaModifier(value, (EntityPlayer)user); - AM = getPerkArmModifier(value, (EntityPlayer)user); - } - if(TacticalManager.isImmuneToWeight(user)) - { - return value * 0.5F; - } - - if(countHeld) - { - if(user.getHeldItem() != null && user.getHeldItem().getItem() instanceof IHeldStaminaItem) - { - value *= (((IHeldStaminaItem)user.getHeldItem().getItem()).getDecayMod(user, user.getHeldItem())); - } - } - if(countArmour) - { - float armourMod = 1.0F; - for(int slot = 1; slot <= 4; slot ++) - { - ItemStack armour = user.getEquipmentInSlot(slot); - if(armour != null && armour.getItem() instanceof IWornStaminaItem) - { - armourMod += (((IWornStaminaItem)armour.getItem()).getDecayModifier(user, armour)); - } - } - float min = ArmourCalculator.encumberanceArray[0]; - float max = ArmourCalculator.encumberanceArray[1]; - float mass = ArmourCalculator.getTotalWeightOfWorn(user, false) - min; - - if(mass > 0F) - { - float modifiers = AM * configArmourWeightModifier* armourWeightModifier; - armourMod += ( (mass+min) / max); - } - value *= armourMod; - } - return value; - } - public static float getClimbinbDecayModifier(EntityLivingBase user, boolean countArmour) - { - float value = getDecayModifier(user.worldObj); - - if(!TacticalManager.isImmuneToWeight(user) && countArmour) - { - float armourMod = 1.0F; - for(int slot = 1; slot <= 4; slot ++) - { - ItemStack armour = user.getEquipmentInSlot(slot); - if(armour != null && armour.getItem() instanceof IWornStaminaItem) - { - armourMod += ((IWornStaminaItem)armour.getItem()).getDecayModifier(user, armour); - } - } - float min = ArmourCalculator.encumberanceArray[0]; - float max = ArmourCalculator.encumberanceArray[1]; - float mass = ArmourCalculator.getTotalWeightOfWorn(user, false)-min; - if(mass > 0) - { - value *= (1+( (min+mass) / max * configArmourWeightModifier*(armourWeightModifierClimbing-1))); - } - value *= armourMod; - } - return value; - } - - public static float getBaseRegenModifier(EntityLivingBase user, boolean countArmour, boolean countHeld) - { - float value = configRegenModifier * regenModifier * (5F/3F); - - if(!TacticalManager.isImmuneToWeight(user)) - { - if(countHeld) - { - if(user.getHeldItem() != null && user.getHeldItem().getItem() instanceof IHeldStaminaItem) - { - value *= ((IHeldStaminaItem)user.getHeldItem().getItem()).getRegenModifier(user, user.getHeldItem()); - } - } - if(countArmour) - { - float AM = 1.0F; - if(user instanceof EntityPlayer) - { - AM = getPerkArmModifier(value, (EntityPlayer)user); - } - - float armourMod = 1.0F; - for(int slot = 1; slot <= 4; slot ++) - { - ItemStack armour = user.getEquipmentInSlot(slot); - if(armour != null && armour.getItem() instanceof IWornStaminaItem) - { - armourMod += ((IWornStaminaItem)armour.getItem()).getRegenModifier(user, armour); - } - } - float weightMod = ArmourCalculator.getTotalWeightOfWorn(user, false)*bulkModifier*configBulk; - if(weightMod > 0) - { - float min = ArmourCalculator.encumberanceArray[0]; - float max = ArmourCalculator.encumberanceArray[1]; - value /= (1.0F+( (min+weightMod) / (max/2) * AM * 0.5F)); - } - value *= armourMod; - } - } - if(user.isSneaking()) - { - value *= 1.5F; - } - - return value; - } - - public static float getBaseIdleModifier(EntityLivingBase user, boolean countArmour, boolean countHeld) - { - float value = pauseModifier; - - if(!TacticalManager.isImmuneToWeight(user)) - { - if(countHeld) - { - if(user.getHeldItem() != null && user.getHeldItem().getItem() instanceof IHeldStaminaItem) - { - value *= ((IHeldStaminaItem)user.getHeldItem().getItem()).getIdleModifier(user, user.getHeldItem()); - } - } - if(countArmour) - { - float armourMod = 1.0F; - for(int slot = 1; slot <= 4; slot ++) - { - ItemStack armour = user.getEquipmentInSlot(slot); - if(armour != null && armour.getItem() instanceof IWornStaminaItem) - { - armourMod += ((IWornStaminaItem)armour.getItem()).getIdleModifier(user, armour); - } - } - } - } - - return value; - } - /** - * This scales the decay modifier across all fields on difficulty - * It's base level is on normal with easy,peaceful being 25% - 50% slower. - * Hard is 25% faster - */ - public static float getDecayModifier(World world) - { - if(!scaleDifficulty) - { - return decayModifierCfg * decayModifierBase; - } - int difficultyMod = world.difficultySetting.getDifficultyId()-2; - return (decayModifierCfg * decayModifierBase) + (0.25F*difficultyMod); - } - private static final String noStaminaNBT = "MF_NoStamina"; - - public static boolean restrictSystem = true; - - /** - * This toggles the stamina use for entities - */ - public static void setStaminaFlag(EntityLivingBase entity, boolean flag) - { - entity.getEntityData().setBoolean(noStaminaNBT, flag); - } - public static boolean doesAffectEntity(EntityLivingBase entity) - { - if(entity.getEntityData().hasKey(noStaminaNBT)) - { - return entity.getEntityData().getBoolean(noStaminaNBT); - } - if(entity instanceof EntityPlayer) - { - EntityPlayer p = (EntityPlayer)entity; - return !p.capabilities.isCreativeMode; - } - else if(restrictSystem) - { - return false; - } - return MineFantasyAPI.isInDebugMode || !entity.isEntityUndead(); - } - - private static float getPerkArmModifier(float value, EntityPlayer user) - { - if(ResearchLogic.hasInfoUnlocked(user, "armourpro")) - { - value *= 0.5F; - } - return value; - } - private static float getBasePerkStaminaModifier(float value, EntityPlayer user) - { - if(ResearchLogic.hasInfoUnlocked(user, "fitness")) - { - value *= 0.75F; - } - return value; - } +public class StaminaBar { + public static final String staminaRegenName = "MineFantasy_staminaRegen"; + public static final String staminaRegenTicksName = "MineFantasy_staminaRegenTicks"; + public static final String staminaBonusName = "MineFantasy_staminaMaxAddon"; + public static final String staminaBonusTicksName = "MineFantasy_staminaMaxAddonTicks"; + public static final String staminaMaxName = "MineFantasy_staminaMax"; + public static final String staminaValueName = "MineFantasy_staminaValue"; + public static final String staminaIdleName = "MineFantasy_staminaIdle"; + public static final String staminaFlashName = "MineFantasy_staminaFlashing"; + /** + * Modifies the decay speed for armour, this scales to what a full suit of plate + * does + */ + private static final float armourWeightModifier = 1.0F; + private static final float armourWeightModifierClimbing = 5.0F; + private static final String noStaminaNBT = "MF_NoStamina"; + /** + * This is the main variable for the entire stamina feature + */ + public static boolean isSystemActive = true; + public static float defaultMax = 100F; + public static float regenModifier = 1.5F; + + // CONFIG VARS + /** + * The decay modifier before being scaled by difficulty + */ + public static float decayModifierCfg = 1.0F; + public static float decayModifierBase = 0.5F; + public static float configRegenModifier = 1.0F; + public static float pauseModifier = 1.0F; + public static float configArmourWeightModifier = 1.0F; + public static float configBulk = 1.0F; + public static boolean scaleDifficulty = true; + + public static boolean levelUp = false; + + public static float levelAmount = 5F; + public static boolean restrictSystem = true; + /** + * Modifies the regen rate slowdown for armour + */ + private static float bulkModifier = 1.0F; + + // MAX STAMINA// + public static float getTotalMaxStamina(EntityLivingBase user) { + return getBaseMaxStamina(user) + getBonusStamina(user); + } + + public static float getBaseMaxStamina(EntityLivingBase user) { + float bonus = getStaminaLevelBoost(user); + if (user.getEntityData() != null) { + if (!user.getEntityData().hasKey(staminaMaxName)) { + setMaxStamina(user, getDefaultMax(user) + bonus); + } + return user.getEntityData().getFloat(staminaMaxName) + bonus; + } + return getDefaultMax(user) + bonus; + } + + public static float getDefaultMax(EntityLivingBase user) { + return defaultMax; + } + + public static void setMaxStamina(EntityLivingBase user, float value) { + if (user.getEntityData() != null) { + user.getEntityData().setFloat(staminaMaxName, value); + } + } + + public static void modifyMaxStamina(EntityLivingBase user, float mod) { + setMaxStamina(user, getBaseMaxStamina(user) + mod); + + if (getStaminaValue(user) < 0) { + setStaminaValue(user, 0); + } + } + + // REGEN BUFF STAMINA// + public static float getBonusStaminaRegen(EntityLivingBase user) { + float level = 0F; + if (user.getEntityData() != null) { + if (!user.getEntityData().hasKey(staminaRegenName)) { + setBonusStaminaRegen(user, 0F); + } + level += user.getEntityData().getFloat(staminaRegenName); + } + if (user.getActivePotionEffect(Potion.regeneration) != null) { + level += (user.getActivePotionEffect(Potion.regeneration).getAmplifier() + 1) * 2.5F; + } + return level; + } + + public static void setBonusStaminaRegen(EntityLivingBase user, float value) { + if (user.getEntityData() != null) { + user.getEntityData().setFloat(staminaRegenName, value); + } + } + + public static int getBonusStaminaRegenTicks(EntityLivingBase user) { + if (user.getEntityData() != null) { + if (!user.getEntityData().hasKey(staminaRegenTicksName)) { + setBonusStaminaRegenTicks(user, 0); + } + return user.getEntityData().getInteger(staminaRegenTicksName); + } + return 0; + } + + public static void setBonusStaminaRegenTicks(EntityLivingBase user, int value) { + if (user.getEntityData() != null) { + user.getEntityData().setInteger(staminaRegenTicksName, value); + } + } + + public static float getRegenBonus(EntityLivingBase user) { + return getBonusStaminaRegen(user) / 20F; + } + + // TEMP STAMINA// + public static float getBonusStamina(EntityLivingBase user) { + if (user.getEntityData() != null) { + if (!user.getEntityData().hasKey(staminaBonusName)) { + setBonusStamina(user, 0F); + } + return user.getEntityData().getFloat(staminaBonusName); + } + return 0F; + } + + private static float getStaminaLevelBoost(EntityLivingBase user) { + if (user.worldObj.isRemote) + return 0; + + float amount = 0F; + if (user instanceof EntityPlayer && levelUp && levelAmount > 0) { + EntityPlayer player = (EntityPlayer) user; + if (player.experienceLevel > 0) { + amount += (player.experienceLevel * levelAmount); + } + } + return amount; + } + + public static void setBonusStamina(EntityLivingBase user, float value) { + if (user.getEntityData() != null) { + user.getEntityData().setFloat(staminaBonusName, value); + } + } + + public static int getBonusStaminaTicks(EntityLivingBase user) { + if (user.getEntityData() != null) { + if (!user.getEntityData().hasKey(staminaBonusTicksName)) { + setBonusStaminaTicks(user, 0); + } + return user.getEntityData().getInteger(staminaBonusTicksName); + } + return 0; + } + + public static void setBonusStaminaTicks(EntityLivingBase user, int value) { + if (user.getEntityData() != null) { + user.getEntityData().setInteger(staminaBonusTicksName, value); + } + } + + public static void tickBonus(EntityLivingBase user) { + if (user.worldObj.isRemote) + return; + + int currentTicks = getBonusStaminaTicks(user); + currentTicks--; + if (currentTicks <= 0) { + setBonusStaminaTicks(user, 0); + setBonusStamina(user, 0); + + if (getStaminaValue(user) > getTotalMaxStamina(user)) { + setStaminaValue(user, getTotalMaxStamina(user)); + } + return; + } + setBonusStaminaTicks(user, currentTicks); + } + + public static void tickBonusRegen(EntityLivingBase user) { + if (user.worldObj.isRemote) + return; + + int currentTicks = getBonusStaminaRegenTicks(user); + currentTicks--; + if (currentTicks <= 0) { + setBonusStaminaRegenTicks(user, 0); + setBonusStaminaRegen(user, 0); + return; + } + setBonusStaminaRegenTicks(user, currentTicks); + } + + /** + * Call this to buff stamina temporarily, it will not override more potent + * effects + * + * @param user the entity to buff + * @param mod the amount of stamina added + * @param seconds the time it takes to wear off + * @return true if either time or modification is applied. + */ + public static boolean buffStamina(EntityLivingBase user, float mod, int seconds) { + if (!isSystemActive) { + return false; + } + boolean success = false; + int ticks = seconds * 20; + + float current = getBonusStamina(user); + int currentTicks = getBonusStaminaTicks(user); + if (mod >= current) { + success = true; + setBonusStaminaTicks(user, ticks); + setBonusStamina(user, mod); + } + return false; + } + + public static boolean buffStaminaRegen(EntityLivingBase user, float mod, int seconds) { + if (!isSystemActive) { + return false; + } + boolean success = false; + int ticks = seconds * 20; + + float current = getBonusStaminaRegen(user); + int currentTicks = getBonusStaminaRegenTicks(user); + if (mod >= current && ticks >= currentTicks) { + success = true; + setBonusStaminaRegenTicks(user, ticks); + setBonusStaminaRegen(user, mod); + } + return false; + } + + /** + * This increases the users max stamina + * + * @param user the user + * @param value the amount to add to max stamina + * @param maxBonus the maximum this can achieve (not counting base stamina), <0 means + * no limit + */ + public static boolean incrStaminaMax(EntityLivingBase user, float value, float maxBonus) { + float current = getBaseMaxStamina(user); + if (maxBonus > 0 && current >= maxBonus) { + return false; + } + setMaxStamina(user, Math.min(maxBonus, current + value)); + MineFantasyAPI.debugMsg("Increased Max Stamina by " + value); + return true; + } + + // STAMINA VALUE// + public static float getStaminaValue(EntityLivingBase user) { + if (user.getEntityData() != null) { + if (!user.getEntityData().hasKey(staminaValueName)) { + setStaminaValue(user, getDefaultMax(user)); + } + return user.getEntityData().getFloat(staminaValueName); + } + return getDefaultMax(user); + } + + public static void setStaminaValue(EntityLivingBase user, float value) { + if (user.getEntityData() != null) { + user.getEntityData().setFloat(staminaValueName, value); + } + } + + public static void modifyStaminaValue(EntityLivingBase user, float mod) { + if (mod < 0 && PowerArmour.isPowered(user)) { + return; + } + setStaminaValue(user, getStaminaValue(user) + mod); + + if (mod < 0 && getStaminaValue(user) < 0) { + setStaminaValue(user, 0); + } + float max = getTotalMaxStamina(user); + if (getStaminaValue(user) > max) { + setStaminaValue(user, max); + } + } + + // DECIMAL PERCENT VALUE// + public static float getStaminaDecimal(EntityLivingBase user) { + return getStaminaValue(user) / getTotalMaxStamina(user); + } + + // INIT// + public static void refreshSystem(EntityLivingBase user) { + if (user.getEntityData() != null) { + NBTTagCompound nbt = user.getEntityData(); + + if (!nbt.hasKey(staminaMaxName)) { + nbt.setFloat(staminaMaxName, getDefaultMax(user)); + } + if (!nbt.hasKey(staminaValueName)) { + nbt.setFloat(staminaValueName, getDefaultMax(user)); + } + if (!nbt.hasKey(staminaFlashName)) { + nbt.setFloat(staminaFlashName, 0); + } + } + } + + // STAMINA IDLE// + public static float getIdleTime(EntityLivingBase user) { + if (user.getEntityData() != null) { + if (!user.getEntityData().hasKey(staminaIdleName)) { + setIdleTime(user, 0); + } + return user.getEntityData().getFloat(staminaIdleName); + } + return 0; + } + + public static void setIdleTime(EntityLivingBase user, float value) { + if (user.getEntityData() != null) { + user.getEntityData().setFloat(staminaIdleName, value); + } + } + + public static void ModifyIdleTime(EntityLivingBase user, float mod) { + setIdleTime(user, getIdleTime(user) + mod); + } + + // STAMINA FLASH// + public static float getFlashTime(EntityLivingBase user) { + if (user.getEntityData() != null) { + if (!user.getEntityData().hasKey(staminaFlashName)) { + setFlashTime(user, 0); + } + return user.getEntityData().getFloat(staminaFlashName); + } + return 0; + } + + /** + * determines if the stamina can take a specific value + */ + + public static void setFlashTime(EntityLivingBase user, float value) { + if (!(user instanceof EntityPlayer)) { + return; + } + if (user.getEntityData() != null) { + user.getEntityData().setFloat(staminaFlashName, value); + } + } + + public static void ModifyFlashTime(EntityLivingBase user, float mod) { + setFlashTime(user, getFlashTime(user) + mod); + } + + /** + * Checks if stamina is available + * + * @param onUse whether or not stamina is trying to be used + * @return + */ + public static boolean isStaminaAvailable(EntityLivingBase user, float level, boolean onUse) { + if (getStaminaValue(user) >= level) { + return true; + } + if (onUse) { + setFlashTime(user, 40); + } + return false; + } + + public static boolean isAnyStamina(EntityLivingBase user, boolean flash) { + return isStaminaAvailable(user, 1, flash); + } + + public static boolean isPercentStamAvailable(EntityLivingBase user, float decimal, boolean flash) { + if (PowerArmour.isPowered(user)) { + return true;// Cogwork infinite power + } + + return isStaminaAvailable(user, getTotalMaxStamina(user) * decimal, flash); + } + + public static float getBaseDecayModifier(EntityLivingBase user, boolean countArmour, boolean countHeld) { + if (PowerArmour.isPowered(user)) { + return 0F; + } + float value = getDecayModifier(user.worldObj); + float AM = 1.0F; + if (user instanceof EntityPlayer) { + value *= getBasePerkStaminaModifier(value, (EntityPlayer) user); + AM = getPerkArmModifier(value, (EntityPlayer) user); + } + if (TacticalManager.isImmuneToWeight(user)) { + return value * 0.5F; + } + + if (countHeld) { + if (user.getHeldItem() != null && user.getHeldItem().getItem() instanceof IHeldStaminaItem) { + value *= (((IHeldStaminaItem) user.getHeldItem().getItem()).getDecayMod(user, user.getHeldItem())); + } + } + if (countArmour) { + float armourMod = 1.0F; + for (int slot = 1; slot <= 4; slot++) { + ItemStack armour = user.getEquipmentInSlot(slot); + if (armour != null && armour.getItem() instanceof IWornStaminaItem) { + armourMod += (((IWornStaminaItem) armour.getItem()).getDecayModifier(user, armour)); + } + } + float min = ArmourCalculator.encumberanceArray[0]; + float max = ArmourCalculator.encumberanceArray[1]; + float mass = ArmourCalculator.getTotalWeightOfWorn(user, false) - min; + + if (mass > 0F) { + float modifiers = AM * configArmourWeightModifier * armourWeightModifier; + armourMod += ((mass + min) / max); + } + value *= armourMod; + } + return value; + } + + public static float getClimbinbDecayModifier(EntityLivingBase user, boolean countArmour) { + float value = getDecayModifier(user.worldObj); + + if (!TacticalManager.isImmuneToWeight(user) && countArmour) { + float armourMod = 1.0F; + for (int slot = 1; slot <= 4; slot++) { + ItemStack armour = user.getEquipmentInSlot(slot); + if (armour != null && armour.getItem() instanceof IWornStaminaItem) { + armourMod += ((IWornStaminaItem) armour.getItem()).getDecayModifier(user, armour); + } + } + float min = ArmourCalculator.encumberanceArray[0]; + float max = ArmourCalculator.encumberanceArray[1]; + float mass = ArmourCalculator.getTotalWeightOfWorn(user, false) - min; + if (mass > 0) { + value *= (1 + ((min + mass) / max * configArmourWeightModifier * (armourWeightModifierClimbing - 1))); + } + value *= armourMod; + } + return value; + } + + public static float getBaseRegenModifier(EntityLivingBase user, boolean countArmour, boolean countHeld) { + float value = configRegenModifier * regenModifier * (5F / 3F); + + if (!TacticalManager.isImmuneToWeight(user)) { + if (countHeld) { + if (user.getHeldItem() != null && user.getHeldItem().getItem() instanceof IHeldStaminaItem) { + value *= ((IHeldStaminaItem) user.getHeldItem().getItem()).getRegenModifier(user, + user.getHeldItem()); + } + } + if (countArmour) { + float AM = 1.0F; + if (user instanceof EntityPlayer) { + AM = getPerkArmModifier(value, (EntityPlayer) user); + } + + float armourMod = 1.0F; + for (int slot = 1; slot <= 4; slot++) { + ItemStack armour = user.getEquipmentInSlot(slot); + if (armour != null && armour.getItem() instanceof IWornStaminaItem) { + armourMod += ((IWornStaminaItem) armour.getItem()).getRegenModifier(user, armour); + } + } + float weightMod = ArmourCalculator.getTotalWeightOfWorn(user, false) * bulkModifier * configBulk; + if (weightMod > 0) { + float min = ArmourCalculator.encumberanceArray[0]; + float max = ArmourCalculator.encumberanceArray[1]; + value /= (1.0F + ((min + weightMod) / (max / 2) * AM * 0.5F)); + } + value *= armourMod; + } + } + if (user.isSneaking()) { + value *= 1.5F; + } + + return value; + } + + public static float getBaseIdleModifier(EntityLivingBase user, boolean countArmour, boolean countHeld) { + float value = pauseModifier; + + if (!TacticalManager.isImmuneToWeight(user)) { + if (countHeld) { + if (user.getHeldItem() != null && user.getHeldItem().getItem() instanceof IHeldStaminaItem) { + value *= ((IHeldStaminaItem) user.getHeldItem().getItem()).getIdleModifier(user, + user.getHeldItem()); + } + } + if (countArmour) { + float armourMod = 1.0F; + for (int slot = 1; slot <= 4; slot++) { + ItemStack armour = user.getEquipmentInSlot(slot); + if (armour != null && armour.getItem() instanceof IWornStaminaItem) { + armourMod += ((IWornStaminaItem) armour.getItem()).getIdleModifier(user, armour); + } + } + } + } + + return value; + } + + /** + * This scales the decay modifier across all fields on difficulty It's base + * level is on normal with easy,peaceful being 25% - 50% slower. Hard is 25% + * faster + */ + public static float getDecayModifier(World world) { + if (!scaleDifficulty) { + return decayModifierCfg * decayModifierBase; + } + int difficultyMod = world.difficultySetting.getDifficultyId() - 2; + return (decayModifierCfg * decayModifierBase) + (0.25F * difficultyMod); + } + + /** + * This toggles the stamina use for entities + */ + public static void setStaminaFlag(EntityLivingBase entity, boolean flag) { + entity.getEntityData().setBoolean(noStaminaNBT, flag); + } + + public static boolean doesAffectEntity(EntityLivingBase entity) { + if (entity.getEntityData().hasKey(noStaminaNBT)) { + return entity.getEntityData().getBoolean(noStaminaNBT); + } + if (entity instanceof EntityPlayer) { + EntityPlayer p = (EntityPlayer) entity; + return !p.capabilities.isCreativeMode; + } else if (restrictSystem) { + return false; + } + return MineFantasyAPI.isInDebugMode || !entity.isEntityUndead(); + } + + private static float getPerkArmModifier(float value, EntityPlayer user) { + if (ResearchLogic.hasInfoUnlocked(user, "armourpro")) { + value *= 0.5F; + } + return value; + } + + private static float getBasePerkStaminaModifier(float value, EntityPlayer user) { + if (ResearchLogic.hasInfoUnlocked(user, "fitness")) { + value *= 0.75F; + } + return value; + } } diff --git a/src/main/java/minefantasy/mf2/api/tier/IToolMaterial.java b/src/main/java/minefantasy/mf2/api/tier/IToolMaterial.java index b70c1b99..38656c2f 100644 --- a/src/main/java/minefantasy/mf2/api/tier/IToolMaterial.java +++ b/src/main/java/minefantasy/mf2/api/tier/IToolMaterial.java @@ -2,10 +2,9 @@ import net.minecraft.item.Item.ToolMaterial; -public interface IToolMaterial -{ - /** - * Gets the material for outside reference - */ - public ToolMaterial getMaterial(); +public interface IToolMaterial { + /** + * Gets the material for outside reference + */ + public ToolMaterial getMaterial(); } diff --git a/src/main/java/minefantasy/mf2/api/tool/IHuntingItem.java b/src/main/java/minefantasy/mf2/api/tool/IHuntingItem.java index efedff79..9879dd7d 100644 --- a/src/main/java/minefantasy/mf2/api/tool/IHuntingItem.java +++ b/src/main/java/minefantasy/mf2/api/tool/IHuntingItem.java @@ -2,10 +2,9 @@ import net.minecraft.item.ItemStack; -public interface IHuntingItem -{ - /** - * Determines if item can retrive drops from animals - */ - boolean canRetrieveDrops(ItemStack item); +public interface IHuntingItem { + /** + * Determines if item can retrive drops from animals + */ + boolean canRetrieveDrops(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/tool/ILighter.java b/src/main/java/minefantasy/mf2/api/tool/ILighter.java index cfa75c8c..20a80bd2 100644 --- a/src/main/java/minefantasy/mf2/api/tool/ILighter.java +++ b/src/main/java/minefantasy/mf2/api/tool/ILighter.java @@ -2,7 +2,8 @@ public interface ILighter { - boolean canLight(); - double getChance(); + boolean canLight(); + + double getChance(); } diff --git a/src/main/java/minefantasy/mf2/api/tool/IToolMF.java b/src/main/java/minefantasy/mf2/api/tool/IToolMF.java index b3cd3a17..d671e6b4 100644 --- a/src/main/java/minefantasy/mf2/api/tool/IToolMF.java +++ b/src/main/java/minefantasy/mf2/api/tool/IToolMF.java @@ -2,20 +2,20 @@ import net.minecraft.item.ItemStack; -public interface IToolMF -{ - /** - * Gets the efficienty of this tool for processing (recommended to use ToolMaterial.getEfficiencyOnProperMaterial()) - */ - public float getEfficiency(ItemStack item); - - /** - * Gets the tier of the material, some recipes may need certain tiers - */ - public int getTier(ItemStack item); - - /** - * Gets the type of tool for crafting (eg, hammer, knife, needle) - */ - public String getToolType(ItemStack item); +public interface IToolMF { + /** + * Gets the efficienty of this tool for processing (recommended to use + * ToolMaterial.getEfficiencyOnProperMaterial()) + */ + public float getEfficiency(ItemStack item); + + /** + * Gets the tier of the material, some recipes may need certain tiers + */ + public int getTier(ItemStack item); + + /** + * Gets the type of tool for crafting (eg, hammer, knife, needle) + */ + public String getToolType(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/DamageSourceAP.java b/src/main/java/minefantasy/mf2/api/weapon/DamageSourceAP.java index 711acdef..39a3902b 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/DamageSourceAP.java +++ b/src/main/java/minefantasy/mf2/api/weapon/DamageSourceAP.java @@ -2,14 +2,13 @@ import net.minecraft.util.DamageSource; -public class DamageSourceAP extends DamageSource -{ - public static DamageSource blunt = new DamageSourceAP(); - public DamageSourceAP() - { - super("battlegearExtra"); - this.setDamageBypassesArmor(); - this.setDamageIsAbsolute(); - } - +public class DamageSourceAP extends DamageSource { + public static DamageSource blunt = new DamageSourceAP(); + + public DamageSourceAP() { + super("battlegearExtra"); + this.setDamageBypassesArmor(); + this.setDamageIsAbsolute(); + } + } diff --git a/src/main/java/minefantasy/mf2/api/weapon/ICustomHitSound.java b/src/main/java/minefantasy/mf2/api/weapon/ICustomHitSound.java index 88ba32e2..4cad3e9d 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/ICustomHitSound.java +++ b/src/main/java/minefantasy/mf2/api/weapon/ICustomHitSound.java @@ -4,11 +4,11 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface ICustomHitSound -{ - /** - * Plays the hit sound - * @return true if it makes it's own sound - */ - public boolean playHitSound(ItemStack item, EntityLivingBase attacker, Entity target); +public interface ICustomHitSound { + /** + * Plays the hit sound + * + * @return true if it makes it's own sound + */ + public boolean playHitSound(ItemStack item, EntityLivingBase attacker, Entity target); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/IDamageModifier.java b/src/main/java/minefantasy/mf2/api/weapon/IDamageModifier.java index 7b35b5d7..b3e74297 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/IDamageModifier.java +++ b/src/main/java/minefantasy/mf2/api/weapon/IDamageModifier.java @@ -4,7 +4,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface IDamageModifier -{ - public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, boolean properHit); +public interface IDamageModifier { + public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, + boolean properHit); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/IDamageType.java b/src/main/java/minefantasy/mf2/api/weapon/IDamageType.java index 7ce761e1..e17e29d0 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/IDamageType.java +++ b/src/main/java/minefantasy/mf2/api/weapon/IDamageType.java @@ -1,17 +1,23 @@ package minefantasy.mf2.api.weapon; -public interface IDamageType -{ - /** - * Gets the cutting:blunt ratio. use any 3 numbers, the relevant values is what matters - * @param implement the object causing the damage, this is "ItemStack" for items and "Entity" for projectiles - * This can therefore be implemented by projectile entities and items - */ - public float[] getDamageRatio(Object... implement); - /** - * Gets the "Penetration" level: this modifies the armour rating of supported armours, 0 means no effect - * @param implement the object causing the damage, this is "ItemStack" for items and "Entity" for projectiles - * This can therefore be implemented by projectile entities and items - */ - public float getPenetrationLevel(Object implement); +public interface IDamageType { + /** + * Gets the cutting:blunt ratio. use any 3 numbers, the relevant values is what + * matters + * + * @param implement the object causing the damage, this is "ItemStack" for items and + * "Entity" for projectiles This can therefore be implemented by + * projectile entities and items + */ + public float[] getDamageRatio(Object... implement); + + /** + * Gets the "Penetration" level: this modifies the armour rating of supported + * armours, 0 means no effect + * + * @param implement the object causing the damage, this is "ItemStack" for items and + * "Entity" for projectiles This can therefore be implemented by + * projectile entities and items + */ + public float getPenetrationLevel(Object implement); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/IKnockbackWeapon.java b/src/main/java/minefantasy/mf2/api/weapon/IKnockbackWeapon.java index 33230160..5c98514c 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/IKnockbackWeapon.java +++ b/src/main/java/minefantasy/mf2/api/weapon/IKnockbackWeapon.java @@ -3,7 +3,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface IKnockbackWeapon -{ - public float getAddedKnockback(EntityLivingBase user, ItemStack item); +public interface IKnockbackWeapon { + public float getAddedKnockback(EntityLivingBase user, ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/IParryable.java b/src/main/java/minefantasy/mf2/api/weapon/IParryable.java index 6846a468..41959e87 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/IParryable.java +++ b/src/main/java/minefantasy/mf2/api/weapon/IParryable.java @@ -5,40 +5,41 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -public interface IParryable -{ - /** - * Determines if the weapon can parry in the first place - */ - public boolean canParry(DamageSource source, EntityLivingBase blocker, ItemStack item); - /** - * This gets how accurate you need to be facing to parry - */ - public float getParryAngle(DamageSource source, EntityLivingBase blocker, ItemStack item); - - /** - * Calls a method when the defender parrys the attacker - */ - public void onParry(DamageSource source, EntityLivingBase user, Entity attacker, float dam); - - /** - * use this method to play custom sounds, return false if there is none - */ - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon); - - /** - * Gets the maximum amount of damage parry can reduce - */ - public float getMaxDamageParry(EntityLivingBase user, ItemStack weapon); - - public boolean canUserParry(EntityLivingBase user); - - /** - * Modifies the amount stamina decays when parrying, 1.0 = default - */ - public float getParryStaminaDecay(DamageSource source, ItemStack weapon); - /** - * Gets how many ticks it takes to recover from a parry - */ - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon); +public interface IParryable { + /** + * Determines if the weapon can parry in the first place + */ + public boolean canParry(DamageSource source, EntityLivingBase blocker, ItemStack item); + + /** + * This gets how accurate you need to be facing to parry + */ + public float getParryAngle(DamageSource source, EntityLivingBase blocker, ItemStack item); + + /** + * Calls a method when the defender parrys the attacker + */ + public void onParry(DamageSource source, EntityLivingBase user, Entity attacker, float dam); + + /** + * use this method to play custom sounds, return false if there is none + */ + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon); + + /** + * Gets the maximum amount of damage parry can reduce + */ + public float getMaxDamageParry(EntityLivingBase user, ItemStack weapon); + + public boolean canUserParry(EntityLivingBase user); + + /** + * Modifies the amount stamina decays when parrying, 1.0 = default + */ + public float getParryStaminaDecay(DamageSource source, ItemStack weapon); + + /** + * Gets how many ticks it takes to recover from a parry + */ + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/IPowerAttack.java b/src/main/java/minefantasy/mf2/api/weapon/IPowerAttack.java index 6945dc03..7fac75dd 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/IPowerAttack.java +++ b/src/main/java/minefantasy/mf2/api/weapon/IPowerAttack.java @@ -4,8 +4,8 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface IPowerAttack -{ - public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target); - public void onPowerAttack(float dam, EntityLivingBase user, Entity target, boolean properHit); +public interface IPowerAttack { + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target); + + public void onPowerAttack(float dam, EntityLivingBase user, Entity target, boolean properHit); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/IRackItem.java b/src/main/java/minefantasy/mf2/api/weapon/IRackItem.java index fbfbcd24..a05c9297 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/IRackItem.java +++ b/src/main/java/minefantasy/mf2/api/weapon/IRackItem.java @@ -5,18 +5,18 @@ public interface IRackItem { - float getScale(ItemStack itemstack); + float getScale(ItemStack itemstack); - float getOffsetX(ItemStack itemstack); + float getOffsetX(ItemStack itemstack); - float getOffsetY(ItemStack itemstack); - - float getOffsetZ(ItemStack itemstack); + float getOffsetY(ItemStack itemstack); - float getRotationOffset(ItemStack itemstack); + float getOffsetZ(ItemStack itemstack); - boolean canHang(TileEntityRack rack, ItemStack item, int slot); - - boolean isSpecialRender(ItemStack item); + float getRotationOffset(ItemStack itemstack); + + boolean canHang(TileEntityRack rack, ItemStack item, int slot); + + boolean isSpecialRender(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/ISharpenable.java b/src/main/java/minefantasy/mf2/api/weapon/ISharpenable.java index 70263859..842b1bdc 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/ISharpenable.java +++ b/src/main/java/minefantasy/mf2/api/weapon/ISharpenable.java @@ -2,19 +2,19 @@ import net.minecraft.item.ItemStack; -public interface ISharpenable -{ - /** - * The max amount of uses of sharpness - * -1 means can't be sharpened - */ - public float getMaxSharpness(ItemStack item); - /** - * The max percent that it can increase damage - */ - public float getDamagePercentMax(ItemStack item); - /** - * The modifier for how much percent is added each use - */ - public float getSharpUsesModifier(ItemStack item); +public interface ISharpenable { + /** + * The max amount of uses of sharpness -1 means can't be sharpened + */ + public float getMaxSharpness(ItemStack item); + + /** + * The max percent that it can increase damage + */ + public float getDamagePercentMax(ItemStack item); + + /** + * The modifier for how much percent is added each use + */ + public float getSharpUsesModifier(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/ISpecialCombatMob.java b/src/main/java/minefantasy/mf2/api/weapon/ISpecialCombatMob.java index 332f404e..31a63eff 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/ISpecialCombatMob.java +++ b/src/main/java/minefantasy/mf2/api/weapon/ISpecialCombatMob.java @@ -3,9 +3,8 @@ import net.minecraft.entity.Entity; import net.minecraft.util.DamageSource; -public interface ISpecialCombatMob -{ - boolean canParry(DamageSource source); +public interface ISpecialCombatMob { + boolean canParry(DamageSource source); - void onParry(DamageSource source, Entity attacker, float dam); + void onParry(DamageSource source, Entity attacker, float dam); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/ISpecialEffect.java b/src/main/java/minefantasy/mf2/api/weapon/ISpecialEffect.java index 1f80649e..e9c09bba 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/ISpecialEffect.java +++ b/src/main/java/minefantasy/mf2/api/weapon/ISpecialEffect.java @@ -4,7 +4,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface ISpecialEffect -{ - public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam); +public interface ISpecialEffect { + public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/IWeaponClass.java b/src/main/java/minefantasy/mf2/api/weapon/IWeaponClass.java index 9181393a..4f48bab8 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/IWeaponClass.java +++ b/src/main/java/minefantasy/mf2/api/weapon/IWeaponClass.java @@ -1,6 +1,5 @@ package minefantasy.mf2.api.weapon; -public interface IWeaponClass -{ - public WeaponClass getWeaponClass(); +public interface IWeaponClass { + public WeaponClass getWeaponClass(); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/IWeaponSpeed.java b/src/main/java/minefantasy/mf2/api/weapon/IWeaponSpeed.java index 45405d98..5669eaa6 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/IWeaponSpeed.java +++ b/src/main/java/minefantasy/mf2/api/weapon/IWeaponSpeed.java @@ -3,7 +3,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -public interface IWeaponSpeed -{ - public int modifyHitTime(EntityLivingBase user, ItemStack item); +public interface IWeaponSpeed { + public int modifyHitTime(EntityLivingBase user, ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/IWeightedWeapon.java b/src/main/java/minefantasy/mf2/api/weapon/IWeightedWeapon.java index 23eb1979..1f83aa24 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/IWeightedWeapon.java +++ b/src/main/java/minefantasy/mf2/api/weapon/IWeightedWeapon.java @@ -2,11 +2,10 @@ import net.minecraft.entity.EntityLivingBase; -public interface IWeightedWeapon -{ - /** - * Gets the amount that you are thrown off balance, <= 0 means no effect - * Spears use 0.5 - */ - public float getBalance(EntityLivingBase user); +public interface IWeightedWeapon { + /** + * Gets the amount that you are thrown off balance, <= 0 means no effect Spears + * use 0.5 + */ + public float getBalance(EntityLivingBase user); } diff --git a/src/main/java/minefantasy/mf2/api/weapon/WeaponClass.java b/src/main/java/minefantasy/mf2/api/weapon/WeaponClass.java index 181560bb..a2c05201 100644 --- a/src/main/java/minefantasy/mf2/api/weapon/WeaponClass.java +++ b/src/main/java/minefantasy/mf2/api/weapon/WeaponClass.java @@ -1,66 +1,58 @@ package minefantasy.mf2.api.weapon; -import java.util.HashMap; - +import minefantasy.mf2.api.rpg.Skill; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; -import minefantasy.mf2.api.rpg.Skill; -import minefantasy.mf2.api.rpg.SkillList; +import java.util.HashMap; + +public class WeaponClass { + public static HashMap classes = new HashMap(); + + public static WeaponClass FIST = new WeaponClass("fist", null, "blunt"); + + public static WeaponClass BLADE = new WeaponClass("blade", null, "blunt"); + public static WeaponClass BLUNT = new WeaponClass("blunt", null, "blade"); + public static WeaponClass AXE = new WeaponClass("axe", null, "blade"); + public static WeaponClass POLEARM = new WeaponClass("polearm", null, "blade"); + public static WeaponClass MISC = new WeaponClass("misc", null, "blunt"); + + public Skill parentSkill; + public String name; + public String sound; + + public WeaponClass(String name, Skill parent, String sound) { + this.name = name; + this.parentSkill = parent; + this.sound = sound; + classes.put(name, this); + } + + public static WeaponClass getWeaponClass(String name) { + WeaponClass WC = classes.get(name); + return WC != null ? WC : WeaponClass.MISC; + } + + public static WeaponClass getWeaponClass(ItemStack weapon) { + if (weapon == null) { + return WeaponClass.FIST; + } + if (weapon.getItem() instanceof IWeaponClass) { + return ((IWeaponClass) weapon.getItem()).getWeaponClass(); + } + return WeaponClass.BLADE; + } + + public static WeaponClass findClassForAny(ItemStack weapon) { + if (weapon == null) + return FIST; + if (weapon.getItem() instanceof IWeaponClass || weapon.getItem() instanceof ItemSword) { + return getWeaponClass(weapon); + } + return WeaponClass.MISC; + } -public class WeaponClass -{ - public static HashMapclasses = new HashMap(); - - public static WeaponClass FIST = new WeaponClass("fist", null, "blunt"); - - public static WeaponClass BLADE = new WeaponClass("blade", null, "blunt"); - public static WeaponClass BLUNT = new WeaponClass("blunt", null, "blade"); - public static WeaponClass AXE = new WeaponClass("axe", null, "blade"); - public static WeaponClass POLEARM = new WeaponClass("polearm",null, "blade"); - public static WeaponClass MISC = new WeaponClass("misc", null, "blunt"); - - public Skill parentSkill; - public String name; - public String sound; - - public WeaponClass(String name, Skill parent, String sound) - { - this.name = name; - this.parentSkill = parent; - this.sound = sound; - classes.put(name, this); - } - public String getSound() - { - return sound; - } - - public static WeaponClass getWeaponClass(String name) - { - WeaponClass WC = classes.get(name); - return WC != null ? WC : WeaponClass.MISC; - } - public static WeaponClass getWeaponClass(ItemStack weapon) - { - if(weapon == null) - { - return WeaponClass.FIST; - } - if(weapon.getItem() instanceof IWeaponClass) - { - return ((IWeaponClass)weapon.getItem()).getWeaponClass(); - } - return WeaponClass.BLADE; - } - - public static WeaponClass findClassForAny(ItemStack weapon) - { - if(weapon == null)return FIST; - if(weapon.getItem() instanceof IWeaponClass || weapon.getItem() instanceof ItemSword) - { - return getWeaponClass(weapon); - } - return WeaponClass.MISC; - } + public String getSound() { + return sound; + } } diff --git a/src/main/java/minefantasy/mf2/block/basic/BasicBlockMF.java b/src/main/java/minefantasy/mf2/block/basic/BasicBlockMF.java index a5de39e0..3233657b 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BasicBlockMF.java +++ b/src/main/java/minefantasy/mf2/block/basic/BasicBlockMF.java @@ -1,69 +1,59 @@ package minefantasy.mf2.block.basic; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BasicBlockMF extends Block -{ - private Object drop; - - public BasicBlockMF(String name, Material material) - { - this(name, material, null); - } - public BasicBlockMF(String name, Material material, Object drop) - { - super(material); - - GameRegistry.registerBlock(this, name); - setBlockName(name); - setBlockTextureName("minefantasy2:basic/"+name); - - if(material == Material.rock) - { - this.setHarvestLevel("pickaxe", 0); - } - this.drop = drop; - this.setCreativeTab(CreativeTabs.tabBlock); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isOpaqueCube() - { - return this.blockMaterial != Material.glass; - } - - @Override - public Item getItemDropped(int meta, Random rand, int i) - { - if(drop != null) - { - if(drop instanceof Item) - { - return (Item) drop; - } - if(drop instanceof Block) - { - return Item.getItemFromBlock((Block) drop); - } - } - return Item.getItemFromBlock(this); +import java.util.Random; + +public class BasicBlockMF extends Block { + private Object drop; + + public BasicBlockMF(String name, Material material) { + this(name, material, null); + } + + public BasicBlockMF(String name, Material material, Object drop) { + super(material); + + GameRegistry.registerBlock(this, name); + setBlockName(name); + setBlockTextureName("minefantasy2:basic/" + name); + + if (material == Material.rock) { + this.setHarvestLevel("pickaxe", 0); + } + this.drop = drop; + this.setCreativeTab(CreativeTabs.tabBlock); } - - @Override - public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) - { - return false; + + @Override + @SideOnly(Side.CLIENT) + public boolean isOpaqueCube() { + return this.blockMaterial != Material.glass; + } + + @Override + public Item getItemDropped(int meta, Random rand, int i) { + if (drop != null) { + if (drop instanceof Item) { + return (Item) drop; + } + if (drop instanceof Block) { + return Item.getItemFromBlock((Block) drop); + } + } + return Item.getItemFromBlock(this); + } + + @Override + public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) { + return false; } } diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockMeta.java b/src/main/java/minefantasy/mf2/block/basic/BlockMeta.java index c0668cac..60af66bb 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BlockMeta.java +++ b/src/main/java/minefantasy/mf2/block/basic/BlockMeta.java @@ -9,58 +9,50 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.IIcon; -public abstract class BlockMeta extends Block -{ - protected final String[] names; - @SideOnly(Side.CLIENT) - protected IIcon[] icons; - public BlockMeta(String name, Material material, String...names) - { - super(material); - this.names = names; - - GameRegistry.registerBlock(this, ItemMetaBlock.class, name); - - if(material == Material.rock) - { - this.setHarvestLevel("pickaxe", 0); - } - this.setHardness(2.0F); - this.setResistance(2.0F); - this.setCreativeTab(CreativeTabs.tabBlock); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return icons[Math.min(meta, icons.length-1)]; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { +public abstract class BlockMeta extends Block { + protected final String[] names; + @SideOnly(Side.CLIENT) + protected IIcon[] icons; + + public BlockMeta(String name, Material material, String... names) { + super(material); + this.names = names; + + GameRegistry.registerBlock(this, ItemMetaBlock.class, name); + + if (material == Material.rock) { + this.setHarvestLevel("pickaxe", 0); + } + this.setHardness(2.0F); + this.setResistance(2.0F); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return icons[Math.min(meta, icons.length - 1)]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { icons = new IIcon[names.length]; - for(int i = 0; i < names.length; i ++) - { - icons[i] = reg.registerIcon("minefantasy2:meta/" + names[i]); + for (int i = 0; i < names.length; i++) { + icons[i] = reg.registerIcon("minefantasy2:meta/" + names[i]); } } - - public String getUnlocalisedName(int meta) - { - return "tile."+names[Math.min(meta, names.length-1)]; - } - public int getCount() - { - return names.length; - } - - @Override - public int damageDropped(int meta) - { - return meta; - } + public String getUnlocalisedName(int meta) { + return "tile." + names[Math.min(meta, names.length - 1)]; + } + + public int getCount() { + return names.length; + } + + @Override + public int damageDropped(int meta) { + return meta; + } } diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockMetalBarsMF.java b/src/main/java/minefantasy/mf2/block/basic/BlockMetalBarsMF.java index 66b2e9cb..153cf7c4 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BlockMetalBarsMF.java +++ b/src/main/java/minefantasy/mf2/block/basic/BlockMetalBarsMF.java @@ -1,7 +1,6 @@ package minefantasy.mf2.block.basic; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.block.Block; import net.minecraft.block.BlockPane; @@ -10,35 +9,37 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -public class BlockMetalBarsMF extends BlockPane -{ - private BaseMaterialMF baseMat; - public BlockMetalBarsMF(BaseMaterialMF material) - { - super("minefantasy2:metal/"+material.name.toLowerCase()+"_bars", "minefantasy2:metal/"+material.name.toLowerCase()+"_bars", Material.iron, true); - String name = material.name.toLowerCase() + "_bars"; - GameRegistry.registerBlock(this, name); - setBlockName(name); - - this.setHarvestLevel("pickaxe", material.harvestLevel); - this.setStepSound(Block.soundTypeMetal); - this.setHardness(material.hardness+1 / 2F); - this.setResistance(material.hardness+1); - this.baseMat = material; - } - - private Random rand = new Random(); - @Override - public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity hitter) - { - if(baseMat.name.equalsIgnoreCase("dragonforge") && !hitter.isImmuneToFire() && hitter instanceof EntityLivingBase) - { - hitter.setFire(10); - hitter.attackEntityFrom(DamageSource.inFire, 1); - world.spawnParticle("flame", x+rand.nextDouble(), y+rand.nextDouble(), z+rand.nextDouble(), 0D, 0D, 0D); - world.spawnParticle("smoke", x+rand.nextDouble(), y+rand.nextDouble(), z+rand.nextDouble(), 0D, 0D, 0D); - } +import java.util.Random; + +public class BlockMetalBarsMF extends BlockPane { + private BaseMaterialMF baseMat; + private Random rand = new Random(); + + public BlockMetalBarsMF(BaseMaterialMF material) { + super("minefantasy2:metal/" + material.name.toLowerCase() + "_bars", + "minefantasy2:metal/" + material.name.toLowerCase() + "_bars", Material.iron, true); + String name = material.name.toLowerCase() + "_bars"; + GameRegistry.registerBlock(this, name); + setBlockName(name); + + this.setHarvestLevel("pickaxe", material.harvestLevel); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(material.hardness + 1 / 2F); + this.setResistance(material.hardness + 1); + this.baseMat = material; + } + + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity hitter) { + if (baseMat.name.equalsIgnoreCase("dragonforge") && !hitter.isImmuneToFire() + && hitter instanceof EntityLivingBase) { + hitter.setFire(10); + hitter.attackEntityFrom(DamageSource.inFire, 1); + world.spawnParticle("flame", x + rand.nextDouble(), y + rand.nextDouble(), z + rand.nextDouble(), 0D, 0D, + 0D); + world.spawnParticle("smoke", x + rand.nextDouble(), y + rand.nextDouble(), z + rand.nextDouble(), 0D, 0D, + 0D); + } } } diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockMetalMF.java b/src/main/java/minefantasy/mf2/block/basic/BlockMetalMF.java index 4241706d..106a3447 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BlockMetalMF.java +++ b/src/main/java/minefantasy/mf2/block/basic/BlockMetalMF.java @@ -1,26 +1,24 @@ package minefantasy.mf2.block.basic; +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; -import cpw.mods.fml.common.registry.GameRegistry; -public class BlockMetalMF extends Block -{ - public BlockMetalMF(BaseMaterialMF material) - { - super(Material.iron); - - String name = material.name.toLowerCase() + "_block"; - GameRegistry.registerBlock(this, name); - setBlockName(name); - - this.setBlockTextureName("minefantasy2:metal/"+name); - this.setHarvestLevel("pickaxe", material.harvestLevel); - this.setStepSound(Block.soundTypeMetal); - this.setHardness(material.hardness+1 / 2F); - this.setResistance(material.hardness+1); - this.setCreativeTab(CreativeTabs.tabBlock); - } +public class BlockMetalMF extends Block { + public BlockMetalMF(BaseMaterialMF material) { + super(Material.iron); + + String name = material.name.toLowerCase() + "_block"; + GameRegistry.registerBlock(this, name); + setBlockName(name); + + this.setBlockTextureName("minefantasy2:metal/" + name); + this.setHarvestLevel("pickaxe", material.harvestLevel); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(material.hardness + 1 / 2F); + this.setResistance(material.hardness + 1); + this.setCreativeTab(CreativeTabs.tabBlock); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockMithrilOre.java b/src/main/java/minefantasy/mf2/block/basic/BlockMithrilOre.java new file mode 100644 index 00000000..cc001ee1 --- /dev/null +++ b/src/main/java/minefantasy/mf2/block/basic/BlockMithrilOre.java @@ -0,0 +1,26 @@ +package minefantasy.mf2.block.basic; + +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.world.World; + +public class BlockMithrilOre extends BlockOreMF { + private boolean isPure; + + public BlockMithrilOre(String name, boolean pure) { + super(name, 4, pure ? 3 : 2); + isPure = pure; + } + + @SideOnly(Side.CLIENT) + @Override + public void randomDisplayTick(World world, int x, int y, int z, Random rand) { + if (rand.nextInt(20) == 0 && world.isRemote) { + // "minefantasy2:block.mithrilore" + world.playSound(x + 0.5D, y + 0.5D, z + 0.5D, (isPure ? "minefantasy2:block.oremithril" : ""), + 1.0F, rand.nextFloat() * 0.4F + 1.1F, true); + } + } +} diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockMythicDecor.java b/src/main/java/minefantasy/mf2/block/basic/BlockMythicDecor.java index c95cd438..a70e8500 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BlockMythicDecor.java +++ b/src/main/java/minefantasy/mf2/block/basic/BlockMythicDecor.java @@ -4,9 +4,8 @@ public class BlockMythicDecor extends BlockMeta { - public BlockMythicDecor() - { - super("mythic_decor", Material.rock, "framed_end", "decorated_end"); - } + public BlockMythicDecor() { + super("mythic_decor", Material.rock, "framed_end", "decorated_end"); + } } diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockMythicOre.java b/src/main/java/minefantasy/mf2/block/basic/BlockMythicOre.java index 0aa15b33..5a9fd45e 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BlockMythicOre.java +++ b/src/main/java/minefantasy/mf2/block/basic/BlockMythicOre.java @@ -1,27 +1,26 @@ package minefantasy.mf2.block.basic; -import java.util.Random; - -import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.world.World; + +import java.util.Random; + +public class BlockMythicOre extends BlockOreMF { + private boolean isPure; + + public BlockMythicOre(String name, boolean pure) { + super(name, 4, pure ? 3 : 2); + isPure = pure; + } -public class BlockMythicOre extends BlockOreMF -{ - private boolean isPure; - public BlockMythicOre(String name, boolean pure) - { - super(name, 4, pure ? 3 : 2); - isPure = pure; - } - @SideOnly(Side.CLIENT) - @Override - public void randomDisplayTick(World world, int x, int y, int z, Random rand) - { - if (rand.nextInt(20) == 0 && world.isRemote) - { - //"minefantasy2:block.mythicore" - world.playSound(x + 0.5D, y + 0.5D, z + 0.5D, (isPure ? "minefantasy2:block.mythicore" : "random.levelup"), 1.0F, rand.nextFloat() * 0.4F + 1.1F, true); + @SideOnly(Side.CLIENT) + @Override + public void randomDisplayTick(World world, int x, int y, int z, Random rand) { + if (rand.nextInt(20) == 0 && world.isRemote) { + // "minefantasy2:block.mythicore" + world.playSound(x + 0.5D, y + 0.5D, z + 0.5D, (isPure ? "minefantasy2:block.mythicore" : "random.levelup"), + 1.0F, rand.nextFloat() * 0.4F + 1.1F, true); } } } diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockOreMF.java b/src/main/java/minefantasy/mf2/block/basic/BlockOreMF.java index 9a103386..c624bce5 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BlockOreMF.java +++ b/src/main/java/minefantasy/mf2/block/basic/BlockOreMF.java @@ -1,7 +1,6 @@ package minefantasy.mf2.block.basic; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.item.list.CreativeTabMF; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -10,84 +9,78 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.common.registry.GameRegistry; -public class BlockOreMF extends Block -{ - public int rarity; - private int xp; - private Item drop; - private int dropMin; - private int dropMax; - - public BlockOreMF(String name, int harvestLevel) - { - this(name, harvestLevel, 0); - } - public BlockOreMF(String name, int harvestLevel, int rarity) - { - this(name, harvestLevel, rarity, null, 1, 1, 0); - } - public BlockOreMF(String name, int harvestLevel, int rarity, Item drop, int min, int max, int xp) - { - this(name, harvestLevel, rarity, drop, min, max, xp, Material.rock); - } - public BlockOreMF(String name, int harvestLevel, int rarity, Item drop, int min, int max, int xp, Material material) - { - super(material); - this.xp = xp; - this.drop = drop; - this.rarity = rarity; - this.dropMin=min; - this.dropMax=max; - - this.setStepSound(Block.soundTypePiston); - GameRegistry.registerBlock(this, ItemOreblockMF.class, name); - setBlockName(name); - setBlockTextureName("minefantasy2:ores/"+name); - - if(material == Material.rock) - { - this.setHarvestLevel("pickaxe", harvestLevel); - } - this.setCreativeTab(CreativeTabMF.tabOres); - OreDictionary.registerOre(name, this); - } - - @Override - public Item getItemDropped(int meta, Random rand, int i) - { - return drop != null ? drop : Item.getItemFromBlock(this); +import java.util.Random; + +public class BlockOreMF extends Block { + public int rarity; + private int xp; + private Item drop; + private int dropMin; + private int dropMax; + private Random rand = new Random(); + + public BlockOreMF(String name, int harvestLevel) { + this(name, harvestLevel, 0); + } + + public BlockOreMF(String name, int harvestLevel, int rarity) { + this(name, harvestLevel, rarity, null, 1, 1, 0); + } + + public BlockOreMF(String name, int harvestLevel, int rarity, Item drop, int min, int max, int xp) { + this(name, harvestLevel, rarity, drop, min, max, xp, Material.rock); + } + + public BlockOreMF(String name, int harvestLevel, int rarity, Item drop, int min, int max, int xp, + Material material) { + super(material); + this.xp = xp; + this.drop = drop; + this.rarity = rarity; + this.dropMin = min; + this.dropMax = max; + + this.setStepSound(Block.soundTypePiston); + GameRegistry.registerBlock(this, ItemOreblockMF.class, name); + setBlockName(name); + setBlockTextureName("minefantasy2:ores/" + name); + + if (material == Material.rock) { + this.setHarvestLevel("pickaxe", harvestLevel); + } + this.setCreativeTab(CreativeTabMF.tabOres); + OreDictionary.registerOre(name, this); + } + + @Override + public Item getItemDropped(int meta, Random rand, int i) { + return drop != null ? drop : Item.getItemFromBlock(this); } /** * Returns the quantity of items to drop on block destruction. */ - @Override - public int quantityDropped(Random rand) - { + @Override + public int quantityDropped(Random rand) { return MathHelper.getRandomIntegerInRange(rand, dropMin, dropMax); } /** - * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive). + * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' + * (inclusive). */ @Override - public int quantityDroppedWithBonus(int fortune, Random rand) - { - if (fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, rand, fortune)) - { + public int quantityDroppedWithBonus(int fortune, Random rand) { + if (fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, rand, fortune)) { int j = rand.nextInt(fortune + 2) - 1; - if (j < 0) - { + if (j < 0) { j = 0; } return this.quantityDropped(rand) * (j + 1); - } - else - { + } else { return this.quantityDropped(rand); } } @@ -96,19 +89,14 @@ public int quantityDroppedWithBonus(int fortune, Random rand) * Drops the block items with a specified chance of dropping the specified items */ @Override - public void dropBlockAsItemWithChance(World world, int x, int y, int z, int m, float f, int i) - { + public void dropBlockAsItemWithChance(World world, int x, int y, int z, int m, float f, int i) { super.dropBlockAsItemWithChance(world, x, y, z, m, f, i); } - private Random rand = new Random(); - @Override - public int getExpDrop(IBlockAccess world, int meta, int fortune) - { - if (xp > 0 && this.getItemDropped(meta, rand, fortune) != Item.getItemFromBlock(this)) - { - return MathHelper.getRandomIntegerInRange(rand, xp, xp*2); + public int getExpDrop(IBlockAccess world, int meta, int fortune) { + if (xp > 0 && this.getItemDropped(meta, rand, fortune) != Item.getItemFromBlock(this)) { + return MathHelper.getRandomIntegerInRange(rand, xp, xp * 2); } return 0; } diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockPaneMF.java b/src/main/java/minefantasy/mf2/block/basic/BlockPaneMF.java index 88dc462b..210cc34e 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BlockPaneMF.java +++ b/src/main/java/minefantasy/mf2/block/basic/BlockPaneMF.java @@ -1,18 +1,16 @@ package minefantasy.mf2.block.basic; +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.BlockPane; import net.minecraft.block.material.Material; -import cpw.mods.fml.common.registry.GameRegistry; -public class BlockPaneMF extends BlockPane -{ +public class BlockPaneMF extends BlockPane { + + public BlockPaneMF(String name, String frontTex, String sideTex, Material material, boolean recoverable) { + super("minefantasy2:basic/" + frontTex, "minefantasy2:basic/" + sideTex, material, recoverable); - public BlockPaneMF(String name, String frontTex, String sideTex, Material material, boolean recoverable) - { - super("minefantasy2:basic/"+frontTex, "minefantasy2:basic/"+sideTex, material, recoverable); - - GameRegistry.registerBlock(this, name); - setBlockName(name); - } + GameRegistry.registerBlock(this, name); + setBlockName(name); + } } diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockReinforcedStone.java b/src/main/java/minefantasy/mf2/block/basic/BlockReinforcedStone.java index 1b2be959..64dd6d09 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BlockReinforcedStone.java +++ b/src/main/java/minefantasy/mf2/block/basic/BlockReinforcedStone.java @@ -6,42 +6,38 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; -public class BlockReinforcedStone extends BlockMeta -{ - private String currentName; - public BlockReinforcedStone(String name, String...alternates) - { - super(name, Material.rock, alternates); - this.currentName = name; - } +public class BlockReinforcedStone extends BlockMeta { + private String currentName; - @Override - public IIcon getIcon(int side, int meta) - { - if(side < 2 && meta < names.length && (this.names[meta].startsWith("dshall") || this.names[meta].equalsIgnoreCase("engraved"))) - { - return icons[0]; - } - return super.getIcon(side, meta); - } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { + public BlockReinforcedStone(String name, String... alternates) { + super(name, Material.rock, alternates); + this.currentName = name; + } + + @Override + public IIcon getIcon(int side, int meta) { + if (side < 2 && meta < names.length + && (this.names[meta].startsWith("dshall") || this.names[meta].equalsIgnoreCase("engraved"))) { + return icons[0]; + } + return super.getIcon(side, meta); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { icons = new IIcon[names.length]; - for(int i = 0; i < names.length; i ++) - { - icons[i] = reg.registerIcon("minefantasy2:meta/" + currentName + "_" + names[i]); + for (int i = 0; i < names.length; i++) { + icons[i] = reg.registerIcon("minefantasy2:meta/" + currentName + "_" + names[i]); + } + } + + @Override + public String getUnlocalisedName(int meta) { + if (meta < names.length + && (this.names[meta].startsWith("dshall") || this.names[meta].equalsIgnoreCase("engraved"))) { + return "tile." + currentName + "_" + names[1]; } + return "tile." + currentName + "_" + names[Math.min(meta, names.length - 1)]; } - - @Override - public String getUnlocalisedName(int meta) - { - if(meta < names.length && (this.names[meta].startsWith("dshall") || this.names[meta].equalsIgnoreCase("engraved"))) - { - return "tile." + currentName + "_" + names[1]; - } - return "tile." + currentName + "_" + names[Math.min(meta, names.length-1)]; - } } diff --git a/src/main/java/minefantasy/mf2/block/basic/BlockWorldGenMarker.java b/src/main/java/minefantasy/mf2/block/basic/BlockWorldGenMarker.java index 4404bddf..ff3fa931 100644 --- a/src/main/java/minefantasy/mf2/block/basic/BlockWorldGenMarker.java +++ b/src/main/java/minefantasy/mf2/block/basic/BlockWorldGenMarker.java @@ -7,20 +7,17 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public class BlockWorldGenMarker extends BlockContainer -{ +public class BlockWorldGenMarker extends BlockContainer { - public BlockWorldGenMarker() - { - super(Material.air); - this.setBlockUnbreakable(); - GameRegistry.registerBlock(this, "WorldGenFlag"); - } + public BlockWorldGenMarker() { + super(Material.air); + this.setBlockUnbreakable(); + GameRegistry.registerBlock(this, "WorldGenFlag"); + } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityWorldGenMarker(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityWorldGenMarker(); + } } diff --git a/src/main/java/minefantasy/mf2/block/basic/ConstructionBlockMF.java b/src/main/java/minefantasy/mf2/block/basic/ConstructionBlockMF.java index 57c9e0fb..9c5dcc47 100644 --- a/src/main/java/minefantasy/mf2/block/basic/ConstructionBlockMF.java +++ b/src/main/java/minefantasy/mf2/block/basic/ConstructionBlockMF.java @@ -1,233 +1,188 @@ package minefantasy.mf2.block.basic; -import java.util.HashMap; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBlockWithMetadata; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.world.World; + +import java.util.List; public class ConstructionBlockMF extends Block { - public IIcon[] m_icons = new IIcon[4]; - public static final String[] m_names = new String[] {"", "_cobblestone", "_brick", "_pavement"}; - public Block[] stairblocks = new Block[4]; - public ConstructionBlockMF(String unlocName) - { - this(unlocName, new String[] {"", "_cobblestone", "_brick", "_pavement"}); - } - public ConstructionBlockMF(String unlocName, String... types) - { - this(unlocName, Material.rock, types); - } - public ConstructionBlockMF(String unlocName, Material material, String... types) - { - super(material); - - this.setBlockName(unlocName); - - this.setCreativeTab(CreativeTabs.tabBlock); - GameRegistry.registerBlock(this, ItemConstBlock.class, unlocName); - for(int i = 0; i < m_names.length; i ++) - { - GameRegistry.registerBlock(stairblocks[i] = new StairsConstBlock(unlocName + m_names[i] + "_stair", this, i).setHardness(1.5F).setResistance(10F), unlocName + m_names[i] + "_stair"); - } - - setHardness(1.5F); - setResistance(10F); - if(material == Material.rock) - { - setHarvestLevel("pickaxe", 0); - } - - addConstructRecipes(); - - } - - @Override - public Block setHardness(float level) - { - if(stairblocks != null) - { - for(Block stairblock : stairblocks) - stairblock.setHardness(level); - } + public static final String[] m_names = new String[]{"", "_cobblestone", "_brick", "_pavement"}; + public IIcon[] m_icons = new IIcon[4]; + public Block[] stairblocks = new Block[4]; + + public ConstructionBlockMF(String unlocName) { + this(unlocName, new String[]{"", "_cobblestone", "_brick", "_pavement"}); + } + + public ConstructionBlockMF(String unlocName, String... types) { + this(unlocName, Material.rock, types); + } + + public ConstructionBlockMF(String unlocName, Material material, String... types) { + super(material); + + this.setBlockName(unlocName); + + this.setCreativeTab(CreativeTabs.tabBlock); + GameRegistry.registerBlock(this, ItemConstBlock.class, unlocName); + for (int i = 0; i < m_names.length; i++) { + GameRegistry.registerBlock(stairblocks[i] = new StairsConstBlock(unlocName + m_names[i] + "_stair", this, i) + .setHardness(1.5F).setResistance(10F), unlocName + m_names[i] + "_stair"); + } + + setHardness(1.5F); + setResistance(10F); + if (material == Material.rock) { + setHarvestLevel("pickaxe", 0); + } + + addConstructRecipes(); + + } + + @Override + public Block setHardness(float level) { + if (stairblocks != null) { + for (Block stairblock : stairblocks) + stairblock.setHardness(level); + } return super.setHardness(level); } - @Override - public Block setResistance(float level) - { - if(stairblocks != null) - { - for(Block stairblock : stairblocks) - stairblock.setResistance(level); - } + + @Override + public Block setResistance(float level) { + if (stairblocks != null) { + for (Block stairblock : stairblocks) + stairblock.setResistance(level); + } return super.setResistance(level); } - - //public Item getItemDropped(int meta, Random rand, int i) { return null; }; - - public void addConstructRecipes() - { - GameRegistry.addSmelting(new ItemStack(this, 1, 1), new ItemStack(this, 1, 0), 0); - - GameRegistry.addRecipe(new ItemStack(this, 4, 3), new Object[] - { - "XX", - "XX", - 'X', new ItemStack(this, 1, 1) - }); - GameRegistry.addRecipe(new ItemStack(this, 4, 2), new Object[] - { - "X X", - " ", - "X X", - 'X', new ItemStack(this, 1, 1) - }); - GameRegistry.addRecipe(new ItemStack(this, 1, 1), new Object[] - { - "X", - 'X', new ItemStack(this, 1, 2) - }); - GameRegistry.addRecipe(new ItemStack(this, 1, 1), new Object[] - { - "X", - 'X', new ItemStack(this, 1, 3) - }); - for(int i = 0; i < 4; i++) - GameRegistry.addRecipe(new ItemStack(stairblocks[i], 4), new Object[] - { - " X", - " XX", - "XXX", - 'X', new ItemStack(this, 1, i) - }); - } - - @Override - public int damageDropped(int meta) - { - if(meta == 0)return 1; - - return meta; - } - - @Override - public void registerBlockIcons(IIconRegister register) - { - m_icons[0] = register.registerIcon(MineFantasyII.MODID + ":" + "basic/" + getUnlocalizedName().substring(5)); - m_icons[1] = register.registerIcon(MineFantasyII.MODID + ":" + "basic/" + getUnlocalizedName().substring(5) + "_cobblestone"); - m_icons[2] = register.registerIcon(MineFantasyII.MODID + ":" + "basic/" + getUnlocalizedName().substring(5) + "_brick"); - m_icons[3] = register.registerIcon(MineFantasyII.MODID + ":" + "basic/" + getUnlocalizedName().substring(5) + "_pavement"); - } - - public String getUnlocalizedName(ItemStack itemstack) { - return getUnlocalizedName() + "." + m_names[itemstack.getItemDamage()]; - } - - @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) - { - - for(int i = 0; i < 4; i++) - { - list.add(new ItemStack(item, 1, i)); - } - } - @Override - public IIcon getIcon(int side, int meta) - { - switch(meta) - { - case 0: - return m_icons[0]; - - case 1: - return m_icons[1]; - - case 2: - return m_icons[2]; - - case 3: - return m_icons[3]; - - default: - return blockIcon; - } - } - - public static class StairsConstBlock extends BlockStairs - { - private final Block base; - public StairsConstBlock(String unlocalizedName, Block baseBlock, int metaOfBaseBlock) - { - super(baseBlock, metaOfBaseBlock); - this.setBlockName(unlocalizedName); - this.setCreativeTab(CreativeTabs.tabBlock); - this.setLightOpacity(0);//They seem to render shadows funny - this.base = baseBlock; - } - - public void addRecipe() - { - GameRegistry.addRecipe(new ItemStack(this, 4), new Object[]{ - "B ", - "BB ", - "BBB", - 'B', this.base - }); - } - - public StairsConstBlock(String unlocalizedName, Block baseBlock) - { - this(unlocalizedName, baseBlock, 0); - } - - public Block register(String name) - { - GameRegistry.registerBlock(this, name); - return this; - } - } - - public static class ItemConstBlock extends ItemBlockWithMetadata - { - - public ItemConstBlock(Block block) { - super(block, block); - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - switch (stack.getItemDamage()) { - case 1: - return this.getUnlocalizedName() + "_cobblestone"; - case 2: - return this.getUnlocalizedName() + "_brick"; - case 3: - return this.getUnlocalizedName() + "_pavement"; - default: - return this.getUnlocalizedName(); - } - } - - @Override - public int getMetadata(int d) - { - return d; - } - } - + + // public Item getItemDropped(int meta, Random rand, int i) { return null; }; + + public void addConstructRecipes() { + GameRegistry.addSmelting(new ItemStack(this, 1, 1), new ItemStack(this, 1, 0), 0); + + GameRegistry.addRecipe(new ItemStack(this, 4, 3), new Object[]{"XX", "XX", 'X', new ItemStack(this, 1, 1)}); + GameRegistry.addRecipe(new ItemStack(this, 4, 2), + new Object[]{"X X", " ", "X X", 'X', new ItemStack(this, 1, 1)}); + GameRegistry.addRecipe(new ItemStack(this, 1, 1), new Object[]{"X", 'X', new ItemStack(this, 1, 2)}); + GameRegistry.addRecipe(new ItemStack(this, 1, 1), new Object[]{"X", 'X', new ItemStack(this, 1, 3)}); + for (int i = 0; i < 4; i++) + GameRegistry.addRecipe(new ItemStack(stairblocks[i], 4), + new Object[]{" X", " XX", "XXX", 'X', new ItemStack(this, 1, i)}); + } + + @Override + public int damageDropped(int meta) { + if (meta == 0) + return 1; + + return meta; + } + + @Override + public void registerBlockIcons(IIconRegister register) { + m_icons[0] = register.registerIcon(MineFantasyII.MODID + ":" + "basic/" + getUnlocalizedName().substring(5)); + m_icons[1] = register.registerIcon( + MineFantasyII.MODID + ":" + "basic/" + getUnlocalizedName().substring(5) + "_cobblestone"); + m_icons[2] = register + .registerIcon(MineFantasyII.MODID + ":" + "basic/" + getUnlocalizedName().substring(5) + "_brick"); + m_icons[3] = register + .registerIcon(MineFantasyII.MODID + ":" + "basic/" + getUnlocalizedName().substring(5) + "_pavement"); + } + + public String getUnlocalizedName(ItemStack itemstack) { + return getUnlocalizedName() + "." + m_names[itemstack.getItemDamage()]; + } + + @Override + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + + for (int i = 0; i < 4; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public IIcon getIcon(int side, int meta) { + switch (meta) { + case 0: + return m_icons[0]; + + case 1: + return m_icons[1]; + + case 2: + return m_icons[2]; + + case 3: + return m_icons[3]; + + default: + return blockIcon; + } + } + + public static class StairsConstBlock extends BlockStairs { + private final Block base; + + public StairsConstBlock(String unlocalizedName, Block baseBlock, int metaOfBaseBlock) { + super(baseBlock, metaOfBaseBlock); + this.setBlockName(unlocalizedName); + this.setCreativeTab(CreativeTabs.tabBlock); + this.setLightOpacity(0);// They seem to render shadows funny + this.base = baseBlock; + } + + public StairsConstBlock(String unlocalizedName, Block baseBlock) { + this(unlocalizedName, baseBlock, 0); + } + + public void addRecipe() { + GameRegistry.addRecipe(new ItemStack(this, 4), new Object[]{"B ", "BB ", "BBB", 'B', this.base}); + } + + public Block register(String name) { + GameRegistry.registerBlock(this, name); + return this; + } + } + + public static class ItemConstBlock extends ItemBlockWithMetadata { + + public ItemConstBlock(Block block) { + super(block, block); + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + switch (stack.getItemDamage()) { + case 1: + return this.getUnlocalizedName() + "_cobblestone"; + case 2: + return this.getUnlocalizedName() + "_brick"; + case 3: + return this.getUnlocalizedName() + "_pavement"; + default: + return this.getUnlocalizedName(); + } + } + + @Override + public int getMetadata(int d) { + return d; + } + } + } diff --git a/src/main/java/minefantasy/mf2/block/basic/ItemMetaBlock.java b/src/main/java/minefantasy/mf2/block/basic/ItemMetaBlock.java index 0e564832..936f7316 100644 --- a/src/main/java/minefantasy/mf2/block/basic/ItemMetaBlock.java +++ b/src/main/java/minefantasy/mf2/block/basic/ItemMetaBlock.java @@ -1,47 +1,39 @@ package minefantasy.mf2.block.basic; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.item.list.ToolListMF; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -public class ItemMetaBlock extends ItemBlock -{ - private BlockMeta instance; - public ItemMetaBlock(Block block) - { - super(block); - this.instance = (BlockMeta) block; - setHasSubtypes(true); - } - - @Override - public String getUnlocalizedName(ItemStack item) - { +import java.util.List; + +public class ItemMetaBlock extends ItemBlock { + private BlockMeta instance; + + public ItemMetaBlock(Block block) { + super(block); + this.instance = (BlockMeta) block; + setHasSubtypes(true); + } + + @Override + public String getUnlocalizedName(ItemStack item) { return instance.getUnlocalisedName(item.getItemDamage()); } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List list) - { - for(int i = 0; i < instance.getCount(); i++) - { - list.add(new ItemStack(this, 1, i)); + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < instance.getCount(); i++) { + list.add(new ItemStack(this, 1, i)); } } - - @Override - public int getMetadata(int subid) - { + + @Override + public int getMetadata(int subid) { return subid; } } diff --git a/src/main/java/minefantasy/mf2/block/basic/ItemOreblockMF.java b/src/main/java/minefantasy/mf2/block/basic/ItemOreblockMF.java index 5cfa1812..59641767 100644 --- a/src/main/java/minefantasy/mf2/block/basic/ItemOreblockMF.java +++ b/src/main/java/minefantasy/mf2/block/basic/ItemOreblockMF.java @@ -6,32 +6,27 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemOreblockMF extends ItemBlock -{ - private BlockOreMF ore; - public ItemOreblockMF(Block block) - { - super(block); - ore = (BlockOreMF) block; - } - - @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = ore.rarity+1; - - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= ToolListMF.rarity.length) - { - lvl = ToolListMF.rarity.length-1; - } - return ToolListMF.rarity[lvl]; - } +public class ItemOreblockMF extends ItemBlock { + private BlockOreMF ore; + + public ItemOreblockMF(Block block) { + super(block); + ore = (BlockOreMF) block; + } + + @Override + public EnumRarity getRarity(ItemStack item) { + int lvl = ore.rarity + 1; + + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (lvl >= ToolListMF.rarity.length) { + lvl = ToolListMF.rarity.length - 1; + } + return ToolListMF.rarity[lvl]; + } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockAnvilMF.java b/src/main/java/minefantasy/mf2/block/crafting/BlockAnvilMF.java index 0b2bb87d..190ddcf8 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockAnvilMF.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockAnvilMF.java @@ -1,7 +1,8 @@ package minefantasy.mf2.block.crafting; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.heating.TongsHelper; import minefantasy.mf2.block.tileentity.TileEntityAnvilMF; @@ -23,47 +24,44 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockAnvilMF extends BlockContainer -{ +import java.util.Random; + +public class BlockAnvilMF extends BlockContainer { public static int anvil_RI = 100; - - @SideOnly(Side.CLIENT) + + @SideOnly(Side.CLIENT) public int anvilRenderSide; public BaseMaterialMF material; private int tier; + private Random rand = new Random(); - public BlockAnvilMF(BaseMaterialMF material) - { + public BlockAnvilMF(BaseMaterialMF material) { super(Material.anvil); String name = material.name; this.material = material; float height = 1.0F / 16F * 13F; setBlockBounds(0F, 0F, 0F, 1F, height, 1F); - - this.setBlockTextureName("minefantasy2:metal/"+name.toLowerCase()+"_block"); - name = "anvil"+name; + + this.setBlockTextureName("minefantasy2:metal/" + name.toLowerCase() + "_block"); + name = "anvil" + name; this.tier = material.tier; GameRegistry.registerBlock(this, ItemBlockAnvilMF.class, name); - setBlockName(name); - this.setStepSound(Block.soundTypeMetal); - this.setHardness(material.hardness+1 / 2F); - this.setResistance(material.hardness+1); + setBlockName(name); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(material.hardness + 1 / 2F); + this.setResistance(material.hardness + 1); this.setLightOpacity(0); this.setCreativeTab(CreativeTabMF.tabUtil); } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @@ -71,9 +69,8 @@ public boolean isOpaqueCube() * Called when the block is placed in the world. */ @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { - int dir = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { + int dir = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 2); } @@ -82,123 +79,103 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase u * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - ItemStack held = user.getHeldItem(); - TileEntityAnvilMF tile = getTile(world, x, y, z); - if(tile != null) - { - if(side == 1 && held != null && held.getItem() instanceof ItemTongs && onUsedTongs(world, user, held, tile)) - { - return true; - } - if(side != 1 || !tile.tryCraft(user, true) && !world.isRemote) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + ItemStack held = user.getHeldItem(); + TileEntityAnvilMF tile = getTile(world, x, y, z); + if (tile != null) { + if (side == 1 && held != null && held.getItem() instanceof ItemTongs + && onUsedTongs(world, user, held, tile)) { + return true; + } + if (side != 1 || !tile.tryCraft(user, true) && !world.isRemote) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } + } return true; } - private boolean onUsedTongs(World world, EntityPlayer user, ItemStack held, TileEntityAnvilMF tile) - { - ItemStack result = tile.getStackInSlot(tile.getSizeInventory()-1); - ItemStack grabbed = TongsHelper.getHeldItem(held); - - //GRAB - if(grabbed == null) - { - if(result != null && result.getItem() == ComponentListMF.hotItem) - { - if(TongsHelper.trySetHeldItem(held, result)) - { - tile.setInventorySlotContents(tile.getSizeInventory()-1, null); - return true; - } - } - } - else - { - for(int s = 0; s < (tile.getSizeInventory()-1); s++) - { - ItemStack slot = tile.getStackInSlot(s); - if(slot == null) - { - tile.setInventorySlotContents(s, grabbed); - TongsHelper.clearHeldItem(held, user); - return false; - } - } - } - return false; - } - @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { - { - TileEntityAnvilMF tile = getTile(world, x, y, z); - if(tile != null) - { - if(user.isSneaking()) - { - tile.upset(user); - } - else - { - tile.tryCraft(user, false); - } - } + + private boolean onUsedTongs(World world, EntityPlayer user, ItemStack held, TileEntityAnvilMF tile) { + ItemStack result = tile.getStackInSlot(tile.getSizeInventory() - 1); + ItemStack grabbed = TongsHelper.getHeldItem(held); + + // GRAB + if (grabbed == null) { + if (result != null && result.getItem() == ComponentListMF.hotItem) { + if (TongsHelper.trySetHeldItem(held, result)) { + tile.setInventorySlotContents(tile.getSizeInventory() - 1, null); + return true; + } + } + } else { + for (int s = 0; s < (tile.getSizeInventory() - 1); s++) { + ItemStack slot = tile.getStackInSlot(s); + if (slot == null) { + tile.setInventorySlotContents(s, grabbed); + TongsHelper.clearHeldItem(held, user); + return false; + } + } } + return false; } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityAnvilMF(tier, material.name); - } - - private TileEntityAnvilMF getTile(World world, int x, int y, int z) - { - return (TileEntityAnvilMF)world.getTileEntity(x, y, z); - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityAnvilMF tile = getTile(world, x, y, z); - - if (tile != null) + @Override + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { { - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { + TileEntityAnvilMF tile = getTile(world, x, y, z); + if (tile != null) { + if (user.isSneaking()) { + tile.upset(user); + } else { + tile.tryCraft(user, false); + } + } + } + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityAnvilMF(tier, material.name); + } + + private TileEntityAnvilMF getTile(World world, int x, int y, int z) { + return (TileEntityAnvilMF) world.getTileEntity(x, y, z); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityAnvilMF tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -209,32 +186,29 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - public int getTier() - { - return tier; - } - @SideOnly(Side.CLIENT) - @Override - public IIcon getIcon(int side, int meta) - { - if(tier == 0) - { - return side == 1 ? Blocks.stone.getIcon(side, meta) : Blocks.cobblestone.getIcon(side, meta); - } - return super.getIcon(side, meta); - } - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister reg) - { - if(tier != 0) - super.registerBlockIcons(reg); - } - - @Override - public int getRenderType() - { - return anvil_RI; - } - private Random rand = new Random(); + + public int getTier() { + return tier; + } + + @SideOnly(Side.CLIENT) + @Override + public IIcon getIcon(int side, int meta) { + if (tier == 0) { + return side == 1 ? Blocks.stone.getIcon(side, meta) : Blocks.cobblestone.getIcon(side, meta); + } + return super.getIcon(side, meta); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister reg) { + if (tier != 0) + super.registerBlockIcons(reg); + } + + @Override + public int getRenderType() { + return anvil_RI; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockBombBench.java b/src/main/java/minefantasy/mf2/block/crafting/BlockBombBench.java index 222be1f9..65c63f18 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockBombBench.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockBombBench.java @@ -1,13 +1,11 @@ package minefantasy.mf2.block.crafting; -import java.util.ArrayList; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.knowledge.ResearchLogic; -import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.tileentity.TileEntityBombBench; -import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.knowledge.KnowledgeListMF; import net.minecraft.block.Block; @@ -18,8 +16,6 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -29,34 +25,31 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockBombBench extends BlockContainer -{ - public static int bomb_RI = 102; - - public BlockBombBench() - { +import java.util.Random; + +public class BlockBombBench extends BlockContainer { + public static int bomb_RI = 102; + private Random rand = new Random(); + + public BlockBombBench() { super(Material.wood); GameRegistry.registerBlock(this, "MF_BombCrafter"); - setBlockName("bombBench"); - this.setStepSound(Block.soundTypeStone); - this.setHardness(5F); - this.setResistance(2F); + setBlockName("bombBench"); + this.setStepSound(Block.soundTypeStone); + this.setHardness(5F); + this.setResistance(2F); this.setLightOpacity(0); this.setCreativeTab(CreativeTabMF.tabUtil); } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @@ -64,8 +57,7 @@ public boolean isOpaqueCube() * Called when the block is placed in the world. */ @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { int direction = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); @@ -75,86 +67,74 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase u * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - if(!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.bombs)) - { - if(world.isRemote) - user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); - return false; + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + if (!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.bombs)) { + if (world.isRemote) + user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); + return false; + } + TileEntityBombBench tile = getTile(world, x, y, z); + if (tile != null && (world.isAirBlock(x, y + 1, z) || !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))) { + if (side != 1 || !tile.tryCraft(user, false) && !world.isRemote) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } } - TileEntityBombBench tile = getTile(world, x, y, z); - if(tile != null && (world.isAirBlock(x, y+1, z) || !world.isSideSolid(x, y+1, z, ForgeDirection.DOWN))) - { - if(side != 1 || !tile.tryCraft(user, false) && !world.isRemote) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } return true; } + @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { - if(ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.bombs)) - { - TileEntityBombBench tile = getTile(world, x, y, z); - if(tile != null) - { - tile.tryCraft(user, false); - } + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { + if (ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.bombs)) { + TileEntityBombBench tile = getTile(world, x, y, z); + if (tile != null) { + tile.tryCraft(user, false); + } } } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityBombBench(); - } - - private TileEntityBombBench getTile(World world, int x, int y, int z) - { - return (TileEntityBombBench)world.getTileEntity(x, y, z); - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityBombBench tile = getTile(world, x, y, z); - - if (tile != null) - { - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityBombBench(); + } + + private TileEntityBombBench getTile(World world, int x, int y, int z) { + return (TileEntityBombBench) world.getTileEntity(x, y, z); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityBombBench tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -165,28 +145,24 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - if(side == 1) - { - return Blocks.crafting_table.getIcon(1, meta); - } - return Blocks.anvil.getIcon(0, 0); - } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } - - @Override - public int getRenderType() - { - return bomb_RI; - } - private Random rand = new Random(); + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + if (side == 1) { + return Blocks.crafting_table.getIcon(1, meta); + } + return Blocks.anvil.getIcon(0, 0); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + + } + + @Override + public int getRenderType() { + return bomb_RI; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockBombPress.java b/src/main/java/minefantasy/mf2/block/crafting/BlockBombPress.java index ff850cd4..28441060 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockBombPress.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockBombPress.java @@ -1,13 +1,11 @@ package minefantasy.mf2.block.crafting; -import java.util.ArrayList; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.block.tileentity.TileEntityBombPress; -import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.knowledge.KnowledgeListMF; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; @@ -16,7 +14,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; @@ -24,34 +21,31 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockBombPress extends BlockContainer -{ - public static int bpress_RI = 108; - - public BlockBombPress() - { +import java.util.Random; + +public class BlockBombPress extends BlockContainer { + public static int bpress_RI = 108; + private Random rand = new Random(); + + public BlockBombPress() { super(Material.iron); GameRegistry.registerBlock(this, "MF_BombPress"); - setBlockName("bombPress"); - this.setStepSound(Block.soundTypeMetal); - this.setHardness(5F); - this.setResistance(2F); + setBlockName("bombPress"); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(5F); + this.setResistance(2F); this.setLightOpacity(0); this.setCreativeTab(CreativeTabMF.tabUtil); } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @@ -59,8 +53,7 @@ public boolean isOpaqueCube() * Called when the block is placed in the world. */ @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { int direction = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); @@ -70,51 +63,43 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase u * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - if(!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.bombs)) - { - if(world.isRemote) - user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); - return false; + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + if (!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.bombs)) { + if (world.isRemote) + user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); + return false; + } + TileEntityBombPress tile = getTile(world, x, y, z); + if (tile != null) { + tile.use(user); } - TileEntityBombPress tile = getTile(world, x, y, z); - if(tile != null) - { - tile.use(user); - } return true; } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityBombPress(); - } + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityBombPress(); + } + + private TileEntityBombPress getTile(World world, int x, int y, int z) { + return (TileEntityBombPress) world.getTileEntity(x, y, z); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return Blocks.anvil.getIcon(0, 0); + } - private TileEntityBombPress getTile(World world, int x, int y, int z) - { - return (TileEntityBombPress)world.getTileEntity(x, y, z); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return Blocks.anvil.getIcon(0, 0); - } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } - - @Override - public int getRenderType() - { - return bpress_RI; - } - - private Random rand = new Random(); + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + + } + + @Override + public int getRenderType() { + return bpress_RI; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockCarpenter.java b/src/main/java/minefantasy/mf2/block/crafting/BlockCarpenter.java index bf5f809d..36408b1c 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockCarpenter.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockCarpenter.java @@ -1,7 +1,8 @@ package minefantasy.mf2.block.crafting; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.block.tileentity.TileEntityCarpenterMF; import minefantasy.mf2.item.list.CreativeTabMF; @@ -20,39 +21,36 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockCarpenter extends BlockContainer -{ - public static int carpenter_RI = 101; - +import java.util.Random; + +public class BlockCarpenter extends BlockContainer { + public static int carpenter_RI = 101; + @SideOnly(Side.CLIENT) public int CarpenterRenderSide; private int tier = 0; + private Random rand = new Random(); - public BlockCarpenter() - { + public BlockCarpenter() { super(Material.wood); - + GameRegistry.registerBlock(this, "MF_CarpenterBench"); - setBlockName("carpenterBench"); - this.setStepSound(Block.soundTypeWood); - this.setHardness(5F); - this.setResistance(2F); + setBlockName("carpenterBench"); + this.setStepSound(Block.soundTypeWood); + this.setHardness(5F); + this.setResistance(2F); this.setLightOpacity(0); this.setCreativeTab(CreativeTabMF.tabUtil); } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @@ -60,8 +58,7 @@ public boolean isOpaqueCube() * Called when the block is placed in the world. */ @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { int direction = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); @@ -71,81 +68,72 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase u * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { { - TileEntityCarpenterMF tile = getTile(world, x, y, z); - if(tile != null && (world.isAirBlock(x, y+1, z) || !world.isSideSolid(x, y+1, z, ForgeDirection.DOWN))) - { - if(side != 1 || !tile.tryCraft(user) && !world.isRemote) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } + TileEntityCarpenterMF tile = getTile(world, x, y, z); + if (tile != null + && (world.isAirBlock(x, y + 1, z) || !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))) { + if (side != 1 || !tile.tryCraft(user) && !world.isRemote) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } + } return true; } } + @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { { - TileEntityCarpenterMF tile = getTile(world, x, y, z); - if(tile != null) - { - tile.tryCraft(user); - } + TileEntityCarpenterMF tile = getTile(world, x, y, z); + if (tile != null) { + tile.tryCraft(user); + } } } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityCarpenterMF(tier); - } - - private TileEntityCarpenterMF getTile(World world, int x, int y, int z) - { - return (TileEntityCarpenterMF)world.getTileEntity(x, y, z); - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityCarpenterMF tile = getTile(world, x, y, z); - - if (tile != null) - { - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityCarpenterMF(tier); + } + + private TileEntityCarpenterMF getTile(World world, int x, int y, int z) { + return (TileEntityCarpenterMF) world.getTileEntity(x, y, z); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityCarpenterMF tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -156,24 +144,21 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return Blocks.crafting_table.getIcon(side, meta); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } - @Override - public int getRenderType() - { - return carpenter_RI; - } - private Random rand = new Random(); + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return Blocks.crafting_table.getIcon(side, meta); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + + } + + @Override + public int getRenderType() { + return carpenter_RI; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockCogwork.java b/src/main/java/minefantasy/mf2/block/crafting/BlockCogwork.java index a134c2d9..49907d23 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockCogwork.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockCogwork.java @@ -18,28 +18,27 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BlockCogwork extends BlockDirectional -{ +public class BlockCogwork extends BlockDirectional { @SideOnly(Side.CLIENT) private IIcon toptex; @SideOnly(Side.CLIENT) private IIcon facetex; private String name; private boolean isMain = false; - public BlockCogwork(String name, boolean helmet) - { + + public BlockCogwork(String name, boolean helmet) { super(Material.circuits); this.isMain = helmet; - GameRegistry.registerBlock(this, "block"+name); - this.name=name; + GameRegistry.registerBlock(this, "block" + name); + this.name = name; this.setTickRandomly(true); this.name = name; this.setCreativeTab(CreativeTabMF.tabGadget); - this.setBlockTextureName("minefantasy2:metal/"+name.toLowerCase()); + this.setBlockTextureName("minefantasy2:metal/" + name.toLowerCase()); setBlockName(name); this.setHardness(1F); - this.setResistance(5F); - this.setLightOpacity(0); + this.setResistance(5F); + this.setLightOpacity(0); } /** @@ -47,37 +46,40 @@ public BlockCogwork(String name, boolean helmet) */ @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int meta) - { - return side == 1 ? this.toptex : (side == 0 ? this.toptex : (meta == 2 && side == 2 ? this.facetex : (meta == 3 && side == 5 ? this.facetex : (meta == 0 && side == 3 ? this.facetex : (meta == 1 && side == 4 ? this.facetex : this.blockIcon))))); + public IIcon getIcon(int side, int meta) { + return side == 1 ? this.toptex + : (side == 0 ? this.toptex + : (meta == 2 && side == 2 ? this.facetex + : (meta == 3 && side == 5 ? this.facetex + : (meta == 0 && side == 3 ? this.facetex + : (meta == 1 && side == 4 ? this.facetex : this.blockIcon))))); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, float f2) - { - if(!world.isRemote && ToolHelper.getCrafterTool(player.getHeldItem()).equalsIgnoreCase("spanner")) - { - return tryBuild(player, world, x, y, z); - } - return false; + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, + float f2) { + if (!world.isRemote && ToolHelper.getCrafterTool(player.getHeldItem()).equalsIgnoreCase("spanner")) { + return tryBuild(player, world, x, y, z); + } + return false; } - public boolean tryBuild(EntityPlayer builder, World world, int x, int y, int z) - { - if (isMain && PowerArmour.isStationBlock(world, x, y+2, z) && world.getBlock(x, y - 1, z) == BlockListMF.cogwork_legs && world.getBlock(x, y + 1, z) == BlockListMF.cogwork_helm) - { - if (!world.isRemote) - { + + public boolean tryBuild(EntityPlayer builder, World world, int x, int y, int z) { + if (isMain && PowerArmour.isStationBlock(world, x, y + 2, z) + && world.getBlock(x, y - 1, z) == BlockListMF.cogwork_legs + && world.getBlock(x, y + 1, z) == BlockListMF.cogwork_helm) { + if (!world.isRemote) { world.setBlock(x, y, z, getBlockById(0), 0, 2); world.setBlock(x, y - 1, z, getBlockById(0), 0, 2); world.setBlock(x, y + 1, z, getBlockById(0), 0, 2); - + EntityCogwork suit = new EntityCogwork(world); int m = world.getBlockMetadata(x, y, z); int angle = getAngleFor(builder); - suit.setLocationAndAngles((double)x + 0.5D, (double)y - 0.95D, (double)z + 0.5D, angle, 0.0F); + suit.setLocationAndAngles(x + 0.5D, y - 0.95D, z + 0.5D, angle, 0.0F); suit.rotationYaw = suit.rotationYawHead = suit.prevRotationYaw = suit.prevRotationYawHead = angle; world.spawnEntityInWorld(suit); - + world.notifyBlockChange(x, y, z, getBlockById(0)); world.notifyBlockChange(x, y - 1, z, getBlockById(0)); world.notifyBlockChange(x, y + 1, z, getBlockById(0)); @@ -87,21 +89,18 @@ public boolean tryBuild(EntityPlayer builder, World world, int x, int y, int z) return false; } - private int getAngleFor(EntityPlayer user) - { - int l = MathHelper.floor_double((double)(user.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; - return (int)(l*90); - } + private int getAngleFor(EntityPlayer user) { + int l = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 2.5D) & 3; + return l * 90; + } - @Override - public boolean renderAsNormalBlock() - { + @Override + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @@ -109,16 +108,14 @@ public boolean isOpaqueCube() * Called when the block is placed in the world. */ @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack placed) - { - int l = MathHelper.floor_double((double)(user.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack placed) { + int l = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 2.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, l, 2); } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister p_149651_1_) - { + public void registerBlockIcons(IIconRegister p_149651_1_) { this.facetex = p_149651_1_.registerIcon(this.getTextureName() + "_face"); this.toptex = p_149651_1_.registerIcon(this.getTextureName() + "_top"); this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "_side"); diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockCrossbowBench.java b/src/main/java/minefantasy/mf2/block/crafting/BlockCrossbowBench.java index f5bdf639..2dcaaa3e 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockCrossbowBench.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockCrossbowBench.java @@ -1,13 +1,11 @@ package minefantasy.mf2.block.crafting; -import java.util.ArrayList; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.knowledge.ResearchLogic; -import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.tileentity.TileEntityCrossbowBench; -import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.knowledge.KnowledgeListMF; import net.minecraft.block.Block; @@ -18,8 +16,6 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -29,34 +25,31 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockCrossbowBench extends BlockContainer -{ - public static int crossBench_RI = 110; - - public BlockCrossbowBench() - { +import java.util.Random; + +public class BlockCrossbowBench extends BlockContainer { + public static int crossBench_RI = 110; + private Random rand = new Random(); + + public BlockCrossbowBench() { super(Material.wood); GameRegistry.registerBlock(this, "MF_CrossbowCrafter"); - setBlockName("crossbowBench"); - this.setStepSound(Block.soundTypeStone); - this.setHardness(5F); - this.setResistance(2F); + setBlockName("crossbowBench"); + this.setStepSound(Block.soundTypeStone); + this.setHardness(5F); + this.setResistance(2F); this.setLightOpacity(0); this.setCreativeTab(CreativeTabMF.tabUtil); } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @@ -64,8 +57,7 @@ public boolean isOpaqueCube() * Called when the block is placed in the world. */ @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { int direction = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); @@ -75,86 +67,74 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase u * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - if(!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.crossbows)) - { - if(world.isRemote) - user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); - return false; + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + if (!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.crossbows)) { + if (world.isRemote) + user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); + return false; + } + TileEntityCrossbowBench tile = getTile(world, x, y, z); + if (tile != null && (world.isAirBlock(x, y + 1, z) || !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))) { + if (side != 1 || !tile.tryCraft(user) && !world.isRemote) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } } - TileEntityCrossbowBench tile = getTile(world, x, y, z); - if(tile != null && (world.isAirBlock(x, y+1, z) || !world.isSideSolid(x, y+1, z, ForgeDirection.DOWN))) - { - if(side != 1 || !tile.tryCraft(user) && !world.isRemote) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } return true; } + @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { - if(ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.bombs)) - { - TileEntityCrossbowBench tile = getTile(world, x, y, z); - if(tile != null) - { - tile.tryCraft(user); - } + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { + if (ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.bombs)) { + TileEntityCrossbowBench tile = getTile(world, x, y, z); + if (tile != null) { + tile.tryCraft(user); + } } } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityCrossbowBench(); - } - - private TileEntityCrossbowBench getTile(World world, int x, int y, int z) - { - return (TileEntityCrossbowBench)world.getTileEntity(x, y, z); - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityCrossbowBench tile = getTile(world, x, y, z); - - if (tile != null) - { - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityCrossbowBench(); + } + + private TileEntityCrossbowBench getTile(World world, int x, int y, int z) { + return (TileEntityCrossbowBench) world.getTileEntity(x, y, z); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityCrossbowBench tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -165,30 +145,24 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - if(side == 1) - { - return Blocks.crafting_table.getIcon(1, meta); - } - return Blocks.anvil.getIcon(0, 0); - } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } - - - @Override - public int getRenderType() - { - return crossBench_RI; - } - - private Random rand = new Random(); + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + if (side == 1) { + return Blocks.crafting_table.getIcon(1, meta); + } + return Blocks.anvil.getIcon(0, 0); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + + } + + @Override + public int getRenderType() { + return crossBench_RI; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockEngineerTanner.java b/src/main/java/minefantasy/mf2/block/crafting/BlockEngineerTanner.java index 82f322e9..36ae4b39 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockEngineerTanner.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockEngineerTanner.java @@ -4,21 +4,19 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class BlockEngineerTanner extends BlockTanningRack -{ +public class BlockEngineerTanner extends BlockTanningRack { - public BlockEngineerTanner(int tier, String tex) - { - super(tier, tex); - } - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - TileEntityTanningRack tile = getTile(world, x, y, z); - if(tile != null) - { - return tile.interact(user, false, side == 1); - } + public BlockEngineerTanner(int tier, String tex) { + super(tier, tex); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + TileEntityTanningRack tile = getTile(world, x, y, z); + if (tile != null) { + return tile.interact(user, false, side == 1); + } return true; } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockFirepit.java b/src/main/java/minefantasy/mf2/block/crafting/BlockFirepit.java index a4b9ba9a..ed0cfc53 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockFirepit.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockFirepit.java @@ -1,7 +1,5 @@ package minefantasy.mf2.block.crafting; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -11,8 +9,6 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -26,240 +22,193 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockFirepit extends BlockContainer -{ +import java.util.Random; + +public class BlockFirepit extends BlockContainer { + + public static int firepit_RI = 112; + private Random rand = new Random(); - private Random rand = new Random(); - public BlockFirepit() - { + public BlockFirepit() { super(Material.wood); setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 0.5F, 0.8F); String name = "firepit"; - this.setBlockName(name); - GameRegistry.registerBlock(this, name); + this.setBlockName(name); + GameRegistry.registerBlock(this, name); this.setLightOpacity(0); setHardness(2F); this.setCreativeTab(CreativeTabMF.tabUtil); } - - @Override - public int quantityDropped(Random rand) - { - return 0; + + @Override + public int quantityDropped(Random rand) { + return 0; } - @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) - { - if(world.isRemote) - { - return; - } - - TileEntityFirepit firepit = (TileEntityFirepit)world.getTileEntity(x, y, z); - if(firepit != null && player.getHeldItem() != null) - { + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, + float f2) { + TileEntityFirepit firepit = (TileEntityFirepit) world.getTileEntity(x, y, z); + + if (firepit != null) { + ItemStack held = player.getHeldItem(); + boolean burning = firepit.isBurning(); + + if (held != null) { + if (firepit.addFuel(held) && !player.capabilities.isCreativeMode) { + if (!world.isRemote) { + if (held.stackSize == 1) { + if (held.getItem().getContainerItem(held) != null) { + player.setCurrentItemOrArmor(0, held.getItem().getContainerItem(held)); + } else { + player.setCurrentItemOrArmor(0, null); + } + } else { + held.stackSize--; + if (held.getItem().getContainerItem(held) != null) { + if (!player.inventory.addItemStackToInventory(held.getItem().getContainerItem(held))) { + player.entityDropItem(held.getItem().getContainerItem(held), 0F); + } + } + } + } + return true; + } + + if (burning) { + if (firepit.tryCook(player, held) && !player.capabilities.isCreativeMode) { + ItemStack contain = held.getItem().getContainerItem(held); + --held.stackSize; + if (held.stackSize <= 0) { + if (contain != null) { + player.setCurrentItemOrArmor(0, contain); + } else + player.setCurrentItemOrArmor(0, null); + } else if (contain != null) { + firepit.dropItem(player, contain); + } + } + return true; + } else if (firepit.fuel > 0) { + if (held.getItem() instanceof ILighter) { + world.playSoundEffect(x + 0.5D, y - 0.5D, z + 0.5D, "fire.ignite", 1.0F, + rand.nextFloat() * 0.4F + 0.8F); + world.spawnParticle("flame", x + 0.5D, y - 0.5D, z + 0.5D, 0F, 0F, 0F); + + ILighter lighter = (ILighter) held.getItem(); + if (lighter.canLight()) { + if (rand.nextDouble() < lighter.getChance()) { + if (!world.isRemote) { + firepit.setLit(true); + held.damageItem(1, player); + } + } + return true; + } + } + if (held.getItem() instanceof ItemFlintAndSteel) { + world.playSoundEffect(x + 0.5D, y - 0.5D, z + 0.5D, "fire.ignite", 1.0F, + rand.nextFloat() * 0.4F + 0.8F); + world.spawnParticle("flame", x + 0.5D, y - 0.5D, z + 0.5D, 0F, 0F, 0F); + + if (!world.isRemote) { + firepit.setLit(true); + held.damageItem(1, player); + } + return true; + } + } + } } + return super.onBlockActivated(world, x, y, z, player, i, f, f1, f2); } - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, float f2) - { - TileEntityFirepit firepit = (TileEntityFirepit)world.getTileEntity(x, y, z); - - if(firepit != null) - { - ItemStack held = player.getHeldItem(); - boolean burning = firepit.isBurning(); - - if(held != null) - { - if(firepit.addFuel(held) && !player.capabilities.isCreativeMode) - { - if(!world.isRemote) - { - if(held.stackSize == 1) - { - if(held.getItem().getContainerItem(held) != null) - { - player.setCurrentItemOrArmor(0, held.getItem().getContainerItem(held)); - } - else - { - player.setCurrentItemOrArmor(0, null); - } - } - else - { - held.stackSize --; - if(held.getItem().getContainerItem(held) != null) - { - if(!player.inventory.addItemStackToInventory(held.getItem().getContainerItem(held))) - { - player.entityDropItem(held.getItem().getContainerItem(held), 0F); - } - } - } - } - return true; - } - - if(burning) - { - if(firepit.tryCook(player, held) && !player.capabilities.isCreativeMode) - { - ItemStack contain = held.getItem().getContainerItem(held); - --held.stackSize; - if(held.stackSize <= 0) - { - if(contain != null) - { - player.setCurrentItemOrArmor(0, contain); - } - else - player.setCurrentItemOrArmor(0, null); - } - else if(contain != null) - { - firepit.dropItem(player, contain); - } - } - return true; - } - else if(firepit.fuel > 0) - { - if(held.getItem() instanceof ILighter) - { - world.playSoundEffect((double)x + 0.5D, (double)y - 0.5D, (double)z + 0.5D, "fire.ignite", 1.0F, rand.nextFloat() * 0.4F + 0.8F); - world.spawnParticle("flame", (double)x + 0.5D, (double)y - 0.5D, (double)z + 0.5D, 0F, 0F, 0F); - - ILighter lighter = (ILighter)held.getItem(); - if(lighter.canLight()) - { - if(rand.nextDouble() < lighter.getChance()) - { - if(!world.isRemote) - { - firepit.setLit(true); - held.damageItem(1, player); - } - } - return true; - } - } - if(held.getItem() instanceof ItemFlintAndSteel) - { - world.playSoundEffect((double)x + 0.5D, (double)y - 0.5D, (double)z + 0.5D, "fire.ignite", 1.0F, rand.nextFloat() * 0.4F + 0.8F); - world.spawnParticle("flame", (double)x + 0.5D, (double)y - 0.5D, (double)z + 0.5D, 0F, 0F, 0F); - - if(!world.isRemote) - { - firepit.setLit(true); - held.damageItem(1, player); - } - return true; - } - } - } - } - return super.onBlockActivated(world, x, y, z, player, i, f, f1, f2); - } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityFirepit(); - } - - @Override - public IIcon getIcon(int side, int meta) - { - return Blocks.planks.getIcon(side, 0); + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityFirepit(); + } + + @Override + public IIcon getIcon(int side, int meta) { + return Blocks.planks.getIcon(side, 0); } - public boolean isOpaqueCube() - { + + public boolean isOpaqueCube() { return false; } - public static int firepit_RI = 112; - + @SideOnly(Side.CLIENT) - public int getRenderType() - { - return firepit_RI; + public int getRenderType() { + return firepit_RI; } - public boolean renderAsNormalBlock() - { + + public boolean renderAsNormalBlock() { return false; } - + + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random random) { + TileEntityFirepit firepit = (TileEntityFirepit) world.getTileEntity(x, y, z); + if (firepit != null && firepit.isBurning()) { + world.spawnParticle("smoke", x + 0.5D, y + 0.5D, z + 0.5D, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 0.5D, y + 0.5D, z + 0.5D, 0.0D, 0.0D, 0.0D); + world.playSound(x, y, z, "fire.fire", 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); + } + } + @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) - { - if(world.getBlockMetadata(x, y, z) == 1) - { - return 15; - } - return super.getLightValue(world, x, y, z); + public int getLightValue(IBlockAccess world, int x, int y, int z) { + if (world.getBlockMetadata(x, y, z) == 1) { + return 15; + } + return super.getLightValue(world, x, y, z); } - + @Override - public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) - { - if(world.isRemote) - { - return; - } - TileEntityFirepit tile = (TileEntityFirepit)world.getTileEntity(x, y, z); - if(entity == null || tile == null || tile.hasBlockAbove()) - { - return; - } - if(entity instanceof EntityItem) - { - entity.motionX = entity.motionY = entity.motionZ = 0; - entity.posX = x+0.5D; - entity.posY = y+0.75D; - entity.posZ = z+0.5D; - } - else - { - if(tile.isBurning()) - { - entity.attackEntityFrom(DamageSource.inFire, 1.0F); - entity.setFire(2); - } - } + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + if (world.isRemote) { + return; + } + TileEntityFirepit tile = (TileEntityFirepit) world.getTileEntity(x, y, z); + if (entity == null || tile == null || tile.hasBlockAbove()) { + return; + } + if (entity instanceof EntityItem) { + entity.motionX = entity.motionY = entity.motionZ = 0; + entity.posX = x + 0.5D; + entity.posY = y + 0.75D; + entity.posZ = z + 0.5D; + } else { + if (tile.isBurning()) { + entity.attackEntityFrom(DamageSource.inFire, 1.0F); + entity.setFire(2); + } + } } + @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityFirepit tile = (TileEntityFirepit)world.getTileEntity(x, y, z); - if(tile != null) - { - int charcoal = tile.getCharcoalDrop(); - - if(charcoal > 0) - { - float xDrop = this.rand.nextFloat() * 0.8F + 0.1F; + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityFirepit tile = (TileEntityFirepit) world.getTileEntity(x, y, z); + if (tile != null) { + int charcoal = tile.getCharcoalDrop(); + + if (charcoal > 0) { + float xDrop = this.rand.nextFloat() * 0.8F + 0.1F; float yDrop = this.rand.nextFloat() * 0.8F + 0.1F; float zDrop = this.rand.nextFloat() * 0.8F + 0.1F; - - for(int c = 0; c < charcoal; c ++) - { - EntityItem drop = new EntityItem(world, (double)((float)x + xDrop), (double)((float)y + yDrop), (double)((float)z + zDrop), new ItemStack(Items.coal, 1, 1)); + + for (int c = 0; c < charcoal; c++) { + EntityItem drop = new EntityItem(world, x + xDrop, y + yDrop, z + zDrop, + new ItemStack(Items.coal, 1, 1)); float jumpFactor = 0.05F; - drop.motionX = (double)((float)this.rand.nextGaussian() * jumpFactor); - drop.motionY = (double)((float)this.rand.nextGaussian() * jumpFactor + 0.2F); - drop.motionZ = (double)((float)this.rand.nextGaussian() * jumpFactor); + drop.motionX = (float) this.rand.nextGaussian() * jumpFactor; + drop.motionY = (float) this.rand.nextGaussian() * jumpFactor + 0.2F; + drop.motionZ = (float) this.rand.nextGaussian() * jumpFactor; world.spawnEntityInWorld(drop); - } - } - } - super.breakBlock(world, x, y, z, block, meta); + } + } + } + super.breakBlock(world, x, y, z, block, meta); } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockFrame.java b/src/main/java/minefantasy/mf2/block/crafting/BlockFrame.java index 04600a46..aec9ffb9 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockFrame.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockFrame.java @@ -12,143 +12,125 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class BlockFrame extends BasicBlockMF -{ - public boolean isCogworkHolder = false; - public BlockFrame(String name) - { - this(name, null); - } - public BlockFrame(String name, Object drop) - { - super(name, Material.iron, drop); - setBlockTextureName("minefantasy2:metal/"+name); - this.setCreativeTab(CreativeTabMF.tabGadget); - this.setHardness(1.0F); - this.setResistance(3.0F); - } - public BlockFrame setCogworkHolder() - { - isCogworkHolder = true; - this.setCreativeTab(null); - return this; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - @Override - public boolean renderAsNormalBlock() - { - return false; - } - @Override - public void setBlockBoundsForItemRender() - { - if(isCogworkHolder) - { - this.setBlockBounds(0F, 0F, 0F, 1F, 1F-offset, 1F); - return; - } - this.setBlockBounds(offset, offset, offset, 1-offset, 1-offset, 1-offset); +public class BlockFrame extends BasicBlockMF { + public static final float offset = 0.28125F; + public boolean isCogworkHolder = false; + + public BlockFrame(String name) { + this(name, null); + } + + public BlockFrame(String name, Object drop) { + super(name, Material.iron, drop); + setBlockTextureName("minefantasy2:metal/" + name); + this.setCreativeTab(CreativeTabMF.tabGadget); + this.setHardness(1.0F); + this.setResistance(3.0F); + } + + public BlockFrame setCogworkHolder() { + isCogworkHolder = true; + this.setCreativeTab(null); + return this; + } + + @Override + public boolean isOpaqueCube() { + return false; } - - public static final float offset = 0.28125F; - @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) - { - if(isCogworkHolder) - { - this.setBlockBounds(0F, 0F, 0F, 1F, 1F-offset, 1F); - return; - } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public void setBlockBoundsForItemRender() { + if (isCogworkHolder) { + this.setBlockBounds(0F, 0F, 0F, 1F, 1F - offset, 1F); + return; + } + this.setBlockBounds(offset, offset, offset, 1 - offset, 1 - offset, 1 - offset); + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { + if (isCogworkHolder) { + this.setBlockBounds(0F, 0F, 0F, 1F, 1F - offset, 1F); + return; + } boolean mz = this.canInteract(world, x, y, z - 1); boolean pz = this.canInteract(world, x, y, z + 1); boolean mx = this.canInteract(world, x - 1, y, z); boolean px = this.canInteract(world, x + 1, y, z); boolean my = this.canInteract(world, x, y - 1, z, true); boolean py = this.canInteract(world, x, y + 1, z); - + float xstart = offset; - float xend = 1-offset; + float xend = 1 - offset; float zstart = offset; - float zend = 1-offset; + float zend = 1 - offset; float ystart = offset; - float yend = 1-offset; - - - if (mz) - { + float yend = 1 - offset; + + if (mz) { zstart = 0.0F; } - if (pz) - { + if (pz) { zend = 1.0F; } - if (mx) - { + if (mx) { xstart = 0.0F; } - if (px) - { + if (px) { xend = 1.0F; } - - if (my) - { + + if (my) { ystart = 0.0F; } - if (py) - { + if (py) { yend = 1.0F; } this.setBlockBounds(xstart, ystart, zstart, xend, yend, zend); } - - - public boolean canInteract(IBlockAccess world, int x, int y, int z) - { - return canInteract(world, x, y, z, false); + + public boolean canInteract(IBlockAccess world, int x, int y, int z) { + return canInteract(world, x, y, z, false); } - public boolean canInteract(IBlockAccess world, int x, int y, int z, boolean floor) - { - if(floor && world.getBlock(x, y, z).isSideSolid(world, x, y, z, ForgeDirection.UP)) - { - return true; - } + + public boolean canInteract(IBlockAccess world, int x, int y, int z, boolean floor) { + if (floor && world.getBlock(x, y, z).isSideSolid(world, x, y, z, ForgeDirection.UP)) { + return true; + } return world.getBlock(x, y, z) instanceof BlockFrame; } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, float f2) - { - if(ToolHelper.getCrafterTool(player.getHeldItem()).equalsIgnoreCase("spanner")) - { - return tryBuild(player, world, x, y, z); - } - return false; + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, + float f2) { + if (ToolHelper.getCrafterTool(player.getHeldItem()).equalsIgnoreCase("spanner")) { + return tryBuild(player, world, x, y, z); + } + return false; + } + + private boolean tryBuild(EntityPlayer player, World world, int x, int y, int z) { + if (PowerArmour.isBasicStationFrame(world, x, y, z) + && (player.capabilities.isCreativeMode || player.inventory.hasItem(ComponentListMF.cogwork_pulley))) { + if (!player.capabilities.isCreativeMode) { + player.inventory.consumeInventoryItem(ComponentListMF.cogwork_pulley); + } + if (!world.isRemote) { + world.setBlock(x, y, z, BlockListMF.cogwork_builder, 0, 2); + } + return true; + } + return false; } - private boolean tryBuild(EntityPlayer player, World world, int x, int y, int z) - { - if(PowerArmour.isBasicStationFrame(world, x, y, z) && (player.capabilities.isCreativeMode || player.inventory.hasItem(ComponentListMF.cogwork_pulley))) - { - if(!player.capabilities.isCreativeMode) - { - player.inventory.consumeInventoryItem(ComponentListMF.cogwork_pulley); - } - if(!world.isRemote) - { - world.setBlock(x, y, z, BlockListMF.cogwork_builder, 0, 2); - } - return true; - } - return false; - } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockRepairKit.java b/src/main/java/minefantasy/mf2/block/crafting/BlockRepairKit.java index 20a2f30c..83a17171 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockRepairKit.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockRepairKit.java @@ -1,13 +1,9 @@ package minefantasy.mf2.block.crafting; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.block.tileentity.TileEntityAnvilMF; import minefantasy.mf2.item.list.CreativeTabMF; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -17,113 +13,106 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockRepairKit extends Block -{ - protected float repairLevel; - protected float successRate; - protected float breakChance; - protected IIcon top, side, bottom; - private String type; - protected boolean isOrnate = false; - protected float repairLevelEnchant = 0.0F; - - public BlockRepairKit(String name, float repairLevel, float rate, float breakChance) - { - super(Material.cloth); - - this.repairLevel = repairLevel; - this.successRate = rate; - this.breakChance = breakChance; - this.type=name; - setBlockBounds(1F/16F, 0F, 1F/16F, 15F/16F, 6F/16F, 15F/16F); - - this.setBlockTextureName("minefantasy2:processor/"+"repair_"+name+"+top"); - name = "repair_"+name; +import java.util.Random; + +public class BlockRepairKit extends Block { + protected float repairLevel; + protected float successRate; + protected float breakChance; + protected IIcon top, side, bottom; + protected boolean isOrnate = false; + protected float repairLevelEnchant = 0.0F; + private String type; + private Random rand = new Random(); + + public BlockRepairKit(String name, float repairLevel, float rate, float breakChance) { + super(Material.cloth); + + this.repairLevel = repairLevel; + this.successRate = rate; + this.breakChance = breakChance; + this.type = name; + setBlockBounds(1F / 16F, 0F, 1F / 16F, 15F / 16F, 6F / 16F, 15F / 16F); + + this.setBlockTextureName("minefantasy2:processor/" + "repair_" + name + "+top"); + name = "repair_" + name; GameRegistry.registerBlock(this, ItemBlockRepairKit.class, name); - setBlockName(name); - this.setStepSound(Block.soundTypeCloth); - this.setHardness(1F); - this.setResistance(0F); + setBlockName(name); + this.setStepSound(Block.soundTypeCloth); + this.setHardness(1F); + this.setResistance(0F); this.setLightOpacity(0); this.setCreativeTab(CreativeTabMF.tabGadget); - } - public BlockRepairKit setOrnate(float enc) - { - repairLevelEnchant = enc; - isOrnate = true; - return this; - } + } + + public BlockRepairKit setOrnate(float enc) { + repairLevelEnchant = enc; + isOrnate = true; + return this; + } - @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int meta) - { + public IIcon getIcon(int side, int meta) { return side == 1 ? this.top : (side == 0 ? this.bottom : this.side); } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister reg) - { - this.side = reg.registerIcon("minefantasy2:processor/repair_"+ type + "_side"); - this.top = reg.registerIcon("minefantasy2:processor/repair_"+ type + "_top"); - this.bottom = reg.registerIcon("minefantasy2:processor/repair_"+ type + "_base"); + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister reg) { + this.side = reg.registerIcon("minefantasy2:processor/repair_" + type + "_side"); + this.top = reg.registerIcon("minefantasy2:processor/repair_" + type + "_top"); + this.bottom = reg.registerIcon("minefantasy2:processor/repair_" + type + "_base"); } - - @Override - public boolean renderAsNormalBlock() - { + + @Override + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } - private Random rand = new Random(); + @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - if(world.isRemote) - { - return true; - } - ItemStack held = user.getHeldItem(); - //held.getItem().isRepairable() Was used but new MF tools disable this to avoid vanilla repairs - if(held != null && canRepair(held) && (!held.isItemEnchanted() || isOrnate)) - { - if(rand.nextFloat() < successRate) - { - boolean broken = rand.nextFloat() < breakChance; - - float lvl = held.isItemEnchanted() ? repairLevelEnchant : repairLevel; - int repairAmount = (int)((float)held.getMaxDamage()*lvl); - held.setItemDamage(Math.max(0, held.getItemDamage() - repairAmount)); - world.playAuxSFX(broken ? 1020 : 1021, x, y, z, 0); - - if(broken) - { - world.playSoundEffect(x+0.5D, y+0.3D, z+0.5D, "random.break", 1.0F, 1.0F); - world.setBlockToAir(x, y, z); - } - return true; - } - else - { - world.playSoundEffect(x+0.5D, y+0.3D, z+0.5D, "step.cloth", 0.5F, 0.5F); - } - return true; - } + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + if (world.isRemote) { + return true; + } + ItemStack held = user.getHeldItem(); + // held.getItem().isRepairable() Was used but new MF tools disable this to avoid + // vanilla repairs + if (held != null && canRepair(held) && (!held.isItemEnchanted() || isOrnate)) { + if (rand.nextFloat() < successRate) { + boolean broken = rand.nextFloat() < breakChance; + + float lvl = held.isItemEnchanted() ? repairLevelEnchant : repairLevel; + int repairAmount = (int) (held.getMaxDamage() * lvl); + held.setItemDamage(Math.max(0, held.getItemDamage() - repairAmount)); + world.playAuxSFX(broken ? 1020 : 1021, x, y, z, 0); + + if (broken) { + world.playSoundEffect(x + 0.5D, y + 0.3D, z + 0.5D, "random.break", 1.0F, 1.0F); + world.setBlockToAir(x, y, z); + } + return true; + } else { + world.playSoundEffect(x + 0.5D, y + 0.3D, z + 0.5D, "step.cloth", 0.5F, 0.5F); + } + return true; + } return false; } - private boolean canRepair(ItemStack held) - { - if(held == null)return false; - if(held.getItem().isDamageable() && CustomToolHelper.getCustomPrimaryMaterial(held) != null)//Custom Tool - { - return held.isItemDamaged(); - } - return held.getItem().isRepairable(); - } + + private boolean canRepair(ItemStack held) { + if (held == null) + return false; + if (held.getItem().isDamageable() && CustomToolHelper.getCustomPrimaryMaterial(held) != null)// Custom Tool + { + return held.isItemDamaged(); + } + return held.getItem().isRepairable(); + } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockResearchStation.java b/src/main/java/minefantasy/mf2/block/crafting/BlockResearchStation.java index a3049b4d..12d84373 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockResearchStation.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockResearchStation.java @@ -1,7 +1,8 @@ package minefantasy.mf2.block.crafting; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.block.tileentity.TileEntityResearch; import minefantasy.mf2.item.list.CreativeTabMF; @@ -20,36 +21,33 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockResearchStation extends BlockContainer -{ - public static int research_RI = 106; +import java.util.Random; + +public class BlockResearchStation extends BlockContainer { + public static int research_RI = 106; private int tier = 0; + private Random rand = new Random(); - public BlockResearchStation() - { + public BlockResearchStation() { super(Material.wood); - + GameRegistry.registerBlock(this, "MF_Research"); - setBlockName("researchStation"); - this.setStepSound(Block.soundTypeWood); - this.setHardness(5F); - this.setResistance(2F); + setBlockName("researchStation"); + this.setStepSound(Block.soundTypeWood); + this.setHardness(5F); + this.setResistance(2F); this.setLightOpacity(0); this.setCreativeTab(CreativeTabMF.tabUtil); } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @@ -57,8 +55,7 @@ public boolean isOpaqueCube() * Called when the block is placed in the world. */ @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { int direction = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); @@ -68,95 +65,84 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase u * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - TileEntityResearch tile = getTile(world, x, y, z); - if(tile != null && (world.isAirBlock(x, y+1, z) || !world.isSideSolid(x, y+1, z, ForgeDirection.DOWN))) - { - if(!(side == 1 && tile.interact(user))) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + TileEntityResearch tile = getTile(world, x, y, z); + if (tile != null && (world.isAirBlock(x, y + 1, z) || !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))) { + if (!(side == 1 && tile.interact(user))) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } + } return true; } + @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { - TileEntityResearch tile = getTile(world, x, y, z); - if(tile != null && (world.isAirBlock(x, y+1, z) || !world.isSideSolid(x, y+1, z, ForgeDirection.DOWN))) - { - tile.interact(user); - } + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { + TileEntityResearch tile = getTile(world, x, y, z); + if (tile != null && (world.isAirBlock(x, y + 1, z) || !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))) { + tile.interact(user); + } } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityResearch(); - } - - private TileEntityResearch getTile(World world, int x, int y, int z) - { - return (TileEntityResearch)world.getTileEntity(x, y, z); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return Blocks.crafting_table.getIcon(side, meta); - } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } - @Override - public int getRenderType() - { - return research_RI; - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityResearch tile = getTile(world, x, y, z); - - if (tile != null) - { - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityResearch(); + } + + private TileEntityResearch getTile(World world, int x, int y, int z) { + return (TileEntityResearch) world.getTileEntity(x, y, z); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return Blocks.crafting_table.getIcon(side, meta); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + + } + + @Override + public int getRenderType() { + return research_RI; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityResearch tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -167,6 +153,4 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - private Random rand = new Random(); } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockRoast.java b/src/main/java/minefantasy/mf2/block/crafting/BlockRoast.java index c0b293cb..bfa9c49d 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockRoast.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockRoast.java @@ -1,7 +1,8 @@ package minefantasy.mf2.block.crafting; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.tileentity.TileEntityRoast; import minefantasy.mf2.item.list.CreativeTabMF; import net.minecraft.block.Block; @@ -18,106 +19,92 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockRoast extends BlockContainer -{ - public static int roast_RI = 113; - private boolean isOven; - private int tier; - public String tex; - - public BlockRoast(int tier, String tex, boolean isOven) - { - super(Material.rock); - this.isOven = isOven; - this.tex = tex; - this.tier = tier; - String name = "food_"+ (isOven ? "oven" : "roast") + "_"+tex; - this.setBlockName(name); - GameRegistry.registerBlock(this, name); - this.setHardness(1.5F); - this.setResistance(1F); +import java.util.Random; + +public class BlockRoast extends BlockContainer { + public static int roast_RI = 113; + public String tex; + public Random rand = new Random(); + private boolean isOven; + private int tier; + + public BlockRoast(int tier, String tex, boolean isOven) { + super(Material.rock); + this.isOven = isOven; + this.tex = tex; + this.tier = tier; + String name = "food_" + (isOven ? "oven" : "roast") + "_" + tex; + this.setBlockName(name); + GameRegistry.registerBlock(this, name); + this.setHardness(1.5F); + this.setResistance(1F); this.setLightOpacity(0); this.setCreativeTab(CreativeTabMF.tabUtil); - if(isOven) - { - setBlockBounds(3F/16F, 0F, 3F/16F, 13F/16F, 1F/1.6F, 13F/16F); - } - else - { - setBlockBounds(3F/16F, 0F, 3F/16F, 13F/16F, 0.125F, 13F/16F); + if (isOven) { + setBlockBounds(3F / 16F, 0F, 3F / 16F, 13F / 16F, 1F / 1.6F, 13F / 16F); + } else { + setBlockBounds(3F / 16F, 0F, 3F / 16F, 13F / 16F, 0.125F, 13F / 16F); } - } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityRoast(); - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { - int dir = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityRoast(); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { + int dir = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 2); } - - public TileEntityRoast getTile(World world, int x, int y, int z) - { - return (TileEntityRoast)world.getTileEntity(x, y, z); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - TileEntityRoast tile = getTile(world, x, y, z); - if(tile != null) - { - return tile.interact(user); - } + + public TileEntityRoast getTile(World world, int x, int y, int z) { + return (TileEntityRoast) world.getTileEntity(x, y, z); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + TileEntityRoast tile = getTile(world, x, y, z); + if (tile != null) { + return tile.interact(user); + } return true; } - - public Random rand = new Random(); + @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityRoast tile = getTile(world, x, y, z); + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityRoast tile = getTile(world, x, y, z); - if (tile != null) - { + if (tile != null) { ItemStack itemstack = tile.items[0]; - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -127,38 +114,35 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return Blocks.anvil.getIcon(side, 0); + public IIcon getIcon(int side, int meta) { + return Blocks.anvil.getIcon(side, 0); } + @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } - + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + + } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } - public boolean isOven() - { - return isOven; - } - @Override - public int getRenderType() - { - return isOven ? roast_RI : super.getRenderType(); - } + + public boolean isOven() { + return isOven; + } + + @Override + public int getRenderType() { + return isOven ? roast_RI : super.getRenderType(); + } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockSalvage.java b/src/main/java/minefantasy/mf2/block/crafting/BlockSalvage.java index 1ffa2f1c..ced79a17 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockSalvage.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockSalvage.java @@ -1,23 +1,15 @@ package minefantasy.mf2.block.crafting; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.archery.AmmoMechanicsMF; import minefantasy.mf2.api.crafting.Salvage; import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.api.rpg.SkillList; -import minefantasy.mf2.block.tileentity.TileEntityAnvilMF; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.knowledge.KnowledgeListMF; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -28,196 +20,163 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockSalvage extends Block -{ - protected float dropLevel; - protected IIcon top, side, bottom; - private String type; - - public BlockSalvage(String name, float dropLevel) - { - super(Material.wood); - - this.dropLevel = dropLevel; - this.type=name; - - this.setBlockTextureName("minefantasy2:processor/"+"salvage_"+name+"+top"); - name = "salvage_"+name; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +public class BlockSalvage extends Block { + protected float dropLevel; + protected IIcon top, side, bottom; + private String type; + private Random rand = new Random(); + + public BlockSalvage(String name, float dropLevel) { + super(Material.wood); + + this.dropLevel = dropLevel; + this.type = name; + + this.setBlockTextureName("minefantasy2:processor/" + "salvage_" + name + "+top"); + name = "salvage_" + name; GameRegistry.registerBlock(this, ItemBlockSalvage.class, name); - setBlockName(name); - this.setStepSound(Block.soundTypeAnvil); - this.setHardness(2F); - this.setResistance(1F); + setBlockName(name); + this.setStepSound(Block.soundTypeAnvil); + this.setHardness(2F); + this.setResistance(1F); this.setCreativeTab(CreativeTabMF.tabGadget); - } + } + + public static float getPlayerDropLevel(EntityPlayer user) { + float rate = 1.0F; + + if (RPGElements.isSystemActive) { + int lvl = RPGElements.getLevel(user, SkillList.artisanry); + if (lvl > 10) { + rate += ((lvl - 10) * 0.01F); + } + } + if (ResearchLogic.hasInfoUnlocked(user, "scrapper")) { + rate += 0.5F; + } - @SideOnly(Side.CLIENT) + return rate; + } + + @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int meta) - { + public IIcon getIcon(int side, int meta) { return side == 1 ? this.top : (side == 0 ? this.bottom : this.side); } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister reg) - { - this.side = reg.registerIcon("minefantasy2:processor/salvage_"+ type + "_side"); - this.top = reg.registerIcon("minefantasy2:processor/salvage_"+ type + "_top"); - this.bottom = reg.registerIcon("minefantasy2:processor/salvage_"+ type + "_base"); + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister reg) { + this.side = reg.registerIcon("minefantasy2:processor/salvage_" + type + "_side"); + this.top = reg.registerIcon("minefantasy2:processor/salvage_" + type + "_top"); + this.bottom = reg.registerIcon("minefantasy2:processor/salvage_" + type + "_base"); } - - private Random rand = new Random(); + @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - if(world.isRemote) - { - return true; - } - ItemStack held = user.getHeldItem(); - String toolType = ToolHelper.getCrafterTool(held); - - /* - Block above = world.getBlock(x, y+1, z); - if(above != null) - { - if(salvageBlock(world, user, above, x, y, z)) - { - world.setBlockToAir(x, y+1, z); - return true; - } - } - */ - - EntityItem drop = getDrop(world, x, y, z); - if(drop != null && !user.isSwingInProgress) - { - ItemStack junk = drop.getEntityItem(); - int amount = Math.min(junk.stackSize, 4); - - for(int a = 0; a < amount; a++) - { - if(salvageItem(world, user, junk, x, y, z)) - { - if(junk.stackSize == 1) - { - AmmoMechanicsMF.dropAmmo(world, junk, x+0.5D, y+1.25D, z+0.5D); - AmmoMechanicsMF.dropAmmoCrate(world, junk, x+0.5D, y+1.25D, z+0.5D); - } - - --drop.getEntityItem().stackSize; - if(drop.getEntityItem().stackSize <= 0) - { - drop.setDead(); - return true; - } - } - } - return true; - } + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + if (world.isRemote) { + return true; + } + ItemStack held = user.getHeldItem(); + String toolType = ToolHelper.getCrafterTool(held); + + /* + * Block above = world.getBlock(x, y+1, z); if(above != null) { + * if(salvageBlock(world, user, above, x, y, z)) { world.setBlockToAir(x, y+1, + * z); return true; } } + */ + + EntityItem drop = getDrop(world, x, y, z); + if (drop != null && !user.isSwingInProgress) { + ItemStack junk = drop.getEntityItem(); + int amount = Math.min(junk.stackSize, 4); + + for (int a = 0; a < amount; a++) { + if (salvageItem(world, user, junk, x, y, z)) { + if (junk.stackSize == 1) { + AmmoMechanicsMF.dropAmmo(world, junk, x + 0.5D, y + 1.25D, z + 0.5D); + AmmoMechanicsMF.dropAmmoCrate(world, junk, x + 0.5D, y + 1.25D, z + 0.5D); + } + + --drop.getEntityItem().stackSize; + if (drop.getEntityItem().stackSize <= 0) { + drop.setDead(); + return true; + } + } + } + return true; + } + return false; + } + /* + * private boolean salvageBlock(World world, EntityPlayer user, Block junk, int + * x, int y, int z) { List salvage = Salvage.salvageBlock(junk, + * dropLevel); + * + * if(salvage != null) { dropSalvage(world, x, y, z, salvage); + * world.playAuxSFX(1021, x, y, z, 0); return true; } return false; } + */ + + private boolean salvageItem(World world, EntityPlayer user, ItemStack junk, int x, int y, int z) { + float modifier = 0.5F; + ItemStack held = user.getHeldItem(); + String type = ToolHelper.getCrafterTool(held); + float efficiency = ToolHelper.getCrafterEfficiency(held); + if (type.equalsIgnoreCase("saw")) { + modifier += (efficiency * 0.1F); + world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "minefantasy2:block.sawcarpenter", 2F, 1F); + } + if (type.equalsIgnoreCase("hammer") || type.equalsIgnoreCase("hvyhammer")) { + modifier += (efficiency * 0.05F); + world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "minefantasy2:block.anvilsucceed", 1F, 1F); + } + + List salvage = Salvage.salvage(user, junk, dropLevel * getPlayerDropLevel(user) * modifier); + + if (salvage != null) { + dropSalvage(world, x, y, z, salvage, junk); + world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "random.break", 1F, 1F); + world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "mob.zombie.woodbreak", 0.5F, 1.5F); + world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "dig.glass", 1.0F, 0.5F); + return true; + } return false; } - private boolean salvageItem(World world, EntityPlayer user, ItemStack junk, int x, int y, int z) - { - float modifier = 0.5F; - ItemStack held = user.getHeldItem(); - String type = ToolHelper.getCrafterTool(held); - float efficiency = ToolHelper.getCrafterEfficiency(held); - if(type.equalsIgnoreCase("saw")) - { - modifier += (efficiency*0.1F); - world.playSoundEffect(x+0.5, y+0.5, z+0.5, "minefantasy2:block.sawcarpenter", 2F, 1F); - } - if(type.equalsIgnoreCase("hammer") || type.equalsIgnoreCase("hvyhammer")) - { - modifier += (efficiency*0.05F); - world.playSoundEffect(x+0.5, y+0.5, z+0.5, "minefantasy2:block.anvilsucceed", 1F, 1F); - } - - List salvage = Salvage.salvage(user, junk, dropLevel * getPlayerDropLevel(user) * modifier); - - if(salvage != null) - { - dropSalvage(world, x, y, z, salvage, junk); - world.playSoundEffect(x+0.5, y+0.5, z+0.5, "random.break", 1F, 1F); - world.playSoundEffect(x+0.5, y+0.5, z+0.5, "mob.zombie.woodbreak", 0.5F, 1.5F); - world.playSoundEffect(x+0.5, y+0.5, z+0.5, "dig.glass", 1.0F, 0.5F); - return true; - } - return false; - } - /* - private boolean salvageBlock(World world, EntityPlayer user, Block junk, int x, int y, int z) - { - List salvage = Salvage.salvageBlock(junk, dropLevel); - - if(salvage != null) - { - dropSalvage(world, x, y, z, salvage); - world.playAuxSFX(1021, x, y, z, 0); - return true; - } - return false; - } - */ - - public static float getPlayerDropLevel(EntityPlayer user) - { - float rate = 1.0F; - - if(RPGElements.isSystemActive) - { - int lvl = RPGElements.getLevel(user, SkillList.artisanry); - if(lvl > 10) - { - rate += ( (lvl-10) *0.01F); - } - } - if(ResearchLogic.hasInfoUnlocked(user, "scrapper")) - { - rate += 0.5F; - } - - return rate; - } - - private void dropSalvage(World world, int x, int y, int z, List salvage, ItemStack junk) - { - Iterator iterator = salvage.iterator(); - while(iterator.hasNext()) - { - ItemStack drop = (ItemStack) iterator.next(); - if(drop != null)// && !user.inventory.addItemStackToInventory(drop)) - { - entityDropItem(world, x, y, z, drop); - } - } - } - public EntityItem entityDropItem(World world, int x, int y, int z, ItemStack item) - { - if (item.stackSize != 0 && item.getItem() != null) - { - EntityItem entityitem = new EntityItem(world, x+0.5D, y+1.25D, z+0.5D, item); + private void dropSalvage(World world, int x, int y, int z, List salvage, ItemStack junk) { + Iterator iterator = salvage.iterator(); + while (iterator.hasNext()) { + ItemStack drop = (ItemStack) iterator.next(); + if (drop != null)// && !user.inventory.addItemStackToInventory(drop)) + { + entityDropItem(world, x, y, z, drop); + } + } + } + + public EntityItem entityDropItem(World world, int x, int y, int z, ItemStack item) { + if (item.stackSize != 0 && item.getItem() != null) { + EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.25D, z + 0.5D, item); entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); return entityitem; - } - else - { + } else { return null; } } - - private EntityItem getDrop(World world, int x, int y, int z) - { - AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x+0.1D, y+1D, z+0.1D, x+0.9D, y+1.5D, z+0.9D); - Listdrops = world.getEntitiesWithinAABB(EntityItem.class, box); - if(drops != null && !drops.isEmpty()) - { - return ((EntityItem)drops.get(0)); - } - return null; - } + + private EntityItem getDrop(World world, int x, int y, int z) { + AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x + 0.1D, y + 1D, z + 0.1D, x + 0.9D, y + 1.5D, z + 0.9D); + List drops = world.getEntitiesWithinAABB(EntityItem.class, box); + if (drops != null && !drops.isEmpty()) { + return (drops.get(0)); + } + return null; + } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/BlockTanningRack.java b/src/main/java/minefantasy/mf2/block/crafting/BlockTanningRack.java index 7d7f5d0c..9b899629 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/BlockTanningRack.java +++ b/src/main/java/minefantasy/mf2/block/crafting/BlockTanningRack.java @@ -1,7 +1,8 @@ package minefantasy.mf2.block.crafting; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.tileentity.TileEntityTanningRack; import minefantasy.mf2.item.list.CreativeTabMF; import net.minecraft.block.Block; @@ -18,107 +19,95 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockTanningRack extends BlockContainer -{ - public static int tanner_RI = 103; - - public int tier; - public String tex; - public BlockTanningRack(int tier, String tex) - { - super(Material.wood); - - this.tier=tier; - this.tex=tex; - String name = "tanner"+tex; - this.setBlockName(name); - GameRegistry.registerBlock(this, name); - this.setHardness(1F + 0.5F*tier); - this.setResistance(1F); +import java.util.Random; + +public class BlockTanningRack extends BlockContainer { + public static int tanner_RI = 103; + + public int tier; + public String tex; + public Random rand = new Random(); + + public BlockTanningRack(int tier, String tex) { + super(Material.wood); + + this.tier = tier; + this.tex = tex; + String name = "tanner" + tex; + this.setBlockName(name); + GameRegistry.registerBlock(this, name); + this.setHardness(1F + 0.5F * tier); + this.setResistance(1F); this.setLightOpacity(0); this.setCreativeTab(CreativeTabMF.tabUtil); - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityTanningRack(tier, tex); - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { - int dir = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityTanningRack(tier, tex); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { + int dir = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 2); } - - public TileEntityTanningRack getTile(World world, int x, int y, int z) - { - return (TileEntityTanningRack)world.getTileEntity(x, y, z); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - TileEntityTanningRack tile = getTile(world, x, y, z); - if(tile != null) - { - return tile.interact(user, false, false); - } + + public TileEntityTanningRack getTile(World world, int x, int y, int z) { + return (TileEntityTanningRack) world.getTileEntity(x, y, z); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + TileEntityTanningRack tile = getTile(world, x, y, z); + if (tile != null) { + return tile.interact(user, false, false); + } return true; } + @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { - TileEntityTanningRack tile = getTile(world, x, y, z); - if(tile != null) - { - tile.interact(user, true, false); - } + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { + TileEntityTanningRack tile = getTile(world, x, y, z); + if (tile != null) { + tile.interact(user, true, false); + } } - - public Random rand = new Random(); + @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityTanningRack tile = getTile(world, x, y, z); + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityTanningRack tile = getTile(world, x, y, z); - if (tile != null) - { + if (tile != null) { ItemStack itemstack = tile.items[0]; - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -128,35 +117,31 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return Blocks.planks.getIcon(side, 0); + public IIcon getIcon(int side, int meta) { + return Blocks.planks.getIcon(side, 0); } + @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } - + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + + } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } - + @Override - public int getRenderType() - { - return tanner_RI; - } + public int getRenderType() { + return tanner_RI; + } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/ItemBlockAnvilMF.java b/src/main/java/minefantasy/mf2/block/crafting/ItemBlockAnvilMF.java index 758b47ea..43433a68 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/ItemBlockAnvilMF.java +++ b/src/main/java/minefantasy/mf2/block/crafting/ItemBlockAnvilMF.java @@ -1,26 +1,24 @@ package minefantasy.mf2.block.crafting; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class ItemBlockAnvilMF extends ItemBlock -{ - private BlockAnvilMF anvil; - public ItemBlockAnvilMF(Block block) - { - super(block); - this.anvil = (BlockAnvilMF) block; - } +import java.util.List; + +public class ItemBlockAnvilMF extends ItemBlock { + private BlockAnvilMF anvil; + + public ItemBlockAnvilMF(Block block) { + super(block); + this.anvil = (BlockAnvilMF) block; + } - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - list.add(StatCollector.translateToLocal("attribute.mfcrafttier.name") + ": " + anvil.getTier()); - super.addInformation(item, user, list, extra); - } + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + list.add(StatCollector.translateToLocal("attribute.mfcrafttier.name") + ": " + anvil.getTier()); + super.addInformation(item, user, list, extra); + } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/ItemBlockRepairKit.java b/src/main/java/minefantasy/mf2/block/crafting/ItemBlockRepairKit.java index b5199829..e172aad6 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/ItemBlockRepairKit.java +++ b/src/main/java/minefantasy/mf2/block/crafting/ItemBlockRepairKit.java @@ -1,7 +1,5 @@ package minefantasy.mf2.block.crafting; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -9,44 +7,43 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class ItemBlockRepairKit extends ItemBlock -{ - private BlockRepairKit kit; - public ItemBlockRepairKit(Block base) - { - super(base); - this.setMaxStackSize(8); - this.kit = (BlockRepairKit)base; - } +import java.util.List; + +public class ItemBlockRepairKit extends ItemBlock { + private BlockRepairKit kit; + + public ItemBlockRepairKit(Block base) { + super(base); + this.setMaxStackSize(8); + this.kit = (BlockRepairKit) base; + } + + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (kit.isOrnate) { + list.add(StatCollector.translateToLocal("attribute.kit.repairRate_normal.name") + ": " + + kit.repairLevel * 100F + "%"); + list.add(StatCollector.translateToLocal("attribute.kit.repairRate_enchant.name") + ": " + + kit.repairLevelEnchant * 100F + "%"); + } else { + list.add(StatCollector.translateToLocal("attribute.kit.repairRate.name") + ": " + kit.repairLevel * 100F + + "%"); + } + list.add(StatCollector.translateToLocal("attribute.kit.repairChance.name") + ": " + kit.successRate * 100F + + "%"); + list.add( + StatCollector.translateToLocal("attribute.kit.breakChance.name") + ": " + kit.breakChance * 100F + "%"); + super.addInformation(item, user, list, extra); + } - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(kit.isOrnate) - { - list.add(StatCollector.translateToLocal("attribute.kit.repairRate_normal.name") + ": " + kit.repairLevel*100F + "%"); - list.add(StatCollector.translateToLocal("attribute.kit.repairRate_enchant.name") + ": " + kit.repairLevelEnchant*100F + "%"); - } - else - { - list.add(StatCollector.translateToLocal("attribute.kit.repairRate.name") + ": " + kit.repairLevel*100F + "%"); - } - list.add(StatCollector.translateToLocal("attribute.kit.repairChance.name") + ": " + kit.successRate*100F + "%"); - list.add(StatCollector.translateToLocal("attribute.kit.breakChance.name") + ": " + kit.breakChance*100F + "%"); - super.addInformation(item, user, list, extra); - } - - @Override - public EnumRarity getRarity(ItemStack item) - { - if(kit.isOrnate) - { - return EnumRarity.rare; - } - if(kit.repairLevel >= 1.0F) - { - return EnumRarity.uncommon; - } - return super.getRarity(item); - } + @Override + public EnumRarity getRarity(ItemStack item) { + if (kit.isOrnate) { + return EnumRarity.rare; + } + if (kit.repairLevel >= 1.0F) { + return EnumRarity.uncommon; + } + return super.getRarity(item); + } } diff --git a/src/main/java/minefantasy/mf2/block/crafting/ItemBlockSalvage.java b/src/main/java/minefantasy/mf2/block/crafting/ItemBlockSalvage.java index 08dfc6eb..9753af5a 100644 --- a/src/main/java/minefantasy/mf2/block/crafting/ItemBlockSalvage.java +++ b/src/main/java/minefantasy/mf2/block/crafting/ItemBlockSalvage.java @@ -1,7 +1,5 @@ package minefantasy.mf2.block.crafting; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -9,26 +7,25 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class ItemBlockSalvage extends ItemBlock -{ - private BlockSalvage kit; - public ItemBlockSalvage(Block base) - { - super(base); - this.setMaxStackSize(8); - this.kit = (BlockSalvage)base; - } +import java.util.List; + +public class ItemBlockSalvage extends ItemBlock { + private BlockSalvage kit; + + public ItemBlockSalvage(Block base) { + super(base); + this.setMaxStackSize(8); + this.kit = (BlockSalvage) base; + } + + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + list.add(StatCollector.translateToLocal("attribute.kit.salvage.name") + ": " + kit.dropLevel); + super.addInformation(item, user, list, extra); + } - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - list.add(StatCollector.translateToLocal("attribute.kit.salvage.name") + ": " + kit.dropLevel); - super.addInformation(item, user, list, extra); - } - - @Override - public EnumRarity getRarity(ItemStack item) - { - return super.getRarity(item); - } + @Override + public EnumRarity getRarity(ItemStack item) { + return super.getRarity(item); + } } diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockAmmoBox.java b/src/main/java/minefantasy/mf2/block/decor/BlockAmmoBox.java index cebc8941..46abeca9 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockAmmoBox.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockAmmoBox.java @@ -1,8 +1,5 @@ package minefantasy.mf2.block.decor; -import java.util.ArrayList; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -21,169 +18,156 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BlockAmmoBox extends BlockWoodDecor -{ - public static int ammo_RI = 116; - /** - * Food-Ammo-All - */ - public final byte storageType; - public String name; - - public BlockAmmoBox(String name, byte storageType) - { - this(name, name, storageType); - } - /** - * @param storageType (Food, Ammo, All) - */ - public BlockAmmoBox(String name, String texName, byte storageType) - { - super(texName); - this.storageType = storageType; - float width = (storageType == 0 ? 8F : storageType == 1 ? 14F : 16F) / 16F; - float height = (storageType == 0 ? 4F : storageType == 1 ? 8F : 9F ) / 16F; - - float border = (1F-width)/2; - this.setBlockBounds(border, 0F, border, 1-border, height, 1-border); - - this.name=name; - GameRegistry.registerBlock(this, ItemBlockAmmoBox.class, name); - setBlockName(name); - this.setHardness(0.5F); - this.setResistance(2F); +import java.util.ArrayList; +import java.util.Random; + +public class BlockAmmoBox extends BlockWoodDecor { + public static final String NBT_Ammo = "Ammo", NBT_Stock = "Stock"; + public static int ammo_RI = 116; + /** + * Food-Ammo-All + */ + public final byte storageType; + public String name; + private Random rand = new Random(); + + public BlockAmmoBox(String name, byte storageType) { + this(name, name, storageType); + } + + /** + * @param storageType (Food, Ammo, All) + */ + public BlockAmmoBox(String name, String texName, byte storageType) { + super(texName); + this.storageType = storageType; + float width = (storageType == 0 ? 8F : storageType == 1 ? 14F : 16F) / 16F; + float height = (storageType == 0 ? 4F : storageType == 1 ? 8F : 9F) / 16F; + + float border = (1F - width) / 2; + this.setBlockBounds(border, 0F, border, 1 - border, height, 1 - border); + + this.name = name; + GameRegistry.registerBlock(this, ItemBlockAmmoBox.class, name); + setBlockName(name); + this.setHardness(0.5F); + this.setResistance(2F); this.setCreativeTab(CreativeTabMF.tabUtil); - } - - @Override - public boolean isOpaqueCube() - { + } + + public static ItemStack getHeld(ItemStack item, boolean removeTag) { + if (item.hasTagCompound() && item.getTagCompound().hasKey(NBT_Ammo)) { + ItemStack i = ItemStack.loadItemStackFromNBT(item.getTagCompound().getCompoundTag(NBT_Ammo)); + if (removeTag) { + item.getTagCompound().removeTag(NBT_Ammo); + } + return i; + } + return null; + } + + public static int getStock(ItemStack item, boolean removeTag) { + if (item.hasTagCompound() && item.getTagCompound().hasKey(NBT_Stock)) { + int i = item.getTagCompound().getInteger(NBT_Stock); + if (removeTag) { + item.getTagCompound().removeTag(NBT_Stock); + } + return i; + } + return 0; + } + + @Override + public boolean isOpaqueCube() { return false; } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } + @Override - public IIcon getIcon(int side, int meta) - { - return Blocks.planks.getIcon(side, 0); + public IIcon getIcon(int side, int meta) { + return Blocks.planks.getIcon(side, 0); } + @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } @SideOnly(Side.CLIENT) - public int getRenderType() - { - return ammo_RI; + public void registerBlockIcons(IIconRegister reg) { + } - public static final String NBT_Ammo = "Ammo", NBT_Stock = "Stock"; + + @SideOnly(Side.CLIENT) + public int getRenderType() { + return ammo_RI; + } + @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { - int direction = MathHelper.floor_double((double)(user.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { + int direction = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); - + TileEntityAmmoBox tile = getTile(world, x, y, z); - if(tile != null) - { - if(item.hasTagCompound() && item.getTagCompound().hasKey(NBT_Ammo) && item.getTagCompound().hasKey(NBT_Stock)) - { - tile.ammo = ItemStack.loadItemStackFromNBT(item.getTagCompound().getCompoundTag(NBT_Ammo)); - tile.stock = item.getTagCompound().getInteger(NBT_Stock); - } + if (tile != null) { + if (item.hasTagCompound() && item.getTagCompound().hasKey(NBT_Ammo) + && item.getTagCompound().hasKey(NBT_Stock)) { + tile.ammo = ItemStack.loadItemStackFromNBT(item.getTagCompound().getCompoundTag(NBT_Ammo)); + tile.stock = item.getTagCompound().getInteger(NBT_Stock); + } } super.onBlockPlacedBy(world, x, y, z, user, item); } - public static ItemStack getHeld(ItemStack item, boolean removeTag) - { - if(item.hasTagCompound() && item.getTagCompound().hasKey(NBT_Ammo)) - { - ItemStack i = ItemStack.loadItemStackFromNBT(item.getTagCompound().getCompoundTag(NBT_Ammo)); - if(removeTag) - { - item.getTagCompound().removeTag(NBT_Ammo); - } - return i; - } - return null; - } - public static int getStock(ItemStack item, boolean removeTag) - { - if(item.hasTagCompound() && item.getTagCompound().hasKey(NBT_Stock)) - { - int i = item.getTagCompound().getInteger(NBT_Stock); - if(removeTag) - { - item.getTagCompound().removeTag(NBT_Stock); - } - return i; - } - return 0; - } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityAmmoBox(); - } - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - ItemStack held = user.getHeldItem(); - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityAmmoBox) - { - return ((TileEntityAmmoBox)tile).interact(user, held); - } - return false; - } - private Random rand = new Random(); - - @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) - { + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityAmmoBox(); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + ItemStack held = user.getHeldItem(); + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityAmmoBox) { + return ((TileEntityAmmoBox) tile).interact(user, held); + } + return false; + } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList ret = new ArrayList(); return ret; } - - @Override - protected ItemStack modifyDrop(TileEntityWoodDecor tile, ItemStack item) - { - return modifyAmmo((TileEntityAmmoBox)tile, super.modifyDrop(tile, item)); - } - - private ItemStack modifyAmmo(TileEntityAmmoBox tile, ItemStack item) - { - if(tile != null && item != null) - { - if(tile.ammo != null) - { - NBTTagCompound nbt = new NBTTagCompound(); - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - tile.ammo.writeToNBT(nbt); - - MFLogUtil.logDebug("Added Drop: " + tile.ammo.getDisplayName() + " x" + tile.stock); - item.getTagCompound().setTag(NBT_Ammo, nbt); - item.getTagCompound().setInteger(NBT_Stock, tile.stock); - } - } - return item; - } - - private TileEntityAmmoBox getTile(World world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityAmmoBox) - { - return (TileEntityAmmoBox)tile; - } - return null; - } + + @Override + protected ItemStack modifyDrop(TileEntityWoodDecor tile, ItemStack item) { + return modifyAmmo((TileEntityAmmoBox) tile, super.modifyDrop(tile, item)); + } + + private ItemStack modifyAmmo(TileEntityAmmoBox tile, ItemStack item) { + if (tile != null && item != null) { + if (tile.ammo != null) { + NBTTagCompound nbt = new NBTTagCompound(); + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + tile.ammo.writeToNBT(nbt); + + MFLogUtil.logDebug("Added Drop: " + tile.ammo.getDisplayName() + " x" + tile.stock); + item.getTagCompound().setTag(NBT_Ammo, nbt); + item.getTagCompound().setInteger(NBT_Stock, tile.stock); + } + } + return item; + } + + private TileEntityAmmoBox getTile(World world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityAmmoBox) { + return (TileEntityAmmoBox) tile; + } + return null; + } } diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockBedMF.java b/src/main/java/minefantasy/mf2/block/decor/BlockBedMF.java index 49ec64ff..2577c1ed 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockBedMF.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockBedMF.java @@ -1,12 +1,8 @@ package minefantasy.mf2.block.decor; -import java.util.Iterator; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.mechanics.PlayerTickHandlerMF; import net.minecraft.block.Block; @@ -16,8 +12,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChunkCoordinates; @@ -27,9 +21,11 @@ import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -public class BlockBedMF extends BlockDirectional -{ - public static final int[][] field_149981_a = new int[][] {{0, 1}, { -1, 0}, {0, -1}, {1, 0}}; +import java.util.Iterator; +import java.util.Random; + +public class BlockBedMF extends BlockDirectional { + public static final int[][] field_149981_a = new int[][]{{0, 1}, {-1, 0}, {0, -1}, {1, 0}}; @SideOnly(Side.CLIENT) private IIcon[] endTex; @SideOnly(Side.CLIENT) @@ -38,70 +34,110 @@ public class BlockBedMF extends BlockDirectional private IIcon[] topTex; @SideOnly(Side.CLIENT) private IIcon baseTex; - + private float height = 0.25F; - public BlockBedMF(String name) - { + public BlockBedMF(String name) { super(Material.cloth); this.setBlockName(name); - GameRegistry.registerBlock(this, name+"_block"); - setBlockTextureName("minefantasy2:furnishings/"+name); + GameRegistry.registerBlock(this, name + "_block"); + setBlockTextureName("minefantasy2:furnishings/" + name); this.resetBounds(); } + /** + * Returns whether or not this bed block is the head of the bed. + */ + public static boolean isBlockHeadOfBed(int meta) { + return (meta & 8) != 0; + } + + public static boolean func_149976_c(int meta) { + return (meta & 4) != 0; + } + + public static void setState(World world, int x, int y, int z, boolean flag) { + int l = world.getBlockMetadata(x, y, z); + + if (flag) { + l |= 4; + } else { + l &= -5; + } + + world.setBlockMetadataWithNotify(x, y, z, l, 4); + } + + public static ChunkCoordinates findBedside(World world, int x, int y, int z, int counter) { + int i1 = world.getBlockMetadata(x, y, z); + int j1 = BlockDirectional.getDirection(i1); + + for (int k1 = 0; k1 <= 1; ++k1) { + int l1 = x - field_149981_a[j1][0] * k1 - 1; + int i2 = z - field_149981_a[j1][1] * k1 - 1; + int j2 = l1 + 2; + int k2 = i2 + 2; + + for (int l2 = l1; l2 <= j2; ++l2) { + for (int i3 = i2; i3 <= k2; ++i3) { + if (World.doesBlockHaveSolidTopSurface(world, l2, y - 1, i3) + && !world.getBlock(l2, y, i3).getMaterial().isOpaque() + && !world.getBlock(l2, y + 1, i3).getMaterial().isOpaque()) { + if (counter <= 0) { + return new ChunkCoordinates(l2, y, i3); + } + + --counter; + } + } + } + } + + return null; + } + /** * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int meta, float fx, float fy, float fz) - { - if (world.isRemote) - { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int meta, float fx, float fy, + float fz) { + if (world.isRemote) { return true; - } - else - { + } else { int i1 = world.getBlockMetadata(x, y, z); - if (!isBlockHeadOfBed(i1)) - { + if (!isBlockHeadOfBed(i1)) { int j1 = getDirection(i1); x += field_149981_a[j1][0]; z += field_149981_a[j1][1]; - if (world.getBlock(x, y, z) != this) - { + if (world.getBlock(x, y, z) != this) { return true; } i1 = world.getBlockMetadata(x, y, z); } - if (world.provider.canRespawnHere() && world.getBiomeGenForCoords(x, z) != BiomeGenBase.hell) - { - if (func_149976_c(i1)) - { + if (world.provider.canRespawnHere() && world.getBiomeGenForCoords(x, z) != BiomeGenBase.hell) { + if (func_149976_c(i1)) { EntityPlayer entityplayer1 = null; Iterator iterator = world.playerEntities.iterator(); - while (iterator.hasNext()) - { - EntityPlayer entityplayer2 = (EntityPlayer)iterator.next(); + while (iterator.hasNext()) { + EntityPlayer entityplayer2 = (EntityPlayer) iterator.next(); - if (entityplayer2.isPlayerSleeping()) - { + if (entityplayer2.isPlayerSleeping()) { ChunkCoordinates chunkcoordinates = entityplayer2.playerLocation; - if (chunkcoordinates.posX == x && chunkcoordinates.posY == y && chunkcoordinates.posZ == z) - { + if (chunkcoordinates.posX == x && chunkcoordinates.posY == y + && chunkcoordinates.posZ == z) { entityplayer1 = entityplayer2; } } } - if (entityplayer1 != null) - { + if (entityplayer1 != null) { user.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0])); return true; } @@ -111,45 +147,36 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer u EntityPlayer.EnumStatus enumstatus = user.sleepInBedAt(x, y, z); - if (enumstatus == EntityPlayer.EnumStatus.OK) - { + if (enumstatus == EntityPlayer.EnumStatus.OK) { setState(world, x, y, z, true); PlayerTickHandlerMF.readyToResetBedPosition(user); return true; - } - else - { - if (enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW) - { + } else { + if (enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW) { user.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0])); - } - else if (enumstatus == EntityPlayer.EnumStatus.NOT_SAFE) - { + } else if (enumstatus == EntityPlayer.EnumStatus.NOT_SAFE) { user.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0])); } return true; } - } - else - { - double d2 = (double)x + 0.5D; - double d0 = (double)y + 0.5D; - double d1 = (double)z + 0.5D; + } else { + double d2 = x + 0.5D; + double d0 = y + 0.5D; + double d1 = z + 0.5D; world.setBlockToAir(x, y, z); int k1 = getDirection(i1); x += field_149981_a[k1][0]; z += field_149981_a[k1][1]; - if (world.getBlock(x, y, z) == this) - { + if (world.getBlock(x, y, z) == this) { world.setBlockToAir(x, y, z); - d2 = (d2 + (double)x + 0.5D) / 2.0D; - d0 = (d0 + (double)y + 0.5D) / 2.0D; - d1 = (d1 + (double)z + 0.5D) / 2.0D; + d2 = (d2 + x + 0.5D) / 2.0D; + d0 = (d0 + y + 0.5D) / 2.0D; + d1 = (d1 + z + 0.5D) / 2.0D; } - world.newExplosion((Entity)null, (double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), 5.0F, true, true); + world.newExplosion((Entity) null, x + 0.5F, y + 0.5F, z + 0.5F, 5.0F, true, true); return true; } } @@ -160,28 +187,27 @@ else if (enumstatus == EntityPlayer.EnumStatus.NOT_SAFE) */ @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int meta) - { - if (side == 0) - { + public IIcon getIcon(int side, int meta) { + if (side == 0) { return baseTex; - } - else - { + } else { int k = getDirection(meta); int l = Direction.bedDirection[k][side]; int i1 = isBlockHeadOfBed(meta) ? 1 : 0; - return (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? this.topTex[i1] : this.sideTex[i1]) : this.endTex[i1]; + return (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? this.topTex[i1] : this.sideTex[i1]) + : this.endTex[i1]; } } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister register) - { - this.topTex = new IIcon[] {register.registerIcon(this.getTextureName() + "_feet_top"), register.registerIcon(this.getTextureName() + "_head_top")}; - this.endTex = new IIcon[] {register.registerIcon(this.getTextureName() + "_feet_end"), register.registerIcon(this.getTextureName() + "_head_end")}; - this.sideTex = new IIcon[] {register.registerIcon(this.getTextureName() + "_feet_side"), register.registerIcon(this.getTextureName() + "_head_side")}; + public void registerBlockIcons(IIconRegister register) { + this.topTex = new IIcon[]{register.registerIcon(this.getTextureName() + "_feet_top"), + register.registerIcon(this.getTextureName() + "_head_top")}; + this.endTex = new IIcon[]{register.registerIcon(this.getTextureName() + "_feet_end"), + register.registerIcon(this.getTextureName() + "_head_end")}; + this.sideTex = new IIcon[]{register.registerIcon(this.getTextureName() + "_feet_side"), + register.registerIcon(this.getTextureName() + "_head_side")}; this.baseTex = register.registerIcon(this.getTextureName() + "_base"); } @@ -189,27 +215,26 @@ public void registerBlockIcons(IIconRegister register) * The type of render function that is called for this block */ @Override - public int getRenderType() - { + public int getRenderType() { return 14; } /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + * If this block doesn't render as an ordinary block it will return False + * (examples: signs, buttons, stairs, etc) */ @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } /** - * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two - * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or + * not to render the shared face of two adjacent blocks and also whether the + * player can attach torches, redstone wire, etc to this block. */ @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @@ -217,133 +242,61 @@ public boolean isOpaqueCube() * Updates the blocks bounds based on its current state. Args: world, x, y, z */ @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) - { + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { this.resetBounds(); } /** - * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are - * their own) Args: x, y, z, neighbor Block + * Lets the block know when one of its neighbor changes. Doesn't know which + * neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor + * Block */ @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbour) - { + public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbour) { int l = world.getBlockMetadata(x, y, z); int i1 = getDirection(l); - if (isBlockHeadOfBed(l)) - { - if (world.getBlock(x - field_149981_a[i1][0], y, z - field_149981_a[i1][1]) != this) - { + if (isBlockHeadOfBed(l)) { + if (world.getBlock(x - field_149981_a[i1][0], y, z - field_149981_a[i1][1]) != this) { world.setBlockToAir(x, y, z); } - } - else if (world.getBlock(x + field_149981_a[i1][0], y, z + field_149981_a[i1][1]) != this) - { + } else if (world.getBlock(x + field_149981_a[i1][0], y, z + field_149981_a[i1][1]) != this) { world.setBlockToAir(x, y, z); - if (!world.isRemote) - { + if (!world.isRemote) { this.dropBlockAsItem(world, x, y, z, l, 0); } } } @Override - public Item getItemDropped(int meta, Random rand, int fortune) - { + public Item getItemDropped(int meta, Random rand, int fortune) { /** * Returns whether or not this bed block is the head of the bed. */ return isBlockHeadOfBed(meta) ? Item.getItemById(0) : ToolListMF.bedroll; } - private void resetBounds() - { + private void resetBounds() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, height, 1.0F); } - /** - * Returns whether or not this bed block is the head of the bed. - */ - public static boolean isBlockHeadOfBed(int meta) - { - return (meta & 8) != 0; - } - - public static boolean func_149976_c(int meta) - { - return (meta & 4) != 0; - } - - public static void setState(World world, int x, int y, int z, boolean flag) - { - int l = world.getBlockMetadata(x, y, z); - - if (flag) - { - l |= 4; - } - else - { - l &= -5; - } - - world.setBlockMetadataWithNotify(x, y, z, l, 4); - } - - public static ChunkCoordinates findBedside(World world, int x, int y, int z, int counter) - { - int i1 = world.getBlockMetadata(x, y, z); - int j1 = BlockDirectional.getDirection(i1); - - for (int k1 = 0; k1 <= 1; ++k1) - { - int l1 = x - field_149981_a[j1][0] * k1 - 1; - int i2 = z - field_149981_a[j1][1] * k1 - 1; - int j2 = l1 + 2; - int k2 = i2 + 2; - - for (int l2 = l1; l2 <= j2; ++l2) - { - for (int i3 = i2; i3 <= k2; ++i3) - { - if (World.doesBlockHaveSolidTopSurface(world, l2, y - 1, i3) && !world.getBlock(l2, y, i3).getMaterial().isOpaque() && !world.getBlock(l2, y + 1, i3).getMaterial().isOpaque()) - { - if (counter <= 0) - { - return new ChunkCoordinates(l2, y, i3); - } - - --counter; - } - } - } - } - - return null; - } - /** * Drops the block items with a specified chance of dropping the specified items */ @Override - public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float f, int i) - { - if (!isBlockHeadOfBed(meta)) - { + public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float f, int i) { + if (!isBlockHeadOfBed(meta)) { super.dropBlockAsItemWithChance(world, x, y, z, meta, f, 0); } } /** - * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility - * and stop pistons + * Returns the mobility information of the block, 0 = free, 1 = can't push but + * can move over, 2 = total immobility and stop pistons */ @Override - public int getMobilityFlag() - { + public int getMobilityFlag() { return 1; } @@ -352,8 +305,7 @@ public int getMobilityFlag() */ @SideOnly(Side.CLIENT) @Override - public Item getItem(World world, int x, int y, int z) - { + public Item getItem(World world, int x, int y, int z) { return ToolListMF.bedroll; } @@ -361,24 +313,21 @@ public Item getItem(World world, int x, int y, int z) * Called when the block is attempted to be harvested */ @Override - public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer user) - { - if (user.capabilities.isCreativeMode && isBlockHeadOfBed(meta)) - { + public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer user) { + if (user.capabilities.isCreativeMode && isBlockHeadOfBed(meta)) { int i1 = getDirection(meta); x -= field_149981_a[i1][0]; z -= field_149981_a[i1][1]; - if (world.getBlock(x, y, z) == this) - { + if (world.getBlock(x, y, z) == this) { world.setBlockToAir(x, y, z); } } } + @Override - public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player) - { - return true; + public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player) { + return true; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockComponent.java b/src/main/java/minefantasy/mf2/block/decor/BlockComponent.java index 90aaafce..66298eb5 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockComponent.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockComponent.java @@ -1,15 +1,10 @@ package minefantasy.mf2.block.decor; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.tileentity.TileEntityComponent; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -29,278 +24,257 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class BlockComponent extends BlockContainer -{ - public static int component_RI = 118; - - public BlockComponent() - { - super(Material.circuits); - GameRegistry.registerBlock(this, ItemBlockAmmoBox.class, "MF_ComponentStorage"); - setBlockName(""); - this.setHardness(1F); - this.setResistance(1F); - this.setBlockBounds(1/16F, 0F, 1/16F, 15/16F, 12/16F, 15/16F); - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - @Override - public boolean renderAsNormalBlock() - { - return false; - } - @Override - public IIcon getIcon(int side, int meta) - { - return Blocks.iron_block.getIcon(side, 0); - } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } - @SideOnly(Side.CLIENT) - public int getRenderType() - { - return component_RI; +import java.util.Random; + +public class BlockComponent extends BlockContainer { + public static int component_RI = 118; + private Random rand = new Random(); + + public BlockComponent() { + super(Material.circuits); + GameRegistry.registerBlock(this, ItemBlockAmmoBox.class, "MF_ComponentStorage"); + setBlockName(""); + this.setHardness(1F); + this.setResistance(1F); + this.setBlockBounds(1 / 16F, 0F, 1 / 16F, 15 / 16F, 12 / 16F, 15 / 16F); } - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { - int direction = MathHelper.floor_double((double)(user.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - world.setBlockMetadataWithNotify(x, y, z, direction, 2); + + private static TileEntityComponent getTile(World world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityComponent) { + return (TileEntityComponent) tile; + } + return null; } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityComponent(); - } - @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { - useBlock(world, x, y, z, user, true); - } - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - useBlock(world, x, y, z, user, false); - return true; + + public static int placeComponent(EntityPlayer user, ItemStack item, World world, int x, int y, int z, String type, + String tex, int dir) { + if (world.isAirBlock(x, y, z) && canBuildOn(world, x, y - 1, z)) { + world.setBlock(x, y, z, BlockListMF.components, dir, 2); + + int max = getStorageSize(type); + int size = user.isSneaking() ? Math.min(item.stackSize, max) : 1; + + TileEntityComponent tile = new TileEntityComponent(); + ItemStack newitem = item.copy(); + newitem.stackSize = 1; + tile.setItem(newitem, type, tex, max, size); + world.setTileEntity(x, y, z, tile); + return size; + } + return 0; } - private void useBlock(World world, int x, int y, int z, EntityPlayer user, boolean leftClick) - { - ItemStack held = user.getHeldItem(); - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityComponent) - { - ((TileEntityComponent)tile).interact(user, held, leftClick); - } + + public static boolean canBuildOn(World world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityComponent) { + return ((TileEntityComponent) tile).isFull(); + } + return world.isSideSolid(x, y, z, ForgeDirection.UP); } - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityComponent) - { - ((TileEntityComponent)tile).checkStack(); - } - } - private Random rand = new Random(); - - private static TileEntityComponent getTile(World world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityComponent) - { - return (TileEntityComponent)tile; - } - return null; - } - - public static int placeComponent(EntityPlayer user, ItemStack item, World world, int x, int y, int z, String type, String tex, int dir) - { - if(world.isAirBlock(x, y, z) && canBuildOn(world, x, y-1, z)) - { - world.setBlock(x, y, z, BlockListMF.components, dir, 2); - - int max = getStorageSize(type); - int size = user.isSneaking() ? Math.min(item.stackSize, max) : 1; - - TileEntityComponent tile = new TileEntityComponent(); - ItemStack newitem = item.copy(); - newitem.stackSize = 1; - tile.setItem(newitem, type, tex, max, size); - world.setTileEntity(x, y, z, tile); - return size; - } - return 0; - } - - public static boolean canBuildOn(World world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityComponent) - { - return ((TileEntityComponent)tile).isFull(); - } - return world.isSideSolid(x, y, z, ForgeDirection.UP); - } - - public static int useComponent(ItemStack item, String type, String tex, World world, EntityPlayer user, MovingObjectPosition movingobjectposition) - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + + public static int useComponent(ItemStack item, String type, String tex, World world, EntityPlayer user, + MovingObjectPosition movingobjectposition) { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; - if (movingobjectposition.sideHit == 0) - { + if (movingobjectposition.sideHit == 0) { --j; } - if (movingobjectposition.sideHit == 1) - { + if (movingobjectposition.sideHit == 1) { ++j; } - if (movingobjectposition.sideHit == 2) - { + if (movingobjectposition.sideHit == 2) { --k; } - if (movingobjectposition.sideHit == 3) - { + if (movingobjectposition.sideHit == 3) { ++k; } - if (movingobjectposition.sideHit == 4) - { + if (movingobjectposition.sideHit == 4) { --i; } - if (movingobjectposition.sideHit == 5) - { + if (movingobjectposition.sideHit == 5) { ++i; } - if (user.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) - { - int l = MathHelper.floor_double((double)(user.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + if (user.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { + int l = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; return placeComponent(user, item, user.worldObj, i, j, k, type, tex, l); } } - return 0; - } - - public static int getStorageSize(String id) - { - if(id == null)return 0; - - if(id.equalsIgnoreCase("bar")) return 64; - if(id.equalsIgnoreCase("plank")) return 64; - if(id.equalsIgnoreCase("pot")) return 64; - if(id.equalsIgnoreCase("jug")) return 32; - if(id.equalsIgnoreCase("sheet")) return 16; - if(id.equalsIgnoreCase("bigplate")) return 8; - - return 0; - } - - @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityComponent) - { - if(((TileEntityComponent)tile).item != null) - { - ItemStack item = ((TileEntityComponent)tile).item.copy(); - item.stackSize = 1; - return item; - } - } - return null; + return 0; + } + + public static int getStorageSize(String id) { + if (id == null) + return 0; + + if (id.equalsIgnoreCase("bar")) + return 64; + if (id.equalsIgnoreCase("plank")) + return 64; + if (id.equalsIgnoreCase("pot")) + return 64; + if (id.equalsIgnoreCase("jug")) + return 32; + if (id.equalsIgnoreCase("sheet")) + return 16; + if (id.equalsIgnoreCase("bigplate")) + return 8; + + return 0; } - @Override - public Item getItemDropped(int meta, Random rand, int fortune) - { - return null; + + @Override + public boolean isOpaqueCube() { + return false; } - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public IIcon getIcon(int side, int meta) { + return Blocks.iron_block.getIcon(side, 0); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + + } + + @SideOnly(Side.CLIENT) + public int getRenderType() { + return component_RI; + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { + int direction = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + world.setBlockMetadataWithNotify(x, y, z, direction, 2); + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityComponent(); + } + + @Override + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { + useBlock(world, x, y, z, user, true); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + useBlock(world, x, y, z, user, false); + return true; + } + + private void useBlock(World world, int x, int y, int z, EntityPlayer user, boolean leftClick) { + ItemStack held = user.getHeldItem(); + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityComponent) { + ((TileEntityComponent) tile).interact(user, held, leftClick); + } + } + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityComponent) { + ((TileEntityComponent) tile).checkStack(); + } + } + + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityComponent) - { - TileEntityComponent component = (TileEntityComponent)tile; - - if(component.item != null) - { - while(component.stackSize > 0) - { - ItemStack drop = component.item.copy(); - int count = Math.min(component.stackSize, drop.getMaxStackSize()); - drop.stackSize = count; - component.stackSize -= count; - dropItem(world, x, y, z, drop); - } - } - } + if (tile != null && tile instanceof TileEntityComponent) { + if (((TileEntityComponent) tile).item != null) { + ItemStack item = ((TileEntityComponent) tile).item.copy(); + item.stackSize = 1; + return item; + } + } + return null; + } + + @Override + public Item getItemDropped(int meta, Random rand, int fortune) { + return null; } - private void dropItem(World world, int x, int y, int z, ItemStack itemstack) - { - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityComponent) { + TileEntityComponent component = (TileEntityComponent) tile; + + if (component.item != null) { + while (component.stackSize > 0) { + ItemStack drop = component.item.copy(); + int count = Math.min(component.stackSize, drop.getMaxStackSize()); + drop.stackSize = count; + component.stackSize -= count; + dropItem(world, x, y, z, drop); + } + } + } + } + + private void dropItem(World world, int x, int y, int z, ItemStack itemstack) { + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } - } - - private AxisAlignedBB getBoundingBox(World world, int x, int y, int z) - { - float height = 1.0F; - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityComponent) - { - height = ((TileEntityComponent)tile).getBlockHeight(); - } - return AxisAlignedBB.getBoundingBox(x + 0.0625D, y + 0D, z + 0.0625D, x + 0.9375D, y + height, z + 0.9375D); - } - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) - { - return getBoundingBox(world, x, y, z); + } + + private AxisAlignedBB getBoundingBox(World world, int x, int y, int z) { + float height = 1.0F; + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityComponent) { + height = ((TileEntityComponent) tile).getBlockHeight(); + } + return AxisAlignedBB.getBoundingBox(x + 0.0625D, y + 0D, z + 0.0625D, x + 0.9375D, y + height, z + 0.9375D); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + return getBoundingBox(world, x, y, z); } /** @@ -308,8 +282,7 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, */ @SideOnly(Side.CLIENT) @Override - public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) - { - return getBoundingBox(world, x, y, z); + public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { + return getBoundingBox(world, x, y, z); } } diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockPowRailMF.java b/src/main/java/minefantasy/mf2/block/decor/BlockPowRailMF.java index 8594a665..2a5acdb8 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockPowRailMF.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockPowRailMF.java @@ -1,38 +1,36 @@ package minefantasy.mf2.block.decor; +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.block.Block; import net.minecraft.block.BlockRailPowered; import net.minecraft.entity.item.EntityMinecart; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -public class BlockPowRailMF extends BlockRailPowered -{ - private BaseMaterialMF baseMat; - private boolean isPowered = true; - public BlockPowRailMF(BaseMaterialMF material) - { - this(material, material.name.toLowerCase()); +public class BlockPowRailMF extends BlockRailPowered { + private BaseMaterialMF baseMat; + private boolean isPowered = true; + + public BlockPowRailMF(BaseMaterialMF material) { + this(material, material.name.toLowerCase()); } - public BlockPowRailMF(BaseMaterialMF material, String type) - { + + public BlockPowRailMF(BaseMaterialMF material, String type) { super(); String name = type + "_rail"; - GameRegistry.registerBlock(this, name); - setBlockName(name); - this.setBlockTextureName("minefantasy2:mechanical/"+name); - - this.setHarvestLevel("pickaxe", material.harvestLevel); - this.setStepSound(Block.soundTypeMetal); - this.setHardness(material.hardness+1 / 2F); - this.setResistance(material.hardness+1); - this.baseMat = material; + GameRegistry.registerBlock(this, name); + setBlockName(name); + this.setBlockTextureName("minefantasy2:mechanical/" + name); + + this.setHarvestLevel("pickaxe", material.harvestLevel); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(material.hardness + 1 / 2F); + this.setResistance(material.hardness + 1); + this.baseMat = material; } - + @Override - public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) - { + public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) { return 0.8F; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockRack.java b/src/main/java/minefantasy/mf2/block/decor/BlockRack.java index e925258f..11b692b5 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockRack.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockRack.java @@ -1,27 +1,15 @@ package minefantasy.mf2.block.decor; -import static net.minecraftforge.common.util.ForgeDirection.EAST; -import static net.minecraftforge.common.util.ForgeDirection.NORTH; -import static net.minecraftforge.common.util.ForgeDirection.SOUTH; -import static net.minecraftforge.common.util.ForgeDirection.WEST; - -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.api.helpers.BlockPositionHelper; import minefantasy.mf2.block.tileentity.decor.TileEntityRack; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.network.packet.RackCommand; import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -32,39 +20,101 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; + +import java.util.Random; + +import static net.minecraftforge.common.util.ForgeDirection.*; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class BlockRack extends BlockWoodDecor -{ - - private Random rand = new Random(); +public class BlockRack extends BlockWoodDecor { + public static int rack_RI = 115; - private static final float thickness = 5F/16F; - public BlockRack(String name) - { + public BlockRack(String name) { super(name); - + setHardness(1.0F); setResistance(1.0F); GameRegistry.registerBlock(this, ItemBlockToolRack.class, name); - setBlockName(name); - this.setCreativeTab(CreativeTabMF.tabUtil); + setBlockName(name); + this.setCreativeTab(CreativeTabMF.tabUtil); + } + + /** + * Convert standard South, West, North, East to rack's (North, South, East, + * West) + */ + public static int getDirection(int dir) { + int[] directions = new int[]{3, 4, 2, 5}; + return directions[Math.min(3, dir)]; + } + + public static boolean interact(int slot, World world, TileEntityRack tile, EntityPlayer player) { + if (player.isSneaking()) { + player.openGui(MineFantasyII.instance, 0, world, tile.xCoord, tile.yCoord, tile.zCoord); + return false; + } + + ItemStack held = player.getHeldItem(); + if (held == null) { + ItemStack hung = tile.getStackInSlot(slot); + if (hung != null) { + if (!world.isRemote) { + player.setCurrentItemOrArmor(0, hung); + tile.setInventorySlotContents(slot, null); + tile.syncItems(); + } + player.swingItem(); + return true; + } + } else { + ItemStack hung = tile.getStackInSlot(slot); + + if (hung == null && tile.canHang(player.getHeldItem(), slot)) { + if (!world.isRemote) { + tile.setInventorySlotContents(slot, player.getHeldItem().copy()); + player.setCurrentItemOrArmor(0, null); + tile.syncItems(); + } + player.swingItem(); + return true; + } else if (held != null && hung != null) { + if (hung.isItemEqual(held)) { + int space = hung.getMaxStackSize() - hung.stackSize; + + if (held.stackSize > space) { + if (!world.isRemote) { + held.stackSize -= space; + hung.stackSize += space; + } + player.swingItem(); + return true; + } else { + if (!world.isRemote) { + hung.stackSize += held.stackSize; + player.setCurrentItemOrArmor(0, null); + } + player.swingItem(); + return true; + } + } + } + } + player.openGui(MineFantasyII.instance, 0, world, tile.xCoord, tile.yCoord, tile.zCoord); + return false; } /** - * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been - * cleared to be reused) + * Returns a bounding box from the pool of bounding boxes (this means this box + * can change after the pool has been cleared to be reused) */ @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) - { + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, + int p_149668_4_) { this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_); return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_); } @@ -73,8 +123,8 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_14 * Updates the blocks bounds based on its current state. Args: world, x, y, z */ @Override - public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) - { + public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, + int p_149719_4_) { this.modifyBoundingbox(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_)); } @@ -83,111 +133,96 @@ public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_ */ @SideOnly(Side.CLIENT) @Override - public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_) - { + public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, + int p_149633_4_) { this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_); return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_); } - public void modifyBoundingbox(int meta) - { + public void modifyBoundingbox(int meta) { float f = 0.25F; - if (meta == 2) - { + if (meta == 2) { this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); } - if (meta == 3) - { + if (meta == 3) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); } - if (meta == 4) - { + if (meta == 4) { this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - if (meta == 5) - { + if (meta == 5) { this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); } } /** - * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two - * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or + * not to render the shared face of two adjacent blocks and also whether the + * player can attach torches, redstone wire, etc to this block. */ @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + * If this block doesn't render as an ordinary block it will return False + * (examples: signs, buttons, stairs, etc) */ @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - public static int rack_RI = 115; + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, + * side, hitX, hitY, hitZ, block metadata + */ /** * The type of render function that is called for this block */ @Override - public int getRenderType() - { + public int getRenderType() { return rack_RI; } /** - * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + * Checks to see if its valid to put this block at the specified coordinates. + * Args: world, x, y, z */ @Override - public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) - { - return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) || - p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) || - p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) || - p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH); + public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { + return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST) + || p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST) + || p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) + || p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH); } - /** - * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata - */ - /** - * Convert standard South, West, North, East to rack's (North, South, East, West) - */ - public static int getDirection(int dir) - { - int[] directions = new int[]{3, 4, 2, 5}; - return directions[Math.min(3, dir)]; - } @Override - public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) - { + public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, + float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) { int j1 = p_149660_9_; - if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) - { + if ((p_149660_9_ == 0 || p_149660_5_ == 2) + && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) { j1 = 2; } - if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) - { + if ((j1 == 0 || p_149660_5_ == 3) + && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) { j1 = 3; } - if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) - { + if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) { j1 = 4; } - if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) - { + if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) { j1 = 5; } @@ -195,42 +230,36 @@ public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, in } /** - * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are - * their own) Args: x, y, z, neighbor Block + * Lets the block know when one of its neighbor changes. Doesn't know which + * neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor + * Block */ @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityRack) - { - ((TileEntityRack)tile).updateInventory(); - } + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityRack) { + ((TileEntityRack) tile).updateInventory(); + } int l = world.getBlockMetadata(x, y, z); boolean flag = false; - if (l == 2 && world.isSideSolid(x, y, z + 1, NORTH)) - { + if (l == 2 && world.isSideSolid(x, y, z + 1, NORTH)) { flag = true; } - if (l == 3 && world.isSideSolid(x, y, z - 1, SOUTH)) - { + if (l == 3 && world.isSideSolid(x, y, z - 1, SOUTH)) { flag = true; } - if (l == 4 && world.isSideSolid(x + 1, y, z, WEST)) - { + if (l == 4 && world.isSideSolid(x + 1, y, z, WEST)) { flag = true; } - if (l == 5 && world.isSideSolid(x - 1, y, z, EAST)) - { + if (l == 5 && world.isSideSolid(x - 1, y, z, EAST)) { flag = true; } - if (!flag) - { + if (!flag) { this.dropBlockAsItem(world, x, y, z, l, 0); world.setBlockToAir(x, y, z); } @@ -242,20 +271,17 @@ public void onNeighborBlockChange(World world, int x, int y, int z, Block block) * Returns the quantity of items to drop on block destruction. */ @Override - public int quantityDropped(Random rand) - { + public int quantityDropped(Random rand) { return 1; } @Override - public IIcon getIcon(int side, int meta) - { - return Blocks.planks.getIcon(side, 0); + public IIcon getIcon(int side, int meta) { + return Blocks.planks.getIcon(side, 0); } - + @Override - public TileEntity createNewTileEntity(World world, int m) - { + public TileEntity createNewTileEntity(World world, int m) { return new TileEntityRack(); } @@ -263,38 +289,37 @@ public TileEntity createNewTileEntity(World world, int m) * Called whenever the block is removed. */ @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityRack tile = (TileEntityRack) world.getTileEntity(x, y, z); + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityRack tile = (TileEntityRack) world.getTileEntity(x, y, z); - if (tile != null) - { + if (tile != null) { for (int var6 = 0; var6 < tile.getSizeInventory(); ++var6) { ItemStack var7 = tile.getStackInSlot(var6); if (var7 != null) { - float var8 = this.rand.nextFloat() * 0.8F + 0.1F; - float var9 = this.rand.nextFloat() * 0.8F + 0.1F; - float var10 = this.rand.nextFloat() * 0.8F + 0.1F; + float var8 = world.rand.nextFloat() * 0.8F + 0.1F; + float var9 = world.rand.nextFloat() * 0.8F + 0.1F; + float var10 = world.rand.nextFloat() * 0.8F + 0.1F; while (var7.stackSize > 0) { - int var11 = this.rand.nextInt(21) + 10; + int var11 = world.rand.nextInt(21) + 10; if (var11 > var7.stackSize) { var11 = var7.stackSize; } var7.stackSize -= var11; - EntityItem var12 = new EntityItem(world, (double) ((float) x + var8), (double) ((float) y + var9), (double) ((float) z + var10), new ItemStack(var7.getItem(), var11, var7.getItemDamage())); + EntityItem var12 = new EntityItem(world, x + var8, y + var9, z + var10, + new ItemStack(var7.getItem(), var11, var7.getItemDamage())); if (var7.hasTagCompound()) { var12.getEntityItem().setTagCompound((NBTTagCompound) var7.getTagCompound().copy()); } float var13 = 0.05F; - var12.motionX = (double) ((float) this.rand.nextGaussian() * var13); - var12.motionY = (double) ((float) this.rand.nextGaussian() * var13 + 0.2F); - var12.motionZ = (double) ((float) this.rand.nextGaussian() * var13); + var12.motionX = (float) world.rand.nextGaussian() * var13; + var12.motionY = (float) world.rand.nextGaussian() * var13 + 0.2F; + var12.motionZ = (float) world.rand.nextGaussian() * var13; world.spawnEntityInWorld(var12); } } @@ -304,102 +329,27 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int i, float f, float f1, float f2) - { - TileEntityRack tile = (TileEntityRack)world.getTileEntity(x, y, z); - if(world.isRemote) - { - int slot = tile.getSlotFor(f, f2); - if(slot >= 0 && slot < 4) - { - ((EntityClientPlayerMP)user).sendQueue.addToSendQueue(new RackCommand(slot, user, tile).generatePacket()); - } - } - + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int i, float f, float f1, + float f2) { + TileEntityRack tile = (TileEntityRack) world.getTileEntity(x, y, z); + if (world.isRemote) { + int slot = tile.getSlotFor(f, f2); + if (slot >= 0 && slot < 4) { + ((EntityClientPlayerMP) user).sendQueue + .addToSendQueue(new RackCommand(slot, user, tile).generatePacket()); + } + } + return true; } - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg){} - - - public static boolean interact(int slot, World world, TileEntityRack tile, EntityPlayer player) - { - if(player.isSneaking()) - { - player.openGui(MineFantasyII.instance, 0, world, tile.xCoord, tile.yCoord, tile.zCoord); - return false; - } - - ItemStack held = player.getHeldItem(); - if(held == null) - { - ItemStack hung = tile.getStackInSlot(slot); - if(hung != null) - { - if(!world.isRemote) - { - player.setCurrentItemOrArmor(0, hung); - tile.setInventorySlotContents(slot, null); - tile.syncItems(); - } - player.swingItem(); - return true; - } - } - else - { - ItemStack hung = tile.getStackInSlot(slot); - - if(hung == null && tile.canHang(player.getHeldItem(), slot)) - { - if(!world.isRemote) - { - tile.setInventorySlotContents(slot, player.getHeldItem().copy()); - player.setCurrentItemOrArmor(0, null); - tile.syncItems(); - } - player.swingItem(); - return true; - } - else if(held != null && hung != null) - { - if(hung.isItemEqual(held)) - { - int space = hung.getMaxStackSize() - hung.stackSize; - - if(held.stackSize > space) - { - if(!world.isRemote) - { - held.stackSize -= space; - hung.stackSize += space; - } - player.swingItem(); - return true; - } - else - { - if(!world.isRemote) - { - hung.stackSize += held.stackSize; - player.setCurrentItemOrArmor(0, null); - } - player.swingItem(); - return true; - } - } - } - } - player.openGui(MineFantasyII.instance, 0, world, tile.xCoord, tile.yCoord, tile.zCoord); - return false; - } @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister reg) - { + public void registerIcons(IIconRegister reg) { + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister reg) { } } diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockRailMF.java b/src/main/java/minefantasy/mf2/block/decor/BlockRailMF.java index d92f452e..3d8cf831 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockRailMF.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockRailMF.java @@ -1,43 +1,36 @@ package minefantasy.mf2.block.decor; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.block.Block; import net.minecraft.block.BlockRail; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class BlockRailMF extends BlockRail -{ - private BaseMaterialMF baseMat; - private boolean isPowered = true; - public BlockRailMF(BaseMaterialMF material) - { - this(material, material.name.toLowerCase()); +public class BlockRailMF extends BlockRail { + private BaseMaterialMF baseMat; + private boolean isPowered = true; + + public BlockRailMF(BaseMaterialMF material) { + this(material, material.name.toLowerCase()); } - public BlockRailMF(BaseMaterialMF material, String type) - { + + public BlockRailMF(BaseMaterialMF material, String type) { super(); String name = type + "_rail"; - GameRegistry.registerBlock(this, name); - setBlockName(name); - this.setBlockTextureName("minefantasy2:mechanical/"+name); - - this.setHarvestLevel("pickaxe", material.harvestLevel); - this.setStepSound(Block.soundTypeMetal); - this.setHardness(material.hardness+1 / 2F); - this.setResistance(material.hardness+1); - this.baseMat = material; + GameRegistry.registerBlock(this, name); + setBlockName(name); + this.setBlockTextureName("minefantasy2:mechanical/" + name); + + this.setHarvestLevel("pickaxe", material.harvestLevel); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(material.hardness + 1 / 2F); + this.setResistance(material.hardness + 1); + this.baseMat = material; } - + @Override - public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) - { + public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) { return 0.8F; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockRoad.java b/src/main/java/minefantasy/mf2/block/decor/BlockRoad.java index ef65419a..91ebda4f 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockRoad.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockRoad.java @@ -1,14 +1,11 @@ package minefantasy.mf2.block.decor; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.tileentity.TileEntityRoad; import minefantasy.mf2.item.tool.advanced.ItemMattock; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -26,247 +23,212 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockRoad extends BlockContainer -{ - public BlockRoad(String name, float f) - { +import java.util.Random; + +public class BlockRoad extends BlockContainer { + public BlockRoad(String name, float f) { super(Material.ground); this.setStepSound(Block.soundTypeGravel); - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f/16F, 1.0F); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f / 16F, 1.0F); this.setLightOpacity(0); GameRegistry.registerBlock(this, name); - setBlockName(name); - setHardness(0.5F); + setBlockName(name); + setHardness(0.5F); } - - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) - { - if(this == BlockListMF.lowroad) - return AxisAlignedBB.getBoundingBox((double)(x + 0), (double)(y + 0), (double)(z + 0), (double)(x + 1), (double)(y + 0.5), (double)(z + 1)); - - return AxisAlignedBB.getBoundingBox((double)(x + 0), (double)(y + 0), (double)(z + 0), (double)(x + 1), (double)(y + 1), (double)(z + 1)); + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + if (this == BlockListMF.lowroad) + return AxisAlignedBB.getBoundingBox(x + 0, y + 0, z + 0, x + 1, y + 0.5, z + 1); + + return AxisAlignedBB.getBoundingBox(x + 0, y + 0, z + 0, x + 1, y + 1, z + 1); } - + @Override - public IIcon getIcon(int side, int meta) - { - return meta == 1 ? Blocks.sand.getIcon(side, 0) : Blocks.dirt.getIcon(side, 0); + public IIcon getIcon(int side, int meta) { + return meta == 1 ? Blocks.sand.getIcon(side, 0) : Blocks.dirt.getIcon(side, 0); } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityRoad) - { - if(((TileEntityRoad)tile).surface[0] > 0) - { - Block surface = ((TileEntityRoad)tile).getBaseBlock(); - int surface_m = ((TileEntityRoad)tile).surface[1]; - return surface.getIcon(side, surface_m); - } - } + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityRoad) { + if (((TileEntityRoad) tile).surface[0] > 0) { + Block surface = ((TileEntityRoad) tile).getBaseBlock(); + int surface_m = ((TileEntityRoad) tile).surface[1]; + return surface.getIcon(side, surface_m); + } + } return this.getIcon(side, world.getBlockMetadata(x, y, z)); } /** - * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two - * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or + * not to render the shared face of two adjacent blocks and also whether the + * player can attach torches, redstone wire, etc to this block. */ - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } - + /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + * If this block doesn't render as an ordinary block it will return False + * (examples: signs, buttons, stairs, etc) */ - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - + @Override - public void onBlockAdded(World world, int x, int y, int z) - { - this.updateTick(world, x, y, z, new Random()); - super.onBlockAdded(world, x, y, z); + public void onBlockAdded(World world, int x, int y, int z) { + this.updateTick(world, x, y, z, new Random()); + super.onBlockAdded(world, x, y, z); } - + @Override - public void updateTick(World world, int x, int y, int z, Random random) - { - if(world.getBlock(x, y-1, z) == Blocks.grass) - { - world.setBlock(x, y-1, z, Blocks.dirt, 0, 2); - } - super.updateTick(world, x, y, z, random); + public void updateTick(World world, int x, int y, int z, Random random) { + if (world.getBlock(x, y - 1, z) == Blocks.grass) { + world.setBlock(x, y - 1, z, Blocks.dirt, 0, 2); + } + super.updateTick(world, x, y, z, random); } - + @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, float f2) - { - TileEntityRoad tile = getTile(world, x, y, z); - if(tile == null)return false; - - boolean isLocked = tile.isLocked; + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, + float f2) { + TileEntityRoad tile = getTile(world, x, y, z); + if (tile == null) + return false; + + boolean isLocked = tile.isLocked; ItemStack itemstack = player.getHeldItem(); - if(itemstack != null) - { - if(!player.canPlayerEdit(x, y, z, i, itemstack)) - { - return false; - } - if(!isLocked) - { - Block block = Block.getBlockFromItem(itemstack.getItem()); - if(itemstack.getItem() instanceof ItemBlock && block != null) - { - if(upgradeRoad(world, x, y, z, 4, itemstack, block)) - { - if(!player.capabilities.isCreativeMode && !world.isRemote) - { - itemstack.stackSize --; - if(itemstack.stackSize <= 0) - { - player.setCurrentItemOrArmor(0, null); - } - } - return true; - } - } - - if(itemstack.getItem() instanceof ItemSpade) - { - if(this == BlockListMF.road) - { - if(!world.isRemote) - { - int m = world.getBlockMetadata(x, y, z); - world.setBlock(x, y, z, BlockListMF.lowroad, m, 2); - } - return true; - } - } - } - if(!world.isRemote && itemstack.getItem() instanceof ItemMattock) - { - toggleLocks(world, x, y, z, 4); - } + if (itemstack != null) { + if (!player.canPlayerEdit(x, y, z, i, itemstack)) { + return false; + } + if (!isLocked) { + Block block = Block.getBlockFromItem(itemstack.getItem()); + if (itemstack.getItem() instanceof ItemBlock && block != null) { + if (upgradeRoad(world, x, y, z, 4, itemstack, block)) { + if (!player.capabilities.isCreativeMode && !world.isRemote) { + itemstack.stackSize--; + if (itemstack.stackSize <= 0) { + player.setCurrentItemOrArmor(0, null); + } + } + return true; + } + } + + if (itemstack.getItem() instanceof ItemSpade) { + if (this == BlockListMF.road) { + if (!world.isRemote) { + int m = world.getBlockMetadata(x, y, z); + world.setBlock(x, y, z, BlockListMF.lowroad, m, 2); + } + return true; + } + } + } + if (!world.isRemote && itemstack.getItem() instanceof ItemMattock) { + toggleLocks(world, x, y, z, 4); + } } return !tile.isLocked; } - private TileEntityRoad getTile(World world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityRoad) - { - return (TileEntityRoad)tile; - } - return null; - } + private TileEntityRoad getTile(World world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityRoad) { + return (TileEntityRoad) tile; + } + return null; + } - @Override - public Item getItemDropped(int meta, Random rand, int fortune) - { - Block drop = meta == 1 ? Blocks.sand : Blocks.dirt; - return Item.getItemFromBlock(drop); + @Override + public Item getItemDropped(int meta, Random rand, int fortune) { + Block drop = meta == 1 ? Blocks.sand : Blocks.dirt; + return Item.getItemFromBlock(drop); } + /** * Resets the Texture + * * @param ID the block right clicked with * @return */ - private boolean upgradeRoad(World world, int x, int y, int z, int r, ItemStack held, Block block) - { - if(!block.isNormalCube()) - { - return false; - } - if(held == null) - { - return false; - } - boolean flag = false; - - for(int x2 = -r; x2 <= r; x2 ++) - { - for(int y2 = -r; y2 <= r; y2 ++) - { - for(int z2 = -r; z2 <= r; z2 ++) - { - Block id = world.getBlock(x+x2, y+y2, z+z2); - int m = world.getBlockMetadata(x+x2, y+y2, z+z2); - if((id == BlockListMF.road || id == BlockListMF.lowroad)) - { - if(getDistance(x+x2, y+y2, z+z2, x, y, z) < r) - { - { - TileEntity tile = world.getTileEntity(x+x2, y+y2, z+z2); - if(tile != null && tile instanceof TileEntityRoad && !((TileEntityRoad)tile).isLocked) - { - flag = true; - ((TileEntityRoad)tile).setSurface(block, held.getItemDamage()); - } - } - } - } - } - } - } - return flag; - } - private boolean toggleLocks(World world, int x, int y, int z, int r) - { - boolean flag = false; - TileEntityRoad tile = getTile(world, x, y, z); - if(tile == null) - { - return false; - } - flag = !tile.isLocked; - tile.isLocked = flag; - tile.sendPacketToClients(); - - for(int x2 = -r; x2 <= r; x2 ++) - { - for(int y2 = -r; y2 <= r; y2 ++) - { - for(int z2 = -r; z2 <= r; z2 ++) - { - if(getDistance(x+x2, y+y2, z+z2, x, y, z) < r) - { - TileEntityRoad tile2 = getTile(world, x+x2, y+y2, z+z2); - if(tile2 != null) - { - tile2.isLocked = flag; - tile2.sendPacketToClients(); - } - } - } - } - } - return true; - } + private boolean upgradeRoad(World world, int x, int y, int z, int r, ItemStack held, Block block) { + if (!block.isNormalCube()) { + return false; + } + if (held == null) { + return false; + } + boolean flag = false; + + for (int x2 = -r; x2 <= r; x2++) { + for (int y2 = -r; y2 <= r; y2++) { + for (int z2 = -r; z2 <= r; z2++) { + Block id = world.getBlock(x + x2, y + y2, z + z2); + int m = world.getBlockMetadata(x + x2, y + y2, z + z2); + if ((id == BlockListMF.road || id == BlockListMF.lowroad)) { + if (getDistance(x + x2, y + y2, z + z2, x, y, z) < r) { + { + TileEntity tile = world.getTileEntity(x + x2, y + y2, z + z2); + if (tile != null && tile instanceof TileEntityRoad + && !((TileEntityRoad) tile).isLocked) { + flag = true; + ((TileEntityRoad) tile).setSurface(block, held.getItemDamage()); + } + } + } + } + } + } + } + return flag; + } + + private boolean toggleLocks(World world, int x, int y, int z, int r) { + boolean flag = false; + TileEntityRoad tile = getTile(world, x, y, z); + if (tile == null) { + return false; + } + flag = !tile.isLocked; + tile.isLocked = flag; + tile.sendPacketToClients(); - public double getDistance(double x, double y, double z, int posX, int posY, int posZ) - { + for (int x2 = -r; x2 <= r; x2++) { + for (int y2 = -r; y2 <= r; y2++) { + for (int z2 = -r; z2 <= r; z2++) { + if (getDistance(x + x2, y + y2, z + z2, x, y, z) < r) { + TileEntityRoad tile2 = getTile(world, x + x2, y + y2, z + z2); + if (tile2 != null) { + tile2.isLocked = flag; + tile2.sendPacketToClients(); + } + } + } + } + } + return true; + } + + public double getDistance(double x, double y, double z, int posX, int posY, int posZ) { double var7 = posX - x; double var9 = posY - y; double var11 = posZ - z; - return (double)MathHelper.sqrt_double(var7 * var7 + var9 * var9 + var11 * var11); + return MathHelper.sqrt_double(var7 * var7 + var9 * var9 + var11 * var11); + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityRoad(); } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityRoad(); - } - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister reg) - { + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister reg) { } } diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockSchematic.java b/src/main/java/minefantasy/mf2/block/decor/BlockSchematic.java index a0cbd49d..a8ca0ac7 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockSchematic.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockSchematic.java @@ -1,14 +1,10 @@ package minefantasy.mf2.block.decor; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.item.list.CreativeTabMF; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -17,131 +13,118 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class BlockSchematic extends Block -{ - public IIcon[] icons = new IIcon[6]; - public BlockSchematic(String name) - { - super(Material.cloth); - - GameRegistry.registerBlock(this, name); - setBlockName(name); - setBlockTextureName("minefantasy2:meta/"+name); - setBlockBounds(0F, 0F, 0F, 1F, 0F, 1F); - } - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List list) - { - } - @Override - @SideOnly(Side.CLIENT) - public boolean isOpaqueCube() - { - return false; - } - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public Item getItemDropped(int meta, Random rand, int i) - { - return ComponentListMF.artefacts; - } - @Override - public int damageDropped(int meta) - { - return meta + 4; - } - - @Override - public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) - { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return icons[Math.min(meta, icons.length-1)]; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - for(int i = 0; i < icons.length; i ++) - { - this.icons[i] = reg.registerIcon("minefantasy2:meta/schematic_"+(i+1)); - } +import java.util.List; +import java.util.Random; + +public class BlockSchematic extends Block { + public IIcon[] icons = new IIcon[6]; + + public BlockSchematic(String name) { + super(Material.cloth); + + GameRegistry.registerBlock(this, name); + setBlockName(name); + setBlockTextureName("minefantasy2:meta/" + name); + setBlockBounds(0F, 0F, 0F, 1F, 0F, 1F); } - - public static boolean useSchematic(ItemStack item, World world, EntityPlayer user, MovingObjectPosition movingobjectposition) - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + + public static boolean useSchematic(ItemStack item, World world, EntityPlayer user, + MovingObjectPosition movingobjectposition) { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; - if (movingobjectposition.sideHit == 0) - { + if (movingobjectposition.sideHit == 0) { --j; } - if (movingobjectposition.sideHit == 1) - { + if (movingobjectposition.sideHit == 1) { ++j; } - if (movingobjectposition.sideHit == 2) - { + if (movingobjectposition.sideHit == 2) { --k; } - if (movingobjectposition.sideHit == 3) - { + if (movingobjectposition.sideHit == 3) { ++k; } - if (movingobjectposition.sideHit == 4) - { + if (movingobjectposition.sideHit == 4) { --i; } - if (movingobjectposition.sideHit == 5) - { + if (movingobjectposition.sideHit == 5) { ++i; } - if (user.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) - { + if (user.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { return placeSchematic(item.getItemDamage(), user, item, user.worldObj, i, j, k); } } - return false; - } - public static boolean placeSchematic(int meta, EntityPlayer user, ItemStack item, World world, int x, int y, int z) - { - if(world.isAirBlock(x, y, z) && canBuildOn(world, x, y-1, z)) - { - world.setBlock(x, y, z, BlockListMF.schematic_general, Math.max(0, meta-4), 2); - return true; - } - return false; - } - - public static boolean canBuildOn(World world, int x, int y, int z) - { - return world.isSideSolid(x, y, z, ForgeDirection.UP); - } + return false; + } + + public static boolean placeSchematic(int meta, EntityPlayer user, ItemStack item, World world, int x, int y, + int z) { + if (world.isAirBlock(x, y, z) && canBuildOn(world, x, y - 1, z)) { + world.setBlock(x, y, z, BlockListMF.schematic_general, Math.max(0, meta - 4), 2); + return true; + } + return false; + } + + public static boolean canBuildOn(World world, int x, int y, int z) { + return world.isSideSolid(x, y, z, ForgeDirection.UP); + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + } + + @Override + @SideOnly(Side.CLIENT) + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public Item getItemDropped(int meta, Random rand, int i) { + return ComponentListMF.artefacts; + } + + @Override + public int damageDropped(int meta) { + return meta + 4; + } + + @Override + public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return icons[Math.min(meta, icons.length - 1)]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + for (int i = 0; i < icons.length; i++) { + this.icons[i] = reg.registerIcon("minefantasy2:meta/schematic_" + (i + 1)); + } + } } diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockTrough.java b/src/main/java/minefantasy/mf2/block/decor/BlockTrough.java index ee15cdfe..0a2fa191 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockTrough.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockTrough.java @@ -16,113 +16,104 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BlockTrough extends BlockWoodDecor -{ - public static int trough_RI = 107; - public BlockTrough(String name) - { - super(name); - this.setBlockBounds(0F, 0F, 0F, 1.0F, (7F/16F), 1.0F); - - GameRegistry.registerBlock(this, ItemBlockTrough.class, name); - setBlockName(name); - this.setHardness(1F); - this.setResistance(0.5F); +public class BlockTrough extends BlockWoodDecor { + public static final String NBT_fill = "Fill_Level"; + public static int trough_RI = 107; + + public BlockTrough(String name) { + super(name); + this.setBlockBounds(0F, 0F, 0F, 1.0F, (7F / 16F), 1.0F); + GameRegistry.registerBlock(this, ItemBlockTrough.class, name); + setBlockName(name); + this.setHardness(1F); + this.setResistance(0.5F); this.setCreativeTab(CreativeTabMF.tabUtil); - } - - @Override - public boolean isOpaqueCube() - { + } + + @Override + public boolean isOpaqueCube() { return false; } - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { + + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { return 1; } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } + @Override - public IIcon getIcon(int side, int meta) - { - return Blocks.planks.getIcon(side, 0); + public IIcon getIcon(int side, int meta) { + return Blocks.planks.getIcon(side, 0); } + @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - - } @SideOnly(Side.CLIENT) - public int getRenderType() - { - return trough_RI; + public void registerBlockIcons(IIconRegister reg) { + } - public static final String NBT_fill = "Fill_Level"; + + @SideOnly(Side.CLIENT) + public int getRenderType() { + return trough_RI; + } + @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { - int direction = MathHelper.floor_double((double)(user.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { + int direction = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); - + TileEntityTrough tile = getTile(world, x, y, z); - if(tile != null) - { - if(item.hasTagCompound() && item.getTagCompound().hasKey(NBT_fill)) - { - tile.fill = item.getTagCompound().getInteger(NBT_fill); - } + if (tile != null) { + if (item.hasTagCompound() && item.getTagCompound().hasKey(NBT_fill)) { + tile.fill = item.getTagCompound().getInteger(NBT_fill); + } } super.onBlockPlacedBy(world, x, y, z, user, item); } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityTrough(); - } - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - ItemStack held = user.getHeldItem(); - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityTrough) - { - if( ((TileEntityTrough)tile).interact(user, held)) - { - world.playSoundEffect(x+0.5D, y+0.5D, z+0.5D, "random.splash", 0.125F + user.getRNG().nextFloat()/4F, 0.5F + user.getRNG().nextFloat()); - ((TileEntityTrough)tile).syncData(); - return true; - } - } - return false; + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityTrough(); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + ItemStack held = user.getHeldItem(); + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityTrough) { + if (((TileEntityTrough) tile).interact(user, held)) { + world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.splash", + 0.125F + user.getRNG().nextFloat() / 4F, 0.5F + user.getRNG().nextFloat()); + ((TileEntityTrough) tile).syncData(); + return true; + } + } + return false; + } + + private TileEntityTrough getTile(World world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityTrough) { + return (TileEntityTrough) tile; + } + return null; + } + + @Override + protected ItemStack modifyDrop(TileEntityWoodDecor tile, ItemStack item) { + return modifyFill((TileEntityTrough) tile, super.modifyDrop(tile, item)); + } + + private ItemStack modifyFill(TileEntityTrough tile, ItemStack item) { + if (tile != null && item != null) { + item.getTagCompound().setInteger(NBT_fill, tile.fill); + } + return item; } - private TileEntityTrough getTile(World world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityTrough) - { - return (TileEntityTrough)tile; - } - return null; - } - - @Override - protected ItemStack modifyDrop(TileEntityWoodDecor tile, ItemStack item) - { - return modifyFill((TileEntityTrough)tile, super.modifyDrop(tile, item)); - } - - private ItemStack modifyFill(TileEntityTrough tile, ItemStack item) - { - if(tile != null && item != null) - { - item.getTagCompound().setInteger(NBT_fill, tile.fill); - } - return item; - } } diff --git a/src/main/java/minefantasy/mf2/block/decor/BlockWoodDecor.java b/src/main/java/minefantasy/mf2/block/decor/BlockWoodDecor.java index 5de876e4..052c050d 100644 --- a/src/main/java/minefantasy/mf2/block/decor/BlockWoodDecor.java +++ b/src/main/java/minefantasy/mf2/block/decor/BlockWoodDecor.java @@ -1,11 +1,9 @@ package minefantasy.mf2.block.decor; -import java.util.ArrayList; -import java.util.Random; - import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.tileentity.decor.TileEntityWoodDecor; +import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -15,87 +13,50 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public abstract class BlockWoodDecor extends BlockContainer -{ - private String texname; - public BlockWoodDecor(String tex) - { - super(Material.wood); - this.texname = tex; - } - - @Override - public abstract TileEntity createNewTileEntity(World world, int meta); - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { - TileEntityWoodDecor tile = getTile(world, x, y, z); - if(tile != null) - { - onPlaceTile(tile, world, x, y, z, user, item); - } +import java.util.ArrayList; + +public abstract class BlockWoodDecor extends BlockContainer { + private final String texture; + + public BlockWoodDecor(String texture) { + super(Material.wood); + this.texture = texture; } - protected void onPlaceTile(TileEntityWoodDecor tile, World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { - CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); - if(material != null) - { - tile.setMaterial(material); + @Override + public abstract TileEntity createNewTileEntity(World world, int meta); + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { + TileEntityWoodDecor tile = getTile(world, x, y, z); + if (tile != null) { + CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); + if (material != null) { + tile.setMaterial(material); + } } - } - - private TileEntityWoodDecor getTile(World world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityWoodDecor) - { - return (TileEntityWoodDecor)tile; - } - return null; - } - - @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) - { - ArrayList ret = new ArrayList(); - return ret; } - - protected ItemStack modifyDrop(TileEntityWoodDecor tile, ItemStack item) - { - if(tile != null && item != null) - { - CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, tile.getMaterialName()); - } - return item; - } - - private Random rand = new Random(); - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityWoodDecor tile = getTile(world, x, y, z); - - ItemStack itemstack = new ItemStack(getItemDropped(meta, world.rand, 0), 1, damageDropped(meta)); - - itemstack = modifyDrop(tile, itemstack); - - if (tile != null) - { - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; - float f1 = this.rand.nextFloat() * 0.8F + 0.1F; - float f2 = this.rand.nextFloat() * 0.8F + 0.1F; + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityWoodDecor tile = getTile(world, x, y, z); + + ItemStack itemstack = new ItemStack(getItemDropped(meta, world.rand, 0), 1, damageDropped(meta)); + + itemstack = modifyDrop(tile, itemstack); + + if (tile != null) { + if (itemstack != null) { + float f = world.rand.nextFloat() * 0.8F + 0.1F; + float f1 = world.rand.nextFloat() * 0.8F + 0.1F; + float f2 = world.rand.nextFloat() * 0.8F + 0.1F; EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, itemstack); float f3 = 0.05F; - entityitem.motionX = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) world.rand.nextGaussian() * f3; + entityitem.motionY = (float) world.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) world.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } @@ -105,20 +66,39 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - public String getFullTexName() - { - return this.texname; - } - - public ItemStack construct(String name) - { - return construct(name, 1); - } - public ItemStack construct(String name, int stacksize) - { - ItemStack item = new ItemStack(this, stacksize); - CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, name.toLowerCase()); - - return item; - } + protected ItemStack modifyDrop(TileEntityWoodDecor tile, ItemStack item) { + if (tile != null && item != null) { + CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, tile.getMaterialName()); + } + return item; + } + + private TileEntityWoodDecor getTile(World world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityWoodDecor) { + return (TileEntityWoodDecor) tile; + } + return null; + } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList ret = new ArrayList(); + return ret; + } + + public String getFullTexName() { + return this.texture; + } + + public ItemStack construct(String name) { + return construct(name, 1); + } + + public ItemStack construct(String name, int stacksize) { + ItemStack item = new ItemStack(this, stacksize); + CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, name.toLowerCase()); + + return item; + } } diff --git a/src/main/java/minefantasy/mf2/block/decor/ItemBedMF.java b/src/main/java/minefantasy/mf2/block/decor/ItemBedMF.java index bbeba876..298c41fc 100644 --- a/src/main/java/minefantasy/mf2/block/decor/ItemBedMF.java +++ b/src/main/java/minefantasy/mf2/block/decor/ItemBedMF.java @@ -4,88 +4,74 @@ import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.item.list.CreativeTabMF; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class ItemBedMF extends Item -{ - public ItemBedMF(String name) - {//ItemBed - this.setUnlocalizedName(name); - setMaxStackSize(4); - setTextureName("minefantasy2:Other/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); +public class ItemBedMF extends Item { + public ItemBedMF(String name) {// ItemBed + this.setUnlocalizedName(name); + setMaxStackSize(4); + setTextureName("minefantasy2:Other/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); this.setCreativeTab(CreativeTabMF.tabGadget); } /** - * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return - * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + * Callback for item usage. If the item does something special on right + * clicking, he will have one of those. Return True if something happen and + * false if it don't. This is for ITEMS, not BLOCKS */ - 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) - { + 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 if (p_77648_7_ != 1) - { + } else if (p_77648_7_ != 1) { return false; - } - else - { + } else { ++p_77648_5_; - BlockBedMF blockbed = (BlockBedMF)BlockListMF.bedroll; - int i1 = MathHelper.floor_double((double)(p_77648_2_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + BlockBedMF blockbed = (BlockBedMF) BlockListMF.bedroll; + int i1 = MathHelper.floor_double(p_77648_2_.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; byte b0 = 0; byte b1 = 0; - if (i1 == 0) - { + if (i1 == 0) { b1 = 1; } - if (i1 == 1) - { + if (i1 == 1) { b0 = -1; } - if (i1 == 2) - { + if (i1 == 2) { b1 = -1; } - if (i1 == 3) - { + if (i1 == 3) { b0 = 1; } - if (p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_ + b0, p_77648_5_, p_77648_6_ + b1, p_77648_7_, p_77648_1_)) - { - if (p_77648_3_.isAirBlock(p_77648_4_, p_77648_5_, p_77648_6_) && p_77648_3_.isAirBlock(p_77648_4_ + b0, p_77648_5_, p_77648_6_ + b1) && World.doesBlockHaveSolidTopSurface(p_77648_3_, p_77648_4_, p_77648_5_ - 1, p_77648_6_) && World.doesBlockHaveSolidTopSurface(p_77648_3_, p_77648_4_ + b0, p_77648_5_ - 1, p_77648_6_ + b1)) - { + if (p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) + && p_77648_2_.canPlayerEdit(p_77648_4_ + b0, p_77648_5_, p_77648_6_ + b1, p_77648_7_, p_77648_1_)) { + if (p_77648_3_.isAirBlock(p_77648_4_, p_77648_5_, p_77648_6_) + && p_77648_3_.isAirBlock(p_77648_4_ + b0, p_77648_5_, p_77648_6_ + b1) + && World.doesBlockHaveSolidTopSurface(p_77648_3_, p_77648_4_, p_77648_5_ - 1, p_77648_6_) + && World.doesBlockHaveSolidTopSurface(p_77648_3_, p_77648_4_ + b0, p_77648_5_ - 1, + p_77648_6_ + b1)) { p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, blockbed, i1, 3); - if (p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_) == blockbed) - { + if (p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_) == blockbed) { p_77648_3_.setBlock(p_77648_4_ + b0, p_77648_5_, p_77648_6_ + b1, blockbed, i1 + 8, 3); } --p_77648_1_.stackSize; return true; - } - else - { + } else { return false; } - } - else - { + } else { return false; } } diff --git a/src/main/java/minefantasy/mf2/block/decor/ItemBlockAmmoBox.java b/src/main/java/minefantasy/mf2/block/decor/ItemBlockAmmoBox.java index 84b0890c..9779566f 100644 --- a/src/main/java/minefantasy/mf2/block/decor/ItemBlockAmmoBox.java +++ b/src/main/java/minefantasy/mf2/block/decor/ItemBlockAmmoBox.java @@ -1,9 +1,5 @@ package minefantasy.mf2.block.decor; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; @@ -19,61 +15,55 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class ItemBlockAmmoBox extends ItemBlock implements IStorageBlock -{ - public ItemBlockAmmoBox(Block base) - { - super(base); - } - - @SideOnly(Side.CLIENT) - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean info) - { - if(item.hasTagCompound() && item.getTagCompound().hasKey(BlockAmmoBox.NBT_Ammo) && item.getTagCompound().hasKey(BlockAmmoBox.NBT_Stock)) - { - ItemStack ammo = ItemStack.loadItemStackFromNBT(item.getTagCompound().getCompoundTag(BlockAmmoBox.NBT_Ammo)); - int stock = item.getTagCompound().getInteger(BlockAmmoBox.NBT_Stock); - if(ammo != null) - { - list.add(ammo.getDisplayName() + " x" + stock); - } - } - CustomMaterial material = CustomMaterial.getMaterialFor(item,CustomToolHelper.slot_main); - if(material != null) - { - list.add(StatCollector.translateToLocalFormatted("attribute.box.capacity.name", TileEntityAmmoBox.getCapacity(material.tier))); - } - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(MineFantasyII.isDebug()) - { - ArrayList wood = CustomMaterial.getList("wood"); - Iterator iteratorWood = wood.iterator(); - while(iteratorWood.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); - list.add( this.construct(customMat.name) ); - } - } - else - { - list.add( this.construct("RefinedWood")); - } +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class ItemBlockAmmoBox extends ItemBlock implements IStorageBlock { + public ItemBlockAmmoBox(Block base) { + super(base); } - - private ItemStack construct(String name) - { - return CustomToolHelper.constructSingleColoredLayer(this, name, 1); - } - - @Override + + @SideOnly(Side.CLIENT) + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean info) { + if (item.hasTagCompound() && item.getTagCompound().hasKey(BlockAmmoBox.NBT_Ammo) + && item.getTagCompound().hasKey(BlockAmmoBox.NBT_Stock)) { + ItemStack ammo = ItemStack + .loadItemStackFromNBT(item.getTagCompound().getCompoundTag(BlockAmmoBox.NBT_Ammo)); + int stock = item.getTagCompound().getInteger(BlockAmmoBox.NBT_Stock); + if (ammo != null) { + list.add(ammo.getDisplayName() + " x" + stock); + } + } + CustomMaterial material = CustomMaterial.getMaterialFor(item, CustomToolHelper.slot_main); + if (material != null) { + list.add(StatCollector.translateToLocalFormatted("attribute.box.capacity.name", + TileEntityAmmoBox.getCapacity(material.tier))); + } + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (MineFantasyII.isDebug()) { + ArrayList wood = CustomMaterial.getList("wood"); + Iterator iteratorWood = wood.iterator(); + while (iteratorWood.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); + list.add(this.construct(customMat.name)); + } + } else { + list.add(this.construct("RefinedWood")); + } + } + + private ItemStack construct(String name) { + return CustomToolHelper.constructSingleColoredLayer(this, name, 1); + } + + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - return CustomToolHelper.getLocalisedName(item, this.getUnlocalizedNameInefficiently(item) + ".name"); + public String getItemStackDisplayName(ItemStack item) { + return CustomToolHelper.getLocalisedName(item, this.getUnlocalizedNameInefficiently(item) + ".name"); } } diff --git a/src/main/java/minefantasy/mf2/block/decor/ItemBlockToolRack.java b/src/main/java/minefantasy/mf2/block/decor/ItemBlockToolRack.java index e7084ebe..0f82da66 100644 --- a/src/main/java/minefantasy/mf2/block/decor/ItemBlockToolRack.java +++ b/src/main/java/minefantasy/mf2/block/decor/ItemBlockToolRack.java @@ -1,58 +1,46 @@ package minefantasy.mf2.block.decor; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; -import minefantasy.mf2.block.tileentity.decor.TileEntityAmmoBox; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -public class ItemBlockToolRack extends ItemBlock -{ - public ItemBlockToolRack(Block base) - { - super(base); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(MineFantasyII.isDebug()) - { - ArrayList wood = CustomMaterial.getList("wood"); - Iterator iteratorWood = wood.iterator(); - while(iteratorWood.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); - list.add( this.construct(customMat.name) ); - } - } - else - { - list.add( this.construct("RefinedWood")); - } +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class ItemBlockToolRack extends ItemBlock { + public ItemBlockToolRack(Block base) { + super(base); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (MineFantasyII.isDebug()) { + ArrayList wood = CustomMaterial.getList("wood"); + Iterator iteratorWood = wood.iterator(); + while (iteratorWood.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); + list.add(this.construct(customMat.name)); + } + } else { + list.add(this.construct("RefinedWood")); + } } - - private ItemStack construct(String name) - { - return CustomToolHelper.constructSingleColoredLayer(this, name, 1); - } - - @Override + + private ItemStack construct(String name) { + return CustomToolHelper.constructSingleColoredLayer(this, name, 1); + } + + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - return CustomToolHelper.getLocalisedName(item, this.getUnlocalizedNameInefficiently(item) + ".name"); + public String getItemStackDisplayName(ItemStack item) { + return CustomToolHelper.getLocalisedName(item, this.getUnlocalizedNameInefficiently(item) + ".name"); } } diff --git a/src/main/java/minefantasy/mf2/block/decor/ItemBlockTrough.java b/src/main/java/minefantasy/mf2/block/decor/ItemBlockTrough.java index 83c788ea..11f05d62 100644 --- a/src/main/java/minefantasy/mf2/block/decor/ItemBlockTrough.java +++ b/src/main/java/minefantasy/mf2/block/decor/ItemBlockTrough.java @@ -1,10 +1,5 @@ package minefantasy.mf2.block.decor; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; @@ -16,7 +11,6 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -25,135 +19,116 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class ItemBlockTrough extends ItemBlock implements IStorageBlock -{ - public ItemBlockTrough(Block base) - { - super(base); - } - - @SideOnly(Side.CLIENT) - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean info) - { - if(item.hasTagCompound() && item.getTagCompound().hasKey(BlockTrough.NBT_fill)) - { - int stock = item.getTagCompound().getInteger(BlockTrough.NBT_fill); - if(stock > 0) - { - list.add(StatCollector.translateToLocalFormatted("attribute.fill", stock)); - } - } - CustomMaterial material = CustomMaterial.getMaterialFor(item,CustomToolHelper.slot_main); - if(material != null) - { - list.add(StatCollector.translateToLocalFormatted("attribute.fill.capacity.name", TileEntityTrough.getCapacity(material.tier) * TileEntityTrough.capacityScale)); - } - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(MineFantasyII.isDebug()) - { - ArrayList wood = CustomMaterial.getList("wood"); - Iterator iteratorWood = wood.iterator(); - while(iteratorWood.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); - list.add( this.construct(customMat.name) ); - } - } - else - { - list.add( this.construct("RefinedWood")); - } +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +public class ItemBlockTrough extends ItemBlock implements IStorageBlock { + private Random rand = new Random(); + + public ItemBlockTrough(Block base) { + super(base); } - - private ItemStack construct(String name) - { - return CustomToolHelper.constructSingleColoredLayer(this, name, 1); - } - - @Override + @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - return CustomToolHelper.getLocalisedName(item, this.getUnlocalizedNameInefficiently(item) + ".name"); + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean info) { + if (item.hasTagCompound() && item.getTagCompound().hasKey(BlockTrough.NBT_fill)) { + int stock = item.getTagCompound().getInteger(BlockTrough.NBT_fill); + if (stock > 0) { + list.add(StatCollector.translateToLocalFormatted("attribute.fill", stock)); + } + } + CustomMaterial material = CustomMaterial.getMaterialFor(item, CustomToolHelper.slot_main); + if (material != null) { + list.add(StatCollector.translateToLocalFormatted("attribute.fill.capacity.name", + TileEntityTrough.getCapacity(material.tier) * TileEntityTrough.capacityScale)); + } } - - @Override - public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float f, float f1, float f2) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - - if (movingobjectposition == null) - { - return super.onItemUse(item, player, world, x, y, z, side, f, f1, f2); + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (MineFantasyII.isDebug()) { + ArrayList wood = CustomMaterial.getList("wood"); + Iterator iteratorWood = wood.iterator(); + while (iteratorWood.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); + list.add(this.construct(customMat.name)); + } + } else { + list.add(this.construct("RefinedWood")); } - else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } + + private ItemStack construct(String name) { + return CustomToolHelper.constructSingleColoredLayer(this, name, 1); + } + + @Override + @SideOnly(Side.CLIENT) + public String getItemStackDisplayName(ItemStack item) { + return CustomToolHelper.getLocalisedName(item, this.getUnlocalizedNameInefficiently(item) + ".name"); + } + + @Override + public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float f, + float f1, float f2) { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + + if (movingobjectposition == null) { + return super.onItemUse(item, player, world, x, y, z, side, f, f1, f2); + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; - if (!world.canMineBlock(player, i, j, k)) - { - return super.onItemUse(item, player, world, x, y, z, side, f, f1, f2); + if (!world.canMineBlock(player, i, j, k)) { + return super.onItemUse(item, player, world, x, y, z, side, f, f1, f2); } - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) - { - return super.onItemUse(item, player, world, x, y, z, side, f, f1, f2); + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { + return super.onItemUse(item, player, world, x, y, z, side, f, f1, f2); } - if (isWaterSource(world, i, j, k)) - { - gather(player); - world.playSoundAtEntity(player, "random.splash", 0.125F + rand.nextFloat()/4F, 0.5F + rand.nextFloat()); - return false; + if (isWaterSource(world, i, j, k)) { + gather(player); + world.playSoundAtEntity(player, "random.splash", 0.125F + rand.nextFloat() / 4F, + 0.5F + rand.nextFloat()); + return false; } } - return super.onItemUse(item, player, world, x, y, z, side, f, f1, f2); + return super.onItemUse(item, player, world, x, y, z, side, f, f1, f2); } } - private Random rand = new Random(); - private void gather(EntityPlayer player) - { - ItemStack item = player.getHeldItem(); - if(item != null) - { - int tier = 0; - CustomMaterial material = CustomMaterial.getMaterialFor(item,CustomToolHelper.slot_main); - if(material != null) - { - tier = material.tier; - } - NBTTagCompound nbt = getNBT(item); - nbt.setInteger(BlockTrough.NBT_fill, TileEntityTrough.getCapacity(tier) * TileEntityTrough.capacityScale); - } + private void gather(EntityPlayer player) { + ItemStack item = player.getHeldItem(); + if (item != null) { + int tier = 0; + CustomMaterial material = CustomMaterial.getMaterialFor(item, CustomToolHelper.slot_main); + if (material != null) { + tier = material.tier; + } + NBTTagCompound nbt = getNBT(item); + nbt.setInteger(BlockTrough.NBT_fill, TileEntityTrough.getCapacity(tier) * TileEntityTrough.capacityScale); + } player.swingItem(); - - } - - private NBTTagCompound getNBT(ItemStack item) - { - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - return item.getTagCompound(); - } - - private boolean isWaterSource(World world, int i, int j, int k) - { - if (world.getBlock(i, j, k).getMaterial() == Material.water) - { - return true; - } - return false; - } + + } + + private NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + return item.getTagCompound(); + } + + private boolean isWaterSource(World world, int i, int j, int k) { + if (world.getBlock(i, j, k).getMaterial() == Material.water) { + return true; + } + return false; + } } diff --git a/src/main/java/minefantasy/mf2/block/food/BlockBerryBush.java b/src/main/java/minefantasy/mf2/block/food/BlockBerryBush.java index 4bb35a4a..048c5462 100644 --- a/src/main/java/minefantasy/mf2/block/food/BlockBerryBush.java +++ b/src/main/java/minefantasy/mf2/block/food/BlockBerryBush.java @@ -1,8 +1,8 @@ package minefantasy.mf2.block.food; -import java.util.ArrayList; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.item.food.FoodListMF; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; @@ -18,185 +18,169 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockBerryBush extends BlockBush implements IShearable -{ - private Random rand = new Random(); - int[] field_150128_a; +import java.util.ArrayList; +import java.util.Random; + +public class BlockBerryBush extends BlockBush implements IShearable { @SideOnly(Side.CLIENT) protected int field_150127_b; + int[] field_150128_a; + private Random rand = new Random(); private IIcon[] berriedBush = new IIcon[2]; private IIcon[] emptyBush = new IIcon[2]; - - public BlockBerryBush(String name) - { + + public BlockBerryBush(String name) { super(Material.leaves); GameRegistry.registerBlock(this, ItemBlockBerries.class, name); - setBlockName(name); - + setBlockName(name); + this.setTickRandomly(true); this.setCreativeTab(CreativeTabs.tabDecorations); this.setHardness(0.3F); - float offset = 1/16F; - this.setBlockBounds(offset, 0F, offset, 1.0F-offset, 1.0F-(offset*2), 1.0F-offset); + float offset = 1 / 16F; + this.setBlockBounds(offset, 0F, offset, 1.0F - offset, 1.0F - (offset * 2), 1.0F - offset); this.setLightOpacity(1); this.setStepSound(soundTypeGrass); } + /** * Ticks the block if it's been scheduled */ @Override - public void updateTick(World world, int x, int y, int z, Random rand) - { - int meta = world.getBlockMetadata(x, y, z); - if(meta >= 1 && rand.nextInt(120) == 0) - { - world.setBlockMetadataWithNotify(x, y, z, 0, 2); - } + public void updateTick(World world, int x, int y, int z, Random rand) { + int meta = world.getBlockMetadata(x, y, z); + if (meta >= 1 && rand.nextInt(120) == 0) { + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + } } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister reg) - { - berriedBush[0] = reg.registerIcon("minefantasy2:food/berrybushfull"); - berriedBush[1] = reg.registerIcon("minefantasy2:food/berrybushfull_opaque"); - emptyBush[0] = reg.registerIcon("minefantasy2:food/berrybush"); - emptyBush[1] = reg.registerIcon("minefantasy2:food/berrybush_opaque"); + public void registerBlockIcons(IIconRegister reg) { + berriedBush[0] = reg.registerIcon("minefantasy2:food/berrybushfull"); + berriedBush[1] = reg.registerIcon("minefantasy2:food/berrybushfull_opaque"); + emptyBush[0] = reg.registerIcon("minefantasy2:food/berrybush"); + emptyBush[1] = reg.registerIcon("minefantasy2:food/berrybush_opaque"); } - + @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int meta) - { - int flag = Minecraft.getMinecraft().gameSettings.fancyGraphics ? 0 : 1; - if(meta == 0) - { - return berriedBush[flag]; + public IIcon getIcon(int side, int meta) { + int flag = Minecraft.getMinecraft().gameSettings.fancyGraphics ? 0 : 1; + if (meta == 0) { + return berriedBush[flag]; } return emptyBush[flag]; } @Override - public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) - { + public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) { return true; } @Override - public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) - { + public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) { ArrayList ret = new ArrayList(); ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3)); return ret; } + @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - int meta = world.getBlockMetadata(x, y, z); - if(meta == 0 ) - { - if(world.isRemote)return true; - - - world.setBlockMetadataWithNotify(x, y, z, 1, 2); - - ItemStack itemstack = rand.nextInt(10) == 0 ? new ItemStack(FoodListMF.berriesJuicy) : new ItemStack(FoodListMF.berries, 1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 0) { + if (world.isRemote) + return true; + + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + + ItemStack itemstack = rand.nextInt(10) == 0 ? new ItemStack(FoodListMF.berriesJuicy) + : new ItemStack(FoodListMF.berries, 1); + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } - - return true; - } - return false; + + return true; + } + return false; } - + @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) - { - return new ArrayList(){}; + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + return new ArrayList() { + }; } + @Override @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) - { - return true; + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { + return true; } + @Override - public int getRenderType() - { + public int getRenderType() { return 0; } + @SideOnly(Side.CLIENT) @Override - public int getRenderColor(int i) - { + public int getRenderColor(int i) { return ColorizerFoliage.getFoliageColorBasic(); } - + @SideOnly(Side.CLIENT) @Override - public int getBlockColor() - { + public int getBlockColor() { double d0 = 0.5D; double d1 = 1.0D; return ColorizerFoliage.getFoliageColor(d0, d1); } - + @SideOnly(Side.CLIENT) @Override - public int colorMultiplier(IBlockAccess world, int x, int y, int z) - { + public int colorMultiplier(IBlockAccess world, int x, int y, int z) { int l = 0; int i1 = 0; int j1 = 0; - for (int k1 = -1; k1 <= 1; ++k1) - { - for (int l1 = -1; l1 <= 1; ++l1) - { + for (int k1 = -1; k1 <= 1; ++k1) { + for (int l1 = -1; l1 <= 1; ++l1) { int i2 = world.getBiomeGenForCoords(x + l1, z + k1).getBiomeFoliageColor(x + l1, y, z + k1); l += (i2 & 16711680) >> 16; i1 += (i2 & 65280) >> 8; diff --git a/src/main/java/minefantasy/mf2/block/food/BlockCakeMF.java b/src/main/java/minefantasy/mf2/block/food/BlockCakeMF.java index 41c1be4e..841124e5 100644 --- a/src/main/java/minefantasy/mf2/block/food/BlockCakeMF.java +++ b/src/main/java/minefantasy/mf2/block/food/BlockCakeMF.java @@ -1,5 +1,8 @@ package minefantasy.mf2.block.food; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.item.food.ItemFoodMF; import minefantasy.mf2.item.list.CreativeTabMF; @@ -14,12 +17,11 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockCakeMF extends Block -{ +public class BlockCakeMF extends Block { + protected int maxSlices = 8; + protected float height = 0.5F; + protected float width = 14F / 16F; @SideOnly(Side.CLIENT) private IIcon topTex; @SideOnly(Side.CLIENT) @@ -27,16 +29,12 @@ public class BlockCakeMF extends Block @SideOnly(Side.CLIENT) private IIcon insideTex; private Item cakeSlice; - protected int maxSlices = 8; - protected float height = 0.5F; - protected float width = 14F/16F; - public BlockCakeMF(String name, Item slice) - { + public BlockCakeMF(String name, Item slice) { super(Material.cake); GameRegistry.registerBlock(this, ItemBlockCake.class, name); - setBlockName(name); - setBlockTextureName("minefantasy2:food/"+name); + setBlockName(name); + setBlockTextureName("minefantasy2:food/" + name); cakeSlice = slice; this.setTickRandomly(true); setCreativeTab(CreativeTabMF.tabFood); @@ -46,36 +44,34 @@ public BlockCakeMF(String name, Item slice) * Updates the blocks bounds based on its current state. Args: world, x, y, z */ @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) - { + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { int slices = world.getBlockMetadata(x, y, z); - float border = (1F-width)/2; - float size = (slices / (float)maxSlices) * (1.0F-(border*2)); - this.setBlockBounds(border + size, 0.0F, border, 1.0F-border, height, 1.0F - border); + float border = (1F - width) / 2; + float size = (slices / (float) maxSlices) * (1.0F - (border * 2)); + this.setBlockBounds(border + size, 0.0F, border, 1.0F - border, height, 1.0F - border); } /** * Sets the block's bounds for rendering it as an item */ @Override - public void setBlockBoundsForItemRender() - { - float f = (1F-width)/2; + public void setBlockBoundsForItemRender() { + float f = (1F - width) / 2; float f1 = height; this.setBlockBounds(f, 0.0F, f, 1.0F - f, f1, 1.0F - f); } /** - * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been - * cleared to be reused) + * Returns a bounding box from the pool of bounding boxes (this means this box + * can change after the pool has been cleared to be reused) */ @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) - { - int slices = world.getBlockMetadata(x, y, z); - float border =(1F-width)/2; - float size = border + (slices / (float)maxSlices) * (1.0F-(border*2)); - return AxisAlignedBB.getBoundingBox(x + size, y, z + border, x + 1 - border, y + height - border, z + 1 - border); + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + int slices = world.getBlockMetadata(x, y, z); + float border = (1F - width) / 2; + float size = border + (slices / (float) maxSlices) * (1.0F - (border * 2)); + return AxisAlignedBB.getBoundingBox(x + size, y, z + border, x + 1 - border, y + height - border, + z + 1 - border); } /** @@ -83,11 +79,10 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, */ @SideOnly(Side.CLIENT) @Override - public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) - { - int slices = world.getBlockMetadata(x, y, z); - float border = (1F-width)/2; - float size = border + (slices / (float)maxSlices) * (1.0F-(border*2)); + public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { + int slices = world.getBlockMetadata(x, y, z); + float border = (1F - width) / 2; + float size = border + (slices / (float) maxSlices) * (1.0F - (border * 2)); return AxisAlignedBB.getBoundingBox(x + size, y, z + border, x + 1 - border, y + height, z + 1 - border); } @@ -96,15 +91,14 @@ public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, i */ @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int meta) - { - return side == 1 ? this.topTex : (side == 0 ? this.bottomTex : (meta > 0 && side == 4 ? this.insideTex : this.blockIcon)); + public IIcon getIcon(int side, int meta) { + return side == 1 ? this.topTex + : (side == 0 ? this.bottomTex : (meta > 0 && side == 4 ? this.insideTex : this.blockIcon)); } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister reg) - { + public void registerBlockIcons(IIconRegister reg) { this.blockIcon = reg.registerIcon(this.getTextureName() + "_side"); this.insideTex = reg.registerIcon(this.getTextureName() + "_inner"); this.topTex = reg.registerIcon(this.getTextureName() + "_top"); @@ -112,21 +106,21 @@ public void registerBlockIcons(IIconRegister reg) } /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + * If this block doesn't render as an ordinary block it will return False + * (examples: signs, buttons, stairs, etc) */ @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } /** - * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two - * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or + * not to render the shared face of two adjacent blocks and also whether the + * player can attach torches, redstone wire, etc to this block. */ @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @@ -134,107 +128,92 @@ public boolean isOpaqueCube() * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xoffset, float yoffset, float zoffset) - { - if(ToolHelper.getCrafterTool(user.getHeldItem()).equalsIgnoreCase("knife")) - { - this.cutSlice(world, x, y, z, user); - return true; - } - return false; + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xoffset, + float yoffset, float zoffset) { + if (ToolHelper.getCrafterTool(user.getHeldItem()).equalsIgnoreCase("knife")) { + this.cutSlice(world, x, y, z, user); + return true; + } + return false; } /** * Called when a player hits the block. Args: world, x, y, z, player */ @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { - if(ToolHelper.getCrafterTool(user.getHeldItem()).equalsIgnoreCase("knife")) - { - this.cutSlice(world, x, y, z, user); - } - } - - private void cutSlice(World world, int x, int y, int z, EntityPlayer user) - { - if(cakeSlice != null) - { - ItemStack slice = new ItemStack(cakeSlice); - if(!user.inventory.addItemStackToInventory(slice)) - { - user.entityDropItem(slice, 1.0F); - } + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { + if (ToolHelper.getCrafterTool(user.getHeldItem()).equalsIgnoreCase("knife")) { + this.cutSlice(world, x, y, z, user); + } + } + + private void cutSlice(World world, int x, int y, int z, EntityPlayer user) { + if (cakeSlice != null) { + ItemStack slice = new ItemStack(cakeSlice); + if (!user.inventory.addItemStackToInventory(slice)) { + user.entityDropItem(slice, 1.0F); + } } int l = world.getBlockMetadata(x, y, z) + 1; - if (l >= maxSlices) - { + if (l >= maxSlices) { world.setBlockToAir(x, y, z); - } - else - { + } else { world.setBlockMetadataWithNotify(x, y, z, l, 2); } - if(user.getHeldItem() != null) - { - user.getHeldItem().damageItem(1, user); + if (user.getHeldItem() != null) { + user.getHeldItem().damageItem(1, user); } } /** - * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + * Checks to see if its valid to put this block at the specified coordinates. + * Args: world, x, y, z */ @Override - public boolean canPlaceBlockAt(World world, int x, int y, int z) - { + public boolean canPlaceBlockAt(World world, int x, int y, int z) { return !super.canPlaceBlockAt(world, x, y, z) ? false : this.canBlockStay(world, x, y, z); } /** - * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are - * their own) Args: x, y, z, neighbor Block + * Lets the block know when one of its neighbor changes. Doesn't know which + * neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor + * Block */ @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) - { - if (!this.canBlockStay(world, x, y, z)) - { - ItemStack item = new ItemStack(this, 1, damageDropped(world.getBlockMetadata(x, y, z))); - EntityItem drop = new EntityItem(world, x+0.5D, y+0.5D, z+0.5D, item); - world.spawnEntityInWorld(drop); + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + if (!this.canBlockStay(world, x, y, z)) { + ItemStack item = new ItemStack(this, 1, damageDropped(world.getBlockMetadata(x, y, z))); + EntityItem drop = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, item); + world.spawnEntityInWorld(drop); world.setBlockToAir(x, y, z); } } /** - * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + * Can this block stay at this position. Similar to canPlaceBlockAt except gets + * checked often with plants. */ @Override - public boolean canBlockStay(World world, int x, int y, int z) - { + public boolean canBlockStay(World world, int x, int y, int z) { return world.getBlock(x, y - 1, z).getMaterial().isSolid(); } @Override - public int damageDropped(int meta) - { - return meta; - } - - public int getRarity() - { - if(cakeSlice instanceof ItemFoodMF) - { - return ((ItemFoodMF)cakeSlice).itemRarity; - } - return 0; - } - - public Block setCheese() - { - width = 0.5F; - height = 5F/16F; - return this; - } + public int damageDropped(int meta) { + return meta; + } + + public int getRarity() { + if (cakeSlice instanceof ItemFoodMF) { + return ((ItemFoodMF) cakeSlice).itemRarity; + } + return 0; + } + + public Block setCheese() { + width = 0.5F; + height = 5F / 16F; + return this; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/food/BlockPie.java b/src/main/java/minefantasy/mf2/block/food/BlockPie.java index 099401dc..cdae4e93 100644 --- a/src/main/java/minefantasy/mf2/block/food/BlockPie.java +++ b/src/main/java/minefantasy/mf2/block/food/BlockPie.java @@ -2,13 +2,11 @@ import net.minecraft.item.Item; -public class BlockPie extends BlockCakeMF -{ - - public BlockPie(String name, Item slice) - { - super(name, slice); - this.height = 1F/16F*6F; - } +public class BlockPie extends BlockCakeMF { + + public BlockPie(String name, Item slice) { + super(name, slice); + this.height = 1F / 16F * 6F; + } } diff --git a/src/main/java/minefantasy/mf2/block/food/ItemBlockBerries.java b/src/main/java/minefantasy/mf2/block/food/ItemBlockBerries.java index e2331ab1..eb6ee023 100644 --- a/src/main/java/minefantasy/mf2/block/food/ItemBlockBerries.java +++ b/src/main/java/minefantasy/mf2/block/food/ItemBlockBerries.java @@ -3,16 +3,14 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; -public class ItemBlockBerries extends ItemBlock -{ - public ItemBlockBerries(Block block) - { - super(block); - setHasSubtypes(true); - } - @Override - public int getMetadata(int id) - { +public class ItemBlockBerries extends ItemBlock { + public ItemBlockBerries(Block block) { + super(block); + setHasSubtypes(true); + } + + @Override + public int getMetadata(int id) { return id; } } diff --git a/src/main/java/minefantasy/mf2/block/food/ItemBlockCake.java b/src/main/java/minefantasy/mf2/block/food/ItemBlockCake.java index 6a00cbff..a32ce665 100644 --- a/src/main/java/minefantasy/mf2/block/food/ItemBlockCake.java +++ b/src/main/java/minefantasy/mf2/block/food/ItemBlockCake.java @@ -7,33 +7,29 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemBlockCake extends ItemBlock -{ - private BlockCakeMF cake; - public ItemBlockCake(Block block) - { +public class ItemBlockCake extends ItemBlock { + private BlockCakeMF cake; + + public ItemBlockCake(Block block) { super(block); - cake=(BlockCakeMF) block; + cake = (BlockCakeMF) block; setMaxStackSize(1); this.setMaxDamage(0); this.setHasSubtypes(true); setCreativeTab(CreativeTabs.tabDecorations); } - + @Override - public int getMetadata(int damage) - { + public int getMetadata(int damage) { return damage; } - + @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = cake.getRarity()+1; - if(lvl >= ToolListMF.rarity.length) - { - lvl = ToolListMF.rarity.length-1; - } - return ToolListMF.rarity[lvl]; + public EnumRarity getRarity(ItemStack item) { + int lvl = cake.getRarity() + 1; + if (lvl >= ToolListMF.rarity.length) { + lvl = ToolListMF.rarity.length - 1; + } + return ToolListMF.rarity[lvl]; } } diff --git a/src/main/java/minefantasy/mf2/block/list/BlockListMF.java b/src/main/java/minefantasy/mf2/block/list/BlockListMF.java index 6595f4f3..5c0e269a 100644 --- a/src/main/java/minefantasy/mf2/block/list/BlockListMF.java +++ b/src/main/java/minefantasy/mf2/block/list/BlockListMF.java @@ -1,48 +1,12 @@ package minefantasy.mf2.block.list; -import minefantasy.mf2.block.basic.BasicBlockMF; -import minefantasy.mf2.block.basic.BlockMetalBarsMF; -import minefantasy.mf2.block.basic.BlockMetalMF; -import minefantasy.mf2.block.basic.BlockMythicDecor; -import minefantasy.mf2.block.basic.BlockMythicOre; -import minefantasy.mf2.block.basic.BlockOreMF; -import minefantasy.mf2.block.basic.BlockPaneMF; -import minefantasy.mf2.block.basic.BlockReinforcedStone; -import minefantasy.mf2.block.basic.BlockWorldGenMarker; -import minefantasy.mf2.block.basic.ConstructionBlockMF; -import minefantasy.mf2.block.crafting.BlockAnvilMF; -import minefantasy.mf2.block.crafting.BlockBombBench; -import minefantasy.mf2.block.crafting.BlockBombPress; -import minefantasy.mf2.block.crafting.BlockCarpenter; -import minefantasy.mf2.block.crafting.BlockCogwork; -import minefantasy.mf2.block.crafting.BlockCrossbowBench; -import minefantasy.mf2.block.crafting.BlockEngineerTanner; -import minefantasy.mf2.block.crafting.BlockFirepit; -import minefantasy.mf2.block.crafting.BlockFrame; -import minefantasy.mf2.block.crafting.BlockRepairKit; -import minefantasy.mf2.block.crafting.BlockResearchStation; -import minefantasy.mf2.block.crafting.BlockRoast; -import minefantasy.mf2.block.crafting.BlockSalvage; -import minefantasy.mf2.block.crafting.BlockTanningRack; -import minefantasy.mf2.block.decor.BlockAmmoBox; -import minefantasy.mf2.block.decor.BlockBedMF; -import minefantasy.mf2.block.decor.BlockComponent; -import minefantasy.mf2.block.decor.BlockRack; -import minefantasy.mf2.block.decor.BlockRoad; -import minefantasy.mf2.block.decor.BlockSchematic; -import minefantasy.mf2.block.decor.BlockTrough; +import minefantasy.mf2.block.basic.*; +import minefantasy.mf2.block.crafting.*; +import minefantasy.mf2.block.decor.*; import minefantasy.mf2.block.food.BlockBerryBush; import minefantasy.mf2.block.food.BlockCakeMF; import minefantasy.mf2.block.food.BlockPie; -import minefantasy.mf2.block.refining.BlockBFC; -import minefantasy.mf2.block.refining.BlockBFH; -import minefantasy.mf2.block.refining.BlockBellows; -import minefantasy.mf2.block.refining.BlockBigFurnace; -import minefantasy.mf2.block.refining.BlockBloomery; -import minefantasy.mf2.block.refining.BlockChimney; -import minefantasy.mf2.block.refining.BlockCrucible; -import minefantasy.mf2.block.refining.BlockForge; -import minefantasy.mf2.block.refining.BlockQuern; +import minefantasy.mf2.block.refining.*; import minefantasy.mf2.block.tree.BlockLeavesMF; import minefantasy.mf2.block.tree.BlockLogMF; import minefantasy.mf2.block.tree.BlockSaplingMF; @@ -56,261 +20,295 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class BlockListMF -{ - public static final String[] metalBlocks = new String[] - { - "copper", "tin", "silver", "bronze", "pigiron", "steel", "blacksteel", "redsteel", "bluesteel", "adamantium", "mithril", "ignotumite", "mithium", "ender" - }; - public static final String[] specialMetalBlocks = new String[] - { - "bronze", "iron", "steel", "blacksteel", "redsteel", "bluesteel" - }; - public static final String[] anvils = new String[] - { - "bronze", "iron", "steel", "blacksteel", "bluesteel", "redsteel" - }; - - public static Block oreCopper = new BlockOreMF("oreCopper", 0, -1).setHardness(2.0F).setResistance(3.0F); - public static Block oreTin = new BlockOreMF("oreTin", 0).setHardness(2.5F).setResistance(4.0F); - public static Block oreSilver = new BlockOreMF("oreSilver", 2).setHardness(3.0F).setResistance(5.0F); - public static Block oreMythic = new BlockMythicOre("oreMythic", false).setHardness(10.0F).setResistance(100.0F); - - public static Block oreKaolinite = new BlockOreMF("oreKaolinite", 1, 0, ComponentListMF.kaolinite, 1, 1, 1).setHardness(3.0F).setResistance(5.0F); - public static Block oreNitre = new BlockOreMF("oreNitre", 2, 0, ComponentListMF.nitre, 1, 2, 1).setHardness(3.0F).setResistance(5.0F); - public static Block oreSulfur = new BlockOreMF("oreSulfur", 2, 0, ComponentListMF.sulfur, 1, 4, 2).setHardness(3.0F).setResistance(2.0F); - public static Block oreBorax = new BlockOreMF("oreBorax", 2, 1, ComponentListMF.flux_strong, 1, 8, 4).setHardness(3.0F).setResistance(2.0F); - public static Block oreTungsten = new BlockOreMF("oreTungsten", 3, 1, ComponentListMF.oreTungsten, 1, 1, 4).setHardness(4.0F).setResistance(2.5F); - public static Block oreClay = new BlockOreMF("oreClay", 0, 0, Items.clay_ball, 1, 4, 1, Material.ground).setHardness(0.5F).setStepSound(Block.soundTypeGravel); - public static Block oreCoalRich = new BlockOreMF("oreCoalRich", 2, 1, Items.coal, 2, 6, 2).setHardness(5.0F).setResistance(10.0F); - - public static Block mud_brick = new BasicBlockMF("mud_brick", Material.ground).setHardness(1.0F).setResistance(0.5F); - public static Block mud_pavement = new BasicBlockMF("mud_pavement", Material.ground).setHardness(0.5F); - - public static Block cobble_brick = new BasicBlockMF("cobble_brick", Material.rock).setHardness(2.5F).setResistance(12.0F).setStepSound(Block.soundTypePiston); - public static Block cobble_pavement = new BasicBlockMF("cobble_pavement", Material.rock).setHardness(2.0F).setResistance(10.0F).setStepSound(Block.soundTypePiston); - - public static Block window = new BasicBlockMF("window", Material.glass).setHardness(0.9F).setResistance(0.1F).setStepSound(Block.soundTypeGlass); - public static Block framed_glass = new BasicBlockMF("framed_glass", Material.glass).setHardness(0.6F).setResistance(0.2F).setStepSound(Block.soundTypeGlass); - public static Block framed_pane = new BlockPaneMF("framed_pane", "framed_glass", "framed_glass_pane", Material.glass, true).setHardness(0.6F).setResistance(0.1F).setStepSound(Block.soundTypeGlass); - public static Block window_pane = new BlockPaneMF("window_pane", "window", "framed_glass_pane", Material.glass, true).setHardness(0.9F).setResistance(0.2F).setStepSound(Block.soundTypeGlass); - - public static Block thatch = new BasicBlockMF("thatch", Material.leaves).setHardness(1.0F).setStepSound(Block.soundTypeGrass); - public static Block thatch_stair = new ConstructionBlockMF.StairsConstBlock("thatch_stair", thatch).register("thatch_stair"); - -// public static Block limestone_cobblestone = new BasicBlockMF("limestone_cobblestone", Material.rock).setHardness(0.8F).setResistance(4.0F).setStepSound(Block.soundTypePiston); -// public static Block limestone = new BasicBlockMF("limestone", Material.rock, limestone_cobblestone).setHardness(1.0F).setResistance(5.0F).setStepSound(Block.soundTypeStone); - - public static Block limestone = new ConstructionBlockMF("limestone").setHardness(1.2F).setResistance(8F); - - public static Block firebricks = new BasicBlockMF("firebricks", Material.rock).setHardness(5.0F).setResistance(15.0F).setStepSound(Block.soundTypePiston); - public static Block clayWall = new BasicBlockMF("clayWall", Material.wood).setHardness(1.0F).setResistance(1.0F).setStepSound(Block.soundTypeWood); - - public static BlockMetalBarsMF[] bars = new BlockMetalBarsMF[specialMetalBlocks.length]; - public static BlockMetalMF[] storage = new BlockMetalMF[metalBlocks.length]; - public static BlockAnvilMF anvilStone; - public static BlockAnvilMF[] anvil = new BlockAnvilMF[anvils.length]; - public static BlockCarpenter carpenter = new BlockCarpenter(); - public static BlockBombBench bombBench = new BlockBombBench(); - public static BlockCrossbowBench crossbowBench = new BlockCrossbowBench(); - - public static Block cheese_wheel = new BlockCakeMF("cheese", FoodListMF.cheese_slice).setCheese(); - - public static Block cake_vanilla = new BlockCakeMF("cake_vanilla", FoodListMF.cake_slice); - public static Block cake_carrot = new BlockCakeMF("cake_carrot", FoodListMF.carrotcake_slice); - public static Block cake_chocolate = new BlockCakeMF("cake_chocolate", FoodListMF.choccake_slice); - public static Block cake_bf = new BlockCakeMF("cake_bf", FoodListMF.bfcake_slice); - - public static Block pie_meat = new BlockPie("pie_meat", FoodListMF.meatpie_slice); - - public static Block pie_apple = new BlockPie("pie_apple", FoodListMF.pieslice_apple); - public static Block pie_berry = new BlockPie("pie_berry", FoodListMF.pieslice_berry); - - public static Block pie_shepards = new BlockPie("pie_shepards", FoodListMF.pieslice_shepards); - - public static Block berryBush = new BlockBerryBush("berries"); - public static Block blast_chamber = new BlockBFC(); - public static Block blast_heater = new BlockBFH(false); - public static Block blast_heater_active = new BlockBFH(true).setLightLevel(10F); - - public static Block crucible = new BlockCrucible("stone", 0, false); - public static Block crucible_active = new BlockCrucible("stone", 0, true).setLightLevel(12F); - public static Block crucibleadv = new BlockCrucible("fireclay", 1, false); - public static Block crucibleadv_active = new BlockCrucible("fireclay", 1, true).setLightLevel(12F); - public static Block crucibleauto = new BlockCrucible("auto", 1, false).setAuto().setHardness(12F); - public static Block crucibleauto_active = new BlockCrucible("auto", 1, true).setAuto().setHardness(12F).setLightLevel(12F); - - public static Block chimney_stone = new BlockChimney("stone", false, false, 5); - public static Block chimney_stone_wide = new BlockChimney("stone", true, false, 10); - public static Block chimney_stone_extractor = new BlockChimney("stone_extractor", true, true, 15); - public static Block chimney_pipe = new BlockChimney("pipe", false, false, 10).setPipe(); - - public static Block tanner = new BlockTanningRack(0, ""); - - public static Block forge = new BlockForge("stone", 0, false); - public static Block forge_active = new BlockForge("stone", 0, true); - public static Block forge_metal = new BlockForge("metal", 1, false); - public static Block forge_metal_active = new BlockForge("metal", 1, true); - - public static Block repair_basic = new BlockRepairKit("basic", 0.25F, 0.05F, 0.2F); - public static Block repair_advanced = new BlockRepairKit("advanced", 1.0F, 0.2F, 0.05F); - public static Block repair_ornate = new BlockRepairKit("ornate", 1.0F, 0.25F, 0.03F).setOrnate(0.5F); - - public static Block bellows = new BlockBellows(); - - public static Block refined_planks = new BasicBlockMF("refined_planks", Material.wood).setHardness(2.5F).setResistance(10F).setStepSound(Block.soundTypeWood); - public static Block nailed_planks = new BasicBlockMF("nailed_planks", Material.wood).setHardness(1.5F).setResistance(7F).setStepSound(Block.soundTypeWood); - public static Block refined_planks_stair = new ConstructionBlockMF.StairsConstBlock("refined_planks_stair", refined_planks).register("refined_planks_stair"); - public static Block nailed_planks_stair = new ConstructionBlockMF.StairsConstBlock("nailed_planks_stair", nailed_planks).register("nailed_planks_stair"); - - public static Block reinforced_stone = new BlockReinforcedStone("reinforced_stone", "base", "engraved", "dshall_0", "dshall_1", "dshall_2").setHardness(2.0F).setResistance(15F).setStepSound(Block.soundTypeStone); - public static Block reinforced_stone_bricks = new BlockReinforcedStone("reinforced_stone_bricks", "base", "mossy", "cracked").setHardness(2.0F).setResistance(15F).setStepSound(Block.soundTypeStone); - public static Block reinforced_stone_framed = new BasicBlockMF("reinforced_stone_framed", Material.rock).setHardness(2.5F).setResistance(20F).setStepSound(Block.soundTypeStone); - public static Block reinforced_stone_framediron = new BasicBlockMF("reinforced_stone_framediron", Material.rock).setHardness(2.5F).setResistance(20F).setStepSound(Block.soundTypeStone).setBlockName("reinforced_stone_framed"); - - public static Block advTanner = new BlockTanningRack(1, "Strong"); - public static Block research = new BlockResearchStation(); - public static Block trough_wood = new BlockTrough("trough_wood"); - public static Block engTanner = new BlockEngineerTanner(2, "Metal"); - - public static Block bombPress = new BlockBombPress(); - - public static Block road = new BlockRoad("road_mf", 14F); - public static Block lowroad = new BlockRoad("road_mf_short", 7F); - - public static Block salvage_basic = new BlockSalvage("basic", 1.0F); - public static Block bloomery = new BlockBloomery(); - public static Block log_yew = new BlockLogMF("yew").setHardness(2F).setResistance(6F); - public static Block log_ironbark = new BlockLogMF("ironbark").setHardness(3F).setResistance(8F); - public static Block log_ebony = new BlockLogMF("ebony").setHardness(5F).setResistance(10F); - - public static Block leaves_yew = new BlockLeavesMF("yew", 100); - public static Block leaves_ironbark = new BlockLeavesMF("ironbark", 40).setHardness(0.3F); - public static Block leaves_ebony = new BlockLeavesMF("ebony", 1000).setHardness(0.5F); - - public static Block sapling_yew = new BlockSaplingMF("yew", log_yew, leaves_yew, 4F); - public static Block sapling_ironbark = new BlockSaplingMF("ironbark", log_ironbark, leaves_ironbark, 8F); - public static Block sapling_ebony = new BlockSaplingMF("ebony", log_ebony, leaves_ebony, 10F); - - public static Block yew_planks = new BasicBlockMF("yew_planks", Material.wood).setHardness(3F).setResistance(6F).setStepSound(Block.soundTypeWood); - public static Block ironbark_planks = new BasicBlockMF("ironbark_planks", Material.wood).setHardness(4F).setResistance(10F).setStepSound(Block.soundTypeWood); - public static Block ebony_planks = new BasicBlockMF("ebony_planks", Material.wood).setHardness(6F).setResistance(12F).setStepSound(Block.soundTypeWood); - - public static Block quern = new BlockQuern("quern"); - - public static Block mud_brick_stair = new ConstructionBlockMF.StairsConstBlock("mud_brick_stair", mud_brick).register("mud_brick_stair"); - public static Block mud_pavement_stair = new ConstructionBlockMF.StairsConstBlock("mud_pavement_stair", mud_pavement).register("mud_pavement_stair"); - public static Block cobble_brick_stair = new ConstructionBlockMF.StairsConstBlock("cobble_brick_stair", cobble_brick).register("cobble_brick_stair"); - public static Block cobble_pavement_stair = new ConstructionBlockMF.StairsConstBlock("cobble_pavement_stair", cobble_pavement).register("cobble_pavement_stair"); - public static Block firebrick_stair = new ConstructionBlockMF.StairsConstBlock("firebrick_stair", firebricks).register("firebrick_stair"); - public static Block reinforced_stone_stair = new ConstructionBlockMF.StairsConstBlock("reinforced_stone_stair", reinforced_stone).register("reinforced_stone_stair"); - public static Block reinforced_stone_brick_stair = new ConstructionBlockMF.StairsConstBlock("reinforced_stone_brick_stair", reinforced_stone_bricks).register("reinforced_stone_brick_stair"); - - public static Block yew_stair = new ConstructionBlockMF.StairsConstBlock("yew_stair", yew_planks).register("yew_stair"); - public static Block ironbark_stair = new ConstructionBlockMF.StairsConstBlock("ironbark_stair", ironbark_planks).register("ironbark_stair"); - public static Block ebony_stair = new ConstructionBlockMF.StairsConstBlock("ebony_stair", ebony_planks).register("ebony_stair"); - - public static Block firepit = new BlockFirepit(); - public static Block roast = new BlockRoast(0, "basic", false); - public static Block oven_stone = new BlockRoast(0, "basic", true); - - public static Block furnace_heater = new BlockBigFurnace("furnace_heater", true, -1); - public static Block furnace_stone = new BlockBigFurnace("furnace_stone", false, 0); - - public static Block rack_wood = new BlockRack("rack_wood"); - public static Block food_box_basic = new BlockAmmoBox("food_box_basic", (byte)0); - public static Block ammo_box_basic = new BlockAmmoBox("ammo_box_basic", (byte)1); - public static Block crate_basic = new BlockAmmoBox("crate_basic", (byte)2); - - public static Block bedroll = new BlockBedMF("bedroll"); - public static Block cogwork_helm = new BlockCogwork("cogwork_helm", false); - public static Block cogwork_legs = new BlockCogwork("cogwork_legs", false); - public static Block cogwork_chest = new BlockCogwork("cogwork_chest", true); - public static Block frame_block = new BlockFrame("frame_block"); - public static Block cogwork_builder = new BlockFrame("cogwork_builder", frame_block).setCogworkHolder(); - - public static Block cruciblemythic = new BlockCrucible("mythic", 2, false).setAuto().setBlockUnbreakable(); - public static Block cruciblemythic_active = new BlockCrucible("mythic", 2, true).setAuto().setBlockUnbreakable().setLightLevel(12F); - public static Block cruciblemaster = new BlockCrucible("master", 3, false).setAuto().setBlockUnbreakable(); - public static Block cruciblemaster_active = new BlockCrucible("master", 3, true).setAuto().setBlockUnbreakable().setLightLevel(12F); - - public static Block mythic_decor = new BlockMythicDecor(); - public static Block WG_Mark = new BlockWorldGenMarker(); - public static Block components = new BlockComponent(); - public static Block schematic_general = new BlockSchematic("schematic_general"); - public static void load() - { - anvilStone = new BlockAnvilMF(BaseMaterialMF.getMaterial("stone")); - //5:20 default planks - Blocks.fire.setFireInfo(refined_planks, 3, 10); - Blocks.fire.setFireInfo(log_ironbark, 2, 8);//IRONBARK: Logs are resistant to fire but raw planks are not - Blocks.fire.setFireInfo(ironbark_planks, 5, 30); - Blocks.fire.setFireInfo(log_ebony, 3, 10);//EBONY: Resistant - Blocks.fire.setFireInfo(ebony_planks, 3, 10); - - for(int a = 0; a < specialMetalBlocks.length; a++) - { - BaseMaterialMF material = BaseMaterialMF.getMaterial(specialMetalBlocks[a]); - if(material != null) - { - bars[a] = new BlockMetalBarsMF(material); - } - } - for(int a = 0; a < metalBlocks.length; a++) - { - BaseMaterialMF material = BaseMaterialMF.getMaterial(metalBlocks[a]); - if(material != null) - { - storage[a] = new BlockMetalMF(material); - } - } - for(int a = 0; a < anvils.length; a++) - { - BaseMaterialMF material = BaseMaterialMF.getMaterial(anvils[a]); - if(material != null) - { - anvil[a] = new BlockAnvilMF(material); - } - } - - OreDictionary.registerOre("cobblestone", new ItemStack(limestone, 1, 1)); - OreDictionary.registerOre("stone", new ItemStack(limestone, 1, 0)); - OreDictionary.registerOre("limestone", new ItemStack(limestone, 1, OreDictionary.WILDCARD_VALUE)); - OreDictionary.registerOre("cobblestone", new ItemStack(cobble_brick, 1, OreDictionary.WILDCARD_VALUE)); - OreDictionary.registerOre("cobblestone", new ItemStack(cobble_pavement, 1, OreDictionary.WILDCARD_VALUE)); - - OreDictionary.registerOre("blockGlass", new ItemStack(window, 1, OreDictionary.WILDCARD_VALUE)); - OreDictionary.registerOre("blockGlass", new ItemStack(framed_glass, 1, OreDictionary.WILDCARD_VALUE)); - OreDictionary.registerOre("paneGlass", new ItemStack(window_pane, 1, OreDictionary.WILDCARD_VALUE)); - OreDictionary.registerOre("paneGlass", new ItemStack(framed_pane, 1, OreDictionary.WILDCARD_VALUE)); - - OreDictionary.registerOre("planksOakWood", new ItemStack(Blocks.planks, 1, 0)); - OreDictionary.registerOre("planksSpruceWood", new ItemStack(Blocks.planks, 1, 1)); - OreDictionary.registerOre("planksBirchWood", new ItemStack(Blocks.planks, 1, 2)); - OreDictionary.registerOre("planksJungleWood", new ItemStack(Blocks.planks, 1, 3)); - OreDictionary.registerOre("planksAcaciaWood", new ItemStack(Blocks.planks, 1, 4)); - OreDictionary.registerOre("planksDarkOakWood", new ItemStack(Blocks.planks, 1, 5)); - - OreDictionary.registerOre("planksIronbarkWood", ironbark_planks); - OreDictionary.registerOre("planksEbonyWood", ebony_planks); - OreDictionary.registerOre("planksYewWood", yew_planks); - OreDictionary.registerOre("planksIronbarkWood", ironbark_planks); - OreDictionary.registerOre("planksEbonyWood", ebony_planks); - OreDictionary.registerOre("planksYewWood", yew_planks); - - for(ItemStack plank: OreDictionary.getOres("plankWood")) - { - if(plank.getItem().getClass().getName().contains("BlockWoodenDevice")) - { - if(plank.getUnlocalizedName().equalsIgnoreCase("tile.blockWoodenDevice.6")) - { - OreDictionary.registerOre("planksGreatwoodWood", plank); - } - if(plank.getUnlocalizedName().equalsIgnoreCase("tile.blockWoodenDevice.7")) - { - OreDictionary.registerOre("planksSilverwoodWood", plank); - } - } - } - } +public class BlockListMF { + public static final String[] metalBlocks = new String[]{"copper", "tin", "silver", "bronze", "pigiron", "steel", + "blacksteel", "redsteel", "bluesteel", "adamantium", "mithril", "ignotumite", "mithium", "ender"}; + public static final String[] specialMetalBlocks = new String[]{"bronze", "iron", "steel", "blacksteel", + "redsteel", "bluesteel"}; + public static final String[] anvils = new String[]{"bronze", "iron", "steel", "blacksteel", "bluesteel", + "redsteel"}; + + public static Block oreCopper = new BlockOreMF("oreCopper", 0, -1).setHardness(2.0F).setResistance(3.0F); + public static Block oreTin = new BlockOreMF("oreTin", 0).setHardness(2.5F).setResistance(4.0F); + public static Block oreSilver = new BlockOreMF("oreSilver", 2).setHardness(3.0F).setResistance(5.0F); + public static Block oreMythic = new BlockMythicOre("oreMythic", false).setHardness(10.0F).setResistance(100.0F); + + //NEW ORES + public static Block oreMithril = new BlockMithrilOre("oreMithril", false).setHardness(10.0F).setResistance(100.0F); + + + //MF + public static Block oreKaolinite = new BlockOreMF("oreKaolinite", 1, 0, ComponentListMF.kaolinite, 1, 1, 1) + .setHardness(3.0F).setResistance(5.0F); + public static Block oreNitre = new BlockOreMF("oreNitre", 2, 0, ComponentListMF.nitre, 1, 2, 1).setHardness(3.0F) + .setResistance(5.0F); + public static Block oreSulfur = new BlockOreMF("oreSulfur", 2, 0, ComponentListMF.sulfur, 1, 4, 2).setHardness(3.0F) + .setResistance(2.0F); + public static Block oreBorax = new BlockOreMF("oreBorax", 2, 1, ComponentListMF.flux_strong, 1, 8, 4) + .setHardness(3.0F).setResistance(2.0F); + public static Block oreTungsten = new BlockOreMF("oreTungsten", 3, 1, ComponentListMF.oreTungsten, 1, 1, 4) + .setHardness(4.0F).setResistance(2.5F); + public static Block oreClay = new BlockOreMF("oreClay", 0, 0, Items.clay_ball, 1, 4, 1, Material.ground) + .setHardness(0.5F).setStepSound(Block.soundTypeGravel); + public static Block oreCoalRich = new BlockOreMF("oreCoalRich", 2, 1, Items.coal, 2, 6, 2).setHardness(5.0F) + .setResistance(10.0F); + + public static Block mud_brick = new BasicBlockMF("mud_brick", Material.ground).setHardness(1.0F) + .setResistance(0.5F); + public static Block mud_pavement = new BasicBlockMF("mud_pavement", Material.ground).setHardness(0.5F); + + public static Block cobble_brick = new BasicBlockMF("cobble_brick", Material.rock).setHardness(2.5F) + .setResistance(12.0F).setStepSound(Block.soundTypePiston); + public static Block cobble_pavement = new BasicBlockMF("cobble_pavement", Material.rock).setHardness(2.0F) + .setResistance(10.0F).setStepSound(Block.soundTypePiston); + + public static Block window = new BasicBlockMF("window", Material.glass).setHardness(0.9F).setResistance(0.1F) + .setStepSound(Block.soundTypeGlass); + public static Block framed_glass = new BasicBlockMF("framed_glass", Material.glass).setHardness(0.6F) + .setResistance(0.2F).setStepSound(Block.soundTypeGlass); + public static Block framed_pane = new BlockPaneMF("framed_pane", "framed_glass", "framed_glass_pane", + Material.glass, true).setHardness(0.6F).setResistance(0.1F).setStepSound(Block.soundTypeGlass); + public static Block window_pane = new BlockPaneMF("window_pane", "window", "framed_glass_pane", Material.glass, + true).setHardness(0.9F).setResistance(0.2F).setStepSound(Block.soundTypeGlass); + + public static Block thatch = new BasicBlockMF("thatch", Material.leaves).setHardness(1.0F) + .setStepSound(Block.soundTypeGrass); + public static Block thatch_stair = new ConstructionBlockMF.StairsConstBlock("thatch_stair", thatch) + .register("thatch_stair"); + + // public static Block limestone_cobblestone = new + // BasicBlockMF("limestone_cobblestone", + // Material.rock).setHardness(0.8F).setResistance(4.0F).setStepSound(Block.soundTypePiston); + // public static Block limestone = new BasicBlockMF("limestone", Material.rock, + // limestone_cobblestone).setHardness(1.0F).setResistance(5.0F).setStepSound(Block.soundTypeStone); + + public static Block limestone = new ConstructionBlockMF("limestone").setHardness(1.2F).setResistance(8F); + + public static Block firebricks = new BasicBlockMF("firebricks", Material.rock).setHardness(5.0F) + .setResistance(15.0F).setStepSound(Block.soundTypePiston); + public static Block clayWall = new BasicBlockMF("clayWall", Material.wood).setHardness(1.0F).setResistance(1.0F) + .setStepSound(Block.soundTypeWood); + + public static BlockMetalBarsMF[] bars = new BlockMetalBarsMF[specialMetalBlocks.length]; + public static BlockMetalMF[] storage = new BlockMetalMF[metalBlocks.length]; + public static BlockAnvilMF anvilStone; + public static BlockAnvilMF[] anvil = new BlockAnvilMF[anvils.length]; + public static BlockCarpenter carpenter = new BlockCarpenter(); + public static BlockBombBench bombBench = new BlockBombBench(); + public static BlockCrossbowBench crossbowBench = new BlockCrossbowBench(); + + public static Block cheese_wheel = new BlockCakeMF("cheese", FoodListMF.cheese_slice).setCheese(); + + public static Block cake_vanilla = new BlockCakeMF("cake_vanilla", FoodListMF.cake_slice); + public static Block cake_carrot = new BlockCakeMF("cake_carrot", FoodListMF.carrotcake_slice); + public static Block cake_chocolate = new BlockCakeMF("cake_chocolate", FoodListMF.choccake_slice); + public static Block cake_bf = new BlockCakeMF("cake_bf", FoodListMF.bfcake_slice); + + public static Block pie_meat = new BlockPie("pie_meat", FoodListMF.meatpie_slice); + + public static Block pie_apple = new BlockPie("pie_apple", FoodListMF.pieslice_apple); + public static Block pie_berry = new BlockPie("pie_berry", FoodListMF.pieslice_berry); + + public static Block pie_shepards = new BlockPie("pie_shepards", FoodListMF.pieslice_shepards); + + public static Block berryBush = new BlockBerryBush("berries"); + public static Block blast_chamber = new BlockBFC(); + public static Block blast_heater = new BlockBFH(false); + public static Block blast_heater_active = new BlockBFH(true).setLightLevel(10F); + + public static Block crucible = new BlockCrucible("stone", 0, false); + public static Block crucible_active = new BlockCrucible("stone", 0, true).setLightLevel(12F); + public static Block crucibleadv = new BlockCrucible("fireclay", 1, false); + public static Block crucibleadv_active = new BlockCrucible("fireclay", 1, true).setLightLevel(12F); + public static Block crucibleauto = new BlockCrucible("auto", 1, false).setAuto().setHardness(12F); + public static Block crucibleauto_active = new BlockCrucible("auto", 1, true).setAuto().setHardness(12F) + .setLightLevel(12F); + + public static Block chimney_stone = new BlockChimney("stone", false, false, 5); + public static Block chimney_stone_wide = new BlockChimney("stone", true, false, 10); + public static Block chimney_stone_extractor = new BlockChimney("stone_extractor", true, true, 15); + public static Block chimney_pipe = new BlockChimney("pipe", false, false, 10).setPipe(); + + public static Block tanner = new BlockTanningRack(0, ""); + + public static Block forge = new BlockForge("stone", 0, false); + public static Block forge_active = new BlockForge("stone", 0, true); + public static Block forge_metal = new BlockForge("metal", 1, false); + public static Block forge_metal_active = new BlockForge("metal", 1, true); + + public static Block repair_basic = new BlockRepairKit("basic", 0.25F, 0.05F, 0.2F); + public static Block repair_advanced = new BlockRepairKit("advanced", 1.0F, 0.2F, 0.05F); + public static Block repair_ornate = new BlockRepairKit("ornate", 1.0F, 0.25F, 0.03F).setOrnate(0.5F); + + public static Block bellows = new BlockBellows(); + + public static Block refined_planks = new BasicBlockMF("refined_planks", Material.wood).setHardness(2.5F) + .setResistance(10F).setStepSound(Block.soundTypeWood); + public static Block nailed_planks = new BasicBlockMF("nailed_planks", Material.wood).setHardness(1.5F) + .setResistance(7F).setStepSound(Block.soundTypeWood); + public static Block refined_planks_stair = new ConstructionBlockMF.StairsConstBlock("refined_planks_stair", + refined_planks).register("refined_planks_stair"); + public static Block nailed_planks_stair = new ConstructionBlockMF.StairsConstBlock("nailed_planks_stair", + nailed_planks).register("nailed_planks_stair"); + + public static Block reinforced_stone = new BlockReinforcedStone("reinforced_stone", "base", "engraved", "dshall_0", + "dshall_1", "dshall_2").setHardness(2.0F).setResistance(15F).setStepSound(Block.soundTypeStone); + public static Block reinforced_stone_bricks = new BlockReinforcedStone("reinforced_stone_bricks", "base", "mossy", + "cracked").setHardness(2.0F).setResistance(15F).setStepSound(Block.soundTypeStone); + public static Block reinforced_stone_framed = new BasicBlockMF("reinforced_stone_framed", Material.rock) + .setHardness(2.5F).setResistance(20F).setStepSound(Block.soundTypeStone); + public static Block reinforced_stone_framediron = new BasicBlockMF("reinforced_stone_framediron", Material.rock) + .setHardness(2.5F).setResistance(20F).setStepSound(Block.soundTypeStone) + .setBlockName("reinforced_stone_framed"); + + public static Block advTanner = new BlockTanningRack(1, "Strong"); + public static Block research = new BlockResearchStation(); + public static Block trough_wood = new BlockTrough("trough_wood"); + public static Block engTanner = new BlockEngineerTanner(2, "Metal"); + + public static Block bombPress = new BlockBombPress(); + + public static Block road = new BlockRoad("road_mf", 14F); + public static Block lowroad = new BlockRoad("road_mf_short", 7F); + + public static Block salvage_basic = new BlockSalvage("basic", 1.0F); + public static Block bloomery = new BlockBloomery(); + public static Block log_yew = new BlockLogMF("yew").setHardness(2F).setResistance(6F); + public static Block log_ironbark = new BlockLogMF("ironbark").setHardness(3F).setResistance(8F); + public static Block log_ebony = new BlockLogMF("ebony").setHardness(5F).setResistance(10F); + + public static Block leaves_yew = new BlockLeavesMF("yew", 100); + public static Block leaves_ironbark = new BlockLeavesMF("ironbark", 40).setHardness(0.3F); + public static Block leaves_ebony = new BlockLeavesMF("ebony", 1000).setHardness(0.5F); + + public static Block sapling_yew = new BlockSaplingMF("yew", log_yew, leaves_yew, 4F); + public static Block sapling_ironbark = new BlockSaplingMF("ironbark", log_ironbark, leaves_ironbark, 8F); + public static Block sapling_ebony = new BlockSaplingMF("ebony", log_ebony, leaves_ebony, 10F); + + public static Block yew_planks = new BasicBlockMF("yew_planks", Material.wood).setHardness(3F).setResistance(6F) + .setStepSound(Block.soundTypeWood); + public static Block ironbark_planks = new BasicBlockMF("ironbark_planks", Material.wood).setHardness(4F) + .setResistance(10F).setStepSound(Block.soundTypeWood); + public static Block ebony_planks = new BasicBlockMF("ebony_planks", Material.wood).setHardness(6F) + .setResistance(12F).setStepSound(Block.soundTypeWood); + + public static Block quern = new BlockQuern("quern"); + + public static Block mud_brick_stair = new ConstructionBlockMF.StairsConstBlock("mud_brick_stair", mud_brick) + .register("mud_brick_stair"); + public static Block mud_pavement_stair = new ConstructionBlockMF.StairsConstBlock("mud_pavement_stair", + mud_pavement).register("mud_pavement_stair"); + public static Block cobble_brick_stair = new ConstructionBlockMF.StairsConstBlock("cobble_brick_stair", + cobble_brick).register("cobble_brick_stair"); + public static Block cobble_pavement_stair = new ConstructionBlockMF.StairsConstBlock("cobble_pavement_stair", + cobble_pavement).register("cobble_pavement_stair"); + public static Block firebrick_stair = new ConstructionBlockMF.StairsConstBlock("firebrick_stair", firebricks) + .register("firebrick_stair"); + public static Block reinforced_stone_stair = new ConstructionBlockMF.StairsConstBlock("reinforced_stone_stair", + reinforced_stone).register("reinforced_stone_stair"); + public static Block reinforced_stone_brick_stair = new ConstructionBlockMF.StairsConstBlock( + "reinforced_stone_brick_stair", reinforced_stone_bricks).register("reinforced_stone_brick_stair"); + + public static Block yew_stair = new ConstructionBlockMF.StairsConstBlock("yew_stair", yew_planks) + .register("yew_stair"); + public static Block ironbark_stair = new ConstructionBlockMF.StairsConstBlock("ironbark_stair", ironbark_planks) + .register("ironbark_stair"); + public static Block ebony_stair = new ConstructionBlockMF.StairsConstBlock("ebony_stair", ebony_planks) + .register("ebony_stair"); + + public static Block firepit = new BlockFirepit(); + public static Block roast = new BlockRoast(0, "basic", false); + public static Block oven_stone = new BlockRoast(0, "basic", true); + + public static Block furnace_heater = new BlockBigFurnace("furnace_heater", true, -1); + public static Block furnace_stone = new BlockBigFurnace("furnace_stone", false, 0); + + public static Block rack_wood = new BlockRack("rack_wood"); + public static Block food_box_basic = new BlockAmmoBox("food_box_basic", (byte) 0); + public static Block ammo_box_basic = new BlockAmmoBox("ammo_box_basic", (byte) 1); + public static Block crate_basic = new BlockAmmoBox("crate_basic", (byte) 2); + + public static Block bedroll = new BlockBedMF("bedroll"); + public static Block cogwork_helm = new BlockCogwork("cogwork_helm", false); + public static Block cogwork_legs = new BlockCogwork("cogwork_legs", false); + public static Block cogwork_chest = new BlockCogwork("cogwork_chest", true); + public static Block frame_block = new BlockFrame("frame_block"); + public static Block cogwork_builder = new BlockFrame("cogwork_builder", frame_block).setCogworkHolder(); + + public static Block cruciblemythic = new BlockCrucible("mythic", 2, false).setAuto().setBlockUnbreakable(); + public static Block cruciblemythic_active = new BlockCrucible("mythic", 2, true).setAuto().setBlockUnbreakable() + .setLightLevel(12F); + public static Block cruciblemaster = new BlockCrucible("master", 3, false).setAuto().setBlockUnbreakable(); + public static Block cruciblemaster_active = new BlockCrucible("master", 3, true).setAuto().setBlockUnbreakable() + .setLightLevel(12F); + + public static Block mythic_decor = new BlockMythicDecor(); + public static Block WG_Mark = new BlockWorldGenMarker(); + public static Block components = new BlockComponent(); + public static Block schematic_general = new BlockSchematic("schematic_general"); + + public static void load() { + anvilStone = new BlockAnvilMF(BaseMaterialMF.getMaterial("stone")); + // 5:20 default planks + Blocks.fire.setFireInfo(refined_planks, 3, 10); + Blocks.fire.setFireInfo(log_ironbark, 2, 8);// IRONBARK: Logs are resistant to fire but raw planks are not + Blocks.fire.setFireInfo(ironbark_planks, 5, 30); + Blocks.fire.setFireInfo(log_ebony, 3, 10);// EBONY: Resistant + Blocks.fire.setFireInfo(ebony_planks, 3, 10); + + for (int a = 0; a < specialMetalBlocks.length; a++) { + BaseMaterialMF material = BaseMaterialMF.getMaterial(specialMetalBlocks[a]); + if (material != null) { + bars[a] = new BlockMetalBarsMF(material); + } + } + for (int a = 0; a < metalBlocks.length; a++) { + BaseMaterialMF material = BaseMaterialMF.getMaterial(metalBlocks[a]); + if (material != null) { + storage[a] = new BlockMetalMF(material); + } + } + for (int a = 0; a < anvils.length; a++) { + BaseMaterialMF material = BaseMaterialMF.getMaterial(anvils[a]); + if (material != null) { + anvil[a] = new BlockAnvilMF(material); + } + } + + OreDictionary.registerOre("cobblestone", new ItemStack(limestone, 1, 1)); + OreDictionary.registerOre("stone", new ItemStack(limestone, 1, 0)); + OreDictionary.registerOre("limestone", new ItemStack(limestone, 1, OreDictionary.WILDCARD_VALUE)); + OreDictionary.registerOre("cobblestone", new ItemStack(cobble_brick, 1, OreDictionary.WILDCARD_VALUE)); + OreDictionary.registerOre("cobblestone", new ItemStack(cobble_pavement, 1, OreDictionary.WILDCARD_VALUE)); + + OreDictionary.registerOre("blockGlass", new ItemStack(window, 1, OreDictionary.WILDCARD_VALUE)); + OreDictionary.registerOre("blockGlass", new ItemStack(framed_glass, 1, OreDictionary.WILDCARD_VALUE)); + OreDictionary.registerOre("paneGlass", new ItemStack(window_pane, 1, OreDictionary.WILDCARD_VALUE)); + OreDictionary.registerOre("paneGlass", new ItemStack(framed_pane, 1, OreDictionary.WILDCARD_VALUE)); + + OreDictionary.registerOre("planksOakWood", new ItemStack(Blocks.planks, 1, 0)); + OreDictionary.registerOre("planksSpruceWood", new ItemStack(Blocks.planks, 1, 1)); + OreDictionary.registerOre("planksBirchWood", new ItemStack(Blocks.planks, 1, 2)); + OreDictionary.registerOre("planksJungleWood", new ItemStack(Blocks.planks, 1, 3)); + OreDictionary.registerOre("planksAcaciaWood", new ItemStack(Blocks.planks, 1, 4)); + OreDictionary.registerOre("planksDarkOakWood", new ItemStack(Blocks.planks, 1, 5)); + + OreDictionary.registerOre("planksIronbarkWood", ironbark_planks); + OreDictionary.registerOre("planksEbonyWood", ebony_planks); + OreDictionary.registerOre("planksYewWood", yew_planks); + OreDictionary.registerOre("planksIronbarkWood", ironbark_planks); + OreDictionary.registerOre("planksEbonyWood", ebony_planks); + OreDictionary.registerOre("planksYewWood", yew_planks); + + for (ItemStack plank : OreDictionary.getOres("plankWood")) { + if (plank.getItem().getClass().getName().contains("BlockWoodenDevice")) { + if (plank.getUnlocalizedName().equalsIgnoreCase("tile.blockWoodenDevice.6")) { + OreDictionary.registerOre("planksGreatwoodWood", plank); + } + if (plank.getUnlocalizedName().equalsIgnoreCase("tile.blockWoodenDevice.7")) { + OreDictionary.registerOre("planksSilverwoodWood", plank); + } + } + } + } } diff --git a/src/main/java/minefantasy/mf2/block/refining/BlockBFC.java b/src/main/java/minefantasy/mf2/block/refining/BlockBFC.java index b766fe42..c71c6a88 100644 --- a/src/main/java/minefantasy/mf2/block/refining/BlockBFC.java +++ b/src/main/java/minefantasy/mf2/block/refining/BlockBFC.java @@ -1,13 +1,10 @@ package minefantasy.mf2.block.refining; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.knowledge.ResearchLogic; -import minefantasy.mf2.block.tileentity.TileEntityCarpenterMF; import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFC; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.knowledge.KnowledgeListMF; @@ -17,7 +14,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -26,79 +22,73 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class BlockBFC extends BlockContainer -{ - private Random rand = new Random(); - public IIcon bottomTex; - public IIcon sideTex; - public BlockBFC() - { - super(Material.anvil); + +import java.util.Random; + +public class BlockBFC extends BlockContainer { + public IIcon bottomTex; + public IIcon sideTex; + private Random rand = new Random(); + + public BlockBFC() { + super(Material.anvil); GameRegistry.registerBlock(this, "MF_BlastChamber"); - setBlockName("blastfurnchamber"); - this.setStepSound(Block.soundTypeMetal); - this.setHardness(8F); - this.setResistance(10F); + setBlockName("blastfurnchamber"); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(8F); + this.setResistance(10F); this.setCreativeTab(CreativeTabMF.tabUtil); - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityBlastFC(); - } - - private TileEntityBlastFC getTile(IBlockAccess world, int x, int y, int z) - { - return (TileEntityBlastFC)world.getTileEntity(x, y, z); - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbour) - { - TileEntityBlastFC tile = getTile(world, x, y, z); - if(tile != null)tile.updateBuild(); } - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityBlastFC tile = getTile(world, x, y, z); + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityBlastFC(); + } + + private TileEntityBlastFC getTile(IBlockAccess world, int x, int y, int z) { + return (TileEntityBlastFC) world.getTileEntity(x, y, z); + } + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbour) { + TileEntityBlastFC tile = getTile(world, x, y, z); if (tile != null) - { - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { + tile.updateBuild(); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityBlastFC tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -109,44 +99,38 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - if(side == 1 || side == 0) - { - return bottomTex; - } - return sideTex; - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - if(!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.blastfurn)) - { - if(world.isRemote) - user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); - return false; + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + if (side == 1 || side == 0) { + return bottomTex; + } + return sideTex; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + if (!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.blastfurn)) { + if (world.isRemote) + user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); + return false; + } + TileEntityBlastFC tile = getTile(world, x, y, z); + if (tile != null) { + if (!world.isRemote) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } } - TileEntityBlastFC tile = getTile(world, x, y, z); - if(tile != null) - { - if(!world.isRemote) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } return true; } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - sideTex = reg.registerIcon("minefantasy2:processor/blast_chamber_side"); - bottomTex = reg.registerIcon("minefantasy2:processor/blast_chamber_top"); - } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + sideTex = reg.registerIcon("minefantasy2:processor/blast_chamber_side"); + bottomTex = reg.registerIcon("minefantasy2:processor/blast_chamber_top"); + } } diff --git a/src/main/java/minefantasy/mf2/block/refining/BlockBFH.java b/src/main/java/minefantasy/mf2/block/refining/BlockBFH.java index 7927f05c..a088651b 100644 --- a/src/main/java/minefantasy/mf2/block/refining/BlockBFH.java +++ b/src/main/java/minefantasy/mf2/block/refining/BlockBFH.java @@ -1,15 +1,11 @@ package minefantasy.mf2.block.refining; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.block.tileentity.TileEntityCarpenterMF; import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFH; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.knowledge.KnowledgeListMF; @@ -20,7 +16,6 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -30,103 +25,116 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class BlockBFH extends BlockContainer -{ - private static boolean keepInventory; - private Random rand = new Random(); - public IIcon bottomTex; - public IIcon sideTex; - public boolean isActive; - public BlockBFH(boolean isActive) - { - super(Material.anvil); - this.isActive = isActive; + +import java.util.List; +import java.util.Random; + +public class BlockBFH extends BlockContainer { + private static boolean keepInventory; + public IIcon bottomTex; + public IIcon sideTex; + public boolean isActive; + private Random rand = new Random(); + + public BlockBFH(boolean isActive) { + super(Material.anvil); + this.isActive = isActive; GameRegistry.registerBlock(this, isActive ? "MF_BlastHeaterActive" : "MF_BlastHeater"); - setBlockName("blastfurnheater"); - this.setStepSound(Block.soundTypeMetal); - this.setHardness(10F); - this.setResistance(10F); + setBlockName("blastfurnheater"); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(10F); + this.setResistance(10F); this.setCreativeTab(CreativeTabMF.tabUtil); - } - - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random rand) - { - if (isActive && rand.nextInt(20) == 0) - { - world.playSound((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); + } + + public static void updateFurnaceBlockState(boolean state, World world, int x, int y, int z) { + int l = world.getBlockMetadata(x, y, z); + TileEntity tileentity = world.getTileEntity(x, y, z); + keepInventory = true; + + if (state) { + world.setBlock(x, y, z, BlockListMF.blast_heater_active); + } else { + world.setBlock(x, y, z, BlockListMF.blast_heater); + } + + keepInventory = false; + world.setBlockMetadataWithNotify(x, y, z, l, 2); + + if (tileentity != null) { + tileentity.validate(); + world.setTileEntity(x, y, z, tileentity); } } - @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) - { - if(!isActive) - { - super.getSubBlocks(item, tab, list); - } + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random rand) { + if (isActive && rand.nextInt(20) == 0) { + world.playSound(x + 0.5F, y + 0.5F, z + 0.5F, "fire.fire", 1.0F + rand.nextFloat(), + rand.nextFloat() * 0.7F + 0.3F, false); + } } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityBlastFH(); - } - - private TileEntityBlastFH getTile(IBlockAccess world, int x, int y, int z) - { - return (TileEntityBlastFH)world.getTileEntity(x, y, z); - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbour) - { - TileEntityBlastFH tile = getTile(world, x, y, z); - if(tile != null)tile.updateBuild(); + + @Override + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + if (!isActive) { + super.getSubBlocks(item, tab, list); + } } - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - if(keepInventory)return; - - TileEntityBlastFH tile = getTile(world, x, y, z); + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityBlastFH(); + } + + private TileEntityBlastFH getTile(IBlockAccess world, int x, int y, int z) { + return (TileEntityBlastFH) world.getTileEntity(x, y, z); + } + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbour) { + TileEntityBlastFH tile = getTile(world, x, y, z); if (tile != null) - { - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { + tile.updateBuild(); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + if (keepInventory) + return; + + TileEntityBlastFH tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -137,75 +145,44 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - if(side == 1 || side == 0) - { - return bottomTex; - } - return sideTex; - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - if(!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.blastfurn)) - { - if(world.isRemote) - user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); - return false; + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + if (side == 1 || side == 0) { + return bottomTex; } - TileEntityBlastFH tile = getTile(world, x, y, z); - if(tile != null) - { - if(!world.isRemote) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } - return true; + return sideTex; } - - public static void updateFurnaceBlockState(boolean state, World world, int x, int y, int z) - { - int l = world.getBlockMetadata(x, y, z); - TileEntity tileentity = world.getTileEntity(x, y, z); - keepInventory = true; - if (state) - { - world.setBlock(x, y, z, BlockListMF.blast_heater_active); + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + if (!ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.blastfurn)) { + if (world.isRemote) + user.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("knowledge.unknownUse"))); + return false; } - else - { - world.setBlock(x, y, z, BlockListMF.blast_heater); + TileEntityBlastFH tile = getTile(world, x, y, z); + if (tile != null) { + if (!world.isRemote) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } } + return true; + } - keepInventory = false; - world.setBlockMetadataWithNotify(x, y, z, l, 2); - - if (tileentity != null) - { - tileentity.validate(); - world.setTileEntity(x, y, z, tileentity); - } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + sideTex = isActive ? reg.registerIcon("minefantasy2:processor/blast_heater_active") + : reg.registerIcon("minefantasy2:processor/blast_heater"); + bottomTex = reg.registerIcon("minefantasy2:processor/blast_chamber_top"); } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - sideTex = isActive ? reg.registerIcon("minefantasy2:processor/blast_heater_active") : reg.registerIcon("minefantasy2:processor/blast_heater"); - bottomTex = reg.registerIcon("minefantasy2:processor/blast_chamber_top"); - } - - @Override - @SideOnly(Side.CLIENT) - public Item getItem(World world, int x, int y, int z) - { + + @Override + @SideOnly(Side.CLIENT) + public Item getItem(World world, int x, int y, int z) { return Item.getItemFromBlock(BlockListMF.blast_heater); } diff --git a/src/main/java/minefantasy/mf2/block/refining/BlockBellows.java b/src/main/java/minefantasy/mf2/block/refining/BlockBellows.java index 213181f0..5d4b0f41 100644 --- a/src/main/java/minefantasy/mf2/block/refining/BlockBellows.java +++ b/src/main/java/minefantasy/mf2/block/refining/BlockBellows.java @@ -1,7 +1,8 @@ package minefantasy.mf2.block.refining; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.tileentity.TileEntityBellows; import minefantasy.mf2.item.list.CreativeTabMF; import net.minecraft.block.BlockContainer; @@ -15,80 +16,73 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.Random; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class BlockBellows extends BlockContainer -{ - public static int bellows_RI = 105; - +public class BlockBellows extends BlockContainer { + public static int bellows_RI = 105; + private Random rand = new Random(); - public BlockBellows() - { + public BlockBellows() { super(Material.wood); GameRegistry.registerBlock(this, "MF_Bellows"); - setBlockName("bellows"); - this.setHardness(1F); - this.setResistance(0.5F); + setBlockName("bellows"); + this.setHardness(1F); + this.setResistance(0.5F); this.setCreativeTab(CreativeTabMF.tabUtil); } + @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } + @Override - public IIcon getIcon(int side, int meta) - { - return Blocks.planks.getIcon(side, 0); + public IIcon getIcon(int side, int meta) { + return Blocks.planks.getIcon(side, 0); } + @SideOnly(Side.CLIENT) - public int getRenderType() - { - return bellows_RI; + public int getRenderType() { + return bellows_RI; } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) - { - int direction = MathHelper.floor_double((double)(user.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase user, ItemStack item) { + int direction = MathHelper.floor_double(user.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, float f2) - { - TileEntityBellows bellows = (TileEntityBellows)world.getTileEntity(x, y, z); - if(bellows != null) - { - bellows.interact(player, 2F); - } - return true; + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, + float f2) { + TileEntityBellows bellows = (TileEntityBellows) world.getTileEntity(x, y, z); + if (bellows != null) { + bellows.interact(player, 2F); + } + return true; } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityBellows(); - } - + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityBellows(); + } - @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister reg){} + public void registerBlockIcons(IIconRegister reg) { + } } diff --git a/src/main/java/minefantasy/mf2/block/refining/BlockBigFurnace.java b/src/main/java/minefantasy/mf2/block/refining/BlockBigFurnace.java index a8dfba0d..b13323bb 100644 --- a/src/main/java/minefantasy/mf2/block/refining/BlockBigFurnace.java +++ b/src/main/java/minefantasy/mf2/block/refining/BlockBigFurnace.java @@ -1,7 +1,5 @@ package minefantasy.mf2.block.refining; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -24,41 +22,41 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockBigFurnace extends BlockContainer -{ +import java.util.Random; + +public class BlockBigFurnace extends BlockContainer { + public static int furn_RI = 114; /** - * Is the random generator used by furnace to drop the inventory contents in random directions. + * This flag is used to prevent the furnace inventory to be dropped upon block + * removal, is used internally when the furnace block changes from idle to + * active and vice-versa. */ - private Random rand = new Random(); + private static boolean keepFurnaceInventory = false; public final boolean isHeater; public final int tier; - /** - * This flag is used to prevent the furnace inventory to be dropped upon block removal, is used internally when the - * furnace block changes from idle to active and vice-versa. + * Is the random generator used by furnace to drop the inventory contents in + * random directions. */ - private static boolean keepFurnaceInventory = false; - public static int furn_RI = 114; + private Random rand = new Random(); - public BlockBigFurnace(String name, boolean isHeater, int tier) - { + public BlockBigFurnace(String name, boolean isHeater, int tier) { super(Material.rock); this.isHeater = isHeater; this.tier = tier; this.setCreativeTab(CreativeTabMF.tabUtil); GameRegistry.registerBlock(this, name); - setBlockName(name); - this.setStepSound(Block.soundTypeStone); - this.setHardness(3.5F); - this.setResistance(2F); + setBlockName(name); + this.setStepSound(Block.soundTypeStone); + this.setHardness(3.5F); + this.setResistance(2F); } - + @Override - public IIcon getIcon(int side, int meta) - { - return BlockListMF.firebricks.getIcon(side, meta); + public IIcon getIcon(int side, int meta) { + return BlockListMF.firebricks.getIcon(side, meta); } - + public boolean isOpaqueCube() { return false; } @@ -66,51 +64,43 @@ public boolean isOpaqueCube() { public boolean renderAsNormalBlock() { return false; } - @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null && tile instanceof TileEntityBigFurnace) - { - if(((TileEntityBigFurnace)tile).isBurning()) - { - return 10; - } - } - return super.getLightValue(world, x, y, z); + public int getLightValue(IBlockAccess world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof TileEntityBigFurnace) { + if (((TileEntityBigFurnace) tile).isBurning()) { + return 10; + } + } + return super.getLightValue(world, x, y, z); } + /** * Called whenever the block is added into the world. Args: world, x, y, z */ - public void onBlockAdded(World world, int x, int y, int z) - { + public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); } + @Override @SideOnly(Side.CLIENT) - public int getRenderType() - { - return furn_RI; + public int getRenderType() { + return furn_RI; } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, float f2) - { - if (world.isRemote) - { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f1, + float f2) { + if (world.isRemote) { return true; - } - else - { - TileEntityBigFurnace tile = (TileEntityBigFurnace)world.getTileEntity(x, y, z); + } else { + TileEntityBigFurnace tile = (TileEntityBigFurnace) world.getTileEntity(x, y, z); ItemStack item = player.getHeldItem(); - - if (tile != null) - { - player.openGui(MineFantasyII.instance, 0, world, x, y, z); + + if (tile != null) { + player.openGui(MineFantasyII.instance, 0, world, x, y, z); } return true; @@ -118,12 +108,9 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p } /** - - /** - * Returns the TileEntity used by this block. + * /** Returns the TileEntity used by this block. */ - public TileEntity createNewTileEntity(World world, int meta) - { + public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityBigFurnace(); } @@ -132,7 +119,7 @@ public TileEntity createNewTileEntity(World world, int meta) */ @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack item) { - int dir = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int dir = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 2); } @@ -141,45 +128,38 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase e * Called whenever the block is removed. */ @Override - public void breakBlock(World world, int x, int y, int z, Block i1, int i2) - { - if (!keepFurnaceInventory) - { - TileEntityBigFurnace tile = (TileEntityBigFurnace)world.getTileEntity(x, y, z); - - if (tile != null) - { - for (int var6 = 0; var6 < tile.getSizeInventory(); ++var6) - { + public void breakBlock(World world, int x, int y, int z, Block i1, int i2) { + if (!keepFurnaceInventory) { + TileEntityBigFurnace tile = (TileEntityBigFurnace) world.getTileEntity(x, y, z); + + if (tile != null) { + for (int var6 = 0; var6 < tile.getSizeInventory(); ++var6) { ItemStack var7 = tile.getStackInSlot(var6); - if (var7 != null) - { + if (var7 != null) { float var8 = this.rand.nextFloat() * 0.8F + 0.1F; float var9 = this.rand.nextFloat() * 0.8F + 0.1F; float var10 = this.rand.nextFloat() * 0.8F + 0.1F; - while (var7.stackSize > 0) - { + while (var7.stackSize > 0) { int var11 = this.rand.nextInt(21) + 10; - if (var11 > var7.stackSize) - { + if (var11 > var7.stackSize) { var11 = var7.stackSize; } var7.stackSize -= var11; - EntityItem var12 = new EntityItem(world, (double)((float)x + var8), (double)((float)y + var9), (double)((float)z + var10), new ItemStack(var7.getItem(), var11, var7.getItemDamage())); + EntityItem var12 = new EntityItem(world, x + var8, y + var9, z + var10, + new ItemStack(var7.getItem(), var11, var7.getItemDamage())); - if (var7.hasTagCompound()) - { - var12.getEntityItem().setTagCompound((NBTTagCompound)var7.getTagCompound().copy()); + if (var7.hasTagCompound()) { + var12.getEntityItem().setTagCompound((NBTTagCompound) var7.getTagCompound().copy()); } float var13 = 0.05F; - var12.motionX = (double)((float)this.rand.nextGaussian() * var13); - var12.motionY = (double)((float)this.rand.nextGaussian() * var13 + 0.2F); - var12.motionZ = (double)((float)this.rand.nextGaussian() * var13); + var12.motionX = (float) this.rand.nextGaussian() * var13; + var12.motionY = (float) this.rand.nextGaussian() * var13 + 0.2F; + var12.motionZ = (float) this.rand.nextGaussian() * var13; world.spawnEntityInWorld(var12); } } @@ -192,5 +172,6 @@ public void breakBlock(World world, int x, int y, int z, Block i1, int i2) @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister reg){} + public void registerBlockIcons(IIconRegister reg) { + } } diff --git a/src/main/java/minefantasy/mf2/block/refining/BlockBloomery.java b/src/main/java/minefantasy/mf2/block/refining/BlockBloomery.java index 82819734..eb545dbd 100644 --- a/src/main/java/minefantasy/mf2/block/refining/BlockBloomery.java +++ b/src/main/java/minefantasy/mf2/block/refining/BlockBloomery.java @@ -1,115 +1,97 @@ package minefantasy.mf2.block.refining; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.api.knowledge.ResearchLogic; -import minefantasy.mf2.api.tool.ILighter; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.tileentity.TileEntityBloomery; -import minefantasy.mf2.block.tileentity.TileEntityCarpenterMF; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.tool.ItemLighterMF; -import minefantasy.mf2.knowledge.KnowledgeListMF; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemFlintAndSteel; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class BlockBloomery extends BlockContainer -{ - public static int bloomery_RI = 109; - - private Random rand = new Random(); - public IIcon bottomTex; - public IIcon sideTex; - public BlockBloomery() - { - super(Material.rock); + +import java.util.Random; + +public class BlockBloomery extends BlockContainer { + public static int bloomery_RI = 109; + public IIcon bottomTex; + public IIcon sideTex; + private Random rand = new Random(); + + public BlockBloomery() { + super(Material.rock); GameRegistry.registerBlock(this, "MF_Bloomery"); - setBlockName("bloomery"); - this.setStepSound(Block.soundTypeStone); - this.setHardness(8F); - this.setResistance(10F); + setBlockName("bloomery"); + this.setStepSound(Block.soundTypeStone); + this.setHardness(8F); + this.setResistance(10F); this.setCreativeTab(CreativeTabMF.tabUtil); - } - @Override - public boolean isOpaqueCube() - { + } + + @Override + public boolean isOpaqueCube() { return false; } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityBloomery(); - } - - private TileEntityBloomery getTile(IBlockAccess world, int x, int y, int z) - { - return (TileEntityBloomery)world.getTileEntity(x, y, z); - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityBloomery tile = getTile(world, x, y, z); - - if (tile != null) - { - for (int i1 = 0; i1 < (tile.getSizeInventory()-1); ++i1)//breaking does not retrieve the result + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityBloomery(); + } + + private TileEntityBloomery getTile(IBlockAccess world, int x, int y, int z) { + return (TileEntityBloomery) world.getTileEntity(x, y, z); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityBloomery tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < (tile.getSizeInventory() - 1); ++i1)// breaking does not retrieve the result { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -120,69 +102,62 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - TileEntityBloomery tile = getTile(world, x, y, z); - if(tile != null) - { - ItemStack held = user.getHeldItem(); - - //Hammer - if(!user.isSwingInProgress && tile.tryHammer(user)) - { - return true; - } - //Light - int l = ItemLighterMF.tryUse(held, user); - if(!tile.isActive && !tile.hasBloom()) - { - if(held != null && l != 0) - { - user.playSound("fire.ignite", 1.0F, 1.0F); - if(world.isRemote)return true; - if(l == 1 && tile.light(user)) - { - held.damageItem(1, user); - } - return true; - } - } - //GUI - if(!world.isRemote && !tile.isActive && !tile.hasBloom()) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + TileEntityBloomery tile = getTile(world, x, y, z); + if (tile != null) { + ItemStack held = user.getHeldItem(); + + // Hammer + if (!user.isSwingInProgress && tile.tryHammer(user)) { + return true; + } + // Light + int l = ItemLighterMF.tryUse(held, user); + if (!tile.isActive && !tile.hasBloom()) { + if (held != null && l != 0) { + user.playSound("fire.ignite", 1.0F, 1.0F); + if (world.isRemote) + return true; + if (l == 1 && tile.light(user)) { + held.damageItem(1, user); + } + return true; + } + } + // GUI + if (!world.isRemote && !tile.isActive && !tile.hasBloom()) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } + } return true; } - @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { - TileEntityBloomery tile = getTile(world, x, y, z); - if(tile != null) - { - if(user.swingProgress <= 0.1F) - { - tile.tryHammer(user); - } - } + + @Override + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { + TileEntityBloomery tile = getTile(world, x, y, z); + if (tile != null) { + if (user.swingProgress <= 0.1F) { + tile.tryHammer(user); + } + } + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister reg) { } - - @SideOnly(Side.CLIENT) + @Override - public void registerBlockIcons(IIconRegister reg){} - - @Override - public IIcon getIcon(int side, int meta) - { - return BlockListMF.crucible.getIcon(side, 0); + public IIcon getIcon(int side, int meta) { + return BlockListMF.crucible.getIcon(side, 0); } + @SideOnly(Side.CLIENT) - public int getRenderType() - { - return bloomery_RI; + public int getRenderType() { + return bloomery_RI; } } diff --git a/src/main/java/minefantasy/mf2/block/refining/BlockChimney.java b/src/main/java/minefantasy/mf2/block/refining/BlockChimney.java index cb86e9e4..f4e96de1 100644 --- a/src/main/java/minefantasy/mf2/block/refining/BlockChimney.java +++ b/src/main/java/minefantasy/mf2/block/refining/BlockChimney.java @@ -1,186 +1,138 @@ package minefantasy.mf2.block.refining; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.tileentity.TileEntityChimney; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.knowledge.KnowledgeListMF; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class BlockChimney extends BlockContainer -{ - private Random rand = new Random(); - public IIcon bottomTex; - public IIcon sideTex; - public int size; - private boolean isWide; - /** - * Weather it can absorb smoke indirectly (not directly above a source) - */ - public boolean isIndirect; - private String chimneyType; - public BlockChimney(String type, boolean wide, boolean indirect, int size) - { - super(Material.rock); - this.isIndirect = indirect; - isWide = wide; - this.chimneyType = type; - this.size = size; - if(wide) - { - this.setLightOpacity(255); - } - else - { - this.setBlockBounds(1F/4F, 0, 1F/4F, 3F/4F, 1F, 3F/4F); - } + +import java.util.Random; + +public class BlockChimney extends BlockContainer { + public static int pipe_RI = 117; + public IIcon bottomTex; + public IIcon sideTex; + public int size; + /** + * Weather it can absorb smoke indirectly (not directly above a source) + */ + public boolean isIndirect; + private Random rand = new Random(); + private boolean isWide; + private String chimneyType; + private boolean isPipe; + + public BlockChimney(String type, boolean wide, boolean indirect, int size) { + super(Material.rock); + this.isIndirect = indirect; + isWide = wide; + this.chimneyType = type; + this.size = size; + if (wide) { + this.setLightOpacity(255); + } else { + this.setBlockBounds(1F / 4F, 0, 1F / 4F, 3F / 4F, 1F, 3F / 4F); + } GameRegistry.registerBlock(this, "MF_Chimney_" + type + (isWide ? "_Wide" : "_Thin")); - setBlockName("chimney."+type + (isWide ? ".wide" : "")); - this.setStepSound(Block.soundTypeMetal); - this.setHardness(5F); - this.setResistance(10F); + setBlockName("chimney." + type + (isWide ? ".wide" : "")); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(5F); + this.setResistance(10F); this.setCreativeTab(CreativeTabMF.tabUtil); - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityChimney(); - } - - private TileEntityChimney getTile(IBlockAccess world, int x, int y, int z) - { - return (TileEntityChimney)world.getTileEntity(x, y, z); - } - public boolean isWideChimney() - { - return isWide; - } - @Override - public boolean isOpaqueCube() - { - return isWide; - } - @Override - public boolean renderAsNormalBlock() - { - return isWide; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - if(isPipe) - { - return BlockListMF.reinforced_stone.getIcon(side, meta); - } - if(side == 1 || side == 0) - { - return bottomTex; - } - return sideTex; - } - - /* - * - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - TileEntityChimney chimney = (TileEntityChimney)world.getTileEntity(x, y, z); - if(chimney != null && chimney.maskBlock != null && chimney.maskBlock != Blocks.air) - { - return chimney.maskBlock.getIcon(side, chimney.maskMeta); - } - return getIcon(side, world.getBlockMetadata(x, y, z)); } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - int m = world.getBlockMetadata(x, y, z); - TileEntityChimney chimney = getTile(world, x, y, z); - - if(chimney != null) - { - ItemStack held = user.getHeldItem(); - if(!world.isRemote && held != null && held.getItem() instanceof ItemBlock) - { - ItemBlock item = (ItemBlock)held.getItem(); - if(item.field_150939_a.isNormalCube()) - { - chimney.maskBlock = item.field_150939_a; - chimney.maskMeta = item.getMetadata(held.getItemDamage()); - chimney.sync(); - world.setBlock(x, y, z, BlockListMF.chimney_wide, m, 2); - return true; - } - } - } - return false; + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityChimney(); + } + + private TileEntityChimney getTile(IBlockAccess world, int x, int y, int z) { + return (TileEntityChimney) world.getTileEntity(x, y, z); + } + + public boolean isWideChimney() { + return isWide; + } + + @Override + public boolean isOpaqueCube() { + return isWide; } - @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) - { - if(!isWide) - { - super.getSubBlocks(item, tab, list); - } + + @Override + public boolean renderAsNormalBlock() { + return isWide; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + if (isPipe) { + return BlockListMF.reinforced_stone.getIcon(side, meta); + } + if (side == 1 || side == 0) { + return bottomTex; + } + return sideTex; + } + + /* + * + * @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, + * int z, int side) { TileEntityChimney chimney = + * (TileEntityChimney)world.getTileEntity(x, y, z); if(chimney != null && + * chimney.maskBlock != null && chimney.maskBlock != Blocks.air) { return + * chimney.maskBlock.getIcon(side, chimney.maskMeta); } return getIcon(side, + * world.getBlockMetadata(x, y, z)); } + * + * @Override public boolean onBlockActivated(World world, int x, int y, int z, + * EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) { + * int m = world.getBlockMetadata(x, y, z); TileEntityChimney chimney = + * getTile(world, x, y, z); + * + * if(chimney != null) { ItemStack held = user.getHeldItem(); if(!world.isRemote + * && held != null && held.getItem() instanceof ItemBlock) { ItemBlock item = + * (ItemBlock)held.getItem(); if(item.field_150939_a.isNormalCube()) { + * chimney.maskBlock = item.field_150939_a; chimney.maskMeta = + * item.getMetadata(held.getItemDamage()); chimney.sync(); world.setBlock(x, y, + * z, BlockListMF.chimney_wide, m, 2); return true; } } } return false; } + * + * @Override public void getSubBlocks(Item item, CreativeTabs tab, List list) { + * if(!isWide) { super.getSubBlocks(item, tab, list); } } + */ + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + if (isPipe) + return; + + sideTex = reg.registerIcon("minefantasy2:chimney/chimney_" + chimneyType + "_side" + (isWide ? "Wide" : "")); + bottomTex = reg.registerIcon("minefantasy2:chimney/chimney_" + chimneyType + "_top" + (isWide ? "Wide" : "")); + } + + public Block setPipe() { + this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F); + isPipe = true; + isWide = false; + return this; + } + + public boolean isPipe() { + return isPipe; + } + + @Override + public int getRenderType() { + return isPipe() ? pipe_RI : super.getRenderType(); } - */ - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - if(isPipe)return; - - sideTex = reg.registerIcon("minefantasy2:chimney/chimney_"+chimneyType+"_side" + (isWide ? "Wide" : "")); - bottomTex = reg.registerIcon("minefantasy2:chimney/chimney_"+chimneyType+"_top" + (isWide ? "Wide" : "")); - } - private boolean isPipe; - - public Block setPipe() - { - this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F); - isPipe = true; - isWide = false; - return this; - } - public boolean isPipe() { - return isPipe; - } - @Override - public int getRenderType() - { - return isPipe() ? pipe_RI : super.getRenderType(); - } - public static int pipe_RI = 117; } diff --git a/src/main/java/minefantasy/mf2/block/refining/BlockCrucible.java b/src/main/java/minefantasy/mf2/block/refining/BlockCrucible.java index 594ae963..ed916c8b 100644 --- a/src/main/java/minefantasy/mf2/block/refining/BlockCrucible.java +++ b/src/main/java/minefantasy/mf2/block/refining/BlockCrucible.java @@ -1,8 +1,5 @@ package minefantasy.mf2.block.refining; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -30,96 +27,141 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockCrucible extends BlockContainer -{ - private Random rand = new Random(); - public final boolean isActive; - private static boolean keepInventory; - public int tier; - public String type; - - public BlockCrucible(String tex, int tier, boolean isActive) - { - super(Material.rock); - this.tier = tier; - this.type = tex; - this.isActive = isActive; - GameRegistry.registerBlock(this, "MF_Crucible"+tex + (isActive ? "Active" : "")); - setBlockName("crucible."+tex); - this.setStepSound(Block.soundTypeStone); - this.setHardness(8F); - this.setResistance(8F); +import java.util.List; +import java.util.Random; + +public class BlockCrucible extends BlockContainer { + private static boolean keepInventory; + public final boolean isActive; + public int tier; + public String type; + public boolean isAuto; + private Random rand = new Random(); + private IIcon sideTex, topTex; + + public BlockCrucible(String tex, int tier, boolean isActive) { + super(Material.rock); + this.tier = tier; + this.type = tex; + this.isActive = isActive; + GameRegistry.registerBlock(this, "MF_Crucible" + tex + (isActive ? "Active" : "")); + setBlockName("crucible." + tex); + this.setStepSound(Block.soundTypeStone); + this.setHardness(8F); + this.setResistance(8F); this.setCreativeTab(CreativeTabMF.tabUtil); - } - public boolean isAuto; - public BlockCrucible setAuto() - { - isAuto = true; - return this; - } + } + + private static TileEntityCrucible getTile(IBlockAccess world, int x, int y, int z) { + return (TileEntityCrucible) world.getTileEntity(x, y, z); + } + + public static void updateFurnaceBlockState(boolean state, World world, int x, int y, int z) { + int l = world.getBlockMetadata(x, y, z); + TileEntityCrucible tileentity = getTile(world, x, y, z); + keepInventory = true; + Block block = world.getBlock(x, y, z); + + if (block != null && block instanceof BlockCrucible) { + int blocktier = ((BlockCrucible) block).tier; + boolean auto = ((BlockCrucible) block).isAuto; + if (state) { + world.setBlock(x, y, z, getActiveBlock(blocktier, auto)); + } else { + world.setBlock(x, y, z, getInactiveBlock(blocktier, auto)); + } + } + + keepInventory = false; + world.setBlockMetadataWithNotify(x, y, z, l, 2); + + if (tileentity != null) { + tileentity.validate(); + world.setTileEntity(x, y, z, tileentity); + } + } + + private static Block getActiveBlock(int tier, boolean auto) { + if (tier == 1) { + return auto ? BlockListMF.crucibleauto_active : BlockListMF.crucibleadv_active; + } + if (tier == 2) { + return BlockListMF.cruciblemythic_active; + } + if (tier == 3) { + return BlockListMF.cruciblemaster_active; + } + return BlockListMF.crucible_active; + } + + private static Block getInactiveBlock(int tier, boolean auto) { + if (tier == 1) { + return auto ? BlockListMF.crucibleauto : BlockListMF.crucibleadv; + } + if (tier == 2) { + return BlockListMF.cruciblemythic; + } + if (tier == 3) { + return BlockListMF.cruciblemaster; + } + return BlockListMF.crucible; + } - @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) - { - if(!isActive) - { - super.getSubBlocks(item, tab, list); - } + public BlockCrucible setAuto() { + isAuto = true; + return this; + } + + @Override + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + if (!isActive) { + super.getSubBlocks(item, tab, list); + } } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityCrucible(); - } - - private static TileEntityCrucible getTile(IBlockAccess world, int x, int y, int z) - { - return (TileEntityCrucible)world.getTileEntity(x, y, z); - } - - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - if(keepInventory)return; - - TileEntityCrucible tile = getTile(world, x, y, z); - if (tile != null) - { - int size = (!isAuto && ConfigHardcore.HCCreduceIngots) ? tile.getSizeInventory()-1 : tile.getSizeInventory(); - for (int i1 = 0; i1 < size; ++i1) - { + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityCrucible(); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + if (keepInventory) + return; + + TileEntityCrucible tile = getTile(world, x, y, z); + + if (tile != null) { + int size = (!isAuto && ConfigHardcore.HCCreduceIngots) ? tile.getSizeInventory() - 1 + : tile.getSizeInventory(); + for (int i1 = 0; i1 < size; ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -130,156 +172,78 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - public static void updateFurnaceBlockState(boolean state, World world, int x, int y, int z) - { - int l = world.getBlockMetadata(x, y, z); - TileEntityCrucible tileentity = getTile(world, x, y, z); - keepInventory = true; - Block block = world.getBlock(x, y, z); - - if(block != null && block instanceof BlockCrucible) - { - int blocktier = ((BlockCrucible)block).tier; - boolean auto = ((BlockCrucible)block).isAuto; - if (state) - { - world.setBlock(x, y, z, getActiveBlock(blocktier, auto)); - } - else - { - world.setBlock(x, y, z, getInactiveBlock(blocktier, auto)); - } - } - keepInventory = false; - world.setBlockMetadataWithNotify(x, y, z, l, 2); + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side == 1 ? topTex : sideTex; + } - if (tileentity != null) - { - tileentity.validate(); - world.setTileEntity(x, y, z, tileentity); + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + TileEntityCrucible tile = getTile(world, x, y, z); + if (tile != null) { + ItemStack held = user.getHeldItem(); + if (held != null && held.getItem() == ComponentListMF.artefacts && held.getItemDamage() == 3) { + if (tier == 2 && isActive) { + --held.stackSize; + if (held.stackSize <= 0) { + user.setCurrentItemOrArmor(0, null); + } + if (!world.isRemote) { + world.spawnEntityInWorld(new EntityLightningBolt(world, x + 0.5, y + 1.5, z + 0.5)); + world.setBlock(x, y, z, BlockListMF.cruciblemaster_active, 0, 2); + } + } + return true; + } + if (tier >= 2) { + BlockCrucible.updateFurnaceBlockState(tile.isCoated(), world, x, y, z); + } + ItemStack out = tile.getStackInSlot(tile.getSizeInventory() - 1); + if (held != null && held.getItem() == ComponentListMF.ingot_mould && out != null + && !(out.getItem() instanceof ItemBlock)) { + ItemStack result = out.copy(); + result.stackSize = 1; + tile.decrStackSize(tile.getSizeInventory() - 1, 1); + + ItemStack mould = ItemFilledMould.createMould(result); + if (held.stackSize == 1) { + user.setCurrentItemOrArmor(0, mould); + } else { + --held.stackSize; + if (!world.isRemote) { + EntityItem drop = new EntityItem(world, user.posX, user.posY, user.posZ, mould); + drop.delayBeforeCanPickup = 0; + world.spawnEntityInWorld(drop); + } + } + return true; + } + if (!world.isRemote) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } } + return true; } - - private static Block getActiveBlock(int tier, boolean auto) - { - if(tier == 1) - { - return auto ? BlockListMF.crucibleauto_active : BlockListMF.crucibleadv_active; - } - if(tier == 2) - { - return BlockListMF.cruciblemythic_active; - } - if(tier == 3) - { - return BlockListMF.cruciblemaster_active; - } - return BlockListMF.crucible_active; - } - private static Block getInactiveBlock(int tier, boolean auto) - { - if(tier == 1) - { - return auto ? BlockListMF.crucibleauto : BlockListMF.crucibleadv; - } - if(tier == 2) - { - return BlockListMF.cruciblemythic; - } - if(tier == 3) - { - return BlockListMF.cruciblemaster; - } - return BlockListMF.crucible; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return side == 1 ? topTex : sideTex; - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - TileEntityCrucible tile = getTile(world, x, y, z); - if(tile != null) - { - ItemStack held = user.getHeldItem(); - if(held != null && held.getItem() == ComponentListMF.artefacts && held.getItemDamage() == 3) - { - if(tier == 2 && isActive) - { - --held.stackSize; - if(held.stackSize <= 0) - { - user.setCurrentItemOrArmor(0, null); - } - if(!world.isRemote) - { - world.spawnEntityInWorld(new EntityLightningBolt(world, x+0.5, y+1.5, z+0.5)); - world.setBlock(x, y, z, BlockListMF.cruciblemaster_active, 0, 2); - } - } - return true; - } - if(tier >= 2) - { - BlockCrucible.updateFurnaceBlockState(tile.isCoated(), world, x, y, z); - } - ItemStack out = tile.getStackInSlot(tile.getSizeInventory()-1); - if(held != null && held.getItem() == ComponentListMF.ingot_mould && out != null && !(out.getItem() instanceof ItemBlock)) - { - ItemStack result = out.copy(); - result.stackSize = 1; - tile.decrStackSize(tile.getSizeInventory()-1, 1); - - ItemStack mould = ItemFilledMould.createMould(result); - if(held.stackSize == 1) - { - user.setCurrentItemOrArmor(0, mould); - } - else - { - --held.stackSize; - if(!world.isRemote) - { - EntityItem drop = new EntityItem(world, user.posX, user.posY, user.posZ, mould); - drop.delayBeforeCanPickup = 0; - world.spawnEntityInWorld(drop); - } - } - return true; - } - if(!world.isRemote) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } - return true; + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + topTex = isActive ? reg.registerIcon("minefantasy2:processor/crucible_top_active_" + type) + : reg.registerIcon("minefantasy2:processor/crucible_top_" + type); + sideTex = reg.registerIcon("minefantasy2:processor/crucible_side_" + type); } - private IIcon sideTex, topTex; - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - topTex = isActive ? reg.registerIcon("minefantasy2:processor/crucible_top_active_"+type) : reg.registerIcon("minefantasy2:processor/crucible_top_"+type); - sideTex = reg.registerIcon("minefantasy2:processor/crucible_side_"+type); - } - @Override - @SideOnly(Side.CLIENT) - public Item getItem(World world, int x, int y, int z) - { + + @Override + @SideOnly(Side.CLIENT) + public Item getItem(World world, int x, int y, int z) { return Item.getItemFromBlock(getInactiveBlock(tier, isAuto)); } - @Override - public Item getItemDropped(int meta, Random rand, int fort) - { + + @Override + public Item getItemDropped(int meta, Random rand, int fort) { return Item.getItemFromBlock(getInactiveBlock(tier, isAuto)); } } diff --git a/src/main/java/minefantasy/mf2/block/refining/BlockForge.java b/src/main/java/minefantasy/mf2/block/refining/BlockForge.java index 21ad127f..1877cc99 100644 --- a/src/main/java/minefantasy/mf2/block/refining/BlockForge.java +++ b/src/main/java/minefantasy/mf2/block/refining/BlockForge.java @@ -1,16 +1,14 @@ package minefantasy.mf2.block.refining; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.heating.ForgeFuel; import minefantasy.mf2.api.heating.ForgeItemHandler; import minefantasy.mf2.api.heating.Heatable; import minefantasy.mf2.api.heating.TongsHelper; import minefantasy.mf2.api.knowledge.ResearchLogic; -import minefantasy.mf2.api.tool.ILighter; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.tileentity.TileEntityForge; import minefantasy.mf2.item.armour.ItemApron; @@ -26,10 +24,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.Item; -import net.minecraft.item.ItemFlintAndSteel; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -37,98 +32,118 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockForge extends BlockContainer -{ - public static int forge_RI = 104; - - private Random rand = new Random(); - public final boolean isActive; - private static boolean keepInventory; - public int tier; - public String type; - - public BlockForge(String tex, int tier, boolean isActive) - { - super(tier == 1 ? Material.iron : Material.rock); - this.tier = tier; - this.type = tex; - this.isActive = isActive; - //setBlockBounds(0F, 0F, 0F, 1F, 12F/16F, 1F); - GameRegistry.registerBlock(this, "MF_Forge"+tex + (isActive ? "Active" : "")); - setBlockName("forge."+tex); - this.setStepSound(Block.soundTypeStone); - this.setHardness(5F); - this.setResistance(8F); +import java.util.List; +import java.util.Random; + +public class BlockForge extends BlockContainer { + public static int forge_RI = 104; + private static boolean keepInventory; + public final boolean isActive; + public int tier; + public String type; + private Random rand = new Random(); + + public BlockForge(String tex, int tier, boolean isActive) { + super(tier == 1 ? Material.iron : Material.rock); + this.tier = tier; + this.type = tex; + this.isActive = isActive; + // setBlockBounds(0F, 0F, 0F, 1F, 12F/16F, 1F); + GameRegistry.registerBlock(this, "MF_Forge" + tex + (isActive ? "Active" : "")); + setBlockName("forge." + tex); + this.setStepSound(Block.soundTypeStone); + this.setHardness(5F); + this.setResistance(8F); this.setCreativeTab(CreativeTabMF.tabUtil); setBlockBounds(0F, 0F, 0F, 1F, 0.5F, 1F); this.setLightOpacity(0); - } - - @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) - { - if(!isActive) - { - super.getSubBlocks(item, tab, list); - } } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityForge(); - } - - private static TileEntityForge getTile(IBlockAccess world, int x, int y, int z) - { - return (TileEntityForge)world.getTileEntity(x, y, z); - } - - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - if(keepInventory)return; - - TileEntityForge tile = getTile(world, x, y, z); - - if (tile != null) - { - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { + + private static TileEntityForge getTile(IBlockAccess world, int x, int y, int z) { + return (TileEntityForge) world.getTileEntity(x, y, z); + } + + public static void updateFurnaceBlockState(boolean state, World world, int x, int y, int z) { + int l = world.getBlockMetadata(x, y, z); + TileEntityForge tileentity = getTile(world, x, y, z); + keepInventory = true; + Block block = world.getBlock(x, y, z); + + if (block != null && block instanceof BlockForge) { + int blocktier = ((BlockForge) block).tier; + if (state) { + world.setBlock(x, y, z, getActiveBlock(blocktier)); + } else { + world.setBlock(x, y, z, getInactiveBlock(blocktier)); + } + } + + keepInventory = false; + world.setBlockMetadataWithNotify(x, y, z, l, 2); + + if (tileentity != null) { + tileentity.validate(); + world.setTileEntity(x, y, z, tileentity); + } + } + + private static Block getActiveBlock(int tier) { + return tier == 1 ? BlockListMF.forge_metal_active : BlockListMF.forge_active; + } + + private static Block getInactiveBlock(int tier) { + return tier == 1 ? BlockListMF.forge_metal : BlockListMF.forge; + } + + @Override + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + if (!isActive) { + super.getSubBlocks(item, tab, list); + } + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityForge(); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + if (keepInventory) + return; + + TileEntityForge tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -139,247 +154,165 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - public static void updateFurnaceBlockState(boolean state, World world, int x, int y, int z) - { - int l = world.getBlockMetadata(x, y, z); - TileEntityForge tileentity = getTile(world, x, y, z); - keepInventory = true; - Block block = world.getBlock(x, y, z); - - if(block != null && block instanceof BlockForge) - { - int blocktier = ((BlockForge)block).tier; - if (state) - { - world.setBlock(x, y, z, getActiveBlock(blocktier)); - } - else - { - world.setBlock(x, y, z, getInactiveBlock(blocktier)); - } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return BlockListMF.crucible.getIcon(side, meta); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + ItemStack held = user.getHeldItem(); + TileEntityForge tile = getTile(world, x, y, z); + if (tile != null) { + if (tile.isLit() && !ItemApron.isUserProtected(user)) { + user.setFire(5); + user.attackEntityFrom(DamageSource.onFire, 1.0F); + } + if (held != null) { + if (side == 1 && held != null && held.getItem() instanceof ItemTongs + && onUsedTongs(world, user, held, tile)) { + return true; + } + int l = ItemLighterMF.tryUse(held, user); + if (!isActive && l != 0) { + user.playSound("fire.ignite", 1.0F, 1.0F); + if (l == 1) { + tile.fireUpForge(); + held.damageItem(1, user); + } + return true; + } + if (Heatable.canHeatItem(held) && tile.tryAddHeatable(held)) { + --held.stackSize; + if (held.stackSize <= 0) { + user.setCurrentItemOrArmor(0, null); + } + return true; + } + + ForgeFuel stats = ForgeItemHandler.getStats(held); + if (stats != null && tile.addFuel(stats, true, tier)) { + if (user.capabilities.isCreativeMode) { + return true; + } + if (user.getHeldItem().getItem().getContainerItem() != null) { + ItemStack cont = new ItemStack(user.getHeldItem().getItem().getContainerItem()); + if (user.getHeldItem().stackSize == 1) { + user.setCurrentItemOrArmor(0, cont); + return true; + } else { + if (!user.inventory.addItemStackToInventory(cont)) { + user.entityDropItem(cont, 0.0F); + } + } + } + if (user.getHeldItem().stackSize == 1) { + user.setCurrentItemOrArmor(0, null); + } else { + user.getHeldItem().stackSize--; + } + return true; + } + if (!world.isRemote && ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.smeltDragonforge) + && held.getItem() == ComponentListMF.dragon_heart) { + if (user.getHeldItem().stackSize == 1) { + user.setCurrentItemOrArmor(0, null); + } else { + user.getHeldItem().stackSize--; + } + tile.dragonHeartPower = 1.0F; + return true; + } + } + if (!world.isRemote && !tile.hasBlockAbove()) { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } } + return true; + } - keepInventory = false; - world.setBlockMetadataWithNotify(x, y, z, l, 2); + private boolean onUsedTongs(World world, EntityPlayer user, ItemStack held, TileEntityForge tile) { + ItemStack contents = tile.getStackInSlot(0); + ItemStack grabbed = TongsHelper.getHeldItem(held); - if (tileentity != null) - { - tileentity.validate(); - world.setTileEntity(x, y, z, tileentity); + // GRAB + if (grabbed == null) { + if (contents != null && contents.getItem() == ComponentListMF.hotItem) { + if (TongsHelper.trySetHeldItem(held, contents)) { + tile.setInventorySlotContents(0, null); + return true; + } + } + } else { + if (contents == null) { + tile.setInventorySlotContents(0, grabbed); + TongsHelper.clearHeldItem(held, user); + return true; + } } + return false; } - - private static Block getActiveBlock(int tier) - { - return tier == 1 ? BlockListMF.forge_metal_active : BlockListMF.forge_active; - } - - private static Block getInactiveBlock(int tier) - { - return tier == 1 ? BlockListMF.forge_metal : BlockListMF.forge; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - return BlockListMF.crucible.getIcon(side, meta); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - ItemStack held = user.getHeldItem(); - TileEntityForge tile = getTile(world, x, y, z); - if(tile != null) - { - if(tile.isLit() && !ItemApron.isUserProtected(user)) - { - user.setFire(5); - user.attackEntityFrom(DamageSource.onFire, 1.0F); - } - if(held != null) - { - if(side == 1 && held != null && held.getItem() instanceof ItemTongs && onUsedTongs(world, user, held, tile)) - { - return true; - } - int l = ItemLighterMF.tryUse(held, user); - if(!isActive && l != 0) - { - user.playSound("fire.ignite", 1.0F, 1.0F); - if(l == 1) - { - tile.fireUpForge(); - held.damageItem(1, user); - } - return true; - } - if(Heatable.canHeatItem(held) && tile.tryAddHeatable(held)) - { - --held.stackSize; - if(held.stackSize <= 0) - { - user.setCurrentItemOrArmor(0, null); - } - return true; - } - - ForgeFuel stats = ForgeItemHandler.getStats(held); - if(stats != null && tile.addFuel(stats, true, tier)) - { - if(user.capabilities.isCreativeMode) - { - return true; - } - if(user.getHeldItem().getItem().getContainerItem() != null) - { - ItemStack cont = new ItemStack(user.getHeldItem().getItem().getContainerItem()); - if(user.getHeldItem().stackSize == 1) - { - user.setCurrentItemOrArmor(0, cont); - return true; - } - else - { - if(!user.inventory.addItemStackToInventory(cont)) - { - user.entityDropItem(cont, 0.0F); - } - } - } - if(user.getHeldItem().stackSize == 1) - { - user.setCurrentItemOrArmor(0, null); - } - else - { - user.getHeldItem().stackSize --; - } - return true; - } - if(!world.isRemote && ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.smeltDragonforge) && held.getItem() == ComponentListMF.dragon_heart) - { - if(user.getHeldItem().stackSize == 1) - { - user.setCurrentItemOrArmor(0, null); - } - else - { - user.getHeldItem().stackSize --; - } - tile.dragonHeartPower = 1.0F; - return true; - } - } - if(!world.isRemote && !tile.hasBlockAbove()) - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } - return true; + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { } - - private boolean onUsedTongs(World world, EntityPlayer user, ItemStack held, TileEntityForge tile) - { - ItemStack contents = tile.getStackInSlot(0); - ItemStack grabbed = TongsHelper.getHeldItem(held); - - //GRAB - if(grabbed == null) - { - if(contents != null && contents.getItem() == ComponentListMF.hotItem) - { - if(TongsHelper.trySetHeldItem(held, contents)) - { - tile.setInventorySlotContents(0, null); - return true; - } - } - } - else - { - if(contents == null) - { - tile.setInventorySlotContents(0, grabbed); - TongsHelper.clearHeldItem(held, user); - return true; - } - } - return false; - } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - } - @Override - @SideOnly(Side.CLIENT) - public Item getItem(World world, int x, int y, int z) - { + + @Override + @SideOnly(Side.CLIENT) + public Item getItem(World world, int x, int y, int z) { return Item.getItemFromBlock(getInactiveBlock(tier)); } - @Override - public Item getItemDropped(int meta, Random rand, int fort) - { + + @Override + public Item getItemDropped(int meta, Random rand, int fort) { return Item.getItemFromBlock(getInactiveBlock(tier)); } - - @Override - public boolean renderAsNormalBlock() - { + + @Override + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } - - @Override - public int getRenderType() - { - return forge_RI; - } - - - /** + + @Override + public int getRenderType() { + return forge_RI; + } + + /** * Called whenever the block is added into the world. Args: world, x, y, z */ - @Override - public void onBlockAdded(World world, int x, int y, int z) - { - if (tier == 1 && !world.isRemote) - { - if (this.isActive && !world.isBlockIndirectlyGettingPowered(x, y, z)) - { + @Override + public void onBlockAdded(World world, int x, int y, int z) { + if (tier == 1 && !world.isRemote) { + if (this.isActive && !world.isBlockIndirectlyGettingPowered(x, y, z)) { world.scheduleBlockUpdate(x, y, z, this, 4); - } - else if (!this.isActive && world.isBlockIndirectlyGettingPowered(x, y, z)) - { - updateFurnaceBlockState(true, world, x, y, z); + } else if (!this.isActive && world.isBlockIndirectlyGettingPowered(x, y, z)) { + updateFurnaceBlockState(true, world, x, y, z); } } } /** - * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are - * their own) Args: x, y, z, neighbor Block + * Lets the block know when one of its neighbor changes. Doesn't know which + * neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor + * Block */ @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) - { - if (tier == 1 && !world.isRemote) - { - if (this.isActive && !world.isBlockIndirectlyGettingPowered(x, y, z)) - { + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + if (tier == 1 && !world.isRemote) { + if (this.isActive && !world.isBlockIndirectlyGettingPowered(x, y, z)) { world.scheduleBlockUpdate(x, y, z, this, 4); - } - else if (!this.isActive && world.isBlockIndirectlyGettingPowered(x, y, z)) - { - updateFurnaceBlockState(true, world, x, y, z); + } else if (!this.isActive && world.isBlockIndirectlyGettingPowered(x, y, z)) { + updateFurnaceBlockState(true, world, x, y, z); } } } @@ -388,12 +321,10 @@ else if (!this.isActive && world.isBlockIndirectlyGettingPowered(x, y, z)) * Ticks the block if it's been scheduled */ @Override - public void updateTick(World world, int x, int y, int z, Random rand) - { - if (tier == 1 && !world.isRemote && this.isActive && !world.isBlockIndirectlyGettingPowered(x, y, z)) - { + public void updateTick(World world, int x, int y, int z, Random rand) { + if (tier == 1 && !world.isRemote && this.isActive && !world.isBlockIndirectlyGettingPowered(x, y, z)) { updateFurnaceBlockState(false, world, x, y, z); } } - + } diff --git a/src/main/java/minefantasy/mf2/block/refining/BlockQuern.java b/src/main/java/minefantasy/mf2/block/refining/BlockQuern.java index ce87bde9..3a33926a 100644 --- a/src/main/java/minefantasy/mf2/block/refining/BlockQuern.java +++ b/src/main/java/minefantasy/mf2/block/refining/BlockQuern.java @@ -1,104 +1,85 @@ package minefantasy.mf2.block.refining; -import java.util.Random; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.api.knowledge.ResearchLogic; -import minefantasy.mf2.api.tool.ILighter; -import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.tileentity.TileEntityQuern; -import minefantasy.mf2.block.tileentity.TileEntityCarpenterMF; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.knowledge.KnowledgeListMF; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemFlintAndSteel; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class BlockQuern extends BlockContainer -{ - private Random rand = new Random(); - public IIcon bottomTex, sideTex, topTex; - private String type; - - public BlockQuern(String type) - { - super(Material.rock); - this.type = type; - GameRegistry.registerBlock(this, "MF_Grind_"+type); - setBlockName(type); - this.setStepSound(Block.soundTypeStone); - this.setHardness(5F); - this.setResistance(5F); + +import java.util.Random; + +public class BlockQuern extends BlockContainer { + public static int quern_RI = 111; + public IIcon bottomTex, sideTex, topTex; + private Random rand = new Random(); + private String type; + + public BlockQuern(String type) { + super(Material.rock); + this.type = type; + GameRegistry.registerBlock(this, "MF_Grind_" + type); + setBlockName(type); + this.setStepSound(Block.soundTypeStone); + this.setHardness(5F); + this.setResistance(5F); this.setCreativeTab(CreativeTabMF.tabUtil); - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityQuern(); - } - - private TileEntityQuern getTile(IBlockAccess world, int x, int y, int z) - { - return (TileEntityQuern)world.getTileEntity(x, y, z); - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - TileEntityQuern tile = getTile(world, x, y, z); - - if (tile != null) - { - for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) - { + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityQuern(); + } + + private TileEntityQuern getTile(IBlockAccess world, int x, int y, int z) { + return (TileEntityQuern) world.getTileEntity(x, y, z); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntityQuern tile = getTile(world, x, y, z); + + if (tile != null) { + for (int i1 = 0; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(world, x + f, y + f1, 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } } @@ -109,63 +90,54 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta) super.breakBlock(world, x, y, z, block, meta); } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, float yOffset, float zOffset) - { - TileEntityQuern tile = getTile(world, x, y, z); - if(tile != null) - { - if(side == 1) - { - tile.onUse(user); - } - else - { - user.openGui(MineFantasyII.instance, 0, world, x, y, z); - } - } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer user, int side, float xOffset, + float yOffset, float zOffset) { + TileEntityQuern tile = getTile(world, x, y, z); + if (tile != null) { + if (side == 1) { + tile.onUse(user); + } else { + user.openGui(MineFantasyII.instance, 0, world, x, y, z); + } + } return true; } - @Override - public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) - { - TileEntityQuern tile = getTile(world, x, y, z); - if(tile != null) - { - tile.onUse(user); - } + + @Override + public void onBlockClicked(World world, int x, int y, int z, EntityPlayer user) { + TileEntityQuern tile = getTile(world, x, y, z); + if (tile != null) { + tile.onUse(user); + } } - - @SideOnly(Side.CLIENT) + + @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister reg) - { - this.topTex = reg.registerIcon("minefantasy2:processor/"+type + "_top"); - this.sideTex = reg.registerIcon("minefantasy2:processor/"+type + "_side"); - this.bottomTex = reg.registerIcon("minefantasy2:processor/"+type + "_base"); - } - - @Override - public IIcon getIcon(int side, int meta) - { - return side == 0 ? bottomTex : side == 1 ? topTex : sideTex; + public void registerBlockIcons(IIconRegister reg) { + this.topTex = reg.registerIcon("minefantasy2:processor/" + type + "_top"); + this.sideTex = reg.registerIcon("minefantasy2:processor/" + type + "_side"); + this.bottomTex = reg.registerIcon("minefantasy2:processor/" + type + "_base"); } - - @Override - public boolean isOpaqueCube() - { + + @Override + public IIcon getIcon(int side, int meta) { + return side == 0 ? bottomTex : side == 1 ? topTex : sideTex; + } + + @Override + public boolean isOpaqueCube() { return false; } + @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } + @SideOnly(Side.CLIENT) - public int getRenderType() - { - return quern_RI; + public int getRenderType() { + return quern_RI; } - public static int quern_RI = 111; } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityAnvilMF.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityAnvilMF.java index 16ca5467..7f42f298 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityAnvilMF.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityAnvilMF.java @@ -1,8 +1,5 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import minefantasy.mf2.api.crafting.IQualityBalance; import minefantasy.mf2.api.crafting.anvil.AnvilCraftMatrix; import minefantasy.mf2.api.crafting.anvil.CraftingManagerAnvil; @@ -20,6 +17,7 @@ import minefantasy.mf2.item.heatable.ItemHeated; import minefantasy.mf2.knowledge.KnowledgeListMF; import minefantasy.mf2.mechanics.PlayerTickHandlerMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.AnvilPacket; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -33,54 +31,62 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.WorldServer; -public class TileEntityAnvilMF extends TileEntity implements IInventory, IAnvil, IQualityBalance -{ - public int tier; - private ItemStack[] inventory; - private Random rand = new Random(); - private int ticksExisted; - private ContainerAnvilMF syncAnvil; - private AnvilCraftMatrix craftMatrix; - private String lastPlayerHit = ""; - private String toolTypeRequired = "hammer"; - private String researchRequired = ""; - private boolean outputHot = false; - private Skill skillUsed; - private boolean resetRecipe = false; - - public TileEntityAnvilMF() - { - this(0, "Iron"); - } - public TileEntityAnvilMF(int tier, String name) - { - inventory = new ItemStack[25]; - this.tier=tier; - texName=name; - setContainer(new ContainerAnvilMF(this)); - } - private boolean isFakeAnvil = false; - public TileEntityAnvilMF setDisplay() - { - isFakeAnvil = true; - return this; - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - tier = nbt.getInteger("tier"); - NBTTagList savedItems = nbt.getTagList("Items", 10); +import java.util.Random; + +public class TileEntityAnvilMF extends TileEntity implements IInventory, IAnvil, IQualityBalance { + public int tier; + public String resName = ""; + public float progressMax; + public float progress; + public String texName = ""; + public float qualityBalance = 0F; + public float thresholdPosition = 0.1F; + public float leftHit = 0F; + public float rightHit = 0F; + private ItemStack[] inventory; + private Random rand = new Random(); + private int ticksExisted; + private ContainerAnvilMF syncAnvil; + private AnvilCraftMatrix craftMatrix; + private String lastPlayerHit = ""; + private String toolTypeRequired = "hammer"; + private String researchRequired = ""; + private boolean outputHot = false; + private Skill skillUsed; + private boolean resetRecipe = false; + private boolean isFakeAnvil = false; + private ItemStack recipe; + private int hammerTierRequired; + private int anvilTierRequired; + + public TileEntityAnvilMF() { + this(0, "Iron"); + } + + public TileEntityAnvilMF(int tier, String name) { + inventory = new ItemStack[25]; + this.tier = tier; + texName = name; + setContainer(new ContainerAnvilMF(this)); + } + + public TileEntityAnvilMF setDisplay() { + isFakeAnvil = true; + return this; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + tier = nbt.getInteger("tier"); + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inventory.length) - { + if (slotNum >= 0 && slotNum < this.inventory.length) { this.inventory[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } @@ -94,29 +100,26 @@ public void readFromNBT(NBTTagCompound nbt) qualityBalance = nbt.getFloat("Quality"); leftHit = nbt.getFloat("leftHit"); rightHit = nbt.getFloat("rightHit"); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setInteger("tier", tier); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.inventory.length; ++i) - { - if (this.inventory[i] != null) - { + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("tier", tier); + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.inventory.length; ++i) { + if (this.inventory[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inventory[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - + nbt.setFloat("Progress", progress); nbt.setFloat("ProgressMax", progressMax); nbt.setString("ResName", resName); @@ -127,893 +130,753 @@ public void writeToNBT(NBTTagCompound nbt) nbt.setFloat("Quality", qualityBalance); nbt.setFloat("leftHit", leftHit); nbt.setFloat("rightHit", rightHit); - } - - @Override - public int getSizeInventory() - { - return inventory.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return inventory[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - onInventoryChanged(); - if (this.inventory[slot] != null) - { + } + + @Override + public int getSizeInventory() { + return inventory.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inventory[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + onInventoryChanged(); + if (this.inventory[slot] != null) { ItemStack itemstack; - if (this.inventory[slot].stackSize <= num) - { + if (this.inventory[slot].stackSize <= num) { itemstack = this.inventory[slot]; this.inventory[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.inventory[slot].splitStack(num); - if (this.inventory[slot].stackSize == 0) - { + if (this.inventory[slot].stackSize == 0) { this.inventory[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return inventory[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - onInventoryChanged(); - inventory[slot] = item; - } - - @Override - public String getInventoryName() - { - return "gui.carpentermf.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - return true; - } - @Override - public void updateEntity() - { - ++ticksExisted; - if(!worldObj.isRemote && (leftHit == 0 || rightHit == 0)) - { - reassignHitValues(); - } - super.updateEntity(); - if(!worldObj.isRemote) - { - if(!isFakeAnvil && ticksExisted % 20 == 0) - { - updateCraftingData(); - } - if(!canCraft() && ticksExisted > 1) - { - progress = progressMax = 0; - this.resName = ""; - this.recipe = null; - } - } - if(!worldObj.isRemote) - { - updateThreshold(); - } - resetRecipe = false; - } - - public void onInventoryChanged() - { - if(!resetRecipe) - { - updateCraftingData(); - resetRecipe = true; - } - } - - public boolean tryCraft(EntityPlayer user, boolean rightClick) - { - if(user == null)return false; - - String toolType = ToolHelper.getCrafterTool(user.getHeldItem()); - int hammerTier = ToolHelper.getCrafterTier(user.getHeldItem()); - if(toolType.equalsIgnoreCase("hammer") || toolType.equalsIgnoreCase("hvyHammer")) - { - if(user.getHeldItem() != null) - { - user.getHeldItem().damageItem(1, user); - if(user.getHeldItem().getItemDamage() >= user.getHeldItem().getMaxDamage()) - { - if(worldObj.isRemote) - user.renderBrokenItemStack(user.getHeldItem()); - - user.destroyCurrentEquippedItem(); - } - } - if(worldObj.isRemote) - return true; - - if(doesPlayerKnowCraft(user) && canCraft() && toolType.equalsIgnoreCase(toolTypeRequired)) - { - float mod = 1.0F; - if(hammerTier < hammerTierRequired) - { - mod = 2.0F; - if(rand.nextInt(5) == 0) - { - reassignHitValues(); - } - } - if(rightClick) - { - this.qualityBalance += (rightHit*mod); - } - else - { - this.qualityBalance -= (leftHit*mod); - } - if(qualityBalance >= 1.0F || qualityBalance <= -1.0F) - { - ruinCraft(); - } - - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "minefantasy2:block.anvilsucceed", 0.25F, rightClick ? 1.2F : 1.0F); - float efficiency = ToolHelper.getCrafterEfficiency(user.getHeldItem()) * (rightClick ? 0.75F : 1.0F); - float toolEfficiency = efficiency; - - if(user.swingProgress > 0 && user.swingProgress <= 1.0) - { - efficiency *= (0.5F-user.swingProgress); - } - - progress += Math.max(0.2F, efficiency); - if(progress >= progressMax) - { - craftItem(user); - } - } - else - { - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "minefantasy2:block.anvilfail", 0.25F, 1.0F); - } - lastPlayerHit = user.getCommandSenderName(); - updateCraftingData(); - - return true; - } - updateCraftingData(); - return false; - } - - private void ruinCraft() - { - if(!worldObj.isRemote) - { - consumeResources(); - reassignHitValues(); - progress = progressMax = qualityBalance = 0; - } - worldObj.playSoundEffect(xCoord+0.5, yCoord+0.8, zCoord+0.5, "random.break", 1.0F, 0.8F); - } - public boolean doesPlayerKnowCraft(EntityPlayer user) - { - return getResearchNeeded().isEmpty() || ResearchLogic.hasInfoUnlocked(user, getResearchNeeded()); - } - private void craftItem(EntityPlayer lastHit) - { - if (this.canCraft()) - { - ItemStack result = modifySpecials(recipe); - if(result == null) - { - return; - } - if(result != null && result.getItem() instanceof ItemArmourMF) - { - result = modifyArmour(result); - } - int output = getSizeInventory()-1; - - int temp = this.averageTemp(); - boolean hot = outputHot && temp > 0; - - if(hot) - { - if(result.getMaxStackSize() == 1 && lastPlayerHit.length() > 0) - { - getNBT(result).setString("MF_CraftedByName", lastPlayerHit); - } - ItemStack out = ItemHeated.createHotItem(result, temp); - if(inventory[output] == null || (inventory[output].stackSize == 1 && SpecialForging.getItemDesign(inventory[output]) != null) ) - { - addXP(lastHit); - this.inventory[output] = out; - consumeResources(); - } - else if(inventory[output].isItemEqual(out) && (inventory[output].stackSize + out.stackSize <= getStackSize(inventory[output]))) - { - addXP(lastHit); - inventory[output].stackSize += out.stackSize; - consumeResources(); - } - } - else if (!hot) - { - if (this.inventory[output] == null) - { - if(result.getMaxStackSize() == 1 && lastPlayerHit.length() > 0) - { - getNBT(result).setString("MF_CraftedByName", lastPlayerHit); - } - this.inventory[output] = result; - } - else if (this.inventory[output].getItem() == result.getItem()) - { - this.inventory[output].stackSize += result.stackSize; // Forge BugFix: Results may have multiple items - } - addXP(lastHit); - consumeResources(); - } - } - onInventoryChanged(); - progress = 0; - reassignHitValues(); - qualityBalance = 0; - } - private void addXP(EntityPlayer smith) - { - if(skillUsed == null)return; - - float baseXP = this.progressMax / 10F; - baseXP /= (1.0F + getAbsoluteBalance()); - - skillUsed.addXP(smith, (int)baseXP + 1); - } - private ItemStack modifyArmour(ItemStack result) - { - ItemArmourMF item = (ItemArmourMF)result.getItem(); - boolean canColour = item.canColour(); - int colour = -1; - for(int a = 0; a < getSizeInventory()-1; a++) - { - ItemStack slot = getStackInSlot(a); - if(slot != null && slot.getItem() instanceof ItemArmor) - { - ItemArmor slotitem = (ItemArmor)slot.getItem(); - if(canColour && slotitem.hasColor(slot)) - { - colour = slotitem.getColor(slot); - } - if(result.isItemStackDamageable()) - { - result.setItemDamage(slot.getItemDamage()); - } - } - } - if(colour != -1 && canColour) - { - item.func_82813_b(result, colour); - } - return result; - } - private ItemStack modifySpecials(ItemStack result) - { - boolean hasHeart = false; - boolean isTool = result.getMaxStackSize() == 1 && result.isItemStackDamageable(); - EntityPlayer player = worldObj.getPlayerEntityByName(lastPlayerHit); - - Item DF = SpecialForging.getDragonCraft(result); - - if(DF != null) - { - //DRAGONFORGE - for(int x = -4; x <= 4; x++) - { - for(int y = -4; y <= 4; y++) - { - for(int z = -4; z <= 4; z++) - { - TileEntity tile = worldObj.getTileEntity(xCoord+x, yCoord+y, zCoord+z); - if(player != null && ResearchLogic.hasInfoUnlocked(player, KnowledgeListMF.smeltDragonforge) && tile != null && tile instanceof TileEntityForge) - { - if(((TileEntityForge)tile).dragonHeartPower > 0) - { - hasHeart = true; - ((TileEntityForge)tile).dragonHeartPower = 0; - worldObj.createExplosion(null, xCoord+x, yCoord+y, zCoord+z, 1F, false); - PlayerTickHandlerMF.spawnDragon(player); - PlayerTickHandlerMF.addDragonEnemyPts(player, 2); - - break; - } - } - } - } - } - } - if(hasHeart) - { - NBTBase nbt = !(result.hasTagCompound()) ? null : result.getTagCompound().copy(); - result = new ItemStack(DF, result.stackSize, result.getItemDamage()); - if(nbt != null) - { - result.setTagCompound((NBTTagCompound) nbt); - } - } - else - { - Item special = SpecialForging.getSpecialCraft(SpecialForging.getItemDesign(inventory[getSizeInventory()-1]), result); - if(special != null) - { - NBTBase nbt = !(result.hasTagCompound()) ? null : result.getTagCompound().copy(); - result = new ItemStack(special, result.stackSize, result.getItemDamage()); - if(nbt != null) - { - result.setTagCompound((NBTTagCompound) nbt); - } - } - } - - if(isPerfectItem() && !isMythicRecipe()) - { - this.setTrait(result, "MF_Inferior", false); - if(CustomToolHelper.isMythic(result)) - { - result.getTagCompound().setBoolean("Unbreakable", true); - } - else - { - ToolHelper.setQuality(result, 200.0F); - } - return result; - } - if(isTool) - { - result = modifyQualityComponents(result); - } - return damageItem(result); - } - private ItemStack modifyQualityComponents(ItemStack result) - { - float totalPts = 0F; - int totalItems = 0; - for(ItemStack item: inventory) - { - if(item != null && item.hasTagCompound()) - { - if(item.getTagCompound().hasKey("MF_Inferior")) - { - ++totalItems; - boolean inf = item.getTagCompound().getBoolean("MF_Inferior"); - totalPts += (inf ? -50F : 100F); - } - } - } - if(totalItems > 0 && totalPts > 0) - { - totalPts /= totalItems; - ToolHelper.setQuality(result, ToolHelper.getQualityLevel(result)+totalPts); - if(totalPts <= -85F) - { - this.setTrait(result, "MF_Inferior", true); - } - if(totalPts >= 80) - { - this.setTrait(result, "MF_Inferior", false); - } - } - return result; - } - private int averageTemp() - { - float totalTemp = 0; - int itemCount = 0; - for(int a = 0; a < getSizeInventory()-1; a++) - { - ItemStack item = getStackInSlot(a); - if(item != null && item.getItem() instanceof IHotItem) - { - ++itemCount; - totalTemp += (float)Heatable.getTemp(item); - } - } - if(totalTemp > 0 && itemCount > 0) - { - return (int)(totalTemp / itemCount); - } - return 0; - } - private NBTTagCompound getNBT(ItemStack item) - { - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - return item.getTagCompound(); - } - private void dropItem(ItemStack itemstack) - { - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.4F + 0.3F; + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return inventory[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + onInventoryChanged(); + inventory[slot] = item; + } + + @Override + public String getInventoryName() { + return "gui.carpentermf.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + return true; + } + + @Override + public void updateEntity() { + ++ticksExisted; + if (!worldObj.isRemote && (leftHit == 0 || rightHit == 0)) { + reassignHitValues(); + } + super.updateEntity(); + if (!worldObj.isRemote) { + if (!isFakeAnvil && ticksExisted % 20 == 0) { + updateCraftingData(); + } + if (!canCraft() && ticksExisted > 1) { + progress = progressMax = 0; + this.resName = ""; + this.recipe = null; + } + } + if (!worldObj.isRemote) { + updateThreshold(); + } + resetRecipe = false; + } + + public void onInventoryChanged() { + if (!resetRecipe) { + updateCraftingData(); + resetRecipe = true; + } + } + + public boolean tryCraft(EntityPlayer user, boolean rightClick) { + if (user == null) + return false; + + String toolType = ToolHelper.getCrafterTool(user.getHeldItem()); + int hammerTier = ToolHelper.getCrafterTier(user.getHeldItem()); + if (toolType.equalsIgnoreCase("hammer") || toolType.equalsIgnoreCase("hvyHammer")) { + if (user.getHeldItem() != null) { + user.getHeldItem().damageItem(1, user); + if (user.getHeldItem().getItemDamage() >= user.getHeldItem().getMaxDamage()) { + if (worldObj.isRemote) + user.renderBrokenItemStack(user.getHeldItem()); + + user.destroyCurrentEquippedItem(); + } + } + if (worldObj.isRemote) + return true; + + if (doesPlayerKnowCraft(user) && canCraft() && toolType.equalsIgnoreCase(toolTypeRequired)) { + float mod = 1.0F; + if (hammerTier < hammerTierRequired) { + mod = 2.0F; + if (rand.nextInt(5) == 0) { + reassignHitValues(); + } + } + if (rightClick) { + this.qualityBalance += (rightHit * mod); + } else { + this.qualityBalance -= (leftHit * mod); + } + if (qualityBalance >= 1.0F || qualityBalance <= -1.0F) { + ruinCraft(); + } + + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "minefantasy2:block.anvilsucceed", + 0.25F, rightClick ? 1.2F : 1.0F); + float efficiency = ToolHelper.getCrafterEfficiency(user.getHeldItem()) * (rightClick ? 0.75F : 1.0F); + float toolEfficiency = efficiency; + + if (user.swingProgress > 0 && user.swingProgress <= 1.0) { + efficiency *= (0.5F - user.swingProgress); + } + + progress += Math.max(0.2F, efficiency); + if (progress >= progressMax) { + craftItem(user); + } + } else { + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "minefantasy2:block.anvilfail", + 0.25F, 1.0F); + } + lastPlayerHit = user.getCommandSenderName(); + updateCraftingData(); + + return true; + } + updateCraftingData(); + return false; + } + + private void ruinCraft() { + if (!worldObj.isRemote) { + consumeResources(); + reassignHitValues(); + progress = progressMax = qualityBalance = 0; + } + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.8, zCoord + 0.5, "random.break", 1.0F, 0.8F); + } + + public boolean doesPlayerKnowCraft(EntityPlayer user) { + return getResearchNeeded().isEmpty() || ResearchLogic.hasInfoUnlocked(user, getResearchNeeded()); + } + + private void craftItem(EntityPlayer lastHit) { + if (this.canCraft()) { + ItemStack result = modifySpecials(recipe); + if (result == null) { + return; + } + + if (result.getItem() instanceof ItemArmourMF) { + result = modifyArmour(result); + } + + if (result.getMaxStackSize() == 1 && lastPlayerHit.length() > 0) { + getNBT(result).setString("MF_CraftedByName", lastPlayerHit); + } + + int temp = this.averageTemp(); + if (outputHot && temp > 0) { + result = ItemHeated.createHotItem(result, temp); + } + + int outputSlot = getSizeInventory() - 1; + + if (inventory[outputSlot] == null || SpecialForging.getItemDesign(inventory[outputSlot]) != null) { + inventory[outputSlot] = result; + } else { + if (inventory[outputSlot].isItemEqual(result) && ItemStack.areItemStackTagsEqual(inventory[outputSlot], result)) { + if (inventory[outputSlot].stackSize + result.stackSize <= getStackSize(inventory[outputSlot])) { + inventory[outputSlot].stackSize += result.stackSize; + } else { + dropItem(result); + } + } else { + dropItem(result); + } + } + + addXP(lastHit); + consumeResources(); + } + onInventoryChanged(); + progress = 0; + reassignHitValues(); + qualityBalance = 0; + } + + private void addXP(EntityPlayer smith) { + if (skillUsed == null) + return; + + float baseXP = this.progressMax / 10F; + baseXP /= (1.0F + getAbsoluteBalance()); + + skillUsed.addXP(smith, (int) baseXP + 1); + } + + private ItemStack modifyArmour(ItemStack result) { + ItemArmourMF item = (ItemArmourMF) result.getItem(); + boolean canColour = item.canColour(); + int colour = -1; + for (int a = 0; a < getSizeInventory() - 1; a++) { + ItemStack slot = getStackInSlot(a); + if (slot != null && slot.getItem() instanceof ItemArmor) { + ItemArmor slotitem = (ItemArmor) slot.getItem(); + if (canColour && slotitem.hasColor(slot)) { + colour = slotitem.getColor(slot); + } + if (result.isItemStackDamageable()) { + result.setItemDamage(slot.getItemDamage()); + } + } + } + if (colour != -1 && canColour) { + item.func_82813_b(result, colour); + } + return result; + } + + private ItemStack modifySpecials(ItemStack result) { + boolean hasHeart = false; + boolean isTool = result.getMaxStackSize() == 1 && result.isItemStackDamageable(); + EntityPlayer player = worldObj.getPlayerEntityByName(lastPlayerHit); + + Item DF = SpecialForging.getDragonCraft(result); + + if (DF != null) { + // DRAGONFORGE + for (int x = -4; x <= 4; x++) { + for (int y = -4; y <= 4; y++) { + for (int z = -4; z <= 4; z++) { + TileEntity tile = worldObj.getTileEntity(xCoord + x, yCoord + y, zCoord + z); + if (player != null && ResearchLogic.hasInfoUnlocked(player, KnowledgeListMF.smeltDragonforge) + && tile != null && tile instanceof TileEntityForge) { + if (((TileEntityForge) tile).dragonHeartPower > 0) { + hasHeart = true; + ((TileEntityForge) tile).dragonHeartPower = 0; + worldObj.createExplosion(null, xCoord + x, yCoord + y, zCoord + z, 1F, false); + PlayerTickHandlerMF.spawnDragon(player); + PlayerTickHandlerMF.addDragonEnemyPts(player, 2); + + break; + } + } + } + } + } + } + if (hasHeart) { + NBTBase nbt = !(result.hasTagCompound()) ? null : result.getTagCompound().copy(); + result = new ItemStack(DF, result.stackSize, result.getItemDamage()); + if (nbt != null) { + result.setTagCompound((NBTTagCompound) nbt); + } + } else { + Item special = SpecialForging + .getSpecialCraft(SpecialForging.getItemDesign(inventory[getSizeInventory() - 1]), result); + if (special != null) { + NBTBase nbt = !(result.hasTagCompound()) ? null : result.getTagCompound().copy(); + result = new ItemStack(special, result.stackSize, result.getItemDamage()); + if (nbt != null) { + result.setTagCompound((NBTTagCompound) nbt); + } + } + } + + if (isPerfectItem() && !isMythicRecipe()) { + this.setTrait(result, "MF_Inferior", false); + if (CustomToolHelper.isMythic(result)) { + result.getTagCompound().setBoolean("Unbreakable", true); + } else { + ToolHelper.setQuality(result, 200.0F); + } + return result; + } + if (isTool) { + result = modifyQualityComponents(result); + } + return damageItem(result); + } + + private ItemStack modifyQualityComponents(ItemStack result) { + float totalPts = 0F; + int totalItems = 0; + for (ItemStack item : inventory) { + if (item != null && item.hasTagCompound()) { + if (item.getTagCompound().hasKey("MF_Inferior")) { + ++totalItems; + boolean inf = item.getTagCompound().getBoolean("MF_Inferior"); + totalPts += (inf ? -50F : 100F); + } + } + } + if (totalItems > 0 && totalPts > 0) { + totalPts /= totalItems; + ToolHelper.setQuality(result, ToolHelper.getQualityLevel(result) + totalPts); + if (totalPts <= -85F) { + this.setTrait(result, "MF_Inferior", true); + } + if (totalPts >= 80) { + this.setTrait(result, "MF_Inferior", false); + } + } + return result; + } + + private int averageTemp() { + float totalTemp = 0; + int itemCount = 0; + for (int a = 0; a < getSizeInventory() - 1; a++) { + ItemStack item = getStackInSlot(a); + if (item != null && item.getItem() instanceof IHotItem) { + ++itemCount; + totalTemp += Heatable.getTemp(item); + } + } + if (totalTemp > 0 && itemCount > 0) { + return (int) (totalTemp / itemCount); + } + return 0; + } + + private NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + return item.getTagCompound(); + } + + private void dropItem(ItemStack itemstack) { + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.4F + 0.3F; float f1 = this.rand.nextFloat() * 0.4F + 0.3F; float f2 = this.rand.nextFloat() * 0.4F + 0.3F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } - + boolean delay = true; - double[] positions = new double[]{xCoord+f, yCoord+f1+1, zCoord+f2}; - if(worldObj.getBlock(xCoord, yCoord+1, zCoord).getMaterial().isSolid() && lastPlayerHit != null) - { - EntityPlayer smith = worldObj.getPlayerEntityByName(lastPlayerHit); - if(smith != null) - { - delay = false; - positions = new double[]{smith.posX, smith.posY, smith.posZ}; - } + double[] positions = new double[]{xCoord + f, yCoord + f1 + 1, zCoord + f2}; + if (worldObj.getBlock(xCoord, yCoord + 1, zCoord).getMaterial().isSolid() && lastPlayerHit != null) { + EntityPlayer smith = worldObj.getPlayerEntityByName(lastPlayerHit); + if (smith != null) { + delay = false; + positions = new double[]{smith.posX, smith.posY, smith.posZ}; + } } - + itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(worldObj, positions[0], positions[1], positions[2], new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + EntityItem entityitem = new EntityItem(worldObj, positions[0], positions[1], positions[2], + new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + if (itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } - - entityitem.delayBeforeCanPickup = delay ? 20 : 0; - entityitem.motionX = entityitem.motionY = entityitem.motionZ = 0; + + entityitem.delayBeforeCanPickup = delay ? 20 : 0; + entityitem.motionX = entityitem.motionY = entityitem.motionZ = 0; worldObj.spawnEntityInWorld(entityitem); } } } - - public boolean hasItems(EntityPlayer user, ItemStack[] items) - { - for(ItemStack check: items) - { - if(!hasItems(user, check)) - { - return false; - } - } - return true; - } - public boolean hasItems(EntityPlayer user, ItemStack item) - { - return hasItems(user, item, item.stackSize); - } - public boolean hasItems(EntityPlayer user, ItemStack item, int number) - { - int count = 0; - for(int a = 0; a < user.inventory.getSizeInventory(); a++) - { - ItemStack slot = user.inventory.getStackInSlot(a); - if(slot != null && slot.isItemEqual(item)) - { - count += slot.stackSize; - } - } - return count >= number; - } - public void syncData() - { - - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { - EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new AnvilPacket(this).generatePacket()); - } - } - public String resName = ""; - public String getResultName() - { - if(!worldObj.isRemote && recipe != null && recipe.getDisplayName() != null) - { - resName = recipe.getDisplayName(); - } - return resName; - } - public String getResearchNeeded() - { - return researchRequired; - } - public String getToolNeeded() - { - return toolTypeRequired; - } - public int getToolTierNeeded() - { - return this.hammerTierRequired; - } - public int getAnvilTierNeeded() - { - return this.anvilTierRequired; - } - public void consumeResources() - { - resetRecipe = true; - for(int slot = 0; slot < getSizeInventory()-1; slot++) - { - ItemStack item = getStackInSlot(slot); - if(item != null && item.getItem() != null && item.getItem().getContainerItem(item) != null) - { - if(item.stackSize == 1) - { - setInventorySlotContents(slot, item.getItem().getContainerItem(item)); - } - else - { - this.dropItem(item.getItem().getContainerItem(item)); - this.decrStackSize(slot, 1); - } - } - else - { - this.decrStackSize(slot, 1); - } - } - resetRecipe = false; - this.onInventoryChanged(); - } - private boolean canFitResult(ItemStack result) - { - ItemStack resSlot = inventory[getSizeInventory()-1]; - if(resSlot != null && result != null) - { - int maxStack = getStackSize(resSlot); - if(resSlot.stackSize + result.stackSize > maxStack) - { - return false; - } - if(resSlot.getItem() instanceof IHotItem) - { - ItemStack heated = Heatable.getItem(resSlot); - if(heated != null) - { - resSlot = heated; - } - } - if(!resSlot.isItemEqual(result) && (SpecialForging.getItemDesign(resSlot) == null || resSlot.stackSize >1) ) - { - return false; - } - } - return true; - } - private int getStackSize(ItemStack slot) - { - if(slot == null)return 0; - - if(slot.getItem() instanceof IHotItem) - { - ItemStack held = Heatable.getItem(slot); - if(held != null)return held.getMaxStackSize(); - } - return slot.getMaxStackSize(); - } - //CRAFTING CODE - public ItemStack getResult() - { - if(syncAnvil == null || craftMatrix == null) - { - return null; - } - - if(ticksExisted <= 1) - return null; - - for(int a = 0 ; a < getSizeInventory()-1 ; a ++) - { - craftMatrix.setInventorySlotContents(a, inventory[a]); - } - - return CraftingManagerAnvil.getInstance().findMatchingRecipe(this, craftMatrix); - } - public void updateCraftingData() - { - if(!worldObj.isRemote) - { - ItemStack oldRecipe = recipe; - recipe = getResult(); - //syncItems(); - - if (!canCraft() && progress > 0) - { - progress = 0; - reassignHitValues(); - qualityBalance = 0; - } - - if(recipe != null && oldRecipe != null && !recipe.isItemEqual(oldRecipe)) - { - progress = 0; - reassignHitValues(); - qualityBalance = 0; - } - if(progress > progressMax)progress = progressMax-1; - syncData(); - } - } - public boolean canCraft() - { - if(worldObj.isRemote) - { - //return canCraft == 1; - } - - if(this.isMythicRecipe() && !this.isMythicReady()) - { - return false; - } - - if(progressMax > 0 && recipe != null && recipe instanceof ItemStack) - { - return this.canFitResult(recipe); + + public boolean hasItems(EntityPlayer user, ItemStack[] items) { + for (ItemStack check : items) { + if (!hasItems(user, check)) { + return false; + } + } + return true; + } + + public boolean hasItems(EntityPlayer user, ItemStack item) { + return hasItems(user, item, item.stackSize); + } + + public boolean hasItems(EntityPlayer user, ItemStack item, int number) { + int count = 0; + for (int a = 0; a < user.inventory.getSizeInventory(); a++) { + ItemStack slot = user.inventory.getStackInSlot(a); + if (slot != null && slot.isItemEqual(item)) { + count += slot.stackSize; + } + } + return count >= number; + } + + public void syncData() { + + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new AnvilPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + } + + public String getResultName() { + if (!worldObj.isRemote && recipe != null && recipe.getDisplayName() != null) { + resName = recipe.getDisplayName(); + } + return resName; + } + + public String getResearchNeeded() { + return researchRequired; + } + + public String getToolNeeded() { + return toolTypeRequired; + } + + public int getToolTierNeeded() { + return this.hammerTierRequired; + } + + public int getAnvilTierNeeded() { + return this.anvilTierRequired; + } + + public void consumeResources() { + resetRecipe = true; + for (int slot = 0; slot < getSizeInventory() - 1; slot++) { + ItemStack item = getStackInSlot(slot); + if (item != null && item.getItem() != null && item.getItem().getContainerItem(item) != null) { + if (item.stackSize == 1) { + setInventorySlotContents(slot, item.getItem().getContainerItem(item)); + } else { + this.dropItem(item.getItem().getContainerItem(item)); + this.decrStackSize(slot, 1); + } + } else { + this.decrStackSize(slot, 1); + } + } + resetRecipe = false; + this.onInventoryChanged(); + } + + private boolean canFitResult(ItemStack result) { + ItemStack resSlot = inventory[getSizeInventory() - 1]; + if (resSlot != null && result != null) { + int maxStack = getStackSize(resSlot); + if (resSlot.stackSize + result.stackSize > maxStack) { + return false; + } + if (resSlot.getItem() instanceof IHotItem) { + ItemStack heated = Heatable.getItem(resSlot); + if (heated != null) { + resSlot = heated; + } + } + if (!resSlot.isItemEqual(result) + && (SpecialForging.getItemDesign(resSlot) == null || resSlot.stackSize > 1)) { + return false; + } + } + return true; + } + + private int getStackSize(ItemStack slot) { + if (slot == null) + return 0; + + if (slot.getItem() instanceof IHotItem) { + ItemStack held = Heatable.getItem(slot); + if (held != null) + return held.getMaxStackSize(); + } + return slot.getMaxStackSize(); + } + + // CRAFTING CODE + public ItemStack getResult() { + if (syncAnvil == null || craftMatrix == null) { + return null; + } + + if (ticksExisted <= 1) + return null; + + for (int a = 0; a < getSizeInventory() - 1; a++) { + craftMatrix.setInventorySlotContents(a, inventory[a]); + } + + return CraftingManagerAnvil.getInstance().findMatchingRecipe(this, craftMatrix); + } + + public void updateCraftingData() { + if (!worldObj.isRemote) { + ItemStack oldRecipe = recipe; + recipe = getResult(); + // syncItems(); + + if (!canCraft() && progress > 0) { + progress = 0; + reassignHitValues(); + qualityBalance = 0; + } + + if (recipe != null && oldRecipe != null && !recipe.isItemEqual(oldRecipe)) { + progress = 0; + reassignHitValues(); + qualityBalance = 0; + } + if (progress > progressMax) + progress = progressMax - 1; + syncData(); + } + } + + public boolean canCraft() { + if (worldObj.isRemote) { + // return canCraft == 1; + } + + if (this.isMythicRecipe() && !this.isMythicReady()) { + return false; + } + + if (progressMax > 0 && recipe != null && recipe instanceof ItemStack) { + return this.canFitResult(recipe); } return false; } - - private ItemStack recipe; - public float progressMax; - public float progress; - private int hammerTierRequired; - private int anvilTierRequired; - - @Override - public void setForgeTime(int i) - { - progressMax = i; - } - @Override - public void setHammerUsed(int i) - { - hammerTierRequired = i; - } - @Override - public void setRequiredAnvil(int i) - { - anvilTierRequired = i; - } - @Override - public void setHotOutput(boolean i) - { - outputHot = i; - } - public void setContainer(ContainerAnvilMF container) - { - syncAnvil = container; - craftMatrix = new AnvilCraftMatrix(this, syncAnvil, ShapelessAnvilRecipes.globalWidth, ShapelessAnvilRecipes.globalHeight); - } - public boolean shouldRenderCraftMetre() - { - return recipe != null; - } - public int getProgressBar(int i) - { - return (int)Math.ceil(i / progressMax * progress); - } - @Override - public void setToolType(String toolType) - { - this.toolTypeRequired = toolType; - } - @Override - public void setResearch(String research) - { - this.researchRequired = research; - } - - private boolean isMythicRecipe() - { - return false;//this.hammerTierRequired >= 6; - } - private boolean isMythicReady() - { - return true; - } - public String texName = ""; - public String getTextureName() - { - return texName; - } - public float qualityBalance = 0F; - public float thresholdPosition = 0.1F; - @Override - public float getMarkerPosition() - { - return qualityBalance; - } - @Override - public boolean shouldShowMetre() - { - return true; - } - @Override - public float getThresholdPosition() - { - return thresholdPosition; - } - @Override - public float getSuperThresholdPosition() - { - return thresholdPosition/3.5F; - } - - private float getAbsoluteBalance() - { - return qualityBalance < 0 ? -qualityBalance : qualityBalance; - } - private float getItemDamage() - { - int threshold = (int)(100F * thresholdPosition / 2F); - int total = (int)(100F * getAbsoluteBalance() - threshold); - - if(total > threshold) - { - float percent = ((float)total - (float)threshold) / (100F-(float)threshold); - return percent; - } - return 0F; - } - private boolean isPerfectItem() - { - int threshold = (int)(100F * getSuperThresholdPosition() / 2F); - int total = (int)(100F * getAbsoluteBalance() - threshold); - - return total <= threshold; - } - private ItemStack damageItem(ItemStack item) - { - float itemdam = getItemDamage(); - if(itemdam > 0.5F) - { - setTrait(item, "MF_Inferior"); - float q = 100F*(0.75F-(itemdam-0.5F)); - ToolHelper.setQuality(item, Math.max(10F, q)); - } - float damage = itemdam * item.getMaxDamage(); - if(item.isItemStackDamageable()) - { - if(damage > 0) - { - item.setItemDamage((int)(damage)); - if(isMythicRecipe()) - { - setTrait(item, "MF_Inferior"); - } - } - else if(isMythicRecipe()) - { - setTrait(item, "Unbreakable"); - } - } - return item; - } - private void setTrait(ItemStack item, String trait) - { - setTrait(item, trait, true); - } - private void setTrait(ItemStack item, String trait, boolean flag) - { - if(item == null)return; - if(item.getMaxStackSize() > 1 || !item.isItemStackDamageable()) - { - return; - } - - NBTTagCompound nbt = this.getNBT(item); - nbt.setBoolean(trait, flag); - } - private void updateThreshold() - { - float modifier = 1.0F; - if(tier < anvilTierRequired) - { - modifier *= 0.25F; - } - - float baseThreshold = worldObj.difficultySetting.getDifficultyId()>= 2 ? 7.5F : 10F; - thresholdPosition = (isMythicRecipe() ? 0.05F : baseThreshold/100F)*modifier; - } - public void upset(EntityPlayer user) - { - if(this.progress > 0 && this.progressMax > 0) - { - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "minefantasy2:block.anvilsucceed", 0.25F, 0.75F); - if(!worldObj.isRemote) - { - progress -= (progressMax/10F); - if(progress < 0) - { - ruinCraft(); - } - } - } - } - public float leftHit = 0F; - public float rightHit = 0F; - private void reassignHitValues() - { - if(!worldObj.isRemote) - { - leftHit = 0.1F + (0.01F*rand.nextInt(11)); - rightHit = 0.1F + (0.01F*rand.nextInt(11)); - } - } - @Override - public void setSkill(Skill skill) - { - skillUsed = skill; - } - @Override - public int getRecipeHammer() { - return hammerTierRequired; - } - @Override - public int getRecipeAnvil() { - return anvilTierRequired; - } + + @Override + public void setForgeTime(int i) { + progressMax = i; + } + + @Override + public void setHammerUsed(int i) { + hammerTierRequired = i; + } + + @Override + public void setRequiredAnvil(int i) { + anvilTierRequired = i; + } + + @Override + public void setHotOutput(boolean i) { + outputHot = i; + } + + public void setContainer(ContainerAnvilMF container) { + syncAnvil = container; + craftMatrix = new AnvilCraftMatrix(this, syncAnvil, ShapelessAnvilRecipes.globalWidth, + ShapelessAnvilRecipes.globalHeight); + } + + public boolean shouldRenderCraftMetre() { + return recipe != null; + } + + public int getProgressBar(int i) { + return (int) Math.ceil(i / progressMax * progress); + } + + @Override + public void setToolType(String toolType) { + this.toolTypeRequired = toolType; + } + + @Override + public void setResearch(String research) { + this.researchRequired = research; + } + + private boolean isMythicRecipe() { + return false;// this.hammerTierRequired >= 6; + } + + private boolean isMythicReady() { + return true; + } + + public String getTextureName() { + return texName; + } + + @Override + public float getMarkerPosition() { + return qualityBalance; + } + + @Override + public boolean shouldShowMetre() { + return true; + } + + @Override + public float getThresholdPosition() { + return thresholdPosition; + } + + @Override + public float getSuperThresholdPosition() { + return thresholdPosition / 3.5F; + } + + private float getAbsoluteBalance() { + return qualityBalance < 0 ? -qualityBalance : qualityBalance; + } + + private float getItemDamage() { + int threshold = (int) (100F * thresholdPosition / 2F); + int total = (int) (100F * getAbsoluteBalance() - threshold); + + if (total > threshold) { + float percent = ((float) total - (float) threshold) / (100F - threshold); + return percent; + } + return 0F; + } + + private boolean isPerfectItem() { + int threshold = (int) (100F * getSuperThresholdPosition() / 2F); + int total = (int) (100F * getAbsoluteBalance() - threshold); + + return total <= threshold; + } + + private ItemStack damageItem(ItemStack item) { + float itemdam = getItemDamage(); + if (itemdam > 0.5F) { + setTrait(item, "MF_Inferior"); + float q = 100F * (0.75F - (itemdam - 0.5F)); + ToolHelper.setQuality(item, Math.max(10F, q)); + } + float damage = itemdam * item.getMaxDamage(); + if (item.isItemStackDamageable()) { + if (damage > 0) { + item.setItemDamage((int) (damage)); + if (isMythicRecipe()) { + setTrait(item, "MF_Inferior"); + } + } else if (isMythicRecipe()) { + setTrait(item, "Unbreakable"); + } + } + return item; + } + + private void setTrait(ItemStack item, String trait) { + setTrait(item, trait, true); + } + + private void setTrait(ItemStack item, String trait, boolean flag) { + if (item == null) + return; + if (item.getMaxStackSize() > 1 || !item.isItemStackDamageable()) { + return; + } + + NBTTagCompound nbt = this.getNBT(item); + nbt.setBoolean(trait, flag); + } + + private void updateThreshold() { + float modifier = 1.0F; + if (tier < anvilTierRequired) { + modifier *= 0.25F; + } + + float baseThreshold = worldObj.difficultySetting.getDifficultyId() >= 2 ? 7.5F : 10F; + thresholdPosition = (isMythicRecipe() ? 0.05F : baseThreshold / 100F) * modifier; + } + + public void upset(EntityPlayer user) { + if (this.progress > 0 && this.progressMax > 0) { + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "minefantasy2:block.anvilsucceed", + 0.25F, 0.75F); + if (!worldObj.isRemote) { + progress -= (progressMax / 10F); + if (progress < 0) { + ruinCraft(); + } + } + } + } + + private void reassignHitValues() { + if (!worldObj.isRemote) { + leftHit = 0.1F + (0.01F * rand.nextInt(11)); + rightHit = 0.1F + (0.01F * rand.nextInt(11)); + } + } + + @Override + public void setSkill(Skill skill) { + skillUsed = skill; + } + + @Override + public int getRecipeHammer() { + return hammerTierRequired; + } + + @Override + public int getRecipeAnvil() { + return anvilTierRequired; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBellows.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBellows.java index a9d4c135..2cef86eb 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBellows.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBellows.java @@ -6,122 +6,106 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -import com.google.common.io.ByteArrayDataInput; - -import cpw.mods.fml.common.FMLCommonHandler; - -public class TileEntityBellows extends TileEntity -{ - public int direction; - public int press = 0; - public TileEntityBellows() - { - - } - public void interact(EntityPlayer player, float powerLevel) - { - int x = (int)xCoord; - int y = (int)yCoord; - int z = (int)zCoord; - IBellowsUseable forge = getFacingForge(); - if(press < 10) - { - if(player != null) - { - player.playSound("minefantasy2:block.bellows", 1, 1); - } - else - { - worldObj.playSound(xCoord, yCoord, zCoord, "minefantasy2:block.bellows", 1.0F, 1.0F, false); - } - press = 50; - if(forge != null) - { - forge.onUsedWithBellows(powerLevel); - } - sendPacketToClients(); - } - } - - @Override - public void updateEntity() - { - super.updateEntity(); - if(press > 0)press -= 2; - if(press < 0)press = 0; - sendPacketToClients(); - } - - private void sendPacketToClients() { - // TODO Auto-generated method stub - - } - public void readFromNBT(NBTTagCompound nbt) - { +public class TileEntityBellows extends TileEntity { + public int direction; + public int press = 0; + + public TileEntityBellows() { + + } + + public void interact(EntityPlayer player, float powerLevel) { + int x = xCoord; + int y = yCoord; + int z = zCoord; + IBellowsUseable forge = getFacingForge(); + if (press < 10) { + if (player != null) { + player.playSound("minefantasy2:block.bellows", 1, 1); + } else { + worldObj.playSound(xCoord, yCoord, zCoord, "minefantasy2:block.bellows", 1.0F, 1.0F, false); + } + press = 50; + if (forge != null) { + forge.onUsedWithBellows(powerLevel); + } + sendPacketToClients(); + } + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (press > 0) + press -= 2; + if (press < 0) + press = 0; + sendPacketToClients(); + } + + private void sendPacketToClients() { + // TODO Auto-generated method stub + + } + + public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); direction = nbt.getInteger("direction"); press = nbt.getInteger("press"); } - - public void writeToNBT(NBTTagCompound nbt) - { + public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setInteger("direction", direction); nbt.setInteger("press", press); } - - - - public ForgeDirection getFacing() - { - int dir = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - switch(dir)//clockwise + + public ForgeDirection getFacing() { + int dir = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + switch (dir)// clockwise { - case 0: //SOUTH - return ForgeDirection.SOUTH; - case 1: //WEST - return ForgeDirection.WEST; - case 2: //NORTH - return ForgeDirection.NORTH; - case 3: //EAST - return ForgeDirection.EAST; + case 0: // SOUTH + return ForgeDirection.SOUTH; + case 1: // WEST + return ForgeDirection.WEST; + case 2: // NORTH + return ForgeDirection.NORTH; + case 3: // EAST + return ForgeDirection.EAST; } - return ForgeDirection.SOUTH; + return ForgeDirection.SOUTH; } - public IBellowsUseable getFacingForge() - { - ForgeDirection dir = getFacing(); - int x2 = xCoord + dir.offsetX; - int y2 = yCoord + dir.offsetY; - int z2 = zCoord + dir.offsetZ; - - TileEntity tile = worldObj.getTileEntity(x2, y2, z2); - - if(tile != null && tile instanceof IBellowsUseable) - return (IBellowsUseable)tile; - - if(worldObj.getBlock(x2, y2, z2).getMaterial() != null && worldObj.getBlock(x2, y2, z2).getMaterial().isSolid()) - { - return getFacingForgeThroughWall(); - } - return null; + + public IBellowsUseable getFacingForge() { + ForgeDirection dir = getFacing(); + int x2 = xCoord + dir.offsetX; + int y2 = yCoord + dir.offsetY; + int z2 = zCoord + dir.offsetZ; + + TileEntity tile = worldObj.getTileEntity(x2, y2, z2); + + if (tile != null && tile instanceof IBellowsUseable) + return (IBellowsUseable) tile; + + if (worldObj.getBlock(x2, y2, z2).getMaterial() != null + && worldObj.getBlock(x2, y2, z2).getMaterial().isSolid()) { + return getFacingForgeThroughWall(); + } + return null; } - - public IBellowsUseable getFacingForgeThroughWall() - { - ForgeDirection dir = getFacing(); - int x2 = xCoord + (dir.offsetX*2); - int y2 = yCoord + (dir.offsetY*2); - int z2 = zCoord + (dir.offsetZ*2); - - TileEntity tile = worldObj.getTileEntity(x2, y2, z2); - if(tile == null) - return null; - if(tile instanceof IBellowsUseable) - { - return (IBellowsUseable)tile; - } - return null; + + public IBellowsUseable getFacingForgeThroughWall() { + ForgeDirection dir = getFacing(); + int x2 = xCoord + (dir.offsetX * 2); + int y2 = yCoord + (dir.offsetY * 2); + int z2 = zCoord + (dir.offsetZ * 2); + + TileEntity tile = worldObj.getTileEntity(x2, y2, z2); + if (tile == null) + return null; + if (tile instanceof IBellowsUseable) { + return (IBellowsUseable) tile; + } + return null; } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBerryBush.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBerryBush.java index 272a414f..5c39d28e 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBerryBush.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBerryBush.java @@ -1,45 +1,40 @@ package minefantasy.mf2.block.tileentity; -import java.util.Random; - import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; -public class TileEntityBerryBush extends TileEntity -{ - private long nextGrowbackTime; - private Random rand = new Random(); - - @Override - public void updateEntity() - { - super.updateEntity(); - - if(!worldObj.isRemote && worldObj.getTotalWorldTime() >= nextGrowbackTime) - {//Regrow - worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); - } - } - - public void harvestBerries() - { - double[] days = new double[]{2D, 7D}; - double modifier = MathHelper.getRandomDoubleInRange(rand, days[0], days[1]); - nextGrowbackTime = worldObj.getTotalWorldTime() + (int)(24000*modifier); - worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setLong("nextGrowbackTime", nextGrowbackTime); - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - nextGrowbackTime = nbt.getLong("nextGrowbackTime"); - } +import java.util.Random; + +public class TileEntityBerryBush extends TileEntity { + private long nextGrowbackTime; + private Random rand = new Random(); + + @Override + public void updateEntity() { + super.updateEntity(); + + if (!worldObj.isRemote && worldObj.getTotalWorldTime() >= nextGrowbackTime) {// Regrow + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); + } + } + + public void harvestBerries() { + double[] days = new double[]{2D, 7D}; + double modifier = MathHelper.getRandomDoubleInRange(rand, days[0], days[1]); + nextGrowbackTime = worldObj.getTotalWorldTime() + (int) (24000 * modifier); + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setLong("nextGrowbackTime", nextGrowbackTime); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + nextGrowbackTime = nbt.getLong("nextGrowbackTime"); + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBigFurnace.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBigFurnace.java index c7019ae6..50d3bfe5 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBigFurnace.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBigFurnace.java @@ -1,8 +1,5 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.heating.ForgeItemHandler; @@ -13,8 +10,8 @@ import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.refining.BlockBigFurnace; import minefantasy.mf2.item.food.FoodListMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.BigFurnacePacket; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -27,1073 +24,900 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.StatCollector; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityBigFurnace extends TileEntity implements IBellowsUseable, IInventory, ISidedInventory -{ - - //UNIVERSAL - public int fuel; - public int maxFuel; - public ItemStack[] inv; - public int itemMeta; - public boolean built = false; - private Random rand = new Random(); - - //ANIMATE - public int numUsers; - public int doorAngle; - - //HEATER - public float heat; - public float maxHeat; - private int aboveType; - public int justShared; - - //FURNACE - public int progress; - private int ticksExisted; - private int ticksSinceSync; - - /** - * CLIENT VAR - * This is used to determine if the block is able to emit smoke - */ - public boolean isBurningClient; - - public TileEntityBigFurnace setBlockType(Block block) - { - blockType = block; - return this; - } - public TileEntityBigFurnace() - { - super(); - inv = new ItemStack[8]; - fuel = maxFuel = progress = 0; - } - public TileEntityBigFurnace(int meta) - { - this(); - itemMeta = meta; - } - - - @Override - public void onUsedWithBellows(float powerLevel) - { - if(isHeater()) - { - if(justShared > 0) - { - return; - } - justShared = 5; - - if(fuel > 0) - { - int max = (int)((float)maxHeat * 1.5F); - if(heat < max) - { - heat += 50*powerLevel; - } - - for(int a = 0; a < 10; a ++) - { - worldObj.spawnParticle("flame", xCoord+(rand.nextDouble()*0.8D)+0.1D, yCoord + 0.4D, zCoord+(rand.nextDouble()*0.8D)+0.1D, 0, 0.01, 0); - } - } - pumpBellows(-1, 0, powerLevel*0.9F); - pumpBellows(0, -1, powerLevel*0.9F); - pumpBellows(0, 1, powerLevel*0.9F); - pumpBellows(1, 0, powerLevel*0.9F); - } - } - - - private void pumpBellows(int x, int z, float pump) - { - int share = 2; - TileEntity tile = worldObj.getTileEntity(xCoord+x, yCoord, zCoord+z); - if(tile == null)return; - - if(tile instanceof TileEntityBigFurnace) - { - TileEntityBigFurnace furn = (TileEntityBigFurnace)tile; - if(furn.isHeater()) - furn.onUsedWithBellows(pump); - } - } - private boolean wasBurning; - @Override - public void updateEntity() - { - super.updateEntity(); - - if(!worldObj.isRemote) - { - if(numUsers > 0 && doorAngle < 20) - { - doorAngle ++; - } - - if(numUsers <= 0 && doorAngle > 0) - { - doorAngle --; - } - if(doorAngle < 0)doorAngle = 0; - if(doorAngle > 20)doorAngle = 20; - } - - ++ticksExisted; - if(justShared > 0)justShared --; - if(ticksExisted % 10 == 0) - { - built = structureExists(); - } - if(isHeater()) - { - updateHeater(); - } - else - { - updateFurnace(); - } - //UNIVERSAL - if(isBurning() != wasBurning || ticksExisted == 20) - { - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); - } - if(!worldObj.isRemote) - { - sendPacketToClients(); - } - wasBurning = isBurning(); - } - - private void updateFurnace() - { - if(isBurning()) - { - if(worldObj.isRemote && rand.nextInt(10)==0) - { - worldObj.spawnParticle("flame", xCoord+(rand.nextDouble()*0.8D)+0.1D, yCoord + 0.4D, zCoord+(rand.nextDouble()*0.8D)+0.1D, 0, 0.01, 0); - } - } - if(worldObj.isRemote) - { - return; - } - if(isBurning()) - { - puffSmoke(new Random(), worldObj, xCoord, yCoord, zCoord); - } - TileEntityBigFurnace heater = getHeater(); - - if(heater != null) - { - heat = heater.heat; - } - else - { - heat -= 4; - } - boolean canSmelt = false; - boolean smelted = false; - - if(getSpecialResult() != null) - { - if(!canFitSpecialResult()) - { - canSmelt = false; - } - else - { - canSmelt = true; - - if(progress >= getMaxTime()) - { - smeltSpecial(); - smelted = true; - } - } - } - else for(int a = 0; a < 4; a ++) - { - if(canSmelt(inv[a], inv[a+4])) - { - canSmelt = true; - - if(progress >= getMaxTime()) - { - smeltItem(a, a+4); - smelted = true; - } - } - } - - if(canSmelt) - { - progress += heat; - } - if(!canSmelt || smelted) - { - progress = 0; - } - } - - private boolean canFitSpecialResult() - { - ItemStack spec = getSpecialResult(); - - if(spec != null) - { - int spaceNeeded = spec.stackSize; - int spaceLeft = 0; - - for(int a = 4; a < 8; a ++) - { - ItemStack item = inv[a]; - if(inv[a] == null) - { - spaceLeft += 64; - } - else - { - if(CustomToolHelper.areEqual(inv[a], spec)) - { - if(inv[a].stackSize < inv[a].getMaxStackSize()) - { - spaceLeft += inv[a].getMaxStackSize() - inv[a].stackSize; - } - } - } - } - return spec.stackSize <= spaceLeft; - } - return false; - } - private void smeltSpecial() - { - ItemStack res = getSpecialResult().copy(); - - for(int output = 4; output < 8; output ++) - { - if(res.stackSize <= 0)break; - - if(inv[output] == null) - { - setInventorySlotContents(output, res); - break; - } - else - { - if(CustomToolHelper.areEqual(inv[output], res)) - { - int spaceLeft = inv[output].getMaxStackSize() - inv[output].stackSize; - - if(res.stackSize <= spaceLeft) - { - inv[output].stackSize += res.stackSize; - break; - } - else - { - inv[output].stackSize += spaceLeft; - res.stackSize -= spaceLeft; - } - } - } - } - for(int input = 0; input < 4; input ++) - decrStackSize(input, 1); - } - - public void puffSmoke(Random rand, World world, int x, int y, int z) - { - if(rand.nextInt(5) != 0) - { - return; - } - ForgeDirection dir = getBack(); - SmokeMechanics.emitSmokeIndirect(world, x+dir.offsetX, y+(isHeater() ? 2 : 1), z+dir.offsetZ, 1); - } - - private int getMaxTime() - { - return (int) 1.0E+5; - } - private void smeltItem(int input, int output) - { - ItemStack res = getResult(inv[input]).copy(); - - if(inv[output] == null) - { - setInventorySlotContents(output, res); - } - else - { - if(CustomToolHelper.areEqual(inv[output], res)) - { - inv[output].stackSize += res.stackSize; - } - } - - decrStackSize(input, 1); - } - private boolean canSmelt(ItemStack in, ItemStack out) - { - if(isHeater()) return false; - - if(!built)return false; - - ItemStack res = getResult(in); - if(res == null) - { - return false; - } - if(out == null) - { - return true; - } - if(CustomToolHelper.areEqual(out, res)) - { - int max = res.getMaxStackSize(); - if((out.stackSize + res.stackSize) > max) - { - return false; - } - } - else - { - return false; - } - - return true; - } - - private TileEntityBigFurnace getHeater() - { - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord-1, zCoord); - if(tile != null && tile instanceof TileEntityBigFurnace) - { - if(((TileEntityBigFurnace)tile).isHeater()) - return (TileEntityBigFurnace)tile; - } - return null; - } - - private TileEntityBigFurnace getFurnace() - { - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord+1, zCoord); - if(tile != null && tile instanceof TileEntityBigFurnace) - { - if(!((TileEntityBigFurnace)tile).isHeater()) - return (TileEntityBigFurnace)tile; - } - return null; - } - - private void updateHeater() - { - if(worldObj.isRemote)return; - - TileEntityBigFurnace furn = getFurnace(); - if(furn != null) - { - aboveType = furn.getType(); - } - if(!built) - { - heat = maxHeat = fuel = maxFuel = 0; - return; - } - if(heat < maxHeat) - { - heat ++; - } - if(heat > maxHeat) - { - heat --; - } - if(fuel > 0) - { - fuel --; - } - else - { - if(inv[0] != null && isItemFuel(inv[0])) - { - fuel = maxFuel = getItemBurnTime(inv[0]); - maxHeat = getItemHeat(inv[0]); - ItemStack cont = inv[0].getItem().getContainerItem(inv[0]); - - if(cont != null) - { - inv[0] = cont; - } - else - { - decrStackSize(0, 1); - } - } - if(fuel <= 0) - { - if(heat > 0)heat --; - maxHeat = 0; - } - } - - - } - - - - private float getItemHeat(ItemStack itemStack) - { - return ForgeItemHandler.getForgeHeat(itemStack); - } - public ItemStack getResult(ItemStack item) - { - if(item == null)return null; - - //SPECIAL SMELTING - BigFurnaceRecipes recipe = BigFurnaceRecipes.getResult(item); - if(recipe != null && recipe.tier <= this.getTier()) - { - return recipe.result; - } - - ItemStack res = FurnaceRecipes.smelting().getSmeltingResult(item);//If no special: try vanilla - if(res != null) - { - if(res.getItem() instanceof ItemFood || item.getItem() instanceof ItemFood) - { - return new ItemStack(FoodListMF.burnt_food, 1, 1); - } - return res; - } - - return null; - } - - public ItemStack getSpecialResult() - { - return null; - /* - ItemStack[] input = new ItemStack[4]; - for(int a = 0; a < 4; a ++) - { - input[a] = inv[a]; - } - Alloy alloy = SpecialFurnaceRecipes.getResult(input); - if(alloy != null) - { - if(alloy.getLevel() <= getSmeltLevel()) - { - return SpecialFurnaceRecipes.getResult(input).getRecipeOutput(); - } - } - return null; - */ - } - - public int getSizeInventory() { - return inv.length; - } - - public ItemStack getStackInSlot(int i) { - return inv[i]; - } - - public ItemStack decrStackSize(int i, int j) { - if (inv[i] != null) { - if (inv[i].stackSize <= j) { - ItemStack itemstack = inv[i]; - inv[i] = null; - return itemstack; - } - ItemStack itemstack1 = inv[i].splitStack(j); - if (inv[i].stackSize == 0) { - inv[i] = null; - } - return itemstack1; - } else { - return null; - } - } - - @SideOnly(Side.CLIENT) - public int getBurnTimeRemainingScaled(int height) - { - if (this.maxFuel == 0) - { +import java.util.Random; + +public class TileEntityBigFurnace extends TileEntity implements IBellowsUseable, IInventory, ISidedInventory { + + // UNIVERSAL + public int fuel; + public int maxFuel; + public ItemStack[] inv; + public int itemMeta; + public boolean built = false; + // ANIMATE + public int numUsers; + public int doorAngle; + // HEATER + public float heat; + public float maxHeat; + public int justShared; + // FURNACE + public int progress; + /** + * CLIENT VAR This is used to determine if the block is able to emit smoke + */ + public boolean isBurningClient; + private Random rand = new Random(); + private int aboveType; + private int ticksExisted; + private int ticksSinceSync; + private boolean wasBurning; + + public TileEntityBigFurnace() { + super(); + inv = new ItemStack[8]; + fuel = maxFuel = progress = 0; + } + + public TileEntityBigFurnace(int meta) { + this(); + itemMeta = meta; + } + + public TileEntityBigFurnace setBlockType(Block block) { + blockType = block; + return this; + } + + @Override + public void onUsedWithBellows(float powerLevel) { + if (isHeater()) { + if (justShared > 0) { + return; + } + justShared = 5; + + if (fuel > 0) { + int max = (int) (maxHeat * 1.5F); + if (heat < max) { + heat += 50 * powerLevel; + } + + for (int a = 0; a < 10; a++) { + worldObj.spawnParticle("flame", xCoord + (rand.nextDouble() * 0.8D) + 0.1D, yCoord + 0.4D, + zCoord + (rand.nextDouble() * 0.8D) + 0.1D, 0, 0.01, 0); + } + } + pumpBellows(-1, 0, powerLevel * 0.9F); + pumpBellows(0, -1, powerLevel * 0.9F); + pumpBellows(0, 1, powerLevel * 0.9F); + pumpBellows(1, 0, powerLevel * 0.9F); + } + } + + private void pumpBellows(int x, int z, float pump) { + int share = 2; + TileEntity tile = worldObj.getTileEntity(xCoord + x, yCoord, zCoord + z); + if (tile == null) + return; + + if (tile instanceof TileEntityBigFurnace) { + TileEntityBigFurnace furn = (TileEntityBigFurnace) tile; + if (furn.isHeater()) + furn.onUsedWithBellows(pump); + } + } + + @Override + public void updateEntity() { + super.updateEntity(); + + if (!worldObj.isRemote) { + if (numUsers > 0 && doorAngle < 20) { + doorAngle++; + } + + if (numUsers <= 0 && doorAngle > 0) { + doorAngle--; + } + if (doorAngle < 0) + doorAngle = 0; + if (doorAngle > 20) + doorAngle = 20; + } + + ++ticksExisted; + if (justShared > 0) + justShared--; + if (ticksExisted % 10 == 0) { + built = structureExists(); + } + if (isHeater()) { + updateHeater(); + } else { + updateFurnace(); + } + // UNIVERSAL + if (isBurning() != wasBurning || ticksExisted == 20) { + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); + } + if (!worldObj.isRemote) { + sendPacketToClients(); + } + wasBurning = isBurning(); + } + + private void updateFurnace() { + if (isBurning()) { + if (worldObj.isRemote && rand.nextInt(10) == 0) { + worldObj.spawnParticle("flame", xCoord + (rand.nextDouble() * 0.8D) + 0.1D, yCoord + 0.4D, + zCoord + (rand.nextDouble() * 0.8D) + 0.1D, 0, 0.01, 0); + } + } + if (worldObj.isRemote) { + return; + } + if (isBurning()) { + puffSmoke(new Random(), worldObj, xCoord, yCoord, zCoord); + } + TileEntityBigFurnace heater = getHeater(); + + if (heater != null) { + heat = heater.heat; + } else { + heat -= 4; + } + boolean canSmelt = false; + boolean smelted = false; + + if (getSpecialResult() != null) { + if (!canFitSpecialResult()) { + canSmelt = false; + } else { + canSmelt = true; + + if (progress >= getMaxTime()) { + smeltSpecial(); + smelted = true; + } + } + } else + for (int a = 0; a < 4; a++) { + if (canSmelt(inv[a], inv[a + 4])) { + canSmelt = true; + + if (progress >= getMaxTime()) { + smeltItem(a, a + 4); + smelted = true; + } + } + } + + if (canSmelt) { + progress += heat; + } + if (!canSmelt || smelted) { + progress = 0; + } + } + + private boolean canFitSpecialResult() { + ItemStack spec = getSpecialResult(); + + if (spec != null) { + int spaceNeeded = spec.stackSize; + int spaceLeft = 0; + + for (int a = 4; a < 8; a++) { + ItemStack item = inv[a]; + if (inv[a] == null) { + spaceLeft += 64; + } else { + if (CustomToolHelper.areEqual(inv[a], spec)) { + if (inv[a].stackSize < inv[a].getMaxStackSize()) { + spaceLeft += inv[a].getMaxStackSize() - inv[a].stackSize; + } + } + } + } + return spec.stackSize <= spaceLeft; + } + return false; + } + + private void smeltSpecial() { + ItemStack res = getSpecialResult().copy(); + + for (int output = 4; output < 8; output++) { + if (res.stackSize <= 0) + break; + + if (inv[output] == null) { + setInventorySlotContents(output, res); + break; + } else { + if (CustomToolHelper.areEqual(inv[output], res)) { + int spaceLeft = inv[output].getMaxStackSize() - inv[output].stackSize; + + if (res.stackSize <= spaceLeft) { + inv[output].stackSize += res.stackSize; + break; + } else { + inv[output].stackSize += spaceLeft; + res.stackSize -= spaceLeft; + } + } + } + } + for (int input = 0; input < 4; input++) + decrStackSize(input, 1); + } + + public void puffSmoke(Random rand, World world, int x, int y, int z) { + if (rand.nextInt(5) != 0) { + return; + } + ForgeDirection dir = getBack(); + SmokeMechanics.emitSmokeIndirect(world, x + dir.offsetX, y + (isHeater() ? 2 : 1), z + dir.offsetZ, 1); + } + + private int getMaxTime() { + return (int) 1.0E+5; + } + + private void smeltItem(int input, int output) { + ItemStack res = getResult(inv[input]).copy(); + + if (inv[output] == null) { + setInventorySlotContents(output, res); + } else { + if (CustomToolHelper.areEqual(inv[output], res)) { + inv[output].stackSize += res.stackSize; + } + } + + decrStackSize(input, 1); + } + + private boolean canSmelt(ItemStack in, ItemStack out) { + if (isHeater()) + return false; + + if (!built) + return false; + + ItemStack res = getResult(in); + if (res == null) { + return false; + } + if (out == null) { + return true; + } + if (CustomToolHelper.areEqual(out, res)) { + int max = res.getMaxStackSize(); + if ((out.stackSize + res.stackSize) > max) { + return false; + } + } else { + return false; + } + + return true; + } + + private TileEntityBigFurnace getHeater() { + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + if (tile != null && tile instanceof TileEntityBigFurnace) { + if (((TileEntityBigFurnace) tile).isHeater()) + return (TileEntityBigFurnace) tile; + } + return null; + } + + private TileEntityBigFurnace getFurnace() { + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); + if (tile != null && tile instanceof TileEntityBigFurnace) { + if (!((TileEntityBigFurnace) tile).isHeater()) + return (TileEntityBigFurnace) tile; + } + return null; + } + + private void updateHeater() { + if (worldObj.isRemote) + return; + + TileEntityBigFurnace furn = getFurnace(); + if (furn != null) { + aboveType = furn.getType(); + } + if (!built) { + heat = maxHeat = fuel = maxFuel = 0; + return; + } + if (heat < maxHeat) { + heat++; + } + if (heat > maxHeat) { + heat--; + } + if (fuel > 0) { + fuel--; + } else { + if (inv[0] != null && isItemFuel(inv[0])) { + fuel = maxFuel = getItemBurnTime(inv[0]); + maxHeat = getItemHeat(inv[0]); + ItemStack cont = inv[0].getItem().getContainerItem(inv[0]); + + if (cont != null) { + inv[0] = cont; + } else { + decrStackSize(0, 1); + } + } + if (fuel <= 0) { + if (heat > 0) + heat--; + maxHeat = 0; + } + } + + } + + private float getItemHeat(ItemStack itemStack) { + return ForgeItemHandler.getForgeHeat(itemStack); + } + + public ItemStack getResult(ItemStack item) { + if (item == null) + return null; + + // SPECIAL SMELTING + BigFurnaceRecipes recipe = BigFurnaceRecipes.getResult(item); + if (recipe != null && recipe.tier <= this.getTier()) { + return recipe.result; + } + + ItemStack res = FurnaceRecipes.smelting().getSmeltingResult(item);// If no special: try vanilla + if (res != null) { + if (res.getItem() instanceof ItemFood || item.getItem() instanceof ItemFood) { + return new ItemStack(FoodListMF.burnt_food, 1, 1); + } + return res; + } + + return null; + } + + public ItemStack getSpecialResult() { + return null; + /* + * ItemStack[] input = new ItemStack[4]; for(int a = 0; a < 4; a ++) { input[a] + * = inv[a]; } Alloy alloy = SpecialFurnaceRecipes.getResult(input); if(alloy != + * null) { if(alloy.getLevel() <= getSmeltLevel()) { return + * SpecialFurnaceRecipes.getResult(input).getRecipeOutput(); } } return null; + */ + } + + public int getSizeInventory() { + return inv.length; + } + + public ItemStack getStackInSlot(int i) { + return inv[i]; + } + + public ItemStack decrStackSize(int i, int j) { + if (inv[i] != null) { + if (inv[i].stackSize <= j) { + ItemStack itemstack = inv[i]; + inv[i] = null; + return itemstack; + } + ItemStack itemstack1 = inv[i].splitStack(j); + if (inv[i].stackSize == 0) { + inv[i] = null; + } + return itemstack1; + } else { + return null; + } + } + + @SideOnly(Side.CLIENT) + public int getBurnTimeRemainingScaled(int height) { + if (this.maxFuel == 0) { this.maxFuel = 200; } return this.fuel * height / this.maxFuel; } - - @SideOnly(Side.CLIENT) - public int getHeatScaled(int height) - { - if(heat <= 0)return 0; - int size = (int)((float)height / TileEntityForge.maxTemperature * this.heat); - - return (int)Math.min(size, height); - } - - @SideOnly(Side.CLIENT) - public int getItemHeatScaled(int height) - { - if(maxHeat <= 0)return 0; - int size = (int)((float)height / TileEntityForge.maxTemperature * this.maxHeat); - - return (int)Math.min(size, height); - } - - - public void setInventorySlotContents(int i, ItemStack itemstack) { - inv[i] = itemstack; - if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); - } - } - - public String getInvName() - { - int t = getType(); - String tier = ""; - - if(isHeater()) - { - return StatCollector.translateToLocal("tile.furnace.name") + " " + StatCollector.translateToLocal("block.furnace.heater"); - } - + + @SideOnly(Side.CLIENT) + public int getHeatScaled(int height) { + if (heat <= 0) + return 0; + int size = (int) (height / TileEntityForge.maxTemperature * this.heat); + + return Math.min(size, height); + } + + @SideOnly(Side.CLIENT) + public int getItemHeatScaled(int height) { + if (maxHeat <= 0) + return 0; + int size = (int) (height / TileEntityForge.maxTemperature * this.maxHeat); + + return Math.min(size, height); + } + + public void setInventorySlotContents(int i, ItemStack itemstack) { + inv[i] = itemstack; + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { + itemstack.stackSize = getInventoryStackLimit(); + } + } + + public String getInvName() { + int t = getType(); + String tier = ""; + + if (isHeater()) { + return StatCollector.translateToLocal("tile.furnace.name") + " " + + StatCollector.translateToLocal("block.furnace.heater"); + } + return tier + " " + StatCollector.translateToLocal("tile.furnace.name"); - } - - - public int getSmeltLevel() { - if(isHeater()) - { - return -1; - } - return getType() - 1; - } - - public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(nbt); - - NBTTagList savedItems = nbt.getTagList("Items", 10); + } + + public int getSmeltLevel() { + if (isHeater()) { + return -1; + } + return getType() - 1; + } + + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inv.length) - { + if (slotNum >= 0 && slotNum < this.inv.length) { this.inv[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } - justShared = nbt.getInteger("Shared"); - built = nbt.getBoolean("Built"); - - fuel = nbt.getInteger("fuel"); - maxFuel = nbt.getInteger("MaxFuel"); - - heat = nbt.getFloat("heat"); - maxHeat = nbt.getFloat("maxHeat"); - - progress = nbt.getInteger("progress"); - aboveType = nbt.getInteger("Level"); - } - - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - - nbt.setInteger("Shared", justShared); - nbt.setInteger("Level", aboveType); - nbt.setBoolean("Built", built); - - nbt.setInteger("fuel", fuel); - nbt.setInteger("maxFuel", maxFuel); - - nbt.setFloat("heat", heat); - nbt.setFloat("maxHeat", maxHeat); - - nbt.setInteger("progress", progress); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.inv.length; ++i) - { - if (this.inv[i] != null) - { + justShared = nbt.getInteger("Shared"); + built = nbt.getBoolean("Built"); + + fuel = nbt.getInteger("fuel"); + maxFuel = nbt.getInteger("MaxFuel"); + + heat = nbt.getFloat("heat"); + maxHeat = nbt.getFloat("maxHeat"); + + progress = nbt.getInteger("progress"); + aboveType = nbt.getInteger("Level"); + } + + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setInteger("Shared", justShared); + nbt.setInteger("Level", aboveType); + nbt.setBoolean("Built", built); + + nbt.setInteger("fuel", fuel); + nbt.setInteger("maxFuel", maxFuel); + + nbt.setFloat("heat", heat); + nbt.setFloat("maxHeat", maxHeat); + + nbt.setInteger("progress", progress); + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.inv.length; ++i) { + if (this.inv[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inv[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - } - - public int getInventoryStackLimit() { - return 64; - } - - - public boolean isBurning() - { - if(worldObj == null) - { - return false; - } - if(worldObj.isRemote) - { - return isBurningClient; - } - if(isHeater()) - { - return heat > 0; - } - return progress > 0 && heat > 0; - } - public boolean isHeater() - { - Block block = worldObj != null ? getBlockType() : blockType; - - if(block != null && block instanceof BlockBigFurnace) - { - return ((BlockBigFurnace)block).isHeater; - } - return false; - } - - - public int getTier() - { - Block block = worldObj != null ? getBlockType() : blockType; - - if(block != null && block instanceof BlockBigFurnace) - { - return ((BlockBigFurnace)block).tier; - } - return 0; - } - - public int getItemBurnTime(ItemStack itemstack) { - if (itemstack == null) { - return 0; - } - return (int)Math.ceil(ForgeItemHandler.getForgeFuel(itemstack)/8); - } - - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { - return false; - } - return entityplayer.getDistanceSq((double) xCoord + 0.5D, - (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D; - } - - public void openChest() - { - if(numUsers == 0) - { - this.worldObj.playSoundEffect(xCoord+0.5D, (double)this.yCoord + 0.5D, zCoord+0.5D, "minefantasy2:block.furnace_open", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - ++numUsers; - } - - public void closeChest() - { - --numUsers; - if(numUsers == 0 && doorAngle >= 15) - { - this.worldObj.playSoundEffect(xCoord+0.5D, (double)this.yCoord + 0.5D, zCoord+0.5D, "minefantasy2:block.furnace_close", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - } - - @Override - public ItemStack getStackInSlotOnClosing(int var1) { - return null; - } - - private void sendPacketToClients() - { - if (!worldObj.isRemote) - { - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { + } + + public int getInventoryStackLimit() { + return 64; + } + + public boolean isBurning() { + if (worldObj == null) { + return false; + } + if (worldObj.isRemote) { + return isBurningClient; + } + if (isHeater()) { + return heat > 0; + } + return progress > 0 && heat > 0; + } + + public boolean isHeater() { + Block block = worldObj != null ? getBlockType() : blockType; + + if (block != null && block instanceof BlockBigFurnace) { + return ((BlockBigFurnace) block).isHeater; + } + return false; + } + + public int getTier() { + Block block = worldObj != null ? getBlockType() : blockType; + + if (block != null && block instanceof BlockBigFurnace) { + return ((BlockBigFurnace) block).tier; + } + return 0; + } + + public int getItemBurnTime(ItemStack itemstack) { + if (itemstack == null) { + return 0; + } + return (int) Math.ceil(ForgeItemHandler.getForgeFuel(itemstack) / 8); + } + + public boolean isUseableByPlayer(EntityPlayer entityplayer) { + if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { + return false; + } + return entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64D; + } + + public void openChest() { + if (numUsers == 0) { + this.worldObj.playSoundEffect(xCoord + 0.5D, this.yCoord + 0.5D, zCoord + 0.5D, + "minefantasy2:block.furnace_open", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + ++numUsers; + } + + public void closeChest() { + --numUsers; + if (numUsers == 0 && doorAngle >= 15) { + this.worldObj.playSoundEffect(xCoord + 0.5D, this.yCoord + 0.5D, zCoord + 0.5D, + "minefantasy2:block.furnace_close", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + } + + @Override + public ItemStack getStackInSlotOnClosing(int var1) { + return null; + } + + private void sendPacketToClients() { + if (!worldObj.isRemote) { + NetworkUtils.sendToWatchers(new BigFurnacePacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + /* + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new BigFurnacePacket(this).generatePacket()); + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, + new BigFurnacePacket(this).generatePacket()); } - } - } - - /* - @Override - public void recievePacket(ByteArrayDataInput data) - { - fuel = data.readInt(); - progress = data.readInt(); - direction = data.readInt(); - heat = data.readInt(); - int burn = data.readInt(); - isBurningClient = burn == 1; - justShared = data.readInt(); - doorAngle = data.readInt(); - } - */ - - public int getBlockMetadata() - { - if(worldObj == null) - return itemMeta*2; - - - if (this.blockMetadata == -1) - { + */ + } + } + + /* + * @Override public void recievePacket(ByteArrayDataInput data) { fuel = + * data.readInt(); progress = data.readInt(); direction = data.readInt(); heat = + * data.readInt(); int burn = data.readInt(); isBurningClient = burn == 1; + * justShared = data.readInt(); doorAngle = data.readInt(); } + */ + + public int getBlockMetadata() { + if (worldObj == null) + return itemMeta * 2; + + if (this.blockMetadata == -1) { this.blockMetadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); } return this.blockMetadata; } - - /** - * Heater:0||Stone :1; - */ - public int getType() - { - return isHeater() ? 0 : 1; - } - - private int getOnMetadata() - { - return getType()*2 + 1; - } - - private int getOffMetadata() - { - return getType()*2; - } - - - @Override - public int[] getAccessibleSlotsFromSide(int side) { - if(isHeater()) - { - return new int[]{0}; - } - return new int[]{0, 1, 2, 3, 4, 5, 6, 7}; - } - - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) { - if(isHeater()) - { - return slot == 0 && isItemFuel(item); - } - return slot < 4 && getResult(item) != null; - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - return canInsertItem(slot, item, 0); - } - - public boolean isItemFuel(ItemStack item) - { - return this.getItemBurnTime(item) > 0; - } - - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) - { - if(!isHeater()) - { - return slot >= 4; - } - return item.getItem() == Items.bucket; - } - - - - public int getCookProgressScaled(int i) - { - return (progress * i) / getMaxTime(); - } - - public boolean isBlockValidForSide(int x, int y, int z) - { - if(worldObj == null) - { - return false; - } - - Block block = worldObj.getBlock(x, y, z); - - if(block == null) - { - return false; - } - - if(block == worldObj.getBlock(xCoord, yCoord, zCoord)) - { - return true; - } - return block == BlockListMF.firebricks; - } - - - /** - * Checks a valid block for sides. It must be the required block. - * - * HEATER: Requires any stone block for bronze, stone above hardness 2.0(like slate)for iron, - * and stone above hardness above 5.0(like granite) for steel - * - * FURNACES require metal blocks of their material - */ - public boolean isBlockValidForTop(int x, int y, int z) - { - if(worldObj == null) - { - return false; - } - Block block = worldObj.getBlock(x, y, z); - - if(block == null) - { - return false; - } - return block == BlockListMF.firebricks; - } - - - - public boolean isBlockValidForSide(ForgeDirection side) - { - if(worldObj == null) - { - return false; - } - - int x = xCoord + side.offsetX; - int y = yCoord + side.offsetY; - int z = zCoord + side.offsetZ; - - return isBlockValidForSide(x, y, z); - } - - - public boolean isSolid(ForgeDirection side) - { - if(worldObj == null) - { - return false; - } - - int x = xCoord + side.offsetX; - int y = yCoord + side.offsetY; - int z = zCoord + side.offsetZ; - - Material mat = worldObj.getBlock(x, y, z).getMaterial(); - - return mat.isSolid(); - } - - - - /** - * Determines if the furnace is built properly - * HEATER must have sides blocked by stone - * FURNACES must have walls built to specifications - */ - private boolean structureExists() - { - if(worldObj == null) - { - return false; - } - - if(isSolid(getFront())) - { - return false; - } - - if(!isHeater() && !isBlockValidForTop(xCoord, yCoord+1, zCoord)) - { - return false; - } - - if(!isBlockValidForSide(getLeft())) - { - return false; - } - if(!isBlockValidForSide(getRight())) - { - return false; - } - if(!isBlockValidForSide(getBack())) - { - return false; - } - - - return true; - } - - - - - - /** - * Gets the direction the face is at(Opposite to the placer) - */ - public ForgeDirection getFront() - { - int direction = getDirection(); - if(direction == 0)//SOUTH PLACE - { - return ForgeDirection.NORTH; - } - if(direction == 1)//WEST PLACE - { - return ForgeDirection.EAST; - } - if(direction == 2)//NORTH PLACE - { - return ForgeDirection.SOUTH; - } - if(direction == 3)//EAST PLACE - { - return ForgeDirection.WEST; - } - return ForgeDirection.UNKNOWN; - } - - /** - * Gets the direction the back is facing (Same dir as placer) - */ - public ForgeDirection getBack() - { - int direction = getDirection(); - if(direction == 0)//SOUTH PLACE - { - return ForgeDirection.SOUTH; - } - if(direction == 1)//WEST PLACE - { - return ForgeDirection.WEST; - } - if(direction == 2)//NORTH PLACE - { - return ForgeDirection.NORTH; - } - if(direction == 3)//EAST PLACE - { - return ForgeDirection.EAST; - } - return ForgeDirection.UNKNOWN; - } - - /** - * Gets the direction the left is facing - */ - public ForgeDirection getLeft() - { - int direction = getDirection(); - if(direction == 0)//SOUTH PLACE - { - return ForgeDirection.WEST; - } - if(direction == 1)//WEST PLACE - { - return ForgeDirection.NORTH; - } - if(direction == 2)//NORTH PLACE - { - return ForgeDirection.EAST; - } - if(direction == 3)//EAST PLACE - { - return ForgeDirection.SOUTH; - } - return ForgeDirection.UNKNOWN; - } - - /** - * Gets the direction the right is facing - */ - public ForgeDirection getRight() - { - int direction = getDirection(); - if(direction == 0)//SOUTH PLACE - { - return ForgeDirection.EAST; - } - if(direction == 1)//WEST PLACE - { - return ForgeDirection.SOUTH; - } - if(direction == 2)//NORTH PLACE - { - return ForgeDirection.WEST; - } - if(direction == 3)//EAST PLACE - { - return ForgeDirection.NORTH; - } - return ForgeDirection.UNKNOWN; - } - - private int getDirection() - { - if(worldObj != null) - { - return worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - } - return 0; - } - public String getTexture() - { - if(isHeater()) - { - return "furnace_heater"; - } - return "furnace_rock"; - } - @Override - public String getInventoryName() { - // TODO Auto-generated method stub - return null; - } - @Override - public boolean hasCustomInventoryName() { - // TODO Auto-generated method stub - return false; - } - @Override - public void openInventory() { - // TODO Auto-generated method stub - - } - @Override - public void closeInventory() { - // TODO Auto-generated method stub - - } + + /** + * Heater:0||Stone :1; + */ + public int getType() { + return isHeater() ? 0 : 1; + } + + private int getOnMetadata() { + return getType() * 2 + 1; + } + + private int getOffMetadata() { + return getType() * 2; + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) { + if (isHeater()) { + return new int[]{0}; + } + return new int[]{0, 1, 2, 3, 4, 5, 6, 7}; + } + + @Override + public boolean canInsertItem(int slot, ItemStack item, int side) { + if (isHeater()) { + return slot == 0 && isItemFuel(item); + } + return slot < 4 && getResult(item) != null; + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + return canInsertItem(slot, item, 0); + } + + public boolean isItemFuel(ItemStack item) { + return this.getItemBurnTime(item) > 0; + } + + @Override + public boolean canExtractItem(int slot, ItemStack item, int side) { + if (!isHeater()) { + return slot >= 4; + } + return item.getItem() == Items.bucket; + } + + public int getCookProgressScaled(int i) { + return (progress * i) / getMaxTime(); + } + + public boolean isBlockValidForSide(int x, int y, int z) { + if (worldObj == null) { + return false; + } + + Block block = worldObj.getBlock(x, y, z); + + if (block == null) { + return false; + } + + if (block == worldObj.getBlock(xCoord, yCoord, zCoord)) { + return true; + } + return block == BlockListMF.firebricks; + } + + /** + * Checks a valid block for sides. It must be the required block. + *

+ * HEATER: Requires any stone block for bronze, stone above hardness 2.0(like + * slate)for iron, and stone above hardness above 5.0(like granite) for steel + *

+ * FURNACES require metal blocks of their material + */ + public boolean isBlockValidForTop(int x, int y, int z) { + if (worldObj == null) { + return false; + } + Block block = worldObj.getBlock(x, y, z); + + if (block == null) { + return false; + } + return block == BlockListMF.firebricks; + } + + public boolean isBlockValidForSide(ForgeDirection side) { + if (worldObj == null) { + return false; + } + + int x = xCoord + side.offsetX; + int y = yCoord + side.offsetY; + int z = zCoord + side.offsetZ; + + return isBlockValidForSide(x, y, z); + } + + public boolean isSolid(ForgeDirection side) { + if (worldObj == null) { + return false; + } + + int x = xCoord + side.offsetX; + int y = yCoord + side.offsetY; + int z = zCoord + side.offsetZ; + + Material mat = worldObj.getBlock(x, y, z).getMaterial(); + + return mat.isSolid(); + } + + /** + * Determines if the furnace is built properly HEATER must have sides blocked by + * stone FURNACES must have walls built to specifications + */ + private boolean structureExists() { + if (worldObj == null) { + return false; + } + + if (isSolid(getFront())) { + return false; + } + + if (!isHeater() && !isBlockValidForTop(xCoord, yCoord + 1, zCoord)) { + return false; + } + + if (!isBlockValidForSide(getLeft())) { + return false; + } + if (!isBlockValidForSide(getRight())) { + return false; + } + if (!isBlockValidForSide(getBack())) { + return false; + } + + return true; + } + + /** + * Gets the direction the face is at(Opposite to the placer) + */ + public ForgeDirection getFront() { + int direction = getDirection(); + if (direction == 0)// SOUTH PLACE + { + return ForgeDirection.NORTH; + } + if (direction == 1)// WEST PLACE + { + return ForgeDirection.EAST; + } + if (direction == 2)// NORTH PLACE + { + return ForgeDirection.SOUTH; + } + if (direction == 3)// EAST PLACE + { + return ForgeDirection.WEST; + } + return ForgeDirection.UNKNOWN; + } + + /** + * Gets the direction the back is facing (Same dir as placer) + */ + public ForgeDirection getBack() { + int direction = getDirection(); + if (direction == 0)// SOUTH PLACE + { + return ForgeDirection.SOUTH; + } + if (direction == 1)// WEST PLACE + { + return ForgeDirection.WEST; + } + if (direction == 2)// NORTH PLACE + { + return ForgeDirection.NORTH; + } + if (direction == 3)// EAST PLACE + { + return ForgeDirection.EAST; + } + return ForgeDirection.UNKNOWN; + } + + /** + * Gets the direction the left is facing + */ + public ForgeDirection getLeft() { + int direction = getDirection(); + if (direction == 0)// SOUTH PLACE + { + return ForgeDirection.WEST; + } + if (direction == 1)// WEST PLACE + { + return ForgeDirection.NORTH; + } + if (direction == 2)// NORTH PLACE + { + return ForgeDirection.EAST; + } + if (direction == 3)// EAST PLACE + { + return ForgeDirection.SOUTH; + } + return ForgeDirection.UNKNOWN; + } + + /** + * Gets the direction the right is facing + */ + public ForgeDirection getRight() { + int direction = getDirection(); + if (direction == 0)// SOUTH PLACE + { + return ForgeDirection.EAST; + } + if (direction == 1)// WEST PLACE + { + return ForgeDirection.SOUTH; + } + if (direction == 2)// NORTH PLACE + { + return ForgeDirection.WEST; + } + if (direction == 3)// EAST PLACE + { + return ForgeDirection.NORTH; + } + return ForgeDirection.UNKNOWN; + } + + private int getDirection() { + if (worldObj != null) { + return worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + } + return 0; + } + + public String getTexture() { + if (isHeater()) { + return "furnace_heater"; + } + return "furnace_rock"; + } + + @Override + public String getInventoryName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean hasCustomInventoryName() { + // TODO Auto-generated method stub + return false; + } + + @Override + public void openInventory() { + // TODO Auto-generated method stub + + } + + @Override + public void closeInventory() { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBloomery.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBloomery.java index ce147d46..9302acf3 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBloomery.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBloomery.java @@ -1,8 +1,7 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.crafting.MineFantasyFuels; import minefantasy.mf2.api.crafting.refine.BloomRecipe; import minefantasy.mf2.api.helpers.ToolHelper; @@ -13,6 +12,7 @@ import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFC; import minefantasy.mf2.item.heatable.ItemHeated; import minefantasy.mf2.knowledge.KnowledgeListMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.BloomeryPacket; import minefantasy.mf2.util.MFLogUtil; import net.minecraft.entity.item.EntityItem; @@ -20,328 +20,286 @@ import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class TileEntityBloomery extends TileEntity implements IInventory -{ - private ItemStack[] inv = new ItemStack[3]; - public float progress, progressMax; - public boolean hasBloom, isActive; - - public ItemStack getResult() - { - ItemStack input = inv[0]; - ItemStack coal = inv[1]; - - if(hasBloom())return null;//Cannot smelt if a bloom exists - if(input == null || coal == null)return null;//Needs input - - if(!hasEnoughCarbon(input, coal)) - { - return null; - } - - return getResult(input); - } - private boolean hasEnoughCarbon(ItemStack input, ItemStack coal) - { - int amount = input.stackSize; - int uses = MineFantasyFuels.getCarbon(coal); - if(uses > 0) - { - int coalNeeded = (int)Math.ceil((float)amount / (float) uses); - MFLogUtil.logDebug("Required Coal: " + coalNeeded); - return coal.stackSize == coalNeeded; - } - return false; - } - private Random rand = new Random(); - @Override - public void updateEntity() - { - ++ticksExisted; - if(isActive && progressMax > 0) - { - if(!worldObj.canBlockSeeTheSky(xCoord, yCoord+1, zCoord)) - { - progressMax = progress = 0; - isActive = false; - return; - } - if(!worldObj.isRemote) - { - ++progress; - if(progress >= progressMax) - { - smeltItem(); - } - if(rand.nextInt(4) == 0) - { - SmokeMechanics.spawnSmoke(worldObj, xCoord, yCoord, zCoord, 1); - } - } - } - if(!worldObj.isRemote && ticksExisted % 20 == 0) - { - syncData(); - } - } - - public void syncData() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { - EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new BloomeryPacket(this).generatePacket()); - } - } - - private int ticksExisted; - /** - * Light the bloomery, starting the process. - * @return true if it can smelt - */ - public boolean light(EntityPlayer user) - { - ItemStack res = getResult(); - if(worldObj.canBlockSeeTheSky(xCoord, yCoord+1, zCoord) && res != null && !isActive) - { - if(!worldObj.isRemote) - { - if(res.getItem() == Items.iron_ingot && !ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.smeltIron)) - { - return false; - } - isActive = true; - progressMax = inv[0].stackSize * getTime(inv[0]);//15s per item - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "fire.ignite", 1.0F, 1.0F); - } - - return true; - } - return false; - } - private int getTime(ItemStack itemStack) - { - return 300; - } - - /** - * Consumes ALL input and sets output - */ - public void smeltItem() - { - ItemStack result = getResult(); - if(result != null) - { - ItemStack res2 = result.copy(); - res2.stackSize = inv[0].stackSize; - inv[0] = inv[1] = null; - inv[2] = res2; - } - isActive = false; - progress = progressMax = 0; - } - - public boolean tryHammer(EntityPlayer user) - { - if(worldObj.getBlock(xCoord, yCoord+1, zCoord).getMaterial().isSolid()) - { - return false; - } - ItemStack held = user.getHeldItem(); - if(!hasBloom() || isActive) - { - return false; - } - String toolType = ToolHelper.getCrafterTool(held); - float pwr = ToolHelper.getCrafterEfficiency(held); - if(toolType.equalsIgnoreCase("hammer") || toolType.equalsIgnoreCase("hvyHammer")) - { - if(user.worldObj.isRemote)return true; - - held.damageItem(1, user); - if(held.getItemDamage() >= held.getMaxDamage()) - { - user.destroyCurrentEquippedItem(); - user.setCurrentItemOrArmor(0, null); - } - - if(rand.nextFloat()*10F < pwr) - { - ItemStack drop = inv[2].copy(); - --inv[2].stackSize; - if(inv[2].stackSize <= 0) - { - inv[2] = null; - } - if(RPGElements.isSystemActive && RPGElements.getLevel(user, SkillList.artisanry) <= 20)//Only gain xp up to level 20 - { - SkillList.artisanry.addXP(user, 1); - } - drop.stackSize = 1; - drop = ItemHeated.createHotItem(drop, 1200); - entityDropItem(worldObj, xCoord, yCoord, zCoord, drop); - syncData(); - } - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "minefantasy2:block.anvilsucceed", 0.25F, 1.0F); - - return true; - } - return false; - } - public EntityItem entityDropItem(World world, int x, int y, int z, ItemStack item) - { - if (item.stackSize != 0 && item.getItem() != null) - { - EntityItem entityitem = new EntityItem(world, x+0.5D, y+1.25F, z+0.5D, item); +import java.util.Random; + +public class TileEntityBloomery extends TileEntity implements IInventory { + public float progress, progressMax; + public boolean hasBloom, isActive; + private ItemStack[] inv = new ItemStack[3]; + private Random rand = new Random(); + private int ticksExisted; + + public static boolean isInput(ItemStack input) { + return getResult(input) != null; + } + + private static ItemStack getResult(ItemStack input) { + return BloomRecipe.getSmeltingResult(input); + } + + public ItemStack getResult() { + ItemStack input = inv[0]; + ItemStack coal = inv[1]; + + if (hasBloom()) + return null;// Cannot smelt if a bloom exists + if (input == null || coal == null) + return null;// Needs input + + if (!hasEnoughCarbon(input, coal)) { + return null; + } + + return getResult(input); + } + + private boolean hasEnoughCarbon(ItemStack input, ItemStack coal) { + int amount = input.stackSize; + int uses = MineFantasyFuels.getCarbon(coal); + if (uses > 0) { + int coalNeeded = (int) Math.ceil((float) amount / (float) uses); + MFLogUtil.logDebug("Required Coal: " + coalNeeded); + return coal.stackSize == coalNeeded; + } + return false; + } + + @Override + public void updateEntity() { + ++ticksExisted; + if (isActive && progressMax > 0) { + if (!worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord)) { + progressMax = progress = 0; + isActive = false; + return; + } + if (!worldObj.isRemote) { + ++progress; + if (progress >= progressMax) { + smeltItem(); + } + if (rand.nextInt(4) == 0) { + SmokeMechanics.spawnSmoke(worldObj, xCoord, yCoord, zCoord, 1); + } + } + } + if (!worldObj.isRemote && ticksExisted % 20 == 0) { + syncData(); + } + } + + public void syncData() { + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new BloomeryPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + } + + /** + * Light the bloomery, starting the process. + * + * @return true if it can smelt + */ + public boolean light(EntityPlayer user) { + ItemStack res = getResult(); + if (worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && res != null && !isActive) { + if (!worldObj.isRemote) { + if (res.getItem() == Items.iron_ingot + && !ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.smeltIron)) { + return false; + } + isActive = true; + progressMax = inv[0].stackSize * getTime(inv[0]);// 15s per item + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "fire.ignite", 1.0F, 1.0F); + } + + return true; + } + return false; + } + + private int getTime(ItemStack itemStack) { + return 300; + } + + /** + * Consumes ALL input and sets output + */ + public void smeltItem() { + ItemStack result = getResult(); + if (result != null) { + ItemStack res2 = result.copy(); + res2.stackSize = inv[0].stackSize; + inv[0] = inv[1] = null; + inv[2] = res2; + } + isActive = false; + progress = progressMax = 0; + } + + public boolean tryHammer(EntityPlayer user) { + if (worldObj.getBlock(xCoord, yCoord + 1, zCoord).getMaterial().isSolid()) { + return false; + } + ItemStack held = user.getHeldItem(); + if (!hasBloom() || isActive) { + return false; + } + String toolType = ToolHelper.getCrafterTool(held); + float pwr = ToolHelper.getCrafterEfficiency(held); + if (toolType.equalsIgnoreCase("hammer") || toolType.equalsIgnoreCase("hvyHammer")) { + if (user.worldObj.isRemote) + return true; + + held.damageItem(1, user); + if (held.getItemDamage() >= held.getMaxDamage()) { + user.destroyCurrentEquippedItem(); + user.setCurrentItemOrArmor(0, null); + } + + if (rand.nextFloat() * 10F < pwr) { + ItemStack drop = inv[2].copy(); + --inv[2].stackSize; + if (inv[2].stackSize <= 0) { + inv[2] = null; + } + if (RPGElements.isSystemActive && RPGElements.getLevel(user, SkillList.artisanry) <= 20)// Only gain xp + // up to level + // 20 + { + SkillList.artisanry.addXP(user, 1); + } + drop.stackSize = 1; + drop = ItemHeated.createHotItem(drop, 1200); + entityDropItem(worldObj, xCoord, yCoord, zCoord, drop); + syncData(); + } + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "minefantasy2:block.anvilsucceed", + 0.25F, 1.0F); + + return true; + } + return false; + } + + public EntityItem entityDropItem(World world, int x, int y, int z, ItemStack item) { + if (item.stackSize != 0 && item.getItem() != null) { + EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.25F, z + 0.5D, item); entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); entityitem.motionX = entityitem.motionY = entityitem.motionZ = 0; return entityitem; - } - else - { + } else { return null; } } - - public boolean hasBloom() - { - if(worldObj.isRemote) - { - return hasBloom; - } - return inv[2] != null; - } - - @Override - public int getSizeInventory() - { - return inv.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return inv[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - if (this.inv[slot] != null) - { + + public boolean hasBloom() { + if (worldObj.isRemote) { + return hasBloom; + } + return inv[2] != null; + } + + @Override + public int getSizeInventory() { + return inv.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inv[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + if (this.inv[slot] != null) { ItemStack itemstack; - if (this.inv[slot].stackSize <= num) - { + if (this.inv[slot].stackSize <= num) { itemstack = this.inv[slot]; this.inv[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.inv[slot].splitStack(num); - if (this.inv[slot].stackSize == 0) - { + if (this.inv[slot].stackSize == 0) { this.inv[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return inv[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - inv[slot] = item; - } - - @Override - public String getInventoryName() - { - return "gui.carpentermf.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - if(item != null && TileEntityBlastFC.isCarbon(item)) - { - return slot == 1; - } - if(item != null && getResult(item) != null) - { - return slot == 0; - } - return false; - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - NBTTagList savedItems = nbt.getTagList("Items", 10); + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return inv[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + inv[slot] = item; + } + + @Override + public String getInventoryName() { + return "gui.carpentermf.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + if (item != null && TileEntityBlastFC.isCarbon(item)) { + return slot == 1; + } + if (item != null && getResult(item) != null) { + return slot == 0; + } + return false; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inv.length) - { + if (slotNum >= 0 && slotNum < this.inv.length) { this.inv[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } @@ -349,46 +307,33 @@ public void readFromNBT(NBTTagCompound nbt) progressMax = nbt.getFloat("ProgressMax"); hasBloom = nbt.getBoolean("hasBloom"); isActive = nbt.getBoolean("isActive"); -} - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.inv.length; ++i) - { - if (this.inv[i] != null) - { + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.inv.length; ++i) { + if (this.inv[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inv[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - + nbt.setFloat("Progress", progress); nbt.setFloat("ProgressMax", progressMax); nbt.setBoolean("hasBloom", hasBloom); nbt.setBoolean("isActive", isActive); - } - - public static boolean isInput(ItemStack input) - { - return getResult(input) != null; - } - - private static ItemStack getResult(ItemStack input) - { - return BloomRecipe.getSmeltingResult(input); - } - @SideOnly(Side.CLIENT) - public String getTextureName() - { - return "bloomery_basic"; - } + } + + @SideOnly(Side.CLIENT) + public String getTextureName() { + return "bloomery_basic"; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBombBench.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBombBench.java index b47143fd..0bbf4f9d 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBombBench.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBombBench.java @@ -1,18 +1,15 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import minefantasy.mf2.api.crafting.IBasicMetre; import minefantasy.mf2.api.crafting.engineer.IBombComponent; import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.knowledge.ResearchLogic; -import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.api.rpg.SkillList; import minefantasy.mf2.item.gadget.ItemBomb; import minefantasy.mf2.item.gadget.ItemExplodingArrow; import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.knowledge.KnowledgeListMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.BombBenchPacket; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -27,456 +24,373 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.WorldServer; -public class TileEntityBombBench extends TileEntity implements IInventory, ISidedInventory, IBasicMetre -{ - private ItemStack[] inv = new ItemStack[6]; - private Random rand = new Random(); - public float progress; - public float maxProgress = 25F; - - public boolean hasRecipe; - - private int ticksExisted; - @Override - public void updateEntity() - { - ++ticksExisted; - if(!worldObj.isRemote && (hasRecipe || ticksExisted % 100 == 0)) - { - syncData(); - } - } - public boolean tryCraft(EntityPlayer user, boolean pressUsed) - { - boolean sticky = !pressUsed && ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.stickybomb) && user.getHeldItem() != null && user.getHeldItem().getItem() == Items.slime_ball; - if(!worldObj.isRemote && sticky && applySlime()) - { - user.inventory.consumeInventoryItem(Items.slime_ball); - return true; - } - ItemStack result = findResult(); - hasRecipe = result != null; - - if(result == null) - { - progress = 0F; - } - else if((pressUsed || ToolHelper.getCrafterTool(user.getHeldItem()).equalsIgnoreCase("spanner"))) - { - if(!pressUsed && user.getHeldItem() != null) - { - worldObj.playSoundEffect(xCoord+0.5, yCoord, zCoord+0.5, "minefantasy2:block.twistbolt", 0.25F, 1.0F); - user.getHeldItem().damageItem(1, user); - if(user.getHeldItem().getItemDamage() >= user.getHeldItem().getMaxDamage()) - { - user.destroyCurrentEquippedItem(); - } - } - float efficiency = pressUsed ? maxProgress : ToolHelper.getCrafterEfficiency(user.getHeldItem()); - - if(!pressUsed && user.swingProgress > 0 && user.swingProgress <= 1.0) - { - efficiency *= (0.5F-user.swingProgress); - } - - if(!worldObj.isRemote) - { - progress += efficiency; - } - if((progress >= maxProgress && craftItem(result))) - { - worldObj.playSoundEffect(xCoord+0.5, yCoord, zCoord+0.5, "random.door_open", 0.35F, 0.5F); - progress = 0; - if(user != null) - { - SkillList.engineering.addXP(user, 2); - } - boolean isArrow = isMatch(0, "arrow") || isMatch(0, "bolt"); - for(int a = 0; a < 4; a++) - { - if(!(isArrow && a == 3)) - { - ItemStack item = getStackInSlot(a); - if(item != null && item.getItem().getContainerItem(item) != null) - { - //START CONTAINER CODE - ItemStack cont = item.getItem().getContainerItem(item); - ItemStack spare = getStackInSlot(5); - if(spare == null) - { - setInventorySlotContents(5, cont); - cont = null; - } - else if(spare.isItemEqual(cont)) - { - if(spare.stackSize + cont.stackSize <= spare.getMaxStackSize()) - { - spare.stackSize += cont.stackSize; - cont = null; - } - else - { - int room_left = spare.getMaxStackSize() - spare.stackSize; - spare.stackSize += room_left; - cont.stackSize -= room_left; - } - } - if(cont != null && !worldObj.isRemote) - { - EntityItem ei = new EntityItem(worldObj, xCoord+0.5, yCoord+0.5, zCoord+0.5, cont); - worldObj.spawnEntityInWorld(ei); - } - } - //END CONTAINER CODE - decrStackSize(a, 1); - } - } - } - return true; - } - return false; - } - private boolean applySlime() - { - ItemStack res = getStackInSlot(4); - - if(res != null && res.getItem() instanceof ItemBomb) - { - if(res.hasTagCompound() && !res.getTagCompound().hasKey("stickyBomb")) - { - res.getTagCompound().setBoolean("stickyBomb", true); - return true; - } - } - return false; - } - private boolean craftItem(ItemStack result) - { - if(inv[4] == null) - { - this.setInventorySlotContents(4, result); - return true; - } - else - { - if(areItemsEqual(result, inv[4]) && (inv[4].stackSize + result.stackSize) <= inv[4].getMaxStackSize()) - { - inv[4].stackSize++; - return true; - } - else - { - return false; - } - } - } - public void syncData() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { +import java.util.Random; + +public class TileEntityBombBench extends TileEntity implements IInventory, ISidedInventory, IBasicMetre { + public float progress; + public float maxProgress = 25F; + public boolean hasRecipe; + private ItemStack[] inv = new ItemStack[6]; + private Random rand = new Random(); + private int ticksExisted; + + public static boolean isMatch(ItemStack item, String type) { + String component = getComponentType(item); + return component != null && component.equalsIgnoreCase(type); + } + + public static String getComponentType(ItemStack item) { + if (item != null && item.getItem() != null && item.getItem() instanceof IBombComponent) { + return ((IBombComponent) item.getItem()).getComponentType(); + } + return null; + } + + public static byte getComponentTier(ItemStack item) { + if (item != null && item.getItem() != null && item.getItem() instanceof IBombComponent) { + return ((IBombComponent) item.getItem()).getTier(); + } + return (byte) 0; + } + + @Override + public void updateEntity() { + ++ticksExisted; + if (!worldObj.isRemote && (hasRecipe || ticksExisted % 100 == 0)) { + syncData(); + } + } + + public boolean tryCraft(EntityPlayer user, boolean pressUsed) { + boolean sticky = !pressUsed && ResearchLogic.hasInfoUnlocked(user, KnowledgeListMF.stickybomb) + && user.getHeldItem() != null && user.getHeldItem().getItem() == Items.slime_ball; + if (!worldObj.isRemote && sticky && applySlime()) { + user.inventory.consumeInventoryItem(Items.slime_ball); + return true; + } + ItemStack result = findResult(); + hasRecipe = result != null; + + if (result == null) { + progress = 0F; + } else if ((pressUsed || ToolHelper.getCrafterTool(user.getHeldItem()).equalsIgnoreCase("spanner"))) { + if (!pressUsed && user.getHeldItem() != null) { + worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "minefantasy2:block.twistbolt", 0.25F, + 1.0F); + user.getHeldItem().damageItem(1, user); + if (user.getHeldItem().getItemDamage() >= user.getHeldItem().getMaxDamage()) { + user.destroyCurrentEquippedItem(); + } + } + float efficiency = pressUsed ? maxProgress : ToolHelper.getCrafterEfficiency(user.getHeldItem()); + + if (!pressUsed && user.swingProgress > 0 && user.swingProgress <= 1.0) { + efficiency *= (0.5F - user.swingProgress); + } + + if (!worldObj.isRemote) { + progress += efficiency; + } + if ((progress >= maxProgress && craftItem(result))) { + worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "random.door_open", 0.35F, 0.5F); + progress = 0; + if (user != null) { + SkillList.engineering.addXP(user, 2); + } + boolean isArrow = isMatch(0, "arrow") || isMatch(0, "bolt"); + for (int a = 0; a < 4; a++) { + if (!(isArrow && a == 3)) { + ItemStack item = getStackInSlot(a); + if (item != null && item.getItem().getContainerItem(item) != null) { + // START CONTAINER CODE + ItemStack cont = item.getItem().getContainerItem(item); + ItemStack spare = getStackInSlot(5); + if (spare == null) { + setInventorySlotContents(5, cont); + cont = null; + } else if (spare.isItemEqual(cont)) { + if (spare.stackSize + cont.stackSize <= spare.getMaxStackSize()) { + spare.stackSize += cont.stackSize; + cont = null; + } else { + int room_left = spare.getMaxStackSize() - spare.stackSize; + spare.stackSize += room_left; + cont.stackSize -= room_left; + } + } + if (cont != null && !worldObj.isRemote) { + EntityItem ei = new EntityItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, + cont); + worldObj.spawnEntityInWorld(ei); + } + } + // END CONTAINER CODE + decrStackSize(a, 1); + } + } + } + return true; + } + return false; + } + + private boolean applySlime() { + ItemStack res = getStackInSlot(4); + + if (res != null && res.getItem() instanceof ItemBomb) { + if (res.hasTagCompound() && !res.getTagCompound().hasKey("stickyBomb")) { + res.getTagCompound().setBoolean("stickyBomb", true); + return true; + } + } + return false; + } + + private boolean craftItem(ItemStack result) { + if (inv[4] == null) { + this.setInventorySlotContents(4, result); + return true; + } else { + if (areItemsEqual(result, inv[4]) && (inv[4].stackSize + result.stackSize) <= inv[4].getMaxStackSize()) { + inv[4].stackSize++; + return true; + } else { + return false; + } + } + } + + public void syncData() { + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new BombBenchPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + + /* + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new BombBenchPacket(this).generatePacket()); - } - } - - private boolean areItemsEqual(ItemStack bomb1, ItemStack bomb2) - { - if(ItemBomb.getCasing(bomb1) != ItemBomb.getCasing(bomb2)) - { - return false; - } - if(ItemBomb.getPowder(bomb1) != ItemBomb.getPowder(bomb2)) - { - return false; - } - if(ItemBomb.getFilling(bomb1) != ItemBomb.getFilling(bomb2)) - { - return false; - } - if(ItemBomb.getFuse(bomb1) != ItemBomb.getFuse(bomb2)) - { - return false; - } - return bomb1.isItemEqual(bomb2); - } - public void onInventoryChanged() - { - } - - private ItemStack findResult() - { - boolean isArrow = isMatch(0, "arrow") || isMatch(0, "bolt"); - if(!isMatch(1, "powder") || (!isArrow && !isMatch(3, "fuse"))) - { - return null; - } - byte caseTier = -1; - byte filling = 0; - byte fuse = -1; - byte powder = -1; - Item design = null; - String com0 = getComponentType(inv[0]); - String com1 = getComponentType(inv[1]); - String com2 = getComponentType(inv[2]); - String com3 = getComponentType(inv[3]); - if(com0 != null) - { - caseTier = getComponentTier(inv[0]); - String type = com0; - design = getDesignCrafted(type); - } - if(com1 != null) - { - if(com1.equalsIgnoreCase("powder")) - { - powder = getComponentTier(inv[1]); - } - else - { - return null; - } - } - else return null; - if(com2 != null) - { - if(com2.equalsIgnoreCase("filling")) - { - filling = getComponentTier(inv[2]); - } - else - { - return null; - } + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, + new BombBenchPacket(this).generatePacket()); } - if(isArrow || com3 != null) - { - if(!isArrow) - { - if(com3.equalsIgnoreCase("fuse")) - { - fuse = getComponentTier(inv[3]); - } - else - { - return null; - } - } - } - else return null; - - if(design != null && isArrow && powder > -1) - { - return ItemExplodingArrow.createBombArrow(design, powder, filling); - } - else if(design != null && fuse > -1 && powder > -1) - { - return ItemBomb.createExplosive(design, caseTier, filling, fuse, powder, 1, false); - } - return null; - } - - private Item getDesignCrafted(String type) - { - if(type.equalsIgnoreCase("bombcase")) - { - return ToolListMF.bomb_custom; - } - if(type.equalsIgnoreCase("minecase")) - { - return ToolListMF.mine_custom; - } - if(type.equalsIgnoreCase("arrow")) - { - return ToolListMF.exploding_arrow; - } - if(type.equalsIgnoreCase("bolt")) - { - return ToolListMF.exploding_bolt; - } - return null; - } - private boolean isMatch(int slot, String type) - { - return isMatch(inv[slot], type); - } - public static boolean isMatch(ItemStack item, String type) - { - String component = getComponentType(item); - return component != null && component.equalsIgnoreCase(type); - } - public static String getComponentType(ItemStack item) - { - if(item != null && item.getItem() != null && item.getItem() instanceof IBombComponent) - { - return ((IBombComponent)item.getItem()).getComponentType(); - } - return null; - } - public static byte getComponentTier(ItemStack item) - { - if(item != null && item.getItem() != null && item.getItem() instanceof IBombComponent) - { - return ((IBombComponent)item.getItem()).getTier(); - } - return (byte)0; - } - - - //INVENORY - - @Override - public int getSizeInventory() - { - return inv.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return inv[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - onInventoryChanged(); - if (this.inv[slot] != null) - { + */ + } + + private boolean areItemsEqual(ItemStack bomb1, ItemStack bomb2) { + if (ItemBomb.getCasing(bomb1) != ItemBomb.getCasing(bomb2)) { + return false; + } + if (ItemBomb.getPowder(bomb1) != ItemBomb.getPowder(bomb2)) { + return false; + } + if (ItemBomb.getFilling(bomb1) != ItemBomb.getFilling(bomb2)) { + return false; + } + if (ItemBomb.getFuse(bomb1) != ItemBomb.getFuse(bomb2)) { + return false; + } + return bomb1.isItemEqual(bomb2); + } + + public void onInventoryChanged() { + } + + private ItemStack findResult() { + boolean isArrow = isMatch(0, "arrow") || isMatch(0, "bolt"); + if (!isMatch(1, "powder") || (!isArrow && !isMatch(3, "fuse"))) { + return null; + } + byte caseTier = -1; + byte filling = 0; + byte fuse = -1; + byte powder = -1; + Item design = null; + String com0 = getComponentType(inv[0]); + String com1 = getComponentType(inv[1]); + String com2 = getComponentType(inv[2]); + String com3 = getComponentType(inv[3]); + if (com0 != null) { + caseTier = getComponentTier(inv[0]); + String type = com0; + design = getDesignCrafted(type); + } + if (com1 != null) { + if (com1.equalsIgnoreCase("powder")) { + powder = getComponentTier(inv[1]); + } else { + return null; + } + } else + return null; + if (com2 != null) { + if (com2.equalsIgnoreCase("filling")) { + filling = getComponentTier(inv[2]); + } else { + return null; + } + } + if (isArrow || com3 != null) { + if (!isArrow) { + if (com3.equalsIgnoreCase("fuse")) { + fuse = getComponentTier(inv[3]); + } else { + return null; + } + } + } else + return null; + + if (design != null && isArrow && powder > -1) { + return ItemExplodingArrow.createBombArrow(design, powder, filling); + } else if (design != null && fuse > -1 && powder > -1) { + return ItemBomb.createExplosive(design, caseTier, filling, fuse, powder, 1, false); + } + return null; + } + + private Item getDesignCrafted(String type) { + if (type.equalsIgnoreCase("bombcase")) { + return ToolListMF.bomb_custom; + } + if (type.equalsIgnoreCase("minecase")) { + return ToolListMF.mine_custom; + } + if (type.equalsIgnoreCase("arrow")) { + return ToolListMF.exploding_arrow; + } + if (type.equalsIgnoreCase("bolt")) { + return ToolListMF.exploding_bolt; + } + return null; + } + + private boolean isMatch(int slot, String type) { + return isMatch(inv[slot], type); + } + + // INVENORY + + @Override + public int getSizeInventory() { + return inv.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inv[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + onInventoryChanged(); + if (this.inv[slot] != null) { ItemStack itemstack; - if (this.inv[slot].stackSize <= num) - { + if (this.inv[slot].stackSize <= num) { itemstack = this.inv[slot]; this.inv[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.inv[slot].splitStack(num); - if (this.inv[slot].stackSize == 0) - { + if (this.inv[slot].stackSize == 0) { this.inv[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return inv[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - onInventoryChanged(); - inv[slot] = item; - } - - @Override - public String getInventoryName() - { - return "gui.bombcraftmf.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - if(this.isMatch(item, "bolt") || this.isMatch(item, "arrow") || this.isMatch(item, "bombcase") || this.isMatch(item, "minecase")) - { - return slot == 0; - } - if(this.isMatch(item, "powder")) - { - return slot == 1; - } - if(this.isMatch(item, "filling")) - { - return slot == 2; - } - if(this.isMatch(item, "fuse")) - { - return slot == 3; - } - return false; - } - - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - NBTTagList savedItems = nbt.getTagList("Items", 10); + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return inv[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + onInventoryChanged(); + inv[slot] = item; + } + + @Override + public String getInventoryName() { + return "gui.bombcraftmf.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + if (this.isMatch(item, "bolt") || this.isMatch(item, "arrow") || this.isMatch(item, "bombcase") + || this.isMatch(item, "minecase")) { + return slot == 0; + } + if (this.isMatch(item, "powder")) { + return slot == 1; + } + if (this.isMatch(item, "filling")) { + return slot == 2; + } + if (this.isMatch(item, "fuse")) { + return slot == 3; + } + return false; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inv.length) - { + if (slotNum >= 0 && slotNum < this.inv.length) { this.inv[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } progress = nbt.getFloat("progress"); maxProgress = nbt.getFloat("maxProgress"); hasRecipe = nbt.getBoolean("hasRecipe"); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.inv.length; ++i) - { - if (this.inv[i] != null) - { + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.inv.length; ++i) { + if (this.inv[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inv[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } @@ -486,35 +400,35 @@ public void writeToNBT(NBTTagCompound nbt) nbt.setFloat("progress", progress); nbt.setFloat("maxProgress", maxProgress); nbt.setBoolean("hasRecipe", hasRecipe); - } - @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return new int[]{0, 1, 2, 3, 4}; - } - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) - { - return this.isItemValidForSlot(slot, item); - } - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) - { - return slot == 4; - } - @Override - public int getMetreScale(int size) - { - return (int)Math.min(size, (float)size / maxProgress * progress); - } - @Override - public boolean shouldShowMetre() - { - return true; - } - @Override - public String getLocalisedName() - { - return StatCollector.translateToLocal("tile.bombBench.name"); - } + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) { + return new int[]{0, 1, 2, 3, 4}; + } + + @Override + public boolean canInsertItem(int slot, ItemStack item, int side) { + return this.isItemValidForSlot(slot, item); + } + + @Override + public boolean canExtractItem(int slot, ItemStack item, int side) { + return slot == 4; + } + + @Override + public int getMetreScale(int size) { + return (int) Math.min(size, size / maxProgress * progress); + } + + @Override + public boolean shouldShowMetre() { + return true; + } + + @Override + public String getLocalisedName() { + return StatCollector.translateToLocal("tile.bombBench.name"); + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBombPress.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBombPress.java index bcdb6df4..e5242164 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBombPress.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityBombPress.java @@ -1,43 +1,32 @@ package minefantasy.mf2.block.tileentity; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -public class TileEntityBombPress extends TileEntity -{ - public float animation = 0F; - - @Override - public void updateEntity() - { - super.updateEntity(); - if(worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) - { - if(animation <= 0) - { - use(null); - } - animation = 1.0F; - } - else - { - if(animation > 0) - { - animation -= 0.05F; - } - } - } - - public void use(EntityPlayer user) - { - TileEntity under = worldObj.getTileEntity(xCoord, yCoord-1, zCoord); - if(animation <= 0 && under != null && under instanceof TileEntityBombBench) - { - ((TileEntityBombBench)under).tryCraft(user, true); - animation = 1.0F; - worldObj.playSoundEffect(xCoord+0.5, yCoord+0.5, zCoord+0.5, "tile.piston.out", 1.0F, 0.75F); - } - } +public class TileEntityBombPress extends TileEntity { + public float animation = 0F; + + @Override + public void updateEntity() { + super.updateEntity(); + if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { + if (animation <= 0) { + use(null); + } + animation = 1.0F; + } else { + if (animation > 0) { + animation -= 0.05F; + } + } + } + + public void use(EntityPlayer user) { + TileEntity under = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + if (animation <= 0 && under != null && under instanceof TileEntityBombBench) { + ((TileEntityBombBench) under).tryCraft(user, true); + animation = 1.0F; + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "tile.piston.out", 1.0F, 0.75F); + } + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCarpenterMF.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCarpenterMF.java index 82a2d22a..dabf1ea5 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCarpenterMF.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCarpenterMF.java @@ -1,8 +1,5 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import minefantasy.mf2.api.crafting.carpenter.CarpenterCraftMatrix; import minefantasy.mf2.api.crafting.carpenter.CraftingManagerCarpenter; import minefantasy.mf2.api.crafting.carpenter.ICarpenter; @@ -12,12 +9,12 @@ import minefantasy.mf2.api.rpg.Skill; import minefantasy.mf2.container.ContainerCarpenterMF; import minefantasy.mf2.item.armour.ItemArmourMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.CarpenterPacket; import minefantasy.mf2.util.MFLogUtil; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -25,50 +22,53 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.WorldServer; -public class TileEntityCarpenterMF extends TileEntity implements IInventory, ICarpenter -{ - private int tier; - private ItemStack[] inventory; - private Random rand = new Random(); - private int ticksExisted; - private ContainerCarpenterMF syncCarpenter; - private CarpenterCraftMatrix craftMatrix; - private String lastPlayerHit = ""; - private String toolTypeRequired = "hands"; - private String craftSound = "step.wood"; - private String researchRequired = ""; - private Skill skillUsed; - private boolean resetRecipe = false; - - public final int width = 4; - public final int height = 4; - public TileEntityCarpenterMF() - { - this(0); - } - public TileEntityCarpenterMF(int tier) - { - inventory = new ItemStack[width*height+5]; - this.tier=tier; - setContainer(new ContainerCarpenterMF(this)); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - tier = nbt.getInteger("tier"); - - NBTTagList savedItems = nbt.getTagList("Items", 10); +import java.util.Random; + +public class TileEntityCarpenterMF extends TileEntity implements IInventory, ICarpenter { + public final int width = 4; + public final int height = 4; + public String resName = ""; + public float progressMax; + public float progress; + private int tier; + private ItemStack[] inventory; + private Random rand = new Random(); + private int ticksExisted; + private ContainerCarpenterMF syncCarpenter; + private CarpenterCraftMatrix craftMatrix; + private String lastPlayerHit = ""; + private String toolTypeRequired = "hands"; + private String craftSound = "step.wood"; + private String researchRequired = ""; + private Skill skillUsed; + private boolean resetRecipe = false; + private ItemStack recipe; + private int hammerTierRequired; + private int CarpenterTierRequired; + + public TileEntityCarpenterMF() { + this(0); + } + + public TileEntityCarpenterMF(int tier) { + inventory = new ItemStack[width * height + 5]; + this.tier = tier; + setContainer(new ContainerCarpenterMF(this)); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + tier = nbt.getInteger("tier"); + + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inventory.length) - { + if (slotNum >= 0 && slotNum < this.inventory.length) { this.inventory[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } @@ -78,579 +78,494 @@ public void readFromNBT(NBTTagCompound nbt) toolTypeRequired = nbt.getString("toolTypeRequired"); craftSound = nbt.getString("craftSound"); researchRequired = nbt.getString("researchRequired"); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setInteger("tier", tier); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.inventory.length; ++i) - { - if (this.inventory[i] != null) - { + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("tier", tier); + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.inventory.length; ++i) { + if (this.inventory[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inventory[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - + nbt.setFloat("Progress", progress); nbt.setFloat("ProgressMax", progressMax); nbt.setString("ResName", resName); nbt.setString("toolTypeRequired", toolTypeRequired); nbt.setString("craftSound", craftSound); nbt.setString("researchRequired", researchRequired); - } - - @Override - public int getSizeInventory() - { - return inventory.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return inventory[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - onInventoryChanged(); - if (this.inventory[slot] != null) - { + } + + @Override + public int getSizeInventory() { + return inventory.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inventory[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + onInventoryChanged(); + if (this.inventory[slot] != null) { ItemStack itemstack; - if (this.inventory[slot].stackSize <= num) - { + if (this.inventory[slot].stackSize <= num) { itemstack = this.inventory[slot]; this.inventory[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.inventory[slot].splitStack(num); - if (this.inventory[slot].stackSize == 0) - { + if (this.inventory[slot].stackSize == 0) { this.inventory[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return inventory[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - onInventoryChanged(); - inventory[slot] = item; - } - - @Override - public String getInventoryName() - { - return "gui.carpentermf.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - return true; - } - @Override - public void updateEntity() - { - ++ticksExisted; - super.updateEntity(); - if(!worldObj.isRemote) - { - if(ticksExisted % 20 == 0) - { - updateCraftingData(); - } - if(!canCraft() && ticksExisted > 1) - { - progress = progressMax = 0; - this.resName = ""; - this.recipe = null; - } - } - resetRecipe = false; - } - - public void onInventoryChanged() - { - if(!resetRecipe) - { - updateCraftingData(); - MFLogUtil.logDebug("Carpenter: Optimised Inv Tick"); - resetRecipe = true; - } - } - - public boolean tryCraft(EntityPlayer user) - { - if(user == null)return false; - - String toolType = ToolHelper.getCrafterTool(user.getHeldItem()); - int hammerTier = ToolHelper.getCrafterTier(user.getHeldItem()); - if(!toolType.equalsIgnoreCase("nothing")) - { - if(user.getHeldItem() != null) - { - user.getHeldItem().damageItem(1, user); - if(user.getHeldItem().getItemDamage() >= user.getHeldItem().getMaxDamage()) - { - if(worldObj.isRemote) - user.renderBrokenItemStack(user.getHeldItem()); - - user.destroyCurrentEquippedItem(); - } - } - if(worldObj.isRemote) - return true; - - if(doesPlayerKnowCraft(user) && canCraft() && toolType.equalsIgnoreCase(toolTypeRequired) && tier >= CarpenterTierRequired && hammerTier >= hammerTierRequired) - { - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, getUseSound(), 1.0F, 1.0F); - float efficiency = ToolHelper.getCrafterEfficiency(user.getHeldItem()); - - if(user.swingProgress > 0 && user.swingProgress <= 1.0) - { - efficiency *= (0.5F-user.swingProgress); - } - - progress += Math.max(0.2F, efficiency); - if(progress >= progressMax) - { - craftItem(user); - } - } - else - { - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "step.stone", 1.25F, 1.5F); - } - lastPlayerHit = user.getCommandSenderName(); - updateCraftingData(); - return true; - } - updateCraftingData(); - return false; - } - - private String getUseSound() - { - if(craftSound.equalsIgnoreCase("engineering")) - { - if(rand.nextInt(5) == 0) - { - return "random.click"; - } - if(rand.nextInt(20) == 0) - { - return "random.door_open"; - } - return "step.wood"; - } - return craftSound; - } - private void craftItem(EntityPlayer user) - { - if (this.canCraft()) - { - addXP(user); - ItemStack result = recipe.copy(); - if(result != null && result.getItem() instanceof ItemArmourMF) - { - result = modifyArmour(result); - } - int output = getOutputSlotNum(); - - if (this.inventory[output] == null) - { - if(result.getMaxStackSize() == 1 && lastPlayerHit.length() > 0) - { - getNBT(result).setString("MF_CraftedByName", lastPlayerHit); - } - this.inventory[output] = result; + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return inventory[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + onInventoryChanged(); + inventory[slot] = item; + } + + @Override + public String getInventoryName() { + return "gui.carpentermf.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + return true; + } + + @Override + public void updateEntity() { + ++ticksExisted; + super.updateEntity(); + if (!worldObj.isRemote) { + if (ticksExisted % 20 == 0) { + updateCraftingData(); + } + if (!canCraft() && ticksExisted > 1) { + progress = progressMax = 0; + this.resName = ""; + this.recipe = null; } - else if (this.inventory[output].getItem() == result.getItem()) - { + } + resetRecipe = false; + } + + public void onInventoryChanged() { + if (!resetRecipe) { + updateCraftingData(); + MFLogUtil.logDebug("Carpenter: Optimised Inv Tick"); + resetRecipe = true; + } + } + + public boolean tryCraft(EntityPlayer user) { + if (user == null) + return false; + + String toolType = ToolHelper.getCrafterTool(user.getHeldItem()); + int hammerTier = ToolHelper.getCrafterTier(user.getHeldItem()); + if (!toolType.equalsIgnoreCase("nothing")) { + if (user.getHeldItem() != null) { + user.getHeldItem().damageItem(1, user); + if (user.getHeldItem().getItemDamage() >= user.getHeldItem().getMaxDamage()) { + if (worldObj.isRemote) + user.renderBrokenItemStack(user.getHeldItem()); + + user.destroyCurrentEquippedItem(); + } + } + if (worldObj.isRemote) + return true; + + if (doesPlayerKnowCraft(user) && canCraft() && toolType.equalsIgnoreCase(toolTypeRequired) + && tier >= CarpenterTierRequired && hammerTier >= hammerTierRequired) { + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, getUseSound(), 1.0F, 1.0F); + float efficiency = ToolHelper.getCrafterEfficiency(user.getHeldItem()); + + if (user.swingProgress > 0 && user.swingProgress <= 1.0) { + efficiency *= (0.5F - user.swingProgress); + } + + progress += Math.max(0.2F, efficiency); + if (progress >= progressMax) { + craftItem(user); + } + } else { + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "step.stone", 1.25F, 1.5F); + } + lastPlayerHit = user.getCommandSenderName(); + updateCraftingData(); + return true; + } + updateCraftingData(); + return false; + } + + private String getUseSound() { + if (craftSound.equalsIgnoreCase("engineering")) { + if (rand.nextInt(5) == 0) { + return "random.click"; + } + if (rand.nextInt(20) == 0) { + return "random.door_open"; + } + return "step.wood"; + } + return craftSound; + } + + private void craftItem(EntityPlayer user) { + if (this.canCraft()) { + addXP(user); + ItemStack result = recipe.copy(); + if (result != null && result.getItem() instanceof ItemArmourMF) { + result = modifyArmour(result); + } + int output = getOutputSlotNum(); + + if (this.inventory[output] == null) { + if (result.getMaxStackSize() == 1 && lastPlayerHit.length() > 0) { + getNBT(result).setString("MF_CraftedByName", lastPlayerHit); + } + this.inventory[output] = result; + } else if (this.inventory[output].getItem() == result.getItem()) { this.inventory[output].stackSize += result.stackSize; // Forge BugFix: Results may have multiple items } consumeResources(); } - onInventoryChanged(); - progress = 0; - } - private int getOutputSlotNum() - { - return getSizeInventory()-5; - } - private ItemStack modifyArmour(ItemStack result) - { - ItemArmourMF item = (ItemArmourMF)result.getItem(); - boolean canColour = item.canColour(); - int colour = -1; - for(int a = 0; a < getOutputSlotNum(); a++) - { - ItemStack slot = getStackInSlot(a); - if(slot != null && slot.getItem() instanceof ItemArmor) - { - ItemArmor slotitem = (ItemArmor)slot.getItem(); - if(canColour && slotitem.hasColor(slot)) - { - colour = slotitem.getColor(slot); - } - if(result.isItemStackDamageable()) - { - result.setItemDamage(slot.getItemDamage()); - } - } - } - if(colour != -1 && canColour) - { - item.func_82813_b(result, colour); - } - return result; - } - private NBTTagCompound getNBT(ItemStack item) - { - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - return item.getTagCompound(); - } - private void dropItem(ItemStack itemstack) - { - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + onInventoryChanged(); + progress = 0; + } + + private int getOutputSlotNum() { + return getSizeInventory() - 5; + } + + private ItemStack modifyArmour(ItemStack result) { + ItemArmourMF item = (ItemArmourMF) result.getItem(); + boolean canColour = item.canColour(); + int colour = -1; + for (int a = 0; a < getOutputSlotNum(); a++) { + ItemStack slot = getStackInSlot(a); + if (slot != null && slot.getItem() instanceof ItemArmor) { + ItemArmor slotitem = (ItemArmor) slot.getItem(); + if (canColour && slotitem.hasColor(slot)) { + colour = slotitem.getColor(slot); + } + if (result.isItemStackDamageable()) { + result.setItemDamage(slot.getItemDamage()); + } + } + } + if (colour != -1 && canColour) { + item.func_82813_b(result, colour); + } + return result; + } + + private NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + return item.getTagCompound(); + } + + private void dropItem(ItemStack itemstack) { + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(worldObj, xCoord + f, yCoord + f1, zCoord + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(worldObj, xCoord + f, yCoord + f1, zCoord + 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; worldObj.spawnEntityInWorld(entityitem); } } } - - public void syncData() - { - - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { + + public void syncData() { + + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new CarpenterPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + + /* + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new CarpenterPacket(this).generatePacket()); - } - } - public String resName = ""; - public String getResultName() - { - if(!worldObj.isRemote && recipe != null && recipe.getItem() != null && recipe.getDisplayName() != null) - { - resName = recipe.getDisplayName(); - } - return resName; - } - public String getToolNeeded() - { - return toolTypeRequired; - } - public String getCraftingSound() - { - return craftSound; - } - public int getToolTierNeeded() - { - return this.hammerTierRequired; - } - public int getCarpenterTierNeeded() - { - return this.CarpenterTierRequired; - } - public void consumeResources() - { - resetRecipe = true; - for(int slot = 0; slot < getOutputSlotNum(); slot++) - { - ItemStack item = getStackInSlot(slot); - if(item != null && item.getItem() != null && item.getItem().getContainerItem(item) != null) - { - if(item.stackSize == 1) - { - setInventorySlotContents(slot, item.getItem().getContainerItem(item)); - } - else - { - ItemStack drop = processSurplus(item.getItem().getContainerItem(item)); - if(drop != null) - { - this.dropItem(drop); - } - this.decrStackSize(slot, 1); - } - } - else - { - this.decrStackSize(slot, 1); - } - } - resetRecipe = false; - this.onInventoryChanged(); - } - private ItemStack processSurplus(ItemStack item) - { - for(int a = 0; a < 4; a++) - { - if(item == null) - { - return null;//If item was sorted - } - - int s = getSizeInventory()-4 + a; - ItemStack slot = inventory[s]; - if(slot == null) - { - setInventorySlotContents(s, item); - return null;//All Placed - } - else - { - if(slot.isItemEqual(item) && slot.stackSize < slot.getMaxStackSize()) - { - if(slot.stackSize + item.stackSize <= slot.getMaxStackSize()) - { - slot.stackSize += item.stackSize; - return null;//All Shared - } - else - { - int room_left = slot.getMaxStackSize() - slot.stackSize; - slot.stackSize += room_left; - item.stackSize -= room_left;//Share - } - } - } - } - return item; - } - private boolean canFitResult(ItemStack result) - { - ItemStack resSlot = inventory[getOutputSlotNum()]; - if(resSlot != null && result != null) - { - if(!resSlot.isItemEqual(result)) - { - return false; - } - if(resSlot.stackSize + result.stackSize > resSlot.getMaxStackSize()) - { - return false; - } + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, + new CarpenterPacket(this).generatePacket()); } - return true; - } - //CRAFTING CODE - public ItemStack getResult() - { - if(syncCarpenter == null || craftMatrix == null) - { - return null; - } - - if(ticksExisted <= 1) - return null; - - for(int a = 0 ; a < getOutputSlotNum() ; a ++) - { - craftMatrix.setInventorySlotContents(a, inventory[a]); - } - - return CraftingManagerCarpenter.getInstance().findMatchingRecipe(this, craftMatrix); - } - public void updateCraftingData() - { - if(!worldObj.isRemote) - { - ItemStack oldRecipe = recipe; - recipe = getResult(); - //syncItems(); - - if (!canCraft() && progress > 0) - { - progress = 0; - //quality = 100; + */ + } + + public String getResultName() { + if (!worldObj.isRemote && recipe != null && recipe.getItem() != null && recipe.getDisplayName() != null) { + resName = recipe.getDisplayName(); + } + return resName; + } + + public String getToolNeeded() { + return toolTypeRequired; + } + + public String getCraftingSound() { + return craftSound; + } + + @Override + public void setCraftingSound(String sound) { + this.craftSound = sound; + } + + public int getToolTierNeeded() { + return this.hammerTierRequired; + } + + public int getCarpenterTierNeeded() { + return this.CarpenterTierRequired; + } + + public void consumeResources() { + resetRecipe = true; + for (int slot = 0; slot < getOutputSlotNum(); slot++) { + ItemStack item = getStackInSlot(slot); + if (item != null && item.getItem() != null && item.getItem().getContainerItem(item) != null) { + if (item.stackSize == 1) { + setInventorySlotContents(slot, item.getItem().getContainerItem(item)); + } else { + ItemStack drop = processSurplus(item.getItem().getContainerItem(item)); + if (drop != null) { + this.dropItem(drop); + } + this.decrStackSize(slot, 1); + } + } else { + this.decrStackSize(slot, 1); } - if(recipe != null && oldRecipe != null && !recipe.isItemEqual(oldRecipe)) - { - progress = 0; - } - if(progress > progressMax)progress = progressMax-1; - syncData(); - } - } - public boolean canCraft() - { - if(worldObj.isRemote) - { - //return canCraft == 1; - } - if(progressMax > 0 && recipe != null && recipe instanceof ItemStack) - { - return this.canFitResult(recipe); + } + resetRecipe = false; + this.onInventoryChanged(); + } + + private ItemStack processSurplus(ItemStack item) { + for (int a = 0; a < 4; a++) { + if (item == null) { + return null;// If item was sorted + } + + int s = getSizeInventory() - 4 + a; + ItemStack slot = inventory[s]; + if (slot == null) { + setInventorySlotContents(s, item); + return null;// All Placed + } else { + if (slot.isItemEqual(item) && slot.stackSize < slot.getMaxStackSize()) { + if (slot.stackSize + item.stackSize <= slot.getMaxStackSize()) { + slot.stackSize += item.stackSize; + return null;// All Shared + } else { + int room_left = slot.getMaxStackSize() - slot.stackSize; + slot.stackSize += room_left; + item.stackSize -= room_left;// Share + } + } + } + } + return item; + } + + private boolean canFitResult(ItemStack result) { + ItemStack resSlot = inventory[getOutputSlotNum()]; + if (resSlot != null && result != null) { + if (!resSlot.isItemEqual(result)) { + return false; + } + if (resSlot.stackSize + result.stackSize > resSlot.getMaxStackSize()) { + return false; + } + } + return true; + } + + // CRAFTING CODE + public ItemStack getResult() { + if (syncCarpenter == null || craftMatrix == null) { + return null; + } + + if (ticksExisted <= 1) + return null; + + for (int a = 0; a < getOutputSlotNum(); a++) { + craftMatrix.setInventorySlotContents(a, inventory[a]); + } + + return CraftingManagerCarpenter.getInstance().findMatchingRecipe(this, craftMatrix); + } + + public void updateCraftingData() { + if (!worldObj.isRemote) { + ItemStack oldRecipe = recipe; + recipe = getResult(); + // syncItems(); + + if (!canCraft() && progress > 0) { + progress = 0; + // quality = 100; + } + if (recipe != null && oldRecipe != null && !recipe.isItemEqual(oldRecipe)) { + progress = 0; + } + if (progress > progressMax) + progress = progressMax - 1; + syncData(); + } + } + + public boolean canCraft() { + if (worldObj.isRemote) { + // return canCraft == 1; + } + if (progressMax > 0 && recipe != null && recipe instanceof ItemStack) { + return this.canFitResult(recipe); } return false; } - - private ItemStack recipe; - public float progressMax; - public float progress; - private int hammerTierRequired; - private int CarpenterTierRequired; - - @Override - public void setForgeTime(int i) - { - progressMax = i; - } - @Override - public void setToolTier(int i) - { - hammerTierRequired = i; - } - @Override - public void setRequiredCarpenter(int i) - { - CarpenterTierRequired = i; - } - @Override - public void setHotOutput(boolean i) - { - } - public void setContainer(ContainerCarpenterMF container) - { - syncCarpenter = container; - craftMatrix = new CarpenterCraftMatrix(this, syncCarpenter, ShapelessCarpenterRecipes.globalWidth, ShapelessCarpenterRecipes.globalHeight); - } - public boolean shouldRenderCraftMetre() - { - return recipe != null; - } - public int getProgressBar(int i) - { - return (int)Math.ceil(i / progressMax * progress); - } - @Override - public void setToolType(String toolType) - { - this.toolTypeRequired = toolType; - } - @Override - public void setCraftingSound(String sound) - { - this.craftSound = sound; - } - @Override - public void setResearch(String research) - { - this.researchRequired = research; - } - public String getResearchNeeded() - { - return researchRequired; - } - public boolean doesPlayerKnowCraft(EntityPlayer user) - { - if(getResearchNeeded().isEmpty()) - { - return true; - } - return ResearchLogic.hasInfoUnlocked(user, getResearchNeeded()); - } - private void addXP(EntityPlayer smith) - { - if(skillUsed != null) - { - float baseXP = this.progressMax / 10F; - skillUsed.addXP(smith, (int)baseXP + 1); - } - } - @Override - public void setSkill(Skill skill) - { - skillUsed = skill; - } + + @Override + public void setForgeTime(int i) { + progressMax = i; + } + + @Override + public void setToolTier(int i) { + hammerTierRequired = i; + } + + @Override + public void setRequiredCarpenter(int i) { + CarpenterTierRequired = i; + } + + @Override + public void setHotOutput(boolean i) { + } + + public void setContainer(ContainerCarpenterMF container) { + syncCarpenter = container; + craftMatrix = new CarpenterCraftMatrix(this, syncCarpenter, ShapelessCarpenterRecipes.globalWidth, + ShapelessCarpenterRecipes.globalHeight); + } + + public boolean shouldRenderCraftMetre() { + return recipe != null; + } + + public int getProgressBar(int i) { + return (int) Math.ceil(i / progressMax * progress); + } + + @Override + public void setToolType(String toolType) { + this.toolTypeRequired = toolType; + } + + @Override + public void setResearch(String research) { + this.researchRequired = research; + } + + public String getResearchNeeded() { + return researchRequired; + } + + public boolean doesPlayerKnowCraft(EntityPlayer user) { + if (getResearchNeeded().isEmpty()) { + return true; + } + return ResearchLogic.hasInfoUnlocked(user, getResearchNeeded()); + } + + private void addXP(EntityPlayer smith) { + if (skillUsed != null) { + float baseXP = this.progressMax / 10F; + skillUsed.addXP(smith, (int) baseXP + 1); + } + } + + @Override + public void setSkill(Skill skill) { + skillUsed = skill; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityChimney.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityChimney.java index 853f38eb..4205693a 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityChimney.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityChimney.java @@ -1,260 +1,211 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - -import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.api.refine.BlastFurnaceRecipes; import minefantasy.mf2.api.refine.ISmokeCarrier; import minefantasy.mf2.api.refine.SmokeMechanics; -import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.refining.BlockChimney; -import minefantasy.mf2.block.refining.BlockChimney; -import minefantasy.mf2.block.refining.BlockForge; -import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFH; -import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.network.packet.ChimneyPacket; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.oredict.OreDictionary; -public class TileEntityChimney extends TileEntity implements ISmokeCarrier -{ - public Block maskBlock = Blocks.air; - public int maskMeta = 0; - private int isIndirect = -1; - - protected int smokeStorage; - public int ticksExisted; - public int ticksExistedTemp; - private Random rand = new Random(); - - public int lastSharedInt = 0; - @Override - public void updateEntity() - { - super.updateEntity(); - ++ticksExisted; - ++ticksExistedTemp; - if(lastSharedInt > 0)--lastSharedInt; - - /*TODO Custom Tex - if(ticksExistedTemp == 20) - { - MineFantasyII.debugMsg("Chimney Loaded R = " + worldObj.isRemote); - sync(); - } - */ - if(smokeStorage > 0) - { - if(!isPipeChimney()) - { - SmokeMechanics.emitSmokeFromCarrier(worldObj, xCoord, yCoord, zCoord, this, 5); - } - else if(tryShareSmoke()) - { - lastSharedInt = 5; - } - } - if(!worldObj.isRemote && smokeStorage > getMaxSmokeStorage() && rand.nextInt(500) == 0) - { - worldObj.newExplosion(null, xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, 2F, false, true); - } - } - public boolean isPipeChimney() - { - if(worldObj != null) - { - Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - return block instanceof BlockChimney && ((BlockChimney)block).isPipe(); - } - return false; - } - private boolean tryShareSmoke() - { - if(!isPipeChimney())return false; - if(tryPassTo(0, 1, 0, true, false)) - { - return true;//Up First - } - if(tryPassTo(-1, 0, 0, false, true) || tryPassTo(1, 0, 0, false, true) || tryPassTo(0, 0, -1, false, true) || tryPassTo(0, 0, 1, false, true)) - { - return true;//Sides - } - if(this.getMaxSmokeStorage() - this.getSmokeValue() <= 5) - { - return tryPassTo(0, -1, 0, false, false);//Down last only when nearly full - } - return false; - } +import java.util.Random; + +public class TileEntityChimney extends TileEntity implements ISmokeCarrier { + public Block maskBlock = Blocks.air; + public int maskMeta = 0; + public int ticksExisted; + public int ticksExistedTemp; + public int lastSharedInt = 0; + protected int smokeStorage; + private int isIndirect = -1; + private Random rand = new Random(); + + @Override + public void updateEntity() { + super.updateEntity(); + ++ticksExisted; + ++ticksExistedTemp; + if (lastSharedInt > 0) + --lastSharedInt; + + /* + * TODO Custom Tex if(ticksExistedTemp == 20) { + * MineFantasyII.debugMsg("Chimney Loaded R = " + worldObj.isRemote); sync(); } + */ + if (smokeStorage > 0) { + if (!isPipeChimney()) { + SmokeMechanics.emitSmokeFromCarrier(worldObj, xCoord, yCoord, zCoord, this, 5); + } else if (tryShareSmoke()) { + lastSharedInt = 5; + } + } + if (!worldObj.isRemote && smokeStorage > getMaxSmokeStorage() && rand.nextInt(500) == 0) { + worldObj.newExplosion(null, xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, 2F, false, true); + } + } + + public boolean isPipeChimney() { + if (worldObj != null) { + Block block = worldObj.getBlock(xCoord, yCoord, zCoord); + return block instanceof BlockChimney && ((BlockChimney) block).isPipe(); + } + return false; + } + + private boolean tryShareSmoke() { + if (!isPipeChimney()) + return false; + if (tryPassTo(0, 1, 0, true, false)) { + return true;// Up First + } + if (tryPassTo(-1, 0, 0, false, true) || tryPassTo(1, 0, 0, false, true) || tryPassTo(0, 0, -1, false, true) + || tryPassTo(0, 0, 1, false, true)) { + return true;// Sides + } + if (this.getMaxSmokeStorage() - this.getSmokeValue() <= 5) { + return tryPassTo(0, -1, 0, false, false);// Down last only when nearly full + } + return false; + } + + private boolean tryPassTo(int x, int y, int z, boolean priority, boolean sideways) { + TileEntity tile = worldObj.getTileEntity(x + xCoord, y + yCoord, z + zCoord); + if (tile != null && tile instanceof TileEntityChimney) { + TileEntityChimney carrier = (TileEntityChimney) tile; + boolean canPass = !sideways || carrier.canAcceptSideways(); + + int smoke = carrier.getSmokeValue(); + int max = carrier.getMaxSmokeStorage(); + int room_left = max - smoke; + int limit = priority ? max : this.getSmokeValue();// When going up, it fills all, sideways follows + // concentration gradient + if (canPass && carrier.lastSharedInt <= 0 && room_left > 0 && smoke < limit) { + int pass = Math.min(room_left, 5); + carrier.setSmokeValue(smoke + pass); + this.smokeStorage -= pass; + return true; + } + } + + return false; + } + + private boolean canAcceptSideways() { + BlockChimney block = this.getActiveBlock(); + if (block != null) { + return block.isWideChimney() || block.isPipe(); + } + return false; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setInteger("ticksExisted", ticksExisted); + nbt.setInteger("StoredSmoke", smokeStorage); + NBTTagList savedItems = new NBTTagList(); + + nbt.setInteger("BlockID", Block.getIdFromBlock(maskBlock)); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + ticksExisted = nbt.getInteger("ticksExisted"); + smokeStorage = nbt.getInteger("StoredSmoke"); + setBlock(nbt.getInteger("BlockID")); + } + + public void setBlock(int id) { + setBlock(id, 0); + } + + public void setBlock(int id, int subId) { + /* + * TODO Custom Tex maskMeta = subId; Block newblock = Block.getBlockById(id); + * if(newblock != null) { maskBlock = newblock; } if(worldObj != null && + * worldObj.isRemote) { worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, + * zCoord, xCoord, yCoord, zCoord); } + */ + } + + @Override + public int getSmokeValue() { + return smokeStorage; + } + + @Override + public void setSmokeValue(int smoke) { + smokeStorage = smoke; + } + + @Override + public int getMaxSmokeStorage() { + if (this.blockType != null && blockType instanceof BlockChimney) { + return ((BlockChimney) blockType).size; + } + return 5; + } + + public void sync() { + /* + * TODO Custom Tex MineFantasyII.debugMsg("Block For Chimney = " + + * maskBlock.getUnlocalizedName() + " R = " + worldObj.isRemote); + * if(!worldObj.isRemote) { MineFantasyII.debugMsg("Syncing Chimney " + xCoord + + * ", " + yCoord + ", " + zCoord); List players = + * ((WorldServer)worldObj).playerEntities; for(int i = 0; i < players.size(); + * i++) { EntityPlayer player = players.get(i); + * ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new + * ChimneyPacket(this).generatePacket()); } } + * MineFantasyII.debugMsg("Syncing Render " + xCoord + ", " + yCoord + ", " + + * zCoord); worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, + * xCoord, yCoord, zCoord); + */ + } + + public BlockChimney getActiveBlock() { + if (worldObj == null) + return null; + + Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - private boolean tryPassTo(int x, int y, int z, boolean priority, boolean sideways) - { - TileEntity tile = worldObj.getTileEntity(x + xCoord, y + yCoord, z + zCoord); - if(tile != null && tile instanceof TileEntityChimney) - { - TileEntityChimney carrier = (TileEntityChimney)tile; - boolean canPass = !sideways || carrier.canAcceptSideways(); - - int smoke = carrier.getSmokeValue(); - int max = carrier.getMaxSmokeStorage(); - int room_left = max-smoke; - int limit = priority ? max : this.getSmokeValue();//When going up, it fills all, sideways follows concentration gradient - if(canPass && carrier.lastSharedInt <= 0 && room_left > 0 && smoke < limit) - { - int pass = Math.min(room_left, 5); - carrier.setSmokeValue(smoke+pass); - this.smokeStorage -= pass; - return true; - } - } - - return false; - } + if (block != null && block instanceof BlockChimney) { + return (BlockChimney) block; + } + return null; + } - private boolean canAcceptSideways() - { - BlockChimney block = this.getActiveBlock(); - if(block != null) - { - return block.isWideChimney() || block.isPipe(); - } - return false; - } - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setInteger("ticksExisted", ticksExisted); - nbt.setInteger("StoredSmoke", smokeStorage); - NBTTagList savedItems = new NBTTagList(); - - nbt.setInteger("BlockID", Block.getIdFromBlock(maskBlock)); - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - ticksExisted = nbt.getInteger("ticksExisted"); - smokeStorage = nbt.getInteger("StoredSmoke"); - setBlock(nbt.getInteger("BlockID")); - } - - public void setBlock(int id) - { - setBlock(id, 0); - } - public void setBlock(int id, int subId) - { - /*TODO Custom Tex - maskMeta = subId; - Block newblock = Block.getBlockById(id); - if(newblock != null) - { - maskBlock = newblock; - } - if(worldObj != null && worldObj.isRemote) - { - worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord); - } - */ - } + public boolean isIndirect() { + BlockChimney block = getActiveBlock(); + return block != null && block.isIndirect; + } - @Override - public int getSmokeValue() - { - return smokeStorage; - } - @Override - public void setSmokeValue(int smoke) - { - smokeStorage = smoke; - } - @Override - public int getMaxSmokeStorage() - { - if(this.blockType != null && blockType instanceof BlockChimney) - { - return ((BlockChimney)blockType).size; - } - return 5; - } + @Override + public boolean canAbsorbIndirect() { + if (isIndirect == -1) { + isIndirect = isIndirect() ? 1 : 0; + } + return isIndirect == 1; + } - public void sync() - { - /*TODO Custom Tex - MineFantasyII.debugMsg("Block For Chimney = " + maskBlock.getUnlocalizedName() + " R = " + worldObj.isRemote); - if(!worldObj.isRemote) - { - MineFantasyII.debugMsg("Syncing Chimney " + xCoord + ", " + yCoord + ", " + zCoord); - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { - EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new ChimneyPacket(this).generatePacket()); - } - } - MineFantasyII.debugMsg("Syncing Render " + xCoord + ", " + yCoord + ", " + zCoord); - worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord); - */ - } + public boolean canAccept(int x, int y, int z) { + Block block = worldObj.getBlock(x + xCoord, y + yCoord, z + zCoord); + if (block instanceof BlockChimney) { + if (x == 0 && z == 0)// Not sideways + { + return true; + } else { + return ((BlockChimney) block).isPipe() || ((BlockChimney) block).isWideChimney(); + } + } + return false; + } - public BlockChimney getActiveBlock() - { - if(worldObj == null)return null; - - Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - - if(block != null && block instanceof BlockChimney) - { - return (BlockChimney)block; - } - return null; - } - public boolean isIndirect() - { - BlockChimney block = getActiveBlock(); - return block != null && block.isIndirect; - } - @Override - public boolean canAbsorbIndirect() - { - if(isIndirect == -1) - { - isIndirect = isIndirect() ? 1 : 0; - } - return isIndirect == 1; - } - public boolean canAccept(int x, int y, int z) - { - Block block = worldObj.getBlock(x+xCoord, y+yCoord, z+zCoord); - if(block instanceof BlockChimney) - { - if(x == 0 && z == 0)//Not sideways - { - return true; - } - else - { - return ((BlockChimney)block).isPipe() || ((BlockChimney)block).isWideChimney(); - } - } - return false; - } - public boolean canAccept(ForgeDirection fd) - { - return canAccept(fd.offsetX, fd.offsetY, fd.offsetZ); - } + public boolean canAccept(ForgeDirection fd) { + return canAccept(fd.offsetX, fd.offsetY, fd.offsetZ); + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityComponent.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityComponent.java index 626e59a2..596afb29 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityComponent.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityComponent.java @@ -1,210 +1,204 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; - import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.decor.BlockComponent; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.StorageBlockPacket; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; import net.minecraft.world.WorldServer; -public class TileEntityComponent extends TileEntity -{ - public ItemStack item; - public int stackSize, max; - public String type = "bar"; - public String tex = "bar"; - public CustomMaterial material; - private int ticksExisted; - - public void setItem(ItemStack item, String type, String tex, int max, int stackSize) - { - this.item = item; - this.item.stackSize = 1; - this.stackSize = stackSize; - this.max = max; - this.type = type; - this.tex = tex; - this.material = CustomToolHelper.getCustomPrimaryMaterial(item); - this.ticksExisted = 19; - } - public void interact(EntityPlayer user, ItemStack held, boolean leftClick) - { - if(item != null && stackSize > 0) - { - if(leftClick)//Take - { - if(held == null) - { - held = item.copy(); - held.stackSize = 1; - user.setCurrentItemOrArmor(0, held); - --stackSize; - } - else - { - ItemStack newitem = item.copy(); - newitem.stackSize = 1; - if(user.inventory.addItemStackToInventory(newitem)) - { - --stackSize; - } - } - if(item == null || stackSize <= 0) - { - worldObj.setBlockToAir(xCoord, yCoord, zCoord); - worldObj.removeTileEntity(xCoord, yCoord, zCoord); - } - } - else if(held != null)//PLACE - { - if(stackSize < max && item.isItemEqual(held) && ItemStack.areItemStackTagsEqual(item, held)) - { - ++stackSize; - --held.stackSize; - } - - if(held.stackSize <= 0) - { - user.setCurrentItemOrArmor(0, null); - } - } - } - checkStack(); - syncData(); - } - - public void checkStack() - { - if(!BlockComponent.canBuildOn(worldObj, xCoord, yCoord-1, zCoord)) - { - worldObj.setBlockToAir(xCoord, yCoord, zCoord); - } - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord+1, zCoord); - if(tile != null && tile instanceof TileEntityComponent) - { - ((TileEntityComponent)tile).checkStack(); - } - } - @Override - public void updateEntity() - { - ++ticksExisted; - - if(ticksExisted == 20 || ticksExisted % 120 == 0) - { - syncData(); - } - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - max = nbt.getInteger("MaxStack"); - type = nbt.getString("type"); - tex = nbt.getString("tex"); - stackSize = nbt.getInteger("StackSize"); - - NBTTagCompound itemsave = nbt.getCompoundTag("ItemSave"); - item = ItemStack.loadItemStackFromNBT(itemsave); - if(nbt.hasKey("MaterialName")) - { - this.material = CustomMaterial.getMaterial(nbt.getString("MaterialName")); - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setInteger("MaxStack", max); - nbt.setString("type", type); - nbt.setString("tex", tex); - nbt.setInteger("StackSize", stackSize); - - if(item != null) - { - NBTTagCompound itemsave = new NBTTagCompound(); - item.writeToNBT(itemsave); - nbt.setTag("ItemSave", itemsave); - } - if(material != null) - { - nbt.setString("MaterialName", material.name); - } - } - - public void syncData() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { +public class TileEntityComponent extends TileEntity { + public ItemStack item; + public int stackSize, max; + public String type = "bar"; + public String tex = "bar"; + public CustomMaterial material; + private int ticksExisted; + + public void setItem(ItemStack item, String type, String tex, int max, int stackSize) { + this.item = item; + this.item.stackSize = 1; + this.stackSize = stackSize; + this.max = max; + this.type = type; + this.tex = tex; + this.material = CustomToolHelper.getCustomPrimaryMaterial(item); + this.ticksExisted = 19; + } + + public void interact(EntityPlayer user, ItemStack held, boolean leftClick) { + if (item != null && stackSize > 0) { + if (leftClick)// Take + { + if (held == null) { + held = item.copy(); + held.stackSize = 1; + user.setCurrentItemOrArmor(0, held); + --stackSize; + } else { + ItemStack newitem = item.copy(); + newitem.stackSize = 1; + if (user.inventory.addItemStackToInventory(newitem)) { + --stackSize; + } + } + if (item == null || stackSize <= 0) { + worldObj.setBlockToAir(xCoord, yCoord, zCoord); + worldObj.removeTileEntity(xCoord, yCoord, zCoord); + } + } else if (held != null)// PLACE + { + if (stackSize < max && item.isItemEqual(held) && ItemStack.areItemStackTagsEqual(item, held)) { + ++stackSize; + --held.stackSize; + } + + if (held.stackSize <= 0) { + user.setCurrentItemOrArmor(0, null); + } + } + } + checkStack(); + syncData(); + } + + public void checkStack() { + if (!BlockComponent.canBuildOn(worldObj, xCoord, yCoord - 1, zCoord)) { + worldObj.setBlockToAir(xCoord, yCoord, zCoord); + } + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); + if (tile != null && tile instanceof TileEntityComponent) { + ((TileEntityComponent) tile).checkStack(); + } + } + + @Override + public void updateEntity() { + ++ticksExisted; + + if (ticksExisted == 20 || ticksExisted % 120 == 0) { + syncData(); + } + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + max = nbt.getInteger("MaxStack"); + type = nbt.getString("type"); + tex = nbt.getString("tex"); + stackSize = nbt.getInteger("StackSize"); + + NBTTagCompound itemsave = nbt.getCompoundTag("ItemSave"); + item = ItemStack.loadItemStackFromNBT(itemsave); + if (nbt.hasKey("MaterialName")) { + this.material = CustomMaterial.getMaterial(nbt.getString("MaterialName")); + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setInteger("MaxStack", max); + nbt.setString("type", type); + nbt.setString("tex", tex); + nbt.setInteger("StackSize", stackSize); + + if (item != null) { + NBTTagCompound itemsave = new NBTTagCompound(); + item.writeToNBT(itemsave); + nbt.setTag("ItemSave", itemsave); + } + if (material != null) { + nbt.setString("MaterialName", material.name); + } + } + + public void syncData() { + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new StorageBlockPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + + /* + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new StorageBlockPacket(this).generatePacket()); - } - } - public boolean isFull() - { - return stackSize >= max; - } - public float getBlockHeight() - { - if(type.equalsIgnoreCase("sheet")) - { - return stackSize * 0.0625F; - } - if(type.equalsIgnoreCase("plank")) - { - float f = 0.125F; - if(stackSize > 42)return 8F*f; - if(stackSize > 36)return 7F*f; - if(stackSize > 30)return 6F*f; - if(stackSize > 24)return 5F*f; - if(stackSize > 18)return 4F*f; - if(stackSize > 12)return 3F*f; - if(stackSize > 6)return 2F*f; - - return f; - } - if(type.equalsIgnoreCase("bar")) - { - float f = 0.125F; - if(stackSize > 50)return 8F*f; - if(stackSize > 48)return 7F*f; - if(stackSize > 34)return 6F*f; - if(stackSize > 32)return 5F*f; - if(stackSize > 18)return 4F*f; - if(stackSize > 16)return 3F*f; - if(stackSize > 2)return 2F*f; - - return f; + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, + new StorageBlockPacket(this).generatePacket()); } - if(type.equalsIgnoreCase("pot")) - { - float f = 0.25F; - if(stackSize > 48)return 4F*f; - if(stackSize > 32)return 3F*f; - if(stackSize > 16)return 2F*f; - - return f; - } - if(type.equalsIgnoreCase("bigplate")) - { - return Math.max(0.125F, stackSize*0.125F); - } - if(type.equalsIgnoreCase("jug")) - { - return stackSize > 16 ? 1.0F : 0.5F; - } - return 1.0F; - } + */ + } + + public boolean isFull() { + return stackSize >= max; + } + + public float getBlockHeight() { + if (type.equalsIgnoreCase("sheet")) { + return stackSize * 0.0625F; + } + if (type.equalsIgnoreCase("plank")) { + float f = 0.125F; + if (stackSize > 42) + return 8F * f; + if (stackSize > 36) + return 7F * f; + if (stackSize > 30) + return 6F * f; + if (stackSize > 24) + return 5F * f; + if (stackSize > 18) + return 4F * f; + if (stackSize > 12) + return 3F * f; + if (stackSize > 6) + return 2F * f; + + return f; + } + if (type.equalsIgnoreCase("bar")) { + float f = 0.125F; + if (stackSize > 50) + return 8F * f; + if (stackSize > 48) + return 7F * f; + if (stackSize > 34) + return 6F * f; + if (stackSize > 32) + return 5F * f; + if (stackSize > 18) + return 4F * f; + if (stackSize > 16) + return 3F * f; + if (stackSize > 2) + return 2F * f; + + return f; + } + if (type.equalsIgnoreCase("pot")) { + float f = 0.25F; + if (stackSize > 48) + return 4F * f; + if (stackSize > 32) + return 3F * f; + if (stackSize > 16) + return 2F * f; + + return f; + } + if (type.equalsIgnoreCase("bigplate")) { + return Math.max(0.125F, stackSize * 0.125F); + } + if (type.equalsIgnoreCase("jug")) { + return stackSize > 16 ? 1.0F : 0.5F; + } + return 1.0F; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCrossbowBench.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCrossbowBench.java index 784bfc2d..5fb3cf0b 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCrossbowBench.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCrossbowBench.java @@ -1,13 +1,11 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import minefantasy.mf2.api.crafting.IBasicMetre; import minefantasy.mf2.api.crafting.engineer.ICrossbowPart; import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.rpg.SkillList; import minefantasy.mf2.item.list.ToolListMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.CrossbowBenchPacket; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -19,276 +17,243 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.WorldServer; -public class TileEntityCrossbowBench extends TileEntity implements IInventory, ISidedInventory, IBasicMetre -{ - /** - * Stock, Head, Mod, Muzzle, Result - */ - private ItemStack[] inv = new ItemStack[5]; - private Random rand = new Random(); - public float progress; - public float maxProgress = 25F; - - public boolean hasRecipe; - - private int ticksExisted; - @Override - public void updateEntity() - { - ++ticksExisted; - if(!worldObj.isRemote && (hasRecipe || ticksExisted % 100 == 0)) - { - syncData(); - } - } - public boolean tryCraft(EntityPlayer user) - { - ItemStack result = findResult(); - hasRecipe = result != null; - - if(result == null) - { - progress = 0F; - } - else if(ToolHelper.getCrafterTool(user.getHeldItem()).equalsIgnoreCase("spanner")) - { - if(user.getHeldItem() != null) - { - worldObj.playSoundEffect(xCoord+0.5, yCoord, zCoord+0.5, "minefantasy2:block.twistbolt", 0.25F, 1.0F); - user.getHeldItem().damageItem(1, user); - if(user.getHeldItem().getItemDamage() >= user.getHeldItem().getMaxDamage()) - { - user.destroyCurrentEquippedItem(); - } - } - float efficiency = ToolHelper.getCrafterEfficiency(user.getHeldItem()); - - if(user.swingProgress > 0 && user.swingProgress <= 1.0) - { - efficiency *= (0.5F-user.swingProgress); - } - - if(!worldObj.isRemote) - { - progress += efficiency; - } - if((progress >= maxProgress && craftItem(result))) - { - worldObj.playSoundEffect(xCoord+0.5, yCoord, zCoord+0.5, "random.door_open", 0.35F, 0.5F); - progress = 0; - if(user != null) - { - SkillList.engineering.addXP(user, 10); - } - for(int a = 0; a < 4; a++) - { - decrStackSize(a, 1); - } - } - return true; - } - return false; - } - private boolean craftItem(ItemStack result) - { - if(inv[4] == null) - { - this.setInventorySlotContents(4, result); - return true; - } - else - { - return false; - } - } - public void syncData() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { +import java.util.Random; + +public class TileEntityCrossbowBench extends TileEntity implements IInventory, ISidedInventory, IBasicMetre { + public float progress; + public float maxProgress = 25F; + public boolean hasRecipe; + /** + * Stock, Head, Mod, Muzzle, Result + */ + private ItemStack[] inv = new ItemStack[5]; + private Random rand = new Random(); + private int ticksExisted; + + private static ICrossbowPart getCrossbowPart(ItemStack item) { + if (item != null && item.getItem() instanceof ICrossbowPart) { + return (ICrossbowPart) item.getItem(); + } + return null; + } + + public static boolean isMatch(ItemStack item, String var) { + ICrossbowPart part = getCrossbowPart(item); + if (part != null) { + return part.getComponentType().equalsIgnoreCase(var); + } + return false; + } + + @Override + public void updateEntity() { + ++ticksExisted; + if (!worldObj.isRemote && (hasRecipe || ticksExisted % 100 == 0)) { + syncData(); + } + } + + public boolean tryCraft(EntityPlayer user) { + ItemStack result = findResult(); + hasRecipe = result != null; + + if (result == null) { + progress = 0F; + } else if (ToolHelper.getCrafterTool(user.getHeldItem()).equalsIgnoreCase("spanner")) { + if (user.getHeldItem() != null) { + worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "minefantasy2:block.twistbolt", 0.25F, + 1.0F); + user.getHeldItem().damageItem(1, user); + if (user.getHeldItem().getItemDamage() >= user.getHeldItem().getMaxDamage()) { + user.destroyCurrentEquippedItem(); + } + } + float efficiency = ToolHelper.getCrafterEfficiency(user.getHeldItem()); + + if (user.swingProgress > 0 && user.swingProgress <= 1.0) { + efficiency *= (0.5F - user.swingProgress); + } + + if (!worldObj.isRemote) { + progress += efficiency; + } + if ((progress >= maxProgress && craftItem(result))) { + worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "random.door_open", 0.35F, 0.5F); + progress = 0; + if (user != null) { + SkillList.engineering.addXP(user, 10); + } + for (int a = 0; a < 4; a++) { + decrStackSize(a, 1); + } + } + return true; + } + return false; + } + + private boolean craftItem(ItemStack result) { + if (inv[4] == null) { + this.setInventorySlotContents(4, result); + return true; + } else { + return false; + } + } + + public void syncData() { + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new CrossbowBenchPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + + /* + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new CrossbowBenchPacket(this).generatePacket()); - } - } - - public void onInventoryChanged() - { - } - - private ItemStack findResult() - { - ICrossbowPart stock = getCrossbowPart(inv[0]); - ICrossbowPart head = getCrossbowPart(inv[1]); - ICrossbowPart mod = getCrossbowPart(inv[2]); - ICrossbowPart muzzle = getCrossbowPart(inv[3]); - - if(stock == null || head == null)return null; - - return ToolListMF.crossbow_custom.constructCrossbow(stock, head, mod, muzzle); - } - - //INVENORY - - private static ICrossbowPart getCrossbowPart(ItemStack item) - { - if(item != null && item.getItem() instanceof ICrossbowPart) - { - return (ICrossbowPart)item.getItem(); + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, + new CrossbowBenchPacket(this).generatePacket()); } - return null; - } - @Override - public int getSizeInventory() - { - return inv.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return inv[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - onInventoryChanged(); - if (this.inv[slot] != null) - { + */ + } + + // INVENORY + + public void onInventoryChanged() { + } + + private ItemStack findResult() { + ICrossbowPart stock = getCrossbowPart(inv[0]); + ICrossbowPart head = getCrossbowPart(inv[1]); + ICrossbowPart mod = getCrossbowPart(inv[2]); + ICrossbowPart muzzle = getCrossbowPart(inv[3]); + + if (stock == null || head == null) + return null; + + return ToolListMF.crossbow_custom.constructCrossbow(stock, head, mod, muzzle); + } + + @Override + public int getSizeInventory() { + return inv.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inv[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + onInventoryChanged(); + if (this.inv[slot] != null) { ItemStack itemstack; - if (this.inv[slot].stackSize <= num) - { + if (this.inv[slot].stackSize <= num) { itemstack = this.inv[slot]; this.inv[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.inv[slot].splitStack(num); - if (this.inv[slot].stackSize == 0) - { + if (this.inv[slot].stackSize == 0) { this.inv[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return inv[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - onInventoryChanged(); - inv[slot] = item; - } - - @Override - public String getInventoryName() - { - return "gui.crossbowcraftmf.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - if(this.isMatch(item, "stock")) - { - return slot == 0; - } - if(this.isMatch(item, "mechanism")) - { - return slot == 1; - } - if(this.isMatch(item, "mod")) - { - return slot == 2; - } - if(this.isMatch(item, "muzzle")) - { - return slot == 3; - } - return false; - } - - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - NBTTagList savedItems = nbt.getTagList("Items", 10); + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return inv[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + onInventoryChanged(); + inv[slot] = item; + } + + @Override + public String getInventoryName() { + return "gui.crossbowcraftmf.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + if (this.isMatch(item, "stock")) { + return slot == 0; + } + if (this.isMatch(item, "mechanism")) { + return slot == 1; + } + if (this.isMatch(item, "mod")) { + return slot == 2; + } + if (this.isMatch(item, "muzzle")) { + return slot == 3; + } + return false; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inv.length) - { + if (slotNum >= 0 && slotNum < this.inv.length) { this.inv[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } progress = nbt.getFloat("progress"); maxProgress = nbt.getFloat("maxProgress"); hasRecipe = nbt.getBoolean("hasRecipe"); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.inv.length; ++i) - { - if (this.inv[i] != null) - { + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.inv.length; ++i) { + if (this.inv[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inv[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } @@ -298,44 +263,35 @@ public void writeToNBT(NBTTagCompound nbt) nbt.setFloat("progress", progress); nbt.setFloat("maxProgress", maxProgress); nbt.setBoolean("hasRecipe", hasRecipe); - } - @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return new int[]{0, 1, 2, 3, 4}; - } - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) - { - return this.isItemValidForSlot(slot, item); - } - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) - { - return slot == 4; - } - @Override - public int getMetreScale(int size) - { - return (int)Math.min(size, (float)size / maxProgress * progress); - } - @Override - public boolean shouldShowMetre() - { - return true; - } - @Override - public String getLocalisedName() - { - return StatCollector.translateToLocal("tile.crossbowBench.name"); - } - public static boolean isMatch(ItemStack item, String var) - { - ICrossbowPart part = getCrossbowPart(item); - if(part != null) - { - return part.getComponentType().equalsIgnoreCase(var); - } - return false; - } + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) { + return new int[]{0, 1, 2, 3, 4}; + } + + @Override + public boolean canInsertItem(int slot, ItemStack item, int side) { + return this.isItemValidForSlot(slot, item); + } + + @Override + public boolean canExtractItem(int slot, ItemStack item, int side) { + return slot == 4; + } + + @Override + public int getMetreScale(int size) { + return (int) Math.min(size, size / maxProgress * progress); + } + + @Override + public boolean shouldShowMetre() { + return true; + } + + @Override + public String getLocalisedName() { + return StatCollector.translateToLocal("tile.crossbowBench.name"); + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCrucible.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCrucible.java index c9e435f8..3a8617af 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCrucible.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityCrucible.java @@ -1,7 +1,5 @@ package minefantasy.mf2.block.tileentity; -import java.util.Random; - import minefantasy.mf2.api.crafting.IHeatUser; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.refine.Alloy; @@ -22,457 +20,365 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -public class TileEntityCrucible extends TileEntity implements IInventory, ISidedInventory, IHeatUser -{ - private ItemStack[] inv = new ItemStack[10]; - public float progress = 0, progressMax = 400; - public float temperature; - private Random rand = new Random(); - - @Override - public void updateEntity() - { - super.updateEntity(); - boolean isHot = getIsHot(); - temperature = getTemperature(); - if(getTier() >= 2) - { - progressMax = 2000; - } - - /* - int time = 400; - for(int a = 1; a < getSizeInventory()-1; a ++) - { - if(inv[a] != null) - { - time += 50; - } - } - if(!worldObj.isRemote) - { - progressMax = time; - } - */ - - if (isHot && canSmelt()) - { - progress += (temperature/600F); - if (progress >= progressMax) - { - progress = 0; - smeltItem(); - if(isAuto()) - { - onAutoSmelt(); - } - } - } - else - { - progress = 0; - } - if(progress > 0 && rand.nextInt(4) == 0 && !isOutside() && this.getTier() < 2) - { - SmokeMechanics.emitSmokeIndirect(worldObj, xCoord, yCoord, zCoord, 1); - } - - if(isHot != getIsHot()) - { - BlockCrucible.updateFurnaceBlockState(getTemperature() > 0, worldObj, xCoord, yCoord, zCoord); - } - } - - private boolean getIsHot() - { - if(this.getTier() >= 2) - { - return this.isCoated(); - } - return getTemperature() > 0; - } - - private void onAutoSmelt() - { - worldObj.playSoundEffect(xCoord+0.5, yCoord+0.5, zCoord+0.5, "random.fizz", 1.0F, 1.0F); - worldObj.playSoundEffect(xCoord+0.5, yCoord+0.5, zCoord+0.5, "random.piston.out", 1.0F, 1.0F); - } - - private boolean isOutside() - { - for(int x = -1; x <= 1; x++) - { - for(int y = -1; y <= 1; y++) - { - if(!worldObj.canBlockSeeTheSky(xCoord + x, yCoord+1, zCoord + y)) - { - return false; - } - } - } - return true; - } - - public void smeltItem() - { - if (!canSmelt()) - { - return; - } - - ItemStack itemstack = getRecipe(); - - if (inv[getOutSlot()] == null) - { - inv[getOutSlot()] = itemstack.copy(); - } - - else if ( CustomToolHelper.areEqual(inv[getOutSlot()], itemstack) ) - { - inv[getOutSlot()].stackSize += itemstack.stackSize; - } - - for(int a = 0; a < (getSizeInventory()-1); a ++) - { - if (inv[a] != null) - { - inv[a].stackSize--; - if (inv[a].stackSize <= 0) { - inv[a] = null; - } - } - } - if(worldObj.isRemote && getTier() >= 2) - { - spawnParticle(-3, 0, 0); - spawnParticle(3, 0, 0); - spawnParticle(0, 0, -3); - spawnParticle(0, 0, 3); - } - } - - - private void spawnParticle(int x, int y, int z) - { - this.worldObj.playAuxSFX(2003, xCoord+x, yCoord+y, zCoord+z, 0); - } - - private boolean canSmelt() - { - if(temperature <= 0) - { - return false; - } - - ItemStack result = getRecipe(); - - if (result == null) - { - return false; - } - - if (inv[getOutSlot()] == null) - return true; - if (inv[getOutSlot()] != null - && CustomToolHelper.areEqual(inv[getOutSlot()], result) - && inv[getOutSlot()].stackSize < (inv[getOutSlot()] - .getMaxStackSize() - (result.stackSize - 1))) - return true; - return false; - } - - private int getOutSlot() { - return 9; - } - - private ItemStack getRecipe() - { - ItemStack[] input = new ItemStack[getSizeInventory()-1]; - for(int a = 0; a < 9; a ++) - { - input[a] = inv[a]; - } - Alloy alloy = AlloyRecipes.getResult(input); - if(alloy != null) - { - if(alloy.getLevel() <= getTier()) - { - return AlloyRecipes.getResult(input).getRecipeOutput(); - } - } - return null; - } - - @Override - public Block getBlockType() - { - if(worldObj == null)return Blocks.air; - - return super.getBlockType(); - } - public int getTier() - { - if(this.getBlockType() != null && this.getBlockType() instanceof BlockCrucible) - { - return ((BlockCrucible)this.getBlockType()).tier; - } - return 0; - } - public boolean isAuto() - { - if(this.getBlockType() != null && this.getBlockType() instanceof BlockCrucible) - { - return ((BlockCrucible)this.getBlockType()).isAuto; - } - return false; - } - public float getTemperature() - { - if(this.getTier() >= 1 && !isCoated()) - { - return 0F; - } - if(getTier() >= 2) - { - return 500; - } - Block under = worldObj.getBlock(xCoord, yCoord-1, zCoord); - - if(under.getMaterial() == Material.fire) - { - return 10F; - } - if(under.getMaterial() == Material.lava) - { - return 50F; - } - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord-1, zCoord); - if(tile != null && tile instanceof TileEntityForge) - { - return ((TileEntityForge)tile).getBlockTemperature(); - } - return 0F; - } - public boolean isCoated() - { - if(this.getTier() >= 2) - { - return isEnderAlter(-1, -1, -3) - && isEnderAlter(-1, -1, 3) - && isEnderAlter(-3, -1, -1) - && isEnderAlter( 3, -1, -1) - && isEnderAlter(1, -1, -3) - && isEnderAlter(1, -1, 3) - && isEnderAlter(-3, -1, 1) - && isEnderAlter( 3, -1, 1); - } - return isFirebrick(0, 0, -1) - && isFirebrick(0, 0, 1) - && isFirebrick(-1, 0, 0) - && isFirebrick( 1, 0, 0); - } - - private boolean isFirebrick(int x, int y, int z) - { - return worldObj.getBlock(xCoord+x, yCoord+y, zCoord+z) == BlockListMF.firebricks; - } - private boolean isEnderAlter(int x, int y, int z) - { - Block block = worldObj.getBlock(xCoord+x, yCoord+y, zCoord+z); - int meta = worldObj.getBlockMetadata(xCoord+x, yCoord+y, zCoord+z); - - if(block == Blocks.end_portal_frame && BlockEndPortalFrame.isEnderEyeInserted(meta)) - { - return true; - } - else - { - //worldObj.setBlock(xCoord+x, yCoord+y, zCoord+z, Blocks.end_portal_frame, 0, 2); - return false; - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setFloat("progress", progress); - nbt.setFloat("progressMax", progressMax); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.inv.length; ++i) - { - if (this.inv[i] != null) - { +import java.util.Random; + +public class TileEntityCrucible extends TileEntity implements IInventory, ISidedInventory, IHeatUser { + private final int[] grid = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8}; + private final int[] output = new int[]{9}; + private final int[] whole = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + public float progress = 0, progressMax = 400; + public float temperature; + private ItemStack[] inv = new ItemStack[10]; + private Random rand = new Random(); + + @Override + public void updateEntity() { + super.updateEntity(); + boolean isHot = getIsHot(); + temperature = getTemperature(); + if (getTier() >= 2) { + progressMax = 2000; + } + + /* + * int time = 400; for(int a = 1; a < getSizeInventory()-1; a ++) { if(inv[a] != + * null) { time += 50; } } if(!worldObj.isRemote) { progressMax = time; } + */ + + if (isHot && canSmelt()) { + progress += (temperature / 600F); + if (progress >= progressMax) { + progress = 0; + smeltItem(); + if (isAuto()) { + onAutoSmelt(); + } + } + } else { + progress = 0; + } + if (progress > 0 && rand.nextInt(4) == 0 && !isOutside() && this.getTier() < 2) { + SmokeMechanics.emitSmokeIndirect(worldObj, xCoord, yCoord, zCoord, 1); + } + + if (isHot != getIsHot()) { + BlockCrucible.updateFurnaceBlockState(getTemperature() > 0, worldObj, xCoord, yCoord, zCoord); + } + } + + private boolean getIsHot() { + if (this.getTier() >= 2) { + return this.isCoated(); + } + return getTemperature() > 0; + } + + private void onAutoSmelt() { + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.fizz", 1.0F, 1.0F); + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.piston.out", 1.0F, 1.0F); + } + + private boolean isOutside() { + for (int x = -1; x <= 1; x++) { + for (int y = -1; y <= 1; y++) { + if (!worldObj.canBlockSeeTheSky(xCoord + x, yCoord + 1, zCoord + y)) { + return false; + } + } + } + return true; + } + + public void smeltItem() { + if (!canSmelt()) { + return; + } + + ItemStack itemstack = getRecipe(); + + if (inv[getOutSlot()] == null) { + inv[getOutSlot()] = itemstack.copy(); + } else if (CustomToolHelper.areEqual(inv[getOutSlot()], itemstack)) { + inv[getOutSlot()].stackSize += itemstack.stackSize; + } + + for (int a = 0; a < (getSizeInventory() - 1); a++) { + if (inv[a] != null) { + inv[a].stackSize--; + if (inv[a].stackSize <= 0) { + inv[a] = null; + } + } + } + if (worldObj.isRemote && getTier() >= 2) { + spawnParticle(-3, 0, 0); + spawnParticle(3, 0, 0); + spawnParticle(0, 0, -3); + spawnParticle(0, 0, 3); + } + } + + private void spawnParticle(int x, int y, int z) { + this.worldObj.playAuxSFX(2003, xCoord + x, yCoord + y, zCoord + z, 0); + } + + private boolean canSmelt() { + if (temperature <= 0) { + return false; + } + + ItemStack result = getRecipe(); + + if (result == null) { + return false; + } + + if (inv[getOutSlot()] == null) + return true; + if (inv[getOutSlot()] != null && CustomToolHelper.areEqual(inv[getOutSlot()], result) + && inv[getOutSlot()].stackSize < (inv[getOutSlot()].getMaxStackSize() - (result.stackSize - 1))) + return true; + return false; + } + + private int getOutSlot() { + return 9; + } + + private ItemStack getRecipe() { + ItemStack[] input = new ItemStack[getSizeInventory() - 1]; + for (int a = 0; a < 9; a++) { + input[a] = inv[a]; + } + Alloy alloy = AlloyRecipes.getResult(input); + if (alloy != null) { + if (alloy.getLevel() <= getTier()) { + return AlloyRecipes.getResult(input).getRecipeOutput(); + } + } + return null; + } + + @Override + public Block getBlockType() { + if (worldObj == null) + return Blocks.air; + + return super.getBlockType(); + } + + public int getTier() { + if (this.getBlockType() != null && this.getBlockType() instanceof BlockCrucible) { + return ((BlockCrucible) this.getBlockType()).tier; + } + return 0; + } + + public boolean isAuto() { + if (this.getBlockType() != null && this.getBlockType() instanceof BlockCrucible) { + return ((BlockCrucible) this.getBlockType()).isAuto; + } + return false; + } + + public float getTemperature() { + if (this.getTier() >= 1 && !isCoated()) { + return 0F; + } + if (getTier() >= 2) { + return 500; + } + Block under = worldObj.getBlock(xCoord, yCoord - 1, zCoord); + + if (under.getMaterial() == Material.fire) { + return 10F; + } + if (under.getMaterial() == Material.lava) { + return 50F; + } + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + if (tile != null && tile instanceof TileEntityForge) { + return ((TileEntityForge) tile).getBlockTemperature(); + } + return 0F; + } + + public boolean isCoated() { + if (this.getTier() >= 2) { + return isEnderAlter(-1, -1, -3) && isEnderAlter(-1, -1, 3) && isEnderAlter(-3, -1, -1) + && isEnderAlter(3, -1, -1) && isEnderAlter(1, -1, -3) && isEnderAlter(1, -1, 3) + && isEnderAlter(-3, -1, 1) && isEnderAlter(3, -1, 1); + } + return isFirebrick(0, 0, -1) && isFirebrick(0, 0, 1) && isFirebrick(-1, 0, 0) && isFirebrick(1, 0, 0); + } + + private boolean isFirebrick(int x, int y, int z) { + return worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z) == BlockListMF.firebricks; + } + // INVENTORY + + private boolean isEnderAlter(int x, int y, int z) { + Block block = worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z); + int meta = worldObj.getBlockMetadata(xCoord + x, yCoord + y, zCoord + z); + + if (block == Blocks.end_portal_frame && BlockEndPortalFrame.isEnderEyeInserted(meta)) { + return true; + } else { + // worldObj.setBlock(xCoord+x, yCoord+y, zCoord+z, Blocks.end_portal_frame, 0, + // 2); + return false; + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setFloat("progress", progress); + nbt.setFloat("progressMax", progressMax); + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.inv.length; ++i) { + if (this.inv[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inv[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - progress = nbt.getFloat("progress"); - progressMax = nbt.getFloat("progressMax"); - - NBTTagList savedItems = nbt.getTagList("Items", 10); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + progress = nbt.getFloat("progress"); + progressMax = nbt.getFloat("progressMax"); + + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inv.length) - { + if (slotNum >= 0 && slotNum < this.inv.length) { this.inv[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } - } - //INVENTORY - - @Override - public int getSizeInventory() - { - return inv.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return inv[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - onInventoryChanged(); - if (this.inv[slot] != null) - { + } + + @Override + public int getSizeInventory() { + return inv.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inv[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + onInventoryChanged(); + if (this.inv[slot] != null) { ItemStack itemstack; - if (this.inv[slot].stackSize <= num) - { + if (this.inv[slot].stackSize <= num) { itemstack = this.inv[slot]; this.inv[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.inv[slot].splitStack(num); - if (this.inv[slot].stackSize == 0) - { + if (this.inv[slot].stackSize == 0) { this.inv[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return inv[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - onInventoryChanged(); - inv[slot] = item; - } - - public void onInventoryChanged() - { - } - - @Override - public String getInventoryName() - { - return "gui.crucible.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - return true; - } - - private boolean isBlastOutput() - { - if(worldObj == null)return false; - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord+1, zCoord); - return tile != null && tile instanceof TileEntityBlastFH; - } - private final int[] grid = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8}; - private final int[] output = new int[]{9}; - private final int[] whole = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - @Override - public int[] getAccessibleSlotsFromSide(int side) - { - if(isBlastOutput()) - { - return whole; - } - return side == 0 ? output : grid; - } - - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) - { - return !isBlastOutput() && slot < getOutSlot(); - } - - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) - { - return isAuto() && slot == getOutSlot(); - } - - @Override - public boolean canAccept(TileEntity tile) { - return tile instanceof TileEntityForge; - } + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return inv[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + onInventoryChanged(); + inv[slot] = item; + } + + public void onInventoryChanged() { + } + + @Override + public String getInventoryName() { + return "gui.crucible.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + return true; + } + + private boolean isBlastOutput() { + if (worldObj == null) + return false; + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); + return tile != null && tile instanceof TileEntityBlastFH; + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) { + if (isBlastOutput()) { + return whole; + } + return side == 0 ? output : grid; + } + + @Override + public boolean canInsertItem(int slot, ItemStack item, int side) { + return !isBlastOutput() && slot < getOutSlot(); + } + + @Override + public boolean canExtractItem(int slot, ItemStack item, int side) { + return isAuto() && slot == getOutSlot(); + } + + @Override + public boolean canAccept(TileEntity tile) { + return tile instanceof TileEntityForge; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityFirepit.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityFirepit.java index d6376b1c..5c0bc7f3 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityFirepit.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityFirepit.java @@ -1,8 +1,5 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.crafting.IBasicMetre; @@ -12,11 +9,8 @@ import minefantasy.mf2.api.helpers.Functions; import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.api.rpg.SkillList; -import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.item.food.FoodListMF; import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.network.packet.FirepitPacket; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; @@ -28,323 +22,250 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; -import net.minecraft.world.WorldServer; - -public class TileEntityFirepit extends TileEntity implements IBasicMetre, IHeatSource -{ - public int fuel = 0; - private int maxFuel = 12000; //10 minutes - private float charcoal = 0; - private int ticksExisted; - private Random rand = new Random(); - - @Override - public void updateEntity() - { - super.updateEntity(); - ++ticksExisted; - - if(!worldObj.isRemote) - { - if(!isLit() && fuel > 0 && ticksExisted % 10 == 0) - { - tryLight(); - } - - if(isLit()) - { - if(fuel > 0) - { - fuel --; - charcoal += (0.25F / 20F / 60F); - } - - if(fuel <= 0) - { - setLit(false); - } - - if(isLit() && isWet()) - { - extinguish(Blocks.water, 0); - } - } - sendPacketToClients(); - } - if(worldObj.isRemote) - { - if(ticksExisted % 5 == 0 && isLit()) - { - worldObj.spawnParticle("smoke", xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, 0.0D, 0.0D, 0.0D); - worldObj.spawnParticle("flame", xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, 0.0D, 0.0D, 0.0D); - - if(rand.nextInt(100) == 0) - { - worldObj.playSound((double)((float)xCoord + 0.5F), (double)((float)yCoord + 0.5F), (double)((float)zCoord + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); - } - } - - if(ticksExisted % 20 == 0) - { - if(worldObj.getBlock(xCoord, yCoord, zCoord) != BlockListMF.firepit) - { - worldObj.removeTileEntity(xCoord, yCoord, zCoord); - MFLogUtil.logWarn("Firepit missing block"); - } - } - } - } - - public boolean hasBlockAbove() - { - if(worldObj == null)return false; - - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord+1, zCoord); - if(tile != null && tile instanceof IHeatUser) - { - return ((IHeatUser)tile).canAccept(this); - } - - return false; - } - - private boolean isWet() - { - if(isWater(-1, 0, 0) || isWater(1, 0, 0) || isWater(0, 0, -1) || isWater(0, 0, 1) || isWater(0, 1, 0)) - { - return true; - } - /* - if(worldObj.getBlock(xCoord, yCoord+1, zCoord) == BlockListMF.roast.blockID) - { - if(worldObj.canLightningStrikeAt(xCoord, yCoord+2, zCoord)) - { - return true; - } - } - */ - - return worldObj.canLightningStrikeAt(xCoord, yCoord+1, zCoord); - } - - public int getCharcoalDrop() - { - return (int)(Math.floor(charcoal)); - } - - public boolean isBurning() - { - return isLit() && fuel > 0; - } - - public boolean isLit() - { - return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1; - } - - private void tryLight() - { - if(isFire(-1, 0, 0) || isFire(1, 0, 0) || isFire(0, 0, -1) || isFire(0, 0, 1) || isFire(0, -1, 0) || isFire(0, 1, 0)) - { - setLit(true); - } - } - - private boolean isFire(int x, int y, int z) - { - return worldObj.getBlock(xCoord+x, yCoord+y, zCoord+z).getMaterial() == Material.fire; - } - private boolean isWater(int x, int y, int z) - { - return worldObj.getBlock(xCoord+x, yCoord+y, zCoord+z).getMaterial() == Material.water; - } - - public boolean addFuel(ItemStack input) - { - int amount = getItemBurnTime(input); - if(amount > 0 && fuel < maxFuel) - { - fuel += amount; - if(fuel > maxFuel) - { - fuel = maxFuel; - } - return true; - } - return false; - } - public void setLit(boolean lit) - { - if(worldObj != null) - { - worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, lit ? 1 : 0, 2); - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setInteger("fuel", fuel); - nbt.setInteger("maxFuel", maxFuel); - nbt.setInteger("ticksExisted", ticksExisted); - - nbt.setFloat("charcoal", charcoal); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - setLit(nbt.getBoolean("isLit")); - - fuel = nbt.getInteger("fuel"); - maxFuel = nbt.getInteger("maxFuel"); - ticksExisted = nbt.getInteger("ticksExisted"); - - charcoal = nbt.getFloat("charcoal"); - } - - /** - * Gets the burn time - * - * Wood tools and plank item are 1 minute - * sticks and saplings are 30seconds - */ - public static int getItemBurnTime(ItemStack input) - { - if (input == null) - { + +import java.util.Random; + +public class TileEntityFirepit extends TileEntity implements IBasicMetre, IHeatSource { + private final int maxFuel = 12000; // 10 minutes + public int fuel = 0; + private float charcoal = 0; + private int ticksExisted; + private Random rand = new Random(); + + /** + * Gets the burn time + *

+ * Wood tools and plank item are 1 minute sticks and saplings are 30seconds + */ + public static int getItemBurnTime(ItemStack input) { + if (input == null) { return 0; - } - else - { + } else { Item i = input.getItem(); - int d = input.getItemDamage(); - Item item = input.getItem(); + if (i == Items.stick) + return 600;// 30Sec + if (i == ComponentListMF.plank || i == ComponentListMF.plank_cut) { + return (int) (200 * CustomToolHelper.getBurnModifier(input)); + } + if (i == ComponentListMF.plank_pane) { + return (int) (600 * CustomToolHelper.getBurnModifier(input)); + } + + return 0; + } + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (worldObj.isRemote) { + if (isBurning()) { + fuel--; + } + return; + } - if (i == Items.stick) return 600;//30Sec - if (i == ComponentListMF.plank || i == ComponentListMF.plank_cut) - { - return (int)(200 * CustomToolHelper.getBurnModifier(input)); + ++ticksExisted; + if (isLit()) { + if (isWet()) { + extinguish(Blocks.water, 0); + return; } - if (i == ComponentListMF.plank_pane) - { - return (int)(600 * CustomToolHelper.getBurnModifier(input)); + + if (fuel > 0) { + fuel--; + charcoal += (0.25F / 20F / 60F); } - + + if (fuel <= 0) { + setLit(false); + } + } else if (fuel > 0 && ticksExisted % 10 == 0) { + tryLight(); + } + } + + private boolean isWet() { + if (isWater(-1, 0, 0) || isWater(1, 0, 0) || isWater(0, 0, -1) || isWater(0, 0, 1) || isWater(0, 1, 0)) { + return true; + } + + return worldObj.canLightningStrikeAt(xCoord, yCoord + 1, zCoord); + } + + public int getCharcoalDrop() { + return (int) (Math.floor(charcoal)); + } + + public boolean isBurning() { + return isLit() && fuel > 0; + } + + public boolean isLit() { + return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1; + } + + public void setLit(boolean lit) { + if (worldObj != null) { + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, lit ? 1 : 0, 2); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + ticksExisted = 0; + } + + private void tryLight() { + if (isFire(-1, 0, 0) || isFire(1, 0, 0) || isFire(0, 0, -1) || isFire(0, 0, 1) || isFire(0, -1, 0) + || isFire(0, 1, 0)) { + setLit(true); + } + } + + private boolean isFire(int x, int y, int z) { + return worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z).getMaterial() == Material.fire; + } + + private boolean isWater(int x, int y, int z) { + return worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z).getMaterial() == Material.water; + } + + public boolean addFuel(ItemStack input) { + int amount = getItemBurnTime(input); + if (amount > 0 && fuel < maxFuel) { + fuel += amount; + if (fuel > maxFuel) { + fuel = maxFuel; + } + return true; + } + return false; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("fuel", fuel); + nbt.setInteger("ticksExisted", ticksExisted); + nbt.setFloat("charcoal", charcoal); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + setLit(nbt.getBoolean("isLit")); + fuel = nbt.getInteger("fuel"); + ticksExisted = nbt.getInteger("ticksExisted"); + charcoal = nbt.getFloat("charcoal"); + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("fuel", fuel); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { + fuel = packet.func_148857_g().getInteger("fuel"); + } + + @Override + public boolean canPlaceAbove() { + return true; + } + + @Override + public int getHeat() { + if (!isBurning()) { return 0; } + return Functions.getIntervalWave1_i(ticksExisted, 30, 100, 200);// 100*-300* + } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldShowMetre() { + return fuel > 0; + } + + @Override + @SideOnly(Side.CLIENT) + public int getMetreScale(int width) { + return this.fuel * width / (maxFuel); } - @Override - public boolean canPlaceAbove() - { - return true; - } - - @Override - public int getHeat() - { - if(!isBurning())return 0; - return Functions.getIntervalWave1_i(ticksExisted, 30, 100, 200);//100*-300* - } - - private void sendPacketToClients() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { - EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new FirepitPacket(this).generatePacket()); - } - } - - @Override - @SideOnly(Side.CLIENT) - public boolean shouldShowMetre() - { - return fuel > 0; - } - @Override - @SideOnly(Side.CLIENT) - public int getMetreScale(int width) - { - return this.fuel * width / (maxFuel); - } - @Override - @SideOnly(Side.CLIENT) - public String getLocalisedName() - { - int seconds = (int)Math.floor(fuel/20); - int mins = (int)Math.floor(seconds/60); - seconds -= mins*60; - - String s = ""; - if(seconds < 10) - { - s += "0"; - } - - return "150C "+StatCollector.translateToLocal("forge.fuel.name") + " " + mins + ":" + s + seconds; - } - - public void extinguish() - { - extinguish(Blocks.sand, 0); - } - - public void extinguish(Block block, int meta) - { - worldObj.playSoundEffect(xCoord+0.5F, yCoord+0.25F, zCoord+0.5F, "random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F); - worldObj.spawnParticle("largesmoke", xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, 0.0D, 0.0D, 0.0D); - worldObj.spawnParticle("tilecrack_" + block + "_" + meta, xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, 0.0D, 0.0D, 0.0D); - - setLit(false); - } - - public boolean tryCook(EntityPlayer player, ItemStack held) - { - if(rand.nextInt(10) != 0)return false; - if(held == null)return false; - if(held.getItem() instanceof ItemFood) - { - player.swingItem(); - if(worldObj.isRemote) - { - return false; - } - ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(held); - if(result != null) - { - float chance = 75F; - if(RPGElements.isSystemActive) - { - int skill = RPGElements.getLevel(player, SkillList.provisioning); - chance += (int)((float)skill/4); - } - boolean success = (rand.nextFloat()*100) < chance; - ItemStack creation = success ? result.copy() : new ItemStack(FoodListMF.burnt_food); - dropItem(player, creation); - SkillList.provisioning.addXP(player, success ? 2 : 1); - - return true; - } - } - return false; - } - - public void dropItem(EntityPlayer player, ItemStack item) - { - EntityItem drop = new EntityItem(worldObj, player.posX, player.posY, player.posZ, item); - drop.delayBeforeCanPickup = 0; - drop.motionX = drop.motionY = drop.motionZ = 0; - worldObj.spawnEntityInWorld(drop); - } + @Override + @SideOnly(Side.CLIENT) + public String getLocalisedName() { + int seconds = (int) Math.floor(fuel / 20); + int mins = (int) Math.floor(seconds / 60); + seconds -= mins * 60; + + String s = ""; + if (seconds < 10) { + s += "0"; + } + + return "150C " + StatCollector.translateToLocal("forge.fuel.name") + " " + mins + ":" + s + seconds; + } + + public void extinguish(Block block, int meta) { + worldObj.playSoundEffect(xCoord + 0.5F, yCoord + 0.25F, zCoord + 0.5F, "random.fizz", 0.4F, + 2.0F + this.rand.nextFloat() * 0.4F); + worldObj.spawnParticle("largesmoke", xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, 0.0D, 0.0D, 0.0D); + worldObj.spawnParticle("tilecrack_" + block + "_" + meta, xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, 0.0D, + 0.0D, 0.0D); + + setLit(false); + } + + public boolean tryCook(EntityPlayer player, ItemStack held) { + if (held.getItem() instanceof ItemFood) { + player.swingItem(); + if (worldObj.isRemote) { + return false; + } + ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(held); + if (result != null) { + if (rand.nextInt(10) != 0) { + return false; + } + float chance = 75F; + if (RPGElements.isSystemActive) { + int skill = RPGElements.getLevel(player, SkillList.provisioning); + chance += (int) ((float) skill / 4); + } + boolean success = (rand.nextFloat() * 100) < chance; + ItemStack creation = success ? result.copy() : new ItemStack(FoodListMF.burnt_food); + dropItem(player, creation); + SkillList.provisioning.addXP(player, success ? 2 : 1); + return true; + } + } + return false; + } + + public void dropItem(EntityPlayer player, ItemStack item) { + EntityItem drop = new EntityItem(worldObj, player.posX, player.posY, player.posZ, item); + drop.delayBeforeCanPickup = 0; + drop.motionX = drop.motionY = drop.motionZ = 0; + worldObj.spawnEntityInWorld(drop); + } + + public boolean hasBlockAbove() { + if (worldObj == null) + return false; + + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); + if (tile != null && tile instanceof IHeatUser) { + return ((IHeatUser) tile).canAccept(this); + } + + return false; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityForge.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityForge.java index 77f13f37..4f0af98c 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityForge.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityForge.java @@ -1,8 +1,5 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.crafting.IBasicMetre; @@ -16,6 +13,7 @@ import minefantasy.mf2.block.refining.BlockForge; import minefantasy.mf2.item.heatable.ItemHeated; import minefantasy.mf2.item.list.ComponentListMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.ForgePacket; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -29,702 +27,600 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.WorldServer; -public class TileEntityForge extends TileEntity implements IInventory, IBasicMetre, IHeatSource, IBellowsUseable -{ - private ItemStack[] inv = new ItemStack[1]; - public float fuel; - public float maxFuel = 6000;//5m - public float temperature, fuelTemperature; - public static final float maxTemperature = 5000; - private Random rand = new Random(); - private int ticksExisted; - public float dragonHeartPower = 0F; - public String texTypeForRender = "stone"; - private boolean isBurning = false; - public int workableState = 0; - - public TileEntityForge(Block block, String type) - { - texTypeForRender = type; - blockType = block; - blockMetadata = 0; - } - - public TileEntityForge() { - } - - @Override - public void updateEntity() - { - ++ticksExisted; - - if(worldObj.isRemote)return; - - if(justShared > 0)--justShared; - super.updateEntity(); - - if(ticksExisted % 20 == 0) - { - ItemStack item = getStackInSlot(0); - if(item != null && !worldObj.isRemote) - { - modifyItem(item, 0); - } - syncData(); - } - if (ticksExisted % 10 == 0) { - shareTemp(); - } - - if(!isLit() && !worldObj.isRemote) - { - if(temperature > 0 && ticksExisted % 5 == 0) - { - temperature = 0; - } - return; - } - tickFuel(); - if(fuel <= 0) - { - this.extinguish(); - return; - } - isBurning = isBurning();//Check if it's burning - float maxTemp = isLit() ? (fuelTemperature + getUnderTemperature()) : 0; - - if(temperature < maxTemp) - { - float amount = 2.0F; - temperature += amount; - if(temperature > maxTemp) - { - temperature = maxTemp; - } - } - else if(temperature > maxTemp && rand.nextInt(20) == 0) - { - temperature -= 10; - } - - if(isBurning && temperature > 250 && rand.nextInt(20) == 0 && !isOutside()) - { - int val = this.getTier() == 1 ? 3 : 1; - if(this.hasBlockAbove()) - { - SmokeMechanics.emitSmokeIndirect(worldObj, xCoord, yCoord+1, zCoord, val); - } - else - { - SmokeMechanics.emitSmokeIndirect(worldObj, xCoord, yCoord, zCoord, val); - } - } - maxFuel = getTier() == 1 ? 12000 : 6000; - } - private boolean isOutside() - { - for(int x = -1; x <= 1; x++) - { - for(int y = -1; y <= 1; y++) - { - if(!worldObj.canBlockSeeTheSky(xCoord + x, yCoord+1, zCoord + y)) - { - return false; - } - } - } - return true; - } - public boolean isLit; - private void shareTemp() - { - isLit = isLit(); - shareTo(-1, 0); - shareTo(1, 0); - shareTo(0, -1); - shareTo(0, 1); - } - - private void shareTo(int x, int z) - { - if (fuel <= 0) - return; - - int share = 2; - TileEntity tile = worldObj.getTileEntity(xCoord + x, yCoord, zCoord + z); - if (tile == null) - return; - - if (tile instanceof TileEntityForge) - { - TileEntityForge forge = (TileEntityForge) tile; - - if (isLit && !forge.isLit && forge.fuel > 0) - { - forge.fireUpForge(); - } - if (!forge.isBurning() && temperature > 1) - { - forge.temperature = 1; - } - if (forge.temperature < (temperature - share)) { - forge.temperature += share; - temperature -= share; - } - share = 1200; - if (forge.fuel < (fuel - share)) { - forge.fuel += share; - fuel -= share; - } - } - } +import java.util.Random; - private void tickFuel() - { - if(fuel > 0) - { - fuel -= 0.2F; - } - - if(fuel < 0)fuel = 0; - } - - private boolean isBurning() - { - return fuel > 0 && temperature > 0; - } - @SideOnly(Side.CLIENT) - private boolean shouldRenderFlame() - { - return fuel > 0 && temperature > 1; - } - - private void modifyItem(ItemStack item, int slot) - { - if(item.getItem() == ComponentListMF.hotItem) - { - int temp = ItemHeated.getTemp(item); - if(temp > temperature) - { - int i = (int)(temperature/5F); - temp -= i; - } - else - { - int increase = (int)(temperature / (20F*getStackModifier(item.stackSize))); - if(temp >= (temperature-increase)) - { - temp = (int) temperature; - } - else - { - temp += increase; - } - } - if(temp <= 0) - { - //this.setInventorySlotContents(slot, ItemHeated.getItem(item)); - } - else - { - ItemHeated.setTemp(item, Math.max(0, temp)); - } - } - else if(temperature > 0) - { - this.setInventorySlotContents(slot, ItemHeated.createHotItem(item)); - - } - } - - private float getStackModifier(int stackSize) - { - float mod = 1F + (float)stackSize / 16F;//1x to 5x - return mod; - } - - public int getTier() - { - Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - if(block != null && block instanceof BlockForge) - { - return ((BlockForge)block).tier; - } - return 0; - } - public float getUnderTemperature() - { - Block under = worldObj.getBlock(xCoord, yCoord-1, zCoord); - - if(under.getMaterial() == Material.fire) - { - return 50F; - } - if(under.getMaterial() == Material.lava) - { - return 100F; - } - return 0F; - } - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setFloat("temperature", temperature); - nbt.setFloat("fuelTemperature", fuelTemperature); - nbt.setFloat("dragonHeartPower", dragonHeartPower); - nbt.setFloat("fuel", fuel); - nbt.setFloat("maxFuel", maxFuel); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.inv.length; ++i) - { - if (this.inv[i] != null) - { +public class TileEntityForge extends TileEntity implements IInventory, IBasicMetre, IHeatSource, IBellowsUseable { + public static final float maxTemperature = 5000; + public float fuel; + public float maxFuel = 6000;// 5m + public float temperature, fuelTemperature; + public float dragonHeartPower = 0F; + public String texTypeForRender = "stone"; + public int workableState = 0; + public boolean isLit; + public int exactTemperature; + int justShared; + private ItemStack[] inv = new ItemStack[1]; + private Random rand = new Random(); + private int ticksExisted; + private boolean isBurning = false; + + public TileEntityForge(Block block, String type) { + texTypeForRender = type; + blockType = block; + blockMetadata = 0; + } + + public TileEntityForge() { + } + + @Override + public void updateEntity() { + ++ticksExisted; + + if (worldObj.isRemote) + return; + + if (justShared > 0) + --justShared; + super.updateEntity(); + + if (ticksExisted % 20 == 0) { + ItemStack item = getStackInSlot(0); + if (item != null && !worldObj.isRemote) { + modifyItem(item, 0); + } + syncData(); + } + if (ticksExisted % 10 == 0) { + shareTemp(); + } + + if (!isLit() && !worldObj.isRemote) { + if (temperature > 0 && ticksExisted % 5 == 0) { + temperature = 0; + } + return; + } + tickFuel(); + if (fuel <= 0) { + this.extinguish(); + return; + } + isBurning = isBurning();// Check if it's burning + float maxTemp = isLit() ? (fuelTemperature + getUnderTemperature()) : 0; + + if (temperature < maxTemp) { + float amount = 2.0F; + temperature += amount; + if (temperature > maxTemp) { + temperature = maxTemp; + } + } else if (temperature > maxTemp && rand.nextInt(20) == 0) { + temperature -= 10; + } + + if (isBurning && temperature > 250 && rand.nextInt(20) == 0 && !isOutside()) { + int val = this.getTier() == 1 ? 3 : 1; + if (this.hasBlockAbove()) { + SmokeMechanics.emitSmokeIndirect(worldObj, xCoord, yCoord + 1, zCoord, val); + } else { + SmokeMechanics.emitSmokeIndirect(worldObj, xCoord, yCoord, zCoord, val); + } + } + maxFuel = getTier() == 1 ? 12000 : 6000; + } + + private boolean isOutside() { + for (int x = -1; x <= 1; x++) { + for (int y = -1; y <= 1; y++) { + if (!worldObj.canBlockSeeTheSky(xCoord + x, yCoord + 1, zCoord + y)) { + return false; + } + } + } + return true; + } + + private void shareTemp() { + isLit = isLit(); + shareTo(-1, 0); + shareTo(1, 0); + shareTo(0, -1); + shareTo(0, 1); + } + + private void shareTo(int x, int z) { + if (fuel <= 0) + return; + + int share = 2; + TileEntity tile = worldObj.getTileEntity(xCoord + x, yCoord, zCoord + z); + if (tile == null) + return; + + if (tile instanceof TileEntityForge) { + TileEntityForge forge = (TileEntityForge) tile; + + if (isLit && !forge.isLit && forge.fuel > 0) { + forge.fireUpForge(); + } + if (!forge.isBurning() && temperature > 1) { + forge.temperature = 1; + } + if (forge.temperature < (temperature - share)) { + forge.temperature += share; + temperature -= share; + } + share = 1200; + if (forge.fuel < (fuel - share)) { + forge.fuel += share; + fuel -= share; + } + } + } + + private void tickFuel() { + if (fuel > 0) { + fuel -= 0.2F; + } + + if (fuel < 0) + fuel = 0; + } + + private boolean isBurning() { + return fuel > 0 && temperature > 0; + } + + @SideOnly(Side.CLIENT) + private boolean shouldRenderFlame() { + return fuel > 0 && temperature > 1; + } + + private void modifyItem(ItemStack item, int slot) { + if (item.getItem() == ComponentListMF.hotItem) { + int temp = ItemHeated.getTemp(item); + if (temp > temperature) { + int i = (int) (temperature / 5F); + temp -= i; + } else { + int increase = (int) (temperature / (20F * getStackModifier(item.stackSize))); + if (temp >= (temperature - increase)) { + temp = (int) temperature; + } else { + temp += increase; + } + } + if (temp <= 0) { + // this.setInventorySlotContents(slot, ItemHeated.getItem(item)); + } else { + ItemHeated.setTemp(item, Math.max(0, temp)); + } + } else if (temperature > 0) { + this.setInventorySlotContents(slot, ItemHeated.createHotItem(item)); + + } + } + + private float getStackModifier(int stackSize) { + float mod = 1F + stackSize / 16F;// 1x to 5x + return mod; + } + + public int getTier() { + Block block = worldObj.getBlock(xCoord, yCoord, zCoord); + if (block != null && block instanceof BlockForge) { + return ((BlockForge) block).tier; + } + return 0; + } + + public float getUnderTemperature() { + Block under = worldObj.getBlock(xCoord, yCoord - 1, zCoord); + + if (under.getMaterial() == Material.fire) { + return 50F; + } + if (under.getMaterial() == Material.lava) { + return 100F; + } + return 0F; + } + // INVENTORY + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setFloat("temperature", temperature); + nbt.setFloat("fuelTemperature", fuelTemperature); + nbt.setFloat("dragonHeartPower", dragonHeartPower); + nbt.setFloat("fuel", fuel); + nbt.setFloat("maxFuel", maxFuel); + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.inv.length; ++i) { + if (this.inv[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inv[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - temperature = nbt.getFloat("temperature"); - fuelTemperature = nbt.getFloat("fuelTemperature"); - dragonHeartPower = nbt.getFloat("dragonHeartPower"); - fuel = nbt.getFloat("fuel"); - maxFuel = nbt.getFloat("maxFuel"); - - NBTTagList savedItems = nbt.getTagList("Items", 10); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + temperature = nbt.getFloat("temperature"); + fuelTemperature = nbt.getFloat("fuelTemperature"); + dragonHeartPower = nbt.getFloat("dragonHeartPower"); + fuel = nbt.getFloat("fuel"); + maxFuel = nbt.getFloat("maxFuel"); + + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inv.length) - { + if (slotNum >= 0 && slotNum < this.inv.length) { this.inv[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } - } - //INVENTORY - - @Override - public int getSizeInventory() - { - return inv.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return inv[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - onInventoryChanged(); - if (this.inv[slot] != null) - { + } + + @Override + public int getSizeInventory() { + return inv.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inv[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + onInventoryChanged(); + if (this.inv[slot] != null) { ItemStack itemstack; - if (this.inv[slot].stackSize <= num) - { + if (this.inv[slot].stackSize <= num) { itemstack = this.inv[slot]; this.inv[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.inv[slot].splitStack(num); - if (this.inv[slot].stackSize == 0) - { + if (this.inv[slot].stackSize == 0) { this.inv[slot] = null; } return itemstack; } + } else { + return null; } - else - { + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return inv[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + onInventoryChanged(); + inv[slot] = item; + } + + public void onInventoryChanged() { + } + + @Override + public String getInventoryName() { + return "gui.crucible.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + return true; + } + + public BlockForge getActiveBlock() { + if (worldObj == null) return null; + + Block block = worldObj.getBlock(xCoord, yCoord, zCoord); + + if (block != null && block instanceof BlockForge) { + return (BlockForge) block; } + return null; } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return inv[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - onInventoryChanged(); - inv[slot] = item; - } - - public void onInventoryChanged() - { - } - - @Override - public String getInventoryName() - { - return "gui.crucible.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - return true; - } - - public BlockForge getActiveBlock() - { - if(worldObj == null)return null; - - Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - - if(block != null && block instanceof BlockForge) - { - return (BlockForge)block; - } - return null; - } - @SideOnly(Side.CLIENT) - public String getTextureName() - { - BlockForge forge = getActiveBlock(); - if(forge == null)return "forge_"+texTypeForRender; - - return "forge_" + forge.type + (shouldRenderFlame() ? "_active" : ""); - } - - public boolean hasFuel() - { - return worldObj != null && fuel > 0; - } - - public boolean isLit() - { - BlockForge forge = getActiveBlock(); - return forge != null && forge.isActive; - } - - /** - * Puts the fire out - */ - public void extinguish() - { - if(getTier() == 1) - { - return; - } - BlockForge.updateFurnaceBlockState(false, worldObj, xCoord, yCoord, zCoord); - } - /** - * Fires the forge up - */ - public void fireUpForge() - { - if(getTier() == 1) - { - return; - } - BlockForge.updateFurnaceBlockState(true, worldObj, xCoord, yCoord, zCoord); - } - - public float getBellowsEffect() - { - return getTier() == 1 ? 2.0F : 1.5F; - } - private float getBellowsMax() - { - return Math.min(fuelTemperature*getBellowsEffect(), getMaxTemp()); - } - public int getMaxTemp() - { - return (int) maxTemperature; - } - public boolean addFuel(ForgeFuel stats, boolean hand, int tier) - { - maxFuel = tier == 1 ? 12000 : 6000; - - boolean hasUsed = false; - - if(stats.baseHeat > this.fuelTemperature) // uses if hotter - { - hasUsed = true; - } - int room_left = (int) (maxFuel - fuel); - if(hand && room_left > 0) - { - hasUsed = true; - fuel = Math.min(fuel + stats.duration, maxFuel);//Fill as much as can fit - } - else if(!hand && (fuel == 0 || room_left >= stats.duration))//For hoppers: only fill when there's full room - { - hasUsed = true; - fuel = Math.min(fuel + stats.duration, maxFuel);//Fill as much as can fit - } - if(stats.doesLight && !isLit()) - { - fireUpForge(); - hasUsed = true; - } - if(hasUsed) - { - fuelTemperature = stats.baseHeat; - } - return hasUsed; - } - - @Override - public int getMetreScale(int size) - { - if(shouldShowMetre()) - { - return (int)((float)size / maxFuel * fuel); - } - return 0; - } - - public int[] getTempsScaled(int size) - { - int[] temps = new int[2]; - if(shouldShowMetre()) - { - temps[0] = (int)((float)size / this.maxTemperature * this.temperature); - temps[1] = (int)((float)size / this.maxTemperature * this.fuelTemperature); - } - if(temps[0] > size)temps[0] = size; - if(temps[1] > size)temps[1] = size; - return temps; - } - - @Override - public boolean shouldShowMetre() - { - return true; - } - - @Override - public String getLocalisedName() - { - return (int)this.temperature+"C " + StatCollector.translateToLocal(workableState >= 2 ? "state.unstable" : workableState == 1 ? "state.workable" : "forge.fuel.name"); - } - - public boolean[] showSides() { - if (worldObj == null) { - return new boolean[] { true, true, true, true }; - } - boolean front = !isForge(0, 0, 1); - boolean left = !isForge(-1, 0, 0); - boolean right = !isForge(1, 0, 0); - boolean back = !isForge(0, 0, -1); - - return new boolean[] { front, left, right, back }; - } - - private boolean isForge(int x, int y, int z) { - return worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z) instanceof BlockForge; - } - public void syncData() - { - - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { - EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new ForgePacket(this).generatePacket()); - } - } - int justShared; - public void onUsedWithBellows(float powerLevel) - { - if(!isBurning())return; - if(justShared > 0) - { - return; - } - if(fuel <= 0) - { - return; - } - float max = getBellowsMax(); - justShared = 5; - if(temperature < max) + @SideOnly(Side.CLIENT) + public String getTextureName() { + BlockForge forge = getActiveBlock(); + if (forge == null) + return "forge_" + texTypeForRender; + + return "forge_" + forge.type + (shouldRenderFlame() ? "_active" : ""); + } + + public boolean hasFuel() { + return worldObj != null && fuel > 0; + } + + public boolean isLit() { + BlockForge forge = getActiveBlock(); + return forge != null && forge.isActive; + } + + /** + * Puts the fire out + */ + public void extinguish() { + if (getTier() == 1) { + return; + } + BlockForge.updateFurnaceBlockState(false, worldObj, xCoord, yCoord, zCoord); + } + + /** + * Fires the forge up + */ + public void fireUpForge() { + if (getTier() == 1) { + return; + } + BlockForge.updateFurnaceBlockState(true, worldObj, xCoord, yCoord, zCoord); + } + + public float getBellowsEffect() { + return getTier() == 1 ? 2.0F : 1.5F; + } + + private float getBellowsMax() { + return Math.min(fuelTemperature * getBellowsEffect(), getMaxTemp()); + } + + public int getMaxTemp() { + return (int) maxTemperature; + } + + public boolean addFuel(ForgeFuel stats, boolean hand, int tier) { + maxFuel = tier == 1 ? 12000 : 6000; + + boolean hasUsed = false; + + if (stats.baseHeat > this.fuelTemperature) // uses if hotter { - temperature = Math.min(max, temperature + (500F*powerLevel)); + hasUsed = true; } - - for(int a = 0; a < 10; a ++) - { - worldObj.spawnParticle("flame", xCoord+(rand.nextDouble()*0.8D)+0.1D, yCoord + 0.4D, zCoord+(rand.nextDouble()*0.8D)+0.1D, 0, 0.01, 0); - } - - pumpBellows(-1, 0, powerLevel*0.9F); - pumpBellows(0, -1, powerLevel*0.9F); - pumpBellows(0, 1, powerLevel*0.9F); - pumpBellows(1, 0, powerLevel*0.9F); - - } - - private void pumpBellows(int x, int z, float pump) - { - if(fuel <= 0)return; - - int share = 2; - TileEntity tile = worldObj.getTileEntity(xCoord+x, yCoord, zCoord+z); - if(tile == null)return; - - if(tile instanceof TileEntityForge) - { - TileEntityForge forge = (TileEntityForge)tile; - forge.onUsedWithBellows(pump); - } - } + int room_left = (int) (maxFuel - fuel); + if (hand && room_left > 0) { + hasUsed = true; + fuel = Math.min(fuel + stats.duration, maxFuel);// Fill as much as can fit + } else if (!hand && (fuel == 0 || room_left >= stats.duration))// For hoppers: only fill when there's full room + { + hasUsed = true; + fuel = Math.min(fuel + stats.duration, maxFuel);// Fill as much as can fit + } + if (stats.doesLight && !isLit()) { + fireUpForge(); + hasUsed = true; + } + if (hasUsed) { + fuelTemperature = stats.baseHeat; + } + return hasUsed; + } + + @Override + public int getMetreScale(int size) { + if (shouldShowMetre()) { + return (int) (size / maxFuel * fuel); + } + return 0; + } + + public int[] getTempsScaled(int size) { + int[] temps = new int[2]; + if (shouldShowMetre()) { + temps[0] = (int) (size / this.maxTemperature * this.temperature); + temps[1] = (int) (size / this.maxTemperature * this.fuelTemperature); + } + if (temps[0] > size) + temps[0] = size; + if (temps[1] > size) + temps[1] = size; + return temps; + } + + @Override + public boolean shouldShowMetre() { + return true; + } + + @Override + public String getLocalisedName() { + return (int) this.temperature + "C " + StatCollector.translateToLocal( + workableState >= 2 ? "state.unstable" : workableState == 1 ? "state.workable" : "forge.fuel.name"); + } + + public boolean[] showSides() { + if (worldObj == null) { + return new boolean[]{true, true, true, true}; + } + boolean front = !isForge(0, 0, 1); + boolean left = !isForge(-1, 0, 0); + boolean right = !isForge(1, 0, 0); + boolean back = !isForge(0, 0, -1); + + return new boolean[]{front, left, right, back}; + } + + private boolean isForge(int x, int y, int z) { + return worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z) instanceof BlockForge; + } + + private void syncData() { + + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new ForgePacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); - public float getBlockTemperature() - { - if(this.isLit) - { - return temperature; - } - return 0; - } - - public boolean hasBlockAbove() - { - if(worldObj == null)return false; - - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord+1, zCoord); - if(tile != null && tile instanceof IHeatUser) - { - return ((IHeatUser)tile).canAccept(this); - } - - return tile != null && tile instanceof TileEntityFurnace; - } - - private void averageAllItems() - { /* - int temp = 0; - int items = 0; - for(ItemStack item: inv) - { - if(item != null && item.getItem() instanceof IHotItem) - { - ++items; - temp += ItemHeated.getTemp(item); - } - } - int average = (int)((float)temp / items); - for(ItemStack item: inv) - { - if(item != null && item.getItem() instanceof IHotItem) - { - ItemHeated.setTemp(item, average); - } + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { + EntityPlayer player = players.get(i); + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, new ForgePacket(this).generatePacket()); } */ - } - - public boolean tryAddHeatable(ItemStack held) - { - ItemStack contents = inv[0]; - if(contents == null) - { - ItemStack placed = held.copy(); - placed.stackSize = 1; - setInventorySlotContents(0, placed); - return true; - } - else if(contents.getItem() instanceof ItemHeated) - { - ItemStack hot = Heatable.getItem(contents); - if(hot != null && hot.isItemEqual(held) && ItemStack.areItemStackTagsEqual(held, hot) && contents.stackSize < contents.getMaxStackSize()) - { - contents.stackSize ++; - return true; - } - } - return false; - } - - public int getWorkableState() - { - if(worldObj == null || worldObj.isRemote) - { - return workableState; - } - if(this.inv[0] != null) - { - return (int)Heatable.getHeatableStage(inv[0]); - } - return 0; - } - - @Override - public boolean canPlaceAbove() - { - return true; - } - - public int exactTemperature; - @Override - public int getHeat() - { - if(worldObj.isRemote) - { - return exactTemperature; - } - int mx = (int)(temperature*1.2F); - int mn = (int)(temperature*0.8F); - return Functions.getIntervalWave1_i(ticksExisted, 400, mx, mn); - } + } + + public void onUsedWithBellows(float powerLevel) { + if (!isBurning()) + return; + if (justShared > 0) { + return; + } + if (fuel <= 0) { + return; + } + float max = getBellowsMax(); + justShared = 5; + if (temperature < max) { + temperature = Math.min(max, temperature + (500F * powerLevel)); + } + + for (int a = 0; a < 10; a++) { + worldObj.spawnParticle("flame", xCoord + (rand.nextDouble() * 0.8D) + 0.1D, yCoord + 0.4D, + zCoord + (rand.nextDouble() * 0.8D) + 0.1D, 0, 0.01, 0); + } + + pumpBellows(-1, 0, powerLevel * 0.9F); + pumpBellows(0, -1, powerLevel * 0.9F); + pumpBellows(0, 1, powerLevel * 0.9F); + pumpBellows(1, 0, powerLevel * 0.9F); + + } + + private void pumpBellows(int x, int z, float pump) { + if (fuel <= 0) + return; + + // int share = 2; + TileEntity tile = worldObj.getTileEntity(xCoord + x, yCoord, zCoord + z); + if (tile == null) + return; + + if (tile instanceof TileEntityForge) { + TileEntityForge forge = (TileEntityForge) tile; + forge.onUsedWithBellows(pump); + } + } + + public float getBlockTemperature() { + if (this.isLit) { + return temperature; + } + return 0; + } + + /* + * private void averageAllItems() { /* int temp = 0; int items = 0; + * for(ItemStack item: inv) { if(item != null && item.getItem() instanceof + * IHotItem) { ++items; temp += ItemHeated.getTemp(item); } } int average = + * (int)((float)temp / items); for(ItemStack item: inv) { if(item != null && + * item.getItem() instanceof IHotItem) { ItemHeated.setTemp(item, average); } } + * } + */ + + public boolean hasBlockAbove() { + if (worldObj == null) + return false; + + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); + if (tile != null && tile instanceof IHeatUser) { + return ((IHeatUser) tile).canAccept(this); + } + + return tile != null && tile instanceof TileEntityFurnace; + } + + public boolean tryAddHeatable(ItemStack held) { + ItemStack contents = inv[0]; + if (contents == null) { + ItemStack placed = held.copy(); + placed.stackSize = 1; + setInventorySlotContents(0, placed); + return true; + } else if (contents.getItem() instanceof ItemHeated) { + ItemStack hot = Heatable.getItem(contents); + if (hot != null && hot.isItemEqual(held) && ItemStack.areItemStackTagsEqual(held, hot) + && contents.stackSize < contents.getMaxStackSize()) { + contents.stackSize++; + return true; + } + } + return false; + } + + public int getWorkableState() { + if (worldObj == null || worldObj.isRemote) { + return workableState; + } + if (this.inv[0] != null) { + return Heatable.getHeatableStage(inv[0]); + } + return 0; + } + + @Override + public boolean canPlaceAbove() { + return true; + } + + @Override + public int getHeat() { + if (worldObj.isRemote) { + return exactTemperature; + } + int mx = (int) (temperature * 1.2F); + int mn = (int) (temperature * 0.8F); + return Functions.getIntervalWave1_i(ticksExisted, 400, mx, mn); + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityQuern.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityQuern.java index 484f4425..b4c7031d 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityQuern.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityQuern.java @@ -1,7 +1,5 @@ package minefantasy.mf2.block.tileentity; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.crafting.refine.QuernRecipes; @@ -14,289 +12,246 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -public class TileEntityQuern extends TileEntity implements IInventory, ISidedInventory -{ - private ItemStack[] inv = new ItemStack[3]; - - private Random rand = new Random(); - - @Override - public void updateEntity() - { - int max = getMaxRevs(); - int levels = max/4; - - if(postUseTicks > 0) - { - --postUseTicks; - } - if(postUseTicks > 0 || !((turnAngle == levels || turnAngle == levels*2 || turnAngle == levels*3 || turnAngle == 0))) - { - this.turnAngle ++; - if(!worldObj.isRemote && (turnAngle == levels || turnAngle == levels*2 || turnAngle == levels*3 || turnAngle == max)) - { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "minefantasy2:block.quern", 1.0F, 1.0F); - onRevolutionComplete(); - } - if(turnAngle >= max) - { - turnAngle = 0; - } - } - } - public static final int getMaxRevs() - { - return 100; - } - public boolean onUse(EntityPlayer user) - { - if(!worldObj.isRemote && turnAngle == 0 && postUseTicks == 0) - { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "minefantasy2:block.quern", 1.0F, 1.0F); - } - this.postUseTicks = 10; - return true; - } - public boolean onRevolutionComplete() - { - QuernRecipes result = this.getResult(inv[0]); - if(result != null && inv[1] != null && result.tier <= getTier()) - { - ItemStack craft = result.result; - if(canFitResult(craft)) - { - if(!worldObj.isRemote) - { - return tryCraft(craft); - } - else - { - worldObj.spawnParticle("smoke", xCoord+0.5F, yCoord+1F, zCoord+0.5F, 0F, 0.2F, 0F); - return true; - } - } - } - - return false; - } - private int getTier() - { - return 0; - } - private boolean canFitResult(ItemStack result) - { - ItemStack out = inv[2]; - if(out == null)return true; - - if(!out.isItemEqual(result))return false; - if(out.stackSize + result.stackSize > result.getMaxStackSize())return false; - - return true; - } - private boolean tryCraft(ItemStack result) - { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "minefantasy2:block.craftprimitive", 0.5F, 1.2F); - /* - if(rand.nextFloat() > 0.20F)//20% success rate - { - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "dig.gravel", 1.0F, 0.5F); - return false; - } - else - */ - { - this.decrStackSize(0, 1); - this.decrStackSize(1, 1); - - ItemStack out = inv[2]; - if(out == null) - { - this.setInventorySlotContents(2, result.copy()); - } - else - { - out.stackSize += result.stackSize; - } - return true; - } - } - @Override - public int getSizeInventory() - { - return inv.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return inv[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - if (this.inv[slot] != null) - { +public class TileEntityQuern extends TileEntity implements IInventory, ISidedInventory { + public int turnAngle; + private ItemStack[] inv = new ItemStack[3]; //0 input, 1 pot, 2 output + private int postUseTicks; + + public static final int getMaxRevs() { + return 100; + } + + public static boolean isInput(ItemStack input) { + return getResult(input) != null; + } + + private static QuernRecipes getResult(ItemStack input) { + return QuernRecipes.getResult(input); + } + + public static boolean isPot(ItemStack item) { + return item != null && item.getItem() == ComponentListMF.clay_pot; + } + + @Override + public void updateEntity() { + int max = getMaxRevs(); + int levels = max / 4; + + if (postUseTicks > 0) { + --postUseTicks; + } + if (postUseTicks > 0 + || !((turnAngle == levels || turnAngle == levels * 2 || turnAngle == levels * 3 || turnAngle == 0))) { + this.turnAngle++; + if (!worldObj.isRemote && (turnAngle == levels || turnAngle == levels * 2 || turnAngle == levels * 3 + || turnAngle == max)) { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "minefantasy2:block.quern", 1.0F, 1.0F); + onRevolutionComplete(); + } + if (turnAngle >= max) { + turnAngle = 0; + } + } + } + + public boolean onUse(EntityPlayer user) { + if (!worldObj.isRemote && turnAngle == 0 && postUseTicks == 0) { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "minefantasy2:block.quern", 1.0F, 1.0F); + } + this.postUseTicks = 10; + return true; + } + + public boolean onRevolutionComplete() { + QuernRecipes result = this.getResult(inv[0]); + if (result != null && (!result.consumePot || inv[1] != null) && result.tier <= getTier()) { + ItemStack craft = result.result; + if (canFitResult(craft)) { + if (!worldObj.isRemote) { + return tryCraft(craft, result.consumePot); + } else { + worldObj.spawnParticle("smoke", xCoord + 0.5F, yCoord + 1F, zCoord + 0.5F, 0F, 0.2F, 0F); + return true; + } + } + } + + return false; + } + + private int getTier() { + return 0; + } + + private boolean canFitResult(ItemStack result) { + ItemStack out = inv[2]; + if (out == null) + return true; + + if (!out.isItemEqual(result)) + return false; + if (out.stackSize + result.stackSize > result.getMaxStackSize()) + return false; + + return true; + } + + private boolean tryCraft(ItemStack result, boolean consumePot) { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "minefantasy2:block.craftprimitive", 0.5F, 1.2F); + /* + * if(rand.nextFloat() > 0.20F)//20% success rate { + * worldObj.playSoundEffect(xCoord, yCoord, zCoord, "dig.gravel", 1.0F, 0.5F); + * return false; } else + */ + + this.decrStackSize(0, 1); + if (consumePot) { + this.decrStackSize(1, 1); + } + ItemStack out = inv[2]; + if (out == null) { + this.setInventorySlotContents(2, result.copy()); + } else { + out.stackSize += result.stackSize; + } + return true; + + } + + @Override + public int getSizeInventory() { + return inv.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return inv[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + if (this.inv[slot] != null) { ItemStack itemstack; - if (this.inv[slot].stackSize <= num) - { + if (this.inv[slot].stackSize <= num) { itemstack = this.inv[slot]; this.inv[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.inv[slot].splitStack(num); - if (this.inv[slot].stackSize == 0) - { + if (this.inv[slot].stackSize == 0) { this.inv[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return inv[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - inv[slot] = item; - } - - @Override - public String getInventoryName() - { - return "gui.quern.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - if(item != null && getResult(item) != null) - { - return slot == 0; - } - if(item != null && item.getItem() == ComponentListMF.clay_pot) - { - return slot == 1; - } - return false; - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - NBTTagList savedItems = nbt.getTagList("Items", 10); + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return inv[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + inv[slot] = item; + } + + @Override + public String getInventoryName() { + return "gui.quern.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + if (item != null && getResult(item) != null) { + return slot == 0; + } + if (item != null && item.getItem() == ComponentListMF.clay_pot) { + return slot == 1; + } + return false; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inv.length) - { + if (slotNum >= 0 && slotNum < this.inv.length) { this.inv[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.inv.length; ++i) - { - if (this.inv[i] != null) - { + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.inv.length; ++i) { + if (this.inv[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inv[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - } - - public static boolean isInput(ItemStack input) - { - return getResult(input) != null; - } - - private static QuernRecipes getResult(ItemStack input) - { - return QuernRecipes.getResult(input); - } - @SideOnly(Side.CLIENT) - public String getTextureName() - { - return "quern_basic"; - } - public static boolean isPot(ItemStack item) - { - return item != null && item.getItem() == ComponentListMF.clay_pot; - } - private int postUseTicks; - public int turnAngle; - - @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return new int[]{0, 1, 2}; - } - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) - { - return isItemValidForSlot(slot, item); - } - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) - { - return slot == 2; - } + } + + @SideOnly(Side.CLIENT) + public String getTextureName() { + return "quern_basic"; + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) { + return new int[]{0, 1, 2}; + } + + @Override + public boolean canInsertItem(int slot, ItemStack item, int side) { + return isItemValidForSlot(slot, item); + } + + @Override + public boolean canExtractItem(int slot, ItemStack item, int side) { + return slot == 2; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityResearch.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityResearch.java index 0ccb4526..320a6c68 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityResearch.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityResearch.java @@ -1,15 +1,12 @@ package minefantasy.mf2.block.tileentity; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import minefantasy.mf2.api.crafting.IBasicMetre; import minefantasy.mf2.api.knowledge.IArtefact; import minefantasy.mf2.api.knowledge.InformationBase; import minefantasy.mf2.api.knowledge.ResearchArtefacts; import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.item.list.ComponentListMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.ResearchTablePacket; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -21,354 +18,310 @@ import net.minecraft.util.ChatComponentTranslation; import net.minecraft.world.WorldServer; -public class TileEntityResearch extends TileEntity implements IInventory, IBasicMetre -{ - private ItemStack[] items = new ItemStack[1]; - public float progress; - public float maxProgress; - public int researchID = -1; - - public boolean interact(EntityPlayer user) - { - if(worldObj.isRemote) - { - return true; - } - ArrayList research = this.getInfo(items[0]); - int result = canResearch(user, research); - - if(research != null && research.size() > 0 && result != 0) - { - if(result == -1) - { - if(!user.worldObj.isRemote) - user.addChatComponentMessage(new ChatComponentTranslation("research.noskill", new Object[0])); - return true; - } - maxProgress = getMaxTime(); - if(maxProgress > 0) - { - addProgress(user); - - if(progress >= maxProgress) - { - addResearch(research, user); - progress = 0; - } - - return true; - } - } - else - { - if(result == 0) - { - if(!user.worldObj.isRemote) - user.addChatComponentMessage(new ChatComponentTranslation("research.null", new Object[0])); - } - progress = 0; - } - - return items[0] != null; - } - private void addResearch(ArrayList research, EntityPlayer user) - { - for(int id = 0; id < research.size(); id++) - { - InformationBase base = ResearchLogic.getResearch(research.get(id)); - if(base != null && !ResearchLogic.alreadyUsedArtefact(user, base, items[0]) && ResearchLogic.canPurchase(user, base) && base.hasSkillsUnlocked(user)) - { - int artefacts = ResearchArtefacts.useArtefact(items[0], base, user); - worldObj.playSoundEffect(xCoord+0.5, yCoord+0.5, zCoord+0.5, "minefantasy2:updateResearch", 1.0F, 1.0F); - if(!user.worldObj.isRemote) - { - Object name = new ChatComponentTranslation("knowledge."+base.getUnlocalisedName()); - if(artefacts == -1) - { - user.addChatComponentMessage(new ChatComponentTranslation("research.finishResearch", name)); - } - else - { - user.addChatComponentMessage(new ChatComponentTranslation("research.addArtefact", name, artefacts, base.getArtefactCount())); - } - } - return; - } - - } - } - //0 nothing, -1 for no skill, 1 for yes - private int canResearch(EntityPlayer user, ArrayList research) - { - if(research == null){return 0;} - int result = 0; - - for(int id = 0; id < research.size(); id++) - { - InformationBase base = ResearchLogic.getResearch(research.get(id)); - if(base != null && !ResearchLogic.alreadyUsedArtefact(user, base, items[0])) - { - if(ResearchLogic.canPurchase(user, base) && base.hasSkillsUnlocked(user)) - { - return 1; - } - else if (!ResearchLogic.hasInfoUnlocked(user, base)) - { - result = -1; - } - } - } - return result; - } - private float getMaxTime() - { - int t = 10; - if(items[0] != null && items[0].getItem() instanceof IArtefact) - { - return ((IArtefact)items[0].getItem()).getStudyTime(items[0]); - } - return this.getInfo(items[0]) != null ? t : 0; - } - private void addProgress(EntityPlayer user) - { - ItemStack held = user.getHeldItem(); - if(held != null && (held.getItem() == ComponentListMF.talisman_lesser || held.getItem() == ComponentListMF.talisman_greater)) - { - progress = maxProgress; - if(!user.capabilities.isCreativeMode && held.getItem() == ComponentListMF.talisman_lesser) - { - --held.stackSize; - if(held.stackSize <= 0) - { - user.setCurrentItemOrArmor(0, null); - } - } - return; - } - float efficiency = 1.0F; - if(user.swingProgress > 0) - { - efficiency *= Math.max(0F, 1.0F-user.swingProgress); - } - worldObj.playSoundEffect(xCoord+0.5, yCoord+0.5, zCoord+0.5, "minefantasy2:block.flipPage", 1.0F, rand.nextFloat()*0.4F+0.8F); - efficiency *= getEnvironmentBoost(); - progress += efficiency; - } - private float getEnvironmentBoost() - { - int books = 0; - for(int x = -8; x <= 8; x++) - { - for(int y = -8; y <= 8; y++) - { - for(int z = -8; z <= 8; z++) - { - if(worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z) == Blocks.bookshelf) - { - ++books; - } - } - } - } - return 1.0F + (0.1F*books); - } - private Random rand = new Random(); - - private int ticksExisted; - @Override - public void updateEntity() - { - super.updateEntity(); - - syncData(); - } - public void syncData() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { +import java.util.ArrayList; +import java.util.Random; + +public class TileEntityResearch extends TileEntity implements IInventory, IBasicMetre { + public float progress; + public float maxProgress; + public int researchID = -1; + private ItemStack[] items = new ItemStack[1]; + private Random rand = new Random(); + private int ticksExisted; + + public static ArrayList getInfo(ItemStack item) { + if (item == null) { + return null; + } + + return ResearchArtefacts.getResearchNames(item); + } + + public static boolean canAccept(ItemStack item) { + ArrayList info = getInfo(item); + return info != null && info.size() > 0; + } + + public boolean interact(EntityPlayer user) { + if (worldObj.isRemote) { + return true; + } + ArrayList research = this.getInfo(items[0]); + int result = canResearch(user, research); + + if (research != null && research.size() > 0 && result != 0) { + if (result == -1) { + if (!user.worldObj.isRemote) + user.addChatComponentMessage(new ChatComponentTranslation("research.noskill", new Object[0])); + return true; + } + maxProgress = getMaxTime(); + if (maxProgress > 0) { + addProgress(user); + + if (progress >= maxProgress) { + addResearch(research, user); + progress = 0; + } + + return true; + } + } else { + if (result == 0) { + if (!user.worldObj.isRemote) + user.addChatComponentMessage(new ChatComponentTranslation("research.null", new Object[0])); + } + progress = 0; + } + + return items[0] != null; + } + + private void addResearch(ArrayList research, EntityPlayer user) { + for (int id = 0; id < research.size(); id++) { + InformationBase base = ResearchLogic.getResearch(research.get(id)); + if (base != null && !ResearchLogic.alreadyUsedArtefact(user, base, items[0]) + && ResearchLogic.canPurchase(user, base) && base.hasSkillsUnlocked(user)) { + int artefacts = ResearchArtefacts.useArtefact(items[0], base, user); + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "minefantasy2:updateResearch", 1.0F, + 1.0F); + if (!user.worldObj.isRemote) { + Object name = new ChatComponentTranslation("knowledge." + base.getUnlocalisedName()); + if (artefacts == -1) { + user.addChatComponentMessage(new ChatComponentTranslation("research.finishResearch", name)); + } else { + user.addChatComponentMessage(new ChatComponentTranslation("research.addArtefact", name, + artefacts, base.getArtefactCount())); + } + } + return; + } + + } + } + + // 0 nothing, -1 for no skill, 1 for yes + private int canResearch(EntityPlayer user, ArrayList research) { + if (research == null) { + return 0; + } + int result = 0; + + for (int id = 0; id < research.size(); id++) { + InformationBase base = ResearchLogic.getResearch(research.get(id)); + if (base != null && !ResearchLogic.alreadyUsedArtefact(user, base, items[0])) { + if (ResearchLogic.canPurchase(user, base) && base.hasSkillsUnlocked(user)) { + return 1; + } else if (!ResearchLogic.hasInfoUnlocked(user, base)) { + result = -1; + } + } + } + return result; + } + + private float getMaxTime() { + int t = 10; + if (items[0] != null && items[0].getItem() instanceof IArtefact) { + return ((IArtefact) items[0].getItem()).getStudyTime(items[0]); + } + return this.getInfo(items[0]) != null ? t : 0; + } + + private void addProgress(EntityPlayer user) { + ItemStack held = user.getHeldItem(); + if (held != null && (held.getItem() == ComponentListMF.talisman_lesser + || held.getItem() == ComponentListMF.talisman_greater)) { + progress = maxProgress; + if (!user.capabilities.isCreativeMode && held.getItem() == ComponentListMF.talisman_lesser) { + --held.stackSize; + if (held.stackSize <= 0) { + user.setCurrentItemOrArmor(0, null); + } + } + return; + } + float efficiency = 1.0F; + if (user.swingProgress > 0) { + efficiency *= Math.max(0F, 1.0F - user.swingProgress); + } + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "minefantasy2:block.flipPage", 1.0F, + rand.nextFloat() * 0.4F + 0.8F); + efficiency *= getEnvironmentBoost(); + progress += efficiency; + } + + private float getEnvironmentBoost() { + int books = 0; + for (int x = -8; x <= 8; x++) { + for (int y = -8; y <= 8; y++) { + for (int z = -8; z <= 8; z++) { + if (worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z) == Blocks.bookshelf) { + ++books; + } + } + } + } + return 1.0F + (0.1F * books); + } + + @Override + public void updateEntity() { + super.updateEntity(); + + syncData(); + } + + public void syncData() { + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new ResearchTablePacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + + /* + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new ResearchTablePacket(this).generatePacket()); + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, + new ResearchTablePacket(this).generatePacket()); } - } - - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setInteger("researchID", researchID); - nbt.setInteger("ticksExisted", ticksExisted); - nbt.setFloat("progress", progress); - nbt.setFloat("maxProgress", maxProgress); - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.items.length; ++i) - { - if (this.items[i] != null) - { + */ + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setInteger("researchID", researchID); + nbt.setInteger("ticksExisted", ticksExisted); + nbt.setFloat("progress", progress); + nbt.setFloat("maxProgress", maxProgress); + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.items.length; ++i) { + if (this.items[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.items[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - ticksExisted = nbt.getInteger("ticksExisted"); - researchID = nbt.getInteger("researchID"); - progress = nbt.getFloat("progress"); - maxProgress = nbt.getFloat("maxProgress"); - NBTTagList savedItems = nbt.getTagList("Items", 10); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + ticksExisted = nbt.getInteger("ticksExisted"); + researchID = nbt.getInteger("researchID"); + progress = nbt.getFloat("progress"); + maxProgress = nbt.getFloat("maxProgress"); + NBTTagList savedItems = nbt.getTagList("Items", 10); this.items = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.items.length) - { + if (slotNum >= 0 && slotNum < this.items.length) { this.items[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } - } - - @Override - public int getSizeInventory() - { - return items.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return items[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - if (this.items[slot] != null) - { + } + + @Override + public int getSizeInventory() { + return items.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return items[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + if (this.items[slot] != null) { ItemStack itemstack; - if (this.items[slot].stackSize <= num) - { + if (this.items[slot].stackSize <= num) { itemstack = this.items[slot]; this.items[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.items[slot].splitStack(num); - if (this.items[slot].stackSize == 0) - { + if (this.items[slot].stackSize == 0) { this.items[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return items[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - items[slot] = item; - } - - @Override - public String getInventoryName() - { - return "gui.bombcraftmf.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - return canAccept(item); - } - public static ArrayList getInfo(ItemStack item) - { - if(item == null) - { - return null; - } - - return ResearchArtefacts.getResearchNames(item); - } - public static boolean canAccept(ItemStack item) - { - ArrayList info = getInfo(item); - return info != null && info.size() > 0; - } - - @Override - public int getMetreScale(int size) - { - if(maxProgress <= 0) - { - return 0; - } - return (int)Math.min(size, Math.ceil(size / maxProgress * progress)); - } - @Override - public boolean shouldShowMetre() - { - return maxProgress > 0; - } - @Override - public String getLocalisedName() - { - return ""; - } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return items[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + items[slot] = item; + } + + @Override + public String getInventoryName() { + return "gui.bombcraftmf.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + return canAccept(item); + } + + @Override + public int getMetreScale(int size) { + if (maxProgress <= 0) { + return 0; + } + return (int) Math.min(size, Math.ceil(size / maxProgress * progress)); + } + + @Override + public boolean shouldShowMetre() { + return maxProgress > 0; + } + + @Override + public String getLocalisedName() { + return ""; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityRoad.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityRoad.java index c5b30d45..47591d7e 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityRoad.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityRoad.java @@ -1,9 +1,7 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import minefantasy.mf2.MineFantasyII; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.RoadPacket; import net.minecraft.block.Block; import net.minecraft.client.entity.EntityClientPlayerMP; @@ -13,123 +11,112 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.WorldServer; -public class TileEntityRoad extends TileEntity -{ - public int[] surface = new int[]{0, 0}; - public boolean isLocked = false; - private int ticksExisted; - private Random rand = new Random(); - - public TileEntityRoad() - { - } - - @Override - public void updateEntity() - { - super.updateEntity(); - - ++ticksExisted; - if(!worldObj.isRemote) - { - if(ticksExisted % 1200 == 0) - { - sendPacketToClients(); - } - } - else if(ticksExisted == 20) - { - requestPacket(); - } - } - - public void setSurface(Block id, int meta) - { - if(worldObj == null) - { - return; - } - if(id == Blocks.grass) - { - id = Blocks.dirt; - } - worldObj.playSoundEffect(xCoord, yCoord, zCoord, "dig.grass", 0.5F, 1.0F); - surface[0] = Block.getIdFromBlock(id); - surface[1] = meta; - sendPacketToClients(); - refreshSurface(); - } - - public void sendPacketToClients() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { +import java.util.Random; + +public class TileEntityRoad extends TileEntity { + public int[] surface = new int[]{0, 0}; + public boolean isLocked = false; + private int ticksExisted; + private Random rand = new Random(); + + public TileEntityRoad() { + } + + @Override + public void updateEntity() { + super.updateEntity(); + + ++ticksExisted; + if (!worldObj.isRemote) { + if (ticksExisted % 1200 == 0) { + sendPacketToClients(); + } + } else if (ticksExisted == 20) { + requestPacket(); + } + } + + public void setSurface(Block id, int meta) { + if (worldObj == null) { + return; + } + if (id == Blocks.grass) { + id = Blocks.dirt; + } + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "dig.grass", 0.5F, 1.0F); + surface[0] = Block.getIdFromBlock(id); + surface[1] = meta; + sendPacketToClients(); + refreshSurface(); + } + + public void sendPacketToClients() { + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new RoadPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + + /* + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new RoadPacket(this).generatePacket()); - } - } - public void requestPacket() - { - if(!worldObj.isRemote)return; - EntityPlayer player = MineFantasyII.proxy.getClientPlayer(); - if(player != null) - { - ((EntityClientPlayerMP)player).sendQueue.addToSendQueue(new RoadPacket(this).request().generatePacket()); + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, new RoadPacket(this).generatePacket()); } - } - private boolean blockChange(int id, int meta) - { - if(id != surface[0])return true; - if(meta != surface[1])return true; - - return false; - } - - - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setIntArray("surface", surface); - nbt.setBoolean("isLocked", isLocked); + */ } - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - surface = nbt.getIntArray("surface"); - isLocked = nbt.getBoolean("isLocked"); + + public void requestPacket() { + if (!worldObj.isRemote) + return; + EntityPlayer player = MineFantasyII.proxy.getClientPlayer(); + if (player != null) { + ((EntityClientPlayerMP) player).sendQueue.addToSendQueue(new RoadPacket(this).request().generatePacket()); + } } - public int[] getSurface() - { - return surface; - } + private boolean blockChange(int id, int meta) { + if (id != surface[0]) + return true; + if (meta != surface[1]) + return true; - public boolean canBuild() - { - if(worldObj == null) - { - return false; - } - return true; - } - - public void refreshSurface() - { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - - public Block getBaseBlock() - { - if(surface[0] <= 0) - { - return Blocks.dirt; - } - Block block = Block.getBlockById(surface[0]); - return block != null ? block : Blocks.dirt; - } + return false; + } + + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setIntArray("surface", surface); + nbt.setBoolean("isLocked", isLocked); + } + + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + surface = nbt.getIntArray("surface"); + isLocked = nbt.getBoolean("isLocked"); + } + + public int[] getSurface() { + return surface; + } + + public boolean canBuild() { + if (worldObj == null) { + return false; + } + return true; + } + + public void refreshSurface() { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + public Block getBaseBlock() { + if (surface[0] <= 0) { + return Blocks.dirt; + } + Block block = Block.getBlockById(surface[0]); + return block != null ? block : Blocks.dirt; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityRoast.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityRoast.java index bbfc5409..4b1f7ee5 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityRoast.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityRoast.java @@ -1,8 +1,5 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.cooking.CookRecipe; @@ -10,6 +7,7 @@ import minefantasy.mf2.api.crafting.IHeatUser; import minefantasy.mf2.block.crafting.BlockRoast; import minefantasy.mf2.block.list.BlockListMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.TileInventoryPacket; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; @@ -22,374 +20,330 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.WorldServer; -public class TileEntityRoast extends TileEntity implements IInventory, IHeatUser -{ - public ItemStack[] items = new ItemStack[1]; - public float progress; - public float maxProgress; - private int tempTicksExisted = 0; - private Random rand = new Random(); - private int ticksExisted; - - public TileEntityRoast() - { - } - private CookRecipe recipe; - @Override - public void updateEntity() - { - super.updateEntity(); - ++tempTicksExisted; - if(tempTicksExisted == 10) - { - blockMetadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - updateRecipe(); - } - int temp = getTemp(); - ++ticksExisted; - if(ticksExisted % 20 == 0 && !worldObj.isRemote) - { - if(recipe != null && temp > 0 && maxProgress > 0 && temp > recipe.minTemperature) - { - if(enableOverheat && recipe.canBurn && temp > recipe.maxTemperature) - { - setInventorySlotContents(0, recipe.burnt.copy()); - updateRecipe(); - } - progress += (temp/100F); - if(progress >= maxProgress) - { - setInventorySlotContents(0, recipe.output.copy()); - updateRecipe(); - } - } - } - if(temp > 0 && worldObj.isRemote && rand.nextInt(20) == 0) - { - worldObj.spawnParticle("flame", xCoord+0.2F+(rand.nextFloat()*0.6F), yCoord+0.2F, zCoord+0.2F+(rand.nextFloat()*0.6F) - ,0F, 0F, 0F); - } - } - /** - * Enable high temperatures ruin cooking - */ - public static boolean enableOverheat = true; - - private int getTemp() - { - TileEntity tile = worldObj.getTileEntity(xCoord, yCoord-1, zCoord); - if(tile != null && tile instanceof IHeatSource) - { - return ((IHeatSource)tile).getHeat(); - } - return 0; - } - public TileEntityRoast setInventoryModel(String tex, boolean isOven) - { - this.isOvenTemp = isOven; - this.texname = tex; - return this; - } - private boolean isOvenTemp; - public boolean isOven() - { - if(worldObj == null)return isOvenTemp; - Block base = worldObj.getBlock(xCoord, yCoord, zCoord); - if(base instanceof BlockRoast) - { - return ((BlockRoast)base).isOven(); - } - return false; - } - public boolean interact(EntityPlayer player) - { - ItemStack held = player.getHeldItem(); - ItemStack item = items[0]; - if(item == null) - { - if(held != null && !(held.getItem() instanceof ItemBlock) && CookRecipe.getResult(held, isOven()) != null) - { - ItemStack item2 = held.copy(); - item2.stackSize = 1; - setInventorySlotContents(0, item2); - tryDecrMainItem(player); - updateRecipe(); - if(!isOven() && this.getTemp() > 0) - { - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "random.fizz", 1.0F, 1.0F); - } - return true; - } - } - else - { - if(!player.inventory.addItemStackToInventory(item)) - { - player.entityDropItem(item, 0.0F); - } - setInventorySlotContents(0, null); - updateRecipe(); - return true; - } - return false; - } - - private void tryDecrMainItem(EntityPlayer player) - { - int held = player.inventory.currentItem; - if(held >= 0 && held < 9) - { - player.inventory.decrStackSize(held, 1); - } - } - public void updateRecipe() - { - recipe = CookRecipe.getResult(getStackInSlot(0), isOven()); - if(recipe != null) - { - maxProgress = recipe.time; - } - progress = 0; - sendPacketToClients(); - } - public int getProgressBar(int i) - { - if(maxProgress <= 0)return 0; - return (int)((float)i / maxProgress * progress); - } - public String getResultName() - { - if(recipe != null) - { - return recipe.output.getDisplayName(); - } - return ""; - } - - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - progress = nbt.getFloat("Progress"); +import java.util.Random; + +public class TileEntityRoast extends TileEntity implements IInventory, IHeatUser { + /** + * Enable high temperatures ruin cooking + */ + public static boolean enableOverheat = true; + public ItemStack[] items = new ItemStack[1]; + public float progress; + public float maxProgress; + public String texname = "basic"; + private int tempTicksExisted = 0; + private Random rand = new Random(); + private int ticksExisted; + private CookRecipe recipe; + private boolean isOvenTemp; + + public TileEntityRoast() { + } + + @Override + public void updateEntity() { + super.updateEntity(); + ++tempTicksExisted; + if (tempTicksExisted == 10) { + blockMetadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + updateRecipe(); + } + int temp = getTemp(); + ++ticksExisted; + if (ticksExisted % 20 == 0 && !worldObj.isRemote) { + if (recipe != null && temp > 0 && maxProgress > 0 && temp > recipe.minTemperature) { + if (enableOverheat && recipe.canBurn && temp > recipe.maxTemperature) { + setInventorySlotContents(0, recipe.burnt.copy()); + updateRecipe(); + } + progress += (temp / 100F); + if (progress >= maxProgress) { + setInventorySlotContents(0, recipe.output.copy()); + updateRecipe(); + } + } + } + if (temp > 0 && worldObj.isRemote && rand.nextInt(20) == 0) { + worldObj.spawnParticle("flame", xCoord + 0.2F + (rand.nextFloat() * 0.6F), yCoord + 0.2F, + zCoord + 0.2F + (rand.nextFloat() * 0.6F), 0F, 0F, 0F); + } + } + + private int getTemp() { + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + if (tile != null && tile instanceof IHeatSource) { + return ((IHeatSource) tile).getHeat(); + } + return 0; + } + + public TileEntityRoast setInventoryModel(String tex, boolean isOven) { + this.isOvenTemp = isOven; + this.texname = tex; + return this; + } + + public boolean isOven() { + if (worldObj == null) + return isOvenTemp; + Block base = worldObj.getBlock(xCoord, yCoord, zCoord); + if (base instanceof BlockRoast) { + return ((BlockRoast) base).isOven(); + } + return false; + } + + public boolean interact(EntityPlayer player) { + ItemStack held = player.getHeldItem(); + ItemStack item = items[0]; + if (item == null) { + if (held != null && !(held.getItem() instanceof ItemBlock) + && CookRecipe.getResult(held, isOven()) != null) { + ItemStack item2 = held.copy(); + item2.stackSize = 1; + setInventorySlotContents(0, item2); + tryDecrMainItem(player); + updateRecipe(); + if (!isOven() && this.getTemp() > 0) { + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "random.fizz", 1.0F, 1.0F); + } + return true; + } + } else { + if (!player.inventory.addItemStackToInventory(item)) { + player.entityDropItem(item, 0.0F); + } + setInventorySlotContents(0, null); + updateRecipe(); + return true; + } + return false; + } + + private void tryDecrMainItem(EntityPlayer player) { + int held = player.inventory.currentItem; + if (held >= 0 && held < 9) { + player.inventory.decrStackSize(held, 1); + } + } + + public void updateRecipe() { + recipe = CookRecipe.getResult(getStackInSlot(0), isOven()); + if (recipe != null) { + maxProgress = recipe.time; + } + progress = 0; + sendPacketToClients(); + } + + public int getProgressBar(int i) { + if (maxProgress <= 0) + return 0; + return (int) (i / maxProgress * progress); + } + + public String getResultName() { + if (recipe != null) { + return recipe.output.getDisplayName(); + } + return ""; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + progress = nbt.getFloat("Progress"); maxProgress = nbt.getFloat("maxProgress"); - - NBTTagList savedItems = nbt.getTagList("Items", 10); - for (int i = 0; i < savedItems.tagCount(); ++i) - { + NBTTagList savedItems = nbt.getTagList("Items", 10); + + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < items.length) - { - items[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); + if (slotNum >= 0 && slotNum < items.length) { + items[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setFloat("Progress", progress); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setFloat("Progress", progress); nbt.setFloat("maxProgress", maxProgress); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < items.length; ++i) - { - if (items[i] != null) - { + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < items.length; ++i) { + if (items[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); items[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - } - - //INVENTORY - public void onInventoryChanged() - { - } - - @Override - public int getSizeInventory() - { - return items.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return items[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - onInventoryChanged(); - if (this.items[slot] != null) - { + } + + // INVENTORY + public void onInventoryChanged() { + } + + @Override + public int getSizeInventory() { + return items.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return items[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + onInventoryChanged(); + if (this.items[slot] != null) { ItemStack itemstack; - if (this.items[slot].stackSize <= num) - { + if (this.items[slot].stackSize <= num) { itemstack = this.items[slot]; this.items[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.items[slot].splitStack(num); - if (this.items[slot].stackSize == 0) - { + if (this.items[slot].stackSize == 0) { this.items[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return items[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - onInventoryChanged(); - items[slot] = item; - } - - @Override - public String getInventoryName() - { - return "tile.roast.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 1; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - return false; - } - - private void dropItem(ItemStack itemstack) - { - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return items[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + onInventoryChanged(); + items[slot] = item; + } + + @Override + public String getInventoryName() { + return "tile.roast.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + return false; + } + + private void dropItem(ItemStack itemstack) { + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(worldObj, xCoord + f, yCoord + f1, zCoord + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(worldObj, xCoord + f, yCoord + f1, zCoord + 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; worldObj.spawnEntityInWorld(entityitem); } } - } - @Override - public boolean canAccept(TileEntity tile) - { - return true; - } - - private void sendPacketToClients() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { + } + + @Override + public boolean canAccept(TileEntity tile) { + return true; + } + + private void sendPacketToClients() { + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new TileInventoryPacket(this, this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + + /* + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new TileInventoryPacket(this, this).generatePacket()); + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, + new TileInventoryPacket(this, this).generatePacket()); } - } - - public String texname = "basic"; - - @SideOnly(Side.CLIENT) - public String getTexName() - { - if(worldObj == null)return texname; - - Block base = worldObj.getBlock(xCoord, yCoord, zCoord); - if(base instanceof BlockRoast) - { - return ((BlockRoast)base).tex; - } - return "basic"; - } - - @Override - public Block getBlockType() - { - if(worldObj == null) return BlockListMF.oven_stone; - + */ + } + + @SideOnly(Side.CLIENT) + public String getTexName() { + if (worldObj == null) + return texname; + + Block base = worldObj.getBlock(xCoord, yCoord, zCoord); + if (base instanceof BlockRoast) { + return ((BlockRoast) base).tex; + } + return "basic"; + } + + @Override + public Block getBlockType() { + if (worldObj == null) + return BlockListMF.oven_stone; + return super.getBlockType(); } - @Override - public int getBlockMetadata() - { - if(worldObj == null) return 0; - return super.getBlockMetadata(); + + @Override + public int getBlockMetadata() { + if (worldObj == null) + return 0; + return super.getBlockMetadata(); } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityTanningRack.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityTanningRack.java index e24d6b92..acbb980b 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityTanningRack.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityTanningRack.java @@ -1,423 +1,353 @@ package minefantasy.mf2.block.tileentity; -import java.util.List; -import java.util.Random; - import minefantasy.mf2.api.crafting.tanning.TanningRecipe; import minefantasy.mf2.api.helpers.ToolHelper; -import minefantasy.mf2.api.refine.BlastFurnaceRecipes; import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.api.rpg.SkillList; -import minefantasy.mf2.block.crafting.BlockTanningRack; import minefantasy.mf2.block.crafting.BlockEngineerTanner; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.container.ContainerTanner; -import minefantasy.mf2.item.ItemComponentMF; import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.util.MFLogUtil; -import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.WorldServer; - -public class TileEntityTanningRack extends TileEntity implements IInventory -{ - public ItemStack[] items = new ItemStack[2]; - public float progress; - public float maxProgress; - public String tex = ""; - public int tier = 0; - public String toolType = "knife"; - public final ContainerTanner container; - private int tempTicksExisted = 0; - private Random rand = new Random(); - - public float acTime; - - public TileEntityTanningRack() - { - this(0, "Basic"); - } - public TileEntityTanningRack(int tier, String tex) - { - container = new ContainerTanner(this); - this.tier=tier; - this.tex=tex; - } - - @Override - public void updateEntity() - { - super.updateEntity(); - ++tempTicksExisted; - if(tempTicksExisted == 10) - { - blockMetadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - } - if(isAutomated()) - { - if(acTime > 0) - { - acTime -= (1F/20); - } - //syncAnimations(); - } - } - public boolean interact(EntityPlayer player, boolean leftClick, boolean leverPull) - { - if(leverPull && acTime > 0) - { - return true; - } - container.detectAndSendChanges(); - - ItemStack held = player.getHeldItem(); - - //Interaction - if(items[1] != null && (leverPull || ToolHelper.getCrafterTool(held).equalsIgnoreCase(toolType))) - { - if(leverPull || ToolHelper.getCrafterTier(held) >= tier) - { - if(!leverPull) - { - held.damageItem(1, player); - if(held.getItemDamage() >= held.getMaxDamage()) - { - player.destroyCurrentEquippedItem(); - } - } - else - { - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "tile.piston.out", 0.75F, 0.85F); - acTime = 1.0F; - } - - float efficiency = leverPull ? 100F : ToolHelper.getCrafterEfficiency(held); - if(!leverPull && player.swingProgress > 0 && player.swingProgress <= 1.0) - { - efficiency *= (0.5F-player.swingProgress); - } - - if(efficiency > 0) - { - progress += efficiency; - } - if(toolType.equalsIgnoreCase("shears")) - { - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "mob.sheep.shear", 1.0F, 1.0F); - } - else - { - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "dig.cloth", 1.0F, 1.0F); - } - if(progress >= maxProgress) - { - if(RPGElements.isSystemActive) - { - SkillList.artisanry.addXP(player, 1); - } - progress = 0; - int ss = items[0] != null ? items[0].stackSize : 1; - ItemStack out = items[1].copy(); - out.stackSize *= ss; - setInventorySlotContents(0, out); - updateRecipe(); - if(isShabbyRack() && rand.nextInt(10) == 0 && !worldObj.isRemote) - { - for(int a = 0; a < rand.nextInt(10); a++) - { - ItemStack plank = ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood"); - worldObj.playSoundEffect(xCoord+0.5, yCoord+0.5, zCoord+0.5, "mob.zombie.woodbreak", 1.0F, 1.5F); - dropItem(plank); - } - worldObj.setBlockToAir(xCoord, yCoord, zCoord); - return true; - } - } - } - return true; - } - if(!leftClick && (ToolHelper.getCrafterTool(held).equalsIgnoreCase("nothing") || ToolHelper.getCrafterTool(held).equalsIgnoreCase("hands"))) - { - //Item placement - ItemStack item = items[0]; - if(item == null) - { - if(held != null && !(held.getItem() instanceof ItemBlock) && TanningRecipe.getRecipe(held) != null) - { - ItemStack item2 = held.copy(); - item2.stackSize = 1; - setInventorySlotContents(0, item2); - tryDecrMainItem(player); - updateRecipe(); - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "mob.horse.leather", 1.0F, 1.0F); - return true; - } - } - else - { - if(!player.inventory.addItemStackToInventory(item)) - { - player.entityDropItem(item, 0.0F); - } - setInventorySlotContents(0, null); - updateRecipe(); - worldObj.playSoundEffect(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, "mob.horse.leather", 1.0F, 1.0F); - return true; - } - } - return false; - } - - public boolean isAutomated() - { - if(worldObj == null) - { - return tex.equalsIgnoreCase("metal"); - } - return worldObj.getBlock(xCoord, yCoord, zCoord) instanceof BlockEngineerTanner; - } - private void tryDecrMainItem(EntityPlayer player) - { - int held = player.inventory.currentItem; - if(held >= 0 && held < 9) - { - player.inventory.decrStackSize(held, 1); - } - } - public void updateRecipe() - { - TanningRecipe recipe = TanningRecipe.getRecipe(items[0]); - if(recipe == null) - { - setInventorySlotContents(1, null); - progress = maxProgress = tier = 0; - } - else - { - setInventorySlotContents(1, recipe.output); - tier = recipe.tier; - maxProgress = recipe.time; - toolType = recipe.toolType; - } - progress = 0; - } - public boolean doesPlayerKnowCraft(EntityPlayer thePlayer) - { - return true; - } - public int getProgressBar(int i) - { - if(maxProgress <= 0)return 0; - return (int)((float)i / maxProgress * progress); - } - public String getResultName() - { - if(items[1] != null) - { - return items[1].getDisplayName(); - } - return ""; - } - - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - acTime = nbt.getFloat("acTime"); - tex = nbt.getString("tex"); - tier = nbt.getInteger("tier"); - progress = nbt.getFloat("Progress"); + +import java.util.Random; + +public class TileEntityTanningRack extends TileEntity implements IInventory { + public final ContainerTanner container; + public ItemStack[] items = new ItemStack[2]; + public float progress; + public float maxProgress; + public String tex = ""; + public int tier = 0; + public String toolType = "knife"; + public float acTime; + private int tempTicksExisted = 0; + private Random rand = new Random(); + + public TileEntityTanningRack() { + this(0, "Basic"); + } + + public TileEntityTanningRack(int tier, String tex) { + container = new ContainerTanner(this); + this.tier = tier; + this.tex = tex; + } + + @Override + public void updateEntity() { + super.updateEntity(); + ++tempTicksExisted; + if (tempTicksExisted == 10) { + blockMetadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + } + if (isAutomated()) { + if (acTime > 0) { + acTime -= (1F / 20); + } + // syncAnimations(); + } + } + + public boolean interact(EntityPlayer player, boolean leftClick, boolean leverPull) { + if (leverPull && acTime > 0) { + return true; + } + container.detectAndSendChanges(); + + ItemStack held = player.getHeldItem(); + + // Interaction + if (items[1] != null && (leverPull || ToolHelper.getCrafterTool(held).equalsIgnoreCase(toolType))) { + if (leverPull || ToolHelper.getCrafterTier(held) >= tier) { + if (!leverPull) { + held.damageItem(1, player); + if (held.getItemDamage() >= held.getMaxDamage()) { + player.destroyCurrentEquippedItem(); + } + } else { + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "tile.piston.out", 0.75F, + 0.85F); + acTime = 1.0F; + } + + float efficiency = leverPull ? 100F : ToolHelper.getCrafterEfficiency(held); + if (!leverPull && player.swingProgress > 0 && player.swingProgress <= 1.0) { + efficiency *= (0.5F - player.swingProgress); + } + + if (efficiency > 0) { + progress += efficiency; + } + if (toolType.equalsIgnoreCase("shears")) { + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "mob.sheep.shear", 1.0F, + 1.0F); + } else { + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "dig.cloth", 1.0F, 1.0F); + } + if (progress >= maxProgress) { + if (RPGElements.isSystemActive) { + SkillList.artisanry.addXP(player, 1); + } + progress = 0; + int ss = items[0] != null ? items[0].stackSize : 1; + ItemStack out = items[1].copy(); + out.stackSize *= ss; + setInventorySlotContents(0, out); + updateRecipe(); + if (isShabbyRack() && rand.nextInt(10) == 0 && !worldObj.isRemote) { + for (int a = 0; a < rand.nextInt(10); a++) { + ItemStack plank = ComponentListMF.plank.construct("ScrapWood"); + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "mob.zombie.woodbreak", + 1.0F, 1.5F); + dropItem(plank); + } + worldObj.setBlockToAir(xCoord, yCoord, zCoord); + return true; + } + } + } + return true; + } + if (!leftClick && (ToolHelper.getCrafterTool(held).equalsIgnoreCase("nothing") + || ToolHelper.getCrafterTool(held).equalsIgnoreCase("hands"))) { + // Item placement + ItemStack item = items[0]; + if (item == null) { + if (held != null && !(held.getItem() instanceof ItemBlock) && TanningRecipe.getRecipe(held) != null) { + ItemStack item2 = held.copy(); + item2.stackSize = 1; + setInventorySlotContents(0, item2); + tryDecrMainItem(player); + updateRecipe(); + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "mob.horse.leather", 1.0F, + 1.0F); + return true; + } + } else { + if (!player.inventory.addItemStackToInventory(item)) { + player.entityDropItem(item, 0.0F); + } + setInventorySlotContents(0, null); + updateRecipe(); + worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "mob.horse.leather", 1.0F, 1.0F); + return true; + } + } + return false; + } + + public boolean isAutomated() { + if (worldObj == null) { + return tex.equalsIgnoreCase("metal"); + } + return worldObj.getBlock(xCoord, yCoord, zCoord) instanceof BlockEngineerTanner; + } + + private void tryDecrMainItem(EntityPlayer player) { + int held = player.inventory.currentItem; + if (held >= 0 && held < 9) { + player.inventory.decrStackSize(held, 1); + } + } + + public void updateRecipe() { + TanningRecipe recipe = TanningRecipe.getRecipe(items[0]); + if (recipe == null) { + setInventorySlotContents(1, null); + progress = maxProgress = tier = 0; + } else { + setInventorySlotContents(1, recipe.output); + tier = recipe.tier; + maxProgress = recipe.time; + toolType = recipe.toolType; + } + progress = 0; + } + + public boolean doesPlayerKnowCraft(EntityPlayer thePlayer) { + return true; + } + + public int getProgressBar(int i) { + if (maxProgress <= 0) + return 0; + return (int) (i / maxProgress * progress); + } + + public String getResultName() { + if (items[1] != null) { + return items[1].getDisplayName(); + } + return ""; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + acTime = nbt.getFloat("acTime"); + tex = nbt.getString("tex"); + tier = nbt.getInteger("tier"); + progress = nbt.getFloat("Progress"); maxProgress = nbt.getFloat("maxProgress"); toolType = nbt.getString("toolType"); - - NBTTagList savedItems = nbt.getTagList("Items", 10); - for (int i = 0; i < savedItems.tagCount(); ++i) - { + NBTTagList savedItems = nbt.getTagList("Items", 10); + + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < items.length) - { - items[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); + if (slotNum >= 0 && slotNum < items.length) { + items[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setFloat("acTime", acTime); - nbt.setString("tex", tex); - nbt.setInteger("tier", tier); - nbt.setFloat("Progress", progress); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setFloat("acTime", acTime); + nbt.setString("tex", tex); + nbt.setInteger("tier", tier); + nbt.setFloat("Progress", progress); nbt.setFloat("maxProgress", maxProgress); nbt.setString("toolType", toolType); - - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < items.length; ++i) - { - if (items[i] != null) - { + + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < items.length; ++i) { + if (items[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); items[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - } - - //INVENTORY - public void onInventoryChanged() - { - } - - @Override - public int getSizeInventory() - { - return items.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return items[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - onInventoryChanged(); - if (this.items[slot] != null) - { + } + + // INVENTORY + public void onInventoryChanged() { + } + + @Override + public int getSizeInventory() { + return items.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return items[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + onInventoryChanged(); + if (this.items[slot] != null) { ItemStack itemstack; - if (this.items[slot].stackSize <= num) - { + if (this.items[slot].stackSize <= num) { itemstack = this.items[slot]; this.items[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.items[slot].splitStack(num); - if (this.items[slot].stackSize == 0) - { + if (this.items[slot].stackSize == 0) { this.items[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return items[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - onInventoryChanged(); - items[slot] = item; - } - - @Override - public String getInventoryName() - { - return "tile.tanner.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 1; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - return false; - } - - private boolean isShabbyRack() - { - return worldObj.getBlock(xCoord, yCoord, zCoord) == BlockListMF.tanner; - } - - private void dropItem(ItemStack itemstack) - { - if (itemstack != null) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return items[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + onInventoryChanged(); + items[slot] = item; + } + + @Override + public String getInventoryName() { + return "tile.tanner.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + return false; + } + + private boolean isShabbyRack() { + return worldObj.getBlock(xCoord, yCoord, zCoord) == BlockListMF.tanner; + } + + private void dropItem(ItemStack itemstack) { + if (itemstack != null) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { + while (itemstack.stackSize > 0) { int j1 = this.rand.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { + if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(worldObj, xCoord + f, yCoord + f1, zCoord + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(worldObj, xCoord + f, yCoord + f1, zCoord + 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 = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; worldObj.spawnEntityInWorld(entityitem); } } - } + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityWorldGenMarker.java b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityWorldGenMarker.java index c14406ea..f67f2c5b 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/TileEntityWorldGenMarker.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/TileEntityWorldGenMarker.java @@ -8,64 +8,57 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.chunk.Chunk; -public class TileEntityWorldGenMarker extends TileEntity -{ - public String className, type; - public int ticks = 0, length = 0, deviation = 0, prevID, prevMeta; - @Override - public void updateEntity() - { - if(!worldObj.isRemote && areChunksLoaded() && ticks >= getSpawnTime()) - { - Block block = Block.getBlockById(prevID); - worldObj.setBlock(xCoord, yCoord, zCoord, block != null ? block : Blocks.air, prevMeta, 2); - StructureModuleMF.placeStructure(className, type, length, deviation, worldObj, xCoord, yCoord, zCoord, this.getBlockMetadata()); - } - - ++ticks; - } - - private boolean areChunksLoaded() - { - return chunkLoaded(0, 0) && - chunkLoaded(-16, 0) && - chunkLoaded(16, 0) && - chunkLoaded(0, -16) && - chunkLoaded(0, 16); - } - private boolean chunkLoaded(int x, int z) - { - Chunk chunk = worldObj.getChunkFromBlockCoords(x, z); - return chunk != null && chunk.isChunkLoaded; - } - - private int getSpawnTime() - { - return ConfigWorldGen.structureTickRate; - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - className = nbt.getString("ClassDirectory"); - type = nbt.getString("SubType"); - length = nbt.getInteger("LengthPosition"); - deviation = nbt.getInteger("Deviation"); - prevID = nbt.getInteger("prevID"); - prevMeta = nbt.getInteger("prevMeta"); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setString("ClassDirectory", className); - nbt.setString("SubType", type); - nbt.setInteger("LengthPosition", length); - nbt.setInteger("prevID", prevID); - nbt.setInteger("prevMeta", prevMeta); - nbt.setInteger("Deviation", deviation); - } +public class TileEntityWorldGenMarker extends TileEntity { + public String className, type; + public int ticks = 0, length = 0, deviation = 0, prevID, prevMeta; + + @Override + public void updateEntity() { + if (!worldObj.isRemote && areChunksLoaded() && ticks >= getSpawnTime()) { + Block block = Block.getBlockById(prevID); + worldObj.setBlock(xCoord, yCoord, zCoord, block != null ? block : Blocks.air, prevMeta, 2); + StructureModuleMF.placeStructure(className, type, length, deviation, worldObj, xCoord, yCoord, zCoord, + this.getBlockMetadata()); + } + + ++ticks; + } + + private boolean areChunksLoaded() { + return chunkLoaded(0, 0) && chunkLoaded(-16, 0) && chunkLoaded(16, 0) && chunkLoaded(0, -16) + && chunkLoaded(0, 16); + } + + private boolean chunkLoaded(int x, int z) { + Chunk chunk = worldObj.getChunkFromBlockCoords(x, z); + return chunk != null && chunk.isChunkLoaded; + } + + private int getSpawnTime() { + return ConfigWorldGen.structureTickRate; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + className = nbt.getString("ClassDirectory"); + type = nbt.getString("SubType"); + length = nbt.getInteger("LengthPosition"); + deviation = nbt.getInteger("Deviation"); + prevID = nbt.getInteger("prevID"); + prevMeta = nbt.getInteger("prevMeta"); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setString("ClassDirectory", className); + nbt.setString("SubType", type); + nbt.setInteger("LengthPosition", length); + nbt.setInteger("prevID", prevID); + nbt.setInteger("prevMeta", prevMeta); + nbt.setInteger("Deviation", deviation); + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/blastfurnace/TileEntityBlastFC.java b/src/main/java/minefantasy/mf2/block/tileentity/blastfurnace/TileEntityBlastFC.java index d729e380..dd11219b 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/blastfurnace/TileEntityBlastFC.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/blastfurnace/TileEntityBlastFC.java @@ -1,7 +1,5 @@ package minefantasy.mf2.block.tileentity.blastfurnace; -import java.util.Random; - import minefantasy.mf2.api.crafting.MineFantasyFuels; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.refine.BlastFurnaceRecipes; @@ -18,330 +16,290 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -public class TileEntityBlastFC extends TileEntity implements IInventory, ISidedInventory, ISmokeCarrier -{ - protected ItemStack[] items = new ItemStack[2]; - protected int smokeStorage; - public int ticksExisted; - public boolean isBuilt = false; - public int fireTime; - protected Random rand = new Random(); - - @Override - public void updateEntity() - { - super.updateEntity(); - ++ticksExisted; - int dropFrequency = 5; - - if(!worldObj.isRemote && ticksExisted % dropFrequency == 0) - { - TileEntity neighbour = worldObj.getTileEntity(xCoord, yCoord-1, zCoord); - if(neighbour != null && neighbour instanceof TileEntityBlastFC && !(neighbour instanceof TileEntityBlastFH)) - { - interact((TileEntityBlastFC)neighbour); - } - } - if(ticksExisted % 200 == 0) - { - updateBuild(); - } - if(smokeStorage > 0) - { - SmokeMechanics.emitSmokeFromCarrier(worldObj, xCoord, yCoord, zCoord, this, 5); - } - if(!worldObj.isRemote && smokeStorage > getMaxSmokeStorage() && rand.nextInt(1000) == 0) - { - worldObj.newExplosion(null, xCoord+0.5D, yCoord+0.5D, zCoord+0.5D, 5F, true, true); - } - } - protected void interact(TileEntityBlastFC tile) - { - if(!tile.isBuilt)return; - - for(int a = 0; a < getSizeInventory(); a++) - { - ItemStack mySlot = getStackInSlot(a); - - if(mySlot != null && canShare(mySlot, a)) - { - ItemStack theirSlot = tile.getStackInSlot(a); - if(theirSlot == null) - { - ItemStack copy = mySlot.copy(); - copy.stackSize = 1; - tile.setInventorySlotContents(a, copy); - this.decrStackSize(a, 1); - } - else if(CustomToolHelper.areEqual(theirSlot, mySlot)) - { - if((theirSlot.stackSize) < getMaxStackSizeForDistribute()) - { - theirSlot.stackSize++; - this.decrStackSize(a, 1); - tile.setInventorySlotContents(a, theirSlot); - } - } - } - } - } - - private boolean canShare(ItemStack mySlot, int a) - { - if(a == 1)return isInput(mySlot); - return isCarbon(mySlot); - } - public void updateBuild() - { - isBuilt = getIsBuilt(); - } - protected boolean getIsBuilt() - { - return (isFirebrick(-1, 0, 0) && isFirebrick(1, 0, 0) && isFirebrick(0, 0, -1) && isFirebrick(0, 0, 1)); - } - protected boolean isFirebrick(int x, int y, int z) - { - Block block = worldObj.getBlock(xCoord+x, yCoord+y, zCoord+z); - if(block != null) - { - return block == BlockListMF.firebricks; - } - return false; - } - protected boolean isAir(int x, int y, int z) - { - return !worldObj.isBlockNormalCubeDefault(xCoord+x, yCoord+y, zCoord+z, false); - } - private int getMaxStackSizeForDistribute() - { - return 1; - } - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setInteger("fireTime", fireTime); - nbt.setBoolean("isBuilt", isBuilt); - nbt.setInteger("ticksExisted", ticksExisted); - nbt.setInteger("StoredSmoke", smokeStorage); - NBTTagList savedItems = new NBTTagList(); - - for (int i = 0; i < this.items.length; ++i) - { - if (this.items[i] != null) - { +import java.util.Random; + +public class TileEntityBlastFC extends TileEntity implements IInventory, ISidedInventory, ISmokeCarrier { + public int ticksExisted; + public boolean isBuilt = false; + public int fireTime; + public int tempUses; + protected ItemStack[] items = new ItemStack[2]; + protected int smokeStorage; + protected Random rand = new Random(); + + public static boolean isCarbon(ItemStack item) { + return MineFantasyFuels.isCarbon(item); + } + + public static boolean isFlux(ItemStack item) { + return true; + } + + public static boolean isInput(ItemStack item) { + return getResult(item) != null; + } + + protected static ItemStack getResult(ItemStack input) { + if (BlastFurnaceRecipes.smelting().getSmeltingResult(input) != null) { + return BlastFurnaceRecipes.smelting().getSmeltingResult(input).copy(); + } + return null; + } + + @Override + public void updateEntity() { + super.updateEntity(); + ++ticksExisted; + int dropFrequency = 5; + + if (!worldObj.isRemote && ticksExisted % dropFrequency == 0) { + TileEntity neighbour = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + if (neighbour != null && neighbour instanceof TileEntityBlastFC + && !(neighbour instanceof TileEntityBlastFH)) { + interact((TileEntityBlastFC) neighbour); + } + } + if (ticksExisted % 200 == 0) { + updateBuild(); + } + if (smokeStorage > 0) { + SmokeMechanics.emitSmokeFromCarrier(worldObj, xCoord, yCoord, zCoord, this, 5); + } + if (!worldObj.isRemote && smokeStorage > getMaxSmokeStorage() && rand.nextInt(1000) == 0) { + worldObj.newExplosion(null, xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, 5F, true, true); + } + } + + protected void interact(TileEntityBlastFC tile) { + if (!tile.isBuilt) + return; + + for (int a = 0; a < getSizeInventory(); a++) { + ItemStack mySlot = getStackInSlot(a); + + if (mySlot != null && canShare(mySlot, a)) { + ItemStack theirSlot = tile.getStackInSlot(a); + if (theirSlot == null) { + ItemStack copy = mySlot.copy(); + copy.stackSize = 1; + tile.setInventorySlotContents(a, copy); + this.decrStackSize(a, 1); + } else if (CustomToolHelper.areEqual(theirSlot, mySlot)) { + if ((theirSlot.stackSize) < getMaxStackSizeForDistribute()) { + theirSlot.stackSize++; + this.decrStackSize(a, 1); + tile.setInventorySlotContents(a, theirSlot); + } + } + } + } + } + + private boolean canShare(ItemStack mySlot, int a) { + if (a == 1) + return isInput(mySlot); + return isCarbon(mySlot); + } + + public void updateBuild() { + isBuilt = getIsBuilt(); + } + + protected boolean getIsBuilt() { + return (isFirebrick(-1, 0, 0) && isFirebrick(1, 0, 0) && isFirebrick(0, 0, -1) && isFirebrick(0, 0, 1)); + } + + protected boolean isFirebrick(int x, int y, int z) { + Block block = worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z); + if (block != null) { + return block == BlockListMF.firebricks; + } + return false; + } + + protected boolean isAir(int x, int y, int z) { + return !worldObj.isBlockNormalCubeDefault(xCoord + x, yCoord + y, zCoord + z, false); + } + + private int getMaxStackSizeForDistribute() { + return 1; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setInteger("fireTime", fireTime); + nbt.setBoolean("isBuilt", isBuilt); + nbt.setInteger("ticksExisted", ticksExisted); + nbt.setInteger("StoredSmoke", smokeStorage); + NBTTagList savedItems = new NBTTagList(); + + for (int i = 0; i < this.items.length; ++i) { + if (this.items[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.items[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } } nbt.setTag("Items", savedItems); - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - fireTime = nbt.getInteger("fireTime"); - isBuilt = nbt.getBoolean("isBuilt"); - ticksExisted = nbt.getInteger("ticksExisted"); - smokeStorage = nbt.getInteger("StoredSmoke"); - NBTTagList savedItems = nbt.getTagList("Items", 10); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + fireTime = nbt.getInteger("fireTime"); + isBuilt = nbt.getBoolean("isBuilt"); + ticksExisted = nbt.getInteger("ticksExisted"); + smokeStorage = nbt.getInteger("StoredSmoke"); + NBTTagList savedItems = nbt.getTagList("Items", 10); this.items = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.items.length) - { + if (slotNum >= 0 && slotNum < this.items.length) { this.items[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } - } - - //INVENTORY - public void onInventoryChanged() - { - } - - @Override - public int getSizeInventory() - { - return items.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return items[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - onInventoryChanged(); - if (this.items[slot] != null) - { + } + + // INVENTORY + public void onInventoryChanged() { + } + + @Override + public int getSizeInventory() { + return items.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return items[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + onInventoryChanged(); + if (this.items[slot] != null) { ItemStack itemstack; - if (this.items[slot].stackSize <= num) - { + if (this.items[slot].stackSize <= num) { itemstack = this.items[slot]; this.items[slot] = null; return itemstack; - } - else - { + } else { itemstack = this.items[slot].splitStack(num); - if (this.items[slot].stackSize == 0) - { + if (this.items[slot].stackSize == 0) { this.items[slot] = null; } return itemstack; } - } - else - { + } else { return null; } } - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - return items[slot]; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - onInventoryChanged(); - items[slot] = item; - } - - @Override - public String getInventoryName() - { - return "gui.bombcraftmf.name"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) - { - return user.getDistance(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) < 8D; - } - - @Override - public void openInventory() - { - } - - @Override - public void closeInventory() - { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - if(slot == 0) - { - return isCarbon(item); - } - return isInput(item); - } - public static boolean isCarbon(ItemStack item) - { - return MineFantasyFuels.isCarbon(item); - } - public static boolean isFlux(ItemStack item) - { - return true; - } - public static boolean isInput(ItemStack item) - { - return getResult(item) != null; - } - protected static ItemStack getResult(ItemStack input) - { - if(BlastFurnaceRecipes.smelting().getSmeltingResult(input) != null) - { - return BlastFurnaceRecipes.smelting().getSmeltingResult(input).copy(); - } - return null; - } - @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return side == 1 ? new int[]{0, 1} : new int[]{}; - } - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) - { - return isItemValidForSlot(slot, item); - } - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) - { - return false; - } - @Override - public int getSmokeValue() - { - return smokeStorage; - } - @Override - public void setSmokeValue(int smoke) - { - smokeStorage = smoke; - } - @Override - public int getMaxSmokeStorage() - { - return 10; - } - @Override - public boolean canAbsorbIndirect() - { - return false; - } - public int tempUses; - public boolean shouldRemoveCarbon() - { - if(tempUses > 0) - { - --tempUses; - MFLogUtil.logDebug("Decr Carbon Uses: " + tempUses); - return false; - } - else - { - int carb = MineFantasyFuels.getCarbon(getStackInSlot(0)) - 1; - if(carb > 0) - { - tempUses = carb; - MFLogUtil.logDebug("Set Carbon Uses: " + tempUses); - } - return true; - } - } + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return items[slot]; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + onInventoryChanged(); + items[slot] = item; + } + + @Override + public String getInventoryName() { + return "gui.bombcraftmf.name"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return user.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) < 8D; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + if (slot == 0) { + return isCarbon(item); + } + return isInput(item); + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) { + return side == 1 ? new int[]{0, 1} : new int[]{}; + } + + @Override + public boolean canInsertItem(int slot, ItemStack item, int side) { + return isItemValidForSlot(slot, item); + } + + @Override + public boolean canExtractItem(int slot, ItemStack item, int side) { + return false; + } + + @Override + public int getSmokeValue() { + return smokeStorage; + } + + @Override + public void setSmokeValue(int smoke) { + smokeStorage = smoke; + } + + @Override + public int getMaxSmokeStorage() { + return 10; + } + + @Override + public boolean canAbsorbIndirect() { + return false; + } + + public boolean shouldRemoveCarbon() { + if (tempUses > 0) { + --tempUses; + MFLogUtil.logDebug("Decr Carbon Uses: " + tempUses); + return false; + } else { + int carb = MineFantasyFuels.getCarbon(getStackInSlot(0)) - 1; + if (carb > 0) { + tempUses = carb; + MFLogUtil.logDebug("Set Carbon Uses: " + tempUses); + } + return true; + } + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/blastfurnace/TileEntityBlastFH.java b/src/main/java/minefantasy/mf2/block/tileentity/blastfurnace/TileEntityBlastFH.java index e747ee2b..6a6b56a8 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/blastfurnace/TileEntityBlastFH.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/blastfurnace/TileEntityBlastFH.java @@ -1,290 +1,251 @@ package minefantasy.mf2.block.tileentity.blastfurnace; import minefantasy.mf2.api.MineFantasyAPI; -import minefantasy.mf2.api.crafting.MineFantasyFuels; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.block.refining.BlockBFH; import minefantasy.mf2.block.tileentity.TileEntityCrucible; import minefantasy.mf2.config.ConfigHardcore; import minefantasy.mf2.entity.EntityFireBlast; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -public class TileEntityBlastFH extends TileEntityBlastFC -{ - public int fuel; - public int maxFuel; - public float heat; - public float progress; - - @Override - public void updateEntity() - { - super.updateEntity(); - - boolean wasBurning = isBurning(); - if(fuel > 0) - { - --fuel; - } - if(isBuilt && smokeStorage < getMaxSmokeStorage()) - { - if(fuel > 0) - { - ++progress; - float maxProgress = getMaxProgress(); - if(progress >= maxProgress) - { - progress -= maxProgress; - smeltItem(); - } - if(ticksExisted % 10 == 0) - { - smokeStorage+=2; - } - } - else if(!worldObj.isRemote) - { - if(isFuel(items[0])) - { - fuel = maxFuel = getItemBurnTime(items[0]); - decrStackSize(0, 1); - } - } - } - if(fireTime > 0) - { - if(fuel > 0)--fuel; - smokeStorage++; - fireTime--; - if(ticksExisted % 2 == 0) - shootFire(); - - } - if (!worldObj.isRemote && wasBurning != isBurning()) - { +public class TileEntityBlastFH extends TileEntityBlastFC { + public static float maxProgress = 1200; + public static int maxFurnaceHeight = 8; + public int fuel; + public int maxFuel; + public float heat; + public float progress; + + public static boolean isFuel(ItemStack item) { + return getItemBurnTime(item) > 0; + } + + public static int getItemBurnTime(ItemStack fuel) { + return MineFantasyAPI.getFuelValue(fuel) / 4; + } + + @Override + public void updateEntity() { + super.updateEntity(); + + boolean wasBurning = isBurning(); + if (fuel > 0) { + --fuel; + } + if (isBuilt && smokeStorage < getMaxSmokeStorage()) { + if (fuel > 0) { + ++progress; + float maxProgress = getMaxProgress(); + if (progress >= maxProgress) { + progress -= maxProgress; + smeltItem(); + } + if (ticksExisted % 10 == 0) { + smokeStorage += 2; + } + } else if (!worldObj.isRemote) { + if (isFuel(items[0])) { + fuel = maxFuel = getItemBurnTime(items[0]); + decrStackSize(0, 1); + } + } + } + if (fireTime > 0) { + if (fuel > 0) + --fuel; + smokeStorage++; + fireTime--; + if (ticksExisted % 2 == 0) + shootFire(); + + } + if (!worldObj.isRemote && wasBurning != isBurning()) { BlockBFH.updateFurnaceBlockState(isBurning(), this.worldObj, this.xCoord, this.yCoord, this.zCoord); } - } - public static float maxProgress = 1200; - private float getMaxProgress() - { - return maxProgress; - } - public static int maxFurnaceHeight = 8; - private void smeltItem() - { - for(int y = 0; y < maxFurnaceHeight; y++) - { - TileEntity tileEntity = worldObj.getTileEntity(xCoord, yCoord+y+1, zCoord); - if(tileEntity != null && tileEntity instanceof TileEntityBlastFC && !(tileEntity instanceof TileEntityBlastFH)) - { - ItemStack result = getSmeltedResult((TileEntityBlastFC) tileEntity, y+1); - if(result != null) - { - dropItem(result); - } - } - else - { - break; - } - } - fireTime = 20; - worldObj.playSoundEffect(xCoord+0.5, yCoord+0.5, zCoord+0.5, "random.fizz", 2.0F, 0.5F); - worldObj.playSoundEffect(xCoord+0.5, yCoord+0.25, zCoord+0.5, "fire.fire", 1.0F, 0.75F); - startFire(1, 0, 0); - startFire(-1, 0, 0); - startFire(0, 0, 1); - startFire(0, 0, -1); - } - - private void dropItem(ItemStack result) - { - TileEntity under = worldObj.getTileEntity(xCoord, yCoord-1, zCoord); - if(under != null && under instanceof TileEntityCrucible) - { - TileEntityCrucible crucible = (TileEntityCrucible)under; - int slot = crucible.getSizeInventory()-1; - { - if(crucible.getStackInSlot(slot) == null) - { - crucible.setInventorySlotContents(slot, result); - return; - } - else if(CustomToolHelper.areEqual(crucible.getStackInSlot(slot), result)) - { - int freeSpace = crucible.getStackInSlot(slot).getMaxStackSize() - crucible.getStackInSlot(slot).stackSize; - if(freeSpace >= result.stackSize) - { - crucible.getStackInSlot(slot).stackSize += result.stackSize; - return; - } - else - { - crucible.getStackInSlot(slot).stackSize += freeSpace; - result.stackSize -= freeSpace; - } - } - } - } - if(result.stackSize <= 0)return; - - if(ConfigHardcore.HCCreduceIngots && rand.nextInt(3) == 0) - { - EntityItem entity = new EntityItem(worldObj, xCoord+0.5, yCoord+0.5, zCoord+0.5, result); - worldObj.spawnEntityInWorld(entity); - } - } - private void startFire(int x, int y, int z) - { - if(!worldObj.isRemote && worldObj.isAirBlock(x, y, z)) - { - worldObj.setBlock(xCoord+x, yCoord+y, zCoord+z, Blocks.fire); - } - } - private void shootFire() - { - if(!worldObj.isRemote) - { - shootFire(-1, 0, 0); - shootFire(1, 0, 0); - shootFire(0, 0, -1); - shootFire(0, 0, 1); - } - } - private void shootFire(int x, int y, int z) - { - double v = 0.125D; - EntityFireBlast fireball = new EntityFireBlast(worldObj, xCoord+0.5+x, yCoord, zCoord+0.5+z, (double)x*v, (double)y*v, (double)z*v); - fireball.getEntityData().setString("Preset", "BlastFurnace"); - fireball.modifySpeed(0.5F); - worldObj.spawnEntityInWorld(fireball); - } - - private ItemStack getSmeltedResult(TileEntityBlastFC shaft, int y) - { - if(shaft.getIsBuilt()) - { - ItemStack input = shaft.getStackInSlot(1); - if(shaft.tempUses <=0 && shaft.getStackInSlot(0) == null || !isCarbon(shaft.getStackInSlot(0))) - { - return null; - } - if(input != null) - { - ItemStack result = getResult(input); - if(result != null) - { - for(int a = 0; a < shaft.getSizeInventory(); a++) - { - if(a > 0 || shaft.shouldRemoveCarbon()) - { - shaft.decrStackSize(a, 1); - } - } - return result; - } - } - } - return null; - } - - @Override - protected void interact(TileEntityBlastFC tile) - { - - } - @Override - public void updateBuild() - { - isBuilt = getIsBuilt(); - } - @Override - protected boolean getIsBuilt() - { - return (isFirebrick(-1, 0, -1) && isFirebrick(1, 0, -1) && isFirebrick(-1, 0, 1) && isFirebrick(1, 0, -1)) && (isAir(-1, 0, 0) && isAir(1, 0, 0) && isAir(0, 0, -1) && isAir(0, 0, 1)); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setFloat("progress", progress); - nbt.setInteger("fuel", fuel); - nbt.setInteger("maxFuel", maxFuel); - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - progress = nbt.getFloat("progress"); - fuel = nbt.getInteger("fuel"); - maxFuel = nbt.getInteger("maxFuel"); - } - public static boolean isFuel(ItemStack item) - { - return getItemBurnTime(item) > 0; - } - @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return side > 0 ? new int[]{0} : new int[]{}; - } - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) - { - return side != 0 && isItemValidForSlot(slot, item); - } - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) - { - return false; - } - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) - { - if(slot == 0) - { - return isFuel(item); - } - return false; - } - - public static int getItemBurnTime(ItemStack fuel) - { - return MineFantasyAPI.getFuelValue(fuel)/4; } - public boolean isBurning() - { - return fuel > 0; - } + private float getMaxProgress() { + return maxProgress; + } + + private void smeltItem() { + for (int y = 0; y < maxFurnaceHeight; y++) { + TileEntity tileEntity = worldObj.getTileEntity(xCoord, yCoord + y + 1, zCoord); + if (tileEntity != null && tileEntity instanceof TileEntityBlastFC + && !(tileEntity instanceof TileEntityBlastFH)) { + ItemStack result = getSmeltedResult((TileEntityBlastFC) tileEntity, y + 1); + if (result != null) { + dropItem(result); + } + } else { + break; + } + } + fireTime = 20; + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.fizz", 2.0F, 0.5F); + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "fire.fire", 1.0F, 0.75F); + startFire(1, 0, 0); + startFire(-1, 0, 0); + startFire(0, 0, 1); + startFire(0, 0, -1); + } + + private void dropItem(ItemStack result) { + TileEntity under = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + if (under != null && under instanceof TileEntityCrucible) { + TileEntityCrucible crucible = (TileEntityCrucible) under; + int slot = crucible.getSizeInventory() - 1; + { + if (crucible.getStackInSlot(slot) == null) { + crucible.setInventorySlotContents(slot, result); + return; + } else if (CustomToolHelper.areEqual(crucible.getStackInSlot(slot), result)) { + int freeSpace = crucible.getStackInSlot(slot).getMaxStackSize() + - crucible.getStackInSlot(slot).stackSize; + if (freeSpace >= result.stackSize) { + crucible.getStackInSlot(slot).stackSize += result.stackSize; + return; + } else { + crucible.getStackInSlot(slot).stackSize += freeSpace; + result.stackSize -= freeSpace; + } + } + } + } + if (result.stackSize <= 0) + return; + + if (ConfigHardcore.HCCreduceIngots && rand.nextInt(3) == 0) { + EntityItem entity = new EntityItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, result); + worldObj.spawnEntityInWorld(entity); + } + } - public int getBurnTimeRemainingScaled(int i) - { - if (this.maxFuel <= 0) - { - return 0; + private void startFire(int x, int y, int z) { + if (!worldObj.isRemote && worldObj.isAirBlock(x, y, z)) { + worldObj.setBlock(xCoord + x, yCoord + y, zCoord + z, Blocks.fire); + } + } + + private void shootFire() { + if (!worldObj.isRemote) { + shootFire(-1, 0, 0); + shootFire(1, 0, 0); + shootFire(0, 0, -1); + shootFire(0, 0, 1); + } + } + + private void shootFire(int x, int y, int z) { + double v = 0.125D; + EntityFireBlast fireball = new EntityFireBlast(worldObj, xCoord + 0.5 + x, yCoord, zCoord + 0.5 + z, x * v, + y * v, z * v); + fireball.getEntityData().setString("Preset", "BlastFurnace"); + fireball.modifySpeed(0.5F); + worldObj.spawnEntityInWorld(fireball); + } + + private ItemStack getSmeltedResult(TileEntityBlastFC shaft, int y) { + if (shaft.getIsBuilt()) { + ItemStack input = shaft.getStackInSlot(1); + if (shaft.tempUses <= 0 && shaft.getStackInSlot(0) == null || !isCarbon(shaft.getStackInSlot(0))) { + return null; + } + if (input != null) { + ItemStack result = getResult(input); + if (result != null) { + for (int a = 0; a < shaft.getSizeInventory(); a++) { + if (a > 0 || shaft.shouldRemoveCarbon()) { + shaft.decrStackSize(a, 1); + } + } + return result; + } + } + } + return null; + } + + @Override + protected void interact(TileEntityBlastFC tile) { + + } + + @Override + public void updateBuild() { + isBuilt = getIsBuilt(); + } + + @Override + protected boolean getIsBuilt() { + return (isFirebrick(-1, 0, -1) && isFirebrick(1, 0, -1) && isFirebrick(-1, 0, 1) && isFirebrick(1, 0, -1)) + && (isAir(-1, 0, 0) && isAir(1, 0, 0) && isAir(0, 0, -1) && isAir(0, 0, 1)); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setFloat("progress", progress); + nbt.setInteger("fuel", fuel); + nbt.setInteger("maxFuel", maxFuel); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + progress = nbt.getFloat("progress"); + fuel = nbt.getInteger("fuel"); + maxFuel = nbt.getInteger("maxFuel"); + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) { + return side > 0 ? new int[]{0} : new int[]{}; + } + + @Override + public boolean canInsertItem(int slot, ItemStack item, int side) { + return side != 0 && isItemValidForSlot(slot, item); + } + + @Override + public boolean canExtractItem(int slot, ItemStack item, int side) { + return false; + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + if (slot == 0) { + return isFuel(item); + } + return false; + } + + public boolean isBurning() { + return fuel > 0; + } + + public int getBurnTimeRemainingScaled(int i) { + if (this.maxFuel <= 0) { + return 0; } return fuel * i / maxFuel; - } - - @Override - public int getSizeInventory() - { - return 1; - } - @Override - public int getMaxSmokeStorage() - { - return 10; - } + } + + @Override + public int getSizeInventory() { + return 1; + } + + @Override + public int getMaxSmokeStorage() { + return 10; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityAmmoBox.java b/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityAmmoBox.java index 5008ce85..f41b40a8 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityAmmoBox.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityAmmoBox.java @@ -1,7 +1,5 @@ package minefantasy.mf2.block.tileentity.decor; -import java.util.List; - import minefantasy.mf2.api.archery.AmmoMechanicsMF; import minefantasy.mf2.api.archery.IAmmo; import minefantasy.mf2.api.archery.IFirearm; @@ -11,6 +9,7 @@ import minefantasy.mf2.block.decor.BlockAmmoBox; import minefantasy.mf2.item.ItemBandage; import minefantasy.mf2.item.gadget.ItemSyringe; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.AmmoBoxPacket; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -18,271 +17,241 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.WorldServer; -public class TileEntityAmmoBox extends TileEntityWoodDecor implements IBasicMetre -{ - public int angle, stock; - public ItemStack ammo; - private byte storageSize = -1; - - public TileEntityAmmoBox() - { - super("ammo_box_basic", CustomMaterial.getMaterial("RefinedWood")); - } - public TileEntityAmmoBox(String tex, CustomMaterial material, byte size) - { - super(tex, material); - this.storageSize = size; - } - - public boolean interact(EntityPlayer user, ItemStack held) - { - if(held != null) - { - if(this.getStorageType() == 1 && ammo != null && held.getItem() instanceof IFirearm && loadGun(held)) - { - open(); - syncData(); - return true; - } - if(canAcceptItem(held)) - { - int max = this.getMaxAmmo(ammo != null ? ammo : held); - if(ammo == null) - { - open(); - placeInEmpty(user, held, max); - } - else if(areItemStacksEqual(held, ammo) && stock < max) - { - open(); - addToBox(user, held, max); - } - - syncData(); - return true; - } - return false; - } - else if(ammo != null) - { - open(); - takeStack(user, held); - syncData(); - return true; - } - syncData(); - return false; - } - private boolean canAcceptItem(ItemStack held) - { - if(held.getItem() instanceof IStorageBlock) - { - return false; - } - byte type = this.getStorageType(); - - return type == 0 ? isFood(held) : type == 1 ? held.getItem() instanceof IAmmo : type == 2; - } - private boolean isFood(ItemStack held) - { - return held.getItem() instanceof ItemFood || held.getItem() instanceof ItemBandage || held.getItem() instanceof ItemSyringe; - } - private boolean loadGun(ItemStack held) - { - IFirearm gun = (IFirearm)held.getItem(); - if(gun.canAcceptAmmo(held, getAmmoClass())) - { - ItemStack loaded = AmmoMechanicsMF.getAmmo(held); - if(loaded == null) - { - int ss = Math.min(ammo.getMaxStackSize(), stock); - ItemStack newloaded = ammo.copy(); - newloaded.stackSize = ss; - AmmoMechanicsMF.setAmmo(held, newloaded); - stock -= ss; - if(stock <= 0) - { - ammo = null; - } - return true; - } - else if(areItemStacksEqual(loaded, ammo)) - { - int room_left = loaded.getMaxStackSize() - loaded.stackSize; - if(stock > room_left) - { - stock -= room_left; - loaded.stackSize += room_left; - AmmoMechanicsMF.setAmmo(held, loaded); - } - else - { - loaded.stackSize += stock; - AmmoMechanicsMF.setAmmo(held, loaded); - stock = 0; - ammo = null; - } - - return true; - } - } - return false; - } - private void addToBox(EntityPlayer user, ItemStack held, int max) - { - int room_left = max - stock; - if(held.stackSize <= room_left) - { - stock += held.stackSize; - user.setCurrentItemOrArmor(0, null); - } - else - { - held.stackSize -= room_left; - stock += room_left; - } - } - - private void takeStack(EntityPlayer user, ItemStack held) - { - int ss = stock; - ItemStack taken = ammo.copy(); - if(ss > taken.getMaxStackSize()) - { - ss = taken.getMaxStackSize(); - } - taken.stackSize = ss; - stock -= ss; - user.setCurrentItemOrArmor(0, taken); - if(stock <= 0) - { - ammo = null; - } - } - /** - * Place ammo in empty box - */ - private void placeInEmpty(EntityPlayer user, ItemStack held, int max) - { - ammo = held.copy(); - int ss = held.stackSize; - if(held.stackSize <= max)//Place all - { - user.setCurrentItemOrArmor(0, null); - } - else //Fill as much - { - stock = max; - held.stackSize -= max; - } - stock = ss; - } - private void open() - { - angle = 16; - this.worldObj.playSoundEffect((double)this.xCoord + 0.5D, (double)this.yCoord + 0.25D, (double)this.zCoord + 0.5D, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 1.4F); - } - private int ticksExisted; - - @Override - public void updateEntity() - { - ++ticksExisted; - if(ticksExisted == 20 || ticksExisted % 100 == 0) - { - syncData(); - } - if(angle > 0)--angle; - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setInteger("stock", stock); - if(ammo != null) - { - NBTTagCompound itemsave = new NBTTagCompound(); - ammo.writeToNBT(itemsave); - nbt.setTag("storage", itemsave); - } - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - stock = nbt.getInteger("stock"); - if(nbt.hasKey("storage")) - { - NBTTagCompound itemsave = nbt.getCompoundTag("storage"); - ammo = ItemStack.loadItemStackFromNBT(itemsave); - } - } - - public void syncData() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { + +public class TileEntityAmmoBox extends TileEntityWoodDecor implements IBasicMetre { + public int angle, stock; + public ItemStack ammo; + private byte storageSize = -1; + private int ticksExisted; + + public TileEntityAmmoBox() { + super("ammo_box_basic", CustomMaterial.getMaterial("RefinedWood")); + } + + public TileEntityAmmoBox(String tex, CustomMaterial material, byte size) { + super(tex, material); + this.storageSize = size; + } + + public boolean interact(EntityPlayer user, ItemStack held) { + if (held != null) { + if (this.getStorageType() == 1 && ammo != null && held.getItem() instanceof IFirearm && loadGun(held)) { + open(); + syncData(); + return true; + } + if (canAcceptItem(held)) { + int max = this.getMaxAmmo(ammo != null ? ammo : held); + if (ammo == null) { + open(); + placeInEmpty(user, held, max); + } else if (areItemStacksEqual(held, ammo) && stock < max) { + open(); + addToBox(user, held, max); + } + + syncData(); + return true; + } + return false; + } else if (ammo != null) { + open(); + takeStack(user, held); + syncData(); + return true; + } + syncData(); + return false; + } + + private boolean canAcceptItem(ItemStack held) { + if (held.getItem() instanceof IStorageBlock) { + return false; + } + byte type = this.getStorageType(); + + return type == 0 ? isFood(held) : type == 1 ? held.getItem() instanceof IAmmo : type == 2; + } + + private boolean isFood(ItemStack held) { + return held.getItem() instanceof ItemFood || held.getItem() instanceof ItemBandage + || held.getItem() instanceof ItemSyringe; + } + + private boolean loadGun(ItemStack held) { + IFirearm gun = (IFirearm) held.getItem(); + if (gun.canAcceptAmmo(held, getAmmoClass())) { + ItemStack loaded = AmmoMechanicsMF.getAmmo(held); + if (loaded == null) { + int ss = Math.min(ammo.getMaxStackSize(), stock); + ItemStack newloaded = ammo.copy(); + newloaded.stackSize = ss; + AmmoMechanicsMF.setAmmo(held, newloaded); + stock -= ss; + if (stock <= 0) { + ammo = null; + } + return true; + } else if (areItemStacksEqual(loaded, ammo)) { + int room_left = loaded.getMaxStackSize() - loaded.stackSize; + if (stock > room_left) { + stock -= room_left; + loaded.stackSize += room_left; + AmmoMechanicsMF.setAmmo(held, loaded); + } else { + loaded.stackSize += stock; + AmmoMechanicsMF.setAmmo(held, loaded); + stock = 0; + ammo = null; + } + + return true; + } + } + return false; + } + + private void addToBox(EntityPlayer user, ItemStack held, int max) { + int room_left = max - stock; + if (held.stackSize <= room_left) { + stock += held.stackSize; + user.setCurrentItemOrArmor(0, null); + } else { + held.stackSize -= room_left; + stock += room_left; + } + } + + private void takeStack(EntityPlayer user, ItemStack held) { + int ss = stock; + ItemStack taken = ammo.copy(); + if (ss > taken.getMaxStackSize()) { + ss = taken.getMaxStackSize(); + } + taken.stackSize = ss; + stock -= ss; + user.setCurrentItemOrArmor(0, taken); + if (stock <= 0) { + ammo = null; + } + } + + /** + * Place ammo in empty box + */ + private void placeInEmpty(EntityPlayer user, ItemStack held, int max) { + ammo = held.copy(); + int ss = held.stackSize; + if (held.stackSize <= max)// Place all + { + user.setCurrentItemOrArmor(0, null); + } else // Fill as much + { + stock = max; + held.stackSize -= max; + } + stock = ss; + } + + private void open() { + angle = 16; + this.worldObj.playSoundEffect(this.xCoord + 0.5D, this.yCoord + 0.25D, this.zCoord + 0.5D, "random.chestclosed", + 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 1.4F); + } + + @Override + public void updateEntity() { + ++ticksExisted; + if (ticksExisted == 20 || ticksExisted % 100 == 0) { + syncData(); + } + if (angle > 0) + --angle; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("stock", stock); + if (ammo != null) { + NBTTagCompound itemsave = new NBTTagCompound(); + ammo.writeToNBT(itemsave); + nbt.setTag("storage", itemsave); + } + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + stock = nbt.getInteger("stock"); + if (nbt.hasKey("storage")) { + NBTTagCompound itemsave = nbt.getCompoundTag("storage"); + ammo = ItemStack.loadItemStackFromNBT(itemsave); + } + } + + public void syncData() { + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new AmmoBoxPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + + /* + List players = ((WorldServer) worldObj).playerEntities; + for (int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new AmmoBoxPacket(this).generatePacket()); + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, new AmmoBoxPacket(this).generatePacket()); super.sendPacketToClient(player); } - } - public int getMaxAmmo(ItemStack ammo) - { - return ammo.getMaxStackSize() * getCapacity(getMaterial().tier); - } - @Override - public int getMetreScale(int size) - { - if(ammo != null) - { - return (int)Math.min(size, (float)size / (float)getMaxAmmo(ammo) * (float)stock); - } - return 0; - } - @Override - public boolean shouldShowMetre() { - return ammo != null; - } - @Override - public String getLocalisedName() - { - if(ammo != null) - { - return ammo.getDisplayName() + " x" + stock; - } - return ""; - } - - private boolean areItemStacksEqual(ItemStack i1, ItemStack i2) - { - if(i1 == null || i2 == null)return false; - - return i1.isItemEqual(i2) && ItemStack.areItemStackTagsEqual(i1, i2); - } - private String getAmmoClass() - { - if(ammo != null && ammo.getItem() instanceof IAmmo) - { - return ((IAmmo)ammo.getItem()).getAmmoType(ammo); - } - return "null"; - } - - public byte getStorageType() - { - if(worldObj != null) - { - Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - if(block instanceof BlockAmmoBox) - { - return ((BlockAmmoBox)block).storageType; - } - } - return storageSize; - } + */ + } + + public int getMaxAmmo(ItemStack ammo) { + return ammo.getMaxStackSize() * getCapacity(getMaterial().tier); + } + + @Override + public int getMetreScale(int size) { + if (ammo != null) { + return (int) Math.min(size, (float) size / (float) getMaxAmmo(ammo) * stock); + } + return 0; + } + + @Override + public boolean shouldShowMetre() { + return ammo != null; + } + + @Override + public String getLocalisedName() { + if (ammo != null) { + return ammo.getDisplayName() + " x" + stock; + } + return ""; + } + + private boolean areItemStacksEqual(ItemStack i1, ItemStack i2) { + if (i1 == null || i2 == null) + return false; + + return i1.isItemEqual(i2) && ItemStack.areItemStackTagsEqual(i1, i2); + } + + private String getAmmoClass() { + if (ammo != null && ammo.getItem() instanceof IAmmo) { + return ((IAmmo) ammo.getItem()).getAmmoType(ammo); + } + return "null"; + } + + public byte getStorageType() { + if (worldObj != null) { + Block block = worldObj.getBlock(xCoord, yCoord, zCoord); + if (block instanceof BlockAmmoBox) { + return ((BlockAmmoBox) block).storageType; + } + } + return storageSize; + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityRack.java b/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityRack.java index a96658b4..98019c57 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityRack.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityRack.java @@ -1,9 +1,8 @@ package minefantasy.mf2.block.tileentity.decor; -import java.util.List; - import minefantasy.mf2.api.helpers.BlockPositionHelper; import minefantasy.mf2.api.weapon.IRackItem; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.TileInventoryPacket; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -17,95 +16,83 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityRack extends TileEntityWoodDecor - implements IInventory -{ +import java.util.List; + +public class TileEntityRack extends TileEntityWoodDecor implements IInventory { private ItemStack inv[]; - private int ticksExisted; + private int ticksExisted; - public TileEntityRack() - { - super("rack_wood"); + public TileEntityRack() { + super("rack_wood"); inv = new ItemStack[4]; } + @Override - public int getSizeInventory() - { + public int getSizeInventory() { return inv.length; } + @Override - public ItemStack getStackInSlot(int i) - { + public ItemStack getStackInSlot(int i) { return inv[i]; } + @Override - public ItemStack decrStackSize(int i, int j) - { - if (inv[i] != null) - { - if (inv[i].stackSize <= j) - { + public ItemStack decrStackSize(int i, int j) { + if (inv[i] != null) { + if (inv[i].stackSize <= j) { ItemStack itemstack = inv[i]; inv[i] = null; syncItems(); return itemstack; } ItemStack itemstack1 = inv[i].splitStack(j); - if (inv[i].stackSize == 0) - { + if (inv[i].stackSize == 0) { inv[i] = null; } syncItems(); return itemstack1; - } - else - { - syncItems(); - updateInventory(); + } else { + syncItems(); + updateInventory(); return null; } } + @Override - public void setInventorySlotContents(int i, ItemStack itemstack) - { + public void setInventorySlotContents(int i, ItemStack itemstack) { inv[i] = itemstack; updateInventory(); syncItems(); } @Override - public void readFromNBT(NBTTagCompound nbt) - { + public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + NBTTagList savedItems = nbt.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < savedItems.tagCount(); ++i) - { + for (int i = 0; i < savedItems.tagCount(); ++i) { NBTTagCompound savedSlot = savedItems.getCompoundTagAt(i); byte slotNum = savedSlot.getByte("Slot"); - if (slotNum >= 0 && slotNum < this.inv.length) - { + if (slotNum >= 0 && slotNum < this.inv.length) { this.inv[slotNum] = ItemStack.loadItemStackFromNBT(savedSlot); } } } @Override - public void writeToNBT(NBTTagCompound nbt) - { + public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + NBTTagList savedItems = new NBTTagList(); - for (int i = 0; i < this.inv.length; ++i) - { - if (this.inv[i] != null) - { + for (int i = 0; i < this.inv.length; ++i) { + if (this.inv[i] != null) { NBTTagCompound savedSlot = new NBTTagCompound(); - savedSlot.setByte("Slot", (byte)i); + savedSlot.setByte("Slot", (byte) i); this.inv[i].writeToNBT(savedSlot); savedItems.appendTag(savedSlot); } @@ -115,42 +102,41 @@ public void writeToNBT(NBTTagCompound nbt) } @Override - public int getInventoryStackLimit() - { + public int getInventoryStackLimit() { return 64; } + @Override - public void updateEntity() - { - ++ticksExisted; - if(ticksExisted == 10 || ticksExisted % 50 == 0) - { - syncItems(); - } + public void updateEntity() { + ++ticksExisted; + if (ticksExisted == 10 || ticksExisted % 50 == 0) { + syncItems(); + } } + public void syncItems() { + if (!worldObj.isRemote) { + List players = ((WorldServer) worldObj).playerEntities; + + NetworkUtils.sendToWatchers(new TileInventoryPacket(this, this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + super.sendPacketToClient(); + /* + for (int i = 0; i < players.size(); i++) { + EntityPlayer player = players.get(i); + ((WorldServer) worldObj).getEntityTracker().func_151248_b(player, + new TileInventoryPacket(this, this).generatePacket()); + super.sendPacketToClient(player); + } + */ + } + } - public void syncItems() - { - if(!worldObj.isRemote) - { - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { - EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new TileInventoryPacket(this, this).generatePacket()); - super.sendPacketToClient(player); - } - } - } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) - { + public boolean isUseableByPlayer(EntityPlayer entityplayer) { + if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { return false; } - return entityplayer.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64D; + return entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64D; } @Override @@ -158,113 +144,105 @@ public ItemStack getStackInSlotOnClosing(int var1) { return null; } - private int getEnchantment(int i) { - ItemStack is = this.getStackInSlot(i); - if(is == null)return 0; - - if(is.isItemEnchanted())return 1; - - return 0; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return false; - } - /* - * North: WEST: 0=2 - * South: SOUTH: 1=1 - * West: EAST: 2=3 - * East: NORTH: 3=0 - */ - public int getSlotFor(float x, float y) - { - int direction =worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - ForgeDirection FD = ForgeDirection.getOrientation(direction); - float offset = 1F/16F; - - float x1 = 0.0F + offset; - float x2 = 1.0F - offset; - float y1 = 0.0F; - float y2 = 1.0F; - if(FD == ForgeDirection.EAST || FD == ForgeDirection.WEST) - { - x1 = 0.0F; - x2 = 1.0F; - y1 = 0.0F + offset; - y2 = 1.0F - offset; - } - int[] coord = BlockPositionHelper.getCoordsFor(x, y, x1, x2, y1, y2, 4, 4, direction); - - if(coord == null) - { - return -1; - } - return coord[0]; - - } - - public boolean canHang(ItemStack item, int slot) - { - if(item == null || item.getItem() == null) - { - return false; - } - if(item.getItem() instanceof ItemBlock) - { - return false; - } - if(item.getItem() instanceof IRackItem) - { - return ((IRackItem)item.getItem()).canHang(this, item, slot); - } - if(item.getItem() instanceof ItemArmor)return false; - //if(item.getItem() instanceof ItemCrossbow || item.getItem() instanceof ItemBomb || item.getItem() instanceof ItemMine)return false; - return item.getItem().isItemTool(item); - } - - @Override - public String getInventoryName() { - return null; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public void openInventory() { - - } - - @Override - public void closeInventory() { - } - public boolean hasRackAbove(int slot) - { - TileEntity side = worldObj.getTileEntity(xCoord, yCoord+1, zCoord); - return side != null && side instanceof TileEntityRack;// && ((TileEntityRack)side).getStackInSlot(slot) == null; - } - public boolean hasRackBelow(int slot) - { - TileEntity side = worldObj.getTileEntity(xCoord, yCoord-1, zCoord); - return side != null && side instanceof TileEntityRack;// && ((TileEntityRack)side).getStackInSlot(slot) == null; - } - public void updateInventory() - { - if(!worldObj.isRemote) - { - for(int x = 0; x < getSizeInventory(); x++) - { - ItemStack item = this.getStackInSlot(x); - if(item != null && !canHang(item, x)) - { - EntityItem drop = new EntityItem(worldObj, xCoord+0.5, yCoord+0.5, zCoord+0.5, item); - worldObj.spawnEntityInWorld(drop); - setInventorySlotContents(x, null); - } - } - } - } + private int getEnchantment(int i) { + ItemStack is = this.getStackInSlot(i); + if (is == null) + return 0; + + if (is.isItemEnchanted()) + return 1; + + return 0; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return false; + } + + /* + * North: WEST: 0=2 South: SOUTH: 1=1 West: EAST: 2=3 East: NORTH: 3=0 + */ + public int getSlotFor(float x, float y) { + int direction = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + ForgeDirection FD = ForgeDirection.getOrientation(direction); + float offset = 1F / 16F; + + float x1 = 0.0F + offset; + float x2 = 1.0F - offset; + float y1 = 0.0F; + float y2 = 1.0F; + if (FD == ForgeDirection.EAST || FD == ForgeDirection.WEST) { + x1 = 0.0F; + x2 = 1.0F; + y1 = 0.0F + offset; + y2 = 1.0F - offset; + } + int[] coord = BlockPositionHelper.getCoordsFor(x, y, x1, x2, y1, y2, 4, 4, direction); + + if (coord == null) { + return -1; + } + return coord[0]; + + } + + public boolean canHang(ItemStack item, int slot) { + if (item == null || item.getItem() == null) { + return false; + } + if (item.getItem() instanceof ItemBlock) { + return false; + } + if (item.getItem() instanceof IRackItem) { + return ((IRackItem) item.getItem()).canHang(this, item, slot); + } + if (item.getItem() instanceof ItemArmor) + return false; + // if(item.getItem() instanceof ItemCrossbow || item.getItem() instanceof + // ItemBomb || item.getItem() instanceof ItemMine)return false; + return item.getItem().isItemTool(item); + } + + @Override + public String getInventoryName() { + return null; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public void openInventory() { + + } + + @Override + public void closeInventory() { + } + + public boolean hasRackAbove(int slot) { + TileEntity side = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); + return side != null && side instanceof TileEntityRack;// && ((TileEntityRack)side).getStackInSlot(slot) == null; + } + + public boolean hasRackBelow(int slot) { + TileEntity side = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + return side != null && side instanceof TileEntityRack;// && ((TileEntityRack)side).getStackInSlot(slot) == null; + } + + public void updateInventory() { + if (!worldObj.isRemote) { + for (int x = 0; x < getSizeInventory(); x++) { + ItemStack item = this.getStackInSlot(x); + if (item != null && !canHang(item, x)) { + EntityItem drop = new EntityItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, item); + worldObj.spawnEntityInWorld(drop); + setInventorySlotContents(x, null); + } + } + } + } } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityTrough.java b/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityTrough.java index 44c24bb7..d869da41 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityTrough.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityTrough.java @@ -1,153 +1,125 @@ package minefantasy.mf2.block.tileentity.decor; -import java.util.List; - import minefantasy.mf2.api.heating.IQuenchBlock; -import minefantasy.mf2.block.decor.BlockTrough; import minefantasy.mf2.item.food.FoodListMF; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.TroughPacket; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.WorldServer; -public class TileEntityTrough extends TileEntityWoodDecor implements IQuenchBlock -{ - public int fill; - - public TileEntityTrough() - { - super("trough_wood"); - } - @Override - public float quench() - { - if(fill > 0) - { - --fill; - return 0F; - } - return -1F; - } - - public boolean interact(EntityPlayer user, ItemStack held) - { - if(held != null) - { - int glass_bottle = 1, - jug = 1, - bucket = 16; - if(fill < getCapacity())//Give - { - if(held.getItem() == Items.water_bucket) - { - user.setCurrentItemOrArmor(0, new ItemStack(Items.bucket)); - addCapacity(bucket); - return true; - } - if(held.getItem() == FoodListMF.jug_water) - { - givePlayerItem(user, held, new ItemStack(FoodListMF.jug_empty)); - addCapacity(jug); - return true; - } - if(held.getItem() == Items.potionitem && held.getItemDamage() == 0) - { - givePlayerItem(user, held, new ItemStack(Items.glass_bottle)); - addCapacity(glass_bottle); - return true; - } - } - - - //Take - if(fill >=1 && held.getItem() == Items.glass_bottle && held.getItemDamage() == 0) - { - givePlayerItem(user, held, new ItemStack(Items.potionitem)); - addCapacity(-glass_bottle); - return true; - } - if(fill >=16 && held.getItem() == Items.bucket) - { - givePlayerItem(user, held, new ItemStack(Items.water_bucket)); - addCapacity(-bucket); - return true; - } - - } - return false; - } - private void givePlayerItem(EntityPlayer user, ItemStack held, ItemStack jug) - { - if(held.stackSize == 1) - { - user.setCurrentItemOrArmor(0, jug); - return; - } - - --held.stackSize; - if(!user.inventory.addItemStackToInventory(jug)) - { - if(!user.worldObj.isRemote) - { - user.entityDropItem(jug, 0F); - } - } - } - - private int ticksExisted; - - @Override - public void updateEntity() - { - ++ticksExisted; - if(ticksExisted == 20 || ticksExisted % 100 == 0) - { - syncData(); - } - if(ticksExisted % 100 == 0 && worldObj.canLightningStrikeAt(xCoord, yCoord+1, zCoord)) - { - addCapacity(1); - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setInteger("fill", fill); - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - fill = nbt.getInteger("fill"); - } - private void addCapacity(int i) - { - int cap = getCapacity(); - fill = Math.min(cap, fill+i); - syncData(); - } - public static int capacityScale = 8; - @Override - public int getCapacity() - { - return super.getCapacity() * capacityScale; - } - - public void syncData() - { - if(worldObj.isRemote)return; - - List players = ((WorldServer)worldObj).playerEntities; - for(int i = 0; i < players.size(); i++) - { - EntityPlayer player = players.get(i); - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new TroughPacket(this).generatePacket()); - super.sendPacketToClient(player); - } - } - + +public class TileEntityTrough extends TileEntityWoodDecor implements IQuenchBlock { + public static int capacityScale = 8; + public int fill; + private int ticksExisted; + + public TileEntityTrough() { + super("trough_wood"); + } + + @Override + public float quench() { + if (fill > 0) { + --fill; + return 0F; + } + return -1F; + } + + public boolean interact(EntityPlayer user, ItemStack held) { + if (held != null) { + int glass_bottle = 1, jug = 1, bucket = 16; + if (fill < getCapacity())// Give + { + if (held.getItem() == Items.water_bucket) { + user.setCurrentItemOrArmor(0, new ItemStack(Items.bucket)); + addCapacity(bucket); + return true; + } + if (held.getItem() == FoodListMF.jug_water) { + givePlayerItem(user, held, new ItemStack(FoodListMF.jug_empty)); + addCapacity(jug); + return true; + } + if (held.getItem() == Items.potionitem && held.getItemDamage() == 0) { + givePlayerItem(user, held, new ItemStack(Items.glass_bottle)); + addCapacity(glass_bottle); + return true; + } + } + + // Take + if (fill >= 1 && held.getItem() == Items.glass_bottle && held.getItemDamage() == 0) { + givePlayerItem(user, held, new ItemStack(Items.potionitem)); + addCapacity(-glass_bottle); + return true; + } + if (fill >= 16 && held.getItem() == Items.bucket) { + givePlayerItem(user, held, new ItemStack(Items.water_bucket)); + addCapacity(-bucket); + return true; + } + + } + return false; + } + + private void givePlayerItem(EntityPlayer user, ItemStack held, ItemStack jug) { + if (held.stackSize == 1) { + user.setCurrentItemOrArmor(0, jug); + return; + } + + --held.stackSize; + if (!user.inventory.addItemStackToInventory(jug)) { + if (!user.worldObj.isRemote) { + user.entityDropItem(jug, 0F); + } + } + } + + @Override + public void updateEntity() { + ++ticksExisted; + if (ticksExisted == 20 || ticksExisted % 100 == 0) { + syncData(); + } + if (ticksExisted % 100 == 0 && worldObj.canLightningStrikeAt(xCoord, yCoord + 1, zCoord)) { + addCapacity(1); + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("fill", fill); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + fill = nbt.getInteger("fill"); + } + + private void addCapacity(int i) { + int cap = getCapacity(); + fill = Math.min(cap, fill + i); + syncData(); + } + + @Override + public int getCapacity() { + return super.getCapacity() * capacityScale; + } + + public void syncData() { + if (worldObj.isRemote) + return; + + NetworkUtils.sendToWatchers(new TroughPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + super.sendPacketToClient(); + } + } diff --git a/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityWoodDecor.java b/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityWoodDecor.java index a6681055..9d74f3e1 100644 --- a/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityWoodDecor.java +++ b/src/main/java/minefantasy/mf2/block/tileentity/decor/TileEntityWoodDecor.java @@ -2,93 +2,82 @@ import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.decor.BlockWoodDecor; +import minefantasy.mf2.network.NetworkUtils; import minefantasy.mf2.network.packet.WoodDecorPacket; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.WorldServer; -public abstract class TileEntityWoodDecor extends TileEntity -{ - private String tex; - private CustomMaterial material; - - public TileEntityWoodDecor(String tex) - { - this.tex = tex; - this.material = CustomMaterial.getMaterial("RefinedWood"); - } - - public TileEntityWoodDecor(String tex, CustomMaterial material) - { - this.tex = tex; - this.material = material; - } - - public CustomMaterial getMaterial() - { - return this.material != null ? this.material : trySetMaterial("RefinedWood"); - } - public String getMaterialName() - { - return this.material != null ? material.name : "RefinedWood"; - } - public void setMaterial(CustomMaterial material) - { - this.material = material; - } - public CustomMaterial trySetMaterial(String materialName) - { - CustomMaterial material = CustomMaterial.getMaterial(materialName); - if(material != null) - { - this.material = material; - } - return this.material; - } - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setString("Material", this.getMaterialName()); - } - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - this.trySetMaterial(nbt.getString("Material")); - } +public abstract class TileEntityWoodDecor extends TileEntity { + private String tex; + private CustomMaterial material; - public int getCapacity() - { - CustomMaterial material = getMaterial(); - if(material != null) - { - return getCapacity(material.tier); - } - return getCapacity(0); - } - public static int getCapacity(int tier) - { - return (tier)*4 + 4; - } + public TileEntityWoodDecor(String tex) { + this.tex = tex; + this.material = CustomMaterial.getMaterial("RefinedWood"); + } - public String getTexName() - { - if(worldObj != null) - { - Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - if(block instanceof BlockWoodDecor) - { - this.tex = ((BlockWoodDecor)block).getFullTexName(); - } - } - return tex; - } + public TileEntityWoodDecor(String tex, CustomMaterial material) { + this.tex = tex; + this.material = material; + } - public void sendPacketToClient(EntityPlayer player) - { - ((WorldServer)worldObj).getEntityTracker().func_151248_b(player, new WoodDecorPacket(this).generatePacket()); - } + public static int getCapacity(int tier) { + return (tier) * 4 + 4; + } + + public CustomMaterial getMaterial() { + return this.material != null ? this.material : trySetMaterial("RefinedWood"); + } + + public void setMaterial(CustomMaterial material) { + this.material = material; + } + + public String getMaterialName() { + return this.material != null ? material.name : "RefinedWood"; + } + + public CustomMaterial trySetMaterial(String materialName) { + CustomMaterial material = CustomMaterial.getMaterial(materialName); + if (material != null) { + this.material = material; + } + return this.material; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setString("Material", this.getMaterialName()); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.trySetMaterial(nbt.getString("Material")); + } + + public int getCapacity() { + CustomMaterial material = getMaterial(); + if (material != null) { + return getCapacity(material.tier); + } + return getCapacity(0); + } + + public String getTexName() { + if (worldObj != null) { + Block block = worldObj.getBlock(xCoord, yCoord, zCoord); + if (block instanceof BlockWoodDecor) { + this.tex = ((BlockWoodDecor) block).getFullTexName(); + } + } + return tex; + } + + public void sendPacketToClient() { + NetworkUtils.sendToWatchers(new WoodDecorPacket(this).generatePacket(), (WorldServer) worldObj, this.xCoord, this.zCoord); + } } diff --git a/src/main/java/minefantasy/mf2/block/tree/BlockLeavesMF.java b/src/main/java/minefantasy/mf2/block/tree/BlockLeavesMF.java index 7a9e9066..81626994 100644 --- a/src/main/java/minefantasy/mf2/block/tree/BlockLeavesMF.java +++ b/src/main/java/minefantasy/mf2/block/tree/BlockLeavesMF.java @@ -1,7 +1,8 @@ package minefantasy.mf2.block.tree; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.list.BlockListMF; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; @@ -12,93 +13,85 @@ import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.IShearable; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockLeavesMF extends BlockLeaves implements IShearable -{ - private String name; - private Block sapling; - private int dropRate; - public BlockLeavesMF(String baseWood) - { - this(baseWood, 20); +import java.util.Random; + +public class BlockLeavesMF extends BlockLeaves implements IShearable { + private String name; + private Block sapling; + private int dropRate; + @SideOnly(Side.CLIENT) + private IIcon opaque_icon; + + public BlockLeavesMF(String baseWood) { + this(baseWood, 20); } - public BlockLeavesMF(String baseWood, int droprate) - { + + public BlockLeavesMF(String baseWood, int droprate) { this.name = baseWood.toLowerCase() + "_leaves"; - GameRegistry.registerBlock(this, name); - this.dropRate = droprate; - this.setTickRandomly(true); - this.setBlockName(name); - this.setBlockTextureName("minefantasy2:tree/"+name); + GameRegistry.registerBlock(this, name); + this.dropRate = droprate; + this.setTickRandomly(true); + this.setBlockName(name); + this.setBlockTextureName("minefantasy2:tree/" + name); } @SideOnly(Side.CLIENT) @Override - public int getRenderColor(int id) - { + public int getRenderColor(int id) { return ColorizerFoliage.getFoliageColorBasic(); } + @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) - { + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { return Blocks.leaves.shouldSideBeRendered(world, x, y, z, side); } + @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return Blocks.leaves.isOpaqueCube(); } - @Override - public int quantityDropped(Random rand) - { + @Override + public int quantityDropped(Random rand) { return 1; } - @Override - public Item getItemDropped(int meta, Random rand, int fort) - { + @Override + public Item getItemDropped(int meta, Random rand, int fort) { return Item.getItemFromBlock(getBlockDrop()); } - @Override - protected int func_150123_b(int meta) - { - return meta == 15 ? dropRate*2 : dropRate; + @Override + protected int func_150123_b(int meta) { + return meta == 15 ? dropRate * 2 : dropRate; } - - private Block getBlockDrop() - { - return this == BlockListMF.leaves_ebony ? BlockListMF.sapling_ebony : this == BlockListMF.leaves_ironbark ? BlockListMF.sapling_ironbark : BlockListMF.sapling_yew; - } - @Override - public int damageDropped(int meta) - { + + private Block getBlockDrop() { + return this == BlockListMF.leaves_ebony ? BlockListMF.sapling_ebony + : this == BlockListMF.leaves_ironbark ? BlockListMF.sapling_ironbark : BlockListMF.sapling_yew; + } + + @Override + public int damageDropped(int meta) { return 0; } - - @SideOnly(Side.CLIENT) - private IIcon opaque_icon; - + @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int meta) - { - return Blocks.leaves.isOpaqueCube() ? opaque_icon : blockIcon; + public IIcon getIcon(int side, int meta) { + return Blocks.leaves.isOpaqueCube() ? opaque_icon : blockIcon; + } + + @Override + public String[] func_150125_e() { + return new String[]{""}; } - @Override - public String[] func_150125_e() - { - return new String[]{""}; - } - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister reg) - { - super.registerBlockIcons(reg); - this.opaque_icon = reg.registerIcon(this.getTextureName()+"_opaque"); + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister reg) { + super.registerBlockIcons(reg); + this.opaque_icon = reg.registerIcon(this.getTextureName() + "_opaque"); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/block/tree/BlockLogMF.java b/src/main/java/minefantasy/mf2/block/tree/BlockLogMF.java index 413bea24..4d06525e 100644 --- a/src/main/java/minefantasy/mf2/block/tree/BlockLogMF.java +++ b/src/main/java/minefantasy/mf2/block/tree/BlockLogMF.java @@ -1,7 +1,8 @@ package minefantasy.mf2.block.tree; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.list.BlockListMF; import net.minecraft.block.Block; import net.minecraft.block.BlockLog; @@ -11,83 +12,75 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class BlockLogMF extends BlockLog -{ - private IIcon sideTex, topTex; - private String name; - - public BlockLogMF(String baseWood) - { - name = baseWood.toLowerCase() + "_log"; - GameRegistry.registerBlock(this, name); - setBlockName(name); - this.setHarvestLevel("axe", 0); - this.setCreativeTab(CreativeTabs.tabBlock); - } - - @SideOnly(Side.CLIENT) - @Override - public IIcon getIcon(int side, int meta) - { - if(meta == 15) - { - return side <= 1 ? topTex : sideTex; - } - return super.getIcon(side, meta); +import java.util.Random; + +public class BlockLogMF extends BlockLog { + private IIcon sideTex, topTex; + private String name; + private Random rand = new Random(); + + public BlockLogMF(String baseWood) { + name = baseWood.toLowerCase() + "_log"; + GameRegistry.registerBlock(this, name); + setBlockName(name); + this.setHarvestLevel("axe", 0); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + @SideOnly(Side.CLIENT) + @Override + public IIcon getIcon(int side, int meta) { + if (meta == 15) { + return side <= 1 ? topTex : sideTex; + } + return super.getIcon(side, meta); } - - @SideOnly(Side.CLIENT) - @Override - protected IIcon getSideIcon(int meta) - { - return sideTex; + + @SideOnly(Side.CLIENT) + @Override + protected IIcon getSideIcon(int meta) { + return sideTex; } @SideOnly(Side.CLIENT) @Override - protected IIcon getTopIcon(int meta) - { - return topTex; + protected IIcon getTopIcon(int meta) { + return topTex; } + @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister reg) - { - sideTex = reg.registerIcon("minefantasy2:tree/"+name+"_side"); - topTex = reg.registerIcon("minefantasy2:tree/"+name+"_top"); + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + sideTex = reg.registerIcon("minefantasy2:tree/" + name + "_side"); + topTex = reg.registerIcon("minefantasy2:tree/" + name + "_top"); } - - private Block getSaplingDrop() - { - return this == BlockListMF.log_ebony ? BlockListMF.sapling_ebony : this == BlockListMF.log_ironbark ? BlockListMF.sapling_ironbark : BlockListMF.sapling_yew; - } - private Random rand = new Random(); + + private Block getSaplingDrop() { + return this == BlockListMF.log_ebony ? BlockListMF.sapling_ebony + : this == BlockListMF.log_ironbark ? BlockListMF.sapling_ironbark : BlockListMF.sapling_yew; + } + @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) - { - super.breakBlock(world, x, y, z, block, meta); - if(meta == 15) - { - float f = this.rand .nextFloat() * 0.8F + 0.1F; - float f1 = this.rand.nextFloat() * 0.8F + 0.1F; - float f2 = this.rand.nextFloat() * 0.8F + 0.1F; - - EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(getSaplingDrop(), 1)); - - float f3 = 0.05F; - entityitem.motionX = (float)this.rand.nextGaussian() * f3; - entityitem.motionY = (float)this.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.rand.nextGaussian() * f3; - world.spawnEntityInWorld(entityitem); - } + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + super.breakBlock(world, x, y, z, block, meta); + if (meta == 15) { + float f = this.rand.nextFloat() * 0.8F + 0.1F; + float f1 = this.rand.nextFloat() * 0.8F + 0.1F; + float f2 = this.rand.nextFloat() * 0.8F + 0.1F; + + EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(getSaplingDrop(), 1)); + + float f3 = 0.05F; + entityitem.motionX = (float) this.rand.nextGaussian() * f3; + entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.rand.nextGaussian() * f3; + world.spawnEntityInWorld(entityitem); + } } + @Override - public int damageDropped(int meta) - { + public int damageDropped(int meta) { return 0; } } diff --git a/src/main/java/minefantasy/mf2/block/tree/BlockSaplingMF.java b/src/main/java/minefantasy/mf2/block/tree/BlockSaplingMF.java index fbe65fda..92a16576 100644 --- a/src/main/java/minefantasy/mf2/block/tree/BlockSaplingMF.java +++ b/src/main/java/minefantasy/mf2/block/tree/BlockSaplingMF.java @@ -1,8 +1,6 @@ package minefantasy.mf2.block.tree; -import java.util.List; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.mechanics.worldGen.WorldGenMFTree; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; @@ -10,32 +8,20 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenCanopyTree; -import net.minecraft.world.gen.feature.WorldGenForest; -import net.minecraft.world.gen.feature.WorldGenMegaJungle; -import net.minecraft.world.gen.feature.WorldGenMegaPineTree; -import net.minecraft.world.gen.feature.WorldGenSavannaTree; -import net.minecraft.world.gen.feature.WorldGenTaiga2; -import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenerator; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class BlockSaplingMF extends BlockBush implements IGrowable -{ - private final Block log, leaves; - private float growthModifier; - private String name; - - public BlockSaplingMF(String baseWood, Block log, Block leaves, float growthModifier) - { - super(Material.plants); - setStepSound(Block.soundTypeGrass); + +import java.util.Random; + +public class BlockSaplingMF extends BlockBush implements IGrowable { + private final Block log, leaves; + private float growthModifier; + private String name; + + public BlockSaplingMF(String baseWood, Block log, Block leaves, float growthModifier) { + super(Material.plants); + setStepSound(Block.soundTypeGrass); float f = 0.4F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); this.setCreativeTab(CreativeTabs.tabDecorations); @@ -43,46 +29,39 @@ public BlockSaplingMF(String baseWood, Block log, Block leaves, float growthModi name = baseWood.toLowerCase() + "_sapling"; this.log = log; this.leaves = leaves; - - setBlockTextureName("minefantasy2:tree/"+name); + + setBlockTextureName("minefantasy2:tree/" + name); GameRegistry.registerBlock(this, name); - setBlockName(name); + setBlockName(name); } /** * Ticks the block if it's been scheduled */ @Override - public void updateTick(World world, int x, int y, int z, Random rand) - { - if (!world.isRemote) - { + public void updateTick(World world, int x, int y, int z, Random rand) { + if (!world.isRemote) { super.updateTick(world, x, y, z, rand); - if (world.getBlockLightValue(x, y + 1, z) >= 9 && rand.nextFloat()*100F < (14.30F)/growthModifier) - { + if (world.getBlockLightValue(x, y + 1, z) >= 9 && rand.nextFloat() * 100F < (14.30F) / growthModifier) { this.initGrow(world, x, y, z, rand); } } } - public void initGrow(World world, int x, int y, int z, Random rand) - { + public void initGrow(World world, int x, int y, int z, Random rand) { int l = world.getBlockMetadata(x, y, z); - if ((l & 8) == 0) - { + if ((l & 8) == 0) { world.setBlockMetadataWithNotify(x, y, z, l | 8, 4); - } - else - { + } else { this.tryGrow(world, x, y, z, rand); } } - public void tryGrow(World world, int x, int y, int z, Random rand) - { - if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return; + public void tryGrow(World world, int x, int y, int z, Random rand) { + if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) + return; int l = world.getBlockMetadata(x, y, z) & 7; Object treegen = new WorldGenMFTree(true, log, leaves); int i1 = 0; @@ -92,47 +71,43 @@ public void tryGrow(World world, int x, int y, int z, Random rand) Block block = Blocks.air; world.setBlock(x, y, z, block, 0, 4); - if (!((WorldGenerator)treegen).generate(world, rand, x + i1, y, z + j1)) - { - if (flag) - { + if (!((WorldGenerator) treegen).generate(world, rand, x + i1, y, z + j1)) { + if (flag) { world.setBlock(x + i1, y, z + j1, this, l, 4); world.setBlock(x + i1 + 1, y, z + j1, this, l, 4); world.setBlock(x + i1, y, z + j1 + 1, this, l, 4); world.setBlock(x + i1 + 1, y, z + j1 + 1, this, l, 4); - } - else - { + } else { world.setBlock(x, y, z, this, l, 4); } } } - public boolean func_149880_a(World p_149880_1_, int p_149880_2_, int p_149880_3_, int p_149880_4_, int p_149880_5_) - { - return p_149880_1_.getBlock(p_149880_2_, p_149880_3_, p_149880_4_) == this && (p_149880_1_.getBlockMetadata(p_149880_2_, p_149880_3_, p_149880_4_) & 7) == p_149880_5_; + public boolean func_149880_a(World p_149880_1_, int p_149880_2_, int p_149880_3_, int p_149880_4_, + int p_149880_5_) { + return p_149880_1_.getBlock(p_149880_2_, p_149880_3_, p_149880_4_) == this + && (p_149880_1_.getBlockMetadata(p_149880_2_, p_149880_3_, p_149880_4_) & 7) == p_149880_5_; } /** * Determines the damage on the item the block drops. Used in cloth and wood. */ - public int damageDropped(int p_149692_1_) - { + public int damageDropped(int p_149692_1_) { return MathHelper.clamp_int(p_149692_1_ & 7, 0, 5); } - 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_) - { + 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; } - 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 (double)p_149852_1_.rand.nextFloat() < (0.45D)/growthModifier; + 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 p_149852_1_.rand.nextFloat() < (0.45D) / growthModifier; } - 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_) - { + 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_) { this.initGrow(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, p_149853_2_); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/FontHelper.java b/src/main/java/minefantasy/mf2/client/FontHelper.java index a2e0a6d9..201f8742 100644 --- a/src/main/java/minefantasy/mf2/client/FontHelper.java +++ b/src/main/java/minefantasy/mf2/client/FontHelper.java @@ -2,34 +2,31 @@ public final class FontHelper { - public static boolean isFormatColour(char colour) - { - return colour >= 48 && colour <= 57 || colour >= 97 && colour <= 102 || colour >= 65 && colour <= 70; - } - - public static boolean isFormatSpecial(char chars) - { - return chars >= 107 && chars <= 111 || chars >= 75 && chars <= 79 || chars == 114 || chars == 82; - } - - public static String getFormatFromString(String string) - { - String s1 = ""; - int i = -1; - int j = string.length(); - - while ((i = string.indexOf(167, i + 1)) != -1) { - if (i < j - 1) { - char c0 = string.charAt(i + 1); - - if (isFormatColour(c0)) - s1 = "\u00a7" + c0; - else if (isFormatSpecial(c0)) - s1 = s1 + "\u00a7" + c0; - } - } - - return s1; - } + public static boolean isFormatColour(char colour) { + return colour >= 48 && colour <= 57 || colour >= 97 && colour <= 102 || colour >= 65 && colour <= 70; + } + + public static boolean isFormatSpecial(char chars) { + return chars >= 107 && chars <= 111 || chars >= 75 && chars <= 79 || chars == 114 || chars == 82; + } + + public static String getFormatFromString(String string) { + String s1 = ""; + int i = -1; + int j = string.length(); + + while ((i = string.indexOf(167, i + 1)) != -1) { + if (i < j - 1) { + char c0 = string.charAt(i + 1); + + if (isFormatColour(c0)) + s1 = "\u00a7" + c0; + else if (isFormatSpecial(c0)) + s1 = s1 + "\u00a7" + c0; + } + } + + return s1; + } } diff --git a/src/main/java/minefantasy/mf2/client/KnowledgePageRegistry.java b/src/main/java/minefantasy/mf2/client/KnowledgePageRegistry.java index dc6df54a..d8825515 100644 --- a/src/main/java/minefantasy/mf2/client/KnowledgePageRegistry.java +++ b/src/main/java/minefantasy/mf2/client/KnowledgePageRegistry.java @@ -1,446 +1,908 @@ package minefantasy.mf2.client; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.knowledge.client.*; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigHardcore; import minefantasy.mf2.item.food.FoodListMF; import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.knowledge.KnowledgeListMF; -import minefantasy.mf2.material.MetalMaterial; -import minefantasy.mf2.recipe.ForgedToolRecipes; import minefantasy.mf2.recipe.ForgingRecipes; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; @SideOnly(Side.CLIENT) -public class KnowledgePageRegistry -{ - public static void registerPages() - { - ItemStack pigiron = ComponentListMF.bar("RefinedIron"); - ItemStack black = ComponentListMF.bar("BlackSteel"); - ItemStack red = ComponentListMF.bar("RedSteel"); - ItemStack blue = ComponentListMF.bar("BlueSteel"); - if(ConfigHardcore.HCCallowRocks) - { - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.hcc"), new EntryPageRecipeBase(KnowledgeListMF.carpenterRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.dirtRockR), new EntryPageRecipeCarpenter(KnowledgeListMF.stonePickR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHammerR), new EntryPageRecipeCarpenter(KnowledgeListMF.sharpRocksR)); - KnowledgeListMF.gettingStarted.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stoneSpearR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneAxeR)); - } - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.1"), new EntryPageText("knowledge.gettingStarted.2")); - - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.carpenter"), new EntryPageRecipeBase(KnowledgeListMF.carpenterRecipe)); - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.fire"), new EntryPageRecipeBase(KnowledgeListMF.firepitRecipe), new EntryPageRecipeBase(KnowledgeListMF.dryrocksR)); - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.food"), new EntryPageRecipeBase(KnowledgeListMF.cooktopRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneovenRecipe)); - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.tanning"), new EntryPageRecipeCarpenter(KnowledgeListMF.tannerRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneKnifeR)); - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.forging"), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneAnvilRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.forgeRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHammerR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneTongsR), new EntryPageRecipeBase(KnowledgeListMF.dryrocksR), new EntryPageRecipeCarpenter(KnowledgeListMF.apronRecipe)); - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.forgingbars"), new EntryPageRecipeAnvil(KnowledgeListMF.barR)); - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.flux"), new EntryPageRecipeAnvil(KnowledgeListMF.fluxR)); - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.3"), new EntryPageRecipeAnvil(KnowledgeListMF.shearsR), new EntryPageText("knowledge.gettingStarted.4"), new EntryPageText("knowledge.gettingStarted.5"), new EntryPageRecipeAnvil(KnowledgeListMF.hammerR), new EntryPageRecipeAnvil(KnowledgeListMF.tongsR), new EntryPageText("knowledge.gettingStarted.6")); - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.upgrade"), new EntryPageRecipeCarpenter(KnowledgeListMF.researchTableRecipe), new EntryPageText("knowledge.gettingStarted.7")); - KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.10"), new EntryPageRecipeCarpenter(KnowledgeListMF.potRecipe), new EntryPageSmelting(ComponentListMF.clay_pot_uncooked, ComponentListMF.clay_pot), new EntryPageRecipeCarpenter(KnowledgeListMF.quernR), new EntryPageText("knowledge.gettingStarted.11"), new EntryPageText("knowledge.gettingStarted.12")); - KnowledgeListMF.gettingStarted.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.bSalvageR), new EntryPageText("knowledge.gettingStarted.13")); - - KnowledgeListMF.research.addPages(new EntryPageText("knowledge.research.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.researchTableRecipe), new EntryPageText("knowledge.research.2")); - KnowledgeListMF.talisman.addPages(new EntryPageText("knowledge.talisman.1"), new EntryPageRecipeAnvil(KnowledgeListMF.talismanRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.artBookR), new EntryPageRecipeCarpenter(KnowledgeListMF.conBookR), new EntryPageRecipeCarpenter(KnowledgeListMF.proBookR), new EntryPageRecipeCarpenter(KnowledgeListMF.engBookR), new EntryPageRecipeCarpenter(KnowledgeListMF.comBookR), new EntryPageText("knowledge.talisman.2"), new EntryPageRecipeAnvil(KnowledgeListMF.greatTalismanRecipe)); - KnowledgeListMF.talisman.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.artBook2R), new EntryPageRecipeCarpenter(KnowledgeListMF.conBook2R), new EntryPageRecipeCarpenter(KnowledgeListMF.proBook2R), new EntryPageRecipeCarpenter(KnowledgeListMF.engBook2R), new EntryPageRecipeCarpenter(KnowledgeListMF.comBook2R)); - KnowledgeListMF.stamina.addPages(new EntryPageText("knowledge.stamina.1")); - KnowledgeListMF.combat.addPages(new EntryPageText("knowledge.combat.1"), new EntryPageText("knowledge.parry.info"), new EntryPageText("knowledge.advparry.info"), new EntryPageText("knowledge.poweratt.info"), new EntryPageText("knowledge.dodge.info"), new EntryPageText("knowledge.armour.info")); - KnowledgeListMF.craftArmourBasic.addPages(new EntryPageText("knowledge.craftArmourBasic.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.hideHelmR), new EntryPageRecipeCarpenter(KnowledgeListMF.hideChestR), new EntryPageRecipeCarpenter(KnowledgeListMF.hideLegsR), new EntryPageRecipeCarpenter(KnowledgeListMF.hideBootsR)); - KnowledgeListMF.craftArmourBasic.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.roughHelmetR), new EntryPageRecipeCarpenter(KnowledgeListMF.roughChestR), new EntryPageRecipeCarpenter(KnowledgeListMF.roughLegsR), new EntryPageRecipeCarpenter(KnowledgeListMF.roughBootsR)); - - KnowledgeListMF.carpenter.addPages(new EntryPageText("knowledge.carpenter.1"), new EntryPageRecipeBase(KnowledgeListMF.carpenterRecipe)); - KnowledgeListMF.salvage.addPages(new EntryPageText("knowledge.salvage.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bSalvageR), new EntryPageText("knowledge.salvage.2")); - - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.1")); - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.plank"), new EntryPageRecipeBase(KnowledgeListMF.plankRecipe), new EntryPageRecipeBase(KnowledgeListMF.stickRecipe)); - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.refinedplank"), new EntryPageRecipeCarpenter(KnowledgeListMF.jugRecipe), new EntryPageSmelting(FoodListMF.jug_uncooked, FoodListMF.jug_empty), new EntryPageRecipeBase(KnowledgeListMF.plantOilR), new EntryPageRecipeCarpenter(KnowledgeListMF.refinedPlankR)); - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.flux"), new EntryPageRecipeAnvil(KnowledgeListMF.fluxR)); - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.bar.1")); - KnowledgeListMF.commodities.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.barR), new EntryPageRecipeAnvil(KnowledgeListMF.baringotR)); - - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.hunks"), new EntryPageRecipeAnvil(KnowledgeListMF.hunkR), new EntryPageRecipeAnvil(KnowledgeListMF.ingotR)); - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.nail"), new EntryPageRecipeAnvil(KnowledgeListMF.nailR)); - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.rivet"), new EntryPageRecipeAnvil(KnowledgeListMF.rivetR)); - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.leatherstrip"), new EntryPageRecipeCarpenter(KnowledgeListMF.lStripsR)); - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.thread"), new EntryPageRecipeCarpenter(KnowledgeListMF.threadR), new EntryPageRecipeCarpenter(KnowledgeListMF.stringR)); - KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.bucket"), new EntryPageRecipeAnvil(KnowledgeListMF.bucketR)); - - KnowledgeListMF.dust.addPages(new EntryPageText("knowledge.dust.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.potRecipe), new EntryPageSmelting(ComponentListMF.clay_pot_uncooked, ComponentListMF.clay_pot), new EntryPageRecipeCarpenter(KnowledgeListMF.quernR), new EntryPageText("knowledge.dust.quern")); - KnowledgeListMF.dust.addPages(new EntryPageGrind(new ItemStack(Items.coal), new ItemStack(ComponentListMF.coalDust)), new EntryPageGrind(new ItemStack(ComponentListMF.kaolinite), new ItemStack(ComponentListMF.kaolinite_dust)), new EntryPageGrind(new ItemStack(Items.wheat), new ItemStack(FoodListMF.flour)), new EntryPageGrind(new ItemStack(Items.dye, 1, 3), new ItemStack(FoodListMF.coca_powder))); - KnowledgeListMF.dust.addPages(new EntryPageText("knowledge.dust.icing"), new EntryPageRecipeCarpenter(KnowledgeListMF.spoonR), new EntryPageRecipeCarpenter(KnowledgeListMF.icingRecipe)); - - KnowledgeListMF.ores.addPages(new EntryPageText("knowledge.ores.1"), new EntryPageText("")); - KnowledgeListMF.ores.addPages(assembleOreDescHC("copper", BlockListMF.oreCopper, ComponentListMF.ingots[0])); - KnowledgeListMF.ores.addPages(assembleOreDescHC("tin", BlockListMF.oreTin, ComponentListMF.ingots[1])); - KnowledgeListMF.ores.addPages(assembleOreDescHC("silver", BlockListMF.oreSilver, ComponentListMF.ingots[8])); - KnowledgeListMF.ores.addPages(assembleOreDesc("wolframite", BlockListMF.oreTungsten)); - KnowledgeListMF.ores.addPages(new EntryPageCrucible(KnowledgeListMF.wolframiteR)); - KnowledgeListMF.ores.addPages(assembleOreDesc("mythic", BlockListMF.oreMythic)); - KnowledgeListMF.ores.addPages(new EntryPageText("knowledge.ores.2")); - KnowledgeListMF.ores.addPages(assembleMineralDesc("clay", BlockListMF.oreClay)); - KnowledgeListMF.ores.addPages(assembleMineralDesc("kaolinite", BlockListMF.oreKaolinite)); - KnowledgeListMF.ores.addPages(assembleMineralDesc("limestone", BlockListMF.limestone)); - KnowledgeListMF.ores.addPages(assembleMineralDesc("borax", BlockListMF.oreBorax)); - KnowledgeListMF.ores.addPages(assembleMineralDesc("nitre", BlockListMF.oreNitre)); - KnowledgeListMF.ores.addPages(assembleMineralDesc("sulfur", BlockListMF.oreSulfur)); - - KnowledgeListMF.plants.addPages(new EntryPageText("knowledge.plants.1")); - KnowledgeListMF.plants.addPages(assembleImgPage("berry", BlockListMF.berryBush)); - KnowledgeListMF.plants.addPages(new EntryPageText("knowledge.plants.2")); - KnowledgeListMF.plants.addPages(assembleImgPage("yew", BlockListMF.log_yew)); - KnowledgeListMF.plants.addPages(assembleImgPage("ironbark", BlockListMF.log_ironbark)); - KnowledgeListMF.plants.addPages(assembleImgPage("ebony", BlockListMF.log_ebony)); - - KnowledgeListMF.minotaurs.addPages(new EntryPageText("knowledge.minotaurs.1"), new EntryPageText("knowledge.minotaurs.2"), new EntryPageText("knowledge.minotaurs.3"), new EntryPageText("knowledge.minotaurs.4")); - KnowledgeListMF.minotaurs.addPages(assembleMobDesc("minotaur")); - KnowledgeListMF.minotaurs.addPages(assembleMobDesc("minotaur_frost")); - KnowledgeListMF.minotaurs.addPages(assembleMobDesc("minotaur_dread")); - KnowledgeListMF.minotaurs.addPages(new EntryPageText("knowledge.minotaurs.combat")); - - KnowledgeListMF.dragons.addPages(new EntryPageText("knowledge.dragons.1"), new EntryPageText("knowledge.dragons.2")); - KnowledgeListMF.dragons.addPages(assembleMobDesc("red_dragon")); - KnowledgeListMF.dragons.addPages(assembleMobDesc("blue_dragon")); - KnowledgeListMF.dragons.addPages(assembleMobDesc("green_dragon")); - KnowledgeListMF.dragons.addPages(assembleMobDesc("ash_dragon")); - KnowledgeListMF.dragons.addPages(new EntryPageText("knowledge.dragons.combat")); - - KnowledgeListMF.chimney.addPages(new EntryPageText("knowledge.chimney.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.chimneyRecipe), new EntryPageText("knowledge.chimney.2"), new EntryPageRecipeCarpenter(KnowledgeListMF.wideChimneyRecipe), new EntryPageText("knowledge.chimney.3"), new EntryPageRecipeCarpenter(KnowledgeListMF.extractChimneyRecipe)); - KnowledgeListMF.chimney.addPages(new EntryPageText("knowledge.chimney.pipe"), new EntryPageRecipeAnvil(KnowledgeListMF.smokePipeR)); - KnowledgeListMF.chimney.addPages(assembleSimpleImgPage("smoke_pipe_example", "knowledge.chimney.pipe.2")); - - KnowledgeListMF.tanning.addPages(new EntryPageText("knowledge.tanning.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.tannerRecipe), new EntryPageText("knowledge.tanning.2"), new EntryPageRecipeCarpenter(KnowledgeListMF.strongRackR)); - - KnowledgeListMF.bloomery.addPages(new EntryPageText("knowledge.bloomery.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bloomeryR), new EntryPageText("knowledge.bloomery.2"), new EntryPageText("knowledge.bloomery.3")); - KnowledgeListMF.crucible.addPages(assembleSimpleImgPage("crucible_example", "knowledge.crucible.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.crucibleRecipe), new EntryPageText("knowledge.crucible.2")); - if(ConfigHardcore.HCCreduceIngots) - { - KnowledgeListMF.crucible.addPages(new EntryPageText("knowledge.crucible.hcc"), new EntryPageRecipeCarpenter(KnowledgeListMF.mouldRecipe), new EntryPageSmelting(ComponentListMF.ingot_mould_uncooked, ComponentListMF.ingot_mould)); - } - KnowledgeListMF.crucible2.addPages(assembleSimpleImgPage("fire_crucible_example", "knowledge.crucible2.1"), new EntryPageGrind(new ItemStack(ComponentListMF.kaolinite), new ItemStack(ComponentListMF.kaolinite_dust)), new EntryPageRecipeCarpenter(KnowledgeListMF.fireclayR), new EntryPageRecipeCarpenter(KnowledgeListMF.advCrucibleRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR), assembleSimpleImgPage("fire_crucible", "knowledge.crucible2.blocks")); - - KnowledgeListMF.bar.addPages(new EntryPageText("knowledge.bar.1")); - KnowledgeListMF.bar.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.barR), new EntryPageRecipeAnvil(KnowledgeListMF.baringotR)); - KnowledgeListMF.smeltCopper.addPages(new EntryPageText("knowledge.smeltCopper.1")); - KnowledgeListMF.smeltBronze.addPages(new EntryPageText("knowledge.smeltBronze.1")); - if(ConfigHardcore.HCCreduceIngots) - { - KnowledgeListMF.smeltIron.addPages(new EntryPageText("knowledge.smeltIron.1")); - KnowledgeListMF.smeltCopper.addPages(new EntryPageRecipeBloom(new ItemStack(BlockListMF.oreCopper), new ItemStack(ComponentListMF.ingots[0]))); - KnowledgeListMF.smeltBronze.addPages(new EntryPageRecipeBloom(new ItemStack(BlockListMF.oreTin), new ItemStack(ComponentListMF.ingots[1]))); - } - else - { - KnowledgeListMF.smeltCopper.addPages(new EntryPageSmelting(new ItemStack(BlockListMF.oreCopper), new ItemStack(ComponentListMF.ingots[0]))); - KnowledgeListMF.smeltBronze.addPages(new EntryPageSmelting(new ItemStack(BlockListMF.oreTin), new ItemStack(ComponentListMF.ingots[1]))); - } - KnowledgeListMF.smeltBronze.addPages(new EntryPageCrucible(KnowledgeListMF.bronze)); - KnowledgeListMF.smeltIron.addPages(new EntryPageText("knowledge.smeltIron.2")); - KnowledgeListMF.smeltPig.addPages(new EntryPageText("knowledge.smeltPig.1"), new EntryPageRecipeAnvil(KnowledgeListMF.ironPrepR), new EntryPageRecipeAnvil(KnowledgeListMF.ironPrepR2), new EntryPageBlastFurnace(ComponentListMF.iron_prep, pigiron), new EntryPageText("knowledge.blastfurn.9")); - KnowledgeListMF.smeltSteel.addPages(new EntryPageText("knowledge.smeltSteel.1"), new EntryPageRecipeAnvil(KnowledgeListMF.steelR)); - if(!ConfigHardcore.HCCreduceIngots) - { - KnowledgeListMF.smeltSteel.addPages(new EntryPageCrucible(KnowledgeListMF.steel)); - } - KnowledgeListMF.encrusted.addPages(new EntryPageText("knowledge.smeltEncrusted.1"), new EntryPageRecipeAnvil(KnowledgeListMF.diamondR), new EntryPageRecipeAnvil(KnowledgeListMF.encrustedR)); - KnowledgeListMF.obsidian.addPages(new EntryPageText("knowledge.smeltObsidian.1"), new EntryPageRecipeAnvil(KnowledgeListMF.obsidianHunkR), new EntryPageCrucible(KnowledgeListMF.obsidalloy)); - - if(ConfigHardcore.HCCreduceIngots) - { - KnowledgeListMF.smeltIron.addPages(new EntryPageRecipeBloom(new ItemStack(Blocks.iron_ore), new ItemStack(Items.iron_ingot))); - } - else - { - KnowledgeListMF.smeltIron.addPages(new EntryPageSmelting(new ItemStack(Blocks.iron_ore), new ItemStack(Items.iron_ingot))); - } - - KnowledgeListMF.apron.addPages(new EntryPageText("knowledge.apron.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.apronRecipe)); - KnowledgeListMF.bellows.addPages(new EntryPageText("knowledge.bellows.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bellowsRecipe)); - KnowledgeListMF.trough.addPages(new EntryPageText("knowledge.trough.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.woodTroughRecipe), new EntryPageText("knowledge.trough.2"), new EntryPageRecipeCarpenter(KnowledgeListMF.nailTroughR)); - KnowledgeListMF.forge.addPages(assembleSimpleImgPage("forge_example", "knowledge.forge.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.forgeRecipe), new EntryPageText("knowledge.forge.2"), new EntryPageText("knowledge.forge.3")); - KnowledgeListMF.anvil.addPages(assembleSimpleImgPage("smithy_example", "knowledge.anvil.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneAnvilRecipe), new EntryPageRecipeAnvil(ForgingRecipes.recipeMap.get("anvilCrafting")), new EntryPageText( "knowledge.anvil.2"), new EntryPageImage("textures/gui/knowledge/anvilGuiExample.png", 128, 128, ""), new EntryPageText( "knowledge.anvil.3"), new EntryPageText( "knowledge.anvil.4"), new EntryPageText( "knowledge.anvil.5")); - KnowledgeListMF.anvil.addPages(new EntryPageText("knowledge.anvil.6"), new EntryPageImage("textures/gui/knowledge/qualityExample.png", 128, 128, "knowledge.anvil.7")); - - KnowledgeListMF.smeltDragonforge.addPages(new EntryPageText("knowledge.smeltDragonforge.1"), new EntryPageText("knowledge.smeltDragonforge.2")); - KnowledgeListMF.craftOrnate.addPages(new EntryPageText("knowledge.craftOrnate.1"), new EntryPageRecipeAnvil(KnowledgeListMF.crestR)); - - KnowledgeListMF.craftArmourLight.addPages(new EntryPageText("knowledge.craftArmourLight.1"), new EntryPageText("knowledge.craftArmourLight.2"), new EntryPageRecipeCarpenter(KnowledgeListMF.roughHelmetR), new EntryPageRecipeCarpenter(KnowledgeListMF.roughChestR), new EntryPageRecipeCarpenter(KnowledgeListMF.roughLegsR), new EntryPageRecipeCarpenter(KnowledgeListMF.roughBootsR)); - KnowledgeListMF.craftArmourLight.addPages(new EntryPageText("knowledge.craftArmourLight.3")); - KnowledgeListMF.craftArmourLight.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.padding[0]), new EntryPageRecipeCarpenter(KnowledgeListMF.padding[1]), new EntryPageRecipeCarpenter(KnowledgeListMF.padding[2]), new EntryPageRecipeCarpenter(KnowledgeListMF.padding[3])); - KnowledgeListMF.craftArmourLight.addPages(new EntryPageText("knowledge.craftArmourLight.4")); - KnowledgeListMF.craftArmourLight.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.reHelmetR), new EntryPageRecipeCarpenter(KnowledgeListMF.reChestR), new EntryPageRecipeCarpenter(KnowledgeListMF.reLegsR), new EntryPageRecipeCarpenter(KnowledgeListMF.reBootsR)); - KnowledgeListMF.craftArmourLight.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.studHelmetR), new EntryPageRecipeAnvil(KnowledgeListMF.studChestR), new EntryPageRecipeAnvil(KnowledgeListMF.studLegsR), new EntryPageRecipeAnvil(KnowledgeListMF.studBootsR)); - KnowledgeListMF.craftArmourMedium.addPages(new EntryPageText("knowledge.craftArmourMedium.1"), new EntryPageRecipeAnvil(KnowledgeListMF.mailRecipes), new EntryPageRecipeAnvil(KnowledgeListMF.mailHelmetR), new EntryPageRecipeAnvil(KnowledgeListMF.mailChestR), new EntryPageRecipeAnvil(KnowledgeListMF.mailLegsR), new EntryPageRecipeAnvil(KnowledgeListMF.mailBootsR)); - KnowledgeListMF.craftArmourMedium.addPages(new EntryPageText("knowledge.craftArmourMedium.scale"), new EntryPageRecipeAnvil(KnowledgeListMF.scaleRecipes), new EntryPageRecipeAnvil(KnowledgeListMF.scaleHelmetR), new EntryPageRecipeAnvil(KnowledgeListMF.scaleChestR), new EntryPageRecipeAnvil(KnowledgeListMF.scaleLegsR), new EntryPageRecipeAnvil(KnowledgeListMF.scaleBootsR)); - KnowledgeListMF.craftArmourHeavy.addPages(new EntryPageText("knowledge.craftArmourHeavy.1"), new EntryPageText("knowledge.craftArmourHeavy.2"), new EntryPageRecipeCarpenter(KnowledgeListMF.padding)); - KnowledgeListMF.craftArmourHeavy.addPages(new EntryPageText("knowledge.craftArmourHeavy.splint"), new EntryPageRecipeAnvil(KnowledgeListMF.splintRecipes), new EntryPageRecipeAnvil(KnowledgeListMF.splintHelmetR), new EntryPageRecipeAnvil(KnowledgeListMF.splintChestR), new EntryPageRecipeAnvil(KnowledgeListMF.splintLegsR), new EntryPageRecipeAnvil(KnowledgeListMF.splintBootsR)); - KnowledgeListMF.craftArmourHeavy.addPages(new EntryPageText("knowledge.craftArmourHeavy.plate"), new EntryPageRecipeAnvil(KnowledgeListMF.plateRecipes), new EntryPageRecipeAnvil(KnowledgeListMF.plateHelmetR), new EntryPageRecipeAnvil(KnowledgeListMF.plateChestR), new EntryPageRecipeAnvil(KnowledgeListMF.plateLegsR), new EntryPageRecipeAnvil(KnowledgeListMF.plateBootsR)); - - KnowledgeListMF.coalflux.addPages(new EntryPageText("knowledge.coalflux.1"), new EntryPageGrind(new ItemStack(ComponentListMF.flux), new ItemStack(ComponentListMF.flux_pot)), new EntryPageRecipeAnvil(KnowledgeListMF.coalfluxR)); - - KnowledgeListMF.bigfurn.addPages(assembleSimpleImgPage("furnace_example", "knowledge.bigfurn.1"), new EntryPageText("knowledge.bigfurn.2")); - KnowledgeListMF.bigfurn.addPages(new EntryPageGrind(new ItemStack(ComponentListMF.kaolinite), new ItemStack(ComponentListMF.kaolinite_dust)), new EntryPageRecipeCarpenter(KnowledgeListMF.fireclayR), new EntryPageRecipeCarpenter(KnowledgeListMF.fireBrickR), new EntryPageSmelting(new ItemStack(ComponentListMF.fireclay_brick), new ItemStack(ComponentListMF.strong_brick)), new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR)); - KnowledgeListMF.bigfurn.addPages(new EntryPageText("knowledge.bigfurn.heater"), new EntryPageRecipeAnvil(KnowledgeListMF.bigHeatR), assembleSimpleImgPage("furnace_heater", BlockListMF.furnace_heater.getUnlocalizedName()+".name")); - KnowledgeListMF.bigfurn.addPages(new EntryPageText("knowledge.bigfurn.top"), new EntryPageRecipeAnvil(KnowledgeListMF.bigFurnR), assembleSimpleImgPage("furnace_full", "knowledge.bigfurn.structure")); - - - KnowledgeListMF.blastfurn.addPages(new EntryPageText("knowledge.blastfurn.1"), new EntryPageText("knowledge.blastfurn.2")); - KnowledgeListMF.blastfurn.addPages(new EntryPageGrind(new ItemStack(ComponentListMF.kaolinite), new ItemStack(ComponentListMF.kaolinite_dust)), new EntryPageRecipeCarpenter(KnowledgeListMF.fireclayR), new EntryPageRecipeCarpenter(KnowledgeListMF.fireBrickR), new EntryPageSmelting(new ItemStack(ComponentListMF.fireclay_brick), new ItemStack(ComponentListMF.strong_brick)), new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR)); - KnowledgeListMF.blastfurn.addPages(new EntryPageText("knowledge.blastfurn.3"), new EntryPageRecipeAnvil(KnowledgeListMF.blastChamR), new EntryPageRecipeAnvil(KnowledgeListMF.blastHeatR), new EntryPageText("knowledge.blastfurn.4"), new EntryPageText("knowledge.blastfurn.5")); - KnowledgeListMF.blastfurn.addPages(new EntryPageImage("textures/gui/knowledge/blast_example.png", 96, 96, "knowledge.blastfurn.6")); - KnowledgeListMF.blastfurn.addPages(new EntryPageText("knowledge.blastfurn.7")); - if(ConfigHardcore.HCCreduceIngots) - { - KnowledgeListMF.blastfurn.addPages(new EntryPageText("knowledge.blastfurn.hcc")); - } - - KnowledgeListMF.etools.addPages(new EntryPageText("knowledge.etools.1"), new EntryPageRecipeAnvil(KnowledgeListMF.spannerR), new EntryPageRecipeAnvil(KnowledgeListMF.eatoolsR)); - KnowledgeListMF.ecomponents.addPages(new EntryPageText("knowledge.ecomponents.1"), new EntryPageRecipeAnvil(KnowledgeListMF.boltR), new EntryPageText("knowledge.ecomponents.2"), new EntryPageRecipeAnvil(KnowledgeListMF.iframeR), new EntryPageRecipeAnvil(KnowledgeListMF.bgearR), new EntryPageRecipeAnvil(KnowledgeListMF.tgearR), new EntryPageRecipeAnvil(KnowledgeListMF.istrutR), new EntryPageRecipeAnvil(KnowledgeListMF.stubeR)); - KnowledgeListMF.tungsten.addPages(new EntryPageText("knowledge.tungsten.1"), new EntryPageText("knowledge.tungsten.2"), new EntryPageText("knowledge.tungsten.3"), new EntryPageCrucible(KnowledgeListMF.wolframiteR)); - KnowledgeListMF.climber.addPages(new EntryPageText("knowledge.climber.1"), new EntryPageRecipeAnvil(KnowledgeListMF.climbPickbR), new EntryPageText("knowledge.climber.2")); - KnowledgeListMF.spyglass.addPages(new EntryPageText("knowledge.spyglass.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.spyglassR)); - KnowledgeListMF.parachute.addPages(new EntryPageText("knowledge.parachute.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.parachuteR)); - KnowledgeListMF.syringe.addPages(new EntryPageText("knowledge.syringe.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.syringeR)); - KnowledgeListMF.engTanner.addPages(new EntryPageText("knowledge.engTanner.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.engTannerR)); - KnowledgeListMF.advcrucible.addPages(assembleSimpleImgPage("auto_crucible_example", BlockListMF.crucibleauto.getUnlocalizedName()+".name"), new EntryPageText("knowledge.advcrucible.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.autoCrucibleR), new EntryPageText("knowledge.crucible2.blocks"), new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR), assembleSimpleImgPage("auto_crucible", "knowledge.basicstructure")); - KnowledgeListMF.advforge.addPages(new EntryPageText("knowledge.advforge.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.advancedForgeR)); - KnowledgeListMF.coke.addPages(new EntryPageText("knowledge.coke.1"), new EntryPageRecipeAnvil(KnowledgeListMF.coalPrepR), new EntryPageSmelting(ComponentListMF.coal_prep, ComponentListMF.coke)); - - KnowledgeListMF.blackpowder.addPages(new EntryPageText("knowledge.blackpowder.1"), new EntryPageGrind(new ItemStack(Items.coal), new ItemStack(ComponentListMF.coalDust)), new EntryPageRecipeCarpenter(KnowledgeListMF.blackpowderRec), new EntryPageRecipeCarpenter(KnowledgeListMF.crudeBombR)); - KnowledgeListMF.advblackpowder.addPages(new EntryPageText("knowledge.advblackpowder.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.advblackpowderRec)); - KnowledgeListMF.bombs.addPages(new EntryPageText("knowledge.bombs.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bombBenchCraft), new EntryPageText("knowledge.bombs.2"), new EntryPageImage("textures/gui/knowledge/bombGuiExample.png", 128, 128, "knowledge.guiSubtitle"), new EntryPageText("knowledge.bombs.3"), new EntryPageText("knowledge.bombs.4")); - KnowledgeListMF.bpress.addPages(new EntryPageText("knowledge.bpress.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bombPressCraft)); - KnowledgeListMF.bombarrow.addPages(new EntryPageText("knowledge.bombarrow.1"), new EntryPageRecipeAnvil(KnowledgeListMF.bombarrowR), new EntryPageRecipeAnvil(KnowledgeListMF.bombBoltR)); - KnowledgeListMF.shrapnel.addPages(new EntryPageText("knowledge.shrapnel.1"), new EntryPageGrind(new ItemStack(Items.flint), new ItemStack(ComponentListMF.shrapnel))); - KnowledgeListMF.firebomb.addPages(new EntryPageText("knowledge.firebomb.1"), new EntryPageText("knowledge.firebomb.2"), new EntryPageText("knowledge.firebomb.3"), new EntryPageRecipeCarpenter(KnowledgeListMF.magmaRefinedR)); - KnowledgeListMF.bombCeramic.addPages(new EntryPageText("knowledge.bombCeramic.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bombCaseCeramicR), new EntryPageSmelting(ComponentListMF.bomb_casing_uncooked, ComponentListMF.bomb_casing)); - KnowledgeListMF.bombIron.addPages(new EntryPageText("knowledge.bombIron.1"), new EntryPageRecipeAnvil(KnowledgeListMF.bombCaseIronR)); - KnowledgeListMF.bombObsidian.addPages(new EntryPageText("knowledge.bombObsidian.1"), new EntryPageRecipeAnvil(KnowledgeListMF.bombCaseObsidianR)); - KnowledgeListMF.bombCrystal.addPages(new EntryPageText("knowledge.bombCrystal.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bombCaseCrystalR)); - - KnowledgeListMF.mineCeramic.addPages(new EntryPageText("knowledge.mineCeramic.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.mineCaseCeramicR), new EntryPageSmelting(ComponentListMF.mine_casing_uncooked, ComponentListMF.mine_casing)); - KnowledgeListMF.mineIron.addPages(new EntryPageText("knowledge.mineIron.1"), new EntryPageRecipeAnvil(KnowledgeListMF.mineCaseIronR)); - KnowledgeListMF.mineObsidian.addPages(new EntryPageText("knowledge.mineObsidian.1"), new EntryPageRecipeAnvil(KnowledgeListMF.mineCaseObsidianR)); - KnowledgeListMF.mineCrystal.addPages(new EntryPageText("knowledge.mineCrystal.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.mineCaseCrystalR)); - KnowledgeListMF.bombFuse.addPages(new EntryPageText("knowledge.bombFuse.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bombFuseR), new EntryPageText("knowledge.bombFuse.2"), new EntryPageRecipeCarpenter(KnowledgeListMF.longFuseR)); - KnowledgeListMF.stickybomb.addPages(new EntryPageText("knowledge.stickybomb.1"), new EntryPageText("knowledge.stickybomb.2")); - - KnowledgeListMF.crossbows.addPages(new EntryPageText("knowledge.crossbows.1"), new EntryPageText("knowledge.crossbows.2"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossBenchCraft), new EntryPageText("knowledge.crossbows.3"), new EntryPageText("knowledge.crossbows.4"), new EntryPageText("knowledge.crossbows.5"), new EntryPageText("knowledge.crossbows.6"), new EntryPageRecipeAnvil(KnowledgeListMF.crossBoltR)); - KnowledgeListMF.crossShafts.addPages(new EntryPageText("knowledge.crossShafts.handle"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossHandleWoodR), new EntryPageText("knowledge.crossShafts.stock"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossStockWoodR)); - KnowledgeListMF.crossHeads.addPages(new EntryPageText("knowledge.crossHeads.light"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossHeadLightR), new EntryPageText("knowledge.crossHeads.medium"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossHeadMediumR), new EntryPageText("knowledge.crossHeads.heavy"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossHeadHeavyR)); - KnowledgeListMF.crossHeadAdvanced.addPages(new EntryPageText("knowledge.crossHeads.advanced"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossHeadAdvancedR)); - KnowledgeListMF.crossShaftAdvanced.addPages(new EntryPageText("knowledge.crossShafts.advanced"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossStockIronR)); - KnowledgeListMF.crossScope.addPages(new EntryPageText("knowledge.crossScope.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossScopeR)); - KnowledgeListMF.crossAmmo.addPages(new EntryPageText("knowledge.crossAmmo.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.crossAmmoR)); - KnowledgeListMF.crossBayonet.addPages(new EntryPageText("knowledge.crossBayonet.1"), new EntryPageRecipeAnvil(KnowledgeListMF.crossBayonetR)); - - KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.1"), new EntryPageText("knowledge.cogArmour.2")); - KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.station"), new EntryPageRecipeAnvil(KnowledgeListMF.frameBlockR), assembleSimpleImgPage("cogwork_station", "knowledge.cogwork_station")); - //EXAMPLE - KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.station.2"), new EntryPageRecipeAnvil(KnowledgeListMF.cogPulleyR), assembleSimpleImgPage("cogwork_station_2", "knowledge.rightclickspanner")); - - //RECIPE - KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.crafting"), new EntryPageRecipeCarpenter(KnowledgeListMF.cogShaftR), new EntryPageRecipeAnvil(KnowledgeListMF.cogHelmR), new EntryPageRecipeAnvil(KnowledgeListMF.cogChestR), new EntryPageRecipeAnvil(KnowledgeListMF.cogLegsR), assembleSimpleImgPage("cogwork_suit_craft", "knowledge.rightclickspanner")); - - KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.armour")); - KnowledgeListMF.cogArmour.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.hugePlateR), new EntryPageRecipeAnvil(KnowledgeListMF.cogPlateR)); - - KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.advantage"), new EntryPageText("knowledge.cogArmour.advantage.2"), new EntryPageText("knowledge.cogArmour.advantage.3")); - KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.disadvantage"), new EntryPageText("knowledge.cogArmour.disadvantage.2")); - KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.removal")); - - KnowledgeListMF.compPlate.addPages(new EntryPageText("knowledge.compPlate.1"), new EntryPageRecipeAnvil(KnowledgeListMF.compPlateR)); - //KnowledgeListMF.craftOrnateWeapons.addPages(new EntryPageText("knowledge.craftOrnateWeapons.1")); - - KnowledgeListMF.repair_basic.addPages(new EntryPageText("knowledge.repair_basic.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.repairBasicR)); - KnowledgeListMF.repair_advanced.addPages(new EntryPageText("knowledge.repair_advanced.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.repairAdvancedR)); - KnowledgeListMF.repair_ornate.addPages(new EntryPageText("knowledge.repair_ornate.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.repairOrnateR)); - - KnowledgeListMF.refined_planks.addPages(new EntryPageText("knowledge.refined_planks.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.nailPlanksR), new EntryPageRecipeCarpenter(KnowledgeListMF.refinedPlankBlockR), new EntryPageRecipeCarpenter(KnowledgeListMF.nailStairR), new EntryPageRecipeCarpenter(KnowledgeListMF.refinedStairR)); - KnowledgeListMF.reinforced_stone.addPages(new EntryPageText("knowledge.reinforced_stone.1"), new EntryPageRecipeAnvil(KnowledgeListMF.obsidianHunkR), new EntryPageCrucible(KnowledgeListMF.reStone)); - KnowledgeListMF.brickworks.addPages(new EntryPageText("knowledge.brickworks.1"), new EntryPageRecipeBase(KnowledgeListMF.stoneBricksR), new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR), new EntryPageRecipeCarpenter(KnowledgeListMF.fireBrickStairR)); - KnowledgeListMF.clay_wall.addPages(new EntryPageText("knowledge.clay_wall.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.clayWallR)); - KnowledgeListMF.glass.addPages(new EntryPageText("knowledge.glass.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.framedGlassR), new EntryPageRecipeCarpenter(KnowledgeListMF.windowR)); - KnowledgeListMF.thatch.addPages(new EntryPageText("knowledge.thatch.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.thatchR), new EntryPageRecipeCarpenter(KnowledgeListMF.thatchStairR)); - KnowledgeListMF.bars.addPages(new EntryPageText("knowledge.bars.1"), new EntryPageRecipeAnvil(KnowledgeListMF.barsR)); - KnowledgeListMF.paint_brush.addPages(new EntryPageText("knowledge.paint_brush.1"), new EntryPageRecipeAnvil(KnowledgeListMF.brushRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.easyPaintPlank)); - KnowledgeListMF.decorated_stone.addPages(new EntryPageText("knowledge.decorated_stone.1"), new EntryPageRecipeAnvil(KnowledgeListMF.framedStoneR), new EntryPageRecipeAnvil(KnowledgeListMF.iframedStoneR)); - - KnowledgeListMF.bed_roll.addPages(new EntryPageText("knowledge.bed_roll.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bedrollR)); - KnowledgeListMF.tool_rack.addPages(new EntryPageText("knowledge.tool_rack.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.rackRecipe), new EntryPageText("knowledge.tool_rack.rules")); - KnowledgeListMF.food_box.addPages(new EntryPageText("knowledge.food_box.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.foodboxR), new EntryPageText("knowledge.ammo_box.2")); - KnowledgeListMF.ammo_box.addPages(new EntryPageText("knowledge.ammo_box.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.ammoboxR), new EntryPageText("knowledge.ammo_box.2")); - KnowledgeListMF.big_box.addPages(new EntryPageText("knowledge.big_box.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.bigboxR), new EntryPageText("knowledge.ammo_box.2")); - - KnowledgeListMF.constructionPts.addPages(new EntryPageText("knowledge.constructionPts.1")); - KnowledgeListMF.constructionPts.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.sawnPlankR)); - KnowledgeListMF.constructionPts.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.plankPaneR)); - KnowledgeListMF.constructionPts.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.hingeRecipe)); - KnowledgeListMF.constructionPts.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.jugRecipe), new EntryPageSmelting(FoodListMF.jug_uncooked, FoodListMF.jug_empty), new EntryPageRecipeBase(KnowledgeListMF.plantOilR), new EntryPageRecipeCarpenter(KnowledgeListMF.refinedPlankR)); - - if(ConfigHardcore.HCCallowRocks) - { - KnowledgeListMF.craftHCCTools.addPages(new EntryPageText("knowledge.craftHCCTools.1"), new EntryPageText("knowledge.craftHCCTools.2")); - KnowledgeListMF.craftHCCTools.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.sharpRocksR), new EntryPageText("knowledge.craftHCCTools.3")); - KnowledgeListMF.craftHCCTools.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stonePickR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneSpadeR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneAxeR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHoeR)); - KnowledgeListMF.craftHCCTools.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stoneKnifeR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHammerR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneTongsR), new EntryPageRecipeCarpenter(KnowledgeListMF.boneNeedleR)); - KnowledgeListMF.craftHCCTools.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stoneSwordR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneMaceR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneWarR), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneSpearR)); - } - KnowledgeListMF.craftTools.addPages(new EntryPageText("knowledge.craftTools.1")); - KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.pickR)); - KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.axeR)); - KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.spadeR)); - KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.hoeR)); - KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.shearsR)); - - KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.craftAdvTools.1")); - KnowledgeListMF.craftAdvTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.handpickR)); - KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.hvypick.info"), new EntryPageRecipeAnvil(KnowledgeListMF.hvyPickR)); - KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.trow.info"), new EntryPageRecipeAnvil(KnowledgeListMF.trowR)); - KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.hvyshovel.info"), new EntryPageRecipeAnvil(KnowledgeListMF.hvyShovelR)); - KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.scythe.info"), new EntryPageRecipeAnvil(KnowledgeListMF.scytheR)); - KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.mattock.info"), new EntryPageRecipeAnvil(KnowledgeListMF.mattockR), new EntryPageText("knowledge.mattock.use")); - KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.lumber.info"), new EntryPageRecipeAnvil(KnowledgeListMF.lumberR)); - - KnowledgeListMF.firemaker.addPages(new EntryPageText("knowledge.dryrocks.info"), new EntryPageRecipeBase(KnowledgeListMF.dryrocksR)); - KnowledgeListMF.firemaker.addPages(new EntryPageText("knowledge.tinderbox.info"), new EntryPageRecipeAnvil(KnowledgeListMF.tinderboxR)); - KnowledgeListMF.firemaker.addPages(new EntryPageText("knowledge.flintsteel.info"), new EntryPageRecipeAnvil(KnowledgeListMF.flintAndSteelR)); - - KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.craftCrafters.1")); - KnowledgeListMF.craftCrafters.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHammerR), new EntryPageRecipeAnvil(KnowledgeListMF.hammerR), new EntryPageText("")); - KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.hvyhammer.info"), new EntryPageRecipeAnvil(KnowledgeListMF.hvyHammerR)); - KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.tongs.info"), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneTongsR), new EntryPageRecipeAnvil(KnowledgeListMF.tongsR), new EntryPageText("")); - KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.knife.info"), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneKnifeR), new EntryPageRecipeAnvil(KnowledgeListMF.knifeR), new EntryPageText("")); - KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.saw.info"), new EntryPageRecipeAnvil(KnowledgeListMF.sawsR)); - KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.needle.info"), new EntryPageRecipeCarpenter(KnowledgeListMF.boneNeedleR), new EntryPageRecipeAnvil(KnowledgeListMF.needleR), new EntryPageText("")); - KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.mallet.info"), new EntryPageRecipeCarpenter(KnowledgeListMF.malletR)); - KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.spoon.info"), new EntryPageRecipeCarpenter(KnowledgeListMF.spoonR)); - - KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.craftWeapons.1")); - KnowledgeListMF.craftWeapons.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.daggerR)); - KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.sword.info"), new EntryPageRecipeAnvil(KnowledgeListMF.swordR)); - KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.waraxe.info"), new EntryPageRecipeAnvil(KnowledgeListMF.waraxeR)); - KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.mace.info"), new EntryPageRecipeAnvil(KnowledgeListMF.maceR)); - KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.spear.info"), new EntryPageRecipeAnvil(KnowledgeListMF.spearR)); - KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.bow.info"), new EntryPageRecipeAnvil(KnowledgeListMF.bowR)); - - KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.craftAdvWeapons.1")); - KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.katanaR)); - KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.greatsword.info"), new EntryPageRecipeAnvil(KnowledgeListMF.gswordR)); - KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.battleaxe.info"), new EntryPageRecipeAnvil(KnowledgeListMF.battleaxeR)); - KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.warhammer.info"), new EntryPageRecipeAnvil(KnowledgeListMF.whammerR)); - KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.halbeard.info"), new EntryPageRecipeAnvil(KnowledgeListMF.halbeardR)); - KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.lance.info"), new EntryPageRecipeAnvil(KnowledgeListMF.lanceR)); - - KnowledgeListMF.arrows.addPages(new EntryPageText("knowledge.arrows.1")); - KnowledgeListMF.arrows.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.fletchingR), new EntryPageRecipeCarpenter(KnowledgeListMF.fletchingR2)); - KnowledgeListMF.arrows.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.arrowheadR)); - KnowledgeListMF.arrows.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.arrowR)); - KnowledgeListMF.arrowsBodkin.addPages(new EntryPageText("knowledge.arrowsBodkin.1")); - KnowledgeListMF.arrowsBodkin.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.bodkinheadR)); - KnowledgeListMF.arrowsBroad.addPages(new EntryPageText("knowledge.arrowsBroad.1")); - KnowledgeListMF.arrowsBroad.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.broadheadR)); - - KnowledgeListMF.smeltBlackSteel.addPages(new EntryPageText("knowledge.smeltBlackSteel.1"), new EntryPageRecipeAnvil(KnowledgeListMF.obsidianHunkR), new EntryPageCrucible(KnowledgeListMF.black), new EntryPageBlastFurnace(ComponentListMF.ingots[6], black)); - KnowledgeListMF.smeltRedSteel.addPages(new EntryPageText("knowledge.smeltRedSteel.1"), new EntryPageCrucible(KnowledgeListMF.red), new EntryPageBlastFurnace(ComponentListMF.ingots[9], red)); - KnowledgeListMF.smeltBlueSteel.addPages(new EntryPageText("knowledge.smeltBlueSteel.1"), new EntryPageCrucible(KnowledgeListMF.blue), new EntryPageBlastFurnace(ComponentListMF.ingots[11], blue)); - KnowledgeListMF.smeltAdamant.addPages(new EntryPageText("knowledge.smeltAdamantium.1"), new EntryPageText("knowledge.smeltAdamantium.2"), new EntryPageCrucible(KnowledgeListMF.adamantium)); - KnowledgeListMF.smeltMithril.addPages(new EntryPageText("knowledge.smeltMithril.1"), new EntryPageText("knowledge.smeltMithril.2"), new EntryPageCrucible(KnowledgeListMF.mithril)); - - KnowledgeListMF.smeltMaster.addPages(new EntryPageText("knowledge.smeltMaster.1"), new EntryPageText("knowledge.smeltMaster.2"), new EntryPageText("knowledge.smeltMaster.3")); - KnowledgeListMF.smeltMaster.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.trilogyRecipe)); - KnowledgeListMF.smeltIgnotumite.addPages(new EntryPageText("knowledge.smeltIgnotumite.1"), new EntryPageCrucible(KnowledgeListMF.ignotumite)); - KnowledgeListMF.smeltMithium.addPages(new EntryPageText("knowledge.smeltMithium.1"), new EntryPageCrucible(KnowledgeListMF.mithium)); - KnowledgeListMF.smeltEnderforge.addPages(new EntryPageText("knowledge.smeltEnderforge.1"), new EntryPageCrucible(KnowledgeListMF.enderforge)); - - KnowledgeListMF.firepit.addPages(new EntryPageText("knowledge.firepit.1"), new EntryPageRecipeBase(KnowledgeListMF.firepitRecipe)); - KnowledgeListMF.firepit.addPages(new EntryPageText("knowledge.firepit.2"), new EntryPageRecipeBase(KnowledgeListMF.cooktopRecipe)); - KnowledgeListMF.firepit.addPages(new EntryPageText("knowledge.firepit.3"), new EntryPageRecipeCarpenter(KnowledgeListMF.stoneovenRecipe)); - KnowledgeListMF.firepit.addPages(new EntryPageText("knowledge.firepit.4")); - - KnowledgeListMF.cookingutensil.addPages(new EntryPageText("knowledge.cookingutensil.1"), new EntryPageRecipeAnvil(KnowledgeListMF.caketinRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.pieTrayRecipe), new EntryPageSmelting(ComponentListMF.pie_tray_uncooked, FoodListMF.pie_tray)); - KnowledgeListMF.salt.addPages(new EntryPageText("knowledge.salt.1"), new EntryPageSmelting(new ItemStack(FoodListMF.bowl_water_salt), new ItemStack(FoodListMF.salt))); - KnowledgeListMF.jug.addPages(new EntryPageText("knowledge.jug.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.jugRecipe), new EntryPageSmelting(FoodListMF.jug_uncooked, FoodListMF.jug_empty), new EntryPageText("knowledge.jug.2"), new EntryPageRecipeBase(KnowledgeListMF.waterJugR), new EntryPageRecipeBase(KnowledgeListMF.milkJugR)); - - KnowledgeListMF.generic_meat.addPages(new EntryPageText("knowledge.generic_meat.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.meatRecipes), new EntryPageRecipeCarpenter(KnowledgeListMF.meatStripR), new EntryPageRecipeCarpenter(KnowledgeListMF.meatHunkR), new EntryPageGrind(new ItemStack(FoodListMF.generic_meat_uncooked), new ItemStack(FoodListMF.generic_meat_mince_uncooked))); - KnowledgeListMF.stew.addPages(new EntryPageText("knowledge.stew.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.stewRecipe)); - KnowledgeListMF.jerky.addPages(new EntryPageText("knowledge.jerky.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.jerkyRecipe)); - KnowledgeListMF.saussage.addPages(new EntryPageText("knowledge.saussage.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.gutsRecipe), new EntryPageGrind(new ItemStack(FoodListMF.breadroll), new ItemStack(FoodListMF.breadcrumbs)), new EntryPageRecipeCarpenter(KnowledgeListMF.saussageR), new EntryPageSmelting(new ItemStack(FoodListMF.saussage_raw), new ItemStack(FoodListMF.saussage_cooked))); - KnowledgeListMF.sandwitch.addPages(new EntryPageText("knowledge.sandwitch.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.breadSliceR), new EntryPageRecipeCarpenter(KnowledgeListMF.sandwitchRecipe)); - KnowledgeListMF.sandwitchBig.addPages(new EntryPageText("knowledge.sandwitchBig.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.sandwitchBigRecipe)); - KnowledgeListMF.meatpie.addPages(new EntryPageText("knowledge.meatpie.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.meatPieRecipe), new EntryPageSmelting(new ItemStack(FoodListMF.pie_meat_uncooked), new ItemStack(FoodListMF.pie_meat_cooked)), new EntryPageRecipeBase(KnowledgeListMF.meatpieOut)); - KnowledgeListMF.shepardpie.addPages(new EntryPageText("knowledge.shepardpie.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.shepardRecipe), new EntryPageSmelting(new ItemStack(FoodListMF.pie_shepard_uncooked), new ItemStack(FoodListMF.pie_shepard_cooked)), new EntryPageRecipeBase(KnowledgeListMF.shepardOut)); - - KnowledgeListMF.bread.addPages(new EntryPageText("knowledge.bread.1"), new EntryPageGrind(new ItemStack(Items.wheat), new ItemStack(FoodListMF.flour)), new EntryPageRecipeCarpenter(KnowledgeListMF.doughRecipe), new EntryPageSmelting(new ItemStack(FoodListMF.dough), new ItemStack(FoodListMF.breadroll)), new EntryPageRecipeCarpenter(KnowledgeListMF.breadRecipe), new EntryPageSmelting(new ItemStack(FoodListMF.raw_bread), new ItemStack(Items.bread)), new EntryPageRecipeCarpenter(KnowledgeListMF.pastryRecipe), new EntryPageGrind(new ItemStack(FoodListMF.breadroll), new ItemStack(FoodListMF.breadcrumbs))); - KnowledgeListMF.bread.addPages(new EntryPageText("knowledge.bread.other"), new EntryPageRecipeCarpenter(KnowledgeListMF.pumpPieR), new EntryPageSmelting(new ItemStack(FoodListMF.pie_pumpkin_uncooked), new ItemStack(FoodListMF.pie_pumpkin_cooked)), new EntryPageRecipeBase(KnowledgeListMF.pumpPieOut)); - KnowledgeListMF.bread.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.simpCakeR), new EntryPageSmelting(new ItemStack(FoodListMF.cake_simple_raw), new ItemStack(FoodListMF.cake_simple_uniced)), new EntryPageRecipeCarpenter(KnowledgeListMF.simpCakeOut)); - - KnowledgeListMF.oats.addPages(new EntryPageText("knowledge.oats.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.oatsRecipe)); - - KnowledgeListMF.berry.addPages(assembleImgPage("berry", BlockListMF.berryBush)); - KnowledgeListMF.icing.addPages(new EntryPageText("knowledge.icing.1"), new EntryPageGrind(new ItemStack(Items.reeds), new ItemStack(FoodListMF.sugarpot)), new EntryPageRecipeBase(KnowledgeListMF.sugarRecipe), new EntryPageText("knowledge.icing.2"), new EntryPageRecipeCarpenter(KnowledgeListMF.icingRecipe)); - KnowledgeListMF.sweetroll.addPages(new EntryPageText("knowledge.sweetroll.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.sweetrollRecipe), new EntryPageSmelting(new ItemStack(FoodListMF.sweetroll_raw), new ItemStack(FoodListMF.sweetroll_uniced)), new EntryPageRecipeCarpenter(KnowledgeListMF.iceSR)); - KnowledgeListMF.cake.addPages(new EntryPageText("knowledge.cake.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.cakeR), new EntryPageSmelting(new ItemStack(FoodListMF.cake_raw), new ItemStack(FoodListMF.cake_uniced)), new EntryPageRecipeCarpenter(KnowledgeListMF.cakeI)); - KnowledgeListMF.carrotcake.addPages(new EntryPageText("knowledge.carrotcake.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.carrotCakeR), new EntryPageSmelting(new ItemStack(FoodListMF.cake_carrot_raw), new ItemStack(FoodListMF.cake_carrot_uniced)), new EntryPageRecipeCarpenter(KnowledgeListMF.carrotCakeI)); - KnowledgeListMF.chococake.addPages(new EntryPageText("knowledge.chococake.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.chocoRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.chocoCakeR), new EntryPageSmelting(new ItemStack(FoodListMF.cake_choc_raw), new ItemStack(FoodListMF.cake_choc_uniced)), new EntryPageRecipeCarpenter(KnowledgeListMF.chocoCakeI)); - KnowledgeListMF.bfcake.addPages(new EntryPageText("knowledge.bfcake.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.chocoRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.bfCakeR), new EntryPageSmelting(new ItemStack(FoodListMF.cake_bf_raw), new ItemStack(FoodListMF.cake_bf_uniced)), new EntryPageRecipeCarpenter(KnowledgeListMF.bfCakeI)); - KnowledgeListMF.berrypie.addPages(new EntryPageText("knowledge.berrypie.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.berryR), new EntryPageSmelting(new ItemStack(FoodListMF.pie_berry_uncooked), new ItemStack(FoodListMF.pie_berry_cooked)), new EntryPageRecipeBase(KnowledgeListMF.berryOut)); - KnowledgeListMF.applepie.addPages(new EntryPageText("knowledge.applepie.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.appleR), new EntryPageSmelting(new ItemStack(FoodListMF.pie_apple_uncooked), new ItemStack(FoodListMF.pie_apple_cooked)), new EntryPageRecipeBase(KnowledgeListMF.appleOut)); - KnowledgeListMF.eclair.addPages(new EntryPageText("knowledge.eclair.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.eclairDoughR), new EntryPageSmelting(new ItemStack(FoodListMF.eclair_raw), new ItemStack(FoodListMF.eclair_uniced)), new EntryPageRecipeCarpenter(KnowledgeListMF.chocoRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.eclairIceR), new EntryPageRecipeCarpenter(KnowledgeListMF.custardRecipe), new EntryPageRecipeCarpenter(KnowledgeListMF.eclairFillR)); - - KnowledgeListMF.cheese.addPages(new EntryPageText("knowledge.cheese.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.curdRecipe), new EntryPageSmelting(new ItemStack(FoodListMF.curds), new ItemStack(FoodListMF.cheese_pot)), new EntryPageRecipeBase(KnowledgeListMF.cheeseOut)); - KnowledgeListMF.cheeseroll.addPages(new EntryPageText("knowledge.cheeseroll.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.cheeserollR)); - - KnowledgeListMF.bandage.addPages(new EntryPageText("knowledge.bandage.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.badBandageR), new EntryPageRecipeCarpenter(KnowledgeListMF.bandageR)); - KnowledgeListMF.bandageadv.addPages(new EntryPageText("knowledge.bandageadv.1"), new EntryPageRecipeCarpenter(KnowledgeListMF.goodBandageR)); - - //MASTERY - KnowledgeListMF.toughness.addPages(new EntryPageText("knowledge.toughness.1")); - KnowledgeListMF.fitness.addPages(new EntryPageText("knowledge.fitness.1")); - KnowledgeListMF.armourpro.addPages(new EntryPageText("knowledge.armourpro.1")); - KnowledgeListMF.parrypro.addPages(new EntryPageText("knowledge.parrypro.1")); - KnowledgeListMF.counteratt.addPages(new EntryPageText("knowledge.counteratt.1"), new EntryPageText("knowledge.counteratt.2")); - KnowledgeListMF.autoparry.addPages(new EntryPageText("knowledge.autoparry.1")); - KnowledgeListMF.firstaid.addPages(new EntryPageText("knowledge.firstaid.1")); - KnowledgeListMF.doctor.addPages(new EntryPageText("knowledge.doctor.1")); - KnowledgeListMF.scrapper.addPages(new EntryPageText("knowledge.scrapper.1")); - } - - private static EntryPage[] assembleOreDesc(String orename, Block ore, Item ingot) - { - return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/"+orename+".png", 96, 96, "knowledge.ores."+orename), new EntryPageSmelting(new ItemStack(ore), new ItemStack(ingot))}; - } - private static EntryPage[] assembleOreDescHC(String orename, Block ore, Item ingot) - { - if(ConfigHardcore.HCCreduceIngots) - { - return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/"+orename+".png", 96, 96, "knowledge.ores."+orename), new EntryPageRecipeBloom(new ItemStack(ore), new ItemStack(ingot))}; - } - return assembleOreDesc(orename, ore, ingot); - } - private static EntryPage[] assembleOreDesc(String orename, Block ore) - { - return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/"+orename+".png", 96, 96, "knowledge.ores."+orename)}; - } - private static EntryPage[] assembleMineralDesc(String orename, Block ore) - { - return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/"+orename+".png", 96, 96, "knowledge.minerals."+orename)}; - } - private static EntryPage[] assembleImgPage(String name, Block blockname) - { - return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/"+name+".png", 96, 96, "knowledge."+name+".1")}; - } - private static EntryPage[] assembleMobDesc(String name) - { - return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/mob/"+name+".png", 96, 96, "knowledge."+name+".1")}; - } - private static EntryPage assembleSimpleImgPage(String name, String text) - { - return new EntryPageImage("textures/gui/knowledge/image/"+name+".png", 96, 96, text); - } +public class KnowledgePageRegistry { + public static void registerPages() { + ItemStack pigiron = ComponentListMF.bar("PigIron"); + ItemStack black = ComponentListMF.bar("BlackSteel"); + ItemStack red = ComponentListMF.bar("RedSteel"); + ItemStack blue = ComponentListMF.bar("BlueSteel"); + if (ConfigHardcore.HCCallowRocks) { + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.hcc"), + new EntryPageRecipeBase(KnowledgeListMF.carpenterRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.dirtRockR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stonePickR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHammerR), + new EntryPageRecipeCarpenter(KnowledgeListMF.sharpRocksR)); + KnowledgeListMF.gettingStarted.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stoneSpearR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneAxeR)); + } + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.1"), + new EntryPageText("knowledge.gettingStarted.2")); + + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.carpenter"), + new EntryPageRecipeBase(KnowledgeListMF.carpenterRecipe)); + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.fire"), + new EntryPageRecipeBase(KnowledgeListMF.firepitRecipe), + new EntryPageRecipeBase(KnowledgeListMF.dryrocksR)); + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.food"), + new EntryPageRecipeBase(KnowledgeListMF.cooktopRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneovenRecipe)); + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.tanning"), + new EntryPageRecipeCarpenter(KnowledgeListMF.tannerRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneKnifeR)); + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.forging"), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneAnvilRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.forgeRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHammerR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneTongsR), + new EntryPageRecipeBase(KnowledgeListMF.dryrocksR), + new EntryPageRecipeCarpenter(KnowledgeListMF.apronRecipe)); + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.forgingbars"), + new EntryPageRecipeAnvil(KnowledgeListMF.barR)); + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.flux"), + new EntryPageRecipeAnvil(KnowledgeListMF.fluxR)); + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.3"), + new EntryPageRecipeAnvil(KnowledgeListMF.shearsR), new EntryPageText("knowledge.gettingStarted.4"), + new EntryPageText("knowledge.gettingStarted.5"), new EntryPageRecipeAnvil(KnowledgeListMF.hammerR), + new EntryPageRecipeAnvil(KnowledgeListMF.tongsR), new EntryPageText("knowledge.gettingStarted.6")); + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.upgrade"), + new EntryPageRecipeCarpenter(KnowledgeListMF.researchTableRecipe), + new EntryPageText("knowledge.gettingStarted.7")); + KnowledgeListMF.gettingStarted.addPages(new EntryPageText("knowledge.gettingStarted.10"), + new EntryPageRecipeCarpenter(KnowledgeListMF.potRecipe), + new EntryPageSmelting(ComponentListMF.clay_pot_uncooked, ComponentListMF.clay_pot), + new EntryPageRecipeCarpenter(KnowledgeListMF.quernR), new EntryPageText("knowledge.gettingStarted.11"), + new EntryPageText("knowledge.gettingStarted.12")); + KnowledgeListMF.gettingStarted.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.bSalvageR), + new EntryPageText("knowledge.gettingStarted.13")); + + KnowledgeListMF.research.addPages(new EntryPageText("knowledge.research.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.researchTableRecipe), + new EntryPageText("knowledge.research.2")); + KnowledgeListMF.talisman.addPages(new EntryPageText("knowledge.talisman.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.talismanRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.artBookR), + new EntryPageRecipeCarpenter(KnowledgeListMF.conBookR), + new EntryPageRecipeCarpenter(KnowledgeListMF.proBookR), + new EntryPageRecipeCarpenter(KnowledgeListMF.engBookR), + new EntryPageRecipeCarpenter(KnowledgeListMF.comBookR), new EntryPageText("knowledge.talisman.2"), + new EntryPageRecipeAnvil(KnowledgeListMF.greatTalismanRecipe)); + KnowledgeListMF.talisman.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.artBook2R), + new EntryPageRecipeCarpenter(KnowledgeListMF.conBook2R), + new EntryPageRecipeCarpenter(KnowledgeListMF.proBook2R), + new EntryPageRecipeCarpenter(KnowledgeListMF.engBook2R), + new EntryPageRecipeCarpenter(KnowledgeListMF.comBook2R)); + KnowledgeListMF.stamina.addPages(new EntryPageText("knowledge.stamina.1")); + KnowledgeListMF.combat.addPages(new EntryPageText("knowledge.combat.1"), + new EntryPageText("knowledge.parry.info"), new EntryPageText("knowledge.advparry.info"), + new EntryPageText("knowledge.poweratt.info"), new EntryPageText("knowledge.dodge.info"), + new EntryPageText("knowledge.armour.info")); + KnowledgeListMF.craftArmourBasic.addPages(new EntryPageText("knowledge.craftArmourBasic.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.hideHelmR), + new EntryPageRecipeCarpenter(KnowledgeListMF.hideChestR), + new EntryPageRecipeCarpenter(KnowledgeListMF.hideLegsR), + new EntryPageRecipeCarpenter(KnowledgeListMF.hideBootsR)); + KnowledgeListMF.craftArmourBasic.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.roughHelmetR), + new EntryPageRecipeCarpenter(KnowledgeListMF.roughChestR), + new EntryPageRecipeCarpenter(KnowledgeListMF.roughLegsR), + new EntryPageRecipeCarpenter(KnowledgeListMF.roughBootsR)); + + KnowledgeListMF.carpenter.addPages(new EntryPageText("knowledge.carpenter.1"), + new EntryPageRecipeBase(KnowledgeListMF.carpenterRecipe)); + KnowledgeListMF.salvage.addPages(new EntryPageText("knowledge.salvage.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bSalvageR), new EntryPageText("knowledge.salvage.2")); + + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.1")); + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.plank"), + new EntryPageRecipeBase(KnowledgeListMF.plankRecipe), + new EntryPageRecipeBase(KnowledgeListMF.stickRecipe)); + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.refinedplank"), + new EntryPageRecipeCarpenter(KnowledgeListMF.jugRecipe), + new EntryPageSmelting(FoodListMF.jug_uncooked, FoodListMF.jug_empty), + new EntryPageRecipeBase(KnowledgeListMF.plantOilR), + new EntryPageRecipeCarpenter(KnowledgeListMF.refinedPlankR)); + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.flux"), + new EntryPageRecipeAnvil(KnowledgeListMF.fluxR)); + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.bar.1")); + KnowledgeListMF.commodities.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.barR), + new EntryPageRecipeAnvil(KnowledgeListMF.baringotR)); + + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.hunks"), + new EntryPageRecipeAnvil(KnowledgeListMF.hunkR), new EntryPageRecipeAnvil(KnowledgeListMF.ingotR)); + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.nail"), + new EntryPageRecipeAnvil(KnowledgeListMF.nailR)); + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.rivet"), + new EntryPageRecipeAnvil(KnowledgeListMF.rivetR)); + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.leatherstrip"), + new EntryPageRecipeCarpenter(KnowledgeListMF.lStripsR)); + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.thread"), + new EntryPageRecipeCarpenter(KnowledgeListMF.threadR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stringR)); + KnowledgeListMF.commodities.addPages(new EntryPageText("knowledge.commodities.bucket"), + new EntryPageRecipeAnvil(KnowledgeListMF.bucketR)); + + KnowledgeListMF.dust.addPages(new EntryPageText("knowledge.dust.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.potRecipe), + new EntryPageSmelting(ComponentListMF.clay_pot_uncooked, ComponentListMF.clay_pot), + new EntryPageRecipeCarpenter(KnowledgeListMF.quernR), new EntryPageText("knowledge.dust.quern")); + KnowledgeListMF.dust.addPages( + new EntryPageGrind(new ItemStack(Items.coal), new ItemStack(ComponentListMF.coalDust)), + new EntryPageGrind(new ItemStack(ComponentListMF.kaolinite), + new ItemStack(ComponentListMF.kaolinite_dust)), + new EntryPageGrind(new ItemStack(Items.wheat), new ItemStack(FoodListMF.flour)), + new EntryPageGrind(new ItemStack(Items.dye, 1, 3), new ItemStack(FoodListMF.coca_powder))); + KnowledgeListMF.dust.addPages(new EntryPageText("knowledge.dust.icing"), + new EntryPageRecipeCarpenter(KnowledgeListMF.spoonR), + new EntryPageRecipeCarpenter(KnowledgeListMF.icingRecipe)); + + KnowledgeListMF.ores.addPages(new EntryPageText("knowledge.ores.1"), new EntryPageText("")); + KnowledgeListMF.ores.addPages(assembleOreDescHC("copper", BlockListMF.oreCopper, ComponentListMF.ingots[0])); + KnowledgeListMF.ores.addPages(assembleOreDescHC("tin", BlockListMF.oreTin, ComponentListMF.ingots[1])); + KnowledgeListMF.ores.addPages(assembleOreDescHC("silver", BlockListMF.oreSilver, ComponentListMF.ingots[8])); + KnowledgeListMF.ores.addPages(assembleOreDesc("wolframite", BlockListMF.oreTungsten)); + KnowledgeListMF.ores.addPages(new EntryPageCrucible(KnowledgeListMF.wolframiteR)); + KnowledgeListMF.ores.addPages(assembleOreDesc("mythic", BlockListMF.oreMythic)); + KnowledgeListMF.ores.addPages(new EntryPageText("knowledge.ores.2")); + KnowledgeListMF.ores.addPages(assembleMineralDesc("clay", BlockListMF.oreClay)); + KnowledgeListMF.ores.addPages(assembleMineralDesc("kaolinite", BlockListMF.oreKaolinite)); + KnowledgeListMF.ores.addPages(assembleMineralDesc("limestone", BlockListMF.limestone)); + KnowledgeListMF.ores.addPages(assembleMineralDesc("borax", BlockListMF.oreBorax)); + KnowledgeListMF.ores.addPages(assembleMineralDesc("nitre", BlockListMF.oreNitre)); + KnowledgeListMF.ores.addPages(assembleMineralDesc("sulfur", BlockListMF.oreSulfur)); + + KnowledgeListMF.plants.addPages(new EntryPageText("knowledge.plants.1")); + KnowledgeListMF.plants.addPages(assembleImgPage("berry", BlockListMF.berryBush)); + KnowledgeListMF.plants.addPages(new EntryPageText("knowledge.plants.2")); + KnowledgeListMF.plants.addPages(assembleImgPage("yew", BlockListMF.log_yew)); + KnowledgeListMF.plants.addPages(assembleImgPage("ironbark", BlockListMF.log_ironbark)); + KnowledgeListMF.plants.addPages(assembleImgPage("ebony", BlockListMF.log_ebony)); + + KnowledgeListMF.minotaurs.addPages(new EntryPageText("knowledge.minotaurs.1"), + new EntryPageText("knowledge.minotaurs.2"), new EntryPageText("knowledge.minotaurs.3"), + new EntryPageText("knowledge.minotaurs.4")); + KnowledgeListMF.minotaurs.addPages(assembleMobDesc("minotaur")); + KnowledgeListMF.minotaurs.addPages(assembleMobDesc("minotaur_frost")); + KnowledgeListMF.minotaurs.addPages(assembleMobDesc("minotaur_dread")); + KnowledgeListMF.minotaurs.addPages(new EntryPageText("knowledge.minotaurs.combat")); + + KnowledgeListMF.dragons.addPages(new EntryPageText("knowledge.dragons.1"), + new EntryPageText("knowledge.dragons.2")); + KnowledgeListMF.dragons.addPages(assembleMobDesc("red_dragon")); + KnowledgeListMF.dragons.addPages(assembleMobDesc("blue_dragon")); + KnowledgeListMF.dragons.addPages(assembleMobDesc("green_dragon")); + KnowledgeListMF.dragons.addPages(assembleMobDesc("ash_dragon")); + KnowledgeListMF.dragons.addPages(new EntryPageText("knowledge.dragons.combat")); + + KnowledgeListMF.chimney.addPages(new EntryPageText("knowledge.chimney.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.chimneyRecipe), new EntryPageText("knowledge.chimney.2"), + new EntryPageRecipeCarpenter(KnowledgeListMF.wideChimneyRecipe), + new EntryPageText("knowledge.chimney.3"), + new EntryPageRecipeCarpenter(KnowledgeListMF.extractChimneyRecipe)); + KnowledgeListMF.chimney.addPages(new EntryPageText("knowledge.chimney.pipe"), + new EntryPageRecipeAnvil(KnowledgeListMF.smokePipeR)); + KnowledgeListMF.chimney.addPages(assembleSimpleImgPage("smoke_pipe_example", "knowledge.chimney.pipe.2")); + + KnowledgeListMF.tanning.addPages(new EntryPageText("knowledge.tanning.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.tannerRecipe), new EntryPageText("knowledge.tanning.2"), + new EntryPageRecipeCarpenter(KnowledgeListMF.strongRackR)); + + KnowledgeListMF.bloomery.addPages(new EntryPageText("knowledge.bloomery.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bloomeryR), new EntryPageText("knowledge.bloomery.2"), + new EntryPageText("knowledge.bloomery.3")); + KnowledgeListMF.crucible.addPages(assembleSimpleImgPage("crucible_example", "knowledge.crucible.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crucibleRecipe), + new EntryPageText("knowledge.crucible.2")); + if (ConfigHardcore.HCCreduceIngots) { + KnowledgeListMF.crucible.addPages(new EntryPageText("knowledge.crucible.hcc"), + new EntryPageRecipeCarpenter(KnowledgeListMF.mouldRecipe), + new EntryPageSmelting(ComponentListMF.ingot_mould_uncooked, ComponentListMF.ingot_mould)); + } + KnowledgeListMF.crucible2.addPages(assembleSimpleImgPage("fire_crucible_example", "knowledge.crucible2.1"), + new EntryPageGrind(new ItemStack(ComponentListMF.kaolinite), + new ItemStack(ComponentListMF.kaolinite_dust)), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireclayR), + new EntryPageRecipeCarpenter(KnowledgeListMF.advCrucibleRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR), + assembleSimpleImgPage("fire_crucible", "knowledge.crucible2.blocks")); + + KnowledgeListMF.bar.addPages(new EntryPageText("knowledge.bar.1")); + KnowledgeListMF.bar.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.barR), + new EntryPageRecipeAnvil(KnowledgeListMF.baringotR)); + KnowledgeListMF.smeltCopper.addPages(new EntryPageText("knowledge.smeltCopper.1")); + KnowledgeListMF.smeltBronze.addPages(new EntryPageText("knowledge.smeltBronze.1")); + if (ConfigHardcore.HCCreduceIngots) { + KnowledgeListMF.smeltIron.addPages(new EntryPageText("knowledge.smeltIron.1")); + KnowledgeListMF.smeltCopper.addPages(new EntryPageRecipeBloom(new ItemStack(BlockListMF.oreCopper), + new ItemStack(ComponentListMF.ingots[0]))); + KnowledgeListMF.smeltBronze.addPages(new EntryPageRecipeBloom(new ItemStack(BlockListMF.oreTin), + new ItemStack(ComponentListMF.ingots[1]))); + } else { + KnowledgeListMF.smeltCopper.addPages(new EntryPageSmelting(new ItemStack(BlockListMF.oreCopper), + new ItemStack(ComponentListMF.ingots[0]))); + KnowledgeListMF.smeltBronze.addPages( + new EntryPageSmelting(new ItemStack(BlockListMF.oreTin), new ItemStack(ComponentListMF.ingots[1]))); + } + KnowledgeListMF.smeltBronze.addPages(new EntryPageCrucible(KnowledgeListMF.bronze)); + KnowledgeListMF.smeltIron.addPages(new EntryPageText("knowledge.smeltIron.2")); + KnowledgeListMF.smeltPig.addPages(new EntryPageText("knowledge.smeltPig.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.ironPrepR), + new EntryPageRecipeAnvil(KnowledgeListMF.ironPrepR2), + new EntryPageBlastFurnace(ComponentListMF.iron_prep, pigiron), + new EntryPageText("knowledge.blastfurn.9")); + KnowledgeListMF.smeltSteel.addPages(new EntryPageText("knowledge.smeltSteel.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.steelR)); + if (!ConfigHardcore.HCCreduceIngots) { + KnowledgeListMF.smeltSteel.addPages(new EntryPageCrucible(KnowledgeListMF.steel)); + } + KnowledgeListMF.encrusted.addPages(new EntryPageText("knowledge.smeltEncrusted.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.diamondR), + new EntryPageRecipeAnvil(KnowledgeListMF.encrustedR)); + KnowledgeListMF.obsidian.addPages(new EntryPageText("knowledge.smeltObsidian.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.obsidianHunkR), + new EntryPageCrucible(KnowledgeListMF.obsidalloy)); + + if (ConfigHardcore.HCCreduceIngots) { + KnowledgeListMF.smeltIron.addPages( + new EntryPageRecipeBloom(new ItemStack(Blocks.iron_ore), new ItemStack(Items.iron_ingot))); + } else { + KnowledgeListMF.smeltIron + .addPages(new EntryPageSmelting(new ItemStack(Blocks.iron_ore), new ItemStack(Items.iron_ingot))); + } + + KnowledgeListMF.apron.addPages(new EntryPageText("knowledge.apron.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.apronRecipe)); + KnowledgeListMF.bellows.addPages(new EntryPageText("knowledge.bellows.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bellowsRecipe)); + KnowledgeListMF.trough.addPages(new EntryPageText("knowledge.trough.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.woodTroughRecipe), new EntryPageText("knowledge.trough.2"), + new EntryPageRecipeCarpenter(KnowledgeListMF.nailTroughR)); + KnowledgeListMF.forge.addPages(assembleSimpleImgPage("forge_example", "knowledge.forge.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.forgeRecipe), new EntryPageText("knowledge.forge.2"), + new EntryPageText("knowledge.forge.3")); + KnowledgeListMF.anvil.addPages(assembleSimpleImgPage("smithy_example", "knowledge.anvil.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneAnvilRecipe), + new EntryPageRecipeAnvil(ForgingRecipes.recipeMap.get("anvilCrafting")), + new EntryPageText("knowledge.anvil.2"), + new EntryPageImage("textures/gui/knowledge/anvilGuiExample.png", 128, 128, ""), + new EntryPageText("knowledge.anvil.3"), new EntryPageText("knowledge.anvil.4"), + new EntryPageText("knowledge.anvil.5")); + KnowledgeListMF.anvil.addPages(new EntryPageText("knowledge.anvil.6"), + new EntryPageImage("textures/gui/knowledge/qualityExample.png", 128, 128, "knowledge.anvil.7")); + + KnowledgeListMF.smeltDragonforge.addPages(new EntryPageText("knowledge.smeltDragonforge.1"), + new EntryPageText("knowledge.smeltDragonforge.2")); + KnowledgeListMF.craftOrnate.addPages(new EntryPageText("knowledge.craftOrnate.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.crestR)); + + KnowledgeListMF.craftArmourLight.addPages(new EntryPageText("knowledge.craftArmourLight.1"), + new EntryPageText("knowledge.craftArmourLight.2"), + new EntryPageRecipeCarpenter(KnowledgeListMF.roughHelmetR), + new EntryPageRecipeCarpenter(KnowledgeListMF.roughChestR), + new EntryPageRecipeCarpenter(KnowledgeListMF.roughLegsR), + new EntryPageRecipeCarpenter(KnowledgeListMF.roughBootsR)); + KnowledgeListMF.craftArmourLight.addPages(new EntryPageText("knowledge.craftArmourLight.3")); + KnowledgeListMF.craftArmourLight.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.padding[0]), + new EntryPageRecipeCarpenter(KnowledgeListMF.padding[1]), + new EntryPageRecipeCarpenter(KnowledgeListMF.padding[2]), + new EntryPageRecipeCarpenter(KnowledgeListMF.padding[3])); + KnowledgeListMF.craftArmourLight.addPages(new EntryPageText("knowledge.craftArmourLight.4")); + KnowledgeListMF.craftArmourLight.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.reHelmetR), + new EntryPageRecipeCarpenter(KnowledgeListMF.reChestR), + new EntryPageRecipeCarpenter(KnowledgeListMF.reLegsR), + new EntryPageRecipeCarpenter(KnowledgeListMF.reBootsR)); + KnowledgeListMF.craftArmourLight.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.studHelmetR), + new EntryPageRecipeAnvil(KnowledgeListMF.studChestR), + new EntryPageRecipeAnvil(KnowledgeListMF.studLegsR), + new EntryPageRecipeAnvil(KnowledgeListMF.studBootsR)); + KnowledgeListMF.craftArmourMedium.addPages(new EntryPageText("knowledge.craftArmourMedium.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.mailRecipes), + new EntryPageRecipeAnvil(KnowledgeListMF.mailHelmetR), + new EntryPageRecipeAnvil(KnowledgeListMF.mailChestR), + new EntryPageRecipeAnvil(KnowledgeListMF.mailLegsR), + new EntryPageRecipeAnvil(KnowledgeListMF.mailBootsR)); + KnowledgeListMF.craftArmourMedium.addPages(new EntryPageText("knowledge.craftArmourMedium.scale"), + new EntryPageRecipeAnvil(KnowledgeListMF.scaleRecipes), + new EntryPageRecipeAnvil(KnowledgeListMF.scaleHelmetR), + new EntryPageRecipeAnvil(KnowledgeListMF.scaleChestR), + new EntryPageRecipeAnvil(KnowledgeListMF.scaleLegsR), + new EntryPageRecipeAnvil(KnowledgeListMF.scaleBootsR)); + KnowledgeListMF.craftArmourHeavy.addPages(new EntryPageText("knowledge.craftArmourHeavy.1"), + new EntryPageText("knowledge.craftArmourHeavy.2"), + new EntryPageRecipeCarpenter(KnowledgeListMF.padding)); + KnowledgeListMF.craftArmourHeavy.addPages(new EntryPageText("knowledge.craftArmourHeavy.splint"), + new EntryPageRecipeAnvil(KnowledgeListMF.splintRecipes), + new EntryPageRecipeAnvil(KnowledgeListMF.splintHelmetR), + new EntryPageRecipeAnvil(KnowledgeListMF.splintChestR), + new EntryPageRecipeAnvil(KnowledgeListMF.splintLegsR), + new EntryPageRecipeAnvil(KnowledgeListMF.splintBootsR)); + KnowledgeListMF.craftArmourHeavy.addPages(new EntryPageText("knowledge.craftArmourHeavy.plate"), + new EntryPageRecipeAnvil(KnowledgeListMF.plateRecipes), + new EntryPageRecipeAnvil(KnowledgeListMF.plateHelmetR), + new EntryPageRecipeAnvil(KnowledgeListMF.plateChestR), + new EntryPageRecipeAnvil(KnowledgeListMF.plateLegsR), + new EntryPageRecipeAnvil(KnowledgeListMF.plateBootsR)); + + KnowledgeListMF.coalflux.addPages(new EntryPageText("knowledge.coalflux.1"), + new EntryPageGrind(new ItemStack(ComponentListMF.flux), new ItemStack(ComponentListMF.flux_pot)), + new EntryPageRecipeAnvil(KnowledgeListMF.coalfluxR)); + + KnowledgeListMF.bigfurn.addPages(assembleSimpleImgPage("furnace_example", "knowledge.bigfurn.1"), + new EntryPageText("knowledge.bigfurn.2")); + KnowledgeListMF.bigfurn.addPages( + new EntryPageGrind(new ItemStack(ComponentListMF.kaolinite), + new ItemStack(ComponentListMF.kaolinite_dust)), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireclayR), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireBrickR), + new EntryPageSmelting(new ItemStack(ComponentListMF.fireclay_brick), + new ItemStack(ComponentListMF.strong_brick)), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR)); + KnowledgeListMF.bigfurn.addPages(new EntryPageText("knowledge.bigfurn.heater"), + new EntryPageRecipeAnvil(KnowledgeListMF.bigHeatR), + assembleSimpleImgPage("furnace_heater", BlockListMF.furnace_heater.getUnlocalizedName() + ".name")); + KnowledgeListMF.bigfurn.addPages(new EntryPageText("knowledge.bigfurn.top"), + new EntryPageRecipeAnvil(KnowledgeListMF.bigFurnR), + assembleSimpleImgPage("furnace_full", "knowledge.bigfurn.structure")); + + KnowledgeListMF.blastfurn.addPages(new EntryPageText("knowledge.blastfurn.1"), + new EntryPageText("knowledge.blastfurn.2")); + KnowledgeListMF.blastfurn.addPages( + new EntryPageGrind(new ItemStack(ComponentListMF.kaolinite), + new ItemStack(ComponentListMF.kaolinite_dust)), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireclayR), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireBrickR), + new EntryPageSmelting(new ItemStack(ComponentListMF.fireclay_brick), + new ItemStack(ComponentListMF.strong_brick)), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR)); + KnowledgeListMF.blastfurn.addPages(new EntryPageText("knowledge.blastfurn.3"), + new EntryPageRecipeAnvil(KnowledgeListMF.blastChamR), + new EntryPageRecipeAnvil(KnowledgeListMF.blastHeatR), new EntryPageText("knowledge.blastfurn.4"), + new EntryPageText("knowledge.blastfurn.5")); + KnowledgeListMF.blastfurn.addPages( + new EntryPageImage("textures/gui/knowledge/blast_example.png", 96, 96, "knowledge.blastfurn.6")); + KnowledgeListMF.blastfurn.addPages(new EntryPageText("knowledge.blastfurn.7")); + if (ConfigHardcore.HCCreduceIngots) { + KnowledgeListMF.blastfurn.addPages(new EntryPageText("knowledge.blastfurn.hcc")); + } + + KnowledgeListMF.etools.addPages(new EntryPageText("knowledge.etools.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.spannerR), new EntryPageRecipeAnvil(KnowledgeListMF.eatoolsR)); + KnowledgeListMF.ecomponents.addPages(new EntryPageText("knowledge.ecomponents.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.boltR), new EntryPageText("knowledge.ecomponents.2"), + new EntryPageRecipeAnvil(KnowledgeListMF.iframeR), new EntryPageRecipeAnvil(KnowledgeListMF.bgearR), + new EntryPageRecipeAnvil(KnowledgeListMF.tgearR), new EntryPageRecipeAnvil(KnowledgeListMF.istrutR), + new EntryPageRecipeAnvil(KnowledgeListMF.stubeR)); + KnowledgeListMF.tungsten.addPages(new EntryPageText("knowledge.tungsten.1"), + new EntryPageText("knowledge.tungsten.2"), new EntryPageText("knowledge.tungsten.3"), + new EntryPageCrucible(KnowledgeListMF.wolframiteR)); + KnowledgeListMF.climber.addPages(new EntryPageText("knowledge.climber.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.climbPickbR), new EntryPageText("knowledge.climber.2")); + KnowledgeListMF.spyglass.addPages(new EntryPageText("knowledge.spyglass.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.spyglassR)); + KnowledgeListMF.parachute.addPages(new EntryPageText("knowledge.parachute.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.parachuteR)); + KnowledgeListMF.syringe.addPages(new EntryPageText("knowledge.syringe.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.syringeR)); + KnowledgeListMF.engTanner.addPages(new EntryPageText("knowledge.engTanner.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.engTannerR)); + KnowledgeListMF.advcrucible.addPages( + assembleSimpleImgPage("auto_crucible_example", BlockListMF.crucibleauto.getUnlocalizedName() + ".name"), + new EntryPageText("knowledge.advcrucible.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.autoCrucibleR), + new EntryPageText("knowledge.crucible2.blocks"), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR), + assembleSimpleImgPage("auto_crucible", "knowledge.basicstructure")); + KnowledgeListMF.advforge.addPages(new EntryPageText("knowledge.advforge.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.advancedForgeR)); + KnowledgeListMF.coke.addPages(new EntryPageText("knowledge.coke.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.coalPrepR), + new EntryPageSmelting(ComponentListMF.coal_prep, ComponentListMF.coke)); + + KnowledgeListMF.blackpowder.addPages(new EntryPageText("knowledge.blackpowder.1"), + new EntryPageGrind(new ItemStack(Items.coal), new ItemStack(ComponentListMF.coalDust)), + new EntryPageRecipeCarpenter(KnowledgeListMF.blackpowderRec), + new EntryPageRecipeCarpenter(KnowledgeListMF.crudeBombR)); + KnowledgeListMF.advblackpowder.addPages(new EntryPageText("knowledge.advblackpowder.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.advblackpowderRec)); + KnowledgeListMF.bombs.addPages(new EntryPageText("knowledge.bombs.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bombBenchCraft), new EntryPageText("knowledge.bombs.2"), + new EntryPageImage("textures/gui/knowledge/bombGuiExample.png", 128, 128, "knowledge.guiSubtitle"), + new EntryPageText("knowledge.bombs.3"), new EntryPageText("knowledge.bombs.4")); + KnowledgeListMF.bpress.addPages(new EntryPageText("knowledge.bpress.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bombPressCraft)); + KnowledgeListMF.bombarrow.addPages(new EntryPageText("knowledge.bombarrow.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.bombarrowR), + new EntryPageRecipeAnvil(KnowledgeListMF.bombBoltR)); + KnowledgeListMF.shrapnel.addPages(new EntryPageText("knowledge.shrapnel.1"), + new EntryPageGrind(new ItemStack(Items.flint), new ItemStack(ComponentListMF.shrapnel))); + KnowledgeListMF.firebomb.addPages(new EntryPageText("knowledge.firebomb.1"), + new EntryPageText("knowledge.firebomb.2"), new EntryPageText("knowledge.firebomb.3"), + new EntryPageRecipeCarpenter(KnowledgeListMF.magmaRefinedR)); + KnowledgeListMF.bombCeramic.addPages(new EntryPageText("knowledge.bombCeramic.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bombCaseCeramicR), + new EntryPageSmelting(ComponentListMF.bomb_casing_uncooked, ComponentListMF.bomb_casing)); + KnowledgeListMF.bombIron.addPages(new EntryPageText("knowledge.bombIron.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.bombCaseIronR)); + KnowledgeListMF.bombObsidian.addPages(new EntryPageText("knowledge.bombObsidian.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.bombCaseObsidianR)); + KnowledgeListMF.bombCrystal.addPages(new EntryPageText("knowledge.bombCrystal.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bombCaseCrystalR)); + + KnowledgeListMF.mineCeramic.addPages(new EntryPageText("knowledge.mineCeramic.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.mineCaseCeramicR), + new EntryPageSmelting(ComponentListMF.mine_casing_uncooked, ComponentListMF.mine_casing)); + KnowledgeListMF.mineIron.addPages(new EntryPageText("knowledge.mineIron.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.mineCaseIronR)); + KnowledgeListMF.mineObsidian.addPages(new EntryPageText("knowledge.mineObsidian.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.mineCaseObsidianR)); + KnowledgeListMF.mineCrystal.addPages(new EntryPageText("knowledge.mineCrystal.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.mineCaseCrystalR)); + KnowledgeListMF.bombFuse.addPages(new EntryPageText("knowledge.bombFuse.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bombFuseR), new EntryPageText("knowledge.bombFuse.2"), + new EntryPageRecipeCarpenter(KnowledgeListMF.longFuseR)); + KnowledgeListMF.stickybomb.addPages(new EntryPageText("knowledge.stickybomb.1"), + new EntryPageText("knowledge.stickybomb.2")); + + KnowledgeListMF.crossbows.addPages(new EntryPageText("knowledge.crossbows.1"), + new EntryPageText("knowledge.crossbows.2"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossBenchCraft), + new EntryPageText("knowledge.crossbows.3"), new EntryPageText("knowledge.crossbows.4"), + new EntryPageText("knowledge.crossbows.5"), new EntryPageText("knowledge.crossbows.6"), + new EntryPageRecipeAnvil(KnowledgeListMF.crossBoltR)); + KnowledgeListMF.crossShafts.addPages(new EntryPageText("knowledge.crossShafts.handle"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossHandleWoodR), + new EntryPageText("knowledge.crossShafts.stock"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossStockWoodR)); + KnowledgeListMF.crossHeads.addPages(new EntryPageText("knowledge.crossHeads.light"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossHeadLightR), + new EntryPageText("knowledge.crossHeads.medium"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossHeadMediumR), + new EntryPageText("knowledge.crossHeads.heavy"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossHeadHeavyR)); + KnowledgeListMF.crossHeadAdvanced.addPages(new EntryPageText("knowledge.crossHeads.advanced"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossHeadAdvancedR)); + KnowledgeListMF.crossShaftAdvanced.addPages(new EntryPageText("knowledge.crossShafts.advanced"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossStockIronR)); + KnowledgeListMF.crossScope.addPages(new EntryPageText("knowledge.crossScope.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossScopeR)); + KnowledgeListMF.crossAmmo.addPages(new EntryPageText("knowledge.crossAmmo.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.crossAmmoR)); + KnowledgeListMF.crossBayonet.addPages(new EntryPageText("knowledge.crossBayonet.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.crossBayonetR)); + + KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.1"), + new EntryPageText("knowledge.cogArmour.2")); + KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.station"), + new EntryPageRecipeAnvil(KnowledgeListMF.frameBlockR), + assembleSimpleImgPage("cogwork_station", "knowledge.cogwork_station")); + // EXAMPLE + KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.station.2"), + new EntryPageRecipeAnvil(KnowledgeListMF.cogPulleyR), + assembleSimpleImgPage("cogwork_station_2", "knowledge.rightclickspanner")); + + // RECIPE + KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.crafting"), + new EntryPageRecipeCarpenter(KnowledgeListMF.cogShaftR), + new EntryPageRecipeAnvil(KnowledgeListMF.cogHelmR), new EntryPageRecipeAnvil(KnowledgeListMF.cogChestR), + new EntryPageRecipeAnvil(KnowledgeListMF.cogLegsR), + assembleSimpleImgPage("cogwork_suit_craft", "knowledge.rightclickspanner")); + + KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.armour")); + KnowledgeListMF.cogArmour.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.hugePlateR), + new EntryPageRecipeAnvil(KnowledgeListMF.cogPlateR)); + + KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.advantage"), + new EntryPageText("knowledge.cogArmour.advantage.2"), + new EntryPageText("knowledge.cogArmour.advantage.3")); + KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.disadvantage"), + new EntryPageText("knowledge.cogArmour.disadvantage.2")); + KnowledgeListMF.cogArmour.addPages(new EntryPageText("knowledge.cogArmour.removal")); + + KnowledgeListMF.compPlate.addPages(new EntryPageText("knowledge.compPlate.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.compPlateR)); + // KnowledgeListMF.craftOrnateWeapons.addPages(new + // EntryPageText("knowledge.craftOrnateWeapons.1")); + + KnowledgeListMF.repair_basic.addPages(new EntryPageText("knowledge.repair_basic.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.repairBasicR)); + KnowledgeListMF.repair_advanced.addPages(new EntryPageText("knowledge.repair_advanced.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.repairAdvancedR)); + KnowledgeListMF.repair_ornate.addPages(new EntryPageText("knowledge.repair_ornate.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.repairOrnateR)); + + KnowledgeListMF.refined_planks.addPages(new EntryPageText("knowledge.refined_planks.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.nailPlanksR), + new EntryPageRecipeCarpenter(KnowledgeListMF.refinedPlankBlockR), + new EntryPageRecipeCarpenter(KnowledgeListMF.nailStairR), + new EntryPageRecipeCarpenter(KnowledgeListMF.refinedStairR)); + KnowledgeListMF.reinforced_stone.addPages(new EntryPageText("knowledge.reinforced_stone.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.obsidianHunkR), + new EntryPageCrucible(KnowledgeListMF.reStone)); + KnowledgeListMF.brickworks.addPages(new EntryPageText("knowledge.brickworks.1"), + new EntryPageRecipeBase(KnowledgeListMF.stoneBricksR), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireBricksR), + new EntryPageRecipeCarpenter(KnowledgeListMF.fireBrickStairR)); + KnowledgeListMF.clay_wall.addPages(new EntryPageText("knowledge.clay_wall.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.clayWallR)); + KnowledgeListMF.glass.addPages(new EntryPageText("knowledge.glass.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.framedGlassR), + new EntryPageRecipeCarpenter(KnowledgeListMF.windowR)); + KnowledgeListMF.thatch.addPages(new EntryPageText("knowledge.thatch.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.thatchR), + new EntryPageRecipeCarpenter(KnowledgeListMF.thatchStairR)); + KnowledgeListMF.bars.addPages(new EntryPageText("knowledge.bars.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.barsR)); + KnowledgeListMF.paint_brush.addPages(new EntryPageText("knowledge.paint_brush.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.brushRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.easyPaintPlank)); + KnowledgeListMF.decorated_stone.addPages(new EntryPageText("knowledge.decorated_stone.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.framedStoneR), + new EntryPageRecipeAnvil(KnowledgeListMF.iframedStoneR)); + + KnowledgeListMF.bed_roll.addPages(new EntryPageText("knowledge.bed_roll.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bedrollR)); + KnowledgeListMF.tool_rack.addPages(new EntryPageText("knowledge.tool_rack.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.rackRecipe), + new EntryPageText("knowledge.tool_rack.rules")); + KnowledgeListMF.food_box.addPages(new EntryPageText("knowledge.food_box.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.foodboxR), new EntryPageText("knowledge.ammo_box.2")); + KnowledgeListMF.ammo_box.addPages(new EntryPageText("knowledge.ammo_box.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.ammoboxR), new EntryPageText("knowledge.ammo_box.2")); + KnowledgeListMF.big_box.addPages(new EntryPageText("knowledge.big_box.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.bigboxR), new EntryPageText("knowledge.ammo_box.2")); + + KnowledgeListMF.constructionPts.addPages(new EntryPageText("knowledge.constructionPts.1")); + KnowledgeListMF.constructionPts.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.sawnPlankR)); + KnowledgeListMF.constructionPts.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.plankPaneR)); + KnowledgeListMF.constructionPts.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.hingeRecipe)); + KnowledgeListMF.constructionPts.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.jugRecipe), + new EntryPageSmelting(FoodListMF.jug_uncooked, FoodListMF.jug_empty), + new EntryPageRecipeBase(KnowledgeListMF.plantOilR), + new EntryPageRecipeCarpenter(KnowledgeListMF.refinedPlankR)); + + if (ConfigHardcore.HCCallowRocks) { + KnowledgeListMF.craftHCCTools.addPages(new EntryPageText("knowledge.craftHCCTools.1"), + new EntryPageText("knowledge.craftHCCTools.2")); + KnowledgeListMF.craftHCCTools.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.sharpRocksR), + new EntryPageText("knowledge.craftHCCTools.3")); + KnowledgeListMF.craftHCCTools.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stonePickR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneSpadeR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneAxeR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHoeR)); + KnowledgeListMF.craftHCCTools.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stoneKnifeR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHammerR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneTongsR), + new EntryPageRecipeCarpenter(KnowledgeListMF.boneNeedleR)); + KnowledgeListMF.craftHCCTools.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stoneSwordR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneMaceR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneWarR), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneSpearR)); + } + KnowledgeListMF.craftTools.addPages(new EntryPageText("knowledge.craftTools.1")); + KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.pickR)); + KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.axeR)); + KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.spadeR)); + KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.hoeR)); + KnowledgeListMF.craftTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.shearsR)); + + KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.craftAdvTools.1")); + KnowledgeListMF.craftAdvTools.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.handpickR)); + KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.hvypick.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.hvyPickR)); + KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.trow.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.trowR)); + KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.hvyshovel.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.hvyShovelR)); + KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.scythe.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.scytheR)); + KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.mattock.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.mattockR), new EntryPageText("knowledge.mattock.use")); + KnowledgeListMF.craftAdvTools.addPages(new EntryPageText("knowledge.lumber.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.lumberR)); + + KnowledgeListMF.firemaker.addPages(new EntryPageText("knowledge.dryrocks.info"), + new EntryPageRecipeBase(KnowledgeListMF.dryrocksR)); + KnowledgeListMF.firemaker.addPages(new EntryPageText("knowledge.tinderbox.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.tinderboxR)); + KnowledgeListMF.firemaker.addPages(new EntryPageText("knowledge.flintsteel.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.flintAndSteelR)); + + KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.craftCrafters.1")); + KnowledgeListMF.craftCrafters.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.stoneHammerR), + new EntryPageRecipeAnvil(KnowledgeListMF.hammerR), new EntryPageText("")); + KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.hvyhammer.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.hvyHammerR)); + KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.tongs.info"), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneTongsR), + new EntryPageRecipeAnvil(KnowledgeListMF.tongsR), new EntryPageText("")); + KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.knife.info"), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneKnifeR), + new EntryPageRecipeAnvil(KnowledgeListMF.knifeR), new EntryPageText("")); + KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.saw.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.sawsR)); + KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.needle.info"), + new EntryPageRecipeCarpenter(KnowledgeListMF.boneNeedleR), + new EntryPageRecipeAnvil(KnowledgeListMF.needleR), new EntryPageText("")); + KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.mallet.info"), + new EntryPageRecipeCarpenter(KnowledgeListMF.malletR)); + KnowledgeListMF.craftCrafters.addPages(new EntryPageText("knowledge.spoon.info"), + new EntryPageRecipeCarpenter(KnowledgeListMF.spoonR)); + + KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.craftWeapons.1")); + KnowledgeListMF.craftWeapons.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.daggerR)); + KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.sword.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.swordR)); + KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.waraxe.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.waraxeR)); + KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.mace.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.maceR)); + KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.spear.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.spearR)); + KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.bow.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.bowR)); + + //NEW + KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.saber.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.saberR)); + KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.gladius.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.gladiusR)); + KnowledgeListMF.craftWeapons.addPages(new EntryPageText("knowledge.shortsword.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.shortswordR)); + + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.craftAdvWeapons.1")); + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.katanaR)); + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.greatsword.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.gswordR)); + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.battleaxe.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.battleaxeR)); + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.warhammer.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.whammerR)); + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.halbeard.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.halbeardR)); + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.lance.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.lanceR)); + //NEW + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.claymore.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.claymoreR)); + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.longsword.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.longswordR)); + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.nodachi.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.nodachiR)); + KnowledgeListMF.craftAdvWeapons.addPages(new EntryPageText("knowledge.trident.info"), + new EntryPageRecipeAnvil(KnowledgeListMF.tridentR)); + + KnowledgeListMF.arrows.addPages(new EntryPageText("knowledge.arrows.1")); + KnowledgeListMF.arrows.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.fletchingR), + new EntryPageRecipeCarpenter(KnowledgeListMF.fletchingR2)); + KnowledgeListMF.arrows.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.arrowheadR)); + KnowledgeListMF.arrows.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.arrowR)); + KnowledgeListMF.arrowsBodkin.addPages(new EntryPageText("knowledge.arrowsBodkin.1")); + KnowledgeListMF.arrowsBodkin.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.bodkinheadR)); + KnowledgeListMF.arrowsBroad.addPages(new EntryPageText("knowledge.arrowsBroad.1")); + KnowledgeListMF.arrowsBroad.addPages(new EntryPageRecipeAnvil(KnowledgeListMF.broadheadR)); + + KnowledgeListMF.smeltBlackSteel.addPages(new EntryPageText("knowledge.smeltBlackSteel.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.obsidianHunkR), new EntryPageCrucible(KnowledgeListMF.black), + new EntryPageBlastFurnace(ComponentListMF.ingots[6], black)); + KnowledgeListMF.smeltRedSteel.addPages(new EntryPageText("knowledge.smeltRedSteel.1"), + new EntryPageCrucible(KnowledgeListMF.red), new EntryPageBlastFurnace(ComponentListMF.ingots[9], red)); + KnowledgeListMF.smeltBlueSteel.addPages(new EntryPageText("knowledge.smeltBlueSteel.1"), + new EntryPageCrucible(KnowledgeListMF.blue), + new EntryPageBlastFurnace(ComponentListMF.ingots[11], blue)); + KnowledgeListMF.smeltAdamant.addPages(new EntryPageText("knowledge.smeltAdamantium.1"), + new EntryPageText("knowledge.smeltAdamantium.2"), new EntryPageCrucible(KnowledgeListMF.adamantium)); + KnowledgeListMF.smeltMithril.addPages(new EntryPageText("knowledge.smeltMithril.1"), + new EntryPageText("knowledge.smeltMithril.2"), new EntryPageCrucible(KnowledgeListMF.mithril)); + + KnowledgeListMF.smeltMaster.addPages(new EntryPageText("knowledge.smeltMaster.1"), + new EntryPageText("knowledge.smeltMaster.2"), new EntryPageText("knowledge.smeltMaster.3")); + KnowledgeListMF.smeltMaster.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.trilogyRecipe)); + KnowledgeListMF.smeltIgnotumite.addPages(new EntryPageText("knowledge.smeltIgnotumite.1"), + new EntryPageCrucible(KnowledgeListMF.ignotumite)); + KnowledgeListMF.smeltMithium.addPages(new EntryPageText("knowledge.smeltMithium.1"), + new EntryPageCrucible(KnowledgeListMF.mithium)); + KnowledgeListMF.smeltEnderforge.addPages(new EntryPageText("knowledge.smeltEnderforge.1"), + new EntryPageCrucible(KnowledgeListMF.enderforge)); + + KnowledgeListMF.firepit.addPages(new EntryPageText("knowledge.firepit.1"), + new EntryPageRecipeBase(KnowledgeListMF.firepitRecipe)); + KnowledgeListMF.firepit.addPages(new EntryPageText("knowledge.firepit.2"), + new EntryPageRecipeBase(KnowledgeListMF.cooktopRecipe)); + KnowledgeListMF.firepit.addPages(new EntryPageText("knowledge.firepit.3"), + new EntryPageRecipeCarpenter(KnowledgeListMF.stoneovenRecipe)); + KnowledgeListMF.firepit.addPages(new EntryPageText("knowledge.firepit.4")); + + KnowledgeListMF.cookingutensil.addPages(new EntryPageText("knowledge.cookingutensil.1"), + new EntryPageRecipeAnvil(KnowledgeListMF.caketinRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.pieTrayRecipe), + new EntryPageSmelting(ComponentListMF.pie_tray_uncooked, FoodListMF.pie_tray)); + KnowledgeListMF.salt.addPages(new EntryPageText("knowledge.salt.1"), + new EntryPageSmelting(new ItemStack(FoodListMF.bowl_water_salt), new ItemStack(FoodListMF.salt))); + KnowledgeListMF.jug.addPages(new EntryPageText("knowledge.jug.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.jugRecipe), + new EntryPageSmelting(FoodListMF.jug_uncooked, FoodListMF.jug_empty), + new EntryPageText("knowledge.jug.2"), new EntryPageRecipeBase(KnowledgeListMF.waterJugR), + new EntryPageRecipeBase(KnowledgeListMF.milkJugR)); + + KnowledgeListMF.generic_meat.addPages(new EntryPageText("knowledge.generic_meat.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.meatRecipes), + new EntryPageRecipeCarpenter(KnowledgeListMF.meatStripR), + new EntryPageRecipeCarpenter(KnowledgeListMF.meatHunkR), + new EntryPageGrind(new ItemStack(FoodListMF.generic_meat_uncooked), + new ItemStack(FoodListMF.generic_meat_mince_uncooked))); + KnowledgeListMF.stew.addPages(new EntryPageText("knowledge.stew.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.stewRecipe)); + KnowledgeListMF.jerky.addPages(new EntryPageText("knowledge.jerky.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.jerkyRecipe)); + KnowledgeListMF.saussage.addPages(new EntryPageText("knowledge.saussage.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.gutsRecipe), + new EntryPageGrind(new ItemStack(FoodListMF.breadroll), new ItemStack(FoodListMF.breadcrumbs)), + new EntryPageRecipeCarpenter(KnowledgeListMF.saussageR), new EntryPageSmelting( + new ItemStack(FoodListMF.saussage_raw), new ItemStack(FoodListMF.saussage_cooked))); + KnowledgeListMF.sandwitch.addPages(new EntryPageText("knowledge.sandwitch.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.breadSliceR), + new EntryPageRecipeCarpenter(KnowledgeListMF.sandwitchRecipe)); + KnowledgeListMF.sandwitchBig.addPages(new EntryPageText("knowledge.sandwitchBig.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.sandwitchBigRecipe)); + KnowledgeListMF.meatpie.addPages(new EntryPageText("knowledge.meatpie.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.meatPieRecipe), + new EntryPageSmelting(new ItemStack(FoodListMF.pie_meat_uncooked), + new ItemStack(FoodListMF.pie_meat_cooked)), + new EntryPageRecipeBase(KnowledgeListMF.meatpieOut)); + KnowledgeListMF.shepardpie.addPages(new EntryPageText("knowledge.shepardpie.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.shepardRecipe), + new EntryPageSmelting(new ItemStack(FoodListMF.pie_shepard_uncooked), + new ItemStack(FoodListMF.pie_shepard_cooked)), + new EntryPageRecipeBase(KnowledgeListMF.shepardOut)); + + KnowledgeListMF.bread.addPages(new EntryPageText("knowledge.bread.1"), + new EntryPageGrind(new ItemStack(Items.wheat), new ItemStack(FoodListMF.flour)), + new EntryPageRecipeCarpenter(KnowledgeListMF.doughRecipe), + new EntryPageSmelting(new ItemStack(FoodListMF.dough), new ItemStack(FoodListMF.breadroll)), + new EntryPageRecipeCarpenter(KnowledgeListMF.breadRecipe), + new EntryPageSmelting(new ItemStack(FoodListMF.raw_bread), new ItemStack(Items.bread)), + new EntryPageRecipeCarpenter(KnowledgeListMF.pastryRecipe), + new EntryPageGrind(new ItemStack(FoodListMF.breadroll), new ItemStack(FoodListMF.breadcrumbs))); + KnowledgeListMF.bread.addPages(new EntryPageText("knowledge.bread.other"), + new EntryPageRecipeCarpenter(KnowledgeListMF.pumpPieR), + new EntryPageSmelting(new ItemStack(FoodListMF.pie_pumpkin_uncooked), + new ItemStack(FoodListMF.pie_pumpkin_cooked)), + new EntryPageRecipeBase(KnowledgeListMF.pumpPieOut)); + KnowledgeListMF.bread.addPages(new EntryPageRecipeCarpenter(KnowledgeListMF.simpCakeR), + new EntryPageSmelting(new ItemStack(FoodListMF.cake_simple_raw), + new ItemStack(FoodListMF.cake_simple_uniced)), + new EntryPageRecipeCarpenter(KnowledgeListMF.simpCakeOut)); + + KnowledgeListMF.oats.addPages(new EntryPageText("knowledge.oats.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.oatsRecipe)); + + KnowledgeListMF.berry.addPages(assembleImgPage("berry", BlockListMF.berryBush)); + KnowledgeListMF.icing.addPages(new EntryPageText("knowledge.icing.1"), + new EntryPageGrind(new ItemStack(Items.reeds), new ItemStack(FoodListMF.sugarpot)), + new EntryPageRecipeBase(KnowledgeListMF.sugarRecipe), new EntryPageText("knowledge.icing.2"), + new EntryPageRecipeCarpenter(KnowledgeListMF.icingRecipe)); + KnowledgeListMF.sweetroll.addPages(new EntryPageText("knowledge.sweetroll.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.sweetrollRecipe), + new EntryPageSmelting(new ItemStack(FoodListMF.sweetroll_raw), + new ItemStack(FoodListMF.sweetroll_uniced)), + new EntryPageRecipeCarpenter(KnowledgeListMF.iceSR)); + KnowledgeListMF.cake.addPages(new EntryPageText("knowledge.cake.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.cakeR), + new EntryPageSmelting(new ItemStack(FoodListMF.cake_raw), new ItemStack(FoodListMF.cake_uniced)), + new EntryPageRecipeCarpenter(KnowledgeListMF.cakeI)); + KnowledgeListMF.carrotcake.addPages(new EntryPageText("knowledge.carrotcake.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.carrotCakeR), + new EntryPageSmelting(new ItemStack(FoodListMF.cake_carrot_raw), + new ItemStack(FoodListMF.cake_carrot_uniced)), + new EntryPageRecipeCarpenter(KnowledgeListMF.carrotCakeI)); + KnowledgeListMF.chococake.addPages(new EntryPageText("knowledge.chococake.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.chocoRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.chocoCakeR), + new EntryPageSmelting(new ItemStack(FoodListMF.cake_choc_raw), + new ItemStack(FoodListMF.cake_choc_uniced)), + new EntryPageRecipeCarpenter(KnowledgeListMF.chocoCakeI)); + KnowledgeListMF.bfcake.addPages(new EntryPageText("knowledge.bfcake.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.chocoRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.bfCakeR), + new EntryPageSmelting(new ItemStack(FoodListMF.cake_bf_raw), new ItemStack(FoodListMF.cake_bf_uniced)), + new EntryPageRecipeCarpenter(KnowledgeListMF.bfCakeI)); + KnowledgeListMF.berrypie + .addPages(new EntryPageText("knowledge.berrypie.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.berryR), + new EntryPageSmelting(new ItemStack(FoodListMF.pie_berry_uncooked), + new ItemStack(FoodListMF.pie_berry_cooked)), + new EntryPageRecipeBase(KnowledgeListMF.berryOut)); + KnowledgeListMF.applepie + .addPages(new EntryPageText("knowledge.applepie.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.appleR), + new EntryPageSmelting(new ItemStack(FoodListMF.pie_apple_uncooked), + new ItemStack(FoodListMF.pie_apple_cooked)), + new EntryPageRecipeBase(KnowledgeListMF.appleOut)); + KnowledgeListMF.eclair.addPages(new EntryPageText("knowledge.eclair.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.eclairDoughR), + new EntryPageSmelting(new ItemStack(FoodListMF.eclair_raw), new ItemStack(FoodListMF.eclair_uniced)), + new EntryPageRecipeCarpenter(KnowledgeListMF.chocoRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.eclairIceR), + new EntryPageRecipeCarpenter(KnowledgeListMF.custardRecipe), + new EntryPageRecipeCarpenter(KnowledgeListMF.eclairFillR)); + + KnowledgeListMF.cheese.addPages(new EntryPageText("knowledge.cheese.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.curdRecipe), + new EntryPageSmelting(new ItemStack(FoodListMF.curds), new ItemStack(FoodListMF.cheese_pot)), + new EntryPageRecipeBase(KnowledgeListMF.cheeseOut)); + KnowledgeListMF.cheeseroll.addPages(new EntryPageText("knowledge.cheeseroll.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.cheeserollR)); + + KnowledgeListMF.bandage.addPages(new EntryPageText("knowledge.bandage.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.badBandageR), + new EntryPageRecipeCarpenter(KnowledgeListMF.bandageR)); + KnowledgeListMF.bandageadv.addPages(new EntryPageText("knowledge.bandageadv.1"), + new EntryPageRecipeCarpenter(KnowledgeListMF.goodBandageR)); + + // MASTERY + KnowledgeListMF.toughness.addPages(new EntryPageText("knowledge.toughness.1")); + KnowledgeListMF.fitness.addPages(new EntryPageText("knowledge.fitness.1")); + KnowledgeListMF.armourpro.addPages(new EntryPageText("knowledge.armourpro.1")); + KnowledgeListMF.parrypro.addPages(new EntryPageText("knowledge.parrypro.1")); + KnowledgeListMF.counteratt.addPages(new EntryPageText("knowledge.counteratt.1"), + new EntryPageText("knowledge.counteratt.2")); + KnowledgeListMF.autoparry.addPages(new EntryPageText("knowledge.autoparry.1")); + KnowledgeListMF.firstaid.addPages(new EntryPageText("knowledge.firstaid.1")); + KnowledgeListMF.doctor.addPages(new EntryPageText("knowledge.doctor.1")); + KnowledgeListMF.scrapper.addPages(new EntryPageText("knowledge.scrapper.1")); + } + + private static EntryPage[] assembleOreDesc(String orename, Block ore, Item ingot) { + return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/" + orename + ".png", 96, 96, + "knowledge.ores." + orename), new EntryPageSmelting(new ItemStack(ore), new ItemStack(ingot))}; + } + + private static EntryPage[] assembleOreDescHC(String orename, Block ore, Item ingot) { + if (ConfigHardcore.HCCreduceIngots) { + return new EntryPage[]{ + new EntryPageImage("textures/gui/knowledge/image/" + orename + ".png", 96, 96, + "knowledge.ores." + orename), + new EntryPageRecipeBloom(new ItemStack(ore), new ItemStack(ingot))}; + } + return assembleOreDesc(orename, ore, ingot); + } + + private static EntryPage[] assembleOreDesc(String orename, Block ore) { + return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/" + orename + ".png", 96, 96, + "knowledge.ores." + orename)}; + } + + private static EntryPage[] assembleMineralDesc(String orename, Block ore) { + return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/" + orename + ".png", 96, 96, + "knowledge.minerals." + orename)}; + } + + private static EntryPage[] assembleImgPage(String name, Block blockname) { + return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/" + name + ".png", 96, 96, + "knowledge." + name + ".1")}; + } + + private static EntryPage[] assembleMobDesc(String name) { + return new EntryPage[]{new EntryPageImage("textures/gui/knowledge/image/mob/" + name + ".png", 96, 96, + "knowledge." + name + ".1")}; + } + + private static EntryPage assembleSimpleImgPage(String name, String text) { + return new EntryPageImage("textures/gui/knowledge/image/" + name + ".png", 96, 96, text); + } } diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiAnvilMF.java b/src/main/java/minefantasy/mf2/client/gui/GuiAnvilMF.java index 3882c203..d2a60843 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiAnvilMF.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiAnvilMF.java @@ -1,30 +1,26 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.GuiHelper; +import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.block.tileentity.TileEntityAnvilMF; -import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.container.ContainerAnvilMF; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiAnvilMF extends GuiContainer -{ +public class GuiAnvilMF extends GuiContainer { private TileEntityAnvilMF tile; private int regularXSize = 176; private int xInvOffset = 28; - - public GuiAnvilMF(InventoryPlayer user, TileEntityAnvilMF tile) - { + + public GuiAnvilMF(InventoryPlayer user, TileEntityAnvilMF tile) { super(new ContainerAnvilMF(user, tile)); this.xSize = 235; this.ySize = 210; @@ -32,87 +28,92 @@ public GuiAnvilMF(InventoryPlayer user, TileEntityAnvilMF tile) } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { - boolean knowsCraft = tile.doesPlayerKnowCraft(mc.thePlayer); - String s = MineFantasyII.isDebug() ? "Anvil Crafting" : knowsCraft ? StatCollector.translateToLocal(tile.getResultName()) : "????"; - this.fontRendererObj.drawString(s, 10+xInvOffset, 8, 0); - + protected void drawGuiContainerForegroundLayer(int x, int y) { + boolean knowsCraft = tile.doesPlayerKnowCraft(mc.thePlayer); + String s = MineFantasyII.isDebug() ? "Anvil Crafting" + : knowsCraft ? StatCollector.translateToLocal(tile.getResultName()) : "????"; + this.fontRendererObj.drawString(s, 10 + xInvOffset, 8, 0); + int xPoint = (this.width - this.xSize) / 2 + 30; int yPoint = (this.height - this.ySize) / 2; - - if(knowsCraft && !tile.resName.equalsIgnoreCase("")) - { - if(tile.getToolNeeded() != null) - { - if(x < xPoint && x > xPoint-20 && y < yPoint+20 && y > yPoint) - { - String s2 = StatCollector.translateToLocal("tooltype."+tile.getToolNeeded()) + ", " + (tile.getToolTierNeeded() > -1 ? StatCollector.translateToLocal("attribute.mfcrafttier.name") + " " + tile.getToolTierNeeded() : StatCollector.translateToLocal("attribute.nomfcrafttier.name")); - this.fontRendererObj.drawStringWithShadow(s2, -18+xInvOffset, -12, isToolSufficient() ? 16777215 : GuiHelper.getColourForRGB(150, 0, 0)); - } - } - if(x < xPoint+regularXSize+20 && x > xPoint+regularXSize && y < yPoint+20 && y > yPoint) - { - String s2 = StatCollector.translateToLocal("tooltype.anvil") + ", " + (tile.getAnvilTierNeeded() > -1 ? StatCollector.translateToLocal("attribute.mfcrafttier.name") + " " + tile.getAnvilTierNeeded() : StatCollector.translateToLocal("attribute.nomfcrafttier.name")); - this.fontRendererObj.drawStringWithShadow(s2, regularXSize-fontRendererObj.getStringWidth(s2)+18+xInvOffset, -12, isBlockSufficient() ? 16777215 : GuiHelper.getColourForRGB(150, 0, 0)); - } + + if (knowsCraft && !tile.resName.equalsIgnoreCase("")) { + if (tile.getToolNeeded() != null) { + if (x < xPoint && x > xPoint - 20 && y < yPoint + 20 && y > yPoint) { + String s2 = StatCollector.translateToLocal("tooltype." + tile.getToolNeeded()) + ", " + + (tile.getToolTierNeeded() > -1 + ? StatCollector.translateToLocal("attribute.mfcrafttier.name") + " " + + tile.getToolTierNeeded() + : StatCollector.translateToLocal("attribute.nomfcrafttier.name")); + this.fontRendererObj.drawStringWithShadow(s2, -18 + xInvOffset, -12, + isToolSufficient() ? 16777215 : GuiHelper.getColourForRGB(150, 0, 0)); + } + } + if (x < xPoint + regularXSize + 20 && x > xPoint + regularXSize && y < yPoint + 20 && y > yPoint) { + String s2 = StatCollector.translateToLocal("tooltype.anvil") + ", " + + (tile.getAnvilTierNeeded() > -1 + ? StatCollector.translateToLocal("attribute.mfcrafttier.name") + " " + + tile.getAnvilTierNeeded() + : StatCollector.translateToLocal("attribute.nomfcrafttier.name")); + this.fontRendererObj.drawStringWithShadow(s2, + regularXSize - fontRendererObj.getStringWidth(s2) + 18 + xInvOffset, -12, + isBlockSufficient() ? 16777215 : GuiHelper.getColourForRGB(150, 0, 0)); + } } } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/anvil"+tile.getTextureName()+".png")); + this.mc.getTextureManager() + .bindTexture(TextureHelperMF.getResource("textures/gui/anvil" + tile.getTextureName() + ".png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); - - if(tile.progressMax > 0 && tile.progress > 0) - { - int progressWidth = (int)(160F/tile.progressMax*tile.progress); - this.drawTexturedModalRect(xPoint+8+xInvOffset, yPoint+21, 0, 210, progressWidth, 3); + + if (tile.progressMax > 0 && tile.progress > 0) { + int progressWidth = (int) (160F / tile.progressMax * tile.progress); + this.drawTexturedModalRect(xPoint + 8 + xInvOffset, yPoint + 21, 0, 210, progressWidth, 3); } - if(tile.doesPlayerKnowCraft(mc.thePlayer) && !tile.resName.equalsIgnoreCase("")) - { - GuiHelper.renderToolIcon(this, "anvil", tile.getAnvilTierNeeded(), xPoint+regularXSize+xInvOffset, yPoint, isBlockSufficient()); - - if(tile.getToolNeeded() != null) - { - GuiHelper.renderToolIcon(this, tile.getToolNeeded(), tile.getToolTierNeeded(), xPoint-20+xInvOffset, yPoint, isToolSufficient()); - } + if (tile.doesPlayerKnowCraft(mc.thePlayer) && !tile.resName.equalsIgnoreCase("")) { + GuiHelper.renderToolIcon(this, "anvil", tile.getAnvilTierNeeded(), xPoint + regularXSize + xInvOffset, + yPoint, isBlockSufficient()); + + if (tile.getToolNeeded() != null) { + GuiHelper.renderToolIcon(this, tile.getToolNeeded(), tile.getToolTierNeeded(), xPoint - 20 + xInvOffset, + yPoint, isToolSufficient()); + } } } - private boolean isBlockSufficient() - { - return tile.tier >= tile.getAnvilTierNeeded(); + + private boolean isBlockSufficient() { + return tile.tier >= tile.getAnvilTierNeeded(); + } + + private boolean isToolSufficient() { + if (mc.thePlayer != null) { + return ToolHelper.isToolSufficient(mc.thePlayer.getHeldItem(), tile.getToolNeeded(), + tile.getToolTierNeeded()); + } + return false; } - private boolean isToolSufficient() - { - if(mc.thePlayer != null) - { - return ToolHelper.isToolSufficient(mc.thePlayer.getHeldItem(), tile.getToolNeeded(), tile.getToolTierNeeded()); - } - return false; - } - + @Override - public void drawScreen(int x, int y, float f) - { + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } - private void renderItem(ItemStack itemstack, int x, int y, int mouseX, int mouseY) - { - itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack, x, y); + + private void renderItem(ItemStack itemstack, int x, int y, int mouseX, int mouseY) { + itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack, x, y); itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack, x, y); } - private void renderItemName(ItemStack itemstack, int x, int y, int mouseX, int mouseY) - { - if (this.func_146978_c(x-guiLeft, y-guiTop, 16, 16, mouseX, mouseY)) - { + + private void renderItemName(ItemStack itemstack, int x, int y, int mouseX, int mouseY) { + if (this.func_146978_c(x - guiLeft, y - guiTop, 16, 16, mouseX, mouseY)) { this.renderToolTip(itemstack, mouseX, mouseY); } } diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiBigFurnace.java b/src/main/java/minefantasy/mf2/client/gui/GuiBigFurnace.java index e65dd4ee..9be317e9 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiBigFurnace.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiBigFurnace.java @@ -1,87 +1,65 @@ package minefantasy.mf2.client.gui; - -import org.lwjgl.opengl.GL11; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityBigFurnace; import minefantasy.mf2.container.ContainerBigFurnace; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - - +import org.lwjgl.opengl.GL11; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class GuiBigFurnace extends GuiContainer -{ +public class GuiBigFurnace extends GuiContainer { private TileEntityBigFurnace smelter; - public GuiBigFurnace(EntityPlayer play, TileEntityBigFurnace tile) - { - super(new ContainerBigFurnace(play, tile)); + public GuiBigFurnace(EntityPlayer play, TileEntityBigFurnace tile) { + super(new ContainerBigFurnace(play, tile)); smelter = tile; } - protected void drawGuiContainerForegroundLayer(int x, int y) - { + protected void drawGuiContainerForegroundLayer(int x, int y) { } - protected void drawGuiContainerBackgroundLayer(float f, int i, int j) - { + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - if(smelter.isHeater()) - { - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/furnace_heater.png")); - } - else - { - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/furnace_top.png")); + if (smelter.isHeater()) { + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/furnace_heater.png")); + } else { + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/furnace_top.png")); } int posX = (width - xSize) / 2; int posY = (height - ySize) / 2; - + drawTexturedModalRect(posX, posY, 0, 0, xSize, ySize); - - - - - if (this.smelter.isBurning()) - { - if(smelter.isHeater()) - { - //FUEL - int fuelSc = this.smelter.getBurnTimeRemainingScaled(12); - if(smelter.fuel > 0) - this.drawTexturedModalRect(posX + 59, posY + 27 + 12 - fuelSc, 176, 12 - fuelSc, 14, fuelSc + 2); - - //HEATMAX - int heatScM = this.smelter.getItemHeatScaled(68); - this.drawTexturedModalRect(posX + 104, posY + 76 - heatScM, 176, 14, 16, 3); - - //HEAT - int heatSc = this.smelter.getHeatScaled(68); - this.drawTexturedModalRect(posX + 107, posY + 76 - heatSc, 176, 17, 10, 5); - } - else - { - if(smelter.progress > 0) - { - int prog = smelter.getCookProgressScaled(24); - drawTexturedModalRect(posX + 76, posY + 34, 176, 0, prog + 1, 16); - } - } + + if (this.smelter.isBurning()) { + if (smelter.isHeater()) { + // FUEL + int fuelSc = this.smelter.getBurnTimeRemainingScaled(12); + if (smelter.fuel > 0) + this.drawTexturedModalRect(posX + 59, posY + 27 + 12 - fuelSc, 176, 12 - fuelSc, 14, fuelSc + 2); + + // HEATMAX + int heatScM = this.smelter.getItemHeatScaled(68); + this.drawTexturedModalRect(posX + 104, posY + 76 - heatScM, 176, 14, 16, 3); + + // HEAT + int heatSc = this.smelter.getHeatScaled(68); + this.drawTexturedModalRect(posX + 107, posY + 76 - heatSc, 176, 17, 10, 5); + } else { + if (smelter.progress > 0) { + int prog = smelter.getCookProgressScaled(24); + drawTexturedModalRect(posX + 76, posY + 34, 176, 0, prog + 1, 16); + } + } } } - private void bindTexture(String image) - { - this.mc.renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } + + private void bindTexture(String image) { + this.mc.renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiBlastChamber.java b/src/main/java/minefantasy/mf2/client/gui/GuiBlastChamber.java index d8a3617c..dd061c21 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiBlastChamber.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiBlastChamber.java @@ -1,50 +1,43 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFC; import minefantasy.mf2.container.ContainerBlastChamber; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiBlastChamber extends GuiContainer -{ +public class GuiBlastChamber extends GuiContainer { private TileEntityBlastFC tile; - - public GuiBlastChamber(InventoryPlayer user, TileEntityBlastFC tile) - { + + public GuiBlastChamber(InventoryPlayer user, TileEntityBlastFC tile) { super(new ContainerBlastChamber(user, tile)); this.ySize = 208; this.tile = tile; } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { + protected void drawGuiContainerForegroundLayer(int x, int y) { } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/blast_chamber.png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); } - + @Override - public void drawScreen(int x, int y, float f) - { + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiBlastHeater.java b/src/main/java/minefantasy/mf2/client/gui/GuiBlastHeater.java index 5d6374fa..2073534f 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiBlastHeater.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiBlastHeater.java @@ -1,56 +1,48 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFH; import minefantasy.mf2.container.ContainerBlastHeater; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiBlastHeater extends GuiContainer -{ +public class GuiBlastHeater extends GuiContainer { private TileEntityBlastFH tile; - - public GuiBlastHeater(InventoryPlayer user, TileEntityBlastFH tile) - { + + public GuiBlastHeater(InventoryPlayer user, TileEntityBlastFH tile) { super(new ContainerBlastHeater(user, tile)); this.ySize = 208; this.tile = tile; } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { + protected void drawGuiContainerForegroundLayer(int x, int y) { } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/blast_heater.png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); - - if (this.tile.isBurning()) - { + + if (this.tile.isBurning()) { int i1 = this.tile.getBurnTimeRemainingScaled(13); this.drawTexturedModalRect(xPoint + 82, yPoint + 42 + 12 - i1, 243, 12 - i1, 14, i1 + 1); } } - + @Override - public void drawScreen(int x, int y, float f) - { + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiBloomery.java b/src/main/java/minefantasy/mf2/client/gui/GuiBloomery.java index f2128b68..0b847742 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiBloomery.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiBloomery.java @@ -1,50 +1,43 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityBloomery; import minefantasy.mf2.container.ContainerBloomery; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiBloomery extends GuiContainer -{ +public class GuiBloomery extends GuiContainer { private TileEntityBloomery tile; - - public GuiBloomery(InventoryPlayer user, TileEntityBloomery tile) - { + + public GuiBloomery(InventoryPlayer user, TileEntityBloomery tile) { super(new ContainerBloomery(user, tile)); this.ySize = 208; this.tile = tile; } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { + protected void drawGuiContainerForegroundLayer(int x, int y) { } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/bloomery.png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); } - + @Override - public void drawScreen(int x, int y, float f) - { + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiBombBench.java b/src/main/java/minefantasy/mf2/client/gui/GuiBombBench.java index ae4cbdff..8ce5cde2 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiBombBench.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiBombBench.java @@ -1,55 +1,49 @@ package minefantasy.mf2.client.gui; -import minefantasy.mf2.block.tileentity.TileEntityBombBench; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; +import minefantasy.mf2.block.tileentity.TileEntityBombBench; import minefantasy.mf2.container.ContainerBombBench; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiBombBench extends GuiContainer -{ +public class GuiBombBench extends GuiContainer { private TileEntityBombBench tile; - public GuiBombBench(InventoryPlayer user, TileEntityBombBench tile) - { + public GuiBombBench(InventoryPlayer user, TileEntityBombBench tile) { super(new ContainerBombBench(user, tile)); this.ySize = 208; this.tile = tile; } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { - String s = StatCollector.translateToLocal("tile.bombBench.name"); - //this.fontRendererObj.drawString(s, 10, 6, 0); - + protected void drawGuiContainerForegroundLayer(int x, int y) { + String s = StatCollector.translateToLocal("tile.bombBench.name"); + // this.fontRendererObj.drawString(s, 10, 6, 0); + int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/bombCraft.png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); } - + @Override - public void drawScreen(int x, int y, float f) - { + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiCarpenterMF.java b/src/main/java/minefantasy/mf2/client/gui/GuiCarpenterMF.java index c5fa7107..03482f65 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiCarpenterMF.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiCarpenterMF.java @@ -1,28 +1,25 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.GuiHelper; +import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.block.tileentity.TileEntityCarpenterMF; -import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.container.ContainerCarpenterMF; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiCarpenterMF extends GuiContainer -{ +public class GuiCarpenterMF extends GuiContainer { private TileEntityCarpenterMF tile; private int regularXSize = 176; - public GuiCarpenterMF(InventoryPlayer user, TileEntityCarpenterMF tile) - { + + public GuiCarpenterMF(InventoryPlayer user, TileEntityCarpenterMF tile) { super(new ContainerCarpenterMF(user, tile)); this.xSize = 195; this.ySize = 240; @@ -30,83 +27,86 @@ public GuiCarpenterMF(InventoryPlayer user, TileEntityCarpenterMF tile) } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { - boolean knowsCraft = tile.doesPlayerKnowCraft(mc.thePlayer); - String s = MineFantasyII.isDebug() ? "Carpenter Bench Crafting" : knowsCraft ? StatCollector.translateToLocal(tile.getResultName()) : "????"; + protected void drawGuiContainerForegroundLayer(int x, int y) { + boolean knowsCraft = tile.doesPlayerKnowCraft(mc.thePlayer); + String s = MineFantasyII.isDebug() ? "Carpenter Bench Crafting" + : knowsCraft ? StatCollector.translateToLocal(tile.getResultName()) : "????"; this.fontRendererObj.drawString(s, 10, 8, 0); - + int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; - - if(knowsCraft && !tile.resName.equalsIgnoreCase("")) - { - if(tile.getToolNeeded() != null) - { - if(x < xPoint && x > xPoint-20 && y < yPoint+20 && y > yPoint) - { - String s2 = StatCollector.translateToLocal("tooltype."+tile.getToolNeeded()) + ", " + (tile.getToolTierNeeded() > -1 ? StatCollector.translateToLocal("attribute.mfcrafttier.name") + " " + tile.getToolTierNeeded() : StatCollector.translateToLocal("attribute.nomfcrafttier.name")); - this.fontRendererObj.drawStringWithShadow(s2, -18, -12, isToolSufficient() ? 16777215 : GuiHelper.getColourForRGB(150, 0, 0)); - } - } - if(x < xPoint+regularXSize+20 && x > xPoint+regularXSize && y < yPoint+20 && y > yPoint) - { - String s2 = StatCollector.translateToLocal("tooltype.carpenter") + ", " + (tile.getCarpenterTierNeeded() > -1 ? StatCollector.translateToLocal("attribute.mfcrafttier.name") + " " + tile.getCarpenterTierNeeded() : StatCollector.translateToLocal("attribute.nomfcrafttier.name")); - this.fontRendererObj.drawStringWithShadow(s2, regularXSize-fontRendererObj.getStringWidth(s2)+18, -12, 16777215); - } + + if (knowsCraft && !tile.resName.equalsIgnoreCase("")) { + if (tile.getToolNeeded() != null) { + if (x < xPoint && x > xPoint - 20 && y < yPoint + 20 && y > yPoint) { + String s2 = StatCollector.translateToLocal("tooltype." + tile.getToolNeeded()) + ", " + + (tile.getToolTierNeeded() > -1 + ? StatCollector.translateToLocal("attribute.mfcrafttier.name") + " " + + tile.getToolTierNeeded() + : StatCollector.translateToLocal("attribute.nomfcrafttier.name")); + this.fontRendererObj.drawStringWithShadow(s2, -18, -12, + isToolSufficient() ? 16777215 : GuiHelper.getColourForRGB(150, 0, 0)); + } + } + if (x < xPoint + regularXSize + 20 && x > xPoint + regularXSize && y < yPoint + 20 && y > yPoint) { + String s2 = StatCollector.translateToLocal("tooltype.carpenter") + ", " + + (tile.getCarpenterTierNeeded() > -1 + ? StatCollector.translateToLocal("attribute.mfcrafttier.name") + " " + + tile.getCarpenterTierNeeded() + : StatCollector.translateToLocal("attribute.nomfcrafttier.name")); + this.fontRendererObj.drawStringWithShadow(s2, regularXSize - fontRendererObj.getStringWidth(s2) + 18, + -12, 16777215); + } } } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/carpenter.png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); - - if(tile.progressMax > 0 && tile.progress > 0) - { - int progressWidth = (int)(160F/tile.progressMax*tile.progress); - this.drawTexturedModalRect(xPoint+8, yPoint+21, 0, 240, progressWidth, 3); + + if (tile.progressMax > 0 && tile.progress > 0) { + int progressWidth = (int) (160F / tile.progressMax * tile.progress); + this.drawTexturedModalRect(xPoint + 8, yPoint + 21, 0, 240, progressWidth, 3); } - if(tile.doesPlayerKnowCraft(mc.thePlayer) && !tile.resName.equalsIgnoreCase("")) - { - GuiHelper.renderToolIcon(this, "carpenter", tile.getCarpenterTierNeeded(), xPoint+regularXSize, yPoint, true); - - if(tile.getToolNeeded() != null) - { - GuiHelper.renderToolIcon(this, tile.getToolNeeded(), tile.getToolTierNeeded(), xPoint-20, yPoint, isToolSufficient()); - } + if (tile.doesPlayerKnowCraft(mc.thePlayer) && !tile.resName.equalsIgnoreCase("")) { + GuiHelper.renderToolIcon(this, "carpenter", tile.getCarpenterTierNeeded(), xPoint + regularXSize, yPoint, + true); + + if (tile.getToolNeeded() != null) { + GuiHelper.renderToolIcon(this, tile.getToolNeeded(), tile.getToolTierNeeded(), xPoint - 20, yPoint, + isToolSufficient()); + } } } - private boolean isToolSufficient() - { - if(mc.thePlayer != null) - { - return ToolHelper.isToolSufficient(mc.thePlayer.getHeldItem(), tile.getToolNeeded(), tile.getToolTierNeeded()); - } - return false; - } - @Override - public void drawScreen(int x, int y, float f) - { + private boolean isToolSufficient() { + if (mc.thePlayer != null) { + return ToolHelper.isToolSufficient(mc.thePlayer.getHeldItem(), tile.getToolNeeded(), + tile.getToolTierNeeded()); + } + return false; + } + + @Override + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } - private void renderItem(ItemStack itemstack, int x, int y, int mouseX, int mouseY) - { - itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack, x, y); + + private void renderItem(ItemStack itemstack, int x, int y, int mouseX, int mouseY) { + itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack, x, y); itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack, x, y); } - private void renderItemName(ItemStack itemstack, int x, int y, int mouseX, int mouseY) - { - if (this.func_146978_c(x-guiLeft, y-guiTop, 16, 16, mouseX, mouseY)) - { + + private void renderItemName(ItemStack itemstack, int x, int y, int mouseX, int mouseY) { + if (this.func_146978_c(x - guiLeft, y - guiTop, 16, 16, mouseX, mouseY)) { this.renderToolTip(itemstack, mouseX, mouseY); } } diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiCrossbowBench.java b/src/main/java/minefantasy/mf2/client/gui/GuiCrossbowBench.java index d8410afa..c030e581 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiCrossbowBench.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiCrossbowBench.java @@ -1,55 +1,49 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityCrossbowBench; import minefantasy.mf2.container.ContainerCrossbowBench; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiCrossbowBench extends GuiContainer -{ +public class GuiCrossbowBench extends GuiContainer { private TileEntityCrossbowBench tile; - public GuiCrossbowBench(InventoryPlayer user, TileEntityCrossbowBench tile) - { + public GuiCrossbowBench(InventoryPlayer user, TileEntityCrossbowBench tile) { super(new ContainerCrossbowBench(user, tile)); this.ySize = 208; this.tile = tile; } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { - String s = StatCollector.translateToLocal("tile.crossbowBench.name"); - //this.fontRendererObj.drawString(s, 10, 6, 0); - + protected void drawGuiContainerForegroundLayer(int x, int y) { + String s = StatCollector.translateToLocal("tile.crossbowBench.name"); + // this.fontRendererObj.drawString(s, 10, 6, 0); + int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/crossbowCraft.png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); } - + @Override - public void drawScreen(int x, int y, float f) - { + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiCrucible.java b/src/main/java/minefantasy/mf2/client/gui/GuiCrucible.java index f7ffbb62..7254f971 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiCrucible.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiCrucible.java @@ -1,5 +1,7 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityCrucible; import minefantasy.mf2.config.ConfigHardcore; @@ -7,74 +9,61 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemBlock; -import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiCrucible extends GuiContainer -{ +public class GuiCrucible extends GuiContainer { private TileEntityCrucible tile; - - public GuiCrucible(InventoryPlayer user, TileEntityCrucible tile) - { + + public GuiCrucible(InventoryPlayer user, TileEntityCrucible tile) { super(new ContainerCrucible(user, tile)); this.ySize = 186; this.tile = tile; } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { + protected void drawGuiContainerForegroundLayer(int x, int y) { } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource(getTex())); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); - - if(tile.getStackInSlot(tile.getSizeInventory()-1) != null && !(tile.getStackInSlot(tile.getSizeInventory()-1).getItem() instanceof ItemBlock) && ConfigHardcore.HCCreduceIngots && !tile.isAuto()) - { - this.drawTexturedModalRect(xPoint+128, yPoint+31, 225, 2, 18, 18); + + if (tile.getStackInSlot(tile.getSizeInventory() - 1) != null + && !(tile.getStackInSlot(tile.getSizeInventory() - 1).getItem() instanceof ItemBlock) + && ConfigHardcore.HCCreduceIngots && !tile.isAuto()) { + this.drawTexturedModalRect(xPoint + 128, yPoint + 31, 225, 2, 18, 18); } - - if (this.tile.temperature > 0) - { + + if (this.tile.temperature > 0) { this.drawTexturedModalRect(xPoint + 81, yPoint + 75, 243, 0, 14, 12); } - if (this.tile.progress > 0 && tile.progressMax > 0) - { - int value = (int)(54F / tile.progressMax * tile.progress); + if (this.tile.progress > 0 && tile.progressMax > 0) { + int value = (int) (54F / tile.progressMax * tile.progress); this.drawTexturedModalRect(xPoint + 61, yPoint + 70, 189, 0, value, 2); } } - - private String getTex() - { - if(tile.getTier() == 1) - { - return "textures/gui/crucible_advanced.png"; - } - if(tile.getTier() >= 2) - { - return "textures/gui/crucible_mythic.png"; - } - return "textures/gui/crucible.png"; - } - @Override - public void drawScreen(int x, int y, float f) - { + private String getTex() { + if (tile.getTier() == 1) { + return "textures/gui/crucible_advanced.png"; + } + if (tile.getTier() >= 2) { + return "textures/gui/crucible_mythic.png"; + } + return "textures/gui/crucible.png"; + } + + @Override + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiDiscovery.java b/src/main/java/minefantasy/mf2/client/gui/GuiDiscovery.java index a21902a4..12adbef9 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiDiscovery.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiDiscovery.java @@ -1,5 +1,7 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.knowledge.InformationBase; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; @@ -8,17 +10,13 @@ import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.resources.I18n; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiDiscovery extends Gui -{ - private static final ResourceLocation field_146261_a = new ResourceLocation("textures/gui/achievement/achievement_background.png"); +public class GuiDiscovery extends Gui { + private static final ResourceLocation field_146261_a = new ResourceLocation( + "textures/gui/achievement/achievement_background.png"); private Minecraft field_146259_f; private int field_146260_g; private int field_146267_h; @@ -29,14 +27,12 @@ public class GuiDiscovery extends Gui private RenderItem field_146264_m; private boolean field_146262_n; - public GuiDiscovery(Minecraft p_i1063_1_) - { + public GuiDiscovery(Minecraft p_i1063_1_) { this.field_146259_f = p_i1063_1_; this.field_146264_m = new RenderItem(); } - public void func_146256_a(InformationBase p_146256_1_) - { + public void func_146256_a(InformationBase p_146256_1_) { this.field_146268_i = I18n.format("knowledge.discover", new Object[0]); this.field_146265_j = p_146256_1_.getDisplayName(); this.field_146263_l = Minecraft.getSystemTime(); @@ -44,8 +40,7 @@ public void func_146256_a(InformationBase p_146256_1_) this.field_146262_n = false; } - public void func_146255_b(InformationBase p_146255_1_) - { + public void func_146255_b(InformationBase p_146255_1_) { this.field_146268_i = p_146255_1_.getDisplayName(); this.field_146265_j = p_146255_1_.getDescription(); this.field_146263_l = Minecraft.getSystemTime() + 2500L; @@ -53,8 +48,7 @@ public void func_146255_b(InformationBase p_146255_1_) this.field_146262_n = true; } - private void func_146258_c() - { + private void func_146258_c() { GL11.glViewport(0, 0, this.field_146259_f.displayWidth, this.field_146259_f.displayHeight); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); @@ -62,7 +56,8 @@ private void func_146258_c() GL11.glLoadIdentity(); this.field_146260_g = this.field_146259_f.displayWidth; this.field_146267_h = this.field_146259_f.displayHeight; - ScaledResolution scaledresolution = new ScaledResolution(this.field_146259_f, this.field_146259_f.displayWidth, this.field_146259_f.displayHeight); + ScaledResolution scaledresolution = new ScaledResolution(this.field_146259_f, this.field_146259_f.displayWidth, + this.field_146259_f.displayHeight); this.field_146260_g = scaledresolution.getScaledWidth(); this.field_146267_h = scaledresolution.getScaledHeight(); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); @@ -74,22 +69,16 @@ private void func_146258_c() GL11.glTranslatef(0.0F, 0.0F, -2000.0F); } - public void func_146254_a() - { - if (this.field_146266_k != null && this.field_146263_l != 0L && Minecraft.getMinecraft().thePlayer != null) - { + public void func_146254_a() { + if (this.field_146266_k != null && this.field_146263_l != 0L && Minecraft.getMinecraft().thePlayer != null) { double d0 = (Minecraft.getSystemTime() - this.field_146263_l) / 3000.0D; - if (!this.field_146262_n) - { - if (d0 < 0.0D || d0 > 1.0D) - { + if (!this.field_146262_n) { + if (d0 < 0.0D || d0 > 1.0D) { this.field_146263_l = 0L; return; } - } - else if (d0 > 0.5D) - { + } else if (d0 > 0.5D) { d0 = 0.5D; } @@ -98,35 +87,30 @@ else if (d0 > 0.5D) GL11.glDepthMask(false); double d1 = d0 * 2.0D; - if (d1 > 1.0D) - { + if (d1 > 1.0D) { d1 = 2.0D - d1; } d1 *= 4.0D; d1 = 1.0D - d1; - if (d1 < 0.0D) - { + if (d1 < 0.0D) { d1 = 0.0D; } d1 *= d1; d1 *= d1; int i = this.field_146260_g - 160; - int j = 0 - (int)(d1 * 36.0D); + int j = 0 - (int) (d1 * 36.0D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); this.field_146259_f.getTextureManager().bindTexture(field_146261_a); GL11.glDisable(GL11.GL_LIGHTING); this.drawTexturedModalRect(i, j, 96, 202, 160, 32); - if (this.field_146262_n) - { + if (this.field_146262_n) { this.field_146259_f.fontRenderer.drawSplitString(this.field_146265_j, i + 30, j + 7, 120, -1); - } - else - { + } else { this.field_146259_f.fontRenderer.drawString(this.field_146268_i, i + 30, j + 7, -256); this.field_146259_f.fontRenderer.drawString(this.field_146265_j, i + 30, j + 18, -1); } @@ -136,15 +120,15 @@ else if (d0 > 0.5D) GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_LIGHTING); - this.field_146264_m.renderItemAndEffectIntoGUI(this.field_146259_f.fontRenderer, this.field_146259_f.getTextureManager(), this.field_146266_k.theItemStack, i + 8, j + 8); + this.field_146264_m.renderItemAndEffectIntoGUI(this.field_146259_f.fontRenderer, + this.field_146259_f.getTextureManager(), this.field_146266_k.theItemStack, i + 8, j + 8); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); } } - public void func_146257_b() - { + public void func_146257_b() { this.field_146266_k = null; this.field_146263_l = 0L; } diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiForge.java b/src/main/java/minefantasy/mf2/client/gui/GuiForge.java index 01cb6b49..c3af1b69 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiForge.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiForge.java @@ -1,73 +1,62 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityForge; import minefantasy.mf2.container.ContainerForge; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiForge extends GuiContainer -{ +public class GuiForge extends GuiContainer { private TileEntityForge tile; - - public GuiForge(InventoryPlayer user, TileEntityForge tile) - { + + public GuiForge(InventoryPlayer user, TileEntityForge tile) { super(new ContainerForge(user, tile)); this.ySize = 175; this.tile = tile; } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { + protected void drawGuiContainerForegroundLayer(int x, int y) { } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource(getTex())); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); - - if (this.tile.fuel > 0 && tile.maxFuel > 0) - { - int scale = tile.getMetreScale(12); - this.drawTexturedModalRect(xPoint + 33, yPoint + 63 + 11 - scale, 176, 11 - scale+8, 14, scale + 1); + + if (this.tile.fuel > 0 && tile.maxFuel > 0) { + int scale = tile.getMetreScale(12); + this.drawTexturedModalRect(xPoint + 33, yPoint + 63 + 11 - scale, 176, 11 - scale + 8, 14, scale + 1); } int[] scale = tile.getTempsScaled(53); - if (this.tile.temperature > 0) - { - if (this.tile.isLit) - { - int heatScM = scale[1]; - this.drawTexturedModalRect(xPoint + 32, yPoint + 58 - heatScM, 176, 0, 16, 3); - } - int heatSc = scale[0]; - this.drawTexturedModalRect(xPoint + 35, yPoint + 58 - heatSc, 176, 3, 10, 5); - } + if (this.tile.temperature > 0) { + if (this.tile.isLit) { + int heatScM = scale[1]; + this.drawTexturedModalRect(xPoint + 32, yPoint + 58 - heatScM, 176, 0, 16, 3); + } + int heatSc = scale[0]; + this.drawTexturedModalRect(xPoint + 35, yPoint + 58 - heatSc, 176, 3, 10, 5); + } + } + + private String getTex() { + return "textures/gui/" + tile.getTextureName() + ".png"; } - - private String getTex() - { - return "textures/gui/" + tile.getTextureName() + ".png"; - } - @Override - public void drawScreen(int x, int y, float f) - { + @Override + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiKnowledge.java b/src/main/java/minefantasy/mf2/client/gui/GuiKnowledge.java index f84732bb..fe805419 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiKnowledge.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiKnowledge.java @@ -1,13 +1,5 @@ package minefantasy.mf2.client.gui; -import java.util.LinkedList; -import java.util.List; -import java.util.Random; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; @@ -31,30 +23,27 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; +import net.minecraft.util.*; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.LinkedList; +import java.util.List; +import java.util.Random; @SideOnly(Side.CLIENT) -public class GuiKnowledge extends GuiScreen -{ - int offsetByX = 70; - int offsetByY = 0; - public int buyWidth = 225; - public int buyHeight = 72; - private RenderItem itemrender = new RenderItem(); - private InformationBase selected = null; - private InformationBase highlighted = null; +public class GuiKnowledge extends GuiScreen { private static final int field_146572_y = InformationList.minDisplayColumn * 24 - 112; private static final int field_146571_z = InformationList.minDisplayRow * 24 - 112; private static final int field_146559_A = InformationList.maxDisplayColumn * 24 - 77; private static final int field_146560_B = InformationList.maxDisplayRow * 24 - 77; - private static final ResourceLocation screenTex = new ResourceLocation("minefantasy2:textures/gui/knowledge/knowledge.png"); - private static final ResourceLocation buyTex = new ResourceLocation("minefantasy2:textures/gui/knowledge/purchase.png"); - private static final ResourceLocation skillTex = new ResourceLocation("minefantasy2:textures/gui/knowledge/skilllist.png"); + private static final ResourceLocation screenTex = new ResourceLocation( + "minefantasy2:textures/gui/knowledge/knowledge.png"); + private static final ResourceLocation buyTex = new ResourceLocation( + "minefantasy2:textures/gui/knowledge/purchase.png"); + private static final ResourceLocation skillTex = new ResourceLocation( + "minefantasy2:textures/gui/knowledge/skilllist.png"); protected static int field_146555_f = 256; protected static int field_146557_g = 202; protected static int field_146563_h; @@ -68,36 +57,39 @@ public class GuiKnowledge extends GuiScreen protected static double field_146573_x; private static int field_146554_D; private static boolean allDiscovered = true; - private static int currentPage = -1; + public int buyWidth = 225; + public int buyHeight = 72; + int offsetByX = 70; + int offsetByY = 0; + private RenderItem itemrender = new RenderItem(); + private InformationBase selected = null; + private InformationBase highlighted = null; private GuiButton button; private LinkedList informationList = new LinkedList(); private EntityPlayer player; - private boolean hasScroll = false; - private boolean canPurchase = false; - - public GuiKnowledge(EntityPlayer user) - { - this.player = user; + private boolean hasScroll = false; + private boolean canPurchase = false; + + public GuiKnowledge(EntityPlayer user) { + this.player = user; short short1 = 141; short short2 = 141; - GuiKnowledge.field_146569_s = GuiKnowledge.field_146567_u = GuiKnowledge.field_146565_w = KnowledgeListMF.gettingStarted.displayColumn * 24 - short1 / 2 - 12; - GuiKnowledge.field_146568_t = GuiKnowledge.field_146566_v = GuiKnowledge.field_146573_x = KnowledgeListMF.gettingStarted.displayRow * 24 - short2 / 2; + GuiKnowledge.field_146569_s = GuiKnowledge.field_146567_u = GuiKnowledge.field_146565_w = KnowledgeListMF.gettingStarted.displayColumn + * 24 - short1 / 2 - 12; + GuiKnowledge.field_146568_t = GuiKnowledge.field_146566_v = GuiKnowledge.field_146573_x = KnowledgeListMF.gettingStarted.displayRow + * 24 - short2 / 2; informationList.clear(); - for (Object achievement : InformationList.knowledgeList) - { - if (!InformationPage.isInfoInPages((InformationBase)achievement)) - { - informationList.add((InformationBase)achievement); + for (Object achievement : InformationList.knowledgeList) { + if (!InformationPage.isInfoInPages((InformationBase) achievement)) { + informationList.add((InformationBase) achievement); } } - for(Object base: InformationList.knowledgeList.toArray()) - { - if(!ResearchLogic.hasInfoUnlocked(user, (InformationBase)base)) - { - allDiscovered = false; - break; - } + for (Object base : InformationList.knowledgeList.toArray()) { + if (!ResearchLogic.hasInfoUnlocked(user, (InformationBase) base)) { + allDiscovered = false; + break; + } } } @@ -105,82 +97,73 @@ public GuiKnowledge(EntityPlayer user) * Adds the buttons (and other controls) to the screen in question. */ @Override - public void initGui() - { - int i1 = (this.width - GuiKnowledge.field_146555_f) / 2 + offsetByX; + public void initGui() { + int i1 = (this.width - GuiKnowledge.field_146555_f) / 2 + offsetByX; int j1 = (this.height - GuiKnowledge.field_146557_g) / 2 + offsetByY; - + this.buttonList.clear(); - this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 101, 80, 20, I18n.format("gui.done", new Object[0]))); - this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 101, 125, 20, InformationPage.getTitle(currentPage))); - - int purchasex = i1 + (field_146555_f - buyWidth)/2; - int purchasey =j1 + (field_146557_g - buyHeight)/2; - //PURCHASE SCREEN - this.buttonList.add(new GuiOptionButton(3, purchasex + 19, purchasey + 47, 80, 20, I18n.format("gui.purchase", new Object[0]))); - this.buttonList.add(new GuiOptionButton(4, purchasex + 125, purchasey + 47, 80, 20, I18n.format("gui.cancel", new Object[0]))); + this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 101, 80, 20, + I18n.format("gui.done", new Object[0]))); + this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 101, 125, 20, + InformationPage.getTitle(currentPage))); + + int purchasex = i1 + (field_146555_f - buyWidth) / 2; + int purchasey = j1 + (field_146557_g - buyHeight) / 2; + // PURCHASE SCREEN + this.buttonList.add(new GuiOptionButton(3, purchasex + 19, purchasey + 47, 80, 20, + I18n.format("gui.purchase", new Object[0]))); + this.buttonList.add(new GuiOptionButton(4, purchasex + 125, purchasey + 47, 80, 20, + I18n.format("gui.cancel", new Object[0]))); } @Override - protected void mouseClicked(int x, int y, int button) - { - if(selected == null && button == 0 && highlighted != null) - { - if(ResearchLogic.hasInfoUnlocked(player, highlighted) && !highlighted.getPages().isEmpty()) - { - player.openGui(MineFantasyII.instance, 1, player.worldObj, 0, highlighted.ID, 0); - } - else if(highlighted.isEasy() && ResearchLogic.canPurchase(player, highlighted)) - { - selected = highlighted; - setPurchaseAvailable(player); - } - } - super.mouseClicked(x, y, button); + protected void mouseClicked(int x, int y, int button) { + if (selected == null && button == 0 && highlighted != null) { + if (ResearchLogic.hasInfoUnlocked(player, highlighted) && !highlighted.getPages().isEmpty()) { + player.openGui(MineFantasyII.instance, 1, player.worldObj, 0, highlighted.ID, 0); + } else if (highlighted.isEasy() && ResearchLogic.canPurchase(player, highlighted)) { + selected = highlighted; + setPurchaseAvailable(player); + } + } + super.mouseClicked(x, y, button); } + @Override - protected void actionPerformed(GuiButton p_146284_1_) - { - if (p_146284_1_.id == 1) - { - this.mc.displayGuiScreen((GuiScreen)null); + protected void actionPerformed(GuiButton p_146284_1_) { + if (p_146284_1_.id == 1) { + this.mc.displayGuiScreen((GuiScreen) null); } - if (selected == null && p_146284_1_.id == 2) - { + if (selected == null && p_146284_1_.id == 2) { currentPage++; - - if (currentPage >= InformationPage.getInfoPages().size()) - { + + if (currentPage >= InformationPage.getInfoPages().size()) { currentPage = -1; } button.displayString = InformationPage.getTitle(currentPage); } - - if (p_146284_1_.id == 3 && selected != null) - { - ((EntityClientPlayerMP)player).sendQueue.addToSendQueue(new ResearchRequest(player, selected.ID).generatePacket()); - selected = null; + + if (p_146284_1_.id == 3 && selected != null) { + ((EntityClientPlayerMP) player).sendQueue + .addToSendQueue(new ResearchRequest(player, selected.ID).generatePacket()); + selected = null; } - if (p_146284_1_.id == 4 && selected != null) - { - selected = null; + if (p_146284_1_.id == 4 && selected != null) { + selected = null; } } /** - * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + * Fired when a key is typed. This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). */ @Override - protected void keyTyped(char p_73869_1_, int p_73869_2_) - { - if (p_73869_2_ == this.mc.gameSettings.keyBindInventory.getKeyCode()) - { - this.mc.displayGuiScreen((GuiScreen)null); + protected void keyTyped(char p_73869_1_, int p_73869_2_) { + if (p_73869_2_ == this.mc.gameSettings.keyBindInventory.getKeyCode()) { + this.mc.displayGuiScreen((GuiScreen) null); this.mc.setIngameFocus(); - } - else - { + } else { super.keyTyped(p_73869_1_, p_73869_2_); } } @@ -189,26 +172,21 @@ protected void keyTyped(char p_73869_1_, int p_73869_2_) * Draws the screen and all the components in it. */ @Override - public void drawScreen(int mx, int my, float f) - { + public void drawScreen(int mx, int my, float f) { { int k; - if (selected == null && Mouse.isButtonDown(0)) - { + if (selected == null && Mouse.isButtonDown(0)) { k = (this.width - GuiKnowledge.field_146555_f) / 2 + offsetByX; int l = (this.height - GuiKnowledge.field_146557_g) / 2 + offsetByY; int i1 = k + 8; int j1 = l + 17; - if ((GuiKnowledge.field_146554_D == 0 || GuiKnowledge.field_146554_D == 1) && mx >= i1 && mx < i1 + 224 && my >= j1 && my < j1 + 155) - { - if (GuiKnowledge.field_146554_D == 0) - { + if ((GuiKnowledge.field_146554_D == 0 || GuiKnowledge.field_146554_D == 1) && mx >= i1 && mx < i1 + 224 + && my >= j1 && my < j1 + 155) { + if (GuiKnowledge.field_146554_D == 0) { GuiKnowledge.field_146554_D = 1; - } - else - { + } else { GuiKnowledge.field_146567_u -= (mx - GuiKnowledge.field_146563_h) * GuiKnowledge.field_146570_r; GuiKnowledge.field_146566_v -= (my - GuiKnowledge.field_146564_i) * GuiKnowledge.field_146570_r; GuiKnowledge.field_146565_w = GuiKnowledge.field_146569_s = GuiKnowledge.field_146567_u; @@ -218,28 +196,22 @@ public void drawScreen(int mx, int my, float f) GuiKnowledge.field_146563_h = mx; GuiKnowledge.field_146564_i = my; } - } - else - { + } else { GuiKnowledge.field_146554_D = 0; } k = Mouse.getDWheel(); float f4 = GuiKnowledge.field_146570_r; - if (k < 0) - { + if (k < 0) { GuiKnowledge.field_146570_r += 0.25F; - } - else if (k > 0) - { + } else if (k > 0) { GuiKnowledge.field_146570_r -= 0.25F; } GuiKnowledge.field_146570_r = MathHelper.clamp_float(GuiKnowledge.field_146570_r, 1.0F, 3.0F); - if (GuiKnowledge.field_146570_r != f4) - { + if (GuiKnowledge.field_146570_r != f4) { float f6 = f4 - GuiKnowledge.field_146570_r; float f5 = f4 * GuiKnowledge.field_146555_f; float f1 = f4 * GuiKnowledge.field_146557_g; @@ -251,23 +223,19 @@ else if (k > 0) GuiKnowledge.field_146573_x = GuiKnowledge.field_146568_t = GuiKnowledge.field_146566_v; } - if (GuiKnowledge.field_146565_w < field_146572_y) - { + if (GuiKnowledge.field_146565_w < field_146572_y) { GuiKnowledge.field_146565_w = field_146572_y; } - if (GuiKnowledge.field_146573_x < field_146571_z) - { + if (GuiKnowledge.field_146573_x < field_146571_z) { GuiKnowledge.field_146573_x = field_146571_z; } - if (GuiKnowledge.field_146565_w >= field_146559_A) - { + if (GuiKnowledge.field_146565_w >= field_146559_A) { GuiKnowledge.field_146565_w = field_146559_A - 1; } - if (GuiKnowledge.field_146573_x >= field_146560_B) - { + if (GuiKnowledge.field_146573_x >= field_146560_B) { GuiKnowledge.field_146573_x = field_146560_B - 1; } @@ -279,11 +247,10 @@ else if (k > 0) GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); } - if(buttonList.get(2) != null) - { - ((GuiButton)buttonList.get(2)).visible = selected != null; - ((GuiButton)buttonList.get(2)).enabled = selected != null && canPurchase ; - ((GuiButton)buttonList.get(3)).visible = selected != null; + if (buttonList.get(2) != null) { + ((GuiButton) buttonList.get(2)).visible = selected != null; + ((GuiButton) buttonList.get(2)).enabled = selected != null && canPurchase; + ((GuiButton) buttonList.get(3)).visible = selected != null; } } @@ -291,57 +258,49 @@ else if (k > 0) * Called from the main game loop to update the screen. */ @Override - public void updateScreen() - { + public void updateScreen() { { GuiKnowledge.field_146569_s = GuiKnowledge.field_146567_u; GuiKnowledge.field_146568_t = GuiKnowledge.field_146566_v; double d0 = GuiKnowledge.field_146565_w - GuiKnowledge.field_146567_u; double d1 = GuiKnowledge.field_146573_x - GuiKnowledge.field_146566_v; - if (d0 * d0 + d1 * d1 < 4.0D) - { + if (d0 * d0 + d1 * d1 < 4.0D) { GuiKnowledge.field_146567_u += d0; GuiKnowledge.field_146566_v += d1; - } - else - { + } else { GuiKnowledge.field_146567_u += d0 * 0.85D; GuiKnowledge.field_146566_v += d1 * 0.85D; } } } - protected void drawOverlay() - { + protected void drawOverlay() { int i = (this.width - GuiKnowledge.field_146555_f) / 2 + offsetByX; int j = (this.height - GuiKnowledge.field_146557_g) / 2 + offsetByY; - + this.fontRendererObj.drawString(I18n.format("gui.information", new Object[0]), i + 15, j + 5, 4210752); } - - protected void renderMainPage(int mx, int my, float f) - { - int k = MathHelper.floor_double(GuiKnowledge.field_146569_s + (GuiKnowledge.field_146567_u - GuiKnowledge.field_146569_s) * f); - int l = MathHelper.floor_double(GuiKnowledge.field_146568_t + (GuiKnowledge.field_146566_v - GuiKnowledge.field_146568_t) * f); - if (k < field_146572_y) - { + protected void renderMainPage(int mx, int my, float f) { + int k = MathHelper.floor_double( + GuiKnowledge.field_146569_s + (GuiKnowledge.field_146567_u - GuiKnowledge.field_146569_s) * f); + int l = MathHelper.floor_double( + GuiKnowledge.field_146568_t + (GuiKnowledge.field_146566_v - GuiKnowledge.field_146568_t) * f); + + if (k < field_146572_y) { k = field_146572_y; } - if (l < field_146571_z) - { + if (l < field_146571_z) { l = field_146571_z; } - if (k >= field_146559_A) - { + if (k >= field_146559_A) { k = field_146559_A - 1; } - if (l >= field_146560_B) - { + if (l >= field_146560_B) { l = field_146560_B - 1; } @@ -358,7 +317,7 @@ protected void renderMainPage(int mx, int my, float f) GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); - + int i2 = k + 288 >> 4; int j2 = l + 288 >> 4; int k2 = (k + 288) % 16; @@ -375,13 +334,11 @@ protected void renderMainPage(int mx, int my, float f) int j3; int k3; - for (i3 = 0; i3 * f1 - l2 < 155.0F; ++i3) - { + for (i3 = 0; i3 * f1 - l2 < 155.0F; ++i3) { float f3 = 0.6F - (j2 + i3) / 25.0F * 0.3F; GL11.glColor4f(f3, f3, f3, 1.0F); - for (j3 = 0; j3 * f2 - k2 < 224.0F; ++j3) - { + for (j3 = 0; j3 * f2 - k2 < 224.0F; ++j3) { IIcon iicon = Blocks.planks.getIcon(0, 0); this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); @@ -396,13 +353,12 @@ protected void renderMainPage(int mx, int my, float f) int j4; int l4; - List achievementList = (currentPage == -1 ? informationList : InformationPage.getInfoPage(currentPage).getInfoList()); - for (i3 = 0; i3 < achievementList.size(); ++i3) - { - InformationBase achievement1 = achievementList.get(i3); + List achievementList = (currentPage == -1 ? informationList + : InformationPage.getInfoPage(currentPage).getInfoList()); + for (i3 = 0; i3 < achievementList.size(); ++i3) { + InformationBase achievement1 = achievementList.get(i3); - if (achievement1.parentInfo != null && achievementList.contains(achievement1.parentInfo)) - { + if (achievement1.parentInfo != null && achievementList.contains(achievement1.parentInfo)) { j3 = achievement1.displayColumn * 24 - k + 11; k3 = achievement1.displayRow * 24 - l + 11; l4 = achievement1.parentInfo.displayColumn * 24 - k + 11; @@ -411,36 +367,25 @@ protected void renderMainPage(int mx, int my, float f) boolean flag6 = ResearchLogic.canUnlockInfo(player, achievement1); researchVisibility = ResearchLogic.func_150874_c(player, achievement1); - if (researchVisibility <= getVisibleRange()[0]) - { + if (researchVisibility <= getVisibleRange()[0]) { j4 = -16777216; - if (flag5) - { + if (flag5) { j4 = -6250336; - } - else if (flag6) - { + } else if (flag6) { j4 = -16711936; } this.drawHorizontalLine(j3, l4, k3, j4); this.drawVerticalLine(l4, k3, l3, j4); - if (j3 > l4) - { + if (j3 > l4) { this.drawTexturedModalRect(j3 - 11 - 7, k3 - 5, 114, 234, 7, 11); - } - else if (j3 < l4) - { + } else if (j3 < l4) { this.drawTexturedModalRect(j3 + 11, k3 - 5, 107, 234, 7, 11); - } - else if (k3 > l3) - { + } else if (k3 > l3) { this.drawTexturedModalRect(j3 - 5, k3 - 11 - 7, 96, 234, 11, 7); - } - else if (k3 < l3) - { + } else if (k3 < l3) { this.drawTexturedModalRect(j3 - 5, k3 + 11, 96, 241, 11, 7); } } @@ -458,41 +403,30 @@ else if (k3 < l3) int i5; int j5; - for (l4 = 0; l4 < achievementList.size(); ++l4) - { - InformationBase achievement2 = achievementList.get(l4); + for (l4 = 0; l4 < achievementList.size(); ++l4) { + InformationBase achievement2 = achievementList.get(l4); i5 = achievement2.displayColumn * 24 - k; j5 = achievement2.displayRow * 24 - l; - if (i5 >= -24 && j5 >= -24 && i5 <= 224.0F * GuiKnowledge.field_146570_r && j5 <= 155.0F * GuiKnowledge.field_146570_r) - { + if (i5 >= -24 && j5 >= -24 && i5 <= 224.0F * GuiKnowledge.field_146570_r + && j5 <= 155.0F * GuiKnowledge.field_146570_r) { researchVisibility = ResearchLogic.func_150874_c(player, achievement2); float f6; - if (ResearchLogic.hasInfoUnlocked(player, achievement2)) - { + if (ResearchLogic.hasInfoUnlocked(player, achievement2)) { f6 = 0.75F; GL11.glColor4f(f6, f6, f6, 1.0F); - } - else if (ResearchLogic.canUnlockInfo(player, achievement2)) - { + } else if (ResearchLogic.canUnlockInfo(player, achievement2)) { f6 = 1.0F; GL11.glColor4f(0.5F, 1.0F, 0.5F, 1.0F); - } - else if (researchVisibility < getVisibleRange()[1]) - { + } else if (researchVisibility < getVisibleRange()[1]) { f6 = 0.3F; GL11.glColor4f(f6, f6, f6, 1.0F); - } - else if (researchVisibility == getVisibleRange()[1]) - { + } else if (researchVisibility == getVisibleRange()[1]) { f6 = 0.2F; GL11.glColor4f(f6, f6, f6, 1.0F); - } - else - { - if (researchVisibility != getVisibleRange()[2]) - { + } else { + if (researchVisibility != getVisibleRange()[2]) { continue; } @@ -502,43 +436,37 @@ else if (researchVisibility == getVisibleRange()[1]) this.mc.getTextureManager().bindTexture(screenTex); - GL11.glEnable(GL11.GL_BLEND);// Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. - if (achievement2.getSpecial()) - { + GL11.glEnable(GL11.GL_BLEND);// Forge: Specifically enable blend because it is needed here. And we fix + // Generic RenderItem's leakage of it. + if (achievement2.getSpecial()) { this.drawTexturedModalRect(i5 - 2, j5 - 2, 26, 202, 26, 26); - } - else if (achievement2.getPerk()) - { + } else if (achievement2.getPerk()) { this.drawTexturedModalRect(i5 - 2, j5 - 2, 52, 202, 26, 26); - } - else - { + } else { this.drawTexturedModalRect(i5 - 2, j5 - 2, 0, 202, 26, 26); } - GL11.glDisable(GL11.GL_BLEND); //Forge: Cleanup states we set. + GL11.glDisable(GL11.GL_BLEND); // Forge: Cleanup states we set. - if (!ResearchLogic.canUnlockInfo(player, achievement2)) - { + if (!ResearchLogic.canUnlockInfo(player, achievement2)) { f6 = 0.1F; GL11.glColor4f(f6, f6, f6, 1.0F); renderitem.renderWithColor = false; } - GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure Lighting is disabled. Fixes MC-33065 + GL11.glDisable(GL11.GL_LIGHTING); // Forge: Make sure Lighting is disabled. Fixes MC-33065 GL11.glEnable(GL11.GL_CULL_FACE); - renderitem.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), achievement2.theItemStack, i5 + 3, j5 + 3); + renderitem.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), + achievement2.theItemStack, i5 + 3, j5 + 3); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_LIGHTING); - if (!ResearchLogic.canUnlockInfo(player, achievement2)) - { + if (!ResearchLogic.canUnlockInfo(player, achievement2)) { renderitem.renderWithColor = true; } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - if (f4 >= i5 && f4 <= i5 + 22 && f5 >= j5 && f5 <= j5 + 22) - { + if (f4 >= i5 && f4 <= i5 + 22 && f5 >= j5 && f5 <= j5 + 22) { achievement = achievement2; } } @@ -550,219 +478,194 @@ else if (achievement2.getPerk()) GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(screenTex); this.drawTexturedModalRect(i1, j1, 0, 0, GuiKnowledge.field_146555_f, GuiKnowledge.field_146557_g); - + this.zLevel = 0.0F; GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); - - if(selected != null) - { - int purchasex = i1 + (field_146555_f - buyWidth)/2; - int purchasey =j1 + (field_146557_g - buyHeight)/2; - renderPurchaseScreen(purchasex, purchasey, mx, my); + + if (selected != null) { + int purchasex = i1 + (field_146555_f - buyWidth) / 2; + int purchasey = j1 + (field_146557_g - buyHeight) / 2; + renderPurchaseScreen(purchasex, purchasey, mx, my); } drawSkillList(); super.drawScreen(mx, my, f); highlighted = achievement; - if (selected == null && achievement != null) - { + if (selected == null && achievement != null) { String s1 = achievement.getDisplayName(); String s2 = achievement.getDescription(); i5 = mx + 12; j5 = my - 4; researchVisibility = ResearchLogic.func_150874_c(player, achievement); - - if (!ResearchLogic.canUnlockInfo(player, achievement)) - { + + if (!ResearchLogic.canUnlockInfo(player, achievement)) { String s; int k4; - if (researchVisibility == 3) - { + if (researchVisibility == 3) { s1 = I18n.format("achievement.unknown", new Object[0]); j4 = Math.max(this.fontRendererObj.getStringWidth(s1), 120); - s = (new ChatComponentTranslation("achievement.requires", new Object[] {achievement.parentInfo.getDisplayName()})).getUnformattedText(); + s = (new ChatComponentTranslation("achievement.requires", + new Object[]{achievement.parentInfo.getDisplayName()})).getUnformattedText(); k4 = this.fontRendererObj.splitStringWidth(s, j4); this.drawGradientRect(i5 - 3, j5 - 3, i5 + j4 + 3, j5 + k4 + 12 + 3, -1073741824, -1073741824); this.fontRendererObj.drawSplitString(s, i5, j5 + 12, j4, -9416624); - } - else if (researchVisibility < 3) - { + } else if (researchVisibility < 3) { j4 = Math.max(this.fontRendererObj.getStringWidth(s1), 120); - s = (new ChatComponentTranslation("achievement.requires", new Object[] {achievement.parentInfo.getDisplayName()})).getUnformattedText(); + s = (new ChatComponentTranslation("achievement.requires", + new Object[]{achievement.parentInfo.getDisplayName()})).getUnformattedText(); k4 = this.fontRendererObj.splitStringWidth(s, j4); this.drawGradientRect(i5 - 3, j5 - 3, i5 + j4 + 3, j5 + k4 + 12 + 3, -1073741824, -1073741824); this.fontRendererObj.drawSplitString(s, i5, j5 + 12, j4, -9416624); - } - else - { + } else { s1 = null; } - } - else - { + } else { j4 = Math.max(this.fontRendererObj.getStringWidth(s1), 120); int k5 = this.fontRendererObj.splitStringWidth(s2, j4); - if (ResearchLogic.hasInfoUnlocked(player, achievement) || ResearchLogic.canUnlockInfo(player, achievement)) - { + if (ResearchLogic.hasInfoUnlocked(player, achievement) + || ResearchLogic.canUnlockInfo(player, achievement)) { k5 += 12; } this.drawGradientRect(i5 - 3, j5 - 3, i5 + j4 + 3, j5 + k5 + 3 + 12, -1073741824, -1073741824); this.fontRendererObj.drawSplitString(s2, i5, j5 + 12, j4, -6250336); - if (ResearchLogic.hasInfoUnlocked(player, achievement)) - { - this.fontRendererObj.drawStringWithShadow(I18n.format("information.discovered", new Object[0]), i5, j5 + k5 + 4, -7302913); - } - else if(InformationBase.easyResearch && ResearchLogic.canUnlockInfo(player, achievement)) - { - this.fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("information.buy"), i5, j5 + k5 + 4, -7302913); + if (ResearchLogic.hasInfoUnlocked(player, achievement)) { + this.fontRendererObj.drawStringWithShadow(I18n.format("information.discovered", new Object[0]), i5, + j5 + k5 + 4, -7302913); + } else if (InformationBase.easyResearch && ResearchLogic.canUnlockInfo(player, achievement)) { + this.fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("information.buy"), i5, + j5 + k5 + 4, -7302913); } } - if (s1 != null) - { - this.fontRendererObj.drawStringWithShadow(s1, i5, j5, ResearchLogic.canUnlockInfo(player, achievement) ? (achievement.getSpecial() ? -128 : -1) : (achievement.getSpecial() ? -8355776 : -8355712)); + if (s1 != null) { + this.fontRendererObj.drawStringWithShadow(s1, i5, j5, + ResearchLogic.canUnlockInfo(player, achievement) ? (achievement.getSpecial() ? -128 : -1) + : (achievement.getSpecial() ? -8355776 : -8355712)); } } - + GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); RenderHelper.disableStandardItemLighting(); } - /** - * Returns true if this GUI should pause the game when it is displayed in single-player + /** + * Returns true if this GUI should pause the game when it is displayed in + * single-player */ @Override - public boolean doesGuiPauseGame() - { + public boolean doesGuiPauseGame() { return false; } - - private int[] getVisibleRange() - { - return new int[]{1, 2, 3}; + + private int[] getVisibleRange() { + return new int[]{1, 2, 3}; } - - private void renderPurchaseScreen(int x, int y, int mx, int my) - { - if(selected != null) - { - String[] requirements = selected.getRequiredSkills(); - int size = 0; - if(requirements != null) - { - size = requirements.length; - } - this.mc.getTextureManager().bindTexture(buyTex); - this.drawTexturedModalRect(x, y, 0, 0, buyWidth, 27);//Top - for(int a = 0; a < size; a++) - { - this.drawTexturedModalRect(x, y+27 + (a*19), 0, 27, buyWidth, 19);//Middle - } - this.drawTexturedModalRect(x, y+27 + (size*19), 0, 46, buyWidth, 26);//Bottom - - if(buttonList.get(2) != null && buttonList.get(3) != null) - { - int j1 = (this.height - GuiKnowledge.field_146557_g) / 2; - int purchasey =j1 + (field_146557_g - buyHeight)/2; - - int offset = -19; - if(requirements != null) - { - offset += (19*requirements.length); - } - ((GuiButton)buttonList.get(2)).yPosition = purchasey + 47 + offset; - ((GuiButton)buttonList.get(3)).yPosition = purchasey + 47 + offset; + + private void renderPurchaseScreen(int x, int y, int mx, int my) { + if (selected != null) { + String[] requirements = selected.getRequiredSkills(); + int size = 0; + if (requirements != null) { + size = requirements.length; } - int red = GuiHelper.getColourForRGB(220, 0, 0); - int white = 16777215; - mc.fontRenderer.drawString(selected.getDisplayName(), x+22, y+12, white, false); - - if(hasScroll) - { - mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("knowledge.hasScroll"), x+20, y+32, red); + this.mc.getTextureManager().bindTexture(buyTex); + this.drawTexturedModalRect(x, y, 0, 0, buyWidth, 27);// Top + for (int a = 0; a < size; a++) { + this.drawTexturedModalRect(x, y + 27 + (a * 19), 0, 27, buyWidth, 19);// Middle } - else - { - for(int a = 0; a < requirements.length; a ++) - { - boolean isUnlocked = selected.isUnlocked(a, mc.thePlayer); - String text = requirements[a]; - mc.fontRenderer.drawStringWithShadow(text, x+20, y+32 + (a*19), isUnlocked ? white : red); - } - } - } - GL11.glColor3f(255, 255, 255); - } - - private void setPurchaseAvailable(EntityPlayer user) - { - if(selected != null) - { - canPurchase = selected.hasSkillsUnlocked(user); + this.drawTexturedModalRect(x, y + 27 + (size * 19), 0, 46, buyWidth, 26);// Bottom + + if (buttonList.get(2) != null && buttonList.get(3) != null) { + int j1 = (this.height - GuiKnowledge.field_146557_g) / 2; + int purchasey = j1 + (field_146557_g - buyHeight) / 2; + + int offset = -19; + if (requirements != null) { + offset += (19 * requirements.length); + } + ((GuiButton) buttonList.get(2)).yPosition = purchasey + 47 + offset; + ((GuiButton) buttonList.get(3)).yPosition = purchasey + 47 + offset; + } + int red = GuiHelper.getColourForRGB(220, 0, 0); + int white = 16777215; + mc.fontRenderer.drawString(selected.getDisplayName(), x + 22, y + 12, white, false); + + if (hasScroll) { + mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("knowledge.hasScroll"), x + 20, + y + 32, red); + } else { + for (int a = 0; a < requirements.length; a++) { + boolean isUnlocked = selected.isUnlocked(a, mc.thePlayer); + String text = requirements[a]; + mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 32 + (a * 19), isUnlocked ? white : red); + } + } + } + GL11.glColor3f(255, 255, 255); + } + + private void setPurchaseAvailable(EntityPlayer user) { + if (selected != null) { + canPurchase = selected.hasSkillsUnlocked(user); + } else { + canPurchase = false; } - else - { - canPurchase = false; - } } - - protected void drawSkillList() - { - GL11.glPushMatrix(); - - int skillWidth = 143; - int skillHeight = 156; + + protected void drawSkillList() { + GL11.glPushMatrix(); + + int skillWidth = 143; + int skillHeight = 156; int x = (this.width - GuiKnowledge.field_146555_f) / 2 - skillWidth + offsetByX; int y = (this.height - GuiKnowledge.field_146557_g) / 2 + offsetByY; this.mc.getTextureManager().bindTexture(skillTex); - + this.drawTexturedModalRect(x, y, 0, 0, skillWidth, skillHeight); - - drawSkill(x+20, y+20, SkillList.artisanry); - drawSkill(x+20, y+44, SkillList.construction); - drawSkill(x+20, y+68, SkillList.provisioning); - drawSkill(x+20, y+92, SkillList.engineering); - drawSkill(x+20, y+116, SkillList.combat); - - drawSkillName(x+20, y+20, SkillList.artisanry); - drawSkillName(x+20, y+44, SkillList.construction); - drawSkillName(x+20, y+68, SkillList.provisioning); - drawSkillName(x+20, y+92, SkillList.engineering); - drawSkillName(x+20, y+116, SkillList.combat); - + + drawSkill(x + 20, y + 20, SkillList.artisanry); + drawSkill(x + 20, y + 44, SkillList.construction); + drawSkill(x + 20, y + 68, SkillList.provisioning); + drawSkill(x + 20, y + 92, SkillList.engineering); + drawSkill(x + 20, y + 116, SkillList.combat); + + drawSkillName(x + 20, y + 20, SkillList.artisanry); + drawSkillName(x + 20, y + 44, SkillList.construction); + drawSkillName(x + 20, y + 68, SkillList.provisioning); + drawSkillName(x + 20, y + 92, SkillList.engineering); + drawSkillName(x + 20, y + 116, SkillList.combat); + GL11.glPopMatrix(); } - - protected void drawSkill(int x, int y, Skill skill) - { - if(skill != null) - { - int level = RPGElements.getLevel(mc.thePlayer, skill); - int xp = skill.getXP(player)[0]; - int max = skill.getXP(player)[1]; - if(xp > max)xp = max; - - float scale = (float)xp / (float)max; - this.drawTexturedModalRect(x+22, y+13, 0, 156, (int)(78F * scale), 5); - - //mc.fontRenderer.drawString(skill.getDisplayName(), x+2, y+1, 0); - //mc.fontRenderer.drawString(""+level, x+1, y+10, 0); - } + + protected void drawSkill(int x, int y, Skill skill) { + if (skill != null) { + int level = RPGElements.getLevel(mc.thePlayer, skill); + int xp = skill.getXP(player)[0]; + int max = skill.getXP(player)[1]; + if (xp > max) + xp = max; + + float scale = (float) xp / (float) max; + this.drawTexturedModalRect(x + 22, y + 13, 0, 156, (int) (78F * scale), 5); + + // mc.fontRenderer.drawString(skill.getDisplayName(), x+2, y+1, 0); + // mc.fontRenderer.drawString(""+level, x+1, y+10, 0); + } } - protected void drawSkillName(int x, int y, Skill skill) - { - if(skill != null) - { - int level = RPGElements.getLevel(mc.thePlayer, skill); - mc.fontRenderer.drawString(skill.getDisplayName(), x+2, y+1, 0); - mc.fontRenderer.drawString(""+level, x+1, y+10, 0); - } + + protected void drawSkillName(int x, int y, Skill skill) { + if (skill != null) { + int level = RPGElements.getLevel(mc.thePlayer, skill); + mc.fontRenderer.drawString(skill.getDisplayName(), x + 2, y + 1, 0); + mc.fontRenderer.drawString("" + level, x + 1, y + 10, 0); + } } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiKnowledgeEntry.java b/src/main/java/minefantasy/mf2/client/gui/GuiKnowledgeEntry.java index 3be717fa..63f975b9 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiKnowledgeEntry.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiKnowledgeEntry.java @@ -1,7 +1,5 @@ package minefantasy.mf2.client.gui; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; @@ -17,150 +15,133 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.resources.I18n; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) -public class GuiKnowledgeEntry extends GuiScreen -{ - //GuiScreenBook - private final GuiScreen parentGui; - private final InformationBase infoBase; - private Minecraft mc = Minecraft.getMinecraft(); - private int pages = 1; - private int currentPage = 0; - public int bookImageWidth = EntryPageCraft.universalBookImageWidth; - public int bookImageHeight = EntryPageCraft.universalBookImageHeight; +public class GuiKnowledgeEntry extends GuiScreen { + private static boolean lastTick = true; + private static boolean canTick = true; + // GuiScreenBook + private final GuiScreen parentGui; + private final InformationBase infoBase; + public int bookImageWidth = EntryPageCraft.universalBookImageWidth; + public int bookImageHeight = EntryPageCraft.universalBookImageHeight; + private Minecraft mc = Minecraft.getMinecraft(); + private int pages = 1; + private int currentPage = 0; private GuiKnowledgeEntry.NextPageButton buttonNextPage; private GuiKnowledgeEntry.NextPageButton buttonPreviousPage; private GuiButton buttonDone; - - public GuiKnowledgeEntry(GuiScreen parent, InformationBase info) - { - this.parentGui = parent; - this.infoBase = info; - pages = info.getPages().size(); - } - - @Override - public void initGui() - { - int xPoint = this.width / 2; + + public GuiKnowledgeEntry(GuiScreen parent, InformationBase info) { + this.parentGui = parent; + this.infoBase = info; + pages = info.getPages().size(); + } + + @Override + public void initGui() { + int xPoint = this.width / 2; int yPoint = (this.height - this.bookImageHeight) / 2; - + this.buttonList.clear(); - this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 - 100, 4 + yPoint + this.bookImageHeight-16, 200, 20, I18n.format("gui.done", new Object[0]))); - this.buttonList.add(this.buttonNextPage = new GuiKnowledgeEntry.NextPageButton(1, xPoint +bookImageWidth - 22, yPoint + 209, true)); - this.buttonList.add(this.buttonPreviousPage = new GuiKnowledgeEntry.NextPageButton(2, xPoint -bookImageWidth + 4, yPoint + 209, false)); - this.updateButtons(); + this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 - 100, + 4 + yPoint + this.bookImageHeight - 16, 200, 20, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(this.buttonNextPage = new GuiKnowledgeEntry.NextPageButton(1, xPoint + bookImageWidth - 22, + yPoint + 209, true)); + this.buttonList.add(this.buttonPreviousPage = new GuiKnowledgeEntry.NextPageButton(2, + xPoint - bookImageWidth + 4, yPoint + 209, false)); + this.updateButtons(); } - - private void updateButtons() - { + + private void updateButtons() { this.buttonNextPage.visible = (this.currentPage < this.pages - 2); this.buttonPreviousPage.visible = this.currentPage > 1; } - private static boolean lastTick = true; - private static boolean canTick = true; - @Override - public void drawScreen(int x, int y, float f) - { - boolean onTick = false; - - boolean currTick = mc.theWorld.getTotalWorldTime() % 10 == 0;//has a second passed - - if(currTick != lastTick) - { - canTick = !canTick; - if(canTick) - { - onTick = true; - } - } - lastTick = currTick; - - drawPage(x, y, f, currentPage, -(bookImageWidth / 2), "left_page", onTick); - drawPage(x, y, f, currentPage+1, (bookImageWidth / 2), "right_page", onTick); - - super.drawScreen(x, y, f); + + @Override + public void drawScreen(int x, int y, float f) { + boolean onTick = false; + + boolean currTick = mc.theWorld.getTotalWorldTime() % 10 == 0;// has a second passed + + if (currTick != lastTick) { + canTick = !canTick; + if (canTick) { + onTick = true; + } + } + lastTick = currTick; + + drawPage(x, y, f, currentPage, -(bookImageWidth / 2), "left_page", onTick); + drawPage(x, y, f, currentPage + 1, (bookImageWidth / 2), "right_page", onTick); + + super.drawScreen(x, y, f); } - public void drawPage(int x, int y, float f, int num, int offset, String tex, boolean onTick) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glEnable(GL11.GL_BLEND); + + public void drawPage(int x, int y, float f, int num, int offset, String tex, boolean onTick) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - int xPoint = (this.width - this.bookImageWidth) / 2 + offset; + + int xPoint = (this.width - this.bookImageWidth) / 2 + offset; int yPoint = (this.height - this.bookImageHeight) / 2; - - this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/"+tex+".png")); + + this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/" + tex + ".png")); this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.bookImageWidth, this.bookImageHeight); - - if(num < infoBase.getPages().size()) - { - EntryPage page = infoBase.getPages().get(num); - if(page != null) - { - page.preRender(this, x, y, f, xPoint, yPoint, onTick); - page.render(this, x, y, f, xPoint, yPoint, onTick); - } - } - - String s = I18n.format("book.pageIndicator", new Object[] {Integer.valueOf(num + 1), Integer.valueOf(this.pages)}); + + if (num < infoBase.getPages().size()) { + EntryPage page = infoBase.getPages().get(num); + if (page != null) { + page.preRender(this, x, y, f, xPoint, yPoint, onTick); + page.render(this, x, y, f, xPoint, yPoint, onTick); + } + } + + String s = I18n.format("book.pageIndicator", + new Object[]{Integer.valueOf(num + 1), Integer.valueOf(this.pages)}); int l = mc.fontRenderer.getStringWidth(s) / 2; - this.fontRendererObj.drawString(s, xPoint + (bookImageWidth/2) - l, yPoint + bookImageHeight-16, 0); + this.fontRendererObj.drawString(s, xPoint + (bookImageWidth / 2) - l, yPoint + bookImageHeight - 16, 0); } - - @Override - protected void actionPerformed(GuiButton button) - { - if (button.id == 0) - { + + @Override + protected void actionPerformed(GuiButton button) { + if (button.id == 0) { this.mc.displayGuiScreen(parentGui); } - if (button.id == 1) - { - if(currentPage < pages-2) - { - currentPage +=2; - } + if (button.id == 1) { + if (currentPage < pages - 2) { + currentPage += 2; + } } - if (button.id == 2) - { - if(currentPage > 1) - { - currentPage -= 2; - } + if (button.id == 2) { + if (currentPage > 1) { + currentPage -= 2; + } } updateButtons(); } - - @Override - protected void keyTyped(char p_73869_1_, int p_73869_2_) - { - if (p_73869_2_ == this.mc.gameSettings.keyBindInventory.getKeyCode()) - { - mc.thePlayer.openGui(MineFantasyII.instance, 1, mc.thePlayer.worldObj, 0, -1, 0); - } - else - { + + @Override + protected void keyTyped(char p_73869_1_, int p_73869_2_) { + if (p_73869_2_ == this.mc.gameSettings.keyBindInventory.getKeyCode()) { + mc.thePlayer.openGui(MineFantasyII.instance, 1, mc.thePlayer.worldObj, 0, -1, 0); + } else { super.keyTyped(p_73869_1_, p_73869_2_); } } - - @Override - public boolean doesGuiPauseGame() - { - return false; - } - - - @SideOnly(Side.CLIENT) - static class NextPageButton extends GuiButton - { + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @SideOnly(Side.CLIENT) + static class NextPageButton extends GuiButton { private final boolean isNextPage; - public NextPageButton(int p_i1079_1_, int p_i1079_2_, int p_i1079_3_, boolean p_i1079_4_) - { + public NextPageButton(int p_i1079_1_, int p_i1079_2_, int p_i1079_3_, boolean p_i1079_4_) { super(p_i1079_1_, p_i1079_2_, p_i1079_3_, 23, 13, ""); this.isNextPage = p_i1079_4_; } @@ -168,34 +149,31 @@ public NextPageButton(int p_i1079_1_, int p_i1079_2_, int p_i1079_3_, boolean p_ /** * Draws this button to the screen. */ - public void drawButton(Minecraft mc, int x, int y) - { - if (this.visible) - { - boolean flag = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height; + public void drawButton(Minecraft mc, int x, int y) { + if (this.visible) { + boolean flag = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width + && y < this.yPosition + this.height; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/book.png")); int k = 0; int l = 228; - if (flag) - { + if (flag) { k += 18; } - if (!this.isNextPage) - { + if (!this.isNextPage) { l += 10; } this.drawTexturedModalRect(this.xPosition, this.yPosition, k, l, 18, 10); } } - + @Override - public void func_146113_a(SoundHandler snd) - { - snd.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("minefantasy2:block.flipPage"), 1.0F)); + public void func_146113_a(SoundHandler snd) { + snd.playSound( + PositionedSoundRecord.func_147674_a(new ResourceLocation("minefantasy2:block.flipPage"), 1.0F)); } } } diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiQuern.java b/src/main/java/minefantasy/mf2/client/gui/GuiQuern.java index aeea75dd..68221b56 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiQuern.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiQuern.java @@ -1,50 +1,43 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityQuern; import minefantasy.mf2.container.ContainerQuern; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiQuern extends GuiContainer -{ +public class GuiQuern extends GuiContainer { private TileEntityQuern tile; - - public GuiQuern(InventoryPlayer user, TileEntityQuern tile) - { + + public GuiQuern(InventoryPlayer user, TileEntityQuern tile) { super(new ContainerQuern(user, tile)); this.ySize = 175; this.tile = tile; } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { + protected void drawGuiContainerForegroundLayer(int x, int y) { } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/quern.png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); } - + @Override - public void drawScreen(int x, int y, float f) - { + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiReload.java b/src/main/java/minefantasy/mf2/client/gui/GuiReload.java index 4467c93c..d8fc9ca8 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiReload.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiReload.java @@ -1,54 +1,46 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.container.ContainerReload; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiReload extends GuiContainer -{ - public GuiReload(InventoryPlayer user, ItemStack weapon) - { +public class GuiReload extends GuiContainer { + public GuiReload(InventoryPlayer user, ItemStack weapon) { super(new ContainerReload(user, weapon)); this.ySize = 148; this.xSize = 176; } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { + protected void drawGuiContainerForegroundLayer(int x, int y) { } - + @Override - protected boolean checkHotbarKeys(int id) - { - return false; + protected boolean checkHotbarKeys(int id) { + return false; } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/reload.png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); } - + @Override - public void drawScreen(int x, int y, float f) - { + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/gui/GuiResearchBlock.java b/src/main/java/minefantasy/mf2/client/gui/GuiResearchBlock.java index 368cb15e..8dd3ec29 100644 --- a/src/main/java/minefantasy/mf2/client/gui/GuiResearchBlock.java +++ b/src/main/java/minefantasy/mf2/client/gui/GuiResearchBlock.java @@ -1,24 +1,19 @@ package minefantasy.mf2.client.gui; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityResearch; import minefantasy.mf2.container.ContainerResearch; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class GuiResearchBlock extends GuiContainer -{ +public class GuiResearchBlock extends GuiContainer { private TileEntityResearch tile; - - public GuiResearchBlock(InventoryPlayer user, TileEntityResearch tile) - { + + public GuiResearchBlock(InventoryPlayer user, TileEntityResearch tile) { super(new ContainerResearch(user, tile)); this.ySize = 158; this.xSize = 178; @@ -26,30 +21,28 @@ public GuiResearchBlock(InventoryPlayer user, TileEntityResearch tile) } /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) */ @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { + protected void drawGuiContainerForegroundLayer(int x, int y) { } @Override - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TextureHelperMF.getResource("textures/gui/knowledge/research.png")); int xPoint = (this.width - this.xSize) / 2; int yPoint = (this.height - this.ySize) / 2; this.drawTexturedModalRect(xPoint, yPoint, 0, 0, this.xSize, this.ySize); - + int scale = tile.getMetreScale(161); - this.drawTexturedModalRect(xPoint+10, yPoint+33, 0, 158, scale, 3); - fontRendererObj.drawString(tile.getLocalisedName(), xPoint+9, yPoint+11, 0); + this.drawTexturedModalRect(xPoint + 10, yPoint + 33, 0, 158, scale, 3); + fontRendererObj.drawString(tile.getLocalisedName(), xPoint + 9, yPoint + 11, 0); } - + @Override - public void drawScreen(int x, int y, float f) - { + public void drawScreen(int x, int y, float f) { super.drawScreen(x, y, f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/AnimationHandlerMF.java b/src/main/java/minefantasy/mf2/client/render/AnimationHandlerMF.java index 39016e20..131b610a 100644 --- a/src/main/java/minefantasy/mf2/client/render/AnimationHandlerMF.java +++ b/src/main/java/minefantasy/mf2/client/render/AnimationHandlerMF.java @@ -1,23 +1,17 @@ package minefantasy.mf2.client.render; -import minefantasy.mf2.item.weapon.ItemWeaponMF; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; +import net.minecraft.entity.player.EntityPlayer; -public class AnimationHandlerMF -{ - @SubscribeEvent - public void onPlayerTick(TickEvent.PlayerTickEvent event) - { - if(event.phase == TickEvent.Phase.START) - { +public class AnimationHandlerMF { + @SubscribeEvent + public void onPlayerTick(TickEvent.PlayerTickEvent event) { + if (event.phase == TickEvent.Phase.START) { tickStart(event.player); } } - public void tickStart(EntityPlayer entityPlayer) - { + public void tickStart(EntityPlayer entityPlayer) { } } diff --git a/src/main/java/minefantasy/mf2/client/render/HudHandlerMF.java b/src/main/java/minefantasy/mf2/client/render/HudHandlerMF.java index bae8faf7..8c3e9e25 100644 --- a/src/main/java/minefantasy/mf2/client/render/HudHandlerMF.java +++ b/src/main/java/minefantasy/mf2/client/render/HudHandlerMF.java @@ -1,53 +1,43 @@ package minefantasy.mf2.client.render; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.item.archery.ItemBowMF; import minefantasy.mf2.item.gadget.IScope; -import minefantasy.mf2.item.gadget.ItemSpyglass; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.FOVUpdateEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class HudHandlerMF -{ - private MineFantasyHUD inGameGUI = new MineFantasyHUD(); - - @SubscribeEvent - public void postRenderOverlay(RenderGameOverlayEvent.Post event) - { - if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR) - { - inGameGUI.renderGameOverlay(event.partialTicks, event.mouseX, event.mouseY); - } - if (event.type == RenderGameOverlayEvent.ElementType.HELMET) - { - inGameGUI.renderViewport(); - } - } - - @SubscribeEvent - public void onBowFOV(FOVUpdateEvent event) - { - ItemStack stack = event.entity.getItemInUse(); - if (stack != null && stack.getItem() instanceof ItemBowMF) - { +public class HudHandlerMF { + private MineFantasyHUD inGameGUI = new MineFantasyHUD(); + + @SubscribeEvent + public void postRenderOverlay(RenderGameOverlayEvent.Post event) { + if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR) { + inGameGUI.renderGameOverlay(event.partialTicks, event.mouseX, event.mouseY); + } + if (event.type == RenderGameOverlayEvent.ElementType.HELMET) { + inGameGUI.renderViewport(); + } + } + + @SubscribeEvent + public void onBowFOV(FOVUpdateEvent event) { + ItemStack stack = event.entity.getItemInUse(); + if (stack != null && stack.getItem() instanceof ItemBowMF) { int i = event.entity.getItemInUseDuration(); float f1 = i / 20.0F; - if (f1 > 1.0F) - { + if (f1 > 1.0F) { f1 = 1.0F; - } - else{ + } else { f1 *= f1; } event.newfov *= 1.0F - f1 * 0.15F; } - if (stack != null && stack.getItem() instanceof IScope) - { - IScope spyglass = (IScope)stack.getItem(); + if (stack != null && stack.getItem() instanceof IScope) { + IScope spyglass = (IScope) stack.getItem(); event.newfov *= 1.0F - spyglass.getZoom(stack); } } diff --git a/src/main/java/minefantasy/mf2/client/render/MineFantasyHUD.java b/src/main/java/minefantasy/mf2/client/render/MineFantasyHUD.java index 1142f1ff..23d5c88c 100644 --- a/src/main/java/minefantasy/mf2/client/render/MineFantasyHUD.java +++ b/src/main/java/minefantasy/mf2/client/render/MineFantasyHUD.java @@ -1,19 +1,11 @@ package minefantasy.mf2.client.render; -import java.awt.Color; - -import org.lwjgl.opengl.GL11; - import minefantasy.mf2.api.archery.AmmoMechanicsMF; import minefantasy.mf2.api.archery.IDisplayMFAmmo; import minefantasy.mf2.api.archery.IFirearm; import minefantasy.mf2.api.crafting.IBasicMetre; import minefantasy.mf2.api.crafting.IQualityBalance; -import minefantasy.mf2.api.helpers.ArmourCalculator; -import minefantasy.mf2.api.helpers.GuiHelper; -import minefantasy.mf2.api.helpers.PowerArmour; -import minefantasy.mf2.api.helpers.TextureHelperMF; -import minefantasy.mf2.api.helpers.ToolHelper; +import minefantasy.mf2.api.helpers.*; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.block.tileentity.TileEntityAnvilMF; @@ -40,174 +32,172 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class MineFantasyHUD extends Gui { + protected static final ResourceLocation pumpkinBlurTexPath = new ResourceLocation("textures/misc/pumpkinblur.png"); + private static Minecraft mc = Minecraft.getMinecraft(); + + /** + * Gets the 2 config values to get the X,Y orient + */ + public static int[] getOrientsFor(int screenX, int screenY, int cfgX, int cfgY) { + int xOrient = cfgX == -1 ? 0 : cfgX == 1 ? screenX : screenX / 2; + int yOrient = cfgY == -1 ? 0 : cfgY == 1 ? screenY : screenY / 2; + + return new int[]{xOrient, yOrient}; + } + + public void renderViewport() { + if (mc.thePlayer != null) { + EntityPlayer player = mc.thePlayer; + + if (this.mc.gameSettings.thirdPersonView == 0) { + if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IScope) { + renderScope(player.getHeldItem(), player); + } + if (player.ridingEntity != null && player.ridingEntity instanceof EntityCogwork) { + renderPowerHelmet(player, (EntityCogwork) player.ridingEntity); + } + } + } + } + + public void renderGameOverlay(float partialTicks, int mouseX, int mouseY) { + if (mc.thePlayer != null) { + EntityPlayer player = mc.thePlayer; + + if (mc.currentScreen != null + && (mc.currentScreen instanceof GuiInventory || mc.currentScreen instanceof GuiContainerCreative)) { + renderArmourRating(player); + } else { + renderAmmo(player); + } + if (StaminaBar.isSystemActive && !player.capabilities.isCreativeMode + && !PowerArmour.isWearingCogwork(player)) { + renderStaminaBar(player); + } + Entity highlight = getClickedEntity(partialTicks, mouseX, mouseY); + if (highlight != null && highlight instanceof EntityCogwork) { + lookAtCogwork((EntityCogwork) highlight); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + int[] coords = getClickedBlock(partialTicks, mouseX, mouseY); + if (coords == null) + return; -public class MineFantasyHUD extends Gui -{ - private static Minecraft mc = Minecraft.getMinecraft(); - public void renderViewport() - { - if(mc.thePlayer != null) - { - EntityPlayer player = mc.thePlayer; - - if(this.mc.gameSettings.thirdPersonView == 0) - { - if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IScope) - { - renderScope(player.getHeldItem(), player); - } - if(player.ridingEntity != null && player.ridingEntity instanceof EntityCogwork) - { - renderPowerHelmet(player, (EntityCogwork)player.ridingEntity); - } - } - } - } - public void renderGameOverlay(float partialTicks, int mouseX, int mouseY) - { - if(mc.thePlayer != null) - { - EntityPlayer player = mc.thePlayer; - - if(mc.currentScreen != null && (mc.currentScreen instanceof GuiInventory || mc.currentScreen instanceof GuiContainerCreative)) - { - renderArmourRating(player); - } - else - { - renderAmmo(player); - } - if(StaminaBar.isSystemActive && !player.capabilities.isCreativeMode && !PowerArmour.isWearingCogwork(player)) - { - renderStaminaBar(player); - } - Entity highlight = getClickedEntity(partialTicks, mouseX, mouseY); - if(highlight != null && highlight instanceof EntityCogwork) - { - lookAtCogwork((EntityCogwork)highlight); - } - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - int[] coords = getClickedBlock(partialTicks, mouseX, mouseY); - if(coords == null)return; - - int x = coords[0]; - int y = coords[1]; - int z = coords[2]; - World world = player.worldObj; - TileEntity tile = world.getTileEntity(x, y, z); - if(tile != null) - { - if(tile instanceof TileEntityAnvilMF) - { - this.renderCraftMetre(world, player, (TileEntityAnvilMF)tile); - } - if(tile instanceof TileEntityCarpenterMF) - { - this.renderCraftMetre(world, player, (TileEntityCarpenterMF)tile); - } - if(tile instanceof TileEntityTanningRack) - { - this.renderCraftMetre(world, player, (TileEntityTanningRack)tile); - } - if(tile instanceof IBasicMetre) - { - this.renderCraftMetre(world, player, (IBasicMetre)tile); - } - if(tile instanceof IQualityBalance) - { - this.renderQualityBalance(world, player, (IQualityBalance)tile); - } - if(tile instanceof TileEntityRoad) - { - renderRoad(world, player, ((TileEntityRoad)tile)); - } - } - } - } - protected static final ResourceLocation pumpkinBlurTexPath = new ResourceLocation("textures/misc/pumpkinblur.png"); - - protected void renderPowerHelmet() - { - GL11.glPushMatrix(); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + int x = coords[0]; + int y = coords[1]; + int z = coords[2]; + World world = player.worldObj; + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null) { + if (tile instanceof TileEntityAnvilMF) { + this.renderCraftMetre(world, player, (TileEntityAnvilMF) tile); + } + if (tile instanceof TileEntityCarpenterMF) { + this.renderCraftMetre(world, player, (TileEntityCarpenterMF) tile); + } + if (tile instanceof TileEntityTanningRack) { + this.renderCraftMetre(world, player, (TileEntityTanningRack) tile); + } + if (tile instanceof IBasicMetre) { + this.renderCraftMetre(world, player, (IBasicMetre) tile); + } + if (tile instanceof IQualityBalance) { + this.renderQualityBalance(world, player, (IQualityBalance) tile); + } + if (tile instanceof TileEntityRoad) { + renderRoad(world, player, ((TileEntityRoad) tile)); + } + } + } + } + + protected void renderPowerHelmet() { + GL11.glPushMatrix(); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - + bindTexture("textures/gui/scopes/cogwork_helm.png"); - int x = (width/2 - 256); + int x = (width / 2 - 256); int y = height - 256; - + this.drawTexturedModalRect(x, y, 0, 64, 128, 64); - + GL11.glPopMatrix(); } - private void renderScope(ItemStack item, EntityPlayer user) - { - if(item.getItem() instanceof IFirearm) - { - float factor = ((IScope)item.getItem()).getZoom(item); - if(factor > 0.1F) - { - GL11.glPushMatrix(); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); - int width = scaledresolution.getScaledWidth(); - int height = scaledresolution.getScaledHeight(); - - bindTexture("textures/gui/scopes/scope_basic.png"); - int xPos = width/2 -128; - int yPos = height/2 -128; - this.drawTexturedModalRect(xPos, yPos, 0, 0, 256, 256); - - GL11.glPopMatrix(); - } - } - } - private void lookAtCogwork(EntityCogwork suit) - { - GL11.glPushMatrix(); - GL11.glColor3f(1.0F, 1.0F, 1.0F); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + private void renderScope(ItemStack item, EntityPlayer user) { + if (item.getItem() instanceof IFirearm) { + float factor = ((IScope) item.getItem()).getZoom(item); + if (factor > 0.1F) { + GL11.glPushMatrix(); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, + MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + int width = scaledresolution.getScaledWidth(); + int height = scaledresolution.getScaledHeight(); + + bindTexture("textures/gui/scopes/scope_basic.png"); + int xPos = width / 2 - 128; + int yPos = height / 2 - 128; + this.drawTexturedModalRect(xPos, yPos, 0, 0, 256, 256); + + GL11.glPopMatrix(); + } + } + } + + private void lookAtCogwork(EntityCogwork suit) { + GL11.glPushMatrix(); + GL11.glColor3f(1.0F, 1.0F, 1.0F); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - + renderCogworkFuel(width, height, suit); - + GL11.glPopMatrix(); - } - private void renderPowerHelmet(EntityPlayer user, EntityCogwork suit) - { - GL11.glPushMatrix(); - GL11.glColor3f(1.0F, 1.0F, 1.0F); - GL11.glEnable(GL11.GL_BLEND); + } + + private void renderPowerHelmet(EntityPlayer user, EntityCogwork suit) { + GL11.glPushMatrix(); + GL11.glColor3f(1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - + renderHelmetBlur(width, height); renderCogworkFuel(width, height, suit); - + GL11.glPopMatrix(); - } - private void renderCogworkFuel(int width, int height, EntityCogwork suit) - { - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); - + } + + private void renderCogworkFuel(int width, int height, EntityCogwork suit) { + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); + bindTexture("textures/gui/hud_overlay.png"); int[] orientationAR = getOrientsFor(width, height, ConfigClient.CF_xOrient, ConfigClient.CF_yOrient); int xPos = orientationAR[0] + ConfigClient.CF_xPos; int yPos = orientationAR[1] + ConfigClient.CF_yPos; - + this.drawTexturedModalRect(xPos, yPos, 84, 38, 172, 20); int i = suit.getMetreScaled(160); - this.drawTexturedModalRect(xPos+6+(160-i), yPos+11, 90, 20, i, 3); - } - - private void renderHelmetBlur(int width, int height) - { + this.drawTexturedModalRect(xPos + 6 + (160 - i), yPos + 11, 90, 20, i, 3); + } + + private void renderHelmetBlur(int width, int height) { GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); OpenGlHelper.glBlendFunc(770, 771, 1, 0); @@ -216,9 +206,9 @@ private void renderHelmetBlur(int width, int height) bindTexture("textures/gui/scopes/cogwork_helm.png"); Tessellator tessellator = Tessellator.instance; 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, height, -90.0D, 0.0D, 1.0D); + tessellator.addVertexWithUV(width, height, -90.0D, 1.0D, 1.0D); + tessellator.addVertexWithUV(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); @@ -227,392 +217,352 @@ private void renderHelmetBlur(int width, int height) GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } - - public int[] getClickedBlock(float ticks, int mouseX, int mouseY) - { - if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + public int[] getClickedBlock(float ticks, int mouseX, int mouseY) { + if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int j = mc.objectMouseOver.blockX; int k = mc.objectMouseOver.blockY; int l = mc.objectMouseOver.blockZ; - + return new int[]{j, k, l}; } - return null; - } - - public Entity getClickedEntity(float ticks, int mouseX, int mouseY) - { - if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) - { - return mc.objectMouseOver.entityHit; + return null; + } + + public Entity getClickedEntity(float ticks, int mouseX, int mouseY) { + if (mc.objectMouseOver != null + && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { + return mc.objectMouseOver.entityHit; } - return null; - } - private void renderArmourRating(EntityPlayer player) - { - int base = getBaseRating(player); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); - int width = scaledresolution.getScaledWidth(); + return null; + } + + private void renderArmourRating(EntityPlayer player) { + int base = getBaseRating(player); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); + int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - - + int[] orientationAR = getOrientsFor(width, height, ConfigClient.AR_xOrient, ConfigClient.AR_yOrient); int xPosAR = orientationAR[0] + ConfigClient.AR_xPos; int yPosAR = orientationAR[1] + ConfigClient.AR_yPos; int y = 8; - if(ArmourCalculator.advancedDamageTypes) - { - mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("attribute.armour.protection"), xPosAR, yPosAR, Color.WHITE.getRGB()); - displayTraitValue(xPosAR, yPosAR+8, orientationAR, 0, player, base); - displayTraitValue(xPosAR, yPosAR+16, orientationAR, 2, player, base); - displayTraitValue(xPosAR, yPosAR+24, orientationAR, 1, player, base); - y = 32; - } - else - { - displayGeneralAR(xPosAR, yPosAR, orientationAR, player, base); + if (ArmourCalculator.advancedDamageTypes) { + mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("attribute.armour.protection"), xPosAR, + yPosAR, Color.WHITE.getRGB()); + displayTraitValue(xPosAR, yPosAR + 8, orientationAR, 0, player, base); + displayTraitValue(xPosAR, yPosAR + 16, orientationAR, 2, player, base); + displayTraitValue(xPosAR, yPosAR + 24, orientationAR, 1, player, base); + y = 32; + } else { + displayGeneralAR(xPosAR, yPosAR, orientationAR, player, base); } - + float weight = getBaseWeight(player); - - for(int a = 0; a < 4; a ++) - { - ItemStack armour = mc.thePlayer.getEquipmentInSlot(4-a); - weight += ArmourCalculator.getPieceWeight(armour, a); - } - + + for (int a = 0; a < 4; a++) { + ItemStack armour = mc.thePlayer.getEquipmentInSlot(4 - a); + weight += ArmourCalculator.getPieceWeight(armour, a); + } + String massString = CustomMaterial.getWeightString(weight); - mc.fontRenderer.drawStringWithShadow(massString, xPosAR, yPosAR+y, Color.WHITE.getRGB()); - } - private int getBaseRating(EntityPlayer player) - { - if(player.ridingEntity != null && player.ridingEntity instanceof EntityCogwork) - { - return ((EntityCogwork)player.ridingEntity).getArmourRating(); - } - return 0; - } - private float getBaseWeight(EntityPlayer player) - { - if(player.ridingEntity != null && player.ridingEntity instanceof EntityCogwork) - { - return ((EntityCogwork)player.ridingEntity).getWeight(); - } - return 0; - } - private void renderAmmo(EntityPlayer player) - { - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); - int width = scaledresolution.getScaledWidth(); + mc.fontRenderer.drawStringWithShadow(massString, xPosAR, yPosAR + y, Color.WHITE.getRGB()); + } + + private int getBaseRating(EntityPlayer player) { + if (player.ridingEntity != null && player.ridingEntity instanceof EntityCogwork) { + return ((EntityCogwork) player.ridingEntity).getArmourRating(); + } + return 0; + } + + private float getBaseWeight(EntityPlayer player) { + if (player.ridingEntity != null && player.ridingEntity instanceof EntityCogwork) { + return ((EntityCogwork) player.ridingEntity).getWeight(); + } + return 0; + } + + private void renderAmmo(EntityPlayer player) { + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); + int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - - + int[] orientationAR = getOrientsFor(width, height, ConfigClient.AR_xOrient, ConfigClient.AR_yOrient); int xPosAR = orientationAR[0] + ConfigClient.AR_xPos; int yPosAR = orientationAR[1] + ConfigClient.AR_yPos; - + ItemStack held = player.getHeldItem(); - if(held != null && (held.getItem() instanceof IDisplayMFAmmo)) - { - ItemStack arrow = AmmoMechanicsMF.getAmmo(held); - - String text = StatCollector.translateToLocal("info.bow.reload"); - if(arrow != null) - { - text = arrow.getDisplayName() + " x" + arrow.stackSize ; - } - int[] orientationAC = getOrientsFor(width, height, ConfigClient.AC_xOrient, ConfigClient.AC_yOrient); + if (held != null && (held.getItem() instanceof IDisplayMFAmmo)) { + ItemStack arrow = AmmoMechanicsMF.getAmmo(held); + + String text = StatCollector.translateToLocal("info.bow.reload"); + if (arrow != null) { + text = arrow.getDisplayName() + " x" + arrow.stackSize; + } + int[] orientationAC = getOrientsFor(width, height, ConfigClient.AC_xOrient, ConfigClient.AC_yOrient); int xPosAC = orientationAR[0] + ConfigClient.AC_xPos; int yPosAC = orientationAR[1] + ConfigClient.AC_yPos; - - mc.fontRenderer.drawStringWithShadow(text, xPosAC, yPosAC, Color.WHITE.getRGB()); - - - int cap = ((IDisplayMFAmmo)held.getItem()).getAmmoCapacity(held); - - ItemStack ammo = AmmoMechanicsMF.getArrowOnBow(held); - int ammocount = ammo == null ? 0 : ammo.stackSize; - if(cap > 1) - { - String ammostring = StatCollector.translateToLocalFormatted("info.firearm.ammo", ammocount, cap); - mc.fontRenderer.drawStringWithShadow(ammostring, xPosAC, yPosAC+10, Color.WHITE.getRGB()); - } + + mc.fontRenderer.drawStringWithShadow(text, xPosAC, yPosAC, Color.WHITE.getRGB()); + + int cap = ((IDisplayMFAmmo) held.getItem()).getAmmoCapacity(held); + + ItemStack ammo = AmmoMechanicsMF.getArrowOnBow(held); + int ammocount = ammo == null ? 0 : ammo.stackSize; + if (cap > 1) { + String ammostring = StatCollector.translateToLocalFormatted("info.firearm.ammo", ammocount, cap); + mc.fontRenderer.drawStringWithShadow(ammostring, xPosAC, yPosAC + 10, Color.WHITE.getRGB()); + } } - } - - private void displayTraitValue(int xPosAR, int yPosAR, int[] orientationAR, int id, EntityPlayer player, int base) - { - float AR = (int)(ArmourCalculator.getDRDisplay(player, id)*100F) + base; - mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("attribute.armour.rating."+id)+" " + ItemWeaponMF.decimal_format.format(AR), xPosAR, yPosAR, Color.WHITE.getRGB()); - } - private void displayGeneralAR(int xPosAR, int yPosAR, int[] orientationAR, EntityPlayer player, int base) - { - float AR = ((int)(ArmourCalculator.getDRDisplay(player, 0)*100F) + base); - - mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("attribute.armour.protection")+": " + ItemWeaponMF.decimal_format.format(AR), xPosAR, yPosAR, Color.WHITE.getRGB()); - } - - private void renderStaminaBar(EntityPlayer player) - { - GL11.glEnable(GL11.GL_BLEND); + } + + private void displayTraitValue(int xPosAR, int yPosAR, int[] orientationAR, int id, EntityPlayer player, int base) { + float AR = (int) (ArmourCalculator.getDRDisplay(player, id) * 100F) + base; + mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("attribute.armour.rating." + id) + " " + + ItemWeaponMF.decimal_format.format(AR), xPosAR, yPosAR, Color.WHITE.getRGB()); + } + + private void displayGeneralAR(int xPosAR, int yPosAR, int[] orientationAR, EntityPlayer player, int base) { + float AR = ((int) (ArmourCalculator.getDRDisplay(player, 0) * 100F) + base); + + mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("attribute.armour.protection") + ": " + + ItemWeaponMF.decimal_format.format(AR), xPosAR, yPosAR, Color.WHITE.getRGB()); + } + + private void renderStaminaBar(EntityPlayer player) { + GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - + float staminaMax = StaminaBar.getTotalMaxStamina(player); float staminaAt = StaminaBar.getStaminaValue(player); - - float staminaPercentage = staminaMax > 0 ? Math.min(1.0F, staminaAt / staminaMax) : 0F; - - float flash = StaminaBar.getFlashTime(player); - int stam = (int)Math.min(81F, (81F * staminaPercentage)); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); - int width = scaledresolution.getScaledWidth(); + + float staminaPercentage = staminaMax > 0 ? Math.min(1.0F, staminaAt / staminaMax) : 0F; + + float flash = StaminaBar.getFlashTime(player); + int stam = (int) Math.min(81F, (81F * staminaPercentage)); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); + int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); bindTexture("textures/gui/hud_overlay.png"); - + int[] orientation = getOrientsFor(width, height, ConfigClient.stam_xOrient, ConfigClient.stam_yOrient); int xPos = orientation[0] + ConfigClient.stam_xPos; int yPos = orientation[1] + ConfigClient.stam_yPos; this.drawTexturedModalRect(xPos, yPos, 0, 0, 81, 5); - + int modifier = modifyMetre(stam, 81, ConfigClient.stam_direction); this.drawTexturedModalRect(xPos + modifier, yPos, 0, 5, stam, 5); - - if(flash > 0 && player.ticksExisted % 10 < 5) - { - this.drawTexturedModalRect(xPos, yPos, 0, 10, 81, 5); + + if (flash > 0 && player.ticksExisted % 10 < 5) { + this.drawTexturedModalRect(xPos, yPos, 0, 10, 81, 5); } /* - else if(StaminaBar.getBonusStaminaRegenTicks(player) > 0 && player.ticksExisted % 10 < 5) - { - this.drawTexturedModalRect(xPos, yPos, 0, 15, 81, 5); - } - */ - - String stamTxt = (int)staminaAt + " / " + (int)staminaMax; + * else if(StaminaBar.getBonusStaminaRegenTicks(player) > 0 && + * player.ticksExisted % 10 < 5) { this.drawTexturedModalRect(xPos, yPos, 0, 15, + * 81, 5); } + */ + + String stamTxt = (int) staminaAt + " / " + (int) staminaMax; boolean bonus = StaminaBar.getBonusStamina(player) > 0; - - if(mc.currentScreen != null && mc.currentScreen instanceof GuiInventory) - { - mc.fontRenderer.drawStringWithShadow(stamTxt, xPos + 41 - (mc.fontRenderer.getStringWidth(stamTxt)/2), yPos-2, bonus ? Color.CYAN.getRGB() : Color.WHITE.getRGB()); + + if (mc.currentScreen != null && mc.currentScreen instanceof GuiInventory) { + mc.fontRenderer.drawStringWithShadow(stamTxt, xPos + 41 - (mc.fontRenderer.getStringWidth(stamTxt) / 2), + yPos - 2, bonus ? Color.CYAN.getRGB() : Color.WHITE.getRGB()); } GL11.glDisable(GL11.GL_BLEND); - } - - private int modifyMetre(int i, int max, int cfg) - { - if(cfg == 0) - { - if(max == i) - { - return (max-i)/2; - } - else - { - return (max-i-1)/2; - } - } - if(cfg == 1) - { - if(max == i) - { - return max-i; - } - else - { - return max-i-1; - } - } - return 0; - } - - public void bindTexture(String image) - { - mc.renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - - /** - * Gets the 2 config values to get the X,Y orient - */ - public static int[] getOrientsFor(int screenX, int screenY, int cfgX, int cfgY) - { - int xOrient = cfgX == -1 ? 0 : cfgX == 1 ? screenX : screenX/2; - int yOrient = cfgY == -1 ? 0 : cfgY == 1 ? screenY : screenY/2; - - return new int[]{xOrient, yOrient}; - } - - private void renderCraftMetre(World world, EntityPlayer player, TileEntityAnvilMF tile) - { - boolean knowsCraft = tile.doesPlayerKnowCraft(player); - GL11.glPushMatrix(); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + } + + private int modifyMetre(int i, int max, int cfg) { + if (cfg == 0) { + if (max == i) { + return (max - i) / 2; + } else { + return (max - i - 1) / 2; + } + } + if (cfg == 1) { + if (max == i) { + return max - i; + } else { + return max - i - 1; + } + } + return 0; + } + + public void bindTexture(String image) { + mc.renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + private void renderCraftMetre(World world, EntityPlayer player, TileEntityAnvilMF tile) { + boolean knowsCraft = tile.doesPlayerKnowCraft(player); + GL11.glPushMatrix(); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - + bindTexture("textures/gui/hud_overlay.png"); - int xPos = width/2 + -86; + int xPos = width / 2 + -86; int yPos = height - 69; - + this.drawTexturedModalRect(xPos, yPos, 84, 0, 172, 20); - this.drawTexturedModalRect(xPos+6, yPos+12, 90, 20, tile.getProgressBar(160), 3); - + this.drawTexturedModalRect(xPos + 6, yPos + 12, 90, 20, tile.getProgressBar(160), 3); + String s = knowsCraft ? tile.getResultName() : "????"; - mc.fontRenderer.drawString(s, xPos + 86 - (mc.fontRenderer.getStringWidth(s) / 2), yPos+3, 0); + mc.fontRenderer.drawString(s, xPos + 86 - (mc.fontRenderer.getStringWidth(s) / 2), yPos + 3, 0); GL11.glColor3f(1.0F, 1.0F, 1.0F); - - if(knowsCraft && !tile.resName.equalsIgnoreCase("") && tile.getToolNeeded() != null) - { - boolean available = ToolHelper.isToolSufficient(player.getHeldItem(), tile.getToolNeeded(), tile.getToolTierNeeded()); - GuiHelper.renderToolIcon(this, tile.getToolNeeded(), tile.getToolTierNeeded(), xPos-20, yPos, available); - if(tile.getAnvilTierNeeded() > -1) - { - GuiHelper.renderToolIcon(this, "anvil", tile.getAnvilTierNeeded(), xPos+172, yPos, tile.tier >= tile.getAnvilTierNeeded()); - } + + if (knowsCraft && !tile.resName.equalsIgnoreCase("") && tile.getToolNeeded() != null) { + boolean available = ToolHelper.isToolSufficient(player.getHeldItem(), tile.getToolNeeded(), + tile.getToolTierNeeded()); + GuiHelper.renderToolIcon(this, tile.getToolNeeded(), tile.getToolTierNeeded(), xPos - 20, yPos, available); + if (tile.getAnvilTierNeeded() > -1) { + GuiHelper.renderToolIcon(this, "anvil", tile.getAnvilTierNeeded(), xPos + 172, yPos, + tile.tier >= tile.getAnvilTierNeeded()); + } } - + GL11.glPopMatrix(); - } - - - private void renderCraftMetre(World world, EntityPlayer player, TileEntityCarpenterMF tile) - { - boolean knowsCraft = tile.doesPlayerKnowCraft(player); - GL11.glPushMatrix(); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + } + + private void renderCraftMetre(World world, EntityPlayer player, TileEntityCarpenterMF tile) { + boolean knowsCraft = tile.doesPlayerKnowCraft(player); + GL11.glPushMatrix(); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - + bindTexture("textures/gui/hud_overlay.png"); - int xPos = width/2 + -86; + int xPos = width / 2 + -86; int yPos = height - 69; - + this.drawTexturedModalRect(xPos, yPos, 84, 0, 172, 20); - this.drawTexturedModalRect(xPos+6, yPos+12, 90, 20, tile.getProgressBar(160), 3); - + this.drawTexturedModalRect(xPos + 6, yPos + 12, 90, 20, tile.getProgressBar(160), 3); + String s = knowsCraft ? tile.getResultName() : "????"; - mc.fontRenderer.drawString(s, xPos + 86 - (mc.fontRenderer.getStringWidth(s) / 2), yPos+3, 0); + mc.fontRenderer.drawString(s, xPos + 86 - (mc.fontRenderer.getStringWidth(s) / 2), yPos + 3, 0); GL11.glColor3f(1.0F, 1.0F, 1.0F); - - if(knowsCraft && !tile.resName.equalsIgnoreCase("") && tile.getToolNeeded() != null) - { - boolean available = ToolHelper.isToolSufficient(player.getHeldItem(), tile.getToolNeeded(), tile.getToolTierNeeded()); - GuiHelper.renderToolIcon(this, tile.getToolNeeded(), tile.getToolTierNeeded(), xPos-20, yPos, available); + + if (knowsCraft && !tile.resName.equalsIgnoreCase("") && tile.getToolNeeded() != null) { + boolean available = ToolHelper.isToolSufficient(player.getHeldItem(), tile.getToolNeeded(), + tile.getToolTierNeeded()); + GuiHelper.renderToolIcon(this, tile.getToolNeeded(), tile.getToolTierNeeded(), xPos - 20, yPos, available); } - + GL11.glPopMatrix(); - } - - private void renderCraftMetre(World world, EntityPlayer player, TileEntityTanningRack tile) - { - boolean knowsCraft = tile.doesPlayerKnowCraft(player); - GL11.glPushMatrix(); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + } + + private void renderCraftMetre(World world, EntityPlayer player, TileEntityTanningRack tile) { + boolean knowsCraft = tile.doesPlayerKnowCraft(player); + GL11.glPushMatrix(); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - + bindTexture("textures/gui/hud_overlay.png"); - int xPos = width/2 + -86; + int xPos = width / 2 + -86; int yPos = height - 69; - + this.drawTexturedModalRect(xPos, yPos, 84, 0, 172, 20); - this.drawTexturedModalRect(xPos+6, yPos+12, 90, 20, tile.getProgressBar(160), 3); - + this.drawTexturedModalRect(xPos + 6, yPos + 12, 90, 20, tile.getProgressBar(160), 3); + String s = knowsCraft ? tile.getResultName() : "????"; ItemStack result = tile.items[1]; - if(result != null && result.stackSize > 1) - { - s += " x"+result.stackSize; + if (result != null && result.stackSize > 1) { + s += " x" + result.stackSize; } - mc.fontRenderer.drawString(s, xPos + 86 - (mc.fontRenderer.getStringWidth(s) / 2), yPos+3, 0); + mc.fontRenderer.drawString(s, xPos + 86 - (mc.fontRenderer.getStringWidth(s) / 2), yPos + 3, 0); GL11.glColor3f(1.0F, 1.0F, 1.0F); - + String resName = tile.getResultName(); - - if(knowsCraft && !resName.equalsIgnoreCase("") && tile.toolType != null) - { - boolean available = ToolHelper.isToolSufficient(player.getHeldItem(), tile.toolType, -1); - GuiHelper.renderToolIcon(this, tile.toolType, tile.tier, xPos-20, yPos, available); + + if (knowsCraft && !resName.equalsIgnoreCase("") && tile.toolType != null) { + boolean available = ToolHelper.isToolSufficient(player.getHeldItem(), tile.toolType, -1); + GuiHelper.renderToolIcon(this, tile.toolType, tile.tier, xPos - 20, yPos, available); } - + GL11.glPopMatrix(); - } - - private void renderCraftMetre(World world, EntityPlayer player, IBasicMetre tile) - { - if(!tile.shouldShowMetre()) - { - return; - } - GL11.glPushMatrix(); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + } + + private void renderCraftMetre(World world, EntityPlayer player, IBasicMetre tile) { + if (!tile.shouldShowMetre()) { + return; + } + GL11.glPushMatrix(); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - + bindTexture("textures/gui/hud_overlay.png"); - int xPos = width/2 + -86; + int xPos = width / 2 + -86; int yPos = height - 69; - + this.drawTexturedModalRect(xPos, yPos, 84, 0, 172, 20); - this.drawTexturedModalRect(xPos+6, yPos+12, 90, 20, tile.getMetreScale(160), 3); - + this.drawTexturedModalRect(xPos + 6, yPos + 12, 90, 20, tile.getMetreScale(160), 3); + String s = tile.getLocalisedName(); - mc.fontRenderer.drawString(s, xPos + 86 - (mc.fontRenderer.getStringWidth(s) / 2), yPos+3, 0); + mc.fontRenderer.drawString(s, xPos + 86 - (mc.fontRenderer.getStringWidth(s) / 2), yPos + 3, 0); GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); - } - private void renderQualityBalance(World world, EntityPlayer player, IQualityBalance tile) - { - if(!tile.shouldShowMetre()) - { - return; - } - GL11.glPushMatrix(); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + } + + private void renderQualityBalance(World world, EntityPlayer player, IQualityBalance tile) { + if (!tile.shouldShowMetre()) { + return; + } + GL11.glPushMatrix(); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, + MineFantasyHUD.mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); - + bindTexture("textures/gui/hud_overlay.png"); - int xPos = width/2 + -86; - int yPos = height - 69+17; + int xPos = width / 2 + -86; + int yPos = height - 69 + 17; int barwidth = 160; - int centre = xPos+5+(barwidth/2); - + int centre = xPos + 5 + (barwidth / 2); + this.drawTexturedModalRect(xPos, yPos, 84, 23, 172, 10); - int markerPos = (int) (centre + (tile.getMarkerPosition()*barwidth/2F)); - this.drawTexturedModalRect(markerPos, yPos+1, 84, 33, 3, 5); - - int offset = (int)(tile.getThresholdPosition()/2F*barwidth); - this.drawTexturedModalRect(centre-offset-1, yPos+1, 87, 33, 2, 4); - this.drawTexturedModalRect(centre+offset, yPos+1, 89, 33, 2, 4); - - int offset2 = (int)(tile.getSuperThresholdPosition()/2F*barwidth); - this.drawTexturedModalRect(centre-offset2, yPos+1, 91, 33, 1, 4); - this.drawTexturedModalRect(centre+offset2, yPos+1, 91, 33, 1, 4); - + int markerPos = (int) (centre + (tile.getMarkerPosition() * barwidth / 2F)); + this.drawTexturedModalRect(markerPos, yPos + 1, 84, 33, 3, 5); + + int offset = (int) (tile.getThresholdPosition() / 2F * barwidth); + this.drawTexturedModalRect(centre - offset - 1, yPos + 1, 87, 33, 2, 4); + this.drawTexturedModalRect(centre + offset, yPos + 1, 89, 33, 2, 4); + + int offset2 = (int) (tile.getSuperThresholdPosition() / 2F * barwidth); + this.drawTexturedModalRect(centre - offset2, yPos + 1, 91, 33, 1, 4); + this.drawTexturedModalRect(centre + offset2, yPos + 1, 91, 33, 1, 4); + GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); - } - - private void renderRoad(World world, EntityPlayer player, TileEntityRoad tile) - { - if(mc.thePlayer.getHeldItem() != null) - { - if(mc.thePlayer.getHeldItem().getItem() instanceof ItemMattock) - { - GL11.glPushMatrix(); - ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); - int width = scaledresolution.getScaledWidth(); - int height = scaledresolution.getScaledHeight(); - - bindTexture("textures/gui/hud_overlay.png"); - int xPos = width/2 + 12; - int yPos = height/2 - 6;; - - this.drawTexturedModalRect(xPos, yPos, tile.isLocked ? 0 : 8, 20, 8, 12); - GL11.glPopMatrix(); - } - } - } + } + + private void renderRoad(World world, EntityPlayer player, TileEntityRoad tile) { + if (mc.thePlayer.getHeldItem() != null) { + if (mc.thePlayer.getHeldItem().getItem() instanceof ItemMattock) { + GL11.glPushMatrix(); + ScaledResolution scaledresolution = new ScaledResolution(MineFantasyHUD.mc, + MineFantasyHUD.mc.displayWidth, MineFantasyHUD.mc.displayHeight); + int width = scaledresolution.getScaledWidth(); + int height = scaledresolution.getScaledHeight(); + + bindTexture("textures/gui/hud_overlay.png"); + int xPos = width / 2 + 12; + int yPos = height / 2 - 6; + ; + + this.drawTexturedModalRect(xPos, yPos, tile.isLocked ? 0 : 8, 20, 8, 12); + GL11.glPopMatrix(); + } + } + } } diff --git a/src/main/java/minefantasy/mf2/client/render/ModelCogwork.java b/src/main/java/minefantasy/mf2/client/render/ModelCogwork.java index a1d9c005..12eaffab 100644 --- a/src/main/java/minefantasy/mf2/client/render/ModelCogwork.java +++ b/src/main/java/minefantasy/mf2/client/render/ModelCogwork.java @@ -1,7 +1,5 @@ package minefantasy.mf2.client.render; -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; @@ -10,214 +8,207 @@ import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; -public class ModelCogwork extends ModelBiped -{ - ModelRenderer rightfoot; +public class ModelCogwork extends ModelBiped { + ModelRenderer rightfoot; ModelRenderer leftfoot; - - ModelRenderer headMask; - ModelRenderer bodyBack; - ModelRenderer rightarmPauldron; - ModelRenderer rightlegArmour; - ModelRenderer leftlegArmour; - ModelRenderer leftarmPauldron; - ModelRenderer rightarmArmour; - ModelRenderer leftarmArmour; - ModelRenderer headArmour; - ModelRenderer bodyArmour; - - //RenderCogwork - public ModelCogwork() { - this(1F); - } - - public ModelCogwork(float scale) { - this(scale, -2F * scale, 128, 64); - } - - public ModelCogwork(float scale, float offset, int texWidth, int texHeight) - { - this.textureWidth = texWidth; - this.textureHeight = texHeight; -//FRAME - this.bipedHead = new ModelRenderer(this, 0, 0); - this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, scale); - this.bipedHead.setRotationPoint(0.0F, 0F + offset, 0.0F); - - this.bipedHeadwear = new ModelRenderer(this, 32, 0); - this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, scale + 0.5F); - this.bipedHeadwear.setRotationPoint(0.0F, 0F + offset, 0.0F); - - this.bipedBody = new ModelRenderer(this, 16, 16); - this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, scale); - this.bipedBody.setRotationPoint(0.0F, 0.0F + offset, 0.0F); - - this.bipedRightArm = new ModelRenderer(this, 40, 16); - this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, scale); - this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + offset, 0.0F); - - this.bipedLeftArm = new ModelRenderer(this, 40, 16); - this.bipedLeftArm.mirror = true; - this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, scale); - this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + offset, 0.0F); - - this.bipedRightLeg = new ModelRenderer(this, 0, 16); - this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 8, 4, scale); - this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + offset, 0.0F); - - this.bipedLeftLeg = new ModelRenderer(this, 0, 16); - this.bipedLeftLeg.mirror = true; - this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 8, 4, scale); - this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + offset, 0.0F); - - rightfoot = new ModelRenderer(this, 0, 53); - rightfoot.addBox(-2F, 0F, -3F, 4, 3, 5, scale); - rightfoot.setRotationPoint(0F, 10F, 0F); - rightfoot.setTextureSize(128, 64); - setRotation(rightfoot, 0F, 0F, 0F); - - leftfoot = new ModelRenderer(this, 0, 53); - leftfoot.mirror = true; - leftfoot.addBox(-2F, 0F, -3F, 4, 3, 5, scale); - leftfoot.setRotationPoint(0F, 10F, 0F); - leftfoot.setTextureSize(128, 64); - -//HEAD ARMOUR - headMask = new ModelRenderer(this, 76, 18); - headMask.addBox(-2F, -3.5F, -6.5F, 4, 5, 3, scale); - headMask.setRotationPoint(0F, 0F, 0F); - headMask.setTextureSize(128, 64); - - headArmour = new ModelRenderer(this, 78, 0); - headArmour.addBox(-4.5F, -8.5F, -4.5F, 9, 9, 9, scale); - headArmour.setRotationPoint(0F, 0F, 0F); - headArmour.setTextureSize(128, 64); - setRotation(headArmour, 0F, 0F, 0F); - -//BODY ARMOUR - bodyBack = new ModelRenderer(this, 34, 32); - bodyBack.addBox(-3.5F, -0.5F, 4F, 7, 9, 3, scale); - bodyBack.setRotationPoint(0F, 0F, 0F); - bodyBack.setTextureSize(128, 64); - setRotation(bodyBack, 0F, 0F, 0F); - - bodyArmour = new ModelRenderer(this, 0, 32); - bodyArmour.addBox(-4.5F, -0.5F, -4F, 9, 13, 8, scale); - bodyArmour.setRotationPoint(0F, 0F, 0F); - bodyArmour.setTextureSize(128, 64); - setRotation(bodyArmour, 0F, 0F, 0F); - -//ARMS ARMOUR - leftarmPauldron = new ModelRenderer(this, 76, 27); - leftarmPauldron.mirror = true; - leftarmPauldron.addBox(0F, -4F, -3F, 5, 5, 6, scale); - leftarmPauldron.setRotationPoint(0F, 0F, 0F); - leftarmPauldron.setTextureSize(128, 64); - setRotation(leftarmPauldron, 0F, 0F, 0.2792527F); - - rightarmPauldron = new ModelRenderer(this, 76, 27); - rightarmPauldron.addBox(-5F, -4F, -3F, 5, 5, 6, scale); - rightarmPauldron.setRotationPoint(0F, 0F, 0F); - rightarmPauldron.setTextureSize(128, 64); - setRotation(rightarmPauldron, 0F, 0F, -0.2792527F); - - leftarmArmour = new ModelRenderer(this, 76, 38); - leftarmArmour.mirror = true; - leftarmArmour.addBox(-1.0F, -2.5F, -2.5F, 5, 9, 5, scale); - leftarmArmour.setRotationPoint(0F, 0F, 0F); - leftarmArmour.setTextureSize(128, 64); - setRotation(leftarmArmour, 0F, -0F, 0F); - - rightarmArmour = new ModelRenderer(this, 76, 38); - rightarmArmour.addBox(-4F, -2.5F, -2.5F, 5, 9, 5, scale); - rightarmArmour.setRotationPoint(0F, 0F, 0F); - rightarmArmour.setTextureSize(128, 64); - setRotation(rightarmArmour, 0F, 0F, 0F); - -//LEGS ARMOUR - rightlegArmour = new ModelRenderer(this, 56, 16); - rightlegArmour.addBox(-2.5F, -0.5F, -2.5F, 5, 9, 5, scale); - rightlegArmour.setRotationPoint(0F, 0F, 0F); - rightlegArmour.setTextureSize(128, 64); - setRotation(rightlegArmour, 0F, 0F, 0F); - - leftlegArmour = new ModelRenderer(this, 56, 16); - leftlegArmour.mirror = true; - leftlegArmour.addBox(-2.5F, -0.5F, -2.5F, 5, 9, 5, scale); - leftlegArmour.setRotationPoint(0F, 0F, 0F); - leftlegArmour.setTextureSize(128, 64); - setRotation(leftlegArmour, 0F, -0F, 0F); - -//GROUPING - this.bipedBody.addChild(bodyArmour); - this.bipedBody.addChild(bodyBack); - - this.bipedLeftArm.addChild(leftarmPauldron); - this.bipedLeftArm.addChild(leftarmArmour); - - this.bipedRightArm.addChild(rightarmPauldron); - this.bipedRightArm.addChild(rightarmArmour); - - this.bipedLeftLeg.addChild(leftlegArmour); - this.bipedRightLeg.addChild(rightlegArmour); - this.bipedLeftLeg.addChild(leftfoot); - this.bipedRightLeg.addChild(rightfoot); - - this.bipedHead.addChild(headArmour); - this.bipedHeadwear.addChild(headMask); - } - - 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 entity, float f1, float f2, float f3, float f4, float f5, float scale) - { - heldItemRight = 0; - aimedBow = false; - boolean isEmpty = true; - boolean isWornByPlayer = false; - if (entity instanceof EntityPlayer) - { - isEmpty = false; - boolean CP = Minecraft.getMinecraft().thePlayer == entity; - isWornByPlayer = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && CP; - - EntityPlayer player = (EntityPlayer) entity; - - ItemStack itemstack = player.getHeldItem(); - heldItemRight = itemstack == null ? 0 : 1; - if (itemstack != null && player.getItemInUseCount() > 0) - { - EnumAction enumaction = itemstack.getItemUseAction(); - - if (enumaction == EnumAction.block) - { - heldItemRight = 3; - } - else if (enumaction == EnumAction.bow) - { - aimedBow = true; - } - } - } - this.setRotationAngles(f1, f2, isEmpty ? 0F : f3, f4, f5, scale, entity); - bipedHead.rotationPointY = bipedHeadwear.rotationPointY = -2F; - this.bipedBody.rotationPointZ = this.bipedLeftLeg.rotationPointZ = this.bipedRightLeg.rotationPointZ = isWornByPlayer ? 6F : 0F; - this.bipedLeftArm.isHidden = this.bipedRightArm.isHidden = this.leftarmArmour.isHidden = this.rightarmArmour.isHidden = isWornByPlayer; - - if(!isWornByPlayer) - { - this.bipedHead.render(scale); - this.bipedHeadwear.render(scale); - } - this.bipedRightArm.render(scale); - this.bipedLeftArm.render(scale); - this.bipedBody.render(scale); - this.bipedRightLeg.render(scale); - this.bipedLeftLeg.render(scale); - } + + ModelRenderer headMask; + ModelRenderer bodyBack; + ModelRenderer rightarmPauldron; + ModelRenderer rightlegArmour; + ModelRenderer leftlegArmour; + ModelRenderer leftarmPauldron; + ModelRenderer rightarmArmour; + ModelRenderer leftarmArmour; + ModelRenderer headArmour; + ModelRenderer bodyArmour; + + // RenderCogwork + public ModelCogwork() { + this(1F); + } + + public ModelCogwork(float scale) { + this(scale, -2F * scale, 128, 64); + } + + public ModelCogwork(float scale, float offset, int texWidth, int texHeight) { + this.textureWidth = texWidth; + this.textureHeight = texHeight; + // FRAME + this.bipedHead = new ModelRenderer(this, 0, 0); + this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, scale); + this.bipedHead.setRotationPoint(0.0F, 0F + offset, 0.0F); + + this.bipedHeadwear = new ModelRenderer(this, 32, 0); + this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, scale + 0.5F); + this.bipedHeadwear.setRotationPoint(0.0F, 0F + offset, 0.0F); + + this.bipedBody = new ModelRenderer(this, 16, 16); + this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, scale); + this.bipedBody.setRotationPoint(0.0F, 0.0F + offset, 0.0F); + + this.bipedRightArm = new ModelRenderer(this, 40, 16); + this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, scale); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + offset, 0.0F); + + this.bipedLeftArm = new ModelRenderer(this, 40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, scale); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + offset, 0.0F); + + this.bipedRightLeg = new ModelRenderer(this, 0, 16); + this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 8, 4, scale); + this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + offset, 0.0F); + + this.bipedLeftLeg = new ModelRenderer(this, 0, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 8, 4, scale); + this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + offset, 0.0F); + + rightfoot = new ModelRenderer(this, 0, 53); + rightfoot.addBox(-2F, 0F, -3F, 4, 3, 5, scale); + rightfoot.setRotationPoint(0F, 10F, 0F); + rightfoot.setTextureSize(128, 64); + setRotation(rightfoot, 0F, 0F, 0F); + + leftfoot = new ModelRenderer(this, 0, 53); + leftfoot.mirror = true; + leftfoot.addBox(-2F, 0F, -3F, 4, 3, 5, scale); + leftfoot.setRotationPoint(0F, 10F, 0F); + leftfoot.setTextureSize(128, 64); + + // HEAD ARMOUR + headMask = new ModelRenderer(this, 76, 18); + headMask.addBox(-2F, -3.5F, -6.5F, 4, 5, 3, scale); + headMask.setRotationPoint(0F, 0F, 0F); + headMask.setTextureSize(128, 64); + + headArmour = new ModelRenderer(this, 78, 0); + headArmour.addBox(-4.5F, -8.5F, -4.5F, 9, 9, 9, scale); + headArmour.setRotationPoint(0F, 0F, 0F); + headArmour.setTextureSize(128, 64); + setRotation(headArmour, 0F, 0F, 0F); + + // BODY ARMOUR + bodyBack = new ModelRenderer(this, 34, 32); + bodyBack.addBox(-3.5F, -0.5F, 4F, 7, 9, 3, scale); + bodyBack.setRotationPoint(0F, 0F, 0F); + bodyBack.setTextureSize(128, 64); + setRotation(bodyBack, 0F, 0F, 0F); + + bodyArmour = new ModelRenderer(this, 0, 32); + bodyArmour.addBox(-4.5F, -0.5F, -4F, 9, 13, 8, scale); + bodyArmour.setRotationPoint(0F, 0F, 0F); + bodyArmour.setTextureSize(128, 64); + setRotation(bodyArmour, 0F, 0F, 0F); + + // ARMS ARMOUR + leftarmPauldron = new ModelRenderer(this, 76, 27); + leftarmPauldron.mirror = true; + leftarmPauldron.addBox(0F, -4F, -3F, 5, 5, 6, scale); + leftarmPauldron.setRotationPoint(0F, 0F, 0F); + leftarmPauldron.setTextureSize(128, 64); + setRotation(leftarmPauldron, 0F, 0F, 0.2792527F); + + rightarmPauldron = new ModelRenderer(this, 76, 27); + rightarmPauldron.addBox(-5F, -4F, -3F, 5, 5, 6, scale); + rightarmPauldron.setRotationPoint(0F, 0F, 0F); + rightarmPauldron.setTextureSize(128, 64); + setRotation(rightarmPauldron, 0F, 0F, -0.2792527F); + + leftarmArmour = new ModelRenderer(this, 76, 38); + leftarmArmour.mirror = true; + leftarmArmour.addBox(-1.0F, -2.5F, -2.5F, 5, 9, 5, scale); + leftarmArmour.setRotationPoint(0F, 0F, 0F); + leftarmArmour.setTextureSize(128, 64); + setRotation(leftarmArmour, 0F, -0F, 0F); + + rightarmArmour = new ModelRenderer(this, 76, 38); + rightarmArmour.addBox(-4F, -2.5F, -2.5F, 5, 9, 5, scale); + rightarmArmour.setRotationPoint(0F, 0F, 0F); + rightarmArmour.setTextureSize(128, 64); + setRotation(rightarmArmour, 0F, 0F, 0F); + + // LEGS ARMOUR + rightlegArmour = new ModelRenderer(this, 56, 16); + rightlegArmour.addBox(-2.5F, -0.5F, -2.5F, 5, 9, 5, scale); + rightlegArmour.setRotationPoint(0F, 0F, 0F); + rightlegArmour.setTextureSize(128, 64); + setRotation(rightlegArmour, 0F, 0F, 0F); + + leftlegArmour = new ModelRenderer(this, 56, 16); + leftlegArmour.mirror = true; + leftlegArmour.addBox(-2.5F, -0.5F, -2.5F, 5, 9, 5, scale); + leftlegArmour.setRotationPoint(0F, 0F, 0F); + leftlegArmour.setTextureSize(128, 64); + setRotation(leftlegArmour, 0F, -0F, 0F); + + // GROUPING + this.bipedBody.addChild(bodyArmour); + this.bipedBody.addChild(bodyBack); + + this.bipedLeftArm.addChild(leftarmPauldron); + this.bipedLeftArm.addChild(leftarmArmour); + + this.bipedRightArm.addChild(rightarmPauldron); + this.bipedRightArm.addChild(rightarmArmour); + + this.bipedLeftLeg.addChild(leftlegArmour); + this.bipedRightLeg.addChild(rightlegArmour); + this.bipedLeftLeg.addChild(leftfoot); + this.bipedRightLeg.addChild(rightfoot); + + this.bipedHead.addChild(headArmour); + this.bipedHeadwear.addChild(headMask); + } + + 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 entity, float f1, float f2, float f3, float f4, float f5, float scale) { + heldItemRight = 0; + aimedBow = false; + boolean isEmpty = true; + boolean isWornByPlayer = false; + if (entity instanceof EntityPlayer) { + isEmpty = false; + boolean CP = Minecraft.getMinecraft().thePlayer == entity; + isWornByPlayer = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && CP; + + EntityPlayer player = (EntityPlayer) entity; + + ItemStack itemstack = player.getHeldItem(); + heldItemRight = itemstack == null ? 0 : 1; + if (itemstack != null && player.getItemInUseCount() > 0) { + EnumAction enumaction = itemstack.getItemUseAction(); + + if (enumaction == EnumAction.block) { + heldItemRight = 3; + } else if (enumaction == EnumAction.bow) { + aimedBow = true; + } + } + } + this.setRotationAngles(f1, f2, isEmpty ? 0F : f3, f4, f5, scale, entity); + bipedHead.rotationPointY = bipedHeadwear.rotationPointY = -2F; + this.bipedBody.rotationPointZ = this.bipedLeftLeg.rotationPointZ = this.bipedRightLeg.rotationPointZ = isWornByPlayer + ? 6F + : 0F; + this.bipedLeftArm.isHidden = this.bipedRightArm.isHidden = this.leftarmArmour.isHidden = this.rightarmArmour.isHidden = isWornByPlayer; + + if (!isWornByPlayer) { + this.bipedHead.render(scale); + this.bipedHeadwear.render(scale); + } + this.bipedRightArm.render(scale); + this.bipedLeftArm.render(scale); + this.bipedBody.render(scale); + this.bipedRightLeg.render(scale); + this.bipedLeftLeg.render(scale); + } } diff --git a/src/main/java/minefantasy/mf2/client/render/ModelParachute.java b/src/main/java/minefantasy/mf2/client/render/ModelParachute.java index 9ff48c61..b5a6adbd 100644 --- a/src/main/java/minefantasy/mf2/client/render/ModelParachute.java +++ b/src/main/java/minefantasy/mf2/client/render/ModelParachute.java @@ -4,10 +4,9 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelParachute extends ModelBase -{ - //fields - ModelRenderer chuteSegment5; +public class ModelParachute extends ModelBase { + // fields + ModelRenderer chuteSegment5; ModelRenderer harness; ModelRenderer chuteSegment1; ModelRenderer chuteSegment2; @@ -17,83 +16,80 @@ public class ModelParachute extends ModelBase ModelRenderer cable1; ModelRenderer cable2; ModelRenderer cable3; - - public ModelParachute() - { - textureWidth = 64; - textureHeight = 32; - - chuteSegment5 = new ModelRenderer(this, 28, 14); - chuteSegment5.addBox(-4.5F, -32F, -13.5F, 9, 9, 9); - chuteSegment5.setRotationPoint(0F, 0F, 0F); - chuteSegment5.setTextureSize(64, 32); - setRotation(chuteSegment5, 0F, 0F, 0F); - harness = new ModelRenderer(this, 28, -9); - harness.addBox(-4.5F, -4.5F, -4.5F, 9, 9, 9); - harness.setRotationPoint(0F, 0F, 0F); - harness.setTextureSize(64, 32); - setRotation(harness, 0F, 0F, 0F); - chuteSegment1 = new ModelRenderer(this, 28, 14); - chuteSegment1.addBox(-4.5F, -41F, -4.5F, 9, 9, 9); - chuteSegment1.setRotationPoint(0F, 0F, 0F); - chuteSegment1.setTextureSize(64, 32); - setRotation(chuteSegment1, 0F, 0F, 0F); - chuteSegment2 = new ModelRenderer(this, 28, 14); - chuteSegment2.addBox(-13.5F, -32F, -4.5F, 9, 9, 9); - chuteSegment2.setRotationPoint(0F, 0F, 0F); - chuteSegment2.setTextureSize(64, 32); - setRotation(chuteSegment2, 0F, 0F, 0F); - chuteSegment3 = new ModelRenderer(this, 28, 14); - chuteSegment3.addBox(4.5F, -32F, -4.5F, 9, 9, 9); - chuteSegment3.setRotationPoint(0F, 0F, 0F); - chuteSegment3.setTextureSize(64, 32); - setRotation(chuteSegment3, 0F, 0F, 0F); - chuteSegment4 = new ModelRenderer(this, 28, 14); - chuteSegment4.addBox(-4.5F, -32F, 4.5F, 9, 9, 9); - chuteSegment4.setRotationPoint(0F, 0F, 0F); - chuteSegment4.setTextureSize(64, 32); - setRotation(chuteSegment4, 0F, 0F, 0F); - cable4 = new ModelRenderer(this, 0, 0); - cable4.addBox(-0.5F, -23F, -0.5F, 1, 24, 1); - cable4.setRotationPoint(0F, -4F, 0F); - cable4.setTextureSize(64, 32); - setRotation(cable4, 0F, 0F, -0.5235988F); - cable1 = new ModelRenderer(this, 0, 0); - cable1.addBox(-0.5F, -23F, -0.5F, 1, 24, 1); - cable1.setRotationPoint(0F, -4F, 0F); - cable1.setTextureSize(64, 32); - setRotation(cable1, 0.5235988F, 0F, 0F); - cable2 = new ModelRenderer(this, 0, 0); - cable2.addBox(-0.5F, -23F, -0.5F, 1, 24, 1); - cable2.setRotationPoint(0F, -4F, 0F); - cable2.setTextureSize(64, 32); - setRotation(cable2, -0.5235988F, 0F, 0F); - cable3 = new ModelRenderer(this, 0, 0); - cable3.addBox(-0.5F, -23F, -0.5F, 1, 24, 1); - cable3.setRotationPoint(0F, -4F, 0F); - cable3.setTextureSize(64, 32); - setRotation(cable3, 0F, 0F, 0.5235988F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - chuteSegment5.render(f5); - harness.render(f5); - chuteSegment1.render(f5); - chuteSegment2.render(f5); - chuteSegment3.render(f5); - chuteSegment4.render(f5); - cable4.render(f5); - cable1.render(f5); - cable2.render(f5); - cable3.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + + public ModelParachute() { + textureWidth = 64; + textureHeight = 32; + + chuteSegment5 = new ModelRenderer(this, 28, 14); + chuteSegment5.addBox(-4.5F, -32F, -13.5F, 9, 9, 9); + chuteSegment5.setRotationPoint(0F, 0F, 0F); + chuteSegment5.setTextureSize(64, 32); + setRotation(chuteSegment5, 0F, 0F, 0F); + harness = new ModelRenderer(this, 28, -9); + harness.addBox(-4.5F, -4.5F, -4.5F, 9, 9, 9); + harness.setRotationPoint(0F, 0F, 0F); + harness.setTextureSize(64, 32); + setRotation(harness, 0F, 0F, 0F); + chuteSegment1 = new ModelRenderer(this, 28, 14); + chuteSegment1.addBox(-4.5F, -41F, -4.5F, 9, 9, 9); + chuteSegment1.setRotationPoint(0F, 0F, 0F); + chuteSegment1.setTextureSize(64, 32); + setRotation(chuteSegment1, 0F, 0F, 0F); + chuteSegment2 = new ModelRenderer(this, 28, 14); + chuteSegment2.addBox(-13.5F, -32F, -4.5F, 9, 9, 9); + chuteSegment2.setRotationPoint(0F, 0F, 0F); + chuteSegment2.setTextureSize(64, 32); + setRotation(chuteSegment2, 0F, 0F, 0F); + chuteSegment3 = new ModelRenderer(this, 28, 14); + chuteSegment3.addBox(4.5F, -32F, -4.5F, 9, 9, 9); + chuteSegment3.setRotationPoint(0F, 0F, 0F); + chuteSegment3.setTextureSize(64, 32); + setRotation(chuteSegment3, 0F, 0F, 0F); + chuteSegment4 = new ModelRenderer(this, 28, 14); + chuteSegment4.addBox(-4.5F, -32F, 4.5F, 9, 9, 9); + chuteSegment4.setRotationPoint(0F, 0F, 0F); + chuteSegment4.setTextureSize(64, 32); + setRotation(chuteSegment4, 0F, 0F, 0F); + cable4 = new ModelRenderer(this, 0, 0); + cable4.addBox(-0.5F, -23F, -0.5F, 1, 24, 1); + cable4.setRotationPoint(0F, -4F, 0F); + cable4.setTextureSize(64, 32); + setRotation(cable4, 0F, 0F, -0.5235988F); + cable1 = new ModelRenderer(this, 0, 0); + cable1.addBox(-0.5F, -23F, -0.5F, 1, 24, 1); + cable1.setRotationPoint(0F, -4F, 0F); + cable1.setTextureSize(64, 32); + setRotation(cable1, 0.5235988F, 0F, 0F); + cable2 = new ModelRenderer(this, 0, 0); + cable2.addBox(-0.5F, -23F, -0.5F, 1, 24, 1); + cable2.setRotationPoint(0F, -4F, 0F); + cable2.setTextureSize(64, 32); + setRotation(cable2, -0.5235988F, 0F, 0F); + cable3 = new ModelRenderer(this, 0, 0); + cable3.addBox(-0.5F, -23F, -0.5F, 1, 24, 1); + cable3.setRotationPoint(0F, -4F, 0F); + cable3.setTextureSize(64, 32); + setRotation(cable3, 0F, 0F, 0.5235988F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + chuteSegment5.render(f5); + harness.render(f5); + chuteSegment1.render(f5); + chuteSegment2.render(f5); + chuteSegment3.render(f5); + chuteSegment4.render(f5); + cable4.render(f5); + cable1.render(f5); + cable2.render(f5); + cable3.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/RenderArrowMF.java b/src/main/java/minefantasy/mf2/client/render/RenderArrowMF.java index 40c8711a..30996773 100644 --- a/src/main/java/minefantasy/mf2/client/render/RenderArrowMF.java +++ b/src/main/java/minefantasy/mf2/client/render/RenderArrowMF.java @@ -1,29 +1,27 @@ package minefantasy.mf2.client.render; -import minefantasy.mf2.entity.EntityArrowMF; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; +import minefantasy.mf2.entity.EntityArrowMF; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class RenderArrowMF extends Render -{ - public void renderArrow(EntityArrowMF arrow, double x, double y, double z, float xr, float yr) - { - this.loadTexture(arrow.getTexture()+".png"); +public class RenderArrowMF extends Render { + public void renderArrow(EntityArrowMF arrow, double x, double y, double z, float xr, float yr) { + this.loadTexture(arrow.getTexture() + ".png"); GL11.glPushMatrix(); - GL11.glTranslatef((float)x, (float)y, (float)z); - GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * yr - 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * yr, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * yr - 90.0F, 0.0F, 1.0F, + 0.0F); + GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * yr, 0.0F, 0.0F, + 1.0F); Tessellator var10 = Tessellator.instance; byte var11 = 0; float var12 = 0.0F; @@ -37,13 +35,12 @@ public void renderArrow(EntityArrowMF arrow, double x, double y, double z, float float var20 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float var21 = arrow.arrowShake - yr; - - if (var21 > 0.0F) - { + + if (var21 > 0.0F) { float var22 = -MathHelper.sin(var21 * 3.0F) * var21; GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F); } - + GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(var20, var20, var20); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); @@ -61,9 +58,8 @@ public void renderArrow(EntityArrowMF arrow, double x, double y, double z, float var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, var17, var19); var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, var16, var19); var10.draw(); - - for (int var23 = 0; var23 < 4; ++var23) - { + + for (int var23 = 0; var23 < 4; ++var23) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, var20); var10.startDrawingQuads(); @@ -73,30 +69,30 @@ public void renderArrow(EntityArrowMF arrow, double x, double y, double z, float var10.addVertexWithUV(-8.0D, 2.0D, 0.0D, var12, var15); var10.draw(); } - + GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render= 18) - drawAmount = 2; - else if (timer > 13) - drawAmount = 1; - else if (timer > 0) - drawAmount = 0; + + if (entityLivingBase != null && entityLivingBase instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entityLivingBase; + + int timer = player.getItemInUseDuration(); + + if (bow != null) { + drawAmount = bow.getDrawAmount(timer); + // arrowStack = bow.getArrow(item); + } else { + if (timer >= 18) + drawAmount = 2; + else if (timer > 13) + drawAmount = 1; + else if (timer > 0) + drawAmount = 0; } - - ItemStack quiver = QuiverArrowRegistry.getArrowContainer(item, (EntityPlayer) entityLivingBase); - if(quiver != null){ - arrowStack = ((IArrowContainer2)quiver.getItem()).getStackInSlot(quiver, ((IArrowContainer2)quiver.getItem()).getSelectedSlot(quiver)); + + if(Loader.isModLoaded("battlegear2")) { + ItemStack quiver = mods.battlegear2.api.quiver.QuiverArrowRegistry.getArrowContainer(item, (EntityPlayer) entityLivingBase); + if (quiver != null) { + arrowStack = ((mods.battlegear2.api.quiver.IArrowContainer2) quiver.getItem()).getStackInSlot(quiver, + ((mods.battlegear2.api.quiver.IArrowContainer2) quiver.getItem()).getSelectedSlot(quiver)); + } } - - if(timer == 0) - { - arrowStack = null; + + if (timer == 0) { + arrowStack = null; } - } - else - { - drawAmount = 2; + } else { + drawAmount = 2; } Tessellator tessellator = Tessellator.instance; - + GL11.glPushMatrix(); - if(isLongbow) - { - GL11.glTranslatef(-1/3F, -1/3F, 0F); - GL11.glScalef(1.5F, 1.5F, 1.0F); - if(entityLivingBase == null) - { - GL11.glTranslatef((0F/16F), -(4F/16F), 0F); - } - } - for(int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer ++) - { - IIcon icon = item.getItem().getIcon(item, layer); - - if(bow != null) - { - icon = bow.getIcon(item, layer, drawAmount); - } - - GL11.glPushMatrix(); - int colour = item.getItem().getColorFromItemStack(item, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + if (isLongbow) { + GL11.glTranslatef(-1 / 3F, -1 / 3F, 0F); + GL11.glScalef(1.5F, 1.5F, 1.0F); + if (entityLivingBase == null) { + GL11.glTranslatef((0F / 16F), -(4F / 16F), 0F); + } + } + for (int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer++) { + IIcon icon = item.getItem().getIcon(item, layer); + + if (bow != null) { + icon = bow.getIcon(item, layer, drawAmount); + } + + GL11.glPushMatrix(); + int colour = item.getItem().getColorFromItemStack(item, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - GL11.glColor3f(1F, 1F, 1F); - GL11.glPopMatrix(); + + ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), + icon.getIconWidth(), icon.getIconHeight(), 0.0625F); + GL11.glColor3f(1F, 1F, 1F); + GL11.glPopMatrix(); } GL11.glPopMatrix(); - - if(arrowStack == null && drawAmount > -2) - { - arrowStack = new ItemStack(Items.arrow); + + if (arrowStack == null && drawAmount > -2) { + arrowStack = new ItemStack(Items.arrow); } - if(arrowStack != null && entityLivingBase != null) - { - int x = -3; - int y = -20; - - if(isLongbow) - { - x += 1; - y += 1; - } - for(int layer = 0; layer < arrowStack.getItem().getRenderPasses(arrowStack.getItemDamage()); layer++) - { - IIcon icon = arrowStack.getItem().getIcon(arrowStack, layer); - GL11.glPushMatrix(); - - int colour = arrowStack.getItem().getColorFromItemStack(arrowStack, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + if (arrowStack != null && entityLivingBase != null) { + int x = -3; + int y = -20; + + if (isLongbow) { + x += 1; + y += 1; + } + for (int layer = 0; layer < arrowStack.getItem().getRenderPasses(arrowStack.getItemDamage()); layer++) { + IIcon icon = arrowStack.getItem().getIcon(arrowStack, layer); + GL11.glPushMatrix(); + + int colour = arrowStack.getItem().getColorFromItemStack(arrowStack, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - GL11.glTranslatef(-(x+drawAmount)/16F, -(y+drawAmount)/16F, firstPerson?-0.5F/16F:0.5F/16F); - GL11.glRotatef(-90, 0, 0, 1); - ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - GL11.glColor3f(1F, 1F, 1F); - GL11.glPopMatrix(); - } + + GL11.glTranslatef(-(x + drawAmount) / 16F, -(y + drawAmount) / 16F, + firstPerson ? -0.5F / 16F : 0.5F / 16F); + GL11.glRotatef(-90, 0, 0, 1); + ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), + icon.getIconWidth(), icon.getIconHeight(), 0.0625F); + GL11.glColor3f(1F, 1F, 1F); + GL11.glPopMatrix(); + } } - - if(item.isItemEnchanted()) - { - renderEnchantmentEffects(tessellator); + + if (item.isItemEnchanted()) { + renderEnchantmentEffects(tessellator); } GL11.glPopMatrix(); } - - - public static void renderEnchantmentEffects(Tessellator tessellator) - { - GL11.glDepthFunc(GL11.GL_EQUAL); - GL11.glDisable(GL11.GL_LIGHTING); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(TextureHelperMF.ITEM_GLINT); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); - float f7 = 0.76F; - GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); - GL11.glMatrixMode(GL11.GL_TEXTURE); - GL11.glPushMatrix(); - float f8 = 0.125F; - GL11.glScalef(f8, f8, f8); - float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; - GL11.glTranslatef(f9, 0.0F, 0.0F); - GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); - ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glScalef(f8, f8, f8); - f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; - GL11.glTranslatef(-f9, 0.0F, 0.0F); - GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); - ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); - GL11.glPopMatrix(); - GL11.glMatrixMode(GL11.GL_MODELVIEW); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glDepthFunc(GL11.GL_LEQUAL); - } } diff --git a/src/main/java/minefantasy/mf2/client/render/RenderCrossbow.java b/src/main/java/minefantasy/mf2/client/render/RenderCrossbow.java index 336ecc9c..a822b5a7 100644 --- a/src/main/java/minefantasy/mf2/client/render/RenderCrossbow.java +++ b/src/main/java/minefantasy/mf2/client/render/RenderCrossbow.java @@ -1,73 +1,138 @@ package minefantasy.mf2.client.render; -/** - * - * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. - */ +import cpw.mods.fml.client.FMLClientHandler; import minefantasy.mf2.api.archery.AmmoMechanicsMF; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.item.gadget.ItemCrossbow; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import cpw.mods.fml.client.FMLClientHandler; +/** + * @author Anonymous Productions + *

+ * Sources are provided for educational reasons. + * though small bits of code, or methods can be used in your own creations. + */ -public class RenderCrossbow implements IItemRenderer -{ +public class RenderCrossbow implements IItemRenderer { - private float scale; RenderItem renderItem = new RenderItem(); + private float scale; - public RenderCrossbow(float sc) - { - scale = sc; + public RenderCrossbow(float sc) { + scale = sc; } + + public static void draw2dItem(Tessellator tessellator, float f, float f1, float f2, float f3, float thickness, + float res, float resSq) { + float f4 = 1.0F; + float f5 = 0.0625F * thickness; + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, 1.0F); + tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, f, f3); + tessellator.addVertexWithUV(f4, 0.0D, 0.0D, f2, f3); + tessellator.addVertexWithUV(f4, 1.0D, 0.0D, f2, f1); + tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, f, f1); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, -1F); + tessellator.addVertexWithUV(0.0D, 1.0D, 0.0F - f5, f, f1); + tessellator.addVertexWithUV(f4, 1.0D, 0.0F - f5, f2, f1); + tessellator.addVertexWithUV(f4, 0.0D, 0.0F - f5, f2, f3); + tessellator.addVertexWithUV(0.0D, 0.0D, 0.0F - f5, f, f3); + tessellator.draw(); + + tessellator.startDrawingQuads(); + tessellator.setNormal(-1F, 0.0F, 0.0F); + for (int i = 0; i < res; i++) { + float f6 = i / res; + float f10 = (f + (f2 - f) * f6) - (1 / (2 * resSq)); + float f14 = f4 * f6; + tessellator.addVertexWithUV(f14, 0.0D, 0.0F - f5, f10, f3); + tessellator.addVertexWithUV(f14, 0.0D, 0.0D, f10, f3); + tessellator.addVertexWithUV(f14, 1.0D, 0.0D, f10, f1); + tessellator.addVertexWithUV(f14, 1.0D, 0.0F - f5, f10, f1); + } + + tessellator.draw(); + + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + for (int j = 0; j < res; j++) { + float f7 = j / res; + float f11 = (f + (f2 - f) * f7) - (1 / (2 * resSq)); + float f15 = f4 * f7 + 1 / (res - .01F); + tessellator.addVertexWithUV(f15, 1.0D, 0.0F - f5, f11, f1); + tessellator.addVertexWithUV(f15, 1.0D, 0.0D, f11, f1); + tessellator.addVertexWithUV(f15, 0.0D, 0.0D, f11, f3); + tessellator.addVertexWithUV(f15, 0.0D, 0.0F - f5, f11, f3); + } + + tessellator.draw(); + + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + for (int k = 0; k < res; k++) { + float f8 = k / res; + float f12 = (f3 + (f1 - f3) * f8) - (1 / (2 * resSq)); + float f16 = f4 * f8 + 1 / (res - .01F); + tessellator.addVertexWithUV(0.0D, f16, 0.0D, f, f12); + tessellator.addVertexWithUV(f4, f16, 0.0D, f2, f12); + tessellator.addVertexWithUV(f4, f16, 0.0F - f5, f2, f12); + tessellator.addVertexWithUV(0.0D, f16, 0.0F - f5, f, f12); + } + + tessellator.draw(); + + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1F, 0.0F); + for (int l = 0; l < res; l++) { + float f9 = l / res; + float f13 = (f3 + (f1 - f3) * f9) - (1 / (2 * resSq)); + float f17 = f4 * f9; + tessellator.addVertexWithUV(f4, f17, 0.0D, f2, f13); + tessellator.addVertexWithUV(0.0D, f17, 0.0D, f, f13); + tessellator.addVertexWithUV(0.0D, f17, 0.0F - f5, f, f13); + tessellator.addVertexWithUV(f4, f17, 0.0F - f5, f2, f13); + } + + tessellator.draw(); + } + @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return type.equals(ItemRenderType.EQUIPPED) || type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON); } @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) - { - Minecraft mc = FMLClientHandler.instance().getClient(); - EntityLivingBase player = null; - ItemCrossbow crossbow = (ItemCrossbow)item.getItem(); - - if (type.equals(ItemRenderType.EQUIPPED)) - { - //GL11.glRotatef(45, 0F, 1F, -1F); - renderPart(item, player, "stock"); + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + Minecraft mc = FMLClientHandler.instance().getClient(); + EntityLivingBase player = null; + ItemCrossbow crossbow = (ItemCrossbow) item.getItem(); + + if (type.equals(ItemRenderType.EQUIPPED)) { + // GL11.glRotatef(45, 0F, 1F, -1F); + renderPart(item, player, "stock"); renderPart(item, player, "mechanism"); renderPart(item, player, "string"); renderPart(item, player, "muzzle"); renderPart(item, player, "mod"); } - if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON) && crossbow.getZoom(item) < 0.1F) - { + if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON) && crossbow.getZoom(item) < 0.1F) { renderPart(item, player, "stock"); renderPart(item, player, "mechanism"); renderPart(item, player, "string"); @@ -83,115 +148,102 @@ private void renderPart(ItemStack item, EntityLivingBase player, String iconName GL11.glTranslatef(0.75F, -0.25F, 0F); GL11.glTranslatef(0f, 0f, 0); doRenderPart(item, iconName); - + GL11.glPopMatrix(); } - - private void doRenderPart(ItemStack item, String iconName) - { - boolean flip = iconName.equalsIgnoreCase("mechanism") || iconName.equalsIgnoreCase("string"); - boolean isHead = iconName.equalsIgnoreCase("mechanism"); - - GL11.glPushMatrix(); - float x = -0.35F; - float y = 0.5F; - - ItemCrossbow bow = (ItemCrossbow)item.getItem(); - if(scale == 2.0F) - { - x -= 0.625F; - y -= 0.425F; - } - if(flip) - { - y += 0F;//bow.headYoffset(); - x += 0F;//bow.headXoffset(); + + private void doRenderPart(ItemStack item, String iconName) { + boolean flip = iconName.equalsIgnoreCase("mechanism") || iconName.equalsIgnoreCase("string"); + boolean isHead = iconName.equalsIgnoreCase("mechanism"); + + GL11.glPushMatrix(); + float x = -0.35F; + float y = 0.5F; + + ItemCrossbow bow = (ItemCrossbow) item.getItem(); + if (scale == 2.0F) { + x -= 0.625F; + y -= 0.425F; } - GL11.glTranslatef(x, y, 0); - if(flip) - { - GL11.glTranslatef(0, -0.1F, 0); - GL11.glScalef(scale, scale, scale); + if (flip) { + y += 0F;// bow.headYoffset(); + x += 0F;// bow.headXoffset(); } - else - { - GL11.glScalef(scale, scale, 1.0F); - GL11.glTranslatef(0F, 0F, 0.0625F/2F); + GL11.glTranslatef(x, y, 0); + if (flip) { + GL11.glTranslatef(0, -0.1F, 0); + GL11.glScalef(scale, scale, scale); + } else { + GL11.glScalef(scale, scale, 1.0F); + GL11.glTranslatef(0F, 0F, 0.0625F / 2F); } Minecraft mc = FMLClientHandler.instance().getClient(); - if(item != null) - mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); - - if(flip) - { - GL11.glRotatef(90, 1, 1, 0); + if (item != null) + mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); + + if (flip) { + GL11.glRotatef(90, 1, 1, 0); } - if(iconName.equalsIgnoreCase("string")) - { - GL11.glTranslatef(0F, 0F, -(4/64F)); - GL11.glScaled(1F, 1F, 0.25F); + if (iconName.equalsIgnoreCase("string")) { + GL11.glTranslatef(0F, 0F, -(4 / 64F)); + GL11.glScaled(1F, 1F, 0.25F); } - Tessellator tessellator = Tessellator.instance; - ItemCrossbow crossbow = (ItemCrossbow)item.getItem(); + ItemCrossbow crossbow = (ItemCrossbow) item.getItem(); IIcon icon = crossbow.getPartIcon(item, iconName); renderIcon(mc, item, tessellator, icon, true); - - if(isHead) - { - int slot = 1; - GL11.glPushMatrix(); - float m = 0.01F; - if(slot % 2 == 0) - { - m = 0; - } - - GL11.glTranslatef(0.1F-m+(7F/32F), 0.35F-m+(7F/32F), -(slot+1)/64F-(1F/32F)); - - float ammoSize = 0.5F; - - - GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glRotatef(90F, 0F, 0F, -1F); - ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); - - if(loaded != null) - { - mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); - for(int layer = 0; layer < loaded.getItem().getRenderPasses(loaded.getItemDamage()); layer ++) - { - GL11.glPushMatrix(); - IIcon bolt = loaded.getItem().getIcon(loaded, layer); - - int colour = loaded.getItem().getColorFromItemStack(loaded, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + + if (isHead) { + int slot = 1; + GL11.glPushMatrix(); + float m = 0.01F; + if (slot % 2 == 0) { + m = 0; + } + + GL11.glTranslatef(0.1F - m + (7F / 32F), 0.35F - m + (7F / 32F), -(slot + 1) / 64F - (1F / 32F)); + + float ammoSize = 0.5F; + + GL11.glScalef(0.5F, 0.5F, 0.5F); + GL11.glRotatef(90F, 0F, 0F, -1F); + ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); + + if (loaded != null) { + mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); + for (int layer = 0; layer < loaded.getItem().getRenderPasses(loaded.getItemDamage()); layer++) { + GL11.glPushMatrix(); + IIcon bolt = loaded.getItem().getIcon(loaded, layer); + + int colour = loaded.getItem().getColorFromItemStack(loaded, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - renderIcon(mc, item, tessellator, bolt, ammoSize, false); - GL11.glPopMatrix(); - } - } - GL11.glPopMatrix(); + + renderIcon(mc, item, tessellator, bolt, ammoSize, false); + GL11.glPopMatrix(); + } + } + GL11.glPopMatrix(); } GL11.glPopMatrix(); } - private void renderIcon(Minecraft mc, ItemStack item, Tessellator tessellator, IIcon icon, boolean enchant) - { - renderIcon(mc, item, tessellator, icon, 1.0F, enchant); + private void renderIcon(Minecraft mc, ItemStack item, Tessellator tessellator, IIcon icon, boolean enchant) { + renderIcon(mc, item, tessellator, icon, 1.0F, enchant); } - private void renderIcon(Minecraft mc, ItemStack item, Tessellator tessellator, IIcon icon, float scale, boolean enchant) - { - if(icon == null)return; - - float x1 = icon.getMinU(); + + private void renderIcon(Minecraft mc, ItemStack item, Tessellator tessellator, IIcon icon, float scale, + boolean enchant) { + if (icon == null) + return; + + float x1 = icon.getMinU(); float x2 = icon.getMaxU(); float y1 = icon.getMinV(); float y2 = icon.getMaxV(); @@ -199,20 +251,17 @@ private void renderIcon(Minecraft mc, ItemStack item, Tessellator tessellator, I float var11 = 0.3F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); /* - GL11.glTranslatef(-var10, -var11, 0.0F); - float var12 = 1.5F; - GL11.glScalef(var12, var12, var12); - GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); + * GL11.glTranslatef(-var10, -var11, 0.0F); float var12 = 1.5F; + * GL11.glScalef(var12, var12, var12); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); + * GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.9375F, + * -0.0625F, 0.0F); */ - GL11.glScalef(scale, scale, scale); - ItemRenderer.renderItemIn2D(tessellator, x2, y1, x1, y2, (int)(icon.getIconWidth()), (int)(icon.getIconHeight()), 0.0625F); + ItemRenderer.renderItemIn2D(tessellator, x2, y1, x1, y2, (icon.getIconWidth()), (icon.getIconHeight()), + 0.0625F); - if (enchant && item != null && item.isItemEnchanted()) - { + if (enchant && item != null && item.isItemEnchanted()) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); mc.renderEngine.bindTexture(TextureHelperMF.ITEM_GLINT); @@ -224,17 +273,19 @@ private void renderIcon(Minecraft mc, ItemStack item, Tessellator tessellator, I GL11.glPushMatrix(); float var14 = 0.125F; GL11.glScalef(var14, var14, var14); - float var15 = (float) (System.currentTimeMillis() % 3000L) / 3000.0F * 8.0F; + float var15 = System.currentTimeMillis() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(var15, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); - ItemRenderer.renderItemIn2D(tessellator, x2, y1, x1, y2, (int)(icon.getIconWidth()*scale), (int)(icon.getIconHeight()*scale), 0.0625F); + ItemRenderer.renderItemIn2D(tessellator, x2, y1, x1, y2, (int) (icon.getIconWidth() * scale), + (int) (icon.getIconHeight() * scale), 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(var14, var14, var14); - var15 = (float) (System.currentTimeMillis() % 4873L) / 4873.0F * 8.0F; + var15 = System.currentTimeMillis() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-var15, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); - ItemRenderer.renderItemIn2D(tessellator, x2, y1, x1, y2, (int)(icon.getIconWidth()*scale), (int)(icon.getIconHeight()*scale), 0.0625F); + ItemRenderer.renderItemIn2D(tessellator, x2, y1, x1, y2, (int) (icon.getIconWidth() * scale), + (int) (icon.getIconHeight() * scale), 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); @@ -244,80 +295,5 @@ private void renderIcon(Minecraft mc, ItemStack item, Tessellator tessellator, I GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - public static void draw2dItem(Tessellator tessellator, float f, float f1, float f2, float f3, float thickness, float res, float resSq) { - float f4 = 1.0F; - float f5 = 0.0625F * thickness; - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, 1.0F); - tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, f, f3); - tessellator.addVertexWithUV(f4, 0.0D, 0.0D, f2, f3); - tessellator.addVertexWithUV(f4, 1.0D, 0.0D, f2, f1); - tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, f, f1); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, -1F); - tessellator.addVertexWithUV(0.0D, 1.0D, 0.0F - f5, f, f1); - tessellator.addVertexWithUV(f4, 1.0D, 0.0F - f5, f2, f1); - tessellator.addVertexWithUV(f4, 0.0D, 0.0F - f5, f2, f3); - tessellator.addVertexWithUV(0.0D, 0.0D, 0.0F - f5, f, f3); - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(-1F, 0.0F, 0.0F); - for (int i = 0; i < res; i++) { - float f6 = (float) i / res; - float f10 = (f + (f2 - f) * f6) - (1 / (2 * resSq)); - float f14 = f4 * f6; - tessellator.addVertexWithUV(f14, 0.0D, 0.0F - f5, f10, f3); - tessellator.addVertexWithUV(f14, 0.0D, 0.0D, f10, f3); - tessellator.addVertexWithUV(f14, 1.0D, 0.0D, f10, f1); - tessellator.addVertexWithUV(f14, 1.0D, 0.0F - f5, f10, f1); - } - - tessellator.draw(); - - - tessellator.startDrawingQuads(); - tessellator.setNormal(1.0F, 0.0F, 0.0F); - for (int j = 0; j < res; j++) { - float f7 = (float) j / res; - float f11 = (f + (f2 - f) * f7) - (1 / (2 * resSq)); - float f15 = f4 * f7 + 1 / (res - .01F); - tessellator.addVertexWithUV(f15, 1.0D, 0.0F - f5, f11, f1); - tessellator.addVertexWithUV(f15, 1.0D, 0.0D, f11, f1); - tessellator.addVertexWithUV(f15, 0.0D, 0.0D, f11, f3); - tessellator.addVertexWithUV(f15, 0.0D, 0.0F - f5, f11, f3); - } - - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 1.0F, 0.0F); - for (int k = 0; k < res; k++) { - float f8 = (float) k / res; - float f12 = (f3 + (f1 - f3) * f8) - (1 / (2 * resSq)); - float f16 = f4 * f8 + 1 / (res - .01F); - tessellator.addVertexWithUV(0.0D, f16, 0.0D, f, f12); - tessellator.addVertexWithUV(f4, f16, 0.0D, f2, f12); - tessellator.addVertexWithUV(f4, f16, 0.0F - f5, f2, f12); - tessellator.addVertexWithUV(0.0D, f16, 0.0F - f5, f, f12); - } - - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, -1F, 0.0F); - for (int l = 0; l < res; l++) { - float f9 = (float) l / res; - float f13 = (f3 + (f1 - f3) * f9) - (1 / (2 * resSq)); - float f17 = f4 * f9; - tessellator.addVertexWithUV(f4, f17, 0.0D, f2, f13); - tessellator.addVertexWithUV(0.0D, f17, 0.0D, f, f13); - tessellator.addVertexWithUV(0.0D, f17, 0.0F - f5, f, f13); - tessellator.addVertexWithUV(f4, f17, 0.0F - f5, f2, f13); - } - - tessellator.draw(); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/RenderDragonBreath.java b/src/main/java/minefantasy/mf2/client/render/RenderDragonBreath.java index 9e992148..ed02e06a 100644 --- a/src/main/java/minefantasy/mf2/client/render/RenderDragonBreath.java +++ b/src/main/java/minefantasy/mf2/client/render/RenderDragonBreath.java @@ -1,5 +1,7 @@ package minefantasy.mf2.client.render; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.entity.EntityDragonBreath; import net.minecraft.client.Minecraft; @@ -8,42 +10,40 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class RenderDragonBreath extends Render -{ - public RenderDragonBreath() - { +public class RenderDragonBreath extends Render { + public RenderDragonBreath() { } /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render 0 && ResearchLogic.hasInfoUnlocked((EntityPlayer)user, "counteratt"); - } - else if(!(user instanceof EntityPlayer) && item != null && item.getItem() instanceof IParryable) - { - hasParried = user.hurtResistantTime > 0; - } + if (doesRenderParry) { + user = ((EntityLivingBase) data[1]); + + if (user instanceof EntityPlayer && item != null) { + hasParried = ItemWeaponMF.getParry(item) > 0 + && ResearchLogic.hasInfoUnlocked((EntityPlayer) user, "counteratt"); + } else if (!(user instanceof EntityPlayer) && item != null && item.getItem() instanceof IParryable) { + hasParried = user.hurtResistantTime > 0; + } } - + this.mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); Tessellator tessellator = Tessellator.instance; - if (type == ItemRenderType.EQUIPPED) - { - if(user != null && hasParried) - { - if(user instanceof EntityPlayer) - { - if(willStab) - { - GL11.glRotatef(-90, 0, 0, 1); - GL11.glTranslatef(-1.5F, 0.5F, 0); - } - else - { - GL11.glRotatef(90, 0, 0, 1); - GL11.glTranslatef(0F, -1.0F, 0); - } - } - else - { - GL11.glRotatef(-90, -1, 0, 0); - GL11.glTranslatef(0F, 0F, -0.25F); - } - } - GL11.glTranslatef(0.25F*offset, -0.25F*offset, 0); + if (type == ItemRenderType.EQUIPPED) { + if (user != null && hasParried) { + if (user instanceof EntityPlayer) { + if (willStab) { + GL11.glRotatef(-90, 0, 0, 1); + GL11.glTranslatef(-1.5F, 0.5F, 0); + } else { + GL11.glRotatef(90, 0, 0, 1); + GL11.glTranslatef(0F, -1.0F, 0); + } + } else { + GL11.glRotatef(-90, -1, 0, 0); + GL11.glTranslatef(0F, 0F, -0.25F); + } + } + GL11.glTranslatef(0.25F * offset, -0.25F * offset, 0); GL11.glTranslatef(-1.0F, 0F, 0); - GL11.glScalef(scale,scale,1); - - for(int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer ++) - { - int colour = item.getItem().getColorFromItemStack(item, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + GL11.glScalef(scale, scale, 1); + + for (int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer++) { + int colour = item.getItem().getColorFromItemStack(item, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - IIcon icon = item.getItem().getIcon(item, layer); - - ItemRenderer.renderItemIn2D(tessellator, - icon.getMaxU(), - icon.getMinV(), - icon.getMinU(), - icon.getMaxV(), - icon.getIconWidth(), - icon.getIconHeight(), 1F/16F); - } - - if (item != null && item.hasEffect(0)) - { - TextureHelperMF.renderEnchantmentEffects(tessellator); + + IIcon icon = item.getItem().getIcon(item, layer); + + ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), + icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); } - }else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) - { - if(hasParried) - { - if(willStab) - { - GL11.glRotatef(-90, 0, 0, 1); - GL11.glTranslatef(-1.5F, 0.5F, 0); - } - else - { - GL11.glRotatef(90, 0, 0, 1); - GL11.glTranslatef(0F, -1.0F, 0); - } - } - GL11.glTranslatef(0.05F*offset, -0.05F*offset, 0); - GL11.glTranslatef(-0.75F, -0.25F, 0); - GL11.glScalef(scale,scale,1); - - for(int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer ++) - { - int colour = item.getItem().getColorFromItemStack(item, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + if (item != null && item.hasEffect(0)) { + TextureHelperMF.renderEnchantmentEffects(tessellator); + } + + } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + if (hasParried) { + if (willStab) { + GL11.glRotatef(-90, 0, 0, 1); + GL11.glTranslatef(-1.5F, 0.5F, 0); + } else { + GL11.glRotatef(90, 0, 0, 1); + GL11.glTranslatef(0F, -1.0F, 0); + } + } + GL11.glTranslatef(0.05F * offset, -0.05F * offset, 0); + GL11.glTranslatef(-0.75F, -0.25F, 0); + GL11.glScalef(scale, scale, 1); + + for (int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer++) { + int colour = item.getItem().getColorFromItemStack(item, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - IIcon icon = item.getItem().getIcon(item, layer); - - ItemRenderer.renderItemIn2D(tessellator, - icon.getMaxU(), - icon.getMinV(), - icon.getMinU(), - icon.getMaxV(), - icon.getIconWidth(), - icon.getIconHeight(), 1F/16F); - } + + IIcon icon = item.getItem().getIcon(item, layer); + + ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), + icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); + } if (item != null && item.hasEffect(0)) { - TextureHelperMF.renderEnchantmentEffects(tessellator); + TextureHelperMF.renderEnchantmentEffects(tessellator); } } GL11.glPopMatrix(); - } + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/RenderLance.java b/src/main/java/minefantasy/mf2/client/render/RenderLance.java index 410d7430..27543230 100644 --- a/src/main/java/minefantasy/mf2/client/render/RenderLance.java +++ b/src/main/java/minefantasy/mf2/client/render/RenderLance.java @@ -1,16 +1,11 @@ package minefantasy.mf2.client.render; -/** - * - * @author Anonymous Productions - * - */ -import net.minecraft.client.Minecraft; +import cpw.mods.fml.client.FMLClientHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -18,18 +13,17 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.client.FMLClientHandler; +/** + * @author Anonymous Productions + */ -public class RenderLance implements IItemRenderer -{ - private Minecraft mc; +public class RenderLance implements IItemRenderer { + private Minecraft mc; private RenderItem itemRenderer; - - public RenderLance() - { + + public RenderLance() { } @Override @@ -38,110 +32,88 @@ public boolean handleRenderType(ItemStack item, ItemRenderType type) { } @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) { GL11.glPushMatrix(); - if (mc == null) - { + if (mc == null) { mc = FMLClientHandler.instance().getClient(); itemRenderer = new RenderItem(); } this.mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); Tessellator tessellator = Tessellator.instance; - if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED) - { - GL11.glTranslatef(0.8F, 0.2F, 0); - + if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED) { + GL11.glTranslatef(0.8F, 0.2F, 0); + GL11.glPushMatrix(); float r = 0F; - if(getRotationFor(data)) - { - if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) - { - r = 90F; - } - else - { - r = 45F; - } + if (getRotationFor(data)) { + if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + r = 90F; + } else { + r = 45F; + } } GL11.glRotatef(r, 0, 0, -1); - GL11.glScalef(3F,3F,1F); - + GL11.glScalef(3F, 3F, 1F); + GL11.glPushMatrix(); GL11.glTranslatef(-0.8F, -0.2F, 0F); - - for(int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer ++) - { - int colour = item.getItem().getColorFromItemStack(item, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + + for (int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer++) { + int colour = item.getItem().getColorFromItemStack(item, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - IIcon icon = item.getItem().getIcon(item, layer); - - ItemRenderer.renderItemIn2D(tessellator, - icon.getMaxU(), - icon.getMinV(), - icon.getMinU(), - icon.getMaxV(), - icon.getIconWidth(), - icon.getIconHeight(), 1F/16F); - } - - if (item != null && item.hasEffect(0)) - { - TextureHelperMF.renderEnchantmentEffects(tessellator); + + IIcon icon = item.getItem().getIcon(item, layer); + + ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), + icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); + } + + if (item != null && item.hasEffect(0)) { + TextureHelperMF.renderEnchantmentEffects(tessellator); } GL11.glPopMatrix(); GL11.glPopMatrix(); } GL11.glPopMatrix(); } - private boolean getRotationFor(Object... data) - { - for(int a = 0; a < data.length; a ++) - { - if(data[a] instanceof EntityLivingBase) - { - EntityLivingBase living = (EntityLivingBase)data[a]; - if(living.isSwingInProgress) - { - return true; - } - - if(living.isRiding()) - { - Entity mount = living.ridingEntity; - float speed = (float)Math.hypot(mount.motionX, mount.motionZ) * 20F; - - if(speed > 4.0F) - { - return true; - } - } - - } - - if(data[a] instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)data[a]; - if(player.isUsingItem()) - { - return true; - } - } - } - return false; - } + + private boolean getRotationFor(Object... data) { + for (int a = 0; a < data.length; a++) { + if (data[a] instanceof EntityLivingBase) { + EntityLivingBase living = (EntityLivingBase) data[a]; + if (living.isSwingInProgress) { + return true; + } + + if (living.isRiding()) { + Entity mount = living.ridingEntity; + float speed = (float) Math.hypot(mount.motionX, mount.motionZ) * 20F; + + if (speed > 4.0F) { + return true; + } + } + + } + + if (data[a] instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) data[a]; + if (player.isUsingItem()) { + return true; + } + } + } + return false; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/RenderMine.java b/src/main/java/minefantasy/mf2/client/render/RenderMine.java index 1d119577..c72f68de 100644 --- a/src/main/java/minefantasy/mf2/client/render/RenderMine.java +++ b/src/main/java/minefantasy/mf2/client/render/RenderMine.java @@ -1,5 +1,7 @@ package minefantasy.mf2.client.render; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.entity.EntityMine; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; @@ -8,32 +10,27 @@ import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class RenderMine extends Render -{ +public class RenderMine extends Render { private RenderBlocks blockRenderer = new RenderBlocks(); - public RenderMine() - { + public RenderMine() { this.shadowSize = 0.25F; } - public void doRender(EntityMine mine, double x, double y, double z, float f, float f1) - { - Block block = mine.getCasing() == 3 ? Blocks.glass : mine.getCasing() == 2 ? Blocks.obsidian : mine.getCasing() == 1 ? Blocks.iron_block : Blocks.hardened_clay; + public void doRender(EntityMine mine, double x, double y, double z, float f, float f1) { + Block block = mine.getCasing() == 3 ? Blocks.glass + : mine.getCasing() == 2 ? Blocks.obsidian + : mine.getCasing() == 1 ? Blocks.iron_block : Blocks.hardened_clay; GL11.glPushMatrix(); - GL11.glTranslatef((float)x, (float)y-0.3F, (float)z); + GL11.glTranslatef((float) x, (float) y - 0.3F, (float) z); this.bindEntityTexture(mine); GL11.glScalef(0.5F, 0.25F, 0.5F); this.blockRenderer.renderBlockAsItem(block, 0, mine.getBrightness(f1)); - + GL11.glTranslatef(0F, 0.3F, 0F); GL11.glScalef(0.5F, 1.0F, 0.5F); this.blockRenderer.renderBlockAsItem(block, 0, mine.getBrightness(f1)); @@ -42,31 +39,33 @@ public void doRender(EntityMine mine, double x, double y, double z, float f, flo } /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + * Returns the location of an entity's texture. Doesn't seem to be called unless + * you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(EntityMine p_110775_1_) - { + protected ResourceLocation getEntityTexture(EntityMine p_110775_1_) { return TextureMap.locationBlocksTexture; } /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + * Returns the location of an entity's texture. Doesn't seem to be called unless + * you call Render.bindEntityTexture. */ @Override - protected ResourceLocation getEntityTexture(Entity p_110775_1_) - { - return this.getEntityTexture((EntityMine)p_110775_1_); + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return this.getEntityTexture((EntityMine) p_110775_1_); } /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render 0.0F) - { - GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10.0F * (float)entity.getForwardDirection(), 1.0F, 0.0F, 0.0F); + if (f2 > 0.0F) { + GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10.0F * entity.getForwardDirection(), 1.0F, 0.0F, 0.0F); } float f4 = 1F; @@ -57,29 +54,31 @@ public void doRender(EntityParachute entity, double x, double y, double z, float } /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + * Returns the location of an entity's texture. Doesn't seem to be called unless + * you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(EntityParachute p_110775_1_) - { + protected ResourceLocation getEntityTexture(EntityParachute p_110775_1_) { return TextureHelperMF.getResource("textures/models/object/parachute.png"); } /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + * Returns the location of an entity's texture. Doesn't seem to be called unless + * you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(Entity p_110775_1_) - { - return this.getEntityTexture((EntityParachute)p_110775_1_); + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return this.getEntityTexture((EntityParachute) p_110775_1_); } /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render= 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; } } @@ -164,59 +159,51 @@ public void doRender(EntityLivingBase entity, double x, double y, double z, floa float f6 = entity.prevLimbSwingAmount + (entity.limbSwingAmount - entity.prevLimbSwingAmount) * f1; float f7 = entity.limbSwing - entity.limbSwingAmount * (1.0F - f1); - if (entity.isChild()) - { + if (entity.isChild()) { f7 *= 3.0F; } - if (f6 > 1.0F) - { + if (f6 > 1.0F) { f6 = 1.0F; } - if(entity instanceof EntityCogwork && entity.riddenByEntity == null && ((EntityCogwork)entity).isUnderRepairFrame()) - { - GL11.glTranslatef(0F, -0.5F, 0F); + if (entity instanceof EntityCogwork && entity.riddenByEntity == null + && ((EntityCogwork) entity).isUnderRepairFrame()) { + GL11.glTranslatef(0F, -0.5F, 0F); } - if(suit != null) - { - GL11.glTranslatef(0F, -0.15625F, 0F); + if (suit != null) { + GL11.glTranslatef(0F, -0.15625F, 0F); } - + GL11.glEnable(GL11.GL_ALPHA_TEST); this.mainModel.setLivingAnimations(entity, f7, f6, f1); GL11.glColor3f(1.0F, 1.0F, 1.0F); this.renderModel(0, entity, f7, f6, f4, f3 - f2, f13, f5); - + CustomMaterial plating = getPlating(entity); - if(plating != null) - { - colourPlating(plating); - this.renderModel(1, entity, f7, f6, f4, f3 - f2, f13, f5); - } + if (plating != null) { + colourPlating(plating); + this.renderModel(1, entity, f7, f6, f4, f3 - f2, f13, f5); + } GL11.glColor3f(1.0F, 1.0F, 1.0F); int j; float f8; float f9; float f10; - for (int i = 0; i < 4; ++i) - { + for (int i = 0; i < 4; ++i) { j = this.shouldRenderPass(entity, i, f1); - if (j > 0) - { + if (j > 0) { this.renderPassModel.setLivingAnimations(entity, f7, f6, f1); this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5); - if ((j & 240) == 16) - { + if ((j & 240) == 16) { this.func_82408_c(entity, i, f1); this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5); } - if ((j & 15) == 15) - { - f8 = (float)entity.ticksExisted + f1; + if ((j & 15) == 15) { + f8 = entity.ticksExisted + f1; this.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_BLEND); f9 = 0.5F; @@ -224,18 +211,17 @@ public void doRender(EntityLivingBase entity, double x, double y, double z, floa GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); - for (int k = 0; k < 2; ++k) - { + for (int k = 0; k < 2; ++k) { GL11.glDisable(GL11.GL_LIGHTING); f10 = 0.76F; GL11.glColor4f(0.5F * f10, 0.25F * f10, 0.8F * f10, 1.0F); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); - float f11 = f8 * (0.001F + (float)k * 0.003F) * 20.0F; + float f11 = f8 * (0.001F + k * 0.003F) * 20.0F; float f12 = 0.33333334F; GL11.glScalef(f12, f12, f12); - GL11.glRotatef(30.0F - (float)k * 60.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(30.0F - k * 60.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, f11, 0.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5); @@ -257,9 +243,8 @@ public void doRender(EntityLivingBase entity, double x, double y, double z, floa } GL11.glDepthMask(true); - if(!isFrame && !isFirstPersonRender(entity)) - { - this.renderEquippedItems(entity, f1); + if (!isFrame && !isFirstPersonRender(entity)) { + this.renderEquippedItems(entity, f1); } float f14 = entity.getBrightness(f1); j = this.getColorMultiplier(entity, f14, f1); @@ -267,42 +252,35 @@ public void doRender(EntityLivingBase entity, double x, double y, double z, floa GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); - if ((j >> 24 & 255) > 0 || entity.hurtTime > 0 || entity.deathTime > 0) - { + if ((j >> 24 & 255) > 0 || entity.hurtTime > 0 || entity.deathTime > 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthFunc(GL11.GL_EQUAL); - if (entity.hurtTime > 0 || entity.deathTime > 0) - { + if (entity.hurtTime > 0 || entity.deathTime > 0) { GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F); this.mainModel.render(entity, f7, f6, f4, f3 - f2, f13, f5); - for (int l = 0; l < 4; ++l) - { - if (this.inheritRenderPass(entity, l, f1) >= 0) - { + for (int l = 0; l < 4; ++l) { + if (this.inheritRenderPass(entity, l, f1) >= 0) { GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F); this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5); } } } - if ((j >> 24 & 255) > 0) - { - f8 = (float)(j >> 16 & 255) / 255.0F; - f9 = (float)(j >> 8 & 255) / 255.0F; - float f15 = (float)(j & 255) / 255.0F; - f10 = (float)(j >> 24 & 255) / 255.0F; + if ((j >> 24 & 255) > 0) { + f8 = (j >> 16 & 255) / 255.0F; + f9 = (j >> 8 & 255) / 255.0F; + float f15 = (j & 255) / 255.0F; + f10 = (j >> 24 & 255) / 255.0F; GL11.glColor4f(f8, f9, f15, f10); this.mainModel.render(entity, f7, f6, f4, f3 - f2, f13, f5); - for (int i1 = 0; i1 < 4; ++i1) - { - if (this.inheritRenderPass(entity, i1, f1) >= 0) - { + for (int i1 = 0; i1 < 4; ++i1) { + if (this.inheritRenderPass(entity, i1, f1) >= 0) { GL11.glColor4f(f8, f9, f15, f10); this.renderPassModel.render(entity, f7, f6, f4, f3 - f2, f13, f5); } @@ -316,9 +294,7 @@ public void doRender(EntityLivingBase entity, double x, double y, double z, floa } GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - catch (Exception exception) - { + } catch (Exception exception) { } OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); @@ -329,55 +305,42 @@ public void doRender(EntityLivingBase entity, double x, double y, double z, floa this.passSpecialRender(entity, x, y, z); MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(entity, this, x, y, z)); } - - public static boolean isFirstPersonRender(EntityLivingBase entity) - { - Minecraft mc = Minecraft.getMinecraft(); - return mc.gameSettings.thirdPersonView == 0 && entity == mc.thePlayer; - } - - private CustomMaterial getPlating(EntityLivingBase base) - { - EntityCogwork suit = getCogwork(base); - if(suit != null) - { - return suit.getPlating(); - } - return null; + + private CustomMaterial getPlating(EntityLivingBase base) { + EntityCogwork suit = getCogwork(base); + if (suit != null) { + return suit.getPlating(); + } + return null; + } + + private EntityCogwork getCogwork(EntityLivingBase base) { + if (base instanceof EntityCogwork) { + return (EntityCogwork) base; + } + if (base.ridingEntity != null && base.ridingEntity instanceof EntityCogwork) { + return (EntityCogwork) base.ridingEntity; + } + return null; + } + + private void colourPlating(CustomMaterial material) { + GL11.glColor3f(material.colourRGB[0] / 255F, material.colourRGB[1] / 255F, material.colourRGB[2] / 255F); } - private EntityCogwork getCogwork(EntityLivingBase base) - { - if(base instanceof EntityCogwork) - { - return (EntityCogwork)base; - } - if(base.ridingEntity != null && base.ridingEntity instanceof EntityCogwork) - { - return (EntityCogwork)base.ridingEntity; - } - return null; - } - - private void colourPlating(CustomMaterial material) - { - GL11.glColor3f((float)material.colourRGB[0]/255F, (float)material.colourRGB[1]/255F, (float)material.colourRGB[2]/255F); - } @Override - protected void renderModel(EntityLivingBase p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) - { - this.renderModel(0, p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + protected void renderModel(EntityLivingBase p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, + float p_77036_5_, float p_77036_6_, float p_77036_7_) { + this.renderModel(0, p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); } - protected void renderModel(int layer, EntityLivingBase p_77036_1_, 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(int layer, EntityLivingBase p_77036_1_, float p_77036_2_, float p_77036_3_, + float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) { this.bindEntityTexture(layer); - if (!p_77036_1_.isInvisible()) - { + if (!p_77036_1_.isInvisible()) { this.mainModel.render(p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); - } - else if (!p_77036_1_.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)) - { + } else if (!p_77036_1_.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)) { GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F); GL11.glDepthMask(false); @@ -389,55 +352,47 @@ else if (!p_77036_1_.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)) GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glPopMatrix(); GL11.glDepthMask(true); - } - else - { - this.mainModel.setRotationAngles(p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_, p_77036_1_); + } else { + this.mainModel.setRotationAngles(p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_, + p_77036_1_); } } - - 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; } - + @Override - protected void renderEquippedItems(EntityLivingBase entity, float offset) - { - if(entity instanceof AbstractClientPlayer) - { - renderPlayerItems((AbstractClientPlayer)entity, offset); - return; - } - renderCogworkItems(entity, offset); + protected void renderEquippedItems(EntityLivingBase entity, float offset) { + if (entity instanceof AbstractClientPlayer) { + renderPlayerItems((AbstractClientPlayer) entity, offset); + return; + } + renderCogworkItems(entity, offset); } - protected void renderCogworkItems(EntityLivingBase entity, float offset) - { + + protected void renderCogworkItems(EntityLivingBase entity, float offset) { GL11.glColor3f(1.0F, 1.0F, 1.0F); - //RenderBiped + // RenderBiped ItemStack itemstack = entity.getHeldItem(); Item item; float f1; - if (itemstack != null && itemstack.getItem() != null) - { + if (itemstack != null && itemstack.getItem() != null) { item = itemstack.getItem(); GL11.glPushMatrix(); - if (this.mainModel.isChild) - { + if (this.mainModel.isChild) { f1 = 0.5F; GL11.glTranslatef(0.0F, 0.625F, 0.0F); GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F); @@ -447,33 +402,31 @@ protected void renderCogworkItems(EntityLivingBase entity, float offset) this.cogworkSuit.bipedRightArm.postRender(0.0625F); GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); - net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); - boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); + net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient + .getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper( + net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, + net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); - if (item instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) - { + if (item instanceof ItemBlock + && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) { f1 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); f1 *= 0.75F; GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f1, -f1, f1); - } - else if (item == Items.bow) - { + } else if (item == Items.bow) { f1 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f1, -f1, f1); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else if (item.isFull3D()) - { + } else if (item.isFull3D()) { f1 = 0.625F; - if (item.shouldRotateAroundWhenRendering()) - { + if (item.shouldRotateAroundWhenRendering()) { GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -0.125F, 0.0F); } @@ -482,9 +435,7 @@ else if (item.isFull3D()) GL11.glScalef(f1, -f1, f1); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else - { + } else { f1 = 0.375F; GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); GL11.glScalef(f1, f1, f1); @@ -497,24 +448,20 @@ else if (item.isFull3D()) int i; float f5; - if (itemstack.getItem().requiresMultipleRenderPasses()) - { - for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) - { + if (itemstack.getItem().requiresMultipleRenderPasses()) { + for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) { int j = itemstack.getItem().getColorFromItemStack(itemstack, i); - f5 = (float)(j >> 16 & 255) / 255.0F; - f2 = (float)(j >> 8 & 255) / 255.0F; - float f3 = (float)(j & 255) / 255.0F; + f5 = (j >> 16 & 255) / 255.0F; + f2 = (j >> 8 & 255) / 255.0F; + float f3 = (j & 255) / 255.0F; GL11.glColor4f(f5, f2, f3, 1.0F); this.renderManager.itemRenderer.renderItem(entity, itemstack, i); } - } - else - { + } else { i = itemstack.getItem().getColorFromItemStack(itemstack, 0); - float f4 = (float)(i >> 16 & 255) / 255.0F; - f5 = (float)(i >> 8 & 255) / 255.0F; - f2 = (float)(i & 255) / 255.0F; + float f4 = (i >> 16 & 255) / 255.0F; + f5 = (i >> 8 & 255) / 255.0F; + f2 = (i & 255) / 255.0F; GL11.glColor4f(f4, f5, f2, 1.0F); this.renderManager.itemRenderer.renderItem(entity, itemstack, 0); } @@ -522,66 +469,59 @@ else if (item.isFull3D()) GL11.glPopMatrix(); } } - - protected void renderPlayerItems(AbstractClientPlayer player, float offset) - { + + protected void renderPlayerItems(AbstractClientPlayer player, float offset) { GL11.glColor3f(1.0F, 1.0F, 1.0F); super.renderArrowsStuckInEntity(player, offset); float f2; float f4; ItemStack held = player.inventory.getCurrentItem(); - if (held != null) - { + if (held != null) { GL11.glPushMatrix(); this.cogworkSuit.bipedRightArm.postRender(0.0625F); GL11.glTranslatef(-0.0625F, 0.5F, -0.0625F); - if (player.fishEntity != null) - { + if (player.fishEntity != null) { held = new ItemStack(Items.stick); } EnumAction enumaction = null; - if (player.getItemInUseCount() > 0) - { + if (player.getItemInUseCount() > 0) { enumaction = held.getItemUseAction(); } - net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(held, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); - boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, held, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); + net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient + .getItemRenderer(held, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper( + net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, held, + net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); - if (is3D || held.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(held.getItem()).getRenderType())) - { + if (is3D || held.getItem() instanceof ItemBlock + && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(held.getItem()).getRenderType())) { f2 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); f2 *= 0.75F; GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f2, -f2, f2); - } - else if (held.getItem() == Items.bow) - { + } else if (held.getItem() == Items.bow) { f2 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f2, -f2, f2); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else if (held.getItem().isFull3D()) - { + } else if (held.getItem().isFull3D()) { f2 = 0.625F; - if (held.getItem().shouldRotateAroundWhenRendering()) - { + if (held.getItem().shouldRotateAroundWhenRendering()) { GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -0.125F, 0.0F); } - if (player.getItemInUseCount() > 0 && enumaction == EnumAction.block) - { + if (player.getItemInUseCount() > 0 && enumaction == EnumAction.block) { GL11.glTranslatef(0.05F, 0.0F, -0.1F); GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-10.0F, 1.0F, 0.0F, 0.0F); @@ -592,9 +532,7 @@ else if (held.getItem().isFull3D()) GL11.glScalef(f2, -f2, f2); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else - { + } else { f2 = 0.375F; GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); GL11.glScalef(f2, f2, f2); @@ -607,24 +545,20 @@ else if (held.getItem().isFull3D()) int k; float f12; - if (held.getItem().requiresMultipleRenderPasses()) - { - for (k = 0; k < held.getItem().getRenderPasses(held.getItemDamage()); ++k) - { + if (held.getItem().requiresMultipleRenderPasses()) { + for (k = 0; k < held.getItem().getRenderPasses(held.getItemDamage()); ++k) { int i = held.getItem().getColorFromItemStack(held, k); - f12 = (float)(i >> 16 & 255) / 255.0F; - f3 = (float)(i >> 8 & 255) / 255.0F; - f4 = (float)(i & 255) / 255.0F; + f12 = (i >> 16 & 255) / 255.0F; + f3 = (i >> 8 & 255) / 255.0F; + f4 = (i & 255) / 255.0F; GL11.glColor4f(f12, f3, f4, 1.0F); this.renderManager.itemRenderer.renderItem(player, held, k); } - } - else - { + } else { k = held.getItem().getColorFromItemStack(held, 0); - float f11 = (float)(k >> 16 & 255) / 255.0F; - f12 = (float)(k >> 8 & 255) / 255.0F; - f3 = (float)(k & 255) / 255.0F; + float f11 = (k >> 16 & 255) / 255.0F; + f12 = (k >> 8 & 255) / 255.0F; + f3 = (k & 255) / 255.0F; GL11.glColor4f(f11, f12, f3, 1.0F); this.renderManager.itemRenderer.renderItem(player, held, 0); } diff --git a/src/main/java/minefantasy/mf2/client/render/RenderSaw.java b/src/main/java/minefantasy/mf2/client/render/RenderSaw.java index 46248418..5c5d4f9b 100644 --- a/src/main/java/minefantasy/mf2/client/render/RenderSaw.java +++ b/src/main/java/minefantasy/mf2/client/render/RenderSaw.java @@ -1,11 +1,8 @@ package minefantasy.mf2.client.render; -/** - * - * @author Anonymous Productions - */ -import net.minecraft.client.Minecraft; +import cpw.mods.fml.client.FMLClientHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; @@ -13,87 +10,74 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import cpw.mods.fml.client.FMLClientHandler; +/** + * @author Anonymous Productions + */ -public class RenderSaw implements IItemRenderer -{ +public class RenderSaw implements IItemRenderer { RenderItem renderItem = new RenderItem(); private float scale; - - public RenderSaw() - { - this(1.0F); + + public RenderSaw() { + this(1.0F); } - public RenderSaw(float Sc) - { - scale = Sc; + + public RenderSaw(float Sc) { + scale = Sc; } @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { return type.equals(ItemRenderType.EQUIPPED); } @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) - { - Minecraft mc = FMLClientHandler.instance().getClient(); - if (type.equals(ItemRenderType.EQUIPPED)) - { - renderItem(item); - } + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + Minecraft mc = FMLClientHandler.instance().getClient(); + if (type.equals(ItemRenderType.EQUIPPED)) { + renderItem(item); + } } - private void renderItem(ItemStack item) - { + private void renderItem(ItemStack item) { GL11.glPushMatrix(); - + Minecraft mc = FMLClientHandler.instance().getClient(); mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); Tessellator tessellator = Tessellator.instance; - - float xOffset = 0.05F+(0.5F * (scale - 1)); - float yOffset = 0.35F-(0.5F * (scale - 1)); - float xPos = 0.0F+xOffset-yOffset; - float yPos = 0.3F-xOffset-yOffset; + + float xOffset = 0.05F + (0.5F * (scale - 1)); + float yOffset = 0.35F - (0.5F * (scale - 1)); + float xPos = 0.0F + xOffset - yOffset; + float yPos = 0.3F - xOffset - yOffset; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(-xPos, -yPos, 0.0F); GL11.glScalef(scale, scale, 1); - - for(int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer ++) - { - int colour = item.getItem().getColorFromItemStack(item, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + + for (int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer++) { + int colour = item.getItem().getColorFromItemStack(item, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - IIcon icon = item.getItem().getIcon(item, layer); - - ItemRenderer.renderItemIn2D(tessellator, - icon.getMaxU(), - icon.getMinV(), - icon.getMinU(), - icon.getMaxV(), - icon.getIconWidth(), - icon.getIconHeight(), 1F/16F); - } - if (item != null && item.hasEffect(0)) - { - TextureHelperMF.renderEnchantmentEffects(tessellator); + + IIcon icon = item.getItem().getIcon(item, layer); + + ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), + icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); + } + if (item != null && item.hasEffect(0)) { + TextureHelperMF.renderEnchantmentEffects(tessellator); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); diff --git a/src/main/java/minefantasy/mf2/client/render/RenderShrapnel.java b/src/main/java/minefantasy/mf2/client/render/RenderShrapnel.java index b104de5f..3a24f22b 100644 --- a/src/main/java/minefantasy/mf2/client/render/RenderShrapnel.java +++ b/src/main/java/minefantasy/mf2/client/render/RenderShrapnel.java @@ -1,5 +1,7 @@ package minefantasy.mf2.client.render; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.entity.EntityShrapnel; import net.minecraft.client.renderer.Tessellator; @@ -7,41 +9,34 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) -public class RenderShrapnel extends Render -{ - private String tex; - - public RenderShrapnel(String tex) - { - this.tex = tex; - } - @Override - public void doRender(Entity entity, double x, double y, double z, float xr, float yr) - { - if(entity instanceof EntityShrapnel) - { - render(entity, ((EntityShrapnel)entity).getTexture(), x, y, z, xr, yr); - } - else - { - render(entity, this.tex, x, y, z, xr, yr); - } +public class RenderShrapnel extends Render { + private String tex; + + public RenderShrapnel(String tex) { + this.tex = tex; + } + + @Override + public void doRender(Entity entity, double x, double y, double z, float xr, float yr) { + if (entity instanceof EntityShrapnel) { + render(entity, ((EntityShrapnel) entity).getTexture(), x, y, z, xr, yr); + } else { + render(entity, this.tex, x, y, z, xr, yr); + } } - public void render(Entity entity, String tex, double x, double y, double z, float xr, float yr) - { - this.loadTexture("textures/projectile/"+tex+".png"); + + public void render(Entity entity, String tex, double x, double y, double z, float xr, float yr) { + this.loadTexture("textures/projectile/" + tex + ".png"); GL11.glPushMatrix(); - GL11.glTranslatef((float)x, (float)y, (float)z); - GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * yr - 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * yr, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * yr - 90.0F, 0.0F, 1.0F, + 0.0F); + GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * yr, 0.0F, 0.0F, + 1.0F); Tessellator var10 = Tessellator.instance; byte var11 = 0; float var12 = 0.0F; @@ -54,14 +49,13 @@ public void render(Entity entity, String tex, double x, double y, double z, floa float var19 = (10 + var11 * 10) / 32.0F; float var20 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); - float var21 = - yr; - - if (var21 > 0.0F) - { + float var21 = -yr; + + if (var21 > 0.0F) { float var22 = -MathHelper.sin(var21 * 3.0F) * var21; GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F); } - + GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(var20, var20, var20); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); @@ -79,9 +73,8 @@ public void render(Entity entity, String tex, double x, double y, double z, floa var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, var17, var19); var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, var16, var19); var10.draw(); - - for (int var23 = 0; var23 < 4; ++var23) - { + + for (int var23 = 0; var23 < 4; ++var23) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, var20); var10.startDrawingQuads(); @@ -91,18 +84,17 @@ public void render(Entity entity, String tex, double x, double y, double z, floa var10.addVertexWithUV(-8.0D, 2.0D, 0.0D, var12, var15); var10.draw(); } - + GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } - - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return null; - } - private void loadTexture(String image) - { - bindTexture(TextureHelperMF.getResource(image)); - } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return null; + } + + private void loadTexture(String image) { + bindTexture(TextureHelperMF.getResource(image)); + } } diff --git a/src/main/java/minefantasy/mf2/client/render/RenderSpear.java b/src/main/java/minefantasy/mf2/client/render/RenderSpear.java index 33ccd625..17c94564 100644 --- a/src/main/java/minefantasy/mf2/client/render/RenderSpear.java +++ b/src/main/java/minefantasy/mf2/client/render/RenderSpear.java @@ -1,137 +1,114 @@ package minefantasy.mf2.client.render; -/** - * - * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. - * - * Code based off Battlegear Spears by Nerd Boy. - */ +import cpw.mods.fml.client.FMLClientHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.client.FMLClientHandler; +/** + * @author Anonymous Productions + *

+ * Sources are provided for educational reasons. + * though small bits of code, or methods can be used in your own creations. + *

+ * Code based off Battlegear Spears by Nerd Boy. + */ -public class RenderSpear implements IItemRenderer -{ - private Minecraft mc; +public class RenderSpear implements IItemRenderer { + private Minecraft mc; private RenderItem itemRenderer; private boolean isHalbeard; - - public RenderSpear() - { - this(false); + + public RenderSpear() { + this(false); } - public RenderSpear(boolean halbeard) - { - isHalbeard = halbeard; + + public RenderSpear(boolean halbeard) { + isHalbeard = halbeard; } @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { + public boolean handleRenderType(ItemStack item, ItemRenderType type) { return type.equals(ItemRenderType.EQUIPPED) || type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON); } @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) { GL11.glPushMatrix(); - if (mc == null) - { + if (mc == null) { mc = FMLClientHandler.instance().getClient(); itemRenderer = new RenderItem(); } this.mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); Tessellator tessellator = Tessellator.instance; - boolean rotate = getRotationFor(type == ItemRenderType.EQUIPPED_FIRST_PERSON, data); - GL11.glTranslatef(-1.0F, -1.0F, 0); - GL11.glScalef(3,3,1); - + boolean rotate = getRotationFor(type == ItemRenderType.EQUIPPED_FIRST_PERSON, data); + GL11.glTranslatef(-1.0F, -1.0F, 0); + GL11.glScalef(3, 3, 1); + GL11.glPushMatrix(); - - for(int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer ++) - { - int colour = item.getItem().getColorFromItemStack(item, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + + for (int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer++) { + int colour = item.getItem().getColorFromItemStack(item, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - IIcon icon = item.getItem().getIcon(item, layer); - float x = icon.getMaxU(); + + IIcon icon = item.getItem().getIcon(item, layer); + float x = icon.getMaxU(); float x2 = icon.getMinU(); - - if(rotate) - { - x2 = icon.getMaxU(); + + if (rotate) { + x2 = icon.getMaxU(); x = icon.getMinU(); } - - ItemRenderer.renderItemIn2D(tessellator, - x, - icon.getMinV(), - x2, - icon.getMaxV(), - icon.getIconWidth(), - icon.getIconHeight(), 1F/16F); - } - if (item != null && item.hasEffect(0)) - { - TextureHelperMF.renderEnchantmentEffects(tessellator); + + ItemRenderer.renderItemIn2D(tessellator, x, icon.getMinV(), x2, icon.getMaxV(), icon.getIconWidth(), + icon.getIconHeight(), 1F / 16F); } - + if (item != null && item.hasEffect(0)) { + TextureHelperMF.renderEnchantmentEffects(tessellator); + } + GL11.glPopMatrix(); GL11.glPopMatrix(); } - private boolean getRotationFor(boolean FP, Object... data) - { - boolean charge = false; - for(int a = 0; a < data.length; a ++) - { - if(data[a] instanceof EntityLivingBase) - { - if(((EntityLivingBase)data[a]).isSwingInProgress && !isHalbeard) - { - return true; - } - if(((EntityLivingBase)data[a]).isSprinting() && FP) - { - charge = true; - } - } - if(data[a] instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)data[a]; - if(player.isUsingItem()) - { - charge = false; - } - } - } - return charge; - } + + private boolean getRotationFor(boolean FP, Object... data) { + boolean charge = false; + for (int a = 0; a < data.length; a++) { + if (data[a] instanceof EntityLivingBase) { + if (((EntityLivingBase) data[a]).isSwingInProgress && !isHalbeard) { + return true; + } + if (((EntityLivingBase) data[a]).isSprinting() && FP) { + charge = true; + } + } + if (data[a] instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) data[a]; + if (player.isUsingItem()) { + charge = false; + } + } + } + return charge; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/RenderSword.java b/src/main/java/minefantasy/mf2/client/render/RenderSword.java index 68769b31..5752cd89 100644 --- a/src/main/java/minefantasy/mf2/client/render/RenderSword.java +++ b/src/main/java/minefantasy/mf2/client/render/RenderSword.java @@ -1,170 +1,147 @@ package minefantasy.mf2.client.render; -import javafx.scene.paint.Color; -import minefantasy.mf2.api.weapon.IParryable; +import cpw.mods.fml.client.FMLClientHandler; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.api.knowledge.ResearchLogic; +import minefantasy.mf2.api.weapon.IParryable; import minefantasy.mf2.item.weapon.ItemWeaponMF; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.client.FMLClientHandler; - -public class RenderSword implements IItemRenderer -{ - private Minecraft mc; +public class RenderSword implements IItemRenderer { + private Minecraft mc; private RenderItem itemRenderer; private boolean isAxe = false; + private boolean rotate; + private float scale; + private float offset; + private boolean doesRenderParry = false; + private boolean willStab = false; - public RenderSword setAxe() - { - isAxe = true; - return this; + public RenderSword setAxe() { + isAxe = true; + return this; + } + + public RenderSword setGladius() { + offset = 0.75F; + willStab = true; + return this; + } + public RenderSword setShortsword() { + offset = 0.0F; + willStab = true; + return this; } + @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - boolean hasParried = false; - EntityLivingBase user = null; - if(data.length> 0 && data[1] instanceof EntityLivingBase) - { - user = ((EntityLivingBase)data[1]); - } - - ItemStack weapon = user.getHeldItem(); - - if(user instanceof EntityPlayer && weapon != null) - { - hasParried = ItemWeaponMF.getParry(weapon) > 0 && ResearchLogic.hasInfoUnlocked((EntityPlayer)user, "counteratt"); - } - else if(!(user instanceof EntityPlayer) && weapon != null && weapon.getItem() instanceof IParryable) - { - hasParried = user.hurtResistantTime > 0; - } - + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + boolean hasParried = false; + EntityLivingBase user = null; + if (data.length > 0 && data[1] instanceof EntityLivingBase) { + user = ((EntityLivingBase) data[1]); + } + + ItemStack weapon = user.getHeldItem(); + + if (user instanceof EntityPlayer && weapon != null) { + hasParried = ItemWeaponMF.getParry(weapon) > 0 + && ResearchLogic.hasInfoUnlocked((EntityPlayer) user, "counteratt"); + } else if (!(user instanceof EntityPlayer) && weapon != null && weapon.getItem() instanceof IParryable) { + hasParried = user.hurtResistantTime > 0; + } + GL11.glPushMatrix(); - if (mc == null) - { + if (mc == null) { mc = FMLClientHandler.instance().getClient(); itemRenderer = new RenderItem(); } this.mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); Tessellator tessellator = Tessellator.instance; - if (type == ItemRenderType.EQUIPPED) - { - if(hasParried) - { - if(user instanceof EntityPlayer) - { - if(isAxe) - { - GL11.glRotatef(180, 1, 0, 0); - GL11.glRotatef(90, 0, 0, 1); - GL11.glTranslatef(-1F, -1F, 0); - } - else - { - GL11.glRotatef(-90, 0, 0, 1); - GL11.glTranslatef(-1F, 0.5F, 0); - } - } - else - { - GL11.glRotatef(-90, -1, 0, 0); - GL11.glTranslatef(0F, 0F, -0.25F); - } - } - for(int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer ++) - { - int colour = item.getItem().getColorFromItemStack(item, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + if (type == ItemRenderType.EQUIPPED) { + if (hasParried) { + if (user instanceof EntityPlayer) { + if (isAxe) { + GL11.glRotatef(180, 1, 0, 0); + GL11.glRotatef(90, 0, 0, 1); + GL11.glTranslatef(-1F, -1F, 0); + } else { + GL11.glRotatef(-90, 0, 0, 1); + GL11.glTranslatef(-1F, 0.5F, 0); + } + } else { + GL11.glRotatef(-90, -1, 0, 0); + GL11.glTranslatef(0F, 0F, -0.25F); + } + } + for (int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer++) { + int colour = item.getItem().getColorFromItemStack(item, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - IIcon icon = item.getItem().getIcon(item, layer); - - ItemRenderer.renderItemIn2D(tessellator, - icon.getMaxU(), - icon.getMinV(), - icon.getMinU(), - icon.getMaxV(), - icon.getIconWidth(), - icon.getIconHeight(), 1F/16F); - } - if (item != null && item.hasEffect(0)) - { - TextureHelperMF.renderEnchantmentEffects(tessellator); + + IIcon icon = item.getItem().getIcon(item, layer); + + ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), + icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); + } + if (item != null && item.hasEffect(0)) { + TextureHelperMF.renderEnchantmentEffects(tessellator); } - } - else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) - { - if(hasParried) - { - if(isAxe) - { - GL11.glRotatef(180, 1, 0, 0); - GL11.glRotatef(90, 0, 0, 1); - GL11.glTranslatef(-1F, -1F, 0); - } - else - { - GL11.glRotatef(-90, 0, 0, 1); - GL11.glTranslatef(-1F, 0.5F, 0); - } - } - for(int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer ++) - { - int colour = item.getItem().getColorFromItemStack(item, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - + } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + if (hasParried) { + if (isAxe) { + GL11.glRotatef(180, 1, 0, 0); + GL11.glRotatef(90, 0, 0, 1); + GL11.glTranslatef(-1F, -1F, 0); + } else { + GL11.glRotatef(-90, 0, 0, 1); + GL11.glTranslatef(-1F, 0.5F, 0); + } + } + for (int layer = 0; layer < item.getItem().getRenderPasses(item.getItemDamage()); layer++) { + int colour = item.getItem().getColorFromItemStack(item, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor4f(red, green, blue, 1.0F); - - IIcon icon = item.getItem().getIcon(item, layer); - - ItemRenderer.renderItemIn2D(tessellator, - icon.getMaxU(), - icon.getMinV(), - icon.getMinU(), - icon.getMaxV(), - icon.getIconWidth(), - icon.getIconHeight(), 1F/16F); - } + + IIcon icon = item.getItem().getIcon(item, layer); + + ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), + icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); + } if (item != null && item.hasEffect(0)) { - TextureHelperMF.renderEnchantmentEffects(tessellator); + TextureHelperMF.renderEnchantmentEffects(tessellator); } } GL11.glPopMatrix(); } - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - return type.equals(ItemRenderType.EQUIPPED) || type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON); - } - - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { - return false; + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return type.equals(ItemRenderType.EQUIPPED) || type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON); } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return false; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/armour/ModelFullplate.java b/src/main/java/minefantasy/mf2/client/render/armour/ModelFullplate.java index 30214e61..c7f0c763 100644 --- a/src/main/java/minefantasy/mf2/client/render/armour/ModelFullplate.java +++ b/src/main/java/minefantasy/mf2/client/render/armour/ModelFullplate.java @@ -3,91 +3,87 @@ import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; -public class ModelFullplate extends ModelBiped -{ - ModelRenderer rightPauldron; - ModelRenderer leftPauldron; - +public class ModelFullplate extends ModelBiped { + ModelRenderer rightPauldron; + ModelRenderer leftPauldron; + ModelRenderer armetridge; ModelRenderer armetjaw; ModelRenderer armetface; - + ModelRenderer bascinetRhorn; ModelRenderer bascinetLhorn; ModelRenderer bascinetface; - public ModelFullplate(float f) - { - super(f, 0F, 64, 64); - - rightPauldron = new ModelRenderer(this, 40, 32); - rightPauldron.addBox(-3.5F, -3.5F, -2.5F, 5, 5, 5, f); - - rightPauldron.setTextureSize(64, 64); - setRotation(rightPauldron, 0F, 0F, -0.418879F); - - leftPauldron = new ModelRenderer(this, 40, 32); - leftPauldron.mirror = true; - leftPauldron.addBox(-1.5F, -3.5F, -2.5F, 5, 5, 5, f); - - leftPauldron.setTextureSize(64, 64); - setRotation(leftPauldron, 0F, 0F, 0.418879F); - - armetridge = new ModelRenderer(this, 0, 38); - armetridge.addBox(-1F, -8.5F, -3.5F, 2, 8, 8); - armetridge.setRotationPoint(0F, 0F, 0F); - - armetjaw = new ModelRenderer(this, 0, 32); - armetjaw.addBox(-3.5F, -5F, -4F, 7, 4, 2); - armetjaw.setRotationPoint(0F, 0F, 0F); - setRotation(armetjaw, 0.3316126F, 0F, 0F); - - armetface = new ModelRenderer(this, 20, 32); - armetface.addBox(-2.5F, -2.5F, -2.6F, 5, 4, 5); - armetface.setRotationPoint(0F, -1F, -5F); - setRotation(armetface, 0F, 0.7853982F, 0F); - - /* - armetface = new ModelRenderer(this, 20, 32); - armetface.addBox(-2.5F, -2.5F, -2.6F, 5, 4, 5); - armetface.setRotationPoint(0F, -0.5F, -4F); - setRotation(armetface, 0.2617994F, 0.7853982F, 0.2617994F); - */ - - bascinetface = new ModelRenderer(this, 0, 54); - bascinetface.addBox(-2.5F, -5F, -7F, 5, 4, 3); - bascinetface.setRotationPoint(0F, 0F, 0F); - setRotation(bascinetface, 0.3316126F, 0F, 0F); - - bascinetLhorn = new ModelRenderer(this, 0, 0); - bascinetLhorn.mirror = true; - bascinetLhorn.addBox(0F, -14F, -3F, 2, 6, 2); - bascinetLhorn.setRotationPoint(0F, 0F, 0F); - setRotation(bascinetLhorn, -0.7853982F, 0.4363323F, 0F); - - bascinetRhorn = new ModelRenderer(this, 0, 0); - bascinetRhorn.addBox(-2F, -14F, -3F, 2, 6, 2); - bascinetRhorn.setRotationPoint(0F, 0F, 0F); - setRotation(bascinetRhorn, -0.7853982F, -0.4363323F, 0F); - - this.bipedRightArm.addChild(rightPauldron); - this.bipedLeftArm.addChild(leftPauldron); - - this.bipedHead.addChild(armetridge); - this.bipedHead.addChild(armetjaw); - this.bipedHead.addChild(armetface); - - this.bipedHead.addChild(bascinetface); - this.bipedHead.addChild(bascinetLhorn); - this.bipedHead.addChild(bascinetRhorn); - - this.bipedLeftLeg.showModel = this.bipedRightLeg.showModel = this.bipedEars.showModel = false; - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + public ModelFullplate(float f) { + super(f, 0F, 64, 64); + + rightPauldron = new ModelRenderer(this, 40, 32); + rightPauldron.addBox(-3.5F, -3.5F, -2.5F, 5, 5, 5, f); + + rightPauldron.setTextureSize(64, 64); + setRotation(rightPauldron, 0F, 0F, -0.418879F); + + leftPauldron = new ModelRenderer(this, 40, 32); + leftPauldron.mirror = true; + leftPauldron.addBox(-1.5F, -3.5F, -2.5F, 5, 5, 5, f); + + leftPauldron.setTextureSize(64, 64); + setRotation(leftPauldron, 0F, 0F, 0.418879F); + + armetridge = new ModelRenderer(this, 0, 38); + armetridge.addBox(-1F, -8.5F, -3.5F, 2, 8, 8); + armetridge.setRotationPoint(0F, 0F, 0F); + + armetjaw = new ModelRenderer(this, 0, 32); + armetjaw.addBox(-3.5F, -5F, -4F, 7, 4, 2); + armetjaw.setRotationPoint(0F, 0F, 0F); + setRotation(armetjaw, 0.3316126F, 0F, 0F); + + armetface = new ModelRenderer(this, 20, 32); + armetface.addBox(-2.5F, -2.5F, -2.6F, 5, 4, 5); + armetface.setRotationPoint(0F, -1F, -5F); + setRotation(armetface, 0F, 0.7853982F, 0F); + + /* + * armetface = new ModelRenderer(this, 20, 32); armetface.addBox(-2.5F, -2.5F, + * -2.6F, 5, 4, 5); armetface.setRotationPoint(0F, -0.5F, -4F); + * setRotation(armetface, 0.2617994F, 0.7853982F, 0.2617994F); + */ + + bascinetface = new ModelRenderer(this, 0, 54); + bascinetface.addBox(-2.5F, -5F, -7F, 5, 4, 3); + bascinetface.setRotationPoint(0F, 0F, 0F); + setRotation(bascinetface, 0.3316126F, 0F, 0F); + + bascinetLhorn = new ModelRenderer(this, 0, 0); + bascinetLhorn.mirror = true; + bascinetLhorn.addBox(0F, -14F, -3F, 2, 6, 2); + bascinetLhorn.setRotationPoint(0F, 0F, 0F); + setRotation(bascinetLhorn, -0.7853982F, 0.4363323F, 0F); + + bascinetRhorn = new ModelRenderer(this, 0, 0); + bascinetRhorn.addBox(-2F, -14F, -3F, 2, 6, 2); + bascinetRhorn.setRotationPoint(0F, 0F, 0F); + setRotation(bascinetRhorn, -0.7853982F, -0.4363323F, 0F); + + this.bipedRightArm.addChild(rightPauldron); + this.bipedLeftArm.addChild(leftPauldron); + + this.bipedHead.addChild(armetridge); + this.bipedHead.addChild(armetjaw); + this.bipedHead.addChild(armetface); + + this.bipedHead.addChild(bascinetface); + this.bipedHead.addChild(bascinetLhorn); + this.bipedHead.addChild(bascinetRhorn); + + this.bipedLeftLeg.showModel = this.bipedRightLeg.showModel = this.bipedEars.showModel = false; + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelAmmoBox.java b/src/main/java/minefantasy/mf2/client/render/block/ModelAmmoBox.java index a6be41db..7a99b513 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelAmmoBox.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelAmmoBox.java @@ -5,28 +5,25 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelAmmoBox extends ModelBase -{ - protected ModelRenderer LeftWall; - protected ModelRenderer FrontWall; - protected ModelRenderer BackWall; - protected ModelRenderer RightWall; - protected ModelRenderer lid; - protected ModelRenderer Base; - protected ModelRenderer lock2; - protected ModelRenderer lock1; - - public ModelAmmoBox() - { - textureWidth = 64; - textureHeight = 32; - +public class ModelAmmoBox extends ModelBase { + protected ModelRenderer LeftWall; + protected ModelRenderer FrontWall; + protected ModelRenderer BackWall; + protected ModelRenderer RightWall; + protected ModelRenderer lid; + protected ModelRenderer Base; + protected ModelRenderer lock2; + protected ModelRenderer lock1; + + public ModelAmmoBox() { + textureWidth = 64; + textureHeight = 32; + LeftWall = new ModelRenderer(this, 34, 0); LeftWall.addBox(-6F, -4F, -3F, 1, 5, 6); LeftWall.setRotationPoint(0F, 0F, 0F); @@ -46,7 +43,7 @@ public ModelAmmoBox() RightWall.addBox(5F, -4F, -3F, 1, 5, 6); RightWall.setRotationPoint(0F, 0F, 0F); RightWall.setTextureSize(64, 32); - + setRotation(RightWall, 0F, 0F, 0F); lid = new ModelRenderer(this, 0, 13); lid.addBox(-6F, -1F, -8F, 12, 1, 8); @@ -68,37 +65,34 @@ public ModelAmmoBox() lock1.setRotationPoint(0F, -4F, 5F); lock1.setTextureSize(64, 32); setRotation(lock1, 0F, 0F, 0F); - + RightWall.mirror = true; } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - renderModel(f5); - } - - protected void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void renderModel(float f) - { - LeftWall.render(f); - RightWall.render(f); - FrontWall.render(f); - BackWall.render(f); - Base.render(f); - } - public void renderLid(float f, float angle) - { - lock1.rotateAngleX = lock2.rotateAngleX = lid.rotateAngleX = -(float)Math.toRadians(angle); - lid.render(f); - lock1.render(f); - lock2.render(f); - } + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + renderModel(f5); + } + + protected void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderModel(float f) { + LeftWall.render(f); + RightWall.render(f); + FrontWall.render(f); + BackWall.render(f); + Base.render(f); + } + + public void renderLid(float f, float angle) { + lock1.rotateAngleX = lock2.rotateAngleX = lid.rotateAngleX = -(float) Math.toRadians(angle); + lid.render(f); + lock1.render(f); + lock2.render(f); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelAnvil.java b/src/main/java/minefantasy/mf2/client/render/block/ModelAnvil.java index 9cdaa173..9496b216 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelAnvil.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelAnvil.java @@ -5,14 +5,13 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ public class ModelAnvil extends ModelBase { - //fields + // fields ModelRenderer End; ModelRenderer Post; ModelRenderer Body; @@ -20,83 +19,79 @@ public class ModelAnvil extends ModelBase { ModelRenderer Back; ModelRenderer floor; ModelRenderer Base; - - public ModelAnvil() - { - textureWidth = 64; - textureHeight = 32; - - End = new ModelRenderer(this, 0, 24); - End.addBox(-10F, -3F, -2F, 3, 4, 4); - End.setRotationPoint(0F, -5F, 0F); - End.setTextureSize(64, 32); - End.mirror = true; - setRotation(End, 0F, 0F, 0F); - Post = new ModelRenderer(this, 48, 24); - Post.addBox(-2F, 0F, -2F, 4, 4, 4); - Post.setRotationPoint(0F, -4F, 0F); - Post.setTextureSize(64, 32); - Post.mirror = true; - setRotation(Post, 0F, 0F, 0F); - Body = new ModelRenderer(this, 32, 0); - Body.addBox(-5F, -3F, -3F, 10, 4, 6); - Body.setRotationPoint(0F, -5F, 0F); - Body.setTextureSize(64, 32); - Body.mirror = true; - setRotation(Body, 0F, 0F, 0F); - Tip = new ModelRenderer(this, 0, 10); - Tip.addBox(5F, -2F, -1F, 3, 2, 2); - Tip.setRotationPoint(0F, -5F, 0F); - Tip.setTextureSize(64, 32); - Tip.mirror = true; - setRotation(Tip, 0F, 0F, 0F); - Back = new ModelRenderer(this, 0, 19); - Back.addBox(-7F, -2F, -1F, 2, 3, 2); - Back.setRotationPoint(0F, -5F, 0F); - Back.setTextureSize(64, 32); - Back.mirror = true; - setRotation(Back, 0F, 0F, 0F); - Base = new ModelRenderer(this, 0, 0); - Base.addBox(-3F, 0F, -3F, 6, 2, 6); - Base.setRotationPoint(0F, 0F, 0F); - Base.setTextureSize(64, 32); - Base.mirror = true; - setRotation(Base, 0F, 0F, 0F); - floor = new ModelRenderer(this, 14, 21); - floor.addBox(-4F, 2F, -4F, 8, 3, 8); - floor.setRotationPoint(0F, 0F, 0F); - floor.setTextureSize(64, 32); - floor.mirror = true; - } - - @Override -public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - End.render(f5); - Base.render(f5); - Post.render(f5); - Body.render(f5); - Tip.render(f5); - Back.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void renderModel(float f) - { - End.render(f); - Base.render(f); - Post.render(f); - Body.render(f); - Tip.render(f); - Back.render(f); - floor.render(f); - } + public ModelAnvil() { + textureWidth = 64; + textureHeight = 32; + + End = new ModelRenderer(this, 0, 24); + End.addBox(-10F, -3F, -2F, 3, 4, 4); + End.setRotationPoint(0F, -5F, 0F); + End.setTextureSize(64, 32); + End.mirror = true; + setRotation(End, 0F, 0F, 0F); + Post = new ModelRenderer(this, 48, 24); + Post.addBox(-2F, 0F, -2F, 4, 4, 4); + Post.setRotationPoint(0F, -4F, 0F); + Post.setTextureSize(64, 32); + Post.mirror = true; + setRotation(Post, 0F, 0F, 0F); + Body = new ModelRenderer(this, 32, 0); + Body.addBox(-5F, -3F, -3F, 10, 4, 6); + Body.setRotationPoint(0F, -5F, 0F); + Body.setTextureSize(64, 32); + Body.mirror = true; + setRotation(Body, 0F, 0F, 0F); + Tip = new ModelRenderer(this, 0, 10); + Tip.addBox(5F, -2F, -1F, 3, 2, 2); + Tip.setRotationPoint(0F, -5F, 0F); + Tip.setTextureSize(64, 32); + Tip.mirror = true; + setRotation(Tip, 0F, 0F, 0F); + Back = new ModelRenderer(this, 0, 19); + Back.addBox(-7F, -2F, -1F, 2, 3, 2); + Back.setRotationPoint(0F, -5F, 0F); + Back.setTextureSize(64, 32); + Back.mirror = true; + setRotation(Back, 0F, 0F, 0F); + Base = new ModelRenderer(this, 0, 0); + Base.addBox(-3F, 0F, -3F, 6, 2, 6); + Base.setRotationPoint(0F, 0F, 0F); + Base.setTextureSize(64, 32); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + floor = new ModelRenderer(this, 14, 21); + floor.addBox(-4F, 2F, -4F, 8, 3, 8); + floor.setRotationPoint(0F, 0F, 0F); + floor.setTextureSize(64, 32); + floor.mirror = true; + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + End.render(f5); + Base.render(f5); + Post.render(f5); + Body.render(f5); + Tip.render(f5); + Back.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderModel(float f) { + End.render(f); + Base.render(f); + Post.render(f); + Body.render(f); + Tip.render(f); + Back.render(f); + floor.render(f); + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelBellows.java b/src/main/java/minefantasy/mf2/client/render/block/ModelBellows.java index ac772207..3b12ec4d 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelBellows.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelBellows.java @@ -5,113 +5,107 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelBellows extends ModelBase -{ - //fields - ModelRenderer Flap4; +public class ModelBellows extends ModelBase { + // fields + ModelRenderer Flap4; ModelRenderer Handle; ModelRenderer Flap1; ModelRenderer Flap2; ModelRenderer Flap3; ModelRenderer Base; ModelRenderer Top; - - public ModelBellows() - { - textureWidth = 64; - textureHeight = 32; - - Flap4 = new ModelRenderer(this, 0, 23); - Flap4.addBox(0F, 0F, -4F, 10, 1, 8); - Flap4.setRotationPoint(-8F, 23F, 0F); - Flap4.setTextureSize(64, 32); - Flap4.mirror = true; - setRotation(Flap4, 0F, 0F, -0.418879F); - Handle = new ModelRenderer(this, 40, 0); - Handle.addBox(7F, -1F, -1F, 10, 2, 2); - Handle.setRotationPoint(-8F, 23F, 0F); - Handle.setTextureSize(64, 32); - Handle.mirror = true; - setRotation(Handle, 0F, 0F, -0.5235988F); - Flap1 = new ModelRenderer(this, 34, 23); - Flap1.addBox(0F, 0F, -3F, 9, 1, 6); - Flap1.setRotationPoint(-8F, 23F, 0F); - Flap1.setTextureSize(64, 32); - Flap1.mirror = true; - setRotation(Flap1, 0F, 0F, -0.1047198F); - Flap2 = new ModelRenderer(this, 0, 23); - Flap2.addBox(0F, 0F, -4F, 10, 1, 8); - Flap2.setRotationPoint(-8F, 23F, 0F); - Flap2.setTextureSize(64, 32); - Flap2.mirror = true; - setRotation(Flap2, 0F, 0F, -0.2094395F); - Flap3 = new ModelRenderer(this, 34, 23); - Flap3.addBox(0F, 0F, -3F, 9, 1, 6); - Flap3.setRotationPoint(-8F, 23F, 0F); - Flap3.setTextureSize(64, 32); - Flap3.mirror = true; - setRotation(Flap3, 0F, 0F, -0.3141593F); - Base = new ModelRenderer(this, 0, 0); - Base.addBox(0F, 0F, -5F, 11, 1, 10); - Base.setRotationPoint(-8F, 23F, 0F); - Base.setTextureSize(64, 32); - Base.mirror = true; - setRotation(Base, 0F, 0F, 0F); - Top = new ModelRenderer(this, 0, 14); - Top.addBox(0F, 0F, -4F, 11, 1, 8); - Top.setRotationPoint(-8F, 23F, 0F); - Top.setTextureSize(64, 32); - Top.mirror = true; - setRotation(Top, 0F, 0F, -0.5235988F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - Flap4.render(f5); - Handle.render(f5); - Flap1.render(f5); - Flap2.render(f5); - Flap3.render(f5); - Base.render(f5); - Top.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } -public void renderModel(int press, float f) { - Flap4.render(f); - Handle.render(f); - Flap1.render(f); - Flap2.render(f); - Flap3.render(f); - Base.render(f); - Top.render(f); -} -public void rotate(int p) -{ - Top.rotateAngleZ = Handle.rotateAngleZ = -getRotationForPart(p,5); - Flap4.rotateAngleZ = -getRotationForPart(p,4); - Flap3.rotateAngleZ = -getRotationForPart(p,3); - Flap2.rotateAngleZ = -getRotationForPart(p,2); - Flap1.rotateAngleZ = -getRotationForPart(p,1); -} + public ModelBellows() { + textureWidth = 64; + textureHeight = 32; -public float getRotationForPart(int press, int part) -{ - float angle = (float)Math.toRadians(50-press); - return (angle/5) * part; -} + Flap4 = new ModelRenderer(this, 0, 23); + Flap4.addBox(0F, 0F, -4F, 10, 1, 8); + Flap4.setRotationPoint(-8F, 23F, 0F); + Flap4.setTextureSize(64, 32); + Flap4.mirror = true; + setRotation(Flap4, 0F, 0F, -0.418879F); + Handle = new ModelRenderer(this, 40, 0); + Handle.addBox(7F, -1F, -1F, 10, 2, 2); + Handle.setRotationPoint(-8F, 23F, 0F); + Handle.setTextureSize(64, 32); + Handle.mirror = true; + setRotation(Handle, 0F, 0F, -0.5235988F); + Flap1 = new ModelRenderer(this, 34, 23); + Flap1.addBox(0F, 0F, -3F, 9, 1, 6); + Flap1.setRotationPoint(-8F, 23F, 0F); + Flap1.setTextureSize(64, 32); + Flap1.mirror = true; + setRotation(Flap1, 0F, 0F, -0.1047198F); + Flap2 = new ModelRenderer(this, 0, 23); + Flap2.addBox(0F, 0F, -4F, 10, 1, 8); + Flap2.setRotationPoint(-8F, 23F, 0F); + Flap2.setTextureSize(64, 32); + Flap2.mirror = true; + setRotation(Flap2, 0F, 0F, -0.2094395F); + Flap3 = new ModelRenderer(this, 34, 23); + Flap3.addBox(0F, 0F, -3F, 9, 1, 6); + Flap3.setRotationPoint(-8F, 23F, 0F); + Flap3.setTextureSize(64, 32); + Flap3.mirror = true; + setRotation(Flap3, 0F, 0F, -0.3141593F); + Base = new ModelRenderer(this, 0, 0); + Base.addBox(0F, 0F, -5F, 11, 1, 10); + Base.setRotationPoint(-8F, 23F, 0F); + Base.setTextureSize(64, 32); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + Top = new ModelRenderer(this, 0, 14); + Top.addBox(0F, 0F, -4F, 11, 1, 8); + Top.setRotationPoint(-8F, 23F, 0F); + Top.setTextureSize(64, 32); + Top.mirror = true; + setRotation(Top, 0F, 0F, -0.5235988F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + Flap4.render(f5); + Handle.render(f5); + Flap1.render(f5); + Flap2.render(f5); + Flap3.render(f5); + Base.render(f5); + Top.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderModel(int press, float f) { + Flap4.render(f); + Handle.render(f); + Flap1.render(f); + Flap2.render(f); + Flap3.render(f); + Base.render(f); + Top.render(f); + } + + public void rotate(int p) { + Top.rotateAngleZ = Handle.rotateAngleZ = -getRotationForPart(p, 5); + Flap4.rotateAngleZ = -getRotationForPart(p, 4); + Flap3.rotateAngleZ = -getRotationForPart(p, 3); + Flap2.rotateAngleZ = -getRotationForPart(p, 2); + Flap1.rotateAngleZ = -getRotationForPart(p, 1); + } + + public float getRotationForPart(int press, int part) { + float angle = (float) Math.toRadians(50 - press); + return (angle / 5) * part; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelBigFurnace.java b/src/main/java/minefantasy/mf2/client/render/block/ModelBigFurnace.java index 49dac42b..27abe5e7 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelBigFurnace.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelBigFurnace.java @@ -4,9 +4,8 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelBigFurnace extends ModelBase -{ - ModelRenderer Wall4t; +public class ModelBigFurnace extends ModelBase { + ModelRenderer Wall4t; ModelRenderer Wall1; ModelRenderer Wall2; ModelRenderer Top; @@ -15,103 +14,98 @@ public class ModelBigFurnace extends ModelBase ModelRenderer lava; ModelRenderer Base; ModelRenderer contents; - - public ModelBigFurnace() - { - textureWidth = 128; - textureHeight = 64; - - Wall4t = new ModelRenderer(this, 76, 50); - Wall1 = new ModelRenderer(this, 0, 27); - Wall2 = new ModelRenderer(this, 0, 27); - Top = new ModelRenderer(this, 0, 0); - Wall3 = new ModelRenderer(this, 48, 50); - Wall4 = new ModelRenderer(this, 76, 60); - lava = new ModelRenderer(this, 26, 27); - Base = new ModelRenderer(this, 0, 0); - contents = new ModelRenderer(this, 0, 41); - - Wall4t.addBox(-6F, -12F, -8F, 12, 3, 2); - Wall4t.setRotationPoint(0F, 0F, 0F); - Wall4t.setTextureSize(128, 64); - Wall4t.mirror = true; - setRotation(Wall4t, 0F, 1.570796F, 0F); - - Wall1.addBox(-8F, -12F, 6F, 16, 12, 2); - Wall1.setRotationPoint(0F, 0F, 0F); - Wall1.setTextureSize(128, 64); - Wall1.mirror = true; - setRotation(Wall1, 0F, 3.141593F, 0F); - - Wall2.addBox(-8F, -12F, 6F, 16, 12, 2); - Wall2.setRotationPoint(0F, 0F, 0F); - Wall2.setTextureSize(128, 64); - Wall2.mirror = true; - setRotation(Wall2, 0F, 0F, 0F); - - Top.addBox(-8F, -14F, -8F, 16, 2, 16); - Top.setRotationPoint(0F, 0F, 0F); - Top.setTextureSize(128, 64); - Top.mirror = true; - setRotation(Top, 0F, 0F, 0F); - - Wall3.addBox(-6F, -12F, 6F, 12, 12, 2); - Wall3.setRotationPoint(0F, 0F, 0F); - Wall3.setTextureSize(128, 64); - Wall3.mirror = true; - setRotation(Wall3, 0F, 1.570796F, 0F); - - Wall4.addBox(-6F, -2F, -8F, 12, 2, 2); - Wall4.setRotationPoint(0F, 0F, 0F); - Wall4.setTextureSize(128, 64); - Wall4.mirror = true; - setRotation(Wall4, 0F, 1.570796F, 0F); - - lava.addBox(-5F, -2F, -5F, 10, 0, 10); - lava.setRotationPoint(0F, 0F, 0F); - lava.setTextureSize(128, 64); - lava.mirror = true; - setRotation(lava, 0F, 0F, 0F); - - Base.addBox(-8F, -2F, -8F, 16, 2, 16); - Base.setRotationPoint(0F, 0F, 0F); - Base.setTextureSize(128, 64); - Base.mirror = true; - setRotation(Base, 3.141593F, 0F, 0F); - - contents.addBox(-6F, -1F, -6F, 12, 1, 12); - contents.setRotationPoint(0F, 0F, 0F); - contents.setTextureSize(128, 64); - contents.mirror = true; - setRotation(contents, 0F, 0F, 0F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - renderModel(false, f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void renderModel(boolean lit, float f) - { - if(lit) - { - lava.render(f); - } - Top.render(f); - contents.render(f); - Base.render(f); - Wall4t.render(f); - Wall1.render(f); - Wall2.render(f); - Wall3.render(f); - Wall4.render(f); + + public ModelBigFurnace() { + textureWidth = 128; + textureHeight = 64; + + Wall4t = new ModelRenderer(this, 76, 50); + Wall1 = new ModelRenderer(this, 0, 27); + Wall2 = new ModelRenderer(this, 0, 27); + Top = new ModelRenderer(this, 0, 0); + Wall3 = new ModelRenderer(this, 48, 50); + Wall4 = new ModelRenderer(this, 76, 60); + lava = new ModelRenderer(this, 26, 27); + Base = new ModelRenderer(this, 0, 0); + contents = new ModelRenderer(this, 0, 41); + + Wall4t.addBox(-6F, -12F, -8F, 12, 3, 2); + Wall4t.setRotationPoint(0F, 0F, 0F); + Wall4t.setTextureSize(128, 64); + Wall4t.mirror = true; + setRotation(Wall4t, 0F, 1.570796F, 0F); + + Wall1.addBox(-8F, -12F, 6F, 16, 12, 2); + Wall1.setRotationPoint(0F, 0F, 0F); + Wall1.setTextureSize(128, 64); + Wall1.mirror = true; + setRotation(Wall1, 0F, 3.141593F, 0F); + + Wall2.addBox(-8F, -12F, 6F, 16, 12, 2); + Wall2.setRotationPoint(0F, 0F, 0F); + Wall2.setTextureSize(128, 64); + Wall2.mirror = true; + setRotation(Wall2, 0F, 0F, 0F); + + Top.addBox(-8F, -14F, -8F, 16, 2, 16); + Top.setRotationPoint(0F, 0F, 0F); + Top.setTextureSize(128, 64); + Top.mirror = true; + setRotation(Top, 0F, 0F, 0F); + + Wall3.addBox(-6F, -12F, 6F, 12, 12, 2); + Wall3.setRotationPoint(0F, 0F, 0F); + Wall3.setTextureSize(128, 64); + Wall3.mirror = true; + setRotation(Wall3, 0F, 1.570796F, 0F); + + Wall4.addBox(-6F, -2F, -8F, 12, 2, 2); + Wall4.setRotationPoint(0F, 0F, 0F); + Wall4.setTextureSize(128, 64); + Wall4.mirror = true; + setRotation(Wall4, 0F, 1.570796F, 0F); + + lava.addBox(-5F, -2F, -5F, 10, 0, 10); + lava.setRotationPoint(0F, 0F, 0F); + lava.setTextureSize(128, 64); + lava.mirror = true; + setRotation(lava, 0F, 0F, 0F); + + Base.addBox(-8F, -2F, -8F, 16, 2, 16); + Base.setRotationPoint(0F, 0F, 0F); + Base.setTextureSize(128, 64); + Base.mirror = true; + setRotation(Base, 3.141593F, 0F, 0F); + + contents.addBox(-6F, -1F, -6F, 12, 1, 12); + contents.setRotationPoint(0F, 0F, 0F); + contents.setTextureSize(128, 64); + contents.mirror = true; + setRotation(contents, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + renderModel(false, f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderModel(boolean lit, float f) { + if (lit) { + lava.render(f); + } + Top.render(f); + contents.render(f); + Base.render(f); + Wall4t.render(f); + Wall1.render(f); + Wall2.render(f); + Wall3.render(f); + Wall4.render(f); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelBloomery.java b/src/main/java/minefantasy/mf2/client/render/block/ModelBloomery.java index 191eafaf..2d3cf0b9 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelBloomery.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelBloomery.java @@ -6,70 +6,62 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelBloomery extends ModelBase -{ - //fields - ModelRenderer top; +public class ModelBloomery extends ModelBase { + // fields + ModelRenderer top; ModelRenderer base; ModelRenderer neck; ModelRenderer body; ModelRenderer bloom; - - public ModelBloomery() - { - textureWidth = 128; - textureHeight = 64; - - top = new ModelRenderer(this, 84, 43); - top.addBox(-5.5F, 0F, -5.5F, 11, 2, 11); - top.setRotationPoint(0F, 0F, 0F); - top.setTextureSize(128, 64); - - base = new ModelRenderer(this, 0, 0); - base.addBox(-9F, 14F, -9F, 18, 2, 18); - base.setRotationPoint(0F, 0F, 0F); - base.setTextureSize(128, 64); - - neck = new ModelRenderer(this, 0, 46); - neck.addBox(-7F, 2F, -7F, 14, 3, 14); - neck.setRotationPoint(0F, 0F, 0F); - neck.setTextureSize(128, 64); - - body = new ModelRenderer(this, 64, 11); - body.addBox(-8F, 5F, -8F, 16, 9, 16); - body.setRotationPoint(0F, 0F, 0F); - body.setTextureSize(128, 64); - - bloom = new ModelRenderer(this, 0, 20); - bloom.addBox(-4F, -4F, -4F, 8, 8, 8); - bloom.setRotationPoint(0F, 6F, 0F); - bloom.setTextureSize(128, 64); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - } - - public void renderModel(TileEntityBloomery bloomery, float f) - { - base.render(f); - body.render(f); - - if(bloomery != null && bloomery.hasBloom) - { - bloom.render(f); + + public ModelBloomery() { + textureWidth = 128; + textureHeight = 64; + + top = new ModelRenderer(this, 84, 43); + top.addBox(-5.5F, 0F, -5.5F, 11, 2, 11); + top.setRotationPoint(0F, 0F, 0F); + top.setTextureSize(128, 64); + + base = new ModelRenderer(this, 0, 0); + base.addBox(-9F, 14F, -9F, 18, 2, 18); + base.setRotationPoint(0F, 0F, 0F); + base.setTextureSize(128, 64); + + neck = new ModelRenderer(this, 0, 46); + neck.addBox(-7F, 2F, -7F, 14, 3, 14); + neck.setRotationPoint(0F, 0F, 0F); + neck.setTextureSize(128, 64); + + body = new ModelRenderer(this, 64, 11); + body.addBox(-8F, 5F, -8F, 16, 9, 16); + body.setRotationPoint(0F, 0F, 0F); + body.setTextureSize(128, 64); + + bloom = new ModelRenderer(this, 0, 20); + bloom.addBox(-4F, -4F, -4F, 8, 8, 8); + bloom.setRotationPoint(0F, 6F, 0F); + bloom.setTextureSize(128, 64); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); } - else - { - neck.render(f); - top.render(f); + + public void renderModel(TileEntityBloomery bloomery, float f) { + base.render(f); + body.render(f); + + if (bloomery != null && bloomery.hasBloom) { + bloom.render(f); + } else { + neck.render(f); + top.render(f); + } } - } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelBombBench.java b/src/main/java/minefantasy/mf2/client/render/block/ModelBombBench.java index 07462de7..3a9fabef 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelBombBench.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelBombBench.java @@ -5,16 +5,14 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelBombBench extends ModelBase -{ - //fields - ModelRenderer top; +public class ModelBombBench extends ModelBase { + // fields + ModelRenderer top; ModelRenderer FRleg; ModelRenderer bottom; ModelRenderer BRleg; @@ -25,107 +23,103 @@ public class ModelBombBench extends ModelBase ModelRenderer powder; ModelRenderer bomb; ModelRenderer fuse; - - public ModelBombBench() - { - textureWidth = 64; - textureHeight = 64; - - top = new ModelRenderer(this, 0, 0); - top.addBox(-8F, 4F, -8F, 16, 4, 16); - top.setRotationPoint(0F, 0F, 0F); - top.setTextureSize(64, 64); - top.mirror = true; - setRotation(top, 0F, 0F, 0F); - FRleg = new ModelRenderer(this, 0, 35); - FRleg.addBox(3F, 8F, -7F, 4, 12, 4); - FRleg.setRotationPoint(0F, 0F, 0F); - FRleg.setTextureSize(64, 64); - FRleg.mirror = true; - setRotation(FRleg, 0F, 0F, 0F); - bottom = new ModelRenderer(this, 0, 20); - bottom.addBox(-6.5F, 14F, -6.5F, 13, 2, 13); - bottom.setRotationPoint(0F, 0F, 0F); - bottom.setTextureSize(64, 64); - bottom.mirror = true; - setRotation(bottom, 0F, 0F, 0F); - BRleg = new ModelRenderer(this, 0, 35); - BRleg.addBox(3F, 8F, 3F, 4, 12, 4); - BRleg.setRotationPoint(0F, 0F, 0F); - BRleg.setTextureSize(64, 64); - BRleg.mirror = true; - setRotation(BRleg, 0F, 0F, 0F); - BLleg = new ModelRenderer(this, 0, 35); - BLleg.addBox(-7F, 8F, 3F, 4, 12, 4); - BLleg.setRotationPoint(0F, 0F, 0F); - BLleg.setTextureSize(64, 64); - BLleg.mirror = true; - setRotation(BLleg, 0F, 0F, 0F); - FLleg = new ModelRenderer(this, 0, 35); - FLleg.addBox(-7F, 8F, -7F, 4, 12, 4); - FLleg.setRotationPoint(0F, 0F, 0F); - FLleg.setTextureSize(64, 64); - FLleg.mirror = true; - setRotation(FLleg, 0F, 0F, 0F); - box = new ModelRenderer(this, 0, 51); - box.addBox(-3F, -1F, -2F, 6, 3, 4); - box.setRotationPoint(0F, 12F, 0F); - box.setTextureSize(64, 64); - box.mirror = true; - setRotation(box, 0F, 0.1396263F, 0F); - casing = new ModelRenderer(this, 0, 20); - casing.addBox(-1F, -1F, -1F, 3, 2, 3); - casing.setRotationPoint(-2F, 3F, -5F); - casing.setTextureSize(64, 64); - casing.mirror = true; - setRotation(casing, 0F, -0.418879F, 0F); - powder = new ModelRenderer(this, 0, 0); - powder.addBox(-2F, -2F, -2F, 4, 4, 4); - powder.setRotationPoint(-2F, 4.5F, 0F); - powder.setTextureSize(64, 64); - powder.mirror = true; - setRotation(powder, 0.7853982F, 0.7853982F, 0.6632251F); - bomb = new ModelRenderer(this, 0, 8); - bomb.addBox(-1F, -1F, -1F, 3, 3, 3); - bomb.setRotationPoint(2F, 2F, -1F); - bomb.setTextureSize(64, 64); - bomb.mirror = true; - setRotation(bomb, 0F, 0.1396263F, 0F); - fuse = new ModelRenderer(this, 6, 2); - fuse.addBox(1F, -2F, 0F, 2, 3, 1); - fuse.setRotationPoint(2F, 2F, -1F); - fuse.setTextureSize(64, 64); - fuse.mirror = true; - setRotation(fuse, 0F, 0.1396263F, 0F); - } - - @Override -public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - renderModel(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void renderModel(float f) - { - top.render(f); - FRleg.render(f); - bottom.render(f); - BRleg.render(f); - BLleg.render(f); - FLleg.render(f); - box.render(f); - casing.render(f); - powder.render(f); - bomb.render(f); - fuse.render(f); - } + public ModelBombBench() { + textureWidth = 64; + textureHeight = 64; + + top = new ModelRenderer(this, 0, 0); + top.addBox(-8F, 4F, -8F, 16, 4, 16); + top.setRotationPoint(0F, 0F, 0F); + top.setTextureSize(64, 64); + top.mirror = true; + setRotation(top, 0F, 0F, 0F); + FRleg = new ModelRenderer(this, 0, 35); + FRleg.addBox(3F, 8F, -7F, 4, 12, 4); + FRleg.setRotationPoint(0F, 0F, 0F); + FRleg.setTextureSize(64, 64); + FRleg.mirror = true; + setRotation(FRleg, 0F, 0F, 0F); + bottom = new ModelRenderer(this, 0, 20); + bottom.addBox(-6.5F, 14F, -6.5F, 13, 2, 13); + bottom.setRotationPoint(0F, 0F, 0F); + bottom.setTextureSize(64, 64); + bottom.mirror = true; + setRotation(bottom, 0F, 0F, 0F); + BRleg = new ModelRenderer(this, 0, 35); + BRleg.addBox(3F, 8F, 3F, 4, 12, 4); + BRleg.setRotationPoint(0F, 0F, 0F); + BRleg.setTextureSize(64, 64); + BRleg.mirror = true; + setRotation(BRleg, 0F, 0F, 0F); + BLleg = new ModelRenderer(this, 0, 35); + BLleg.addBox(-7F, 8F, 3F, 4, 12, 4); + BLleg.setRotationPoint(0F, 0F, 0F); + BLleg.setTextureSize(64, 64); + BLleg.mirror = true; + setRotation(BLleg, 0F, 0F, 0F); + FLleg = new ModelRenderer(this, 0, 35); + FLleg.addBox(-7F, 8F, -7F, 4, 12, 4); + FLleg.setRotationPoint(0F, 0F, 0F); + FLleg.setTextureSize(64, 64); + FLleg.mirror = true; + setRotation(FLleg, 0F, 0F, 0F); + box = new ModelRenderer(this, 0, 51); + box.addBox(-3F, -1F, -2F, 6, 3, 4); + box.setRotationPoint(0F, 12F, 0F); + box.setTextureSize(64, 64); + box.mirror = true; + setRotation(box, 0F, 0.1396263F, 0F); + casing = new ModelRenderer(this, 0, 20); + casing.addBox(-1F, -1F, -1F, 3, 2, 3); + casing.setRotationPoint(-2F, 3F, -5F); + casing.setTextureSize(64, 64); + casing.mirror = true; + setRotation(casing, 0F, -0.418879F, 0F); + powder = new ModelRenderer(this, 0, 0); + powder.addBox(-2F, -2F, -2F, 4, 4, 4); + powder.setRotationPoint(-2F, 4.5F, 0F); + powder.setTextureSize(64, 64); + powder.mirror = true; + setRotation(powder, 0.7853982F, 0.7853982F, 0.6632251F); + bomb = new ModelRenderer(this, 0, 8); + bomb.addBox(-1F, -1F, -1F, 3, 3, 3); + bomb.setRotationPoint(2F, 2F, -1F); + bomb.setTextureSize(64, 64); + bomb.mirror = true; + setRotation(bomb, 0F, 0.1396263F, 0F); + fuse = new ModelRenderer(this, 6, 2); + fuse.addBox(1F, -2F, 0F, 2, 3, 1); + fuse.setRotationPoint(2F, 2F, -1F); + fuse.setTextureSize(64, 64); + fuse.mirror = true; + setRotation(fuse, 0F, 0.1396263F, 0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + renderModel(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderModel(float f) { + top.render(f); + FRleg.render(f); + bottom.render(f); + BRleg.render(f); + BLleg.render(f); + FLleg.render(f); + box.render(f); + casing.render(f); + powder.render(f); + bomb.render(f); + fuse.render(f); + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelBombPress.java b/src/main/java/minefantasy/mf2/client/render/block/ModelBombPress.java index 55b0ffd0..02917532 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelBombPress.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelBombPress.java @@ -5,15 +5,13 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelBombPress extends ModelBase -{ - ModelRenderer frame3; +public class ModelBombPress extends ModelBase { + ModelRenderer frame3; ModelRenderer socket; ModelRenderer frame2; ModelRenderer Leg2; @@ -23,93 +21,90 @@ public class ModelBombPress extends ModelBase ModelRenderer body; ModelRenderer Leg1; ModelRenderer Lever; - - public ModelBombPress() - { - textureWidth = 64; - textureHeight = 32; - - frame4 = new ModelRenderer(this, 0, 0); - frame4.addBox(-8F, 2F, 7F, 16, 2, 1); - frame4.setRotationPoint(0F, 0F, 0F); - frame4.setTextureSize(64, 32); - setRotation(frame4, 0F, 1.570796F, 0F); - socket = new ModelRenderer(this, 0, 21); - socket.addBox(-1F, 5F, -1F, 2, 3, 2); - socket.setRotationPoint(0F, 0F, 0F); - socket.setTextureSize(64, 32); - setRotation(socket, 0F, 0F, 0F); - frame2 = new ModelRenderer(this, 0, 0); - frame2.addBox(-8F, 0F, -6F, 16, 2, 1); - frame2.setRotationPoint(0F, 0F, 0F); - frame2.setTextureSize(64, 32); - setRotation(frame2, 0F, 0F, 0F); - Leg2 = new ModelRenderer(this, 0, 3); - Leg2.addBox(-7F, 2F, 3F, 3, 14, 4); - Leg2.setRotationPoint(0F, 0F, 0F); - Leg2.setTextureSize(64, 32); - setRotation(Leg2, 0F, 0F, 0F); - frame3 = new ModelRenderer(this, 0, 0); - frame3.addBox(-8F, 2F, -8F, 16, 2, 1); - frame3.setRotationPoint(0F, 0F, 0F); - frame3.setTextureSize(64, 32); - setRotation(frame3, 0F, 1.570796F, 0F); - handle = new ModelRenderer(this, 32, 16); - handle.addBox(-0.5F, 9.5F, -1.5F, 2, 3, 2); - handle.setRotationPoint(7F, 3F, 6F); - handle.setTextureSize(64, 32); - setRotation(handle, -1.308997F, 0F, 0F); - frame1 = new ModelRenderer(this, 0, 0); - frame1.addBox(-8F, 0F, 5F, 16, 2, 1); - frame1.setRotationPoint(0F, 0F, 0F); - frame1.setTextureSize(64, 32); - setRotation(frame1, 0F, 0F, 0F); - body = new ModelRenderer(this, 14, 3); - body.addBox(-2F, -5F, -5F, 4, 10, 5); - body.setRotationPoint(0F, 0F, 0F); - body.setTextureSize(64, 32); - setRotation(body, 1.570796F, 0F, 0F); - Leg1 = new ModelRenderer(this, 0, 3); - Leg1.addBox(4F, 2F, 3F, 3, 14, 4); - Leg1.setRotationPoint(0F, 0F, 0F); - Leg1.setTextureSize(64, 32); - setRotation(Leg1, 0F, 0F, 0F); - Leg1.mirror = false; - Lever = new ModelRenderer(this, 32, 3); - Lever.addBox(0F, 0F, -1F, 1, 12, 1); - Lever.setRotationPoint(7F, 3F, 6F); - Lever.setTextureSize(64, 32); - setRotation(Lever, -1.308997F, 0F, 0F); - } - - @Override -public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - renderModel(f5, 0F); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void renderModel(float f, float f2) - { - Lever.rotateAngleX = handle.rotateAngleX = -0.75F + (0.55F*f2); - frame1.rotationPointY = frame2.rotationPointY = frame3.rotationPointY = frame4.rotationPointY = socket.rotationPointY = body.rotationPointY = (12F*f2); - frame3.render(f); - socket.render(f); - frame2.render(f); - Leg2.render(f); - frame4.render(f); - handle.render(f); - frame1.render(f); - body.render(f); - Leg1.render(f); - Lever.render(f); - } + public ModelBombPress() { + textureWidth = 64; + textureHeight = 32; + + frame4 = new ModelRenderer(this, 0, 0); + frame4.addBox(-8F, 2F, 7F, 16, 2, 1); + frame4.setRotationPoint(0F, 0F, 0F); + frame4.setTextureSize(64, 32); + setRotation(frame4, 0F, 1.570796F, 0F); + socket = new ModelRenderer(this, 0, 21); + socket.addBox(-1F, 5F, -1F, 2, 3, 2); + socket.setRotationPoint(0F, 0F, 0F); + socket.setTextureSize(64, 32); + setRotation(socket, 0F, 0F, 0F); + frame2 = new ModelRenderer(this, 0, 0); + frame2.addBox(-8F, 0F, -6F, 16, 2, 1); + frame2.setRotationPoint(0F, 0F, 0F); + frame2.setTextureSize(64, 32); + setRotation(frame2, 0F, 0F, 0F); + Leg2 = new ModelRenderer(this, 0, 3); + Leg2.addBox(-7F, 2F, 3F, 3, 14, 4); + Leg2.setRotationPoint(0F, 0F, 0F); + Leg2.setTextureSize(64, 32); + setRotation(Leg2, 0F, 0F, 0F); + frame3 = new ModelRenderer(this, 0, 0); + frame3.addBox(-8F, 2F, -8F, 16, 2, 1); + frame3.setRotationPoint(0F, 0F, 0F); + frame3.setTextureSize(64, 32); + setRotation(frame3, 0F, 1.570796F, 0F); + handle = new ModelRenderer(this, 32, 16); + handle.addBox(-0.5F, 9.5F, -1.5F, 2, 3, 2); + handle.setRotationPoint(7F, 3F, 6F); + handle.setTextureSize(64, 32); + setRotation(handle, -1.308997F, 0F, 0F); + frame1 = new ModelRenderer(this, 0, 0); + frame1.addBox(-8F, 0F, 5F, 16, 2, 1); + frame1.setRotationPoint(0F, 0F, 0F); + frame1.setTextureSize(64, 32); + setRotation(frame1, 0F, 0F, 0F); + body = new ModelRenderer(this, 14, 3); + body.addBox(-2F, -5F, -5F, 4, 10, 5); + body.setRotationPoint(0F, 0F, 0F); + body.setTextureSize(64, 32); + setRotation(body, 1.570796F, 0F, 0F); + Leg1 = new ModelRenderer(this, 0, 3); + Leg1.addBox(4F, 2F, 3F, 3, 14, 4); + Leg1.setRotationPoint(0F, 0F, 0F); + Leg1.setTextureSize(64, 32); + setRotation(Leg1, 0F, 0F, 0F); + Leg1.mirror = false; + Lever = new ModelRenderer(this, 32, 3); + Lever.addBox(0F, 0F, -1F, 1, 12, 1); + Lever.setRotationPoint(7F, 3F, 6F); + Lever.setTextureSize(64, 32); + setRotation(Lever, -1.308997F, 0F, 0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + renderModel(f5, 0F); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderModel(float f, float f2) { + Lever.rotateAngleX = handle.rotateAngleX = -0.75F + (0.55F * f2); + frame1.rotationPointY = frame2.rotationPointY = frame3.rotationPointY = frame4.rotationPointY = socket.rotationPointY = body.rotationPointY = (12F + * f2); + frame3.render(f); + socket.render(f); + frame2.render(f); + Leg2.render(f); + frame4.render(f); + handle.render(f); + frame1.render(f); + body.render(f); + Leg1.render(f); + Lever.render(f); + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelCarpenter.java b/src/main/java/minefantasy/mf2/client/render/block/ModelCarpenter.java index 393f39a0..eac60753 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelCarpenter.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelCarpenter.java @@ -5,92 +5,86 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelCarpenter extends ModelBase -{ - //fields - ModelRenderer leg4; +public class ModelCarpenter extends ModelBase { + // fields + ModelRenderer leg4; ModelRenderer top; ModelRenderer bottom; ModelRenderer leg3; ModelRenderer leg1; ModelRenderer leg2; - - public ModelCarpenter() - { - textureWidth = 64; - textureHeight = 64; - - leg4 = new ModelRenderer(this, 0, 35); - leg4.addBox(3F, 4F, 3F, 4, 12, 4); - leg4.setRotationPoint(0F, 0F, 0F); - leg4.setTextureSize(64, 64); - leg4.mirror = true; - setRotation(leg4, 0F, 0F, 0F); - top = new ModelRenderer(this, 0, 0); - top.addBox(-8F, 0F, -8F, 16, 4, 16); - top.setRotationPoint(0F, 0F, 0F); - top.setTextureSize(64, 64); - top.mirror = true; - setRotation(top, 0F, 0F, 0F); - bottom = new ModelRenderer(this, 0, 20); - bottom.addBox(-6.5F, 11F, -6.5F, 13, 2, 13); - bottom.setRotationPoint(0F, 0F, 0F); - bottom.setTextureSize(64, 64); - bottom.mirror = true; - setRotation(bottom, 0F, 0F, 0F); - leg3 = new ModelRenderer(this, 0, 35); - leg3.addBox(-7F, 4F, 3F, 4, 12, 4); - leg3.setRotationPoint(0F, 0F, 0F); - leg3.setTextureSize(64, 64); - leg3.mirror = true; - setRotation(leg3, 0F, 0F, 0F); - leg1 = new ModelRenderer(this, 0, 35); - leg1.addBox(-7F, 4F, -7F, 4, 12, 4); - leg1.setRotationPoint(0F, 0F, 0F); - leg1.setTextureSize(64, 64); - leg1.mirror = true; - setRotation(leg1, 0F, 0F, 0F); - leg2 = new ModelRenderer(this, 0, 35); - leg2.addBox(3F, 4F, -7F, 4, 12, 4); - leg2.setRotationPoint(0F, 0F, 0F); - leg2.setTextureSize(64, 64); - leg2.mirror = true; - setRotation(leg2, 0F, 0F, 0F); - } - - @Override -public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - top.render(f5); - bottom.render(f5); - leg1.render(f5); - leg2.render(f5); - leg3.render(f5); - leg4.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void renderModel(float f) - { - top.render(f); - bottom.render(f); - leg1.render(f); - leg2.render(f); - leg3.render(f); - leg4.render(f); - } + public ModelCarpenter() { + textureWidth = 64; + textureHeight = 64; + + leg4 = new ModelRenderer(this, 0, 35); + leg4.addBox(3F, 4F, 3F, 4, 12, 4); + leg4.setRotationPoint(0F, 0F, 0F); + leg4.setTextureSize(64, 64); + leg4.mirror = true; + setRotation(leg4, 0F, 0F, 0F); + top = new ModelRenderer(this, 0, 0); + top.addBox(-8F, 0F, -8F, 16, 4, 16); + top.setRotationPoint(0F, 0F, 0F); + top.setTextureSize(64, 64); + top.mirror = true; + setRotation(top, 0F, 0F, 0F); + bottom = new ModelRenderer(this, 0, 20); + bottom.addBox(-6.5F, 11F, -6.5F, 13, 2, 13); + bottom.setRotationPoint(0F, 0F, 0F); + bottom.setTextureSize(64, 64); + bottom.mirror = true; + setRotation(bottom, 0F, 0F, 0F); + leg3 = new ModelRenderer(this, 0, 35); + leg3.addBox(-7F, 4F, 3F, 4, 12, 4); + leg3.setRotationPoint(0F, 0F, 0F); + leg3.setTextureSize(64, 64); + leg3.mirror = true; + setRotation(leg3, 0F, 0F, 0F); + leg1 = new ModelRenderer(this, 0, 35); + leg1.addBox(-7F, 4F, -7F, 4, 12, 4); + leg1.setRotationPoint(0F, 0F, 0F); + leg1.setTextureSize(64, 64); + leg1.mirror = true; + setRotation(leg1, 0F, 0F, 0F); + leg2 = new ModelRenderer(this, 0, 35); + leg2.addBox(3F, 4F, -7F, 4, 12, 4); + leg2.setRotationPoint(0F, 0F, 0F); + leg2.setTextureSize(64, 64); + leg2.mirror = true; + setRotation(leg2, 0F, 0F, 0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + top.render(f5); + bottom.render(f5); + leg1.render(f5); + leg2.render(f5); + leg3.render(f5); + leg4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderModel(float f) { + top.render(f); + bottom.render(f); + leg1.render(f); + leg2.render(f); + leg3.render(f); + leg4.render(f); + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelCrossbowBench.java b/src/main/java/minefantasy/mf2/client/render/block/ModelCrossbowBench.java index 39443eff..73b41263 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelCrossbowBench.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelCrossbowBench.java @@ -5,16 +5,14 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelCrossbowBench extends ModelBase -{ - //fields - ModelRenderer top; +public class ModelCrossbowBench extends ModelBase { + // fields + ModelRenderer top; ModelRenderer FRleg; ModelRenderer bottom; ModelRenderer BRleg; @@ -24,104 +22,101 @@ public class ModelCrossbowBench extends ModelBase ModelRenderer stock; ModelRenderer arms; ModelRenderer chest; - - public ModelCrossbowBench() - { - textureWidth = 64; - textureHeight = 64; - - top = new ModelRenderer(this, 0, 0); - top.addBox(-8F, 4F, -8F, 16, 4, 16); - top.setRotationPoint(0F, 0F, 0F); - top.setTextureSize(64, 64); - top.mirror = true; - setRotation(top, 0F, 0F, 0F); - FRleg = new ModelRenderer(this, 0, 35); - FRleg.addBox(3F, 8F, -7F, 4, 12, 4); - FRleg.setRotationPoint(0F, 0F, 0F); - FRleg.setTextureSize(64, 64); - FRleg.mirror = true; - setRotation(FRleg, 0F, 0F, 0F); - bottom = new ModelRenderer(this, 0, 20); - bottom.addBox(-6.5F, 14F, -6.5F, 13, 2, 13); - bottom.setRotationPoint(0F, 0F, 0F); - bottom.setTextureSize(64, 64); - bottom.mirror = true; - setRotation(bottom, 0F, 0F, 0F); - BRleg = new ModelRenderer(this, 0, 35); - BRleg.addBox(3F, 8F, 3F, 4, 12, 4); - BRleg.setRotationPoint(0F, 0F, 0F); - BRleg.setTextureSize(64, 64); - BRleg.mirror = true; - setRotation(BRleg, 0F, 0F, 0F); - BLleg = new ModelRenderer(this, 0, 35); - BLleg.addBox(-7F, 8F, 3F, 4, 12, 4); - BLleg.setRotationPoint(0F, 0F, 0F); - BLleg.setTextureSize(64, 64); - BLleg.mirror = true; - setRotation(BLleg, 0F, 0F, 0F); - FLleg = new ModelRenderer(this, 0, 35); - FLleg.addBox(-7F, 8F, -7F, 4, 12, 4); - FLleg.setRotationPoint(0F, 0F, 0F); - FLleg.setTextureSize(64, 64); - FLleg.mirror = true; - setRotation(FLleg, 0F, 0F, 0F); - - shaft = new ModelRenderer(this, 0, 56); - shaft.addBox(-3F, -1F, -0.9666666F, 6, 1, 2); - shaft.setRotationPoint(-2F, 3F, -2F); - shaft.setTextureSize(64, 64); - shaft.mirror = true; - setRotation(shaft, 0F, 0F, 0F); - - stock = new ModelRenderer(this, 0, 59); - stock.addBox(-3F, -2F, -1F, 6, 3, 2); - stock.setRotationPoint(4F, 3F, -2F); - stock.setTextureSize(64, 64); - stock.mirror = true; - setRotation(stock, 0F, 0F, 0F); - - arms = new ModelRenderer(this, 0, 54); - arms.addBox(-5F, 0F, 0F, 10, 1, 1); - arms.setRotationPoint(-5F, 1F, -2F); - arms.setTextureSize(64, 64); - arms.mirror = true; - setRotation(arms, 0F, 1.570796F, 0F); - - chest = new ModelRenderer(this, 16, 35); - chest.addBox(-3F, 0F, -2F, 6, 3, 4); - chest.setRotationPoint(4F, 1F, 5F); - chest.setTextureSize(64, 64); - chest.mirror = true; - setRotation(chest, 0F, 0.3316126F, 0F); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - renderModel(f5); - } - public void renderModel(float f) - { - top.render(f); - bottom.render(f); - FLleg.render(f); - BLleg.render(f); - FRleg.render(f); - BRleg.render(f); - shaft.render(f); - stock.render(f); - arms.render(f); - chest.render(f); - - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + + public ModelCrossbowBench() { + textureWidth = 64; + textureHeight = 64; + + top = new ModelRenderer(this, 0, 0); + top.addBox(-8F, 4F, -8F, 16, 4, 16); + top.setRotationPoint(0F, 0F, 0F); + top.setTextureSize(64, 64); + top.mirror = true; + setRotation(top, 0F, 0F, 0F); + FRleg = new ModelRenderer(this, 0, 35); + FRleg.addBox(3F, 8F, -7F, 4, 12, 4); + FRleg.setRotationPoint(0F, 0F, 0F); + FRleg.setTextureSize(64, 64); + FRleg.mirror = true; + setRotation(FRleg, 0F, 0F, 0F); + bottom = new ModelRenderer(this, 0, 20); + bottom.addBox(-6.5F, 14F, -6.5F, 13, 2, 13); + bottom.setRotationPoint(0F, 0F, 0F); + bottom.setTextureSize(64, 64); + bottom.mirror = true; + setRotation(bottom, 0F, 0F, 0F); + BRleg = new ModelRenderer(this, 0, 35); + BRleg.addBox(3F, 8F, 3F, 4, 12, 4); + BRleg.setRotationPoint(0F, 0F, 0F); + BRleg.setTextureSize(64, 64); + BRleg.mirror = true; + setRotation(BRleg, 0F, 0F, 0F); + BLleg = new ModelRenderer(this, 0, 35); + BLleg.addBox(-7F, 8F, 3F, 4, 12, 4); + BLleg.setRotationPoint(0F, 0F, 0F); + BLleg.setTextureSize(64, 64); + BLleg.mirror = true; + setRotation(BLleg, 0F, 0F, 0F); + FLleg = new ModelRenderer(this, 0, 35); + FLleg.addBox(-7F, 8F, -7F, 4, 12, 4); + FLleg.setRotationPoint(0F, 0F, 0F); + FLleg.setTextureSize(64, 64); + FLleg.mirror = true; + setRotation(FLleg, 0F, 0F, 0F); + + shaft = new ModelRenderer(this, 0, 56); + shaft.addBox(-3F, -1F, -0.9666666F, 6, 1, 2); + shaft.setRotationPoint(-2F, 3F, -2F); + shaft.setTextureSize(64, 64); + shaft.mirror = true; + setRotation(shaft, 0F, 0F, 0F); + + stock = new ModelRenderer(this, 0, 59); + stock.addBox(-3F, -2F, -1F, 6, 3, 2); + stock.setRotationPoint(4F, 3F, -2F); + stock.setTextureSize(64, 64); + stock.mirror = true; + setRotation(stock, 0F, 0F, 0F); + + arms = new ModelRenderer(this, 0, 54); + arms.addBox(-5F, 0F, 0F, 10, 1, 1); + arms.setRotationPoint(-5F, 1F, -2F); + arms.setTextureSize(64, 64); + arms.mirror = true; + setRotation(arms, 0F, 1.570796F, 0F); + + chest = new ModelRenderer(this, 16, 35); + chest.addBox(-3F, 0F, -2F, 6, 3, 4); + chest.setRotationPoint(4F, 1F, 5F); + chest.setTextureSize(64, 64); + chest.mirror = true; + setRotation(chest, 0F, 0.3316126F, 0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + renderModel(f5); + } + + public void renderModel(float f) { + top.render(f); + bottom.render(f); + FLleg.render(f); + BLleg.render(f); + FRleg.render(f); + BRleg.render(f); + shaft.render(f); + stock.render(f); + arms.render(f); + chest.render(f); + + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelEngTanningRack.java b/src/main/java/minefantasy/mf2/client/render/block/ModelEngTanningRack.java index 0e970e5a..10f7f49f 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelEngTanningRack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelEngTanningRack.java @@ -5,15 +5,14 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ public class ModelEngTanningRack extends ModelBase { - //fields - ModelRenderer side2; + // fields + ModelRenderer side2; ModelRenderer side1; ModelRenderer Blade2; ModelRenderer Top; @@ -21,79 +20,76 @@ public class ModelEngTanningRack extends ModelBase { ModelRenderer Blade; ModelRenderer Lever; ModelRenderer pivot; - - public ModelEngTanningRack() - { - textureWidth = 64; - textureHeight = 32; - - side2 = new ModelRenderer(this, 50, 0); - side2.addBox(6F, 5F, -2.5F, 2, 17, 5); - side2.setRotationPoint(0F, 0F, 0F); - side2.setTextureSize(64, 32); - setRotation(side2, 0F, 0F, 0F); - side1 = new ModelRenderer(this, 50, 0); - side1.addBox(-8F, 5F, -2.5F, 2, 17, 5); - side1.setRotationPoint(0F, 0F, 0F); - side1.setTextureSize(64, 32); - setRotation(side1, 0F, 0F, 0F); - Blade2 = new ModelRenderer(this, 26, 28); - Blade2.addBox(-6F, 1F, -0.5F, 12, 3, 1); - Blade2.setRotationPoint(0F, 4F, 1F); - Blade2.setTextureSize(64, 32); - setRotation(Blade2, -0.2443461F, 0F, 0F); - Top = new ModelRenderer(this, 0, 28); - Top.addBox(-6F, 5F, -0.5F, 12, 3, 1); - Top.setRotationPoint(0F, 0F, 0F); - Top.setTextureSize(64, 32); - setRotation(Top, 0F, 0F, 0F); - Base = new ModelRenderer(this, 0, 0); - Base.addBox(-8F, 22F, -3.5F, 16, 2, 6); - Base.setRotationPoint(0F, 0F, 0F); - Base.setTextureSize(64, 32); - setRotation(Base, 0F, 0F, 0F); - Blade = new ModelRenderer(this, 26, 28); - Blade.addBox(-6F, 1F, -0.5F, 12, 3, 1); - Blade.setRotationPoint(0F, 4F, -1F); - Blade.setTextureSize(64, 32); - setRotation(Blade, 0.2443461F, 0F, 0F); - Lever = new ModelRenderer(this, 0, 8); - Lever.addBox(-1F, 1F, -0.5F, 1, 10, 1); - Lever.setRotationPoint(5F, 5F, 0F); - Lever.setTextureSize(64, 32); - setRotation(Lever, 0F, 0F, 1.570796F); - pivot = new ModelRenderer(this, 4, 8); - pivot.addBox(-1.5F, -1F, -1F, 2, 2, 2); - pivot.setRotationPoint(5F, 5F, 0F); - pivot.setTextureSize(64, 32); - setRotation(pivot, 0F, 0F, 1.570796F); - } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public ModelEngTanningRack() { + textureWidth = 64; + textureHeight = 32; + + side2 = new ModelRenderer(this, 50, 0); + side2.addBox(6F, 5F, -2.5F, 2, 17, 5); + side2.setRotationPoint(0F, 0F, 0F); + side2.setTextureSize(64, 32); + setRotation(side2, 0F, 0F, 0F); + side1 = new ModelRenderer(this, 50, 0); + side1.addBox(-8F, 5F, -2.5F, 2, 17, 5); + side1.setRotationPoint(0F, 0F, 0F); + side1.setTextureSize(64, 32); + setRotation(side1, 0F, 0F, 0F); + Blade2 = new ModelRenderer(this, 26, 28); + Blade2.addBox(-6F, 1F, -0.5F, 12, 3, 1); + Blade2.setRotationPoint(0F, 4F, 1F); + Blade2.setTextureSize(64, 32); + setRotation(Blade2, -0.2443461F, 0F, 0F); + Top = new ModelRenderer(this, 0, 28); + Top.addBox(-6F, 5F, -0.5F, 12, 3, 1); + Top.setRotationPoint(0F, 0F, 0F); + Top.setTextureSize(64, 32); + setRotation(Top, 0F, 0F, 0F); + Base = new ModelRenderer(this, 0, 0); + Base.addBox(-8F, 22F, -3.5F, 16, 2, 6); + Base.setRotationPoint(0F, 0F, 0F); + Base.setTextureSize(64, 32); + setRotation(Base, 0F, 0F, 0F); + Blade = new ModelRenderer(this, 26, 28); + Blade.addBox(-6F, 1F, -0.5F, 12, 3, 1); + Blade.setRotationPoint(0F, 4F, -1F); + Blade.setTextureSize(64, 32); + setRotation(Blade, 0.2443461F, 0F, 0F); + Lever = new ModelRenderer(this, 0, 8); + Lever.addBox(-1F, 1F, -0.5F, 1, 10, 1); + Lever.setRotationPoint(5F, 5F, 0F); + Lever.setTextureSize(64, 32); + setRotation(Lever, 0F, 0F, 1.570796F); + pivot = new ModelRenderer(this, 4, 8); + pivot.addBox(-1.5F, -1F, -1F, 2, 2, 2); + pivot.setRotationPoint(5F, 5F, 0F); + pivot.setTextureSize(64, 32); + setRotation(pivot, 0F, 0F, 1.570796F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); renderModel(f5); } - public void renderModel(float f5) - { + public void renderModel(float f5) { Base.render(f5); Top.render(f5); side1.render(f5); side2.render(f5); } - public void renderBlade(float f5) - { + + public void renderBlade(float f5) { Blade.render(f5); Blade2.render(f5); } - public void rotateLever(float animation) - { - pivot.rotateAngleX = Lever.rotateAngleX = (float) Math.toRadians(animation*45F); + + public void rotateLever(float animation) { + pivot.rotateAngleX = Lever.rotateAngleX = (float) Math.toRadians(animation * 45F); } - public void renderLever(float f5) - { + + public void renderLever(float f5) { pivot.render(f5); Lever.render(f5); } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelFirepit.java b/src/main/java/minefantasy/mf2/client/render/block/ModelFirepit.java index 97f2ad62..255e0b6e 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelFirepit.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelFirepit.java @@ -1,98 +1,91 @@ package minefantasy.mf2.client.render.block; -import minefantasy.mf2.block.tileentity.TileEntityBloomery; import minefantasy.mf2.block.tileentity.TileEntityFirepit; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelFirepit extends ModelBase -{ - //fields - ModelRenderer Base; - ModelRenderer Plank1; - ModelRenderer Plank2; - ModelRenderer Plank3; - ModelRenderer Plank4; +public class ModelFirepit extends ModelBase { + // fields + ModelRenderer Base; + ModelRenderer Plank1; + ModelRenderer Plank2; + ModelRenderer Plank3; + ModelRenderer Plank4; ModelRenderer Pile; - - public ModelFirepit() - { - textureWidth = 64; - textureHeight = 32; - - Base = new ModelRenderer(this, 0, 15); - Pile = new ModelRenderer(this, 0, 6); - - Plank1 = new ModelRenderer(this, 24, 0); - Plank2 = new ModelRenderer(this, 24, 0); - Plank3 = new ModelRenderer(this, 0, 0); - Plank4 = new ModelRenderer(this, 0, 0); - - Base.addBox(-5F, 3F, -5F, 10, 3, 10); - Base.setRotationPoint(0F, 0F, 0F); - Base.setTextureSize(64, 32); - Base.mirror = true; - setRotation(Base, 0F, 0F, 0F); - Plank2.addBox(-1.5F, -1.5F, -4.5F, 3, 3, 9); - Plank2.setRotationPoint(0F, 3F, 5F); - Plank2.setTextureSize(64, 32); - Plank2.mirror = true; - Plank1.addBox(-1.5F, -1.5F, -4.5F, 3, 3, 9); - Plank1.setRotationPoint(0F, 3F, -5F); - Plank1.setTextureSize(64, 32); - Plank1.mirror = true; - Plank3.addBox(-4.5F, -1.5F, -1.5F, 9, 3, 3); - Plank3.setRotationPoint(-5F, 3F, 0F); - Plank3.setTextureSize(64, 32); - Plank3.mirror = true; - Plank4.addBox(-4.5F, -1.5F, -1.5F, 9, 3, 3); - Plank4.setRotationPoint(5F, 3F, 0F); - Plank4.setTextureSize(64, 32); - Plank4.mirror = true; - Pile.addBox(-3F, 0F, -3F, 6, 3, 6); - Pile.setRotationPoint(0F, 0F, 0F); - Pile.setTextureSize(64, 32); - Pile.mirror = true; - setRotation(Pile, 0F, 0F, 0F); - - float angle = 0.7853982F; - - setRotation(Plank1, angle, 0F, 0F); - setRotation(Plank2, -angle, 0F, 0F); - setRotation(Plank3, 0F, 0F, -angle); - setRotation(Plank4, 0F, 0F, angle); - } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - } - - public void renderModel(TileEntityFirepit pit, float f) - { - Base.render(f); - - if(pit == null || pit.fuel > 0) - { - Plank1.render(f); - Plank2.render(f); - Plank3.render(f); - Plank4.render(f); - Pile.render(f); - } - } + + public ModelFirepit() { + textureWidth = 64; + textureHeight = 32; + + Base = new ModelRenderer(this, 0, 15); + Pile = new ModelRenderer(this, 0, 6); + + Plank1 = new ModelRenderer(this, 24, 0); + Plank2 = new ModelRenderer(this, 24, 0); + Plank3 = new ModelRenderer(this, 0, 0); + Plank4 = new ModelRenderer(this, 0, 0); + + Base.addBox(-5F, 3F, -5F, 10, 3, 10); + Base.setRotationPoint(0F, 0F, 0F); + Base.setTextureSize(64, 32); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + Plank2.addBox(-1.5F, -1.5F, -4.5F, 3, 3, 9); + Plank2.setRotationPoint(0F, 3F, 5F); + Plank2.setTextureSize(64, 32); + Plank2.mirror = true; + Plank1.addBox(-1.5F, -1.5F, -4.5F, 3, 3, 9); + Plank1.setRotationPoint(0F, 3F, -5F); + Plank1.setTextureSize(64, 32); + Plank1.mirror = true; + Plank3.addBox(-4.5F, -1.5F, -1.5F, 9, 3, 3); + Plank3.setRotationPoint(-5F, 3F, 0F); + Plank3.setTextureSize(64, 32); + Plank3.mirror = true; + Plank4.addBox(-4.5F, -1.5F, -1.5F, 9, 3, 3); + Plank4.setRotationPoint(5F, 3F, 0F); + Plank4.setTextureSize(64, 32); + Plank4.mirror = true; + Pile.addBox(-3F, 0F, -3F, 6, 3, 6); + Pile.setRotationPoint(0F, 0F, 0F); + Pile.setTextureSize(64, 32); + Pile.mirror = true; + setRotation(Pile, 0F, 0F, 0F); + + float angle = 0.7853982F; + + setRotation(Plank1, angle, 0F, 0F); + setRotation(Plank2, -angle, 0F, 0F); + setRotation(Plank3, 0F, 0F, -angle); + setRotation(Plank4, 0F, 0F, angle); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + } + + public void renderModel(TileEntityFirepit pit, float f) { + Base.render(f); + + if (pit == null || pit.fuel > 0) { + Plank1.render(f); + Plank2.render(f); + Plank3.render(f); + Plank4.render(f); + Pile.render(f); + } + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelFoodBox.java b/src/main/java/minefantasy/mf2/client/render/block/ModelFoodBox.java index 2d826555..7bd4afe5 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelFoodBox.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelFoodBox.java @@ -1,66 +1,61 @@ package minefantasy.mf2.client.render.block; -import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelFoodBox extends ModelAmmoBox -{ - public ModelFoodBox() - { - textureWidth = 64; - textureHeight = 32; - - LeftWall = new ModelRenderer(this, 20, 0); - LeftWall.addBox(-4F, -2F, -2F, 1, 3, 4); - LeftWall.setRotationPoint(0F, 0F, 0F); - LeftWall.setTextureSize(64, 32); - setRotation(LeftWall, 0F, 0F, 0F); - FrontWall = new ModelRenderer(this, 0, 5); - FrontWall.addBox(-4F, -2F, -3F, 8, 3, 1); - FrontWall.setRotationPoint(0F, 0F, 0F); - FrontWall.setTextureSize(64, 32); - setRotation(FrontWall, 0F, 0F, 0F); - BackWall = new ModelRenderer(this, 0, 5); - BackWall.addBox(-4F, -2F, 2F, 8, 3, 1); - BackWall.setRotationPoint(0F, 0F, 0F); - BackWall.setTextureSize(64, 32); - setRotation(BackWall, 0F, 0F, 0F); - RightWall = new ModelRenderer(this, 20, 0); - RightWall.addBox(3F, -2F, -2F, 1, 3, 4); - RightWall.setRotationPoint(0F, 0F, 0F); - RightWall.setTextureSize(64, 32); - setRotation(RightWall, 0F, 0F, 0F); - lid = new ModelRenderer(this, 0, 11); - lid.addBox(-4F, -1F, -6F, 8, 1, 6); - lid.setRotationPoint(0F, -2F, 3F); - lid.setTextureSize(64, 32); - setRotation(lid, 0F, 0F, 0F); - Base = new ModelRenderer(this, 0, 0); - Base.addBox(-3F, 0F, -2F, 6, 1, 4); - Base.setRotationPoint(0F, 0F, 0F); - Base.setTextureSize(64, 32); - setRotation(Base, 0F, 0F, 0F); - lock1 = new ModelRenderer(this, 0, 0); - lock1.addBox(-0.5F, -1.5F, -6.5F, 1, 2, 1); - lock1.setRotationPoint(0F, -2F, 3F); - lock1.setTextureSize(64, 32); - setRotation(lock1, 0F, 0F, 0F); - +public class ModelFoodBox extends ModelAmmoBox { + public ModelFoodBox() { + textureWidth = 64; + textureHeight = 32; + + LeftWall = new ModelRenderer(this, 20, 0); + LeftWall.addBox(-4F, -2F, -2F, 1, 3, 4); + LeftWall.setRotationPoint(0F, 0F, 0F); + LeftWall.setTextureSize(64, 32); + setRotation(LeftWall, 0F, 0F, 0F); + FrontWall = new ModelRenderer(this, 0, 5); + FrontWall.addBox(-4F, -2F, -3F, 8, 3, 1); + FrontWall.setRotationPoint(0F, 0F, 0F); + FrontWall.setTextureSize(64, 32); + setRotation(FrontWall, 0F, 0F, 0F); + BackWall = new ModelRenderer(this, 0, 5); + BackWall.addBox(-4F, -2F, 2F, 8, 3, 1); + BackWall.setRotationPoint(0F, 0F, 0F); + BackWall.setTextureSize(64, 32); + setRotation(BackWall, 0F, 0F, 0F); + RightWall = new ModelRenderer(this, 20, 0); + RightWall.addBox(3F, -2F, -2F, 1, 3, 4); + RightWall.setRotationPoint(0F, 0F, 0F); + RightWall.setTextureSize(64, 32); + setRotation(RightWall, 0F, 0F, 0F); + lid = new ModelRenderer(this, 0, 11); + lid.addBox(-4F, -1F, -6F, 8, 1, 6); + lid.setRotationPoint(0F, -2F, 3F); + lid.setTextureSize(64, 32); + setRotation(lid, 0F, 0F, 0F); + Base = new ModelRenderer(this, 0, 0); + Base.addBox(-3F, 0F, -2F, 6, 1, 4); + Base.setRotationPoint(0F, 0F, 0F); + Base.setTextureSize(64, 32); + setRotation(Base, 0F, 0F, 0F); + lock1 = new ModelRenderer(this, 0, 0); + lock1.addBox(-0.5F, -1.5F, -6.5F, 1, 2, 1); + lock1.setRotationPoint(0F, -2F, 3F); + lock1.setTextureSize(64, 32); + setRotation(lock1, 0F, 0F, 0F); + RightWall.mirror = true; } + @Override - public void renderLid(float f, float angle) - { - lock1.rotateAngleX = lid.rotateAngleX = -(float)Math.toRadians(angle); - lid.render(f); - lock1.render(f); - } + public void renderLid(float f, float angle) { + lock1.rotateAngleX = lid.rotateAngleX = -(float) Math.toRadians(angle); + lid.render(f); + lock1.render(f); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelForge.java b/src/main/java/minefantasy/mf2/client/render/block/ModelForge.java index b7ae7ec4..b1e444ab 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelForge.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelForge.java @@ -6,153 +6,145 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. though small bits of - * code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelForge extends ModelBase -{ - // fields - ModelRenderer Back; - ModelRenderer Right; - ModelRenderer cornerBR; - ModelRenderer Left; - ModelRenderer Base; - ModelRenderer front; - ModelRenderer cornerBL; - ModelRenderer cornerFR; - ModelRenderer cornerFL; - ModelRenderer fuel; +public class ModelForge extends ModelBase { + // fields + ModelRenderer Back; + ModelRenderer Right; + ModelRenderer cornerBR; + ModelRenderer Left; + ModelRenderer Base; + ModelRenderer front; + ModelRenderer cornerBL; + ModelRenderer cornerFR; + ModelRenderer cornerFL; + ModelRenderer fuel; - public ModelForge() - { - textureWidth = 64; - textureHeight = 64; + public ModelForge() { + textureWidth = 64; + textureHeight = 64; - Back = new ModelRenderer(this, 0, 0); - Back.addBox(-6F, -6F, -8F, 12, 7, 2); - Back.setRotationPoint(0F, 22F, 0F); - Back.setTextureSize(64, 64); - Back.mirror = true; - setRotation(Back, 0F, 1.570796F, 0F); - Right = new ModelRenderer(this, 0, 0); - Right.addBox(-6F, -8F, -8F, 12, 7, 2); - Right.setRotationPoint(0F, 24F, 0F); - Right.setTextureSize(64, 64); - Right.mirror = true; - setRotation(Right, 0F, 3.154392F, 0F); - cornerBR = new ModelRenderer(this, 0, 9); - cornerBR.addBox(-8F, -7F, -8F, 2, 6, 2); - cornerBR.setRotationPoint(0F, 24F, 0F); - cornerBR.setTextureSize(64, 64); - cornerBR.mirror = true; - setRotation(cornerBR, 0F, 1.570796F, 0F); - Left = new ModelRenderer(this, 0, 0); - Left.addBox(-6F, -6F, -8F, 12, 7, 2); - Left.setRotationPoint(0F, 22F, 0F); - Left.setTextureSize(64, 64); - Left.mirror = true; - setRotation(Left, 0F, 0F, 0F); - Base = new ModelRenderer(this, 0, 15); - Base.addBox(-8F, 1F, -8F, 16, 1, 16); - Base.setRotationPoint(0F, 22F, 0F); - Base.setTextureSize(64, 64); - Base.mirror = true; - setRotation(Base, 0F, 0F, 0F); - front = new ModelRenderer(this, 0, 0); - front.addBox(-6F, -8F, -8F, 12, 7, 2); - front.setRotationPoint(0F, 24F, 0F); - front.setTextureSize(64, 64); - front.mirror = true; - setRotation(front, 0F, -1.570796F, 0F); - cornerBL = new ModelRenderer(this, 0, 9); - cornerBL.addBox(6F, -5F, -8F, 2, 6, 2); - cornerBL.setRotationPoint(0F, 22F, 0F); - cornerBL.setTextureSize(64, 64); - cornerBL.mirror = true; - setRotation(cornerBL, 0F, 1.570796F, 0F); - cornerFR = new ModelRenderer(this, 0, 9); - cornerFR.addBox(-8F, -7F, 6F, 2, 6, 2); - cornerFR.setRotationPoint(0F, 24F, 0F); - cornerFR.setTextureSize(64, 64); - cornerFR.mirror = true; - setRotation(cornerFR, 0F, 1.570796F, 0F); - cornerFL = new ModelRenderer(this, 0, 9); - cornerFL.addBox(6F, -7F, 6F, 2, 6, 2); - cornerFL.setRotationPoint(0F, 24F, 0F); - cornerFL.setTextureSize(64, 64); - cornerFL.mirror = true; - setRotation(cornerFL, 0F, 1.570796F, 0F); - fuel = new ModelRenderer(this, 32, 0); - fuel.addBox(-8F, -1F, -8F, 16, 0, 16); - fuel.addBox(-8F, -0.5F, -8F, 16, 0, 16); - fuel.addBox(-8F, -0F, -8F, 16, 0, 16); - fuel.setRotationPoint(0F, 18.5F, 0F); - fuel.setTextureSize(64, 64); - fuel.mirror = true; - setRotation(fuel, 0F, 0F, 0F); - } + Back = new ModelRenderer(this, 0, 0); + Back.addBox(-6F, -6F, -8F, 12, 7, 2); + Back.setRotationPoint(0F, 22F, 0F); + Back.setTextureSize(64, 64); + Back.mirror = true; + setRotation(Back, 0F, 1.570796F, 0F); + Right = new ModelRenderer(this, 0, 0); + Right.addBox(-6F, -8F, -8F, 12, 7, 2); + Right.setRotationPoint(0F, 24F, 0F); + Right.setTextureSize(64, 64); + Right.mirror = true; + setRotation(Right, 0F, 3.154392F, 0F); + cornerBR = new ModelRenderer(this, 0, 9); + cornerBR.addBox(-8F, -7F, -8F, 2, 6, 2); + cornerBR.setRotationPoint(0F, 24F, 0F); + cornerBR.setTextureSize(64, 64); + cornerBR.mirror = true; + setRotation(cornerBR, 0F, 1.570796F, 0F); + Left = new ModelRenderer(this, 0, 0); + Left.addBox(-6F, -6F, -8F, 12, 7, 2); + Left.setRotationPoint(0F, 22F, 0F); + Left.setTextureSize(64, 64); + Left.mirror = true; + setRotation(Left, 0F, 0F, 0F); + Base = new ModelRenderer(this, 0, 15); + Base.addBox(-8F, 1F, -8F, 16, 1, 16); + Base.setRotationPoint(0F, 22F, 0F); + Base.setTextureSize(64, 64); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + front = new ModelRenderer(this, 0, 0); + front.addBox(-6F, -8F, -8F, 12, 7, 2); + front.setRotationPoint(0F, 24F, 0F); + front.setTextureSize(64, 64); + front.mirror = true; + setRotation(front, 0F, -1.570796F, 0F); + cornerBL = new ModelRenderer(this, 0, 9); + cornerBL.addBox(6F, -5F, -8F, 2, 6, 2); + cornerBL.setRotationPoint(0F, 22F, 0F); + cornerBL.setTextureSize(64, 64); + cornerBL.mirror = true; + setRotation(cornerBL, 0F, 1.570796F, 0F); + cornerFR = new ModelRenderer(this, 0, 9); + cornerFR.addBox(-8F, -7F, 6F, 2, 6, 2); + cornerFR.setRotationPoint(0F, 24F, 0F); + cornerFR.setTextureSize(64, 64); + cornerFR.mirror = true; + setRotation(cornerFR, 0F, 1.570796F, 0F); + cornerFL = new ModelRenderer(this, 0, 9); + cornerFL.addBox(6F, -7F, 6F, 2, 6, 2); + cornerFL.setRotationPoint(0F, 24F, 0F); + cornerFL.setTextureSize(64, 64); + cornerFL.mirror = true; + setRotation(cornerFL, 0F, 1.570796F, 0F); + fuel = new ModelRenderer(this, 32, 0); + fuel.addBox(-8F, -1F, -8F, 16, 0, 16); + fuel.addBox(-8F, -0.5F, -8F, 16, 0, 16); + fuel.addBox(-8F, -0F, -8F, 16, 0, 16); + fuel.setRotationPoint(0F, 18.5F, 0F); + fuel.setTextureSize(64, 64); + fuel.mirror = true; + setRotation(fuel, 0F, 0F, 0F); + } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - Back.render(f5); - Right.render(f5); - cornerBR.render(f5); - Left.render(f5); - Base.render(f5); - front.render(f5); - cornerBL.render(f5); - cornerFR.render(f5); - cornerFL.render(f5); - fuel.render(f5); - } + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Back.render(f5); + Right.render(f5); + cornerBR.render(f5); + Left.render(f5); + Base.render(f5); + front.render(f5); + cornerBL.render(f5); + cornerFR.render(f5); + cornerFL.render(f5); + fuel.render(f5); + } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } - public void renderModel(TileEntityForge forge, float f, boolean hasFuel, float height) - { - boolean[] sides = new boolean[]{true, true, true, true}; - if(forge != null) - { - sides = forge.showSides(); - } + public void renderModel(TileEntityForge forge, float f, boolean hasFuel, float height) { + boolean[] sides = new boolean[]{true, true, true, true}; + if (forge != null) { + sides = forge.showSides(); + } - if (sides[0]) - front.render(f); + if (sides[0]) + front.render(f); - if (sides[1]) - Left.render(f); + if (sides[1]) + Left.render(f); - if (sides[2]) - Right.render(f); + if (sides[2]) + Right.render(f); - if (sides[3]) - Back.render(f); + if (sides[3]) + Back.render(f); - if (sides[3] || sides[2]) - cornerBR.render(f); + if (sides[3] || sides[2]) + cornerBR.render(f); - if (sides[3] || sides[1]) - cornerBL.render(f); + if (sides[3] || sides[1]) + cornerBL.render(f); - if (sides[0] || sides[2]) - cornerFR.render(f); + if (sides[0] || sides[2]) + cornerFR.render(f); - if (sides[0] || sides[1]) - cornerFL.render(f); - Base.render(f); - if(hasFuel) - { - fuel.offsetY = -height*0.3F +0.3F; - fuel.render(f); - } - } + if (sides[0] || sides[1]) + cornerFL.render(f); + Base.render(f); + if (hasFuel) { + fuel.offsetY = -height * 0.3F + 0.3F; + fuel.render(f); + } + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelForgeTop.java b/src/main/java/minefantasy/mf2/client/render/block/ModelForgeTop.java index 478063e0..48377958 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelForgeTop.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelForgeTop.java @@ -1,21 +1,18 @@ package minefantasy.mf2.client.render.block; -import minefantasy.mf2.block.tileentity.TileEntityForge; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. though small bits of - * code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelForgeTop extends ModelBase -{ - // fields - ModelRenderer Back; +public class ModelForgeTop extends ModelBase { + // fields + ModelRenderer Back; ModelRenderer Right; ModelRenderer cornerBR; ModelRenderer Left; @@ -24,89 +21,86 @@ public class ModelForgeTop extends ModelBase ModelRenderer cornerFR; ModelRenderer cornerFL; ModelRenderer Top; - - public ModelForgeTop() - { - textureWidth = 64; - textureHeight = 32; - - Back = new ModelRenderer(this, 0, 0); - Back.addBox(-4F, -5F, -6F, 8, 6, 2); - Back.setRotationPoint(0F, 22F, 0F); - Back.setTextureSize(64, 32); - Back.mirror = true; - setRotation(Back, 0F, 1.570796F, 0F); - Right = new ModelRenderer(this, 0, 0); - Right.addBox(-4F, -7F, -6F, 8, 6, 2); - Right.setRotationPoint(0F, 24F, 0F); - Right.setTextureSize(64, 32); - Right.mirror = true; - setRotation(Right, 0F, 3.154392F, 0F); - cornerBR = new ModelRenderer(this, 0, 8); - cornerBR.addBox(-6F, -13F, -6F, 2, 12, 2); - cornerBR.setRotationPoint(0F, 24F, 0F); - cornerBR.setTextureSize(64, 32); - cornerBR.mirror = true; - setRotation(cornerBR, 0F, 1.570796F, 0F); - Left = new ModelRenderer(this, 0, 0); - Left.addBox(-4F, -5F, -6F, 8, 6, 2); - Left.setRotationPoint(0F, 22F, 0F); - Left.setTextureSize(64, 32); - Left.mirror = true; - setRotation(Left, 0F, 0F, 0F); - front = new ModelRenderer(this, 0, 0); - front.addBox(-4F, -7F, -6F, 8, 6, 2); - front.setRotationPoint(0F, 24F, 0F); - front.setTextureSize(64, 32); - front.mirror = true; - setRotation(front, 0F, -1.570796F, 0F); - cornerBL = new ModelRenderer(this, 0, 8); - cornerBL.addBox(4F, -11F, -6F, 2, 12, 2); - cornerBL.setRotationPoint(0F, 22F, 0F); - cornerBL.setTextureSize(64, 32); - cornerBL.mirror = true; - setRotation(cornerBL, 0F, 1.570796F, 0F); - cornerFR = new ModelRenderer(this, 0, 8); - cornerFR.addBox(-6F, -13F, 4F, 2, 12, 2); - cornerFR.setRotationPoint(0F, 24F, 0F); - cornerFR.setTextureSize(64, 32); - cornerFR.mirror = true; - setRotation(cornerFR, 0F, 1.570796F, 0F); - cornerFL = new ModelRenderer(this, 0, 8); - cornerFL.addBox(4F, -13F, 4F, 2, 12, 2); - cornerFL.setRotationPoint(0F, 24F, 0F); - cornerFL.setTextureSize(64, 32); - cornerFL.mirror = true; - setRotation(cornerFL, 0F, 1.570796F, 0F); - Top = new ModelRenderer(this, 20, 0); - Top.addBox(-6F, -14F, -6F, 12, 3, 12); - Top.setRotationPoint(0F, 22F, 0F); - Top.setTextureSize(64, 32); - Top.mirror = true; - setRotation(Top, 0F, 0F, 0F); - } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - } - public void render(float f) - { - Back.render(f); - Right.render(f); - cornerBR.render(f); - Left.render(f); - front.render(f); - cornerBL.render(f); - cornerFR.render(f); - cornerFL.render(f); - Top.render(f); - } + public ModelForgeTop() { + textureWidth = 64; + textureHeight = 32; - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + Back = new ModelRenderer(this, 0, 0); + Back.addBox(-4F, -5F, -6F, 8, 6, 2); + Back.setRotationPoint(0F, 22F, 0F); + Back.setTextureSize(64, 32); + Back.mirror = true; + setRotation(Back, 0F, 1.570796F, 0F); + Right = new ModelRenderer(this, 0, 0); + Right.addBox(-4F, -7F, -6F, 8, 6, 2); + Right.setRotationPoint(0F, 24F, 0F); + Right.setTextureSize(64, 32); + Right.mirror = true; + setRotation(Right, 0F, 3.154392F, 0F); + cornerBR = new ModelRenderer(this, 0, 8); + cornerBR.addBox(-6F, -13F, -6F, 2, 12, 2); + cornerBR.setRotationPoint(0F, 24F, 0F); + cornerBR.setTextureSize(64, 32); + cornerBR.mirror = true; + setRotation(cornerBR, 0F, 1.570796F, 0F); + Left = new ModelRenderer(this, 0, 0); + Left.addBox(-4F, -5F, -6F, 8, 6, 2); + Left.setRotationPoint(0F, 22F, 0F); + Left.setTextureSize(64, 32); + Left.mirror = true; + setRotation(Left, 0F, 0F, 0F); + front = new ModelRenderer(this, 0, 0); + front.addBox(-4F, -7F, -6F, 8, 6, 2); + front.setRotationPoint(0F, 24F, 0F); + front.setTextureSize(64, 32); + front.mirror = true; + setRotation(front, 0F, -1.570796F, 0F); + cornerBL = new ModelRenderer(this, 0, 8); + cornerBL.addBox(4F, -11F, -6F, 2, 12, 2); + cornerBL.setRotationPoint(0F, 22F, 0F); + cornerBL.setTextureSize(64, 32); + cornerBL.mirror = true; + setRotation(cornerBL, 0F, 1.570796F, 0F); + cornerFR = new ModelRenderer(this, 0, 8); + cornerFR.addBox(-6F, -13F, 4F, 2, 12, 2); + cornerFR.setRotationPoint(0F, 24F, 0F); + cornerFR.setTextureSize(64, 32); + cornerFR.mirror = true; + setRotation(cornerFR, 0F, 1.570796F, 0F); + cornerFL = new ModelRenderer(this, 0, 8); + cornerFL.addBox(4F, -13F, 4F, 2, 12, 2); + cornerFL.setRotationPoint(0F, 24F, 0F); + cornerFL.setTextureSize(64, 32); + cornerFL.mirror = true; + setRotation(cornerFL, 0F, 1.570796F, 0F); + Top = new ModelRenderer(this, 20, 0); + Top.addBox(-6F, -14F, -6F, 12, 3, 12); + Top.setRotationPoint(0F, 22F, 0F); + Top.setTextureSize(64, 32); + Top.mirror = true; + setRotation(Top, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + } + + public void render(float f) { + Back.render(f); + Right.render(f); + cornerBR.render(f); + Left.render(f); + front.render(f); + cornerBL.render(f); + cornerFR.render(f); + cornerFL.render(f); + Top.render(f); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelOven.java b/src/main/java/minefantasy/mf2/client/render/block/ModelOven.java index cfe722f6..a73d884d 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelOven.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelOven.java @@ -1,102 +1,96 @@ package minefantasy.mf2.client.render.block; -import minefantasy.mf2.block.tileentity.TileEntityForge; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. though small bits of - * code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelOven extends ModelBase -{ - ModelRenderer top; +public class ModelOven extends ModelBase { + ModelRenderer top; ModelRenderer base; ModelRenderer right; ModelRenderer topfront; ModelRenderer left; ModelRenderer back; ModelRenderer front; - - public ModelOven() - { - float offsetY = 1F; - textureWidth = 64; - textureHeight = 32; - - top = new ModelRenderer(this, 24, 0); - top.addBox(-5F, -11F+offsetY, -5F, 10, 1, 10); - top.setRotationPoint(0F, 0F, 0F); - top.setTextureSize(64, 32); - top.mirror = true; - setRotation(top, 0F, 0F, 0F); - - base = new ModelRenderer(this, 24, 21); - base.addBox(-5F, offsetY, -5F, 10, 1, 10); - base.setRotationPoint(0F, 0F, 0F); - base.setTextureSize(64, 32); - base.mirror = true; - setRotation(base, 0F, 0F, 0F); - - right = new ModelRenderer(this, 0, 11); - right.addBox(-5F, -10F+offsetY, 5F, 10, 10, 1); - right.setRotationPoint(0F, 0F, 0F); - right.setTextureSize(64, 32); - right.mirror = true; - setRotation(right, 0F, 1.570796F, 0F); - - topfront = new ModelRenderer(this, 22, 11); - topfront.addBox(-5F, -10F+offsetY, -6F, 10, 2, 1); - topfront.setRotationPoint(0F, 0F, 0F); - topfront.setTextureSize(64, 32); - topfront.mirror = true; - setRotation(topfront, 0F, 0F, 0F); - - left = new ModelRenderer(this, 0, 11); - left.addBox(-5F, -10F+offsetY, 5F, 10, 10, 1); - left.setRotationPoint(0F, 0F, 0F); - left.setTextureSize(64, 32); - left.mirror = true; - setRotation(left, 0F, -1.570796F, 0F); - - back = new ModelRenderer(this, 0, 11); - back.addBox(-5F, -10F+offsetY, 5F, 10, 10, 1); - back.setRotationPoint(0F, 0F, 0F); - back.setTextureSize(64, 32); - back.mirror = true; - setRotation(back, 0F, 0F, 0F); - - front = new ModelRenderer(this, 22, 18); - front.addBox(-5F, -2F+offsetY, -6F, 10, 2, 1); - front.setRotationPoint(0F, 0F, 0F); - front.setTextureSize(64, 32); - front.mirror = true; - setRotation(front, 0F, 0F, 0F); - } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - } - public void render(float f) - { - top.render(f); - base.render(f); - right.render(f); - topfront.render(f); - left.render(f); - back.render(f); - front.render(f); - } + public ModelOven() { + float offsetY = 1F; + textureWidth = 64; + textureHeight = 32; - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + top = new ModelRenderer(this, 24, 0); + top.addBox(-5F, -11F + offsetY, -5F, 10, 1, 10); + top.setRotationPoint(0F, 0F, 0F); + top.setTextureSize(64, 32); + top.mirror = true; + setRotation(top, 0F, 0F, 0F); + + base = new ModelRenderer(this, 24, 21); + base.addBox(-5F, offsetY, -5F, 10, 1, 10); + base.setRotationPoint(0F, 0F, 0F); + base.setTextureSize(64, 32); + base.mirror = true; + setRotation(base, 0F, 0F, 0F); + + right = new ModelRenderer(this, 0, 11); + right.addBox(-5F, -10F + offsetY, 5F, 10, 10, 1); + right.setRotationPoint(0F, 0F, 0F); + right.setTextureSize(64, 32); + right.mirror = true; + setRotation(right, 0F, 1.570796F, 0F); + + topfront = new ModelRenderer(this, 22, 11); + topfront.addBox(-5F, -10F + offsetY, -6F, 10, 2, 1); + topfront.setRotationPoint(0F, 0F, 0F); + topfront.setTextureSize(64, 32); + topfront.mirror = true; + setRotation(topfront, 0F, 0F, 0F); + + left = new ModelRenderer(this, 0, 11); + left.addBox(-5F, -10F + offsetY, 5F, 10, 10, 1); + left.setRotationPoint(0F, 0F, 0F); + left.setTextureSize(64, 32); + left.mirror = true; + setRotation(left, 0F, -1.570796F, 0F); + + back = new ModelRenderer(this, 0, 11); + back.addBox(-5F, -10F + offsetY, 5F, 10, 10, 1); + back.setRotationPoint(0F, 0F, 0F); + back.setTextureSize(64, 32); + back.mirror = true; + setRotation(back, 0F, 0F, 0F); + + front = new ModelRenderer(this, 22, 18); + front.addBox(-5F, -2F + offsetY, -6F, 10, 2, 1); + front.setRotationPoint(0F, 0F, 0F); + front.setTextureSize(64, 32); + front.mirror = true; + setRotation(front, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + } + + public void render(float f) { + top.render(f); + base.render(f); + right.render(f); + topfront.render(f); + left.render(f); + back.render(f); + front.render(f); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelQuern.java b/src/main/java/minefantasy/mf2/client/render/block/ModelQuern.java index d3713c71..334dfa63 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelQuern.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelQuern.java @@ -6,61 +6,56 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelQuern extends ModelBase -{ - ModelRenderer base; +public class ModelQuern extends ModelBase { + ModelRenderer base; ModelRenderer top; ModelRenderer handle; ModelRenderer core; - - public ModelQuern() - { - textureWidth = 64; - textureHeight = 64; - - base = new ModelRenderer(this, 0, 0); - base.addBox(-8F, 3F, -8F, 16, 13, 16); - base.setRotationPoint(0F, 0F, 0F); - base.setTextureSize(64, 32); - - top = new ModelRenderer(this, 0, 29); - top.addBox(-6F, 2F, -6F, 12, 1, 12); - top.setRotationPoint(0F, 0F, 0F); - top.setTextureSize(64, 32); - - handle = new ModelRenderer(this, 48, 29); - handle.addBox(3F, 0F, -5F, 2, 2, 2); - handle.setRotationPoint(0F, 0F, 0F); - handle.setTextureSize(64, 32); - - core = new ModelRenderer(this, 48, 29); - core.addBox(-1, 0F, -1F, 2, 2, 2); - core.setRotationPoint(0F, 0F, 0F); - core.setTextureSize(64, 32); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - } - - public void renderModel(TileEntityQuern quern, float f) - { - if(quern != null) - { - top.rotateAngleY = handle.rotateAngleY = (float) (Math.PI * quern.turnAngle) / TileEntityQuern.getMaxRevs()*2; - } - - base.render(f); - top.render(f); - core.render(f); - handle.render(f); - } - + + public ModelQuern() { + textureWidth = 64; + textureHeight = 64; + + base = new ModelRenderer(this, 0, 0); + base.addBox(-8F, 3F, -8F, 16, 13, 16); + base.setRotationPoint(0F, 0F, 0F); + base.setTextureSize(64, 32); + + top = new ModelRenderer(this, 0, 29); + top.addBox(-6F, 2F, -6F, 12, 1, 12); + top.setRotationPoint(0F, 0F, 0F); + top.setTextureSize(64, 32); + + handle = new ModelRenderer(this, 48, 29); + handle.addBox(3F, 0F, -5F, 2, 2, 2); + handle.setRotationPoint(0F, 0F, 0F); + handle.setTextureSize(64, 32); + + core = new ModelRenderer(this, 48, 29); + core.addBox(-1, 0F, -1F, 2, 2, 2); + core.setRotationPoint(0F, 0F, 0F); + core.setTextureSize(64, 32); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + } + + public void renderModel(TileEntityQuern quern, float f) { + if (quern != null) { + top.rotateAngleY = handle.rotateAngleY = (float) (Math.PI * quern.turnAngle) / TileEntityQuern.getMaxRevs() + * 2; + } + + base.render(f); + top.render(f); + core.render(f); + handle.render(f); + } + } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelRack.java b/src/main/java/minefantasy/mf2/client/render/block/ModelRack.java index 4a541762..1b8d07ca 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelRack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelRack.java @@ -4,10 +4,9 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelRack extends ModelBase -{ - //fields - ModelRenderer rStrut; +public class ModelRack extends ModelBase { + // fields + ModelRenderer rStrut; ModelRenderer beam; ModelRenderer rack1; ModelRenderer lStrut; @@ -16,75 +15,72 @@ public class ModelRack extends ModelBase ModelRenderer dividerR; ModelRenderer divider2; ModelRenderer dividerL; - - public ModelRack() - { - textureWidth = 64; - textureHeight = 32; - - rStrut = new ModelRenderer(this, 0, 0); - rStrut.addBox(7F, 0F, 6F, 1, 16, 2); - rStrut.setRotationPoint(0F, 0F, 0F); - - beam = new ModelRenderer(this, 0, 29); - beam.addBox(-8F, 13F, 5F, 16, 1, 1); - beam.setRotationPoint(0F, 0F, 0F); - - rack1 = new ModelRenderer(this, 0, 29); - rack1.addBox(-8F, 3F, 5F, 16, 2, 1); - rack1.setRotationPoint(0F, 0F, 0F); - - lStrut = new ModelRenderer(this, 0, 0); - lStrut.addBox(-8F, 0F, 6F, 1, 16, 2); - lStrut.setRotationPoint(0F, 0F, 0F); - divider3 = new ModelRenderer(this, 0, 29); - divider3.addBox(3F, 4F, 3F, 2, 1, 2); - divider3.setRotationPoint(0F, 0F, 0F); - - divider1 = new ModelRenderer(this, 0, 29); - divider1.addBox(-1F, 4F, 3F, 2, 1, 2); - divider1.setRotationPoint(0F, 0F, 0F); - - dividerR = new ModelRenderer(this, 1, 29); - dividerR.addBox(7F, 4F, 3F, 1, 1, 2); - dividerR.setRotationPoint(0F, 0F, 0F); - - divider2 = new ModelRenderer(this, 0, 29); - divider2.addBox(-5F, 4F, 3F, 2, 1, 2); - divider2.setRotationPoint(0F, 0F, 0F); - - dividerL = new ModelRenderer(this, 0, 29); - dividerL.addBox(-8F, 4F, 3F, 1, 1, 2); - dividerL.setRotationPoint(0F, 0F, 0F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - rStrut.render(f5); - beam.render(f5); - rack1.render(f5); - lStrut.render(f5); - divider3.render(f5); - divider1.render(f5); - dividerR.render(f5); - divider2.render(f5); - dividerL.render(f5); - } - - public void renderModel(float scale) - { - rStrut.render(scale); - beam.render(scale); - rack1.render(scale); - lStrut.render(scale); - divider3.render(scale); - divider1.render(scale); - dividerR.render(scale); - divider2.render(scale); - dividerL.render(scale); - } + public ModelRack() { + textureWidth = 64; + textureHeight = 32; + + rStrut = new ModelRenderer(this, 0, 0); + rStrut.addBox(7F, 0F, 6F, 1, 16, 2); + rStrut.setRotationPoint(0F, 0F, 0F); + + beam = new ModelRenderer(this, 0, 29); + beam.addBox(-8F, 13F, 5F, 16, 1, 1); + beam.setRotationPoint(0F, 0F, 0F); + + rack1 = new ModelRenderer(this, 0, 29); + rack1.addBox(-8F, 3F, 5F, 16, 2, 1); + rack1.setRotationPoint(0F, 0F, 0F); + + lStrut = new ModelRenderer(this, 0, 0); + lStrut.addBox(-8F, 0F, 6F, 1, 16, 2); + lStrut.setRotationPoint(0F, 0F, 0F); + + divider3 = new ModelRenderer(this, 0, 29); + divider3.addBox(3F, 4F, 3F, 2, 1, 2); + divider3.setRotationPoint(0F, 0F, 0F); + + divider1 = new ModelRenderer(this, 0, 29); + divider1.addBox(-1F, 4F, 3F, 2, 1, 2); + divider1.setRotationPoint(0F, 0F, 0F); + + dividerR = new ModelRenderer(this, 1, 29); + dividerR.addBox(7F, 4F, 3F, 1, 1, 2); + dividerR.setRotationPoint(0F, 0F, 0F); + + divider2 = new ModelRenderer(this, 0, 29); + divider2.addBox(-5F, 4F, 3F, 2, 1, 2); + divider2.setRotationPoint(0F, 0F, 0F); + + dividerL = new ModelRenderer(this, 0, 29); + dividerL.addBox(-8F, 4F, 3F, 1, 1, 2); + dividerL.setRotationPoint(0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + rStrut.render(f5); + beam.render(f5); + rack1.render(f5); + lStrut.render(f5); + divider3.render(f5); + divider1.render(f5); + dividerR.render(f5); + divider2.render(f5); + dividerL.render(f5); + } + + public void renderModel(float scale) { + rStrut.render(scale); + beam.render(scale); + rack1.render(scale); + lStrut.render(scale); + divider3.render(scale); + divider1.render(scale); + dividerR.render(scale); + divider2.render(scale); + dividerL.render(scale); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelResearch.java b/src/main/java/minefantasy/mf2/client/render/block/ModelResearch.java index 66bd3696..a4d7a12a 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelResearch.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelResearch.java @@ -5,16 +5,14 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelResearch extends ModelBase -{ - //fields - ModelRenderer top; +public class ModelResearch extends ModelBase { + // fields + ModelRenderer top; ModelRenderer FRleg; ModelRenderer bottom; ModelRenderer BRleg; @@ -24,100 +22,97 @@ public class ModelResearch extends ModelBase ModelRenderer ink; ModelRenderer book; ModelRenderer papers; - - public ModelResearch() - { - textureWidth = 64; - textureHeight = 64; - - top = new ModelRenderer(this, 0, 0); - top.addBox(-8F, 4F, -8F, 16, 4, 16); - top.setRotationPoint(0F, 0F, 0F); - top.setTextureSize(64, 64); - top.mirror = true; - setRotation(top, 0F, 0F, 0F); - FRleg = new ModelRenderer(this, 0, 35); - FRleg.addBox(3F, 8F, -7F, 4, 12, 4); - FRleg.setRotationPoint(0F, 0F, 0F); - FRleg.setTextureSize(64, 64); - FRleg.mirror = true; - setRotation(FRleg, 0F, 0F, 0F); - bottom = new ModelRenderer(this, 0, 20); - bottom.addBox(-6.5F, 14F, -6.5F, 13, 2, 13); - bottom.setRotationPoint(0F, 0F, 0F); - bottom.setTextureSize(64, 64); - bottom.mirror = true; - setRotation(bottom, 0F, 0F, 0F); - BRleg = new ModelRenderer(this, 0, 35); - BRleg.addBox(3F, 8F, 3F, 4, 12, 4); - BRleg.setRotationPoint(0F, 0F, 0F); - BRleg.setTextureSize(64, 64); - BRleg.mirror = true; - setRotation(BRleg, 0F, 0F, 0F); - BLleg = new ModelRenderer(this, 0, 35); - BLleg.addBox(-7F, 8F, 3F, 4, 12, 4); - BLleg.setRotationPoint(0F, 0F, 0F); - BLleg.setTextureSize(64, 64); - BLleg.mirror = true; - setRotation(BLleg, 0F, 0F, 0F); - FLleg = new ModelRenderer(this, 0, 35); - FLleg.addBox(-7F, 8F, -7F, 4, 12, 4); - FLleg.setRotationPoint(0F, 0F, 0F); - FLleg.setTextureSize(64, 64); - FLleg.mirror = true; - setRotation(FLleg, 0F, 0F, 0F); - papers = new ModelRenderer(this, 0, 51); - papers.addBox(-3F, -1F, -4F, 6, 0, 8); - papers.setRotationPoint(0F, 4.5F, -2F); - papers.setTextureSize(64, 64); - papers.mirror = true; - setRotation(papers, 0F, 0.296706F, 0F); - ink = new ModelRenderer(this, 0, 0); - ink.addBox(-1F, -1F, -1F, 2, 2, 2); - ink.setRotationPoint(5F, 3F, 4F); - ink.setTextureSize(64, 64); - ink.mirror = true; - setRotation(ink, 0F, 0F, 0F); - book = new ModelRenderer(this, 16, 35); - book.addBox(-3F, -1F, -4F, 6, 3, 8); - book.setRotationPoint(-4F, 2F, 4F); - book.setTextureSize(64, 64); - book.mirror = true; - setRotation(book, 0F, -0.1396263F, 0F); - papers2 = new ModelRenderer(this, 0, 51); - papers2.addBox(-3F, -1F, -4F, 6, 1, 8); - papers2.setRotationPoint(0F, 14F, 0F); - papers2.setTextureSize(64, 64); - papers2.mirror = true; - setRotation(papers2, 0F, 0.6283185F, 0F); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - renderModel(f5); - } - public void renderModel(float f) - { - top.render(f); - bottom.render(f); - FLleg.render(f); - BLleg.render(f); - FRleg.render(f); - BRleg.render(f); - papers.render(f); - papers2.render(f); - ink.render(f); - book.render(f); - - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + + public ModelResearch() { + textureWidth = 64; + textureHeight = 64; + + top = new ModelRenderer(this, 0, 0); + top.addBox(-8F, 4F, -8F, 16, 4, 16); + top.setRotationPoint(0F, 0F, 0F); + top.setTextureSize(64, 64); + top.mirror = true; + setRotation(top, 0F, 0F, 0F); + FRleg = new ModelRenderer(this, 0, 35); + FRleg.addBox(3F, 8F, -7F, 4, 12, 4); + FRleg.setRotationPoint(0F, 0F, 0F); + FRleg.setTextureSize(64, 64); + FRleg.mirror = true; + setRotation(FRleg, 0F, 0F, 0F); + bottom = new ModelRenderer(this, 0, 20); + bottom.addBox(-6.5F, 14F, -6.5F, 13, 2, 13); + bottom.setRotationPoint(0F, 0F, 0F); + bottom.setTextureSize(64, 64); + bottom.mirror = true; + setRotation(bottom, 0F, 0F, 0F); + BRleg = new ModelRenderer(this, 0, 35); + BRleg.addBox(3F, 8F, 3F, 4, 12, 4); + BRleg.setRotationPoint(0F, 0F, 0F); + BRleg.setTextureSize(64, 64); + BRleg.mirror = true; + setRotation(BRleg, 0F, 0F, 0F); + BLleg = new ModelRenderer(this, 0, 35); + BLleg.addBox(-7F, 8F, 3F, 4, 12, 4); + BLleg.setRotationPoint(0F, 0F, 0F); + BLleg.setTextureSize(64, 64); + BLleg.mirror = true; + setRotation(BLleg, 0F, 0F, 0F); + FLleg = new ModelRenderer(this, 0, 35); + FLleg.addBox(-7F, 8F, -7F, 4, 12, 4); + FLleg.setRotationPoint(0F, 0F, 0F); + FLleg.setTextureSize(64, 64); + FLleg.mirror = true; + setRotation(FLleg, 0F, 0F, 0F); + papers = new ModelRenderer(this, 0, 51); + papers.addBox(-3F, -1F, -4F, 6, 0, 8); + papers.setRotationPoint(0F, 4.5F, -2F); + papers.setTextureSize(64, 64); + papers.mirror = true; + setRotation(papers, 0F, 0.296706F, 0F); + ink = new ModelRenderer(this, 0, 0); + ink.addBox(-1F, -1F, -1F, 2, 2, 2); + ink.setRotationPoint(5F, 3F, 4F); + ink.setTextureSize(64, 64); + ink.mirror = true; + setRotation(ink, 0F, 0F, 0F); + book = new ModelRenderer(this, 16, 35); + book.addBox(-3F, -1F, -4F, 6, 3, 8); + book.setRotationPoint(-4F, 2F, 4F); + book.setTextureSize(64, 64); + book.mirror = true; + setRotation(book, 0F, -0.1396263F, 0F); + papers2 = new ModelRenderer(this, 0, 51); + papers2.addBox(-3F, -1F, -4F, 6, 1, 8); + papers2.setRotationPoint(0F, 14F, 0F); + papers2.setTextureSize(64, 64); + papers2.mirror = true; + setRotation(papers2, 0F, 0.6283185F, 0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + renderModel(f5); + } + + public void renderModel(float f) { + top.render(f); + bottom.render(f); + FLleg.render(f); + BLleg.render(f); + FRleg.render(f); + BRleg.render(f); + papers.render(f); + papers2.render(f); + ink.render(f); + book.render(f); + + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelRoast.java b/src/main/java/minefantasy/mf2/client/render/block/ModelRoast.java index a86220dc..bd7f7cd9 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelRoast.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelRoast.java @@ -5,53 +5,51 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ public class ModelRoast extends ModelBase { - ModelRenderer side2B; + ModelRenderer side2B; ModelRenderer side1B; ModelRenderer Top; ModelRenderer side2; ModelRenderer side1; - - public ModelRoast() - { - textureWidth = 64; - textureHeight = 32; - - side2B = new ModelRenderer(this, 10, 4); - side1B = new ModelRenderer(this, 10, 4); - Top = new ModelRenderer(this, 0, 0); - side2 = new ModelRenderer(this, 0, 4); - side1 = new ModelRenderer(this, 0, 4); - - side2B.addBox(7F, 22F, -1.5F, 2, 17, 3); - side2B.setRotationPoint(0F, 2F, 0F); - side2B.setTextureSize(64, 32); - side2B.mirror = true; - side1B.mirror = true; - side1B.addBox(-9F, 22F, -1.5F, 2, 17, 3); - side1B.setRotationPoint(0F, 2F, 0F); - side1B.setTextureSize(64, 32); - side1B.mirror = true; - side1B.mirror = false; - Top.addBox(-8F, 12F, -1F, 16, 2, 2); - Top.setRotationPoint(0F, 2F, 0F); - Top.setTextureSize(64, 32); - Top.mirror = true; - side2.addBox(7F, 5F, -1.5F, 2, 17, 3); - side2.setRotationPoint(0F, 2F, 0F); - side2.setTextureSize(64, 32); - side2.mirror = true; - side1.addBox(-9F, 5F, -1.5F, 2, 17, 3); - side1.setRotationPoint(0F, 2F, 0F); - side1.setTextureSize(64, 32); - side1.mirror = true; - } + + public ModelRoast() { + textureWidth = 64; + textureHeight = 32; + + side2B = new ModelRenderer(this, 10, 4); + side1B = new ModelRenderer(this, 10, 4); + Top = new ModelRenderer(this, 0, 0); + side2 = new ModelRenderer(this, 0, 4); + side1 = new ModelRenderer(this, 0, 4); + + side2B.addBox(7F, 22F, -1.5F, 2, 17, 3); + side2B.setRotationPoint(0F, 2F, 0F); + side2B.setTextureSize(64, 32); + side2B.mirror = true; + side1B.mirror = true; + side1B.addBox(-9F, 22F, -1.5F, 2, 17, 3); + side1B.setRotationPoint(0F, 2F, 0F); + side1B.setTextureSize(64, 32); + side1B.mirror = true; + side1B.mirror = false; + Top.addBox(-8F, 12F, -1F, 16, 2, 2); + Top.setRotationPoint(0F, 2F, 0F); + Top.setTextureSize(64, 32); + Top.mirror = true; + side2.addBox(7F, 5F, -1.5F, 2, 17, 3); + side2.setRotationPoint(0F, 2F, 0F); + side2.setTextureSize(64, 32); + side2.mirror = true; + side1.addBox(-9F, 5F, -1.5F, 2, 17, 3); + side1.setRotationPoint(0F, 2F, 0F); + side1.setTextureSize(64, 32); + side1.mirror = true; + } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); @@ -61,26 +59,23 @@ public void render(Entity entity, float f, float f1, float f2, float f3, float f side2.render(f5); } - public void renderModel(float f5) - { - Top.render(f5); + public void renderModel(float f5) { + Top.render(f5); side1.render(f5); side2.render(f5); } - - public void renderModel(boolean L, boolean R, float scale, boolean base) - { - Top.render(scale); - if(L) - side1.render(scale); - if(R) - side2.render(scale); - if(base) - { - if(L) - side1B.render(scale); - if(R) - side2B.render(scale); - } - } + + public void renderModel(boolean L, boolean R, float scale, boolean base) { + Top.render(scale); + if (L) + side1.render(scale); + if (R) + side2.render(scale); + if (base) { + if (L) + side1B.render(scale); + if (R) + side2B.render(scale); + } + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelSmallCrate.java b/src/main/java/minefantasy/mf2/client/render/block/ModelSmallCrate.java index 9133af62..f9424585 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelSmallCrate.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelSmallCrate.java @@ -1,64 +1,59 @@ package minefantasy.mf2.client.render.block; -import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelSmallCrate extends ModelAmmoBox -{ - public ModelSmallCrate() - { - textureWidth = 64; - textureHeight = 32; - - LeftWall = new ModelRenderer(this, 40, 1); - LeftWall.addBox(-8F, -7F, -5F, 1, 7, 10); - LeftWall.setRotationPoint(0F, 0F, 0F); - LeftWall.setTextureSize(64, 32); - setRotation(LeftWall, 0F, 0F, 0F); - FrontWall = new ModelRenderer(this, 0, 10); - FrontWall.addBox(-7F, -7F, -6F, 14, 8, 1); - FrontWall.setRotationPoint(0F, 0F, 0F); - FrontWall.setTextureSize(64, 32); - setRotation(FrontWall, 0F, 0F, 0F); - BackWall = new ModelRenderer(this, 0, 10); - BackWall.addBox(-7F, -7F, 5F, 14, 8, 1); - BackWall.setRotationPoint(0F, 0F, 0F); - BackWall.setTextureSize(64, 32); - setRotation(BackWall, 0F, 0F, 0F); - RightWall = new ModelRenderer(this, 40, 1); - RightWall.addBox(7F, -7F, -5F, 1, 7, 10); - RightWall.setRotationPoint(0F, 0F, 0F); - RightWall.setTextureSize(64, 32); - setRotation(RightWall, 0F, 0F, 0F); - lid = new ModelRenderer(this, 0, 19); - lid.addBox(-7F, -1F, -12F, 14, 1, 12); - lid.setRotationPoint(0F, -7F, 6F); - lid.setTextureSize(64, 32); - setRotation(lid, 0F, 0F, 0F); - Base = new ModelRenderer(this, 0, 0); - Base.addBox(-7F, 0F, -5F, 14, 1, 10); - Base.setRotationPoint(0F, 0F, 0F); - Base.setTextureSize(64, 32); - setRotation(Base, 0F, 0F, 0F); - lock2 = new ModelRenderer(this, 0, 0); - lock2.addBox(2F, -1.5F, -12.5F, 2, 3, 2); - lock2.setRotationPoint(0F, -7F, 6F); - lock2.setTextureSize(64, 32); - setRotation(lock2, 0F, 0F, 0F); - lock1 = new ModelRenderer(this, 0, 0); - lock1.addBox(-4F, -1.5F, -12.5F, 2, 3, 2); - lock1.setRotationPoint(0F, -7F, 6F); - lock1.setTextureSize(64, 32); - setRotation(lock1, 0F, 0F, 0F); - +public class ModelSmallCrate extends ModelAmmoBox { + public ModelSmallCrate() { + textureWidth = 64; + textureHeight = 32; + + LeftWall = new ModelRenderer(this, 40, 1); + LeftWall.addBox(-8F, -7F, -5F, 1, 7, 10); + LeftWall.setRotationPoint(0F, 0F, 0F); + LeftWall.setTextureSize(64, 32); + setRotation(LeftWall, 0F, 0F, 0F); + FrontWall = new ModelRenderer(this, 0, 10); + FrontWall.addBox(-7F, -7F, -6F, 14, 8, 1); + FrontWall.setRotationPoint(0F, 0F, 0F); + FrontWall.setTextureSize(64, 32); + setRotation(FrontWall, 0F, 0F, 0F); + BackWall = new ModelRenderer(this, 0, 10); + BackWall.addBox(-7F, -7F, 5F, 14, 8, 1); + BackWall.setRotationPoint(0F, 0F, 0F); + BackWall.setTextureSize(64, 32); + setRotation(BackWall, 0F, 0F, 0F); + RightWall = new ModelRenderer(this, 40, 1); + RightWall.addBox(7F, -7F, -5F, 1, 7, 10); + RightWall.setRotationPoint(0F, 0F, 0F); + RightWall.setTextureSize(64, 32); + setRotation(RightWall, 0F, 0F, 0F); + lid = new ModelRenderer(this, 0, 19); + lid.addBox(-7F, -1F, -12F, 14, 1, 12); + lid.setRotationPoint(0F, -7F, 6F); + lid.setTextureSize(64, 32); + setRotation(lid, 0F, 0F, 0F); + Base = new ModelRenderer(this, 0, 0); + Base.addBox(-7F, 0F, -5F, 14, 1, 10); + Base.setRotationPoint(0F, 0F, 0F); + Base.setTextureSize(64, 32); + setRotation(Base, 0F, 0F, 0F); + lock2 = new ModelRenderer(this, 0, 0); + lock2.addBox(2F, -1.5F, -12.5F, 2, 3, 2); + lock2.setRotationPoint(0F, -7F, 6F); + lock2.setTextureSize(64, 32); + setRotation(lock2, 0F, 0F, 0F); + lock1 = new ModelRenderer(this, 0, 0); + lock1.addBox(-4F, -1.5F, -12.5F, 2, 3, 2); + lock1.setRotationPoint(0F, -7F, 6F); + lock1.setTextureSize(64, 32); + setRotation(lock1, 0F, 0F, 0F); + RightWall.mirror = true; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelSmokePipe.java b/src/main/java/minefantasy/mf2/client/render/block/ModelSmokePipe.java index d89be8ce..2d32b1dc 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelSmokePipe.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelSmokePipe.java @@ -7,98 +7,97 @@ import net.minecraftforge.common.util.ForgeDirection; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. though small bits of - * code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ public class ModelSmokePipe extends ModelBase { - ModelRenderer centre; - ModelRenderer north; - ModelRenderer south; - ModelRenderer up; - ModelRenderer down; - ModelRenderer east; - ModelRenderer west; + ModelRenderer centre; + ModelRenderer north; + ModelRenderer south; + ModelRenderer up; + ModelRenderer down; + ModelRenderer east; + ModelRenderer west; - public ModelSmokePipe() { - textureWidth = 64; - textureHeight = 64; + public ModelSmokePipe() { + textureWidth = 64; + textureHeight = 64; - centre = new ModelRenderer(this, 16, 12); - centre.addBox(-6F, -6F, -6F, 12, 12, 12); - centre.setRotationPoint(0F, 0F, 0F); - centre.setTextureSize(64, 64); + centre = new ModelRenderer(this, 16, 12); + centre.addBox(-6F, -6F, -6F, 12, 12, 12); + centre.setRotationPoint(0F, 0F, 0F); + centre.setTextureSize(64, 64); - setRotation(centre, 0F, 0F, 0F); - north = new ModelRenderer(this, 0, 0); - north.addBox(6F, -6F, -6F, 2, 12, 12); - north.setRotationPoint(0F, 0F, 0F); - north.setTextureSize(64, 64); + setRotation(centre, 0F, 0F, 0F); + north = new ModelRenderer(this, 0, 0); + north.addBox(6F, -6F, -6F, 2, 12, 12); + north.setRotationPoint(0F, 0F, 0F); + north.setTextureSize(64, 64); - setRotation(north, 0F, 1.570796F, 0F); - south = new ModelRenderer(this, 0, 0); - south.addBox(-8F, -6F, -6F, 2, 12, 12); - south.setRotationPoint(0F, 0F, 0F); - south.setTextureSize(64, 64); + setRotation(north, 0F, 1.570796F, 0F); + south = new ModelRenderer(this, 0, 0); + south.addBox(-8F, -6F, -6F, 2, 12, 12); + south.setRotationPoint(0F, 0F, 0F); + south.setTextureSize(64, 64); - setRotation(south, 0F, 1.570796F, 0F); - up = new ModelRenderer(this, 0, 0); - up.addBox(-8F, -6F, -6F, 2, 12, 12); - up.setRotationPoint(0F, 0F, 0F); - up.setTextureSize(64, 64); + setRotation(south, 0F, 1.570796F, 0F); + up = new ModelRenderer(this, 0, 0); + up.addBox(-8F, -6F, -6F, 2, 12, 12); + up.setRotationPoint(0F, 0F, 0F); + up.setTextureSize(64, 64); - setRotation(up, 0F, 0F, 1.570796F); - down = new ModelRenderer(this, 0, 0); - down.addBox(6F, -6F, -6F, 2, 12, 12); - down.setRotationPoint(0F, 0F, 0F); - down.setTextureSize(64, 64); + setRotation(up, 0F, 0F, 1.570796F); + down = new ModelRenderer(this, 0, 0); + down.addBox(6F, -6F, -6F, 2, 12, 12); + down.setRotationPoint(0F, 0F, 0F); + down.setTextureSize(64, 64); - setRotation(down, 0F, 0F, 1.570796F); - east = new ModelRenderer(this, 0, 0); - east.addBox(-8F, -6F, -6F, 2, 12, 12); - east.setRotationPoint(0F, 0F, 0F); - east.setTextureSize(64, 64); + setRotation(down, 0F, 0F, 1.570796F); + east = new ModelRenderer(this, 0, 0); + east.addBox(-8F, -6F, -6F, 2, 12, 12); + east.setRotationPoint(0F, 0F, 0F); + east.setTextureSize(64, 64); - setRotation(east, 0F, 0F, 0F); - west = new ModelRenderer(this, 0, 0); - west.addBox(6F, -6F, -6F, 2, 12, 12); - west.setRotationPoint(0F, 0F, 0F); - west.setTextureSize(64, 64); + setRotation(east, 0F, 0F, 0F); + west = new ModelRenderer(this, 0, 0); + west.addBox(6F, -6F, -6F, 2, 12, 12); + west.setRotationPoint(0F, 0F, 0F); + west.setTextureSize(64, 64); - setRotation(west, 0F, 0F, 0F); - } + setRotation(west, 0F, 0F, 0F); + } - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - } + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } - protected void setRotation(ModelRenderer model, float x, float y, float z) { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + protected void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } - public void renderModel(TileEntityChimney tile, float f) { - centre.render(f); - if (tile == null) { - east.render(f); - west.render(f); - } else { - if (tile.canAccept(ForgeDirection.UP)) - up.render(f); - if (tile.canAccept(ForgeDirection.DOWN)) - down.render(f); - if (tile.canAccept(ForgeDirection.NORTH)) - north.render(f); - if (tile.canAccept(ForgeDirection.SOUTH)) - south.render(f); - if (tile.canAccept(ForgeDirection.EAST)) - east.render(f); - if (tile.canAccept(ForgeDirection.WEST)) - west.render(f); - } - } + public void renderModel(TileEntityChimney tile, float f) { + centre.render(f); + if (tile == null) { + east.render(f); + west.render(f); + } else { + if (tile.canAccept(ForgeDirection.UP)) + up.render(f); + if (tile.canAccept(ForgeDirection.DOWN)) + down.render(f); + if (tile.canAccept(ForgeDirection.NORTH)) + north.render(f); + if (tile.canAccept(ForgeDirection.SOUTH)) + south.render(f); + if (tile.canAccept(ForgeDirection.EAST)) + east.render(f); + if (tile.canAccept(ForgeDirection.WEST)) + west.render(f); + } + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelTanningRack.java b/src/main/java/minefantasy/mf2/client/render/block/ModelTanningRack.java index 64368277..d367fc55 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelTanningRack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelTanningRack.java @@ -5,51 +5,49 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ public class ModelTanningRack extends ModelBase { - //fields + // fields ModelRenderer Base; ModelRenderer side2; ModelRenderer side1; ModelRenderer Top; - - public ModelTanningRack() - { - textureWidth = 64; - textureHeight = 32; - - Base = new ModelRenderer(this, 0, 0); - Base.addBox(-8F, 22F, -2.5F, 16, 2, 5); - Base.setRotationPoint(0F, 0F, 0F); - Base.setTextureSize(64, 32); - Base.mirror = true; - setRotation(Base, 0F, 0F, 0F); - side2 = new ModelRenderer(this, 54, 0); - side2.addBox(6F, 5F, -1.5F, 2, 17, 3); - side2.setRotationPoint(0F, 0F, 0F); - side2.setTextureSize(64, 32); - side2.mirror = true; - setRotation(side2, 0F, 0F, 0F); - side1 = new ModelRenderer(this, 54, 0); - side1.mirror = true; - side1.addBox(-8F, 5F, -1.5F, 2, 17, 3); - side1.setRotationPoint(0F, 0F, 0F); - side1.setTextureSize(64, 32); - side1.mirror = true; - setRotation(side1, 0F, 0F, 0F); - side1.mirror = false; - Top = new ModelRenderer(this, 0, 27); - Top.addBox(-6F, 6F, -0.5F, 12, 3, 2); - Top.setRotationPoint(0F, 0F, 0F); - Top.setTextureSize(64, 32); - Top.mirror = true; - setRotation(Top, 0F, 0F, 0F); - } + + public ModelTanningRack() { + textureWidth = 64; + textureHeight = 32; + + Base = new ModelRenderer(this, 0, 0); + Base.addBox(-8F, 22F, -2.5F, 16, 2, 5); + Base.setRotationPoint(0F, 0F, 0F); + Base.setTextureSize(64, 32); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + side2 = new ModelRenderer(this, 54, 0); + side2.addBox(6F, 5F, -1.5F, 2, 17, 3); + side2.setRotationPoint(0F, 0F, 0F); + side2.setTextureSize(64, 32); + side2.mirror = true; + setRotation(side2, 0F, 0F, 0F); + side1 = new ModelRenderer(this, 54, 0); + side1.mirror = true; + side1.addBox(-8F, 5F, -1.5F, 2, 17, 3); + side1.setRotationPoint(0F, 0F, 0F); + side1.setTextureSize(64, 32); + side1.mirror = true; + setRotation(side1, 0F, 0F, 0F); + side1.mirror = false; + Top = new ModelRenderer(this, 0, 27); + Top.addBox(-6F, 6F, -0.5F, 12, 3, 2); + Top.setRotationPoint(0F, 0F, 0F); + Top.setTextureSize(64, 32); + Top.mirror = true; + setRotation(Top, 0F, 0F, 0F); + } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelTrough.java b/src/main/java/minefantasy/mf2/client/render/block/ModelTrough.java index 657a9a52..969d42cf 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelTrough.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelTrough.java @@ -5,88 +5,82 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelTrough extends ModelBase -{ - ModelRenderer LeftWall; +public class ModelTrough extends ModelBase { + ModelRenderer LeftWall; ModelRenderer Fill; ModelRenderer FrontWall; ModelRenderer BackWall; ModelRenderer RightWall; ModelRenderer Base; - - public ModelTrough() - { - textureWidth = 64; - textureHeight = 32; - - LeftWall = new ModelRenderer(this, 42, 15); - LeftWall.addBox(-8F, -6F, -5F, 1, 7, 10); - LeftWall.setRotationPoint(0F, 0F, 0F); - LeftWall.setTextureSize(64, 32); - LeftWall.mirror = true; - setRotation(LeftWall, 0F, 0F, 0F); - Fill = new ModelRenderer(this, 40, 0); - Fill.addBox(-7F, 0F, -5F, 14, 0, 10); - Fill.setRotationPoint(0F, 0F, 0F); - Fill.setTextureSize(64, 32); - Fill.mirror = true; - setRotation(Fill, 0F, 0F, 0F); - FrontWall = new ModelRenderer(this, 0, 11); - FrontWall.addBox(-8F, -6F, -6F, 16, 7, 1); - FrontWall.setRotationPoint(0F, 0F, 0F); - FrontWall.setTextureSize(64, 32); - FrontWall.mirror = true; - setRotation(FrontWall, 0F, 0F, 0F); - BackWall = new ModelRenderer(this, 0, 11); - BackWall.addBox(-8F, -6F, 5F, 16, 7, 1); - BackWall.setRotationPoint(0F, 0F, 0F); - BackWall.setTextureSize(64, 32); - BackWall.mirror = true; - setRotation(BackWall, 0F, 0F, 0F); - RightWall = new ModelRenderer(this, 42, 15); - RightWall.addBox(7F, -6F, -5F, 1, 7, 10); - RightWall.setRotationPoint(0F, 0F, 0F); - RightWall.setTextureSize(64, 32); - RightWall.mirror = true; - setRotation(RightWall, 0F, 0F, 0F); - Base = new ModelRenderer(this, 0, 0); - Base.addBox(-7F, 0F, -5F, 14, 1, 10); - Base.setRotationPoint(0F, 0F, 0F); - Base.setTextureSize(64, 32); - Base.mirror = true; - setRotation(Base, 0F, 0F, 0F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - renderModel(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void renderModel(float f) - { - LeftWall.render(f); - RightWall.render(f); - FrontWall.render(f); - BackWall.render(f); - Base.render(f); - } - public void renderWater(float f) - { - Fill.render(f); - } + public ModelTrough() { + textureWidth = 64; + textureHeight = 32; + + LeftWall = new ModelRenderer(this, 42, 15); + LeftWall.addBox(-8F, -6F, -5F, 1, 7, 10); + LeftWall.setRotationPoint(0F, 0F, 0F); + LeftWall.setTextureSize(64, 32); + LeftWall.mirror = true; + setRotation(LeftWall, 0F, 0F, 0F); + Fill = new ModelRenderer(this, 40, 0); + Fill.addBox(-7F, 0F, -5F, 14, 0, 10); + Fill.setRotationPoint(0F, 0F, 0F); + Fill.setTextureSize(64, 32); + Fill.mirror = true; + setRotation(Fill, 0F, 0F, 0F); + FrontWall = new ModelRenderer(this, 0, 11); + FrontWall.addBox(-8F, -6F, -6F, 16, 7, 1); + FrontWall.setRotationPoint(0F, 0F, 0F); + FrontWall.setTextureSize(64, 32); + FrontWall.mirror = true; + setRotation(FrontWall, 0F, 0F, 0F); + BackWall = new ModelRenderer(this, 0, 11); + BackWall.addBox(-8F, -6F, 5F, 16, 7, 1); + BackWall.setRotationPoint(0F, 0F, 0F); + BackWall.setTextureSize(64, 32); + BackWall.mirror = true; + setRotation(BackWall, 0F, 0F, 0F); + RightWall = new ModelRenderer(this, 42, 15); + RightWall.addBox(7F, -6F, -5F, 1, 7, 10); + RightWall.setRotationPoint(0F, 0F, 0F); + RightWall.setTextureSize(64, 32); + RightWall.mirror = true; + setRotation(RightWall, 0F, 0F, 0F); + Base = new ModelRenderer(this, 0, 0); + Base.addBox(-7F, 0F, -5F, 14, 1, 10); + Base.setRotationPoint(0F, 0F, 0F); + Base.setTextureSize(64, 32); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + renderModel(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderModel(float f) { + LeftWall.render(f); + RightWall.render(f); + FrontWall.render(f); + BackWall.render(f); + Base.render(f); + } + + public void renderWater(float f) { + Fill.render(f); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/ModelWoodCarpenter.java b/src/main/java/minefantasy/mf2/client/render/block/ModelWoodCarpenter.java index a92ca6fa..ae514647 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/ModelWoodCarpenter.java +++ b/src/main/java/minefantasy/mf2/client/render/block/ModelWoodCarpenter.java @@ -5,16 +5,14 @@ import net.minecraft.entity.Entity; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ModelWoodCarpenter extends ModelBase -{ - //fields - ModelRenderer top; +public class ModelWoodCarpenter extends ModelBase { + // fields + ModelRenderer top; ModelRenderer FRleg; ModelRenderer bottom; ModelRenderer BRleg; @@ -27,121 +25,117 @@ public class ModelWoodCarpenter extends ModelBase ModelRenderer vice; ModelRenderer hammerhead; ModelRenderer plank; - - public ModelWoodCarpenter() - { - textureWidth = 64; - textureHeight = 64; - - top = new ModelRenderer(this, 0, 0); - top.addBox(-8F, 4F, -8F, 16, 4, 16); - top.setRotationPoint(0F, 0F, 0F); - top.setTextureSize(64, 64); - top.mirror = true; - setRotation(top, 0F, 0F, 0F); - FRleg = new ModelRenderer(this, 0, 35); - FRleg.addBox(3F, 8F, -7F, 4, 12, 4); - FRleg.setRotationPoint(0F, 0F, 0F); - FRleg.setTextureSize(64, 64); - FRleg.mirror = true; - setRotation(FRleg, 0F, 0F, 0F); - bottom = new ModelRenderer(this, 0, 20); - bottom.addBox(-6.5F, 14F, -6.5F, 13, 2, 13); - bottom.setRotationPoint(0F, 0F, 0F); - bottom.setTextureSize(64, 64); - bottom.mirror = true; - setRotation(bottom, 0F, 0F, 0F); - BRleg = new ModelRenderer(this, 0, 35); - BRleg.addBox(3F, 8F, 3F, 4, 12, 4); - BRleg.setRotationPoint(0F, 0F, 0F); - BRleg.setTextureSize(64, 64); - BRleg.mirror = true; - setRotation(BRleg, 0F, 0F, 0F); - BLleg = new ModelRenderer(this, 0, 35); - BLleg.addBox(-7F, 8F, 3F, 4, 12, 4); - BLleg.setRotationPoint(0F, 0F, 0F); - BLleg.setTextureSize(64, 64); - BLleg.mirror = true; - setRotation(BLleg, 0F, 0F, 0F); - FLleg = new ModelRenderer(this, 0, 35); - FLleg.addBox(-7F, 8F, -7F, 4, 12, 4); - FLleg.setRotationPoint(0F, 0F, 0F); - FLleg.setTextureSize(64, 64); - FLleg.mirror = true; - setRotation(FLleg, 0F, 0F, 0F); - plank2 = new ModelRenderer(this, 0, 51); - plank2.addBox(-5F, -1F, -1F, 10, 1, 2); - plank2.setRotationPoint(2F, 4F, 6F); - plank2.setTextureSize(64, 64); - plank2.mirror = true; - setRotation(plank2, 0F, -0.0698132F, 0F); - hammerhandle = new ModelRenderer(this, 5, 51); - hammerhandle.addBox(-3F, 0F, 0F, 6, 1, 1); - hammerhandle.setRotationPoint(-2F, 13F, -2F); - hammerhandle.setTextureSize(64, 64); - hammerhandle.mirror = true; - setRotation(hammerhandle, 0F, 1.570796F, 0F); - block = new ModelRenderer(this, 0, 0); - block.addBox(-2F, -2F, -2F, 4, 4, 4); - block.setRotationPoint(0F, 2F, 0F); - block.setTextureSize(64, 64); - block.mirror = true; - setRotation(block, 0F, -0.0523599F, 0F); - nail = new ModelRenderer(this, 0, 8); - nail.addBox(0F, -2F, 0F, 1, 3, 1); - nail.setRotationPoint(0F, 0F, 0F); - nail.setTextureSize(64, 64); - nail.mirror = true; - setRotation(nail, 0F, 0F, 0F); - vice = new ModelRenderer(this, 4, 11); - vice.addBox(-2F, -1F, -1F, 4, 3, 2); - vice.setRotationPoint(5F, 4F, -8F); - vice.setTextureSize(64, 64); - vice.mirror = true; - setRotation(vice, 0F, 0F, 0F); - hammerhead = new ModelRenderer(this, 4, 12); - hammerhead.addBox(-1F, -1F, -1F, 3, 2, 2); - hammerhead.setRotationPoint(-2F, 13F, 2F); - hammerhead.setTextureSize(64, 64); - hammerhead.mirror = true; - setRotation(hammerhead, 0F, 0F, 0F); - plank = new ModelRenderer(this, 0, 51); - plank.addBox(-5F, -1F, -1F, 10, 1, 2); - plank.setRotationPoint(-4F, 4F, -3F); - plank.setTextureSize(64, 64); - plank.mirror = true; - setRotation(plank, 0F, 0.7679449F, 0F); - } - - @Override -public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - renderModel(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void renderModel(float f) - { - top.render(f); - FRleg.render(f); - bottom.render(f); - BRleg.render(f); - BLleg.render(f); - FLleg.render(f); - plank2.render(f); - hammerhandle.render(f); - block.render(f); - nail.render(f); - vice.render(f); - hammerhead.render(f); - plank.render(f); - } + public ModelWoodCarpenter() { + textureWidth = 64; + textureHeight = 64; + + top = new ModelRenderer(this, 0, 0); + top.addBox(-8F, 4F, -8F, 16, 4, 16); + top.setRotationPoint(0F, 0F, 0F); + top.setTextureSize(64, 64); + top.mirror = true; + setRotation(top, 0F, 0F, 0F); + FRleg = new ModelRenderer(this, 0, 35); + FRleg.addBox(3F, 8F, -7F, 4, 12, 4); + FRleg.setRotationPoint(0F, 0F, 0F); + FRleg.setTextureSize(64, 64); + FRleg.mirror = true; + setRotation(FRleg, 0F, 0F, 0F); + bottom = new ModelRenderer(this, 0, 20); + bottom.addBox(-6.5F, 14F, -6.5F, 13, 2, 13); + bottom.setRotationPoint(0F, 0F, 0F); + bottom.setTextureSize(64, 64); + bottom.mirror = true; + setRotation(bottom, 0F, 0F, 0F); + BRleg = new ModelRenderer(this, 0, 35); + BRleg.addBox(3F, 8F, 3F, 4, 12, 4); + BRleg.setRotationPoint(0F, 0F, 0F); + BRleg.setTextureSize(64, 64); + BRleg.mirror = true; + setRotation(BRleg, 0F, 0F, 0F); + BLleg = new ModelRenderer(this, 0, 35); + BLleg.addBox(-7F, 8F, 3F, 4, 12, 4); + BLleg.setRotationPoint(0F, 0F, 0F); + BLleg.setTextureSize(64, 64); + BLleg.mirror = true; + setRotation(BLleg, 0F, 0F, 0F); + FLleg = new ModelRenderer(this, 0, 35); + FLleg.addBox(-7F, 8F, -7F, 4, 12, 4); + FLleg.setRotationPoint(0F, 0F, 0F); + FLleg.setTextureSize(64, 64); + FLleg.mirror = true; + setRotation(FLleg, 0F, 0F, 0F); + plank2 = new ModelRenderer(this, 0, 51); + plank2.addBox(-5F, -1F, -1F, 10, 1, 2); + plank2.setRotationPoint(2F, 4F, 6F); + plank2.setTextureSize(64, 64); + plank2.mirror = true; + setRotation(plank2, 0F, -0.0698132F, 0F); + hammerhandle = new ModelRenderer(this, 5, 51); + hammerhandle.addBox(-3F, 0F, 0F, 6, 1, 1); + hammerhandle.setRotationPoint(-2F, 13F, -2F); + hammerhandle.setTextureSize(64, 64); + hammerhandle.mirror = true; + setRotation(hammerhandle, 0F, 1.570796F, 0F); + block = new ModelRenderer(this, 0, 0); + block.addBox(-2F, -2F, -2F, 4, 4, 4); + block.setRotationPoint(0F, 2F, 0F); + block.setTextureSize(64, 64); + block.mirror = true; + setRotation(block, 0F, -0.0523599F, 0F); + nail = new ModelRenderer(this, 0, 8); + nail.addBox(0F, -2F, 0F, 1, 3, 1); + nail.setRotationPoint(0F, 0F, 0F); + nail.setTextureSize(64, 64); + nail.mirror = true; + setRotation(nail, 0F, 0F, 0F); + vice = new ModelRenderer(this, 4, 11); + vice.addBox(-2F, -1F, -1F, 4, 3, 2); + vice.setRotationPoint(5F, 4F, -8F); + vice.setTextureSize(64, 64); + vice.mirror = true; + setRotation(vice, 0F, 0F, 0F); + hammerhead = new ModelRenderer(this, 4, 12); + hammerhead.addBox(-1F, -1F, -1F, 3, 2, 2); + hammerhead.setRotationPoint(-2F, 13F, 2F); + hammerhead.setTextureSize(64, 64); + hammerhead.mirror = true; + setRotation(hammerhead, 0F, 0F, 0F); + plank = new ModelRenderer(this, 0, 51); + plank.addBox(-5F, -1F, -1F, 10, 1, 2); + plank.setRotationPoint(-4F, 4F, -3F); + plank.setTextureSize(64, 64); + plank.mirror = true; + setRotation(plank, 0F, 0.7679449F, 0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + renderModel(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderModel(float f) { + top.render(f); + FRleg.render(f); + bottom.render(f); + BRleg.render(f); + BLleg.render(f); + FLleg.render(f); + plank2.render(f); + hammerhandle.render(f); + block.render(f); + nail.render(f); + vice.render(f); + hammerhead.render(f); + plank.render(f); + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderAmmoBox.java b/src/main/java/minefantasy/mf2/client/render/block/RenderAmmoBox.java index 84c1dece..c5154f3b 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderAmmoBox.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderAmmoBox.java @@ -1,43 +1,43 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.decor.BlockAmmoBox; -import minefantasy.mf2.block.tileentity.decor.TileEntityAmmoBox; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderAmmoBox implements ISimpleBlockRenderingHandler { + private static final TileEntityAmmoBoxRenderer invModel = new TileEntityAmmoBoxRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (block == null || !(block instanceof BlockAmmoBox)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + BlockAmmoBox box = (BlockAmmoBox) block; + invModel.renderInvModel(box.getFullTexName(), box.storageType, CustomMaterial.getMaterial("refinedWood"), 0F, + 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockAmmoBox.ammo_RI; + } -public class RenderAmmoBox implements ISimpleBlockRenderingHandler -{ - private static final TileEntityAmmoBoxRenderer invModel = new TileEntityAmmoBoxRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(block == null || !(block instanceof BlockAmmoBox))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - BlockAmmoBox box = (BlockAmmoBox)block; - invModel.renderInvModel(box.getFullTexName(), box.storageType, CustomMaterial.getMaterial("refinedWood"), 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockAmmoBox.ammo_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderAnvilMF.java b/src/main/java/minefantasy/mf2/client/render/block/RenderAnvilMF.java index 6970d24f..cad17085 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderAnvilMF.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderAnvilMF.java @@ -1,40 +1,41 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.crafting.BlockAnvilMF; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderAnvilMF implements ISimpleBlockRenderingHandler { + private static final TileEntityAnvilMFRenderer renderAnvil = new TileEntityAnvilMFRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (!(block instanceof BlockAnvilMF)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + BlockAnvilMF anvil = (BlockAnvilMF) block; + renderAnvil.renderModelAt(anvil.material.name, 0, 0.0F, 0.0F, 0.0F, 0.0F, 0); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockAnvilMF.anvil_RI; + } -public class RenderAnvilMF implements ISimpleBlockRenderingHandler -{ - private static final TileEntityAnvilMFRenderer renderAnvil = new TileEntityAnvilMFRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(!(block instanceof BlockAnvilMF))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - BlockAnvilMF anvil = (BlockAnvilMF)block; - renderAnvil.renderModelAt(anvil.material.name, 0, 0.0F, 0.0F, 0.0F, 0.0F, 0); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockAnvilMF.anvil_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderBellows.java b/src/main/java/minefantasy/mf2/client/render/block/RenderBellows.java index 50f9d2c4..e6be1a18 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderBellows.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderBellows.java @@ -1,41 +1,40 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.refining.BlockBellows; -import minefantasy.mf2.block.tileentity.TileEntityBellows; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderBellows implements ISimpleBlockRenderingHandler { + private static final TileEntityBellowsRenderer invModel = new TileEntityBellowsRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (!(block instanceof BlockBellows)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + invModel.renderInvModel(0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockBellows.bellows_RI; + } -public class RenderBellows implements ISimpleBlockRenderingHandler -{ - private static final TileEntityBellowsRenderer invModel = new TileEntityBellowsRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(block == null || !(block instanceof BlockBellows))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - invModel.renderInvModel(0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockBellows.bellows_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderBigFurnace.java b/src/main/java/minefantasy/mf2/client/render/block/RenderBigFurnace.java index c46b4806..eeec2c30 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderBigFurnace.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderBigFurnace.java @@ -1,42 +1,41 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.refining.BlockBigFurnace; -import minefantasy.mf2.block.tileentity.TileEntityBigFurnace; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderBigFurnace implements ISimpleBlockRenderingHandler { + private static final TileEntityBigFurnaceRenderer invModel = new TileEntityBigFurnaceRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (!(block instanceof BlockBigFurnace)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + BlockBigFurnace furnace = (BlockBigFurnace) block; + invModel.renderInvModel(furnace.isHeater, furnace.isHeater ? "furnace_heater" : "furnace_rock", 0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockBigFurnace.furn_RI; + } -public class RenderBigFurnace implements ISimpleBlockRenderingHandler -{ - private static final TileEntityBigFurnaceRenderer invModel = new TileEntityBigFurnaceRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(block == null || !(block instanceof BlockBigFurnace))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - BlockBigFurnace furnace = (BlockBigFurnace)block; - invModel.renderInvModel(furnace.isHeater, furnace.isHeater ? "furnace_heater" : "furnace_rock", 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockBigFurnace.furn_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderBloomery.java b/src/main/java/minefantasy/mf2/client/render/block/RenderBloomery.java index 61bad33b..ac3221de 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderBloomery.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderBloomery.java @@ -1,43 +1,41 @@ package minefantasy.mf2.client.render.block; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.refining.BlockBloomery; -import minefantasy.mf2.block.tileentity.TileEntityBloomery; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; - -public class RenderBloomery implements ISimpleBlockRenderingHandler -{ - private static final TileEntityBloomeryRenderer invModel = new TileEntityBloomeryRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(block == null || !(block instanceof BlockBloomery))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - BlockBloomery bloomery = (BlockBloomery)block; - invModel.renderInvModel("bloomery_basic", 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockBloomery.bloomery_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } +public class RenderBloomery implements ISimpleBlockRenderingHandler { + private static final TileEntityBloomeryRenderer invModel = new TileEntityBloomeryRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (!(block instanceof BlockBloomery)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + BlockBloomery bloomery = (BlockBloomery) block; + invModel.renderInvModel("bloomery_basic", 0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockBloomery.bloomery_RI; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderBombBench.java b/src/main/java/minefantasy/mf2/client/render/block/RenderBombBench.java index 7644c3f6..9fb04a5f 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderBombBench.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderBombBench.java @@ -1,40 +1,37 @@ package minefantasy.mf2.client.render.block; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.crafting.BlockBombBench; -import minefantasy.mf2.block.tileentity.TileEntityBombBench; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; - -public class RenderBombBench implements ISimpleBlockRenderingHandler -{ - private static final TileEntityBombBenchRenderer invModel = new TileEntityBombBenchRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - invModel.renderModelAt("carpenter_bomb", 0, 0F, 0F, 0F, 0F, 0); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockBombBench.bomb_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } +public class RenderBombBench implements ISimpleBlockRenderingHandler { + private static final TileEntityBombBenchRenderer invModel = new TileEntityBombBenchRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + invModel.renderModelAt("carpenter_bomb", 0, 0F, 0F, 0F, 0F, 0); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockBombBench.bomb_RI; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderBombPress.java b/src/main/java/minefantasy/mf2/client/render/block/RenderBombPress.java index 39e28629..5e87030e 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderBombPress.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderBombPress.java @@ -1,39 +1,37 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.crafting.BlockBombPress; -import minefantasy.mf2.block.tileentity.TileEntityBombPress; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderBombPress implements ISimpleBlockRenderingHandler { + private static final TileEntityBombPressRenderer invModel = new TileEntityBombPressRenderer(); -public class RenderBombPress implements ISimpleBlockRenderingHandler -{ - private static final TileEntityBombPressRenderer invModel = new TileEntityBombPressRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - invModel.renderModelAt("bombPress", 0, 0F, 0F, 0F, 0F, 0, 0); - GL11.glPopMatrix(); - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + invModel.renderModelAt("bombPress", 0, 0F, 0F, 0F, 0F, 0, 0); + GL11.glPopMatrix(); + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } - @Override - public int getRenderId() { - return BlockBombPress.bpress_RI; - } + @Override + public int getRenderId() { + return BlockBombPress.bpress_RI; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderCarpenter.java b/src/main/java/minefantasy/mf2/client/render/block/RenderCarpenter.java index 1db34460..4792f00a 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderCarpenter.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderCarpenter.java @@ -1,39 +1,37 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.crafting.BlockCarpenter; -import minefantasy.mf2.block.tileentity.TileEntityCarpenterMF; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderCarpenter implements ISimpleBlockRenderingHandler { + private static final TileEntityCarpenterRenderer invModel = new TileEntityCarpenterRenderer(); -public class RenderCarpenter implements ISimpleBlockRenderingHandler -{ - private static final TileEntityCarpenterRenderer invModel = new TileEntityCarpenterRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - invModel.renderModelAt("carpenter", 0, 0F, 0F, 0F, 0F, 0); - GL11.glPopMatrix(); - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + invModel.renderModelAt("carpenter", 0, 0F, 0F, 0F, 0F, 0); + GL11.glPopMatrix(); + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } - @Override - public int getRenderId() { - return BlockCarpenter.carpenter_RI; - } + @Override + public int getRenderId() { + return BlockCarpenter.carpenter_RI; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderCrossbowBench.java b/src/main/java/minefantasy/mf2/client/render/block/RenderCrossbowBench.java index f0dfc6d9..90bec3af 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderCrossbowBench.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderCrossbowBench.java @@ -1,39 +1,37 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.crafting.BlockCrossbowBench; -import minefantasy.mf2.block.tileentity.TileEntityCrossbowBench; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderCrossbowBench implements ISimpleBlockRenderingHandler { + private static final TileEntityCrossbowBenchRenderer invModel = new TileEntityCrossbowBenchRenderer(); -public class RenderCrossbowBench implements ISimpleBlockRenderingHandler -{ - private static final TileEntityCrossbowBenchRenderer invModel = new TileEntityCrossbowBenchRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - invModel.renderModelAt("carpenter_crossbow", 0, 0F, 0F, 0F, 0F, 0); - GL11.glPopMatrix(); - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + invModel.renderModelAt("carpenter_crossbow", 0, 0F, 0F, 0F, 0F, 0); + GL11.glPopMatrix(); + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } - @Override - public int getRenderId() { - return BlockCrossbowBench.crossBench_RI; - } + @Override + public int getRenderId() { + return BlockCrossbowBench.crossBench_RI; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderFirepit.java b/src/main/java/minefantasy/mf2/client/render/block/RenderFirepit.java index 27bf5195..00ef8a20 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderFirepit.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderFirepit.java @@ -1,39 +1,37 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.crafting.BlockFirepit; -import minefantasy.mf2.block.tileentity.TileEntityFirepit; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderFirepit implements ISimpleBlockRenderingHandler { + private static final TileEntityFirepitRenderer invModel = new TileEntityFirepitRenderer(); -public class RenderFirepit implements ISimpleBlockRenderingHandler -{ - private static final TileEntityFirepitRenderer invModel = new TileEntityFirepitRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - invModel.renderInvModel(0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + invModel.renderInvModel(0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } - @Override - public int getRenderId() { - return BlockFirepit.firepit_RI; - } + @Override + public int getRenderId() { + return BlockFirepit.firepit_RI; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderForge.java b/src/main/java/minefantasy/mf2/client/render/block/RenderForge.java index c7281995..00060920 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderForge.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderForge.java @@ -1,40 +1,41 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.refining.BlockForge; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderForge implements ISimpleBlockRenderingHandler { + private static final TileEntityForgeRenderer invModel = new TileEntityForgeRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (block == null || !(block instanceof BlockForge)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + BlockForge forge = (BlockForge) block; + invModel.renderInvModel("forge_" + forge.type, 0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockForge.forge_RI; + } -public class RenderForge implements ISimpleBlockRenderingHandler -{ - private static final TileEntityForgeRenderer invModel = new TileEntityForgeRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(block == null || !(block instanceof BlockForge))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - BlockForge forge = (BlockForge)block; - invModel.renderInvModel("forge_"+forge.type, 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockForge.forge_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderQuern.java b/src/main/java/minefantasy/mf2/client/render/block/RenderQuern.java index 782a66aa..a1afa7e3 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderQuern.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderQuern.java @@ -1,42 +1,41 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.refining.BlockQuern; -import minefantasy.mf2.block.tileentity.TileEntityQuern; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderQuern implements ISimpleBlockRenderingHandler { + private static final TileEntityQuernRenderer invModel = new TileEntityQuernRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (block == null || !(block instanceof BlockQuern)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + BlockQuern quern = (BlockQuern) block; + invModel.renderModelAt(null, "quern_basic", 0F, 0F, 0F, 0F, true); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockQuern.quern_RI; + } -public class RenderQuern implements ISimpleBlockRenderingHandler -{ - private static final TileEntityQuernRenderer invModel = new TileEntityQuernRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(block == null || !(block instanceof BlockQuern))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - BlockQuern quern = (BlockQuern)block; - invModel.renderModelAt(null, "quern_basic", 0F, 0F, 0F, 0F, true); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockQuern.quern_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderRack.java b/src/main/java/minefantasy/mf2/client/render/block/RenderRack.java index 19c6dd1c..4701f7ca 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderRack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderRack.java @@ -1,44 +1,42 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.decor.BlockRack; -import minefantasy.mf2.block.decor.BlockTrough; -import minefantasy.mf2.block.tileentity.decor.TileEntityRack; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderRack implements ISimpleBlockRenderingHandler { + private static final TileEntityRackRenderer invModel = new TileEntityRackRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (block == null || !(block instanceof BlockRack)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + BlockRack rack = (BlockRack) block; + invModel.renderInvModel(CustomMaterial.getMaterial("refinedWood"), rack.getFullTexName(), 0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockRack.rack_RI; + } -public class RenderRack implements ISimpleBlockRenderingHandler -{ - private static final TileEntityRackRenderer invModel = new TileEntityRackRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(block == null || !(block instanceof BlockRack))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - BlockRack rack = (BlockRack)block; - invModel.renderInvModel(CustomMaterial.getMaterial("refinedWood"), rack.getFullTexName(), 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockRack.rack_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderResearch.java b/src/main/java/minefantasy/mf2/client/render/block/RenderResearch.java index b662a171..c45467c2 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderResearch.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderResearch.java @@ -1,40 +1,37 @@ package minefantasy.mf2.client.render.block; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.crafting.BlockResearchStation; -import minefantasy.mf2.block.tileentity.TileEntityResearch; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; - import org.lwjgl.opengl.GL11; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; - -public class RenderResearch implements ISimpleBlockRenderingHandler -{ - private static final TileEntityResearchRenderer invModel = new TileEntityResearchRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - invModel.renderModelAt("researchTable", 0, 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockResearchStation.research_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } +public class RenderResearch implements ISimpleBlockRenderingHandler { + private static final TileEntityResearchRenderer invModel = new TileEntityResearchRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + invModel.renderModelAt("researchTable", 0, 0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockResearchStation.research_RI; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderRoast.java b/src/main/java/minefantasy/mf2/client/render/block/RenderRoast.java index fcc3717d..167306f8 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderRoast.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderRoast.java @@ -1,42 +1,42 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.crafting.BlockRoast; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderRoast implements ISimpleBlockRenderingHandler { + private static final TileEntityRoastRenderer invModel = new TileEntityRoastRenderer(); -public class RenderRoast implements ISimpleBlockRenderingHandler -{ - private static final TileEntityRoastRenderer invModel = new TileEntityRoastRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(!(block instanceof BlockRoast))return; - BlockRoast roast = (BlockRoast)block; - if(roast.isOven()) - { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - invModel.renderInvModel(roast.tex, true, 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - } + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (!(block instanceof BlockRoast)) + return; + BlockRoast roast = (BlockRoast) block; + if (roast.isOven()) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + invModel.renderInvModel(roast.tex, true, 0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } - @Override - public int getRenderId() { - return BlockRoast.roast_RI; - } + @Override + public int getRenderId() { + return BlockRoast.roast_RI; + } - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderSmokePipe.java b/src/main/java/minefantasy/mf2/client/render/block/RenderSmokePipe.java index adb44c58..a8b560fb 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderSmokePipe.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderSmokePipe.java @@ -1,44 +1,43 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.refining.BlockChimney; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderSmokePipe implements ISimpleBlockRenderingHandler { + private static final TileEntitySmokePipeRenderer tileRender = new TileEntitySmokePipeRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (!(block instanceof BlockChimney)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + + if (((BlockChimney) block).isPipe()) { + tileRender.renderAModelAt(null, 0D, 0D, 0D, 0F); + } + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockChimney.pipe_RI; + } -public class RenderSmokePipe implements ISimpleBlockRenderingHandler -{ - private static final TileEntitySmokePipeRenderer tileRender = new TileEntitySmokePipeRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(!(block instanceof BlockChimney))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - - if(((BlockChimney)block).isPipe()) - { - tileRender.renderAModelAt(null, 0D, 0D, 0D, 0F); - } - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { - return false; - } - - @Override - public int getRenderId() { - return BlockChimney.pipe_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderTanningRack.java b/src/main/java/minefantasy/mf2/client/render/block/RenderTanningRack.java index fc7c79d0..2a599c35 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderTanningRack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderTanningRack.java @@ -1,42 +1,41 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.block.crafting.BlockTanningRack; -import minefantasy.mf2.block.tileentity.TileEntityTanningRack; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderTanningRack implements ISimpleBlockRenderingHandler { + private static final TileEntityTanningRackRenderer invModel = new TileEntityTanningRackRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (!(block instanceof BlockTanningRack)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + BlockTanningRack rack = (BlockTanningRack) block; + invModel.renderInvModel(rack.tex, rack.tex.equalsIgnoreCase("metal"), 0F, 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockTanningRack.tanner_RI; + } -public class RenderTanningRack implements ISimpleBlockRenderingHandler -{ - private static final TileEntityTanningRackRenderer invModel = new TileEntityTanningRackRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(!(block instanceof BlockTanningRack))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - BlockTanningRack rack = (BlockTanningRack)block; - invModel.renderInvModel(rack.tex, rack.tex.equalsIgnoreCase("metal"), 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockTanningRack.tanner_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/RenderTrough.java b/src/main/java/minefantasy/mf2/client/render/block/RenderTrough.java index fef0d10c..aa9fb388 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/RenderTrough.java +++ b/src/main/java/minefantasy/mf2/client/render/block/RenderTrough.java @@ -1,43 +1,42 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.decor.BlockTrough; -import minefantasy.mf2.block.tileentity.decor.TileEntityTrough; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +public class RenderTrough implements ISimpleBlockRenderingHandler { + private static final TileEntityTroughRenderer invModel = new TileEntityTroughRenderer(); + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (!(block instanceof BlockTrough)) + return; + + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + BlockTrough trough = (BlockTrough) block; + invModel.renderInvModel(trough.getFullTexName(), CustomMaterial.getMaterial("refinedWood"), 0F, 0F, 0F); + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return BlockTrough.trough_RI; + } -public class RenderTrough implements ISimpleBlockRenderingHandler -{ - private static final TileEntityTroughRenderer invModel = new TileEntityTroughRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - if(block == null || !(block instanceof BlockTrough))return; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - BlockTrough trough = (BlockTrough)block; - invModel.renderInvModel(trough.getFullTexName(), CustomMaterial.getMaterial("refinedWood"), 0F, 0F, 0F, 0F); - GL11.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - return false; - } - - @Override - public int getRenderId() { - return BlockTrough.trough_RI; - } - - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityAmmoBoxRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityAmmoBoxRenderer.java index 67208eaa..27aeb5ad 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityAmmoBoxRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityAmmoBoxRenderer.java @@ -1,117 +1,107 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - -import org.lwjgl.opengl.GL11; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.tileentity.decor.TileEntityAmmoBox; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +import java.util.Random; + +public class TileEntityAmmoBoxRenderer extends TileEntitySpecialRenderer { + private ModelAmmoBox modelbig, model, modelsml; + private Random random = new Random(); -public class TileEntityAmmoBoxRenderer extends TileEntitySpecialRenderer -{ - public TileEntityAmmoBoxRenderer() - { + public TileEntityAmmoBoxRenderer() { model = new ModelAmmoBox(); modelbig = new ModelSmallCrate(); modelsml = new ModelFoodBox(); } - public void renderAModelAt(TileEntityAmmoBox tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntityAmmoBox tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); } - this.renderModelAt(tile, i, d, d1, d2, f); + this.renderModelAt(tile, i, d, d1, d2, f); } - - public void renderInvModel(String tex, byte type, CustomMaterial material, double d, double d1, double d2, float f) - { - ModelAmmoBox baseMdl = type == 0 ? modelsml : type == 1 ? model : modelbig; - int i = 2; - int j = 450 - (90 * i); - - GL11.glPushMatrix(); //start + + public void renderInvModel(String tex, byte type, CustomMaterial material, double d, double d1, double d2, + float f) { + ModelAmmoBox baseMdl = type == 0 ? modelsml : type == 1 ? model : modelbig; + int i = 2; + int j = 450 - (90 * i); + + GL11.glPushMatrix(); // start float scale = 1.0F; - float yOffset = 1/16F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j+90, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + float yOffset = 1 / 16F; + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j + 90, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); float level = 0F; - - GL11.glColor3f((float)material.colourRGB[0]/255F, (float)material.colourRGB[1]/255F, (float)material.colourRGB[2]/255F); - - bindTextureByName("textures/models/tileentity/"+tex+"_base.png"); //texture - baseMdl.renderModel(0.0625F); + + GL11.glColor3f(material.colourRGB[0] / 255F, material.colourRGB[1] / 255F, material.colourRGB[2] / 255F); + + bindTextureByName("textures/models/tileentity/" + tex + "_base.png"); // texture + baseMdl.renderModel(0.0625F); + baseMdl.renderLid(0.0625F, 0F); + + GL11.glColor3f(1F, 1F, 1F); + + bindTextureByName("textures/models/tileentity/" + tex + "_detail.png"); // texture + baseMdl.renderModel(0.0625F); baseMdl.renderLid(0.0625F, 0F); - - GL11.glColor3f(1F, 1F, 1F); - - bindTextureByName("textures/models/tileentity/"+tex+"_detail.png"); //texture - baseMdl.renderModel(0.0625F); - baseMdl.renderLid(0.0625F, 0F); - GL11.glPopMatrix(); + GL11.glPopMatrix(); GL11.glColor3f(1F, 1F, 1F); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - - public void renderModelAt(TileEntityAmmoBox tile, int meta, double d, double d1, double d2, float f) - { - ModelAmmoBox baseMdl = tile.getStorageType() == 0 ? modelsml : tile.getStorageType() == 1 ? model : modelbig; - int i = meta; - if(!tile.hasWorldObj()) - { - i = 2; - } - - int j = 450 - (90 * i); - - GL11.glPushMatrix(); //start + + public void renderModelAt(TileEntityAmmoBox tile, int meta, double d, double d1, double d2, float f) { + ModelAmmoBox baseMdl = tile.getStorageType() == 0 ? modelsml : tile.getStorageType() == 1 ? model : modelbig; + int i = meta; + if (!tile.hasWorldObj()) { + i = 2; + } + + int j = 450 - (90 * i); + + GL11.glPushMatrix(); // start float scale = 1.0F; - float yOffset = 1/16F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j+90, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + float yOffset = 1 / 16F; + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j + 90, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); float level = 0F; - + CustomMaterial material = tile.getMaterial(); - GL11.glColor3f((float)material.colourRGB[0]/255F, (float)material.colourRGB[1]/255F, (float)material.colourRGB[2]/255F); - - bindTextureByName("textures/models/tileentity/"+tile.getTexName()+"_base.png"); //texture - baseMdl.renderModel(0.0625F); + GL11.glColor3f(material.colourRGB[0] / 255F, material.colourRGB[1] / 255F, material.colourRGB[2] / 255F); + + bindTextureByName("textures/models/tileentity/" + tile.getTexName() + "_base.png"); // texture + baseMdl.renderModel(0.0625F); baseMdl.renderLid(0.0625F, tile.angle); - - GL11.glColor3f(1F, 1F, 1F); - - bindTextureByName("textures/models/tileentity/"+tile.getTexName()+"_detail.png"); //texture - baseMdl.renderModel(0.0625F); - baseMdl.renderLid(0.0625F, tile.angle); - GL11.glPopMatrix(); + + GL11.glColor3f(1F, 1F, 1F); + + bindTextureByName("textures/models/tileentity/" + tile.getTexName() + "_detail.png"); // texture + baseMdl.renderModel(0.0625F); + baseMdl.renderLid(0.0625F, tile.angle); + GL11.glPopMatrix(); GL11.glColor3f(1F, 1F, 1F); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityAmmoBox) tileentity, d, d1, d2, f); //where to render + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityAmmoBox) tileentity, d, d1, d2, f); // where to render } - - private ModelAmmoBox modelbig, model, modelsml; - private Random random = new Random(); } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityAnvilMFRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityAnvilMFRenderer.java index 38b005bb..19e403aa 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityAnvilMFRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityAnvilMFRenderer.java @@ -1,43 +1,38 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - -import minefantasy.mf2.block.tileentity.TileEntityAnvilMF; import minefantasy.mf2.api.helpers.TextureHelperMF; +import minefantasy.mf2.block.tileentity.TileEntityAnvilMF; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; +import java.util.Random; + public class TileEntityAnvilMFRenderer extends TileEntitySpecialRenderer { - public TileEntityAnvilMFRenderer() - { + private ModelAnvil model; + private Random random = new Random(); + + public TileEntityAnvilMFRenderer() { model = new ModelAnvil(); } - public void renderAModelAt(TileEntityAnvilMF tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntityAnvilMF tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); + } + for (int a = 0; a < 2; a++) { + if (shouldRender(tile, a)) { + this.renderModelAt(tile.getTextureName(), i, d, d1, d2, f, a); + } } - for(int a = 0; a < 2; a ++) - { - if(shouldRender(tile, a)) - { - this.renderModelAt(tile.getTextureName(), i, d, d1, d2, f, a); - } - } } - - public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass) - { + + public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass) { int i = meta; - int j = 90 * i; @@ -60,50 +55,43 @@ public void renderModelAt(String tex, int meta, double d, double d1, double d2, j = 90; } - if(renderPass == 1) - { - bindTextureByName("textures/models/tileentity/anvilGrid.png"); //texture + if (renderPass == 1) { + bindTextureByName("textures/models/tileentity/anvilGrid.png"); // texture + } else { + bindTextureByName("textures/models/tileentity/anvil" + tex + ".png"); // texture } - else - { - bindTextureByName("textures/models/tileentity/anvil"+tex+".png"); //texture - } - - GL11.glPushMatrix(); //start + + GL11.glPushMatrix(); // start float scale = 1.0F; float yOffset = 0F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + (0.3F*scale)+yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j+180F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + GL11.glTranslatef((float) d + 0.5F, (float) d1 + (0.3F * scale) + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j + 180F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - model.renderModel(0.0625F); - + model.renderModel(0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityAnvilMF) tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityAnvilMF) tileentity, d, d1, d2, f); // where to render + } + + private boolean shouldRender(TileEntityAnvilMF tile, int p) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer sp = mc.thePlayer; + if (p == 1)// GRID + { + return false; + } + return true; } - - private ModelAnvil model; - private Random random = new Random(); - - - private boolean shouldRender(TileEntityAnvilMF tile, int p) - { - Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer sp = mc.thePlayer; - if(p == 1)//GRID - { - return false; - } - return true; - } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBellowsRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBellowsRenderer.java index 5347b6e0..f2600f8c 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBellowsRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBellowsRenderer.java @@ -1,62 +1,56 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityBellows; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; -public class TileEntityBellowsRenderer extends TileEntitySpecialRenderer -{ - public TileEntityBellowsRenderer() - { +import java.util.Random; + +public class TileEntityBellowsRenderer extends TileEntitySpecialRenderer { + private ModelBellows model; + private Random random = new Random(); + + public TileEntityBellowsRenderer() { model = new ModelBellows(); } - public void renderAModelAt(TileEntityBellows tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntityBellows tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); } - this.renderModelAt(tile, i, d, d1, d2, f); + this.renderModelAt(tile, i, d, d1, d2, f); } - - public void renderInvModel(double d, double d1, double d2, float f) - { - int j = 90; + + public void renderInvModel(double d, double d1, double d2, float f) { + int j = 90; model.rotate(0); - bindTextureByName("textures/models/tileentity/bellows.png"); //texture - - GL11.glPushMatrix(); //start + bindTextureByName("textures/models/tileentity/bellows.png"); // texture + + GL11.glPushMatrix(); // start float scale = 1.0F; float yOffset = 1.525F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); float level = 0F; - model.renderModel(0, 0.0625F); - + model.renderModel(0, 0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - - public void renderModelAt(TileEntityBellows tile, int meta, double d, double d1, double d2, float f) - { - int i = meta; - - int j = 90 * i; + public void renderModelAt(TileEntityBellows tile, int meta, double d, double d1, double d2, float f) { + int i = meta; + + int j = 90 * i; if (i == 1) { j = 0; @@ -77,32 +71,30 @@ public void renderModelAt(TileEntityBellows tile, int meta, double d, double d1, j = 90; } model.rotate(tile.press); - bindTextureByName("textures/models/tileentity/bellows.png"); //texture - - GL11.glPushMatrix(); //start + bindTextureByName("textures/models/tileentity/bellows.png"); // texture + + GL11.glPushMatrix(); // start float scale = 1.0F; float yOffset = 1.525F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); float level = 0F; - model.renderModel(tile.press, 0.0625F); - + model.renderModel(tile.press, 0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityBellows) tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityBellows) tileentity, d, d1, d2, f); // where to render } - - private ModelBellows model; - private Random random = new Random(); } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBigFurnaceRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBigFurnaceRenderer.java index 908e6913..cc0eb4a6 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBigFurnaceRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBigFurnaceRenderer.java @@ -1,8 +1,5 @@ package minefantasy.mf2.client.render.block; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityBigFurnace; import net.minecraft.client.Minecraft; @@ -13,202 +10,192 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; - +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class TileEntityBigFurnaceRenderer extends TileEntitySpecialRenderer -{ - public TileEntityBigFurnaceRenderer() - { - model = new ModelBigFurnace(); - } - - public void renderAModelAt(TileEntityBigFurnace tile, double d, double d1, double d2, float f) - { - int i = 1; - if (tile.hasWorldObj()) - { - i = tile.getBlockMetadata(); - } - - int j = 90 * i; - - if (i == 0) { - j = 0; - } - - if (i == 1) { - j = 270; - } - - if (i == 2) { - j = 180; - } - - if (i == 3) { - j = 90; - } - if (i == 4) { - j = 90; - } - - String type = tile.getTexture(); - - bindTextureByName("textures/models/tileentity/" + type + ".png"); // texture - - boolean display = tile.isBurning(); - - GL11.glPushMatrix(); // start - float scale = 1.0F; - - float offset = (1.0F - 0.0625F); - GL11.glTranslatef((float) d + 0.5F, (float) d1 + (0.0635F * 2F), (float) d2 + 0.5F); // size - GL11.glRotatef(j - 90, 0.0F, 1.0F, 0.0F); - GL11.glScalef(scale, -scale, -scale); - model.renderModel(display, 0.0625F); - - float sc = 0.75F; - float angle = 90F / 20F * (float) tile.doorAngle; - GL11.glPushMatrix(); - GL11.glTranslatef(-pixel(8), -pixel(12), 0); - if (tile.isHeater()) { - GL11.glTranslatef(0, pixel(12), 0); - } - GL11.glPushMatrix(); - GL11.glScalef(sc, sc, sc); - GL11.glRotatef(90, 0, 1, 0); - if (tile.isHeater()) { - GL11.glRotatef(angle, 1F, 0, 0); - renderDoorHeater(0, 54, 12, 8, 128, 64); - } else { - GL11.glRotatef(-angle, 1F, 0, 0); - renderDoor(0, 54, 12, 8, 128, 64); - } - GL11.glPopMatrix(); - GL11.glPopMatrix(); - - GL11.glPopMatrix(); // end - - } - - public void renderInvModel(boolean heater, String type, double d, double d1, double d2, float f) - { - int j = 90; - - bindTextureByName("textures/models/tileentity/" + type + ".png"); // texture - - GL11.glPushMatrix(); // start - float scale = 1.0F; - - float offset = (1.0F - 0.0625F); - GL11.glTranslatef((float) d + 0.5F, (float) d1 + (0.0635F * 2F), (float) d2 + 0.5F); // size - GL11.glRotatef(j - 90, 0.0F, 1.0F, 0.0F); - GL11.glScalef(scale, -scale, -scale); - model.renderModel(false, 0.0625F); - - float sc = 0.75F; - float angle = 0F; - GL11.glPushMatrix(); - GL11.glTranslatef(-pixel(8), -pixel(12), 0); - if (heater) { - GL11.glTranslatef(0, pixel(12), 0); - } - GL11.glPushMatrix(); - GL11.glScalef(sc, sc, sc); - GL11.glRotatef(90, 0, 1, 0); - if (heater) { - GL11.glRotatef(angle, 1F, 0, 0); - renderDoorHeater(0, 54, 12, 8, 128, 64); - } else { - GL11.glRotatef(-angle, 1F, 0, 0); - renderDoor(0, 54, 12, 8, 128, 64); - } - GL11.glPopMatrix(); - GL11.glPopMatrix(); - - GL11.glPopMatrix(); // end - - } - private void bindTextureByName(String image) - { - bindTexture(TextureHelperMF.getResource(image)); - } - -public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { -renderAModelAt((TileEntityBigFurnace) tileentity, d, d1, d2, f); //where to render -} - - -private void renderDoor(int x, int y, int w, int h, int tw, int th) { - Minecraft mc = Minecraft.getMinecraft(); - - float f = 0.01F / (float)tw; - float f1 = 0.01F / (float)th; - - float x1 = (float)x / (float)tw + f; - float x2 = (float)(x + w) / tw - f; - float y1 = (float)y / th + f1; - float y2 = (float)(y + h) / th - f1; - - Tessellator image = Tessellator.instance; - float xPos = 0.5F; - float yPos = 0.0F; - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glTranslatef(-xPos, -yPos, pixel(0.5F)); - float var13 = 1F; - GL11.glScalef(var13, var13, var13); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-1F, -1F, 0.0F); - ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F); - - -} -@Override -protected void bindTexture(ResourceLocation p_147499_1_) -{ - TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; - - if (texturemanager != null) - { - texturemanager.bindTexture(p_147499_1_); +public class TileEntityBigFurnaceRenderer extends TileEntitySpecialRenderer { + private ModelBigFurnace model; + + public TileEntityBigFurnaceRenderer() { + model = new ModelBigFurnace(); + } + + public void renderAModelAt(TileEntityBigFurnace tile, double d, double d1, double d2, float f) { + int i = 1; + if (tile.hasWorldObj()) { + i = tile.getBlockMetadata(); + } + + int j = 90 * i; + + if (i == 0) { + j = 0; + } + + if (i == 1) { + j = 270; + } + + if (i == 2) { + j = 180; + } + + if (i == 3) { + j = 90; + } + if (i == 4) { + j = 90; + } + + String type = tile.getTexture(); + + bindTextureByName("textures/models/tileentity/" + type + ".png"); // texture + + boolean display = tile.isBurning(); + + GL11.glPushMatrix(); // start + float scale = 1.0F; + + float offset = (1.0F - 0.0625F); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + (0.0635F * 2F), (float) d2 + 0.5F); // size + GL11.glRotatef(j - 90, 0.0F, 1.0F, 0.0F); + GL11.glScalef(scale, -scale, -scale); + model.renderModel(display, 0.0625F); + + float sc = 0.75F; + float angle = 90F / 20F * tile.doorAngle; + GL11.glPushMatrix(); + GL11.glTranslatef(-pixel(8), -pixel(12), 0); + if (tile.isHeater()) { + GL11.glTranslatef(0, pixel(12), 0); + } + GL11.glPushMatrix(); + GL11.glScalef(sc, sc, sc); + GL11.glRotatef(90, 0, 1, 0); + if (tile.isHeater()) { + GL11.glRotatef(angle, 1F, 0, 0); + renderDoorHeater(0, 54, 12, 8, 128, 64); + } else { + GL11.glRotatef(-angle, 1F, 0, 0); + renderDoor(0, 54, 12, 8, 128, 64); + } + GL11.glPopMatrix(); + GL11.glPopMatrix(); + + GL11.glPopMatrix(); // end + + } + + public void renderInvModel(boolean heater, String type, double d, double d1, double d2, float f) { + int j = 90; + + bindTextureByName("textures/models/tileentity/" + type + ".png"); // texture + + GL11.glPushMatrix(); // start + float scale = 1.0F; + + float offset = (1.0F - 0.0625F); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + (0.0635F * 2F), (float) d2 + 0.5F); // size + GL11.glRotatef(j - 90, 0.0F, 1.0F, 0.0F); + GL11.glScalef(scale, -scale, -scale); + model.renderModel(false, 0.0625F); + + float sc = 0.75F; + float angle = 0F; + GL11.glPushMatrix(); + GL11.glTranslatef(-pixel(8), -pixel(12), 0); + if (heater) { + GL11.glTranslatef(0, pixel(12), 0); + } + GL11.glPushMatrix(); + GL11.glScalef(sc, sc, sc); + GL11.glRotatef(90, 0, 1, 0); + if (heater) { + GL11.glRotatef(angle, 1F, 0, 0); + renderDoorHeater(0, 54, 12, 8, 128, 64); + } else { + GL11.glRotatef(-angle, 1F, 0, 0); + renderDoor(0, 54, 12, 8, 128, 64); + } + GL11.glPopMatrix(); + GL11.glPopMatrix(); + + GL11.glPopMatrix(); // end + + } + + private void bindTextureByName(String image) { + bindTexture(TextureHelperMF.getResource(image)); + } + + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityBigFurnace) tileentity, d, d1, d2, f); // where to render + } + + private void renderDoor(int x, int y, int w, int h, int tw, int th) { + Minecraft mc = Minecraft.getMinecraft(); + + float f = 0.01F / tw; + float f1 = 0.01F / th; + + float x1 = (float) x / (float) tw + f; + float x2 = (float) (x + w) / tw - f; + float y1 = (float) y / th + f1; + float y2 = (float) (y + h) / th - f1; + + Tessellator image = Tessellator.instance; + float xPos = 0.5F; + float yPos = 0.0F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslatef(-xPos, -yPos, pixel(0.5F)); + float var13 = 1F; + GL11.glScalef(var13, var13, var13); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-1F, -1F, 0.0F); + ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F); + + } + + @Override + protected void bindTexture(ResourceLocation p_147499_1_) { + TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; + + if (texturemanager != null) { + texturemanager.bindTexture(p_147499_1_); + } + } + + private void renderDoorHeater(int x, int y, int w, int h, int tw, int th) { + Minecraft mc = Minecraft.getMinecraft(); + + float f = 0.01F / tw; + float f1 = 0.01F / th; + + float x1 = (float) x / (float) tw + f; + float x2 = (float) (x + w) / tw - f; + float y1 = (float) y / th + f1; + float y2 = (float) (y + h) / th - f1; + + Tessellator image = Tessellator.instance; + float xPos = 0.5F; + float yPos = 1.0F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslatef(-xPos, -yPos, pixel(0.5F)); + float var13 = 1F; + GL11.glScalef(var13, var13, var13); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-1F, -1F, 0.0F); + ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F); + + } + + public float pixel(float count) { + return count * 0.0625F; } -} - -private void renderDoorHeater(int x, int y, int w, int h, int tw, int th) { - Minecraft mc = Minecraft.getMinecraft(); - - float f = 0.01F / (float)tw; - float f1 = 0.01F / (float)th; - - float x1 = (float)x / (float)tw + f; - float x2 = (float)(x + w) / tw - f; - float y1 = (float)y / th + f1; - float y2 = (float)(y + h) / th - f1; - - Tessellator image = Tessellator.instance; - float xPos = 0.5F; - float yPos = 1.0F; - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glTranslatef(-xPos, -yPos, pixel(0.5F)); - float var13 = 1F; - GL11.glScalef(var13, var13, var13); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-1F, -1F, 0.0F); - ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F); - - -} -public float pixel(float count) -{ - return count * 0.0625F; -} - - -private ModelBigFurnace model; } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBloomeryRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBloomeryRenderer.java index f39c0568..00e12321 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBloomeryRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBloomeryRenderer.java @@ -1,37 +1,33 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityBloomery; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; -public class TileEntityBloomeryRenderer extends TileEntitySpecialRenderer -{ - public TileEntityBloomeryRenderer() - { +import java.util.Random; + +public class TileEntityBloomeryRenderer extends TileEntitySpecialRenderer { + private ModelBloomery model; + private Random random = new Random(); + + public TileEntityBloomeryRenderer() { model = new ModelBloomery(); } - public void renderAModelAt(TileEntityBloomery tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntityBloomery tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); } - this.renderModelAt(tile, tile.getTextureName(), i, d, d1, d2, f, tile.getWorldObj() == null); + this.renderModelAt(tile, tile.getTextureName(), i, d, d1, d2, f, tile.getWorldObj() == null); } - - public void renderModelAt(TileEntityBloomery tile, String tex, int meta, double d, double d1, double d2, float f, boolean inv) - { + + public void renderModelAt(TileEntityBloomery tile, String tex, int meta, double d, double d1, double d2, float f, + boolean inv) { int i = meta; - int j = 90 * i; @@ -54,53 +50,49 @@ public void renderModelAt(TileEntityBloomery tile, String tex, int meta, double j = 90; } - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture - - GL11.glPushMatrix(); //start + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture + + GL11.glPushMatrix(); // start float scale = 1.0F; float yOffset = 1.0F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j-90F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j - 90F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - model.renderModel(tile, 0.0625F); - + model.renderModel(tile, 0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - - public void renderInvModel(String tex, double d, double d1, double d2, float f) - { + + public void renderInvModel(String tex, double d, double d1, double d2, float f) { int j = 90; - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture - - GL11.glPushMatrix(); //start + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture + + GL11.glPushMatrix(); // start float scale = 1.0F; float yOffset = 1.0F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j-90F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j - 90F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - model.renderModel(null, 0.0625F); - + model.renderModel(null, 0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end + + } + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); } - - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityBloomery) tileentity, d, d1, d2, f); //where to render + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityBloomery) tileentity, d, d1, d2, f); // where to render } - - private ModelBloomery model; - private Random random = new Random(); - + } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBombBenchRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBombBenchRenderer.java index e0bcb680..22dc7f88 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBombBenchRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBombBenchRenderer.java @@ -1,52 +1,44 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; +import java.util.Random; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. - * + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. + *

* Custom renderers based off render tutorial by MC_DucksAreBest */ -public class TileEntityBombBenchRenderer extends TileEntitySpecialRenderer -{ - public TileEntityBombBenchRenderer() - { +public class TileEntityBombBenchRenderer extends TileEntitySpecialRenderer { + private ModelBombBench model; + private Random random = new Random(); + + public TileEntityBombBenchRenderer() { model = new ModelBombBench(); } - public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); + } + for (int a = 0; a < 2; a++) { + if (shouldRender(tile, a)) { + this.renderModelAt("carpenter_bomb", i, d, d1, d2, f, a); + } } - for(int a = 0; a < 2; a ++) - { - if(shouldRender(tile, a)) - { - this.renderModelAt("carpenter_bomb", i, d, d1, d2, f, a); - } - } } - - public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass) - { + + public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass) { int i = meta; - int j = 90 * i; @@ -69,48 +61,41 @@ public void renderModelAt(String tex, int meta, double d, double d1, double d2, j = 90; } - if(renderPass == 1) - { - bindTextureByName("textures/models/tileentity/anvilGrid.png"); //texture - } - else - { - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture + if (renderPass == 1) { + bindTextureByName("textures/models/tileentity/anvilGrid.png"); // texture + } else { + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture } - - GL11.glPushMatrix(); //start - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.25F, (float) d2 + 0.5F); //size - GL11.glRotatef(j+180F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(1F, -1F, -1F); //if you read this comment out this line and you can see what happens + + GL11.glPushMatrix(); // start + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.25F, (float) d2 + 0.5F); // size + GL11.glRotatef(j + 180F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(1F, -1F, -1F); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - model.renderModel(0.0625F); - + model.renderModel(0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt (tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt(tileentity, d, d1, d2, f); // where to render + } + + private boolean shouldRender(TileEntity tile, int p) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer sp = mc.thePlayer; + if (p == 1)// GRID + { + return false; + } + return true; } - - private ModelBombBench model; - private Random random = new Random(); - - - private boolean shouldRender(TileEntity tile, int p) - { - Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer sp = mc.thePlayer; - if(p == 1)//GRID - { - return false; - } - return true; - } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBombPressRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBombPressRenderer.java index c5961579..d5b82e86 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityBombPressRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityBombPressRenderer.java @@ -1,53 +1,46 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityBombPress; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; +import java.util.Random; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. - * + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. + *

* Custom renderers based off render tutorial by MC_DucksAreBest */ -public class TileEntityBombPressRenderer extends TileEntitySpecialRenderer -{ - public TileEntityBombPressRenderer() - { +public class TileEntityBombPressRenderer extends TileEntitySpecialRenderer { + private ModelBombPress model; + private Random random = new Random(); + + public TileEntityBombPressRenderer() { model = new ModelBombPress(); } - public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); + } + for (int a = 0; a < 2; a++) { + if (shouldRender(tile, a)) { + this.renderModelAt("bombPress", i, d, d1, d2, f, a, ((TileEntityBombPress) tile).animation); + } } - for(int a = 0; a < 2; a ++) - { - if(shouldRender(tile, a)) - { - this.renderModelAt("bombPress", i, d, d1, d2, f, a, ((TileEntityBombPress)tile).animation); - } - } } - - public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass, float animation) - { + + public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass, + float animation) { int i = meta; - int j = 90 * i; @@ -69,41 +62,37 @@ public void renderModelAt(String tex, int meta, double d, double d1, double d2, if (i == 4) { j = 90; } - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture - - GL11.glPushMatrix(); //start - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1, (float) d2 + 0.5F); //size - GL11.glRotatef(j+180F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(1F, -1F, -1F); //if you read this comment out this line and you can see what happens + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture + + GL11.glPushMatrix(); // start + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1, (float) d2 + 0.5F); // size + GL11.glRotatef(j + 180F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(1F, -1F, -1F); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - model.renderModel(0.0625F, animation); - + model.renderModel(0.0625F, animation); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt (tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt(tileentity, d, d1, d2, f); // where to render + } + + private boolean shouldRender(TileEntity tile, int p) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer sp = mc.thePlayer; + if (p == 1)// GRID + { + return false; + } + return true; } - - private ModelBombPress model; - private Random random = new Random(); - - - private boolean shouldRender(TileEntity tile, int p) - { - Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer sp = mc.thePlayer; - if(p == 1)//GRID - { - return false; - } - return true; - } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityCarpenterRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityCarpenterRenderer.java index c4bdab5e..076c2dd6 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityCarpenterRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityCarpenterRenderer.java @@ -1,43 +1,36 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - import minefantasy.mf2.api.helpers.TextureHelperMF; -import minefantasy.mf2.block.tileentity.TileEntityBombBench; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; -public class TileEntityCarpenterRenderer extends TileEntitySpecialRenderer -{ - public TileEntityCarpenterRenderer() - { +import java.util.Random; + +public class TileEntityCarpenterRenderer extends TileEntitySpecialRenderer { + private ModelWoodCarpenter model; + private Random random = new Random(); + + public TileEntityCarpenterRenderer() { model = new ModelWoodCarpenter(); } - public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); + } + for (int a = 0; a < 2; a++) { + if (shouldRender(tile, a)) { + this.renderModelAt("carpenter", i, d, d1, d2, f, a); + } } - for(int a = 0; a < 2; a ++) - { - if(shouldRender(tile, a)) - { - this.renderModelAt("carpenter", i, d, d1, d2, f, a); - } - } } - - public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass) - { + + public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass) { int i = meta; - int j = 90 * i; @@ -60,48 +53,41 @@ public void renderModelAt(String tex, int meta, double d, double d1, double d2, j = 90; } - if(renderPass == 1) - { - bindTextureByName("textures/models/tileentity/anvilGrid.png"); //texture - } - else - { - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture + if (renderPass == 1) { + bindTextureByName("textures/models/tileentity/anvilGrid.png"); // texture + } else { + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture } - - GL11.glPushMatrix(); //start - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.25F, (float) d2 + 0.5F); //size - GL11.glRotatef(j+180F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(1F, -1F, -1F); //if you read this comment out this line and you can see what happens + + GL11.glPushMatrix(); // start + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.25F, (float) d2 + 0.5F); // size + GL11.glRotatef(j + 180F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(1F, -1F, -1F); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - model.renderModel(0.0625F); - + model.renderModel(0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt (tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt(tileentity, d, d1, d2, f); // where to render + } + + private boolean shouldRender(TileEntity tile, int p) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer sp = mc.thePlayer; + if (p == 1)// GRID + { + return false; + } + return true; } - - private ModelWoodCarpenter model; - private Random random = new Random(); - - - private boolean shouldRender(TileEntity tile, int p) - { - Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer sp = mc.thePlayer; - if(p == 1)//GRID - { - return false; - } - return true; - } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityCrossbowBenchRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityCrossbowBenchRenderer.java index 4294289d..65f3cb71 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityCrossbowBenchRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityCrossbowBenchRenderer.java @@ -1,52 +1,44 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; +import java.util.Random; /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. - * + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. + *

* Custom renderers based off render tutorial by MC_DucksAreBest */ -public class TileEntityCrossbowBenchRenderer extends TileEntitySpecialRenderer -{ - public TileEntityCrossbowBenchRenderer() - { +public class TileEntityCrossbowBenchRenderer extends TileEntitySpecialRenderer { + private ModelCrossbowBench model; + private Random random = new Random(); + + public TileEntityCrossbowBenchRenderer() { model = new ModelCrossbowBench(); } - public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); + } + for (int a = 0; a < 2; a++) { + if (shouldRender(tile, a)) { + this.renderModelAt("carpenter_crossbow", i, d, d1, d2, f, a); + } } - for(int a = 0; a < 2; a ++) - { - if(shouldRender(tile, a)) - { - this.renderModelAt("carpenter_crossbow", i, d, d1, d2, f, a); - } - } } - - public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass) - { + + public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f, int renderPass) { int i = meta; - int j = 90 * i; @@ -69,48 +61,41 @@ public void renderModelAt(String tex, int meta, double d, double d1, double d2, j = 90; } - if(renderPass == 1) - { - bindTextureByName("textures/models/tileentity/anvilGrid.png"); //texture - } - else - { - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture + if (renderPass == 1) { + bindTextureByName("textures/models/tileentity/anvilGrid.png"); // texture + } else { + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture } - - GL11.glPushMatrix(); //start - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.25F, (float) d2 + 0.5F); //size - GL11.glRotatef(j+180F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(1F, -1F, -1F); //if you read this comment out this line and you can see what happens + + GL11.glPushMatrix(); // start + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.25F, (float) d2 + 0.5F); // size + GL11.glRotatef(j + 180F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(1F, -1F, -1F); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - model.renderModel(0.0625F); - + model.renderModel(0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt (tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt(tileentity, d, d1, d2, f); // where to render + } + + private boolean shouldRender(TileEntity tile, int p) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer sp = mc.thePlayer; + if (p == 1)// GRID + { + return false; + } + return true; } - - private ModelCrossbowBench model; - private Random random = new Random(); - - - private boolean shouldRender(TileEntity tile, int p) - { - Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer sp = mc.thePlayer; - if(p == 1)//GRID - { - return false; - } - return true; - } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityFirepitRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityFirepitRenderer.java index 01b1fa22..a8668ac6 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityFirepitRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityFirepitRenderer.java @@ -1,87 +1,70 @@ package minefantasy.mf2.client.render.block; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityFirepit; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; -public class TileEntityFirepitRenderer extends TileEntitySpecialRenderer -{ - private ModelForgeTop topModel; - public TileEntityFirepitRenderer() - { +public class TileEntityFirepitRenderer extends TileEntitySpecialRenderer { + private ModelForgeTop topModel; + private ModelFirepit model; + + public TileEntityFirepitRenderer() { model = new ModelFirepit(); topModel = new ModelForgeTop(); } public void renderAModelAt(TileEntityFirepit tile, double d, double d1, double d2, float f) { - bindTextureByName("textures/models/tileentity/firepit.png"); + bindTextureByName("textures/models/tileentity/firepit.png"); GL11.glPushMatrix(); float yOffset = 0.0625F * 5F; - + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - - model.renderModel(tile, 0.0625F); - - if(tile.hasBlockAbove()) - { - GL11.glTranslatef(0F, -(1.5F-yOffset), 0F); - bindTextureByName("textures/models/tileentity/forge_top.png"); //texture - topModel.render(0.0625F); + GL11.glScalef(1.0F, -1F, -1F); + + model.renderModel(tile, 0.0625F); + + if (tile.hasBlockAbove()) { + GL11.glTranslatef(0F, -(1.5F - yOffset), 0F); + bindTextureByName("textures/models/tileentity/forge_top.png"); // texture + topModel.render(0.0625F); } GL11.glPopMatrix(); - } - public void renderInvModel(double d, double d1, double d2, float f) - { - bindTextureByName("textures/models/tileentity/firepit.png"); + + public void renderInvModel(double d, double d1, double d2, float f) { + bindTextureByName("textures/models/tileentity/firepit.png"); GL11.glPushMatrix(); float yOffset = 0.0625F * 5F; - + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - - model.renderModel(null, 0.0625F); - + GL11.glScalef(1.0F, -1F, -1F); + + model.renderModel(null, 0.0625F); + GL11.glPopMatrix(); - } + @Override - protected void bindTexture(ResourceLocation p_147499_1_) - { + protected void bindTexture(ResourceLocation p_147499_1_) { TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; - if (texturemanager != null) - { + if (texturemanager != null) { texturemanager.bindTexture(p_147499_1_); } } - - private void bindTextureByName(String image) - { - bindTexture(TextureHelperMF.getResource(image)); - } - - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityFirepit) tileentity, d, d1, d2, f); + + private void bindTextureByName(String image) { + bindTexture(TextureHelperMF.getResource(image)); + } + + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityFirepit) tileentity, d, d1, d2, f); } - - private ModelFirepit model; } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityForgeRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityForgeRenderer.java index d160ec26..b21b88e6 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityForgeRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityForgeRenderer.java @@ -1,38 +1,36 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - -import minefantasy.mf2.block.tileentity.TileEntityForge; import minefantasy.mf2.api.helpers.TextureHelperMF; +import minefantasy.mf2.block.tileentity.TileEntityForge; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; -public class TileEntityForgeRenderer extends TileEntitySpecialRenderer -{ - public TileEntityForgeRenderer() - { +import java.util.Random; + +public class TileEntityForgeRenderer extends TileEntitySpecialRenderer { + private ModelForge model; + private ModelForgeTop topModel; + private Random random = new Random(); + + public TileEntityForgeRenderer() { model = new ModelForge(); topModel = new ModelForgeTop(); } - public void renderAModelAt(TileEntityForge tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntityForge tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); } - this.renderModelAt(tile, tile.getTextureName(), i, d, d1, d2, f, tile.getWorldObj() == null, tile.hasFuel()); + this.renderModelAt(tile, tile.getTextureName(), i, d, d1, d2, f, tile.getWorldObj() == null, tile.hasFuel()); } - - public void renderModelAt(TileEntityForge tile, String tex, int meta, double d, double d1, double d2, float f, boolean inv, boolean hasFuel) - { + + public void renderModelAt(TileEntityForge tile, String tex, int meta, double d, double d1, double d2, float f, + boolean inv, boolean hasFuel) { int i = meta; - int j = 90 * i; @@ -55,76 +53,68 @@ public void renderModelAt(TileEntityForge tile, String tex, int meta, double d, j = 90; } - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture - - GL11.glPushMatrix(); //start + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture + + GL11.glPushMatrix(); // start float scale = 1.0F; float yOffset = inv ? 1.75F : 1.5F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j-90F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j - 90F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); float level = 0F; - if(tile != null && tile.fuel > 0 && tile.maxFuel > 0) - { - level = tile.fuel / tile.maxFuel; + if (tile != null && tile.fuel > 0 && tile.maxFuel > 0) { + level = tile.fuel / tile.maxFuel; } - model.renderModel(tile, 0.0625F, hasFuel, level); - - if(tile != null && tile.hasBlockAbove()) - { - bindTextureByName("textures/models/tileentity/forge_top.png"); //texture - topModel.render(0.0625F); + model.renderModel(tile, 0.0625F, hasFuel, level); + + if (tile != null && tile.hasBlockAbove()) { + bindTextureByName("textures/models/tileentity/forge_top.png"); // texture + topModel.render(0.0625F); } GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - - public void renderInvModel(String tex, double d, double d1, double d2, float f) - { + + public void renderInvModel(String tex, double d, double d1, double d2, float f) { int j = 90; - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture - - GL11.glPushMatrix(); //start + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture + + GL11.glPushMatrix(); // start float scale = 1.0F; float yOffset = 1.75F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j-90F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j - 90F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); float level = 0F; - model.renderModel(null, 0.0625F, false, level); - + model.renderModel(null, 0.0625F, false, level); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityForge) tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityForge) tileentity, d, d1, d2, f); // where to render + } + + private boolean shouldRender(TileEntityForge tile, int p) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer sp = mc.thePlayer; + if (p == 1)// GRID + { + return false; + } + return true; } - - private ModelForge model; - private ModelForgeTop topModel; - private Random random = new Random(); - - - private boolean shouldRender(TileEntityForge tile, int p) - { - Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer sp = mc.thePlayer; - if(p == 1)//GRID - { - return false; - } - return true; - } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityQuernRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityQuernRenderer.java index 47d6036e..55b41e03 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityQuernRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityQuernRenderer.java @@ -1,55 +1,50 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityQuern; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; -public class TileEntityQuernRenderer extends TileEntitySpecialRenderer -{ - public TileEntityQuernRenderer() - { +import java.util.Random; + +public class TileEntityQuernRenderer extends TileEntitySpecialRenderer { + private ModelQuern model; + private Random random = new Random(); + + public TileEntityQuernRenderer() { model = new ModelQuern(); } - public void renderAModelAt(TileEntityQuern tile, double d, double d1, double d2, float f) - { - this.renderModelAt(tile, tile.getTextureName(), d, d1, d2, f, tile.getWorldObj() == null); + public void renderAModelAt(TileEntityQuern tile, double d, double d1, double d2, float f) { + this.renderModelAt(tile, tile.getTextureName(), d, d1, d2, f, tile.getWorldObj() == null); } - - public void renderModelAt(TileEntityQuern tile, String tex, double d, double d1, double d2, float f, boolean inv) - { - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture - - GL11.glPushMatrix(); //start + + public void renderModelAt(TileEntityQuern tile, String tex, double d, double d1, double d2, float f, boolean inv) { + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture + + GL11.glPushMatrix(); // start float scale = 1.0F; float yOffset = 1.0F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - model.renderModel(tile, 0.0625F); - + model.renderModel(tile, 0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityQuern) tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); } - - private ModelQuern model; - private Random random = new Random(); - + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityQuern) tileentity, d, d1, d2, f); // where to render + } + } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityRackRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityRackRenderer.java index 7787a577..82442958 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityRackRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityRackRenderer.java @@ -1,9 +1,5 @@ package minefantasy.mf2.client.render.block; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.weapon.IRackItem; @@ -24,177 +20,182 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.IItemRenderer.ItemRendererHelper; import net.minecraftforge.client.MinecraftForgeClient; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class TileEntityRackRenderer extends TileEntitySpecialRenderer { + private static Minecraft mc = Minecraft.getMinecraft(); + private ModelRack model; -public class TileEntityRackRenderer extends TileEntitySpecialRenderer -{ - private static Minecraft mc = Minecraft.getMinecraft(); - public TileEntityRackRenderer() - { + public TileEntityRackRenderer() { model = new ModelRack(); } - - public void renderAModelAt(TileEntityRack tile, double d, double d1, double d2, float f) - { + + public static void renderEquippedItem(ItemRenderType type, IItemRenderer customRenderer, RenderBlocks renderBlocks, + ItemStack item) { + if (customRenderer.shouldUseRenderHelper(type, item, ItemRendererHelper.EQUIPPED_BLOCK)) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + customRenderer.renderItem(type, item, renderBlocks); + GL11.glPopMatrix(); + } else { + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslatef(0.0F, -0.3F, 0.0F); + + GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); + customRenderer.renderItem(type, item, renderBlocks); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + } + + public void renderAModelAt(TileEntityRack tile, double d, double d1, double d2, float f) { int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata()-2; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata() - 2; } - int j = i*90; - if(i == 1)j = 180; - if(i == 2)j = 90; - - GL11.glPushMatrix();//Start all - GL11.glTranslatef((float) d + 0.5F, (float) d1+1F, (float) d2 + 0.5F); - GL11.glRotatef(j+180, 0.0F, 1.0F, 0.0F); + int j = i * 90; + if (i == 1) + j = 180; + if (i == 2) + j = 90; + + GL11.glPushMatrix();// Start all + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1F, (float) d2 + 0.5F); + GL11.glRotatef(j + 180, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.0F, -1F, -1F); - float itemsStart = -(3F/16F); - float itemsGap = 4F/16F; - + float itemsStart = -(3F / 16F); + float itemsGap = 4F / 16F; + CustomMaterial material = tile.getMaterial(); - GL11.glColor3f((float)material.colourRGB[0]/255F, (float)material.colourRGB[1]/255F, (float)material.colourRGB[2]/255F); - - bindTextureByName("textures/models/tileentity/"+tile.getTexName()+"_base.png"); //texture - model.renderModel(0.0625F); - + GL11.glColor3f(material.colourRGB[0] / 255F, material.colourRGB[1] / 255F, material.colourRGB[2] / 255F); + + bindTextureByName("textures/models/tileentity/" + tile.getTexName() + "_base.png"); // texture + model.renderModel(0.0625F); + GL11.glColor3f(1F, 1F, 1F); - - bindTextureByName("textures/models/tileentity/"+tile.getTexName()+"_detail.png"); //texture - model.renderModel(0.0625F); - - for(int a = 0; a < 4; a ++) - { - GL11.glPushMatrix();//Start Individual Items - ItemStack itemstack = tile.getStackInSlot(a); - if(itemstack != null) - { - float o = tile.yCoord%2 == 0 ? 2F : 3F; - float x = itemsStart + (a*itemsGap) - (o/16F); - float y = 0.3F; - float z = a % 2 == 0 ? 0.4F : 0.45F; - z -= 6F/16F; - float r = getRotationForItem(itemstack.getItem()); - float scale = 1.0F; - if(itemstack.getItem() instanceof IRackItem) - { - IRackItem rackitem = (IRackItem)itemstack.getItem(); - scale = rackitem.getScale(itemstack); - x += rackitem.getOffsetX(itemstack); - y += rackitem.getOffsetY(itemstack); - z -= rackitem.getOffsetZ(itemstack); - r += rackitem.getRotationOffset(itemstack); - z -= (scale-1)/2 * 5.5F/16F; - y -= (scale-1)/2F; - } - - GL11.glTranslatef(x, y, z); - - GL11.glPushMatrix(); - GL11.glRotatef(90F, 0, 1F, 0); - GL11.glRotatef(r, 0, 0, 1F); - GL11.glScalef(scale, scale, 1); - - - IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, ItemRenderType.EQUIPPED); - if (isCustom(itemstack) && customRenderer != null) - { - this.mc.getTextureManager().bindTexture(this.mc.getTextureManager().getResourceLocation(itemstack.getItemSpriteNumber())); - renderEquippedItem(ItemRenderType.EQUIPPED, customRenderer, new RenderBlocks(), itemstack); - } - else - { - for(int layer = 0; layer < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); layer ++) - { - IIcon icon = itemstack.getItem().getIcon(itemstack, layer); - if(icon != null) - { - GL11.glPushMatrix(); - int colour = itemstack.getItem().getColorFromItemStack(itemstack, layer); - float red = (float)(colour >> 16 & 255) / 255.0F; - float green = (float)(colour >> 8 & 255) / 255.0F; - float blue = (float)(colour & 255) / 255.0F; - - GL11.glColor4f(red, green, blue, 1.0F); - - - renderItem(tile, itemstack, icon, a, layer); - GL11.glPopMatrix(); - } - } - } - GL11.glPopMatrix(); - } - - GL11.glPopMatrix();//END individual item placement + + bindTextureByName("textures/models/tileentity/" + tile.getTexName() + "_detail.png"); // texture + model.renderModel(0.0625F); + + for (int a = 0; a < 4; a++) { + GL11.glPushMatrix();// Start Individual Items + ItemStack itemstack = tile.getStackInSlot(a); + if (itemstack != null) { + float o = tile.yCoord % 2 == 0 ? 2F : 3F; + float x = itemsStart + (a * itemsGap) - (o / 16F); + float y = 0.3F; + float z = a % 2 == 0 ? 0.4F : 0.45F; + z -= 6F / 16F; + float r = getRotationForItem(itemstack.getItem()); + float scale = 1.0F; + if (itemstack.getItem() instanceof IRackItem) { + IRackItem rackitem = (IRackItem) itemstack.getItem(); + scale = rackitem.getScale(itemstack); + x += rackitem.getOffsetX(itemstack); + y += rackitem.getOffsetY(itemstack); + z -= rackitem.getOffsetZ(itemstack); + r += rackitem.getRotationOffset(itemstack); + z -= (scale - 1) / 2 * 5.5F / 16F; + y -= (scale - 1) / 2F; + } + + GL11.glTranslatef(x, y, z); + + GL11.glPushMatrix(); + GL11.glRotatef(90F, 0, 1F, 0); + GL11.glRotatef(r, 0, 0, 1F); + GL11.glScalef(scale, scale, 1); + + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, ItemRenderType.EQUIPPED); + if (isCustom(itemstack) && customRenderer != null) { + this.mc.getTextureManager().bindTexture( + this.mc.getTextureManager().getResourceLocation(itemstack.getItemSpriteNumber())); + renderEquippedItem(ItemRenderType.EQUIPPED, customRenderer, new RenderBlocks(), itemstack); + } else { + for (int layer = 0; layer < itemstack.getItem() + .getRenderPasses(itemstack.getItemDamage()); layer++) { + IIcon icon = itemstack.getItem().getIcon(itemstack, layer); + if (icon != null) { + GL11.glPushMatrix(); + int colour = itemstack.getItem().getColorFromItemStack(itemstack, layer); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + + GL11.glColor4f(red, green, blue, 1.0F); + + renderItem(tile, itemstack, icon, a, layer); + GL11.glPopMatrix(); + } + } + } + GL11.glPopMatrix(); + } + + GL11.glPopMatrix();// END individual item placement } - GL11.glPopMatrix(); //end all - + GL11.glPopMatrix(); // end all } - - public void renderInvModel(CustomMaterial material, String tex, double d, double d1, double d2, float f) - { + + public void renderInvModel(CustomMaterial material, String tex, double d, double d1, double d2, float f) { int j = 0; - - GL11.glPushMatrix();//Start all - GL11.glTranslatef((float) d + 0.5F, (float) d1+1F, (float) d2 + 0.5F); - GL11.glRotatef(j+180, 0.0F, 1.0F, 0.0F); + + GL11.glPushMatrix();// Start all + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1F, (float) d2 + 0.5F); + GL11.glRotatef(j + 180, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.0F, -1F, -1F); - float itemsStart = -(3F/16F); - float itemsGap = 4F/16F; - - GL11.glColor3f((float)material.colourRGB[0]/255F, (float)material.colourRGB[1]/255F, (float)material.colourRGB[2]/255F); - - bindTextureByName("textures/models/tileentity/"+tex+"_base.png"); //texture - model.renderModel(0.0625F); - + float itemsStart = -(3F / 16F); + float itemsGap = 4F / 16F; + + GL11.glColor3f(material.colourRGB[0] / 255F, material.colourRGB[1] / 255F, material.colourRGB[2] / 255F); + + bindTextureByName("textures/models/tileentity/" + tex + "_base.png"); // texture + model.renderModel(0.0625F); + GL11.glColor3f(1F, 1F, 1F); - - bindTextureByName("textures/models/tileentity/"+tex+"_detail.png"); //texture - model.renderModel(0.0625F); - - GL11.glPopMatrix(); //end all - + bindTextureByName("textures/models/tileentity/" + tex + "_detail.png"); // texture + model.renderModel(0.0625F); + + GL11.glPopMatrix(); // end all + + } + + private float getRotationForItem(Item item) { + String classname = item.getClass().getName(); + if (classname.endsWith("ItemCrossbow") || classname.endsWith("ItemBlunderbuss") + || classname.endsWith("ItemBlowgun") || classname.endsWith("ItemMusket")) { + return 45F; + } + return -45F; } - - private float getRotationForItem(Item item) { - String classname = item.getClass().getName(); - if(classname.endsWith("ItemCrossbow") || classname.endsWith("ItemBlunderbuss") || classname.endsWith("ItemBlowgun") || classname.endsWith("ItemMusket")) - { - return 45F; - } - return -45F; - } - - @Override - protected void bindTexture(ResourceLocation p_147499_1_) - { - TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; - - if (texturemanager != null) - { - texturemanager.bindTexture(p_147499_1_); - } - } - private void bindTextureByName(String image) - { - bindTexture(TextureHelperMF.getResource(image)); - } - - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityRack) tileentity, d, d1, d2, f); //where to render + + @Override + protected void bindTexture(ResourceLocation p_147499_1_) { + TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; + + if (texturemanager != null) { + texturemanager.bindTexture(p_147499_1_); + } + } + + private void bindTextureByName(String image) { + bindTexture(TextureHelperMF.getResource(image)); + } + + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityRack) tileentity, d, d1, d2, f); // where to render } - - - private void renderItem(TileEntityRack tile, ItemStack itemstack, IIcon icon, int slot, int layer) - { - GL11.glPushMatrix(); + + private void renderItem(TileEntityRack tile, ItemStack itemstack, IIcon icon, int slot, int layer) { + GL11.glPushMatrix(); TextureManager texturemanager = this.mc.getTextureManager(); GL11.glScalef(0.85F, 0.85F, 0.85F); - - if (icon == null) - { + + if (icon == null) { GL11.glPopMatrix(); return; } @@ -212,8 +213,7 @@ private void renderItem(TileEntityRack tile, ItemStack itemstack, IIcon icon, in GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - if (itemstack.hasEffect(layer)) - { + if (itemstack.hasEffect(layer)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); texturemanager.bindTexture(TextureHelperMF.ITEM_GLINT); @@ -225,14 +225,14 @@ private void renderItem(TileEntityRack tile, ItemStack itemstack, IIcon icon, in GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); - float f9 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; + float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); - f9 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; + f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); @@ -246,38 +246,12 @@ private void renderItem(TileEntityRack tile, ItemStack itemstack, IIcon icon, in GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); - } - - private boolean isCustom(ItemStack itemstack) - { - if(itemstack != null && itemstack.getItem() instanceof IRackItem) - { - return ((IRackItem)itemstack.getItem()).isSpecialRender(itemstack); - } - return false; - } - - public static void renderEquippedItem(ItemRenderType type, IItemRenderer customRenderer, RenderBlocks renderBlocks, ItemStack item) - { - if (customRenderer.shouldUseRenderHelper(type, item, ItemRendererHelper.EQUIPPED_BLOCK)) - { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - customRenderer.renderItem(type, item, renderBlocks); - GL11.glPopMatrix(); - } - else - { - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glTranslatef(0.0F, -0.3F, 0.0F); - - GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); - customRenderer.renderItem(type, item, renderBlocks); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); + } + + private boolean isCustom(ItemStack itemstack) { + if (itemstack != null && itemstack.getItem() instanceof IRackItem) { + return ((IRackItem) itemstack.getItem()).isSpecialRender(itemstack); } + return false; } - - private ModelRack model; } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityResearchRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityResearchRenderer.java index e2df5e0d..c403cac0 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityResearchRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityResearchRenderer.java @@ -1,36 +1,32 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - import minefantasy.mf2.api.helpers.TextureHelperMF; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; -public class TileEntityResearchRenderer extends TileEntitySpecialRenderer -{ - public TileEntityResearchRenderer() - { +import java.util.Random; + +public class TileEntityResearchRenderer extends TileEntitySpecialRenderer { + private ModelResearch model; + private Random random = new Random(); + + public TileEntityResearchRenderer() { model = new ModelResearch(); } - public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntity tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); } - this.renderModelAt("researchTable", i, d, d1, d2, f); + this.renderModelAt("researchTable", i, d, d1, d2, f); } - - public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f) - { + + public void renderModelAt(String tex, int meta, double d, double d1, double d2, float f) { int i = meta; - int j = 90 * i; @@ -53,41 +49,37 @@ public void renderModelAt(String tex, int meta, double d, double d1, double d2, j = 90; } - bindTextureByName("textures/models/tileentity/"+tex+".png"); //texture - - GL11.glPushMatrix(); //start - GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.25F, (float) d2 + 0.5F); //size - GL11.glRotatef(j+180F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(1F, -1F, -1F); //if you read this comment out this line and you can see what happens + bindTextureByName("textures/models/tileentity/" + tex + ".png"); // texture + + GL11.glPushMatrix(); // start + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.25F, (float) d2 + 0.5F); // size + GL11.glRotatef(j + 180F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(1F, -1F, -1F); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - model.renderModel(0.0625F); - + model.renderModel(0.0625F); + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt (tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt(tileentity, d, d1, d2, f); // where to render + } + + private boolean shouldRender(TileEntity tile, int p) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer sp = mc.thePlayer; + if (p == 1)// GRID + { + return false; + } + return true; } - - private ModelResearch model; - private Random random = new Random(); - - - private boolean shouldRender(TileEntity tile, int p) - { - Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer sp = mc.thePlayer; - if(p == 1)//GRID - { - return false; - } - return true; - } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityRoastRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityRoastRenderer.java index 17eecf6e..735b791d 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityRoastRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityRoastRenderer.java @@ -1,9 +1,5 @@ package minefantasy.mf2.client.render.block; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityRoast; import net.minecraft.block.Block; @@ -21,111 +17,106 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class TileEntityRoastRenderer extends TileEntitySpecialRenderer { + private final RenderBlocks blockrender = new RenderBlocks(); + private ModelOven ovenModel; -public class TileEntityRoastRenderer extends TileEntitySpecialRenderer -{ - private final RenderBlocks blockrender = new RenderBlocks(); - private ModelOven ovenModel; - public TileEntityRoastRenderer() - { - ovenModel = new ModelOven(); + public TileEntityRoastRenderer() { + ovenModel = new ModelOven(); } public void renderAModelAt(TileEntityRoast tile, double d, double d1, double d2, float f) { int i = 0; - if (tile.getWorldObj() != null) - { + if (tile.getWorldObj() != null) { i = tile.blockMetadata; } int j = 360 - (90 * i); - float pixelHeight = tile.isOven() ? 3F : 5F; + float pixelHeight = tile.isOven() ? 3F : 5F; GL11.glPushMatrix(); - GL11.glTranslatef((float) d +0.5F, (float) d1 + (pixelHeight/32), (float) d2 + 0.5F); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + (pixelHeight / 32), (float) d2 + 0.5F); GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); - GL11.glScalef(1.0F, -1F, -1F); - if(tile.isOven()) - { - GL11.glPushMatrix(); - GL11.glRotatef(180, 0, 1, 0); - bindTextureByName("textures/models/tileentity/oven_"+ tile.getTexName() +".png"); - ovenModel.render(0.0625F); - GL11.glPopMatrix(); + GL11.glScalef(1.0F, -1F, -1F); + if (tile.isOven()) { + GL11.glPushMatrix(); + GL11.glRotatef(180, 0, 1, 0); + bindTextureByName("textures/models/tileentity/oven_" + tile.getTexName() + ".png"); + ovenModel.render(0.0625F); + GL11.glPopMatrix(); } - + GL11.glRotatef(90, 1.0F, 0F, 0F); - renderHungItem((TileEntityRoast) tile, d, d1, d2, f); + renderHungItem(tile, d, d1, d2, f); GL11.glPopMatrix(); } + public void renderInvModel(String tex, boolean oven, double d, double d1, double d2, float f) { - - float pixelHeight = oven ? 3F : 5F; + + float pixelHeight = oven ? 3F : 5F; GL11.glPushMatrix(); - GL11.glTranslatef((float) d +0.5F, (float) d1 + (pixelHeight/32), (float) d2 + 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - if(oven) - { - GL11.glPushMatrix(); - GL11.glRotatef(180, 0, 1, 0); - bindTextureByName("textures/models/tileentity/oven_"+ tex +".png"); - ovenModel.render(0.0625F); - GL11.glPopMatrix(); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + (pixelHeight / 32), (float) d2 + 0.5F); + GL11.glScalef(1.0F, -1F, -1F); + if (oven) { + GL11.glPushMatrix(); + GL11.glRotatef(180, 0, 1, 0); + bindTextureByName("textures/models/tileentity/oven_" + tex + ".png"); + ovenModel.render(0.0625F); + GL11.glPopMatrix(); } - + GL11.glPopMatrix(); } - + @Override - protected void bindTexture(ResourceLocation p_147499_1_) - { - TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; + protected void bindTexture(ResourceLocation p_147499_1_) { + TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; + + if (texturemanager != null) { + texturemanager.bindTexture(p_147499_1_); + } + } - if (texturemanager != null) - { - texturemanager.bindTexture(p_147499_1_); - } - } - private void bindTextureByName(String image) - { - bindTexture(TextureHelperMF.getResource(image)); - } + private void bindTextureByName(String image) { + bindTexture(TextureHelperMF.getResource(image)); + } - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityRoast) tileentity, d, d1, d2, f); + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityRoast) tileentity, d, d1, d2, f); } - - private void renderHungItem(TileEntityRoast tile, double d, double d1, double d2, float f) - { - Minecraft mc = Minecraft.getMinecraft(); - ItemStack itemstack = tile.getStackInSlot(0); - if(itemstack == null)return; - //Block - if (itemstack.getItemSpriteNumber() == 0 && itemstack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType())) - { - Block block = Block.getBlockFromItem(itemstack.getItem()); - if(block != null) - { - //this.blockrender.renderBlockAsItem(block, itemstack.getItemDamage(), 1.0F); - } + + private void renderHungItem(TileEntityRoast tile, double d, double d1, double d2, float f) { + Minecraft mc = Minecraft.getMinecraft(); + ItemStack itemstack = tile.getStackInSlot(0); + if (itemstack == null) + return; + // Block + if (itemstack.getItemSpriteNumber() == 0 && itemstack.getItem() instanceof ItemBlock + && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType())) { + Block block = Block.getBlockFromItem(itemstack.getItem()); + if (block != null) { + // this.blockrender.renderBlockAsItem(block, itemstack.getItemDamage(), 1.0F); + } } - //Item - else if(itemstack.getItem().getIconFromDamage(itemstack.getItemDamage()) != null) - { - Item item = itemstack.getItem(); - mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); - - Tessellator image = Tessellator.instance; - IIcon index = item.getIconFromDamage(itemstack.getItemDamage()); - float x1 = index.getMaxU(); - float x2 = index.getMinU(); - float y1 = index.getMinV(); - float y2 = index.getMaxV(); - float scale = 0.5F; - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glTranslatef(-scale/2, -scale/2, 0.0F); - GL11.glScalef(scale, scale, scale); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-1F, -1F, 0.0F); - ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, index.getIconWidth(), index.getIconHeight(), 0.0625F); - } - } + // Item + else if (itemstack.getItem().getIconFromDamage(itemstack.getItemDamage()) != null) { + Item item = itemstack.getItem(); + mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); + + Tessellator image = Tessellator.instance; + IIcon index = item.getIconFromDamage(itemstack.getItemDamage()); + float x1 = index.getMaxU(); + float x2 = index.getMinU(); + float y1 = index.getMinV(); + float y2 = index.getMaxV(); + float scale = 0.5F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslatef(-scale / 2, -scale / 2, 0.0F); + GL11.glScalef(scale, scale, scale); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-1F, -1F, 0.0F); + ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, index.getIconWidth(), index.getIconHeight(), 0.0625F); + } + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntitySmokePipeRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntitySmokePipeRenderer.java index 7e8d95ab..78f5d732 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntitySmokePipeRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntitySmokePipeRenderer.java @@ -1,54 +1,49 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - -import org.lwjgl.opengl.GL11; - import minefantasy.mf2.api.helpers.TextureHelperMF; -import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.tileentity.TileEntityChimney; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; +import org.lwjgl.opengl.GL11; + +import java.util.Random; + +public class TileEntitySmokePipeRenderer extends TileEntitySpecialRenderer { + private static ModelSmokePipe model = new ModelSmokePipe(); + private Random random = new Random(); -public class TileEntitySmokePipeRenderer extends TileEntitySpecialRenderer -{ - public TileEntitySmokePipeRenderer() - { + public TileEntitySmokePipeRenderer() { } - - public void renderAModelAt(TileEntityChimney tile, double d, double d1, double d2, float f) - { - if(tile != null && !tile.isPipeChimney()) - { - return; - } - GL11.glPushMatrix(); //start + + public void renderAModelAt(TileEntityChimney tile, double d, double d1, double d2, float f) { + if (tile != null && !tile.isPipeChimney()) { + return; + } + GL11.glPushMatrix(); // start float scale = 1.0F; float yOffset = 0.5F; - - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - - bindTextureByName("textures/models/tileentity/smoke_pipe.png"); //texture - model.renderModel(tile, 0.0625F); - - GL11.glPopMatrix(); + + bindTextureByName("textures/models/tileentity/smoke_pipe.png"); // texture + model.renderModel(tile, 0.0625F); + + GL11.glPopMatrix(); GL11.glColor3f(1F, 1F, 1F); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityChimney) tileentity, d, d1, d2, f); //where to render + + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); + } + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityChimney) tileentity, d, d1, d2, f); // where to render } - - private static ModelSmokePipe model = new ModelSmokePipe(); - private Random random = new Random(); } diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityTanningRackRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityTanningRackRenderer.java index 0427cf5b..8216043b 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityTanningRackRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityTanningRackRenderer.java @@ -1,6 +1,5 @@ package minefantasy.mf2.client.render.block; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.block.tileentity.TileEntityTanningRack; import net.minecraft.client.Minecraft; @@ -15,21 +14,22 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -public class TileEntityTanningRackRenderer extends TileEntitySpecialRenderer -{ +public class TileEntityTanningRackRenderer extends TileEntitySpecialRenderer { + + private ModelTanningRack model; + private ModelEngTanningRack engmodel; - public TileEntityTanningRackRenderer() - { + public TileEntityTanningRackRenderer() { engmodel = new ModelEngTanningRack(); model = new ModelTanningRack(); } public void renderAModelAt(TileEntityTanningRack tile, double d, double d1, double d2, float f) { - if (tile != null); + if (tile != null) + ; int i = 0; if (tile.getWorldObj() != null) { i = tile.blockMetadata; @@ -55,101 +55,87 @@ public void renderAModelAt(TileEntityTanningRack tile, double d, double d1, doub if (i == 4) { j = 90; } - bindTextureByName("textures/models/tileentity/tanner"+tile.tex+".png"); + bindTextureByName("textures/models/tileentity/tanner" + tile.tex + ".png"); GL11.glPushMatrix(); - GL11.glTranslatef((float) d + 0.5F, (float) d1+1.45F, (float) d2 + 0.5F); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.45F, (float) d2 + 0.5F); GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); - GL11.glScalef(1.0F, -1F, -1F); - if(tile.isAutomated()) - { - engmodel.renderModel(0.0625F); - GL11.glPushMatrix(); - GL11.glTranslatef(0F, tile.acTime, 0F); - engmodel.renderBlade(0.0625F); - GL11.glPopMatrix(); - engmodel.rotateLever(tile.acTime); - engmodel.renderLever(0.0625F); - } - else - { - model.renderModel(0.0625F); - } - renderHungItem((TileEntityTanningRack) tile, d, d1, d2, f); + GL11.glScalef(1.0F, -1F, -1F); + if (tile.isAutomated()) { + engmodel.renderModel(0.0625F); + GL11.glPushMatrix(); + GL11.glTranslatef(0F, tile.acTime, 0F); + engmodel.renderBlade(0.0625F); + GL11.glPopMatrix(); + engmodel.rotateLever(tile.acTime); + engmodel.renderLever(0.0625F); + } else { + model.renderModel(0.0625F); + } + renderHungItem(tile, d, d1, d2, f); GL11.glPopMatrix(); - } - + public void renderInvModel(String tex, boolean isAuto, double d, double d1, double d2, float f) { int j = 90; - bindTextureByName("textures/models/tileentity/tanner"+tex+".png"); + bindTextureByName("textures/models/tileentity/tanner" + tex + ".png"); GL11.glPushMatrix(); - GL11.glTranslatef((float) d + 0.5F, (float) d1+1.45F, (float) d2 + 0.5F); + GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.45F, (float) d2 + 0.5F); GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); - GL11.glScalef(1.0F, -1F, -1F); - if(isAuto) - { - engmodel.renderModel(0.0625F); - GL11.glPushMatrix(); - engmodel.renderBlade(0.0625F); - GL11.glPopMatrix(); - engmodel.renderLever(0.0625F); - } - else - { - model.renderModel(0.0625F); - } + GL11.glScalef(1.0F, -1F, -1F); + if (isAuto) { + engmodel.renderModel(0.0625F); + GL11.glPushMatrix(); + engmodel.renderBlade(0.0625F); + GL11.glPopMatrix(); + engmodel.renderLever(0.0625F); + } else { + model.renderModel(0.0625F); + } GL11.glPopMatrix(); - } + @Override - protected void bindTexture(ResourceLocation p_147499_1_) - { - TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; - - if (texturemanager != null) - { - texturemanager.bindTexture(p_147499_1_); - } - } - private void bindTextureByName(String image) - { - bindTexture(TextureHelperMF.getResource(image)); - } - - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityTanningRack) tileentity, d, d1, d2, f); + protected void bindTexture(ResourceLocation p_147499_1_) { + TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; + + if (texturemanager != null) { + texturemanager.bindTexture(p_147499_1_); + } + } + + private void bindTextureByName(String image) { + bindTexture(TextureHelperMF.getResource(image)); + } + + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityTanningRack) tileentity, d, d1, d2, f); + } + + private void renderHungItem(TileEntityTanningRack tile, double d, double d1, double d2, float f) { + Minecraft mc = Minecraft.getMinecraft(); + ItemStack itemstack = tile.getStackInSlot(0); + if (itemstack != null && itemstack.getItem().getIconFromDamage(itemstack.getItemDamage()) != null) { + Item item = itemstack.getItem(); + mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); + + Tessellator image = Tessellator.instance; + IIcon index = item.getIconFromDamage(itemstack.getItemDamage()); + float x1 = index.getMinU(); + float x2 = index.getMaxU(); + float y1 = index.getMinV(); + float y2 = index.getMaxV(); + float xPos = 0.5F; + float yPos = -0.5F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslatef(-xPos, -yPos, 0.0F); + float var13 = 1F; + GL11.glScalef(var13, var13, var13); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-1F, -1F, 0.0F); + ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, index.getIconWidth(), index.getIconHeight(), 0.0625F); + } + } - - private void renderHungItem(TileEntityTanningRack tile, double d, double d1, - double d2, float f) { - Minecraft mc = Minecraft.getMinecraft(); - ItemStack itemstack = tile.getStackInSlot(0); - if(itemstack != null && itemstack.getItem().getIconFromDamage(itemstack.getItemDamage()) != null) - { - Item item = itemstack.getItem(); - mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); - - Tessellator image = Tessellator.instance; - IIcon index = item.getIconFromDamage(itemstack.getItemDamage()); - float x1 = index.getMinU(); - float x2 = index.getMaxU(); - float y1 = index.getMinV(); - float y2 = index.getMaxV(); - float xPos = 0.5F; - float yPos = -0.5F; - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glTranslatef(-xPos, -yPos, 0.0F); - float var13 = 1F; - GL11.glScalef(var13, var13, var13); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-1F, -1F, 0.0F); - ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, index.getIconWidth(), index.getIconHeight(), 0.0625F); - } - - } - - private ModelTanningRack model; - private ModelEngTanningRack engmodel; } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/block/TileEntityTroughRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/TileEntityTroughRenderer.java index 049e2950..56c55131 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/TileEntityTroughRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/TileEntityTroughRenderer.java @@ -1,40 +1,34 @@ package minefantasy.mf2.client.render.block; -import java.util.Random; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.tileentity.decor.TileEntityTrough; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; - import org.lwjgl.opengl.GL11; -public class TileEntityTroughRenderer extends TileEntitySpecialRenderer -{ - public TileEntityTroughRenderer() - { +import java.util.Random; + +public class TileEntityTroughRenderer extends TileEntitySpecialRenderer { + private ModelTrough model; + + public TileEntityTroughRenderer() { model = new ModelTrough(); } - public void renderAModelAt(TileEntityTrough tile, double d, double d1, double d2, float f) - { - int i = 0; - if (tile.getWorldObj() != null) - { - i = tile.getBlockMetadata(); + public void renderAModelAt(TileEntityTrough tile, double d, double d1, double d2, float f) { + int i = 0; + if (tile.getWorldObj() != null) { + i = tile.getBlockMetadata(); } - this.renderModelAt(tile, i, d, d1, d2, f); + this.renderModelAt(tile, i, d, d1, d2, f); } - - public void renderModelAt(TileEntityTrough tile, int meta, double d, double d1, double d2, float f) - { - int i = meta; - - int j = 90 * i; + public void renderModelAt(TileEntityTrough tile, int meta, double d, double d1, double d2, float f) { + int i = meta; + + int j = 90 * i; if (i == 1) { j = 0; @@ -54,75 +48,70 @@ public void renderModelAt(TileEntityTrough tile, int meta, double d, double d1, if (i == 0) { j = 90; } - - GL11.glPushMatrix(); //start + + GL11.glPushMatrix(); // start float scale = 1.0F; - float yOffset = 1/16F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + float yOffset = 1 / 16F; + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); float level = 0F; - + CustomMaterial material = tile.getMaterial(); - GL11.glColor3f((float)material.colourRGB[0]/255F, (float)material.colourRGB[1]/255F, (float)material.colourRGB[2]/255F); - - bindTextureByName("textures/models/tileentity/"+tile.getTexName()+"_base.png"); //texture - model.renderModel(0.0625F); - + GL11.glColor3f(material.colourRGB[0] / 255F, material.colourRGB[1] / 255F, material.colourRGB[2] / 255F); + + bindTextureByName("textures/models/tileentity/" + tile.getTexName() + "_base.png"); // texture + model.renderModel(0.0625F); + GL11.glColor3f(1F, 1F, 1F); - - float height = (float)tile.fill / (float)tile.getCapacity(); - if(tile.fill > 0) - { - GL11.glEnable(GL11.GL_BLEND); + + float height = (float) tile.fill / (float) tile.getCapacity(); + if (tile.fill > 0) { + GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - bindTextureByName("textures/models/tileentity/"+tile.getTexName()+"_water.png"); //texture - GL11.glColor4f(1F, 1F, 1F, 0.5F); - GL11.glTranslatef(0F, -height*0.35F, 0F); - model.renderWater(0.0625F); + + bindTextureByName("textures/models/tileentity/" + tile.getTexName() + "_water.png"); // texture + GL11.glColor4f(1F, 1F, 1F, 0.5F); + GL11.glTranslatef(0F, -height * 0.35F, 0F); + model.renderWater(0.0625F); } GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end } - - public void renderInvModel(String tex, CustomMaterial material, double d, double d1, double d2, float f) - { - int j = 90; - GL11.glPushMatrix(); //start + public void renderInvModel(String tex, CustomMaterial material, double d, double d1, double d2) { + int j = 90; + + GL11.glPushMatrix(); // start float scale = 1.0F; - float yOffset = 1/16F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens + float yOffset = 1 / 16F; + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens GL11.glPushMatrix(); - float level = 0F; - - GL11.glColor3f((float)material.colourRGB[0]/255F, (float)material.colourRGB[1]/255F, (float)material.colourRGB[2]/255F); - - bindTextureByName("textures/models/tileentity/"+tex+"_base.png"); //texture - model.renderModel(0.0625F); - + + GL11.glColor3f(material.colourRGB[0] / 255F, material.colourRGB[1] / 255F, material.colourRGB[2] / 255F); + + bindTextureByName("textures/models/tileentity/" + tex + "_base.png"); // texture + model.renderModel(0.0625F); + GL11.glColor3f(1F, 1F, 1F); - + GL11.glPopMatrix(); GL11.glColor3f(255, 255, 255); - GL11.glPopMatrix(); //end + GL11.glPopMatrix(); // end + + } + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderAModelAt((TileEntityTrough) tileentity, d, d1, d2, f); //where to render + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderAModelAt((TileEntityTrough) tileentity, d, d1, d2, f); // where to render } - - private ModelTrough model; - private Random random = new Random(); } diff --git a/src/main/java/minefantasy/mf2/client/render/block/component/ModelBarStack.java b/src/main/java/minefantasy/mf2/client/render/block/component/ModelBarStack.java index b2564a49..ee3ef5c2 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/component/ModelBarStack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/component/ModelBarStack.java @@ -3,68 +3,62 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -public class ModelBarStack extends ModelBase -{ - private ModelRenderer[] bar = new ModelRenderer[64]; - - public ModelBarStack() - { - textureWidth = 32; - textureHeight = 16; - int i = 0; - for(int y = 0; y < 4; y ++) - { - for(int z = 0; z < 2; z ++) - { - for(int x = 0; x < 2; x ++) - { - float xCoord = -7.5F + (x*8F); - float yCoord = 12F - (y*4F); - float zCoord = 7.5F - (z*8F); - - bar[i] = new ModelRenderer(this, 0, 0); - bar[i].addBox(0F, 2F, -7F, 3, 2, 7); - bar[i].setRotationPoint(xCoord, yCoord, zCoord); - bar[i].setTextureSize(64, 32); - setRotation(bar[i], 0F, 0F, 0F); - ++i; - - bar[i] = new ModelRenderer(this, 0, 0); - bar[i].addBox(4F, 2F, -7F, 3, 2, 7); - bar[i].setRotationPoint(xCoord, yCoord, zCoord); - bar[i].setTextureSize(64, 32); - setRotation(bar[i], 0F, 0F, 0F); - ++i; - - bar[i] = new ModelRenderer(this, 0, 0); - bar[i].addBox(-3F, 0F, -7F, 3, 2, 7); - bar[i].setRotationPoint(xCoord, yCoord, zCoord); - bar[i].setTextureSize(64, 32); - setRotation(bar[i], 0F, -1.570796F, 0F); - ++i; - - bar[i] = new ModelRenderer(this, 0, 0); - bar[i].addBox(-7F, 0F, -7F, 3, 2, 7); - bar[i].setRotationPoint(xCoord, yCoord, zCoord); - bar[i].setTextureSize(64, 32); - setRotation(bar[i], 0F, -1.570796F, 0F); - ++i; - } - } - } - - } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void render(int stackSize, float f) - { - for(int i = 0; i < stackSize; i ++) - { - bar[i].render(f); - } - } +public class ModelBarStack extends ModelBase { + private ModelRenderer[] bar = new ModelRenderer[64]; + + public ModelBarStack() { + textureWidth = 32; + textureHeight = 16; + int i = 0; + for (int y = 0; y < 4; y++) { + for (int z = 0; z < 2; z++) { + for (int x = 0; x < 2; x++) { + float xCoord = -7.5F + (x * 8F); + float yCoord = 12F - (y * 4F); + float zCoord = 7.5F - (z * 8F); + + bar[i] = new ModelRenderer(this, 0, 0); + bar[i].addBox(0F, 2F, -7F, 3, 2, 7); + bar[i].setRotationPoint(xCoord, yCoord, zCoord); + bar[i].setTextureSize(64, 32); + setRotation(bar[i], 0F, 0F, 0F); + ++i; + + bar[i] = new ModelRenderer(this, 0, 0); + bar[i].addBox(4F, 2F, -7F, 3, 2, 7); + bar[i].setRotationPoint(xCoord, yCoord, zCoord); + bar[i].setTextureSize(64, 32); + setRotation(bar[i], 0F, 0F, 0F); + ++i; + + bar[i] = new ModelRenderer(this, 0, 0); + bar[i].addBox(-3F, 0F, -7F, 3, 2, 7); + bar[i].setRotationPoint(xCoord, yCoord, zCoord); + bar[i].setTextureSize(64, 32); + setRotation(bar[i], 0F, -1.570796F, 0F); + ++i; + + bar[i] = new ModelRenderer(this, 0, 0); + bar[i].addBox(-7F, 0F, -7F, 3, 2, 7); + bar[i].setRotationPoint(xCoord, yCoord, zCoord); + bar[i].setTextureSize(64, 32); + setRotation(bar[i], 0F, -1.570796F, 0F); + ++i; + } + } + } + + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(int stackSize, float f) { + for (int i = 0; i < stackSize; i++) { + bar[i].render(f); + } + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/component/ModelBigPlateStack.java b/src/main/java/minefantasy/mf2/client/render/block/component/ModelBigPlateStack.java index 350e59b8..fdf05c69 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/component/ModelBigPlateStack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/component/ModelBigPlateStack.java @@ -3,76 +3,71 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -public class ModelBigPlateStack extends ModelBase -{ - private ModelRenderer[] sheet = new ModelRenderer[8]; +public class ModelBigPlateStack extends ModelBase { + private ModelRenderer[] sheet = new ModelRenderer[8]; - public ModelBigPlateStack() - { - textureWidth = 64; - textureHeight = 16; - - sheet[0] = new ModelRenderer(this, 0, 0); - sheet[0].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); - sheet[0].setRotationPoint(0F, 14F, 0F); - sheet[0].setTextureSize(64, 16); - setRotation(sheet[0], 0F, 0F, 0F); + public ModelBigPlateStack() { + textureWidth = 64; + textureHeight = 16; - sheet[1] = new ModelRenderer(this, 0, 0); - sheet[1].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); - sheet[1].setRotationPoint(0F, 12F, 0F); - sheet[1].setTextureSize(64, 16); - setRotation(sheet[1], 0F, 0.0349066F, 0F); + sheet[0] = new ModelRenderer(this, 0, 0); + sheet[0].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); + sheet[0].setRotationPoint(0F, 14F, 0F); + sheet[0].setTextureSize(64, 16); + setRotation(sheet[0], 0F, 0F, 0F); - sheet[2] = new ModelRenderer(this, 0, 0); - sheet[2].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); - sheet[2].setRotationPoint(0F, 10F, 0F); - sheet[2].setTextureSize(64, 16); - setRotation(sheet[2], 0F, -0.0349066F, 0F); + sheet[1] = new ModelRenderer(this, 0, 0); + sheet[1].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); + sheet[1].setRotationPoint(0F, 12F, 0F); + sheet[1].setTextureSize(64, 16); + setRotation(sheet[1], 0F, 0.0349066F, 0F); - sheet[3] = new ModelRenderer(this, 0, 0); - sheet[3].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); - sheet[3].setRotationPoint(0F, 8F, 0F); - sheet[3].setTextureSize(64, 16); - setRotation(sheet[3], 0F, 0.1047198F, 0F); + sheet[2] = new ModelRenderer(this, 0, 0); + sheet[2].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); + sheet[2].setRotationPoint(0F, 10F, 0F); + sheet[2].setTextureSize(64, 16); + setRotation(sheet[2], 0F, -0.0349066F, 0F); - sheet[4] = new ModelRenderer(this, 0, 0); - sheet[4].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); - sheet[4].setRotationPoint(0F, 6F, 0F); - sheet[4].setTextureSize(64, 16); - setRotation(sheet[4], 0F, 0F, 0F); + sheet[3] = new ModelRenderer(this, 0, 0); + sheet[3].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); + sheet[3].setRotationPoint(0F, 8F, 0F); + sheet[3].setTextureSize(64, 16); + setRotation(sheet[3], 0F, 0.1047198F, 0F); - sheet[5] = new ModelRenderer(this, 0, 0); - sheet[5].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); - sheet[5].setRotationPoint(0F, 4F, 0F); - sheet[5].setTextureSize(64, 16); - setRotation(sheet[5], 0F, -0.0872665F, 0F); + sheet[4] = new ModelRenderer(this, 0, 0); + sheet[4].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); + sheet[4].setRotationPoint(0F, 6F, 0F); + sheet[4].setTextureSize(64, 16); + setRotation(sheet[4], 0F, 0F, 0F); - sheet[6] = new ModelRenderer(this, 0, 0); - sheet[6].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); - sheet[6].setRotationPoint(0F, 2F, 0F); - sheet[6].setTextureSize(64, 16); - setRotation(sheet[6], 0F, 0.0174533F, 0F); + sheet[5] = new ModelRenderer(this, 0, 0); + sheet[5].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); + sheet[5].setRotationPoint(0F, 4F, 0F); + sheet[5].setTextureSize(64, 16); + setRotation(sheet[5], 0F, -0.0872665F, 0F); - sheet[7] = new ModelRenderer(this, 0, 0); - sheet[7].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); - sheet[7].setRotationPoint(0F, 0F, 0F); - sheet[7].setTextureSize(64, 16); - setRotation(sheet[7], 0F, 0.0698132F, 0F); - } + sheet[6] = new ModelRenderer(this, 0, 0); + sheet[6].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); + sheet[6].setRotationPoint(0F, 2F, 0F); + sheet[6].setTextureSize(64, 16); + setRotation(sheet[6], 0F, 0.0174533F, 0F); - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + sheet[7] = new ModelRenderer(this, 0, 0); + sheet[7].addBox(-6.5F, 0F, -6.5F, 13, 2, 13); + sheet[7].setRotationPoint(0F, 0F, 0F); + sheet[7].setTextureSize(64, 16); + setRotation(sheet[7], 0F, 0.0698132F, 0F); + } - public void render(int stackSize, float f) - { - for (int i = 0; i < stackSize; i++) - { - sheet[i].render(f); - } - } + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(int stackSize, float f) { + for (int i = 0; i < stackSize; i++) { + sheet[i].render(f); + } + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/component/ModelJugStack.java b/src/main/java/minefantasy/mf2/client/render/block/component/ModelJugStack.java index 0055fcda..a84448e6 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/component/ModelJugStack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/component/ModelJugStack.java @@ -3,52 +3,45 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -public class ModelJugStack extends ModelBase -{ - private ModelRenderer[] jug = new ModelRenderer[32]; - - public ModelJugStack() - { - textureWidth = 32; - textureHeight =16; - int i = 0; - for(int y = 0; y < 2; y ++) - { - for(int z = 0; z < 4; z ++) - { - for(int x = 0; x < 4; x ++) - { - float xCoord = -8F + (x * 4F); - float yCoord = 8F - (y * 8F); - float zCoord = 8F - (z * 4F); - - - jug[i] = new ModelRenderer(this, 0, 4); - jug[i].addBox(0F, 2F, -3F, 3, 6, 3); - jug[i].setTextureOffset(12, 0); - jug[i].addBox(1F, 1F, -2F, 3, 6, 1); - jug[i].setTextureOffset(0, 0); - jug[i].addBox(0.5F, 0F, -2.5F, 2, 2, 2); - - jug[i].setRotationPoint(xCoord, yCoord, zCoord); - jug[i].setTextureSize(31, 16); - ++i; - } - } - } - - } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void render(int stackSize, float f) - { - for(int i = 0; i < stackSize; i ++) - { - jug[i].render(f); - } - } +public class ModelJugStack extends ModelBase { + private ModelRenderer[] jug = new ModelRenderer[32]; + + public ModelJugStack() { + textureWidth = 32; + textureHeight = 16; + int i = 0; + for (int y = 0; y < 2; y++) { + for (int z = 0; z < 4; z++) { + for (int x = 0; x < 4; x++) { + float xCoord = -8F + (x * 4F); + float yCoord = 8F - (y * 8F); + float zCoord = 8F - (z * 4F); + + jug[i] = new ModelRenderer(this, 0, 4); + jug[i].addBox(0F, 2F, -3F, 3, 6, 3); + jug[i].setTextureOffset(12, 0); + jug[i].addBox(1F, 1F, -2F, 3, 6, 1); + jug[i].setTextureOffset(0, 0); + jug[i].addBox(0.5F, 0F, -2.5F, 2, 2, 2); + + jug[i].setRotationPoint(xCoord, yCoord, zCoord); + jug[i].setTextureSize(31, 16); + ++i; + } + } + } + + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(int stackSize, float f) { + for (int i = 0; i < stackSize; i++) { + jug[i].render(f); + } + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/component/ModelPlankStack.java b/src/main/java/minefantasy/mf2/client/render/block/component/ModelPlankStack.java index 4a2bd59f..f8353e11 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/component/ModelPlankStack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/component/ModelPlankStack.java @@ -3,48 +3,42 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -public class ModelPlankStack extends ModelBase -{ - private ModelRenderer[] plank = new ModelRenderer[64]; - - public ModelPlankStack() - { - textureWidth = 32; - textureHeight = 32; - int i = 0; - for(int y = 0; y < 16; y ++) - { - for(int x = 0; x < 4; x ++) - { - float xCoord = -8F + x*4F; - float yCoord = 15F - y; - float zCoord = 8F; - if(y % 2 == 0) - { - xCoord += 1F; - } - - plank[i] = new ModelRenderer(this, 0, 0); - plank[i].addBox(0F, 0F, 0F, 3, 16, 1); - plank[i].setRotationPoint(xCoord, yCoord, zCoord); - plank[i].setTextureSize(32, 32); - setRotation(plank[i], -1.570796F, 0F, 0F); - ++i; - } - } - - } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void render(int stackSize, float f) - { - for(int i = 0; i < stackSize; i ++) - { - plank[i].render(f); - } - } +public class ModelPlankStack extends ModelBase { + private ModelRenderer[] plank = new ModelRenderer[64]; + + public ModelPlankStack() { + textureWidth = 32; + textureHeight = 32; + int i = 0; + for (int y = 0; y < 16; y++) { + for (int x = 0; x < 4; x++) { + float xCoord = -8F + x * 4F; + float yCoord = 15F - y; + float zCoord = 8F; + if (y % 2 == 0) { + xCoord += 1F; + } + + plank[i] = new ModelRenderer(this, 0, 0); + plank[i].addBox(0F, 0F, 0F, 3, 16, 1); + plank[i].setRotationPoint(xCoord, yCoord, zCoord); + plank[i].setTextureSize(32, 32); + setRotation(plank[i], -1.570796F, 0F, 0F); + ++i; + } + } + + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(int stackSize, float f) { + for (int i = 0; i < stackSize; i++) { + plank[i].render(f); + } + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/component/ModelPotStack.java b/src/main/java/minefantasy/mf2/client/render/block/component/ModelPotStack.java index 7f08bd7b..530ab8e3 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/component/ModelPotStack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/component/ModelPotStack.java @@ -3,48 +3,42 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -public class ModelPotStack extends ModelBase -{ - private ModelRenderer[] pot = new ModelRenderer[64]; - - public ModelPotStack() - { - textureWidth = 16; - textureHeight = 8; - int i = 0; - for(int y = 0; y < 4; y ++) - { - for(int z = 0; z < 4; z ++) - { - for(int x = 0; x < 4; x ++) - { - float xCoord = -8F + (x * 4F); - float yCoord = 12F - (y * 4F); - float zCoord = 8F - (z * 4F); +public class ModelPotStack extends ModelBase { + private ModelRenderer[] pot = new ModelRenderer[64]; - pot[i] = new ModelRenderer(this, 0, 0); - pot[i].addBox(0F, 0F, -4F, 4, 4, 4); - pot[i].setRotationPoint(xCoord, yCoord, zCoord); - pot[i].setTextureSize(64, 32); - pot[i].mirror = true; - setRotation(pot[i], 0F, 0F, 0F); - ++i; - } - } - } - - } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - public void render(int stackSize, float f) - { - for(int i = 0; i < stackSize; i ++) - { - pot[i].render(f); - } - } + public ModelPotStack() { + textureWidth = 16; + textureHeight = 8; + int i = 0; + for (int y = 0; y < 4; y++) { + for (int z = 0; z < 4; z++) { + for (int x = 0; x < 4; x++) { + float xCoord = -8F + (x * 4F); + float yCoord = 12F - (y * 4F); + float zCoord = 8F - (z * 4F); + + pot[i] = new ModelRenderer(this, 0, 0); + pot[i].addBox(0F, 0F, -4F, 4, 4, 4); + pot[i].setRotationPoint(xCoord, yCoord, zCoord); + pot[i].setTextureSize(64, 32); + pot[i].mirror = true; + setRotation(pot[i], 0F, 0F, 0F); + ++i; + } + } + } + + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(int stackSize, float f) { + for (int i = 0; i < stackSize; i++) { + pot[i].render(f); + } + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/component/ModelSheetStack.java b/src/main/java/minefantasy/mf2/client/render/block/component/ModelSheetStack.java index 903b0e04..75d6f294 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/component/ModelSheetStack.java +++ b/src/main/java/minefantasy/mf2/client/render/block/component/ModelSheetStack.java @@ -3,111 +3,106 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -public class ModelSheetStack extends ModelBase -{ - private ModelRenderer[] sheet = new ModelRenderer[16]; +public class ModelSheetStack extends ModelBase { + private ModelRenderer[] sheet = new ModelRenderer[16]; - public ModelSheetStack() - { - textureWidth = 64; - textureHeight = 16; + public ModelSheetStack() { + textureWidth = 64; + textureHeight = 16; - sheet[0] = new ModelRenderer(this, 0, 0); - sheet[0].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[0].setRotationPoint(0F, 15F, 0F); - sheet[0].setTextureSize(64, 16); - - setRotation(sheet[0], 0F, 0F, 0F); - sheet[1] = new ModelRenderer(this, 0, 0); - sheet[1].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[1].setRotationPoint(0F, 14F, 0F); - sheet[1].setTextureSize(64, 16); - - setRotation(sheet[1], 0F, -0.122173F, 0F); - sheet[2] = new ModelRenderer(this, 0, 0); - sheet[2].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[2].setRotationPoint(0F, 13F, 0F); - sheet[2].setTextureSize(64, 16); - setRotation(sheet[2], 0F, 0F, 0F); - sheet[3] = new ModelRenderer(this, 0, 0); - sheet[3].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[3].setRotationPoint(0F, 12F, 0F); - sheet[3].setTextureSize(64, 16); - setRotation(sheet[3], 0F, 0.1047198F, 0F); - sheet[4] = new ModelRenderer(this, 0, 0); - sheet[4].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[4].setRotationPoint(0F, 11F, 0F); - sheet[4].setTextureSize(64, 16); - setRotation(sheet[4], 0F, 0F, 0F); - sheet[5] = new ModelRenderer(this, 0, 0); - sheet[5].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[5].setRotationPoint(0F, 10F, 0F); - sheet[5].setTextureSize(64, 16); - setRotation(sheet[5], 0F, -0.0698132F, 0F); - sheet[6] = new ModelRenderer(this, 0, 0); - sheet[6].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[6].setRotationPoint(0F, 9F, 0F); - sheet[6].setTextureSize(64, 16); - setRotation(sheet[6], 0F, 0.0174533F, 0F); - sheet[7] = new ModelRenderer(this, 0, 0); - sheet[7].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[7].setRotationPoint(0F, 8F, 0F); - sheet[7].setTextureSize(64, 16); - setRotation(sheet[7], 0F, 0.122173F, 0F); - sheet[8] = new ModelRenderer(this, 0, 0); - sheet[8].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[8].setRotationPoint(0F, 7F, 0F); - sheet[8].setTextureSize(64, 16); - setRotation(sheet[8], 0F, 0.0349066F, 0F); - sheet[9] = new ModelRenderer(this, 0, 0); - sheet[9].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[9].setRotationPoint(0F, 6F, 0F); - sheet[9].setTextureSize(64, 16); - setRotation(sheet[9], 0F, -0.0523599F, 0F); - sheet[10] = new ModelRenderer(this, 0, 0); - sheet[10].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[10].setRotationPoint(0F, 5F, 0F); - sheet[10].setTextureSize(64, 16); - setRotation(sheet[10], 0F, 0F, 0F); - sheet[11] = new ModelRenderer(this, 0, 0); - sheet[11].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[11].setRotationPoint(0F, 4F, 0F); - sheet[11].setTextureSize(64, 16); - setRotation(sheet[11], 0F, -0.0523599F, 0F); - sheet[12] = new ModelRenderer(this, 0, 0); - sheet[12].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[12].setRotationPoint(0F, 3F, 0F); - sheet[12].setTextureSize(64, 16); - setRotation(sheet[12], 0F, 0.0349066F, 0F); - sheet[13] = new ModelRenderer(this, 0, 0); - sheet[13].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[13].setRotationPoint(0F, 2F, 0F); - sheet[13].setTextureSize(64, 16); - setRotation(sheet[13], 0F, -0.0349066F, 0F); - sheet[14] = new ModelRenderer(this, 0, 0); - sheet[14].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[14].setRotationPoint(0F, 1F, 0F); - sheet[14].setTextureSize(64, 16); - setRotation(sheet[14], 0F, -0.122173F, 0F); - sheet[15] = new ModelRenderer(this, 0, 0); - sheet[15].addBox(-7F, 0F, -7F, 14, 1, 14); - sheet[15].setRotationPoint(0F, 0F, 0F); - sheet[15].setTextureSize(64, 16); - setRotation(sheet[15], 0F, 0F, 0F); - } + sheet[0] = new ModelRenderer(this, 0, 0); + sheet[0].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[0].setRotationPoint(0F, 15F, 0F); + sheet[0].setTextureSize(64, 16); - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + setRotation(sheet[0], 0F, 0F, 0F); + sheet[1] = new ModelRenderer(this, 0, 0); + sheet[1].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[1].setRotationPoint(0F, 14F, 0F); + sheet[1].setTextureSize(64, 16); - public void render(int stackSize, float f) - { - for (int i = 0; i < stackSize; i++) - { - sheet[i].render(f); - } - } + setRotation(sheet[1], 0F, -0.122173F, 0F); + sheet[2] = new ModelRenderer(this, 0, 0); + sheet[2].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[2].setRotationPoint(0F, 13F, 0F); + sheet[2].setTextureSize(64, 16); + setRotation(sheet[2], 0F, 0F, 0F); + sheet[3] = new ModelRenderer(this, 0, 0); + sheet[3].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[3].setRotationPoint(0F, 12F, 0F); + sheet[3].setTextureSize(64, 16); + setRotation(sheet[3], 0F, 0.1047198F, 0F); + sheet[4] = new ModelRenderer(this, 0, 0); + sheet[4].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[4].setRotationPoint(0F, 11F, 0F); + sheet[4].setTextureSize(64, 16); + setRotation(sheet[4], 0F, 0F, 0F); + sheet[5] = new ModelRenderer(this, 0, 0); + sheet[5].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[5].setRotationPoint(0F, 10F, 0F); + sheet[5].setTextureSize(64, 16); + setRotation(sheet[5], 0F, -0.0698132F, 0F); + sheet[6] = new ModelRenderer(this, 0, 0); + sheet[6].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[6].setRotationPoint(0F, 9F, 0F); + sheet[6].setTextureSize(64, 16); + setRotation(sheet[6], 0F, 0.0174533F, 0F); + sheet[7] = new ModelRenderer(this, 0, 0); + sheet[7].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[7].setRotationPoint(0F, 8F, 0F); + sheet[7].setTextureSize(64, 16); + setRotation(sheet[7], 0F, 0.122173F, 0F); + sheet[8] = new ModelRenderer(this, 0, 0); + sheet[8].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[8].setRotationPoint(0F, 7F, 0F); + sheet[8].setTextureSize(64, 16); + setRotation(sheet[8], 0F, 0.0349066F, 0F); + sheet[9] = new ModelRenderer(this, 0, 0); + sheet[9].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[9].setRotationPoint(0F, 6F, 0F); + sheet[9].setTextureSize(64, 16); + setRotation(sheet[9], 0F, -0.0523599F, 0F); + sheet[10] = new ModelRenderer(this, 0, 0); + sheet[10].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[10].setRotationPoint(0F, 5F, 0F); + sheet[10].setTextureSize(64, 16); + setRotation(sheet[10], 0F, 0F, 0F); + sheet[11] = new ModelRenderer(this, 0, 0); + sheet[11].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[11].setRotationPoint(0F, 4F, 0F); + sheet[11].setTextureSize(64, 16); + setRotation(sheet[11], 0F, -0.0523599F, 0F); + sheet[12] = new ModelRenderer(this, 0, 0); + sheet[12].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[12].setRotationPoint(0F, 3F, 0F); + sheet[12].setTextureSize(64, 16); + setRotation(sheet[12], 0F, 0.0349066F, 0F); + sheet[13] = new ModelRenderer(this, 0, 0); + sheet[13].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[13].setRotationPoint(0F, 2F, 0F); + sheet[13].setTextureSize(64, 16); + setRotation(sheet[13], 0F, -0.0349066F, 0F); + sheet[14] = new ModelRenderer(this, 0, 0); + sheet[14].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[14].setRotationPoint(0F, 1F, 0F); + sheet[14].setTextureSize(64, 16); + setRotation(sheet[14], 0F, -0.122173F, 0F); + sheet[15] = new ModelRenderer(this, 0, 0); + sheet[15].addBox(-7F, 0F, -7F, 14, 1, 14); + sheet[15].setRotationPoint(0F, 0F, 0F); + sheet[15].setTextureSize(64, 16); + setRotation(sheet[15], 0F, 0F, 0F); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(int stackSize, float f) { + for (int i = 0; i < stackSize; i++) { + sheet[i].render(f); + } + } } diff --git a/src/main/java/minefantasy/mf2/client/render/block/component/TileEntityComponentRenderer.java b/src/main/java/minefantasy/mf2/client/render/block/component/TileEntityComponentRenderer.java index 993a1b7f..a85ff90a 100644 --- a/src/main/java/minefantasy/mf2/client/render/block/component/TileEntityComponentRenderer.java +++ b/src/main/java/minefantasy/mf2/client/render/block/component/TileEntityComponentRenderer.java @@ -1,26 +1,22 @@ package minefantasy.mf2.client.render.block.component; -import org.lwjgl.opengl.GL11; - import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.tileentity.TileEntityComponent; -import minefantasy.mf2.client.render.block.component.*; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; +import org.lwjgl.opengl.GL11; -public class TileEntityComponentRenderer extends TileEntitySpecialRenderer -{ - private ModelBarStack bars; +public class TileEntityComponentRenderer extends TileEntitySpecialRenderer { + private ModelBarStack bars; private ModelSheetStack sheets; private ModelPlankStack planks; private ModelPotStack pots; private ModelBigPlateStack bigplates; private ModelJugStack jugs; - - public TileEntityComponentRenderer() - { + + public TileEntityComponentRenderer() { this.bars = new ModelBarStack(); this.sheets = new ModelSheetStack(); this.planks = new ModelPlankStack(); @@ -29,77 +25,67 @@ public TileEntityComponentRenderer() this.jugs = new ModelJugStack(); } - public void renderModelAt(TileEntityComponent tile, double d, double d1, double d2, float f) - { - if(tile.item != null) - { - int i = tile.getBlockMetadata(); - - int j = 180 + (-90 * i); - - GL11.glPushMatrix(); //start - float scale = 1.0F; - float yOffset = 1.0F; - GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); //size - GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); //rotate based on metadata - GL11.glScalef(scale, -scale, -scale); //if you read this comment out this line and you can see what happens - GL11.glPushMatrix(); - float level = 0F; - - CustomMaterial material = tile.material; - if(material != null) - { - GL11.glColor3f((float)material.colourRGB[0]/255F, (float)material.colourRGB[1]/255F, (float)material.colourRGB[2]/255F); - } - - bindTextureByName("textures/models/object/component/placed_"+tile.tex+".png"); //texture - render(tile.type, tile.stackSize, 0.0625F); - - - GL11.glColor3f(1F, 1F, 1F); - - GL11.glPopMatrix(); - GL11.glColor3f(1F, 1F, 1F); - GL11.glPopMatrix(); //end - } + public void renderModelAt(TileEntityComponent tile, double d, double d1, double d2, float f) { + if (tile.item != null) { + int i = tile.getBlockMetadata(); + + int j = 180 + (-90 * i); + + GL11.glPushMatrix(); // start + float scale = 1.0F; + float yOffset = 1.0F; + GL11.glTranslatef((float) d + 0.5F, (float) d1 + yOffset, (float) d2 + 0.5F); // size + GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); // rotate based on metadata + GL11.glScalef(scale, -scale, -scale); // if you read this comment out this line and you can see what happens + GL11.glPushMatrix(); + float level = 0F; + + CustomMaterial material = tile.material; + if (material != null) { + GL11.glColor3f(material.colourRGB[0] / 255F, material.colourRGB[1] / 255F, + material.colourRGB[2] / 255F); + } + + bindTextureByName("textures/models/object/component/placed_" + tile.tex + ".png"); // texture + render(tile.type, tile.stackSize, 0.0625F); + + GL11.glColor3f(1F, 1F, 1F); + + GL11.glPopMatrix(); + GL11.glColor3f(1F, 1F, 1F); + GL11.glPopMatrix(); // end + } } - private void render(String type, int stackSize, float f) - { - if(type.equalsIgnoreCase("bar")) - { - bars.render(stackSize, f); - } - if(type.equalsIgnoreCase("sheet")) - { - sheets.render(stackSize, f); - } - if(type.equalsIgnoreCase("plank")) - { - planks.render(stackSize, f); - } - if(type.equalsIgnoreCase("pot")) - { - pots.render(stackSize, f); - } - if(type.equalsIgnoreCase("bigplate")) - { - bigplates.render(stackSize, f); - } - if(type.equalsIgnoreCase("jug")) - { - jugs.render(stackSize, f); - } - } + private void render(String type, int stackSize, float f) { + if (type.equalsIgnoreCase("bar")) { + bars.render(stackSize, f); + } + if (type.equalsIgnoreCase("sheet")) { + sheets.render(stackSize, f); + } + if (type.equalsIgnoreCase("plank")) { + planks.render(stackSize, f); + } + if (type.equalsIgnoreCase("pot")) { + pots.render(stackSize, f); + } + if (type.equalsIgnoreCase("bigplate")) { + bigplates.render(stackSize, f); + } + if (type.equalsIgnoreCase("jug")) { + jugs.render(stackSize, f); + } + } - private void bindTextureByName(String image) - { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); - } - @Override - public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { - renderModelAt((TileEntityComponent) tileentity, d, d1, d2, f); //where to render + private void bindTextureByName(String image) { + Minecraft.getMinecraft().renderEngine.bindTexture(TextureHelperMF.getResource(image)); } - + + @Override + public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { + renderModelAt((TileEntityComponent) tileentity, d, d1, d2, f); // where to render + } + } diff --git a/src/main/java/minefantasy/mf2/client/render/mob/ModelAshDragon.java b/src/main/java/minefantasy/mf2/client/render/mob/ModelAshDragon.java index f703dc9f..85047faa 100644 --- a/src/main/java/minefantasy/mf2/client/render/mob/ModelAshDragon.java +++ b/src/main/java/minefantasy/mf2/client/render/mob/ModelAshDragon.java @@ -6,9 +6,8 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelAshDragon extends ModelBase -{ - public ModelRenderer Bodyfront; +public class ModelAshDragon extends ModelBase { + public ModelRenderer Bodyfront; public ModelRenderer Tail1; public ModelRenderer Neck1; public ModelRenderer Wingshoulderright; @@ -143,9 +142,8 @@ public class ModelAshDragon extends ModelBase public ModelRenderer shape128; public ModelRenderer shape129; - public ModelAshDragon() - { - this.textureWidth = 512; + public ModelAshDragon() { + this.textureWidth = 512; this.textureHeight = 512; this.Wingshoulderleft = new ModelRenderer(this, 470, 230); this.Wingshoulderleft.setRotationPoint(3.0F, 4.0F, 4.0F); @@ -826,15 +824,14 @@ public ModelAshDragon() this.Wingfinger1left.addChild(this.Wingfingerlower1left); this.Bodyfront.addChild(this.shape148); } - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { + + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles((EntityDragon) entity, f, f1, f2, f3, f4, f5); this.Bodyfront.render(f5); @@ -846,65 +843,60 @@ private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleZ = z; } - public void setRotationAngles(EntityDragon dragon, float step1, float step2, float head1, float neckY, float neckX, float head4) - { + public void setRotationAngles(EntityDragon dragon, float step1, float step2, float head1, float neckY, float neckX, + float head4) { super.setRotationAngles(step1, step2, head1, neckY, neckX, head4, dragon); float wingFlap = (float) Math.toRadians(dragon.wingFlap()); - float jawAngle = (float)Math.toRadians(dragon.getJawMove()); - float neckAngle = -(float)Math.toRadians(4.5F * dragon.getNeckAngle()); - + float jawAngle = (float) Math.toRadians(dragon.getJawMove()); + float neckAngle = -(float) Math.toRadians(4.5F * dragon.getNeckAngle()); + this.Head1.rotateAngleX = neckX / (180F / (float) Math.PI) + neckAngle; this.Head1.rotateAngleY = neckY / (180F / (float) Math.PI); - + this.Mouthback_MOVE_TO_OPEN.rotateAngleX = jawAngle - (3.141F / 9F); - //this.Tail1.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - //this.Tail3.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - //this.Tail4.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - - if (!dragon.isTerrestrial()) //Fly + // this.Tail1.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + // this.Tail3.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + // this.Tail4.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + + if (!dragon.isTerrestrial()) // Fly { - if(!dragon.onGround) - { - float angle = (float) Math.toRadians(dragon.getVertTailAngle()); - this.Bodyfront.rotateAngleX = 0.546F - angle; - } - else - { - this.Bodyfront.rotateAngleX = 0.5462880558742251F; - } - - if(dragon.motionY < -0.01F)//Glide - { - wingFlap = 0; - } - else if (dragon.motionX == 0 && dragon.motionZ == 0) //Hover - { - wingFlap = (float) Math.toRadians(dragon.wingFlap()); + if (!dragon.onGround) { + float angle = (float) Math.toRadians(dragon.getVertTailAngle()); + this.Bodyfront.rotateAngleX = 0.546F - angle; + } else { + this.Bodyfront.rotateAngleX = 0.5462880558742251F; } - else + + if (dragon.motionY < -0.01F)// Glide + { + wingFlap = 0; + } else if (dragon.motionX == 0 && dragon.motionZ == 0) // Hover { - wingFlap = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2;//Move + wingFlap = (float) Math.toRadians(dragon.wingFlap()); + } else { + wingFlap = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2;// Move } - this.Wingshoulderleft.rotateAngleZ = (float) (wingFlap*0.25F); - this.Wingshoulderright.rotateAngleZ = (float) -(wingFlap*0.25F); + this.Wingshoulderleft.rotateAngleZ = wingFlap * 0.25F; + this.Wingshoulderright.rotateAngleZ = -(wingFlap * 0.25F); this.Wingshoulderleft.rotateAngleX = 0.5F; this.Wingshoulderright.rotateAngleX = 0.5F; - } - else //Walk + } else // Walk { - this.Bodyfront.rotateAngleX = 0.5462880558742251F; - // this.Winglowerarmright.rotateAngleZ = (float) Math.toRadians(180); - //this.Winglowerarmleft.rotateAngleZ = (float) -Math.toRadians(180); - + this.Bodyfront.rotateAngleX = 0.5462880558742251F; + // this.Winglowerarmright.rotateAngleZ = (float) Math.toRadians(180); + // this.Winglowerarmleft.rotateAngleZ = (float) -Math.toRadians(180); + this.ThighR.rotateAngleX = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; this.ThighL.rotateAngleX = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; - - if(dragon.onGround) - { - this.Wingshoulderright.rotateAngleZ = (float) -Math.toRadians(40); - this.Wingshoulderleft.rotateAngleZ = (float) Math.toRadians(40); - this.Wingshoulderleft.rotateAngleX = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; - this.Wingshoulderright.rotateAngleX = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; + + if (dragon.onGround) { + this.Wingshoulderright.rotateAngleZ = (float) -Math.toRadians(40); + this.Wingshoulderleft.rotateAngleZ = (float) Math.toRadians(40); + this.Wingshoulderleft.rotateAngleX = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; + this.Wingshoulderright.rotateAngleX = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; } } } diff --git a/src/main/java/minefantasy/mf2/client/render/mob/ModelDragon.java b/src/main/java/minefantasy/mf2/client/render/mob/ModelDragon.java index 0a0fbf00..78a4244b 100644 --- a/src/main/java/minefantasy/mf2/client/render/mob/ModelDragon.java +++ b/src/main/java/minefantasy/mf2/client/render/mob/ModelDragon.java @@ -6,9 +6,8 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelDragon extends ModelBase -{ - public ModelRenderer Body; +public class ModelDragon extends ModelBase { + public ModelRenderer Body; public ModelRenderer Tail1; public ModelRenderer Neckbase; public ModelRenderer shape16; @@ -143,8 +142,7 @@ public class ModelDragon extends ModelBase public ModelRenderer Wingfingerlower2right; public ModelRenderer Wingfingerlower3right; - public ModelDragon() - { + public ModelDragon() { this.textureWidth = 512; this.textureHeight = 512; this.Righttoeleft = new ModelRenderer(this, 290, 280); @@ -290,7 +288,8 @@ public ModelDragon() this.Headlargehornlowerright = new ModelRenderer(this, 190, 500); this.Headlargehornlowerright.setRotationPoint(-1.6F, 0.0F, -2.0F); this.Headlargehornlowerright.addBox(-3.0F, 0.0F, 0.0F, 3, 2, 8, 0.0F); - this.setRotateAngle(Headlargehornlowerright, 0.18203784098300857F, -0.22759093446006054F, -0.36425021489121656F); + this.setRotateAngle(Headlargehornlowerright, 0.18203784098300857F, -0.22759093446006054F, + -0.36425021489121656F); this.Wingshoulderright = new ModelRenderer(this, 470, 230); this.Wingshoulderright.setRotationPoint(-5.0F, 2.0F, 12.0F); this.Wingshoulderright.addBox(-5.0F, 0.0F, 0.0F, 5, 7, 8, 0.0F); @@ -679,7 +678,7 @@ public ModelDragon() this.Spiketop19 = new ModelRenderer(this, 300, 460); this.Spiketop19.setRotationPoint(0.0F, 5.0F, 11.0F); this.Spiketop19.addBox(-0.5F, -7.0F, 0.0F, 1, 7, 2, 0.0F); - //Grouping + // Grouping this.RightFoot.addChild(this.Righttoeleft); this.Spikebase4.addChild(this.Spiketop6); this.Thumbtoeupperright.addChild(this.Thumbtoelowerright); @@ -814,15 +813,14 @@ public ModelDragon() this.Lefthandrightfinger_1.addChild(this.Clawlefthandleft); this.Tail6.addChild(this.Spiketop19); } - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { + + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles((EntityDragon) entity, f, f1, f2, f3, f4, f5); this.Body.render(f5); @@ -834,59 +832,55 @@ private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleZ = z; } - public void setRotationAngles(EntityDragon dragon, float step1, float step2, float head1, float neckY, float neckX, float head4) - { + public void setRotationAngles(EntityDragon dragon, float step1, float step2, float head1, float neckY, float neckX, + float head4) { super.setRotationAngles(step1, step2, head1, neckY, neckX, head4, dragon); float wingFlap = (float) Math.toRadians(dragon.wingFlap()); - float jawAngle = (float)Math.toRadians(dragon.getJawMove()); - float neckAngle = -(float)Math.toRadians(4.5F * dragon.getNeckAngle()); - + float jawAngle = (float) Math.toRadians(dragon.getJawMove()); + float neckAngle = -(float) Math.toRadians(4.5F * dragon.getNeckAngle()); + this.Headback.rotateAngleX = neckX / (180F / (float) Math.PI) + neckAngle; this.Headback.rotateAngleY = neckY / (180F / (float) Math.PI); - + this.Lowerjaw.rotateAngleX = -0.045553093477052F - jawAngle; - //this.Tail1.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - //this.Tail3.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - //this.Tail4.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - - if (!dragon.isTerrestrial()) //Fly + // this.Tail1.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + // this.Tail3.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + // this.Tail4.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + + if (!dragon.isTerrestrial()) // Fly { - if(!dragon.onGround) - { - float angle = (float) Math.toRadians(dragon.getVertTailAngle()); - this.Body.rotateAngleX = 0.546F - angle; - } - else - { - this.Body.rotateAngleX = 0.5462880558742251F; - } - - if(dragon.motionY < -0.01F)//Glide - { - wingFlap = 0; - } - else if (dragon.motionX == 0 && dragon.motionZ == 0) //Hover - { - wingFlap = (float) Math.toRadians(dragon.wingFlap()); + if (!dragon.onGround) { + float angle = (float) Math.toRadians(dragon.getVertTailAngle()); + this.Body.rotateAngleX = 0.546F - angle; + } else { + this.Body.rotateAngleX = 0.5462880558742251F; } - else + + if (dragon.motionY < -0.01F)// Glide + { + wingFlap = 0; + } else if (dragon.motionX == 0 && dragon.motionZ == 0) // Hover { - wingFlap = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2;//Move + wingFlap = (float) Math.toRadians(dragon.wingFlap()); + } else { + wingFlap = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2;// Move } - this.Wingshoulderright.rotateAngleZ = (float) (wingFlap*0.75F); - this.Wingshoulderleft.rotateAngleZ = (float) -(wingFlap*0.75F); - this.Wingupperarmright.rotateAngleZ = (float) (wingFlap*0.25F); - this.Wingupperarmleft.rotateAngleZ = (float) -(wingFlap*0.25F); - - } - else //Walk + this.Wingshoulderright.rotateAngleZ = wingFlap * 0.75F; + this.Wingshoulderleft.rotateAngleZ = -(wingFlap * 0.75F); + this.Wingupperarmright.rotateAngleZ = wingFlap * 0.25F; + this.Wingupperarmleft.rotateAngleZ = -(wingFlap * 0.25F); + + } else // Walk { - this.Body.rotateAngleX = 0.5462880558742251F; - this.Wingshoulderright.rotateAngleZ = (float) -Math.toRadians(40); + this.Body.rotateAngleX = 0.5462880558742251F; + this.Wingshoulderright.rotateAngleZ = (float) -Math.toRadians(40); this.Wingshoulderleft.rotateAngleZ = (float) Math.toRadians(40); - // this.Winglowerarmright.rotateAngleZ = (float) Math.toRadians(180); - //this.Winglowerarmleft.rotateAngleZ = (float) -Math.toRadians(180); - + // this.Winglowerarmright.rotateAngleZ = (float) Math.toRadians(180); + // this.Winglowerarmleft.rotateAngleZ = (float) -Math.toRadians(180); + this.Righthip.rotateAngleX = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; this.Lefthip.rotateAngleX = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; this.Shoulderleft_1.rotateAngleX = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; diff --git a/src/main/java/minefantasy/mf2/client/render/mob/ModelFrostDragon.java b/src/main/java/minefantasy/mf2/client/render/mob/ModelFrostDragon.java index e9ff53dd..2df12704 100644 --- a/src/main/java/minefantasy/mf2/client/render/mob/ModelFrostDragon.java +++ b/src/main/java/minefantasy/mf2/client/render/mob/ModelFrostDragon.java @@ -6,9 +6,8 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelFrostDragon extends ModelBase -{ - public ModelRenderer Body; +public class ModelFrostDragon extends ModelBase { + public ModelRenderer Body; public ModelRenderer Tail1; public ModelRenderer Neckbase; public ModelRenderer Belly1; @@ -159,8 +158,7 @@ public class ModelFrostDragon extends ModelBase public ModelRenderer Wingfingerlower2right; public ModelRenderer Wingfingerlower3right; - public ModelFrostDragon() - { + public ModelFrostDragon() { this.textureWidth = 512; this.textureHeight = 512; this.Tooth13 = new ModelRenderer(this, 180, 500); @@ -252,7 +250,8 @@ public ModelFrostDragon() this.Headlargehornlowerright = new ModelRenderer(this, 190, 500); this.Headlargehornlowerright.setRotationPoint(-1.6F, 0.0F, -3.0F); this.Headlargehornlowerright.addBox(-3.0F, 0.0F, 0.0F, 3, 2, 6, 0.0F); - this.setRotateAngle(Headlargehornlowerright, 0.18203784098300857F, -0.27314402793711257F, -0.36425021489121656F); + this.setRotateAngle(Headlargehornlowerright, 0.18203784098300857F, -0.27314402793711257F, + -0.36425021489121656F); this.Tooth16 = new ModelRenderer(this, 180, 500); this.Tooth16.setRotationPoint(-2.5F, 0.4F, -4.5F); this.Tooth16.addBox(0.0F, -2.0F, -0.5F, 1, 2, 1, 0.0F); @@ -928,15 +927,14 @@ public ModelFrostDragon() this.Wingshoulderleft.addChild(this.Wingupperarmleft); this.Spikebase6.addChild(this.Spiketop8); } - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { + + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles((EntityDragon) entity, f, f1, f2, f3, f4, f5); this.Body.render(f5); @@ -948,59 +946,55 @@ private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleZ = z; } - public void setRotationAngles(EntityDragon dragon, float step1, float step2, float head1, float neckY, float neckX, float head4) - { + public void setRotationAngles(EntityDragon dragon, float step1, float step2, float head1, float neckY, float neckX, + float head4) { super.setRotationAngles(step1, step2, head1, neckY, neckX, head4, dragon); float wingFlap = (float) Math.toRadians(dragon.wingFlap()); - float jawAngle = (float)Math.toRadians(dragon.getJawMove()); - float neckAngle = -(float)Math.toRadians(4.5F * dragon.getNeckAngle()); - + float jawAngle = (float) Math.toRadians(dragon.getJawMove()); + float neckAngle = -(float) Math.toRadians(4.5F * dragon.getNeckAngle()); + this.Headback.rotateAngleX = neckX / (180F / (float) Math.PI) + neckAngle; this.Headback.rotateAngleY = neckY / (180F / (float) Math.PI); - + this.Mouthback_MOVE_THIS_TO_OPEN_MOUTH.rotateAngleX = jawAngle - (3.141F / 9F); - //this.Tail1.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - //this.Tail3.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - //this.Tail4.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - - if (!dragon.isTerrestrial()) //Fly + // this.Tail1.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + // this.Tail3.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + // this.Tail4.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + + if (!dragon.isTerrestrial()) // Fly { - if(!dragon.onGround) - { - float angle = (float) Math.toRadians(dragon.getVertTailAngle()); - this.Body.rotateAngleX = 0.546F - angle; - } - else - { - this.Body.rotateAngleX = 0.5462880558742251F; - } - - if(dragon.motionY < -0.01F)//Glide - { - wingFlap = 0; - } - else if (dragon.motionX == 0 && dragon.motionZ == 0) //Hover - { - wingFlap = (float) Math.toRadians(dragon.wingFlap()); + if (!dragon.onGround) { + float angle = (float) Math.toRadians(dragon.getVertTailAngle()); + this.Body.rotateAngleX = 0.546F - angle; + } else { + this.Body.rotateAngleX = 0.5462880558742251F; } - else + + if (dragon.motionY < -0.01F)// Glide + { + wingFlap = 0; + } else if (dragon.motionX == 0 && dragon.motionZ == 0) // Hover { - wingFlap = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2;//Move + wingFlap = (float) Math.toRadians(dragon.wingFlap()); + } else { + wingFlap = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2;// Move } - this.Wingshoulderright.rotateAngleZ = (float) (wingFlap*0.75F); - this.Wingshoulderleft.rotateAngleZ = (float) -(wingFlap*0.75F); - this.Wingupperarmright.rotateAngleZ = (float) (wingFlap*0.25F); - this.Wingupperarmleft.rotateAngleZ = (float) -(wingFlap*0.25F); - - } - else //Walk + this.Wingshoulderright.rotateAngleZ = wingFlap * 0.75F; + this.Wingshoulderleft.rotateAngleZ = -(wingFlap * 0.75F); + this.Wingupperarmright.rotateAngleZ = wingFlap * 0.25F; + this.Wingupperarmleft.rotateAngleZ = -(wingFlap * 0.25F); + + } else // Walk { - this.Body.rotateAngleX = 0.5462880558742251F; - this.Wingshoulderright.rotateAngleZ = (float) -Math.toRadians(40); + this.Body.rotateAngleX = 0.5462880558742251F; + this.Wingshoulderright.rotateAngleZ = (float) -Math.toRadians(40); this.Wingshoulderleft.rotateAngleZ = (float) Math.toRadians(40); - // this.Winglowerarmright.rotateAngleZ = (float) Math.toRadians(180); - //this.Winglowerarmleft.rotateAngleZ = (float) -Math.toRadians(180); - + // this.Winglowerarmright.rotateAngleZ = (float) Math.toRadians(180); + // this.Winglowerarmleft.rotateAngleZ = (float) -Math.toRadians(180); + this.Righthip.rotateAngleX = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; this.Lefthip.rotateAngleX = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; this.Shoulderleft_1.rotateAngleX = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; diff --git a/src/main/java/minefantasy/mf2/client/render/mob/ModelHound.java b/src/main/java/minefantasy/mf2/client/render/mob/ModelHound.java index 05f55bba..99123a02 100644 --- a/src/main/java/minefantasy/mf2/client/render/mob/ModelHound.java +++ b/src/main/java/minefantasy/mf2/client/render/mob/ModelHound.java @@ -1,318 +1,328 @@ package minefantasy.mf2.client.render.mob; -import org.lwjgl.opengl.GL11; - import minefantasy.mf2.entity.mob.EntityHound; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.MathHelper; +import org.lwjgl.opengl.GL11; public class ModelHound extends ModelBase { - /** main box for the wolf head */ - public ModelRenderer WolfHead; - /** The wolf's body */ - public ModelRenderer Body; - /** Wolf'se first leg */ - public ModelRenderer Leg1; - /** Wolf's second leg */ - public ModelRenderer Leg2; - /** Wolf's third leg */ - public ModelRenderer Leg3; - /** Wolf's fourth leg */ - public ModelRenderer Leg4; - /** The wolf's tail */ - public ModelRenderer Tail; - /** The wolf's mane */ - public ModelRenderer Mane; - public ModelRenderer Collar; - public ModelRenderer Jaw; - public ModelRenderer Ear1; - public ModelRenderer Ear2; - public ModelRenderer Nose; + /** + * main box for the wolf head + */ + public ModelRenderer WolfHead; + /** + * The wolf's body + */ + public ModelRenderer Body; + /** + * Wolf'se first leg + */ + public ModelRenderer Leg1; + /** + * Wolf's second leg + */ + public ModelRenderer Leg2; + /** + * Wolf's third leg + */ + public ModelRenderer Leg3; + /** + * Wolf's fourth leg + */ + public ModelRenderer Leg4; + /** + * The wolf's tail + */ + public ModelRenderer Tail; + /** + * The wolf's mane + */ + public ModelRenderer Mane; + public ModelRenderer Collar; + public ModelRenderer Jaw; + public ModelRenderer Ear1; + public ModelRenderer Ear2; + public ModelRenderer Nose; + + public ModelHound() { + this(0F); + } - public ModelHound() { - this(0F); - } + public ModelHound(float scale) { + float var1 = 0F; + float var2 = 13.5F; + textureWidth = 64; + textureHeight = 32; - public ModelHound(float scale) { - float var1 = 0F; - float var2 = 13.5F; - textureWidth = 64; - textureHeight = 32; + Collar = new ModelRenderer(this, 20, 24); + Collar.addBox(-3.5F, -3.5F, 0.5F, 7, 7, 1, scale); + Collar.setRotationPoint(-1F, 12.5F, -7F); + Collar.setTextureSize(64, 32); + Collar.mirror = true; + setRotation(Collar, 0F, 0F, 0F); + Body = new ModelRenderer(this, 38, 17); + Body.addBox(-4F, -2F, -3F, 6, 8, 7, scale); + Body.setRotationPoint(-1F, 15F, 3F); + Body.setTextureSize(64, 32); + Body.mirror = true; + setRotation(Body, 1.570796F, 0F, 0F); + Mane = new ModelRenderer(this, 32, 0); + Mane.addBox(-4F, -3F, -4F, 8, 8, 8, scale); + Mane.setRotationPoint(0F, 14F, -3F); + Mane.setTextureSize(64, 32); + Mane.mirror = true; + setRotation(Mane, 1.570796F, 0F, 0F); + Leg1 = new ModelRenderer(this, 0, 18); + Leg1.addBox(-3F, 0F, -2F, 3, 8, 3, scale); + Leg1.setRotationPoint(-1.5F, 16F, 7F); + Leg1.setTextureSize(64, 32); + Leg1.mirror = true; + setRotation(Leg1, 0F, 0F, 0F); + Leg2 = new ModelRenderer(this, 0, 18); + Leg2.addBox(0F, 0F, -2F, 3, 8, 3, scale); + Leg2.setRotationPoint(-0.5F, 16F, 7F); + Leg2.setTextureSize(64, 32); + Leg2.mirror = true; + setRotation(Leg2, 0F, 0F, 0F); + Leg3 = new ModelRenderer(this, 0, 18); + Leg3.addBox(-3F, 0F, -1F, 3, 8, 3, scale); + Leg3.setRotationPoint(-1.5F, 16F, -4F); + Leg3.setTextureSize(64, 32); + Leg3.mirror = true; + setRotation(Leg3, 0F, 0F, 0F); + Leg4 = new ModelRenderer(this, 0, 18); + Leg4.addBox(0F, 0F, -1F, 3, 8, 3, scale); + Leg4.setRotationPoint(-0.5F, 16F, -4F); + Leg4.setTextureSize(64, 32); + Leg4.mirror = true; + setRotation(Leg4, 0F, 0F, 0F); + Tail = new ModelRenderer(this, 12, 27); + Tail.addBox(-1F, 0F, -1F, 2, 3, 2, scale); + Tail.setRotationPoint(-1F, 13F, 8F); + Tail.setTextureSize(64, 32); + Tail.mirror = true; + setRotation(Tail, 1.130069F, 0F, 0F); + Ear1 = new ModelRenderer(this, 16, 11); + Ear1.addBox(-3F, -6F, 0F, 2, 5, 1, scale); + Ear1.setRotationPoint(-1F, 12.5F, -7F); + Ear1.setTextureSize(64, 32); + Ear1.mirror = true; + setRotation(Ear1, 0F, 0F, 0F); + Ear2 = new ModelRenderer(this, 16, 11); + Ear2.mirror = true; + Ear2.addBox(1F, -6F, 0F, 2, 5, 1, scale); + Ear2.setRotationPoint(-1F, 12.5F, -7F); + Ear2.setTextureSize(64, 32); + Ear2.mirror = true; + setRotation(Ear2, 0F, 0F, 0F); + Ear2.mirror = false; + Jaw = new ModelRenderer(this, 12, 17); + Jaw.addBox(-1.5F, 2F, -7F, 3, 1, 4, scale); + Jaw.setRotationPoint(-1F, 12.5F, -7F); + Jaw.setTextureSize(64, 32); + Jaw.mirror = true; + setRotation(Jaw, 0F, 0F, 0F); + Nose = new ModelRenderer(this, 0, 11); + Nose.addBox(-1.5F, 0F, -7F, 3, 2, 4, scale); + Nose.setRotationPoint(-1F, 12.5F, -7F); + Nose.setTextureSize(64, 32); + Nose.mirror = true; + setRotation(Nose, 0F, 0F, 0F); + WolfHead = new ModelRenderer(this, 0, 0); + WolfHead.addBox(-3F, -3F, -3F, 6, 6, 5, scale); + WolfHead.setRotationPoint(-1F, 12.5F, -7F); + WolfHead.setTextureSize(64, 32); + WolfHead.mirror = true; + setRotation(WolfHead, 0F, 0F, 0F); + } - Collar = new ModelRenderer(this, 20, 24); - Collar.addBox(-3.5F, -3.5F, 0.5F, 7, 7, 1, scale); - Collar.setRotationPoint(-1F, 12.5F, -7F); - Collar.setTextureSize(64, 32); - Collar.mirror = true; - setRotation(Collar, 0F, 0F, 0F); - Body = new ModelRenderer(this, 38, 17); - Body.addBox(-4F, -2F, -3F, 6, 8, 7, scale); - Body.setRotationPoint(-1F, 15F, 3F); - Body.setTextureSize(64, 32); - Body.mirror = true; - setRotation(Body, 1.570796F, 0F, 0F); - Mane = new ModelRenderer(this, 32, 0); - Mane.addBox(-4F, -3F, -4F, 8, 8, 8, scale); - Mane.setRotationPoint(0F, 14F, -3F); - Mane.setTextureSize(64, 32); - Mane.mirror = true; - setRotation(Mane, 1.570796F, 0F, 0F); - Leg1 = new ModelRenderer(this, 0, 18); - Leg1.addBox(-3F, 0F, -2F, 3, 8, 3, scale); - Leg1.setRotationPoint(-1.5F, 16F, 7F); - Leg1.setTextureSize(64, 32); - Leg1.mirror = true; - setRotation(Leg1, 0F, 0F, 0F); - Leg2 = new ModelRenderer(this, 0, 18); - Leg2.addBox(0F, 0F, -2F, 3, 8, 3, scale); - Leg2.setRotationPoint(-0.5F, 16F, 7F); - Leg2.setTextureSize(64, 32); - Leg2.mirror = true; - setRotation(Leg2, 0F, 0F, 0F); - Leg3 = new ModelRenderer(this, 0, 18); - Leg3.addBox(-3F, 0F, -1F, 3, 8, 3, scale); - Leg3.setRotationPoint(-1.5F, 16F, -4F); - Leg3.setTextureSize(64, 32); - Leg3.mirror = true; - setRotation(Leg3, 0F, 0F, 0F); - Leg4 = new ModelRenderer(this, 0, 18); - Leg4.addBox(0F, 0F, -1F, 3, 8, 3, scale); - Leg4.setRotationPoint(-0.5F, 16F, -4F); - Leg4.setTextureSize(64, 32); - Leg4.mirror = true; - setRotation(Leg4, 0F, 0F, 0F); - Tail = new ModelRenderer(this, 12, 27); - Tail.addBox(-1F, 0F, -1F, 2, 3, 2, scale); - Tail.setRotationPoint(-1F, 13F, 8F); - Tail.setTextureSize(64, 32); - Tail.mirror = true; - setRotation(Tail, 1.130069F, 0F, 0F); - Ear1 = new ModelRenderer(this, 16, 11); - Ear1.addBox(-3F, -6F, 0F, 2, 5, 1, scale); - Ear1.setRotationPoint(-1F, 12.5F, -7F); - Ear1.setTextureSize(64, 32); - Ear1.mirror = true; - setRotation(Ear1, 0F, 0F, 0F); - Ear2 = new ModelRenderer(this, 16, 11); - Ear2.mirror = true; - Ear2.addBox(1F, -6F, 0F, 2, 5, 1, scale); - Ear2.setRotationPoint(-1F, 12.5F, -7F); - Ear2.setTextureSize(64, 32); - Ear2.mirror = true; - setRotation(Ear2, 0F, 0F, 0F); - Ear2.mirror = false; - Jaw = new ModelRenderer(this, 12, 17); - Jaw.addBox(-1.5F, 2F, -7F, 3, 1, 4, scale); - Jaw.setRotationPoint(-1F, 12.5F, -7F); - Jaw.setTextureSize(64, 32); - Jaw.mirror = true; - setRotation(Jaw, 0F, 0F, 0F); - Nose = new ModelRenderer(this, 0, 11); - Nose.addBox(-1.5F, 0F, -7F, 3, 2, 4, scale); - Nose.setRotationPoint(-1F, 12.5F, -7F); - Nose.setTextureSize(64, 32); - Nose.mirror = true; - setRotation(Nose, 0F, 0F, 0F); - WolfHead = new ModelRenderer(this, 0, 0); - WolfHead.addBox(-3F, -3F, -3F, 6, 6, 5, scale); - WolfHead.setRotationPoint(-1F, 12.5F, -7F); - WolfHead.setTextureSize(64, 32); - WolfHead.mirror = true; - setRotation(WolfHead, 0F, 0F, 0F); - } + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } - private void setRotation(ModelRenderer model, float x, float y, float z) { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + /** + * Sets the models various rotation angles then renders the model. + */ + @Override + public void render(Entity entity, float f1, float f2, float f3, float f4, float f5, float f6) { + super.render(entity, f1, f2, f3, f4, f5, f6); + EntityHound var5 = (EntityHound) entity; + this.setRotationAngles(var5, f1, f2, f3, f4, f5, f6); + if (this.isChild) { + float var8 = 2F; + GL11.glPushMatrix(); + GL11.glTranslatef(0F, 5F * f6, 2F * f6); + this.WolfHead.renderWithRotation(f6); + this.Collar.renderWithRotation(f6); + this.Ear1.renderWithRotation(f6); + this.Ear2.renderWithRotation(f6); + this.Jaw.renderWithRotation(f6); + this.Nose.renderWithRotation(f6); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(1F / var8, 1F / var8, 1F / var8); + GL11.glTranslatef(0F, 24F * f6, 0F); + this.Body.render(f6); + this.Leg1.render(f6); + this.Leg2.render(f6); + this.Leg3.render(f6); + this.Leg4.render(f6); + this.Tail.renderWithRotation(f6); + this.Mane.render(f6); + GL11.glPopMatrix(); + } else { + this.WolfHead.renderWithRotation(f6); + this.Collar.renderWithRotation(f6); + this.Ear1.renderWithRotation(f6); + this.Ear2.renderWithRotation(f6); + this.Jaw.renderWithRotation(f6); + this.Nose.renderWithRotation(f6); + this.Body.render(f6); + this.Leg1.render(f6); + this.Leg2.render(f6); + this.Leg3.render(f6); + this.Leg4.render(f6); + this.Tail.renderWithRotation(f6); + this.Mane.render(f6); + } + } - /** - * Sets the models various rotation angles then renders the model. - */ - @Override - public void render(Entity entity, float f1, float f2, float f3, float f4, float f5, float f6) { - super.render(entity, f1, f2, f3, f4, f5, f6); - EntityHound var5 = (EntityHound) entity; - this.setRotationAngles(var5, f1, f2, f3, f4, f5, f6); - if (this.isChild) { - float var8 = 2F; - GL11.glPushMatrix(); - GL11.glTranslatef(0F, 5F * f6, 2F * f6); - this.WolfHead.renderWithRotation(f6); - this.Collar.renderWithRotation(f6); - this.Ear1.renderWithRotation(f6); - this.Ear2.renderWithRotation(f6); - this.Jaw.renderWithRotation(f6); - this.Nose.renderWithRotation(f6); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glScalef(1F / var8, 1F / var8, 1F / var8); - GL11.glTranslatef(0F, 24F * f6, 0F); - this.Body.render(f6); - this.Leg1.render(f6); - this.Leg2.render(f6); - this.Leg3.render(f6); - this.Leg4.render(f6); - this.Tail.renderWithRotation(f6); - this.Mane.render(f6); - GL11.glPopMatrix(); - } else { - this.WolfHead.renderWithRotation(f6); - this.Collar.renderWithRotation(f6); - this.Ear1.renderWithRotation(f6); - this.Ear2.renderWithRotation(f6); - this.Jaw.renderWithRotation(f6); - this.Nose.renderWithRotation(f6); - this.Body.render(f6); - this.Leg1.render(f6); - this.Leg2.render(f6); - this.Leg3.render(f6); - this.Leg4.render(f6); - this.Tail.renderWithRotation(f6); - this.Mane.render(f6); - } - } + /** + * Used for easily adding entity-dependent animations. The second and third + * float params here are the same second and third as in the setRotationAngles + * method. + */ + @Override + public void setLivingAnimations(EntityLivingBase living, float step1, float step2, float z) { + EntityHound var5 = (EntityHound) living; - /** - * Used for easily adding entity-dependent animations. The second and third - * float params here are the same second and third as in the - * setRotationAngles method. - */ - @Override - public void setLivingAnimations(EntityLivingBase living, float step1, float step2, float z) - { - EntityHound var5 = (EntityHound) living; + float walk1 = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; + float walk2 = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; - float walk1 = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; - float walk2 = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; - - if (var5.isAngry()) { - this.Tail.rotateAngleY = 0F; - } else { - this.Tail.rotateAngleY = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; - } + if (var5.isAngry()) { + this.Tail.rotateAngleY = 0F; + } else { + this.Tail.rotateAngleY = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; + } - if (var5.isSitting()) - { - float dig = 0; - this.Mane.setRotationPoint(-1F, 16F, -2F); - this.Mane.rotateAngleX = ((float) Math.PI * 2F / 5F); - this.Mane.rotateAngleY = 0F; - this.Body.setRotationPoint(0F, 18F, 0F); - this.Body.rotateAngleX = ((float) Math.PI / 4F); - this.Tail.setRotationPoint(-1F, 21F, 6F); - this.Leg1.setRotationPoint(-2.5F, 22F, 2F); - this.Leg1.rotateAngleX = ((float) Math.PI * 3F / 2F); - this.Leg2.setRotationPoint(0.5F, 22F, 2F); - this.Leg2.rotateAngleX = ((float) Math.PI * 3F / 2F); - this.Leg3.rotateAngleX = 5.811947F + dig; - this.Leg3.setRotationPoint(-2.49F, 17F, -4F); - this.Leg4.rotateAngleX = 5.811947F - dig; - this.Leg4.setRotationPoint(0.51F, 17F, -4F); - } - else //WALK - { - this.Body.setRotationPoint(0F, 14F, 2F); - this.Body.rotateAngleX = ((float) Math.PI / 2F); - this.Mane.setRotationPoint(-1F, 14F, -2F); - this.Mane.rotateAngleX = this.Body.rotateAngleX; - this.Tail.setRotationPoint(-1F, 12F, 8F); - this.Leg1.setRotationPoint(-2.5F, 16F, 7F); - this.Leg2.setRotationPoint(0.5F, 16F, 7F); - this.Leg3.setRotationPoint(-2.5F, 16F, -4F); - this.Leg4.setRotationPoint(0.5F, 16F, -4F); + if (var5.isSitting()) { + float dig = 0; + this.Mane.setRotationPoint(-1F, 16F, -2F); + this.Mane.rotateAngleX = ((float) Math.PI * 2F / 5F); + this.Mane.rotateAngleY = 0F; + this.Body.setRotationPoint(0F, 18F, 0F); + this.Body.rotateAngleX = ((float) Math.PI / 4F); + this.Tail.setRotationPoint(-1F, 21F, 6F); + this.Leg1.setRotationPoint(-2.5F, 22F, 2F); + this.Leg1.rotateAngleX = ((float) Math.PI * 3F / 2F); + this.Leg2.setRotationPoint(0.5F, 22F, 2F); + this.Leg2.rotateAngleX = ((float) Math.PI * 3F / 2F); + this.Leg3.rotateAngleX = 5.811947F + dig; + this.Leg3.setRotationPoint(-2.49F, 17F, -4F); + this.Leg4.rotateAngleX = 5.811947F - dig; + this.Leg4.setRotationPoint(0.51F, 17F, -4F); + } else // WALK + { + this.Body.setRotationPoint(0F, 14F, 2F); + this.Body.rotateAngleX = ((float) Math.PI / 2F); + this.Mane.setRotationPoint(-1F, 14F, -2F); + this.Mane.rotateAngleX = this.Body.rotateAngleX; + this.Tail.setRotationPoint(-1F, 12F, 8F); + this.Leg1.setRotationPoint(-2.5F, 16F, 7F); + this.Leg2.setRotationPoint(0.5F, 16F, 7F); + this.Leg3.setRotationPoint(-2.5F, 16F, -4F); + this.Leg4.setRotationPoint(0.5F, 16F, -4F); - if(var5.isChild() || var5.isSprinting())//Alternate run - { - this.Leg1.rotateAngleX = walk1; - this.Leg2.rotateAngleX = walk1; - this.Leg3.rotateAngleX = walk2; - this.Leg4.rotateAngleX = walk2; - } - else - { - this.Leg2.rotateAngleX = walk1; - this.Leg3.rotateAngleX = walk1; - this.Leg1.rotateAngleX = walk2; - this.Leg4.rotateAngleX = walk2; - } - } + if (var5.isChild() || var5.isSprinting())// Alternate run + { + this.Leg1.rotateAngleX = walk1; + this.Leg2.rotateAngleX = walk1; + this.Leg3.rotateAngleX = walk2; + this.Leg4.rotateAngleX = walk2; + } else { + this.Leg2.rotateAngleX = walk1; + this.Leg3.rotateAngleX = walk1; + this.Leg1.rotateAngleX = walk2; + this.Leg4.rotateAngleX = walk2; + } + } - this.WolfHead.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); - this.Collar.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); - this.Ear1.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); - this.Ear2.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); - this.Jaw.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); - this.Nose.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); - this.Mane.rotateAngleZ = var5.getShakeAngle(z, -0.08F); - this.Body.rotateAngleZ = var5.getShakeAngle(z, -0.16F); - this.Tail.rotateAngleZ = var5.getShakeAngle(z, -0.2F); - } + this.WolfHead.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); + this.Collar.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); + this.Ear1.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); + this.Ear2.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); + this.Jaw.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); + this.Nose.rotateAngleZ = var5.getInterestedAngle(z) + var5.getShakeAngle(z, 0F); + this.Mane.rotateAngleZ = var5.getShakeAngle(z, -0.08F); + this.Body.rotateAngleZ = var5.getShakeAngle(z, -0.16F); + this.Tail.rotateAngleZ = var5.getShakeAngle(z, -0.2F); + } - /** - * Sets the models various rotation angles. - */ - public void setRotationAngles(EntityHound wolf, float f1, float f2, float f3, float f4, float f5, float f6) { - super.setRotationAngles(f1, f2, f3, f4, f5, f6, wolf); - int neck = wolf.eatAnimation; - if (neck < -15) - neck = -15; + /** + * Sets the models various rotation angles. + */ + public void setRotationAngles(EntityHound wolf, float f1, float f2, float f3, float f4, float f5, float f6) { + super.setRotationAngles(f1, f2, f3, f4, f5, f6, wolf); + int neck = wolf.eatAnimation; + if (neck < -15) + neck = -15; - float neckAngle = f5 + (4F * neck); - float jawAngle = neckAngle + (1.5F * wolf.jawMove); - this.WolfHead.rotateAngleX = neckAngle / (180F / (float) Math.PI); - this.WolfHead.rotateAngleY = f4 / (180F / (float) Math.PI); + float neckAngle = f5 + (4F * neck); + float jawAngle = neckAngle + (1.5F * wolf.jawMove); + this.WolfHead.rotateAngleX = neckAngle / (180F / (float) Math.PI); + this.WolfHead.rotateAngleY = f4 / (180F / (float) Math.PI); - this.Collar.rotateAngleX = neckAngle / (180F / (float) Math.PI); - this.Collar.rotateAngleY = f4 / (180F / (float) Math.PI); + this.Collar.rotateAngleX = neckAngle / (180F / (float) Math.PI); + this.Collar.rotateAngleY = f4 / (180F / (float) Math.PI); - this.Ear1.rotateAngleX = neckAngle / (180F / (float) Math.PI); - this.Ear1.rotateAngleY = f4 / (180F / (float) Math.PI); + this.Ear1.rotateAngleX = neckAngle / (180F / (float) Math.PI); + this.Ear1.rotateAngleY = f4 / (180F / (float) Math.PI); - this.Ear2.rotateAngleX = neckAngle / (180F / (float) Math.PI); - this.Ear2.rotateAngleY = f4 / (180F / (float) Math.PI); + this.Ear2.rotateAngleX = neckAngle / (180F / (float) Math.PI); + this.Ear2.rotateAngleY = f4 / (180F / (float) Math.PI); - this.Jaw.rotateAngleX = jawAngle / (180F / (float) Math.PI); - this.Jaw.rotateAngleY = f4 / (180F / (float) Math.PI); + this.Jaw.rotateAngleX = jawAngle / (180F / (float) Math.PI); + this.Jaw.rotateAngleY = f4 / (180F / (float) Math.PI); - this.Nose.rotateAngleX = neckAngle / (180F / (float) Math.PI); - this.Nose.rotateAngleY = f4 / (180F / (float) Math.PI); + this.Nose.rotateAngleX = neckAngle / (180F / (float) Math.PI); + this.Nose.rotateAngleY = f4 / (180F / (float) Math.PI); - this.Tail.rotateAngleX = f3; - } + this.Tail.rotateAngleX = f3; + } - private void rotateSleeping() { - Leg1.rotationPointY = 23F; - Leg2.rotationPointY = 23F; - Leg3.rotationPointY = 23F; - Leg4.rotationPointY = 23F; + private void rotateSleeping() { + Leg1.rotationPointY = 23F; + Leg2.rotationPointY = 23F; + Leg3.rotationPointY = 23F; + Leg4.rotationPointY = 23F; - Leg1.rotationPointZ = 9F; - Leg2.rotationPointZ = 9F; - Leg3.rotationPointZ = -1F; - Leg4.rotationPointZ = -1F; - this.Leg1.rotateAngleX = -(float) (Math.PI / 2); - this.Leg2.rotateAngleX = -(float) (Math.PI / 2); - this.Leg3.rotateAngleX = -(float) (Math.PI / 2); - this.Leg4.rotateAngleX = -(float) (Math.PI / 2); - Body.rotateAngleX = 1; - Mane.rotateAngleX = 0; - Tail.rotateAngleX = 0; + Leg1.rotationPointZ = 9F; + Leg2.rotationPointZ = 9F; + Leg3.rotationPointZ = -1F; + Leg4.rotationPointZ = -1F; + this.Leg1.rotateAngleX = -(float) (Math.PI / 2); + this.Leg2.rotateAngleX = -(float) (Math.PI / 2); + this.Leg3.rotateAngleX = -(float) (Math.PI / 2); + this.Leg4.rotateAngleX = -(float) (Math.PI / 2); + Body.rotateAngleX = 1; + Mane.rotateAngleX = 0; + Tail.rotateAngleX = 0; - Body.rotationPointZ = 5; - this.Collar.rotationPointY = 17.5F; - this.Ear1.rotationPointY = 17.5F; - this.Ear2.rotationPointY = 17.5F; - this.WolfHead.rotationPointY = 17.5F; - this.Nose.rotationPointY = 17.5F; - this.Jaw.rotationPointY = 17.5F; + Body.rotationPointZ = 5; + this.Collar.rotationPointY = 17.5F; + this.Ear1.rotationPointY = 17.5F; + this.Ear2.rotationPointY = 17.5F; + this.WolfHead.rotationPointY = 17.5F; + this.Nose.rotationPointY = 17.5F; + this.Jaw.rotationPointY = 17.5F; - this.WolfHead.rotateAngleX = Ear1.rotateAngleX = Ear2.rotateAngleX = Nose.rotateAngleX = Collar.rotateAngleX = Jaw.rotateAngleX = 0.5F; - this.WolfHead.rotateAngleY = Ear1.rotateAngleY = Ear2.rotateAngleY = Nose.rotateAngleY = Collar.rotateAngleY = Jaw.rotateAngleY = 0F; - } + this.WolfHead.rotateAngleX = Ear1.rotateAngleX = Ear2.rotateAngleX = Nose.rotateAngleX = Collar.rotateAngleX = Jaw.rotateAngleX = 0.5F; + this.WolfHead.rotateAngleY = Ear1.rotateAngleY = Ear2.rotateAngleY = Nose.rotateAngleY = Collar.rotateAngleY = Jaw.rotateAngleY = 0F; + } } diff --git a/src/main/java/minefantasy/mf2/client/render/mob/ModelMinotaur.java b/src/main/java/minefantasy/mf2/client/render/mob/ModelMinotaur.java index 5f931819..b3cd926a 100644 --- a/src/main/java/minefantasy/mf2/client/render/mob/ModelMinotaur.java +++ b/src/main/java/minefantasy/mf2/client/render/mob/ModelMinotaur.java @@ -1,16 +1,13 @@ - package minefantasy.mf2.client.render.mob; import minefantasy.mf2.entity.mob.EntityMinotaur; -import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelMinotaur extends ModelBiped -{ - ModelRenderer Nose; +public class ModelMinotaur extends ModelBiped { + ModelRenderer Nose; ModelRenderer Mane; ModelRenderer bipedLeftForearm; ModelRenderer tailEnd; @@ -26,222 +23,215 @@ public class ModelMinotaur extends ModelBiped ModelRenderer bipedRightForearm; ModelRenderer shoulders; ModelRenderer trapezius; - + ModelRenderer helmet; ModelRenderer armour; ModelRenderer warlordhelm; - - public ModelMinotaur() - { - //AXIAL - textureWidth = 128; - textureHeight = 128; - - bipedHead = new ModelRenderer(this, 0, 0); - bipedHead.addBox(-2F, -3F, -5F, 4, 6, 6); - bipedHead.setRotationPoint(0F, -9F, -2F); - bipedHead.setTextureSize(128, 128); - - Nose = new ModelRenderer(this, 0, 54); - Nose.addBox(-2F, -1F, -9F, 4, 4, 4); - Nose.setRotationPoint(0F, -9F, -2F); - Nose.setTextureSize(128, 128); - - Mane = new ModelRenderer(this, 0, 88); - Mane.addBox(-3F, -3F, -2F, 6, 12, 8); - Mane.setRotationPoint(0F, -8F, 1F); - Mane.setTextureSize(128, 128); - - tailEnd = new ModelRenderer(this, 64, 0); - tailEnd.addBox(-1F, 4F, 10F, 2, 2, 11); - tailEnd.setRotationPoint(0F, 4F, 0F); - tailEnd.setTextureSize(128, 128); - setRotation(tailEnd, -0.5363927F, 0F, 0F); - - bipedBody = new ModelRenderer(this, 0, 12); - bipedBody.addBox(-5F, 0F, -5F, 10, 14, 9); - bipedBody.setRotationPoint(0F, -8F, 1F); - bipedBody.setTextureSize(128, 128); - - tail = new ModelRenderer(this, 64, 17); - tail.addBox(-2F, -3F, 2F, 4, 3, 11); - tail.setRotationPoint(0F, 4F, 0F); - tail.setTextureSize(128, 128); - setRotation(tail, -1.182165F, 0F, 0F); - - shoulders = new ModelRenderer(this, 86, 50); - shoulders.addBox(-7.5F, -1F, -4F, 15, 7, 6); - shoulders.setRotationPoint(0F, -8F, 1F); - shoulders.setTextureSize(128, 128); - - trapezius = new ModelRenderer(this, 0, 64); - trapezius.addBox(-4F, -2F, -4F, 8, 13, 9); - trapezius.setRotationPoint(0F, -8F, 1F); - trapezius.setTextureSize(128, 128); - - //APPENDICULAR - LEFT - Lhorn1 = new ModelRenderer(this, 20, 5); - Lhorn1.mirror = true; - Lhorn1.addBox(2F, -2F, -2F, 5, 2, 2); - Lhorn1.setRotationPoint(0F, -9F, -2F); - Lhorn1.setTextureSize(128, 128); - - Lhorn2 = new ModelRenderer(this, 20, 0); - Lhorn2.mirror = true; - Lhorn2.addBox(6F, -6F, -2F, 1, 4, 1); - Lhorn2.setRotationPoint(0F, -9F, -2F); - Lhorn2.setTextureSize(128, 128); - - bipedLeftArm = new ModelRenderer(this, 38, 33); - bipedLeftArm.mirror = true; - bipedLeftArm.addBox(-1F, -2F, -3F, 5, 10, 7); - bipedLeftArm.setRotationPoint(7F, -6F, 1F); - bipedLeftArm.setTextureSize(128, 128); - - bipedLeftForearm = new ModelRenderer(this, 62, 33); - bipedLeftForearm.mirror = true; - bipedLeftForearm.addBox(0F, 8F, -1F, 4, 10, 4); - bipedLeftForearm.setRotationPoint(7F, -6F, 1F); - bipedLeftForearm.setTextureSize(128, 128); - - bipedLeftThigh = new ModelRenderer(this, 38, 0); - bipedLeftThigh.mirror = true; - bipedLeftThigh.addBox(-2F, 0F, -3F, 5, 10, 8); - bipedLeftThigh.setRotationPoint(3F, 4F, 0F); - bipedLeftThigh.setTextureSize(128, 128); - - bipedLeftLeg = new ModelRenderer(this, 20, 50); - bipedLeftLeg.mirror = true; - bipedLeftLeg.addBox(-1F, 10F, 0F, 4, 6, 5); - bipedLeftLeg.setRotationPoint(3F, 4F, 0F); - bipedLeftLeg.setTextureSize(128, 128); - - bipedLeftFoot = new ModelRenderer(this, 20, 38); - bipedLeftFoot.mirror = true; - bipedLeftFoot.addBox(-1F, 13F, -2F, 4, 7, 5); - bipedLeftFoot.setRotationPoint(3F, 4F, 0F); - bipedLeftFoot.setTextureSize(128, 128); - - //APPENDICULAR - RIGHT - Rhorn1 = new ModelRenderer(this, 20, 5); - Rhorn1.addBox(-7F, -2F, -2F, 5, 2, 2); - Rhorn1.setRotationPoint(0F, -9F, -2F); - Rhorn1.setTextureSize(128, 128); - - Rhorn2 = new ModelRenderer(this, 20, 0); - Rhorn2.addBox(-7F, -6F, -2F, 1, 4, 1); - Rhorn2.setRotationPoint(0F, -9F, -2F); - Rhorn2.setTextureSize(128, 128); - - bipedRightArm = new ModelRenderer(this, 38, 33); - bipedRightArm.addBox(-4F, -2F, -3F, 5, 10, 7); - bipedRightArm.setRotationPoint(-7F, -6F, 1F); - bipedRightArm.setTextureSize(128, 128); - - bipedRightForearm = new ModelRenderer(this, 62, 33); - bipedRightForearm.addBox(-4F, 8F, -1F, 4, 10, 4); - bipedRightForearm.setRotationPoint(-7F, -6F, 1F); - bipedRightForearm.setTextureSize(128, 128); - - bipedRightThigh = new ModelRenderer(this, 38, 0); - bipedRightThigh.addBox(-3F, 0F, -3F, 5, 10, 8); - bipedRightThigh.setRotationPoint(-3F, 4F, 0F); - bipedRightThigh.setTextureSize(128, 128); - - bipedRightLeg = new ModelRenderer(this, 20, 50); - bipedRightLeg.addBox(-3F, 10F, 0F, 4, 6, 5); - bipedRightLeg.setRotationPoint(-3F, 4F, 0F); - bipedRightLeg.setTextureSize(128, 128); - - bipedRightFoot = new ModelRenderer(this, 20, 38); - bipedRightFoot.addBox(-3F, 13F, -2F, 4, 7, 5); - bipedRightFoot.setRotationPoint(-3F, 4F, 0F); - bipedRightFoot.setTextureSize(128, 128); - - //ARMOUR - helmet = new ModelRenderer(this, 74, 98); - helmet.addBox(-2.5F, -3.5F, -5.5F, 5, 6, 6); - helmet.setRotationPoint(0F, -9F, -2F); - - armour = new ModelRenderer(this, 86, 103); - armour.setTextureOffset(86, 103).addBox(-5.5F, -0.5F, -5.5F, 11, 15, 10);//chest - armour.setTextureOffset(90, 77).addBox(-4.5F, -4.5F, -2.5F, 9, 16, 10);//back - armour.setTextureOffset(34, 110).addBox(-8F, -1.5F, -5F, 16, 8, 10);//shoulders - armour.setRotationPoint(0F, -8F, 1F); - - warlordhelm = new ModelRenderer(this, 46, 97); - warlordhelm.addBox(-3.5F, -2F, -10F, 7, 6, 7); - warlordhelm.setRotationPoint(-32F, -9F, -2F); - } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - renderMinotaur((EntityMinotaur)entity, f, f1, f2, f3, f4, f5); - } - public void renderMinotaur(EntityMinotaur mino, float f, float f1, float f2, float f3, float f4, float f5) - { - setRotationAngles(mino, f, f1, f2, f3, f4, f5); - Nose.render(f5); - tailEnd.render(f5); - bipedLeftFoot.render(f5); - bipedRightFoot.render(f5); - shoulders.render(f5); - bipedLeftThigh.render(f5); - bipedRightThigh.render(f5); - tail.render(f5); - Rhorn1.render(f5); - Rhorn2.render(f5); - Lhorn1.render(f5); - if(!mino.isBloodied()) - { - Lhorn2.render(f5); - } - bipedHead.render(f5); - bipedLeftLeg.render(f5); - bipedRightLeg.render(f5); - bipedBody.render(f5); - bipedRightArm.render(f5); - bipedLeftArm.render(f5); - bipedRightForearm.render(f5); - bipedLeftForearm.render(f5); - bipedRightLeg.render(f5); - bipedLeftLeg.render(f5); - Mane.render(f5); - trapezius.render(f5); - - armour.render(f5); - helmet.render(f5); - warlordhelm.render(f5); - } - - public void setRotationAngles(EntityMinotaur mino, float f, float f1, float f2, float f3, float f4, float f5) - { + + public ModelMinotaur() { + // AXIAL + textureWidth = 128; + textureHeight = 128; + + bipedHead = new ModelRenderer(this, 0, 0); + bipedHead.addBox(-2F, -3F, -5F, 4, 6, 6); + bipedHead.setRotationPoint(0F, -9F, -2F); + bipedHead.setTextureSize(128, 128); + + Nose = new ModelRenderer(this, 0, 54); + Nose.addBox(-2F, -1F, -9F, 4, 4, 4); + Nose.setRotationPoint(0F, -9F, -2F); + Nose.setTextureSize(128, 128); + + Mane = new ModelRenderer(this, 0, 88); + Mane.addBox(-3F, -3F, -2F, 6, 12, 8); + Mane.setRotationPoint(0F, -8F, 1F); + Mane.setTextureSize(128, 128); + + tailEnd = new ModelRenderer(this, 64, 0); + tailEnd.addBox(-1F, 4F, 10F, 2, 2, 11); + tailEnd.setRotationPoint(0F, 4F, 0F); + tailEnd.setTextureSize(128, 128); + setRotation(tailEnd, -0.5363927F, 0F, 0F); + + bipedBody = new ModelRenderer(this, 0, 12); + bipedBody.addBox(-5F, 0F, -5F, 10, 14, 9); + bipedBody.setRotationPoint(0F, -8F, 1F); + bipedBody.setTextureSize(128, 128); + + tail = new ModelRenderer(this, 64, 17); + tail.addBox(-2F, -3F, 2F, 4, 3, 11); + tail.setRotationPoint(0F, 4F, 0F); + tail.setTextureSize(128, 128); + setRotation(tail, -1.182165F, 0F, 0F); + + shoulders = new ModelRenderer(this, 86, 50); + shoulders.addBox(-7.5F, -1F, -4F, 15, 7, 6); + shoulders.setRotationPoint(0F, -8F, 1F); + shoulders.setTextureSize(128, 128); + + trapezius = new ModelRenderer(this, 0, 64); + trapezius.addBox(-4F, -2F, -4F, 8, 13, 9); + trapezius.setRotationPoint(0F, -8F, 1F); + trapezius.setTextureSize(128, 128); + + // APPENDICULAR - LEFT + Lhorn1 = new ModelRenderer(this, 20, 5); + Lhorn1.mirror = true; + Lhorn1.addBox(2F, -2F, -2F, 5, 2, 2); + Lhorn1.setRotationPoint(0F, -9F, -2F); + Lhorn1.setTextureSize(128, 128); + + Lhorn2 = new ModelRenderer(this, 20, 0); + Lhorn2.mirror = true; + Lhorn2.addBox(6F, -6F, -2F, 1, 4, 1); + Lhorn2.setRotationPoint(0F, -9F, -2F); + Lhorn2.setTextureSize(128, 128); + + bipedLeftArm = new ModelRenderer(this, 38, 33); + bipedLeftArm.mirror = true; + bipedLeftArm.addBox(-1F, -2F, -3F, 5, 10, 7); + bipedLeftArm.setRotationPoint(7F, -6F, 1F); + bipedLeftArm.setTextureSize(128, 128); + + bipedLeftForearm = new ModelRenderer(this, 62, 33); + bipedLeftForearm.mirror = true; + bipedLeftForearm.addBox(0F, 8F, -1F, 4, 10, 4); + bipedLeftForearm.setRotationPoint(7F, -6F, 1F); + bipedLeftForearm.setTextureSize(128, 128); + + bipedLeftThigh = new ModelRenderer(this, 38, 0); + bipedLeftThigh.mirror = true; + bipedLeftThigh.addBox(-2F, 0F, -3F, 5, 10, 8); + bipedLeftThigh.setRotationPoint(3F, 4F, 0F); + bipedLeftThigh.setTextureSize(128, 128); + + bipedLeftLeg = new ModelRenderer(this, 20, 50); + bipedLeftLeg.mirror = true; + bipedLeftLeg.addBox(-1F, 10F, 0F, 4, 6, 5); + bipedLeftLeg.setRotationPoint(3F, 4F, 0F); + bipedLeftLeg.setTextureSize(128, 128); + + bipedLeftFoot = new ModelRenderer(this, 20, 38); + bipedLeftFoot.mirror = true; + bipedLeftFoot.addBox(-1F, 13F, -2F, 4, 7, 5); + bipedLeftFoot.setRotationPoint(3F, 4F, 0F); + bipedLeftFoot.setTextureSize(128, 128); + + // APPENDICULAR - RIGHT + Rhorn1 = new ModelRenderer(this, 20, 5); + Rhorn1.addBox(-7F, -2F, -2F, 5, 2, 2); + Rhorn1.setRotationPoint(0F, -9F, -2F); + Rhorn1.setTextureSize(128, 128); + + Rhorn2 = new ModelRenderer(this, 20, 0); + Rhorn2.addBox(-7F, -6F, -2F, 1, 4, 1); + Rhorn2.setRotationPoint(0F, -9F, -2F); + Rhorn2.setTextureSize(128, 128); + + bipedRightArm = new ModelRenderer(this, 38, 33); + bipedRightArm.addBox(-4F, -2F, -3F, 5, 10, 7); + bipedRightArm.setRotationPoint(-7F, -6F, 1F); + bipedRightArm.setTextureSize(128, 128); + + bipedRightForearm = new ModelRenderer(this, 62, 33); + bipedRightForearm.addBox(-4F, 8F, -1F, 4, 10, 4); + bipedRightForearm.setRotationPoint(-7F, -6F, 1F); + bipedRightForearm.setTextureSize(128, 128); + + bipedRightThigh = new ModelRenderer(this, 38, 0); + bipedRightThigh.addBox(-3F, 0F, -3F, 5, 10, 8); + bipedRightThigh.setRotationPoint(-3F, 4F, 0F); + bipedRightThigh.setTextureSize(128, 128); + + bipedRightLeg = new ModelRenderer(this, 20, 50); + bipedRightLeg.addBox(-3F, 10F, 0F, 4, 6, 5); + bipedRightLeg.setRotationPoint(-3F, 4F, 0F); + bipedRightLeg.setTextureSize(128, 128); + + bipedRightFoot = new ModelRenderer(this, 20, 38); + bipedRightFoot.addBox(-3F, 13F, -2F, 4, 7, 5); + bipedRightFoot.setRotationPoint(-3F, 4F, 0F); + bipedRightFoot.setTextureSize(128, 128); + + // ARMOUR + helmet = new ModelRenderer(this, 74, 98); + helmet.addBox(-2.5F, -3.5F, -5.5F, 5, 6, 6); + helmet.setRotationPoint(0F, -9F, -2F); + + armour = new ModelRenderer(this, 86, 103); + armour.setTextureOffset(86, 103).addBox(-5.5F, -0.5F, -5.5F, 11, 15, 10);// chest + armour.setTextureOffset(90, 77).addBox(-4.5F, -4.5F, -2.5F, 9, 16, 10);// back + armour.setTextureOffset(34, 110).addBox(-8F, -1.5F, -5F, 16, 8, 10);// shoulders + armour.setRotationPoint(0F, -8F, 1F); + + warlordhelm = new ModelRenderer(this, 46, 97); + warlordhelm.addBox(-3.5F, -2F, -10F, 7, 6, 7); + warlordhelm.setRotationPoint(-32F, -9F, -2F); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + renderMinotaur((EntityMinotaur) entity, f, f1, f2, f3, f4, f5); + } + + public void renderMinotaur(EntityMinotaur mino, float f, float f1, float f2, float f3, float f4, float f5) { + setRotationAngles(mino, f, f1, f2, f3, f4, f5); + Nose.render(f5); + tailEnd.render(f5); + bipedLeftFoot.render(f5); + bipedRightFoot.render(f5); + shoulders.render(f5); + bipedLeftThigh.render(f5); + bipedRightThigh.render(f5); + tail.render(f5); + Rhorn1.render(f5); + Rhorn2.render(f5); + Lhorn1.render(f5); + if (!mino.isBloodied()) { + Lhorn2.render(f5); + } + bipedHead.render(f5); + bipedLeftLeg.render(f5); + bipedRightLeg.render(f5); + bipedBody.render(f5); + bipedRightArm.render(f5); + bipedLeftArm.render(f5); + bipedRightForearm.render(f5); + bipedLeftForearm.render(f5); + bipedRightLeg.render(f5); + bipedLeftLeg.render(f5); + Mane.render(f5); + trapezius.render(f5); + + armour.render(f5); + helmet.render(f5); + warlordhelm.render(f5); + } + + public void setRotationAngles(EntityMinotaur mino, float f, float f1, float f2, float f3, float f4, float f5) { int swingAngle = 28 * mino.swing; double swingRad = Math.toRadians(swingAngle); - + int swingAngleY = 9 * mino.swing; double swingRadY = Math.toRadians(swingAngleY); bipedHead.rotateAngleY = f3 / 57.29578F; - bipedHead.rotateAngleX = f4 / 57.29578F + (float)Math.toRadians(mino.getHeadChargeAngle()); - if (mino.swing <= 0) - { + bipedHead.rotateAngleX = f4 / 57.29578F + (float) Math.toRadians(mino.getHeadChargeAngle()); + if (mino.swing <= 0) { bipedRightArm.rotateAngleX = MathHelper.cos(f * 0.6662F + 3.141593F) * 2.0F * f1 * 0.5F; bipedLeftArm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5F; bipedRightArm.rotateAngleY = 0.0F; - bipedLeftArm.rotateAngleY = 0.0F; - } - else - { + bipedLeftArm.rotateAngleY = 0.0F; + } else { bipedRightArm.rotateAngleX = (float) -swingRad; bipedLeftArm.rotateAngleX = (float) -swingRad; - bipedRightArm.rotateAngleY = (float)swingRadY; - bipedLeftArm.rotateAngleY = (float)-swingRadY; + bipedRightArm.rotateAngleY = (float) swingRadY; + bipedLeftArm.rotateAngleY = (float) -swingRadY; } bipedRightArm.rotateAngleZ = 0.0F; bipedLeftArm.rotateAngleZ = 0.0F; @@ -262,7 +252,7 @@ public void setRotationAngles(EntityMinotaur mino, float f, float f1, float f2, Lhorn1.rotateAngleY = bipedHead.rotateAngleY; Lhorn2.rotateAngleX = bipedHead.rotateAngleX; Lhorn2.rotateAngleY = bipedHead.rotateAngleY; - + if (onGround > -9990F) { float f6 = onGround; bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * 3.141593F * 2.0F) * 0.2F; @@ -279,56 +269,54 @@ public void setRotationAngles(EntityMinotaur mino, float f, float f1, float f2, f6 = 1.0F - f6; float f8 = MathHelper.sin(f6 * 3.141593F); float f10 = MathHelper.sin(onGround * 3.141593F) * -(bipedHead.rotateAngleX - 0.7F) * 0.75F; - bipedRightArm.rotateAngleX -= (double) f8 * 1.2D + (double) f10; + bipedRightArm.rotateAngleX -= f8 * 1.2D + f10; bipedRightArm.rotateAngleY += bipedBody.rotateAngleY * 2.0F; bipedRightArm.rotateAngleZ = MathHelper.sin(onGround * 3.141593F) * -0.4F; } - if(mino.riddenByEntity != null) - { - bipedLeftArm.rotateAngleX = (float) Math.toRadians(180F); + if (mino.riddenByEntity != null) { + bipedLeftArm.rotateAngleX = (float) Math.toRadians(180F); } - if(mino.getAttack() == 3 && mino.getHeldItem() == null)//if is power attack + if (mino.getAttack() == 3 && mino.getHeldItem() == null)// if is power attack { - bipedLeftArm.rotateAngleX = (float) Math.toRadians(-135F); - bipedRightArm.rotateAngleX = (float) Math.toRadians(-135F); + bipedLeftArm.rotateAngleX = (float) Math.toRadians(-135F); + bipedRightArm.rotateAngleX = (float) Math.toRadians(-135F); } - + bipedRightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F; bipedLeftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F; bipedRightArm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.05F; bipedLeftArm.rotateAngleX -= MathHelper.sin(f2 * 0.067F) * 0.05F; - + bipedLeftThigh.rotateAngleX = bipedLeftFoot.rotateAngleX = bipedLeftLeg.rotateAngleX; bipedRightThigh.rotateAngleX = bipedRightFoot.rotateAngleX = bipedRightLeg.rotateAngleX; - + joinBlocks(Mane, bipedBody); joinBlocks(trapezius, bipedBody); joinBlocks2(bipedLeftForearm, bipedLeftArm); joinBlocks2(bipedRightForearm, bipedRightArm); - + joinBlocks(armour, bipedBody); joinBlocks2(helmet, bipedHead); joinBlocks2(warlordhelm, bipedHead); } - private void joinBlocks(ModelRenderer model, ModelRenderer anchor) - { - joinBlocks(model, anchor, 1.0F); + + private void joinBlocks(ModelRenderer model, ModelRenderer anchor) { + joinBlocks(model, anchor, 1.0F); } - private void joinBlocks2(ModelRenderer model, ModelRenderer anchor) - { - model.rotateAngleX = anchor.rotateAngleX; - model.rotateAngleY = anchor.rotateAngleY; - model.rotateAngleZ = anchor.rotateAngleZ; - - model.rotationPointX = anchor.rotationPointX; - model.rotationPointY = anchor.rotationPointY; - model.rotationPointZ = anchor.rotationPointZ; + + private void joinBlocks2(ModelRenderer model, ModelRenderer anchor) { + model.rotateAngleX = anchor.rotateAngleX; + model.rotateAngleY = anchor.rotateAngleY; + model.rotateAngleZ = anchor.rotateAngleZ; + + model.rotationPointX = anchor.rotationPointX; + model.rotationPointY = anchor.rotationPointY; + model.rotationPointZ = anchor.rotationPointZ; } - - private void joinBlocks(ModelRenderer model, ModelRenderer anchor, float ratio) - { - model.rotateAngleX = anchor.rotateAngleX * ratio; - model.rotateAngleY = anchor.rotateAngleY * ratio; - model.rotateAngleZ = anchor.rotateAngleZ * ratio; + + private void joinBlocks(ModelRenderer model, ModelRenderer anchor, float ratio) { + model.rotateAngleX = anchor.rotateAngleX * ratio; + model.rotateAngleY = anchor.rotateAngleY * ratio; + model.rotateAngleZ = anchor.rotateAngleZ * ratio; } } diff --git a/src/main/java/minefantasy/mf2/client/render/mob/ModelVenomDragon.java b/src/main/java/minefantasy/mf2/client/render/mob/ModelVenomDragon.java index 48a5fdf4..0ecc5776 100644 --- a/src/main/java/minefantasy/mf2/client/render/mob/ModelVenomDragon.java +++ b/src/main/java/minefantasy/mf2/client/render/mob/ModelVenomDragon.java @@ -6,9 +6,8 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ModelVenomDragon extends ModelBase -{ - public ModelRenderer Body; +public class ModelVenomDragon extends ModelBase { + public ModelRenderer Body; public ModelRenderer Tail1; public ModelRenderer Belly1; public ModelRenderer Wingshoulderright; @@ -160,8 +159,7 @@ public class ModelVenomDragon extends ModelBase public ModelRenderer Clawrighthandright; public ModelRenderer Thumbtoelowerright; - public ModelVenomDragon() - { + public ModelVenomDragon() { this.textureWidth = 512; this.textureHeight = 512; this.Thumbtoeupperleft = new ModelRenderer(this, 305, 280); @@ -927,9 +925,8 @@ public ModelVenomDragon() this.Winglowerarmright.addChild(this.Wingfinger1right); this.Wingfinger1right.addChild(this.Wingfinger2right); this.Wingfinger1right.addChild(this.Wingmembramelargeright); - - - //Grouping + + // Grouping this.RightFoot.addChild(this.Righttoeleft); this.Thumbtoeupperright.addChild(this.Thumbtoelowerright); this.Wingupperarmleft.addChild(this.Wingmembramesmallleft); @@ -991,7 +988,7 @@ public ModelVenomDragon() this.Rightfoot.addChild(this.Lefttoeleft); this.Righthandleftfinger.addChild(this.Clawrighthandleft); this.Neckend.addChild(this.Headback); - //this.Headback.addChild(this.Lowerjaw); + // this.Headback.addChild(this.Lowerjaw); this.Shoulderleft.addChild(this.Lowerarmleft); this.Thumbtoeupperleft.addChild(this.Thumbtoelowerleft); this.Body.addChild(this.Shoulderleft_1); @@ -1033,15 +1030,14 @@ public ModelVenomDragon() this.Rightfoot.addChild(this.Lefttoemid); this.Lefthandrightfinger_1.addChild(this.Clawlefthandleft); } - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { + + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles((EntityDragon) entity, f, f1, f2, f3, f4, f5); this.Body.render(f5); @@ -1053,59 +1049,55 @@ private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleZ = z; } - public void setRotationAngles(EntityDragon dragon, float step1, float step2, float head1, float neckY, float neckX, float head4) - { + public void setRotationAngles(EntityDragon dragon, float step1, float step2, float head1, float neckY, float neckX, + float head4) { super.setRotationAngles(step1, step2, head1, neckY, neckX, head4, dragon); float wingFlap = (float) Math.toRadians(dragon.wingFlap()); - float jawAngle = (float)Math.toRadians(dragon.getJawMove()); - float neckAngle = -(float)Math.toRadians(4.5F * dragon.getNeckAngle()); - + float jawAngle = (float) Math.toRadians(dragon.getJawMove()); + float neckAngle = -(float) Math.toRadians(4.5F * dragon.getNeckAngle()); + this.Headback.rotateAngleX = neckX / (180F / (float) Math.PI) + neckAngle; this.Headback.rotateAngleY = neckY / (180F / (float) Math.PI); - + this.Lowerjaw.rotateAngleX = 0.045553093477052F + jawAngle; - //this.Tail1.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - //this.Tail3.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - //this.Tail4.rotateAngleY = (float) Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; - - if (!dragon.isTerrestrial()) //Fly + // this.Tail1.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + // this.Tail3.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + // this.Tail4.rotateAngleY = (float) + // Math.toRadians(dragon.prevRotationYaw-dragon.rotationYaw)*1.5F; + + if (!dragon.isTerrestrial()) // Fly { - if(!dragon.onGround) - { - float angle = (float) Math.toRadians(dragon.getVertTailAngle()); - this.Body.rotateAngleX = 0.546F - angle; - } - else - { - this.Body.rotateAngleX = 0.5462880558742251F; - } - - if(dragon.motionY < -0.01F)//Glide - { - wingFlap = 0; - } - else if (dragon.motionX == 0 && dragon.motionZ == 0) //Hover - { - wingFlap = (float) Math.toRadians(dragon.wingFlap()); + if (!dragon.onGround) { + float angle = (float) Math.toRadians(dragon.getVertTailAngle()); + this.Body.rotateAngleX = 0.546F - angle; + } else { + this.Body.rotateAngleX = 0.5462880558742251F; } - else + + if (dragon.motionY < -0.01F)// Glide + { + wingFlap = 0; + } else if (dragon.motionX == 0 && dragon.motionZ == 0) // Hover { - wingFlap = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2;//Move + wingFlap = (float) Math.toRadians(dragon.wingFlap()); + } else { + wingFlap = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2;// Move } - this.Wingshoulderright.rotateAngleZ = (float) (wingFlap*0.75F); - this.Wingshoulderleft.rotateAngleZ = (float) -(wingFlap*0.75F); - this.Wingupperarmright.rotateAngleZ = (float) (wingFlap*0.25F); - this.Wingupperarmleft.rotateAngleZ = (float) -(wingFlap*0.25F); - - } - else //Walk + this.Wingshoulderright.rotateAngleZ = wingFlap * 0.75F; + this.Wingshoulderleft.rotateAngleZ = -(wingFlap * 0.75F); + this.Wingupperarmright.rotateAngleZ = wingFlap * 0.25F; + this.Wingupperarmleft.rotateAngleZ = -(wingFlap * 0.25F); + + } else // Walk { - this.Body.rotateAngleX = 0.5462880558742251F; - this.Wingshoulderright.rotateAngleZ = (float) -Math.toRadians(40); + this.Body.rotateAngleX = 0.5462880558742251F; + this.Wingshoulderright.rotateAngleZ = (float) -Math.toRadians(40); this.Wingshoulderleft.rotateAngleZ = (float) Math.toRadians(40); - // this.Winglowerarmright.rotateAngleZ = (float) Math.toRadians(180); - //this.Winglowerarmleft.rotateAngleZ = (float) -Math.toRadians(180); - + // this.Winglowerarmright.rotateAngleZ = (float) Math.toRadians(180); + // this.Winglowerarmleft.rotateAngleZ = (float) -Math.toRadians(180); + this.Righthip.rotateAngleX = MathHelper.cos(step1 * 0.6662F) * 1.4F * step2; this.Lefthip.rotateAngleX = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; this.Shoulderleft_1.rotateAngleX = MathHelper.cos(step1 * 0.6662F + (float) Math.PI) * 1.4F * step2; diff --git a/src/main/java/minefantasy/mf2/client/render/mob/RenderDragon.java b/src/main/java/minefantasy/mf2/client/render/mob/RenderDragon.java index f6303fff..b951bb7f 100644 --- a/src/main/java/minefantasy/mf2/client/render/mob/RenderDragon.java +++ b/src/main/java/minefantasy/mf2/client/render/mob/RenderDragon.java @@ -1,7 +1,7 @@ package minefantasy.mf2.client.render.mob; -import org.lwjgl.opengl.GL11; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.entity.mob.EntityDragon; import net.minecraft.client.model.ModelBase; @@ -11,47 +11,44 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.BossStatus; import net.minecraft.util.ResourceLocation; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) -public class RenderDragon extends RenderLiving -{ - private static ModelBase dragonModel = new ModelDragon(); - private static ModelBase venomModel = new ModelVenomDragon(); - private static ModelBase frostModel = new ModelFrostDragon(); - private static ModelBase ashModel = new ModelAshDragon(); - public RenderDragon(float shadow) - { +public class RenderDragon extends RenderLiving { + private static ModelBase dragonModel = new ModelDragon(); + private static ModelBase venomModel = new ModelVenomDragon(); + private static ModelBase frostModel = new ModelFrostDragon(); + private static ModelBase ashModel = new ModelAshDragon(); + + public RenderDragon(float shadow) { super(dragonModel, shadow); } - + @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - if(entity instanceof EntityDragon) - { - return TextureHelperMF.getResource("textures/models/monster/dragon/"+((EntityDragon)entity).getTexture() + ".png"); - } - return TextureHelperMF.getResource("textures/models/monster/dragon/dragonGreen.png"); - } - + protected ResourceLocation getEntityTexture(Entity entity) { + if (entity instanceof EntityDragon) { + return TextureHelperMF + .getResource("textures/models/monster/dragon/" + ((EntityDragon) entity).getTexture() + ".png"); + } + return TextureHelperMF.getResource("textures/models/monster/dragon/dragonGreen.png"); + } + @Override - protected void preRenderCallback(EntityLivingBase entity, float f) - { - this.preRenderCallback((EntityDragon)entity, f); + protected void preRenderCallback(EntityLivingBase entity, float f) { + this.preRenderCallback((EntityDragon) entity, f); } - public void doRender(EntityLiving entity, double x, double y, double z, float f, float f1) - { - String breed = ((EntityDragon)entity).getType().breedName; - this.mainModel = breed.equalsIgnoreCase("ash") ? ashModel : breed.equalsIgnoreCase("white") ? frostModel : breed.equalsIgnoreCase("green") ? venomModel : dragonModel; - super.doRender(entity, x, y, z, f, 1); - BossStatus.setBossStatus((EntityDragon)entity, ((EntityDragon)entity).getType().tier == 4); + + public void doRender(EntityLiving entity, double x, double y, double z, float f, float f1) { + String breed = ((EntityDragon) entity).getType().breedName; + this.mainModel = breed.equalsIgnoreCase("ash") ? ashModel + : breed.equalsIgnoreCase("white") ? frostModel + : breed.equalsIgnoreCase("green") ? venomModel : dragonModel; + super.doRender(entity, x, y, z, f, 1); + BossStatus.setBossStatus((EntityDragon) entity, ((EntityDragon) entity).getType().tier == 4); } - - protected void preRenderCallback(EntityDragon mob, float f) - { - float scale = mob.getScale(); + + protected void preRenderCallback(EntityDragon mob, float f) { + float scale = mob.getScale(); GL11.glScalef(scale, scale, scale); } } diff --git a/src/main/java/minefantasy/mf2/client/render/mob/RenderHound.java b/src/main/java/minefantasy/mf2/client/render/mob/RenderHound.java index 3f65d8ba..e48a780b 100644 --- a/src/main/java/minefantasy/mf2/client/render/mob/RenderHound.java +++ b/src/main/java/minefantasy/mf2/client/render/mob/RenderHound.java @@ -1,7 +1,5 @@ package minefantasy.mf2.client.render.mob; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; @@ -12,12 +10,11 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) -public class RenderHound extends RenderLiving -{ - public RenderHound(ModelBase modelbase) - { +public class RenderHound extends RenderLiving { + public RenderHound(ModelBase modelbase) { super(modelbase, 1.0F); this.setRenderPassModel(modelbase); } @@ -25,70 +22,61 @@ public RenderHound(ModelBase modelbase) /** * Defines what float the third param in setRotationAngles of ModelBase is */ - protected float handleRotationFloat(EntityHound mob, float f) - { + protected float handleRotationFloat(EntityHound mob, float f) { return mob.getTailRotation(); } /** * Queries whether should render the specified pass or not. */ - protected int shouldRenderPass(EntityHound hound, int layer, float f) - { - if (layer == 0 && hound.getWolfShaking()) - { + protected int shouldRenderPass(EntityHound hound, int layer, float f) { + if (layer == 0 && hound.getWolfShaking()) { float f1 = hound.getBrightness(f) * hound.getShadingWhileShaking(f); this.bindTexture("hound"); GL11.glColor3f(f1, f1, f1); return 1; - } - else if (layer == 1 && hound.isTamed()) - { + } else if (layer == 1 && hound.isTamed()) { this.bindTexture("collar"); int j = hound.getCollarColor(); - GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]); + GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], + EntitySheep.fleeceColorTable[j][2]); return 1; - } - else - { + } else { return -1; } } - private void bindTexture(String string) - { - bindTexture(TextureHelperMF.getResource("textures/models/animal/hound/"+string+".png")); - } + private void bindTexture(String string) { + bindTexture(TextureHelperMF.getResource("textures/models/animal/hound/" + string + ".png")); + } - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless + * you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(EntityHound p_110775_1_) - { + protected ResourceLocation getEntityTexture(EntityHound p_110775_1_) { return TextureHelperMF.getResource("textures/models/animal/hound/hound.png"); } /** * Queries whether should render the specified pass or not. */ - protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_) - { - return this.shouldRenderPass((EntityHound)p_77032_1_, p_77032_2_, p_77032_3_); + protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_) { + return this.shouldRenderPass((EntityHound) p_77032_1_, p_77032_2_, p_77032_3_); } /** * Defines what float the third param in setRotationAngles of ModelBase is */ - protected float handleRotationFloat(EntityLivingBase p_77044_1_, float p_77044_2_) - { - return this.handleRotationFloat((EntityHound)p_77044_1_, p_77044_2_); + protected float handleRotationFloat(EntityLivingBase p_77044_1_, float p_77044_2_) { + return this.handleRotationFloat((EntityHound) p_77044_1_, p_77044_2_); } /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + * Returns the location of an entity's texture. Doesn't seem to be called unless + * you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(Entity p_110775_1_) - { - return this.getEntityTexture((EntityHound)p_110775_1_); + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return this.getEntityTexture((EntityHound) p_110775_1_); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/client/render/mob/RenderMinotaur.java b/src/main/java/minefantasy/mf2/client/render/mob/RenderMinotaur.java index 2ee9c40d..45184923 100644 --- a/src/main/java/minefantasy/mf2/client/render/mob/RenderMinotaur.java +++ b/src/main/java/minefantasy/mf2/client/render/mob/RenderMinotaur.java @@ -1,23 +1,17 @@ package minefantasy.mf2.client.render.mob; -import java.util.UUID; - -import org.lwjgl.opengl.GL11; - import com.mojang.authlib.GameProfile; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.helpers.TextureHelperMF; import minefantasy.mf2.entity.mob.EntityMinotaur; import net.minecraft.block.Block; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.entity.RenderBiped; -import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.boss.BossStatus; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -26,56 +20,52 @@ import net.minecraft.nbt.NBTUtil; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; + +import java.util.UUID; @SideOnly(Side.CLIENT) -public class RenderMinotaur extends RenderBiped -{ - public RenderMinotaur(ModelBiped model, float shadow) - { +public class RenderMinotaur extends RenderBiped { + public RenderMinotaur(ModelBiped model, float shadow) { super(model, shadow); - + } - + @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - if(entity instanceof EntityMinotaur) - { - return TextureHelperMF.getResource("textures/models/monster/minotaur/"+((EntityMinotaur)entity).getTexture() + ".png"); - } - return TextureHelperMF.getResource("textures/models/monster/minotaur/minotaurBrown.png"); - } - + protected ResourceLocation getEntityTexture(Entity entity) { + if (entity instanceof EntityMinotaur) { + return TextureHelperMF + .getResource("textures/models/monster/minotaur/" + ((EntityMinotaur) entity).getTexture() + ".png"); + } + return TextureHelperMF.getResource("textures/models/monster/minotaur/minotaurBrown.png"); + } + @Override - public void doRender(EntityLiving entity, double x, double y, double z, float f, float f1) - { - super.doRender(entity, x, y, z, f, 1); + public void doRender(EntityLiving entity, double x, double y, double z, float f, float f1) { + super.doRender(entity, x, y, z, f, 1); } - + @Override - protected void renderEquippedItems(EntityLiving p_77029_1_, float p_77029_2_) - { + protected void renderEquippedItems(EntityLiving p_77029_1_, float p_77029_2_) { GL11.glColor3f(1.0F, 1.0F, 1.0F); ItemStack itemstack = p_77029_1_.getHeldItem(); ItemStack itemstack1 = p_77029_1_.func_130225_q(3); Item item; float f1; - if (itemstack1 != null) - { + if (itemstack1 != null) { GL11.glPushMatrix(); this.modelBipedMain.bipedHead.postRender(0.0625F); item = itemstack1.getItem(); - net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack1, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); - boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack1, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); + net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient + .getItemRenderer(itemstack1, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper( + net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack1, + net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); - if (item instanceof ItemBlock) - { - if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType())) - { + if (item instanceof ItemBlock) { + if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType())) { f1 = 0.625F; GL11.glTranslatef(0.0F, -0.25F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); @@ -83,77 +73,69 @@ protected void renderEquippedItems(EntityLiving p_77029_1_, float p_77029_2_) } this.renderManager.itemRenderer.renderItem(p_77029_1_, itemstack1, 0); - } - else if (item == Items.skull) - { + } else if (item == Items.skull) { f1 = 1.0625F; GL11.glScalef(f1, -f1, -f1); GameProfile gameprofile = null; - if (itemstack1.hasTagCompound()) - { + if (itemstack1.hasTagCompound()) { NBTTagCompound nbttagcompound = itemstack1.getTagCompound(); - if (nbttagcompound.hasKey("SkullOwner", 10)) - { + if (nbttagcompound.hasKey("SkullOwner", 10)) { gameprofile = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("SkullOwner")); - } - else if (nbttagcompound.hasKey("SkullOwner", 8) && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkullOwner"))) - { - gameprofile = new GameProfile((UUID)null, nbttagcompound.getString("SkullOwner")); + } else if (nbttagcompound.hasKey("SkullOwner", 8) + && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkullOwner"))) { + gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); } } - TileEntitySkullRenderer.field_147536_b.func_152674_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, itemstack1.getItemDamage(), gameprofile); + TileEntitySkullRenderer.field_147536_b.func_152674_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, + itemstack1.getItemDamage(), gameprofile); } GL11.glPopMatrix(); } - if (itemstack != null && itemstack.getItem() != null) - { + if (itemstack != null && itemstack.getItem() != null) { item = itemstack.getItem(); GL11.glPushMatrix(); - if (this.mainModel.isChild) - { + if (this.mainModel.isChild) { f1 = 0.5F; GL11.glTranslatef(0.0F, 0.625F, 0.0F); GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F); GL11.glScalef(f1, f1, f1); } - GL11.glTranslatef(0.0F, 8F/16F, 0.0F); + GL11.glTranslatef(0.0F, 8F / 16F, 0.0F); this.modelBipedMain.bipedRightArm.postRender(0.0625F); GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); - net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); - boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); + net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient + .getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper( + net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, + net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); - if (item instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) - { + if (item instanceof ItemBlock + && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) { f1 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); f1 *= 0.75F; GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f1, -f1, f1); - } - else if (item == Items.bow) - { + } else if (item == Items.bow) { f1 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f1, -f1, f1); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else if (item.isFull3D()) - { + } else if (item.isFull3D()) { f1 = 0.625F; - if (item.shouldRotateAroundWhenRendering()) - { + if (item.shouldRotateAroundWhenRendering()) { GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -0.125F, 0.0F); } @@ -162,9 +144,7 @@ else if (item.isFull3D()) GL11.glScalef(f1, -f1, f1); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else - { + } else { f1 = 0.375F; GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); GL11.glScalef(f1, f1, f1); @@ -177,24 +157,20 @@ else if (item.isFull3D()) int i; float f5; - if (itemstack.getItem().requiresMultipleRenderPasses()) - { - for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) - { + if (itemstack.getItem().requiresMultipleRenderPasses()) { + for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) { int j = itemstack.getItem().getColorFromItemStack(itemstack, i); - f5 = (float)(j >> 16 & 255) / 255.0F; - f2 = (float)(j >> 8 & 255) / 255.0F; - float f3 = (float)(j & 255) / 255.0F; + f5 = (j >> 16 & 255) / 255.0F; + f2 = (j >> 8 & 255) / 255.0F; + float f3 = (j & 255) / 255.0F; GL11.glColor4f(f5, f2, f3, 1.0F); this.renderManager.itemRenderer.renderItem(p_77029_1_, itemstack, i); } - } - else - { + } else { i = itemstack.getItem().getColorFromItemStack(itemstack, 0); - float f4 = (float)(i >> 16 & 255) / 255.0F; - f5 = (float)(i >> 8 & 255) / 255.0F; - f2 = (float)(i & 255) / 255.0F; + float f4 = (i >> 16 & 255) / 255.0F; + f5 = (i >> 8 & 255) / 255.0F; + f2 = (i & 255) / 255.0F; GL11.glColor4f(f4, f5, f2, 1.0F); this.renderManager.itemRenderer.renderItem(p_77029_1_, itemstack, 0); } diff --git a/src/main/java/minefantasy/mf2/commands/CommandMF.java b/src/main/java/minefantasy/mf2/commands/CommandMF.java new file mode 100644 index 00000000..8f8297b9 --- /dev/null +++ b/src/main/java/minefantasy/mf2/commands/CommandMF.java @@ -0,0 +1,158 @@ +package minefantasy.mf2.commands; + +import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.api.helpers.ToolHelper; +import minefantasy.mf2.api.material.CustomMaterial; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.StatCollector; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class CommandMF implements ICommand { + + private final List materials; + + private final List aliases = new ArrayList() {{ + add("mf"); + add("minefantasy"); + }}; + + public CommandMF() { + materials = setupMaterialsList(); + } + + private List setupMaterialsList() { + List materials = new ArrayList(); + for(CustomMaterial material : CustomMaterial.materialList.values()) { + if(material.type.equalsIgnoreCase("wood") || material.type.equalsIgnoreCase("metal")) { + materials.add(material); + } + } + return materials; + } + + @Override + public String getCommandName() { + return "minefantasy"; + } + + @Override + public String getCommandUsage(ICommandSender iCommandSender) { + return null; + } + + @Override + public List getCommandAliases() { + return this.aliases; + } + + @Override + public void processCommand(ICommandSender iCommandSender, String[] strings) { + if (iCommandSender instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) iCommandSender; + if (strings[0].equalsIgnoreCase("edit")) { + ItemStack equippedItem = player.getCurrentEquippedItem(); + if (equippedItem == null) { + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("command.invalid.item"))); + return; + } + + switch (strings[1]) { + case "material": + processEditMaterialCommand(strings, player, equippedItem); + break; + case "quality": + processQualityCommand(strings, player, equippedItem); + break; + case "unbreakable": + processUnbreakableCommand(strings, player, equippedItem); + break; + } + } + } + } + + private void processEditMaterialCommand(String[] strings, EntityPlayer player, ItemStack equippedItem) { + if (!CustomToolHelper.hasAnyMaterial(equippedItem)) { + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("command.invalid.item"))); + return; + } + + CustomMaterial material = CustomMaterial.getMaterial(strings[2]); + if (material == null) { + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("command.edit.invalid.material"))); + return; + } + + String slot = material.type.equalsIgnoreCase("metal") ? CustomToolHelper.slot_main : CustomToolHelper.slot_haft; + CustomMaterial.addMaterial(equippedItem, slot, material.name); + onSuccess(player); + } + + private void processQualityCommand(String[] strings, EntityPlayer player, ItemStack equippedItem) { + int qualityLvl = Integer.parseInt(strings[2]); + if (0 <= qualityLvl && qualityLvl <= 200) { + equippedItem = ToolHelper.setQuality(equippedItem, qualityLvl); + //this is only approximate trait calculation + if (qualityLvl <= 50) { + equippedItem.stackTagCompound.setBoolean("MF_Inferior", true); + } + if (qualityLvl >= 150) { + equippedItem.stackTagCompound.setBoolean("MF_Inferior", false); + } + onSuccess(player); + } + } + + private void processUnbreakableCommand(String[] strings, EntityPlayer player, ItemStack equippedItem) { + boolean isUnbreakable = Boolean.parseBoolean(strings[2]); + ToolHelper.setUnbreakable(equippedItem, isUnbreakable); + onSuccess(player); + } + + private void onSuccess(EntityPlayer player) { + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("command.edit.success"))); + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender iCommandSender) { + return true; + } + + @Override + public List addTabCompletionOptions(ICommandSender iCommandSender, String[] strings) { + if (strings[0].equalsIgnoreCase("edit")) { + if (strings.length == 2) { + return Arrays.asList("material", "quality", "unbreakable"); + } + + if (strings.length == 3) { + if (strings[2].equalsIgnoreCase("material")) { + return materials; + } + + if (strings[2].equalsIgnoreCase("unbreakable")) { + return Arrays.asList("true", "false"); + } + } + } + + return null; + } + + @Override + public boolean isUsernameIndex(String[] strings, int i) { + return false; + } + + @Override + public int compareTo(Object o) { + return 0; + } +} diff --git a/src/main/java/minefantasy/mf2/config/ConfigArmour.java b/src/main/java/minefantasy/mf2/config/ConfigArmour.java index a512ed6b..f770de38 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigArmour.java +++ b/src/main/java/minefantasy/mf2/config/ConfigArmour.java @@ -4,35 +4,50 @@ import minefantasy.mf2.api.helpers.TacticalManager; import minefantasy.mf2.entity.EntityCogwork; -public class ConfigArmour extends ConfigurationBaseMF -{ - public static final String CATEGORY_BONUS = "Bonuses"; - - public static boolean resistArrow; - - public static final String CATEGORY_PENALTIES = "Penalties"; - - - public static final String CATEGORY_COGWORK = "Cogwork Features"; - public static boolean cogworkGrief; - public static float cogworkFuelUnits; +public class ConfigArmour extends ConfigurationBaseMF { + public static final String CATEGORY_BONUS = "Bonuses"; + public static final String CATEGORY_PENALTIES = "Penalties"; + public static final String CATEGORY_COGWORK = "Cogwork Features"; + public static boolean resistArrow; + public static boolean cogworkGrief; + public static float cogworkFuelUnits; - @Override - protected void loadConfig() - { - resistArrow = Boolean.parseBoolean(config.get(CATEGORY_BONUS, "Deflect Arrows", true, "With this option; arrows have a chance to deflect off armour. It compares the arrow damage and armour rating. Chain and plate have higher rates. Arrows bounced off can hurt enemies").getString()); - TacticalManager.arrowDeflectChance = Float.parseFloat(config.get(CATEGORY_BONUS, "Deflect Arrows Modifier", 1.0F, "This modifies the chance for arrows to deflect off armour: Increasing this increases the deflect chance, decreasing decreases the chance, 0 means it's impossible").getString()); - - TacticalManager.shouldSlow = Boolean.parseBoolean(config.get(CATEGORY_PENALTIES, "Armour Slow Movement", true, "With this: Heavier armours slow your movement down acrosss both walking and sprinting. Speed is affected by design and material").getString()); - TacticalManager.minWeightSpeed = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Min armour weigh speed", 10F, "The minimal speed percent capable from weight (10 = 10%), MF armours don't go lower than 75% anyway").getString()); - ArmourCalculator.slowRate = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Slowdown Rate", 1.0F, "A modifier for the rate armours slow down movement, increasing this slows you more, decreasing it slows less, just keep it above 0").getString()); - - ArmourCalculator.useConfigIndirectDmg = Boolean.parseBoolean(config.get("Misc", "Use config indrect damage", true, "Allows config for indirect projectiles, disable if you get problems when getting hit by modded projectiles").getString()); - - cogworkGrief = Boolean.parseBoolean(config.get(CATEGORY_COGWORK, "Cogwork Grief", true, "Should cogwork armour cause envionmental damage when impact landing").getString()); - cogworkFuelUnits = Float.parseFloat(config.get(CATEGORY_COGWORK, "Cogwork Fuel Modifier", 1F, "Modify the amount of fuel added to cogworks").getString()); - EntityCogwork.health_modifier = Float.parseFloat(config.get(CATEGORY_COGWORK, "Cogwork Durability Modifier", 1.0F, "Modify the relative durability of cogwork armour").getString()); - EntityCogwork.rating_modifier = Float.parseFloat(config.get(CATEGORY_COGWORK, "Cogwork Armour Modifier", 1.0F, "Modify the relative armour rating of cogwork armour").getString()); - EntityCogwork.allowedBulk = Integer.parseInt(config.get(CATEGORY_COGWORK, "Worn Apparel Restrict", 0, "-1: can't wear armour with cogwork, 0=Can enter cogwork with light armour, 1=can enter with medium, 2=can enter in any armour").getString()); - } + @Override + protected void loadConfig() { + resistArrow = Boolean.parseBoolean(config.get(CATEGORY_BONUS, "Deflect Arrows", true, + "With this option; arrows have a chance to deflect off armour. It compares the arrow damage and armour rating. Chain and plate have higher rates. Arrows bounced off can hurt enemies") + .getString()); + TacticalManager.arrowDeflectChance = Float.parseFloat(config.get(CATEGORY_BONUS, "Deflect Arrows Modifier", + 1.0F, + "This modifies the chance for arrows to deflect off armour: Increasing this increases the deflect chance, decreasing decreases the chance, 0 means it's impossible") + .getString()); + + TacticalManager.shouldSlow = Boolean.parseBoolean(config.get(CATEGORY_PENALTIES, "Armour Slow Movement", true, + "With this: Heavier armours slow your movement down acrosss both walking and sprinting. Speed is affected by design and material") + .getString()); + TacticalManager.minWeightSpeed = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Min armour weigh speed", 10F, + "The minimal speed percent capable from weight (10 = 10%), MF armours don't go lower than 75% anyway") + .getString()); + ArmourCalculator.slowRate = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Slowdown Rate", 1.0F, + "A modifier for the rate armours slow down movement, increasing this slows you more, decreasing it slows less, just keep it above 0") + .getString()); + + ArmourCalculator.useConfigIndirectDmg = Boolean.parseBoolean(config.get("Misc", "Use config indrect damage", + true, + "Allows config for indirect projectiles, disable if you get problems when getting hit by modded projectiles") + .getString()); + + cogworkGrief = Boolean.parseBoolean(config.get(CATEGORY_COGWORK, "Cogwork Grief", true, + "Should cogwork armour cause envionmental damage when impact landing").getString()); + cogworkFuelUnits = Float.parseFloat( + config.get(CATEGORY_COGWORK, "Cogwork Fuel Modifier", 1F, "Modify the amount of fuel added to cogworks") + .getString()); + EntityCogwork.health_modifier = Float.parseFloat(config.get(CATEGORY_COGWORK, "Cogwork Durability Modifier", + 1.0F, "Modify the relative durability of cogwork armour").getString()); + EntityCogwork.rating_modifier = Float.parseFloat(config.get(CATEGORY_COGWORK, "Cogwork Armour Modifier", 1.0F, + "Modify the relative armour rating of cogwork armour").getString()); + EntityCogwork.allowedBulk = Integer.parseInt(config.get(CATEGORY_COGWORK, "Worn Apparel Restrict", 0, + "-1: can't wear armour with cogwork, 0=Can enter cogwork with light armour, 1=can enter with medium, 2=can enter in any armour") + .getString()); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigClient.java b/src/main/java/minefantasy/mf2/config/ConfigClient.java index e3f4adcc..f143ed2f 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigClient.java +++ b/src/main/java/minefantasy/mf2/config/ConfigClient.java @@ -2,125 +2,136 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.block.crafting.BlockAnvilMF; -import minefantasy.mf2.block.crafting.BlockBombBench; -import minefantasy.mf2.block.crafting.BlockBombPress; -import minefantasy.mf2.block.crafting.BlockCarpenter; -import minefantasy.mf2.block.crafting.BlockCrossbowBench; -import minefantasy.mf2.block.crafting.BlockFirepit; -import minefantasy.mf2.block.crafting.BlockResearchStation; -import minefantasy.mf2.block.crafting.BlockRoast; -import minefantasy.mf2.block.crafting.BlockTanningRack; +import minefantasy.mf2.block.crafting.*; import minefantasy.mf2.block.decor.BlockAmmoBox; import minefantasy.mf2.block.decor.BlockComponent; import minefantasy.mf2.block.decor.BlockRack; import minefantasy.mf2.block.decor.BlockTrough; -import minefantasy.mf2.block.refining.BlockBellows; -import minefantasy.mf2.block.refining.BlockBigFurnace; -import minefantasy.mf2.block.refining.BlockBloomery; -import minefantasy.mf2.block.refining.BlockChimney; -import minefantasy.mf2.block.refining.BlockForge; -import minefantasy.mf2.block.refining.BlockQuern; +import minefantasy.mf2.block.refining.*; import minefantasy.mf2.mechanics.EventManagerMF; @SideOnly(Side.CLIENT) -public class ConfigClient extends ConfigurationBaseMF -{ - public static final String CATEGORY_GUI = "Gui/Hud Features"; - - - public static final String CATEGORY_AESTHETIC = "Aesthetics"; - - public static boolean playBreath; - public static boolean playHitsound; - public static boolean customModel; - - - public static final String GUI_STAMINA = "Stamina Bar Positioning"; - - public static int stam_xOrient; - public static int stam_yOrient; - public static int stam_xPos; - public static int stam_yPos; - public static int stam_direction; - - - public static final String GUI_ARATING = "Armour Rating Positioning"; - - public static int AR_xOrient; - public static int AR_yOrient; - public static int AR_xPos; - public static int AR_yPos; +public class ConfigClient extends ConfigurationBaseMF { + public static final String CATEGORY_GUI = "Gui/Hud Features"; - - public static final String GUI_ACOUNT = "Arrow Count Positioning"; + public static final String CATEGORY_AESTHETIC = "Aesthetics"; + public static final String GUI_STAMINA = "Stamina Bar Positioning"; + public static final String GUI_ARATING = "Armour Rating Positioning"; + public static final String GUI_ACOUNT = "Arrow Count Positioning"; + public static final String GUI_CAFUEL = "Clockwork Armour Fuel Positioning"; + public static final String CATEGORY_BLOCK = "Block Render Ids"; + public static final String CATEGORY_DEBUG = "Debug Info"; + public static boolean playBreath; + public static boolean playHitsound; + public static boolean customModel; + public static int stam_xOrient; + public static int stam_yOrient; + public static int stam_xPos; + public static int stam_yPos; + public static int stam_direction; + public static int AR_xOrient; + public static int AR_yOrient; + public static int AR_xPos; + public static int AR_yPos; + public static int AC_xOrient; + public static int AC_yOrient; + public static int AC_xPos; + public static int AC_yPos; + public static int CF_xOrient; + public static int CF_yOrient; + public static int CF_xPos; + public static int CF_yPos; - - public static int AC_xOrient; - public static int AC_yOrient; - public static int AC_xPos; - public static int AC_yPos; - - public static final String GUI_CAFUEL = "Clockwork Armour Fuel Positioning"; - - public static int CF_xOrient; - public static int CF_yOrient; - public static int CF_xPos; - public static int CF_yPos; - - - public static final String CATEGORY_BLOCK = "Block Render Ids"; - - public static final String CATEGORY_DEBUG = "Debug Info"; - @Override - protected void loadConfig() - { - playBreath = Boolean.parseBoolean(config.get(CATEGORY_AESTHETIC, "Make Breathe Sound", true, "[With Stamina System] Plays breath sounds when low on energy(sound may be annoying to some...)").getString()); - playHitsound = Boolean.parseBoolean(config.get(CATEGORY_AESTHETIC, "Make Hit Sound", true, "Plays sounds when hitting entities with different items").getString()); - customModel = Boolean.parseBoolean(config.get(CATEGORY_AESTHETIC, "Custom Apparel Model", true, "Determines if some work apparel (like aprons and clothing) use special models").getString()); - - stam_xOrient = Integer.parseInt(config.get(GUI_STAMINA, "X Orient", 1, "The orientation for the X axis (-1 = left, 0 = middle, 1 = right). Determines what point in the axis to snap to").getString()); - stam_yOrient = Integer.parseInt(config.get(GUI_STAMINA, "Y Orient", 1, "The orientation for the Y axis (-1 = top, 0 = middle, 1 = bottom). Determines what point in the axis to snap to").getString()); - stam_xPos = Integer.parseInt(config.get(GUI_STAMINA, "X Position", -82, "The Offset value away from the orient (-)left, (+)right").getString()); - stam_yPos = Integer.parseInt(config.get(GUI_STAMINA, "Y Position", -7, "The Offset value away from the orient (-)up, (+)down").getString()); - stam_direction = Integer.parseInt(config.get(GUI_STAMINA, "Metre Direction", 1, "The direction the metre goes down: -1 = left to right, 0 = middle, 1 = right to left (May have subtle flaws in altered directions 1 and 0)").getString()); - - AR_xOrient = Integer.parseInt(config.get(GUI_ARATING, "X Orient", -1, "The orientation for the X axis (-1 = left, 0 = middle, 1 = right). Determines what point in the axis to snap to").getString()); - AR_yOrient = Integer.parseInt(config.get(GUI_ARATING, "Y Orient", -1, "The orientation for the Y axis (-1 = top, 0 = middle, 1 = bottom). Determines what point in the axis to snap to").getString()); - AR_xPos = Integer.parseInt(config.get(GUI_ARATING, "X Position", 4, "The Offset value away from the orient (-)left, (+)right").getString()); - AR_yPos = Integer.parseInt(config.get(GUI_ARATING, "Y Position", 4, "The Offset value away from the orient (-)up, (+)down").getString()); - - AC_xOrient = Integer.parseInt(config.get(GUI_ACOUNT, "X Orient", -1, "The orientation for the X axis (-1 = left, 0 = middle, 1 = right). Determines what point in the axis to snap to").getString()); - AC_yOrient = Integer.parseInt(config.get(GUI_ACOUNT, "Y Orient", -1, "The orientation for the Y axis (-1 = top, 0 = middle, 1 = bottom). Determines what point in the axis to snap to").getString()); - AC_xPos = Integer.parseInt(config.get(GUI_ACOUNT, "X Position", 4, "The Offset value away from the orient (-)left, (+)right").getString()); - AC_yPos = Integer.parseInt(config.get(GUI_ACOUNT, "Y Position", 4, "The Offset value away from the orient (-)up, (+)down").getString()); - - CF_xOrient = Integer.parseInt(config.get(GUI_CAFUEL, "X Orient", 1, "The orientation for the X axis (-1 = left, 0 = middle, 1 = right). Determines what point in the axis to snap to").getString()); - CF_yOrient = Integer.parseInt(config.get(GUI_CAFUEL, "Y Orient", -1, "The orientation for the Y axis (-1 = top, 0 = middle, 1 = bottom). Determines what point in the axis to snap to").getString()); - CF_xPos = Integer.parseInt(config.get(GUI_CAFUEL, "X Position", -164, "The Offset value away from the orient (-)left, (+)right").getString()); - CF_yPos = Integer.parseInt(config.get(GUI_CAFUEL, "Y Position", -4, "The Offset value away from the orient (-)up, (+)down").getString()); - - BlockAnvilMF.anvil_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Anvil", -100).getString()); - BlockCarpenter.carpenter_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Carpenter", -101).getString()); - BlockBombBench.bomb_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Bomb Bench", -102).getString()); - BlockTanningRack.tanner_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Tanning Rack", -103).getString()); - BlockForge.forge_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Forge", -104).getString()); - BlockBellows.bellows_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Bellows", -105).getString()); - BlockResearchStation.research_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "ResearchTable", -106).getString()); - BlockBombPress.bpress_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Bomb Press", -107).getString()); - BlockTrough.trough_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Trough", -108).getString()); - BlockBloomery.bloomery_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Bloomery", -109).getString()); - BlockCrossbowBench.crossBench_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Crossbow Bench", -110).getString()); - BlockQuern.quern_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Quern", -111).getString()); - BlockFirepit.firepit_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Firepit", -112).getString()); - BlockRoast.roast_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Roast", -113).getString()); - BlockBigFurnace.furn_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Big Furnace", -114).getString()); - BlockRack.rack_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Rack", -115).getString()); - BlockAmmoBox.ammo_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Ammo Box", -116).getString()); - BlockChimney.pipe_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Smoke Pipe", -117).getString()); - BlockComponent.component_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Component Storage", -118).getString()); - - EventManagerMF.displayOreDict = Boolean.parseBoolean(config.get(CATEGORY_DEBUG, "Show Debug OreDict", false, "Displays a list of Ore Dictionary entries to tooltips").getString()); - } + @Override + protected void loadConfig() { + playBreath = Boolean.parseBoolean(config.get(CATEGORY_AESTHETIC, "Make Breathe Sound", true, + "[With Stamina System] Plays breath sounds when low on energy(sound may be annoying to some...)") + .getString()); + playHitsound = Boolean.parseBoolean(config.get(CATEGORY_AESTHETIC, "Make Hit Sound", true, + "Plays sounds when hitting entities with different items").getString()); + customModel = Boolean + .parseBoolean(config + .get(CATEGORY_AESTHETIC, "Custom Apparel Model", true, + "Determines if some work apparel (like aprons and clothing) use special models") + .getString()); + + stam_xOrient = Integer.parseInt(config.get(GUI_STAMINA, "X Orient", 1, + "The orientation for the X axis (-1 = left, 0 = middle, 1 = right). Determines what point in the axis to snap to") + .getString()); + stam_yOrient = Integer.parseInt(config.get(GUI_STAMINA, "Y Orient", 1, + "The orientation for the Y axis (-1 = top, 0 = middle, 1 = bottom). Determines what point in the axis to snap to") + .getString()); + stam_xPos = Integer.parseInt( + config.get(GUI_STAMINA, "X Position", -82, "The Offset value away from the orient (-)left, (+)right") + .getString()); + stam_yPos = Integer.parseInt( + config.get(GUI_STAMINA, "Y Position", -7, "The Offset value away from the orient (-)up, (+)down") + .getString()); + stam_direction = Integer.parseInt(config.get(GUI_STAMINA, "Metre Direction", 1, + "The direction the metre goes down: -1 = left to right, 0 = middle, 1 = right to left (May have subtle flaws in altered directions 1 and 0)") + .getString()); + + AR_xOrient = Integer.parseInt(config.get(GUI_ARATING, "X Orient", -1, + "The orientation for the X axis (-1 = left, 0 = middle, 1 = right). Determines what point in the axis to snap to") + .getString()); + AR_yOrient = Integer.parseInt(config.get(GUI_ARATING, "Y Orient", -1, + "The orientation for the Y axis (-1 = top, 0 = middle, 1 = bottom). Determines what point in the axis to snap to") + .getString()); + AR_xPos = Integer.parseInt( + config.get(GUI_ARATING, "X Position", 4, "The Offset value away from the orient (-)left, (+)right") + .getString()); + AR_yPos = Integer.parseInt(config + .get(GUI_ARATING, "Y Position", 4, "The Offset value away from the orient (-)up, (+)down").getString()); + + AC_xOrient = Integer.parseInt(config.get(GUI_ACOUNT, "X Orient", -1, + "The orientation for the X axis (-1 = left, 0 = middle, 1 = right). Determines what point in the axis to snap to") + .getString()); + AC_yOrient = Integer.parseInt(config.get(GUI_ACOUNT, "Y Orient", -1, + "The orientation for the Y axis (-1 = top, 0 = middle, 1 = bottom). Determines what point in the axis to snap to") + .getString()); + AC_xPos = Integer.parseInt( + config.get(GUI_ACOUNT, "X Position", 4, "The Offset value away from the orient (-)left, (+)right") + .getString()); + AC_yPos = Integer.parseInt(config + .get(GUI_ACOUNT, "Y Position", 4, "The Offset value away from the orient (-)up, (+)down").getString()); + + CF_xOrient = Integer.parseInt(config.get(GUI_CAFUEL, "X Orient", 1, + "The orientation for the X axis (-1 = left, 0 = middle, 1 = right). Determines what point in the axis to snap to") + .getString()); + CF_yOrient = Integer.parseInt(config.get(GUI_CAFUEL, "Y Orient", -1, + "The orientation for the Y axis (-1 = top, 0 = middle, 1 = bottom). Determines what point in the axis to snap to") + .getString()); + CF_xPos = Integer.parseInt( + config.get(GUI_CAFUEL, "X Position", -164, "The Offset value away from the orient (-)left, (+)right") + .getString()); + CF_yPos = Integer.parseInt(config + .get(GUI_CAFUEL, "Y Position", -4, "The Offset value away from the orient (-)up, (+)down").getString()); + + BlockAnvilMF.anvil_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Anvil", -100).getString()); + BlockCarpenter.carpenter_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Carpenter", -101).getString()); + BlockBombBench.bomb_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Bomb Bench", -102).getString()); + BlockTanningRack.tanner_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Tanning Rack", -103).getString()); + BlockForge.forge_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Forge", -104).getString()); + BlockBellows.bellows_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Bellows", -105).getString()); + BlockResearchStation.research_RI = Integer + .parseInt(config.get(CATEGORY_BLOCK, "ResearchTable", -106).getString()); + BlockBombPress.bpress_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Bomb Press", -107).getString()); + BlockTrough.trough_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Trough", -108).getString()); + BlockBloomery.bloomery_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Bloomery", -109).getString()); + BlockCrossbowBench.crossBench_RI = Integer + .parseInt(config.get(CATEGORY_BLOCK, "Crossbow Bench", -110).getString()); + BlockQuern.quern_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Quern", -111).getString()); + BlockFirepit.firepit_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Firepit", -112).getString()); + BlockRoast.roast_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Roast", -113).getString()); + BlockBigFurnace.furn_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Big Furnace", -114).getString()); + BlockRack.rack_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Rack", -115).getString()); + BlockAmmoBox.ammo_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Ammo Box", -116).getString()); + BlockChimney.pipe_RI = Integer.parseInt(config.get(CATEGORY_BLOCK, "Smoke Pipe", -117).getString()); + BlockComponent.component_RI = Integer + .parseInt(config.get(CATEGORY_BLOCK, "Component Storage", -118).getString()); + + EventManagerMF.displayOreDict = Boolean.parseBoolean(config.get(CATEGORY_DEBUG, "Show Debug OreDict", false, + "Displays a list of Ore Dictionary entries to tooltips").getString()); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigCrafting.java b/src/main/java/minefantasy/mf2/config/ConfigCrafting.java index cec48002..b86c0f65 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigCrafting.java +++ b/src/main/java/minefantasy/mf2/config/ConfigCrafting.java @@ -2,21 +2,22 @@ import minefantasy.mf2.api.cooking.CookRecipe; import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFH; -import minefantasy.mf2.mechanics.CombatMechanics; -import minefantasy.mf2.recipe.ForgedToolRecipes; -public class ConfigCrafting extends ConfigurationBaseMF -{ - public static final String CATEGORY_REFINING = "Refining"; - public static boolean allowIronResmelt; - public static final String CATEGORY_COOKING = "Cooking"; - - @Override - protected void loadConfig() - { - allowIronResmelt = Boolean.parseBoolean(config.get(CATEGORY_REFINING, "Allow Iron ingots to make Pig Iron", false, "If you're not resoureful: you can allow iron ingots to make prepared iron for refining.").getString()); - TileEntityBlastFH.maxFurnaceHeight = Integer.parseInt(config.get(CATEGORY_REFINING, "Max Blast Furnace Height", 16, "The max amount of chambers a blast furnace can read").getString()); - CookRecipe.canCookBasics = Boolean.parseBoolean(config.get(CATEGORY_COOKING, "Cook non-mf food on cooktop", true, "This means non-mf food cooked in a furnace can work on a cooking plate").getString()); - } +public class ConfigCrafting extends ConfigurationBaseMF { + public static final String CATEGORY_REFINING = "Refining"; + public static final String CATEGORY_COOKING = "Cooking"; + public static boolean allowIronResmelt; + + @Override + protected void loadConfig() { + allowIronResmelt = Boolean.parseBoolean(config + .get(CATEGORY_REFINING, "Allow Iron ingots to make Pig Iron", false, + "If you're not resoureful: you can allow iron ingots to make prepared iron for refining.") + .getString()); + TileEntityBlastFH.maxFurnaceHeight = Integer.parseInt(config.get(CATEGORY_REFINING, "Max Blast Furnace Height", + 16, "The max amount of chambers a blast furnace can read").getString()); + CookRecipe.canCookBasics = Boolean.parseBoolean(config.get(CATEGORY_COOKING, "Cook non-mf food on cooktop", + true, "This means non-mf food cooked in a furnace can work on a cooking plate").getString()); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigExperiment.java b/src/main/java/minefantasy/mf2/config/ConfigExperiment.java index 8e16aec4..30968516 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigExperiment.java +++ b/src/main/java/minefantasy/mf2/config/ConfigExperiment.java @@ -1,42 +1,40 @@ package minefantasy.mf2.config; import minefantasy.mf2.api.helpers.ArmourCalculator; -import minefantasy.mf2.api.rpg.RPGElements; -public class ConfigExperiment extends ConfigurationBaseMF -{ - public static final String CATEGORY_EARLY = "Unfinished Features"; - public static final String CATEGORY_ARCHERY = "Archery Features"; - - public static boolean stickArrows; - public static boolean dynamicArrows; +public class ConfigExperiment extends ConfigurationBaseMF { + public static final String CATEGORY_EARLY = "Unfinished Features"; + public static final String CATEGORY_ARCHERY = "Archery Features"; + public static final String CATEGORY_ARMOUR = "Armour Features"; + public static final String CATEGORY_FOOD = "Experimental: Hunger Modification"; + public static boolean stickArrows; + public static boolean dynamicArrows; + public static String debug = ""; - - public static final String CATEGORY_ARMOUR = "Armour Features"; - + @Override + protected void loadConfig() { + // RPGElements.isSystemActive = Boolean.parseBoolean(config.get(CATEGORY_EARLY, + // "Enable Skills", false, "This will be a later feature where skills determine + // a number of actions ingame, also will be used to unlock perks").getString()); + stickArrows = Boolean.parseBoolean(config + .get(CATEGORY_ARCHERY, "Save Arrows", true, + "With this active; arrows fired into enemies save, so they can be dropped on death") + .getString()); + dynamicArrows = Boolean.parseBoolean(config.get(CATEGORY_ARCHERY, "Dynamic arrow sync", true, + "This is for whatever hosts the world (singleplayer, or servers); it increases the rate arrows sync their data for smoother rendering for players. This however increases packet traffic. If you have a lot of players on a server or a lot of arrows, disable this to help clean it up") + .getString()); - public static final String CATEGORY_FOOD = "Experimental: Hunger Modification"; - - public static String debug = ""; - - @Override - protected void loadConfig() - { - //RPGElements.isSystemActive = Boolean.parseBoolean(config.get(CATEGORY_EARLY, "Enable Skills", false, "This will be a later feature where skills determine a number of actions ingame, also will be used to unlock perks").getString()); - stickArrows = Boolean.parseBoolean(config.get(CATEGORY_ARCHERY, "Save Arrows", true, "With this active; arrows fired into enemies save, so they can be dropped on death").getString()); - dynamicArrows = Boolean.parseBoolean(config.get(CATEGORY_ARCHERY, "Dynamic arrow sync", true, "This is for whatever hosts the world (singleplayer, or servers); it increases the rate arrows sync their data for smoother rendering for players. This however increases packet traffic. If you have a lot of players on a server or a lot of arrows, disable this to help clean it up").getString()); - - String AADesc = - "This feature Sets supported armours to calculate weapons differently: \n" + - "Damage is divided into cutting and blunt, and MF armours will alter their ratings depending \n" + - "Both weapons and ranged entities can be registered to deliver a certain ratio \n" + - "Armours can't be registered, all coding needs to be hardwired into the code themselves \n" + - "So this means mod armours can not support this, they need to have a system built-in to their own coding" + - "But this ratio only effects armours that are told to. so it should have no effect on unsupported armours, being balanced as usual \n" + - "Undefined weapon damages however have no effect either, but it will try and guess \n" + - "This will also change change axes and blunt weapons to match blade damage (since armour is vulnerable to blunt"; - ArmourCalculator.advancedDamageTypes = Boolean.parseBoolean(config.get(CATEGORY_ARMOUR, "Advanced Armour Calculator", true, AADesc).getString()); - debug = config.get("###Enable Debug Mode###", "Debug Passcode", "").getString(); - } + String AADesc = "This feature Sets supported armours to calculate weapons differently: \n" + + "Damage is divided into cutting and blunt, and MF armours will alter their ratings depending \n" + + "Both weapons and ranged entities can be registered to deliver a certain ratio \n" + + "Armours can't be registered, all coding needs to be hardwired into the code themselves \n" + + "So this means mod armours can not support this, they need to have a system built-in to their own coding" + + "But this ratio only effects armours that are told to. so it should have no effect on unsupported armours, being balanced as usual \n" + + "Undefined weapon damages however have no effect either, but it will try and guess \n" + + "This will also change change axes and blunt weapons to match blade damage (since armour is vulnerable to blunt"; + ArmourCalculator.advancedDamageTypes = Boolean + .parseBoolean(config.get(CATEGORY_ARMOUR, "Advanced Armour Calculator", true, AADesc).getString()); + debug = config.get("###Enable Debug Mode###", "Debug Passcode", "").getString(); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigFarming.java b/src/main/java/minefantasy/mf2/config/ConfigFarming.java index 91bc6e82..4110f297 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigFarming.java +++ b/src/main/java/minefantasy/mf2/config/ConfigFarming.java @@ -2,22 +2,25 @@ import minefantasy.mf2.farming.FarmingHelper; -public class ConfigFarming extends ConfigurationBaseMF -{ - public static final String CATEGORY_BONUS = "Bonuses"; - - public static final String CATEGORY_PENALTIES = "Penalties"; - - - public static final String CATEGORY_MISC = "Other Features"; +public class ConfigFarming extends ConfigurationBaseMF { + public static final String CATEGORY_BONUS = "Bonuses"; - @Override - protected void loadConfig() - { - FarmingHelper.isEnabled = Boolean.parseBoolean(config.get("##Enable System##", "isEnabled", true, "This toggles the farming mechanics").getString()); - - FarmingHelper.hoeFailChanceCfg = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Hoe Fail Modifier", 1.0F, "Modifies the rate for hoes to fail making fields").getString()); - FarmingHelper.farmBreakCfg = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Harvest Ruin Modifier", 1.0F, "Modifies the rate for ruining fields when harvesting (scythes increase this chance)").getString()); - } + public static final String CATEGORY_PENALTIES = "Penalties"; + + public static final String CATEGORY_MISC = "Other Features"; + + @Override + protected void loadConfig() { + FarmingHelper.isEnabled = Boolean.parseBoolean( + config.get("##Enable System##", "isEnabled", true, "This toggles the farming mechanics").getString()); + + FarmingHelper.hoeFailChanceCfg = Float.parseFloat(config + .get(CATEGORY_PENALTIES, "Hoe Fail Modifier", 1.0F, "Modifies the rate for hoes to fail making fields") + .getString()); + FarmingHelper.farmBreakCfg = Float.parseFloat(config + .get(CATEGORY_PENALTIES, "Harvest Ruin Modifier", 1.0F, + "Modifies the rate for ruining fields when harvesting (scythes increase this chance)") + .getString()); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigHardcore.java b/src/main/java/minefantasy/mf2/config/ConfigHardcore.java index 44037c50..96303375 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigHardcore.java +++ b/src/main/java/minefantasy/mf2/config/ConfigHardcore.java @@ -7,58 +7,95 @@ import minefantasy.mf2.hunger.HungerSystemMF; import minefantasy.mf2.mechanics.CombatMechanics; -public class ConfigHardcore extends ConfigurationBaseMF -{ - public static final String CATEGORY_CRAFTING = "1: HARDCORE CRAFTING"; - public static boolean HCCreduceIngots = true; - public static boolean HCChotBurn = true; - public static boolean HCCWeakItems = true; - public static boolean HCCallowRocks = true; - public static boolean HCCRemoveCraft = true; - - public static final String CATEGORY_RESEARCH = "2: Research"; - - public static final String CATEGORY_FOOD = "3: Food and Hunting"; - - public static boolean hunterKnife; - public static boolean lessHunt; - public static boolean preventCook; - - - public static final String CATEGORY_MOB = "4: Monster Upgrades"; - - public static boolean upgradeZombieWep; - public static float zombieWepChance; - public static boolean fastZombies; - - public static final String CATEGORY_USER = "5: Player Debuffs"; - public static boolean critLimp; - - @Override - protected void loadConfig() - { - HCCreduceIngots = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Hardcore Ingots", true, "Some Metals (Like iron, steel and direct ore smelts) Must be worked manually on an anvil rather than smelted. They may also cost more! Big furnace still works.").getString()); - HCChotBurn = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Hot burns", true, "You cannot hold hot items (apron or not), tongs must be used.").getString()); - Heatable.HCCquenchRuin = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Hardcore Quench", true, "Hot items can be damaged if a trough is not used.").getString()); - HCCWeakItems = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Weaken Basic items", true, "This will significantly reduce the durability of basic items (made on basic crafting table), they can still be crafted but are practically useless.").getString()); - HCCallowRocks = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Allow Stone-Age", true, "Allows punching stone for sharp rocks, and using them on leaves for sticks/vines: These make primitive stone tools").getString()); - HCCRemoveCraft = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Remove Recipes", true, "Some recipes (Such as Bread, or Flint and Steel) will be removed, since MF has its own recipe for such items.").getString()); - - ResearchLogic.knowledgelyr = Integer.parseInt(config.get(CATEGORY_RESEARCH, "###CHANGE RESEARCH ID###", 0, "This changes the research ID, removing all entries").getString()); - InformationBase.unlockAll = Boolean.parseBoolean(config.get(CATEGORY_RESEARCH, "Unlock entries", false, "If you don't want to research, this will unlock all entries.").getString()); - InformationBase.easyResearch = Boolean.parseBoolean(config.get(CATEGORY_RESEARCH, "Baby-Mode Research", false, "This removes the process of examining artefacts, research is unlocked by clicking entries in the book.").getString()); - - hunterKnife = Boolean.parseBoolean(config.get(CATEGORY_FOOD, "Restrict to hunting weapon", false, "This option means animals ONLY drop meat and hide when killed with a hunting weapon such as a knife, only the killing blow counts").getString()); - lessHunt = Boolean.parseBoolean(config.get(CATEGORY_FOOD, "Reduce Meat Drops", false, "This will alter the stack size of animal meat drops, meaning they only drop 1 every time").getString()); - preventCook = Boolean.parseBoolean(config.get(CATEGORY_FOOD, "Prevent furnace food", false, "Stop food from being cooked in a furnace").getString()); - HungerSystemMF.slowdownRate = Integer.parseInt(config.get(CATEGORY_FOOD, "Hunger slow rate", 3, "how many added points per haunch is slows by. Default is 3: meaning it's takes 3 additional haunches to remove 1, meaning each haunch takes 4 times to be removed").getString()); - TileEntityRoast.enableOverheat = Boolean.parseBoolean(config.get(CATEGORY_FOOD, "Burn at high temperature", true, "Cooking food on a stove or oven will automatically burn at high temperatures").getString()); - - upgradeZombieWep = Boolean.parseBoolean(config.get(CATEGORY_MOB, "Give Zombie Weapon", true, "Zombies have a chance on spawning with forged iron weapons, It also controls some zombies having MF armour").getString()); - zombieWepChance = Float.parseFloat(config.get(CATEGORY_MOB, "Zombie Weapon Spawn Chance Modifier", 1.0F, "Chance for Zombies to have forged weapons, increased with difficulty").getString()); - fastZombies = Boolean.parseBoolean(config.get(CATEGORY_MOB, "Speed up zombies", true, "Speed up zombies (Sure it's not as real.. but it makes them a bit more dangerous)").getString()); - critLimp = Boolean.parseBoolean(config.get(CATEGORY_MOB, "Critical Injury Limp", true, "This means when you're badly wounded, you slow down and limp").getString()); - CombatMechanics.swordSkeleton = Boolean.parseBoolean(config.get(CATEGORY_MOB, "Skeleton Swords", true, "Some Skeletons use swords").getString()); - } +public class ConfigHardcore extends ConfigurationBaseMF { + public static final String CATEGORY_CRAFTING = "1: HARDCORE CRAFTING"; + public static final String CATEGORY_RESEARCH = "2: Research"; + public static final String CATEGORY_FOOD = "3: Food and Hunting"; + public static final String CATEGORY_MOB = "4: Monster Upgrades"; + public static final String CATEGORY_USER = "5: Player Debuffs"; + public static boolean HCCreduceIngots = true; + public static boolean HCChotBurn = true; + public static boolean HCCWeakItems = true; + public static boolean HCCallowRocks = true; + public static boolean HCCRemoveCraft = true; + public static boolean HCCRemoveBooksCraft = false; + public static boolean HCCRemoveTalismansCraft = false; + public static boolean hunterKnife; + public static boolean lessHunt; + public static boolean preventCook; + public static boolean upgradeZombieWep; + public static float zombieWepChance; + public static boolean fastZombies; + public static boolean critLimp; + @Override + protected void loadConfig() { + HCCreduceIngots = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Hardcore Ingots", true, + "Some Metals (Like iron, steel and direct ore smelts) Must be worked manually on an anvil rather than smelted. They may also cost more! Big furnace still works.") + .getString()); + HCChotBurn = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Hot burns", true, + "You cannot hold hot items (apron or not), tongs must be used.").getString()); + Heatable.HCCquenchRuin = Boolean.parseBoolean(config + .get(CATEGORY_CRAFTING, "Hardcore Quench", true, "Hot items can be damaged if a trough is not used.") + .getString()); + HCCWeakItems = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Weaken Basic items", true, + "This will significantly reduce the durability of basic items (made on basic crafting table), they can still be crafted but are practically useless.") + .getString()); + HCCallowRocks = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Allow Stone-Age", true, + "Allows punching stone for sharp rocks, and using them on leaves for sticks/vines: These make primitive stone tools") + .getString()); + HCCRemoveCraft = Boolean.parseBoolean(config.get(CATEGORY_CRAFTING, "Remove Recipes", true, + "Some recipes (Such as Bread, or Flint and Steel) will be removed, since MF has its own recipe for such items.") + .getString()); + HCCRemoveBooksCraft = Boolean + .parseBoolean(config + .get(CATEGORY_CRAFTING, "Remove Books Recipes", false, + "Skill books recipes will be disabled, but you still can find them it the world.") + .getString()); + HCCRemoveTalismansCraft = Boolean.parseBoolean(config + .get(CATEGORY_CRAFTING, "Remove Talismans Recipes", false, + "Research talismans recipes will be disabled, but you still can find them it the world.") + .getString()); + + ResearchLogic.knowledgelyr = Integer.parseInt(config.get(CATEGORY_RESEARCH, "###CHANGE RESEARCH ID###", 0, + "This changes the research ID, removing all entries").getString()); + InformationBase.unlockAll = Boolean.parseBoolean(config.get(CATEGORY_RESEARCH, "Unlock entries", false, + "If you don't want to research, this will unlock all entries.").getString()); + InformationBase.easyResearch = Boolean.parseBoolean(config.get(CATEGORY_RESEARCH, "Baby-Mode Research", false, + "This removes the process of examining artefacts, research is unlocked by clicking entries in the book.") + .getString()); + + hunterKnife = Boolean.parseBoolean(config.get(CATEGORY_FOOD, "Restrict to hunting weapon", false, + "This option means animals ONLY drop meat and hide when killed with a hunting weapon such as a knife, only the killing blow counts") + .getString()); + lessHunt = Boolean.parseBoolean(config + .get(CATEGORY_FOOD, "Reduce Meat Drops", false, + "This will alter the stack size of animal meat drops, meaning they only drop 1 every time") + .getString()); + preventCook = Boolean.parseBoolean( + config.get(CATEGORY_FOOD, "Prevent furnace food", false, "Stop food and ceramic from being cooked in a furnace") + .getString()); + HungerSystemMF.slowdownRate = Integer.parseInt(config.get(CATEGORY_FOOD, "Hunger slow rate", 3, + "how many added points per haunch is slows by. Default is 3: meaning it's takes 3 additional haunches to remove 1, meaning each haunch takes 4 times to be removed") + .getString()); + TileEntityRoast.enableOverheat = Boolean + .parseBoolean(config + .get(CATEGORY_FOOD, "Burn at high temperature", true, + "Cooking food on a stove or oven will automatically burn at high temperatures") + .getString()); + + upgradeZombieWep = Boolean.parseBoolean(config.get(CATEGORY_MOB, "Give Zombie Weapon", true, + "Zombies have a chance on spawning with forged iron weapons, It also controls some zombies having MF armour") + .getString()); + zombieWepChance = Float.parseFloat(config.get(CATEGORY_MOB, "Zombie Weapon Spawn Chance Modifier", 1.0F, + "Chance for Zombies to have forged weapons, increased with difficulty").getString()); + fastZombies = Boolean.parseBoolean(config + .get(CATEGORY_MOB, "Speed up zombies", true, + "Speed up zombies (Sure it's not as real.. but it makes them a bit more dangerous)") + .getString()); + critLimp = Boolean.parseBoolean(config.get(CATEGORY_MOB, "Critical Injury Limp", true, + "This means when you're badly wounded, you slow down and limp").getString()); + CombatMechanics.swordSkeleton = Boolean.parseBoolean( + config.get(CATEGORY_MOB, "Skeleton Swords", true, "Some Skeletons use swords").getString()); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigIntegration.java b/src/main/java/minefantasy/mf2/config/ConfigIntegration.java new file mode 100644 index 00000000..27ea7feb --- /dev/null +++ b/src/main/java/minefantasy/mf2/config/ConfigIntegration.java @@ -0,0 +1,31 @@ +package minefantasy.mf2.config; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; + +import java.util.Arrays; + +public class ConfigIntegration extends ConfigurationBaseMF { + + public static final String CATEGORY_MODS = "Cross-mod Integration"; + public static final String CATEGORY_BUKKIT = "Bukkit Integration"; + public static boolean neiIntegration; + public static boolean mtIntegration; + public static String[] pluginsList = new String[0]; + + @Override + protected void loadConfig() { + neiIntegration = Boolean.parseBoolean( + config.get(CATEGORY_MODS, "NEI Integration", true, "Enable Not Enough Items integration").getString()); + mtIntegration = Boolean.parseBoolean( + config.get(CATEGORY_MODS, "MT Integration", true, "Enable MineTweaker (CraftTweaker) integration") + .getString()); + + if (FMLCommonHandler.instance().getSide() == Side.SERVER) { + pluginsList = config.get(CATEGORY_BUKKIT, "Plugins List", new String[]{"WorldGuard"}, + "This registers listeners of Bukkit plugins (if avaliable). Here you are should list all protection-related plugins (e.g WorldGuard). You are can find correct plugin name in its plugin.yml (inside plugin's .jar file)") + .getStringList(); + Arrays.sort(pluginsList); + } + } +} diff --git a/src/main/java/minefantasy/mf2/config/ConfigItemRegistry.java b/src/main/java/minefantasy/mf2/config/ConfigItemRegistry.java index acc95f68..9d144067 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigItemRegistry.java +++ b/src/main/java/minefantasy/mf2/config/ConfigItemRegistry.java @@ -1,7 +1,5 @@ package minefantasy.mf2.config; -import java.util.Arrays; - import minefantasy.mf2.api.armour.ArmourDesign; import minefantasy.mf2.api.armour.CustomArmourEntry; import minefantasy.mf2.api.armour.CustomDamageRatioEntry; @@ -10,429 +8,333 @@ import minefantasy.mf2.util.MFLogUtil; import net.minecraft.item.Item; -public class ConfigItemRegistry extends ConfigurationBaseMF -{ - public static final String CATEGORY_ARMOUR = "Armour List"; - - public static String[] armourListAC = new String[0]; - - - public static final String CATEGORY_FARM = "Farming"; - - public static String[] hoeList = new String[0]; - - public static final String CATEGORY_TOOL = "Tools"; - - public static String[] crafterList = new String[0]; - - public static final String CATEGORY_WEPS = "Weapon Register"; - - public static String[] customDamagerList = new String[0]; - public static String[] customDamagerEntityList = new String[0]; - - @Override - protected void loadConfig() - { - //Weight - - String AAdesc = - "This will register items under a certain 'Design' calculating the variables itself.\n Each entry has it's own line:\n" + - "Order itemid|Design|WeightGroup|WeightModifier \n" + - "The WeightModifier alters the weight for heavier or lighter materials keep it at 1.0 unless you have a special material (like mithril and adamamantium)\n" + - "Designs can be any that are registered: MineFantasy designs are 'clothing', 'leather', 'mail', 'default'(that's just basic metal armour), and 'plate'\n" + - "WeightGroup refers to whether it is light medium or heavy armour \n" + - "EXAMPLE (This is what vanilla gold is registered under) \n" + - "minecraft:golden_helmet|default|medium|2.0 \n"+ - "minecraft:golden_chestplate|default|medium|2.0 \n"+ - "minecraft:golden_leggings|default|medium|2.0 \n"+ - "minecraft:golden_boots|default|medium|2.0 \n"+ - "The 2.0 means it is 2x heavier than other vanilla armours \n"+ - "This does not override existing MF armours \n"; - - armourListAC = config.get(CATEGORY_ARMOUR, "Auto-Armour Registry", new String[0], AAdesc).getStringList(); - Arrays.sort(armourListAC); - - //Hoes - - String hoeDesc = - "This Registers Hoe items to an efficiency level: (It uses the same variable as efficiency, you may need to find that out first, by default: it should be able to guess it:\n" + - "Order itemid|efficicncy \n" + - "Efficicney is a variable that goes into play with the failure chance, higher efficicnecy has easier tiling\n"; - - hoeList = config.get(CATEGORY_FARM, "Hoe Registry", new String[0], hoeDesc).getStringList(); - Arrays.sort(hoeList); - - //Crafters - - String craftDesc = - "This Registers items to a tool type and efficiency (such as hammer, hvyHammer, knife, saw, etc):\n" + - "Order itemid|efficiency|tier|tooltype \n" + - "tooltype can be hammer, hvyHammer, knife, shears, needle, spoon, mallet, saw, spanner \n" + - "efficiency is the measure of how fast it works (similar to dig speed)"; - - crafterList = config.get(CATEGORY_TOOL, "Crafter Registry", new String[0], craftDesc).getStringList(); - Arrays.sort(crafterList); - - //Weapons - - String damageDesc = - "[Experimental] This registers weapons for the damage variable mechanics implemented by option. \n" + - "Though mod-added armours have absolutely no support, and never can without being specifically coded to \n" + - "MineFantasy armours will take these variables and function differently on the values. But weapon items can \n" + - "be added to the list: Put each entry on it's own line set out like this: \n" + - "id|cutting|pierce|blunt \n" + - "id is the item id as a string (you need to find it out yourself), cutting and blunt are the ratio. \n" + - "EXAMPLE (for example... making a stick to piercing damage) \n" + - "minecraft:stick|0|1.0|0 \n"+ - "The difference between the ratio is what determines damage 1|0 means 100% cutting damage, 3|1 means it's 3 cutting to 1 blunt (or 75%, 25%). use whatever numbers you need to make the ratio."; - - customDamagerList = config.get(CATEGORY_WEPS, "Custom Damage Ratios", new String[0], damageDesc).getStringList(); - Arrays.sort(customDamagerList); - - String damageEDesc = - "Similar method to 'Custom Damage Ratios' only with entities, This is for registering things like arrows, same format only with the entity registry name (usually modid:name)"; - - customDamagerEntityList = config.get(CATEGORY_WEPS, "Custom Entity Damage Ratios", new String[0], damageEDesc).getStringList(); - Arrays.sort(customDamagerEntityList); - } - - public static void readCustoms() - { - MFLogUtil.logDebug("Loading Custom Item Entries from config..."); - try - { - for(String s: armourListAC) - { - breakdownLineForAutoarmour(s); - } - for(String s: hoeList) - { - breakdownLineForHoe(s); - } - for(String s: crafterList) - { - breakdownLineForCrafter(s); - } - for(String s: customDamagerList) - { - breakdownLineForDamage(s); - } - for(String s: customDamagerEntityList) - { - breakdownLineForDamage(s); - } - } - catch(Exception e) - { - MFLogUtil.logWarn("Failed to load Custom Item Entries from config. Check the config file"); - } - } - - private static void registerArmourclassEntry(Item piece, String design, float weight) - { - ArmourDesign AC = getClassFor(design); - if(AC == null) - { - MFLogUtil.logWarn("Could not define armour design '" + design + "' for item id: " + Item.getIdFromItem(piece)); - return; - } - CustomArmourEntry.registerItem(piece, AC, weight, AC.getGroup()); - } - - private static ArmourDesign getClassFor(String name) - { - ArmourDesign design = ArmourDesign.designs.get(name); - if(design != null) - { - return design; - } - return null; - } - - private static void breakdownLineForAutoarmour(String config) - { - String temp = ""; - int phase = 0; - String id = ""; - ArmourDesign AD = null; - String weightGroup = "medium"; - float weight = 1.0F; - for(int a = 0; a < config.length(); a ++) - { - if(a == config.length()-1) - { - temp = temp + config.charAt(a); - } - if(config.charAt(a) == "|".charAt(0) || a == config.length()-1) - { - if(phase == 0) - { - id = temp; - temp = ""; - phase ++; - } - else if(phase == 1) - { - ArmourDesign design = getClassFor(temp); - if(design != null) - { - AD = design; - } - temp = ""; - phase ++; - } - else if(phase == 2) - { - weightGroup = temp; - temp = ""; - phase ++; - } - else if(phase == 3) - { - weight = Float.valueOf(temp); - temp = ""; - - Item piece = getItemFromString(id); - if(AD != null && piece != null) - { - CustomArmourEntry.registerItem(piece, AD, weight, weightGroup); - MFLogUtil.logDebug("Added Armour: " + piece.getUnlocalizedName() + "(" + AD.getName() + ") To " + weightGroup + " armour category... Modified weight is " + weight); - } - phase = 0; - } - } - else - { - if(config.charAt(a) != " ".charAt(0)) - { - temp = temp + config.charAt(a); - } - } - } - } - - - private static void breakdownLineForHoe(String config) - { - String temp = ""; - int phase = 0; - String id = ""; - float eff = 6.0F; - - for(int a = 0; a < config.length(); a ++) - { - if(a == config.length()-1) - { - temp = temp + config.charAt(a); - } - if(config.charAt(a) == "|".charAt(0) || a == config.length()-1) - { - if(phase == 0) - { - id = temp; - temp = ""; - phase ++; - } - else if(phase == 1) - { - eff = Float.valueOf(temp); - temp = ""; - - Item hoe = getItemFromString(id); - if(hoe != null) - { - CustomHoeEntry.registerItem(hoe, eff); - MFLogUtil.logDebug("Added Hoe: " + id + " With Efficiency " + eff); - } - phase = 0; - } - } - else - { - if(config.charAt(a) != " ".charAt(0)) - { - temp = temp + config.charAt(a); - } - } - } - } - - private static void breakdownLineForCrafter(String config) - { - String temp = ""; - int phase = 0; - String id = ""; - String type = ""; - int tier = -1; - float efficiency = 2.0F; - - for(int a = 0; a < config.length(); a ++) - { - if(a == config.length()-1) - { - temp = temp + config.charAt(a); - } - if(config.charAt(a) == "|".charAt(0) || a == config.length()-1) - { - if(phase == 0) - { - id = temp; - temp = ""; - phase ++; - } - else if(phase == 1) - { - efficiency = Float.valueOf(temp); - temp = ""; - phase ++; - } - else if(phase == 2) - { - tier = Integer.valueOf(temp); - temp = ""; - phase ++; - } - else if(phase == 3) - { - type = temp; - temp = ""; - - Item hoe = getItemFromString(id); - if(hoe != null) - { - CustomCrafterEntry.registerItem(hoe, type, efficiency, tier); - MFLogUtil.logDebug("Added Crafter: " + id + " as " + type + " for efficiency " + efficiency); - } - phase = 0; - } - } - else - { - if(config.charAt(a) != " ".charAt(0)) - { - temp = temp + config.charAt(a); - } - } - } - } - - private static void breakdownLineForDamage(String config) - { - String temp = ""; - int phase = 0; - String id = ""; - float cut = 0; - float blunt = 0; - float pierce = 0; - - for(int a = 0; a < config.length(); a ++) - { - if(a == config.length()-1) - { - temp = temp + config.charAt(a); - } - if(config.charAt(a) == "|".charAt(0) || a == config.length()-1) - { - if(phase == 0) - { - id = temp; - temp = ""; - phase ++; - } - else if(phase == 1) - { - cut = Float.valueOf(temp); - temp = ""; - phase ++; - } - else if(phase == 2) - { - pierce = Float.valueOf(temp); - temp = ""; - phase ++; - } - else if(phase == 3) - { - blunt = Float.valueOf(temp); - temp = ""; - - Item weapon = getItemFromString(id); - if(weapon != null) - { - CustomDamageRatioEntry.registerItem(weapon, new float[]{cut, blunt, pierce}); - MFLogUtil.logDebug("Added Custom weapon: " + id + " With Ratio " + cut + ":" + pierce + ":" + blunt); - } - phase = 0; - } - } - else - { - if(config.charAt(a) != " ".charAt(0)) - { - temp = temp + config.charAt(a); - } - } - } - } - - private static void breakdownLineForDamageEntity(String config) - { - String temp = ""; - int phase = 0; - String id = ""; - float cut = 0; - float pierce = 0; - float blunt = 0; - - for(int a = 0; a < config.length(); a ++) - { - if(a == config.length()-1) - { - temp = temp + config.charAt(a); - } - if(config.charAt(a) == "|".charAt(0) || a == config.length()-1) - { - if(phase == 0) - { - id = temp; - temp = ""; - phase ++; - } - else if(phase == 1) - { - cut = Float.valueOf(temp); - temp = ""; - phase ++; - } - else if(phase == 2) - { - pierce = Float.valueOf(temp); - temp = ""; - phase ++; - } - else if(phase == 3) - { - blunt = Float.valueOf(temp); - temp = ""; - - CustomDamageRatioEntry.registerEntity(id, new float[]{cut, blunt, pierce}); - MFLogUtil.logDebug("Added Custom entity: " + id + " With Ratio " + cut + ":" + pierce + ":" + blunt); - phase = 0; - } - } - else - { - if(config.charAt(a) != " ".charAt(0)) - { - temp = temp + config.charAt(a); - } - } - } - } - - private static Item getItemFromString(String id) - { - Object object = Item.itemRegistry.getObject(id); - return object != null && object instanceof Item ? (Item)object : null; - } +import java.util.Arrays; + +public class ConfigItemRegistry extends ConfigurationBaseMF { + public static final String CATEGORY_ARMOUR = "Armour List"; + public static final String CATEGORY_FARM = "Farming"; + public static final String CATEGORY_TOOL = "Tools"; + public static final String CATEGORY_WEPS = "Weapon Register"; + public static String[] armourListAC = new String[0]; + public static String[] hoeList = new String[0]; + public static String[] crafterList = new String[0]; + public static String[] customDamagerList = new String[0]; + public static String[] customDamagerEntityList = new String[0]; + + public static void readCustoms() { + MFLogUtil.logDebug("Loading Custom Item Entries from config..."); + try { + for (String s : armourListAC) { + breakdownLineForAutoarmour(s); + } + for (String s : hoeList) { + breakdownLineForHoe(s); + } + for (String s : crafterList) { + breakdownLineForCrafter(s); + } + for (String s : customDamagerList) { + breakdownLineForDamage(s); + } + for (String s : customDamagerEntityList) { + breakdownLineForDamage(s); + } + } catch (Exception e) { + MFLogUtil.logWarn("Failed to load Custom Item Entries from config. Check the config file"); + } + } + + private static void registerArmourclassEntry(Item piece, String design, float weight) { + ArmourDesign AC = getClassFor(design); + if (AC == null) { + MFLogUtil.logWarn( + "Could not define armour design '" + design + "' for item id: " + Item.getIdFromItem(piece)); + return; + } + CustomArmourEntry.registerItem(piece, AC, weight, AC.getGroup()); + } + + private static ArmourDesign getClassFor(String name) { + ArmourDesign design = ArmourDesign.designs.get(name); + if (design != null) { + return design; + } + return null; + } + + private static void breakdownLineForAutoarmour(String config) { + String temp = ""; + int phase = 0; + String id = ""; + ArmourDesign AD = null; + String weightGroup = "medium"; + float weight = 1.0F; + for (int a = 0; a < config.length(); a++) { + if (a == config.length() - 1) { + temp = temp + config.charAt(a); + } + if (config.charAt(a) == "|".charAt(0) || a == config.length() - 1) { + if (phase == 0) { + id = temp; + temp = ""; + phase++; + } else if (phase == 1) { + ArmourDesign design = getClassFor(temp); + if (design != null) { + AD = design; + } + temp = ""; + phase++; + } else if (phase == 2) { + weightGroup = temp; + temp = ""; + phase++; + } else if (phase == 3) { + weight = Float.valueOf(temp); + temp = ""; + + Item piece = getItemFromString(id); + if (AD != null && piece != null) { + CustomArmourEntry.registerItem(piece, AD, weight, weightGroup); + MFLogUtil.logDebug("Added Armour: " + piece.getUnlocalizedName() + "(" + AD.getName() + ") To " + + weightGroup + " armour category... Modified weight is " + weight); + } + phase = 0; + } + } else { + if (config.charAt(a) != " ".charAt(0)) { + temp = temp + config.charAt(a); + } + } + } + } + + private static void breakdownLineForHoe(String config) { + String temp = ""; + int phase = 0; + String id = ""; + float eff = 6.0F; + + for (int a = 0; a < config.length(); a++) { + if (a == config.length() - 1) { + temp = temp + config.charAt(a); + } + if (config.charAt(a) == "|".charAt(0) || a == config.length() - 1) { + if (phase == 0) { + id = temp; + temp = ""; + phase++; + } else if (phase == 1) { + eff = Float.valueOf(temp); + temp = ""; + + Item hoe = getItemFromString(id); + if (hoe != null) { + CustomHoeEntry.registerItem(hoe, eff); + MFLogUtil.logDebug("Added Hoe: " + id + " With Efficiency " + eff); + } + phase = 0; + } + } else { + if (config.charAt(a) != " ".charAt(0)) { + temp = temp + config.charAt(a); + } + } + } + } + + private static void breakdownLineForCrafter(String config) { + String temp = ""; + int phase = 0; + String id = ""; + String type = ""; + int tier = -1; + float efficiency = 2.0F; + + for (int a = 0; a < config.length(); a++) { + if (a == config.length() - 1) { + temp = temp + config.charAt(a); + } + if (config.charAt(a) == "|".charAt(0) || a == config.length() - 1) { + if (phase == 0) { + id = temp; + temp = ""; + phase++; + } else if (phase == 1) { + efficiency = Float.valueOf(temp); + temp = ""; + phase++; + } else if (phase == 2) { + tier = Integer.valueOf(temp); + temp = ""; + phase++; + } else if (phase == 3) { + type = temp; + temp = ""; + + Item hoe = getItemFromString(id); + if (hoe != null) { + CustomCrafterEntry.registerItem(hoe, type, efficiency, tier); + MFLogUtil.logDebug("Added Crafter: " + id + " as " + type + " for efficiency " + efficiency); + } + phase = 0; + } + } else { + if (config.charAt(a) != " ".charAt(0)) { + temp = temp + config.charAt(a); + } + } + } + } + + private static void breakdownLineForDamage(String config) { + String temp = ""; + int phase = 0; + String id = ""; + float cut = 0; + float blunt = 0; + float pierce = 0; + + for (int a = 0; a < config.length(); a++) { + if (a == config.length() - 1) { + temp = temp + config.charAt(a); + } + if (config.charAt(a) == "|".charAt(0) || a == config.length() - 1) { + if (phase == 0) { + id = temp; + temp = ""; + phase++; + } else if (phase == 1) { + cut = Float.valueOf(temp); + temp = ""; + phase++; + } else if (phase == 2) { + pierce = Float.valueOf(temp); + temp = ""; + phase++; + } else if (phase == 3) { + blunt = Float.valueOf(temp); + temp = ""; + + Item weapon = getItemFromString(id); + if (weapon != null) { + CustomDamageRatioEntry.registerItem(weapon, new float[]{cut, blunt, pierce}); + MFLogUtil.logDebug( + "Added Custom weapon: " + id + " With Ratio " + cut + ":" + pierce + ":" + blunt); + } + phase = 0; + } + } else { + if (config.charAt(a) != " ".charAt(0)) { + temp = temp + config.charAt(a); + } + } + } + } + + private static void breakdownLineForDamageEntity(String config) { + String temp = ""; + int phase = 0; + String id = ""; + float cut = 0; + float pierce = 0; + float blunt = 0; + + for (int a = 0; a < config.length(); a++) { + if (a == config.length() - 1) { + temp = temp + config.charAt(a); + } + if (config.charAt(a) == "|".charAt(0) || a == config.length() - 1) { + if (phase == 0) { + id = temp; + temp = ""; + phase++; + } else if (phase == 1) { + cut = Float.valueOf(temp); + temp = ""; + phase++; + } else if (phase == 2) { + pierce = Float.valueOf(temp); + temp = ""; + phase++; + } else if (phase == 3) { + blunt = Float.valueOf(temp); + temp = ""; + + CustomDamageRatioEntry.registerEntity(id, new float[]{cut, blunt, pierce}); + MFLogUtil + .logDebug("Added Custom entity: " + id + " With Ratio " + cut + ":" + pierce + ":" + blunt); + phase = 0; + } + } else { + if (config.charAt(a) != " ".charAt(0)) { + temp = temp + config.charAt(a); + } + } + } + } + + private static Item getItemFromString(String id) { + Object object = Item.itemRegistry.getObject(id); + return object != null && object instanceof Item ? (Item) object : null; + } + + @Override + protected void loadConfig() { + // Weight + + String AAdesc = "This will register items under a certain 'Design' calculating the variables itself.\n Each entry has it's own line:\n" + + "Order itemid|Design|WeightGroup|WeightModifier \n" + + "The WeightModifier alters the weight for heavier or lighter materials keep it at 1.0 unless you have a special material (like mithril and adamamantium)\n" + + "Designs can be any that are registered: MineFantasy designs are 'clothing', 'leather', 'mail', 'default'(that's just basic metal armour), and 'plate'\n" + + "WeightGroup refers to whether it is light medium or heavy armour \n" + + "EXAMPLE (This is what vanilla gold is registered under) \n" + + "minecraft:golden_helmet|default|medium|2.0 \n" + "minecraft:golden_chestplate|default|medium|2.0 \n" + + "minecraft:golden_leggings|default|medium|2.0 \n" + "minecraft:golden_boots|default|medium|2.0 \n" + + "The 2.0 means it is 2x heavier than other vanilla armours \n" + + "This does not override existing MF armours \n"; + + armourListAC = config.get(CATEGORY_ARMOUR, "Auto-Armour Registry", new String[0], AAdesc).getStringList(); + Arrays.sort(armourListAC); + + // Hoes + + String hoeDesc = "This Registers Hoe items to an efficiency level: (It uses the same variable as efficiency, you may need to find that out first, by default: it should be able to guess it:\n" + + "Order itemid|efficicncy \n" + + "Efficicney is a variable that goes into play with the failure chance, higher efficicnecy has easier tiling\n"; + + hoeList = config.get(CATEGORY_FARM, "Hoe Registry", new String[0], hoeDesc).getStringList(); + Arrays.sort(hoeList); + + // Crafters + + String craftDesc = "This Registers items to a tool type and efficiency (such as hammer, hvyHammer, knife, saw, etc):\n" + + "Order itemid|efficiency|tier|tooltype \n" + + "tooltype can be hammer, hvyHammer, knife, shears, needle, spoon, mallet, saw, spanner \n" + + "efficiency is the measure of how fast it works (similar to dig speed)"; + + crafterList = config.get(CATEGORY_TOOL, "Crafter Registry", new String[0], craftDesc).getStringList(); + Arrays.sort(crafterList); + + // Weapons + + String damageDesc = "[Experimental] This registers weapons for the damage variable mechanics implemented by option. \n" + + "Though mod-added armours have absolutely no support, and never can without being specifically coded to \n" + + "MineFantasy armours will take these variables and function differently on the values. But weapon items can \n" + + "be added to the list: Put each entry on it's own line set out like this: \n" + + "id|cutting|pierce|blunt \n" + + "id is the item id as a string (you need to find it out yourself), cutting and blunt are the ratio. \n" + + "EXAMPLE (for example... making a stick to piercing damage) \n" + "minecraft:stick|0|1.0|0 \n" + + "The difference between the ratio is what determines damage 1|0 means 100% cutting damage, 3|1 means it's 3 cutting to 1 blunt (or 75%, 25%). use whatever numbers you need to make the ratio."; + + customDamagerList = config.get(CATEGORY_WEPS, "Custom Damage Ratios", new String[0], damageDesc) + .getStringList(); + Arrays.sort(customDamagerList); + + String damageEDesc = "Similar method to 'Custom Damage Ratios' only with entities, This is for registering things like arrows, same format only with the entity registry name (usually modid:name)"; + + customDamagerEntityList = config.get(CATEGORY_WEPS, "Custom Entity Damage Ratios", new String[0], damageEDesc) + .getStringList(); + Arrays.sort(customDamagerEntityList); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigMobs.java b/src/main/java/minefantasy/mf2/config/ConfigMobs.java index b1cc3391..04825bb1 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigMobs.java +++ b/src/main/java/minefantasy/mf2/config/ConfigMobs.java @@ -1,121 +1,139 @@ package minefantasy.mf2.config; -import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFH; import minefantasy.mf2.entity.mob.EntityDragon; -import minefantasy.mf2.mechanics.CombatMechanics; - -public class ConfigMobs extends ConfigurationBaseMF -{ - public static final String BASIC = "1-1: Basic Entities"; - public static final String MOB_DRAGON = "2-4: DRAGON"; - - public static int youngdragonHP, dragonHP, diredragonHP, elderdragonHP, ancientdragonHP; - public static int youngdragonMD, dragonMD, diredragonMD, elderdragonMD, ancientdragonMD; - public static int youngdragonFD, dragonFD, diredragonFD, elderdragonFD, ancientdragonFD; - public static int youngdragonFT, dragonFT, diredragonFT, elderdragonFT, ancientdragonFT; - public static float dragonChance; - public static int dragonInterval; - public static boolean dragonKillNPC; - public static boolean dragonGriefFire; - public static boolean dragonGriefGeneral; - public static boolean dragonMSG; - - public static final String MOB_MINOTAUR = "5-5: MINOTAUR"; - public static int minotaurHP, minotaurMD, minotaurGD, minotaurBT, minotaurBD, minotaurDC, minotaurGC, minotaurGCB, minotaurTC; - public static int guardminotaurHP, guardminotaurMD, guardminotaurGD, guardminotaurBT, guardminotaurBD, guardminotaurDC, guardminotaurGC, guardminotaurGCB, guardminotaurTC; - public static int eliteminotaurHP, eliteminotaurMD, eliteminotaurGD, eliteminotaurBT, eliteminotaurBD, eliteminotaurDC, eliteminotaurGC, eliteminotaurGCB, eliteminotaurTC; - public static int bossminotaurHP, bossminotaurMD, bossminotaurGD, bossminotaurBT, bossminotaurBD, bossminotaurDC, bossminotaurGC, bossminotaurGCB, bossminotaurTC; - public static int lightminotaurAR, mediumminotaurAR, heavyminotaurAR, frostminotaurAR, dreadminotaurAR; - public static int minotaurSpawnrate, minotaurSpawnrateNether; - - @Override - protected void loadConfig() - { - youngdragonHP = Integer.parseInt(config.get(MOB_DRAGON, "2Aa: Health", 60, "Young Dragon Stats").getString()); - youngdragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Ab: Bite dmg", 4).getString()); - youngdragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Ab: Fire dmg", 2).getString()); - youngdragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Ac: Fire time", 10).getString()); - - dragonHP = Integer.parseInt(config.get(MOB_DRAGON, "2Ba: Health", 100, "Adult Dragon Stats").getString()); - dragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Bb: Bite dmg", 7).getString()); - dragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Bb: Fire dmg", 5).getString()); - dragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Bc: Fire time", 40).getString()); - - diredragonHP = Integer.parseInt(config.get(MOB_DRAGON, "2Ca: Health", 200, "Dire Dragon Stats").getString()); - diredragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Cb: Bite dmg", 8).getString()); - diredragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Cb: Fire dmg", 8).getString()); - diredragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Cc: Fire time", 40).getString()); - - elderdragonHP = Integer.parseInt(config.get(MOB_DRAGON, "2Da: Health", 500, "Elder Dragon Stats").getString()); - elderdragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Db: Bite dmg", 14).getString()); - elderdragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Db: Fire dmg", 10).getString()); - elderdragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Dc: Fire time", 50).getString()); - - ancientdragonHP = Integer.parseInt(config.get(MOB_DRAGON, "2Ea: Health", 1000, "Ancient Dragon Stats").getString()); - ancientdragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Eb: Bite dmg", 20).getString()); - ancientdragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Eb: Fire dmg", 10).getString()); - ancientdragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Ec: Fire time", 100).getString()); - - - dragonInterval = Integer.parseInt(config.get(MOB_DRAGON, "3A: Dragon Spawn Interval", 12000, "How many ticks between visits (12000 means 4 times a day), there is a chance for a dragon each time").getString()); - dragonChance = Float.parseFloat(config.get(MOB_DRAGON, "3B: Spawn Chance", 5F, "A Percent (0-100) chance that a dragon spawns at set times").getString()); - - dragonKillNPC = Boolean.parseBoolean(config.get(MOB_DRAGON, "4A: Kill NPC Grief", true, "Should dragons kill NPCs (including villages as well as animals/mobs)... Not as determined though").getString()); - dragonGriefFire = Boolean.parseBoolean(config.get(MOB_DRAGON, "4B: Fire Grief", true, "Should fire breath start fires").getString()); - dragonGriefGeneral = Boolean.parseBoolean(config.get(MOB_DRAGON, "4C: General Block Grief", true, "Should blocks be frozen by frost breath, melted by fire, or glass shatter with fire and stomping").getString()); - dragonMSG = Boolean.parseBoolean(config.get(MOB_DRAGON, "4D: Spawn Message", true, "Will players get a message when dragons enter/leave").getString()); - EntityDragon.interestTimeSeconds = Integer.parseInt(config.get(MOB_DRAGON, "4E: Dragon Interest Time", 90, "How many seconds until a dragon leaves (2x as long if wounded) ").getString()); - EntityDragon.heartChance = Float.parseFloat(config.get(MOB_DRAGON, "4F: Heart Drop chance modifier", 1F, "Modify chance of getting a heart").getString()); - - minotaurSpawnrate = Integer.parseInt(config.get(MOB_MINOTAUR, "5Aa: Overworld Spawnrate", 5).getString()); - minotaurSpawnrateNether = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ab: Nether Spawnrate", 25).getString()); - - minotaurHP = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ba: Health", 30, "Lesser Minotaur").getString()); - minotaurMD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bb: Pound dmg", 5).getString()); - minotaurGD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bc: Gore dmg", 5).getString()); - minotaurBD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bd: Beserk dmg", 7).getString()); - minotaurBT = Integer.parseInt(config.get(MOB_MINOTAUR, "5Be: Beserk threshold (% health)", 25).getString()); - minotaurDC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bf: Disarm chance when mob power attacks", 10).getString()); - minotaurGC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bg: Grab Chance", 5).getString()); - minotaurGCB = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bh: Grab Chance (Beserk)", 10).getString()); - minotaurTC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bi: Throw Chance", 20).getString()); - - guardminotaurHP = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ca: Health", 30, "Minotaur Warrior").getString()); - guardminotaurMD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cb: Pound dmg", 6).getString()); - guardminotaurGD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cc: Gore dmg", 7).getString()); - guardminotaurBD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cd: Beserk dmg", 8).getString()); - guardminotaurBT = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ce: Beserk threshold (% health)", 35).getString()); - guardminotaurDC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cf: Disarm chance when mob power attacks", 10).getString()); - guardminotaurGC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cg: Grab Chance", 5).getString()); - guardminotaurGCB = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ch: Grab Chance (Beserk)", 10).getString()); - guardminotaurTC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ci: Throw Chance", 20).getString()); - lightminotaurAR = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cj: Armour rating", 100).getString()); - - eliteminotaurHP = Integer.parseInt(config.get(MOB_MINOTAUR, "5Da: Health", 50, "Elite Minotaur").getString()); - eliteminotaurMD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Db: Pound dmg", 6).getString()); - eliteminotaurGD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dc: Gore dmg", 6).getString()); - eliteminotaurBD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dd: Beserk dmg", 8).getString()); - eliteminotaurBT = Integer.parseInt(config.get(MOB_MINOTAUR, "5De: Beserk threshold (% health)", 40).getString()); - eliteminotaurDC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Df: Disarm chance when mob power attacks", 20).getString()); - eliteminotaurGC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dg: Grab Chance", 10).getString()); - eliteminotaurGCB = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dh: Grab Chance (Beserk)", 20).getString()); - eliteminotaurTC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Di: Throw Chance", 20).getString()); - mediumminotaurAR = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dj: Armour rating", 400).getString()); - - bossminotaurHP = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ea: Health", 60, "Minotaur Warlord").getString()); - bossminotaurMD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Eb: Pound dmg", 8).getString()); - bossminotaurGD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ec: Gore dmg", 10).getString()); - bossminotaurBD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ed: Beserk dmg", 10).getString()); - bossminotaurBT = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ee: Beserk threshold (% health)", 40).getString()); - bossminotaurDC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ef: Disarm chance when mob power attacks", 40).getString()); - bossminotaurGC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Eg: Grab Chance", 20).getString()); - bossminotaurGCB = Integer.parseInt(config.get(MOB_MINOTAUR, "5Eh: Grab Chance (Beserk)", 40).getString()); - bossminotaurTC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ei: Throw Chance", 20).getString()); - heavyminotaurAR = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ej: Armour rating", 600).getString()); - - frostminotaurAR = Integer.parseInt(config.get(MOB_MINOTAUR, "5Fa: Frost armour bonus", 50, "Species Bonus").getString()); - dreadminotaurAR = Integer.parseInt(config.get(MOB_MINOTAUR, "5Fb: Dread armour bonus", 100).getString()); - - } + +public class ConfigMobs extends ConfigurationBaseMF { + public static final String BASIC = "1-1: Basic Entities"; + public static final String MOB_DRAGON = "2-4: DRAGON"; + public static final String MOB_MINOTAUR = "5-5: MINOTAUR"; + public static int youngdragonHP, dragonHP, diredragonHP, elderdragonHP, ancientdragonHP; + public static int youngdragonMD, dragonMD, diredragonMD, elderdragonMD, ancientdragonMD; + public static int youngdragonFD, dragonFD, diredragonFD, elderdragonFD, ancientdragonFD; + public static int youngdragonFT, dragonFT, diredragonFT, elderdragonFT, ancientdragonFT; + public static float dragonChance; + public static int dragonInterval; + public static boolean dragonKillNPC; + public static boolean dragonGriefFire; + public static boolean dragonGriefGeneral; + public static boolean dragonMSG; + public static int minotaurHP, minotaurMD, minotaurGD, minotaurBT, minotaurBD, minotaurDC, minotaurGC, minotaurGCB, + minotaurTC; + public static int guardminotaurHP, guardminotaurMD, guardminotaurGD, guardminotaurBT, guardminotaurBD, + guardminotaurDC, guardminotaurGC, guardminotaurGCB, guardminotaurTC; + public static int eliteminotaurHP, eliteminotaurMD, eliteminotaurGD, eliteminotaurBT, eliteminotaurBD, + eliteminotaurDC, eliteminotaurGC, eliteminotaurGCB, eliteminotaurTC; + public static int bossminotaurHP, bossminotaurMD, bossminotaurGD, bossminotaurBT, bossminotaurBD, bossminotaurDC, + bossminotaurGC, bossminotaurGCB, bossminotaurTC; + public static int lightminotaurAR, mediumminotaurAR, heavyminotaurAR, frostminotaurAR, dreadminotaurAR; + public static int minotaurSpawnrate, minotaurSpawnrateNether; + + @Override + protected void loadConfig() { + youngdragonHP = Integer.parseInt(config.get(MOB_DRAGON, "2Aa: Health", 60, "Young Dragon Stats").getString()); + youngdragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Ab: Bite dmg", 4).getString()); + youngdragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Ab: Fire dmg", 2).getString()); + youngdragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Ac: Fire time", 10).getString()); + + dragonHP = Integer.parseInt(config.get(MOB_DRAGON, "2Ba: Health", 200, "Adult Dragon Stats").getString()); + dragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Bb: Bite dmg", 12).getString()); + dragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Bb: Fire dmg", 15).getString()); + dragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Bc: Fire time", 60).getString()); + + diredragonHP = Integer.parseInt(config.get(MOB_DRAGON, "2Ca: Health", 200, "Dire Dragon Stats").getString()); + diredragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Cb: Bite dmg", 10).getString()); + diredragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Cb: Fire dmg", 12).getString()); + diredragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Cc: Fire time", 40).getString()); + + elderdragonHP = Integer.parseInt(config.get(MOB_DRAGON, "2Da: Health", 650, "Elder Dragon Stats").getString()); + elderdragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Db: Bite dmg", 20).getString()); + elderdragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Db: Fire dmg", 25).getString()); + elderdragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Dc: Fire time", 80).getString()); + + ancientdragonHP = Integer + .parseInt(config.get(MOB_DRAGON, "2Ea: Health", 1200, "Ancient Dragon Stats").getString()); + ancientdragonMD = Integer.parseInt(config.get(MOB_DRAGON, "2Eb: Bite dmg", 35).getString()); + ancientdragonFD = Integer.parseInt(config.get(MOB_DRAGON, "2Eb: Fire dmg", 40).getString()); + ancientdragonFT = Integer.parseInt(config.get(MOB_DRAGON, "2Ec: Fire time", 120).getString()); + + dragonInterval = Integer.parseInt(config.get(MOB_DRAGON, "3A: Dragon Spawn Interval", 6000, + "How many ticks between visits (12000 means 4 times a day), there is a chance for a dragon each time") + .getString()); + dragonChance = Float.parseFloat(config + .get(MOB_DRAGON, "3B: Spawn Chance", 15F, "A Percent (0-100) chance that a dragon spawns at set times") + .getString()); + + dragonKillNPC = Boolean.parseBoolean(config.get(MOB_DRAGON, "4A: Kill NPC Grief", true, + "Should dragons kill NPCs (including villages as well as animals/mobs)... Not as determined though") + .getString()); + dragonGriefFire = Boolean.parseBoolean( + config.get(MOB_DRAGON, "4B: Fire Grief", true, "Should fire breath start fires").getString()); + dragonGriefGeneral = Boolean.parseBoolean(config.get(MOB_DRAGON, "4C: General Block Grief", true, + "Should blocks be frozen by frost breath, melted by fire, or glass shatter with fire and stomping") + .getString()); + dragonMSG = Boolean.parseBoolean( + config.get(MOB_DRAGON, "4D: Spawn Message", true, "Will players get a message when dragons enter/leave") + .getString()); + EntityDragon.interestTimeSeconds = Integer.parseInt(config.get(MOB_DRAGON, "4E: Dragon Interest Time", 90, + "How many seconds until a dragon leaves (2x as long if wounded) ").getString()); + EntityDragon.heartChance = Float.parseFloat(config + .get(MOB_DRAGON, "4F: Heart Drop chance modifier", 1F, "Modify chance of getting a heart").getString()); + + minotaurSpawnrate = Integer.parseInt(config.get(MOB_MINOTAUR, "5Aa: Overworld Spawnrate", 5).getString()); + minotaurSpawnrateNether = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ab: Nether Spawnrate", 25).getString()); + + minotaurHP = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ba: Health", 30, "Lesser Minotaur").getString()); + minotaurMD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bb: Pound dmg", 5).getString()); + minotaurGD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bc: Gore dmg", 5).getString()); + minotaurBD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bd: Beserk dmg", 7).getString()); + minotaurBT = Integer.parseInt(config.get(MOB_MINOTAUR, "5Be: Beserk threshold (% health)", 25).getString()); + minotaurDC = Integer + .parseInt(config.get(MOB_MINOTAUR, "5Bf: Disarm chance when mob power attacks", 10).getString()); + minotaurGC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bg: Grab Chance", 5).getString()); + minotaurGCB = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bh: Grab Chance (Beserk)", 10).getString()); + minotaurTC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Bi: Throw Chance", 20).getString()); + + guardminotaurHP = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ca: Health", 30, "Minotaur Warrior").getString()); + guardminotaurMD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cb: Pound dmg", 6).getString()); + guardminotaurGD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cc: Gore dmg", 7).getString()); + guardminotaurBD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cd: Beserk dmg", 8).getString()); + guardminotaurBT = Integer + .parseInt(config.get(MOB_MINOTAUR, "5Ce: Beserk threshold (% health)", 35).getString()); + guardminotaurDC = Integer + .parseInt(config.get(MOB_MINOTAUR, "5Cf: Disarm chance when mob power attacks", 10).getString()); + guardminotaurGC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cg: Grab Chance", 5).getString()); + guardminotaurGCB = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ch: Grab Chance (Beserk)", 10).getString()); + guardminotaurTC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ci: Throw Chance", 20).getString()); + lightminotaurAR = Integer.parseInt(config.get(MOB_MINOTAUR, "5Cj: Armour rating", 100).getString()); + + eliteminotaurHP = Integer.parseInt(config.get(MOB_MINOTAUR, "5Da: Health", 50, "Elite Minotaur").getString()); + eliteminotaurMD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Db: Pound dmg", 6).getString()); + eliteminotaurGD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dc: Gore dmg", 6).getString()); + eliteminotaurBD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dd: Beserk dmg", 8).getString()); + eliteminotaurBT = Integer + .parseInt(config.get(MOB_MINOTAUR, "5De: Beserk threshold (% health)", 40).getString()); + eliteminotaurDC = Integer + .parseInt(config.get(MOB_MINOTAUR, "5Df: Disarm chance when mob power attacks", 20).getString()); + eliteminotaurGC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dg: Grab Chance", 10).getString()); + eliteminotaurGCB = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dh: Grab Chance (Beserk)", 20).getString()); + eliteminotaurTC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Di: Throw Chance", 20).getString()); + mediumminotaurAR = Integer.parseInt(config.get(MOB_MINOTAUR, "5Dj: Armour rating", 400).getString()); + + bossminotaurHP = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ea: Health", 60, "Minotaur Warlord").getString()); + bossminotaurMD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Eb: Pound dmg", 8).getString()); + bossminotaurGD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ec: Gore dmg", 10).getString()); + bossminotaurBD = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ed: Beserk dmg", 10).getString()); + bossminotaurBT = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ee: Beserk threshold (% health)", 40).getString()); + bossminotaurDC = Integer + .parseInt(config.get(MOB_MINOTAUR, "5Ef: Disarm chance when mob power attacks", 40).getString()); + bossminotaurGC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Eg: Grab Chance", 20).getString()); + bossminotaurGCB = Integer.parseInt(config.get(MOB_MINOTAUR, "5Eh: Grab Chance (Beserk)", 40).getString()); + bossminotaurTC = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ei: Throw Chance", 20).getString()); + heavyminotaurAR = Integer.parseInt(config.get(MOB_MINOTAUR, "5Ej: Armour rating", 600).getString()); + + frostminotaurAR = Integer + .parseInt(config.get(MOB_MINOTAUR, "5Fa: Frost armour bonus", 50, "Species Bonus").getString()); + dreadminotaurAR = Integer.parseInt(config.get(MOB_MINOTAUR, "5Fb: Dread armour bonus", 100).getString()); + + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigStamina.java b/src/main/java/minefantasy/mf2/config/ConfigStamina.java index 1a80a6fb..263740d3 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigStamina.java +++ b/src/main/java/minefantasy/mf2/config/ConfigStamina.java @@ -2,54 +2,80 @@ import minefantasy.mf2.api.stamina.StaminaBar; -public class ConfigStamina extends ConfigurationBaseMF -{ - public static String VALUES = "Value Modifiers"; - - public static float exhaustDamage; - public static float weaponModifier; - public static float sprintModifier; - public static int fullRegenSeconds; - public static float weaponDrain; - public static float bowModifier; - public static float miningSpeed; - - - public static String OPTION = "Options"; - - public static boolean affectSpeed; - public static boolean affectMining; - - - public static String OTHER = "Misc"; - - @Override - protected void loadConfig() - { - StaminaBar.isSystemActive = Boolean.parseBoolean(config.get("##Activate Stamina System##", "Is enabled", true, "This is the main switch for the stamina bar and all it's features. Setting false disables the system entirely").getString()); - - StaminaBar.decayModifierCfg = Float.parseFloat(config.get(VALUES, "Decay Modifier", 1.0F, "This modifies the rate of decay").getString()); - StaminaBar.configRegenModifier = Float.parseFloat(config.get(VALUES, "Regen Modifier", 1.0F, "This modifies the rate of regen").getString()); - StaminaBar.pauseModifier = Float.parseFloat(config.get(VALUES, "Idle Modifier", 1.0F, "This modifies the time between decaying and regenning back").getString()); - StaminaBar.configBulk = Float.parseFloat(config.get(VALUES, "Bulk Regen Modifier", 1.0F, "This is the rate that worn apparel slows regen: Most items bring it down by 25%, plate is more scale/leather is less").getString()); - StaminaBar.scaleDifficulty = Boolean.parseBoolean(config.get(VALUES, "Difficulty Scale Decay", false, "This makes difficulty change your decay rate across all fields: peaceful(-50%), easy(-25%), normal(base), hard(+25%)").getString()); - StaminaBar.defaultMax = Float.parseFloat(config.get(VALUES, "Max stamina base", 100F, "This is where your stamina starts on spawning, Note that when changed: it only applies on death or new worlds").getString()); - //StaminaBar.restrictSystem = Boolean.parseBoolean(config.get("Restrict use to players", "Will restrict", false, "This restricts the stamina system only to players").getString()); - - weaponModifier = Float.parseFloat(config.get(VALUES, "Weapon Modifier", 1.0F, "This modifies the amount using weapons influences stamina").getString()); - sprintModifier = Float.parseFloat(config.get(VALUES, "Sprint Modifier", 1.0F, "Modify how fast sprinting decays stamina").getString()); - fullRegenSeconds = Integer.parseInt(config.get(VALUES, "Regen Time", 15, "Base time(seconds) until the metre is refilled(this is the base, other variables will be modified)").getString()); - weaponDrain = Float.parseFloat(config.get(VALUES, "Exhausted Damage Modifier", 0.85F, "This is how being exhausted(empty stamina) influences your damage as a decimal. 0.85 = 85%. A value more than 1 increases the damage when out of stamina").getString()); - bowModifier = Float.parseFloat(config.get(VALUES, "Bow Time", 1.0F, "Modifies the rate drawing bows will drain stamina").getString()); - StaminaBar.configArmourWeightModifier = Float.parseFloat(config.get(VALUES, "Weight Modifier", 1.0F, "Modifies the amount weight of armour slows decay").getString()); - miningSpeed = Float.parseFloat(config.get(VALUES, "Mining Modifier", 1.0F, "Modifies the rate block breaking drains stamina").getString()); - exhaustDamage = Float.parseFloat(config.get(VALUES, "Exhausted Damage Modifier", 1.5F, "How much damage you take when out of stamina (1.5 = +50% more damage)").getString()); - - affectSpeed = Boolean.parseBoolean(config.get(OPTION, "Affect Speed", true, "Slowness effect adds when out of stamina").getString()); - affectMining = Boolean.parseBoolean(config.get(OPTION, "Affect Mining", true, "Breaking blocks drains stamina, adds mining fatigue").getString()); - - StaminaBar.levelUp = Boolean.parseBoolean(config.get(OTHER, "Level Max Stamina", false, "This makes your experience bar increase max stamina").getString()); - StaminaBar.levelAmount = Float.parseFloat(config.get(OTHER, "Level Up Amount", 5F, "How much an experience level increases stamina max").getString()); - } +public class ConfigStamina extends ConfigurationBaseMF { + public static String VALUES = "Value Modifiers"; + + public static float exhaustDamage; + public static float weaponModifier; + public static float sprintModifier; + public static int fullRegenSeconds; + public static float weaponDrain; + public static float bowModifier; + public static float miningSpeed; + + public static String OPTION = "Options"; + + public static boolean affectSpeed; + public static boolean affectMining; + + public static String OTHER = "Misc"; + + @Override + protected void loadConfig() { + StaminaBar.isSystemActive = Boolean.parseBoolean(config.get("##Activate Stamina System##", "Is enabled", true, + "This is the main switch for the stamina bar and all it's features. Setting false disables the system entirely") + .getString()); + + StaminaBar.decayModifierCfg = Float + .parseFloat(config.get(VALUES, "Decay Modifier", 1.0F, "This modifies the rate of decay").getString()); + StaminaBar.configRegenModifier = Float + .parseFloat(config.get(VALUES, "Regen Modifier", 1.0F, "This modifies the rate of regen").getString()); + StaminaBar.pauseModifier = Float.parseFloat( + config.get(VALUES, "Idle Modifier", 1.0F, "This modifies the time between decaying and regenning back") + .getString()); + StaminaBar.configBulk = Float.parseFloat(config.get(VALUES, "Bulk Regen Modifier", 1.0F, + "This is the rate that worn apparel slows regen: Most items bring it down by 25%, plate is more scale/leather is less") + .getString()); + StaminaBar.scaleDifficulty = Boolean.parseBoolean(config.get(VALUES, "Difficulty Scale Decay", false, + "This makes difficulty change your decay rate across all fields: peaceful(-50%), easy(-25%), normal(base), hard(+25%)") + .getString()); + StaminaBar.defaultMax = Float.parseFloat(config.get(VALUES, "Max stamina base", 100F, + "This is where your stamina starts on spawning, Note that when changed: it only applies on death or new worlds") + .getString()); + // StaminaBar.restrictSystem = Boolean.parseBoolean(config.get("Restrict use to + // players", "Will restrict", false, "This restricts the stamina system only to + // players").getString()); + + weaponModifier = Float.parseFloat( + config.get(VALUES, "Weapon Modifier", 1.0F, "This modifies the amount using weapons influences stamina") + .getString()); + sprintModifier = Float.parseFloat( + config.get(VALUES, "Sprint Modifier", 1.0F, "Modify how fast sprinting decays stamina").getString()); + fullRegenSeconds = Integer.parseInt(config.get(VALUES, "Regen Time", 15, + "Base time(seconds) until the metre is refilled(this is the base, other variables will be modified)") + .getString()); + weaponDrain = Float.parseFloat(config.get(VALUES, "Exhausted Damage Modifier", 0.85F, + "This is how being exhausted(empty stamina) influences your damage as a decimal. 0.85 = 85%. A value more than 1 increases the damage when out of stamina") + .getString()); + bowModifier = Float.parseFloat( + config.get(VALUES, "Bow Time", 1.0F, "Modifies the rate drawing bows will drain stamina").getString()); + StaminaBar.configArmourWeightModifier = Float.parseFloat(config + .get(VALUES, "Weight Modifier", 1.0F, "Modifies the amount weight of armour slows decay").getString()); + miningSpeed = Float.parseFloat(config + .get(VALUES, "Mining Modifier", 1.0F, "Modifies the rate block breaking drains stamina").getString()); + exhaustDamage = Float.parseFloat(config.get(VALUES, "Exhausted Damage Modifier", 1.5F, + "How much damage you take when out of stamina (1.5 = +50% more damage)").getString()); + + affectSpeed = Boolean.parseBoolean( + config.get(OPTION, "Affect Speed", true, "Slowness effect adds when out of stamina").getString()); + affectMining = Boolean.parseBoolean(config + .get(OPTION, "Affect Mining", true, "Breaking blocks drains stamina, adds mining fatigue").getString()); + + StaminaBar.levelUp = Boolean.parseBoolean( + config.get(OTHER, "Level Max Stamina", false, "This makes your experience bar increase max stamina") + .getString()); + StaminaBar.levelAmount = Float.parseFloat(config + .get(OTHER, "Level Up Amount", 5F, "How much an experience level increases stamina max").getString()); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigTools.java b/src/main/java/minefantasy/mf2/config/ConfigTools.java index a9eefd28..69e85e54 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigTools.java +++ b/src/main/java/minefantasy/mf2/config/ConfigTools.java @@ -1,23 +1,19 @@ package minefantasy.mf2.config; -public class ConfigTools extends ConfigurationBaseMF -{ - public static final String CATEGORY_BONUS = "Bonuses"; - - public static float handpickBonus; +public class ConfigTools extends ConfigurationBaseMF { + public static final String CATEGORY_BONUS = "Bonuses"; + public static final String CATEGORY_PENALTIES = "Penalties"; + public static float handpickBonus; + public static float hvyDropChance; - - public static final String CATEGORY_PENALTIES = "Penalties"; - - public static float hvyDropChance; - - - @Override - protected void loadConfig() - { - handpickBonus = Float.parseFloat(config.get(CATEGORY_BONUS, "Handpick double-drop chance", 20F, "This is the percent value (0-100) handpicks double item drops").getString()); - - hvyDropChance = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Heavy ruin-drop chance", 25F, "This is the percent value (0-100) heavy picks/shovels and lumber axe do NOT drop blocks on break").getString()); - } + @Override + protected void loadConfig() { + handpickBonus = Float.parseFloat(config.get(CATEGORY_BONUS, "Handpick double-drop chance", 20F, + "This is the percent value (0-100) handpicks double item drops").getString()); + + hvyDropChance = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Heavy ruin-drop chance", 25F, + "This is the percent value (0-100) heavy picks/shovels and lumber axe do NOT drop blocks on break") + .getString()); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigWeapon.java b/src/main/java/minefantasy/mf2/config/ConfigWeapon.java index 1305224a..83966a52 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigWeapon.java +++ b/src/main/java/minefantasy/mf2/config/ConfigWeapon.java @@ -1,26 +1,29 @@ package minefantasy.mf2.config; -public class ConfigWeapon extends ConfigurationBaseMF -{ - public static final String CATEGORY_PENALTIES = "Penalties"; - - public static boolean useBalance; - public static boolean breakArrowsGround; - public static float arrowBreakMod; - - public static final String CATEGORY_BONUS = "Bonuses"; - - public static boolean xpTrain; +public class ConfigWeapon extends ConfigurationBaseMF { + public static final String CATEGORY_PENALTIES = "Penalties"; + public static final String CATEGORY_BONUS = "Bonuses"; + public static boolean useBalance; + public static boolean breakArrowsGround; + public static float arrowBreakMod; + public static boolean xpTrain; - - @Override - protected void loadConfig() - { - useBalance = Boolean.parseBoolean(config.get(CATEGORY_PENALTIES, "Heavy Weapon Balance", true, "This causes heavy weapons to throw the camera off angle. This is recommended as it gives a downside to avoid overpowering heavy weapons. With this active: spamming hits is difficult").getString()); - breakArrowsGround = Boolean.parseBoolean(config.get(CATEGORY_PENALTIES, "Arrow Ground Break", true, "Arrows can break when hitting the ground").getString()); - arrowBreakMod = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Arrow Break Chance modifier", 1.0F, "This modifies the rate that arrows break when hitting blocks, 1.0=normal higher numbers increases the break chance").getString()); - - xpTrain = Boolean.parseBoolean(config.get(CATEGORY_BONUS, "Training weapon xp", true, "This option allows training weapons to increase your xp level slowly when hitting with them").getString()); - } + @Override + protected void loadConfig() { + useBalance = Boolean.parseBoolean(config.get(CATEGORY_PENALTIES, "Heavy Weapon Balance", true, + "This causes heavy weapons to throw the camera off angle. This is recommended as it gives a downside to avoid overpowering heavy weapons. With this active: spamming hits is difficult") + .getString()); + breakArrowsGround = Boolean.parseBoolean( + config.get(CATEGORY_PENALTIES, "Arrow Ground Break", true, "Arrows can break when hitting the ground") + .getString()); + arrowBreakMod = Float.parseFloat(config.get(CATEGORY_PENALTIES, "Arrow Break Chance modifier", 1.0F, + "This modifies the rate that arrows break when hitting blocks, 1.0=normal higher numbers increases the break chance") + .getString()); + + xpTrain = Boolean.parseBoolean(config + .get(CATEGORY_BONUS, "Training weapon xp", true, + "This option allows training weapons to increase your xp level slowly when hitting with them") + .getString()); + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigWorldGen.java b/src/main/java/minefantasy/mf2/config/ConfigWorldGen.java index 6b4cf6cd..4696380c 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigWorldGen.java +++ b/src/main/java/minefantasy/mf2/config/ConfigWorldGen.java @@ -1,271 +1,449 @@ package minefantasy.mf2.config; -import minefantasy.mf2.mechanics.worldGen.WorldGenMFBase; - -public class ConfigWorldGen extends ConfigurationBaseMF -{ - public static String copper = "1A: [Ore Gen] Copper Ore"; - public static float copperRarity; - public static int copperFrequencyMin; - public static int copperFrequencyMax; - public static int copperLayerMin; - public static int copperLayerMax; - public static int copperSize; - - - public static String tin = "1B: [Ore Gen] Tin Ore"; - public static float tinRarity; - public static int tinFrequencyMin; - public static int tinFrequencyMax; - public static int tinLayerMin; - public static int tinLayerMax; - public static int tinSize; - - - public static String silver = "1C: [Ore Gen] Silver Ore"; - public static float silverRarity; - public static int silverFrequencyMin; - public static int silverFrequencyMax; - public static int silverLayerMin; - public static int silverLayerMax; - public static int silverSize; - - public static String wolframite = "1D: [Ore Gen] Wolframite Ore"; - public static float wolframiteRarity; - public static int wolframiteFrequencyMin; - public static int wolframiteFrequencyMax; - public static int wolframiteLayerMin; - public static int wolframiteLayerMax; - public static int wolframiteSize; - - public static String mythic = "1E: [Ore Gen] Mythic Ore"; - public static float mythicRarity; - public static int mythicFrequencyMin; - public static int mythicFrequencyMax; - public static int mythicLayerMin; - public static int mythicLayerMax; - public static int mythicSize; - - - public static String kaolinite = "2A: [Mineral Gen] Kaolinite Deposit"; - public static float kaoliniteRarity; - public static int kaoliniteFrequencyMin; - public static int kaoliniteFrequencyMax; - public static int kaoliniteLayerMin; - public static int kaoliniteLayerMax; - public static int kaoliniteSize; - - public static String clay = "2B: [Mineral Gen] Clay Deposit"; - public static float clayRarity; - public static int clayFrequencyMin; - public static int clayFrequencyMax; - public static int clayLayerMin; - public static int clayLayerMax; - public static int claySize; - - public static String nitre = "2C: [Mineral Gen] Nitre Deposit"; - public static float nitreRarity; - public static int nitreFrequencyMin; - public static int nitreFrequencyMax; - public static int nitreLayerMin; - public static int nitreLayerMax; - public static int nitreSize; - - public static String sulfur = "2D: [Mineral Gen] Sulfur Deposit"; - public static float sulfurRarity; - public static int sulfurFrequencyMin; - public static int sulfurFrequencyMax; - public static int sulfurLayerMin; - public static int sulfurLayerMax; - public static int sulfurSize; - - public static String borax = "2E: [Mineral Gen] Borax Deposit"; - public static float boraxRarity; - public static int boraxFrequencyMin; - public static int boraxFrequencyMax; - public static int boraxLayerMin; - public static int boraxLayerMax; - public static int boraxSize; - - public static String coal = "2F: [Mineral Gen] Rich Coal Deposit"; - public static float coalRarity; - public static int coalFrequencyMin; - public static int coalFrequencyMax; - public static int coalLayerMin; - public static int coalLayerMax; - public static int coalSize; - - public static String limestone = "3A: [Rock Gen] Limestone"; - public static float limestoneRarity; - public static int limestoneFrequencyMax; - public static int limestoneFrequencyMin; - public static int limestoneLayerMax; - public static int limestoneLayerMin; - public static int limestoneSize; - - public static String berry = "4A: [Plant Gen] Berry Bush"; - public static float berryRarity; - public static float berryMinTemp; - public static float berryMaxTemp; - public static float berryMinRain; - public static float berryMaxRain; - - public static String yew = "5A: [Tree Gen] Yew"; - public static float yewRarity; - public static float yewMinTemp; - public static float yewMaxTemp; - public static float yewMinRain; - public static float yewMaxRain; - - public static String ironbark = "5B: [Tree Gen] Ironbark"; - public static float ironbarkRarity; - public static float ironbarkMinTemp; - public static float ironbarkMaxTemp; - public static float ironbarkMinRain; - public static float ironbarkMaxRain; - - public static String ebony = "5C: [Tree Gen] Ebony"; - public static float ebonyRarity; - public static float ebonyMinTemp; - public static float ebonyMaxTemp; - public static float ebonyMinRain; - public static float ebonyMaxRain; - - public static String structure = "6A: [Structure Gen] General"; - public static int structureTickRate; - public static String ancientForge = "6B: [Structure Gen] Ancient Forge"; - public static float MFChance; - public static String ancientAlter = "6C: [Structure Gen] Ancient Alter"; - public static float MAChance; - public static String dwarvenSH = "6D: [Structure Gen] Dwarven Stronghold"; - public static float DSChance; - public static int DSGrid, DSLength, DSDeviations; - - @Override - protected void loadConfig() - { - copperRarity = Float.parseFloat(config.get(copper, "Copper Rarity", 1.0D, "The chance for copper to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any copper").getString()); - copperFrequencyMin = Integer.parseInt(config.get(copper, "Copper Frequency Min", 8, "Copper will try spawn between this and max veins per chunk").getString()); - copperFrequencyMax = Integer.parseInt(config.get(copper, "Copper Frequency Max", 8, "Copper will try spawn between min and this veins per chunk").getString()); - copperLayerMin = Integer.parseInt(config.get(copper, "Copper Layer Min", 48, "Copper veins spawn above this layer").getString()); - copperLayerMax = Integer.parseInt(config.get(copper, "Copper Layer Max", 96, "Copper veins spawn below this layer").getString()); - copperSize = Integer.parseInt(config.get(copper, "Copper Size", 8, "How many blocks consist of the vein").getString()); - - tinRarity = Float.parseFloat(config.get(tin, "Tin Rarity", 1.0D, "The chance for tin to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any tin").getString()); - tinFrequencyMin = Integer.parseInt(config.get(tin, "Tin Frequency Min", 8, "Tin will try spawn between this and max veins per chunk").getString()); - tinFrequencyMax = Integer.parseInt(config.get(tin, "Tin Frequency Max", 8, "Tin will try spawn between min and this veins per chunk").getString()); - tinLayerMin = Integer.parseInt(config.get(tin, "Tin Layer Min", 48, "Tin veins spawn above this layer").getString()); - tinLayerMax = Integer.parseInt(config.get(tin, "Tin Layer Max", 96, "Tin veins spawn below this layer").getString()); - tinSize = Integer.parseInt(config.get(tin, "Tin Size", 5, "How many blocks consist of the vein").getString()); - - silverRarity = Float.parseFloat(config.get(silver, "Silver Rarity", 1.0D, "The chance for silver to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any ").getString()); - silverFrequencyMin = Integer.parseInt(config.get(silver, "Silver Frequency Min", 3, "Silver will try spawn between this and max veins per chunk").getString()); - silverFrequencyMax = Integer.parseInt(config.get(silver, "Silver Frequency Max", 4, "Silver will try spawn between min and this veins per chunk").getString()); - silverLayerMin = Integer.parseInt(config.get(silver, "Silver Layer Min", 0, "Silver veins spawn above this layer").getString()); - silverLayerMax = Integer.parseInt(config.get(silver, "Silver Layer Max", 32, "Silver veins spawn below this layer").getString()); - silverSize = Integer.parseInt(config.get(silver, "Silver Size", 8, "How many blocks consist of the vein").getString()); - - wolframiteRarity = Float.parseFloat(config.get(wolframite, "Wolframite Rarity", 1.0D, "The chance for wolframite to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any ").getString()); - wolframiteFrequencyMin = Integer.parseInt(config.get(wolframite, "Wolframite Frequency Min", 1, "Wolframite will try spawn between this and max veins per chunk").getString()); - wolframiteFrequencyMax = Integer.parseInt(config.get(wolframite, "Wolframite Frequency Max", 1, "Wolframite will try spawn between min and this veins per chunk").getString()); - wolframiteLayerMin = Integer.parseInt(config.get(wolframite, "Wolframite Layer Min", 0, "Wolframite veins spawn above this layer").getString()); - wolframiteLayerMax = Integer.parseInt(config.get(wolframite, "Wolframite Layer Max", 16, "Wolframite veins spawn below this layer").getString()); - wolframiteSize = Integer.parseInt(config.get(wolframite, "Wolframite Size", 7, "How many blocks consist of the vein").getString()); - - mythicRarity = Float.parseFloat(config.get(mythic, "Mythic Rarity", 0.05D, "The chance for mythic to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any mythic").getString()); - mythicFrequencyMin = Integer.parseInt(config.get(mythic, "Mythic Frequency Min", 2, "Mythic will try spawn between this and max veins per chunk").getString()); - mythicFrequencyMax = Integer.parseInt(config.get(mythic, "Mythic Frequency Max", 5, "Mythic will try spawn between min and this veins per chunk").getString()); - mythicLayerMin = Integer.parseInt(config.get(mythic, "Mythic Layer Min", 4, "Mythic veins spawn above this layer").getString()); - mythicLayerMax = Integer.parseInt(config.get(mythic, "Mythic Layer Max", 6, "Mythic veins spawn below this layer").getString()); - mythicSize = Integer.parseInt(config.get(mythic, "Mythic Size", 8, "How many blocks consist of the vein").getString()); - - - kaoliniteRarity = Float.parseFloat(config.get(kaolinite, "Kaolinite Rarity", 0.25D, "The chance for kaolinite to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any kaolinite").getString()); - kaoliniteFrequencyMin = Integer.parseInt(config.get(kaolinite, "Kaolinite Frequency Min", 1, "Kaolinite will try spawn between this and max deposits per chunk").getString()); - kaoliniteFrequencyMax = Integer.parseInt(config.get(kaolinite, "Kaolinite Frequency Max", 1, "Kaolinite will try spawn between min and this deposits per chunk").getString()); - kaoliniteLayerMin = Integer.parseInt(config.get(kaolinite, "Kaolinite Layer Min", 48, "Kaolinite deposits spawn above this layer").getString()); - kaoliniteLayerMax = Integer.parseInt(config.get(kaolinite, "Kaolinite Layer Max", 72, "Kaolinite deposits spawn below this layer").getString()); - kaoliniteSize = Integer.parseInt(config.get(kaolinite, "Kaolinite Size", 16, "How many blocks consist of the deposit").getString()); - - //Coal: 20 deposits of 16: Up to 320 coal value per chunk - //Rich Coal: 10 deposits of 8: up to 80 coal value - coalRarity = Float.parseFloat(config.get(coal, "Rich Coal Rarity", 1F, "The chance for rich coal to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any rich coal deposits").getString()); - coalFrequencyMin = Integer.parseInt(config.get(coal, "Rich Coal Frequency Min", 5, "Rich Coal will try spawn between this and max deposits per chunk").getString()); - coalFrequencyMax = Integer.parseInt(config.get(coal, "Rich Coal Frequency Max", 5, "Rich Coal will try spawn between min and this deposits per chunk").getString()); - coalLayerMin = Integer.parseInt(config.get(coal, "Rich Coal Layer Min", 0, "Rich Coal deposits spawn above this layer").getString()); - coalLayerMax = Integer.parseInt(config.get(coal, "Rich Coal Layer Max", 64, "Rich Coal deposits spawn below this layer").getString()); - coalSize = Integer.parseInt(config.get(coal, "Rich Coal Size", 8, "How many blocks consist of the deposit").getString()); - - clayRarity = Float.parseFloat(config.get(clay, "Clay Rarity", 0.15D, "The chance for clay to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any clay").getString()); - clayFrequencyMin = Integer.parseInt(config.get(clay, "Clay Frequency Min", 1, "Clay will try spawn between this and max deposits per chunk").getString()); - clayFrequencyMax = Integer.parseInt(config.get(clay, "Clay Frequency Max", 1, "Clay will try spawn between min and this deposits per chunk").getString()); - clayLayerMin = Integer.parseInt(config.get(clay, "Clay Layer Min", 60, "Clay deposits spawn above this layer").getString()); - clayLayerMax = Integer.parseInt(config.get(clay, "Clay Layer Max", 68, "Clay deposits spawn below this layer").getString()); - claySize = Integer.parseInt(config.get(clay, "Clay Size", 32, "How many blocks consist of the deposit").getString()); - - nitreRarity = Float.parseFloat(config.get(nitre, "Nitre Rarity", 1.0D, "The chance for nitre to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any nitre").getString()); - nitreFrequencyMin = Integer.parseInt(config.get(nitre, "Nitre Frequency Min", 2, "Nitre will try spawn between this and max deposits per chunk").getString()); - nitreFrequencyMax = Integer.parseInt(config.get(nitre, "Nitre Frequency Max", 5, "Nitre will try spawn between min and this deposits per chunk").getString()); - nitreLayerMin = Integer.parseInt(config.get(nitre, "Nitre Layer Min", 16, "Nitre deposits spawn above this layer").getString()); - nitreLayerMax = Integer.parseInt(config.get(nitre, "Nitre Layer Max", 64, "Nitre deposits spawn below this layer").getString()); - nitreSize = Integer.parseInt(config.get(nitre, "Nitre Size", 8, "How many blocks consist of the deposit").getString()); - - sulfurRarity = Float.parseFloat(config.get(sulfur, "Sulfur Rarity", 1.0D, "The chance for sulfur to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any sulfur").getString()); - sulfurFrequencyMin = Integer.parseInt(config.get(sulfur, "Sulfur Frequency Min", 6, "Sulfur will try spawn between this and max deposits per chunk").getString()); - sulfurFrequencyMax = Integer.parseInt(config.get(sulfur, "Sulfur Frequency Max", 12, "Sulfur will try spawn between min and this deposits per chunk").getString()); - sulfurLayerMin = Integer.parseInt(config.get(sulfur, "Sulfur Layer Min", 0, "Sulfur deposits spawn above this layer").getString()); - sulfurLayerMax = Integer.parseInt(config.get(sulfur, "Sulfur Layer Max", 16, "Sulfur deposits spawn below this layer").getString()); - sulfurSize = Integer.parseInt(config.get(sulfur, "Sulfur Size", 4, "How many blocks consist of the deposit").getString()); - - boraxRarity = Float.parseFloat(config.get(borax, "Borax Rarity", 0.1D, "The chance for borax to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any borax").getString()); - boraxFrequencyMin = Integer.parseInt(config.get(borax, "Borax Frequency Min", 5, "Borax will try spawn between this and max deposits per chunk").getString()); - boraxFrequencyMax = Integer.parseInt(config.get(borax, "Borax Frequency Max", 10, "Borax will try spawn between min and this deposits per chunk").getString()); - boraxLayerMin = Integer.parseInt(config.get(borax, "Borax Layer Min", 48, "Borax deposits spawn above this layer").getString()); - boraxLayerMax = Integer.parseInt(config.get(borax, "Borax Layer Max", 96, "Borax deposits spawn below this layer").getString()); - boraxSize = Integer.parseInt(config.get(borax, "Borax Size", 8, "How many blocks consist of the deposit").getString()); - - limestoneRarity = Float.parseFloat(config.get(limestone, "Limestone Rarity", 2.5E-2D, "The chance for limestone to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any limestone").getString()); - limestoneFrequencyMin = Integer.parseInt(config.get(limestone, "Limestone Frequency Min", 1, "Limestone will try spawn between this and max deposits per chunk").getString()); - limestoneFrequencyMax = Integer.parseInt(config.get(limestone, "Limestone Frequency Max", 1, "Limestone will try spawn between min and this deposits per chunk").getString()); - limestoneLayerMin = Integer.parseInt(config.get(limestone, "Limestone Layer Min", 48, "Limestone deposits spawn above this layer").getString()); - limestoneLayerMax = Integer.parseInt(config.get(limestone, "Limestone Layer Max", 96, "Limestone deposits spawn below this layer").getString()); - limestoneSize = Integer.parseInt(config.get(limestone, "Limestone Size", 128, "How many blocks consist of the deposit").getString()); - - //Trees and Plants use SN values to make them more compact (since their pretty rare) - berryRarity = Float.parseFloat(config.get(berry, "Berry Bush Rarity", 3.0E-2D, "The chance for berry bushes to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any berries").getString()); - yewRarity = Float.parseFloat(config.get(yew, "Yew Tree Rarity", 1.0E-3D, "The chance for yew trees to spawn in a chunk. (0=never, 1.0=always), this means many chunks may not have any trees").getString()); - ironbarkRarity = Float.parseFloat(config.get(ironbark, "Ironbark Tree Rarity", 1.5E-3D, "The chance for ironbark trees to spawn in a chunk. (0=never, 1.0=always), this means many chunks may not have any trees").getString()); - ebonyRarity = Float.parseFloat(config.get(ebony, "Ebony Tree Rarity", 5.0E-4D, "The chance for ebony trees to spawn in a chunk. (0=never, 1.0=always), this means many chunks may not have any trees").getString()); - - berryMinTemp = Float.parseFloat(config.get(berry, "Berry Bush Spawn Temp Min", 0.2D, "The minimal biome temperature berries can spawn").getString()); - berryMaxTemp = Float.parseFloat(config.get(berry, "Berry Bush Spawn Temp Max", 1.0D, "The maximum biome temperature berries can spawn").getString()); - berryMinRain = Float.parseFloat(config.get(berry, "Berry Bush Spawn Rain Min", 0.3D, "The minimal biome rainfall berries can spawn").getString()); - berryMaxRain = Float.parseFloat(config.get(berry, "Berry Bush Spawn Rain Max", 1.0D, "The maximum biome rainfall berries can spawn").getString()); - - yewMinTemp = Float.parseFloat(config.get(yew, "Yew Tree Spawn Temp Min", 0.2D, "The minimal biome temperature yew can spawn").getString()); - yewMaxTemp = Float.parseFloat(config.get(yew, "Yew Tree Spawn Temp Max", 1.0D, "The maximum biome temperature yew can spawn").getString()); - yewMinRain = Float.parseFloat(config.get(yew, "Yew Tree Spawn Rain Min", 0.3D, "The minimal biome rainfall yew can spawn").getString()); - yewMaxRain = Float.parseFloat(config.get(yew, "Yew Tree Spawn Rain Max", 1.0D, "The maximum biome rainfall yew can spawn").getString()); - - ironbarkMinTemp = Float.parseFloat(config.get(ironbark, "Ironbark Tree Spawn Temp Min", 0.4D, "The minimal biome temperature ironbark can spawn").getString()); - ironbarkMaxTemp = Float.parseFloat(config.get(ironbark, "Ironbark Tree Spawn Temp Max", 1.2D, "The maximum biome temperature ironbark can spawn").getString()); - ironbarkMinRain = Float.parseFloat(config.get(ironbark, "Ironbark Tree Spawn Rain Min", 0.0D, "The minimal biome rainfall ironbark can spawn").getString()); - ironbarkMaxRain = Float.parseFloat(config.get(ironbark, "Ironbark Tree Spawn Rain Max", 0.8D, "The maximum biome rainfall ironbark can spawn").getString()); - - ebonyMinTemp = Float.parseFloat(config.get(ebony, "Ebony Tree Spawn Temp Min", 0.2D, "The minimal biome temperature ebony can spawn").getString()); - ebonyMaxTemp = Float.parseFloat(config.get(ebony, "Ebony Tree Spawn Temp Max", 1.0D, "The maximum biome temperature ebony can spawn").getString()); - ebonyMinRain = Float.parseFloat(config.get(ebony, "Ebony Tree Spawn Rain Min", 0.4D, "The minimal biome rainfall ebony can spawn").getString()); - ebonyMaxRain = Float.parseFloat(config.get(ebony, "Ebony Tree Spawn Rain Max", 1.0D, "The maximum biome rainfall ebony can spawn").getString()); - - structureTickRate = Integer.parseInt(config.get(structure, "Generation Tick rate", 1, "How many ticks (1/20seconds) for each section to generate").getString()); - MFChance = Float.parseFloat(config.get(ancientForge, "Spawn Chance", 1.5E-2D, "The chance for this structure to generate in a chunk. (0=never, 1.0=always)").getString()); - MAChance = Float.parseFloat(config.get(ancientAlter, "Spawn Chance", 1.0E-2D, "The chance for this structure to generate in a chunk. (0=never, 1.0=always)").getString()); - DSChance = Float.parseFloat(config.get(dwarvenSH, "Spawn Chance", 5.0E-2D, "The chance for this structure to generate in a chunk. (0=never, 1.0=always)").getString()); - - DSGrid = Integer.parseInt(config.get(dwarvenSH, "Stronghold Grid size", 8, "Strongholds generate on a grid on the map to avoid overlaps, this defines the minimum distance between two strongholds (in 16x16 block chunks)").getString()); - DSLength = Integer.parseInt(config.get(dwarvenSH, "Stronghold max length", 8, "Max amount of halls making the length of dwarf strongholds (some may be smaller or larger, but this is a guideline)").getString()); - DSDeviations = Integer.parseInt(config.get(dwarvenSH, "Stronghold max deviations", 1, "Max amount of intersections in dwarf stronghold hallways (not including living hubs). This can significantly increase complexity of strongholds and in turn lag when generating").getString()); - - } +public class ConfigWorldGen extends ConfigurationBaseMF { + public static String copper = "1A: [Ore Gen] Copper Ore"; + public static float copperRarity; + public static int copperFrequencyMin; + public static int copperFrequencyMax; + public static int copperLayerMin; + public static int copperLayerMax; + public static int copperSize; + + public static String tin = "1B: [Ore Gen] Tin Ore"; + public static float tinRarity; + public static int tinFrequencyMin; + public static int tinFrequencyMax; + public static int tinLayerMin; + public static int tinLayerMax; + public static int tinSize; + + public static String silver = "1C: [Ore Gen] Silver Ore"; + public static float silverRarity; + public static int silverFrequencyMin; + public static int silverFrequencyMax; + public static int silverLayerMin; + public static int silverLayerMax; + public static int silverSize; + + public static String wolframite = "1D: [Ore Gen] Wolframite Ore"; + public static float wolframiteRarity; + public static int wolframiteFrequencyMin; + public static int wolframiteFrequencyMax; + public static int wolframiteLayerMin; + public static int wolframiteLayerMax; + public static int wolframiteSize; + + public static String mythic = "1E: [Ore Gen] Mythic Ore"; + public static float mythicRarity; + public static int mythicFrequencyMin; + public static int mythicFrequencyMax; + public static int mythicLayerMin; + public static int mythicLayerMax; + public static int mythicSize; + + public static String kaolinite = "2A: [Mineral Gen] Kaolinite Deposit"; + public static float kaoliniteRarity; + public static int kaoliniteFrequencyMin; + public static int kaoliniteFrequencyMax; + public static int kaoliniteLayerMin; + public static int kaoliniteLayerMax; + public static int kaoliniteSize; + + public static String clay = "2B: [Mineral Gen] Clay Deposit"; + public static float clayRarity; + public static int clayFrequencyMin; + public static int clayFrequencyMax; + public static int clayLayerMin; + public static int clayLayerMax; + public static int claySize; + + public static String nitre = "2C: [Mineral Gen] Nitre Deposit"; + public static float nitreRarity; + public static int nitreFrequencyMin; + public static int nitreFrequencyMax; + public static int nitreLayerMin; + public static int nitreLayerMax; + public static int nitreSize; + + public static String sulfur = "2D: [Mineral Gen] Sulfur Deposit"; + public static float sulfurRarity; + public static int sulfurFrequencyMin; + public static int sulfurFrequencyMax; + public static int sulfurLayerMin; + public static int sulfurLayerMax; + public static int sulfurSize; + + public static String borax = "2E: [Mineral Gen] Borax Deposit"; + public static float boraxRarity; + public static int boraxFrequencyMin; + public static int boraxFrequencyMax; + public static int boraxLayerMin; + public static int boraxLayerMax; + public static int boraxSize; + + public static String coal = "2F: [Mineral Gen] Rich Coal Deposit"; + public static float coalRarity; + public static int coalFrequencyMin; + public static int coalFrequencyMax; + public static int coalLayerMin; + public static int coalLayerMax; + public static int coalSize; + + public static String limestone = "3A: [Rock Gen] Limestone"; + public static float limestoneRarity; + public static int limestoneFrequencyMax; + public static int limestoneFrequencyMin; + public static int limestoneLayerMax; + public static int limestoneLayerMin; + public static int limestoneSize; + + public static String berry = "4A: [Plant Gen] Berry Bush"; + public static float berryRarity; + public static float berryMinTemp; + public static float berryMaxTemp; + public static float berryMinRain; + public static float berryMaxRain; + + public static String yew = "5A: [Tree Gen] Yew"; + public static float yewRarity; + public static float yewMinTemp; + public static float yewMaxTemp; + public static float yewMinRain; + public static float yewMaxRain; + + public static String ironbark = "5B: [Tree Gen] Ironbark"; + public static float ironbarkRarity; + public static float ironbarkMinTemp; + public static float ironbarkMaxTemp; + public static float ironbarkMinRain; + public static float ironbarkMaxRain; + + public static String ebony = "5C: [Tree Gen] Ebony"; + public static float ebonyRarity; + public static float ebonyMinTemp; + public static float ebonyMaxTemp; + public static float ebonyMinRain; + public static float ebonyMaxRain; + + //NEW ORES + public static String mithril = "6A: [Ore Gen] Mithril Ore"; + public static float mithrilRarity; + public static int mithrilFrequencyMin; + public static int mithrilFrequencyMax; + public static int mithrilLayerMin; + public static int mithrilLayerMax; + public static int mithrilSize; + + public static String structure = "6A: [Structure Gen] General"; + public static int structureTickRate; + public static String ancientForge = "6B: [Structure Gen] Ancient Forge"; + public static float MFChance; + public static String ancientAlter = "6C: [Structure Gen] Ancient Alter"; + public static float MAChance; + public static String dwarvenSH = "6D: [Structure Gen] Dwarven Stronghold"; + public static float DSChance; + public static int DSGrid, DSLength, DSDeviations; + + @Override + protected void loadConfig() { + copperRarity = Float.parseFloat(config.get(copper, "Copper Rarity", 1.0D, + "The chance for copper to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any copper") + .getString()); + copperFrequencyMin = Integer.parseInt(config + .get(copper, "Copper Frequency Min", 8, "Copper will try spawn between this and max veins per chunk") + .getString()); + copperFrequencyMax = Integer.parseInt(config + .get(copper, "Copper Frequency Max", 8, "Copper will try spawn between min and this veins per chunk") + .getString()); + copperLayerMin = Integer.parseInt( + config.get(copper, "Copper Layer Min", 48, "Copper veins spawn above this layer").getString()); + copperLayerMax = Integer.parseInt( + config.get(copper, "Copper Layer Max", 96, "Copper veins spawn below this layer").getString()); + copperSize = Integer + .parseInt(config.get(copper, "Copper Size", 8, "How many blocks consist of the vein").getString()); + + tinRarity = Float.parseFloat(config.get(tin, "Tin Rarity", 1.0D, + "The chance for tin to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any tin") + .getString()); + tinFrequencyMin = Integer.parseInt( + config.get(tin, "Tin Frequency Min", 8, "Tin will try spawn between this and max veins per chunk") + .getString()); + tinFrequencyMax = Integer.parseInt( + config.get(tin, "Tin Frequency Max", 8, "Tin will try spawn between min and this veins per chunk") + .getString()); + tinLayerMin = Integer + .parseInt(config.get(tin, "Tin Layer Min", 48, "Tin veins spawn above this layer").getString()); + tinLayerMax = Integer + .parseInt(config.get(tin, "Tin Layer Max", 96, "Tin veins spawn below this layer").getString()); + tinSize = Integer.parseInt(config.get(tin, "Tin Size", 5, "How many blocks consist of the vein").getString()); + + silverRarity = Float.parseFloat(config.get(silver, "Silver Rarity", 1.1D, + "The chance for silver to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any ") + .getString()); + silverFrequencyMin = Integer.parseInt(config + .get(silver, "Silver Frequency Min", 3, "Silver will try spawn between this and max veins per chunk") + .getString()); + silverFrequencyMax = Integer.parseInt(config + .get(silver, "Silver Frequency Max", 8, "Silver will try spawn between min and this veins per chunk") + .getString()); + silverLayerMin = Integer + .parseInt(config.get(silver, "Silver Layer Min", 5, "Silver veins spawn above this layer").getString()); + silverLayerMax = Integer.parseInt( + config.get(silver, "Silver Layer Max", 32, "Silver veins spawn below this layer").getString()); + silverSize = Integer + .parseInt(config.get(silver, "Silver Size", 8, "How many blocks consist of the vein").getString()); + + wolframiteRarity = Float.parseFloat(config.get(wolframite, "Wolframite Rarity", 1.0D, + "The chance for wolframite to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any ") + .getString()); + wolframiteFrequencyMin = Integer.parseInt(config.get(wolframite, "Wolframite Frequency Min", 1, + "Wolframite will try spawn between this and max veins per chunk").getString()); + wolframiteFrequencyMax = Integer.parseInt(config.get(wolframite, "Wolframite Frequency Max", 1, + "Wolframite will try spawn between min and this veins per chunk").getString()); + wolframiteLayerMin = Integer.parseInt(config + .get(wolframite, "Wolframite Layer Min", 0, "Wolframite veins spawn above this layer").getString()); + wolframiteLayerMax = Integer.parseInt(config + .get(wolframite, "Wolframite Layer Max", 16, "Wolframite veins spawn below this layer").getString()); + wolframiteSize = Integer.parseInt( + config.get(wolframite, "Wolframite Size", 7, "How many blocks consist of the vein").getString()); + + mythicRarity = Float.parseFloat(config.get(mythic, "Mythic Rarity", 0.90D, + "The chance for mythic to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any mythic") + .getString()); + mythicFrequencyMin = Integer.parseInt(config + .get(mythic, "Mythic Frequency Min", 3, "Mythic will try spawn between this and max veins per chunk") + .getString()); + mythicFrequencyMax = Integer.parseInt(config + .get(mythic, "Mythic Frequency Max", 6, "Mythic will try spawn between min and this veins per chunk") + .getString()); + mythicLayerMin = Integer + .parseInt(config.get(mythic, "Mythic Layer Min", 4, "Mythic veins spawn above this layer").getString()); + mythicLayerMax = Integer + .parseInt(config.get(mythic, "Mythic Layer Max", 6, "Mythic veins spawn below this layer").getString()); + mythicSize = Integer + .parseInt(config.get(mythic, "Mythic Size", 8, "How many blocks consist of the vein").getString()); + + //NEW ORES + mithrilRarity = Float.parseFloat(config.get(mithril, "Mithril Rarity", 0.95D, + "The chance for mithril to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any mythic") + .getString()); + mithrilFrequencyMin = Integer.parseInt(config + .get(mythic, "Mithril Frequency Min", 3, "Mythril will try spawn between this and max veins per chunk") + .getString()); + mithrilFrequencyMax = Integer.parseInt(config + .get(mythic, "Mythril Frequency Max", 7, "Mithril will try spawn between min and this veins per chunk") + .getString()); + mithrilLayerMin = Integer + .parseInt(config.get(mithril, "Mithril Layer Min", 8, "Mythril veins spawn above this layer").getString()); + mithrilLayerMax = Integer + .parseInt(config.get(mithril, "Mithril Layer Max", 20, "Mythril veins spawn below this layer").getString()); + mithrilSize = Integer + .parseInt(config.get(mithril, "Mithril Size", 5, "How many blocks consist of the vein").getString()); + + + + + + //MF + kaoliniteRarity = Float.parseFloat(config.get(kaolinite, "Kaolinite Rarity", 0.75D, + "The chance for kaolinite to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any kaolinite") + .getString()); + kaoliniteFrequencyMin = Integer.parseInt(config.get(kaolinite, "Kaolinite Frequency Min", 1, + "Kaolinite will try spawn between this and max deposits per chunk").getString()); + kaoliniteFrequencyMax = Integer.parseInt(config.get(kaolinite, "Kaolinite Frequency Max", 1, + "Kaolinite will try spawn between min and this deposits per chunk").getString()); + kaoliniteLayerMin = Integer.parseInt(config + .get(kaolinite, "Kaolinite Layer Min", 30, "Kaolinite deposits spawn above this layer").getString()); + kaoliniteLayerMax = Integer.parseInt(config + .get(kaolinite, "Kaolinite Layer Max", 72, "Kaolinite deposits spawn below this layer").getString()); + kaoliniteSize = Integer.parseInt( + config.get(kaolinite, "Kaolinite Size", 16, "How many blocks consist of the deposit").getString()); + + // Coal: 20 deposits of 16: Up to 320 coal value per chunk + // Rich Coal: 10 deposits of 8: up to 80 coal value + coalRarity = Float.parseFloat(config.get(coal, "Rich Coal Rarity", 1F, + "The chance for rich coal to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any rich coal deposits") + .getString()); + coalFrequencyMin = Integer.parseInt(config.get(coal, "Rich Coal Frequency Min", 5, + "Rich Coal will try spawn between this and max deposits per chunk").getString()); + coalFrequencyMax = Integer.parseInt(config.get(coal, "Rich Coal Frequency Max", 5, + "Rich Coal will try spawn between min and this deposits per chunk").getString()); + coalLayerMin = Integer.parseInt( + config.get(coal, "Rich Coal Layer Min", 0, "Rich Coal deposits spawn above this layer").getString()); + coalLayerMax = Integer.parseInt( + config.get(coal, "Rich Coal Layer Max", 64, "Rich Coal deposits spawn below this layer").getString()); + coalSize = Integer + .parseInt(config.get(coal, "Rich Coal Size", 8, "How many blocks consist of the deposit").getString()); + + clayRarity = Float.parseFloat(config.get(clay, "Clay Rarity", 0.15D, + "The chance for clay to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any clay") + .getString()); + clayFrequencyMin = Integer.parseInt( + config.get(clay, "Clay Frequency Min", 1, "Clay will try spawn between this and max deposits per chunk") + .getString()); + clayFrequencyMax = Integer.parseInt( + config.get(clay, "Clay Frequency Max", 1, "Clay will try spawn between min and this deposits per chunk") + .getString()); + clayLayerMin = Integer + .parseInt(config.get(clay, "Clay Layer Min", 60, "Clay deposits spawn above this layer").getString()); + clayLayerMax = Integer + .parseInt(config.get(clay, "Clay Layer Max", 68, "Clay deposits spawn below this layer").getString()); + claySize = Integer + .parseInt(config.get(clay, "Clay Size", 32, "How many blocks consist of the deposit").getString()); + + nitreRarity = Float.parseFloat(config.get(nitre, "Nitre Rarity", 1.0D, + "The chance for nitre to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any nitre") + .getString()); + nitreFrequencyMin = Integer.parseInt(config + .get(nitre, "Nitre Frequency Min", 2, "Nitre will try spawn between this and max deposits per chunk") + .getString()); + nitreFrequencyMax = Integer.parseInt(config + .get(nitre, "Nitre Frequency Max", 5, "Nitre will try spawn between min and this deposits per chunk") + .getString()); + nitreLayerMin = Integer.parseInt( + config.get(nitre, "Nitre Layer Min", 16, "Nitre deposits spawn above this layer").getString()); + nitreLayerMax = Integer.parseInt( + config.get(nitre, "Nitre Layer Max", 64, "Nitre deposits spawn below this layer").getString()); + nitreSize = Integer + .parseInt(config.get(nitre, "Nitre Size", 8, "How many blocks consist of the deposit").getString()); + + sulfurRarity = Float.parseFloat(config.get(sulfur, "Sulfur Rarity", 1.0D, + "The chance for sulfur to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any sulfur") + .getString()); + sulfurFrequencyMin = Integer.parseInt(config + .get(sulfur, "Sulfur Frequency Min", 6, "Sulfur will try spawn between this and max deposits per chunk") + .getString()); + sulfurFrequencyMax = Integer.parseInt(config.get(sulfur, "Sulfur Frequency Max", 12, + "Sulfur will try spawn between min and this deposits per chunk").getString()); + sulfurLayerMin = Integer.parseInt( + config.get(sulfur, "Sulfur Layer Min", 0, "Sulfur deposits spawn above this layer").getString()); + sulfurLayerMax = Integer.parseInt( + config.get(sulfur, "Sulfur Layer Max", 16, "Sulfur deposits spawn below this layer").getString()); + sulfurSize = Integer + .parseInt(config.get(sulfur, "Sulfur Size", 4, "How many blocks consist of the deposit").getString()); + + boraxRarity = Float.parseFloat(config.get(borax, "Borax Rarity", 0.8D, + "The chance for borax to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any borax") + .getString()); + boraxFrequencyMin = Integer.parseInt(config + .get(borax, "Borax Frequency Min", 5, "Borax will try spawn between this and max deposits per chunk") + .getString()); + boraxFrequencyMax = Integer.parseInt(config + .get(borax, "Borax Frequency Max", 10, "Borax will try spawn between min and this deposits per chunk") + .getString()); + boraxLayerMin = Integer.parseInt( + config.get(borax, "Borax Layer Min", 36, "Borax deposits spawn above this layer").getString()); + boraxLayerMax = Integer.parseInt( + config.get(borax, "Borax Layer Max", 96, "Borax deposits spawn below this layer").getString()); + boraxSize = Integer + .parseInt(config.get(borax, "Borax Size", 8, "How many blocks consist of the deposit").getString()); + + limestoneRarity = Float.parseFloat(config.get(limestone, "Limestone Rarity", 2.5E-2D, + "The chance for limestone to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any limestone") + .getString()); + limestoneFrequencyMin = Integer.parseInt(config.get(limestone, "Limestone Frequency Min", 1, + "Limestone will try spawn between this and max deposits per chunk").getString()); + limestoneFrequencyMax = Integer.parseInt(config.get(limestone, "Limestone Frequency Max", 1, + "Limestone will try spawn between min and this deposits per chunk").getString()); + limestoneLayerMin = Integer.parseInt(config + .get(limestone, "Limestone Layer Min", 48, "Limestone deposits spawn above this layer").getString()); + limestoneLayerMax = Integer.parseInt(config + .get(limestone, "Limestone Layer Max", 96, "Limestone deposits spawn below this layer").getString()); + limestoneSize = Integer.parseInt( + config.get(limestone, "Limestone Size", 128, "How many blocks consist of the deposit").getString()); + + // Trees and Plants use SN values to make them more compact (since their pretty + // rare) + berryRarity = Float.parseFloat(config.get(berry, "Berry Bush Rarity", 3.0E-2D, + "The chance for berry bushes to spawn in a chunk. (0=never, 1.0=always), this means some chunks may not have any berries") + .getString()); + yewRarity = Float.parseFloat(config.get(yew, "Yew Tree Rarity", 1.0E-3D, + "The chance for yew trees to spawn in a chunk. (0=never, 1.0=always), this means many chunks may not have any trees") + .getString()); + ironbarkRarity = Float.parseFloat(config.get(ironbark, "Ironbark Tree Rarity", 1.5E-3D, + "The chance for ironbark trees to spawn in a chunk. (0=never, 1.0=always), this means many chunks may not have any trees") + .getString()); + ebonyRarity = Float.parseFloat(config.get(ebony, "Ebony Tree Rarity", 5.0E-4D, + "The chance for ebony trees to spawn in a chunk. (0=never, 1.0=always), this means many chunks may not have any trees") + .getString()); + + berryMinTemp = Float.parseFloat( + config.get(berry, "Berry Bush Spawn Temp Min", 0.2D, "The minimal biome temperature berries can spawn") + .getString()); + berryMaxTemp = Float.parseFloat( + config.get(berry, "Berry Bush Spawn Temp Max", 1.0D, "The maximum biome temperature berries can spawn") + .getString()); + berryMinRain = Float.parseFloat( + config.get(berry, "Berry Bush Spawn Rain Min", 0.3D, "The minimal biome rainfall berries can spawn") + .getString()); + berryMaxRain = Float.parseFloat( + config.get(berry, "Berry Bush Spawn Rain Max", 1.0D, "The maximum biome rainfall berries can spawn") + .getString()); + + yewMinTemp = Float.parseFloat(config + .get(yew, "Yew Tree Spawn Temp Min", 0.2D, "The minimal biome temperature yew can spawn").getString()); + yewMaxTemp = Float.parseFloat(config + .get(yew, "Yew Tree Spawn Temp Max", 1.0D, "The maximum biome temperature yew can spawn").getString()); + yewMinRain = Float.parseFloat(config + .get(yew, "Yew Tree Spawn Rain Min", 0.3D, "The minimal biome rainfall yew can spawn").getString()); + yewMaxRain = Float.parseFloat(config + .get(yew, "Yew Tree Spawn Rain Max", 1.0D, "The maximum biome rainfall yew can spawn").getString()); + + ironbarkMinTemp = Float.parseFloat(config + .get(ironbark, "Ironbark Tree Spawn Temp Min", 0.4D, "The minimal biome temperature ironbark can spawn") + .getString()); + ironbarkMaxTemp = Float.parseFloat(config + .get(ironbark, "Ironbark Tree Spawn Temp Max", 1.2D, "The maximum biome temperature ironbark can spawn") + .getString()); + ironbarkMinRain = Float.parseFloat(config + .get(ironbark, "Ironbark Tree Spawn Rain Min", 0.0D, "The minimal biome rainfall ironbark can spawn") + .getString()); + ironbarkMaxRain = Float.parseFloat(config + .get(ironbark, "Ironbark Tree Spawn Rain Max", 0.8D, "The maximum biome rainfall ironbark can spawn") + .getString()); + + ebonyMinTemp = Float.parseFloat( + config.get(ebony, "Ebony Tree Spawn Temp Min", 0.2D, "The minimal biome temperature ebony can spawn") + .getString()); + ebonyMaxTemp = Float.parseFloat( + config.get(ebony, "Ebony Tree Spawn Temp Max", 1.0D, "The maximum biome temperature ebony can spawn") + .getString()); + ebonyMinRain = Float.parseFloat( + config.get(ebony, "Ebony Tree Spawn Rain Min", 0.4D, "The minimal biome rainfall ebony can spawn") + .getString()); + ebonyMaxRain = Float.parseFloat( + config.get(ebony, "Ebony Tree Spawn Rain Max", 1.0D, "The maximum biome rainfall ebony can spawn") + .getString()); + + structureTickRate = Integer.parseInt(config + .get(structure, "Generation Tick rate", 1, "How many ticks (1/20seconds) for each section to generate") + .getString()); + MFChance = Float + .parseFloat(config + .get(ancientForge, "Spawn Chance", 1.5E-2D, + "The chance for this structure to generate in a chunk. (0=never, 1.0=always)") + .getString()); + MAChance = Float + .parseFloat(config + .get(ancientAlter, "Spawn Chance", 1.0E-2D, + "The chance for this structure to generate in a chunk. (0=never, 1.0=always)") + .getString()); + DSChance = Float + .parseFloat(config + .get(dwarvenSH, "Spawn Chance", 5.0E-2D, + "The chance for this structure to generate in a chunk. (0=never, 1.0=always)") + .getString()); + + DSGrid = Integer.parseInt(config.get(dwarvenSH, "Stronghold Grid size", 8, + "Strongholds generate on a grid on the map to avoid overlaps, this defines the minimum distance between two strongholds (in 16x16 block chunks)") + .getString()); + DSLength = Integer.parseInt(config.get(dwarvenSH, "Stronghold max length", 8, + "Max amount of halls making the length of dwarf strongholds (some may be smaller or larger, but this is a guideline)") + .getString()); + DSDeviations = Integer.parseInt(config.get(dwarvenSH, "Stronghold max deviations", 1, + "Max amount of intersections in dwarf stronghold hallways (not including living hubs). This can significantly increase complexity of strongholds and in turn lag when generating") + .getString()); + + } } diff --git a/src/main/java/minefantasy/mf2/config/ConfigurationBaseMF.java b/src/main/java/minefantasy/mf2/config/ConfigurationBaseMF.java index efdc1d4c..2f3a0ecc 100644 --- a/src/main/java/minefantasy/mf2/config/ConfigurationBaseMF.java +++ b/src/main/java/minefantasy/mf2/config/ConfigurationBaseMF.java @@ -2,17 +2,15 @@ import net.minecraftforge.common.config.Configuration; -public abstract class ConfigurationBaseMF -{ - protected Configuration config; - - public void setConfig(Configuration configuration) - { - configuration.load(); - config = configuration; - loadConfig(); - configuration.save(); +public abstract class ConfigurationBaseMF { + protected Configuration config; + + public void setConfig(Configuration configuration) { + configuration.load(); + config = configuration; + loadConfig(); + configuration.save(); } - protected abstract void loadConfig(); + protected abstract void loadConfig(); } diff --git a/src/main/java/minefantasy/mf2/container/ContainerAnvilMF.java b/src/main/java/minefantasy/mf2/container/ContainerAnvilMF.java index e75d26dd..3e14eb1e 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerAnvilMF.java +++ b/src/main/java/minefantasy/mf2/container/ContainerAnvilMF.java @@ -8,123 +8,98 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerAnvilMF extends Container -{ +public class ContainerAnvilMF extends Container { private TileEntityAnvilMF tile; private boolean isGuiContainer = false; private int xInvOffset = 28; - - public ContainerAnvilMF(TileEntityAnvilMF tile) - { - isGuiContainer = false; - this.tile = tile; + + public ContainerAnvilMF(TileEntityAnvilMF tile) { + isGuiContainer = false; + this.tile = tile; int width = 6; int height = 4; - for(int x = 0; x < width; x ++) - { - for (int y = 0; y < height; y ++) - { - int slot = y*width+x; - this.addSlotToContainer(new Slot(tile, slot, 8 + x * 18, 38 + y * 18)); - } + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + int slot = y * width + x; + this.addSlotToContainer(new Slot(tile, slot, 8 + x * 18, 38 + y * 18)); + } } - this.addSlotToContainer(new Slot(tile, tile.getSizeInventory()-1, 150, 65)); + this.addSlotToContainer(new Slot(tile, tile.getSizeInventory() - 1, 150, 65)); } - - public ContainerAnvilMF(InventoryPlayer user, TileEntityAnvilMF tile) - { - isGuiContainer = true; + + public ContainerAnvilMF(InventoryPlayer user, TileEntityAnvilMF tile) { + isGuiContainer = true; this.tile = tile; int width = 6; int height = 4; - - for(int x = 0; x < width; x ++) - { - for (int y = 0; y < height; y ++) - { - int slot = y*width+x; - this.addSlotToContainer(new Slot(tile, slot, 44 + x * 18, 39 + y * 18)); - } + + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + int slot = y * width + x; + this.addSlotToContainer(new Slot(tile, slot, 44 + x * 18, 39 + y * 18)); + } } - this.addSlotToContainer(new Slot(tile, tile.getSizeInventory()-1, 214, 66)); + this.addSlotToContainer(new Slot(tile, tile.getSizeInventory() - 1, 214, 66)); int i; - for (i = 0; i < 3; ++i) - { - for (int j = 0; j < 9; ++j) - { - this.addSlotToContainer(new Slot(user, j + i * 9 + 9, 8 + j * 18+xInvOffset, 128 + i * 18)); + for (i = 0; i < 3; ++i) { + for (int j = 0; j < 9; ++j) { + this.addSlotToContainer(new Slot(user, j + i * 9 + 9, 8 + j * 18 + xInvOffset, 128 + i * 18)); } } - for (i = 0; i < 9; ++i) - { - this.addSlotToContainer(new Slot(user, i, 8 + i * 18+xInvOffset, 186)); + for (i = 0; i < 9; ++i) { + this.addSlotToContainer(new Slot(user, i, 8 + i * 18 + xInvOffset, 186)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - if(isGuiContainer) - { - tile.onInventoryChanged(); - } - + public void detectAndSendChanges() { + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + if (isGuiContainer) { + tile.onInventoryChanged(); + } + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) - { - int slotCount = tile.getSizeInventory(); + public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) { + int slotCount = tile.getSizeInventory(); ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(currentSlot); + Slot slot = (Slot) this.inventorySlots.get(currentSlot); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (currentSlot < slotCount) - { - if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) - { + if (currentSlot < slotCount) { + if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 0, slotCount-1, false)) - { + } else if (!this.mergeItemStack(itemstack1, 0, slotCount - 1, false)) { return null; } - if (itemstack1.stackSize <= 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize <= 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } } diff --git a/src/main/java/minefantasy/mf2/container/ContainerBigFurnace.java b/src/main/java/minefantasy/mf2/container/ContainerBigFurnace.java index aebf8d2b..8f772f91 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerBigFurnace.java +++ b/src/main/java/minefantasy/mf2/container/ContainerBigFurnace.java @@ -4,23 +4,19 @@ import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.tileentity.TileEntityBigFurnace; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotFurnace; import net.minecraft.item.ItemStack; - /** - * * @author Anonymous Productions - * - * Sources are provided for educational reasons. - * though small bits of code, or methods can be used in your own creations. + *

+ * Sources are provided for educational reasons. though small bits of + * code, or methods can be used in your own creations. */ -public class ContainerBigFurnace extends Container -{ +public class ContainerBigFurnace extends Container { public TileEntityBigFurnace smelter; public int lastProgress; public int lastFuel; @@ -28,213 +24,169 @@ public class ContainerBigFurnace extends Container public int lastHeat; public int lastMaxHeat; - public ContainerBigFurnace(EntityPlayer play, TileEntityBigFurnace tileentityfurnace) - { - lastProgress = 0; + public ContainerBigFurnace(EntityPlayer play, TileEntityBigFurnace tileentityfurnace) { + lastProgress = 0; lastFuel = 0; lastMaxFuel = 0; lastHeat = 0; lastMaxHeat = 0; smelter = tileentityfurnace; tileentityfurnace.openChest(); - - if(smelter.isHeater()) - { - addSlotToContainer(new Slot(smelter, 0, 59, 44)); - } - else - { - //IN - addSlotToContainer(new Slot(smelter, 0, 36, 26)); - addSlotToContainer(new Slot(smelter, 1, 54, 26)); - addSlotToContainer(new Slot(smelter, 2, 36, 44)); - addSlotToContainer(new Slot(smelter, 3, 54, 44)); - - //OUT - addSlotToContainer(new SlotFurnace(play, smelter, 4, 106, 26)); - addSlotToContainer(new SlotFurnace(play, smelter, 5, 124, 26)); - addSlotToContainer(new SlotFurnace(play, smelter, 6, 106, 44)); - addSlotToContainer(new SlotFurnace(play, smelter, 7, 124, 44)); + + if (smelter.isHeater()) { + addSlotToContainer(new Slot(smelter, 0, 59, 44)); + } else { + // IN + addSlotToContainer(new Slot(smelter, 0, 36, 26)); + addSlotToContainer(new Slot(smelter, 1, 54, 26)); + addSlotToContainer(new Slot(smelter, 2, 36, 44)); + addSlotToContainer(new Slot(smelter, 3, 54, 44)); + + // OUT + addSlotToContainer(new SlotFurnace(play, smelter, 4, 106, 26)); + addSlotToContainer(new SlotFurnace(play, smelter, 5, 124, 26)); + addSlotToContainer(new SlotFurnace(play, smelter, 6, 106, 44)); + addSlotToContainer(new SlotFurnace(play, smelter, 7, 124, 44)); } - - //PLAYER INV - for (int i = 0; i < 3; i++) - { - for (int k = 0; k < 9; k++) - { - addSlotToContainer(new Slot(play.inventory, k + i * 9 + 9, 8 + k * 18, 84 + i * 18)); + + // PLAYER INV + for (int i = 0; i < 3; i++) { + for (int k = 0; k < 9; k++) { + addSlotToContainer(new Slot(play.inventory, k + i * 9 + 9, 8 + k * 18, 84 + i * 18)); } } - for (int j = 0; j < 9; j++) - { - addSlotToContainer(new Slot(play.inventory, j, 8 + j * 18, 142)); + for (int j = 0; j < 9; j++) { + addSlotToContainer(new Slot(play.inventory, j, 8 + j * 18, 142)); } } @Override - public void onContainerClosed(EntityPlayer player) - { + public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); this.smelter.closeChest(); } - + @Override - public void addCraftingToCrafters(ICrafting icrafting) - { + public void addCraftingToCrafters(ICrafting icrafting) { super.addCraftingToCrafters(icrafting); icrafting.sendProgressBarUpdate(this, 0, smelter.progress); icrafting.sendProgressBarUpdate(this, 1, smelter.fuel); icrafting.sendProgressBarUpdate(this, 2, smelter.maxFuel); - icrafting.sendProgressBarUpdate(this, 3, (int)smelter.heat); - icrafting.sendProgressBarUpdate(this, 4, (int)smelter.maxHeat); + icrafting.sendProgressBarUpdate(this, 3, (int) smelter.heat); + icrafting.sendProgressBarUpdate(this, 4, (int) smelter.maxHeat); } @Override - public void 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.lastProgress != this.smelter.progress) - { + if (this.lastProgress != this.smelter.progress) { icrafting.sendProgressBarUpdate(this, 0, this.smelter.progress); } - if (this.lastFuel != this.smelter.fuel) - { + if (this.lastFuel != this.smelter.fuel) { icrafting.sendProgressBarUpdate(this, 1, this.smelter.fuel); } - if (this.lastMaxFuel != this.smelter.maxFuel) - { + if (this.lastMaxFuel != this.smelter.maxFuel) { icrafting.sendProgressBarUpdate(this, 2, this.smelter.maxFuel); } - - - if (this.lastHeat != this.smelter.heat) - { - icrafting.sendProgressBarUpdate(this, 3, (int)this.smelter.heat); + + if (this.lastHeat != this.smelter.heat) { + icrafting.sendProgressBarUpdate(this, 3, (int) this.smelter.heat); } - if (this.lastMaxHeat != this.smelter.maxHeat) - { - icrafting.sendProgressBarUpdate(this, 4, (int)this.smelter.maxHeat); + if (this.lastMaxHeat != this.smelter.maxHeat) { + icrafting.sendProgressBarUpdate(this, 4, (int) this.smelter.maxHeat); } - + } this.lastProgress = this.smelter.progress; this.lastFuel = this.smelter.fuel; this.lastMaxFuel = this.smelter.maxFuel; - this.lastHeat = (int)this.smelter.heat; - this.lastMaxHeat = (int)this.smelter.maxHeat; + this.lastHeat = (int) this.smelter.heat; + this.lastMaxHeat = (int) this.smelter.maxHeat; } @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { + public void updateProgressBar(int id, int value) { + if (id == 0) { this.smelter.progress = value; } - if (id == 1) - { + if (id == 1) { this.smelter.fuel = value; } - if (id == 2) - { + if (id == 2) { this.smelter.maxFuel = value; } - - if (id == 3) - { + + if (id == 3) { this.smelter.heat = value; } - if (id == 4) - { + if (id == 4) { this.smelter.maxHeat = value; } } - public boolean canInteractWith(EntityPlayer entityplayer) - { + public boolean canInteractWith(EntityPlayer entityplayer) { return smelter.isUseableByPlayer(entityplayer); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer player, int num) - { - int invSize = 8; - if(smelter.isHeater()) - { - invSize = 1; - } + public ItemStack transferStackInSlot(EntityPlayer player, int num) { + int invSize = 8; + if (smelter.isHeater()) { + invSize = 1; + } ItemStack placedItem = null; - Slot slot = (Slot)this.inventorySlots.get(num); + Slot slot = (Slot) this.inventorySlots.get(num); - - - - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemSlot = slot.getStack(); placedItem = itemSlot.copy(); - //Take - if (num < invSize) - { - if (!this.mergeItemStack(itemSlot, invSize, 36 + invSize, true)) - { + // Take + if (num < invSize) { + if (!this.mergeItemStack(itemSlot, invSize, 36 + invSize, true)) { return null; } slot.onSlotChange(itemSlot, placedItem); } - //Put - else - { - if(smelter.isHeater()) - { - if(smelter.isItemFuel(itemSlot)) - { - if (!this.mergeItemStack(itemSlot, 0, 1, false)) - { - return null; - } - } - } - else - { - if(smelter.getResult(itemSlot) != null) - { - if (!this.mergeItemStack(itemSlot, 0, 4, false)) - { - return null; - } - } - } + // Put + else { + if (smelter.isHeater()) { + if (smelter.isItemFuel(itemSlot)) { + if (!this.mergeItemStack(itemSlot, 0, 1, false)) { + return null; + } + } + } else { + if (smelter.getResult(itemSlot) != null) { + if (!this.mergeItemStack(itemSlot, 0, 4, false)) { + return null; + } + } + } slot.onSlotChange(itemSlot, placedItem); } - if (itemSlot.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemSlot.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemSlot.stackSize == placedItem.stackSize) - { + if (itemSlot.stackSize == placedItem.stackSize) { return null; } diff --git a/src/main/java/minefantasy/mf2/container/ContainerBlastChamber.java b/src/main/java/minefantasy/mf2/container/ContainerBlastChamber.java index 05f58090..948e1c65 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerBlastChamber.java +++ b/src/main/java/minefantasy/mf2/container/ContainerBlastChamber.java @@ -7,130 +7,101 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.tileentity.TileEntityFurnace; -public class ContainerBlastChamber extends Container -{ +public class ContainerBlastChamber extends Container { private TileEntityBlastFC tile; private boolean isGuiContainer = false; - - public ContainerBlastChamber(InventoryPlayer user, TileEntityBlastFC tile) - { - isGuiContainer = true; + + public ContainerBlastChamber(InventoryPlayer user, TileEntityBlastFC tile) { + isGuiContainer = true; this.tile = tile; - - this.addSlotToContainer(new SlotRestrictive(tile, 0, 80, 30)); - this.addSlotToContainer(new SlotRestrictive(tile, 1, 80, 68)); - + + this.addSlotToContainer(new SlotRestrictive(tile, 0, 80, 30)); + this.addSlotToContainer(new SlotRestrictive(tile, 1, 80, 68)); + 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(user, j + i * 9 + 9, 8 + j * 18, 126 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 184)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - if(isGuiContainer) - { - tile.onInventoryChanged(); - } - + public void detectAndSendChanges() { + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + if (isGuiContainer) { + tile.onInventoryChanged(); + } + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int clicked) - { + public ItemStack transferStackInSlot(EntityPlayer user, int clicked) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(clicked); - //TOTAL SLOTS: 38 = 2+27+9 - //Chamber = 0-1 - //Inv = 2-28 - //Bar = 29-47 - - if (slot != null && slot.getHasStack()) - { + Slot slot = (Slot) this.inventorySlots.get(clicked); + // TOTAL SLOTS: 38 = 2+27+9 + // Chamber = 0-1 + // Inv = 2-28 + // Bar = 29-47 + + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (clicked > 1)//INVENTORY + if (clicked > 1)// INVENTORY { - if (TileEntityBlastFC.isCarbon(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + if (TileEntityBlastFC.isCarbon(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (TileEntityBlastFC.isInput(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { + } else if (TileEntityBlastFC.isInput(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } - } - else if (clicked >= 2 && clicked < 29)//INVENTORY + } else if (clicked >= 2 && clicked < 29)// INVENTORY { - if (!this.mergeItemStack(itemstack1, 29, 38, false)) - { + if (!this.mergeItemStack(itemstack1, 29, 38, false)) { return null; } } - //BAR - else if (clicked >= 29 && clicked < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) - { + // BAR + else if (clicked >= 29 && clicked < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 2, 38, false)) - { + } else if (!this.mergeItemStack(itemstack1, 2, 38, false)) { return null; } - if (itemstack1.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } diff --git a/src/main/java/minefantasy/mf2/container/ContainerBlastHeater.java b/src/main/java/minefantasy/mf2/container/ContainerBlastHeater.java index a18fe542..6f95ea24 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerBlastHeater.java +++ b/src/main/java/minefantasy/mf2/container/ContainerBlastHeater.java @@ -9,152 +9,120 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.tileentity.TileEntityFurnace; -public class ContainerBlastHeater extends Container -{ +public class ContainerBlastHeater extends Container { private TileEntityBlastFH tile; private boolean isGuiContainer = false; private int lastFuel; private int lastFuelMax; - - public ContainerBlastHeater(InventoryPlayer user, TileEntityBlastFH tile) - { - isGuiContainer = true; + + public ContainerBlastHeater(InventoryPlayer user, TileEntityBlastFH tile) { + isGuiContainer = true; this.tile = tile; - - this.addSlotToContainer(new Slot(tile, 0, 80, 76)); - + + this.addSlotToContainer(new Slot(tile, 0, 80, 76)); + 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(user, j + i * 9 + 9, 8 + j * 18, 126 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 184)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); + public void detectAndSendChanges() { + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); - if (this.lastFuel != tile.fuel) - { + if (this.lastFuel != tile.fuel) { icrafting.sendProgressBarUpdate(this, 0, tile.fuel); } - if (this.lastFuelMax != tile.maxFuel) - { + if (this.lastFuelMax != tile.maxFuel) { icrafting.sendProgressBarUpdate(this, 1, tile.maxFuel); } } - this.lastFuel = tile.fuel; + this.lastFuel = tile.fuel; this.lastFuelMax = tile.maxFuel; - - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - if(isGuiContainer) - { - tile.onInventoryChanged(); - } - + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + if (isGuiContainer) { + tile.onInventoryChanged(); + } + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { + public void updateProgressBar(int id, int value) { + if (id == 0) { tile.fuel = value; } - if (id == 1) - { + if (id == 1) { tile.maxFuel = value; } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int clicked) - { + public ItemStack transferStackInSlot(EntityPlayer user, int clicked) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(clicked); + Slot slot = (Slot) this.inventorySlots.get(clicked); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (clicked > 0)//INVENTORY + if (clicked > 0)// INVENTORY { - if (TileEntityBlastFH.isFuel(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + if (TileEntityBlastFH.isFuel(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (clicked >= 1 && clicked < 28)//INVENTORY + } else if (clicked >= 1 && clicked < 28)// INVENTORY { - if (!this.mergeItemStack(itemstack1, 28, 37, false)) - { + if (!this.mergeItemStack(itemstack1, 28, 37, false)) { return null; } } - //BAR - else if (clicked >= 28 && clicked < 37 && !this.mergeItemStack(itemstack1, 1, 28, false)) - { + // BAR + else if (clicked >= 28 && clicked < 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) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } diff --git a/src/main/java/minefantasy/mf2/container/ContainerBloomery.java b/src/main/java/minefantasy/mf2/container/ContainerBloomery.java index 96670e5e..32962407 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerBloomery.java +++ b/src/main/java/minefantasy/mf2/container/ContainerBloomery.java @@ -8,124 +8,97 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -public class ContainerBloomery extends Container -{ +public class ContainerBloomery extends Container { private TileEntityBloomery tile; private boolean isGuiContainer = false; - - public ContainerBloomery(InventoryPlayer user, TileEntityBloomery tile) - { - isGuiContainer = true; + + public ContainerBloomery(InventoryPlayer user, TileEntityBloomery tile) { + isGuiContainer = true; this.tile = tile; - - this.addSlotToContainer(new SlotRestrictive(tile, 0, 80, 30)); - this.addSlotToContainer(new SlotRestrictive(tile, 1, 80, 68)); - + + this.addSlotToContainer(new SlotRestrictive(tile, 0, 80, 30)); + this.addSlotToContainer(new SlotRestrictive(tile, 1, 80, 68)); + 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(user, j + i * 9 + 9, 8 + j * 18, 126 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 184)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { + public void detectAndSendChanges() { + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int clicked) - { + public ItemStack transferStackInSlot(EntityPlayer user, int clicked) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(clicked); - //TOTAL SLOTS: 38 = 2+27+9 - //Chamber = 0-1 - //Inv = 2-28 - //Bar = 29-47 - - if (slot != null && slot.getHasStack()) - { + Slot slot = (Slot) this.inventorySlots.get(clicked); + // TOTAL SLOTS: 38 = 2+27+9 + // Chamber = 0-1 + // Inv = 2-28 + // Bar = 29-47 + + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (clicked > 1)//INVENTORY + if (clicked > 1)// INVENTORY { - if (TileEntityBloomery.isInput(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + if (TileEntityBloomery.isInput(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (TileEntityBlastFC.isCarbon(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { + } else if (TileEntityBlastFC.isCarbon(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } - } - else if (clicked >= 2 && clicked < 29)//INVENTORY + } else if (clicked >= 2 && clicked < 29)// INVENTORY { - if (!this.mergeItemStack(itemstack1, 29, 38, false)) - { + if (!this.mergeItemStack(itemstack1, 29, 38, false)) { return null; } } - //BAR - else if (clicked >= 29 && clicked < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) - { + // BAR + else if (clicked >= 29 && clicked < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 2, 38, false)) - { + } else if (!this.mergeItemStack(itemstack1, 2, 38, false)) { return null; } - if (itemstack1.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } diff --git a/src/main/java/minefantasy/mf2/container/ContainerBombBench.java b/src/main/java/minefantasy/mf2/container/ContainerBombBench.java index e4370669..38c52257 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerBombBench.java +++ b/src/main/java/minefantasy/mf2/container/ContainerBombBench.java @@ -7,157 +7,123 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.tileentity.TileEntityFurnace; -public class ContainerBombBench extends Container -{ +public class ContainerBombBench extends Container { private TileEntityBombBench tile; private boolean isGuiContainer = false; - - public ContainerBombBench(InventoryPlayer user, TileEntityBombBench tile) - { - isGuiContainer = true; + + public ContainerBombBench(InventoryPlayer user, TileEntityBombBench tile) { + isGuiContainer = true; this.tile = tile; - + this.addSlotToContainer(new SlotBombBench("case", tile, 0, 77, 74)); - this.addSlotToContainer(new SlotBombBench("powder", tile, 1, 77, 48)); - this.addSlotToContainer(new SlotBombBench("filling", tile, 2, 52, 23)); - this.addSlotToContainer(new SlotBombBench("fuse", tile, 3, 102, 23)); - this.addSlotToContainer(new SlotBombBench("bomb", tile, 4, 147, 48)); - this.addSlotToContainer(new SlotBombBench("misc", tile, 5, 147, 75)); - + this.addSlotToContainer(new SlotBombBench("powder", tile, 1, 77, 48)); + this.addSlotToContainer(new SlotBombBench("filling", tile, 2, 52, 23)); + this.addSlotToContainer(new SlotBombBench("fuse", tile, 3, 102, 23)); + this.addSlotToContainer(new SlotBombBench("bomb", tile, 4, 147, 48)); + this.addSlotToContainer(new SlotBombBench("misc", tile, 5, 147, 75)); + 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(user, j + i * 9 + 9, 8 + j * 18, 126 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 184)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - if(isGuiContainer) - { - tile.onInventoryChanged(); - } - + public void detectAndSendChanges() { + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + if (isGuiContainer) { + tile.onInventoryChanged(); + } + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int clicked) - { + public ItemStack transferStackInSlot(EntityPlayer user, int clicked) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(clicked); - //TOTAL SLOTS: 41 = 5+27+9 - //Bomb = 0-4 - //Inv = 5-31 - //Bar = 32-40 - - if (slot != null && slot.getHasStack()) - { + Slot slot = (Slot) this.inventorySlots.get(clicked); + // TOTAL SLOTS: 41 = 5+27+9 + // Bomb = 0-4 + // Inv = 5-31 + // Bar = 32-40 + + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (clicked == 4)//OUTPUT + if (clicked == 4)// OUTPUT { - if (!this.mergeItemStack(itemstack1, 5, 41, true)) - { + if (!this.mergeItemStack(itemstack1, 5, 41, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); - } - else if (clicked > 4)//INVENTORY + } else if (clicked > 4)// INVENTORY { - if (TileEntityBombBench.isMatch(itemstack1, "bolt") || TileEntityBombBench.isMatch(itemstack1, "arrow") || TileEntityBombBench.isMatch(itemstack1, "bombcase") || TileEntityBombBench.isMatch(itemstack1, "minecase")) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + if (TileEntityBombBench.isMatch(itemstack1, "bolt") || TileEntityBombBench.isMatch(itemstack1, "arrow") + || TileEntityBombBench.isMatch(itemstack1, "bombcase") + || TileEntityBombBench.isMatch(itemstack1, "minecase")) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (TileEntityBombBench.isMatch(itemstack1, "powder")) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { + } else if (TileEntityBombBench.isMatch(itemstack1, "powder")) { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } - } - else if (TileEntityBombBench.isMatch(itemstack1, "filling")) - { - if (!this.mergeItemStack(itemstack1, 2, 3, false)) - { + } else if (TileEntityBombBench.isMatch(itemstack1, "filling")) { + if (!this.mergeItemStack(itemstack1, 2, 3, false)) { return null; } - } - else if (TileEntityBombBench.isMatch(itemstack1, "fuse")) - { - if (!this.mergeItemStack(itemstack1, 3, 4, false)) - { + } else if (TileEntityBombBench.isMatch(itemstack1, "fuse")) { + if (!this.mergeItemStack(itemstack1, 3, 4, false)) { return null; } - } - else if (clicked >= 5 && clicked < 32)//INVENTORY + } else if (clicked >= 5 && clicked < 32)// INVENTORY { - if (!this.mergeItemStack(itemstack1, 32, 41, false)) - { + if (!this.mergeItemStack(itemstack1, 32, 41, false)) { return null; } } - //BAR - else if (clicked >= 32 && clicked < 41 && !this.mergeItemStack(itemstack1, 5, 32, false)) - { + // BAR + else if (clicked >= 32 && clicked < 41 && !this.mergeItemStack(itemstack1, 5, 32, false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 5, 41, false))//BOMB INVENTORY + } else if (!this.mergeItemStack(itemstack1, 5, 41, false))// BOMB INVENTORY { return null; } - if (itemstack1.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } diff --git a/src/main/java/minefantasy/mf2/container/ContainerCarpenterMF.java b/src/main/java/minefantasy/mf2/container/ContainerCarpenterMF.java index 6576f2d5..60e1f58b 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerCarpenterMF.java +++ b/src/main/java/minefantasy/mf2/container/ContainerCarpenterMF.java @@ -8,133 +8,106 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerCarpenterMF extends Container -{ +public class ContainerCarpenterMF extends Container { private TileEntityCarpenterMF tile; private boolean isGuiContainer = false; - - public ContainerCarpenterMF(TileEntityCarpenterMF tile) - { - isGuiContainer = false; - this.tile = tile; + + public ContainerCarpenterMF(TileEntityCarpenterMF tile) { + isGuiContainer = false; + this.tile = tile; int width = tile.width; int height = tile.height; - for(int x = 0; x < width; x ++) - { - for (int y = 0; y < height; y ++) - { - int slot = y*width+x; - this.addSlotToContainer(new Slot(tile, slot, 44 + x * 18, 54 + y * 18)); - } + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + int slot = y * width + x; + this.addSlotToContainer(new Slot(tile, slot, 44 + x * 18, 54 + y * 18)); + } + } + this.addSlotToContainer(new Slot(tile, tile.getSizeInventory() - 5, 174, 80)); + for (int y = 0; y < 4; y++) { + int slot = tile.getSizeInventory() - 4 + y; + this.addSlotToContainer(new Slot(tile, slot, 3, 54 + y * 18)); } - this.addSlotToContainer(new Slot(tile, tile.getSizeInventory()-5, 174, 80)); - for (int y = 0; y < 4; y ++) - { - int slot = tile.getSizeInventory()-4 + y; - this.addSlotToContainer(new Slot(tile, slot, 3, 54 + y * 18)); - } } - - public ContainerCarpenterMF(InventoryPlayer user, TileEntityCarpenterMF tile) - { - isGuiContainer = true; + + public ContainerCarpenterMF(InventoryPlayer user, TileEntityCarpenterMF tile) { + isGuiContainer = true; this.tile = tile; int width = tile.width; int height = tile.height; - - for(int x = 0; x < width; x ++) - { - for (int y = 0; y < height; y ++) - { - int slot = y*width+x; - this.addSlotToContainer(new Slot(tile, slot, 44 + x * 18, 54 + y * 18)); - } + + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + int slot = y * width + x; + this.addSlotToContainer(new Slot(tile, slot, 44 + x * 18, 54 + y * 18)); + } + } + this.addSlotToContainer(new Slot(tile, tile.getSizeInventory() - 5, 174, 80)); + for (int y = 0; y < 4; y++) { + int slot = tile.getSizeInventory() - 4 + y; + this.addSlotToContainer(new Slot(tile, slot, 3, 54 + y * 18)); } - this.addSlotToContainer(new Slot(tile, tile.getSizeInventory()-5, 174, 80)); - for (int y = 0; y < 4; y ++) - { - int slot = tile.getSizeInventory()-4 + y; - this.addSlotToContainer(new Slot(tile, slot, 3, 54 + y * 18)); - } - + 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(user, j + i * 9 + 9, 8 + j * 18, 158 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 216)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - if(isGuiContainer) - { - tile.onInventoryChanged(); - } - + public void detectAndSendChanges() { + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + if (isGuiContainer) { + tile.onInventoryChanged(); + } + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) - { - int slotCount = tile.getSizeInventory(); + public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) { + int slotCount = tile.getSizeInventory(); ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(currentSlot); + Slot slot = (Slot) this.inventorySlots.get(currentSlot); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (currentSlot < slotCount) - { - if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) - { + if (currentSlot < slotCount) { + if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 0, slotCount-5, false)) - { + } else if (!this.mergeItemStack(itemstack1, 0, slotCount - 5, false)) { return null; } - if (itemstack1.stackSize <= 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize <= 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } } diff --git a/src/main/java/minefantasy/mf2/container/ContainerCrossbowBench.java b/src/main/java/minefantasy/mf2/container/ContainerCrossbowBench.java index 7b5350bb..316e33c6 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerCrossbowBench.java +++ b/src/main/java/minefantasy/mf2/container/ContainerCrossbowBench.java @@ -7,156 +7,120 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.tileentity.TileEntityFurnace; -public class ContainerCrossbowBench extends Container -{ +public class ContainerCrossbowBench extends Container { private TileEntityCrossbowBench tile; private boolean isGuiContainer = false; - - public ContainerCrossbowBench(InventoryPlayer user, TileEntityCrossbowBench tile) - { - isGuiContainer = true; + + public ContainerCrossbowBench(InventoryPlayer user, TileEntityCrossbowBench tile) { + isGuiContainer = true; this.tile = tile; - + this.addSlotToContainer(new SlotRestrictive(tile, 0, 77, 74)); - this.addSlotToContainer(new SlotRestrictive(tile, 1, 77, 48)); - this.addSlotToContainer(new SlotRestrictive(tile, 2, 52, 48)); - this.addSlotToContainer(new SlotRestrictive(tile, 3, 100, 30)); - this.addSlotToContainer(new SlotRestrictive(tile, 4, 147, 48)); - + this.addSlotToContainer(new SlotRestrictive(tile, 1, 77, 48)); + this.addSlotToContainer(new SlotRestrictive(tile, 2, 52, 48)); + this.addSlotToContainer(new SlotRestrictive(tile, 3, 100, 30)); + this.addSlotToContainer(new SlotRestrictive(tile, 4, 147, 48)); + 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(user, j + i * 9 + 9, 8 + j * 18, 126 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 184)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - if(isGuiContainer) - { - tile.onInventoryChanged(); - } - + public void detectAndSendChanges() { + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + if (isGuiContainer) { + tile.onInventoryChanged(); + } + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int clicked) - { + public ItemStack transferStackInSlot(EntityPlayer user, int clicked) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(clicked); - //TOTAL SLOTS: 41 = 5+27+9 - //Crossbow = 0-4 - //Inv = 5-31 - //Bar = 32-40 - - if (slot != null && slot.getHasStack()) - { + Slot slot = (Slot) this.inventorySlots.get(clicked); + // TOTAL SLOTS: 41 = 5+27+9 + // Crossbow = 0-4 + // Inv = 5-31 + // Bar = 32-40 + + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (clicked == 4)//OUTPUT + if (clicked == 4)// OUTPUT { - if (!this.mergeItemStack(itemstack1, 5, 41, true)) - { + if (!this.mergeItemStack(itemstack1, 5, 41, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); - } - else if (clicked > 4)//INVENTORY + } else if (clicked > 4)// INVENTORY { - if (TileEntityCrossbowBench.isMatch(itemstack1, "stock")) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + if (TileEntityCrossbowBench.isMatch(itemstack1, "stock")) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (TileEntityCrossbowBench.isMatch(itemstack1, "mechanism")) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { + } else if (TileEntityCrossbowBench.isMatch(itemstack1, "mechanism")) { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } - } - else if (TileEntityCrossbowBench.isMatch(itemstack1, "mod")) - { - if (!this.mergeItemStack(itemstack1, 2, 3, false)) - { + } else if (TileEntityCrossbowBench.isMatch(itemstack1, "mod")) { + if (!this.mergeItemStack(itemstack1, 2, 3, false)) { return null; } - } - else if (TileEntityCrossbowBench.isMatch(itemstack1, "muzzle")) - { - if (!this.mergeItemStack(itemstack1, 3, 4, false)) - { + } else if (TileEntityCrossbowBench.isMatch(itemstack1, "muzzle")) { + if (!this.mergeItemStack(itemstack1, 3, 4, false)) { return null; } - } - else if (clicked >= 5 && clicked < 32)//INVENTORY + } else if (clicked >= 5 && clicked < 32)// INVENTORY { - if (!this.mergeItemStack(itemstack1, 32, 41, false)) - { + if (!this.mergeItemStack(itemstack1, 32, 41, false)) { return null; } } - //BAR - else if (clicked >= 32 && clicked < 41 && !this.mergeItemStack(itemstack1, 5, 32, false)) - { + // BAR + else if (clicked >= 32 && clicked < 41 && !this.mergeItemStack(itemstack1, 5, 32, false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 5, 41, false))//BOMB INVENTORY + } else if (!this.mergeItemStack(itemstack1, 5, 41, false))// BOMB INVENTORY { return null; } - if (itemstack1.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } diff --git a/src/main/java/minefantasy/mf2/container/ContainerCrucible.java b/src/main/java/minefantasy/mf2/container/ContainerCrucible.java index b288f47f..2fdba1df 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerCrucible.java +++ b/src/main/java/minefantasy/mf2/container/ContainerCrucible.java @@ -10,144 +10,115 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerCrucible extends Container -{ +public class ContainerCrucible extends Container { private TileEntityCrucible tile; private int lastProgress; private int lastProgressMax; private int lastTemp; - - public ContainerCrucible(InventoryPlayer user, TileEntityCrucible tile) - { + + public ContainerCrucible(InventoryPlayer user, TileEntityCrucible tile) { this.tile = tile; int width = 3; int height = 3; - - for(int x = 0; x < width; x ++) - { - for (int y = 0; y < height; y ++) - { - int slot = y*width+x; - this.addSlotToContainer(new Slot(tile, slot, 62 + x * 18, 14 + y * 18)); - } + + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + int slot = y * width + x; + this.addSlotToContainer(new Slot(tile, slot, 62 + x * 18, 14 + y * 18)); + } } - this.addSlotToContainer(new SlotCrucibleOut(tile, tile.getSizeInventory()-1, 129, 32)); + this.addSlotToContainer(new SlotCrucibleOut(tile, tile.getSizeInventory() - 1, 129, 32)); 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(user, j + i * 9 + 9, 8 + j * 18, 104 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 162)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); - - if (this.lastProgress != (int)tile.progress) - { - icrafting.sendProgressBarUpdate(this, 0, (int)tile.progress); + public void detectAndSendChanges() { + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); + + if (this.lastProgress != (int) tile.progress) { + icrafting.sendProgressBarUpdate(this, 0, (int) tile.progress); } - if (this.lastProgressMax != (int)tile.progressMax) - { - icrafting.sendProgressBarUpdate(this, 1, (int)tile.progressMax); + if (this.lastProgressMax != (int) tile.progressMax) { + icrafting.sendProgressBarUpdate(this, 1, (int) tile.progressMax); } - if (this.lastTemp != (int)tile.temperature) - { - icrafting.sendProgressBarUpdate(this, 2, (int)tile.temperature); + if (this.lastTemp != (int) tile.temperature) { + icrafting.sendProgressBarUpdate(this, 2, (int) tile.temperature); } } - this.lastProgress = (int)tile.progress; - this.lastProgressMax = (int)tile.progressMax; - this.lastTemp = (int)tile.temperature; - - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - tile.onInventoryChanged(); - + this.lastProgress = (int) tile.progress; + this.lastProgressMax = (int) tile.progressMax; + this.lastTemp = (int) tile.temperature; + + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + tile.onInventoryChanged(); + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { + public void updateProgressBar(int id, int value) { + if (id == 0) { tile.progress = value; } - if (id == 1) - { + if (id == 1) { tile.progressMax = value; } - - if (id == 2) - { + + if (id == 2) { tile.temperature = value; } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) - { - int slotCount = tile.getSizeInventory(); + public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) { + int slotCount = tile.getSizeInventory(); ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(currentSlot); + Slot slot = (Slot) this.inventorySlots.get(currentSlot); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (currentSlot < slotCount) - { - if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) - { + if (currentSlot < slotCount) { + if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 0, slotCount-1, false)) - { + } else if (!this.mergeItemStack(itemstack1, 0, slotCount - 1, false)) { return null; } - if (itemstack1.stackSize <= 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize <= 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } } diff --git a/src/main/java/minefantasy/mf2/container/ContainerForge.java b/src/main/java/minefantasy/mf2/container/ContainerForge.java index feff900c..b9862b80 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerForge.java +++ b/src/main/java/minefantasy/mf2/container/ContainerForge.java @@ -10,159 +10,131 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerForge extends Container -{ +public class ContainerForge extends Container { private TileEntityForge tile; private int lastTemp; - - public ContainerForge(InventoryPlayer user, TileEntityForge tile) - { + + public ContainerForge(InventoryPlayer user, TileEntityForge tile) { this.tile = tile; int width = 3; int height = 3; - - this.addSlotToContainer(new Slot(tile, 0, 70 + 18, 14 + 18)); + + this.addSlotToContainer(new Slot(tile, 0, 70 + 18, 14 + 18)); 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(user, j + i * 9 + 9, 8 + j * 18, 93 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 151)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); - - if (this.lastTemp != (int)tile.temperature) - { - icrafting.sendProgressBarUpdate(this, 0, (int)tile.temperature); + public void detectAndSendChanges() { + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); + + if (this.lastTemp != (int) tile.temperature) { + icrafting.sendProgressBarUpdate(this, 0, (int) tile.temperature); } } - this.lastTemp = (int)tile.temperature; - - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - tile.onInventoryChanged(); - + this.lastTemp = (int) tile.temperature; + + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + tile.onInventoryChanged(); + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { + public void updateProgressBar(int id, int value) { + if (id == 0) { tile.temperature = value; } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) - { - int slotCount = tile.getSizeInventory(); + public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) { + int slotCount = tile.getSizeInventory(); ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(currentSlot); + Slot slot = (Slot) this.inventorySlots.get(currentSlot); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (currentSlot < slotCount) - { - if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) - { + if (currentSlot < slotCount) { + if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) { return null; } - } - else if (!this.mergeItemStack(true, itemstack1, 0, slotCount, false)) - { + } else if (!this.mergeItemStack(true, itemstack1, 0, slotCount, false)) { return null; } - if (itemstack1.stackSize <= 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize <= 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } } return itemstack; } - + @Override - protected boolean mergeItemStack(ItemStack item, int minSlot, int maxSlot, boolean goBackwards) - { - return mergeItemStack(true, item, minSlot, maxSlot, goBackwards); + protected boolean mergeItemStack(ItemStack item, int minSlot, int maxSlot, boolean goBackwards) { + return mergeItemStack(true, item, minSlot, maxSlot, goBackwards); } - protected boolean mergeItemStack(boolean allowStack, ItemStack item, int minSlot, int maxSlot, boolean goBackwards) - { + + protected boolean mergeItemStack(boolean allowStack, ItemStack item, int minSlot, int maxSlot, + boolean goBackwards) { boolean flag1 = false; int k = minSlot; - if (goBackwards) - { + if (goBackwards) { k = maxSlot - 1; } Slot slot; ItemStack itemstack1; - if (allowStack && item.isStackable()) - { - while (item.stackSize > 0 && (!goBackwards && k < maxSlot || goBackwards && k >= minSlot)) - { - slot = (Slot)this.inventorySlots.get(k); + if (allowStack && item.isStackable()) { + while (item.stackSize > 0 && (!goBackwards && k < maxSlot || goBackwards && k >= minSlot)) { + slot = (Slot) this.inventorySlots.get(k); itemstack1 = slot.getStack(); - if (itemstack1 != null && itemstack1.getItem() == item.getItem() && (!item.getHasSubtypes() || item.getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(item, itemstack1)) - { + if (itemstack1 != null && itemstack1.getItem() == item.getItem() + && (!item.getHasSubtypes() || item.getItemDamage() == itemstack1.getItemDamage()) + && ItemStack.areItemStackTagsEqual(item, itemstack1)) { int l = itemstack1.stackSize + item.stackSize; - if (l <= item.getMaxStackSize()) - { + if (l <= item.getMaxStackSize()) { item.stackSize = 0; itemstack1.stackSize = l; slot.onSlotChanged(); flag1 = true; - } - else if (itemstack1.stackSize < item.getMaxStackSize()) - { + } else if (itemstack1.stackSize < item.getMaxStackSize()) { item.stackSize -= item.getMaxStackSize() - itemstack1.stackSize; itemstack1.stackSize = item.getMaxStackSize(); slot.onSlotChanged(); @@ -170,37 +142,28 @@ else if (itemstack1.stackSize < item.getMaxStackSize()) } } - if (goBackwards) - { + if (goBackwards) { --k; - } - else - { + } else { ++k; } } } - if (item.stackSize > 0) - { - if (goBackwards) - { + if (item.stackSize > 0) { + if (goBackwards) { k = maxSlot - 1; - } - else - { + } else { k = minSlot; } - while (!goBackwards && k < maxSlot || goBackwards && k >= minSlot) - { - slot = (Slot)this.inventorySlots.get(k); + while (!goBackwards && k < maxSlot || goBackwards && k >= minSlot) { + slot = (Slot) this.inventorySlots.get(k); itemstack1 = slot.getStack(); - if (itemstack1 == null) - { - ItemStack i2 = item.copy(); - i2.stackSize = 1; + if (itemstack1 == null) { + ItemStack i2 = item.copy(); + i2.stackSize = 1; slot.putStack(i2); slot.onSlotChanged(); item.stackSize--; @@ -208,12 +171,9 @@ else if (itemstack1.stackSize < item.getMaxStackSize()) break; } - if (goBackwards) - { + if (goBackwards) { --k; - } - else - { + } else { ++k; } } diff --git a/src/main/java/minefantasy/mf2/container/ContainerQuern.java b/src/main/java/minefantasy/mf2/container/ContainerQuern.java index eead2e64..82a38044 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerQuern.java +++ b/src/main/java/minefantasy/mf2/container/ContainerQuern.java @@ -1,110 +1,86 @@ package minefantasy.mf2.container; import minefantasy.mf2.block.tileentity.TileEntityQuern; -import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFC; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -public class ContainerQuern extends Container -{ +public class ContainerQuern extends Container { private TileEntityQuern tile; private boolean isGuiContainer = false; - - public ContainerQuern(InventoryPlayer user, TileEntityQuern tile) - { - isGuiContainer = true; + + public ContainerQuern(InventoryPlayer user, TileEntityQuern tile) { + isGuiContainer = true; this.tile = tile; - - this.addSlotToContainer(new SlotRestrictive(tile, 0, 81, 9)); - this.addSlotToContainer(new SlotRestrictive(tile, 1, 81, 32)); - this.addSlotToContainer(new SlotRestrictive(tile, 2, 81, 55)); - + + this.addSlotToContainer(new SlotRestrictive(tile, 0, 81, 9)); + this.addSlotToContainer(new SlotRestrictive(tile, 1, 81, 32)); + this.addSlotToContainer(new SlotRestrictive(tile, 2, 81, 55)); + 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(user, j + i * 9 + 9, 8 + j * 18, 93 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 151)); } } + @Override - public boolean canInteractWith(EntityPlayer user) - { + public boolean canInteractWith(EntityPlayer user) { return this.tile.isUseableByPlayer(user); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int clicked) - { + public ItemStack transferStackInSlot(EntityPlayer user, int clicked) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(clicked); - //TOTAL SLOTS: 39 = 3+27+9 - //Chamber = 0-2 - //Inv = 2-28 - //Bar = 29-47 + Slot slot = (Slot) this.inventorySlots.get(clicked); + // TOTAL SLOTS: 39 = 3+27+9 + // Chamber = 0-2 + // Inv = 2-28 + // Bar = 29-47 - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (clicked > 2)//INVENTORY + if (clicked > 2)// INVENTORY { - if (TileEntityQuern.isInput(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + if (TileEntityQuern.isInput(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (TileEntityQuern.isPot(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { + } else if (TileEntityQuern.isPot(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } - } - else if (clicked >= 3 && clicked < 30)//INVENTORY + } else if (clicked >= 3 && clicked < 30)// INVENTORY { - if (!this.mergeItemStack(itemstack1, 30, 39, false)) - { + if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } } - //BAR - else if (clicked >= 30 && clicked < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) - { + // BAR + else if (clicked >= 30 && clicked < 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) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } diff --git a/src/main/java/minefantasy/mf2/container/ContainerReload.java b/src/main/java/minefantasy/mf2/container/ContainerReload.java index 12741860..b30ddcff 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerReload.java +++ b/src/main/java/minefantasy/mf2/container/ContainerReload.java @@ -3,7 +3,6 @@ import minefantasy.mf2.api.archery.AmmoMechanicsMF; import minefantasy.mf2.api.archery.IAmmo; import minefantasy.mf2.api.archery.IFirearm; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -12,116 +11,95 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerReload extends Container -{ +public class ContainerReload extends Container { private InventoryBasic weaponInv; private ItemStack weapon; - public ContainerReload(InventoryPlayer user, ItemStack weapon) - { + private ItemStack previousAmmo; + + public ContainerReload(InventoryPlayer user, ItemStack weapon) { this.weapon = weapon; weaponInv = new InventoryBasic("reload", false, 1); weaponInv.setInventorySlotContents(0, AmmoMechanicsMF.getAmmo(weapon)); - this.addSlotToContainer(new SlotReload(this, weaponInv, 0, 79, 11)); - + this.addSlotToContainer(new SlotReload(this, weaponInv, 0, 79, 11)); + 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(user, j + i * 9 + 9, 8 + j * 18, 66 + i * 18)); } } - for (i = 0; i < 9; ++i) - { - if(i != user.currentItem) - { - this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 124)); - } + for (i = 0; i < 9; ++i) { + if (i != user.currentItem) { + this.addSlotToContainer(new Slot(user, i, 8 + i * 18, 124)); + } } } @Override - public ItemStack slotClick(int p_75144_1_, int p_75144_2_, int p_75144_3_, EntityPlayer p_75144_4_) - { - ItemStack result = super.slotClick(p_75144_1_, p_75144_2_, p_75144_3_, p_75144_4_); - - ItemStack ammo = weaponInv.getStackInSlot(0); - AmmoMechanicsMF.setAmmo(weapon, ammo); - - return result; + public ItemStack slotClick(int p_75144_1_, int p_75144_2_, int p_75144_3_, EntityPlayer p_75144_4_) { + ItemStack result = super.slotClick(p_75144_1_, p_75144_2_, p_75144_3_, p_75144_4_); + + ItemStack ammo = weaponInv.getStackInSlot(0); + AmmoMechanicsMF.setAmmo(weapon, ammo); + + return result; } + @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { + public void detectAndSendChanges() { + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } previousAmmo = weaponInv.getStackInSlot(0); } - private ItemStack previousAmmo; + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int clicked) - { + public ItemStack transferStackInSlot(EntityPlayer user, int clicked) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(clicked); + Slot slot = (Slot) this.inventorySlots.get(clicked); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (clicked > 0)//INVENTORY + if (clicked > 0)// INVENTORY { - if (canAccept(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + if (canAccept(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (clicked >= 1 && clicked < 27)//INVENTORY + } else if (clicked >= 1 && clicked < 27)// INVENTORY { - if (!this.mergeItemStack(itemstack1, 27, 36, false)) - { + if (!this.mergeItemStack(itemstack1, 27, 36, false)) { return null; } } - //BAR - else if (clicked >= 27 && clicked < 36 && !this.mergeItemStack(itemstack1, 1, 27, false)) - { + // BAR + else if (clicked >= 27 && clicked < 36 && !this.mergeItemStack(itemstack1, 1, 27, false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 1, 36, false)) - { + } else if (!this.mergeItemStack(itemstack1, 1, 36, false)) { return null; } - if (itemstack1.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } @@ -131,24 +109,21 @@ else if (!this.mergeItemStack(itemstack1, 1, 36, false)) return itemstack; } - public boolean canAccept(ItemStack ammo) - { - String ammoType = "null"; - if(ammo != null && ammo.getItem() instanceof IAmmo) - { - ammoType = ((IAmmo)ammo.getItem()).getAmmoType(ammo); - } - - if(weapon != null && weapon.getItem() instanceof IFirearm) - { - return ((IFirearm)weapon.getItem()).canAcceptAmmo(weapon, ammoType); - } - - return ammoType.equalsIgnoreCase("arrow"); - } - - @Override - public boolean canInteractWith(EntityPlayer user) { - return true; - } + public boolean canAccept(ItemStack ammo) { + String ammoType = "null"; + if (ammo != null && ammo.getItem() instanceof IAmmo) { + ammoType = ((IAmmo) ammo.getItem()).getAmmoType(ammo); + } + + if (weapon != null && weapon.getItem() instanceof IFirearm) { + return ((IFirearm) weapon.getItem()).canAcceptAmmo(weapon, ammoType); + } + + return ammoType.equalsIgnoreCase("arrow"); + } + + @Override + public boolean canInteractWith(EntityPlayer user) { + return true; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/container/ContainerResearch.java b/src/main/java/minefantasy/mf2/container/ContainerResearch.java index 1aac627f..e6a30313 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerResearch.java +++ b/src/main/java/minefantasy/mf2/container/ContainerResearch.java @@ -10,125 +10,99 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerResearch extends Container -{ +public class ContainerResearch extends Container { private TileEntityResearch tile; private boolean isGuiContainer = false; private int lastProgress; private int lastProgressMax; - - public ContainerResearch(InventoryPlayer user, TileEntityResearch tile) - { - isGuiContainer = true; + + public ContainerResearch(InventoryPlayer user, TileEntityResearch tile) { + isGuiContainer = true; this.tile = tile; - - this.addSlotToContainer(new Slot(tile, 0, 83, 40)); - + + this.addSlotToContainer(new Slot(tile, 0, 83, 40)); + 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(user, j + i * 9 + 9, 10 + j * 18, 76 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(user, i, 10 + i * 18, 134)); } } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); + public void detectAndSendChanges() { + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); - if (this.lastProgress != tile.progress) - { - icrafting.sendProgressBarUpdate(this, 0, (int)tile.progress); + if (this.lastProgress != tile.progress) { + icrafting.sendProgressBarUpdate(this, 0, (int) tile.progress); } - if (this.lastProgressMax != tile.maxProgress) - { - icrafting.sendProgressBarUpdate(this, 1, (int)tile.maxProgress); + if (this.lastProgressMax != tile.maxProgress) { + icrafting.sendProgressBarUpdate(this, 1, (int) tile.maxProgress); } } - this.lastProgress = (int)tile.progress; - this.lastProgressMax = (int)tile.maxProgress; + this.lastProgress = (int) tile.progress; + this.lastProgressMax = (int) tile.maxProgress; } - + @Override @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { + public void updateProgressBar(int id, int value) { + if (id == 0) { tile.progress = value; } - if (id == 1) - { + if (id == 1) { tile.maxProgress = value; } } - + @Override - public boolean canInteractWith(EntityPlayer user) - { + public boolean canInteractWith(EntityPlayer user) { return this.tile.isUseableByPlayer(user); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int clicked) - { + public ItemStack transferStackInSlot(EntityPlayer user, int clicked) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(clicked); + Slot slot = (Slot) this.inventorySlots.get(clicked); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (clicked > 0)//INVENTORY + if (clicked > 0)// INVENTORY { - if (TileEntityResearch.canAccept(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + if (TileEntityResearch.canAccept(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (clicked >= 1 && clicked < 28)//INVENTORY + } else if (clicked >= 1 && clicked < 28)// INVENTORY { - if (!this.mergeItemStack(itemstack1, 28, 37, false)) - { + if (!this.mergeItemStack(itemstack1, 28, 37, false)) { return null; } } - //BAR - else if (clicked >= 28 && clicked < 37 && !this.mergeItemStack(itemstack1, 1, 28, false)) - { + // BAR + else if (clicked >= 28 && clicked < 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) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } diff --git a/src/main/java/minefantasy/mf2/container/ContainerRoast.java b/src/main/java/minefantasy/mf2/container/ContainerRoast.java index 60920a06..261c16d7 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerRoast.java +++ b/src/main/java/minefantasy/mf2/container/ContainerRoast.java @@ -9,108 +9,86 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerRoast extends Container -{ +public class ContainerRoast extends Container { private TileEntityRoast tile; private int lastProgress; private int lastProgressMax; - - public ContainerRoast(TileEntityRoast tile) - { + + public ContainerRoast(TileEntityRoast tile) { this.tile = tile; this.addSlotToContainer(new Slot(tile, 0, 0, 0)); } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); - - if (this.lastProgress != (int)tile.progress) - { - icrafting.sendProgressBarUpdate(this, 0, (int)tile.progress); + public void detectAndSendChanges() { + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); + + if (this.lastProgress != (int) tile.progress) { + icrafting.sendProgressBarUpdate(this, 0, (int) tile.progress); } - if (this.lastProgressMax != (int)tile.maxProgress) - { - icrafting.sendProgressBarUpdate(this, 1, (int)tile.maxProgress); + if (this.lastProgressMax != (int) tile.maxProgress) { + icrafting.sendProgressBarUpdate(this, 1, (int) tile.maxProgress); } } - this.lastProgress = (int)tile.progress; - this.lastProgressMax = (int)tile.maxProgress; - - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - tile.onInventoryChanged(); - + this.lastProgress = (int) tile.progress; + this.lastProgressMax = (int) tile.maxProgress; + + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + tile.onInventoryChanged(); + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { + public void updateProgressBar(int id, int value) { + if (id == 0) { tile.progress = value; } - if (id == 1) - { + if (id == 1) { tile.maxProgress = value; } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) - { - int slotCount = tile.getSizeInventory(); + public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) { + int slotCount = tile.getSizeInventory(); ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(currentSlot); + Slot slot = (Slot) this.inventorySlots.get(currentSlot); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (currentSlot < slotCount) - { - if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) - { + if (currentSlot < slotCount) { + if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 0, slotCount-1, false)) - { + } else if (!this.mergeItemStack(itemstack1, 0, slotCount - 1, false)) { return null; } - if (itemstack1.stackSize <= 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize <= 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } } diff --git a/src/main/java/minefantasy/mf2/container/ContainerTanner.java b/src/main/java/minefantasy/mf2/container/ContainerTanner.java index d1ab3ec2..b925ae06 100644 --- a/src/main/java/minefantasy/mf2/container/ContainerTanner.java +++ b/src/main/java/minefantasy/mf2/container/ContainerTanner.java @@ -9,109 +9,87 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class ContainerTanner extends Container -{ +public class ContainerTanner extends Container { private TileEntityTanningRack tile; private int lastProgress; private int lastProgressMax; - - public ContainerTanner(TileEntityTanningRack tile) - { + + public ContainerTanner(TileEntityTanningRack tile) { this.tile = tile; - for(int a = 0; a < 2; a++) - this.addSlotToContainer(new Slot(tile, a, 0, 0)); + for (int a = 0; a < 2; a++) + this.addSlotToContainer(new Slot(tile, a, 0, 0)); } @Override - public void detectAndSendChanges() - { - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); - - if (this.lastProgress != (int)tile.progress) - { - icrafting.sendProgressBarUpdate(this, 0, (int)tile.progress); + public void detectAndSendChanges() { + for (int i = 0; i < this.crafters.size(); ++i) { + ICrafting icrafting = (ICrafting) this.crafters.get(i); + + if (this.lastProgress != (int) tile.progress) { + icrafting.sendProgressBarUpdate(this, 0, (int) tile.progress); } - if (this.lastProgressMax != (int)tile.maxProgress) - { - icrafting.sendProgressBarUpdate(this, 1, (int)tile.maxProgress); + if (this.lastProgressMax != (int) tile.maxProgress) { + icrafting.sendProgressBarUpdate(this, 1, (int) tile.maxProgress); } } - this.lastProgress = (int)tile.progress; - this.lastProgressMax = (int)tile.maxProgress; - - for (int i = 0; i < this.inventorySlots.size(); ++i) - { - ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); - ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); - - if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) - { - tile.onInventoryChanged(); - + this.lastProgress = (int) tile.progress; + this.lastProgressMax = (int) tile.maxProgress; + + for (int i = 0; i < this.inventorySlots.size(); ++i) { + ItemStack itemstack = ((Slot) this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack) this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { + tile.onInventoryChanged(); + itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); - for (int j = 0; j < this.crafters.size(); ++j) - { - ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + for (int j = 0; j < this.crafters.size(); ++j) { + ((ICrafting) this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } } - + @Override @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int value) - { - if (id == 0) - { + public void updateProgressBar(int id, int value) { + if (id == 0) { tile.progress = value; } - if (id == 1) - { + if (id == 1) { tile.maxProgress = value; } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) - { + public boolean canInteractWith(EntityPlayer p_75145_1_) { return this.tile.isUseableByPlayer(p_75145_1_); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) - { - int slotCount = tile.getSizeInventory(); + public ItemStack transferStackInSlot(EntityPlayer user, int currentSlot) { + int slotCount = tile.getSizeInventory(); ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(currentSlot); + Slot slot = (Slot) this.inventorySlots.get(currentSlot); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (currentSlot < slotCount) - { - if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) - { + if (currentSlot < slotCount) { + if (!this.mergeItemStack(itemstack1, slotCount, this.inventorySlots.size(), false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 0, slotCount-1, false)) - { + } else if (!this.mergeItemStack(itemstack1, 0, slotCount - 1, false)) { return null; } - if (itemstack1.stackSize <= 0) - { - slot.putStack((ItemStack)null); - } - else - { + if (itemstack1.stackSize <= 0) { + slot.putStack((ItemStack) null); + } else { slot.onSlotChanged(); } } diff --git a/src/main/java/minefantasy/mf2/container/InventoryReload.java b/src/main/java/minefantasy/mf2/container/InventoryReload.java index 5fdc6c39..ae14de97 100644 --- a/src/main/java/minefantasy/mf2/container/InventoryReload.java +++ b/src/main/java/minefantasy/mf2/container/InventoryReload.java @@ -5,101 +5,89 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -public class InventoryReload implements IInventory -{ - private ItemStack weapon; - public InventoryReload(ItemStack weapon) - { - this.weapon = weapon; - } - - @Override - public int getSizeInventory() - { - return 1; - } - - @Override - public ItemStack getStackInSlot(int i) - { - return AmmoMechanicsMF.getAmmo(weapon); - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - ItemStack ammo = AmmoMechanicsMF.getAmmo(weapon); - if(ammo != null) - { - ItemStack ammo2 = ammo.copy(); - ammo.stackSize -= num; - ammo2.stackSize = num; - if(ammo.stackSize > 0) - { - setInventorySlotContents(slot, ammo); - } - else - { - setInventorySlotContents(slot, null); - } - return ammo2; - } - return ammo; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - return null; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack item) - { - if(item != null) - { - AmmoMechanicsMF.setAmmo(weapon, item); - } - else - { - AmmoMechanicsMF.removeAmmo(weapon); - } - } - - @Override - public String getInventoryName() { - return null; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public void markDirty() { - } - - @Override - public boolean isUseableByPlayer(EntityPlayer user) { - return true; - } - - @Override - public void openInventory() { - } - - @Override - public void closeInventory() { - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack item) { - return false; - } +public class InventoryReload implements IInventory { + private ItemStack weapon; + + public InventoryReload(ItemStack weapon) { + this.weapon = weapon; + } + + @Override + public int getSizeInventory() { + return 1; + } + + @Override + public ItemStack getStackInSlot(int i) { + return AmmoMechanicsMF.getAmmo(weapon); + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + ItemStack ammo = AmmoMechanicsMF.getAmmo(weapon); + if (ammo != null) { + ItemStack ammo2 = ammo.copy(); + ammo.stackSize -= num; + ammo2.stackSize = num; + if (ammo.stackSize > 0) { + setInventorySlotContents(slot, ammo); + } else { + setInventorySlotContents(slot, null); + } + return ammo2; + } + return ammo; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return null; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + if (item != null) { + AmmoMechanicsMF.setAmmo(weapon, item); + } else { + AmmoMechanicsMF.removeAmmo(weapon); + } + } + + @Override + public String getInventoryName() { + return null; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public void markDirty() { + } + + @Override + public boolean isUseableByPlayer(EntityPlayer user) { + return true; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack item) { + return false; + } } diff --git a/src/main/java/minefantasy/mf2/container/SlotBombBench.java b/src/main/java/minefantasy/mf2/container/SlotBombBench.java index bb55ee80..30bfad77 100644 --- a/src/main/java/minefantasy/mf2/container/SlotBombBench.java +++ b/src/main/java/minefantasy/mf2/container/SlotBombBench.java @@ -3,32 +3,27 @@ import minefantasy.mf2.block.tileentity.TileEntityBombBench; import minefantasy.mf2.item.gadget.ItemBomb; import minefantasy.mf2.item.gadget.ItemMine; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +public class SlotBombBench extends Slot { + private final String type; -public class SlotBombBench extends Slot -{ - private final String type; - public SlotBombBench(String type, IInventory parent, int id, int x, int y) - { - super(parent, id, x, y); - this.type = type; - } - - @Override - public boolean isItemValid(ItemStack item) - { - if(type.equalsIgnoreCase("case")) - { - return TileEntityBombBench.isMatch(item, "arrow") || TileEntityBombBench.isMatch(item, "bolt") || TileEntityBombBench.isMatch(item, "bombCase") || TileEntityBombBench.isMatch(item, "mineCase"); - } - if(type.equalsIgnoreCase("bomb")) - { - return item.getItem() instanceof ItemBomb || item.getItem() instanceof ItemMine; - } + public SlotBombBench(String type, IInventory parent, int id, int x, int y) { + super(parent, id, x, y); + this.type = type; + } + + @Override + public boolean isItemValid(ItemStack item) { + if (type.equalsIgnoreCase("case")) { + return TileEntityBombBench.isMatch(item, "arrow") || TileEntityBombBench.isMatch(item, "bolt") + || TileEntityBombBench.isMatch(item, "bombCase") || TileEntityBombBench.isMatch(item, "mineCase"); + } + if (type.equalsIgnoreCase("bomb")) { + return item.getItem() instanceof ItemBomb || item.getItem() instanceof ItemMine; + } return TileEntityBombBench.isMatch(item, type); } } diff --git a/src/main/java/minefantasy/mf2/container/SlotCrucibleOut.java b/src/main/java/minefantasy/mf2/container/SlotCrucibleOut.java index 845ccda9..0dacb742 100644 --- a/src/main/java/minefantasy/mf2/container/SlotCrucibleOut.java +++ b/src/main/java/minefantasy/mf2/container/SlotCrucibleOut.java @@ -7,35 +7,31 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +public class SlotCrucibleOut extends Slot { + private TileEntityCrucible tile; + private int slotNum; -public class SlotCrucibleOut extends Slot -{ - private TileEntityCrucible tile; - private int slotNum; - public SlotCrucibleOut(TileEntityCrucible parent, int id, int x, int y) - { - super(parent, id, x, y); - this.tile=parent; - this.slotNum = id; - } - - @Override - public boolean canTakeStack(EntityPlayer player) - { - return canTakeStack(); - } - public boolean canTakeStack() - { - ItemStack slot = tile.getStackInSlot(slotNum); - if(slot != null && slot.getItem() instanceof ItemBlock) - { - return true; - } - return !ConfigHardcore.HCCreduceIngots || tile.isAuto(); - } - @Override - public boolean isItemValid(ItemStack item) - { - return true; + public SlotCrucibleOut(TileEntityCrucible parent, int id, int x, int y) { + super(parent, id, x, y); + this.tile = parent; + this.slotNum = id; + } + + @Override + public boolean canTakeStack(EntityPlayer player) { + return canTakeStack(); + } + + public boolean canTakeStack() { + ItemStack slot = tile.getStackInSlot(slotNum); + if (slot != null && slot.getItem() instanceof ItemBlock) { + return true; + } + return !ConfigHardcore.HCCreduceIngots || tile.isAuto(); + } + + @Override + public boolean isItemValid(ItemStack item) { + return true; } } diff --git a/src/main/java/minefantasy/mf2/container/SlotReload.java b/src/main/java/minefantasy/mf2/container/SlotReload.java index f4a3e4fe..94c2df4e 100644 --- a/src/main/java/minefantasy/mf2/container/SlotReload.java +++ b/src/main/java/minefantasy/mf2/container/SlotReload.java @@ -4,21 +4,18 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +public class SlotReload extends Slot { + private ContainerReload container; + private int slot; -public class SlotReload extends Slot -{ - private ContainerReload container; - private int slot; - public SlotReload(ContainerReload container, IInventory parent, int id, int x, int y) - { - super(parent, id, x, y); - this.container = container; - this.slot = id; - } - - @Override - public boolean isItemValid(ItemStack item) - { - return container.canAccept(item); + public SlotReload(ContainerReload container, IInventory parent, int id, int x, int y) { + super(parent, id, x, y); + this.container = container; + this.slot = id; + } + + @Override + public boolean isItemValid(ItemStack item) { + return container.canAccept(item); } } diff --git a/src/main/java/minefantasy/mf2/container/SlotRestrictive.java b/src/main/java/minefantasy/mf2/container/SlotRestrictive.java index 9cabc5ef..d078e1f8 100644 --- a/src/main/java/minefantasy/mf2/container/SlotRestrictive.java +++ b/src/main/java/minefantasy/mf2/container/SlotRestrictive.java @@ -4,21 +4,18 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +public class SlotRestrictive extends Slot { + private IInventory tile; + private int slot; -public class SlotRestrictive extends Slot -{ - private IInventory tile; - private int slot; - public SlotRestrictive(IInventory parent, int id, int x, int y) - { - super(parent, id, x, y); - this.tile=parent; - this.slot = id; - } - - @Override - public boolean isItemValid(ItemStack item) - { - return tile.isItemValidForSlot(slot, item); + public SlotRestrictive(IInventory parent, int id, int x, int y) { + super(parent, id, x, y); + this.tile = parent; + this.slot = id; + } + + @Override + public boolean isItemValid(ItemStack item) { + return tile.isItemValidForSlot(slot, item); } } diff --git a/src/main/java/minefantasy/mf2/entity/EntityArrowMF.java b/src/main/java/minefantasy/mf2/entity/EntityArrowMF.java index f917fd87..53b1aa2a 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityArrowMF.java +++ b/src/main/java/minefantasy/mf2/entity/EntityArrowMF.java @@ -1,14 +1,10 @@ package minefantasy.mf2.entity; -import java.util.Iterator; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.archery.IArrowMF; import minefantasy.mf2.api.archery.IArrowRetrieve; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.TacticalManager; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.weapon.IDamageType; import minefantasy.mf2.config.ConfigExperiment; @@ -33,1079 +29,930 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.play.server.S2BPacketChangeGameState; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraft.world.World; -public class EntityArrowMF extends EntityArrow implements IProjectile, IDamageType, IArrowRetrieve -{ - private boolean playedSound = false; - private int xTile = -1; - private int yTile = -1; - private int zTile = -1; - private Block inBlock; - private int inData; - private boolean inGround; - /** 1 if the player can pick up the arrow */ - public int canBePickedUp; - /** Seems to be some sort of timer for animating an arrow. */ - public int arrowShake; - /** The owner of this arrow. */ - public Entity shootingEntity; - private int ticksInGround; - private int ticksInAir; - private double damage = 2.0D; - /** The amount of knockback an arrow applies when it hits a mob. */ - private int knockbackStrength; - public float velocityModifier = 1.0F; - public ArrowType arrowtype = ArrowType.NORMAL; - public float firepower = 1F; - - public EntityArrowMF(World world) - { - super(world); - this.renderDistanceWeight = 10.0D; - this.setSize(0.5F, 0.5F); - } - - public EntityArrowMF(World world, double x, double y, double z) - { - super(world); - this.renderDistanceWeight = 10.0D; - this.setSize(0.5F, 0.5F); - this.setPosition(x, y, z); - this.yOffset = 0.0F; - } - - /** - * This is for shooting an arrow from a shooting entity to a target(Like skeletons and such) - */ - public EntityArrowMF(World world, EntityLivingBase shooter, EntityLivingBase target, float accuracy, float power) - { - super(world); - this.renderDistanceWeight = 10.0D; - this.shootingEntity = shooter; - - this.firepower = power; - if (shooter instanceof EntityPlayer) - { - this.canBePickedUp = 1; - } - - this.posY = shooter.posY + shooter.getEyeHeight() - 0.10000000149011612D; - double d0 = target.posX - shooter.posX; - double d1 = target.boundingBox.minY + target.height / 3.0F - this.posY; - double d2 = target.posZ - shooter.posZ; - double d3 = 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)); - 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 + f4, d2, accuracy, power); - } - } - - /** - * This method is for firing an arrow from an entity (Mostly player shooting) - */ - public EntityArrowMF(World world, EntityLivingBase shooter, float power) - { - this(world, shooter, 1.0F, power); - } - public EntityArrowMF(World world, EntityLivingBase shooter, float spread, float power) - { - super(world); - this.firepower = power/2F; - this.renderDistanceWeight = 10.0D; - this.shootingEntity = shooter; - - if (shooter instanceof EntityPlayer) { - this.canBePickedUp = 1; - } - - this.setSize(0.5F, 0.5F); - this.setLocationAndAngles( - shooter.posX, - shooter.posY + shooter.getEyeHeight(), - shooter.posZ, shooter.rotationYaw, - shooter.rotationPitch); - this.posX -= MathHelper.cos(this.rotationYaw / 180.0F - * (float) Math.PI) * 0.16F; - this.posY -= 0.10000000149011612D; - this.posZ -= 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 = -MathHelper.sin(this.rotationYaw / 180.0F - * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F - * (float) Math.PI); - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F - * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F - * (float) Math.PI); - this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F - * (float) Math.PI)); - this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, - power * 1.5F, spread); - } - - public EntityArrowMF setDeisgn(ArrowType type) - { - this.arrowtype = type; - return this; - } - /** - * Implement this with the constructor - */ - public EntityArrowMF setArrow(ItemStack arrow) - { - ItemStack arrowStack = arrow.copy(); - arrowStack.stackSize = 1; - setArrowStack(arrowStack); - return this; - } - public EntityArrowMF setArrowTex(String tex) - { - updateTex(tex); - return this; - } - private final int texture_dw = 18; - private float power = 0F; - @Override - protected void entityInit() - { - this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));//Critical - this.dataWatcher.addObject(texture_dw, "steel_arrow"); - } - - /** - * Similar to setArrowHeading, it's point the throwable entity to a x, y, z - * direction. - */ - @Override - public void setThrowableHeading(double x, double y, double z, float power, float spread) - { - float f2 = MathHelper.sqrt_double(x * x + y * y + z * z); - x /= f2; - y /= f2; - z /= f2; - x += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) - * 0.007499999832361937D * spread; - y += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) - * 0.007499999832361937D * spread; - z += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) - * 0.007499999832361937D * spread; - x *= power; - y *= power; - z *= power; - 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, f3) * 180.0D / Math.PI); - this.ticksInGround = 0; - } - - /** - * Sets the position and rotation. Only difference from the other one is no - * bounding on the rotation. Args: posX, posY, posZ, yaw, pitch - */ - @Override - @SideOnly(Side.CLIENT) - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int i) - { - this.setPosition(x, y, z); - this.setRotation(yaw, pitch); - } - /** - * Sets the position and rotation. Only difference from the other one is no - * bounding on the rotation. Args: posX, posY, posZ, yaw, pitch - */ - public void setPositionAndRotation(double x, double y, double z, float yaw, float pitch, int i) - { - this.setPosition(x, y, z); - this.setRotation(yaw, pitch); - } - - /** - * Sets the velocity to the args. Args: x, y, z - */ - @Override - @SideOnly(Side.CLIENT) - public void setVelocity(double xv, double yv, double zv) - { - this.motionX = xv; - this.motionY = yv; - this.motionZ = zv; - - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) - { - float f = MathHelper.sqrt_double(xv * xv + zv * zv); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(xv, - zv) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2( - yv, 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); - this.ticksInGround = 0; - } - } - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() - { - super.onEntityUpdate(); - - if(ConfigExperiment.dynamicArrows && worldObj.isRemote) - { - return; - } - 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, f) * 180.0D / Math.PI); - } - - Block block = this.worldObj.getBlock(this.xTile, - this.yTile, this.zTile); - - if (block.getMaterial() != Material.air) { - block.setBlockBoundsBasedOnState(this.worldObj, - this.xTile, this.yTile, - this.zTile); - AxisAlignedBB axisalignedbb = block - .getCollisionBoundingBoxFromPool(this.worldObj, - this.xTile, this.yTile, - this.zTile); - - if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) - { +import java.util.Iterator; +import java.util.List; + +public class EntityArrowMF extends EntityArrow implements IProjectile, IDamageType, IArrowRetrieve { + private final int texture_dw = 18; + /** + * 1 if the player can pick up the arrow + */ + public int canBePickedUp; + /** + * Seems to be some sort of timer for animating an arrow. + */ + public int arrowShake; + /** + * The owner of this arrow. + */ + public Entity shootingEntity; + public float velocityModifier = 1.0F; + public ArrowType arrowtype = ArrowType.NORMAL; + public float firepower = 1F; + private boolean playedSound = false; + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private Block inBlock; + private int inData; + private boolean inGround; + private int ticksInGround; + private int ticksInAir; + private double damage = 2.0D; + /** + * The amount of knockback an arrow applies when it hits a mob. + */ + private int knockbackStrength; + private float power = 0F; + + public EntityArrowMF(World world) { + super(world); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + } + + public EntityArrowMF(World world, double x, double y, double z) { + super(world); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + this.setPosition(x, y, z); + this.yOffset = 0.0F; + } + + /** + * This is for shooting an arrow from a shooting entity to a target(Like + * skeletons and such) + */ + public EntityArrowMF(World world, EntityLivingBase shooter, EntityLivingBase target, float accuracy, float power) { + super(world); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = shooter; + + this.firepower = power; + if (shooter instanceof EntityPlayer) { + this.canBePickedUp = 1; + } + + this.posY = shooter.posY + shooter.getEyeHeight() - 0.10000000149011612D; + double d0 = target.posX - shooter.posX; + double d1 = target.boundingBox.minY + target.height / 3.0F - this.posY; + double d2 = target.posZ - shooter.posZ; + double d3 = 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)); + 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 + f4, d2, accuracy, power); + } + } + + /** + * This method is for firing an arrow from an entity (Mostly player shooting) + */ + public EntityArrowMF(World world, EntityLivingBase shooter, float power) { + this(world, shooter, 1.0F, power); + } + + public EntityArrowMF(World world, EntityLivingBase shooter, float spread, float power) { + super(world); + this.firepower = power / 2F; + this.renderDistanceWeight = 10.0D; + this.shootingEntity = shooter; + + if (shooter instanceof EntityPlayer) { + this.canBePickedUp = 1; + } + + this.setSize(0.5F, 0.5F); + this.setLocationAndAngles(shooter.posX, shooter.posY + shooter.getEyeHeight(), shooter.posZ, + shooter.rotationYaw, shooter.rotationPitch); + this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; + this.posY -= 0.10000000149011612D; + this.posZ -= 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 = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); + this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); + this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); + this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, power * 1.5F, spread); + } + + public static DamageSource causeBombDamage(Entity bomb, Entity user) { + return (new EntityDamageSourceBomb(bomb, user)).setProjectile(); + } + + public EntityArrowMF setDeisgn(ArrowType type) { + this.arrowtype = type; + return this; + } + + /** + * Implement this with the constructor + */ + public EntityArrowMF setArrow(ItemStack arrow) { + ItemStack arrowStack = arrow.copy(); + arrowStack.stackSize = 1; + setArrowStack(arrowStack); + return this; + } + + public EntityArrowMF setArrowTex(String tex) { + updateTex(tex); + return this; + } + + @Override + protected void entityInit() { + this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));// Critical + this.dataWatcher.addObject(texture_dw, "steel_arrow"); + } + + /** + * Similar to setArrowHeading, it's point the throwable entity to a x, y, z + * direction. + */ + @Override + public void setThrowableHeading(double x, double y, double z, float power, float spread) { + float f2 = MathHelper.sqrt_double(x * x + y * y + z * z); + x /= f2; + y /= f2; + z /= f2; + x += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * spread; + y += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * spread; + z += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * spread; + x *= power; + y *= power; + z *= power; + 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, f3) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + /** + * Sets the position and rotation. Only difference from the other one is no + * bounding on the rotation. Args: posX, posY, posZ, yaw, pitch + */ + @Override + @SideOnly(Side.CLIENT) + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int i) { + this.setPosition(x, y, z); + this.setRotation(yaw, pitch); + } + + /** + * Sets the position and rotation. Only difference from the other one is no + * bounding on the rotation. Args: posX, posY, posZ, yaw, pitch + */ + public void setPositionAndRotation(double x, double y, double z, float yaw, float pitch, int i) { + this.setPosition(x, y, z); + this.setRotation(yaw, pitch); + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + @Override + @SideOnly(Side.CLIENT) + public void setVelocity(double xv, double yv, double zv) { + this.motionX = xv; + this.motionY = yv; + this.motionZ = zv; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { + float f = MathHelper.sqrt_double(xv * xv + zv * zv); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(xv, zv) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(yv, 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); + this.ticksInGround = 0; + } + } + + /** + * Called to update the entity's position/logic. + */ + @Override + public void onUpdate() { + super.onEntityUpdate(); + + if (ConfigExperiment.dynamicArrows && worldObj.isRemote) { + return; + } + 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, f) * 180.0D / Math.PI); + } + + Block block = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile); + + if (block.getMaterial() != Material.air) { + block.setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile); + AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, + this.zTile); + + if (axisalignedbb != null + && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { this.inGround = true; } - } - - if (this.arrowShake > 0) { - --this.arrowShake; - } - - if (this.inGround) - { - int j = this.worldObj.getBlockMetadata(this.xTile, - this.yTile, this.zTile); - - if (block == this.inBlock && j == this.inData) { - ++this.ticksInGround; - - if (this.ticksInGround == 1200) - { - this.setDead(); - } - } else - { - this.inGround = false; - this.motionX *= this.rand.nextFloat() * 0.2F; - this.motionY *= this.rand.nextFloat() * 0.2F; - this.motionZ *= this.rand.nextFloat() * 0.2F; - this.ticksInGround = 0; - this.ticksInAir = 0; - } - } 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); + } + + if (this.arrowShake > 0) { + --this.arrowShake; + } + + if (this.inGround) { + int j = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + + if (block == this.inBlock && j == this.inData) { + ++this.ticksInGround; + + if (this.ticksInGround == 1200) { + this.setDead(); + } + } else { + this.inGround = false; + this.motionX *= this.rand.nextFloat() * 0.2F; + this.motionY *= this.rand.nextFloat() * 0.2F; + this.motionZ *= this.rand.nextFloat() * 0.2F; + this.ticksInGround = 0; + this.ticksInAir = 0; + } + } 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); MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false); vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, + this.posZ + this.motionZ); + + if (movingobjectposition != null) { + vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, + movingobjectposition.hitVec.zCoord); + } + + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, + this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double d0 = 0.0D; + int i; + float f1; + + for (i = 0; i < list.size(); ++i) { + Entity entity1 = (Entity) list.get(i); + + if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) { + f1 = 0.3F; + AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1); + MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3); + + if (movingobjectposition1 != null) { + double d1 = vec31.distanceTo(movingobjectposition1.hitVec); + + if (d1 < d0 || d0 == 0.0D) { + entity = entity1; + d0 = d1; + } + } + } + } + + if (entity != null) { + movingobjectposition = new MovingObjectPosition(entity); + } + + 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)) { + movingobjectposition = null; + } + } + + float f2; + float f4; + + if (movingobjectposition != null) { + if (isExplosive()) { + explode(); + } + if (movingobjectposition.entityHit != null) { + f2 = MathHelper.sqrt_double( + this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ) + / velocityModifier; + + float dam = Math.max(0.1F, this.getHitDamage() * firepower);// (getDamageModifier()*power) / 10F * + // (float)k; + + dam *= getDamageModifier(movingobjectposition.entityHit); + + if (this.getIsCritical()) { + dam *= (rand.nextFloat() * 0.5F) + 1.0F; + } + + DamageSource damagesource = null; + + if (this.shootingEntity == null) { + damagesource = DamageSource.causeArrowDamage(this, this); + } else { + damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity); + } + + if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { + movingobjectposition.entityHit.setFire(5); + } + if (isExplosive()) { + dam = this.getExplosionDamage(); + damagesource.setExplosion(); + if (this.getFilling() == 2) { + damagesource.setFireDamage(); + } + } + if (movingobjectposition.entityHit.attackEntityFrom(damagesource, dam)) { + onHitEntity(movingobjectposition.entityHit, dam); + if (movingobjectposition.entityHit instanceof EntityLivingBase) { + EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit; + + if (!this.worldObj.isRemote) { + entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); + } + + if (this.knockbackStrength > 0) { + f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (f4 > 0.0F) { + movingobjectposition.entityHit.addVelocity( + this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, 0.1D, + this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4); + } + } + + if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { + EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); + 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)); + } + } + + playHitSound(); + + if (!(movingobjectposition.entityHit instanceof EntityEnderman)) { + this.setDead(); + } + } else { + this.motionX *= -0.10000000149011612D; + this.motionY *= -0.10000000149011612D; + this.motionZ *= -0.10000000149011612D; + this.rotationYaw += 180.0F; + this.prevRotationYaw += 180.0F; + this.ticksInAir = 0; + } + if (isMagicArrow()) { + setDead(); + } + } else { + this.xTile = movingobjectposition.blockX; + this.yTile = movingobjectposition.blockY; + this.zTile = movingobjectposition.blockZ; + this.inBlock = block; + this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX)); + this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY)); + this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); + f2 = MathHelper.sqrt_double( + this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.posX -= this.motionX / f2 * 0.05000000074505806D; + this.posY -= this.motionY / f2 * 0.05000000074505806D; + this.posZ -= this.motionZ / f2 * 0.05000000074505806D; + playHitSound(); + this.inGround = true; + this.arrowShake = 7; + this.setIsCritical(false); + + if (this.inBlock.getMaterial() != Material.air) { + this.inBlock.onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this); + } + if (isMagicArrow()) { + setDead(); + } + if (ConfigWeapon.breakArrowsGround && didArrowBreak()) { + breakArrow(); + } + } + if (getEntityData().hasKey("hasBroken_MFArrow")) { + worldObj.playSoundAtEntity(this, "random.break", 1.0F, 1.0F); + setDead(); + } + } + + if (isMagicArrow()) { + for (i = 0; i < 4; ++i) { + this.worldObj.spawnParticle("reddust", this.posX + this.motionX * i / 4.0D, + this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D, -this.motionX, + -this.motionY + 0.2D, -this.motionZ); + } + } + + if (this.getIsCritical()) { + for (i = 0; i < 4; ++i) { + this.worldObj.spawnParticle("crit", this.posX + this.motionX * i / 4.0D, + this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D, -this.motionX, + -this.motionY + 0.2D, -this.motionZ); + } + } + + this.posX += this.motionX; + this.posY += this.motionY; + 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); + + for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 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.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 f3 = 0.99F; + f1 = 0.05F; + + if (this.isInWater()) { + for (int l = 0; l < 4; ++l) { + f4 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f4, this.posY - this.motionY * f4, + this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ); + } + + f3 = 0.8F; + } + + if (this.isWet()) { + this.extinguish(); + } + + this.motionX *= f3; + this.motionY *= f3; + this.motionZ *= f3; + this.motionY -= f1 * getGravityModifier(); + this.setPosition(this.posX, this.posY, this.posZ); + this.func_145775_I(); + } + } + + private float getDamageModifier(Entity target) { + CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(getArrowStack()); + return CombatMechanics.getSpecialModifier(material, "standard", target, true); + } + + private float getModifiedVelocity() { + String s = "MF_Bow_Velocity"; + if (getEntityData().hasKey(s)) { + return getEntityData().getFloat(s); + } + return 1.0F; + } + + private boolean isExplosive() { + return getEntityData().hasKey("Explosive"); + } + + private void playHitSound() { + if (worldObj.isRemote || playedSound) + return; + float pitch = 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F); + if (this.arrowtype != null && this.arrowtype == ArrowType.BROADHEAD) { + pitch *= 0.75F; + } + this.playSound("minefantasy2:weapon.arrowHit", 0.5F, pitch); + playedSound = true; + } + + private void onHitEntity(Entity entityHit, float dam) { + ItemStack arrow = getArrowStack(); + if (arrow != null && arrow.getItem() instanceof IArrowMF) { + ((IArrowMF) arrow.getItem()).onHitEntity(this, shootingEntity, entityHit, dam); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + @Override + public void writeEntityToNBT(NBTTagCompound nbt) { + nbt.setFloat("firepower", firepower); + nbt.setBoolean("PlayedSound", playedSound); + nbt.setFloat("pierceChance", velocityModifier); + nbt.setShort("xTile", (short) this.xTile); + nbt.setShort("yTile", (short) this.yTile); + nbt.setShort("zTile", (short) this.zTile); + nbt.setShort("life", (short) this.ticksInGround); + nbt.setByte("inTile", (byte) Block.getIdFromBlock(this.inBlock)); + nbt.setByte("inData", (byte) this.inData); + nbt.setByte("shake", (byte) this.arrowShake); + nbt.setByte("inGround", (byte) (this.inGround ? 1 : 0)); + nbt.setByte("pickup", (byte) this.canBePickedUp); + nbt.setDouble("damage", this.damage); + + nbt.setString("arrowTexture", this.getCustomTex()); + nbt.setString("arrowtype", arrowtype.name); + nbt.setFloat("FirePower", power); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + @Override + public void readEntityFromNBT(NBTTagCompound nbt) { + firepower = nbt.getFloat("firepower"); + playedSound = nbt.getBoolean("PlayedSound"); + velocityModifier = nbt.getFloat("pierceChance"); + this.xTile = nbt.getShort("xTile"); + this.yTile = nbt.getShort("yTile"); + this.zTile = nbt.getShort("zTile"); + this.ticksInGround = nbt.getShort("life"); + this.inBlock = Block.getBlockById(nbt.getByte("inTile") & 255); + this.inData = nbt.getByte("inData") & 255; + this.arrowShake = nbt.getByte("shake") & 255; + this.inGround = nbt.getByte("inGround") == 1; + + if (nbt.hasKey("damage", 99)) { + this.damage = nbt.getDouble("damage"); + } + + if (nbt.hasKey("pickup", 99)) { + this.canBePickedUp = nbt.getByte("pickup"); + } else if (nbt.hasKey("player", 99)) { + this.canBePickedUp = nbt.getBoolean("player") ? 1 : 0; + } - if (movingobjectposition != null) - { - vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + if (nbt.hasKey("arrowTexture")) { + updateTex(nbt.getString("arrowTexture")); + } + if (nbt.hasKey("arrowtype")) { + ArrowType arrow = ArrowType.arrowMap.get(nbt.getString("arrowtype")); + if (arrow != null) { + arrowtype = arrow; } + } + power = nbt.getFloat("FirePower"); + } - Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( - this, - this.boundingBox.addCoord(this.motionX, this.motionY, - this.motionZ).expand(1.0D, 1.0D, 1.0D)); - double d0 = 0.0D; - int i; - float f1; - - for (i = 0; i < list.size(); ++i) { - Entity entity1 = (Entity) list.get(i); - - if (entity1.canBeCollidedWith() - && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) { - f1 = 0.3F; - AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand( - f1, f1, f1); - MovingObjectPosition movingobjectposition1 = axisalignedbb1 - .calculateIntercept(vec31, vec3); - - if (movingobjectposition1 != null) { - double d1 = vec31 - .distanceTo(movingobjectposition1.hitVec); - - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; - d0 = d1; - } - } - } - } - - if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); - } - - 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)) { - movingobjectposition = null; - } - } - - float f2; - float f4; - - if (movingobjectposition != null) - { - if(isExplosive()) - { - explode(); - } - if (movingobjectposition.entityHit != null) - { - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ) / velocityModifier; - - float dam = Math.max(0.1F, this.getHitDamage() * firepower);//(getDamageModifier()*power) / 10F * (float)k; - - dam *= getDamageModifier(movingobjectposition.entityHit); - - if (this.getIsCritical()) - { - dam *= (rand.nextFloat()*0.5F)+1.0F; - } - - DamageSource damagesource = null; - - if (this.shootingEntity == null) - { - damagesource = DamageSource - .causeArrowDamage(this, this); - } - else - { - damagesource = DamageSource.causeArrowDamage(this, - this.shootingEntity); - } - - if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) - { - movingobjectposition.entityHit.setFire(5); - } - if(isExplosive()) - { - dam = this.getExplosionDamage(); - damagesource.setExplosion(); - if(this.getFilling() == 2) - { - damagesource.setFireDamage(); - } - } - if (movingobjectposition.entityHit.attackEntityFrom(damagesource, dam)) - { - onHitEntity(movingobjectposition.entityHit, dam); - if (movingobjectposition.entityHit instanceof EntityLivingBase) - { - EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit; - - if (!this.worldObj.isRemote) - { - entitylivingbase .setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); - } - - if (this.knockbackStrength > 0) - { - f4 = MathHelper.sqrt_double(this.motionX* this.motionX + this.motionZ* this.motionZ); - - if (f4 > 0.0F) - { - movingobjectposition.entityHit.addVelocity(this.motionX* this.knockbackStrength* 0.6000000238418579D/ f4,0.1D,this.motionZ* this.knockbackStrength* 0.6000000238418579D/ f4); - } - } - - if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) - { - EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); - 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)); - } - } - - playHitSound(); - - if (!(movingobjectposition.entityHit instanceof EntityEnderman)) - { - this.setDead(); - } - } - else - { - this.motionX *= -0.10000000149011612D; - this.motionY *= -0.10000000149011612D; - this.motionZ *= -0.10000000149011612D; - this.rotationYaw += 180.0F; - this.prevRotationYaw += 180.0F; - this.ticksInAir = 0; - } - if(isMagicArrow()) - { - setDead(); - } - } - else - { - this.xTile = movingobjectposition.blockX; - this.yTile = movingobjectposition.blockY; - this.zTile = movingobjectposition.blockZ; - this.inBlock = block; - this.inData = this.worldObj.getBlockMetadata( - this.xTile, this.yTile, - this.zTile); - this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX)); - this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY)); - this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); - f2 = MathHelper.sqrt_double(this.motionX * this.motionX - + this.motionY * this.motionY + this.motionZ - * this.motionZ); - this.posX -= this.motionX / f2 - * 0.05000000074505806D; - this.posY -= this.motionY / f2 - * 0.05000000074505806D; - this.posZ -= this.motionZ / f2 - * 0.05000000074505806D; - playHitSound(); - this.inGround = true; - this.arrowShake = 7; - this.setIsCritical(false); - - if (this.inBlock.getMaterial() != Material.air) - { - this.inBlock.onEntityCollidedWithBlock( - this.worldObj, this.xTile, - this.yTile, this.zTile, this); - } - if(isMagicArrow()) - { - setDead(); - } - if(ConfigWeapon.breakArrowsGround && didArrowBreak()) - { - breakArrow(); - } - } - if(getEntityData().hasKey("hasBroken_MFArrow")) - { - worldObj.playSoundAtEntity(this, "random.break", 1.0F, 1.0F); - setDead(); - } - } - - if(isMagicArrow()) - { - for (i = 0; i < 4; ++i) - { - this.worldObj.spawnParticle("reddust", this.posX - + this.motionX * i / 4.0D, this.posY - + this.motionY * i / 4.0D, this.posZ - + this.motionZ * i / 4.0D, -this.motionX, - -this.motionY + 0.2D, -this.motionZ); - } - } - - if (this.getIsCritical()) - { - for (i = 0; i < 4; ++i) - { - this.worldObj.spawnParticle("crit", this.posX - + this.motionX * i / 4.0D, this.posY - + this.motionY * i / 4.0D, this.posZ - + this.motionZ * i / 4.0D, -this.motionX, - -this.motionY + 0.2D, -this.motionZ); - } - } - - this.posX += this.motionX; - this.posY += this.motionY; - 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); - - for (this.rotationPitch = (float) (Math.atan2(this.motionY, - f2) * 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.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 f3 = 0.99F; - f1 = 0.05F; - - if (this.isInWater()) { - for (int l = 0; l < 4; ++l) { - f4 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - - this.motionX * f4, this.posY - - this.motionY * f4, this.posZ - - this.motionZ * f4, this.motionX, - this.motionY, this.motionZ); - } - - f3 = 0.8F; - } - - if (this.isWet()) { - this.extinguish(); - } - - this.motionX *= f3; - this.motionY *= f3; - this.motionZ *= f3; - this.motionY -= f1*getGravityModifier(); - this.setPosition(this.posX, this.posY, this.posZ); - this.func_145775_I(); - } - } - - private float getDamageModifier(Entity target) - { - CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(getArrowStack()); - return CombatMechanics.getSpecialModifier(material, "standard", target, true); - } - - private float getModifiedVelocity() - { - String s = "MF_Bow_Velocity"; - if(getEntityData().hasKey(s)) - { - return getEntityData().getFloat(s); - } - return 1.0F; - } - - private boolean isExplosive() - { - return getEntityData().hasKey("Explosive"); - } - - private void playHitSound() - { - if(worldObj.isRemote || playedSound)return; - float pitch = 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F); - if(this.arrowtype != null && this.arrowtype == ArrowType.BROADHEAD) - { - pitch *= 0.75F; - } - this.playSound("minefantasy2:weapon.arrowHit", 0.5F, pitch); - playedSound = true; - } - - private void onHitEntity(Entity entityHit, float dam) - { - ItemStack arrow = getArrowStack(); - if(arrow != null && arrow.getItem() instanceof IArrowMF) - { - ((IArrowMF)arrow.getItem()).onHitEntity(this, shootingEntity, entityHit, dam); - } - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(NBTTagCompound nbt) - { - nbt.setFloat("firepower", firepower); - nbt.setBoolean("PlayedSound", playedSound); - nbt.setFloat("pierceChance", velocityModifier); - nbt.setShort("xTile", (short) this.xTile); - nbt.setShort("yTile", (short) this.yTile); - nbt.setShort("zTile", (short) this.zTile); - nbt.setShort("life", (short) this.ticksInGround); - nbt.setByte("inTile", (byte) Block.getIdFromBlock(this.inBlock)); - nbt.setByte("inData", (byte) this.inData); - nbt.setByte("shake", (byte) this.arrowShake); - nbt.setByte("inGround", (byte) (this.inGround ? 1 : 0)); - nbt.setByte("pickup", (byte) this.canBePickedUp); - nbt.setDouble("damage", this.damage); - - nbt.setString("arrowTexture", this.getCustomTex()); - nbt.setString("arrowtype", arrowtype.name); - nbt.setFloat("FirePower", power); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(NBTTagCompound nbt) - { - firepower = nbt.getFloat("firepower"); - playedSound = nbt.getBoolean("PlayedSound"); - velocityModifier = nbt.getFloat("pierceChance"); - this.xTile = nbt.getShort("xTile"); - this.yTile = nbt.getShort("yTile"); - this.zTile = nbt.getShort("zTile"); - this.ticksInGround = nbt.getShort("life"); - this.inBlock = Block.getBlockById(nbt - .getByte("inTile") & 255); - this.inData = nbt.getByte("inData") & 255; - this.arrowShake = nbt.getByte("shake") & 255; - this.inGround = nbt.getByte("inGround") == 1; - - if (nbt.hasKey("damage", 99)) { - this.damage = nbt.getDouble("damage"); - } - - if (nbt.hasKey("pickup", 99)) { - this.canBePickedUp = nbt.getByte("pickup"); - } else if (nbt.hasKey("player", 99)) { - this.canBePickedUp = nbt.getBoolean("player") ? 1 - : 0; - } - - if(nbt.hasKey("arrowTexture")) - { - updateTex(nbt.getString("arrowTexture")); - } - if(nbt.hasKey("arrowtype")) - { - ArrowType arrow = ArrowType.arrowMap.get(nbt.getString("arrowtype")); - if(arrow != null) - { - arrowtype = arrow; - } - } - power = nbt.getFloat("FirePower"); - } - - /** - * Called by a player entity when they collide with an entity - */ - @Override - public void onCollideWithPlayer(EntityPlayer player) - { - if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) - { - boolean canPickUp = this.canBePickedUp == 1 || this.canBePickedUp == 2 && player.capabilities.isCreativeMode; - - if (this.canBePickedUp == 1 && !player.inventory.addItemStackToInventory(getPickedUpItem())) - { - canPickUp = false; - } - - if (canPickUp) - { - this.playSound( "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); - player.onItemPickup(this, 1); - this.setDead(); - } - } - } - - /** - * returns if this entity triggers Block.onEntityWalking on the blocks they - * walk on. used for spiders and wolves to prevent them from trampling crops - */ - @Override - protected boolean canTriggerWalking() - { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() - { - return 0.0F; - } - - @Override - public void setDamage(double dam) - { - this.damage = dam; - } - - @Override - public double getDamage() - { - return this.damage; - } - - /** - * Sets the amount of knockback the arrow applies when it hits a mob. - */ - @Override - public void setKnockbackStrength(int str) - { - this.knockbackStrength = str; - } - - /** - * If returns false, the item will not inflict any damage against entities. - */ - @Override - public boolean canAttackWithItem() - { - return false; - } - - /** - * The old critical method called on full charge, I use my own - */ - @Override - public void setIsCritical(boolean flag) - { - - } - /** - * [New Method] Whether the arrow has a stream of critical hit particles flying behind - * it. Called by chance - */ - public void setCritical(boolean flag) - { - byte b0 = this.dataWatcher.getWatchableObjectByte(16); - - if (flag) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 1))); - } else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -2))); - } - } - - /** - * Whether the arrow has a stream of critical hit particles flying behind - * it. - */ - @Override - public boolean getIsCritical() - { - byte b0 = this.dataWatcher.getWatchableObjectByte(16); - return (b0 & 1) != 0; - } - - public float getHitDamage() - { - float dam = 2.0F; - ItemStack arrowStack = getArrowStack(); - if(arrowStack != null) - { - if(arrowStack.getItem() instanceof IArrowMF) - { - dam = ((IArrowMF)arrowStack.getItem()).getDamageModifier(arrowStack); - } - } - if(getEntityData().hasKey("MF_Bow_Damage")) - { - dam *= getEntityData().getFloat("MF_Bow_Damage"); - } - return dam; - } - - public float getGravityModifier() - { - ItemStack arrowStack = getArrowStack(); - if(arrowStack != null) - { - if(arrowStack.getItem() instanceof IArrowMF) - { - return ((IArrowMF)arrowStack.getItem()).getGravityModifier(arrowStack); - } - } - return 1.0F; - } - - public float getBreakChance() - { - ItemStack arrowStack = getArrowStack(); - if(arrowStack != null) - { - if(arrowStack.getItem() instanceof IArrowMF) - { - return ((IArrowMF)arrowStack.getItem()).getBreakChance(this, arrowStack); - } - } - return 1.0F; - } - - @SideOnly(Side.CLIENT) - public String getTexture() - { - return "textures/projectile/"+getCustomTex(); - } - - public ItemStack getPickedUpItem() - { - return getArrowStack(); - } - - /** - * Saves the arrow to the NBT - * @param arrow - */ - private void setArrowStack(ItemStack arrow) - { - NBTTagCompound arrowNBT = new NBTTagCompound(); - arrow.writeToNBT(arrowNBT); - getEntityData().setTag("MF_ArrowItem", arrowNBT); - } - - private ItemStack getArrowStack() - { - if(getEntityData().hasKey("MF_ArrowItem")) - { - NBTTagCompound heldArrow = getEntityData().getCompoundTag("MF_ArrowItem"); - return ItemStack.loadItemStackFromNBT(heldArrow); - } - return new ItemStack(Items.arrow); - } - private void updateTex(String tex) - { - dataWatcher.updateObject(texture_dw, tex); - } - private String getCustomTex() - { - try - { - return dataWatcher.getWatchableObjectString(texture_dw); - }catch(Exception e) - { - MFLogUtil.logWarn("Arrow Failed To Load Texture"); - return "steel_arrow"; - } - } - - @Override - public boolean canBePickedUp() - { - if(isMagicArrow()) - { - return false; - } - if(didArrowBreak()) - { - breakArrow(); - return false; - } - return canBePickedUp == 1; - } - - private void breakArrow() - { - getEntityData().setBoolean("hasBroken_MFArrow", true); - } - - private boolean didArrowBreak() - { - if(isExplosive()) - { - return false; - } - float c = rand.nextFloat(); - float br = getBreakChance() * ConfigWeapon.arrowBreakMod; - return c < br; - } - @Override - public ItemStack getDroppedItem() - { - return getArrowStack(); - } - - @Override - public float[] getDamageRatio(Object... implement) - { - if(isExplosive()) - { - return new float[]{0,1, 0}; - } - if(arrowtype != null) - { - return arrowtype.ratio; - } - return new float[]{0,0, 1}; - } - - public void modifyVelocity(float velocity) - { - this.velocityModifier = velocity; - motionX*=velocity; - motionY*=velocity; - motionZ*=velocity; - } - @Override - public float getPenetrationLevel(Object implement) - { - return arrowtype == ArrowType.BROADHEAD ? -0.5F : 0F; - } - - public void setPower(float f) - { - power = f; - } - - public EntityArrowMF setBombStats(int powder, int filling) - { - getEntityData().setInteger("powder", powder); - getEntityData().setInteger("filling", filling); - getEntityData().setBoolean("Explosive", true); - return this; - } - public void explode() - { - worldObj.playSoundAtEntity(this, "random.explode", 0.3F, 10F - 5F); - worldObj.createExplosion(this, posX, posY, posZ, 0, false); - if (!this.worldObj.isRemote) - { - double area = getRangeOfBlast()*2D; - AxisAlignedBB var3 = this.boundingBox.expand(area, area/2, area); + /** + * Called by a player entity when they collide with an entity + */ + @Override + public void onCollideWithPlayer(EntityPlayer player) { + if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { + boolean canPickUp = this.canBePickedUp == 1 + || this.canBePickedUp == 2 && player.capabilities.isCreativeMode; + + if (this.canBePickedUp == 1 && !player.inventory.addItemStackToInventory(getPickedUpItem())) { + canPickUp = false; + } + + if (canPickUp) { + this.playSound("random.pop", 0.2F, + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + player.onItemPickup(this, 1); + this.setDead(); + } + } + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk + * on. used for spiders and wolves to prevent them from trampling crops + */ + @Override + protected boolean canTriggerWalking() { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public float getShadowSize() { + return 0.0F; + } + + @Override + public double getDamage() { + return this.damage; + } + + @Override + public void setDamage(double dam) { + this.damage = dam; + } + + /** + * Sets the amount of knockback the arrow applies when it hits a mob. + */ + @Override + public void setKnockbackStrength(int str) { + this.knockbackStrength = str; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + @Override + public boolean canAttackWithItem() { + return false; + } + + /** + * [New Method] Whether the arrow has a stream of critical hit particles flying + * behind it. Called by chance + */ + public void setCritical(boolean flag) { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (flag) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 1))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -2))); + } + } + + /** + * Whether the arrow has a stream of critical hit particles flying behind it. + */ + @Override + public boolean getIsCritical() { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + return (b0 & 1) != 0; + } + + /** + * The old critical method called on full charge, I use my own + */ + @Override + public void setIsCritical(boolean flag) { + + } + + public float getHitDamage() { + float dam = 2.0F; + ItemStack arrowStack = getArrowStack(); + if (arrowStack != null) { + if (arrowStack.getItem() instanceof IArrowMF) { + dam = ((IArrowMF) arrowStack.getItem()).getDamageModifier(arrowStack); + } + } + if (getEntityData().hasKey("MF_Bow_Damage")) { + dam *= getEntityData().getFloat("MF_Bow_Damage"); + } + return dam; + } + + public float getGravityModifier() { + ItemStack arrowStack = getArrowStack(); + if (arrowStack != null) { + if (arrowStack.getItem() instanceof IArrowMF) { + return ((IArrowMF) arrowStack.getItem()).getGravityModifier(arrowStack); + } + } + return 1.0F; + } + + public float getBreakChance() { + ItemStack arrowStack = getArrowStack(); + if (arrowStack != null) { + if (arrowStack.getItem() instanceof IArrowMF) { + return ((IArrowMF) arrowStack.getItem()).getBreakChance(this, arrowStack); + } + } + return 1.0F; + } + + @SideOnly(Side.CLIENT) + public String getTexture() { + return "textures/projectile/" + getCustomTex(); + } + + public ItemStack getPickedUpItem() { + return getArrowStack(); + } + + private ItemStack getArrowStack() { + if (getEntityData().hasKey("MF_ArrowItem")) { + NBTTagCompound heldArrow = getEntityData().getCompoundTag("MF_ArrowItem"); + return ItemStack.loadItemStackFromNBT(heldArrow); + } + return new ItemStack(Items.arrow); + } + + /** + * Saves the arrow to the NBT + * + * @param arrow + */ + private void setArrowStack(ItemStack arrow) { + NBTTagCompound arrowNBT = new NBTTagCompound(); + arrow.writeToNBT(arrowNBT); + getEntityData().setTag("MF_ArrowItem", arrowNBT); + } + + private void updateTex(String tex) { + dataWatcher.updateObject(texture_dw, tex); + } + + private String getCustomTex() { + try { + return dataWatcher.getWatchableObjectString(texture_dw); + } catch (Exception e) { + MFLogUtil.logWarn("Arrow Failed To Load Texture"); + return "steel_arrow"; + } + } + + @Override + public boolean canBePickedUp() { + if (isMagicArrow()) { + return false; + } + if (didArrowBreak()) { + breakArrow(); + return false; + } + return canBePickedUp == 1; + } + + private void breakArrow() { + getEntityData().setBoolean("hasBroken_MFArrow", true); + } + + private boolean didArrowBreak() { + if (isExplosive()) { + return false; + } + float c = rand.nextFloat(); + float br = getBreakChance() * ConfigWeapon.arrowBreakMod; + return c < br; + } + + @Override + public ItemStack getDroppedItem() { + return getArrowStack(); + } + + @Override + public float[] getDamageRatio(Object... implement) { + if (isExplosive()) { + return new float[]{0, 1, 0}; + } + if (arrowtype != null) { + return arrowtype.ratio; + } + return new float[]{0, 0, 1}; + } + + public void modifyVelocity(float velocity) { + this.velocityModifier = velocity; + motionX *= velocity; + motionY *= velocity; + motionZ *= velocity; + } + + @Override + public float getPenetrationLevel(Object implement) { + return arrowtype == ArrowType.BROADHEAD ? -0.5F : 0F; + } + + public void setPower(float f) { + power = f; + } + + public EntityArrowMF setBombStats(int powder, int filling) { + getEntityData().setInteger("powder", powder); + getEntityData().setInteger("filling", filling); + getEntityData().setBoolean("Explosive", true); + return this; + } + + public void explode() { + worldObj.playSoundAtEntity(this, "random.explode", 0.3F, 10F - 5F); + worldObj.createExplosion(this, posX, posY, posZ, 0, false); + if (!this.worldObj.isRemote) { + double area = getRangeOfBlast() * 2D; + AxisAlignedBB var3 = this.boundingBox.expand(area, area / 2, area); List var4 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, var3); - if (var4 != null && !var4.isEmpty()) - { + if (var4 != null && !var4.isEmpty()) { Iterator splashDamage = var4.iterator(); - while (splashDamage.hasNext()) - { - Entity entityHit = (Entity)splashDamage.next(); + while (splashDamage.hasNext()) { + Entity entityHit = (Entity) splashDamage.next(); double distanceToEntity = this.getDistanceToEntity(entityHit); double radius = getRangeOfBlast(); - if (distanceToEntity < radius) - { - float dam = getExplosionDamage(); - - if(distanceToEntity > radius/2) - { - double sc = distanceToEntity-(radius/2); - if(sc < 0)sc = 0; - if(sc > (radius/2))sc = (radius/2); - dam *= (sc / (radius/2)); - } - if(!(entityHit instanceof EntityItem)) - { - DamageSource source = causeBombDamage(this, shootingEntity != null ? shootingEntity:this); - source.setExplosion(); - if(getFilling() == 2) - { - source.setFireDamage(); - } - entityHit.attackEntityFrom(source, dam); - } + if (distanceToEntity < radius) { + float dam = getExplosionDamage(); + + if (distanceToEntity > radius / 2) { + double sc = distanceToEntity - (radius / 2); + if (sc < 0) + sc = 0; + if (sc > (radius / 2)) + sc = (radius / 2); + dam *= (sc / (radius / 2)); + } + if (!(entityHit instanceof EntityItem)) { + DamageSource source = causeBombDamage(this, shootingEntity != null ? shootingEntity : this); + source.setExplosion(); + if (getFilling() == 2) { + source.setFireDamage(); + } + entityHit.attackEntityFrom(source, dam); + } } } } this.setDead(); } - + int filling = getFilling(); - if(filling > 0) - { - for(int a = 0; a < 16; a++) - { - float range = 0.6F; - EntityShrapnel shrapnel = new EntityShrapnel(worldObj, posX, posY+0.5D, posZ, (rand.nextDouble()-0.5)*range, (rand.nextDouble()-0.5)*range, (rand.nextDouble()-0.5)*range); - - if(filling == 2) - { - shrapnel.setFire(10); - } - worldObj.spawnEntityInWorld(shrapnel); - } + if (filling > 0) { + for (int a = 0; a < 16; a++) { + float range = 0.6F; + EntityShrapnel shrapnel = new EntityShrapnel(worldObj, posX, posY + 0.5D, posZ, + (rand.nextDouble() - 0.5) * range, (rand.nextDouble() - 0.5) * range, + (rand.nextDouble() - 0.5) * range); + + if (filling == 2) { + shrapnel.setFire(10); + } + worldObj.spawnEntityInWorld(shrapnel); + } } - } - private int getFilling() - { - return getEntityData().getInteger("filling"); - } - private int getPowder() - { - return getEntityData().getInteger("powder"); - } - - private EnumExplosiveType getBlast() - { - return EnumExplosiveType.getType((byte)getFilling()); - } - private EnumPowderType getPowderType() - { - return EnumPowderType.getType((byte)getPowder()); - } - private double getRangeOfBlast() - { - return getBlast().range * getPowderType().rangeModifier*0.5F; - } - - private int getExplosionDamage() - { - return (int)(getBlast().damage* getPowderType().damageModifier*0.5F); - } - public static DamageSource causeBombDamage(Entity bomb, Entity user) - { - return (new EntityDamageSourceBomb(bomb, user)).setProjectile(); } - - public boolean isMagicArrow() - { - CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(getArrowStack()); - return material != null && material.type.equalsIgnoreCase("magic"); - } + + private int getFilling() { + return getEntityData().getInteger("filling"); + } + + private int getPowder() { + return getEntityData().getInteger("powder"); + } + + private EnumExplosiveType getBlast() { + return EnumExplosiveType.getType((byte) getFilling()); + } + + private EnumPowderType getPowderType() { + return EnumPowderType.getType((byte) getPowder()); + } + + private double getRangeOfBlast() { + return getBlast().range * getPowderType().rangeModifier * 0.5F; + } + + private int getExplosionDamage() { + return (int) (getBlast().damage * getPowderType().damageModifier * 0.5F); + } + + public boolean isMagicArrow() { + CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(getArrowStack()); + return material != null && material.type.equalsIgnoreCase("magic"); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/EntityBomb.java b/src/main/java/minefantasy/mf2/entity/EntityBomb.java index 73f2b316..8df26f76 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityBomb.java +++ b/src/main/java/minefantasy/mf2/entity/EntityBomb.java @@ -1,15 +1,14 @@ package minefantasy.mf2.entity; -import java.util.Iterator; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.item.gadget.EnumCasingType; import minefantasy.mf2.item.gadget.EnumExplosiveType; import minefantasy.mf2.item.gadget.EnumFuseType; import minefantasy.mf2.item.gadget.EnumPowderType; import minefantasy.mf2.mechanics.CombatMechanics; +import minefantasy.mf2.util.BukkitUtils; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -17,7 +16,6 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; @@ -25,14 +23,18 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class EntityBomb extends Entity -{ - /** How long the fuse is */ +import java.util.Iterator; +import java.util.List; + +public class EntityBomb extends Entity { + private final int typeId = 2; + /** + * How long the fuse is + */ public int fuse; private EntityLivingBase thrower; - public EntityBomb(World world) - { + public EntityBomb(World world) { super(world); this.fuse = getFuseTime(); this.preventEntitySpawning = true; @@ -40,37 +42,41 @@ public EntityBomb(World world) this.yOffset = this.height / 2.0F; } - public EntityBomb(World world, EntityLivingBase thrower) - { + public EntityBomb(World world, EntityLivingBase thrower) { this(world); this.thrower = thrower; - - this.setLocationAndAngles(thrower.posX, thrower.posY + thrower.getEyeHeight(), thrower.posZ, thrower.rotationYaw, thrower.rotationPitch); - this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F; + + this.setLocationAndAngles(thrower.posX, thrower.posY + thrower.getEyeHeight(), thrower.posZ, + thrower.rotationYaw, thrower.rotationPitch); + this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.posY -= 0.10000000149011612D; - this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F; + this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(this.posX, this.posY, this.posZ); - - float force = this.getThrownForce() + (CombatMechanics.getStrengthEnhancement(thrower)/4); - + + float force = this.getThrownForce() + (CombatMechanics.getStrengthEnhancement(thrower) / 4); + float f = 0.4F; - this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f; - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f; - this.motionY = -MathHelper.sin((this.rotationPitch + this.getThrownOffset()) / 180.0F * (float)Math.PI) * f; + this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI) * f; + this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI) * f; + this.motionY = -MathHelper.sin((this.rotationPitch + this.getThrownOffset()) / 180.0F * (float) Math.PI) * f; this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, force, 1.0F); - + this.prevPosX = posX; this.prevPosY = posY; this.prevPosZ = posZ; } - - private int getFuseTime() - { - return (this.fuse = getFuseType().time) + (isSticky() ? 20 : 0); - } - public void setThrowableHeading(double x, double y, double z, float offset, float force) - { + public static DamageSource causeBombDamage(Entity bomb, Entity user) { + return (new EntityDamageSourceBomb(bomb, user)).setProjectile(); + } + + private int getFuseTime() { + return (this.fuse = getFuseType().time) + (isSticky() ? 20 : 0); + } + + public void setThrowableHeading(double x, double y, double z, float offset, float force) { float f2 = MathHelper.sqrt_double(x * x + y * y + z * z); x /= f2; y /= f2; @@ -85,43 +91,41 @@ public void setThrowableHeading(double x, double y, double z, float offset, floa 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, 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, f3) * 180.0D / Math.PI); } - protected float getThrownOffset() - { + + protected float getThrownOffset() { return 0.0F; } - protected float getThrownForce() - { + + protected float getThrownForce() { return 1.5F; } - + @Override - protected void entityInit() - { - dataWatcher.addObject(typeId, (byte)0); - dataWatcher.addObject(typeId+1, (byte)0); - dataWatcher.addObject(typeId+2, (byte)0); - dataWatcher.addObject(typeId+3, (byte)0); + protected void entityInit() { + dataWatcher.addObject(typeId, (byte) 0); + dataWatcher.addObject(typeId + 1, (byte) 0); + dataWatcher.addObject(typeId + 2, (byte) 0); + dataWatcher.addObject(typeId + 3, (byte) 0); } /** - * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to - * prevent them from trampling crops + * returns if this entity triggers Block.onEntityWalking on the blocks they walk + * on. used for spiders and wolves to prevent them from trampling crops */ @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return false; } /** - * Returns true if other Entities should be prevented from moving through this Entity. + * Returns true if other Entities should be prevented from moving through this + * Entity. */ @Override - public boolean canBeCollidedWith() - { + public boolean canBeCollidedWith() { return true; } @@ -129,8 +133,7 @@ public boolean canBeCollidedWith() * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { + public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; @@ -140,105 +143,86 @@ public void onUpdate() this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; - if (this.onGround) - { - double d = 0.75D; + if (this.onGround) { + double d = 0.75D; this.motionX *= d; this.motionZ *= d; this.motionY *= -0.99D; } List collide = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox); - if (!collide.isEmpty() && !(thrower != null && collide.contains(thrower))) - { - if(isSticky()) - { - Object object = collide.get(0); - if(object instanceof Entity && object != this) - { - if(this.ridingEntity == null && ((Entity) object).riddenByEntity == null && canStick((Entity) object)) - { - this.mountEntity((Entity) object); - this.fuse = getFuseTime(); - } - } - } - this.motionX = motionZ = 0; + if (!collide.isEmpty() && !(thrower != null && collide.contains(thrower))) { + if (isSticky()) { + Object object = collide.get(0); + if (object instanceof Entity && object != this) { + if (this.ridingEntity == null && ((Entity) object).riddenByEntity == null + && canStick((Entity) object)) { + this.mountEntity((Entity) object); + this.fuse = getFuseTime(); + } + } + } + this.motionX = motionZ = 0; } - if (this.fuse-- <= 0) - { + if (this.fuse-- <= 0) { this.setDead(); - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { this.explode(); } - } - else - { + } else { this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.125D, this.posZ, 0.0D, 0.0D, 0.0D); this.worldObj.spawnParticle("flame", this.posX, this.posY + 0.125D, this.posZ, 0.0D, 0.0D, 0.0D); } - - if(!worldObj.isRemote && this.ridingEntity != null && ridingEntity instanceof EntityLivingBase) - { - if(!(ridingEntity instanceof EntityChicken)) - { - CombatMechanics.panic((EntityLivingBase)ridingEntity, 1.0F, 30); - } + + if (!worldObj.isRemote && this.ridingEntity != null && ridingEntity instanceof EntityLivingBase) { + if (!(ridingEntity instanceof EntityChicken)) { + CombatMechanics.panic((EntityLivingBase) ridingEntity, 1.0F, 30); + } + } + if (isStuckInBlock()) { + motionX = motionY = motionZ = 0; } - if(isStuckInBlock()) - { - motionX = motionY = motionZ = 0; + } + + private boolean canStick(Entity entity) { + return !(entity instanceof EntityCogwork); + } + + @Override + public void mountEntity(Entity object) { + super.mountEntity(object); + + if (object instanceof EntityChicken) { + EntityChicken chook = (EntityChicken) object; + Entity target = worldObj.findNearestEntityWithinAABB(IMob.class, chook.boundingBox.expand(64, 8, 64), + chook); + if (target != null) { + if (target instanceof EntityLivingBase) { + chook.setCustomNameTag("Suicide Chook!"); + fuse = getFuseTime() * 2; + chook.getNavigator().clearPathEntity(); + chook.setAttackTarget((EntityLivingBase) target); + chook.targetTasks.addTask(1, new EntityAIAttackOnCollide(chook, IMob.class, 1.25D, true)); + chook.setAIMoveSpeed(0.5F); + } + } } } - - private boolean canStick(Entity entity) - { - return ! (entity instanceof EntityCogwork); - } - - @Override - public void mountEntity(Entity object) - { - super.mountEntity(object); - - if(object instanceof EntityChicken) - { - EntityChicken chook = (EntityChicken)object; - Entity target = worldObj.findNearestEntityWithinAABB(IMob.class, chook.boundingBox.expand(64, 8, 64),chook); - if(target != null) - { - if(target instanceof EntityLivingBase) - { - chook.setCustomNameTag("Suicide Chook!"); - fuse = getFuseTime()*2; - chook.getNavigator().clearPathEntity(); - chook.setAttackTarget((EntityLivingBase)target); - chook.targetTasks.addTask(1, new EntityAIAttackOnCollide(chook, IMob.class, 1.25D, true)); - chook.setAIMoveSpeed(0.5F); - } - } - } - } - - private boolean isStuckInBlock() - { - return false;//isSticky() && isAABBInSolid(boundingBox.expand(0.5D, 0.5D, 0.5D)); - } - - private boolean isSticky() - { - return getEntityData().hasKey("stickyBomb"); - } - - private double getGravityModifier() - { - return isStuckInBlock() ? 0F : getCase().weightModifier; - } - - private void explode2() - { + + private boolean isStuckInBlock() { + return false;// isSticky() && isAABBInSolid(boundingBox.expand(0.5D, 0.5D, 0.5D)); + } + + private boolean isSticky() { + return getEntityData().hasKey("stickyBomb"); + } + + private double getGravityModifier() { + return isStuckInBlock() ? 0F : getCase().weightModifier; + } + + private void explode2() { float power = 3.5F; this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, power, false); } @@ -247,194 +231,174 @@ private void explode2() * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - protected void writeEntityToNBT(NBTTagCompound nbt) - { - nbt.setByte("Fuse", (byte)this.fuse); + protected void writeEntityToNBT(NBTTagCompound nbt) { + nbt.setByte("Fuse", (byte) this.fuse); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - protected void readEntityFromNBT(NBTTagCompound nbt) - { + protected void readEntityFromNBT(NBTTagCompound nbt) { this.fuse = nbt.getByte("Fuse"); } @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() - { + @SideOnly(Side.CLIENT) + public float getShadowSize() { return 0.25F; } /** * returns null or the entityliving it was placed or ignited by */ - public EntityLivingBase getTntPlacedBy() - { + public EntityLivingBase getTntPlacedBy() { return this.thrower; } - + @Override - public void applyEntityCollision(Entity entity) - { - if(!(thrower != null && thrower == entity)) - { + public void applyEntityCollision(Entity entity) { + if (!(thrower != null && thrower == entity)) { this.motionX = 0; this.motionZ = 0; - } - } - - public void explode() - { - worldObj.playSoundAtEntity(this, "random.explode", 0.3F, 10F - 5F); - worldObj.createExplosion(this, posX, posY, posZ, 0, false); - if (!this.worldObj.isRemote) - { - double area = getRangeOfBlast()*2D; - AxisAlignedBB var3 = this.boundingBox.expand(area, area/2, area); + } + } + + public void explode() { + worldObj.playSoundAtEntity(this, "random.explode", 0.3F, 10F - 5F); + worldObj.createExplosion(this, posX, posY, posZ, 0, false); + if (!this.worldObj.isRemote) { + double area = getRangeOfBlast() * 2D; + AxisAlignedBB var3 = this.boundingBox.expand(area, area / 2, area); List var4 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, var3); - if (var4 != null && !var4.isEmpty()) - { + if (var4 != null && !var4.isEmpty()) { Iterator splashDamage = var4.iterator(); - while (splashDamage.hasNext()) - { - Entity entityHit = (Entity)splashDamage.next(); - double distanceToEntity = this.getDistanceToEntity(entityHit); + while (splashDamage.hasNext()) { + Entity entityHit = (Entity) splashDamage.next(); + + if (MineFantasyII.isBukkitServer() + && BukkitUtils.cantDamage(thrower != null ? thrower : this, entityHit)) { + continue; + } + double distanceToEntity = this.getDistanceToEntity(entityHit); double radius = getRangeOfBlast(); - if (distanceToEntity < radius) - { - float dam = getDamage(); - - if(getCasing() != 2 && distanceToEntity > radius/2) - { - double sc = distanceToEntity-(radius/2); - if(sc < 0)sc = 0; - if(sc > (radius/2))sc = (radius/2); - dam *= (sc / (radius/2)); - } - if(!(entityHit instanceof EntityItem)) - { - DamageSource source = causeBombDamage(this, thrower != null ? thrower:this); - source.setExplosion(); - if(getFilling() == 2) - { - source.setFireDamage(); - } - if(ridingEntity != null && entityHit == ridingEntity) - { - dam *= 1.5F; - } - if(entityHit.attackEntityFrom(source, dam)) - { - applyEffects(entityHit); - } - } + if (distanceToEntity < radius) { + float dam = getDamage(); + + if (getCasing() != 2 && distanceToEntity > radius / 2) { + double sc = distanceToEntity - (radius / 2); + if (sc < 0) + sc = 0; + if (sc > (radius / 2)) + sc = (radius / 2); + dam *= (sc / (radius / 2)); + } + if (!(entityHit instanceof EntityItem)) { + + DamageSource source = causeBombDamage(this, thrower != null ? thrower : this); + source.setExplosion(); + if (getFilling() == 2) { + source.setFireDamage(); + } + if (ridingEntity != null && entityHit == ridingEntity) { + dam *= 1.5F; + } + if (entityHit.attackEntityFrom(source, dam)) { + applyEffects(entityHit); + } + } } } } this.setDead(); } - + int t = getFilling(); - if(t > 0) - { - for(int a = 0; a < 16; a++) - { - float range = 0.6F; - EntityShrapnel shrapnel = new EntityShrapnel(worldObj, posX, posY+0.5D, posZ, (rand.nextDouble()-0.5)*range, (rand.nextDouble()-0.5F)*range, (rand.nextDouble()-0.5)*range); - - if(t == 2) - { - shrapnel.setFire(10); - } - worldObj.spawnEntityInWorld(shrapnel); - } + if (t > 0) { + for (int a = 0; a < 16; a++) { + float range = 0.6F; + EntityShrapnel shrapnel = new EntityShrapnel(worldObj, posX, posY + 0.5D, posZ, + (rand.nextDouble() - 0.5) * range, (rand.nextDouble() - 0.5F) * range, + (rand.nextDouble() - 0.5) * range); + + if (t == 2) { + shrapnel.setFire(10); + } + worldObj.spawnEntityInWorld(shrapnel); + } + } + } + + private void applyEffects(Entity hit) { + if (getFilling() == 2) { + hit.setFire(5); + } + if (hit instanceof EntityLivingBase) { + EntityLivingBase live = (EntityLivingBase) hit; } - } - private void applyEffects(Entity hit) - { - if(getFilling() == 2) - { - hit.setFire(5); - } - if(hit instanceof EntityLivingBase) - { - EntityLivingBase live = (EntityLivingBase)hit; - } - } - - private double getRangeOfBlast() - { - return getBlast().range * getCase().rangeModifier * getPowderType().rangeModifier; - } - - private int getDamage() - { - return (int)(getBlast().damage* getCase().damageModifier * getPowderType().damageModifier); - } - - public static DamageSource causeBombDamage(Entity bomb, Entity user) - { - return (new EntityDamageSourceBomb(bomb, user)).setProjectile(); } - - public boolean canEntityBeSeen(Entity entity) - { - return this.worldObj.rayTraceBlocks(Vec3.createVectorHelper(this.posX, this.posY + this.getEyeHeight(), this.posZ), Vec3.createVectorHelper(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ)) == null; - } - - private final int typeId = 2; - public byte getFilling() - { - return dataWatcher.getWatchableObjectByte(typeId); - } - public byte getCasing() - { - return dataWatcher.getWatchableObjectByte(typeId+1); - } - public byte getFuse() - { - return dataWatcher.getWatchableObjectByte(typeId+2); - } - public byte getPowder() - { - return dataWatcher.getWatchableObjectByte(typeId+3); - } - public EntityBomb setType(byte fill, byte casing, byte fuse, byte powder) - { - dataWatcher.updateObject(typeId, fill); - dataWatcher.updateObject(typeId+1, casing); - dataWatcher.updateObject(typeId+2, fuse); - dataWatcher.updateObject(typeId+3, powder); - - this.fuse = getFuseType().time; - - return this; - } - private EnumExplosiveType getBlast() - { - return EnumExplosiveType.getType(getFilling()); - } - private EnumCasingType getCase() - { - return EnumCasingType.getType(getCasing()); - } - private EnumFuseType getFuseType() - { - return EnumFuseType.getType(getFuse()); - } - private EnumPowderType getPowderType() - { - return EnumPowderType.getType(getPowder()); - } - - public boolean isAABBInSolid(AxisAlignedBB field) - { + + private double getRangeOfBlast() { + return getBlast().range * getCase().rangeModifier * getPowderType().rangeModifier; + } + + private int getDamage() { + return (int) (getBlast().damage * getCase().damageModifier * getPowderType().damageModifier); + } + + public boolean canEntityBeSeen(Entity entity) { + return this.worldObj.rayTraceBlocks( + Vec3.createVectorHelper(this.posX, this.posY + this.getEyeHeight(), this.posZ), + Vec3.createVectorHelper(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ)) == null; + } + + public byte getFilling() { + return dataWatcher.getWatchableObjectByte(typeId); + } + + public byte getCasing() { + return dataWatcher.getWatchableObjectByte(typeId + 1); + } + + public byte getFuse() { + return dataWatcher.getWatchableObjectByte(typeId + 2); + } + + public byte getPowder() { + return dataWatcher.getWatchableObjectByte(typeId + 3); + } + + public EntityBomb setType(byte fill, byte casing, byte fuse, byte powder) { + dataWatcher.updateObject(typeId, fill); + dataWatcher.updateObject(typeId + 1, casing); + dataWatcher.updateObject(typeId + 2, fuse); + dataWatcher.updateObject(typeId + 3, powder); + + this.fuse = getFuseType().time; + + return this; + } + + private EnumExplosiveType getBlast() { + return EnumExplosiveType.getType(getFilling()); + } + + private EnumCasingType getCase() { + return EnumCasingType.getType(getCasing()); + } + + private EnumFuseType getFuseType() { + return EnumFuseType.getType(getFuse()); + } + + private EnumPowderType getPowderType() { + return EnumPowderType.getType(getPowder()); + } + + public boolean isAABBInSolid(AxisAlignedBB field) { int i = MathHelper.floor_double(field.minX); int j = MathHelper.floor_double(field.maxX + 1.0D); int k = MathHelper.floor_double(field.minY); @@ -442,26 +406,20 @@ public boolean isAABBInSolid(AxisAlignedBB field) int i1 = MathHelper.floor_double(field.minZ); int j1 = MathHelper.floor_double(field.maxZ + 1.0D); - for (int k1 = i; k1 < j; ++k1) - { - for (int l1 = k; l1 < l; ++l1) - { - for (int i2 = i1; i2 < j1; ++i2) - { + for (int k1 = i; k1 < j; ++k1) { + for (int l1 = k; l1 < l; ++l1) { + for (int i2 = i1; i2 < j1; ++i2) { Block block = worldObj.getBlock(k1, l1, i2); - if (block.getMaterial().isSolid()) - { + if (block.getMaterial().isSolid()) { int j2 = worldObj.getBlockMetadata(k1, l1, i2); - double d0 = (double)(l1 + 1); + double d0 = l1 + 1; - if (j2 < 8) - { - d0 = (double)(l1 + 1) - (double)j2 / 8.0D; + if (j2 < 8) { + d0 = l1 + 1 - j2 / 8.0D; } - if (d0 >= field.minY) - { + if (d0 >= field.minY) { return true; } } diff --git a/src/main/java/minefantasy/mf2/entity/EntityCogwork.java b/src/main/java/minefantasy/mf2/entity/EntityCogwork.java index 3fb4dd4b..4227ae65 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityCogwork.java +++ b/src/main/java/minefantasy/mf2/entity/EntityCogwork.java @@ -4,11 +4,7 @@ import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.armour.ArmourDesign; import minefantasy.mf2.api.armour.IPowerArmour; -import minefantasy.mf2.api.helpers.ArmourCalculator; -import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.PowerArmour; -import minefantasy.mf2.api.helpers.TacticalManager; -import minefantasy.mf2.api.helpers.ToolHelper; +import minefantasy.mf2.api.helpers.*; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigArmour; @@ -35,587 +31,528 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.common.ForgeHooks; -public class EntityCogwork extends EntityLivingBase implements IPowerArmour -{ - public static float base_fuel_minutes = 20F; - - private static final float general_step_height = 1.0F; - private int noMoveTime = 0; - public EntityCogwork(World world) - { - super(world); - this.stepHeight = general_step_height; - this.preventEntitySpawning = true; - this.setSize(1.5F, 2.5F); - } - public EntityCogwork(World world, double posX, double posY, double posZ) - { - this(world); - this.setPosition(posX, posY, posZ); - } - - @Override - protected void entityInit() - { +public class EntityCogwork extends EntityLivingBase implements IPowerArmour { + public static final float base_armour_units = 30F; + private static final float general_step_height = 1.0F; + private static final float base_frame_weight = 100F; + public static float base_fuel_minutes = 20F; + public static int maxBolts = 16; + public static int allowedBulk = 1; + public static float rating_modifier = 1.0F; + public static float health_modifier = 1.0F; + private int noMoveTime = 0; + private ItemStack[] items = new ItemStack[]{}; + private float forwardControl, strafeControl; + private boolean jumpControl; + private int jumpTimer = 0; + private boolean alternateStep; + + public EntityCogwork(World world) { + super(world); + this.stepHeight = general_step_height; + this.preventEntitySpawning = true; + this.setSize(1.5F, 2.5F); + } + + public EntityCogwork(World world, double posX, double posY, double posZ) { + this(world); + this.setPosition(posX, posY, posZ); + } + + @SideOnly(Side.CLIENT) + public static int getArmourRating(CustomMaterial base) { + if (base != null) { + float ratio = base.hardness * ArmourDesign.COGWORK.getRating() * rating_modifier; + return (int) (ratio * ArmourCalculator.armourRatingScale); + } + return 0; + } + + @Override + protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(12, ""); this.dataWatcher.addObject(13, Float.valueOf(0F)); this.dataWatcher.addObject(14, Integer.valueOf(0)); } - - - public void setBolts(int value) - { + + public int getBolts() { + return this.dataWatcher.getWatchableObjectInt(14); + } + + public void setBolts(int value) { this.dataWatcher.updateObject(14, value); } - public int getBolts() - { - return this.dataWatcher.getWatchableObjectInt(14); + public float getFuel() { + return this.dataWatcher.getWatchableObjectFloat(13); } - - - public void setFuel(float level) - { + + public void setFuel(float level) { this.dataWatcher.updateObject(13, level); } - public float getFuel() - { - return this.dataWatcher.getWatchableObjectFloat(13); + public String getCustomMaterial() { + return this.dataWatcher.getWatchableObjectString(12); } - - public void setCustomMaterial(String name) - { - if(name.length() == 0) - { - setHealth(getMaxHealth()); - } + + public void setCustomMaterial(String name) { + if (name.length() == 0) { + setHealth(getMaxHealth()); + } this.dataWatcher.updateObject(12, name); } - public String getCustomMaterial() - { - return this.dataWatcher.getWatchableObjectString(12); + @Override + public ItemStack getHeldItem() { + return null; } - @Override - public ItemStack getHeldItem() { - return null; - } - @Override - public ItemStack getEquipmentInSlot(int p_71124_1_) { - return null; - } - @Override - public void setCurrentItemOrArmor(int p_70062_1_, ItemStack p_70062_2_) { - } - private ItemStack[] items = new ItemStack[]{}; - @Override - public ItemStack[] getLastActiveItems() { - return items; - } - - @Override - public void onUpdate() - { + @Override + public ItemStack getEquipmentInSlot(int p_71124_1_) { + return null; + } + + @Override + public void setCurrentItemOrArmor(int p_70062_1_, ItemStack p_70062_2_) { + } + + @Override + public ItemStack[] getLastActiveItems() { + return items; + } + + @Override + public void onUpdate() { super.onUpdate(); - if(noMoveTime > 0) - { - moveForward = moveStrafing = 0; - --noMoveTime; - } - + if (noMoveTime > 0) { + moveForward = moveStrafing = 0; + --noMoveTime; + } + float fuel = this.getFuel(); float maxfuel = this.getMaxFuel(); - if(isPowered()) - { - fuel -= getFuelDecay(); - } + if (isPowered()) { + fuel -= getFuelDecay(); + } fuel = MathHelper.clamp_float(fuel, 0F, maxfuel); setFuel(fuel); - - /* if(isSprinting()) - { - if(riddenByEntity == null || this.getMoveForward() <= 0 || !isPowered()) - { - setSprinting(false); - } - }*/ - if(this.riddenByEntity != null) - { - stepHeight = general_step_height; - updateRider(); - if(riddenByEntity.isBurning() && this.isFullyArmoured()) - { - riddenByEntity.extinguish(); - } - - //ARROWS - if(riddenByEntity instanceof EntityLivingBase) - { - int arrows = ((EntityLivingBase)riddenByEntity).getArrowCountInEntity(); - ((EntityLivingBase)riddenByEntity).setArrowCountInEntity(0); - int my_arrows = this.getArrowCountInEntity(); - this.setArrowCountInEntity(my_arrows + arrows); - - if(this.isFullyArmoured()) - { - ((EntityLivingBase)riddenByEntity).setAir(300); - } - - if(ticksExisted % 20 == 0) - { - for(int a = 0; a < 4; a ++) - { - if(!allowEquipment( (EntityLivingBase)riddenByEntity) ) - { - riddenByEntity.mountEntity(null); - break; - } - } - } - } - - //DAMAGE - if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0) - { - int i = MathHelper.floor_double(this.posX); - int j = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset); - int k = MathHelper.floor_double(this.posZ); - Block block = this.worldObj.getBlock(i, j, k); - - if (block.getMaterial() != Material.air) - { - this.worldObj.spawnParticle("blockcrack_" + Block.getIdFromBlock(block) + "_" + this.worldObj.getBlockMetadata(i, j, k), this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.boundingBox.minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, 4.0D * ((double)this.rand.nextFloat() - 0.5D), 0.5D, ((double)this.rand.nextFloat() - 0.5D) * 4.0D); - } - if(!worldObj.isRemote && ConfigArmour.cogworkGrief) - { - damageBlock(block, i, j, k, worldObj.getBlockMetadata(i, j, k)); - block = this.worldObj.getBlock(i, j+1, k); - damageSurface(block, i, j+1, k, worldObj.getBlockMetadata(i, j, k)); - } - } - } - else - { - motionX = motionZ = 0; - this.setMoveForward(0F); - this.setMoveStrafe(0F); - stepHeight = 0; - this.limbSwing = this.limbSwingAmount = this.prevLimbSwingAmount = 0; - this.rotationPitch = 20F; - this.rotationYawHead = this.rotationYaw; - this.prevRotationYawHead = this.prevRotationYaw; - this.swingProgress = this.swingProgressInt = 0; + + /* + * if(isSprinting()) { if(riddenByEntity == null || this.getMoveForward() <= 0 + * || !isPowered()) { setSprinting(false); } } + */ + if (this.riddenByEntity != null) { + stepHeight = general_step_height; + updateRider(); + if (riddenByEntity.isBurning() && this.isFullyArmoured()) { + riddenByEntity.extinguish(); + } + + // ARROWS + if (riddenByEntity instanceof EntityLivingBase) { + int arrows = ((EntityLivingBase) riddenByEntity).getArrowCountInEntity(); + ((EntityLivingBase) riddenByEntity).setArrowCountInEntity(0); + int my_arrows = this.getArrowCountInEntity(); + this.setArrowCountInEntity(my_arrows + arrows); + + if (this.isFullyArmoured()) { + ((EntityLivingBase) riddenByEntity).setAir(300); + } + + if (ticksExisted % 20 == 0) { + for (int a = 0; a < 4; a++) { + if (!allowEquipment((EntityLivingBase) riddenByEntity)) { + riddenByEntity.mountEntity(null); + break; + } + } + } + } + + // DAMAGE + if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D + && this.rand.nextInt(5) == 0) { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY - 0.20000000298023224D - this.yOffset); + int k = MathHelper.floor_double(this.posZ); + Block block = this.worldObj.getBlock(i, j, k); + + if (block.getMaterial() != Material.air) { + this.worldObj.spawnParticle( + "blockcrack_" + Block.getIdFromBlock(block) + "_" + this.worldObj.getBlockMetadata(i, j, k), + this.posX + (this.rand.nextFloat() - 0.5D) * this.width, this.boundingBox.minY + 0.1D, + this.posZ + (this.rand.nextFloat() - 0.5D) * this.width, + 4.0D * (this.rand.nextFloat() - 0.5D), 0.5D, (this.rand.nextFloat() - 0.5D) * 4.0D); + } + if (!worldObj.isRemote && ConfigArmour.cogworkGrief) { + damageBlock(block, i, j, k, worldObj.getBlockMetadata(i, j, k)); + block = this.worldObj.getBlock(i, j + 1, k); + damageSurface(block, i, j + 1, k, worldObj.getBlockMetadata(i, j, k)); + } + } + } else { + motionX = motionZ = 0; + this.setMoveForward(0F); + this.setMoveStrafe(0F); + stepHeight = 0; + this.limbSwing = this.limbSwingAmount = this.prevLimbSwingAmount = 0; + this.rotationPitch = 20F; + this.rotationYawHead = this.rotationYaw; + this.prevRotationYawHead = this.prevRotationYaw; + this.swingProgress = this.swingProgressInt = 0; } - if(jumpTimer > 0) - { - --jumpTimer; + if (jumpTimer > 0) { + --jumpTimer; } onPortalTick(); } - - /** - * Modifier for actions and fuel decay (weight of the suit) - */ - private float getFuelCost() - { - float mass = this.getWeight(); - return mass/200F; - } - /** - * Rate of constant fuel droppage - * @return - */ - private float getFuelDecay() - { - return getFuelCost() * (isSprinting() ? 3.0F : 1.0F); - } - private void damageBlock(Block block, int x, int y, int z, int blockMetadata) - { - if(block == Blocks.grass || block == Blocks.farmland) - { - worldObj.setBlock(x, y, z, Blocks.dirt, 0, 2); - } - if(block.getMaterial() == Material.glass) - { - worldObj.setBlockToAir(x, y, z); - this.worldObj.playSoundEffect(x+0.5D, y+0.5D, z+0.5D, "dig.glass", 1.0F, 0.9F+(rand.nextFloat() * 0.2F)); - } - if(block == Blocks.ice) - { - worldObj.setBlock(x, y, z, Blocks.water, 0, 2); - this.worldObj.playSoundEffect(x+0.5D, y+0.5D, z+0.5D, "dig.glass", 1.0F, 0.9F+(rand.nextFloat() * 0.2F)); - } - if(block.getMaterial() == Material.leaves) - { - worldObj.setBlock(x, y, z, Blocks.water, 0, 2); - this.worldObj.playSoundEffect(x+0.5D, y+0.5D, z+0.5D, "dig.grass", 1.0F, 0.9F+(rand.nextFloat() * 0.2F)); - } - } - private void damageSurface(Block block, int x, int y, int z, int blockMetadata) - { - if(block.getBlockHardness(worldObj, x, y, z) == 0 && (block.getMaterial() == Material.vine || block.getMaterial() == Material.plants)) - { - worldObj.setBlockToAir(x, y, z); - this.worldObj.playSoundEffect(x+0.5D, y+0.5D, z+0.5D, "dig.grass", 1.0F, 0.9F+(rand.nextFloat() * 0.2F)); - } - if(block == Blocks.snow_layer) - { - worldObj.setBlockToAir(x, y, z); - this.worldObj.playSoundEffect(x+0.5D, y+0.5D, z+0.5D, "dig.cloth", 1.0F, 0.9F+(rand.nextFloat() * 0.2F)); - } - } - @Override - public void knockBack(Entity hitter, float f, double d, double d1) - { - } - - public CustomMaterial getPlating() - { - return CustomMaterial.getMaterial(getCustomMaterial()); - } - public void updateRider() - { - if(!isPowered())return; - - if(worldObj.isRemote && riddenByEntity != null && riddenByEntity instanceof EntityPlayer) - { - float forward = ((EntityPlayer)riddenByEntity).moveForward; - float strafe = ((EntityPlayer)riddenByEntity).moveStrafing; - - if(riddenByEntity instanceof EntityClientPlayerMP) - { - boolean jump = ClientProxyMF.isUserJumpCommand(riddenByEntity); - if(jump != jumpControl || forward != forwardControl || strafe != strafeControl) - { - this.forwardControl = forward; - this.strafeControl = strafe; - this.jumpControl = jump; - - ((EntityClientPlayerMP)riddenByEntity).sendQueue.addToSendQueue(new CogworkControlPacket(this).generatePacket()); - } - } - } - if(ticksExisted % 100 == 0) - { - if(rand.nextInt(20) == 0) - { - this.playSound("minefantasy2:entity.cogwork.toot", 0.5F, 1.0F); - } - this.playSound("minefantasy2:entity.cogwork.idle", 0.5F, 0.75F + rand.nextFloat()*0.5F); - } - - if (!worldObj.isRemote) - { - if(this.jumpControl && jumpTimer == 0) - { - this.jumpTimer = 10; - } - if (!this.isInWater() && !this.handleLavaMovement()) - { - if (this.onGround && jumpTimer == 8) - { + + /** + * Modifier for actions and fuel decay (weight of the suit) + */ + private float getFuelCost() { + float mass = this.getWeight(); + return mass / 200F; + } + + /** + * Rate of constant fuel droppage + * + * @return + */ + private float getFuelDecay() { + return getFuelCost() * (isSprinting() ? 3.0F : 1.0F); + } + + private void damageBlock(Block block, int x, int y, int z, int blockMetadata) { + if (block == Blocks.grass || block == Blocks.farmland) { + worldObj.setBlock(x, y, z, Blocks.dirt, 0, 2); + } + if (block.getMaterial() == Material.glass) { + worldObj.setBlockToAir(x, y, z); + this.worldObj.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "dig.glass", 1.0F, + 0.9F + (rand.nextFloat() * 0.2F)); + } + if (block == Blocks.ice) { + worldObj.setBlock(x, y, z, Blocks.water, 0, 2); + this.worldObj.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "dig.glass", 1.0F, + 0.9F + (rand.nextFloat() * 0.2F)); + } + if (block.getMaterial() == Material.leaves) { + worldObj.setBlock(x, y, z, Blocks.water, 0, 2); + this.worldObj.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "dig.grass", 1.0F, + 0.9F + (rand.nextFloat() * 0.2F)); + } + } + + private void damageSurface(Block block, int x, int y, int z, int blockMetadata) { + if (block.getBlockHardness(worldObj, x, y, z) == 0 + && (block.getMaterial() == Material.vine || block.getMaterial() == Material.plants)) { + worldObj.setBlockToAir(x, y, z); + this.worldObj.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "dig.grass", 1.0F, + 0.9F + (rand.nextFloat() * 0.2F)); + } + if (block == Blocks.snow_layer) { + worldObj.setBlockToAir(x, y, z); + this.worldObj.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "dig.cloth", 1.0F, + 0.9F + (rand.nextFloat() * 0.2F)); + } + } + + @Override + public void knockBack(Entity hitter, float f, double d, double d1) { + } + + public CustomMaterial getPlating() { + return CustomMaterial.getMaterial(getCustomMaterial()); + } + + public void updateRider() { + if (!isPowered()) + return; + + if (worldObj.isRemote && riddenByEntity != null && riddenByEntity instanceof EntityPlayer) { + float forward = ((EntityPlayer) riddenByEntity).moveForward; + float strafe = ((EntityPlayer) riddenByEntity).moveStrafing; + + if (riddenByEntity instanceof EntityClientPlayerMP) { + boolean jump = ClientProxyMF.isUserJumpCommand(riddenByEntity); + if (jump != jumpControl || forward != forwardControl || strafe != strafeControl) { + this.forwardControl = forward; + this.strafeControl = strafe; + this.jumpControl = jump; + + ((EntityClientPlayerMP) riddenByEntity).sendQueue + .addToSendQueue(new CogworkControlPacket(this).generatePacket()); + } + } + } + if (ticksExisted % 100 == 0) { + if (rand.nextInt(20) == 0) { + this.playSound("minefantasy2:entity.cogwork.toot", 0.5F, 1.0F); + } + this.playSound("minefantasy2:entity.cogwork.idle", 0.5F, 0.75F + rand.nextFloat() * 0.5F); + } + + if (!worldObj.isRemote) { + if (this.jumpControl && jumpTimer == 0) { + this.jumpTimer = 10; + } + if (!this.isInWater() && !this.handleLavaMovement()) { + if (this.onGround && jumpTimer == 8) { this.jump(); } } } - } - protected void jump() - { - spendFuel(5F); - worldObj.playSoundEffect(posX, posY, posZ, "tile.piston.out", 2.0F, 1.0F); + } + + protected void jump() { + spendFuel(5F); + worldObj.playSoundEffect(posX, posY, posZ, "tile.piston.out", 2.0F, 1.0F); this.motionY = 0.41999998688697815D; - if (this.isSprinting()) - { + if (this.isSprinting()) { float f = this.rotationYaw * 0.017453292F; - this.motionX -= (double)(MathHelper.sin(f) * 0.2F); - this.motionZ += (double)(MathHelper.cos(f) * 0.2F); + this.motionX -= MathHelper.sin(f) * 0.2F; + this.motionZ += MathHelper.cos(f) * 0.2F; } this.isAirBorne = true; ForgeHooks.onLivingJump(this); } - - private void spendFuel(float cost) - { - this.setFuel(Math.max(0F, getFuel() - cost*getFuelCost()) ); - } - @Override - public boolean isSprinting() - { + + private void spendFuel(float cost) { + this.setFuel(Math.max(0F, getFuel() - cost * getFuelCost())); + } + + @Override + public boolean isSprinting() { return isPowered() && forwardControl > 0 && riddenByEntity != null && riddenByEntity.isSprinting(); } - private float forwardControl, strafeControl; - private boolean jumpControl; - private int jumpTimer = 0; - - public void setMoveForward(float f) - { - forwardControl = f; - } - public float getMoveForward() - { - return forwardControl; - } - public void setMoveStrafe(float f) - { - strafeControl = f; - } - public float getMoveStrafe() - { - return strafeControl; - } - public void setJumpControl(boolean b) - { - this.jumpControl = b;; - } - public boolean getJumpControl() - { - return jumpControl; - } - protected void applyEntityAttributes() - { + + public float getMoveForward() { + return forwardControl; + } + + public void setMoveForward(float f) { + forwardControl = f; + } + + public float getMoveStrafe() { + return strafeControl; + } + + public void setMoveStrafe(float f) { + strafeControl = f; + } + + public boolean getJumpControl() { + return jumpControl; + } + + public void setJumpControl(boolean b) { + this.jumpControl = b; + ; + } + + protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25F); } - - @Override - public boolean shouldRiderFaceForward(EntityPlayer player) - { + + @Override + public boolean shouldRiderFaceForward(EntityPlayer player) { return true; } - - @Override - public boolean shouldRiderSit() - { - return false; - } - - @Override - public double getMountedYOffset() - { - return 0.8625D; - } - @Override - public boolean canBeCollidedWith() - { + + @Override + public boolean shouldRiderSit() { + return false; + } + + @Override + public double getMountedYOffset() { + return 0.8625D; + } + + @Override + public boolean canBeCollidedWith() { return riddenByEntity == null && super.canBeCollidedWith(); } - - @Override - public boolean canBePushed() - { + + @Override + public boolean canBePushed() { return false; } - public static int maxBolts = 16; - @Override - public boolean interactFirst(EntityPlayer user) - { - if(user.isSwingInProgress) - { - return false; - } - - ItemStack item = user.getHeldItem(); - if(item != null) - { - float fuel_item = PowerArmour.getFuelValue(item); - if(fuel_item > 0) - { - float fuel = getFuel(); - float max = getMaxFuel(); - if(fuel < max) - { - fuel += Math.max(0F, fuel_item * ConfigArmour.cogworkFuelUnits); - if(fuel > max) - { - fuel = max; - } - setFuel(fuel); - - if(!user.capabilities.isCreativeMode) - { - --item.stackSize; - - ItemStack container = item.getItem().getContainerItem(item); - if(container != null) - { - if(item.stackSize >= 1) - { - if(!user.inventory.addItemStackToInventory(container)) - { - user.entityDropItem(container, 0F); - } - } - } - if(item.stackSize <= 0) - { - user.setCurrentItemOrArmor(0, container); - } - } - } - return true; - } - if(this.riddenByEntity != null) - { - return false; - } - if(this.isUnderRepairFrame()) - { - if(getPlating() == null && item.getItem() == ComponentListMF.cogwork_armour) - { - CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); - if(material != null) - { - this.playSound("mob.horse.armor", 1.0F, 1.0F); - int boltCount = this.getBolts(); - if(boltCount < maxBolts) - { - if(!user.isSwingInProgress && user.capabilities.isCreativeMode || user.inventory.consumeInventoryItem(ComponentListMF.bolt)) - { - ++boltCount; - setBolts(boltCount); - } - user.swingItem(); - return true; - } - this.setCustomMaterial(material.name); - float damagePercent = 1F - ((float)item.getItemDamage() / (float)item.getMaxDamage()); - this.setHealth(getMaxHealth() * damagePercent); - if(!user.capabilities.isCreativeMode) - { - --item.stackSize; - if(item.stackSize <= 0) - { - user.setCurrentItemOrArmor(0, null); - } - } - user.swingItem(); - return true; - } - } - if(this.getPlating() != null && ToolHelper.getCrafterTool(item).equalsIgnoreCase("spanner")) - { - this.playSound("mob.horse.armor", 1.2F, 1.0F); - user.swingItem(); - int boltCount = this.getBolts(); - if(boltCount > 0) - { - if(!worldObj.isRemote) - { - ItemStack bolt = new ItemStack(ComponentListMF.bolt, boltCount); - if(!user.capabilities.isCreativeMode && !user.inventory.addItemStackToInventory(bolt)) - { - this.entityDropItem(bolt, 0.0F); - } - } - setBolts(0); - } - float damagePercent = 1F - (getHealth() / getMaxHealth()); - if(!worldObj.isRemote) - { - ItemStack armour = ComponentListMF.cogwork_armour.createComm(getPlating().name, 1, damagePercent); - if(!user.capabilities.isCreativeMode && !user.inventory.addItemStackToInventory(armour)) - { - this.entityDropItem(armour, 0.0F); - } - } - this.playSound("mob.irongolem.hit", 1.0F, 1.0F); - this.setCustomMaterial(""); - return true; - } - } - } - if(user.ridingEntity == null) - { - if(!this.allowEquipment(user)) - { - return true; - } - else - { - this.noMoveTime = 20; - user.moveForward = user.moveStrafing = 0F; - user.mountEntity(this); - this.playSound("tile.piston.in", 1.0F, 0.6F); - return true; - } - } - return false; - } - - private float getMaxFuel() { - return base_fuel_minutes * 1200F; - } - public static int allowedBulk = 1; - private boolean allowEquipment(EntityLivingBase user) - { - if(allowedBulk >= 2) - { - return true;//Any Armour - } - - float bulk = ArmourCalculator.getEquipmentBulk(user); - if(allowedBulk >= 0) - { - if(bulk > allowedBulk) - { - if(user instanceof EntityPlayer && worldObj.isRemote) - { - ((EntityPlayer)user).addChatComponentMessage(new ChatComponentTranslation("vehicle.tooBigArmour")); - } - return false; - } - return true; - } - for(int a = 0; a < 4; a ++) - { - if(user.getEquipmentInSlot(a+1) != null) - { - if(user instanceof EntityPlayer && worldObj.isRemote) - { - ((EntityPlayer)user).addChatComponentMessage(new ChatComponentTranslation("vehicle.noArmour")); - } - return false; - } - } - return true; - } - @Override - protected boolean isMovementBlocked() - { + + @Override + public boolean interactFirst(EntityPlayer user) { + if (user.isSwingInProgress) { + return false; + } + + ItemStack item = user.getHeldItem(); + if (item != null) { + float fuel_item = PowerArmour.getFuelValue(item); + if (fuel_item > 0) { + float fuel = getFuel(); + float max = getMaxFuel(); + if (fuel < max) { + fuel += Math.max(0F, fuel_item * ConfigArmour.cogworkFuelUnits); + if (fuel > max) { + fuel = max; + } + setFuel(fuel); + + if (!user.capabilities.isCreativeMode) { + --item.stackSize; + + ItemStack container = item.getItem().getContainerItem(item); + if (container != null) { + if (item.stackSize >= 1) { + if (!user.inventory.addItemStackToInventory(container)) { + user.entityDropItem(container, 0F); + } + } + } + if (item.stackSize <= 0) { + user.setCurrentItemOrArmor(0, container); + } + } + } + return true; + } + if (this.riddenByEntity != null) { + return false; + } + if (this.isUnderRepairFrame()) { + if (getPlating() == null && item.getItem() == ComponentListMF.cogwork_armour) { + CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(item); + if (material != null) { + this.playSound("mob.horse.armor", 1.0F, 1.0F); + int boltCount = this.getBolts(); + if (boltCount < maxBolts) { + if (!user.isSwingInProgress && user.capabilities.isCreativeMode + || user.inventory.consumeInventoryItem(ComponentListMF.bolt)) { + ++boltCount; + setBolts(boltCount); + } + user.swingItem(); + return true; + } + this.setCustomMaterial(material.name); + float damagePercent = 1F - ((float) item.getItemDamage() / (float) item.getMaxDamage()); + this.setHealth(getMaxHealth() * damagePercent); + if (!user.capabilities.isCreativeMode) { + --item.stackSize; + if (item.stackSize <= 0) { + user.setCurrentItemOrArmor(0, null); + } + } + user.swingItem(); + return true; + } + } + if (this.getPlating() != null && ToolHelper.getCrafterTool(item).equalsIgnoreCase("spanner")) { + this.playSound("mob.horse.armor", 1.2F, 1.0F); + user.swingItem(); + int boltCount = this.getBolts(); + if (boltCount > 0) { + if (!worldObj.isRemote) { + ItemStack bolt = new ItemStack(ComponentListMF.bolt, boltCount); + if (!user.capabilities.isCreativeMode && !user.inventory.addItemStackToInventory(bolt)) { + this.entityDropItem(bolt, 0.0F); + } + } + setBolts(0); + } + float damagePercent = 1F - (getHealth() / getMaxHealth()); + if (!worldObj.isRemote) { + ItemStack armour = ComponentListMF.cogwork_armour.createComm(getPlating().name, 1, + damagePercent); + if (!user.capabilities.isCreativeMode && !user.inventory.addItemStackToInventory(armour)) { + this.entityDropItem(armour, 0.0F); + } + } + this.playSound("mob.irongolem.hit", 1.0F, 1.0F); + this.setCustomMaterial(""); + return true; + } + } + } + if (user.ridingEntity == null) { + if (!this.allowEquipment(user)) { + return true; + } else { + this.noMoveTime = 20; + user.moveForward = user.moveStrafing = 0F; + user.mountEntity(this); + this.playSound("tile.piston.in", 1.0F, 0.6F); + return true; + } + } + return false; + } + + private float getMaxFuel() { + return base_fuel_minutes * 1200F; + } + + private boolean allowEquipment(EntityLivingBase user) { + if (allowedBulk >= 2) { + return true;// Any Armour + } + + float bulk = ArmourCalculator.getEquipmentBulk(user); + if (allowedBulk >= 0) { + if (bulk > allowedBulk) { + if (user instanceof EntityPlayer && worldObj.isRemote) { + ((EntityPlayer) user).addChatComponentMessage(new ChatComponentTranslation("vehicle.tooBigArmour")); + } + return false; + } + return true; + } + for (int a = 0; a < 4; a++) { + if (user.getEquipmentInSlot(a + 1) != null) { + if (user instanceof EntityPlayer && worldObj.isRemote) { + ((EntityPlayer) user).addChatComponentMessage(new ChatComponentTranslation("vehicle.noArmour")); + } + return false; + } + } return true; } - - @Override - public boolean isPowered() - { - return noMoveTime == 0 && getFuel() > 0 && riddenByEntity != null; - } - @Override - public void moveEntityWithHeading(float strafe, float forward) - { - if (isPowered() && this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase) - { - EntityLivingBase user = (EntityLivingBase)riddenByEntity; - + + @Override + protected boolean isMovementBlocked() { + return true; + } + + @Override + public boolean isPowered() { + return noMoveTime == 0 && getFuel() > 0 && riddenByEntity != null; + } + + @Override + public void moveEntityWithHeading(float strafe, float forward) { + if (isPowered() && this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase) { + EntityLivingBase user = (EntityLivingBase) riddenByEntity; + this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw; this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F; this.setRotation(this.rotationYaw, this.rotationPitch); this.rotationYawHead = this.renderYawOffset = this.rotationYaw; strafe = MathHelper.clamp_float(this.getMoveStrafe(), -1F, 1F) * 0.5F; forward = MathHelper.clamp_float(this.getMoveForward(), -1F, 1F) * 0.5F; - - if (forward <= 0.0F) - { - forward *= 0.5F;//Backstep slower + + if (forward <= 0.0F) { + forward *= 0.5F;// Backstep slower } - if (!this.worldObj.isRemote) - { - this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue()); + if (!this.worldObj.isRemote) { + this.setAIMoveSpeed( + (float) this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue()); moveCogwork(strafe, forward); } @@ -624,132 +561,112 @@ public void moveEntityWithHeading(float strafe, float forward) double d0 = this.posZ - this.prevPosZ; float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F; - if (f4 > 1.0F) - { + if (f4 > 1.0F) { f4 = 1.0F; } user.limbSwingAmount += (f4 - user.limbSwingAmount) * 0.4F; user.limbSwing += user.limbSwingAmount; + } else { + super.moveEntityWithHeading(strafe, forward); } - else - { - super.moveEntityWithHeading(strafe, forward); - } } - - private float getSpeedModifier() - { - return isSprinting() ? 2.0F : 1.0F; - } - public void moveCogwork(float p_70612_1_, float p_70612_2_) - { + + private float getSpeedModifier() { + return isSprinting() ? 2.0F : 1.0F; + } + + public void moveCogwork(float p_70612_1_, float p_70612_2_) { double d0; - if (this.isInWater() || this.handleLavaMovement()) - { + if (this.isInWater() || this.handleLavaMovement()) { d0 = this.posY; this.motionY -= 0.03D; - if (this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + 0.6000000238418579D - this.posY + d0, this.motionZ)) - { + if (this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, + this.motionY + 0.6000000238418579D - this.posY + d0, this.motionZ)) { this.motionY = 0.30000001192092896D; } } { float f2 = 0.91F; - if (this.onGround) - { - f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; + if (this.onGround) { + f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; } float f3 = 0.16277136F / (f2 * f2 * f2); float f4; - if (this.onGround) - { + if (this.onGround) { f4 = this.getAIMoveSpeed() * f3; - } - else - { + } else { f4 = this.jumpMovementFactor; } - if(riddenByEntity == null) - { - f4 = 0F; + if (riddenByEntity == null) { + f4 = 0F; } - if(isSprinting()) - { - f4 *= 2.0F; + if (isSprinting()) { + f4 *= 2.0F; } this.moveFlying(p_70612_1_, p_70612_2_, f4); f2 = 0.91F; - if (this.onGround) - { - f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; + if (this.onGround) { + f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; } - if (this.isOnLadder()) - { + if (this.isOnLadder()) { float f5 = 0.15F; - if (this.motionX < (double)(-f5)) - { - this.motionX = (double)(-f5); + if (this.motionX < (-f5)) { + this.motionX = (-f5); } - if (this.motionX > (double)f5) - { - this.motionX = (double)f5; + if (this.motionX > f5) { + this.motionX = f5; } - if (this.motionZ < (double)(-f5)) - { - this.motionZ = (double)(-f5); + if (this.motionZ < (-f5)) { + this.motionZ = (-f5); } - if (this.motionZ > (double)f5) - { - this.motionZ = (double)f5; + if (this.motionZ > f5) { + this.motionZ = f5; } this.fallDistance = 0.0F; - if (this.motionY < -0.15D) - { + if (this.motionY < -0.15D) { this.motionY = -0.15D; } } this.moveEntity(this.motionX, this.motionY, this.motionZ); - if (this.isCollidedHorizontally && this.isOnLadder()) - { + if (this.isCollidedHorizontally && this.isOnLadder()) { this.motionY = 0.2D; } - if (this.worldObj.isRemote && (!this.worldObj.blockExists((int)this.posX, 0, (int)this.posZ) || !this.worldObj.getChunkFromBlockCoords((int)this.posX, (int)this.posZ).isChunkLoaded)) - { - if (this.posY > 0.0D) - { + if (this.worldObj.isRemote && (!this.worldObj.blockExists((int) this.posX, 0, (int) this.posZ) + || !this.worldObj.getChunkFromBlockCoords((int) this.posX, (int) this.posZ).isChunkLoaded)) { + if (this.posY > 0.0D) { this.motionY = -0.1D; - } - else - { + } else { this.motionY = 0.0D; } - } - else - { + } else { this.motionY -= 0.08D; } this.motionY *= 0.9800000190734863D; - this.motionX *= (double)f2; - this.motionZ *= (double)f2; + this.motionX *= f2; + this.motionZ *= f2; } this.prevLimbSwingAmount = this.limbSwingAmount; @@ -757,283 +674,246 @@ public void moveCogwork(float p_70612_1_, float p_70612_2_) double d1 = this.posZ - this.prevPosZ; float f6 = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F; - if (f6 > 1.0F) - { + if (f6 > 1.0F) { f6 = 1.0F; } this.limbSwingAmount += (f6 - this.limbSwingAmount) * 0.4F; this.limbSwing += this.limbSwingAmount; } - - @Override - public void writeEntityToNBT(NBTTagCompound nbt) - { + + @Override + public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); nbt.setString("Plating", this.getCustomMaterial()); nbt.setFloat("Fuel", getFuel()); nbt.setInteger("Bolts", getBolts()); } - @Override - public void readEntityFromNBT(NBTTagCompound nbt) - { + + @Override + public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); - if (nbt.hasKey("Plating", 8) && nbt.getString("Plating").length() > 0) - { + if (nbt.hasKey("Plating", 8) && nbt.getString("Plating").length() > 0) { this.setCustomMaterial(nbt.getString("Plating")); } this.setFuel(nbt.getFloat("Fuel")); setBolts(nbt.getInteger("Bolts")); } - - @Override - public boolean canBreatheUnderwater() - { + + @Override + public boolean canBreatheUnderwater() { return true; } - + /** * Returns the sound this mob makes on death. */ - @Override - protected String getDeathSound() - { + @Override + protected String getDeathSound() { return "mob.irongolem.death"; } - - @Override - protected String getHurtSound() - { + + @Override + protected String getHurtSound() { return "mob.irongolem.hurt"; } - - private boolean alternateStep; + @Override - protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) - { - String s = alternateStep ? "in" : "out"; - alternateStep = !alternateStep; - this.playSound("tile.piston."+s, 0.25F, 1.0F); + protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { + String s = alternateStep ? "in" : "out"; + alternateStep = !alternateStep; + this.playSound("tile.piston." + s, 0.25F, 1.0F); this.playSound("mob.irongolem.walk", 1.0F, 1.0F); } - - @Override - protected void updatePotionEffects() - { - } - - @Override - public void addPotionEffect(PotionEffect effect) - { - } - - @Override - public boolean isPotionApplicable(PotionEffect effect) - { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void performHurtAnimation() - { - } - - @Override - public float getAIMoveSpeed() - { - return riddenByEntity == null ? 1F : super.getAIMoveSpeed(); - } - @Override - public boolean isFullyArmoured() { - return getPlating() != null; - } - @Override - public boolean attackEntityFrom(DamageSource source, float damage) - { - return attackEntityFrom(source, damage, true); - } - /** - * Modified attackEntityFrom - * @param shouldPass is used to determine if the wearer should take the hit - */ - public boolean attackEntityFrom(DamageSource source, float damage, boolean shouldPass) - { - if(shouldPass && this.riddenByEntity != null) - { - return this.riddenByEntity.attackEntityFrom(source, damage); - } - - if(source.isExplosion()) - { - this.noMoveTime = 20; - damage *= 1.5F; - } - return super.attackEntityFrom(source, modifyDamage(this, damage, source)); - } - public boolean shouldBlockPoisonOrMagic() - { - return getPlating() != null; - } - @Override - public float modifyDamage(EntityLivingBase user, float damage, DamageSource src) - { - if(src.getDamageType().equalsIgnoreCase("humanstomp")) - { - return 0F; - } - if(src == DamageSource.wither || src.isMagicDamage()) - { - return shouldBlockPoisonOrMagic() ? 0F : damage; - } - - if(user != this) - { - this.attackEntityFrom(src, damage, false); - } - - float AC = 2.0F; - float fResist = 0.0F; - CustomMaterial plating = getPlating(); - if(plating != null) - { - AC = plating.hardness * ArmourDesign.COGWORK.getRating() * rating_modifier; - fResist = plating.getFireResistance() / 100F; - } - - if(src.isFireDamage()) - { - if(user == this) - { - return damage * MathHelper.clamp_float(1F-fResist, 0F, 1F); - } - else if(isFullyArmoured()) - { - return 0F;//All or nothing depends on if armour is full - } - } - if(user == this) - { - return damage; - } - - if(src.isUnblockable() && !isFullyArmoured()) - { - return damage; - } - return damage * 1F/AC; - } - - @Override - public void setFire(int i) - { - } - - @Override - protected void damageEntity(DamageSource source, float dam) - { - CustomMaterial plating = this.getPlating(); - boolean canDestroy = false;//Only spanner or fire can destroy frames - boolean isFrame = plating == null; - - if(source.getSourceOfDamage() != null && source.getSourceOfDamage() instanceof EntityLivingBase) - { - canDestroy = ToolHelper.getCrafterTool(((EntityLivingBase)source.getSourceOfDamage()).getHeldItem()).equalsIgnoreCase("spanner"); + + @Override + protected void updatePotionEffects() { + } + + @Override + public void addPotionEffect(PotionEffect effect) { + } + + @Override + public boolean isPotionApplicable(PotionEffect effect) { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void performHurtAnimation() { + } + + @Override + public float getAIMoveSpeed() { + return riddenByEntity == null ? 1F : super.getAIMoveSpeed(); + } + + @Override + public boolean isFullyArmoured() { + return getPlating() != null; + } + + @Override + public boolean attackEntityFrom(DamageSource source, float damage) { + return attackEntityFrom(source, damage, true); + } + + /** + * Modified attackEntityFrom + * + * @param shouldPass is used to determine if the wearer should take the hit + */ + public boolean attackEntityFrom(DamageSource source, float damage, boolean shouldPass) { + if (shouldPass && this.riddenByEntity != null) { + return this.riddenByEntity.attackEntityFrom(source, damage); } - if(source.isFireDamage() || source.canHarmInCreative()) - { - canDestroy = true; + + if (source.isExplosion()) { + this.noMoveTime = 20; + damage *= 1.5F; } - - - if(isFrame) - { - if(canDestroy && riddenByEntity == null) - { - setHealth(0); - } - else - { - setHealth(getMaxHealth()); - } - return; + return super.attackEntityFrom(source, modifyDamage(this, damage, source)); + } + + public boolean shouldBlockPoisonOrMagic() { + return getPlating() != null; + } + + @Override + public float modifyDamage(EntityLivingBase user, float damage, DamageSource src) { + if (src.getDamageType().equalsIgnoreCase("humanstomp")) { + return 0F; } - else if (dam != 0.0F) - { - if(plating != null) - { - float HP = plating.durability * ArmourDesign.COGWORK.getDurability() * 20F * health_modifier; - dam *= (this.getMaxHealth() / HP); - } + if (src == DamageSource.wither || src.isMagicDamage()) { + return shouldBlockPoisonOrMagic() ? 0F : damage; + } + + if (user != this) { + this.attackEntityFrom(src, damage, false); + } + + float AC = 2.0F; + float fResist = 0.0F; + CustomMaterial plating = getPlating(); + if (plating != null) { + AC = plating.hardness * ArmourDesign.COGWORK.getRating() * rating_modifier; + fResist = plating.getFireResistance() / 100F; + } + + if (src.isFireDamage()) { + if (user == this) { + return damage * MathHelper.clamp_float(1F - fResist, 0F, 1F); + } else if (isFullyArmoured()) { + return 0F;// All or nothing depends on if armour is full + } + } + if (user == this) { + return damage; + } + + if (src.isUnblockable() && !isFullyArmoured()) { + return damage; + } + return damage * 1F / AC; + } + + @Override + public void setFire(int i) { + } + + @Override + protected void damageEntity(DamageSource source, float dam) { + CustomMaterial plating = this.getPlating(); + boolean canDestroy = false;// Only spanner or fire can destroy frames + boolean isFrame = plating == null; + + if (source.getSourceOfDamage() != null && source.getSourceOfDamage() instanceof EntityLivingBase) { + canDestroy = ToolHelper.getCrafterTool(((EntityLivingBase) source.getSourceOfDamage()).getHeldItem()) + .equalsIgnoreCase("spanner"); + } + if (source.isFireDamage() || source.canHarmInCreative()) { + canDestroy = true; + } + + if (isFrame) { + if (canDestroy && riddenByEntity == null) { + setHealth(0); + } else { + setHealth(getMaxHealth()); + } + return; + } else if (dam != 0.0F) { + if (plating != null) { + float HP = plating.durability * ArmourDesign.COGWORK.getDurability() * 20F * health_modifier; + dam *= (this.getMaxHealth() / HP); + } dam = this.applyPotionDamageCalculations(source, dam); - - - float hp = this.getHealth() - dam; - if(hp <= 1.0F) - { - hp = getMaxHealth(); - destroyArmour(); - } - this.setHealth(hp); - - if(!source.isFireDamage()) - { - this.playSound("mob.irongolem.hit", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + + float hp = this.getHealth() - dam; + if (hp <= 1.0F) { + hp = getMaxHealth(); + destroyArmour(); + } + this.setHealth(hp); + + if (!source.isFireDamage()) { + this.playSound("mob.irongolem.hit", 1.0F, + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); } } } - - private void destroyArmour() - { - this.setCustomMaterial(""); - } - @Override - public void heal(float amount) - { - } - @SideOnly(Side.CLIENT) - public int getMetreScaled(int i) - { - return (int)((float)i / getMaxFuel() * getFuel()); - } - - @Override - protected void fall(float distance) - { - if(distance > 2) - { - float power = Math.min(distance/2F, 3F); - initImpactLanding(posX, posY, posZ, power / 2F, ConfigArmour.cogworkGrief); - } - } - - public Shockwave initImpactLanding(double x, double y, double z, float power, boolean grief) - { - noMoveTime = 10; + + private void destroyArmour() { + this.setCustomMaterial(""); + } + + @Override + public void heal(float amount) { + } + + @SideOnly(Side.CLIENT) + public int getMetreScaled(int i) { + return (int) (i / getMaxFuel() * getFuel()); + } + + @Override + protected void fall(float distance) { + if (distance > 2) { + float power = Math.min(distance / 2F, 3F); + initImpactLanding(posX, posY, posZ, power / 2F, ConfigArmour.cogworkGrief); + } + } + + public Shockwave initImpactLanding(double x, double y, double z, float power, boolean grief) { + noMoveTime = 10; return newShockwave(x, y, z, power, false, grief); } - - @Override - protected void collideWithEntity(Entity hit) - { - super.collideWithEntity(hit); - if(!isSprinting() || !isPowered() || hit == riddenByEntity) - { - return; - } - this.playSound(this.getHurtSound(), this.getSoundVolume(), this.getSoundPitch()); - float modifier = width*width*height / hit.width*hit.width*hit.height;//compare volume - float force = (float)Math.hypot(motionX, motionZ) * modifier; - TacticalManager.knockbackEntity(hit, this, force, force/4F); - hit.attackEntityFrom(DamageSource.causeMobDamage( (riddenByEntity != null && riddenByEntity instanceof EntityLivingBase) ? (EntityLivingBase)riddenByEntity : this), force); + + @Override + protected void collideWithEntity(Entity hit) { + super.collideWithEntity(hit); + if (!isSprinting() || !isPowered() || hit == riddenByEntity) { + return; + } + this.playSound(this.getHurtSound(), this.getSoundVolume(), this.getSoundPitch()); + float modifier = width * width * height / hit.width * hit.width * hit.height;// compare volume + float force = (float) Math.hypot(motionX, motionZ) * modifier; + TacticalManager.knockbackEntity(hit, this, force, force / 4F); + hit.attackEntityFrom( + DamageSource.causeMobDamage((riddenByEntity != null && riddenByEntity instanceof EntityLivingBase) + ? (EntityLivingBase) riddenByEntity + : this), + force); } /** - * returns a new explosion. Does initiation (at time of writing Explosion is not finished) + * returns a new explosion. Does initiation (at time of writing Explosion is not + * finished) */ - public Shockwave newShockwave(double x, double y, double z, float power, boolean fire, boolean grief) - { - Shockwave explosion = new Shockwave("humanstomp", worldObj, this.riddenByEntity != null ? this.riddenByEntity : this, x, y, z, power); + public Shockwave newShockwave(double x, double y, double z, float power, boolean fire, boolean grief) { + Shockwave explosion = new Shockwave("humanstomp", worldObj, + this.riddenByEntity != null ? this.riddenByEntity : this, x, y, z, power); explosion.isFlaming = fire; explosion.isGriefing = grief; explosion.isSmoking = grief; @@ -1041,78 +921,53 @@ public Shockwave newShockwave(double x, double y, double z, float power, boolean explosion.decorateWave(true); return explosion; } - + @Override - protected void dropFewItems(boolean pkill, int looting) - { - this.dropItem(Item.getItemFromBlock(BlockListMF.cogwork_helm), 1); - this.dropItem(Item.getItemFromBlock(BlockListMF.cogwork_chest), 1); - this.dropItem(Item.getItemFromBlock(BlockListMF.cogwork_legs), 1); - + protected void dropFewItems(boolean pkill, int looting) { + this.dropItem(Item.getItemFromBlock(BlockListMF.cogwork_helm), 1); + this.dropItem(Item.getItemFromBlock(BlockListMF.cogwork_chest), 1); + this.dropItem(Item.getItemFromBlock(BlockListMF.cogwork_legs), 1); + } + @SideOnly(Side.CLIENT) - public int getArmourRating() - { - return getArmourRating(getPlating()); + public int getArmourRating() { + return getArmourRating(getPlating()); } - public static float rating_modifier = 1.0F; - public static float health_modifier = 1.0F; - @SideOnly(Side.CLIENT) - public static int getArmourRating(CustomMaterial base) - { - if(base != null) - { - float ratio = base.hardness * ArmourDesign.COGWORK.getRating() * rating_modifier; - return (int)(ratio * ArmourCalculator.armourRatingScale); - } - return 0; - } - private static final float base_frame_weight = 100F; - public static final float base_armour_units = 30F; - - public float getWeight() - { - float weight = base_frame_weight;//Weight of frame - CustomMaterial plating = getPlating(); - if(plating != null) - { - weight += plating.density * base_armour_units; - } - return weight; - } - public boolean isUnderRepairFrame() - { - int i = MathHelper.floor_double(this.posX); - int j = MathHelper.floor_double(this.posY +3); + + public float getWeight() { + float weight = base_frame_weight;// Weight of frame + CustomMaterial plating = getPlating(); + if (plating != null) { + weight += plating.density * base_armour_units; + } + return weight; + } + + public boolean isUnderRepairFrame() { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY + 3); int k = MathHelper.floor_double(this.posZ); - - return PowerArmour.isStationBlock(worldObj, i, j, k); - } - - private void onPortalTick() - { - if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) - { + + return PowerArmour.isStationBlock(worldObj, i, j, k); + } + + private void onPortalTick() { + if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) { this.worldObj.theProfiler.startSection("portal"); - MinecraftServer minecraftserver = ((WorldServer)this.worldObj).func_73046_m(); + MinecraftServer minecraftserver = ((WorldServer) this.worldObj).func_73046_m(); int i = this.getMaxInPortalTime(); - if (this.inPortal) - { - if (minecraftserver.getAllowNether()) - { - if (this.ridingEntity == null && this.portalCounter++ >= i) - { + if (this.inPortal) { + if (minecraftserver.getAllowNether()) { + if (this.ridingEntity == null && this.portalCounter++ >= i) { this.portalCounter = i; this.timeUntilPortal = this.getPortalCooldown(); byte b0; - if (this.worldObj.provider.dimensionId == -1) - { + if (this.worldObj.provider.dimensionId == -1) { b0 = 0; - } - else - { + } else { b0 = -1; } this.travelToDimension(b0); @@ -1120,40 +975,34 @@ private void onPortalTick() this.inPortal = false; } - } - else - { - if (this.portalCounter > 0) - { + } else { + if (this.portalCounter > 0) { this.portalCounter -= 4; } - if (this.portalCounter < 0) - { + if (this.portalCounter < 0) { this.portalCounter = 0; } } - if (this.timeUntilPortal > 0) - { + if (this.timeUntilPortal > 0) { --this.timeUntilPortal; } this.worldObj.theProfiler.endSection(); } - } - @Override - public void travelToDimension(int id) - { - if(this.riddenByEntity != null) - { - riddenByEntity.travelToDimension(id); + } + + @Override + public void travelToDimension(int id) { + if (this.riddenByEntity != null) { + riddenByEntity.travelToDimension(id); } - super.travelToDimension(id); + super.travelToDimension(id); + } + + @Override + public boolean isArmoured(String piece) { + return isFullyArmoured(); } - @Override - public boolean isArmoured(String piece) - { - return isFullyArmoured(); - } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/EntityDamageSourceBomb.java b/src/main/java/minefantasy/mf2/entity/EntityDamageSourceBomb.java index c6c2c95b..2ae2c544 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityDamageSourceBomb.java +++ b/src/main/java/minefantasy/mf2/entity/EntityDamageSourceBomb.java @@ -3,12 +3,10 @@ import net.minecraft.entity.Entity; import net.minecraft.util.EntityDamageSourceIndirect; -public class EntityDamageSourceBomb extends EntityDamageSourceIndirect -{ +public class EntityDamageSourceBomb extends EntityDamageSourceIndirect { private Entity thrower; - public EntityDamageSourceBomb(Entity bomb, Entity user) - { + public EntityDamageSourceBomb(Entity bomb, Entity user) { super("bomb", bomb, user); thrower = user; } diff --git a/src/main/java/minefantasy/mf2/entity/EntityDragonBreath.java b/src/main/java/minefantasy/mf2/entity/EntityDragonBreath.java index c7c564f6..1264bd81 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityDragonBreath.java +++ b/src/main/java/minefantasy/mf2/entity/EntityDragonBreath.java @@ -1,31 +1,29 @@ package minefantasy.mf2.entity; -import java.util.Random; - import minefantasy.mf2.entity.mob.DragonBreath; -import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityFireball; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class EntityDragonBreath extends EntityFireball -{ - private static final float size =0.75F; +import java.util.Random; + +public class EntityDragonBreath extends EntityFireball { + private static final float size = 0.75F; + private final int typeId = 2; public Random rand = new Random(); - - public EntityDragonBreath(World world) - { + private DragonBreath breath; + + public EntityDragonBreath(World world) { super(world); this.setSize(size, size); } - public EntityDragonBreath(World world, EntityLivingBase shooter, double xVelocity, double yVelocity, double zVelocity, float spread) - { + public EntityDragonBreath(World world, EntityLivingBase shooter, double xVelocity, double yVelocity, + double zVelocity, float spread) { this(world); this.shootingEntity = shooter; this.setSize(1.0F, 1.0F); @@ -36,93 +34,76 @@ public EntityDragonBreath(World world, EntityLivingBase shooter, double xVelocit xVelocity += this.rand.nextGaussian() * spread; yVelocity += this.rand.nextGaussian() * spread; zVelocity += this.rand.nextGaussian() * spread; - double d3 = (double)MathHelper.sqrt_double(xVelocity * xVelocity + yVelocity * yVelocity + zVelocity * zVelocity); + double d3 = MathHelper.sqrt_double(xVelocity * xVelocity + yVelocity * yVelocity + zVelocity * zVelocity); this.accelerationX = xVelocity / d3 * 0.1D; this.accelerationY = yVelocity / d3 * 0.1D; this.accelerationZ = zVelocity / d3 * 0.1D; } - private final int typeId = 2; @Override - protected void entityInit() - { - dataWatcher.addObject(typeId, 0); - } - public EntityDragonBreath setType(int type) - { - dataWatcher.updateObject(typeId, type); - return this; + protected void entityInit() { + dataWatcher.addObject(typeId, 0); } - + @Override - public void setFire(int time) - { + public void setFire(int time) { } - public int getType() - { - return dataWatcher.getWatchableObjectInt(typeId); + + public int getType() { + return dataWatcher.getWatchableObjectInt(typeId); } - + + public EntityDragonBreath setType(int type) { + dataWatcher.updateObject(typeId, type); + return this; + } + @Override - public void onUpdate() - { - super.onUpdate(); - if(this.ticksExisted >= getLifeSpan()) - { - setDead(); - } - if(ticksExisted % 5 == 0 && shouldExpand()) - { - int lifeScale = (int) Math.floor((float)ticksExisted / 5F); - float newSize = size + (size/4*lifeScale); - this.setSize(newSize, newSize); - } - if(ticksExisted % 10 == 0) - { - for(int x = -1; x <= 1; x++) - { - for(int y = -1; y <= 1; y++) - { - for(int z = -1; z <= 1; z++) - { - int i = (int)posX + x; - int j = (int)posY + y; - int k = (int)posZ + z; - getBreath().hitBlock(worldObj, this, i, j, k, false); - } - } - } - } - } - - private boolean shouldExpand() { - return getBreath().shouldExpand(); - } - - private int getLifeSpan() - { - return getBreath().getLifeSpan(); - } - - /** + public void onUpdate() { + super.onUpdate(); + if (this.ticksExisted >= getLifeSpan()) { + setDead(); + } + if (ticksExisted % 5 == 0 && shouldExpand()) { + int lifeScale = (int) Math.floor(ticksExisted / 5F); + float newSize = size + (size / 4 * lifeScale); + this.setSize(newSize, newSize); + } + if (ticksExisted % 10 == 0) { + for (int x = -1; x <= 1; x++) { + for (int y = -1; y <= 1; y++) { + for (int z = -1; z <= 1; z++) { + int i = (int) posX + x; + int j = (int) posY + y; + int k = (int) posZ + z; + getBreath().hitBlock(worldObj, this, i, j, k, false); + } + } + } + } + } + + private boolean shouldExpand() { + return getBreath().shouldExpand(); + } + + private int getLifeSpan() { + return getBreath().getLifeSpan(); + } + + /** * Called when this EntityFireball hits a block or entity. */ - protected void onImpact(MovingObjectPosition pos) - { - if (!this.worldObj.isRemote) - { - if (pos.entityHit != null && (shootingEntity == null || shootingEntity != pos.entityHit)) - { - getBreath().onHitEntity(pos.entityHit, this); - } - else - { + protected void onImpact(MovingObjectPosition pos) { + if (!this.worldObj.isRemote) { + if (pos.entityHit != null && (shootingEntity == null || shootingEntity != pos.entityHit)) { + getBreath().onHitEntity(pos.entityHit, this); + } else { int i = pos.blockX; int j = pos.blockY; int k = pos.blockZ; - switch (pos.sideHit) - { + switch (pos.sideHit) { case 0: --j; break; @@ -148,78 +129,66 @@ protected void onImpact(MovingObjectPosition pos) } } - /** - * Returns true if other Entities should be prevented from moving through this Entity. + /** + * Returns true if other Entities should be prevented from moving through this + * Entity. */ - public boolean canBeCollidedWith() - { + public boolean canBeCollidedWith() { return false; } /** * Called when the entity is attacked. */ - public boolean attackEntityFrom(DamageSource src, float power) - { + public boolean attackEntityFrom(DamageSource src, float power) { return false; } - - public void modifySpeed(float mod) - { - this.accelerationX *= mod; - this.accelerationY *= mod; - this.accelerationZ *= mod; - } - - public EntityDragonBreath setDamage(float dam) - { - getEntityData().setFloat("Damage", dam); - return this; - } - public float getDamage() - { - if(getEntityData().hasKey("Damage")) - { - return getEntityData().getFloat("Damage"); - } - return 2.0F; - } - private DragonBreath breath; - public DragonBreath getBreath() - { - if(breath == null) - { - DragonBreath load = DragonBreath.projectiles.get(getType()); - if(load != null) - { - breath = load; - } - else - { - breath = DragonBreath.frost; - } - } - return breath; - } - - public DamageSource causeFireblastDamage() - { + + public void modifySpeed(float mod) { + this.accelerationX *= mod; + this.accelerationY *= mod; + this.accelerationZ *= mod; + } + + public float getDamage() { + if (getEntityData().hasKey("Damage")) { + return getEntityData().getFloat("Damage"); + } + return 2.0F; + } + + public EntityDragonBreath setDamage(float dam) { + getEntityData().setFloat("Damage", dam); + return this; + } + + public DragonBreath getBreath() { + if (breath == null) { + DragonBreath load = DragonBreath.projectiles.get(getType()); + if (load != null) { + breath = load; + } else { + breath = DragonBreath.frost; + } + } + return breath; + } + + public DamageSource causeFireblastDamage() { return this.getBreath().getDamageSource(this, this.shootingEntity); } - + @Override - public void writeEntityToNBT(NBTTagCompound nbt) - { + public void writeEntityToNBT(NBTTagCompound nbt) { nbt.setInteger("type", getType()); } + @Override - public void readEntityFromNBT(NBTTagCompound nbt) - { + public void readEntityFromNBT(NBTTagCompound nbt) { setType(nbt.getInteger("type")); } - public String getTextureName() - { - return getBreath().getTexture(this); - } + public String getTextureName() { + return getBreath().getTexture(this); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/EntityFireBlast.java b/src/main/java/minefantasy/mf2/entity/EntityFireBlast.java index 8a2eaed3..cbe0c9db 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityFireBlast.java +++ b/src/main/java/minefantasy/mf2/entity/EntityFireBlast.java @@ -1,119 +1,95 @@ package minefantasy.mf2.entity; -import static net.minecraftforge.common.util.ForgeDirection.UP; import minefantasy.mf2.config.ConfigMobs; import minefantasy.mf2.entity.mob.EntityDragon; import net.minecraft.block.material.Material; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityFireball; import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EntityDamageSourceIndirect; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.IBlockAccess; +import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class EntityFireBlast extends EntityFireball -{ - private static final float size =0.75F; - - public EntityFireBlast(World world) - { +import static net.minecraftforge.common.util.ForgeDirection.UP; + +public class EntityFireBlast extends EntityFireball { + private static final float size = 0.75F; + public static DamageSource blastDamage = (new DamageSource("blastfurn")).setFireDamage(); + public static DamageSource basicDamage = (new DamageSource("fireblastBase")).setFireDamage(); + + public EntityFireBlast(World world) { super(world); this.setInvisible(true); this.setSize(size, size); } - public EntityFireBlast(World world, EntityLivingBase shooter, double xv, double yv, double zv) - { + public EntityFireBlast(World world, EntityLivingBase shooter, double xv, double yv, double zv) { super(world, shooter, xv, yv, zv); this.setInvisible(true); this.setSize(size, size); } - public EntityFireBlast(World world, double x, double y, double z, double xv, double yv, double zv) - { + public EntityFireBlast(World world, double x, double y, double z, double xv, double yv, double zv) { super(world, x, y, z, xv, yv, zv); this.setInvisible(true); this.setSize(size, size); } - + @Override - public void onUpdate() - { - super.onUpdate(); - if(this.ticksExisted >= getLifeSpan()) - { - setDead(); - } - if(ticksExisted % 5 == 0) - { - int lifeScale = (int) Math.floor((float)ticksExisted / 5F); - float newSize = size + (size/4*lifeScale); - this.setSize(newSize, newSize); - } - if(ticksExisted % 10 == 0) - { - for(int x = -1; x <= 1; x++) - { - for(int y = -1; y <= 1; y++) - { - for(int z = -1; z <= 1; z++) - { - int i = (int)posX + x; - int j = (int)posY + y; - int k = (int)posZ + z; - - if (!worldObj.isRemote && canBlockCatchFire(i, j-1, k) && worldObj.isAirBlock(i, j, k) && rand.nextFloat() < getPyro()) - { - this.worldObj.setBlock(i, j, k, Blocks.fire); - } - } - } - } - } - AxisAlignedBB bb = this.boundingBox.expand(1D, 1D, 1D); - if(!worldObj.isRemote) - this.destroyBlocksInAABB(bb); + public void onUpdate() { + super.onUpdate(); + if (this.ticksExisted >= getLifeSpan()) { + setDead(); + } + if (ticksExisted % 5 == 0) { + int lifeScale = (int) Math.floor(ticksExisted / 5F); + float newSize = size + (size / 4 * lifeScale); + this.setSize(newSize, newSize); + } + if (ticksExisted % 10 == 0) { + for (int x = -1; x <= 1; x++) { + for (int y = -1; y <= 1; y++) { + for (int z = -1; z <= 1; z++) { + int i = (int) posX + x; + int j = (int) posY + y; + int k = (int) posZ + z; + + if (!worldObj.isRemote && canBlockCatchFire(i, j - 1, k) && worldObj.isAirBlock(i, j, k) + && rand.nextFloat() < getPyro()) { + this.worldObj.setBlock(i, j, k, Blocks.fire); + } + } + } + } + } + AxisAlignedBB bb = this.boundingBox.expand(1D, 1D, 1D); + if (!worldObj.isRemote) + this.destroyBlocksInAABB(bb); } - private int getLifeSpan() - { - if(isPreset("BlastFurnace")) - { - return 15; - } - return 30; - } + private int getLifeSpan() { + if (isPreset("BlastFurnace")) { + return 15; + } + return 30; + } - /** + /** * Called when this EntityFireball hits a block or entity. */ - protected void onImpact(MovingObjectPosition pos) - { - if (!this.worldObj.isRemote) - { - if (pos.entityHit != null) - { - if (!pos.entityHit.isImmuneToFire()) - { - pos.entityHit.setFire(isPreset("Dragon") ? 2 : 4); - pos.entityHit.attackEntityFrom(causeFireblastDamage(), getDamage()); + protected void onImpact(MovingObjectPosition pos) { + if (!this.worldObj.isRemote) { + if (pos.entityHit != null) { + if (!pos.entityHit.isImmuneToFire()) { + pos.entityHit.setFire(isPreset("Dragon") ? 2 : 4); + pos.entityHit.attackEntityFrom(causeFireblastDamage(), getDamage()); } - } - else - { + } else { int i = pos.blockX; int j = pos.blockY; int k = pos.blockZ; - switch (pos.sideHit) - { + switch (pos.sideHit) { case 0: --j; break; @@ -133,15 +109,13 @@ protected void onImpact(MovingObjectPosition pos) ++i; } - if (!worldObj.isRemote && this.worldObj.isAirBlock(i, j, k) && rand.nextFloat() < getPyro()) - { + if (!worldObj.isRemote && this.worldObj.isAirBlock(i, j, k) && rand.nextFloat() < getPyro()) { this.worldObj.setBlock(i, j, k, Blocks.fire); } boolean tnt = worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ).getMaterial() == Material.tnt; - if(isPreset("BlastFurnace") && (rand.nextInt(50) == 0) || tnt) - { - boolean solid = worldObj.isBlockNormalCubeDefault(pos.blockX, pos.blockY, pos.blockZ, false); - worldObj.newExplosion(this, posX, posY, posZ, solid ? 1.5F : 0.5F, true, true); + if (isPreset("BlastFurnace") && (rand.nextInt(50) == 0) || tnt) { + boolean solid = worldObj.isBlockNormalCubeDefault(pos.blockX, pos.blockY, pos.blockZ, false); + worldObj.newExplosion(this, posX, posY, posZ, solid ? 1.5F : 0.5F, true, true); } } @@ -149,99 +123,87 @@ protected void onImpact(MovingObjectPosition pos) } } - private float getPyro() - { - - if(!ConfigMobs.dragonGriefFire && shootingEntity != null && shootingEntity instanceof EntityDragon) - { - return 0F; - } - - if(getEntityData().hasKey("Pyro")) - { - return getEntityData().getFloat("Pyro"); - } - - return 0.75F; + private float getPyro() { + + if (!ConfigMobs.dragonGriefFire && shootingEntity != null && shootingEntity instanceof EntityDragon) { + return 0F; + } + + if (getEntityData().hasKey("Pyro")) { + return getEntityData().getFloat("Pyro"); + } + + return 0.75F; + } + + public EntityFireBlast setPyro(float dam) { + getEntityData().setFloat("Pyro", dam); + return this; + } + + private float getDamage() { + if (getEntityData().hasKey("Damage")) { + return getEntityData().getFloat("Damage"); + } + + if (isPreset("BlastFurnace")) { + return 8F; + } + return 2.0F; + } + + public EntityFireBlast setDamage(float dam) { + getEntityData().setFloat("Damage", dam); + return this; } - private float getDamage() - { - if(getEntityData().hasKey("Damage")) - { - return getEntityData().getFloat("Damage"); - } - - if(isPreset("BlastFurnace")) - { - return 8F; - } - return 2.0F; - } - - /** - * Returns true if other Entities should be prevented from moving through this Entity. + + /** + * Returns true if other Entities should be prevented from moving through this + * Entity. */ - public boolean canBeCollidedWith() - { + public boolean canBeCollidedWith() { return false; } /** * Called when the entity is attacked. */ - public boolean attackEntityFrom(DamageSource src, float power) - { + public boolean attackEntityFrom(DamageSource src, float power) { return false; } - + @Override - public boolean isInvisible() - { + public boolean isInvisible() { return true; } - - public void modifySpeed(float mod) - { - this.accelerationX *= mod; - this.accelerationY *= mod; - this.accelerationZ *= mod; + + public void modifySpeed(float mod) { + this.accelerationX *= mod; + this.accelerationY *= mod; + this.accelerationZ *= mod; } - - public boolean isPreset(String s) - { - if(getEntityData().hasKey("Preset")) - { - return getEntityData().getString("Preset").equalsIgnoreCase(s); - } - return false; + + public boolean isPreset(String s) { + if (getEntityData().hasKey("Preset")) { + return getEntityData().getString("Preset").equalsIgnoreCase(s); + } + return false; } - public boolean canBlockCatchFire(int x, int y, int z) - { + + public boolean canBlockCatchFire(int x, int y, int z) { return canCatchFire(x, y, z, UP); } - public boolean canCatchFire(int x, int y, int z, ForgeDirection face) - { + + public boolean canCatchFire(int x, int y, int z, ForgeDirection face) { return worldObj.getBlock(x, y, z).isFlammable(worldObj, x, y, z, face); } - public EntityFireBlast preset(String string) - { - getEntityData().setBoolean(string, true); - return this; - } - public EntityFireBlast setDamage(float dam) - { - getEntityData().setFloat("Damage", dam); - return this; - } - public EntityFireBlast setPyro(float dam) - { - getEntityData().setFloat("Pyro", dam); - return this; - } - - private boolean destroyBlocksInAABB(AxisAlignedBB box) - { + public EntityFireBlast preset(String string) { + getEntityData().setBoolean(string, true); + return this; + } + + private boolean destroyBlocksInAABB(AxisAlignedBB box) { int var2 = MathHelper.floor_double(box.minX); int var3 = MathHelper.floor_double(box.minY); int var4 = MathHelper.floor_double(box.minZ); @@ -251,29 +213,20 @@ private boolean destroyBlocksInAABB(AxisAlignedBB box) boolean var8 = false; boolean var9 = false; - for (int var10 = var2; var10 <= var5; ++var10) - { - for (int var11 = var3; var11 <= var6; ++var11) - { - for (int var12 = var4; var12 <= var7; ++var12) - { + for (int var10 = var2; var10 <= var5; ++var10) { + for (int var11 = var3; var11 <= var6; ++var11) { + for (int var12 = var4; var12 <= var7; ++var12) { Material var13 = this.worldObj.getBlock(var10, var11, var12).getMaterial(); - if (var13 != null) - { - if (var13 == Material.glass) - { + if (var13 != null) { + if (var13 == Material.glass) { var9 = true; this.worldObj.setBlockToAir(var10, var11, var12); - } - else if (var13 == Material.tnt) - { + } else if (var13 == Material.tnt) { var9 = true; this.worldObj.setBlockToAir(var10, var11, var12); this.worldObj.createExplosion(this, var10, var11, var12, 4.0F, true); - } - else - { + } else { var8 = true; } } @@ -281,27 +234,23 @@ else if (var13 == Material.tnt) } } - if (var9) - { - double var16 = box.minX + (box.maxX - box.minX) * (double)this.rand.nextFloat(); - double var17 = box.minY + (box.maxY - box.minY) * (double)this.rand.nextFloat(); - double var14 = box.minZ + (box.maxZ - box.minZ) * (double)this.rand.nextFloat(); + if (var9) { + double var16 = box.minX + (box.maxX - box.minX) * this.rand.nextFloat(); + double var17 = box.minY + (box.maxY - box.minY) * this.rand.nextFloat(); + double var14 = box.minZ + (box.maxZ - box.minZ) * this.rand.nextFloat(); this.worldObj.spawnParticle("largeexplode", var16, var17, var14, 0.0D, 0.0D, 0.0D); - for(int a = 0 ; a < 1+rand.nextInt(4); a ++) + for (int a = 0; a < 1 + rand.nextInt(4); a++) this.worldObj.playSoundAtEntity(this, "dig.glass", 1F, 1F); } return var8; } - - public static DamageSource blastDamage = (new DamageSource("blastfurn")).setFireDamage(); - public static DamageSource basicDamage = (new DamageSource("fireblastBase")).setFireDamage(); - public DamageSource causeFireblastDamage() - { - if(isPreset("BlastFurnace")) - { - return blastDamage; - } - return shootingEntity == null ? basicDamage : (new EntityDamageSourceIndirect("fireblast", this, shootingEntity)).setFireDamage().setProjectile(); + + public DamageSource causeFireblastDamage() { + if (isPreset("BlastFurnace")) { + return blastDamage; + } + return shootingEntity == null ? basicDamage + : (new EntityDamageSourceIndirect("fireblast", this, shootingEntity)).setFireDamage().setProjectile(); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/EntityItemUnbreakable.java b/src/main/java/minefantasy/mf2/entity/EntityItemUnbreakable.java index 7fefc868..01036732 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityItemUnbreakable.java +++ b/src/main/java/minefantasy/mf2/entity/EntityItemUnbreakable.java @@ -1,8 +1,5 @@ package minefantasy.mf2.entity; -import java.util.Iterator; - -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; @@ -12,162 +9,140 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.item.ItemExpireEvent; -public class EntityItemUnbreakable extends EntityItem -{ - public EntityItemUnbreakable(World world) - { - super(world); - } - public EntityItemUnbreakable(World world, EntityItem parent) - { - super(world, parent.posX, parent.posY, parent.posZ, parent.getEntityItem()); - this.mimicSpeed(parent); - delayBeforeCanPickup = parent.delayBeforeCanPickup; - isImmuneToFire = true; - } - public void mimicSpeed(EntityItem parent) - { +import java.util.Iterator; + +public class EntityItemUnbreakable extends EntityItem { + public EntityItemUnbreakable(World world) { + super(world); + } + + public EntityItemUnbreakable(World world, EntityItem parent) { + super(world, parent.posX, parent.posY, parent.posZ, parent.getEntityItem()); + this.mimicSpeed(parent); + delayBeforeCanPickup = parent.delayBeforeCanPickup; + isImmuneToFire = true; + } + + public void mimicSpeed(EntityItem parent) { this.motionX = parent.motionX; this.motionY = parent.motionY; this.motionZ = parent.motionZ; } - - @Override - public boolean attackEntityFrom(DamageSource src, float dam) - { - if(isBreakable() && !src.isFireDamage()) - { - return super.attackEntityFrom(src, dam); - } - return false; - } - - @Override - public void onUpdate() - { + + @Override + public boolean attackEntityFrom(DamageSource src, float dam) { + if (isBreakable() && !src.isFireDamage()) { + return super.attackEntityFrom(src, dam); + } + return false; + } + + @Override + public void onUpdate() { ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); - if (stack != null && stack.getItem() != null) - { - if (stack.getItem().onEntityItemUpdate(this)) - { + if (stack != null && stack.getItem() != null) { + if (stack.getItem().onEntityItemUpdate(this)) { return; } } - if (this.getEntityItem() == null) - { + if (this.getEntityItem() == null) { this.setDead(); - } - else - { - this.onEntityUpdate(); + } else { + this.onEntityUpdate(); - if (this.delayBeforeCanPickup > 0) - { + if (this.delayBeforeCanPickup > 0) { --this.delayBeforeCanPickup; } this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; - if(!isBreakable() && posY <= 1.0F) - { - motionY = 0D; + if (!isBreakable() && posY <= 1.0F) { + motionY = 0D; + } else { + this.motionY -= 0.03999999910593033D; } - else - { - this.motionY -= 0.03999999910593033D; - } - this.noClip = this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); + this.noClip = this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, + this.posZ); this.moveEntity(this.motionX, this.motionY, this.motionZ); - boolean flag = (int)this.prevPosX != (int)this.posX || (int)this.prevPosY != (int)this.posY || (int)this.prevPosZ != (int)this.posZ; + boolean flag = (int) this.prevPosX != (int) this.posX || (int) this.prevPosY != (int) this.posY + || (int) this.prevPosZ != (int) this.posZ; - if (flag || this.ticksExisted % 25 == 0) - { - if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava) - { + if (flag || this.ticksExisted % 25 == 0) { + if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), + MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava) { this.motionY = 0.20000000298023224D; - this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); - this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.motionX = (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F; + this.motionZ = (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F; } - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { this.searchForOtherItemsNearby(); } } float f = 0.98F; - if (this.onGround) - { - f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F; + if (this.onGround) { + f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)).slipperiness * 0.98F; } - this.motionX *= (double)f; + this.motionX *= f; this.motionY *= 0.9800000190734863D; - this.motionZ *= (double)f; + this.motionZ *= f; - if (this.onGround) - { + if (this.onGround) { this.motionY *= -0.5D; } ++this.age; ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); - - if(isBreakable()) - { - if (!this.worldObj.isRemote && this.age >= lifespan) - { - if (item != null) - { - ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj))); - if (MinecraftForge.EVENT_BUS.post(event)) - { - lifespan += event.extraLife; - } - else - { + + if (isBreakable()) { + if (!this.worldObj.isRemote && this.age >= lifespan) { + if (item != null) { + ItemExpireEvent event = new ItemExpireEvent(this, + (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj))); + if (MinecraftForge.EVENT_BUS.post(event)) { + lifespan += event.extraLife; + } else { + this.setDead(); + } + } else { this.setDead(); } } - else - { - this.setDead(); - } - } } - - if (item != null && item.stackSize <= 0) - { + + if (item != null && item.stackSize <= 0) { this.setDead(); } } } - private boolean isBreakable() - { - return false; - } - private void searchForOtherItemsNearby() - { - Iterator iterator = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.5D, 0.0D, 0.5D)).iterator(); - - while (iterator.hasNext()) - { - EntityItem entityitem = (EntityItem)iterator.next(); + + private boolean isBreakable() { + return false; + } + + private void searchForOtherItemsNearby() { + Iterator iterator = this.worldObj + .getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.5D, 0.0D, 0.5D)).iterator(); + + while (iterator.hasNext()) { + EntityItem entityitem = (EntityItem) iterator.next(); this.combineItems(entityitem); } } - - @Override - public void playSound(String sound, float volume, float pitch) - { - if(sound.equalsIgnoreCase("random.fizz")) - { - return; - } + + @Override + public void playSound(String sound, float volume, float pitch) { + if (sound.equalsIgnoreCase("random.fizz")) { + return; + } this.worldObj.playSoundAtEntity(this, sound, volume, pitch); } } diff --git a/src/main/java/minefantasy/mf2/entity/EntityMine.java b/src/main/java/minefantasy/mf2/entity/EntityMine.java index 1ff7693a..661636e8 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityMine.java +++ b/src/main/java/minefantasy/mf2/entity/EntityMine.java @@ -1,13 +1,14 @@ package minefantasy.mf2.entity; -import java.util.Iterator; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.item.gadget.EnumCasingType; import minefantasy.mf2.item.gadget.EnumExplosiveType; import minefantasy.mf2.item.gadget.EnumFuseType; import minefantasy.mf2.item.gadget.EnumPowderType; import minefantasy.mf2.item.list.ToolListMF; +import minefantasy.mf2.util.BukkitUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; @@ -19,69 +20,70 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class EntityMine extends Entity -{ - /** How long the fuse is */ +import java.util.Iterator; +import java.util.List; + +public class EntityMine extends Entity { + private static DamageSource mineDmg = new DamageSource("mine").setExplosion(); + private static DamageSource mineFireDmg = new DamageSource("mine").setExplosion().setFireDamage(); + private final int typeId = 2; + /** + * How long the fuse is + */ public int fuse; private EntityLivingBase thrower; - public EntityMine(World world) - { + public EntityMine(World world) { super(world); this.preventEntitySpawning = true; this.setSize(0.5F, 0.25F); this.yOffset = this.height / 2.0F; } - public EntityMine(World world, EntityLivingBase thrower) - { + public EntityMine(World world, EntityLivingBase thrower) { this(world); this.thrower = thrower; this.fuse = 40; - - this.setLocationAndAngles(thrower.posX, thrower.posY + thrower.getEyeHeight(), thrower.posZ, thrower.rotationYaw, thrower.rotationPitch); - this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F; + + this.setLocationAndAngles(thrower.posX, thrower.posY + thrower.getEyeHeight(), thrower.posZ, + thrower.rotationYaw, thrower.rotationPitch); + this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.posY -= 0.10000000149011612D; - this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F; + this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(this.posX, this.posY, this.posZ); - + float f = 0.4F; - this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f; - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f; - this.motionY = -MathHelper.sin((this.rotationPitch + this.getThrownOffset()) / 180.0F * (float)Math.PI) * f; + this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI) * f; + this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI) * f; + this.motionY = -MathHelper.sin((this.rotationPitch + this.getThrownOffset()) / 180.0F * (float) Math.PI) * f; this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.getThrownForce(), 1.0F); - + this.prevPosX = posX; this.prevPosY = posY; this.prevPosZ = posZ; } - @Override - public boolean interactFirst(EntityPlayer user) - { - if(user.isSneaking()) - { - //DISARM - setDead(); - user.swingItem(); - if(!worldObj.isRemote) - { - ItemStack item = ToolListMF.mine_custom.createMine(getCasing(), getFilling(), getFuse(), getPowder(), 1); - if(!user.inventory.addItemStackToInventory(item)) - { - this.entityDropItem(item, 0.0F); - } - } - } - return super.interactFirst(user); + public boolean interactFirst(EntityPlayer user) { + if (user.isSneaking()) { + // DISARM + setDead(); + user.swingItem(); + if (!worldObj.isRemote) { + ItemStack item = ToolListMF.mine_custom.createMine(getCasing(), getFilling(), getFuse(), getPowder(), + 1); + if (!user.inventory.addItemStackToInventory(item)) { + this.entityDropItem(item, 0.0F); + } + } + } + return super.interactFirst(user); } - public void setThrowableHeading(double x, double y, double z, float offset, float force) - { + public void setThrowableHeading(double x, double y, double z, float offset, float force) { float f2 = MathHelper.sqrt_double(x * x + y * y + z * z); x /= f2; y /= f2; @@ -96,43 +98,41 @@ public void setThrowableHeading(double x, double y, double z, float offset, floa 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, 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, f3) * 180.0D / Math.PI); } - protected float getThrownOffset() - { + + protected float getThrownOffset() { return 0.0F; } - protected float getThrownForce() - { + + protected float getThrownForce() { return 0.5F; } @Override - protected void entityInit() - { - dataWatcher.addObject(typeId, (byte)0); - dataWatcher.addObject(typeId+1, (byte)0); - dataWatcher.addObject(typeId+2, (byte)0); - dataWatcher.addObject(typeId+3, (byte)0); + protected void entityInit() { + dataWatcher.addObject(typeId, (byte) 0); + dataWatcher.addObject(typeId + 1, (byte) 0); + dataWatcher.addObject(typeId + 2, (byte) 0); + dataWatcher.addObject(typeId + 3, (byte) 0); } /** - * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to - * prevent them from trampling crops + * returns if this entity triggers Block.onEntityWalking on the blocks they walk + * on. used for spiders and wolves to prevent them from trampling crops */ @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return false; } /** - * Returns true if other Entities should be prevented from moving through this Entity. + * Returns true if other Entities should be prevented from moving through this + * Entity. */ @Override - public boolean canBeCollidedWith() - { + public boolean canBeCollidedWith() { return !this.isDead; } @@ -140,8 +140,7 @@ public boolean canBeCollidedWith() * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { + public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; @@ -151,61 +150,51 @@ public void onUpdate() this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; - if (this.onGround) - { + if (this.onGround) { this.motionX = 0; this.motionZ = 0; this.motionY *= -0.99D; } - if(fuse > 0) - { - --fuse; - } - double radius = Math.max(1.0D, getRangeOfBlast()-1.5D); - - if(ticksExisted % 5 == 0) - { - List list = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox.expand(radius*2, radius, radius*2)); - if (fuse == 0 && !list.isEmpty()) - { - boolean detonate = false; - Iterator i = list.iterator(); - while(i.hasNext()) - { - EntityLivingBase e = (EntityLivingBase) i.next(); - if(e.getDistanceToEntity(this) < radius) - { - detonate = true; - break; - } - } - - if(detonate) - { - worldObj.playSoundEffect(posX, posY, posZ, "game.tnt.primed", 1.0F, 0.75F); - --fuse; - } - } + if (fuse > 0) { + --fuse; } - if(fuse < 0) - { - fuse --; - - if(fuse < -10) - { - this.setDead(); - - if (!this.worldObj.isRemote) - { - this.explode(); - } - } + double radius = Math.max(1.0D, getRangeOfBlast() - 1.5D); + + if (ticksExisted % 5 == 0) { + List list = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, + boundingBox.expand(radius * 2, radius, radius * 2)); + if (fuse == 0 && !list.isEmpty()) { + boolean detonate = false; + Iterator i = list.iterator(); + while (i.hasNext()) { + EntityLivingBase e = (EntityLivingBase) i.next(); + if (e.getDistanceToEntity(this) < radius) { + detonate = true; + break; + } + } + + if (detonate) { + worldObj.playSoundEffect(posX, posY, posZ, "game.tnt.primed", 1.0F, 0.75F); + --fuse; + } + } + } + if (fuse < 0) { + fuse--; + + if (fuse < -10) { + this.setDead(); + + if (!this.worldObj.isRemote) { + this.explode(); + } + } } } - private void explode2() - { + private void explode2() { float power = 5.0F; this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, power, false); } @@ -214,172 +203,158 @@ private void explode2() * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - protected void writeEntityToNBT(NBTTagCompound nbt) - { - nbt.setByte("Fuse", (byte)this.fuse); + protected void writeEntityToNBT(NBTTagCompound nbt) { + nbt.setByte("Fuse", (byte) this.fuse); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - protected void readEntityFromNBT(NBTTagCompound nbt) - { + protected void readEntityFromNBT(NBTTagCompound nbt) { this.fuse = nbt.getByte("Fuse"); } @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() - { + @SideOnly(Side.CLIENT) + public float getShadowSize() { return 0.25F; } /** * returns null or the entityliving it was placed or ignited by */ - public EntityLivingBase getTntPlacedBy() - { + public EntityLivingBase getTntPlacedBy() { return this.thrower; } - - public void explode() - { - worldObj.playSoundAtEntity(this, "random.explode", 0.3F, 10F - 5F); - worldObj.createExplosion(this, posX, posY, posZ, 0, false); - if (!this.worldObj.isRemote) - { - double area = getRangeOfBlast()*2D* getPowderType().rangeModifier; - AxisAlignedBB var3 = this.boundingBox.expand(area, area/2, area); + + public void explode() { + worldObj.playSoundAtEntity(this, "random.explode", 0.3F, 10F - 5F); + worldObj.createExplosion(this, posX, posY, posZ, 0, false); + if (!this.worldObj.isRemote) { + double area = getRangeOfBlast() * 2D * getPowderType().rangeModifier; + AxisAlignedBB var3 = this.boundingBox.expand(area, area / 2, area); List var4 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, var3); - if (var4 != null && !var4.isEmpty()) - { + if (var4 != null && !var4.isEmpty()) { Iterator splashDamage = var4.iterator(); - while (splashDamage.hasNext()) - { - Entity entityHit = (Entity)splashDamage.next(); + while (splashDamage.hasNext()) { + Entity entityHit = (Entity) splashDamage.next(); + + if (MineFantasyII.isBukkitServer() + && BukkitUtils.cantDamage(thrower != null ? thrower : this, entityHit)) { + continue; + } + double distanceToEntity = this.getDistanceToEntity(entityHit); - double radius = getRangeOfBlast()* getPowderType().rangeModifier; - if (distanceToEntity < radius) - { - float dam = getDamage(); - - if(getCasing() != 2 && distanceToEntity > radius/2) - { - double sc = distanceToEntity-(radius/2); - if(sc < 0)sc = 0; - if(sc > (radius/2))sc = (radius/2); - dam *= (sc / (radius/2)); - } - if(!(entityHit instanceof EntityItem)) - { - DamageSource source = mineDmg; - if(getFilling() == 2) - { - source = mineFireDmg; - } - if(entityHit.attackEntityFrom(source, dam)) - { - applyEffects(entityHit); - } - } + double radius = getRangeOfBlast() * getPowderType().rangeModifier; + if (distanceToEntity < radius) { + float dam = getDamage(); + + if (getCasing() != 2 && distanceToEntity > radius / 2) { + double sc = distanceToEntity - (radius / 2); + if (sc < 0) + sc = 0; + if (sc > (radius / 2)) + sc = (radius / 2); + dam *= (sc / (radius / 2)); + } + if (!(entityHit instanceof EntityItem)) { + DamageSource source = mineDmg; + if (getFilling() == 2) { + source = mineFireDmg; + } + if (entityHit.attackEntityFrom(source, dam)) { + applyEffects(entityHit); + } + } } } } this.setDead(); } - + int t = getFilling(); - if(t > 0) - { - for(int a = 0; a < 16; a++) - { - float range = 0.6F; - EntityShrapnel shrapnel = new EntityShrapnel(worldObj, posX, posY+0.5D, posZ, (rand.nextDouble()-0.5)*(range/2), (rand.nextDouble())*range, (rand.nextDouble()-0.5)*(range/2)); - - if(t == 2) - { - shrapnel.setFire(10); - } - worldObj.spawnEntityInWorld(shrapnel); - } + if (t > 0) { + for (int a = 0; a < 16; a++) { + float range = 0.6F; + EntityShrapnel shrapnel = new EntityShrapnel(worldObj, posX, posY + 0.5D, posZ, + (rand.nextDouble() - 0.5) * (range / 2), (rand.nextDouble()) * range, + (rand.nextDouble() - 0.5) * (range / 2)); + + if (t == 2) { + shrapnel.setFire(10); + } + worldObj.spawnEntityInWorld(shrapnel); + } + } + } + + private void applyEffects(Entity hit) { + if (getFilling() == 2) { + hit.setFire(8); + } + if (hit instanceof EntityLivingBase) { + EntityLivingBase live = (EntityLivingBase) hit; } - } - private void applyEffects(Entity hit) - { - if(getFilling() == 2) - { - hit.setFire(8); - } - if(hit instanceof EntityLivingBase) - { - EntityLivingBase live = (EntityLivingBase)hit; - } - } - - private double getRangeOfBlast() - { - return getBlast().range * getCase().rangeModifier; - } - - private float getDamage() - { - return getBlast().damage * getCase().damageModifier * getPowderType().damageModifier; - } - - private static DamageSource mineDmg = new DamageSource("mine").setExplosion(); - private static DamageSource mineFireDmg = new DamageSource("mine").setExplosion().setFireDamage(); - - public boolean canEntityBeSeen(Entity entity) - { - return this.worldObj.rayTraceBlocks(Vec3.createVectorHelper(this.posX, this.posY + this.getEyeHeight(), this.posZ), Vec3.createVectorHelper(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ)) == null; } - - private final int typeId = 2; - public byte getFilling() - { - return dataWatcher.getWatchableObjectByte(typeId); - } - public byte getCasing() - { - return dataWatcher.getWatchableObjectByte(typeId+1); - } - public byte getFuse() - { - return dataWatcher.getWatchableObjectByte(typeId+2); - } - public byte getPowder() - { - return dataWatcher.getWatchableObjectByte(typeId+3); - } - public EntityMine setType(byte fill, byte casing, byte fuse, byte powder) - { - dataWatcher.updateObject(typeId, fill); - dataWatcher.updateObject(typeId+1, casing); - dataWatcher.updateObject(typeId+2, fuse); - dataWatcher.updateObject(typeId+3, powder); - - this.fuse = getFuseType().time; - - return this; - } - private EnumExplosiveType getBlast() - { - return EnumExplosiveType.getType(getFilling()); - } - private EnumCasingType getCase() - { - return EnumCasingType.getType(getCasing()); - } - private EnumFuseType getFuseType() - { - return EnumFuseType.getType(getFuse()); - } - private EnumPowderType getPowderType() - { - return EnumPowderType.getType(getPowder()); - } + + private double getRangeOfBlast() { + return getBlast().range * getCase().rangeModifier; + } + + private float getDamage() { + return getBlast().damage * getCase().damageModifier * getPowderType().damageModifier; + } + + public boolean canEntityBeSeen(Entity entity) { + return this.worldObj.rayTraceBlocks( + Vec3.createVectorHelper(this.posX, this.posY + this.getEyeHeight(), this.posZ), + Vec3.createVectorHelper(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ)) == null; + } + + public byte getFilling() { + return dataWatcher.getWatchableObjectByte(typeId); + } + + public byte getCasing() { + return dataWatcher.getWatchableObjectByte(typeId + 1); + } + + public byte getFuse() { + return dataWatcher.getWatchableObjectByte(typeId + 2); + } + + public byte getPowder() { + return dataWatcher.getWatchableObjectByte(typeId + 3); + } + + public EntityMine setType(byte fill, byte casing, byte fuse, byte powder) { + dataWatcher.updateObject(typeId, fill); + dataWatcher.updateObject(typeId + 1, casing); + dataWatcher.updateObject(typeId + 2, fuse); + dataWatcher.updateObject(typeId + 3, powder); + + this.fuse = getFuseType().time; + + return this; + } + + private EnumExplosiveType getBlast() { + return EnumExplosiveType.getType(getFilling()); + } + + private EnumCasingType getCase() { + return EnumCasingType.getType(getCasing()); + } + + private EnumFuseType getFuseType() { + return EnumFuseType.getType(getFuse()); + } + + private EnumPowderType getPowderType() { + return EnumPowderType.getType(getPowder()); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/EntityParachute.java b/src/main/java/minefantasy/mf2/entity/EntityParachute.java index cae61c97..ca3c38b7 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityParachute.java +++ b/src/main/java/minefantasy/mf2/entity/EntityParachute.java @@ -2,19 +2,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.List; - import minefantasy.mf2.api.helpers.ArmourCalculator; import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.util.MFLogUtil; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; @@ -22,9 +17,12 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class EntityParachute extends Entity -{ - /** true if no player in parachute */ +import java.util.List; + +public class EntityParachute extends Entity { + /** + * true if no player in parachute + */ private boolean isParachuteEmpty; private double speedMultiplier; private int parachutePosRotationIncrements; @@ -40,8 +38,7 @@ public class EntityParachute extends Entity @SideOnly(Side.CLIENT) private double velocityZ; - public EntityParachute(World world) - { + public EntityParachute(World world) { super(world); this.isParachuteEmpty = true; this.speedMultiplier = 0.07D; @@ -49,99 +46,89 @@ public EntityParachute(World world) this.setSize(2F, 4F); } + public EntityParachute(World world, double x, double y, double z) { + this(world); + this.setPosition(x, y + this.yOffset, z); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = x; + this.prevPosY = y; + this.prevPosZ = z; + } + /** - * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to - * prevent them from trampling crops + * returns if this entity triggers Block.onEntityWalking on the blocks they walk + * on. used for spiders and wolves to prevent them from trampling crops */ @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return false; } + @Override - public boolean canRiderInteract() - { + public boolean canRiderInteract() { return false; } - protected void entityInit() - { + protected void entityInit() { this.dataWatcher.addObject(17, new Integer(0)); this.dataWatcher.addObject(18, new Integer(1)); this.dataWatcher.addObject(19, new Float(0.0F)); } /** - * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be - * pushable on contact, like parachutes or minecarts. + * Returns a boundingBox used to collide the entity with other entities and + * blocks. This enables the entity to be pushable on contact, like parachutes or + * minecarts. */ - public AxisAlignedBB getCollisionBox(Entity entity) - { + public AxisAlignedBB getCollisionBox(Entity entity) { return entity.boundingBox; } /** * returns the bounding box for this entity */ - public AxisAlignedBB getBoundingBox() - { + public AxisAlignedBB getBoundingBox() { return this.boundingBox; } /** - * Returns true if this entity should push and be pushed by other entities when colliding. + * Returns true if this entity should push and be pushed by other entities when + * colliding. */ - public boolean canBePushed() - { + public boolean canBePushed() { return true; } - public EntityParachute(World world, double x, double y, double z) - { - this(world); - this.setPosition(x, y + (double)this.yOffset, z); - this.motionX = 0.0D; - this.motionY = 0.0D; - this.motionZ = 0.0D; - this.prevPosX = x; - this.prevPosY = y; - this.prevPosZ = z; - } - /** - * Returns the Y offset from the entity's position for any entity riding this one. + * Returns the Y offset from the entity's position for any entity riding this + * one. */ - public double getMountedYOffset() - { + public double getMountedYOffset() { return 1D; } /** * Called when the entity is attacked. */ - public boolean attackEntityFrom(DamageSource src, float dam) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource src, float dam) { + if (this.isEntityInvulnerable()) { return false; - } - else if (!this.worldObj.isRemote && !this.isDead) - { + } else if (!this.worldObj.isRemote && !this.isDead) { this.setForwardDirection(-this.getForwardDirection()); this.setTimeSinceHit(10); this.setDamageTaken(this.getDamageTaken() + dam * 10.0F); this.setBeenAttacked(); - boolean flag = src.getEntity() instanceof EntityPlayer && ((EntityPlayer)src.getEntity()).capabilities.isCreativeMode; + boolean flag = src.getEntity() instanceof EntityPlayer + && ((EntityPlayer) src.getEntity()).capabilities.isCreativeMode; - if (flag || this.getDamageTaken() > 20.0F) - { - if (this.riddenByEntity != null) - { + if (flag || this.getDamageTaken() > 20.0F) { + if (this.riddenByEntity != null) { this.riddenByEntity.mountEntity(this); } - if (!flag) - { + if (!flag) { this.func_145778_a(ToolListMF.parachute, 1, 0.0F); } @@ -149,52 +136,45 @@ else if (!this.worldObj.isRemote && !this.isDead) } return true; - } - else - { + } else { return true; } } /** - * Setups the entity to do the hurt animation. Only used by packets in multiplayer. + * Setups the entity to do the hurt animation. Only used by packets in + * multiplayer. */ @SideOnly(Side.CLIENT) - public void performHurtAnimation() - { + public void performHurtAnimation() { this.setForwardDirection(-this.getForwardDirection()); this.setTimeSinceHit(10); this.setDamageTaken(this.getDamageTaken() * 11.0F); } /** - * Returns true if other Entities should be prevented from moving through this Entity. + * Returns true if other Entities should be prevented from moving through this + * Entity. */ - public boolean canBeCollidedWith() - { + public boolean canBeCollidedWith() { return !this.isDead; } /** - * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, - * posY, posZ, yaw, pitch + * Sets the position and rotation. Only difference from the other one is no + * bounding on the rotation. Args: posX, posY, posZ, yaw, pitch */ @SideOnly(Side.CLIENT) - public void setPositionAndRotation2(double x, double y, double z, float xr, float yr, int zr) - { - if (this.isParachuteEmpty) - { + public void setPositionAndRotation2(double x, double y, double z, float xr, float yr, int zr) { + if (this.isParachuteEmpty) { this.parachutePosRotationIncrements = zr + 5; - } - else - { + } else { double d3 = x - this.posX; double d4 = y - this.posY; double d5 = z - this.posZ; double d6 = d3 * d3 + d4 * d4 + d5 * d5; - if (d6 <= 1.0D) - { + if (d6 <= 1.0D) { return; } @@ -204,8 +184,8 @@ public void setPositionAndRotation2(double x, double y, double z, float xr, floa this.parachuteX = x; this.parachuteY = y; this.parachuteZ = z; - this.parachuteYaw = (double)xr; - this.parachutePitch = (double)yr; + this.parachuteYaw = xr; + this.parachutePitch = yr; this.motionX = this.velocityX; this.motionY = this.velocityY; this.motionZ = this.velocityZ; @@ -215,8 +195,7 @@ public void setPositionAndRotation2(double x, double y, double z, float xr, floa * Sets the velocity to the args. Args: x, y, z */ @SideOnly(Side.CLIENT) - public void setVelocity(double xv, double yv, double zv) - { + public void setVelocity(double xv, double yv, double zv) { this.velocityX = this.motionX = xv; this.velocityY = this.motionY = yv; this.velocityZ = this.motionZ = zv; @@ -225,26 +204,21 @@ public void setVelocity(double xv, double yv, double zv) /** * Called to update the entity's position/logic. */ - protected void fall(float distance) - { + protected void fall(float distance) { } - - public void onUpdate() - { - if(this.riddenByEntity != null) - { - riddenByEntity.fallDistance = 0; - //this.rotationYaw = riddenByEntity.rotationYaw; - } + + public void onUpdate() { + if (this.riddenByEntity != null) { + riddenByEntity.fallDistance = 0; + // this.rotationYaw = riddenByEntity.rotationYaw; + } super.onUpdate(); - if (this.getTimeSinceHit() > 0) - { + if (this.getTimeSinceHit() > 0) { this.setTimeSinceHit(this.getTimeSinceHit() - 1); } - if (this.getDamageTaken() > 0.0F) - { + if (this.getDamageTaken() > 0.0F) { this.setDamageTaken(this.getDamageTaken() - 1.0F); } @@ -254,15 +228,14 @@ public void onUpdate() byte b0 = 5; double d0 = 0.0D; - for (int i = 0; i < b0; ++i) - { - double d1 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(i + 0) / (double)b0 - 0.125D; - double d3 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(i + 1) / (double)b0 - 0.125D; - AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(this.boundingBox.minX, d1, this.boundingBox.minZ, this.boundingBox.maxX, d3, this.boundingBox.maxZ); + for (int i = 0; i < b0; ++i) { + double d1 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (i + 0) / b0 - 0.125D; + double d3 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (i + 1) / b0 - 0.125D; + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(this.boundingBox.minX, d1, this.boundingBox.minZ, + this.boundingBox.maxX, d3, this.boundingBox.maxZ); - if (this.worldObj.isAABBInMaterial(axisalignedbb, Material.water)) - { - d0 += 1.0D / (double)b0; + if (this.worldObj.isAABBInMaterial(axisalignedbb, Material.water)) { + d0 += 1.0D / b0; } } @@ -272,29 +245,25 @@ public void onUpdate() double d11; double d12; - if (this.worldObj.isRemote && this.isParachuteEmpty) - { - if (this.parachutePosRotationIncrements > 0) - { - d2 = this.posX + (this.parachuteX - this.posX) / (double)this.parachutePosRotationIncrements; - d4 = this.posY + (this.parachuteY - this.posY) / (double)this.parachutePosRotationIncrements; - d11 = this.posZ + (this.parachuteZ - this.posZ) / (double)this.parachutePosRotationIncrements; - d12 = MathHelper.wrapAngleTo180_double(this.parachuteYaw - (double)this.rotationYaw); - this.rotationYaw = (float)((double)this.rotationYaw + d12 / (double)this.parachutePosRotationIncrements); - this.rotationPitch = (float)((double)this.rotationPitch + (this.parachutePitch - (double)this.rotationPitch) / (double)this.parachutePosRotationIncrements); + if (this.worldObj.isRemote && this.isParachuteEmpty) { + if (this.parachutePosRotationIncrements > 0) { + d2 = this.posX + (this.parachuteX - this.posX) / this.parachutePosRotationIncrements; + d4 = this.posY + (this.parachuteY - this.posY) / this.parachutePosRotationIncrements; + d11 = this.posZ + (this.parachuteZ - this.posZ) / this.parachutePosRotationIncrements; + d12 = MathHelper.wrapAngleTo180_double(this.parachuteYaw - this.rotationYaw); + this.rotationYaw = (float) (this.rotationYaw + d12 / this.parachutePosRotationIncrements); + this.rotationPitch = (float) (this.rotationPitch + + (this.parachutePitch - this.rotationPitch) / this.parachutePosRotationIncrements); --this.parachutePosRotationIncrements; this.setPosition(d2, d4, d11); this.setRotation(this.rotationYaw, this.rotationPitch); - } - else - { + } else { d2 = this.posX + this.motionX; d4 = this.posY + this.motionY; d11 = this.posZ + this.motionZ; this.setPosition(d2, d4, d11); - if (this.onGround) - { + if (this.onGround) { this.motionX *= 0.5D; this.motionY *= 0.5D; this.motionZ *= 0.5D; @@ -304,57 +273,46 @@ public void onUpdate() this.motionY *= 0.949999988079071D; this.motionZ *= 0.9900000095367432D; } - } - else - { - if (d0 < 1.0D) - { + } else { + if (d0 < 1.0D) { d2 = d0 * 2.0D - 1.0D; this.motionY += 0.03999999910593033D * d2; - } - else - { - if (this.motionY < 0.0D) - { + } else { + if (this.motionY < 0.0D) { this.motionY /= 2.0D; } this.motionY += 0.007000000216066837D; } - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)this.riddenByEntity; + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase) { + EntityLivingBase entitylivingbase = (EntityLivingBase) this.riddenByEntity; float f = this.riddenByEntity.rotationYaw + -entitylivingbase.moveStrafing * 90.0F; - this.motionX += -Math.sin((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D; - this.motionZ += Math.cos((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D; + this.motionX += -Math.sin(f * (float) Math.PI / 180.0F) * this.speedMultiplier + * entitylivingbase.moveForward * 0.05000000074505806D; + this.motionZ += Math.cos(f * (float) Math.PI / 180.0F) * this.speedMultiplier + * entitylivingbase.moveForward * 0.05000000074505806D; } d2 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - if (d2 > 0.35D) - { + if (d2 > 0.35D) { d4 = 0.35D / d2; this.motionX *= d4; this.motionZ *= d4; d2 = 0.35D; } - if (d2 > d10 && this.speedMultiplier < 0.35D) - { + if (d2 > d10 && this.speedMultiplier < 0.35D) { this.speedMultiplier += (0.35D - this.speedMultiplier) / 35.0D; - if (this.speedMultiplier > 0.35D) - { + if (this.speedMultiplier > 0.35D) { this.speedMultiplier = 0.35D; } - } - else - { + } else { this.speedMultiplier -= (this.speedMultiplier - 0.07D) / 35.0D; - if (this.speedMultiplier < 0.07D) - { + if (this.speedMultiplier < 0.07D) { this.speedMultiplier = 0.07D; } } @@ -362,206 +320,179 @@ public void onUpdate() int l; this.motionY *= 0.5D; - if (this.onGround) - { + if (this.onGround) { this.motionX *= 0.5D; this.motionZ *= 0.5D; } this.moveEntity(this.motionX, this.motionY, this.motionZ); - if ( (this.isCollidedHorizontally && d10 > 0D) || isTooHeavy()) - { - if (!this.worldObj.isRemote && !this.isDead) - { + if ((this.isCollidedHorizontally && d10 > 0D) || isTooHeavy()) { + if (!this.worldObj.isRemote && !this.isDead) { this.setDead(); - for (l = 0; l < 3; ++l) - { + for (l = 0; l < 3; ++l) { this.func_145778_a(Item.getItemFromBlock(Blocks.wool), 1, 0.0F); } - for (l = 0; l < 2; ++l) - { + for (l = 0; l < 2; ++l) { this.func_145778_a(ComponentListMF.leather_strip, 1, 0.0F); } } - } - else - { + } else { this.motionX *= 0.9900000095367432D; this.motionY *= 0.949999988079071D; this.motionZ *= 0.9900000095367432D; } this.rotationPitch = 0.0F; - d4 = (double)this.rotationYaw; + d4 = this.rotationYaw; d11 = this.prevPosX - this.posX; d12 = this.prevPosZ - this.posZ; - if (d11 * d11 + d12 * d12 > 0.001D) - { - d4 = (double)((float)(Math.atan2(d12, d11) * 180.0D / Math.PI)); + if (d11 * d11 + d12 * d12 > 0.001D) { + d4 = ((float) (Math.atan2(d12, d11) * 180.0D / Math.PI)); } - double d7 = MathHelper.wrapAngleTo180_double(d4 - (double)this.rotationYaw); + double d7 = MathHelper.wrapAngleTo180_double(d4 - this.rotationYaw); - if (d7 > 20.0D) - { + if (d7 > 20.0D) { d7 = 20.0D; } - if (d7 < -20.0D) - { + if (d7 < -20.0D) { d7 = -20.0D; } - this.rotationYaw = (float)((double)this.rotationYaw + d7); + this.rotationYaw = (float) (this.rotationYaw + d7); this.setRotation(this.rotationYaw, this.rotationPitch); - if (!this.worldObj.isRemote) - { - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + if (!this.worldObj.isRemote) { + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, + this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - if (list != null && !list.isEmpty()) - { - for (int k1 = 0; k1 < list.size(); ++k1) - { - Entity entity = (Entity)list.get(k1); + if (list != null && !list.isEmpty()) { + for (int k1 = 0; k1 < list.size(); ++k1) { + Entity entity = (Entity) list.get(k1); - if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityParachute) - { + if (entity != this.riddenByEntity && entity.canBePushed() + && entity instanceof EntityParachute) { entity.applyEntityCollision(this); } } } - if (this.riddenByEntity != null && this.riddenByEntity.isDead) - { + if (this.riddenByEntity != null && this.riddenByEntity.isDead) { this.riddenByEntity = null; } } } } - private boolean isTooHeavy() - { - if(riddenByEntity != null && riddenByEntity instanceof EntityLivingBase) - { - return ArmourCalculator.getTotalWeightOfWorn((EntityLivingBase)riddenByEntity, false) > 100F; - } - return false; - } - - public void updateRiderPosition() - { - if (this.riddenByEntity != null) - { - double d0 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D; - double d1 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D; - this.riddenByEntity.setPosition(this.posX + d0, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + d1); + private boolean isTooHeavy() { + if (riddenByEntity != null && riddenByEntity instanceof EntityLivingBase) { + return ArmourCalculator.getTotalWeightOfWorn((EntityLivingBase) riddenByEntity, false) > 100F; + } + return false; + } + + public void updateRiderPosition() { + if (this.riddenByEntity != null) { + double d0 = Math.cos(this.rotationYaw * Math.PI / 180.0D) * 0.4D; + double d1 = Math.sin(this.rotationYaw * Math.PI / 180.0D) * 0.4D; + this.riddenByEntity.setPosition(this.posX + d0, + this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + d1); } } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound nbt) {} + protected void writeEntityToNBT(NBTTagCompound nbt) { + } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound nbt) {} + protected void readEntityFromNBT(NBTTagCompound nbt) { + } @SideOnly(Side.CLIENT) - public float getShadowSize() - { + public float getShadowSize() { return 0.0F; } /** - * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance - * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround + * Takes in the distance the entity has fallen this tick and whether its on the + * ground to update the fall distance and deal fall damage if landing on the + * ground. Args: distanceFallenThisTick, onGround */ - protected void updateFallState(double dist, boolean hitGound) - { + protected void updateFallState(double dist, boolean hitGound) { int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.posY); int k = MathHelper.floor_double(this.posZ); - if (hitGound) - { - if (this.fallDistance > 0.0F || onGround) - { - if (!this.worldObj.isRemote && !this.isDead) - { + if (hitGound) { + if (this.fallDistance > 0.0F || onGround) { + if (!this.worldObj.isRemote && !this.isDead) { this.setDead(); this.func_145778_a(ToolListMF.parachute, 1, 0.0F); } this.fallDistance = 0.0F; } - } - else if (this.worldObj.getBlock(i, j - 1, k).getMaterial() != Material.water && dist < 0.0D) - { - this.fallDistance = (float)((double)this.fallDistance - dist); + } else if (this.worldObj.getBlock(i, j - 1, k).getMaterial() != Material.water && dist < 0.0D) { + this.fallDistance = (float) (this.fallDistance - dist); } } - /** - * Sets the damage taken from the last hit. - */ - public void setDamageTaken(float dam) - { - this.dataWatcher.updateObject(19, Float.valueOf(dam)); - } - /** * Gets the damage taken from the last hit. */ - public float getDamageTaken() - { + public float getDamageTaken() { return this.dataWatcher.getWatchableObjectFloat(19); } /** - * Sets the time to count down from since the last time entity was hit. + * Sets the damage taken from the last hit. */ - public void setTimeSinceHit(int time) - { - this.dataWatcher.updateObject(17, Integer.valueOf(time)); + public void setDamageTaken(float dam) { + this.dataWatcher.updateObject(19, Float.valueOf(dam)); } /** * Gets the time since the last hit. */ - public int getTimeSinceHit() - { + public int getTimeSinceHit() { return this.dataWatcher.getWatchableObjectInt(17); } /** - * Sets the forward direction of the entity. + * Sets the time to count down from since the last time entity was hit. */ - public void setForwardDirection(int dir) - { - this.dataWatcher.updateObject(18, Integer.valueOf(dir)); + public void setTimeSinceHit(int time) { + this.dataWatcher.updateObject(17, Integer.valueOf(time)); } /** * Gets the forward direction of the entity. */ - public int getForwardDirection() - { + public int getForwardDirection() { return this.dataWatcher.getWatchableObjectInt(18); } + /** + * Sets the forward direction of the entity. + */ + public void setForwardDirection(int dir) { + this.dataWatcher.updateObject(18, Integer.valueOf(dir)); + } + /** * true if no player in parachute */ @SideOnly(Side.CLIENT) - public void setIsParachuteEmpty(boolean flag) - { + public void setIsParachuteEmpty(boolean flag) { this.isParachuteEmpty = flag; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/EntityShrapnel.java b/src/main/java/minefantasy/mf2/entity/EntityShrapnel.java index b5baa471..6b6abb0b 100644 --- a/src/main/java/minefantasy/mf2/entity/EntityShrapnel.java +++ b/src/main/java/minefantasy/mf2/entity/EntityShrapnel.java @@ -1,7 +1,7 @@ package minefantasy.mf2.entity; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.weapon.IDamageType; import net.minecraft.block.Block; import net.minecraft.entity.Entity; @@ -13,47 +13,28 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class EntityShrapnel extends Entity implements IDamageType -{ +import java.util.List; + +public class EntityShrapnel extends Entity implements IDamageType { + public EntityLivingBase shootingEntity; + public double accelerationX; + public double accelerationY; + public double accelerationZ; private int field_145795_e = -1; private int field_145793_f = -1; private int field_145794_g = -1; private Block field_145796_h; private boolean inGround; - public EntityLivingBase shootingEntity; private int ticksAlive; private int ticksInAir; - public double accelerationX; - public double accelerationY; - public double accelerationZ; - public EntityShrapnel(World world) - { + public EntityShrapnel(World world) { super(world); this.setSize(0.5F, 0.5F); } - @Override - protected void entityInit() {} - - /** - * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge - * length * 64 * renderDistanceWeight Args: distance - */ - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double dist) - { - double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; - d1 *= 64.0D; - return dist < d1 * d1; - } - - public EntityShrapnel(World world, double x, double y, double z, double xv, double yv, double zv) - { + public EntityShrapnel(World world, double x, double y, double z, double xv, double yv, double zv) { super(world); this.setSize(1.0F, 1.0F); this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); @@ -64,8 +45,7 @@ public EntityShrapnel(World world, double x, double y, double z, double xv, doub this.accelerationZ = zv / d6 * 0.1D; } - public EntityShrapnel(World world, EntityLivingBase shooter, double x, double y, double z) - { + public EntityShrapnel(World world, EntityLivingBase shooter, double x, double y, double z) { super(world); this.shootingEntity = shooter; this.setSize(1.0F, 1.0F); @@ -82,22 +62,35 @@ public EntityShrapnel(World world, EntityLivingBase shooter, double x, double y, this.accelerationZ = z / d3 * 0.1D; } + @Override + protected void entityInit() { + } + + /** + * Checks if the entity is in range to render by using the past in distance and + * comparing it to its average edge length * 64 * renderDistanceWeight Args: + * distance + */ + @Override + @SideOnly(Side.CLIENT) + public boolean isInRangeToRenderDist(double dist) { + double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; + d1 *= 64.0D; + return dist < d1 * d1; + } + /** * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { - if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ))) - { + public void onUpdate() { + if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead + || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) { this.setDead(); - } - else - { + } else { super.onUpdate(); - if (this.inGround) - { + if (this.inGround) { this.setDead(); this.inGround = false; this.motionX *= this.rand.nextFloat() * 0.2F; @@ -106,44 +99,43 @@ public void onUpdate() this.ticksAlive = 0; this.ticksInAir = 0; return; - } - else - { + } else { ++this.ticksInAir; - if(ticksInAir >= 10)setDead(); + if (ticksInAir >= 10) + setDead(); } Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, + this.posZ + this.motionZ); 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); + 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); } Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, + this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; - for (int i = 0; i < list.size(); ++i) - { - Entity entity1 = (Entity)list.get(i); + for (int i = 0; i < list.size(); ++i) { + Entity entity1 = (Entity) list.get(i); - if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) - { + if (entity1.canBeCollidedWith() + && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - if (movingobjectposition1 != null) - { + if (movingobjectposition1 != null) { double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) - { + if (d1 < d0 || d0 == 0.0D) { entity = entity1; d0 = d1; } @@ -151,13 +143,11 @@ public void onUpdate() } } - if (entity != null) - { + if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } - if (movingobjectposition != null) - { + if (movingobjectposition != null) { this.onImpact(movingobjectposition); } @@ -165,25 +155,22 @@ public void onUpdate() 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.motionZ, this.motionX) * 180.0D / Math.PI) + 90.0F; + this.rotationYaw = (float) (Math.atan2(this.motionZ, this.motionX) * 180.0D / Math.PI) + 90.0F; - for (this.rotationPitch = (float)(Math.atan2(f1, this.motionY) * 180.0D / Math.PI) - 90.0F; this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) - { + for (this.rotationPitch = (float) (Math.atan2(f1, this.motionY) * 180.0D / Math.PI) + - 90.0F; 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; } @@ -191,12 +178,11 @@ public void onUpdate() this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; float f2 = this.getMotionFactor(); - if (this.isInWater()) - { - for (int j = 0; j < 4; ++j) - { + if (this.isInWater()) { + for (int j = 0; j < 4; ++j) { float f3 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, + this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); } f2 = 0.8F; @@ -214,21 +200,19 @@ public void onUpdate() } /** - * Return the motion factor for this projectile. The factor is multiplied by the original motion. + * Return the motion factor for this projectile. The factor is multiplied by the + * original motion. */ - protected float getMotionFactor() - { + protected float getMotionFactor() { return 0.95F; } /** * Called when this EntityFireball hits a block or entity. */ - protected void onImpact(MovingObjectPosition hitPos) - { - if (isBurning() && hitPos.entityHit != null) - { - hitPos.entityHit.setFire(1); + protected void onImpact(MovingObjectPosition hitPos) { + if (isBurning() && hitPos.entityHit != null) { + hitPos.entityHit.setFire(1); } } @@ -236,60 +220,54 @@ protected void onImpact(MovingObjectPosition hitPos) * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - public void writeEntityToNBT(NBTTagCompound p_70014_1_) - { - p_70014_1_.setShort("xTile", (short)this.field_145795_e); - p_70014_1_.setShort("yTile", (short)this.field_145793_f); - p_70014_1_.setShort("zTile", (short)this.field_145794_g); - p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145796_h)); - p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0)); - p_70014_1_.setTag("direction", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ})); + public void writeEntityToNBT(NBTTagCompound p_70014_1_) { + p_70014_1_.setShort("xTile", (short) this.field_145795_e); + p_70014_1_.setShort("yTile", (short) this.field_145793_f); + p_70014_1_.setShort("zTile", (short) this.field_145794_g); + p_70014_1_.setByte("inTile", (byte) Block.getIdFromBlock(this.field_145796_h)); + p_70014_1_.setByte("inGround", (byte) (this.inGround ? 1 : 0)); + p_70014_1_.setTag("direction", + this.newDoubleNBTList(new double[]{this.motionX, this.motionY, this.motionZ})); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - public void readEntityFromNBT(NBTTagCompound p_70037_1_) - { + public void readEntityFromNBT(NBTTagCompound p_70037_1_) { this.field_145795_e = p_70037_1_.getShort("xTile"); this.field_145793_f = p_70037_1_.getShort("yTile"); this.field_145794_g = p_70037_1_.getShort("zTile"); this.field_145796_h = Block.getBlockById(p_70037_1_.getByte("inTile") & 255); this.inGround = p_70037_1_.getByte("inGround") == 1; - if (p_70037_1_.hasKey("direction", 9)) - { + if (p_70037_1_.hasKey("direction", 9)) { NBTTagList nbttaglist = p_70037_1_.getTagList("direction", 6); this.motionX = nbttaglist.func_150309_d(0); this.motionY = nbttaglist.func_150309_d(1); this.motionZ = nbttaglist.func_150309_d(2); - } - else - { + } else { this.setDead(); } } /** - * Returns true if other Entities should be prevented from moving through this Entity. + * Returns true if other Entities should be prevented from moving through this + * Entity. */ @Override - public boolean canBeCollidedWith() - { + public boolean canBeCollidedWith() { return true; } @Override - public float getCollisionBorderSize() - { + public float getCollisionBorderSize() { return 1.0F; } @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() - { + @SideOnly(Side.CLIENT) + public float getShadowSize() { return 0.0F; } @@ -297,32 +275,29 @@ public float getShadowSize() * Gets how bright this entity is. */ @Override - public float getBrightness(float p_70013_1_) - { + public float getBrightness(float p_70013_1_) { return 1.0F; } @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float p_70070_1_) - { + @SideOnly(Side.CLIENT) + public int getBrightnessForRender(float p_70070_1_) { return 15728880; } @SideOnly(Side.CLIENT) - public String getTexture() - { - return isBurning() ? "fireshrapnel" : "shrapnel"; - } - - @Override - public float[] getDamageRatio(Object... implement) - { - return isBurning() ? new float[]{0, 1, 0} : new float[]{0, 1, 1};//50/50 blunt and piercing, fire bombs are full blunt - } - - @Override - public float getPenetrationLevel(Object implement) { - return 0; - } + public String getTexture() { + return isBurning() ? "fireshrapnel" : "shrapnel"; + } + + @Override + public float[] getDamageRatio(Object... implement) { + return isBurning() ? new float[]{0, 1, 0} : new float[]{0, 1, 1};// 50/50 blunt and piercing, fire bombs + // are full blunt + } + + @Override + public float getPenetrationLevel(Object implement) { + return 0; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/EntitySmoke.java b/src/main/java/minefantasy/mf2/entity/EntitySmoke.java index 77e05c31..3b8e0687 100644 --- a/src/main/java/minefantasy/mf2/entity/EntitySmoke.java +++ b/src/main/java/minefantasy/mf2/entity/EntitySmoke.java @@ -1,8 +1,5 @@ package minefantasy.mf2.entity; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.armour.IGasProtector; @@ -16,92 +13,101 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.*; import net.minecraft.util.MovingObjectPosition.MovingObjectType; -import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class EntitySmoke extends Entity -{ +import java.util.List; +import java.util.Random; + +public class EntitySmoke extends Entity { + public EntityLivingBase shootingEntity; + public double accelerationX; + public double accelerationY; + public double accelerationZ; private int field_145795_e = -1; private int field_145793_f = -1; private int field_145794_g = -1; private Block field_145796_h; private boolean inGround; - public EntityLivingBase shootingEntity; private int ticksAlive; private int ticksInAir; - public double accelerationX; - public double accelerationY; - public double accelerationZ; - public EntitySmoke(World world) - { + public EntitySmoke(World world) { super(world); this.setSize(0.2F, 0.2F); } + + public EntitySmoke(World world, double x, double y, double z, double xv, double yv, double zv) { + super(world); + noClip = false; + this.setSize(0.5F, 0.5F); + this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); + this.setPosition(x, y, z); + double d6 = MathHelper.sqrt_double(xv * xv + yv * yv + zv * zv); + this.accelerationX = xv / d6 * 0.1D; + this.accelerationY = yv / d6 * 0.1D; + this.accelerationZ = zv / d6 * 0.1D; + } + + public static boolean canPoison(Entity hit, Random rand) { + if (!(hit instanceof EntityLivingBase)) + return false; + + ItemStack helmet = ((EntityLivingBase) hit).getEquipmentInSlot(4); + if (helmet != null && helmet.getItem() instanceof IGasProtector) { + float prot = ((IGasProtector) helmet.getItem()).getGasProtection(helmet); + if (prot >= 100F || rand.nextFloat() * 100 < prot) { + return false; + } + } + if (PowerArmour.isWearingCogwork((EntityLivingBase) hit)) { + return false; + } + return ((EntityLivingBase) hit).getCreatureAttribute() != EnumCreatureAttribute.UNDEAD; + } + @Override - protected boolean canTriggerWalking() - { + protected boolean canTriggerWalking() { return false; } + @Override - public boolean canAttackWithItem() - { + public boolean canAttackWithItem() { return false; } - protected void entityInit() {} + protected void entityInit() { + } /** - * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge - * length * 64 * renderDistanceWeight Args: distance + * Checks if the entity is in range to render by using the past in distance and + * comparing it to its average edge length * 64 * renderDistanceWeight Args: + * distance */ @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double dist) - { + public boolean isInRangeToRenderDist(double dist) { double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; d1 *= 64.0D; return dist < d1 * d1; } - public EntitySmoke(World world, double x, double y, double z, double xv, double yv, double zv) - { - super(world); - noClip = false; - this.setSize(0.5F, 0.5F); - this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); - this.setPosition(x, y, z); - double d6 = (double)MathHelper.sqrt_double(xv * xv + yv * yv + zv * zv); - this.accelerationX = xv / d6 * 0.1D; - this.accelerationY = yv / d6 * 0.1D; - this.accelerationZ = zv / d6 * 0.1D; - } - /** * Called to update the entity's position/logic. */ - public void onUpdate() - { - if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ))) - { + public void onUpdate() { + if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead + || !this.worldObj.blockExists((int) this.posX, (int) this.posY, (int) this.posZ))) { this.setDead(); - } - else - { + } else { super.onUpdate(); - if (this.inGround) - { - if (this.worldObj.getBlock(this.field_145795_e, this.field_145793_f, this.field_145794_g) == this.field_145796_h) - { + if (this.inGround) { + if (this.worldObj.getBlock(this.field_145795_e, this.field_145793_f, + this.field_145794_g) == this.field_145796_h) { ++this.ticksAlive; - if (this.ticksAlive == 600) - { + if (this.ticksAlive == 600) { this.setDead(); } @@ -109,48 +115,46 @@ public void onUpdate() } 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 *= this.rand.nextFloat() * 0.2F; + this.motionY *= this.rand.nextFloat() * 0.2F; + this.motionZ *= this.rand.nextFloat() * 0.2F; this.ticksAlive = 0; this.ticksInAir = 0; - } - else - { + } else { ++this.ticksInAir; } Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, + this.posZ + this.motionZ); 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); + 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); } Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, + this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; - for (int i = 0; i < list.size(); ++i) - { - Entity entity1 = (Entity)list.get(i); + for (int i = 0; i < list.size(); ++i) { + Entity entity1 = (Entity) list.get(i); - if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) - { + if (entity1.canBeCollidedWith() + && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) { float f = 0.3F; - AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); + AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - if (movingobjectposition1 != null) - { + if (movingobjectposition1 != null) { double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) - { + if (d1 < d0 || d0 == 0.0D) { entity = entity1; d0 = d1; } @@ -158,13 +162,11 @@ public void onUpdate() } } - if (entity != null) - { + if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } - if (movingobjectposition != null) - { + if (movingobjectposition != null) { this.onImpact(movingobjectposition); } @@ -172,25 +174,22 @@ public void onUpdate() 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.motionZ, this.motionX) * 180.0D / Math.PI) + 90.0F; + this.rotationYaw = (float) (Math.atan2(this.motionZ, this.motionX) * 180.0D / Math.PI) + 90.0F; - for (this.rotationPitch = (float)(Math.atan2((double)f1, this.motionY) * 180.0D / Math.PI) - 90.0F; this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) - { + for (this.rotationPitch = (float) (Math.atan2(f1, this.motionY) * 180.0D / Math.PI) + - 90.0F; 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; } @@ -198,8 +197,7 @@ public void onUpdate() this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; float f2 = this.getMotionFactor(); - if (this.isInWater()) - { + if (this.isInWater()) { f2 = 0.8F; } @@ -207,151 +205,111 @@ public void onUpdate() this.motionX += this.accelerationX; this.motionY += this.accelerationY + floating; this.motionZ += this.accelerationZ; - + double slowdownRate = 0.5F; this.accelerationX *= slowdownRate; this.accelerationY *= slowdownRate; this.accelerationZ *= slowdownRate; - - this.motionX *= (double)f2; - this.motionY *= (double)f2; - this.motionZ *= (double)f2; + + this.motionX *= f2; + this.motionY *= f2; + this.motionZ *= f2; this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); this.setPosition(this.posX, this.posY, this.posZ); } } /** - * Return the motion factor for this projectile. The factor is multiplied by the original motion. + * Return the motion factor for this projectile. The factor is multiplied by the + * original motion. */ - protected float getMotionFactor() - { + protected float getMotionFactor() { return 0.95F; } /** * Called when this EntityFireball hits a block or entity. */ - protected void onImpact(MovingObjectPosition pos) - { - if (!this.worldObj.isRemote) - { - if (pos.entityHit != null) - { - if(pos.entityHit instanceof EntityLivingBase && !worldObj.isRemote) - { - EntityLivingBase hit = (EntityLivingBase)pos.entityHit; - - if(canPoison(hit, rand)) - { - hit.addPotionEffect(new PotionEffect(Potion.hunger.id, 20, 0)); - if(rand.nextInt(20) == 0) - { - if(hit.getActivePotionEffect(Potion.blindness) != null) - { - hit.addPotionEffect(new PotionEffect(Potion.wither.id, 200, 0)); - } - else if(hit.getActivePotionEffect(Potion.confusion) != null) - { - hit.addPotionEffect(new PotionEffect(Potion.blindness.id, 200, 0)); - } - else - { - hit.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0)); - } - } - } - } + protected void onImpact(MovingObjectPosition pos) { + if (!this.worldObj.isRemote) { + if (pos.entityHit != null) { + if (pos.entityHit instanceof EntityLivingBase && !worldObj.isRemote) { + EntityLivingBase hit = (EntityLivingBase) pos.entityHit; + + if (canPoison(hit, rand)) { + hit.addPotionEffect(new PotionEffect(Potion.hunger.id, 20, 0)); + if (rand.nextInt(20) == 0) { + if (hit.getActivePotionEffect(Potion.blindness) != null) { + hit.addPotionEffect(new PotionEffect(Potion.wither.id, 200, 0)); + } else if (hit.getActivePotionEffect(Potion.confusion) != null) { + hit.addPotionEffect(new PotionEffect(Potion.blindness.id, 200, 0)); + } else { + hit.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0)); + } + } + } + } } - if(pos.typeOfHit == MovingObjectType.BLOCK) - { - setDead(); + if (pos.typeOfHit == MovingObjectType.BLOCK) { + setDead(); } } } - public static boolean canPoison(Entity hit, Random rand) - { - if(!(hit instanceof EntityLivingBase))return false; - - ItemStack helmet = ((EntityLivingBase)hit).getEquipmentInSlot(4); - if(helmet != null && helmet.getItem() instanceof IGasProtector) - { - float prot = ((IGasProtector)helmet.getItem()).getGasProtection(helmet); - if(prot >= 100F || rand.nextFloat()*100 < prot) - { - return false; - } - } - if(PowerArmour.isWearingCogwork( (EntityLivingBase)hit)) - { - return false; - } - return ((EntityLivingBase)hit).getCreatureAttribute() != EnumCreatureAttribute.UNDEAD; - } - - /** + /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound nbt) - { - nbt.setShort("xTile", (short)this.field_145795_e); - nbt.setShort("yTile", (short)this.field_145793_f); - nbt.setShort("zTile", (short)this.field_145794_g); - nbt.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145796_h)); - nbt.setByte("inGround", (byte)(this.inGround ? 1 : 0)); - nbt.setTag("direction", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ})); + public void writeEntityToNBT(NBTTagCompound nbt) { + nbt.setShort("xTile", (short) this.field_145795_e); + nbt.setShort("yTile", (short) this.field_145793_f); + nbt.setShort("zTile", (short) this.field_145794_g); + nbt.setByte("inTile", (byte) Block.getIdFromBlock(this.field_145796_h)); + nbt.setByte("inGround", (byte) (this.inGround ? 1 : 0)); + nbt.setTag("direction", this.newDoubleNBTList(new double[]{this.motionX, this.motionY, this.motionZ})); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound nbt) - { + public void readEntityFromNBT(NBTTagCompound nbt) { this.field_145795_e = nbt.getShort("xTile"); this.field_145793_f = nbt.getShort("yTile"); this.field_145794_g = nbt.getShort("zTile"); this.field_145796_h = Block.getBlockById(nbt.getByte("inTile") & 255); this.inGround = nbt.getByte("inGround") == 1; - if (nbt.hasKey("direction", 9)) - { + if (nbt.hasKey("direction", 9)) { NBTTagList nbttaglist = nbt.getTagList("direction", 6); this.motionX = nbttaglist.func_150309_d(0); this.motionY = nbttaglist.func_150309_d(1); this.motionZ = nbttaglist.func_150309_d(2); - } - else - { + } else { this.setDead(); } } /** - * Returns true if other Entities should be prevented from moving through this Entity. + * Returns true if other Entities should be prevented from moving through this + * Entity. */ @Override - public boolean canBeCollidedWith() - { + public boolean canBeCollidedWith() { return false; } /** * Called when the entity is attacked. */ - public boolean attackEntityFrom(DamageSource source, float amount) - { + public boolean attackEntityFrom(DamageSource source, float amount) { return false; } @SideOnly(Side.CLIENT) - public float getShadowSize() - { + public float getShadowSize() { return 1.0F; } - + @Override - public void setFire(int i) - { + public void setFire(int i) { } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/Shockwave.java b/src/main/java/minefantasy/mf2/entity/Shockwave.java index dc0d25a0..39448da7 100644 --- a/src/main/java/minefantasy/mf2/entity/Shockwave.java +++ b/src/main/java/minefantasy/mf2/entity/Shockwave.java @@ -1,51 +1,44 @@ package minefantasy.mf2.entity; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentProtection; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EntityDamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; -public class Shockwave -{//Explosion - /** whether or not the explosion sets fire to blocks around it */ +import java.util.*; + +public class Shockwave {// Explosion + /** + * whether or not the explosion sets fire to blocks around it + */ public boolean isFlaming; - /** whether or not this explosion spawns smoke particles */ + /** + * whether or not this explosion spawns smoke particles + */ public boolean isSmoking = true; public boolean isGriefing = true; - private int maxRange = 16; - private Random explosionRNG = new Random(); - private World worldObj; public double explosionX; public double explosionY; public double explosionZ; public Entity exploder; public float explosionSize; - /** A list of ChunkPositions of blocks affected by this explosion */ + /** + * A list of ChunkPositions of blocks affected by this explosion + */ public List affectedBlockPositions = new ArrayList(); + private int maxRange = 16; + private Random explosionRNG = new Random(); + private World worldObj; private Map field_77288_k = new HashMap(); private String type; - - public Shockwave(String type, World world, Entity cause, double x, double y, double z, float power) - { + + public Shockwave(String type, World world, Entity cause, double x, double y, double z, float power) { this.worldObj = world; this.exploder = cause; this.explosionSize = power; @@ -58,8 +51,7 @@ public Shockwave(String type, World world, Entity cause, double x, double y, dou /** * Does the first part of the explosion (destroy blocks) */ - public void initiate() - { + public void initiate() { float f = this.explosionSize; HashSet hashset = new HashSet(); int i; @@ -69,17 +61,14 @@ public void initiate() double d6; double d7; - for (i = 0; i < this.maxRange; ++i) - { - for (j = 0; j < this.maxRange; ++j) - { - for (k = 0; k < this.maxRange; ++k) - { - if (i == 0 || i == this.maxRange - 1 || j == 0 || j == this.maxRange - 1 || k == 0 || k == this.maxRange - 1) - { - double d0 = (double)((float)i / ((float)this.maxRange - 1.0F) * 2.0F - 1.0F); - double d1 = (double)((float)j / ((float)this.maxRange - 1.0F) * 2.0F - 1.0F); - double d2 = (double)((float)k / ((float)this.maxRange - 1.0F) * 2.0F - 1.0F); + for (i = 0; i < this.maxRange; ++i) { + for (j = 0; j < this.maxRange; ++j) { + for (k = 0; k < this.maxRange; ++k) { + if (i == 0 || i == this.maxRange - 1 || j == 0 || j == this.maxRange - 1 || k == 0 + || k == this.maxRange - 1) { + double d0 = i / (this.maxRange - 1.0F) * 2.0F - 1.0F; + double d1 = j / (this.maxRange - 1.0F) * 2.0F - 1.0F; + double d2 = k / (this.maxRange - 1.0F) * 2.0F - 1.0F; double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); d0 /= d3; d1 /= d3; @@ -89,21 +78,19 @@ public void initiate() d6 = this.explosionY; d7 = this.explosionZ; - for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) - { + for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) { int j1 = MathHelper.floor_double(d5); int k1 = MathHelper.floor_double(d6); int l1 = MathHelper.floor_double(d7); Block block = this.worldObj.getBlock(j1, k1, l1); - if (block.getMaterial() == Material.glass) - { + if (block.getMaterial() == Material.glass) { hashset.add(new ChunkPosition(j1, k1, l1)); } - d5 += d0 * (double)f2; - d6 += d1 * (double)f2; - d7 += d2 * (double)f2; + d5 += d0 * f2; + d6 += d1 * f2; + d7 += d2 * f2; } } } @@ -112,44 +99,41 @@ public void initiate() this.affectedBlockPositions.addAll(hashset); this.explosionSize *= 2.0F; - i = MathHelper.floor_double(this.explosionX - (double)this.explosionSize - 1.0D); - j = MathHelper.floor_double(this.explosionX + (double)this.explosionSize + 1.0D); - k = MathHelper.floor_double(this.explosionY - (double)this.explosionSize - 1.0D); - int i2 = MathHelper.floor_double(this.explosionY + (double)this.explosionSize + 1.0D); - int l = MathHelper.floor_double(this.explosionZ - (double)this.explosionSize - 1.0D); - int j2 = MathHelper.floor_double(this.explosionZ + (double)this.explosionSize + 1.0D); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox((double)i, (double)k, (double)l, (double)j, (double)i2, (double)j2)); + i = MathHelper.floor_double(this.explosionX - this.explosionSize - 1.0D); + j = MathHelper.floor_double(this.explosionX + this.explosionSize + 1.0D); + k = MathHelper.floor_double(this.explosionY - this.explosionSize - 1.0D); + int i2 = MathHelper.floor_double(this.explosionY + this.explosionSize + 1.0D); + int l = MathHelper.floor_double(this.explosionZ - this.explosionSize - 1.0D); + int j2 = MathHelper.floor_double(this.explosionZ + this.explosionSize + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, + AxisAlignedBB.getBoundingBox(i, k, l, j, i2, j2)); Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ); - for (int i1 = 0; i1 < list.size(); ++i1) - { - Entity entity = (Entity)list.get(i1); - double d4 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double)this.explosionSize; + for (int i1 = 0; i1 < list.size(); ++i1) { + Entity entity = (Entity) list.get(i1); + double d4 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / this.explosionSize; - if (d4 <= 1.0D && !(entity instanceof EntityItem)) - { + if (d4 <= 1.0D && !(entity instanceof EntityItem)) { d5 = entity.posX - this.explosionX; - d6 = entity.posY + (double)entity.getEyeHeight() - this.explosionY; + d6 = entity.posY + entity.getEyeHeight() - this.explosionY; d7 = entity.posZ - this.explosionZ; - double d9 = (double)MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7); + double d9 = MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7); - if (d9 != 0.0D) - { + if (d9 != 0.0D) { d5 /= d9; d6 /= d9; d7 /= d9; - double d10 = (double)this.worldObj.getBlockDensity(vec3, entity.boundingBox); + double d10 = this.worldObj.getBlockDensity(vec3, entity.boundingBox); double d11 = (1.0D - d4) * d10; - float damage = (float)((int)((d11 * d11 + d11) / 2.0D * 8.0D * (double)this.explosionSize + 1.0D)); - entity.attackEntityFrom(getExplosionSource(), Math.min(64F, 4F + (damage/2F))); + float damage = ((int) ((d11 * d11 + d11) / 2.0D * 8.0D * this.explosionSize + 1.0D)); + entity.attackEntityFrom(getExplosionSource(), Math.min(64F, 4F + (damage / 2F))); double d8 = EnchantmentProtection.func_92092_a(entity, d11); entity.motionX += d5 * d8; entity.motionY += d6 * d8; entity.motionZ += d7 * d8; - if (entity instanceof EntityPlayer) - { - this.field_77288_k.put((EntityPlayer)entity, Vec3.createVectorHelper(d5 * d11, d6 * d11, d7 * d11)); + if (entity instanceof EntityPlayer) { + this.field_77288_k.put(entity, Vec3.createVectorHelper(d5 * d11, d6 * d11, d7 * d11)); } } } @@ -161,19 +145,17 @@ public void initiate() /** * Does the second part of the explosion (sound, particles, drop spawn) */ - public void decorateWave(boolean flag) - { - this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); - - if (this.explosionSize >= 2.0F && this.isSmoking) - { - this.worldObj.spawnParticle("largesmoke", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); - } - else - { + public void decorateWave(boolean flag) { + this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, + (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + + if (this.explosionSize >= 2.0F && this.isSmoking) { + this.worldObj.spawnParticle("largesmoke", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, + 0.0D); + } else { this.worldObj.spawnParticle("smoke", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); } - + Iterator iterator; ChunkPosition chunkposition; int i; @@ -181,79 +163,72 @@ public void decorateWave(boolean flag) int k; Block block; - if (this.isSmoking) - { + if (this.isSmoking) { iterator = this.affectedBlockPositions.iterator(); - while (iterator.hasNext()) - { - chunkposition = (ChunkPosition)iterator.next(); + while (iterator.hasNext()) { + chunkposition = (ChunkPosition) iterator.next(); i = chunkposition.chunkPosX; j = chunkposition.chunkPosY; k = chunkposition.chunkPosZ; block = this.worldObj.getBlock(i, j, k); - if (flag) - { - double d0 = (double)((float)i + this.worldObj.rand.nextFloat()); - double d1 = (double)((float)j + this.worldObj.rand.nextFloat()); - double d2 = (double)((float)k + this.worldObj.rand.nextFloat()); + if (flag) { + double d0 = i + this.worldObj.rand.nextFloat(); + double d1 = j + this.worldObj.rand.nextFloat(); + double d2 = k + this.worldObj.rand.nextFloat(); double d3 = d0 - this.explosionX; double d4 = d1 - this.explosionY; double d5 = d2 - this.explosionZ; - double d6 = (double)MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); + double d6 = MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); d3 /= d6; d4 /= d6; d5 /= d6; - double d7 = 0.5D / (d6 / (double)this.explosionSize + 0.1D); - d7 *= (double)(this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F); + double d7 = 0.5D / (d6 / this.explosionSize + 0.1D); + d7 *= this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F; d3 *= d7; d4 *= d7; d5 *= d7; - this.worldObj.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5); + this.worldObj.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, + (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5); this.worldObj.spawnParticle("smoke", d0, d1, d2, d3, d4, d5); } - if (isGriefing && block.getMaterial() == Material.glass) - { - this.worldObj.setBlockToAir(i, j, k); - this.worldObj.playSoundEffect(i, j, k, "break.glass", 1.0F, 0.75F+(explosionRNG.nextFloat()*0.5F)); + if (isGriefing && block.getMaterial() == Material.glass) { + this.worldObj.setBlockToAir(i, j, k); + this.worldObj.playSoundEffect(i, j, k, "break.glass", 1.0F, + 0.75F + (explosionRNG.nextFloat() * 0.5F)); } } } - if (this.isFlaming) - { + if (this.isFlaming) { iterator = this.affectedBlockPositions.iterator(); - while (iterator.hasNext()) - { - chunkposition = (ChunkPosition)iterator.next(); + while (iterator.hasNext()) { + chunkposition = (ChunkPosition) iterator.next(); i = chunkposition.chunkPosX; j = chunkposition.chunkPosY; k = chunkposition.chunkPosZ; block = this.worldObj.getBlock(i, j, k); Block block1 = this.worldObj.getBlock(i, j - 1, k); - if (block.getMaterial() == Material.air && block1.func_149730_j() && this.explosionRNG.nextInt(3) == 0) - { + if (block.getMaterial() == Material.air && block1.func_149730_j() + && this.explosionRNG.nextInt(3) == 0) { this.worldObj.setBlock(i, j, k, Blocks.fire); } } } } - public Map func_77277_b() - { + public Map func_77277_b() { return this.field_77288_k; } - - public DamageSource getExplosionSource() - { - if(exploder != null) - { - return new EntityDamageSource(type, exploder).setExplosion(); - } + + public DamageSource getExplosionSource() { + if (exploder != null) { + return new EntityDamageSource(type, exploder).setExplosion(); + } return new DamageSource(type).setExplosion(); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/list/EntityListMF.java b/src/main/java/minefantasy/mf2/entity/list/EntityListMF.java index cc5a56c0..58dee519 100644 --- a/src/main/java/minefantasy/mf2/entity/list/EntityListMF.java +++ b/src/main/java/minefantasy/mf2/entity/list/EntityListMF.java @@ -3,51 +3,40 @@ import cpw.mods.fml.common.registry.EntityRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.config.ConfigExperiment; -import minefantasy.mf2.config.ConfigMobs; -import minefantasy.mf2.entity.EntityArrowMF; -import minefantasy.mf2.entity.EntityBomb; -import minefantasy.mf2.entity.EntityDragonBreath; -import minefantasy.mf2.entity.EntityFireBlast; -import minefantasy.mf2.entity.EntityItemUnbreakable; -import minefantasy.mf2.entity.EntityMine; -import minefantasy.mf2.entity.EntityParachute; -import minefantasy.mf2.entity.EntityShrapnel; -import minefantasy.mf2.entity.EntitySmoke; +import minefantasy.mf2.entity.*; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; -public class EntityListMF -{ - public static void register() - { - addEntity(EntityArrowMF.class, "arrowMF", 1, 16, ConfigExperiment.dynamicArrows ? 1 : 20); - addEntity(EntityBomb.class, "bombMF", 2, 16, ConfigExperiment.dynamicArrows ? 1 : 20); - addEntity(EntityShrapnel.class, "shrapnel_mf", 3, 16, ConfigExperiment.dynamicArrows ? 1 : 20); - addEntity(EntityFireBlast.class, "fire_blast", 4, 16, ConfigExperiment.dynamicArrows ? 2 : 20); - addEntity(EntitySmoke.class, "smoke_mf", 5, 16, ConfigExperiment.dynamicArrows ? 2 : 20); - addEntity(EntityItemUnbreakable.class, "special_eitem_mf", 6, 16, ConfigExperiment.dynamicArrows ? 2 : 20); - - addEntity(EntityMine.class, "landmineMF", 7, 16, 10); - addEntity(EntityParachute.class, "parachute_mf", 8, 16, 20); - - addEntity(EntityDragonBreath.class, "dragonbreath", 9, 16, ConfigExperiment.dynamicArrows ? 2 : 20); - - MobListMF.register(); - } - public static int autoAssign() - { - for(int a = 0; a <= 255; a++) - { - if (!EntityList.IDtoClassMapping.containsKey(Integer.valueOf(a))) - { - System.out.println("MineFantasy: Autoassigned EntityID " +a); - return a; - } - } - throw new IllegalArgumentException("MineFantasy: No Available Entity ID!, you can try manually adding them in Config/Mobs.cfg"); - } - private static void addEntity(Class entityClass, String entityName, int id, int range, int ticks) - { +public class EntityListMF { + public static void register() { + addEntity(EntityArrowMF.class, "arrowMF", 1, 16, ConfigExperiment.dynamicArrows ? 1 : 20); + addEntity(EntityBomb.class, "bombMF", 2, 16, ConfigExperiment.dynamicArrows ? 1 : 20); + addEntity(EntityShrapnel.class, "shrapnel_mf", 3, 16, ConfigExperiment.dynamicArrows ? 1 : 20); + addEntity(EntityFireBlast.class, "fire_blast", 4, 16, ConfigExperiment.dynamicArrows ? 2 : 20); + addEntity(EntitySmoke.class, "smoke_mf", 5, 16, ConfigExperiment.dynamicArrows ? 2 : 20); + addEntity(EntityItemUnbreakable.class, "special_eitem_mf", 6, 16, ConfigExperiment.dynamicArrows ? 2 : 20); + + addEntity(EntityMine.class, "landmineMF", 7, 16, 10); + addEntity(EntityParachute.class, "parachute_mf", 8, 16, 20); + + addEntity(EntityDragonBreath.class, "dragonbreath", 9, 16, ConfigExperiment.dynamicArrows ? 2 : 20); + + MobListMF.register(); + } + + public static int autoAssign() { + for (int a = 0; a <= 255; a++) { + if (!EntityList.IDtoClassMapping.containsKey(Integer.valueOf(a))) { + System.out.println("MineFantasy: Autoassigned EntityID " + a); + return a; + } + } + throw new IllegalArgumentException( + "MineFantasy: No Available Entity ID!, you can try manually adding them in Config/Mobs.cfg"); + } + + private static void addEntity(Class entityClass, String entityName, int id, int range, + int ticks) { EntityRegistry.registerModEntity(entityClass, entityName, id, MineFantasyII.instance, range, ticks, true); } } diff --git a/src/main/java/minefantasy/mf2/entity/list/MobListMF.java b/src/main/java/minefantasy/mf2/entity/list/MobListMF.java index 0ca0bd9a..2da97b65 100644 --- a/src/main/java/minefantasy/mf2/entity/list/MobListMF.java +++ b/src/main/java/minefantasy/mf2/entity/list/MobListMF.java @@ -1,87 +1,73 @@ package minefantasy.mf2.entity.list; - import cpw.mods.fml.common.registry.EntityRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.config.ConfigMobs; import minefantasy.mf2.entity.EntityCogwork; -import minefantasy.mf2.entity.mob.*; -import minefantasy.mf2.util.MFLogUtil; +import minefantasy.mf2.entity.mob.DragonBreath; +import minefantasy.mf2.entity.mob.EntityDragon; +import minefantasy.mf2.entity.mob.EntityHound; +import minefantasy.mf2.entity.mob.EntityMinotaur; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.BiomeDictionary.Type; -public class MobListMF -{ - public static void register() - { - DragonBreath.init(); - addEntity(10, EntityDragon.class, "MF_Dragon"); - addEntity(11, EntityMinotaur.class, "MF_Minotaur"); - addEntity(12, EntityCogwork.class, "MF_CogSuit"); - addEntity(13, EntityHound.class, "MF_Hound"); - - addSpawn(EntityDragon.class, 1, 1, 1, EnumCreatureType.monster, Type.NETHER); - if(ConfigMobs.minotaurSpawnrate > 0) - { - addSpawn(EntityMinotaur.class, ConfigMobs.minotaurSpawnrate, 1, 1, EnumCreatureType.monster); - } - if(ConfigMobs.minotaurSpawnrateNether > 0) - { - addSpawn(EntityMinotaur.class, ConfigMobs.minotaurSpawnrateNether, 1, 1, EnumCreatureType.monster, Type.NETHER); - } - } - - private static void addEntity(int IDBase, Class entityClass, String entityName) - { - EntityRegistry.registerModEntity(entityClass, entityName, IDBase, MineFantasyII.instance, 128, 1, true); +public class MobListMF { + public static void register() { + DragonBreath.init(); + addEntity(10, EntityDragon.class, "MF_Dragon"); + addEntity(11, EntityMinotaur.class, "MF_Minotaur"); + addEntity(12, EntityCogwork.class, "MF_CogSuit"); + addEntity(13, EntityHound.class, "MF_Hound"); + + addSpawn(EntityDragon.class, 1, 1, 1, EnumCreatureType.monster, Type.NETHER); + if (ConfigMobs.minotaurSpawnrate > 0) { + addSpawn(EntityMinotaur.class, ConfigMobs.minotaurSpawnrate, 1, 1, EnumCreatureType.monster); + } + if (ConfigMobs.minotaurSpawnrateNether > 0) { + addSpawn(EntityMinotaur.class, ConfigMobs.minotaurSpawnrateNether, 1, 1, EnumCreatureType.monster, + Type.NETHER); + } } - - public static void addSpawn(Class entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature) - { - for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) - { - if(biome != null) - { - if(BiomeDictionary.isBiomeRegistered(biome)) - { - if(BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END)) - { - return; - } - if(BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)) - { - return; - } - if(BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MUSHROOM)) - { - return; - } - } - - EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biome); - } + + private static void addEntity(int IDBase, Class entityClass, String entityName) { + EntityRegistry.registerModEntity(entityClass, entityName, IDBase, MineFantasyII.instance, 128, 1, true); + } + + public static void addSpawn(Class entityClass, int weightedProb, int min, int max, + EnumCreatureType typeOfCreature) { + for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) { + if (biome != null) { + if (BiomeDictionary.isBiomeRegistered(biome)) { + if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END)) { + return; + } + if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)) { + return; + } + if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MUSHROOM)) { + return; + } + } + + EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biome); + } } } - - public static void addSpawn(Class entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeDictionary.Type type) - { - for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) - { - if(biome != null) - { - if(BiomeDictionary.isBiomeRegistered(biome)) - { - if(BiomeDictionary.isBiomeOfType(biome, type)) - { - EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biome); - } - } - } + + public static void addSpawn(Class entityClass, int weightedProb, int min, int max, + EnumCreatureType typeOfCreature, BiomeDictionary.Type type) { + for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) { + if (biome != null) { + if (BiomeDictionary.isBiomeRegistered(biome)) { + if (BiomeDictionary.isBiomeOfType(biome, type)) { + EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biome); + } + } + } } } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/AshBreath.java b/src/main/java/minefantasy/mf2/entity/mob/AshBreath.java index 019a9efc..bb432500 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/AshBreath.java +++ b/src/main/java/minefantasy/mf2/entity/mob/AshBreath.java @@ -2,57 +2,48 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.entity.EntityCogwork; import minefantasy.mf2.entity.EntityDragonBreath; import minefantasy.mf2.entity.EntitySmoke; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.world.World; -public class AshBreath extends DragonBreath -{ - - public AshBreath(String name) - { - super(name); - } - - @Override - public DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter) - { - return shooter == null ? new DamageSource("ashblastBase").setDamageBypassesArmor() : (new EntityDamageSourceIndirect("ashblast", breath, shooter).setDamageBypassesArmor()); - } - - @Override - @SideOnly(Side.CLIENT) - public String getTexture(EntityDragonBreath instance) - { - return "textures/projectile/dragonbreath_ash"; - } - - public void onHitEntity(Entity target, EntityDragonBreath instance) - { - super.onHitEntity(target, instance); - if(target instanceof EntityLivingBase) - { - float dam = instance.getDamage(); - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 0)); - } - } - - @Override - public float modifyDamage(Entity hit, float dam) - { - return EntitySmoke.canPoison(hit, random) ? (dam/5F + 1) : 0F; - } - - @Override - public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) - { - } +public class AshBreath extends DragonBreath { + + public AshBreath(String name) { + super(name); + } + + @Override + public DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter) { + return shooter == null ? new DamageSource("ashblastBase").setDamageBypassesArmor() + : (new EntityDamageSourceIndirect("ashblast", breath, shooter).setDamageBypassesArmor()); + } + + @Override + @SideOnly(Side.CLIENT) + public String getTexture(EntityDragonBreath instance) { + return "textures/projectile/dragonbreath_ash"; + } + + public void onHitEntity(Entity target, EntityDragonBreath instance) { + super.onHitEntity(target, instance); + if (target instanceof EntityLivingBase) { + float dam = instance.getDamage(); + ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 0)); + } + } + + @Override + public float modifyDamage(Entity hit, float dam) { + return EntitySmoke.canPoison(hit, random) ? (dam / 5F + 1) : 0F; + } + + @Override + public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) { + } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/DamageSourceMobMF.java b/src/main/java/minefantasy/mf2/entity/mob/DamageSourceMobMF.java index 99795c9d..69636ae6 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/DamageSourceMobMF.java +++ b/src/main/java/minefantasy/mf2/entity/mob/DamageSourceMobMF.java @@ -2,35 +2,29 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EntityDamageSource; import net.minecraft.util.IChatComponent; -import net.minecraft.util.StatCollector; -public class DamageSourceMobMF extends EntityDamageSource -{ +public class DamageSourceMobMF extends EntityDamageSource { protected Entity damageSourceEntity; private String attackName; - - public DamageSourceMobMF(String name, Entity attacker) - { + + public DamageSourceMobMF(String name, Entity attacker) { super("mob", attacker); - this.attackName=name; + this.attackName = name; this.damageSourceEntity = attacker; } @Override - public Entity getEntity() - { + public Entity getEntity() { return this.damageSourceEntity; } @Override - public IChatComponent func_151519_b(EntityLivingBase target) - { + public IChatComponent func_151519_b(EntityLivingBase target) { String s = "death.attack." + this.damageType + "." + attackName; - return new ChatComponentTranslation(s, new Object[] {target.func_145748_c_(), this.damageSourceEntity.func_145748_c_()}); + return new ChatComponentTranslation(s, + new Object[]{target.func_145748_c_(), this.damageSourceEntity.func_145748_c_()}); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/mob/DragonBreath.java b/src/main/java/minefantasy/mf2/entity/mob/DragonBreath.java index 2d29903a..f6fc511c 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/DragonBreath.java +++ b/src/main/java/minefantasy/mf2/entity/mob/DragonBreath.java @@ -1,8 +1,5 @@ package minefantasy.mf2.entity.mob; -import java.util.ArrayList; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.entity.EntityDragonBreath; @@ -11,59 +8,58 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; -public abstract class DragonBreath -{ - public static ArrayList projectiles = new ArrayList(); - - public static int nextID = 0; - protected Random random = new Random(); - public static DragonBreath fire, frost, poison, ash; - public static void init() - { - fire = new FireBreath("fire"); - frost = new FrostBreath("frost"); - poison = new PoisonBreath("poison"); - ash = new AshBreath("ash"); - } - - public int id = 0; - public final String name; - public DragonBreath(String name) - { - this.name = name; - register(); - } - - public void register() - { - this.id = nextID; - projectiles.add(this); - ++nextID; - } +import java.util.ArrayList; +import java.util.Random; + +public abstract class DragonBreath { + public static ArrayList projectiles = new ArrayList(); + + public static int nextID = 0; + public static DragonBreath fire, frost, poison, ash; + public final String name; + public int id = 0; + protected Random random = new Random(); + + public DragonBreath(String name) { + this.name = name; + register(); + } + + public static void init() { + fire = new FireBreath("fire"); + frost = new FrostBreath("frost"); + poison = new PoisonBreath("poison"); + ash = new AshBreath("ash"); + } + + public void register() { + this.id = nextID; + projectiles.add(this); + ++nextID; + } + + public abstract DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter); + + public boolean shouldExpand() { + return true; + } - public abstract DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter); + public int getLifeSpan() { + return 30; + } - public boolean shouldExpand(){ - return true; - } + @SideOnly(Side.CLIENT) + public abstract String getTexture(EntityDragonBreath instance); - public int getLifeSpan() { - return 30; - } + public void onHitEntity(Entity entityHit, EntityDragonBreath instance) { + entityHit.attackEntityFrom(getDamageSource(instance, instance.shootingEntity), + modifyDamage(entityHit, instance.getDamage())); + } - @SideOnly(Side.CLIENT) - public abstract String getTexture(EntityDragonBreath instance); - - public void onHitEntity(Entity entityHit, EntityDragonBreath instance) { - entityHit.attackEntityFrom(getDamageSource(instance, instance.shootingEntity), modifyDamage(entityHit, instance.getDamage())); - } - - public float modifyDamage(Entity hit, float dam) - { - return dam; - } + public float modifyDamage(Entity hit, float dam) { + return dam; + } - public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) - { - } + public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) { + } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/DragonBreed.java b/src/main/java/minefantasy/mf2/entity/mob/DragonBreed.java index 65d1e4a4..217bf831 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/DragonBreed.java +++ b/src/main/java/minefantasy/mf2/entity/mob/DragonBreed.java @@ -1,137 +1,167 @@ package minefantasy.mf2.entity.mob; +import minefantasy.mf2.config.ConfigMobs; +import net.minecraft.world.biome.BiomeGenBase; + import java.util.ArrayList; import java.util.Random; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.common.BiomeManager; -import net.minecraftforge.common.BiomeManager.BiomeType; +public class DragonBreed { + private static final ArrayList[] breeds = new ArrayList[]{new ArrayList(), + new ArrayList(), new ArrayList(), new ArrayList(), + new ArrayList()}; -import minefantasy.mf2.config.ConfigMobs; -import minefantasy.mf2.util.MFLogUtil; - -public class DragonBreed -{ - private static final ArrayList[]breeds = new ArrayList[]{new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList()}; - - /* New System Breeds - * Red: Fire, plains and hills - * Green: Poison, swamps, forests and plains - * White: Frost, cold regions - * Black: Dire, nether - * - */ - public static DragonBreed YOUNGRED = new DragonBreed(0, "dragon_young", "red", "dragon_red", DragonBreath.fire).setCombat(ConfigMobs.youngdragonHP, 0.0F, 0F, ConfigMobs.youngdragonMD, 15, 200).setProjectile(ConfigMobs.youngdragonFD, ConfigMobs.youngdragonFT, 1000, 0.05F).register(); - public static DragonBreed YOUNGWHITE = new DragonBreed(0, "dragon_young", "white", "dragon_frost", DragonBreath.frost).setCombat(ConfigMobs.youngdragonHP, 0.0F, 0F, ConfigMobs.youngdragonMD, 25, 200).setProjectile(ConfigMobs.youngdragonFD, ConfigMobs.youngdragonFT, 800, 0.05F).register(); - public static DragonBreed YOUNGGREEN = new DragonBreed(0, "dragon_young", "green", "dragon_green", DragonBreath.poison).setCombat(ConfigMobs.youngdragonHP, 0.0F, 0F, ConfigMobs.youngdragonMD, 35, 100).setProjectile(ConfigMobs.youngdragonFD, ConfigMobs.youngdragonFT, 400, 0.05F).register(); - public static DragonBreed YOUNGASH = new DragonBreed(0, "dragon_young", "ash", "dragon_ash", DragonBreath.ash).setCombat(ConfigMobs.youngdragonHP, 0.0F, 0F, ConfigMobs.youngdragonMD, 15, 200).setProjectile(ConfigMobs.youngdragonFD, ConfigMobs.youngdragonFT, 200, 0.05F).setBlind().register(); - - public static DragonBreed RED = new DragonBreed(1, "dragon", "red", "dragon_red", DragonBreath.fire).setCombat(ConfigMobs.dragonHP, 2.0F, 0F, ConfigMobs.dragonMD, 15, 300).setProjectile(ConfigMobs.dragonFD, ConfigMobs.dragonFT, 500, 0.1F).register(); - public static DragonBreed WHITE = new DragonBreed(1, "dragon", "white", "dragon_frost", DragonBreath.frost).setCombat(ConfigMobs.youngdragonHP, 2.0F, 0F, ConfigMobs.dragonMD, 25, 300).setProjectile(ConfigMobs.dragonFD, ConfigMobs.dragonFT, 400, 0.1F).register(); - public static DragonBreed GREEN = new DragonBreed(1, "dragon", "green", "dragon_green", DragonBreath.poison).setCombat(ConfigMobs.dragonHP, 2.0F, 0F, ConfigMobs.dragonMD, 35, 200).setProjectile(ConfigMobs.dragonFD, ConfigMobs.dragonFT, 300, 0.1F).register(); - public static DragonBreed ASH = new DragonBreed(1, "dragon", "ash", "dragon_ash", DragonBreath.ash).setCombat(ConfigMobs.dragonHP, 2.0F, 0F, ConfigMobs.dragonMD, 15, 300).setProjectile(ConfigMobs.dragonFD, ConfigMobs.dragonFT, 150, 0.1F).setBlind().register(); - - public static DragonBreed REDM = new DragonBreed(2, "dragon_mature", "red", "dragon_red", DragonBreath.fire).setCombat(ConfigMobs.diredragonHP, 2.0F, 1F, ConfigMobs.diredragonMD, 15, 300).setProjectile(ConfigMobs.diredragonFD, ConfigMobs.diredragonFT, 400, 0.25F).register(); - public static DragonBreed WHITEM = new DragonBreed(2, "dragon_mature", "white", "dragon_frost", DragonBreath.frost).setCombat(ConfigMobs.diredragonHP, 2.0F, 1F, ConfigMobs.diredragonMD, 25, 300).setProjectile(ConfigMobs.diredragonFD, ConfigMobs.diredragonFT, 300, 0.25F).register(); - public static DragonBreed GREENM = new DragonBreed(2, "dragon_mature", "green", "dragon_green", DragonBreath.poison).setCombat(ConfigMobs.diredragonHP, 2.0F, 1F, ConfigMobs.diredragonMD, 30, 200).setProjectile(ConfigMobs.diredragonFD, ConfigMobs.diredragonFT, 200, 0.25F).register(); - public static DragonBreed ASHM = new DragonBreed(2, "dragon_mature", "ash", "dragon_ash", DragonBreath.ash).setCombat(ConfigMobs.diredragonHP, 2.0F, 1F, ConfigMobs.diredragonMD, 15, 300).setProjectile(ConfigMobs.diredragonFD, ConfigMobs.diredragonFT, 100, 0.25F).setBlind().register(); - - public static DragonBreed ELDERRED = new DragonBreed(3, "dragon_elder", "red", "dragon_red", DragonBreath.fire).setCombat(ConfigMobs.elderdragonHP, 2.0F, 2F, ConfigMobs.elderdragonMD, 15, 300).setProjectile(ConfigMobs.elderdragonFD, ConfigMobs.elderdragonFT, 400, 0.35F).register(); - public static DragonBreed ELDERWHITE = new DragonBreed(3, "dragon_elder", "white", "dragon_frost", DragonBreath.frost).setCombat(ConfigMobs.elderdragonHP, 2.0F, 2F, ConfigMobs.elderdragonMD, 25, 300).setProjectile(ConfigMobs.elderdragonFD, ConfigMobs.elderdragonFT, 300, 0.35F).register(); - public static DragonBreed ELDERGREEN = new DragonBreed(3, "dragon_elder", "green", "dragon_green", DragonBreath.poison).setCombat(ConfigMobs.elderdragonHP, 2.0F, 2F, ConfigMobs.elderdragonMD, 35, 200).setProjectile(ConfigMobs.elderdragonFD, ConfigMobs.elderdragonFT, 200, 0.35F).register(); - public static DragonBreed ELDERASH = new DragonBreed(3, "dragon_elder", "ash", "dragon_ash", DragonBreath.ash).setCombat(ConfigMobs.elderdragonHP, 2.0F, 2F, ConfigMobs.elderdragonMD, 15, 300).setProjectile(ConfigMobs.elderdragonFD, ConfigMobs.elderdragonFT, 100, 0.35F).setBlind().register(); - - public static DragonBreed ANCIENT = new DragonBreed(4, "dragon_ancient", "dire", "dragon_ancient", DragonBreath.fire).setCombat(ConfigMobs.ancientdragonHP, 2.0F, 5F, ConfigMobs.ancientdragonMD, 20, 300).setProjectile(ConfigMobs.ancientdragonFD, ConfigMobs.ancientdragonFT, 400, 1.0F).register(); - - - public int tier = 0; - public String name = "dragon"; - public String breedName = "red"; - public DragonBreath rangedAttack; - public String tex = "dragonGreen"; - public float health = 200; - public float regenRate = 0; - public float meleeDamage = 8; - public float fireDamage = 5; - public float pyro = 0.1F; - public int disengageChance = 200; - public int fireTimer = 50; - public int coolTimer = 200; - public int meleeSpeed = 20; - public float DT = 2.0F; - - public DragonBreed(int tier, String name, String breedname, String tex, DragonBreath breath) - { - this.tier = tier; - this.name = name; - this.breedName = breedname; - this.tex = tex; - this.rangedAttack = breath; - } - public DragonBreed setCombat(float health, float DT, float regenRate, float meleeDamage, int meleeSpeed, int disengageChance) - { - this.health = health; - this.regenRate = regenRate; - this.meleeDamage = meleeDamage; - this.meleeSpeed = meleeSpeed; - this.disengageChance = disengageChance; - this.DT = DT; - return this; - } - public DragonBreed setProjectile(float fireDamage, int fireTimer, int coolTimer, float pyro) - { - this.fireDamage = fireDamage; - this.fireTimer = fireTimer; - this.coolTimer = coolTimer; - this.pyro = pyro; - return this; - } - public DragonBreed register() - { - breeds[tier].add(this); - return this; - } - private boolean isBlind = false; - public DragonBreed setBlind() - { - isBlind = true; - return this; - } - public boolean isBlind() - { - return isBlind; - } - - public static DragonBreed getBreed(int tier, int id) - { - tier = Math.min(breeds.length-1, tier); - id = Math.min(breeds[tier].size()-1, id); - DragonBreed breed = breeds[tier].get(id); - return breed != null ? breed : breeds[tier].get(0); - } - private static Random rand = new Random(); - public static int getRandomDragon(EntityDragon dragon, int tier) - { - ArrayList pool = breeds[tier]; - BiomeGenBase biome = dragon.worldObj.getBiomeGenForCoords((int)(dragon.posX), (int)(dragon.posZ)); - int id = getIdForBiome(biome, dragon.worldObj.canLightningStrikeAt((int)dragon.posX, (int)dragon.posY, (int)dragon.posZ), dragon.dimension); - if(id >= pool.size()) - { - id = pool.size()-1; - } - return id; - } - private static int getIdForBiome(BiomeGenBase biome, boolean isRaining, int dimension) - { - if(dimension == -1) - { - return rand.nextBoolean() ? 3 : 0;//Ash or Fire - } - BiomeGenBase.TempCategory category = biome.getTempCategory(); - if(!biome.func_150559_j() && !biome.canSpawnLightningBolt()) return 3;//Ash - if(biome.getEnableSnow() || biome.temperature <= 0.25F || category == BiomeGenBase.TempCategory.COLD)return 1;//Frost - if(biome.isHighHumidity() || (category == BiomeGenBase.TempCategory.MEDIUM && isRaining)) return 2;//Poison - if(category == BiomeGenBase.TempCategory.OCEAN)return 2;//Poison - return 0;//Fire - } + /* + * New System Breeds Red: Fire, plains and hills Green: Poison, swamps, forests + * and plains White: Frost, cold regions Black: Dire, nether + * + */ + public static DragonBreed YOUNGRED = new DragonBreed(0, "dragon_young", "red", "dragon_red", DragonBreath.fire) + .setCombat(ConfigMobs.youngdragonHP, 0.0F, 0F, ConfigMobs.youngdragonMD, 15, 200) + .setProjectile(ConfigMobs.youngdragonFD, ConfigMobs.youngdragonFT, 1000, 0.05F).register(); + public static DragonBreed YOUNGWHITE = new DragonBreed(0, "dragon_young", "white", "dragon_frost", + DragonBreath.frost).setCombat(ConfigMobs.youngdragonHP, 0.0F, 0F, ConfigMobs.youngdragonMD, 25, 200) + .setProjectile(ConfigMobs.youngdragonFD, ConfigMobs.youngdragonFT, 800, 0.05F).register(); + public static DragonBreed YOUNGGREEN = new DragonBreed(0, "dragon_young", "green", "dragon_green", + DragonBreath.poison).setCombat(ConfigMobs.youngdragonHP, 0.0F, 0F, ConfigMobs.youngdragonMD, 35, 100) + .setProjectile(ConfigMobs.youngdragonFD, ConfigMobs.youngdragonFT, 400, 0.05F).register(); + public static DragonBreed YOUNGASH = new DragonBreed(0, "dragon_young", "ash", "dragon_ash", DragonBreath.ash) + .setCombat(ConfigMobs.youngdragonHP, 0.0F, 0F, ConfigMobs.youngdragonMD, 15, 200) + .setProjectile(ConfigMobs.youngdragonFD, ConfigMobs.youngdragonFT, 200, 0.05F).setBlind().register(); + + public static DragonBreed RED = new DragonBreed(1, "dragon", "red", "dragon_red", DragonBreath.fire) + .setCombat(ConfigMobs.dragonHP, 2.0F, 0F, ConfigMobs.dragonMD, 15, 300) + .setProjectile(ConfigMobs.dragonFD, ConfigMobs.dragonFT, 500, 0.1F).register(); + public static DragonBreed WHITE = new DragonBreed(1, "dragon", "white", "dragon_frost", DragonBreath.frost) + .setCombat(ConfigMobs.youngdragonHP, 2.0F, 0F, ConfigMobs.dragonMD, 25, 300) + .setProjectile(ConfigMobs.dragonFD, ConfigMobs.dragonFT, 400, 0.1F).register(); + public static DragonBreed GREEN = new DragonBreed(1, "dragon", "green", "dragon_green", DragonBreath.poison) + .setCombat(ConfigMobs.dragonHP, 2.0F, 0F, ConfigMobs.dragonMD, 35, 200) + .setProjectile(ConfigMobs.dragonFD, ConfigMobs.dragonFT, 300, 0.1F).register(); + public static DragonBreed ASH = new DragonBreed(1, "dragon", "ash", "dragon_ash", DragonBreath.ash) + .setCombat(ConfigMobs.dragonHP, 2.0F, 0F, ConfigMobs.dragonMD, 15, 300) + .setProjectile(ConfigMobs.dragonFD, ConfigMobs.dragonFT, 150, 0.1F).setBlind().register(); + + public static DragonBreed REDM = new DragonBreed(2, "dragon_mature", "red", "dragon_red", DragonBreath.fire) + .setCombat(ConfigMobs.diredragonHP, 2.0F, 1F, ConfigMobs.diredragonMD, 15, 300) + .setProjectile(ConfigMobs.diredragonFD, ConfigMobs.diredragonFT, 400, 0.25F).register(); + public static DragonBreed WHITEM = new DragonBreed(2, "dragon_mature", "white", "dragon_frost", DragonBreath.frost) + .setCombat(ConfigMobs.diredragonHP, 2.0F, 1F, ConfigMobs.diredragonMD, 25, 300) + .setProjectile(ConfigMobs.diredragonFD, ConfigMobs.diredragonFT, 300, 0.25F).register(); + public static DragonBreed GREENM = new DragonBreed(2, "dragon_mature", "green", "dragon_green", DragonBreath.poison) + .setCombat(ConfigMobs.diredragonHP, 2.0F, 1F, ConfigMobs.diredragonMD, 30, 200) + .setProjectile(ConfigMobs.diredragonFD, ConfigMobs.diredragonFT, 200, 0.25F).register(); + public static DragonBreed ASHM = new DragonBreed(2, "dragon_mature", "ash", "dragon_ash", DragonBreath.ash) + .setCombat(ConfigMobs.diredragonHP, 2.0F, 1F, ConfigMobs.diredragonMD, 15, 300) + .setProjectile(ConfigMobs.diredragonFD, ConfigMobs.diredragonFT, 100, 0.25F).setBlind().register(); + + public static DragonBreed ELDERRED = new DragonBreed(3, "dragon_elder", "red", "dragon_red", DragonBreath.fire) + .setCombat(ConfigMobs.elderdragonHP, 2.0F, 2F, ConfigMobs.elderdragonMD, 15, 300) + .setProjectile(ConfigMobs.elderdragonFD, ConfigMobs.elderdragonFT, 400, 0.35F).register(); + public static DragonBreed ELDERWHITE = new DragonBreed(3, "dragon_elder", "white", "dragon_frost", + DragonBreath.frost).setCombat(ConfigMobs.elderdragonHP, 2.0F, 2F, ConfigMobs.elderdragonMD, 25, 300) + .setProjectile(ConfigMobs.elderdragonFD, ConfigMobs.elderdragonFT, 300, 0.35F).register(); + public static DragonBreed ELDERGREEN = new DragonBreed(3, "dragon_elder", "green", "dragon_green", + DragonBreath.poison).setCombat(ConfigMobs.elderdragonHP, 2.0F, 2F, ConfigMobs.elderdragonMD, 35, 200) + .setProjectile(ConfigMobs.elderdragonFD, ConfigMobs.elderdragonFT, 200, 0.35F).register(); + public static DragonBreed ELDERASH = new DragonBreed(3, "dragon_elder", "ash", "dragon_ash", DragonBreath.ash) + .setCombat(ConfigMobs.elderdragonHP, 2.0F, 2F, ConfigMobs.elderdragonMD, 15, 300) + .setProjectile(ConfigMobs.elderdragonFD, ConfigMobs.elderdragonFT, 100, 0.35F).setBlind().register(); + + public static DragonBreed ANCIENT = new DragonBreed(4, "dragon_ancient", "dire", "dragon_ancient", + DragonBreath.fire).setCombat(ConfigMobs.ancientdragonHP, 2.0F, 5F, ConfigMobs.ancientdragonMD, 20, 300) + .setProjectile(ConfigMobs.ancientdragonFD, ConfigMobs.ancientdragonFT, 400, 1.0F).register(); + private static Random rand = new Random(); + public int tier = 0; + public String name = "dragon"; + public String breedName = "red"; + public DragonBreath rangedAttack; + public String tex = "dragonGreen"; + public float health = 250; + public float regenRate = 2; + public float meleeDamage = 12; + public float fireDamage = 10; + public float pyro = 1.0F; + public int disengageChance = 200; + public int fireTimer = 25; + public int coolTimer = 250; + public int meleeSpeed = 25; + public float DT = 2.0F; + private boolean isBlind = false; + + public DragonBreed(int tier, String name, String breedname, String tex, DragonBreath breath) { + this.tier = tier; + this.name = name; + this.breedName = breedname; + this.tex = tex; + this.rangedAttack = breath; + } + + public static DragonBreed getBreed(int tier, int id) { + tier = Math.min(breeds.length - 1, tier); + id = Math.min(breeds[tier].size() - 1, id); + DragonBreed breed = breeds[tier].get(id); + return breed != null ? breed : breeds[tier].get(0); + } + + public static int getRandomDragon(EntityDragon dragon, int tier) { + ArrayList pool = breeds[tier]; + BiomeGenBase biome = dragon.worldObj.getBiomeGenForCoords((int) (dragon.posX), (int) (dragon.posZ)); + int id = getIdForBiome(biome, + dragon.worldObj.canLightningStrikeAt((int) dragon.posX, (int) dragon.posY, (int) dragon.posZ), + dragon.dimension); + if (id >= pool.size()) { + id = pool.size() - 1; + } + return id; + } + + private static int getIdForBiome(BiomeGenBase biome, boolean isRaining, int dimension) { + if (dimension == -1) { + return rand.nextBoolean() ? 3 : 0;// Ash or Fire + } + BiomeGenBase.TempCategory category = biome.getTempCategory(); + if (!biome.func_150559_j() && !biome.canSpawnLightningBolt()) + return 3;// Ash + if (biome.getEnableSnow() || biome.temperature <= 0.25F || category == BiomeGenBase.TempCategory.COLD) + return 1;// Frost + if (biome.isHighHumidity() || (category == BiomeGenBase.TempCategory.MEDIUM && isRaining)) + return 2;// Poison + if (category == BiomeGenBase.TempCategory.OCEAN) + return 2;// Poison + return 0;// Fire + } + + public DragonBreed setCombat(float health, float DT, float regenRate, float meleeDamage, int meleeSpeed, + int disengageChance) { + this.health = health; + this.regenRate = regenRate; + this.meleeDamage = meleeDamage; + this.meleeSpeed = meleeSpeed; + this.disengageChance = disengageChance; + this.DT = DT; + return this; + } + + public DragonBreed setProjectile(float fireDamage, int fireTimer, int coolTimer, float pyro) { + this.fireDamage = fireDamage; + this.fireTimer = fireTimer; + this.coolTimer = coolTimer; + this.pyro = pyro; + return this; + } + + public DragonBreed register() { + breeds[tier].add(this); + return this; + } + + public DragonBreed setBlind() { + isBlind = true; + return this; + } + + public boolean isBlind() { + return isBlind; + } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/EntityDragon.java b/src/main/java/minefantasy/mf2/entity/mob/EntityDragon.java index ef2cec70..6d89347e 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/EntityDragon.java +++ b/src/main/java/minefantasy/mf2/entity/mob/EntityDragon.java @@ -1,8 +1,7 @@ package minefantasy.mf2.entity.mob; -import java.util.Iterator; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.armour.IArmourPenetrationMob; import minefantasy.mf2.api.armour.IArmouredEntity; import minefantasy.mf2.api.helpers.ArmourCalculator; @@ -14,11 +13,7 @@ import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.item.list.ToolListMF; import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.IEntityLivingData; -import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.*; import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; @@ -27,36 +22,32 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class EntityDragon extends EntityFlyingMF implements IMob, IBossDisplayData, IArmouredEntity, IArmourPenetrationMob -{ - public static int interestTimeSeconds = 90; - public static float heartChance = 1.0F; - +import java.util.Iterator; +import java.util.List; + +public class EntityDragon extends EntityFlyingMF + implements IMob, IBossDisplayData, IArmouredEntity, IArmourPenetrationMob { + private static final int dataID = 12; + public static int interestTimeSeconds = 90; + public static float heartChance = 16.0F; public int courseChangeCooldown; public double waypointX; public double waypointY; public double waypointZ; + public int fireBreathCooldown; private Entity targetedEntity; - private int attackCounter; - private int fireBreathTick; - public int fireBreathCooldown; - private Entity lastEnemy; - private int interestTime; - @SideOnly(Side.CLIENT) - private int wingFlap, wingTick; - public EntityDragon(World world) - { + private int attackCounter; + private int fireBreathTick; + private Entity lastEnemy; + private int interestTime; + @SideOnly(Side.CLIENT) + private int wingFlap, wingTick; + + public EntityDragon(World world) { super(world); this.setSize(4.0F, 3.0F); this.isImmuneToFire = true; @@ -65,248 +56,217 @@ public EntityDragon(World world) } @Override - protected void fall(float distance) - { - if(isTerrestrial()) - { - float power = Math.min(distance/2F, 3F) * getScale(); - createShockwave(posX, posY, posZ, power / 2F, ConfigMobs.dragonGriefGeneral); - } - } - - public void setDragon(int tier) - { - setTier(tier); - setBreed(DragonBreed.getRandomDragon(this, tier)); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getType().health); - setHealth(getMaxHealth()); - this.setSize(3.0F*getScale(), 2.0F*getScale()); - stepHeight = 1.25F + (tier*0.25F); - this.experienceValue = 50 * (tier+1); - } - + protected void fall(float distance) { + if (isTerrestrial()) { + float power = Math.min(distance / 2F, 3F) * getScale(); + createShockwave(posX, posY, posZ, power / 2F, ConfigMobs.dragonGriefGeneral); + } + } + + public void setDragon(int tier) { + setTier(tier); + setBreed(DragonBreed.getRandomDragon(this, tier)); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getType().health); + setHealth(getMaxHealth()); + this.setSize(4.0F * getScale(), 3.0F * getScale()); + stepHeight = 1.25F + (tier * 0.25F); + this.experienceValue = 75 * (tier + 2); + } + @Override - public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) - { - setDragon(getRandomTier()); - return super.onSpawnWithEgg(data); - } - - private int getRandomTier() - { - float f = rand.nextFloat()*100F; - - if(f < 25F) - { - return 0;//0-25 (25%) - } - if(f < 50F) - { - return 2;//25-50 (25%) - } - if(f < 59F) - { - return 3;//50-59 (9%) - } - if(f < 60F)//59-60 (1%) - { - return 4;//55-60 - } - return 1;//60-100 40% - } - - private static final int dataID = 12; - protected void entityInit() - { + public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) { + setDragon(getRandomTier()); + return super.onSpawnWithEgg(data); + } + + private int getRandomTier() { + float f = rand.nextFloat() * 100F; + + if (f < 25F) { + return 0;// 0-25 (25%) + } + if (f < 20F) { + return 0;// 25-50 (25%) + } + if (f < 15F) { + return 0;// 50-59 (9%) + } + if (f < 10F)// 59-60 (1%) + { + return 0;// 55-60 + } + return 1;// 60-100 40% + } + + protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(dataID, Byte.valueOf((byte)0)); - this.dataWatcher.addObject(dataID+1, Float.valueOf(0F)); - this.dataWatcher.addObject(dataID+2, Float.valueOf(0F)); - this.dataWatcher.addObject(dataID+3, Integer.valueOf(0)); - this.dataWatcher.addObject(dataID+4, Integer.valueOf(0)); - this.dataWatcher.addObject(dataID+5, Integer.valueOf(rand.nextInt(5))); + this.dataWatcher.addObject(dataID, Byte.valueOf((byte) 0)); + this.dataWatcher.addObject(dataID + 1, Float.valueOf(0F)); + this.dataWatcher.addObject(dataID + 2, Float.valueOf(0F)); + this.dataWatcher.addObject(dataID + 3, Integer.valueOf(0)); + this.dataWatcher.addObject(dataID + 4, Integer.valueOf(0)); + this.dataWatcher.addObject(dataID + 5, Integer.valueOf(rand.nextInt(5))); } - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(ConfigMobs.dragonHP); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); } @Override - public void onUpdate() - { - super.onUpdate(); - - if(fireBreathTick > 0)--fireBreathTick; - if(fireBreathCooldown > 0)--fireBreathCooldown; - - if(!isTerrestrial()) - { - this.fallDistance = 0; - } - if(!worldObj.isRemote) - { - if(isInWater()) - { - if (rand.nextFloat() < 0.8F) - { + public void onUpdate() { + super.onUpdate(); + + if (fireBreathTick > 0) + --fireBreathTick; + if (fireBreathCooldown > 0) + --fireBreathCooldown; + + if (!isTerrestrial()) { + this.fallDistance = 0; + } + if (!worldObj.isRemote) { + if (isInWater()) { + if (rand.nextFloat() < 0.8F) { getJumpHelper().setJumping(); } } - - int disengageTime = getDisengageTime(); - if(disengageTime > 0) - { - if(targetedEntity != null)targetedEntity = null; - --disengageTime; - } - if(disengageTime == 1 && lastEnemy != null && this.canAttackEntity(lastEnemy)) - { - setTarget(lastEnemy); - lastEnemy = null; - } - setDisengageTime(disengageTime); - if(rand.nextInt(this.getDisengageChance()) == 0 && disengageTime <= 0) - { - disengage(100); - } - - if(onGround)//Ground begin walk - { - setTerrestrial(true); - } - if(targetedEntity != null && targetedEntity.posY < (posY-5D) && this.getDistance(targetedEntity.posX, posY, targetedEntity.posZ) < 2D)//Slam to enemy - { - setTerrestrial(true); - } - if(rand.nextInt(100) == 0 && targetedEntity == null)//Idle take off - { - setTerrestrial(false); - jump(); - } - if(targetedEntity != null && targetedEntity.posY > (posY+2D))//Combat take off - { - setTerrestrial(false); - jump(); - } - - if(fireBreathTick > 0 && targetedEntity != null) - { - this.faceEntity(targetedEntity, 1F, 1F); - breatheFire(); - } - - if (targetedEntity == null && (rand.nextInt(100) == 0) && disengageTime <= 0) - { - this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 1.5F - 1.0F) * 12.0F); - this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - } - if (targetedEntity == null && (rand.nextInt(100) == 0) && disengageTime > 0) - { - this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.waypointY = this.posY - 4D; - this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - } - if(getHealth() < getMaxHealth() && this.ticksExisted % 100 == 0 && getType().regenRate > 0) - { - heal(getType().regenRate); - if(getHealth() > getMaxHealth()) - { - setHealth(getMaxHealth()); - } - } - int time = getInterestTime(); - int maxTime = ((getHealth() > (getMaxHealth()*0.75F)) ? time : time*2) * 20; - if(dimension != -1) - { - ++interestTime; - if(interestTime > maxTime && worldObj.canBlockSeeTheSky((int)posX, (int)posY, (int)posZ) && posY > 128F) - { - if(ConfigMobs.dragonMSG) - { - List list = worldObj.playerEntities; - Iterator players = list.iterator(); - while(players.hasNext()) - { - Object instance = players.next(); - if(instance != null && instance instanceof EntityPlayer) - { - if(((EntityPlayer)instance).getDistanceToEntity(this) < 128D) - { - ((EntityPlayer)instance).addChatMessage(new ChatComponentText(StatCollector.translateToLocal("event.dragonaway.name"))); - } - } - } - } - this.setDead(); - } - if(interestTime > maxTime - 60 && worldObj.canBlockSeeTheSky((int)posX, (int)posY, (int)posZ)) - { - this.waypointY = this.posY + 4D; - } - } - } - else - { - float jawMove = getJawMove(); - if(jawMove > 0) - { - -- jawMove; - } - setJawMove(jawMove); - float neckAngle = getNeckAngle(); - if(neckAngle > 0) - { - -- neckAngle; - } - setNeckAngle(neckAngle); - - wingTick++; - if (wingTick == 20) { - wingTick = 0; - if(!isTerrestrial()) - worldObj.playSoundAtEntity(this,"mob.enderdragon.flap", 0.5F, 1.5F); - } - int i = (120 / 20) * wingTick; - wingFlap = -40 + i; - } - } - + + int disengageTime = getDisengageTime(); + if (disengageTime > 0) { + if (targetedEntity != null) + targetedEntity = null; + --disengageTime; + } + if (disengageTime == 1 && lastEnemy != null && this.canAttackEntity(lastEnemy)) { + setTarget(lastEnemy); + lastEnemy = null; + } + setDisengageTime(disengageTime); + if (rand.nextInt(this.getDisengageChance()) == 0 && disengageTime <= 0) { + disengage(100); + } + + if (onGround)// Ground begin walk + { + setTerrestrial(true); + } + if (targetedEntity != null && targetedEntity.posY < (posY - 5D) + && this.getDistance(targetedEntity.posX, posY, targetedEntity.posZ) < 2D)// Slam to enemy + { + setTerrestrial(true); + } + if (rand.nextInt(100) == 0 && targetedEntity == null)// Idle take off + { + setTerrestrial(false); + jump(); + } + if (targetedEntity != null && targetedEntity.posY > (posY + 2D))// Combat take off + { + setTerrestrial(false); + jump(); + } + + if (fireBreathTick > 0 && targetedEntity != null) { + this.faceEntity(targetedEntity, 1F, 1F); + breatheFire(); + } + + if (targetedEntity == null && (rand.nextInt(100) == 0) && disengageTime <= 0) { + this.waypointX = this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + this.waypointY = this.posY + (this.rand.nextFloat() * 1.5F - 1.0F) * 12.0F; + this.waypointZ = this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + } + if (targetedEntity == null && (rand.nextInt(100) == 0) && disengageTime > 0) { + this.waypointX = this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + this.waypointY = this.posY - 4D; + this.waypointZ = this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + } + if (getHealth() < getMaxHealth() && this.ticksExisted % 100 == 0 && getType().regenRate > 0) { + heal(getType().regenRate); + if (getHealth() > getMaxHealth()) { + setHealth(getMaxHealth()); + } + } + int time = getInterestTime(); + int maxTime = ((getHealth() > (getMaxHealth() * 0.75F)) ? time : time * 2) * 20; + if (dimension != -1) { + ++interestTime; + if (interestTime > maxTime && worldObj.canBlockSeeTheSky((int) posX, (int) posY, (int) posZ) + && posY > 128F) { + if (ConfigMobs.dragonMSG) { + List list = worldObj.playerEntities; + Iterator players = list.iterator(); + while (players.hasNext()) { + Object instance = players.next(); + if (instance != null && instance instanceof EntityPlayer) { + if (((EntityPlayer) instance).getDistanceToEntity(this) < 128D) { + ((EntityPlayer) instance).addChatMessage(new ChatComponentText( + StatCollector.translateToLocal("event.dragonaway.name"))); + } + } + } + } + this.setDead(); + } + if (interestTime > maxTime - 60 && worldObj.canBlockSeeTheSky((int) posX, (int) posY, (int) posZ)) { + this.waypointY = this.posY + 4D; + } + } + } else { + float jawMove = getJawMove(); + if (jawMove > 0) { + --jawMove; + } + setJawMove(jawMove); + float neckAngle = getNeckAngle(); + if (neckAngle > 0) { + --neckAngle; + } + setNeckAngle(neckAngle); + + wingTick++; + if (wingTick == 20) { + wingTick = 0; + if (!isTerrestrial()) + worldObj.playSoundAtEntity(this, "mob.enderdragon.flap", 0.5F, 1.5F); + } + int i = (120 / 20) * wingTick; + wingFlap = -40 + i; + } + } + private int getInterestTime() { - return interestTimeSeconds; - } - - private void breatheFire() - { - int spread = 4; - - for(int a = 0; a < spread; a ++) - { - double xAngle = this.targetedEntity.posX - this.posX; - double yAngle = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - (this.posY + (double) (this.height / 2.0F)); - double zAngle = this.targetedEntity.posZ - this.posZ; - double power = 1.0D; - Vec3 var20 = this.getLook(1.0F); - Entity breath = getBreath(xAngle, yAngle, zAngle); - breath.posX = this.posX + var20.xCoord * power; - breath.posY = this.posY + (double) (this.height / 2.0F) + 0.5D; - breath.posZ = this.posZ + var20.zCoord * power; - this.worldObj.spawnEntityInWorld(breath); - } - } - private Entity getBreath(double xAngle, double yAngle, double zAngle) - { - return new EntityDragonBreath(this.worldObj, this, xAngle, yAngle, zAngle, 1.0F).setDamage(getType().fireDamage).setType(getType().rangedAttack.id); - } - - @Override - protected void updateEntityActionState() - { - if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) - { + return interestTimeSeconds; + } + + private void breatheFire() { + int spread = 4; + + for (int a = 0; a < spread; a++) { + double xAngle = this.targetedEntity.posX - this.posX; + double yAngle = this.targetedEntity.boundingBox.minY + this.targetedEntity.height / 2.0F + - (this.posY + this.height / 2.0F); + double zAngle = this.targetedEntity.posZ - this.posZ; + double power = 1.0D; + Vec3 var20 = this.getLook(1.0F); + Entity breath = getBreath(xAngle, yAngle, zAngle); + breath.posX = this.posX + var20.xCoord * power; + breath.posY = this.posY + this.height / 2.0F + 0.5D; + breath.posZ = this.posZ + var20.zCoord * power; + this.worldObj.spawnEntityInWorld(breath); + } + } + + private Entity getBreath(double xAngle, double yAngle, double zAngle) { + return new EntityDragonBreath(this.worldObj, this, xAngle, yAngle, zAngle, 1.0F).setDamage(getType().fireDamage) + .setType(getType().rangedAttack.id); + } + + @Override + protected void updateEntityActionState() { + if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { this.setDead(); } @@ -316,466 +276,414 @@ protected void updateEntityActionState() double d2 = this.waypointZ - this.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; - if (d3 < 1.0D || d3 > 3600.0D) - { - this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + if (d3 < 1.0D || d3 > 3600.0D) { + this.waypointX = this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + this.waypointY = this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + this.waypointZ = this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; } - if (this.courseChangeCooldown-- <= 0) - { + if (this.courseChangeCooldown-- <= 0) { this.courseChangeCooldown += this.rand.nextInt(5) + 2; - d3 = (double)MathHelper.sqrt_double(d3); + d3 = MathHelper.sqrt_double(d3); double flyspd = getFlightSpeed(); - if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3)) - { + if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3)) { this.motionX += d0 / d3 * 0.5D * flyspd; this.motionY += d1 / d3 * 0.5D * flyspd; this.motionZ += d2 / d3 * 0.5D * flyspd; - } - else - { + } else { this.waypointX = this.posX; this.waypointY = this.posY; this.waypointZ = this.posZ; } } - if (this.targetedEntity != null && this.targetedEntity.isDead) - { + if (this.targetedEntity != null && this.targetedEntity.isDead) { this.targetedEntity = null; } - if (this.targetedEntity == null) - { + if (this.targetedEntity == null) { EntityPlayer closest = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D); - if(closest != null && canAttackEntity(closest)) - { - targetedEntity = closest; - closest = null; + if (closest != null && canAttackEntity(closest)) { + targetedEntity = closest; + closest = null; } - if (this.targetedEntity != null) - { + if (this.targetedEntity != null) { this.moveToTarget(); } } - + if (this.targetedEntity != null && this.targetedEntity.isDead) { this.targetedEntity = null; } - if (this.targetedEntity == null) - { - this.setEntityToAttack(EntityPlayer.class); + if (this.targetedEntity == null) { + this.setEntityToAttack(EntityPlayer.class); } - if (ConfigMobs.dragonKillNPC && this.targetedEntity == null) - { - this.setEntityToAttack(EntityLiving.class); + if (ConfigMobs.dragonKillNPC && this.targetedEntity == null) { + this.setEntityToAttack(EntityLiving.class); } double var9 = 200.0D; - if (this.targetedEntity != null && getDisengageTime() <= 0 && this.targetedEntity.getDistanceSqToEntity(this) < var9 * var9) - { - if (!worldObj.isRemote && !this.canEntityBeSeen(this.targetedEntity) && getDisengageTime() <= 0 && (targetedEntity instanceof EntityPlayer ? rand.nextInt(40) == 0 : true)) - { - disengage(200); - return; + if (this.targetedEntity != null && getDisengageTime() <= 0 + && this.targetedEntity.getDistanceSqToEntity(this) < var9 * var9) { + if (!worldObj.isRemote && !this.canEntityBeSeen(this.targetedEntity) && getDisengageTime() <= 0 + && (targetedEntity instanceof EntityPlayer ? rand.nextInt(40) == 0 : true)) { + disengage(200); + return; } - float range = getAttackRange(); - + float range = getAttackRange(); + double var11 = this.targetedEntity.posX - this.posX; - double var13 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - (this.posY + (double) (this.height / 2.0F)); + double var13 = this.targetedEntity.boundingBox.minY + this.targetedEntity.height / 2.0F + - (this.posY + this.height / 2.0F); double var15 = this.targetedEntity.posZ - this.posZ; this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(var11, var15)) * 180.0F / (float) Math.PI; - - boolean inRangeOfAttack = this.targetedEntity.getDistanceToEntity(this) < (range*getScale()) && this.canEntityBeSeen(targetedEntity); - boolean inRangeOfLeap = onGround && this.targetedEntity.getDistanceToEntity(this) > range*2 && this.targetedEntity.getDistanceToEntity(this) < range*8; - boolean inRangeOfFire = this.targetedEntity.getDistanceToEntity(this) > range && this.targetedEntity.getDistanceToEntity(this) < range*6 && fireBreathCooldown <= 0; - - if (this.canEntityBeSeen(this.targetedEntity) && inRangeOfFire) - { + + boolean inRangeOfAttack = this.targetedEntity.getDistanceToEntity(this) < (range * getScale()) + && this.canEntityBeSeen(targetedEntity); + boolean inRangeOfLeap = onGround && this.targetedEntity.getDistanceToEntity(this) > range * 2 + && this.targetedEntity.getDistanceToEntity(this) < range * 8; + boolean inRangeOfFire = this.targetedEntity.getDistanceToEntity(this) > range + && this.targetedEntity.getDistanceToEntity(this) < range * 6 && fireBreathCooldown <= 0; + + if (this.canEntityBeSeen(this.targetedEntity) && inRangeOfFire) { this.fireBreathTick = getType().fireTimer; - + fireBreathCooldown = 600 + getBreathCooldown() + rand.nextInt(getBreathCooldown()); worldObj.playSoundAtEntity(this, "minefantasy2:mob.dragon.fire", 1, 1); setJawMove(20); } - if (this.canEntityBeSeen(this.targetedEntity) && inRangeOfLeap && rand.nextInt(100) == 0) - { + if (this.canEntityBeSeen(this.targetedEntity) && inRangeOfLeap && rand.nextInt(100) == 0) { TacticalManager.lungeEntity(this, targetedEntity, 3.0F, 1.5F); } - if (fallDistance <= 0 && this.canEntityBeSeen(this.targetedEntity) && inRangeOfAttack) - { - if ((targetedEntity.isSneaking() && !targetedEntity.onGround ) || this.attackCounter <= 0) - { - if(targetedEntity.isRiding() && posY > (targetedEntity.posY)) - { - targetedEntity.mountEntity(null); - targetedEntity.motionY = 1.0F; - targetedEntity.motionX = this.motionX; - targetedEntity.motionZ = this.motionZ; - if(targetedEntity instanceof EntityLivingBase) - { - ((EntityLivingBase)targetedEntity).addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 5)); - ((EntityLivingBase)targetedEntity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 5)); - ((EntityLivingBase)targetedEntity).addPotionEffect(new PotionEffect(Potion.weakness.id, 200, 2)); - } - } + if (fallDistance <= 0 && this.canEntityBeSeen(this.targetedEntity) && inRangeOfAttack) { + if ((targetedEntity.isSneaking() && !targetedEntity.onGround) || this.attackCounter <= 0) { + if (targetedEntity.isRiding() && posY > (targetedEntity.posY)) { + targetedEntity.mountEntity(null); + targetedEntity.motionY = 1.0F; + targetedEntity.motionX = this.motionX; + targetedEntity.motionZ = this.motionZ; + if (targetedEntity instanceof EntityLivingBase) { + ((EntityLivingBase) targetedEntity) + .addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 5)); + ((EntityLivingBase) targetedEntity) + .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 5)); + ((EntityLivingBase) targetedEntity) + .addPotionEffect(new PotionEffect(Potion.weakness.id, 200, 2)); + } + } attackEntity(targetedEntity, this.getAttackStrength(targetedEntity)); this.attackCounter = getAttackTime(); setJawMove(40); - if(getHealth() <= this.getLowHPThreshold()) - { - disengage(50); + if (getHealth() <= this.getLowHPThreshold()) { + disengage(50); } worldObj.playSoundAtEntity(this, "minefantasy2:mob.dragon.bite", 1, 1); } - } if (this.attackCounter > 0) { + } + if (this.attackCounter > 0) { --this.attackCounter; } - if (this.canEntityBeSeen(this.targetedEntity) && !inRangeOfAttack) - { - this.faceEntity(targetedEntity, 1F, 1F); + if (this.canEntityBeSeen(this.targetedEntity) && !inRangeOfAttack) { + this.faceEntity(targetedEntity, 1F, 1F); waypointX = targetedEntity.posX; waypointY = targetedEntity.posY; waypointZ = targetedEntity.posZ; } - } - else - { - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float) Math.PI; + } else { + this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F + / (float) Math.PI; if (this.attackCounter > 0) { --this.attackCounter; } } } - private float getAttackRange() - { - return 6.0F; - } - private float getFlightSpeed() { - return 0.8F; - } + private float getAttackRange() { + return 6.0F; + } - @Override - public boolean canEntityBeSeen(Entity entity) - { - return entity != null && super.canEntityBeSeen(entity); + private float getFlightSpeed() { + return 0.8F; } - private int getBreathCooldown() - { - return getType().coolTimer; - } + @Override + public boolean canEntityBeSeen(Entity entity) { + return entity != null && super.canEntityBeSeen(entity); + } + + private int getBreathCooldown() { + return getType().coolTimer; + } - private int getAttackTime() - { - return getType().meleeSpeed; - } + private int getAttackTime() { + return getType().meleeSpeed; + } - /** + /** * True if the ghast has an unobstructed line of travel to the waypoint. */ - private boolean isCourseTraversable(double x, double y, double z, double distance) - { + private boolean isCourseTraversable(double x, double y, double z, double distance) { double d4 = (this.waypointX - this.posX) / distance; double d5 = (this.waypointY - this.posY) / distance; double d6 = (this.waypointZ - this.posZ) / distance; AxisAlignedBB axisalignedbb = this.boundingBox.copy(); - for (int i = 1; (double)i < distance; ++i) - { + for (int i = 1; i < distance; ++i) { axisalignedbb.offset(d4, d5, d6); - if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) - { + if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) { return false; } - Block block = worldObj.getBlock((int)d4, (int)d5, (int)d6); - if(block.getMaterial().isLiquid()) - { - return false; + Block block = worldObj.getBlock((int) d4, (int) d5, (int) d6); + if (block.getMaterial().isLiquid()) { + return false; } } return true; } - protected void attackEntity(Entity entity, float f) - { + protected void attackEntity(Entity entity, float f) { float damage = this.getAttackStrength(entity); - - if (rand.nextInt(3) == 0) - { + + if (rand.nextInt(3) == 0) { targetedEntity.motionY = 2; jump(); setNeckAngle(10); - damage = 2.0F; + damage = 4.0F; } worldObj.playSoundAtEntity(this, "minefantasy2:mob.dragon.bite", 1, 1); entity.attackEntityFrom(DamageSource.causeMobDamage(this), damage); } - + @Override - public void playLivingSound() - { - super.playLivingSound(); - setJawMove(20); + public void playLivingSound() { + super.playLivingSound(); + setJawMove(20); } + private float getAttackStrength(Entity entity) { + return getType().meleeDamage; + } - private float getAttackStrength(Entity entity) - { - return getType().meleeDamage; - } - - public void setEntityToAttack(Class enClass) - { - List list = worldObj.getEntitiesWithinAABB(enClass, AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D).expand(getAggro(), getAggro(), getAggro())); - while (!list.isEmpty()) - { + public void setEntityToAttack(Class enClass) { + List list = worldObj.getEntitiesWithinAABB(enClass, + AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D).expand(getAggro(), + getAggro(), getAggro())); + while (!list.isEmpty()) { Entity target = (Entity) list.get(0); - if (canAttackEntity(target)) - { - double r = getAggro(); - boolean inRange = this.getDistanceToEntity(target) <= r; - if(getDisengageTime() <= 0 && inRange) - { - setTarget(target); - list.clear(); - } - else - { - list.remove(0); - } - } - else - { + if (canAttackEntity(target)) { + double r = getAggro(); + boolean inRange = this.getDistanceToEntity(target) <= r; + if (getDisengageTime() <= 0 && inRange) { + setTarget(target); + list.clear(); + } else { + list.remove(0); + } + } else { list.remove(0); } } } - - public void setTarget(Entity target) - { + + public void setTarget(Entity target) { this.targetedEntity = target; } - private boolean canAttackEntity(Entity target) - { - if(this.getType().isBlind() && !this.canHearEntity(target) ) - { - return false; - } - if(getDisengageTime() > 0) - { - return false; - } - if(!this.canEntityBeSeen(target))return false; - if (target instanceof EntityDragon || target == this.riddenByEntity) - { + + private boolean canAttackEntity(Entity target) { + if (this.getType().isBlind() && !this.canHearEntity(target)) { + return false; + } + if (getDisengageTime() > 0) { + return false; + } + if (!this.canEntityBeSeen(target)) + return false; + if (target instanceof EntityDragon || target == this.riddenByEntity) { return false; } if (target instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer)target; + EntityPlayer player = (EntityPlayer) target; return !player.capabilities.isCreativeMode; } return canEntityBeSeen(target); } - - private double getAggro() - { - return 256D; - } - - @Override - public boolean attackEntityFrom(DamageSource source, float damage) - { - if(source.getEntity() != null) - { - this.interestTime = 0; - } - if(getDisengageTime() <= 0 && this.getHealth() < getLowHPThreshold()) - { - disengage(100); - } - if(source.isFireDamage()) - return false; - - if(source == DamageSource.inWall) - return false; - - if(source.getEntity() != null && source.getEntity() instanceof EntityPlayer) - { - if(getDisengageTime() <= 0 && getAttackTarget() == null || damage > 16 || (targetedEntity != null && !(targetedEntity instanceof EntityPlayer))) + + private double getAggro() { + return 256D; + } + + @Override + public boolean attackEntityFrom(DamageSource source, float damage) { + if (source.getEntity() != null) { + this.interestTime = 0; + } + if (getDisengageTime() <= 0 && this.getHealth() < getLowHPThreshold()) { + disengage(100); + } + if (source.isFireDamage()) + return false; + + if (source == DamageSource.inWall) + return false; + + if (source.getEntity() != null && source.getEntity() instanceof EntityPlayer) { + if (getDisengageTime() <= 0 && getAttackTarget() == null || damage > 20 + || (targetedEntity != null && !(targetedEntity instanceof EntityPlayer))) setTarget(source.getEntity()); } - - if(source.getEntity() != null) - { - if(getDisengageTime() <= 0 && getAttackTarget() == null) - setTarget(source.getEntity()); + + if (source.getEntity() != null) { + if (getDisengageTime() <= 0 && getAttackTarget() == null) + setTarget(source.getEntity()); } return super.attackEntityFrom(source, damage); } - - /** - * @return The health threshold where dragons constantly retreat - */ - private float getLowHPThreshold() - { - return getType().health / 4; - } - - private int getDisengageChance() - { - return getType().disengageChance; - } - - @Override - protected String getLivingSound() - { + + /** + * @return The health threshold where dragons constantly retreat + */ + private float getLowHPThreshold() { + return getType().health / 4; + } + + private int getDisengageChance() { + return getType().disengageChance; + } + + @Override + protected String getLivingSound() { return "minefantasy2:mob.dragon.say"; } - - @Override - protected void func_145780_a(int x, int y, int z, Block floor) - { + + @Override + protected void func_145780_a(int x, int y, int z, Block floor) { this.playSound("minefantasy2:mob.dragon.step", 1.0F, 1.0F); } /** * Returns the sound this mob makes when it is hurt. */ - @Override - protected String getHurtSound() - { + @Override + protected String getHurtSound() { return "minefantasy2:mob.dragon.hurt"; } /** * Returns the volume for the sounds this mob makes. */ - @Override - protected float getSoundVolume() - { + @Override + protected float getSoundVolume() { return 2.0F; } - @Override - protected float getSoundPitch() - { + + @Override + protected float getSoundPitch() { return 1.0F; } - - protected Item getDropItem() - { + + protected Item getDropItem() { return ComponentListMF.dragon_heart; } /** - * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param - * par2 - Level of Looting used to kill this mob. + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has + * recently been hit by a player. @param par2 - Level of Looting used to kill + * this mob. */ @Override - protected void dropFewItems(boolean playerKill, int looting) - { - int count = getLootCount(getTier()) + rand.nextInt(looting+1); - for(int a = 0; a < count; a++) - { - Item drop = getLoot(getTier()); - this.dropItem(drop, 1); - } - if(getTier() == 4)//ANCIENT - { - this.dropItem(Items.nether_star, 1); - } - if(didDropHeart(this.getTier())) - { - this.dropItem(ComponentListMF.dragon_heart, 1); - } - } - - private Item getLoot(int tier) - { - if(tier == 4)//Ancient - { - return ToolListMF.loot_sack_rare; - } - return ToolListMF.loot_sack_uc;//Any - } - - private boolean didDropHeart(int tier) - { - if(tier == 4)//Ancient - { - return true; - } - if(tier == 3)//Elder - { - return true; - } - if(tier == 2)//Mature - { - return rand.nextFloat() * heartChance > 0.25F;//75% chance - } - if(tier == 1)//Adult - { - return rand.nextFloat() * heartChance >0.85F;//15% chance - } - return false;//Young - } - - private int getLootCount(int tier) - { - if(tier == 4)//Ancient - { - return 1;//1 Exquisite - } - if(tier == 3)//Elder - { - return 2 + rand.nextInt(4);//2-5 Valuable - } - if(tier == 2)//Mature - { - return 2 + rand.nextInt(1);//2-3 Valuable - } - if(tier == 1)//Adult - { - return 1 + rand.nextInt(1);//1-2 Valuable - } - return 1;//Young, 1 Valuable - } - - /** - * Checks if the entity's current position is a valid location to spawn this entity. + protected void dropFewItems(boolean playerKill, int looting) { + int count = getLootCount(getTier()) + rand.nextInt(looting + 1); + for (int a = 0; a < count; a++) { + Item drop = getLoot(getTier()); + this.dropItem(drop, 1); + } + if (getTier() == 4)// ANCIENT + { + this.dropItem(Items.nether_star, 1); + } + if (didDropHeart(this.getTier())) { + this.dropItem(ComponentListMF.dragon_heart, 1); + } + } + + private Item getLoot(int tier) { + if (tier == 4)// Ancient + { + return ToolListMF.loot_sack_rare; + } + return ToolListMF.loot_sack_uc;// Any + } + + private boolean didDropHeart(int tier) { + if (tier == 4)// Ancient + { + return true; + } + if (tier == 3)// Elder + { + return true; + } + if (tier == 2)// Mature + { + return rand.nextFloat() * heartChance > 0.25F;// 75% chance + } + if (tier == 1)// Adult + { + return rand.nextFloat() * heartChance > 1.50F;// 15% chance + } + return false;// Young + } + + private int getLootCount(int tier) { + if (tier == 4)// Ancient + { + return 1;// 1 Exquisite + } + if (tier == 3)// Elder + { + return 2 + rand.nextInt(4);// 2-5 Valuable + } + if (tier == 2)// Mature + { + return 2 + rand.nextInt(1);// 2-3 Valuable + } + if (tier == 1)// Adult + { + return 1 + rand.nextInt(1);// 1-2 Valuable + } + return 1;// Young, 1 Valuable + } + + /** + * Checks if the entity's current position is a valid location to spawn this + * entity. */ @Override - public boolean getCanSpawnHere() - { - return super.getCanSpawnHere() && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL; + public boolean getCanSpawnHere() { + return super.getCanSpawnHere() && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL; } /** * Will return how many at most can spawn in a chunk at once. */ - public int getMaxSpawnedInChunk() - { - return 1; + public int getMaxSpawnedInChunk() { + return 2; } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - public void writeEntityToNBT(NBTTagCompound nbt) - { + public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); - + nbt.setInteger("FireBreath", fireBreathTick); nbt.setInteger("FireBreathCooldown", fireBreathTick); - + nbt.setInteger("Breed", getBreed()); nbt.setInteger("Tier", getTier()); nbt.setInteger("interestTime", interestTime); @@ -784,149 +692,128 @@ public void writeEntityToNBT(NBTTagCompound nbt) /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - public void readEntityFromNBT(NBTTagCompound nbt) - { + public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); - + fireBreathTick = nbt.getInteger("FireBreath"); - fireBreathCooldown =nbt.getInteger("FireBreathCooldown"); - + fireBreathCooldown = nbt.getInteger("FireBreathCooldown"); + setBreed(nbt.getInteger("Breed")); setTier(nbt.getInteger("Tier")); interestTime = nbt.getInteger("interestTime"); } - + @SideOnly(Side.CLIENT) - public String getTexture() - { - return getType().tex; - } - + public String getTexture() { + return getType().tex; + } + @SideOnly(Side.CLIENT) - public double wingFlap() - { - return wingFlap; - } - + public double wingFlap() { + return wingFlap; + } + @SideOnly(Side.CLIENT) - public float getJawMove() - { - return dataWatcher.getWatchableObjectFloat(dataID+1); - } - + public float getJawMove() { + return dataWatcher.getWatchableObjectFloat(dataID + 1); + } + + public void setJawMove(float i) { + dataWatcher.updateObject(dataID + 1, i); + } + @SideOnly(Side.CLIENT) - public float getNeckAngle() - { - return dataWatcher.getWatchableObjectFloat(dataID+2); - } - - public int getDisengageTime() - { - return dataWatcher.getWatchableObjectInt(dataID+3); - } - - public void setJawMove(float i) - { - dataWatcher.updateObject(dataID+1, i); - } - - public void setNeckAngle(float i) - { - dataWatcher.updateObject(dataID+2, i); - } - - public void setDisengageTime(int i) - { - dataWatcher.updateObject(dataID+3, i); - } - + public float getNeckAngle() { + return dataWatcher.getWatchableObjectFloat(dataID + 2); + } + + public void setNeckAngle(float i) { + dataWatcher.updateObject(dataID + 2, i); + } + + public int getDisengageTime() { + return dataWatcher.getWatchableObjectInt(dataID + 3); + } + + public void setDisengageTime(int i) { + dataWatcher.updateObject(dataID + 3, i); + } + @Override - public boolean isTerrestrial() - { - return dataWatcher.getWatchableObjectByte(dataID) == 1; - } - - public void setTerrestrial(boolean flag) - { - dataWatcher.updateObject(dataID, (byte)(flag ? 1 : 0)); - } - - public double wingAngle() - { - return isTerrestrial() ? 0D : 45D; - } - - private void moveToTarget() - { - if(getDisengageTime() <= 0 && targetedEntity != null) - { - this.faceEntity(targetedEntity, 1F, 1F); - this.waypointX = targetedEntity.posX; - this.waypointY = targetedEntity.posY; - this.waypointZ = targetedEntity.posZ; - } - } - - public void disengage(int time) - { - if(targetedEntity != null && targetedEntity instanceof EntityPlayer) - { - lastEnemy = targetedEntity; - } - setDisengageTime(time); - setTerrestrial(false); - this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.waypointY = this.posY + (double) ((this.rand.nextFloat()) * 16.0F); - this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + public boolean isTerrestrial() { + return dataWatcher.getWatchableObjectByte(dataID) == 1; + } + + public void setTerrestrial(boolean flag) { + dataWatcher.updateObject(dataID, (byte) (flag ? 1 : 0)); + } + + public double wingAngle() { + return isTerrestrial() ? 0D : 45D; + } + + private void moveToTarget() { + if (getDisengageTime() <= 0 && targetedEntity != null) { + this.faceEntity(targetedEntity, 1F, 1F); + this.waypointX = targetedEntity.posX; + this.waypointY = targetedEntity.posY; + this.waypointZ = targetedEntity.posZ; + } + } + + public void disengage(int time) { + if (targetedEntity != null && targetedEntity instanceof EntityPlayer) { + lastEnemy = targetedEntity; + } + setDisengageTime(time); + setTerrestrial(false); + this.waypointX = this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + this.waypointY = this.posY + (this.rand.nextFloat()) * 16.0F; + this.waypointZ = this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; targetedEntity = null; - } - - public DragonBreed getType() - { - return DragonBreed.getBreed(getTier(), getBreed()); - } - public int getBreed() - { - return dataWatcher.getWatchableObjectInt(dataID+4); - } - - public void setBreed(int i) - { - dataWatcher.updateObject(dataID+4, i); - } - public int getTier() - { - return dataWatcher.getWatchableObjectInt(dataID+5); - } - - public void setTier(int i) - { - dataWatcher.updateObject(dataID+5, i); - } - public String getCommandSenderName() - { + } + + public DragonBreed getType() { + return DragonBreed.getBreed(getTier(), getBreed()); + } + + public int getBreed() { + return dataWatcher.getWatchableObjectInt(dataID + 4); + } + + public void setBreed(int i) { + dataWatcher.updateObject(dataID + 4, i); + } + + public int getTier() { + return dataWatcher.getWatchableObjectInt(dataID + 5); + } + + public void setTier(int i) { + dataWatcher.updateObject(dataID + 5, i); + } + + public String getCommandSenderName() { String tierName = StatCollector.translateToLocal("entity." + getType().name + ".name"); String breedName = StatCollector.translateToLocal("entity.dragonbreed." + getType().breedName + ".name"); return StatCollector.translateToLocalFormatted(tierName, breedName); } - public float getScale() - { - return 0.6F + (getTier() * 0.2F); - } - - public Shockwave createShockwave(double x, double y, double z, float power, boolean grief) - { + public float getScale() { + return 1.0F + (getTier() * 0.6F); + } + + public Shockwave createShockwave(double x, double y, double z, float power, boolean grief) { return newShockwave(x, y, z, power, false, grief); } /** - * returns a new explosion. Does initiation (at time of writing Explosion is not finished) + * returns a new explosion. Does initiation (at time of writing Explosion is not + * finished) */ - public Shockwave newShockwave(double x, double y, double z, float power, boolean fire, boolean smoke) - { - Shockwave explosion = new Shockwave("dragonstomp", worldObj, this, x, y, z, power); + public Shockwave newShockwave(double x, double y, double z, float power, boolean fire, boolean smoke) { + Shockwave explosion = new Shockwave("dragonstomp", worldObj, this, x, y, z, power); explosion.isFlaming = fire; explosion.isGriefing = worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"); explosion.isSmoking = smoke; @@ -935,78 +822,69 @@ public Shockwave newShockwave(double x, double y, double z, float power, boolean return explosion; } - public float getFirePyro() - { - if(!ConfigMobs.dragonGriefFire) - { - return 0F; - } - return getType().pyro; - } - - @Override - public float getThreshold(DamageSource src) - { - if(!src.isUnblockable()) - { - return getType().DT; - } - return 0; - } - - @Override - public float[] getHitTraits() - { - return new float[]{0, 1, 9};//90% Piercing, 10% BLunt - } - - @SideOnly(Side.CLIENT) - public float getVertTailAngle() - { - if(this.motionY > 0.05F || this.motionY < -0.05F)//accend or decend - { - if(!(this.motionX == 0 && this.motionZ == 0))//moving - { - float angle = (float) (45F * this.motionY)*5; - if(angle < -45) angle = -45; - if(angle > 45) angle = 45; - - return angle; - } - } - return 0; - } - private boolean canHearEntity(Entity target) - { - if(target instanceof EntityLivingBase && PowerArmour.isWearingCogwork((EntityLivingBase)target)) return true; - - double distance = getDistanceToEntity(target); - - - if(distance < width/2) - { - return true;//touching - } - if(distance < 16 && this.getAttackTarget() != null && getAttackTarget() == target) - { - return true;//Smell - } - float tarSpeed = (float)Math.hypot (target.motionX, target.motionZ); - - if(tarSpeed < 0.1F) - { - return false; - } - if(target instanceof EntityLivingBase) - { - return getSound((EntityLivingBase)target, tarSpeed) >= distance; - } - return true; - } - - private double getSound(EntityLivingBase target, float speed) - { - float value = 10F * (60F + ArmourCalculator.getTotalWeightOfWorn(target, false)) * speed; - return value; - } + public float getFirePyro() { + if (!ConfigMobs.dragonGriefFire) { + return 0F; + } + return getType().pyro; + } + + @Override + public float getThreshold(DamageSource src) { + if (!src.isUnblockable()) { + return getType().DT; + } + return 0; + } + + @Override + public float[] getHitTraits() { + return new float[]{0, 1, 9};// 90% Piercing, 10% BLunt + } + + @SideOnly(Side.CLIENT) + public float getVertTailAngle() { + if (this.motionY > 0.05F || this.motionY < -0.05F)// accend or decend + { + if (!(this.motionX == 0 && this.motionZ == 0))// moving + { + float angle = (float) (45F * this.motionY) * 5; + if (angle < -45) + angle = -45; + if (angle > 45) + angle = 45; + + return angle; + } + } + return 0; + } + + private boolean canHearEntity(Entity target) { + if (target instanceof EntityLivingBase && PowerArmour.isWearingCogwork((EntityLivingBase) target)) + return true; + + double distance = getDistanceToEntity(target); + + if (distance < width / 2) { + return true;// touching + } + if (distance < 16 && this.getAttackTarget() != null && getAttackTarget() == target) { + return true;// Smell + } + float tarSpeed = (float) Math.hypot(target.motionX, target.motionZ); + + if (tarSpeed < 0.1F) { + return false; + } + if (target instanceof EntityLivingBase) { + return getSound((EntityLivingBase) target, tarSpeed) >= distance; + } + return true; + } + + private double getSound(EntityLivingBase target, float speed) { + float value = 10F * (60F + ArmourCalculator.getTotalWeightOfWorn(target, false)) * speed; + return value; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/mob/EntityFlyingMF.java b/src/main/java/minefantasy/mf2/entity/mob/EntityFlyingMF.java index a32d19d9..b9d0c4ae 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/EntityFlyingMF.java +++ b/src/main/java/minefantasy/mf2/entity/mob/EntityFlyingMF.java @@ -4,79 +4,72 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public abstract class EntityFlyingMF extends EntityLiving -{ - public EntityFlyingMF(World world) - { +public abstract class EntityFlyingMF extends EntityLiving { + public EntityFlyingMF(World world) { super(world); } /** * Called when the mob is falling. Calculates and applies fall damage. */ - protected void fall(float distance) {} + protected void fall(float distance) { + } /** - * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance - * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround + * Takes in the distance the entity has fallen this tick and whether its on the + * ground to update the fall distance and deal fall damage if landing on the + * ground. Args: distanceFallenThisTick, onGround */ - protected void updateFallState(double distance, boolean hitground) - { - if(isTerrestrial()) - { - super.updateFallState(distance, hitground); - } + protected void updateFallState(double distance, boolean hitground) { + if (isTerrestrial()) { + super.updateFallState(distance, hitground); + } } /** - * Moves the entity based on the specified heading. Args: strafe, forward + * Moves the entity based on the specified heading. Args: strafe, forward */ @Override - public void moveEntityWithHeading(float strafe, float forward) - { - if(isTerrestrial()) - { - super.moveEntityWithHeading(strafe, forward); - return; - } - if (this.isInWater()) - { + public void moveEntityWithHeading(float strafe, float forward) { + if (isTerrestrial()) { + super.moveEntityWithHeading(strafe, forward); + return; + } + if (this.isInWater()) { this.moveFlying(strafe, forward, 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.800000011920929D; this.motionY *= 0.800000011920929D; this.motionZ *= 0.800000011920929D; - } - else if (this.handleLavaMovement()) - { + } else if (this.handleLavaMovement()) { this.moveFlying(strafe, forward, 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.5D; this.motionY *= 0.5D; this.motionZ *= 0.5D; - } - else - { + } else { float f2 = 0.91F; - if (this.onGround) - { - f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; + if (this.onGround) { + f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; } float f3 = 0.16277136F / (f2 * f2 * f2); this.moveFlying(strafe, forward, this.onGround ? 0.1F * f3 : 0.02F); f2 = 0.91F; - if (this.onGround) - { - f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; + if (this.onGround) { + f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; } this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= (double)f2; - this.motionY *= (double)f2; - this.motionZ *= (double)f2; + this.motionX *= f2; + this.motionY *= f2; + this.motionZ *= f2; } this.prevLimbSwingAmount = this.limbSwingAmount; @@ -84,8 +77,7 @@ else if (this.handleLavaMovement()) double d0 = this.posZ - this.prevPosZ; float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F; - if (f4 > 1.0F) - { + if (f4 > 1.0F) { f4 = 1.0F; } @@ -96,10 +88,9 @@ else if (this.handleLavaMovement()) /** * returns true if this entity is by a ladder, false otherwise */ - public boolean isOnLadder() - { + public boolean isOnLadder() { return isTerrestrial() ? super.isOnLadder() : false; } - + public abstract boolean isTerrestrial(); } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/mob/EntityHound.java b/src/main/java/minefantasy/mf2/entity/mob/EntityHound.java index 562beef7..ca6c3338 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/EntityHound.java +++ b/src/main/java/minefantasy/mf2/entity/mob/EntityHound.java @@ -11,17 +11,7 @@ import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.EntityAIAttackOnCollide; -import net.minecraft.entity.ai.EntityAIHurtByTarget; -import net.minecraft.entity.ai.EntityAILeapAtTarget; -import net.minecraft.entity.ai.EntityAILookIdle; -import net.minecraft.entity.ai.EntityAIMate; -import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; -import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; -import net.minecraft.entity.ai.EntityAISwimming; -import net.minecraft.entity.ai.EntityAITargetNonTamed; -import net.minecraft.entity.ai.EntityAIWander; -import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.ai.*; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityAnimal; @@ -40,19 +30,24 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class EntityHound extends EntityTameable -{ +public class EntityHound extends EntityTameable { + // Animations + public float jawMove; + public int eatAnimation; private float field_70926_e; private float field_70924_f; - /** true is the wolf is wet else false */ + /** + * true is the wolf is wet else false + */ private boolean isShaking; private boolean field_70928_h; - /** This time increases while wolf is shaking and emitting water particles. */ + /** + * This time increases while wolf is shaking and emitting water particles. + */ private float timeWolfIsShaking; private float prevTimeWolfIsShaking; - public EntityHound(World world) - { + public EntityHound(World world) { super(world); this.setSize(0.6F, 0.8F); this.getNavigator().setAvoidsWater(true); @@ -71,22 +66,18 @@ public EntityHound(World world) this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this)); this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false)); - + this.setTamed(false); } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - if (this.isTamed()) - { + if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); - } - else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); } } @@ -95,8 +86,7 @@ protected void applyEntityAttributes() * Returns true if the newer Entity AI code should be run */ @Override - public boolean isAIEnabled() - { + public boolean isAIEnabled() { return true; } @@ -104,16 +94,12 @@ public boolean isAIEnabled() * Sets the active target the Task system uses for tracking */ @Override - public void setAttackTarget(EntityLivingBase target) - { + public void setAttackTarget(EntityLivingBase target) { super.setAttackTarget(target); - if (target == null) - { + if (target == null) { this.setAngry(false); - } - else if (!this.isTamed()) - { + } else if (!this.isTamed()) { this.setAngry(true); } } @@ -122,23 +108,20 @@ else if (!this.isTamed()) * main AI tick function, replaces updateEntityActionState */ @Override - protected void updateAITick() - { + protected void updateAITick() { this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); } - + @Override - protected void entityInit() - { + protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(18, new Float(this.getHealth())); - this.dataWatcher.addObject(19, new Byte((byte)0)); - this.dataWatcher.addObject(20, new Byte((byte)BlockColored.func_150032_b(1))); + this.dataWatcher.addObject(19, new Byte((byte) 0)); + this.dataWatcher.addObject(20, new Byte((byte) BlockColored.func_150032_b(1))); } @Override - protected void func_145780_a(int x, int y, int z, Block surface) - { + protected void func_145780_a(int x, int y, int z, Block surface) { this.playSound("mob.wolf.step", 0.15F, 1.0F); } @@ -146,24 +129,21 @@ protected void func_145780_a(int x, int y, int z, Block surface) * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - public void writeEntityToNBT(NBTTagCompound nbt) - { + public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); nbt.setBoolean("Angry", this.isAngry()); - nbt.setByte("CollarColor", (byte)this.getCollarColor()); + nbt.setByte("CollarColor", (byte) this.getCollarColor()); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - public void readEntityFromNBT(NBTTagCompound nbt) - { + public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); this.setAngry(nbt.getBoolean("Angry")); - if (nbt.hasKey("CollarColor", 99)) - { + if (nbt.hasKey("CollarColor", 99)) { this.setCollarColor(nbt.getByte("CollarColor")); } } @@ -172,17 +152,19 @@ public void readEntityFromNBT(NBTTagCompound nbt) * Returns the sound this mob makes while it's alive. */ @Override - protected String getLivingSound() - { - return this.isAngry() ? "mob.wolf.growl" : (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); + protected String getLivingSound() { + return this.isAngry() ? "mob.wolf.growl" + : (this.rand.nextInt(3) == 0 + ? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F ? "mob.wolf.whine" + : "mob.wolf.panting") + : "mob.wolf.bark"); } /** * Returns the sound this mob makes when it is hurt. */ @Override - protected String getHurtSound() - { + protected String getHurtSound() { return "mob.wolf.hurt"; } @@ -190,8 +172,7 @@ protected String getHurtSound() * Returns the sound this mob makes on death. */ @Override - protected String getDeathSound() - { + protected String getDeathSound() { return "mob.wolf.death"; } @@ -199,32 +180,29 @@ protected String getDeathSound() * Returns the volume for the sounds this mob makes. */ @Override - protected float getSoundVolume() - { + protected float getSoundVolume() { return 0.4F; } @Override - protected Item getDropItem() - { + protected Item getDropItem() { return Item.getItemById(-1); } /** - * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons - * use this to react to sunlight and start to burn. + * Called frequently so the entity can update its state every tick as required. + * For example, zombies and skeletons use this to react to sunlight and start to + * burn. */ @Override - public void onLivingUpdate() - { + public void onLivingUpdate() { super.onLivingUpdate(); - if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) - { + if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) { this.field_70928_h = true; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; - this.worldObj.setEntityState(this, (byte)8); + this.worldObj.setEntityState(this, (byte) 8); } } @@ -232,116 +210,101 @@ public void onLivingUpdate() * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); this.field_70924_f = this.field_70926_e; - if (this.func_70922_bv()) - { + if (this.func_70922_bv()) { this.field_70926_e += (1.0F - this.field_70926_e) * 0.4F; - } - else - { + } else { this.field_70926_e += (0.0F - this.field_70926_e) * 0.4F; } - if (this.func_70922_bv()) - { + if (this.func_70922_bv()) { this.numTicksToChaseTarget = 10; } - if (this.isWet()) - { + if (this.isWet()) { this.isShaking = true; this.field_70928_h = false; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; - } - else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) - { - if (this.timeWolfIsShaking == 0.0F) - { - this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) { + if (this.timeWolfIsShaking == 0.0F) { + this.playSound("mob.wolf.shake", this.getSoundVolume(), + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); } this.prevTimeWolfIsShaking = this.timeWolfIsShaking; this.timeWolfIsShaking += 0.05F; - if (this.prevTimeWolfIsShaking >= 2.0F) - { + if (this.prevTimeWolfIsShaking >= 2.0F) { this.isShaking = false; this.field_70928_h = false; this.prevTimeWolfIsShaking = 0.0F; this.timeWolfIsShaking = 0.0F; } - if (this.timeWolfIsShaking > 0.4F) - { - float f = (float)this.boundingBox.minY; - int i = (int)(MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float)Math.PI) * 7.0F); + if (this.timeWolfIsShaking > 0.4F) { + float f = (float) this.boundingBox.minY; + int i = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F); - for (int j = 0; j < i; ++j) - { + for (int j = 0; j < i; ++j) { float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; - this.worldObj.spawnParticle("splash", this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle("splash", this.posX + f1, f + 0.8F, this.posZ + f2, this.motionX, + this.motionY, this.motionZ); } } } } @SideOnly(Side.CLIENT) - public boolean getWolfShaking() - { + public boolean getWolfShaking() { return this.isShaking; } /** - * Used when calculating the amount of shading to apply while the wolf is shaking. + * Used when calculating the amount of shading to apply while the wolf is + * shaking. */ @SideOnly(Side.CLIENT) - public float getShadingWhileShaking(float p_70915_1_) - { - return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) / 2.0F * 0.25F; + public float getShadingWhileShaking(float p_70915_1_) { + return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) + / 2.0F * 0.25F; } @SideOnly(Side.CLIENT) - public float getShakeAngle(float p_70923_1_, float p_70923_2_) - { - float f2 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F; + public float getShakeAngle(float p_70923_1_, float p_70923_2_) { + float f2 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + + p_70923_2_) / 1.8F; - if (f2 < 0.0F) - { + if (f2 < 0.0F) { f2 = 0.0F; - } - else if (f2 > 1.0F) - { + } else if (f2 > 1.0F) { f2 = 1.0F; } - return MathHelper.sin(f2 * (float)Math.PI) * MathHelper.sin(f2 * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI; + return MathHelper.sin(f2 * (float) Math.PI) * MathHelper.sin(f2 * (float) Math.PI * 11.0F) * 0.15F + * (float) Math.PI; } @Override - public float getEyeHeight() - { + public float getEyeHeight() { return this.height * 0.8F; } @SideOnly(Side.CLIENT) - public float getInterestedAngle(float p_70917_1_) - { - return (this.field_70924_f + (this.field_70926_e - this.field_70924_f) * p_70917_1_) * 0.15F * (float)Math.PI; + public float getInterestedAngle(float p_70917_1_) { + return (this.field_70924_f + (this.field_70926_e - this.field_70924_f) * p_70917_1_) * 0.15F * (float) Math.PI; } /** - * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently - * use in wolves. + * The speed it takes to move the entityliving's rotationPitch through the + * faceEntity method. This is only currently use in wolves. */ @Override - public int getVerticalFaceSpeed() - { + public int getVerticalFaceSpeed() { return this.isSitting() ? 20 : super.getVerticalFaceSpeed(); } @@ -349,19 +312,14 @@ public int getVerticalFaceSpeed() * Called when the entity is attacked. */ @Override - public boolean attackEntityFrom(DamageSource source, float dam) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource source, float dam) { + if (this.isEntityInvulnerable()) { return false; - } - else - { + } else { Entity entity = source.getEntity(); this.aiSit.setSitting(false); - if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) - { + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { dam = (dam + 1.0F) / 2.0F; } @@ -370,71 +328,56 @@ public boolean attackEntityFrom(DamageSource source, float dam) } @Override - public boolean attackEntityAsMob(Entity target) - { + public boolean attackEntityAsMob(Entity target) { int i = this.isTamed() ? 4 : 2; - return target.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i); + return target.attackEntityFrom(DamageSource.causeMobDamage(this), i); } @Override - public void setTamed(boolean flag) - { + public void setTamed(boolean flag) { super.setTamed(flag); - if (flag) - { + if (flag) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); - } - else - { + } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); } } /** - * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets + * into the saddle on a pig. */ @Override - public boolean interact(EntityPlayer user) - { + public boolean interact(EntityPlayer user) { ItemStack itemstack = user.inventory.getCurrentItem(); - if (this.isTamed()) - { - if (itemstack != null) - { - if (itemstack.getItem() instanceof ItemFood) - { - ItemFood itemfood = (ItemFood)itemstack.getItem(); - - if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) - { - if (!user.capabilities.isCreativeMode) - { + if (this.isTamed()) { + if (itemstack != null) { + if (itemstack.getItem() instanceof ItemFood) { + ItemFood itemfood = (ItemFood) itemstack.getItem(); + + if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) { + if (!user.capabilities.isCreativeMode) { --itemstack.stackSize; } - this.heal((float)itemfood.func_150905_g(itemstack)); + this.heal(itemfood.func_150905_g(itemstack)); - if (itemstack.stackSize <= 0) - { - user.inventory.setInventorySlotContents(user.inventory.currentItem, (ItemStack)null); + if (itemstack.stackSize <= 0) { + user.inventory.setInventorySlotContents(user.inventory.currentItem, (ItemStack) null); } return true; } - } - else if (itemstack.getItem() == Items.dye) - { + } else if (itemstack.getItem() == Items.dye) { int i = BlockColored.func_150032_b(itemstack.getItemDamage()); - if (i != this.getCollarColor()) - { + if (i != this.getCollarColor()) { this.setCollarColor(i); - if (!user.capabilities.isCreativeMode && --itemstack.stackSize <= 0) - { - user.inventory.setInventorySlotContents(user.inventory.currentItem, (ItemStack)null); + if (!user.capabilities.isCreativeMode && --itemstack.stackSize <= 0) { + user.inventory.setInventorySlotContents(user.inventory.currentItem, (ItemStack) null); } return true; @@ -442,44 +385,35 @@ else if (itemstack.getItem() == Items.dye) } } - if (this.func_152114_e(user) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) - { + if (this.func_152114_e(user) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; - this.setPathToEntity((PathEntity)null); - this.setTarget((Entity)null); - this.setAttackTarget((EntityLivingBase)null); + this.setPathToEntity((PathEntity) null); + this.setTarget((Entity) null); + this.setAttackTarget((EntityLivingBase) null); } - } - else if (itemstack != null && itemstack.getItem() == Items.bone && !this.isAngry()) - { - if (!user.capabilities.isCreativeMode) - { + } else if (itemstack != null && itemstack.getItem() == Items.bone && !this.isAngry()) { + if (!user.capabilities.isCreativeMode) { --itemstack.stackSize; } - if (itemstack.stackSize <= 0) - { - user.inventory.setInventorySlotContents(user.inventory.currentItem, (ItemStack)null); + if (itemstack.stackSize <= 0) { + user.inventory.setInventorySlotContents(user.inventory.currentItem, (ItemStack) null); } - if (!this.worldObj.isRemote) - { - if (this.rand.nextInt(3) == 0) - { + if (!this.worldObj.isRemote) { + if (this.rand.nextInt(3) == 0) { this.setTamed(true); - this.setPathToEntity((PathEntity)null); - this.setAttackTarget((EntityLivingBase)null); + this.setPathToEntity((PathEntity) null); + this.setAttackTarget((EntityLivingBase) null); this.aiSit.setSitting(true); this.setHealth(20.0F); this.func_152115_b(user.getUniqueID().toString()); this.playTameEffect(true); - this.worldObj.setEntityState(this, (byte)7); - } - else - { + this.worldObj.setEntityState(this, (byte) 7); + } else { this.playTameEffect(false); - this.worldObj.setEntityState(this, (byte)6); + this.worldObj.setEntityState(this, (byte) 6); } } @@ -491,110 +425,94 @@ else if (itemstack != null && itemstack.getItem() == Items.bone && !this.isAngry @SideOnly(Side.CLIENT) @Override - public void handleHealthUpdate(byte id) - { - if (id == 8) - { + public void handleHealthUpdate(byte id) { + if (id == 8) { this.field_70928_h = true; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; - } - else - { + } else { super.handleHealthUpdate(id); } } @SideOnly(Side.CLIENT) - public float getTailRotation() - { - return this.isAngry() ? 1.5393804F : (this.isTamed() ? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * (float)Math.PI : ((float)Math.PI / 5F)); + public float getTailRotation() { + return this.isAngry() ? 1.5393804F + : (this.isTamed() + ? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * (float) Math.PI + : ((float) Math.PI / 5F)); } /** - * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on - * the animal type) + * Checks if the parameter is an item which this animal can be fed to breed it + * (wheat, carrots or seeds depending on the animal type) */ @Override - public boolean isBreedingItem(ItemStack item) - { - return item == null ? false : (!(item.getItem() instanceof ItemFood) ? false : ((ItemFood)item.getItem()).isWolfsFavoriteMeat()); + public boolean isBreedingItem(ItemStack item) { + return item == null ? false + : (!(item.getItem() instanceof ItemFood) ? false : ((ItemFood) item.getItem()).isWolfsFavoriteMeat()); } /** * Will return how many at most can spawn in a chunk at once. */ @Override - public int getMaxSpawnedInChunk() - { + public int getMaxSpawnedInChunk() { return 8; } /** * Determines whether this wolf is angry or not. */ - public boolean isAngry() - { + public boolean isAngry() { return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0; } /** * Sets whether this wolf is angry or not. */ - public void setAngry(boolean flag) - { + public void setAngry(boolean flag) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (flag) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); - } - else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + if (flag) { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); + } else { + this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } /** * Return this wolf's collar color. */ - public int getCollarColor() - { + public int getCollarColor() { return this.dataWatcher.getWatchableObjectByte(20) & 15; } /** * Set this wolf's collar color. */ - public void setCollarColor(int colour) - { - this.dataWatcher.updateObject(20, Byte.valueOf((byte)(colour & 15))); + public void setCollarColor(int colour) { + this.dataWatcher.updateObject(20, Byte.valueOf((byte) (colour & 15))); } @Override - public EntityHound createChild(EntityAgeable parent) - { + public EntityHound createChild(EntityAgeable parent) { EntityHound entitywolf = new EntityHound(this.worldObj); String s = this.func_152113_b(); - if (s != null && s.trim().length() > 0) - { + if (s != null && s.trim().length() > 0) { entitywolf.func_152115_b(s); entitywolf.setTamed(true); } return entitywolf; } - - public void func_70918_i(boolean flag) - { - if (flag) - { - this.dataWatcher.updateObject(19, Byte.valueOf((byte)1)); - } - else - { - this.dataWatcher.updateObject(19, Byte.valueOf((byte)0)); + + public void func_70918_i(boolean flag) { + if (flag) { + this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1)); + } else { + this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0)); } } @@ -602,29 +520,21 @@ public void func_70918_i(boolean flag) * Returns true if the mob is currently able to mate with the specified mob. */ @Override - public boolean canMateWith(EntityAnimal mate) - { - if (mate == this) - { + public boolean canMateWith(EntityAnimal mate) { + if (mate == this) { return false; - } - else if (!this.isTamed()) - { + } else if (!this.isTamed()) { return false; - } - else if (!(mate instanceof EntityHound)) - { + } else if (!(mate instanceof EntityHound)) { return false; - } - else - { - EntityHound entitywolf = (EntityHound)mate; - return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.isInLove() && entitywolf.isInLove()); + } else { + EntityHound entitywolf = (EntityHound) mate; + return !entitywolf.isTamed() ? false + : (entitywolf.isSitting() ? false : this.isInLove() && entitywolf.isInLove()); } } - public boolean func_70922_bv() - { + public boolean func_70922_bv() { return this.dataWatcher.getWatchableObjectByte(19) == 1; } @@ -632,45 +542,34 @@ public boolean func_70922_bv() * Determines if an entity can be despawned, used on idle far away entities */ @Override - protected boolean canDespawn() - { + protected boolean canDespawn() { return !this.isTamed() && this.ticksExisted > 2400; } @Override - public boolean func_142018_a(EntityLivingBase target, EntityLivingBase owner) - { - if (!(target instanceof EntityCreeper) && !(target instanceof EntityGhast)) - { - if (target instanceof EntityHound) - { - EntityHound entitywolf = (EntityHound)target; - - if (entitywolf.isTamed() && entitywolf.getOwner() == owner) - { + public boolean func_142018_a(EntityLivingBase target, EntityLivingBase owner) { + if (!(target instanceof EntityCreeper) && !(target instanceof EntityGhast)) { + if (target instanceof EntityHound) { + EntityHound entitywolf = (EntityHound) target; + + if (entitywolf.isTamed() && entitywolf.getOwner() == owner) { return false; } } - return target instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer)owner).canAttackPlayer((EntityPlayer)target) ? false : !(target instanceof EntityHorse) || !((EntityHorse)target).isTame(); - } - else - { + return target instanceof EntityPlayer && owner instanceof EntityPlayer + && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) target) ? false + : !(target instanceof EntityHorse) || !((EntityHorse) target).isTame(); + } else { return false; } } - - //Animations - public float jawMove; - public int eatAnimation; - public String getTexture() - { - return "hound"; - } + public String getTexture() { + return "hound"; + } - public boolean shouldFollowOwner() - { - return true; - } + public boolean shouldFollowOwner() { + return true; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/mob/EntityMinotaur.java b/src/main/java/minefantasy/mf2/entity/mob/EntityMinotaur.java index 398e4ca7..fbdd3643 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/EntityMinotaur.java +++ b/src/main/java/minefantasy/mf2/entity/mob/EntityMinotaur.java @@ -19,18 +19,8 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.IEntityLivingData; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.EntityAIAttackOnCollide; -import net.minecraft.entity.ai.EntityAIHurtByTarget; -import net.minecraft.entity.ai.EntityAILookIdle; -import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; -import net.minecraft.entity.ai.EntityAISwimming; -import net.minecraft.entity.ai.EntityAIWander; -import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.*; +import net.minecraft.entity.ai.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -41,16 +31,18 @@ import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; -public class EntityMinotaur extends EntityMobMF implements IArmourPenetrationMob, ISpecialCombatMob -{ - public int swing; - private int grabCooldown; - private int hitCooldownTime; - - public EntityMinotaur(World world) - { - super(world); - this.getNavigator().setBreakDoors(true); +public class EntityMinotaur extends EntityMobMF implements IArmourPenetrationMob, ISpecialCombatMob { + private static final int dataID = 12; + public int swing; + private int grabCooldown; + private int hitCooldownTime; + private int specialAttackTime; + private float[] punch = new float[]{0F, 1F, 0F}; + private float[] headbutt = new float[]{0F, 1F, 4F}; + + public EntityMinotaur(World world) { + super(world); + this.getNavigator().setBreakDoors(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityLivingBase.class, 1.0D, true)); @@ -60,346 +52,295 @@ public EntityMinotaur(World world) this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new AI_MinotaurFindTarget(this, EntityPlayer.class, 0, true)); - + this.setSize(1.5F, 2.5F); this.stepHeight = 1.0F; this.experienceValue = 40; - - for (int i = 0; i < this.equipmentDropChances.length; ++i) - { + + for (int i = 0; i < this.equipmentDropChances.length; ++i) { this.equipmentDropChances[i] = 1F; } - } - public void worldGenTier(int species, int tier) - { - setMob(species, tier); - setLoadout(); - if(tier > 0) - { - this.setHomeArea((int)posX, (int)posY, (int)posZ, getRange(tier)); - } - } - private int getRange(int tier) - { - return tier > 1 ? 12 : 24; - } - @Override - public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) - { - int species = MinotaurBreed.getEnvironment(this); - - setMob(species, 0); - setLoadout(); - return super.onSpawnWithEgg(data); - } - - public void setLoadout() - { - String tier = getMinotaur().weaponTier; - if(tier != null) - { - this.setCurrentItemOrArmor(0, getRandomWeapon().construct(tier, "OakWood")); - } - } - public ItemWeaponMF getRandomWeapon() - { - if(getTier() == 3) - { - return OrnateStyle.ornate_greatsword; - } - ItemWeaponMF[] list = new ItemWeaponMF[]{ - CustomToolListMF.standard_greatsword, - CustomToolListMF.standard_katana, - CustomToolListMF.standard_battleaxe, - CustomToolListMF.standard_warhammer, - CustomToolListMF.standard_spear, - CustomToolListMF.standard_halbeard - }; - return list[rand.nextInt(list.length)]; - } - @Override - public String getCommandSenderName() - { + } + + public void worldGenTier(int species, int tier) { + setMob(species, tier); + setLoadout(); + if (tier > 0) { + this.setHomeArea((int) posX, (int) posY, (int) posZ, getRange(tier)); + } + } + + private int getRange(int tier) { + return tier > 1 ? 12 : 24; + } + + @Override + public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) { + int species = MinotaurBreed.getEnvironment(this); + + setMob(species, 0); + setLoadout(); + return super.onSpawnWithEgg(data); + } + + public void setLoadout() { + String tier = getMinotaur().weaponTier; + if (tier != null) { + this.setCurrentItemOrArmor(0, getRandomWeapon().construct(tier, "OakWood")); + } + } + + public ItemWeaponMF getRandomWeapon() { + if (getTier() == 3) { + return OrnateStyle.ornate_greatsword; + } + ItemWeaponMF[] list = new ItemWeaponMF[]{CustomToolListMF.standard_greatsword, + CustomToolListMF.standard_katana, CustomToolListMF.standard_battleaxe, + CustomToolListMF.standard_warhammer, CustomToolListMF.standard_spear, + CustomToolListMF.standard_halbeard}; + return list[rand.nextInt(list.length)]; + } + + @Override + public String getCommandSenderName() { return StatCollector.translateToLocal("entity." + getMinotaur().name + ".name"); } - @Override - protected void applyEntityAttributes() - { + + @Override + protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(24.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35F); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(ConfigMobs.minotaurMD); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(ConfigMobs.minotaurHP); } - @Override - protected boolean isAIEnabled() - { + + @Override + protected boolean isAIEnabled() { return true; } - private static final int dataID = 12; - protected void entityInit() - { + + protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(dataID, Byte.valueOf((byte)0)); - this.dataWatcher.addObject(dataID+1, Integer.valueOf((byte)1)); - this.dataWatcher.addObject(dataID+2, Integer.valueOf(2)); - this.dataWatcher.addObject(dataID+3, Integer.valueOf(0)); + this.dataWatcher.addObject(dataID, Byte.valueOf((byte) 0)); + this.dataWatcher.addObject(dataID + 1, Integer.valueOf((byte) 1)); + this.dataWatcher.addObject(dataID + 2, Integer.valueOf(2)); + this.dataWatcher.addObject(dataID + 3, Integer.valueOf(0)); } + @Override - public float getBlockPathWeight(int x, int y, int z) - { + public float getBlockPathWeight(int x, int y, int z) { return super.getBlockPathWeight(x, y, z); } + @Override - public void onUpdate() - { - super.onUpdate(); - - if(!worldObj.isRemote) - { - if(getRageLevel() == 0 && getAttackTarget() == null) - { - if(ticksExisted % 40 == 0) - { - forage(); - } - } - if(ticksExisted % 20 == 0) - { - if(!isBloodied()) - { - if(getRageVariable() > 0) - { - addRage(-1); - if(getRageVariable() > 50) - { - setRage(50); - } - } - } - } - if(hitCooldownTime > 0)--hitCooldownTime; - if(grabCooldown > 0) - { - --grabCooldown; - } - if(specialAttackTime > 0) - { - --specialAttackTime; - } - if((getAttack() == (byte)1 || getAttack() == (byte)3) && specialAttackTime == 0) - { - initBasicAttack(); - } - if(this.getAttackTarget() != null) - { - if(getRageLevel() > 20 && getAttack() != (byte)2 && getHeldItem() == null && rand.nextInt(100) == 0) - { - this.initHeadbutt(); - } - EntityLivingBase target = getAttackTarget(); - int intLvl = getIntLvl(); - - if(intLvl > 0)//Smarter means more likely - { - if(getAttack() !=2 && rand.nextInt(10) < intLvl && onGround && target instanceof EntityPlayer && ((EntityPlayer)target).isBlocking() && this.getDistanceToEntity(target) < 4F) - { - this.jump(); - this.initPowerAttack(); - } - } - else - { - if(getRageLevel() > 40 && getAttack() !=2 && rand.nextInt(50) == 0 && onGround && target instanceof EntityPlayer && ((EntityPlayer)target).isBlocking() && this.getDistanceToEntity(target) < 4F) - { - this.jump(); - this.initPowerAttack(); - } - } - double distance = this.getDistanceSqToEntity(target); - if(!TacticalManager.isFlankedBy(target, this, 270) && distance > 6 && distance < 12 && rand.nextInt(50) == 0 && this.getAttack() == (byte)0 && this.getMinotaur().throwsBombs) - { - this.throwBomb(target, 1.0F); - } - - if(this.ticksExisted % 20 == 0 && (getRageLevel() <= 0 || !canEntityBeSeen(getAttackTarget()))) - { - if(rand.nextInt( 50 + (50*getIntLvl())) == 0) - { - this.setAttackTarget(null); - } - } - } - - boolean inBeserk = getRageLevel() >= 100 && isBloodied(); - if(getAttack() == (byte)2) - { - if(!inBeserk) - { - initBasicAttack(); - } - else - { - this.swingItem(); - } - } - if(getAttack() != (byte)2 && inBeserk) - { - initBeserk(); - } - } - } - - private void forage() - { - if(rand.nextInt(100) == 0) - { - int radius = 8; - for(int x = -radius; x <= radius; x++) - { - for(int y = -2; y <= 2; y++) - { - for(int z = -radius; z <= radius; z++) - { - int xPos = (int)posX + x; - int yPos = (int)posY + y; - int zPos = (int)posZ + z; - if(rand.nextInt(10) == 0) - { - if(worldObj.getBlock(xPos, yPos, zPos) == BlockListMF.berryBush && worldObj.getBlockMetadata(xPos, yPos, zPos) == 0) - { - getNavigator().tryMoveToXYZ(xPos+0.5, yPos+1, zPos+0.5, 0.6F); - return; - } - if(worldObj.getBlock(xPos, yPos, zPos) instanceof BlockCrops && worldObj.getBlockMetadata(xPos, yPos, zPos) >= 4) - { - getNavigator().tryMoveToXYZ(xPos+0.5, yPos+1, zPos+0.5, 0.6F); - return; - } - } - } - } - } - return; - } - if(worldObj.getBlock((int)posX, (int)posY, (int)posZ) == BlockListMF.berryBush && worldObj.getBlockMetadata((int)posX, (int)posY, (int)posZ) == 0) - { - worldObj.playSoundEffect(posX, posY+getEyeHeight(), posZ, "random.eat", 1.0F, 0.75F); - swingItem(); - heal(10); - worldObj.setBlockMetadataWithNotify((int)posX, (int)posY, (int)posZ, 1, 2); - } - else if(worldObj.getBlock((int)posX, (int)posY, (int)posZ) instanceof BlockCrops && worldObj.getBlockMetadata((int)posX, (int)posY, (int)posZ) > 0) - { - worldObj.playSoundEffect(posX, posY+getEyeHeight(), posZ, "random.eat", 1.0F, 0.75F); - worldObj.playSoundEffect(posX, posY+getEyeHeight(), posZ, "dig.grass", 1.0F, 1.00F); - swingItem(); - heal(5); - worldObj.setBlockToAir((int)posX, (int)posY, (int)posZ); - } - } - - @Override - protected void dropFewItems(boolean playerKill, int looting) - { - int count = getLootCount() == 1 ? 1 : rand.nextInt(looting+getLootCount()+1); - for(int a = 0; a < count; a++) - { - Item drop = getLoot(); - this.dropItem(drop, 1); - } - count = rand.nextInt(looting+4)+1; - for(int a = 0; a < count; a++) - { - this.dropItem(ComponentListMF.rawhideLarge, 1); - } - count = rand.nextInt(looting+2)+1; - for(int a = 0; a < count; a++) - { - this.dropItem(isBurning() ? Items.cooked_beef : Items.beef, 1); - } - } - - private Item getLoot() - { - int breed = getTier(); - if(breed > 2) - { - return ToolListMF.loot_sack_rare; - } - if(breed > 0) - { - return ToolListMF.loot_sack_uc; - } - return ToolListMF.loot_sack; - } - private int getLootCount() - { - int breed = getTier(); - if(breed > 2) - { - return 1; - } - return 2 + breed; - } - - @Override - public boolean attackEntityFrom(DamageSource source, float damage) - { - if (!super.attackEntityFrom(source, damage)) - { - return false; + public void onUpdate() { + super.onUpdate(); + + if (!worldObj.isRemote) { + if (getRageLevel() == 0 && getAttackTarget() == null) { + if (ticksExisted % 40 == 0) { + forage(); + } + } + if (ticksExisted % 20 == 0) { + if (!isBloodied()) { + if (getRageVariable() > 0) { + addRage(-1); + if (getRageVariable() > 50) { + setRage(50); + } + } + } + } + if (hitCooldownTime > 0) + --hitCooldownTime; + if (grabCooldown > 0) { + --grabCooldown; + } + if (specialAttackTime > 0) { + --specialAttackTime; + } + if ((getAttack() == (byte) 1 || getAttack() == (byte) 3) && specialAttackTime == 0) { + initBasicAttack(); + } + if (this.getAttackTarget() != null) { + if (getRageLevel() > 20 && getAttack() != (byte) 2 && getHeldItem() == null && rand.nextInt(100) == 0) { + this.initHeadbutt(); + } + EntityLivingBase target = getAttackTarget(); + int intLvl = getIntLvl(); + + if (intLvl > 0)// Smarter means more likely + { + if (getAttack() != 2 && rand.nextInt(10) < intLvl && onGround && target instanceof EntityPlayer + && ((EntityPlayer) target).isBlocking() && this.getDistanceToEntity(target) < 4F) { + this.jump(); + this.initPowerAttack(); + } + } else { + if (getRageLevel() > 40 && getAttack() != 2 && rand.nextInt(50) == 0 && onGround + && target instanceof EntityPlayer && ((EntityPlayer) target).isBlocking() + && this.getDistanceToEntity(target) < 4F) { + this.jump(); + this.initPowerAttack(); + } + } + double distance = this.getDistanceSqToEntity(target); + if (!TacticalManager.isFlankedBy(target, this, 270) && distance > 6 && distance < 12 + && rand.nextInt(50) == 0 && this.getAttack() == (byte) 0 && this.getMinotaur().throwsBombs) { + this.throwBomb(target, 1.0F); + } + + if (this.ticksExisted % 20 == 0 && (getRageLevel() <= 0 || !canEntityBeSeen(getAttackTarget()))) { + if (rand.nextInt(50 + (50 * getIntLvl())) == 0) { + this.setAttackTarget(null); + } + } + } + + boolean inBeserk = getRageLevel() >= 100 && isBloodied(); + if (getAttack() == (byte) 2) { + if (!inBeserk) { + initBasicAttack(); + } else { + this.swingItem(); + } + } + if (getAttack() != (byte) 2 && inBeserk) { + initBeserk(); + } } - else - { - Entity entity = source.getEntity(); - if(entity != null) - { - addRage(this.getIntLvl() >= 1 ? (int)(damage/2) : (int)damage); - } + } + + private void forage() { + if (rand.nextInt(100) == 0) { + int radius = 8; + for (int x = -radius; x <= radius; x++) { + for (int y = -2; y <= 2; y++) { + for (int z = -radius; z <= radius; z++) { + int xPos = (int) posX + x; + int yPos = (int) posY + y; + int zPos = (int) posZ + z; + if (rand.nextInt(10) == 0) { + if (worldObj.getBlock(xPos, yPos, zPos) == BlockListMF.berryBush + && worldObj.getBlockMetadata(xPos, yPos, zPos) == 0) { + getNavigator().tryMoveToXYZ(xPos + 0.5, yPos + 1, zPos + 0.5, 0.6F); + return; + } + if (worldObj.getBlock(xPos, yPos, zPos) instanceof BlockCrops + && worldObj.getBlockMetadata(xPos, yPos, zPos) >= 4) { + getNavigator().tryMoveToXYZ(xPos + 0.5, yPos + 1, zPos + 0.5, 0.6F); + return; + } + } + } + } + } + return; + } + if (worldObj.getBlock((int) posX, (int) posY, (int) posZ) == BlockListMF.berryBush + && worldObj.getBlockMetadata((int) posX, (int) posY, (int) posZ) == 0) { + worldObj.playSoundEffect(posX, posY + getEyeHeight(), posZ, "random.eat", 1.0F, 0.75F); + swingItem(); + heal(10); + worldObj.setBlockMetadataWithNotify((int) posX, (int) posY, (int) posZ, 1, 2); + } else if (worldObj.getBlock((int) posX, (int) posY, (int) posZ) instanceof BlockCrops + && worldObj.getBlockMetadata((int) posX, (int) posY, (int) posZ) > 0) { + worldObj.playSoundEffect(posX, posY + getEyeHeight(), posZ, "random.eat", 1.0F, 0.75F); + worldObj.playSoundEffect(posX, posY + getEyeHeight(), posZ, "dig.grass", 1.0F, 1.00F); + swingItem(); + heal(5); + worldObj.setBlockToAir((int) posX, (int) posY, (int) posZ); + } + } + + @Override + protected void dropFewItems(boolean playerKill, int looting) { + int count = getLootCount() == 1 ? 1 : rand.nextInt(looting + getLootCount() + 1); + for (int a = 0; a < count; a++) { + Item drop = getLoot(); + this.dropItem(drop, 1); + } + count = rand.nextInt(looting + 4) + 1; + for (int a = 0; a < count; a++) { + this.dropItem(ComponentListMF.rawhideLarge, 1); + } + count = rand.nextInt(looting + 2) + 1; + for (int a = 0; a < count; a++) { + this.dropItem(isBurning() ? Items.cooked_beef : Items.beef, 1); + } + } + + private Item getLoot() { + int breed = getTier(); + if (breed > 2) { + return ToolListMF.loot_sack_rare; + } + if (breed > 0) { + return ToolListMF.loot_sack_uc; + } + return ToolListMF.loot_sack; + } + + private int getLootCount() { + int breed = getTier(); + if (breed > 2) { + return 1; + } + return 2 + breed; + } + + @Override + public boolean attackEntityFrom(DamageSource source, float damage) { + if (!super.attackEntityFrom(source, damage)) { + return false; + } else { + Entity entity = source.getEntity(); + if (entity != null) { + addRage(this.getIntLvl() >= 1 ? (int) (damage / 2) : (int) damage); + } } return true; } - - public void initBeserk() - { - TacticalManager.tryDisarm(this); - //this.playSound("minefantasy2:mob.minotaur.beserk", 1.0F, 1.0F); - setSprinting(true); - setAttack((byte)2); - } - public void initPowerAttack() - { - setSprinting(true); - specialAttackTime = 30; - hitCooldownTime = 0; - setAttack((byte)3); - } - public void initHeadbutt() - { - setSprinting(true); - specialAttackTime = 20; - this.hitCooldownTime = 0; - setAttack((byte)1); - } - public void initBasicAttack() - { - setSprinting(false); - specialAttackTime = 0; - setAttack((byte)0); - } - @Override - protected String getLivingSound() - { + + public void initBeserk() { + TacticalManager.tryDisarm(this); + // this.playSound("minefantasy2:mob.minotaur.beserk", 1.0F, 1.0F); + setSprinting(true); + setAttack((byte) 2); + } + + public void initPowerAttack() { + setSprinting(true); + specialAttackTime = 30; + hitCooldownTime = 0; + setAttack((byte) 3); + } + + public void initHeadbutt() { + setSprinting(true); + specialAttackTime = 20; + this.hitCooldownTime = 0; + setAttack((byte) 1); + } + + public void initBasicAttack() { + setSprinting(false); + specialAttackTime = 0; + setAttack((byte) 0); + } + + @Override + protected String getLivingSound() { return "mob.cow.say"; } /** * Returns the sound this mob makes when it is hurt. */ - @Override - protected String getHurtSound() - { + @Override + protected String getHurtSound() { return "mob.cow.hurt"; } @@ -407,251 +348,215 @@ protected String getHurtSound() * Returns the sound this mob makes on death. */ @Override - protected String getDeathSound() - { - return "mob.cow.death"; + protected String getDeathSound() { + return "minefantasy2:mob.minotaur.death"; } + @Override - public float getSoundPitch() - { - return 0.5F; + public float getSoundPitch() { + return 0.5F; } - protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) - { + protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { this.playSound("mob.cow.step", 0.75F, 0.9F); } - protected Item getDropItem() - { + protected Item getDropItem() { return ComponentListMF.hideLarge; } - public double getHeadChargeAngle() - { - return getAttack() == (byte)1 ? 80F : 0F; - } - - public float getArmourRating(DamageSource src) - { - float[] armour = getValueResistences(); - return (getMinotaur().armour_rating/100F) * ArmourCalculator.adjustACForDamage(src, getDT(), armour[0], armour[1], armour[2]); - } - - @Override - protected void damageEntity(DamageSource source, float dam) - { - float AR = 1.0F + Math.max(0.0F, getArmourRating(source)); - - super.damageEntity(source, dam / AR); - } - @Override - public void writeEntityToNBT(NBTTagCompound nbt) - { + + public double getHeadChargeAngle() { + return getAttack() == (byte) 1 ? 80F : 0F; + } + + public float getArmourRating(DamageSource src) { + float[] armour = getValueResistences(); + return (getMinotaur().armour_rating / 100F) + * ArmourCalculator.adjustACForDamage(src, getDT(), armour[0], armour[1], armour[2]); + } + + @Override + protected void damageEntity(DamageSource source, float dam) { + float AR = 1.0F + Math.max(0.0F, getArmourRating(source)); + + super.damageEntity(source, dam / AR); + } + + @Override + public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); - - nbt.setInteger("Attack", (int)getAttack()); - nbt.setInteger("Species", (int)getSpecies()); - nbt.setInteger("Breed", (int)getTier()); - nbt.setInteger("Rage", (int)getRageVariable()); + + nbt.setInteger("Attack", getAttack()); + nbt.setInteger("Species", getSpecies()); + nbt.setInteger("Breed", getTier()); + nbt.setInteger("Rage", getRageVariable()); } @Override - public void readEntityFromNBT(NBTTagCompound nbt) - { + public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); - - setAttack((byte)nbt.getInteger("Attack")); + + setAttack((byte) nbt.getInteger("Attack")); int species = nbt.getInteger("Species"); int breed = nbt.getInteger("Breed"); setMob(species, breed); - + setRage(nbt.getInteger("Rage")); } - - private float getDT() - { - byte att = getAttack(); - if(att == (byte)2) - { - return 5F; - } - return 2F; - } - /** - * Cutting, Blunt, Piercing - */ - private float[] getValueResistences() - { - return new float[]{0.75F, 1F, 0.5F}; - } - - /** - * 0=Normal, 1=Headbutt, 2=Beserk, 3=Power - */ - public byte getAttack() - { - return dataWatcher.getWatchableObjectByte(dataID); - } - - /** - * 0=Normal, 1=Headbutt, 2=Beserk, 3=Power - */ - public void setAttack(byte type) - { - dataWatcher.updateObject(dataID, type); - } - + + private float getDT() { + byte att = getAttack(); + if (att == (byte) 2) { + return 5F; + } + return 2F; + } + + /** + * Cutting, Blunt, Piercing + */ + private float[] getValueResistences() { + return new float[]{0.75F, 1F, 0.5F}; + } + + /** + * 0=Normal, 1=Headbutt, 2=Beserk, 3=Power + */ + public byte getAttack() { + return dataWatcher.getWatchableObjectByte(dataID); + } + + /** + * 0=Normal, 1=Headbutt, 2=Beserk, 3=Power + */ + public void setAttack(byte type) { + dataWatcher.updateObject(dataID, type); + } + /** - * @param species Brown, Snow, Nether + * @param species Brown, Snow, Nether * @param subspecies the tier such as normal, warlord, etc */ - public void setMob(int species, int subspecies) - { - MinotaurBreed minotaur = MinotaurBreed.getBreed(species, subspecies); - - setSpecies(species); - setTier(subspecies); - - this.preventEntitySpawning = minotaur.isSpecial; - this.isImmuneToFire = species == 1; - this.experienceValue = minotaur.experienceValue; - - if(subspecies == 0) - { - this.targetTasks.addTask(2, new AI_MinotaurFindTarget(this, EntityLiving.class, 0, false)); - } - if(subspecies >= 3) - { - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(16.0D); - } - } - + public void setMob(int species, int subspecies) { + MinotaurBreed minotaur = MinotaurBreed.getBreed(species, subspecies); + + setSpecies(species); + setTier(subspecies); + + this.preventEntitySpawning = minotaur.isSpecial; + this.isImmuneToFire = species == 1; + this.experienceValue = minotaur.experienceValue; + + if (subspecies == 0) { + this.targetTasks.addTask(2, new AI_MinotaurFindTarget(this, EntityLiving.class, 0, false)); + } + if (subspecies >= 3) { + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(16.0D); + } + } + @Override - protected boolean canDespawn() - { + protected boolean canDespawn() { return !getMinotaur().isSpecial; } + /** - * 0=Normal, 1=Nether - */ - public int getSpecies() - { - return dataWatcher.getWatchableObjectInt(dataID+1); - } - /** - * 0=Normal, 1=Nether - */ - public void setSpecies(int type) - { - dataWatcher.updateObject(dataID+1, type); - - - } - public int getTier() - { - return dataWatcher.getWatchableObjectInt(dataID+2); - } - public void setTier(int type) - { - dataWatcher.updateObject(dataID+2, type); - } - - private int specialAttackTime; + * 0=Normal, 1=Nether + */ + public int getSpecies() { + return dataWatcher.getWatchableObjectInt(dataID + 1); + } + + /** + * 0=Normal, 1=Nether + */ + public void setSpecies(int type) { + dataWatcher.updateObject(dataID + 1, type); + + } + + public int getTier() { + return dataWatcher.getWatchableObjectInt(dataID + 2); + } + + public void setTier(int type) { + dataWatcher.updateObject(dataID + 2, type); + } + + @Override + public float[] getHitTraits() { + byte att = getAttack(); + if (att == (byte) 1) { + return headbutt; + } + return punch; + } + + @Override + public boolean attackEntityAsMob(Entity target) { + if (worldObj.difficultySetting == EnumDifficulty.PEACEFUL && target instanceof EntityPlayer) { + return false; + } + // if(hitCooldownTime > 0)return false; + + if (!canEntityBeSeen(target)) { + return false; + } + if (getAttack() == 3 && motionY > 0 && target.posY < posY) { + return false; + } + + float dam = getHitDamage(); + + if (getRageLevel() > 50) { + addRage((int) (dam * 1.5)); + } + if (getAttack() == 2 && this.riddenByEntity != null && this.riddenByEntity == target) { + if (target instanceof EntityLivingBase && rand.nextInt(4) == 0) { + ArmourCalculator.damageArmour((EntityLivingBase) target, (int) (dam * 0.25F)); + } + } + if (this.riddenByEntity == null) { + if (grabCooldown <= 0 && rand.nextInt(100) < getGrabChance() && canPickUp(target)) { + target.mountEntity(this); + } + } else if (rand.nextInt(100) < ConfigMobs.minotaurTC && riddenByEntity == target) { + riddenByEntity.mountEntity(null); + grabCooldown = 60; + TacticalManager.knockbackEntity(target, this, 4F, 1F); + } + if (getAttack() == 3 && fallDistance > 0 && target instanceof EntityPlayer + && ((EntityPlayer) target).isBlocking() && rand.nextInt(100) < getDisarmChance()) { + TacticalManager.tryDisarm(this, (EntityLivingBase) target, true); + } - private float[]punch = new float[]{0F, 1F, 0F}; - private float[]headbutt = new float[]{0F, 1F, 4F}; - @Override - public float[] getHitTraits() - { - byte att = getAttack(); - if(att == (byte)1) - { - return headbutt; - } - return punch; - } - - @Override - public boolean attackEntityAsMob(Entity target) - { - if(worldObj.difficultySetting == EnumDifficulty.PEACEFUL && target instanceof EntityPlayer) - { - return false; - } - //if(hitCooldownTime > 0)return false; - - if(!canEntityBeSeen(target)) - { - return false; - } - if(getAttack() == 3 && motionY > 0 && target.posY < posY) - { - return false; - } - - - float dam = getHitDamage(); - - if(getRageLevel() > 50) - { - addRage((int) (dam*1.5)); - } - if(getAttack() == 2 && this.riddenByEntity != null && this.riddenByEntity == target) - { - if(target instanceof EntityLivingBase && rand.nextInt(4) == 0) - { - ArmourCalculator.damageArmour((EntityLivingBase) target, (int)(dam*0.25F)); - } - } - if(this.riddenByEntity == null) - { - if(grabCooldown <= 0 && rand.nextInt(100) < getGrabChance() && canPickUp(target)) - { - target.mountEntity(this); - } - } - else if(rand.nextInt(100) < ConfigMobs.minotaurTC && riddenByEntity == target) - { - riddenByEntity.mountEntity(null); - grabCooldown = 60; - TacticalManager.knockbackEntity(target, this, 4F, 1F); - } - if(getAttack() == 3 && fallDistance > 0 && target instanceof EntityPlayer && ((EntityPlayer)target).isBlocking() && rand.nextInt(100) < getDisarmChance()) - { - TacticalManager.tryDisarm(this, (EntityLivingBase)target, true); - } - int i = getKnockbackBoost(); - if (target instanceof EntityLivingBase) - { - dam += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase)target); - i += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase)target); + if (target instanceof EntityLivingBase) { + dam += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase) target); + i += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase) target); } boolean flag = target.attackEntityFrom(new DamageSourceMobMF(getAttackType(), this), dam); - if (flag) - { - this.hitCooldownTime = getAttackSpeed(); - this.swingItem(); - if (i > 0) - { - target.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)); + if (flag) { + this.hitCooldownTime = getAttackSpeed(); + this.swingItem(); + if (i > 0) { + target.addVelocity(-MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F) * i * 0.5F, 0.1D, + MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F) * i * 0.5F); this.motionX *= 0.6D; this.motionZ *= 0.6D; } int j = EnchantmentHelper.getFireAspectModifier(this); - if (j > 0) - { + if (j > 0) { target.setFire(j * 4); } - if (target instanceof EntityLivingBase) - { - EnchantmentHelper.func_151384_a((EntityLivingBase)target, this); + if (target instanceof EntityLivingBase) { + EnchantmentHelper.func_151384_a((EntityLivingBase) target, this); } EnchantmentHelper.func_151385_b(this, target); @@ -659,191 +564,154 @@ else if(rand.nextInt(100) < ConfigMobs.minotaurTC && riddenByEntity == target) return flag; } - private boolean canPickUp(Entity target) - { - if(target instanceof EntityLivingBase && PowerArmour.isWearingCogwork((EntityLivingBase)target)) - { - return false; - } - float mysize = getVolume(this); - float theirsize = getVolume(target); - return mysize > theirsize; - } - - private float getVolume(Entity entity) - { - return entity.width*entity.width*entity.height; - } - - private int getAttackSpeed() - { - return 0; - /* - if(rage >= 100) - { - return 10; - } - if(rage > 80) - { - return 15; - } - if(rage > 50) - { - return 20; - } - if(rage > 25) - { - return 30; - } - return 35; - */ - } - - @Override - public void onKillEntity(EntityLivingBase victim) - { - super.onKillEntity(victim); - if(!isBloodied()) - { - addRage(-20); - } - if(getHealth() < getMaxHealth()*0.75F) - { - this.heal(5); - } - } - - public MinotaurBreed getMinotaur() - { - return MinotaurBreed.getBreed(getSpecies(), getTier()); - } - - private int getDisarmChance() - { - return getMinotaur().disarmChance; - } - private int getGrabChance() - { - return (getAttack() == 2 ? getMinotaur().grabChanceBeserk : getMinotaur().grabChance); - } - private int getThrowChance() - { - return getMinotaur().throwChance; - } - private String getAttackType() - { - byte att = getAttack(); - if(att == (byte)1) - { - return "gore"; - } - if(att == (byte)2) - { - return "beserk"; - } - return "pound"; - } - private int getKnockbackBoost() - { - byte att = getAttack(); - if(att == (byte)1) - { - return getSpecies() == 1 ? 4 : 2; - } - return 0; - } - private float getHitDamage() - { - MinotaurBreed breed = getMinotaur(); - byte att = getAttack(); - - if(att != (byte)1 && getHeldItem() != null)//no weapon dam on gore - { - float melee = att == (byte)2 ? breed.beserkDamage : breed.poundDamage; - - return Math.max(2F, melee-2F);//Weapon Dam - } - - if(att == (byte)1) - { - return breed.goreDamage; - } - if(att == (byte)2) - { - return breed.beserkDamage; - } - return breed.poundDamage; - } - - public boolean isBloodied() - { - float t = this.getMinotaur().beserkThreshold/100F; - return getHealth() < (getMaxHealth()*t); - } - @SideOnly(Side.CLIENT) - public String getTexture() - { - String tex = "minotaur" + getMinotaur().tex; - if(isBloodied()) - { - tex += "_bloodied"; - } - return tex; - } - - public int getRageVariable() - { - return dataWatcher.getWatchableObjectInt(dataID+3); - } - public void addRage(int level) - { - setRage(getRageVariable() + level); - } - public void setRage(int level) - { - if(!worldObj.isRemote) - dataWatcher.updateObject(dataID+3, Math.max(0, level)); - } - - - public int getRageLevel() - { - return isBloodied() ? 100 : getRageVariable(); - } - - private int getIntLvl() - { - return this.getMinotaur().intelligenceLvl; - } - - public boolean isDocile() - { - return getIntLvl() <= 0; - } - @Override - public boolean canParry(DamageSource source) - { - int intLvl = this.getIntLvl(); - if(intLvl == 0) - { - return rand.nextInt(8) == 0; - } - return this.getAttack() == (byte)0; - } - public void throwBomb(EntityLivingBase attackTarget, float spread) - { - EntityBomb bomb = new EntityBomb(worldObj, this).setType((byte)1, (byte)0, (byte)0, (byte)0); - worldObj.spawnEntityInWorld(bomb); - this.swingItem(); - } - @Override - public void onParry(DamageSource source, Entity attacker, float dam) - { - Entity target = this.getEntityToAttack(); - if(getIntLvl() > 1 && target != null && attacker == target && this.getDistanceSqToEntity(attacker) < 4) - { - this.setAttack((byte)1); - TacticalManager.lungeEntity(this, attacker, 2.0F, 0.2F); - } - } + + private boolean canPickUp(Entity target) { + if (target instanceof EntityLivingBase && PowerArmour.isWearingCogwork((EntityLivingBase) target)) { + return false; + } + float mysize = getVolume(this); + float theirsize = getVolume(target); + return mysize > theirsize; + } + + private float getVolume(Entity entity) { + return entity.width * entity.width * entity.height; + } + + private int getAttackSpeed() { + return 0; + /* + * if(rage >= 100) { return 10; } if(rage > 80) { return 15; } if(rage > 50) { + * return 20; } if(rage > 25) { return 30; } return 35; + */ + } + + @Override + public void onKillEntity(EntityLivingBase victim) { + super.onKillEntity(victim); + if (!isBloodied()) { + addRage(-20); + } + if (getHealth() < getMaxHealth() * 0.75F) { + this.heal(5); + } + } + + public MinotaurBreed getMinotaur() { + return MinotaurBreed.getBreed(getSpecies(), getTier()); + } + + private int getDisarmChance() { + return getMinotaur().disarmChance; + } + + private int getGrabChance() { + return (getAttack() == 2 ? getMinotaur().grabChanceBeserk : getMinotaur().grabChance); + } + + private int getThrowChance() { + return getMinotaur().throwChance; + } + + private String getAttackType() { + byte att = getAttack(); + if (att == (byte) 1) { + return "gore"; + } + if (att == (byte) 2) { + return "beserk"; + } + return "pound"; + } + + private int getKnockbackBoost() { + byte att = getAttack(); + if (att == (byte) 1) { + return getSpecies() == 1 ? 4 : 2; + } + return 0; + } + + private float getHitDamage() { + MinotaurBreed breed = getMinotaur(); + byte att = getAttack(); + + if (att != (byte) 1 && getHeldItem() != null)// no weapon dam on gore + { + float melee = att == (byte) 2 ? breed.beserkDamage : breed.poundDamage; + + return Math.max(2F, melee - 2F);// Weapon Dam + } + + if (att == (byte) 1) { + return breed.goreDamage; + } + if (att == (byte) 2) { + return breed.beserkDamage; + } + return breed.poundDamage; + } + + public boolean isBloodied() { + float t = this.getMinotaur().beserkThreshold / 100F; + return getHealth() < (getMaxHealth() * t); + } + + @SideOnly(Side.CLIENT) + public String getTexture() { + String tex = "minotaur" + getMinotaur().tex; + if (isBloodied()) { + tex += "_bloodied"; + } + return tex; + } + + public int getRageVariable() { + return dataWatcher.getWatchableObjectInt(dataID + 3); + } + + public void addRage(int level) { + setRage(getRageVariable() + level); + } + + public void setRage(int level) { + if (!worldObj.isRemote) + dataWatcher.updateObject(dataID + 3, Math.max(0, level)); + } + + public int getRageLevel() { + return isBloodied() ? 100 : getRageVariable(); + } + + private int getIntLvl() { + return this.getMinotaur().intelligenceLvl; + } + + public boolean isDocile() { + return getIntLvl() <= 0; + } + + @Override + public boolean canParry(DamageSource source) { + int intLvl = this.getIntLvl(); + if (intLvl == 0) { + return rand.nextInt(8) == 0; + } + return this.getAttack() == (byte) 0; + } + + public void throwBomb(EntityLivingBase attackTarget, float spread) { + EntityBomb bomb = new EntityBomb(worldObj, this).setType((byte) 1, (byte) 0, (byte) 0, (byte) 0); + worldObj.spawnEntityInWorld(bomb); + this.swingItem(); + } + + @Override + public void onParry(DamageSource source, Entity attacker, float dam) { + Entity target = this.getEntityToAttack(); + if (getIntLvl() > 1 && target != null && attacker == target && this.getDistanceSqToEntity(attacker) < 4) { + this.setAttack((byte) 1); + TacticalManager.lungeEntity(this, attacker, 2.0F, 0.2F); + } + } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/EntityMobMF.java b/src/main/java/minefantasy/mf2/entity/mob/EntityMobMF.java index 5f2c4461..882629bc 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/EntityMobMF.java +++ b/src/main/java/minefantasy/mf2/entity/mob/EntityMobMF.java @@ -13,26 +13,23 @@ import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; -public abstract class EntityMobMF extends EntityCreature implements IMob -{ - public EntityMobMF(World world) - { +public abstract class EntityMobMF extends EntityCreature implements IMob { + public EntityMobMF(World world) { super(world); this.experienceValue = 5; } /** - * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons - * use this to react to sunlight and start to burn. + * Called frequently so the entity can update its state every tick as required. + * For example, zombies and skeletons use this to react to sunlight and start to + * burn. */ @Override - public void onLivingUpdate() - { + public void onLivingUpdate() { this.updateArmSwingProgress(); float f = this.getBrightness(1.0F); - if (f > 0.5F) - { + if (f > 0.5F) { this.entityAge += 2; } @@ -43,35 +40,31 @@ public void onLivingUpdate() * Called to update the entity's position/logic. */ @Override - public void onUpdate() - { + public void onUpdate() { super.onUpdate(); - if (this.canDespawn() && !this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) - { + if (this.canDespawn() && !this.worldObj.isRemote + && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { this.setDead(); } } @Override - protected String getSwimSound() - { + protected String getSwimSound() { return "game.hostile.swim"; } @Override - protected String getSplashSound() - { + protected String getSplashSound() { return "game.hostile.swim.splash"; } /** - * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking - * (Animals, Spiders at day, peaceful PigZombies). + * Finds the closest player within 16 blocks to attack, or null if this Entity + * isn't interested in attacking (Animals, Spiders at day, peaceful PigZombies). */ @Override - protected Entity findPlayerToAttack() - { + protected Entity findPlayerToAttack() { EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D); return entityplayer != null && this.canEntityBeSeen(entityplayer) ? entityplayer : null; } @@ -80,32 +73,22 @@ protected Entity findPlayerToAttack() * Called when the entity is attacked. */ @Override - public boolean attackEntityFrom(DamageSource source, float dam) - { - if (this.isEntityInvulnerable()) - { + public boolean attackEntityFrom(DamageSource source, float dam) { + if (this.isEntityInvulnerable()) { return false; - } - else if (super.attackEntityFrom(source, dam)) - { + } else if (super.attackEntityFrom(source, dam)) { Entity entity = source.getEntity(); - if (this.riddenByEntity != entity && this.ridingEntity != entity) - { - if (entity != this) - { + if (this.riddenByEntity != entity && this.ridingEntity != entity) { + if (entity != this) { this.entityToAttack = entity; } return true; - } - else - { + } else { return true; } - } - else - { + } else { return false; } } @@ -114,8 +97,7 @@ else if (super.attackEntityFrom(source, dam)) * Returns the sound this mob makes when it is hurt. */ @Override - protected String getHurtSound() - { + protected String getHurtSound() { return "game.hostile.hurt"; } @@ -123,55 +105,47 @@ protected String getHurtSound() * Returns the sound this mob makes on death. */ @Override - protected String getDeathSound() - { + protected String getDeathSound() { return "game.hostile.die"; } @Override - protected String func_146067_o(int distance) - { + protected String func_146067_o(int distance) { return distance > 4 ? "game.hostile.hurt.fall.big" : "game.hostile.hurt.fall.small"; } @Override - public boolean attackEntityAsMob(Entity target) - { - if(worldObj.difficultySetting == EnumDifficulty.PEACEFUL && target instanceof EntityPlayer) - { - return false; - } - - float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + public boolean attackEntityAsMob(Entity target) { + if (worldObj.difficultySetting == EnumDifficulty.PEACEFUL && target instanceof EntityPlayer) { + return false; + } + + float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); int i = 0; - if (target instanceof EntityLivingBase) - { - f += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase)target); - i += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase)target); + if (target instanceof EntityLivingBase) { + f += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase) target); + i += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase) target); } boolean flag = target.attackEntityFrom(DamageSource.causeMobDamage(this), f); - if (flag) - { - if (i > 0) - { - target.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)); + if (flag) { + if (i > 0) { + target.addVelocity(-MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F) * i * 0.5F, 0.1D, + MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F) * i * 0.5F); this.motionX *= 0.6D; this.motionZ *= 0.6D; } int j = EnchantmentHelper.getFireAspectModifier(this); - if (j > 0) - { + if (j > 0) { target.setFire(j * 4); } - if (target instanceof EntityLivingBase) - { - EnchantmentHelper.func_151384_a((EntityLivingBase)target, this); + if (target instanceof EntityLivingBase) { + EnchantmentHelper.func_151384_a((EntityLivingBase) target, this); } EnchantmentHelper.func_151385_b(this, target); @@ -181,47 +155,41 @@ public boolean attackEntityAsMob(Entity target) } /** - * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. + * Basic mob attack. Default to touch of death in EntityCreature. Overridden by + * each mob to define their attack. */ @Override - protected void attackEntity(Entity target, float dam) - { - if (this.attackTime <= 0 && dam < 2.0F && target.boundingBox.maxY > this.boundingBox.minY && target.boundingBox.minY < this.boundingBox.maxY) - { + protected void attackEntity(Entity target, float dam) { + if (this.attackTime <= 0 && dam < 2.0F && target.boundingBox.maxY > this.boundingBox.minY + && target.boundingBox.minY < this.boundingBox.maxY) { this.attackTime = 20; this.attackEntityAsMob(target); } } /** - * Takes a coordinate in and returns a weight to determine how likely this creature will try to path to the block. - * Args: x, y, z + * Takes a coordinate in and returns a weight to determine how likely this + * creature will try to path to the block. Args: x, y, z */ @Override - public float getBlockPathWeight(int x, int y, int z) - { + public float getBlockPathWeight(int x, int y, int z) { return 0.5F - this.worldObj.getLightBrightness(x, y, z); } /** * Checks to make sure the light is not too bright where the mob is spawning */ - protected boolean isValidLightLevel() - { + 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)) - { + if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, i, j, k) > this.rand.nextInt(32)) { return false; - } - else - { + } else { int l = this.worldObj.getBlockLightValue(i, j, k); - if (this.worldObj.isThundering()) - { + if (this.worldObj.isThundering()) { int i1 = this.worldObj.skylightSubtracted; this.worldObj.skylightSubtracted = 10; l = this.worldObj.getBlockLightValue(i, j, k); @@ -233,24 +201,23 @@ protected boolean isValidLightLevel() } /** - * Checks if the entity's current position is a valid location to spawn this entity. + * Checks if the entity's current position is a valid location to spawn this + * entity. */ @Override - public boolean getCanSpawnHere() - { - return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && this.isValidLightLevel() && super.getCanSpawnHere(); + public boolean getCanSpawnHere() { + return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && this.isValidLightLevel() + && super.getCanSpawnHere(); } @Override - protected void applyEntityAttributes() - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); } @Override - protected boolean func_146066_aG() - { + protected boolean func_146066_aG() { return true; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/mob/FireBreath.java b/src/main/java/minefantasy/mf2/entity/mob/FireBreath.java index 6ba88489..28f54a29 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/FireBreath.java +++ b/src/main/java/minefantasy/mf2/entity/mob/FireBreath.java @@ -1,5 +1,7 @@ package minefantasy.mf2.entity.mob; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.config.ConfigMobs; import minefantasy.mf2.entity.EntityDragonBreath; import net.minecraft.block.Block; @@ -11,69 +13,57 @@ import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class FireBreath extends DragonBreath -{ +public class FireBreath extends DragonBreath { + + public FireBreath(String name) { + super(name); + } + + @Override + public DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter) { + return shooter == null ? new DamageSource("fireblastBase").setFireDamage() + : (new EntityDamageSourceIndirect("fireblast", breath, shooter)).setFireDamage(); + } + + @Override + @SideOnly(Side.CLIENT) + public String getTexture(EntityDragonBreath instance) { + return "textures/projectile/dragonbreath_fire"; + } + + public void onHitEntity(Entity target, EntityDragonBreath instance) { + super.onHitEntity(target, instance); + if (target instanceof EntityLivingBase) { + target.setFire(5); + } + } - public FireBreath(String name) - { - super(name); - } + @Override + public float modifyDamage(Entity hit, float dam) { + return dam; + } - @Override - public DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter) - { - return shooter == null ? new DamageSource("fireblastBase").setFireDamage() : (new EntityDamageSourceIndirect("fireblast", breath, shooter)).setFireDamage(); - } + @Override + public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) { + Block hit = world.getBlock(x, y, z); + if (!world.isRemote && (impact || instance.rand.nextInt(20) == 0)) { + if (!world.isRemote && world.isAirBlock(x, y + 1, z)) { + if (ConfigMobs.dragonGriefFire && hit.isSideSolid(world, x, y, z, ForgeDirection.UP) + && hit.isFlammable(world, x, y + 1, z, ForgeDirection.UP)) { + world.setBlock(x, y + 1, z, Blocks.fire); + } + if (!world.getGameRules().getGameRuleBooleanValue("mobGriefing")) + return; - @Override - @SideOnly(Side.CLIENT) - public String getTexture(EntityDragonBreath instance) - { - return "textures/projectile/dragonbreath_fire"; - } - - public void onHitEntity(Entity target, EntityDragonBreath instance) - { - super.onHitEntity(target, instance); - if(target instanceof EntityLivingBase) - { - target.setFire(5); - } - } - - @Override - public float modifyDamage(Entity hit, float dam) - { - return dam; - } - - @Override - public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) - { - Block hit = world.getBlock(x, y, z); - if(!world.isRemote && (impact || instance.rand.nextInt(20) == 0)) - { - if(!world.isRemote && world.isAirBlock(x, y+1, z)) - { - if(ConfigMobs.dragonGriefFire && hit.isSideSolid(world, x, y, z, ForgeDirection.UP) && hit.isFlammable(world, x, y+1, z, ForgeDirection.UP)) - { - world.setBlock(x, y+1, z, Blocks.fire); - } - if(!world.getGameRules().getGameRuleBooleanValue("mobGriefing"))return; - - if(ConfigMobs.dragonGriefGeneral && hit == Blocks.ice) - { - world.setBlock(x, y, z, Blocks.water); - } - if(ConfigMobs.dragonGriefGeneral && hit.getMaterial() == Material.glass) - { - world.playSoundEffect(x+0.5D, y+0.5D, z+0.5D, "dig.glass", 1.0F, 1.0F); - world.setBlockToAir(x, y, z); - } - } - } - } + if (ConfigMobs.dragonGriefGeneral && hit == Blocks.ice) { + world.setBlock(x, y, z, Blocks.water); + } + if (ConfigMobs.dragonGriefGeneral && hit.getMaterial() == Material.glass) { + world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "dig.glass", 1.0F, 1.0F); + world.setBlockToAir(x, y, z); + } + } + } + } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/FrostBreath.java b/src/main/java/minefantasy/mf2/entity/mob/FrostBreath.java index cb81196b..8576e34a 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/FrostBreath.java +++ b/src/main/java/minefantasy/mf2/entity/mob/FrostBreath.java @@ -1,5 +1,7 @@ package minefantasy.mf2.entity.mob; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.config.ConfigMobs; import minefantasy.mf2.entity.EntityDragonBreath; @@ -13,76 +15,61 @@ import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class FrostBreath extends DragonBreath -{ +public class FrostBreath extends DragonBreath { + + public FrostBreath(String name) { + super(name); + } + + @Override + public DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter) { + return shooter == null ? new DamageSource("frostblastBase") + : (new EntityDamageSourceIndirect("frostblast", breath, shooter)); + } + + @Override + @SideOnly(Side.CLIENT) + public String getTexture(EntityDragonBreath instance) { + return "textures/projectile/dragonbreath_frost"; + } + + public void onHitEntity(Entity target, EntityDragonBreath instance) { + super.onHitEntity(target, instance); + if (target instanceof EntityLivingBase) { + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity((EntityLivingBase) target)) { + StaminaBar.modifyStaminaValue((EntityLivingBase) target, -1F); + } + ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2)); + } + } - public FrostBreath(String name) - { - super(name); - } + @Override + public float modifyDamage(Entity hit, float dam) { + return dam; + } - @Override - public DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter) - { - return shooter == null ? new DamageSource("frostblastBase") : (new EntityDamageSourceIndirect("frostblast", breath, shooter)); - } + @Override + public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) { + Block hit = world.getBlock(x, y, z); + if (!world.isRemote && (impact || instance.rand.nextInt(20) == 0)) { + if (ConfigMobs.dragonGriefGeneral && world.isAirBlock(x, y + 1, z)) { + if (hit.isSideSolid(world, x, y, z, ForgeDirection.UP)) { + world.setBlock(x, y + 1, z, Blocks.snow_layer); + } - @Override - @SideOnly(Side.CLIENT) - public String getTexture(EntityDragonBreath instance) - { - return "textures/projectile/dragonbreath_frost"; - } - - public void onHitEntity(Entity target, EntityDragonBreath instance) - { - super.onHitEntity(target, instance); - if(target instanceof EntityLivingBase) - { - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity((EntityLivingBase) target)) - { - StaminaBar.modifyStaminaValue((EntityLivingBase) target, -1F); - } - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2)); - } - } - - @Override - public float modifyDamage(Entity hit, float dam) - { - return dam; - } - - @Override - public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) - { - Block hit = world.getBlock(x, y, z); - if(!world.isRemote && (impact || instance.rand.nextInt(20) == 0)) - { - if(ConfigMobs.dragonGriefGeneral && world.isAirBlock(x, y+1, z)) - { - if(hit.isSideSolid(world, x, y, z, ForgeDirection.UP)) - { - world.setBlock(x, y+1, z, Blocks.snow_layer); - } - - if(!world.getGameRules().getGameRuleBooleanValue("mobGriefing"))return; - if(hit == Blocks.water || hit == Blocks.flowing_water) - { - world.setBlock(x, y, z, Blocks.ice); - } - if(hit == Blocks.water || hit == Blocks.lava) - { - world.setBlock(x, y, z, Blocks.obsidian); - } - if(hit == Blocks.water || hit == Blocks.flowing_lava) - { - world.setBlock(x, y, z, Blocks.cobblestone); - } - } - } - } + if (!world.getGameRules().getGameRuleBooleanValue("mobGriefing")) + return; + if (hit == Blocks.water || hit == Blocks.flowing_water) { + world.setBlock(x, y, z, Blocks.ice); + } + if (hit == Blocks.water || hit == Blocks.lava) { + world.setBlock(x, y, z, Blocks.obsidian); + } + if (hit == Blocks.water || hit == Blocks.flowing_lava) { + world.setBlock(x, y, z, Blocks.cobblestone); + } + } + } + } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/MinotaurBreed.java b/src/main/java/minefantasy/mf2/entity/mob/MinotaurBreed.java index efad33f3..3c6f02f7 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/MinotaurBreed.java +++ b/src/main/java/minefantasy/mf2/entity/mob/MinotaurBreed.java @@ -1,165 +1,213 @@ package minefantasy.mf2.entity.mob; -import java.util.ArrayList; -import java.util.Random; - import minefantasy.mf2.config.ConfigMobs; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -public class MinotaurBreed -{ - public static final ArrayList normal = new ArrayList(); - public static final ArrayList frost = new ArrayList(); - public static final ArrayList nether = new ArrayList(); - private static Random rand = new Random(); - - public static MinotaurBreed BROWN = new MinotaurBreed(normal, "minotaur", "Brown", null, 10, ConfigMobs.minotaurHP, ConfigMobs.minotaurMD, ConfigMobs.minotaurGD, 0).setGrabs(ConfigMobs.minotaurDC, ConfigMobs.minotaurGC, ConfigMobs.minotaurTC).setBeserk(ConfigMobs.minotaurBT, ConfigMobs.minotaurBD, ConfigMobs.minotaurGCB).setLesser(); - public static MinotaurBreed BROWNGUARD = new MinotaurBreed(normal, "minotaur_guard", "GuardBrown", "iron", 20, ConfigMobs.guardminotaurHP, ConfigMobs.guardminotaurMD, ConfigMobs.guardminotaurGD, ConfigMobs.lightminotaurAR).setGrabs(ConfigMobs.guardminotaurDC, ConfigMobs.guardminotaurGC, ConfigMobs.guardminotaurTC).setBeserk(ConfigMobs.guardminotaurBT, ConfigMobs.guardminotaurBD, ConfigMobs.guardminotaurGCB).setIntelligence(1); - public static MinotaurBreed BROWNELITE = new MinotaurBreed(normal, "minotaur_elite", "EliteBrown", "steel", 40, ConfigMobs.eliteminotaurHP, ConfigMobs.eliteminotaurMD, ConfigMobs.eliteminotaurGD, ConfigMobs.mediumminotaurAR).setGrabs(ConfigMobs.eliteminotaurDC, ConfigMobs.eliteminotaurGC, ConfigMobs.eliteminotaurTC).setBeserk(ConfigMobs.eliteminotaurBT, ConfigMobs.eliteminotaurBD, ConfigMobs.eliteminotaurGCB).setIntelligence(2); - public static MinotaurBreed BROWNBOSS = new MinotaurBreed(normal, "minotaur_boss", "BossBrown", "obsidian", 100, ConfigMobs.bossminotaurHP, ConfigMobs.bossminotaurMD, ConfigMobs.bossminotaurGD, ConfigMobs.heavyminotaurAR).setGrabs(ConfigMobs.bossminotaurDC, ConfigMobs.bossminotaurGC, ConfigMobs.bossminotaurTC).setBeserk(ConfigMobs.bossminotaurBT, ConfigMobs.bossminotaurBD, ConfigMobs.bossminotaurGCB).setIntelligence(3).throwBombs(); - - public static MinotaurBreed FROST = new MinotaurBreed(frost, "frostminotaur", "White", null, 15, ConfigMobs.minotaurHP, ConfigMobs.minotaurMD, ConfigMobs.minotaurGD, ConfigMobs.frostminotaurAR).setGrabs(ConfigMobs.minotaurDC, ConfigMobs.minotaurGC, ConfigMobs.minotaurTC).setBeserk(ConfigMobs.minotaurBT, ConfigMobs.minotaurBD, ConfigMobs.minotaurGCB).setLesser(); - public static MinotaurBreed FROSTGUARD = new MinotaurBreed(frost, "frostminotaur_guard", "GuardWhite", "iron", 25, ConfigMobs.guardminotaurHP, ConfigMobs.guardminotaurMD, ConfigMobs.guardminotaurGD, ConfigMobs.lightminotaurAR + ConfigMobs.frostminotaurAR).setGrabs(ConfigMobs.guardminotaurDC, ConfigMobs.guardminotaurGC, ConfigMobs.guardminotaurTC).setBeserk(ConfigMobs.guardminotaurBT, ConfigMobs.guardminotaurBD, ConfigMobs.guardminotaurGCB).setIntelligence(1); - public static MinotaurBreed FROSTELITE = new MinotaurBreed(frost, "frostminotaur_elite", "EliteWhite", "steel", 50, ConfigMobs.eliteminotaurHP, ConfigMobs.eliteminotaurMD, ConfigMobs.eliteminotaurGD, ConfigMobs.mediumminotaurAR + ConfigMobs.frostminotaurAR).setGrabs(ConfigMobs.eliteminotaurDC, ConfigMobs.eliteminotaurGC, ConfigMobs.eliteminotaurTC).setBeserk(ConfigMobs.eliteminotaurBT, ConfigMobs.eliteminotaurBD, ConfigMobs.eliteminotaurGCB).setIntelligence(2); - public static MinotaurBreed FROSTBOSS = new MinotaurBreed(frost, "frostminotaurr_boss", "BossWhite", "obsidian", 120, ConfigMobs.bossminotaurHP, ConfigMobs.bossminotaurMD, ConfigMobs.bossminotaurGD, ConfigMobs.heavyminotaurAR + ConfigMobs.frostminotaurAR).setGrabs(ConfigMobs.bossminotaurDC, ConfigMobs.bossminotaurGC, ConfigMobs.bossminotaurTC).setBeserk(ConfigMobs.bossminotaurBT, ConfigMobs.bossminotaurBD, ConfigMobs.bossminotaurGCB).setIntelligence(3).throwBombs(); - - public static MinotaurBreed NETHER = new MinotaurBreed(nether, "dredminotaur", "Nether", null, 15, ConfigMobs.minotaurHP, ConfigMobs.minotaurMD, ConfigMobs.minotaurGD, ConfigMobs.dreadminotaurAR).setGrabs(ConfigMobs.minotaurDC, ConfigMobs.minotaurGC, ConfigMobs.minotaurTC).setBeserk(ConfigMobs.minotaurBT, ConfigMobs.minotaurBD, ConfigMobs.minotaurGCB).setLesser(); - public static MinotaurBreed NETHERGUARD = new MinotaurBreed(nether, "dredminotaur_guard", "GuardNether", "iron", 25, ConfigMobs.guardminotaurHP, ConfigMobs.guardminotaurMD, ConfigMobs.guardminotaurGD, ConfigMobs.lightminotaurAR + ConfigMobs.dreadminotaurAR).setGrabs(ConfigMobs.guardminotaurDC, ConfigMobs.guardminotaurGC, ConfigMobs.guardminotaurTC).setBeserk(ConfigMobs.guardminotaurBT, ConfigMobs.guardminotaurBD, ConfigMobs.guardminotaurGCB).setIntelligence(1); - public static MinotaurBreed NETHERELITE = new MinotaurBreed(nether, "dredminotaur_elite", "EliteNether", "steel", 50, ConfigMobs.eliteminotaurHP, ConfigMobs.eliteminotaurMD, ConfigMobs.eliteminotaurGD, ConfigMobs.mediumminotaurAR + ConfigMobs.dreadminotaurAR).setGrabs(ConfigMobs.eliteminotaurDC, ConfigMobs.eliteminotaurGC, ConfigMobs.eliteminotaurTC).setBeserk(ConfigMobs.eliteminotaurBT, ConfigMobs.eliteminotaurBD, ConfigMobs.eliteminotaurGCB).setIntelligence(2); - public static MinotaurBreed NETHERBOSS = new MinotaurBreed(nether, "dredminotaur_boss", "BossNether", "obsidian", 150, ConfigMobs.bossminotaurHP, ConfigMobs.bossminotaurMD, ConfigMobs.bossminotaurGD, ConfigMobs.heavyminotaurAR + ConfigMobs.dreadminotaurAR).setGrabs(ConfigMobs.bossminotaurDC, ConfigMobs.bossminotaurGC, ConfigMobs.bossminotaurTC).setBeserk(ConfigMobs.bossminotaurBT, ConfigMobs.bossminotaurBD, ConfigMobs.bossminotaurGCB).setIntelligence(3).throwBombs(); - - public String name = "minotaur"; - public String tex = "Brown"; - public float health = 50; - public float poundDamage = 8; - public float goreDamage = 8; - public float beserkDamage = 12; - public int beserkThreshold = 40; - public int grabChance = 10; - public int grabChanceBeserk = 25; - public int throwChance = 20; - public int disarmChance = 10; - public ArrayList pool; - public int intelligenceLvl = 0; - - public int experienceValue; - public boolean isSpecial = true; - public String weaponTier; - public int armour_rating; - public boolean throwsBombs = false; - - public MinotaurBreed(ArrayList pool, String name, String tex, String weapons, int xp, float health, float poundDamage, float goreDamage, int AR) - { - this.pool = pool; - pool.add(this); - this.name = name; - this.tex = tex; - this.health = health; - this.poundDamage = poundDamage; - this.goreDamage = goreDamage; - this.beserkDamage = poundDamage *1.5F; - this.weaponTier = weapons; - this.experienceValue = xp; - this.armour_rating = AR; - } - /** - * Set beserk stats - * @param threshold the percent (0-100) health where it triggers (Default 25%) - * @param damage (The damage done by melee) - * @param grabChance the percent (0-100) chance to grab enemies when beserked (Default 25%) - */ - public MinotaurBreed setBeserk(int threshold, float damage, int grabChance) - { - this.beserkThreshold = threshold; - this.beserkDamage = damage; - this.grabChanceBeserk = grabChance; - return this; - } - /** - * - * @param grabChance the percent (0-100) chance to disarm enemies with a power attack (Default 10%) - * @param grabChance the percent (0-100) chance to grab enemies (Default 10%) - * @param grabChance the percent (0-100) chance to throw grabbed enemies when hit (Default 20%) - * @return - */ - public MinotaurBreed setGrabs(int disarmChance, int grabChance, int throwChance) - { - this.disarmChance = disarmChance; - this.grabChance = grabChance; - this.throwChance = throwChance; - return this; - } - - /** - * Set the intelligence for the mob 0 For docile... 1 For basic... 2 For Orderly - */ - public MinotaurBreed setIntelligence(int level) - { - this.intelligenceLvl = level; - return this; - } - /** - * Enables spawning and despawning - */ - public MinotaurBreed setLesser() - { - this.isSpecial = false; - return this; - } - public MinotaurBreed throwBombs() - { - this.throwsBombs = true; - return this; - } - - public static int getRandomMinotaur(int species) - { - return getRandomMinotaur(species == 1 ? MinotaurBreed.nether : MinotaurBreed.normal); - } - public static int getRandomMinotaur(ArrayList pool) - { - if(pool.size() <= 1) - { - return 0; - } - return rand.nextInt(pool.size()); - } - public static MinotaurBreed getBreed(int species, int id) - { - return getBreed(species == 2 ? MinotaurBreed.frost : species == 1 ? MinotaurBreed.nether : MinotaurBreed.normal, id); - } - public static MinotaurBreed getBreed(ArrayList pool, int id) - { - if(id >= pool.size()) - { - id = (pool.size()-1); - } - return pool.get(id); - } - public static int getEnvironment(EntityMinotaur mob) - { - return getEnvironment(mob.worldObj, (int)mob.posX, (int)mob.posZ, mob.dimension); - } - public static int getEnvironment(World world, int x, int z, int dimension) - { - if(dimension == -1)return 1;//NETHER - - BiomeGenBase biome =world.getBiomeGenForCoords(x, z); - if(biome != null) - { - if(biome.getEnableSnow() || biome.temperature <= 0.25F || biome.getTempCategory() == BiomeGenBase.TempCategory.COLD) - { - return 2;//FROST - } - } - return 0;//BROWN - } - /** - * What environment is a particular structure - */ - public static int getEnvironment(String subtype) - { - return subtype.equalsIgnoreCase("Frost") ? (byte)2 : subtype.equalsIgnoreCase("Nether") ? (byte)1 : (byte)0; - } +import java.util.ArrayList; +import java.util.Random; + +public class MinotaurBreed { + public static final ArrayList normal = new ArrayList(); + public static final ArrayList frost = new ArrayList(); + public static final ArrayList nether = new ArrayList(); + public static MinotaurBreed BROWN = new MinotaurBreed(normal, "minotaur", "Brown", null, 10, ConfigMobs.minotaurHP, + ConfigMobs.minotaurMD, ConfigMobs.minotaurGD, 0) + .setGrabs(ConfigMobs.minotaurDC, ConfigMobs.minotaurGC, ConfigMobs.minotaurTC) + .setBeserk(ConfigMobs.minotaurBT, ConfigMobs.minotaurBD, ConfigMobs.minotaurGCB).setLesser(); + public static MinotaurBreed BROWNGUARD = new MinotaurBreed(normal, "minotaur_guard", "GuardBrown", "iron", 20, + ConfigMobs.guardminotaurHP, ConfigMobs.guardminotaurMD, ConfigMobs.guardminotaurGD, + ConfigMobs.lightminotaurAR) + .setGrabs(ConfigMobs.guardminotaurDC, ConfigMobs.guardminotaurGC, ConfigMobs.guardminotaurTC) + .setBeserk(ConfigMobs.guardminotaurBT, ConfigMobs.guardminotaurBD, ConfigMobs.guardminotaurGCB) + .setIntelligence(1); + public static MinotaurBreed BROWNELITE = new MinotaurBreed(normal, "minotaur_elite", "EliteBrown", "steel", 40, + ConfigMobs.eliteminotaurHP, ConfigMobs.eliteminotaurMD, ConfigMobs.eliteminotaurGD, + ConfigMobs.mediumminotaurAR) + .setGrabs(ConfigMobs.eliteminotaurDC, ConfigMobs.eliteminotaurGC, ConfigMobs.eliteminotaurTC) + .setBeserk(ConfigMobs.eliteminotaurBT, ConfigMobs.eliteminotaurBD, ConfigMobs.eliteminotaurGCB) + .setIntelligence(2); + public static MinotaurBreed BROWNBOSS = new MinotaurBreed(normal, "minotaur_boss", "BossBrown", "obsidian", 100, + ConfigMobs.bossminotaurHP, ConfigMobs.bossminotaurMD, ConfigMobs.bossminotaurGD, ConfigMobs.heavyminotaurAR) + .setGrabs(ConfigMobs.bossminotaurDC, ConfigMobs.bossminotaurGC, ConfigMobs.bossminotaurTC) + .setBeserk(ConfigMobs.bossminotaurBT, ConfigMobs.bossminotaurBD, ConfigMobs.bossminotaurGCB) + .setIntelligence(3).throwBombs(); + public static MinotaurBreed FROST = new MinotaurBreed(frost, "frostminotaur", "White", null, 15, + ConfigMobs.minotaurHP, ConfigMobs.minotaurMD, ConfigMobs.minotaurGD, ConfigMobs.frostminotaurAR) + .setGrabs(ConfigMobs.minotaurDC, ConfigMobs.minotaurGC, ConfigMobs.minotaurTC) + .setBeserk(ConfigMobs.minotaurBT, ConfigMobs.minotaurBD, ConfigMobs.minotaurGCB).setLesser(); + public static MinotaurBreed FROSTGUARD = new MinotaurBreed(frost, "frostminotaur_guard", "GuardWhite", "iron", 25, + ConfigMobs.guardminotaurHP, ConfigMobs.guardminotaurMD, ConfigMobs.guardminotaurGD, + ConfigMobs.lightminotaurAR + ConfigMobs.frostminotaurAR) + .setGrabs(ConfigMobs.guardminotaurDC, ConfigMobs.guardminotaurGC, ConfigMobs.guardminotaurTC) + .setBeserk(ConfigMobs.guardminotaurBT, ConfigMobs.guardminotaurBD, ConfigMobs.guardminotaurGCB) + .setIntelligence(1); + public static MinotaurBreed FROSTELITE = new MinotaurBreed(frost, "frostminotaur_elite", "EliteWhite", "steel", 50, + ConfigMobs.eliteminotaurHP, ConfigMobs.eliteminotaurMD, ConfigMobs.eliteminotaurGD, + ConfigMobs.mediumminotaurAR + ConfigMobs.frostminotaurAR) + .setGrabs(ConfigMobs.eliteminotaurDC, ConfigMobs.eliteminotaurGC, ConfigMobs.eliteminotaurTC) + .setBeserk(ConfigMobs.eliteminotaurBT, ConfigMobs.eliteminotaurBD, ConfigMobs.eliteminotaurGCB) + .setIntelligence(2); + public static MinotaurBreed FROSTBOSS = new MinotaurBreed(frost, "frostminotaurr_boss", "BossWhite", "obsidian", + 120, ConfigMobs.bossminotaurHP, ConfigMobs.bossminotaurMD, ConfigMobs.bossminotaurGD, + ConfigMobs.heavyminotaurAR + ConfigMobs.frostminotaurAR) + .setGrabs(ConfigMobs.bossminotaurDC, ConfigMobs.bossminotaurGC, ConfigMobs.bossminotaurTC) + .setBeserk(ConfigMobs.bossminotaurBT, ConfigMobs.bossminotaurBD, ConfigMobs.bossminotaurGCB) + .setIntelligence(3).throwBombs(); + public static MinotaurBreed NETHER = new MinotaurBreed(nether, "dredminotaur", "Nether", null, 15, + ConfigMobs.minotaurHP, ConfigMobs.minotaurMD, ConfigMobs.minotaurGD, ConfigMobs.dreadminotaurAR) + .setGrabs(ConfigMobs.minotaurDC, ConfigMobs.minotaurGC, ConfigMobs.minotaurTC) + .setBeserk(ConfigMobs.minotaurBT, ConfigMobs.minotaurBD, ConfigMobs.minotaurGCB).setLesser(); + public static MinotaurBreed NETHERGUARD = new MinotaurBreed(nether, "dredminotaur_guard", "GuardNether", "iron", 25, + ConfigMobs.guardminotaurHP, ConfigMobs.guardminotaurMD, ConfigMobs.guardminotaurGD, + ConfigMobs.lightminotaurAR + ConfigMobs.dreadminotaurAR) + .setGrabs(ConfigMobs.guardminotaurDC, ConfigMobs.guardminotaurGC, ConfigMobs.guardminotaurTC) + .setBeserk(ConfigMobs.guardminotaurBT, ConfigMobs.guardminotaurBD, ConfigMobs.guardminotaurGCB) + .setIntelligence(1); + public static MinotaurBreed NETHERELITE = new MinotaurBreed(nether, "dredminotaur_elite", "EliteNether", "steel", + 50, ConfigMobs.eliteminotaurHP, ConfigMobs.eliteminotaurMD, ConfigMobs.eliteminotaurGD, + ConfigMobs.mediumminotaurAR + ConfigMobs.dreadminotaurAR) + .setGrabs(ConfigMobs.eliteminotaurDC, ConfigMobs.eliteminotaurGC, ConfigMobs.eliteminotaurTC) + .setBeserk(ConfigMobs.eliteminotaurBT, ConfigMobs.eliteminotaurBD, ConfigMobs.eliteminotaurGCB) + .setIntelligence(2); + public static MinotaurBreed NETHERBOSS = new MinotaurBreed(nether, "dredminotaur_boss", "BossNether", "obsidian", + 150, ConfigMobs.bossminotaurHP, ConfigMobs.bossminotaurMD, ConfigMobs.bossminotaurGD, + ConfigMobs.heavyminotaurAR + ConfigMobs.dreadminotaurAR) + .setGrabs(ConfigMobs.bossminotaurDC, ConfigMobs.bossminotaurGC, ConfigMobs.bossminotaurTC) + .setBeserk(ConfigMobs.bossminotaurBT, ConfigMobs.bossminotaurBD, ConfigMobs.bossminotaurGCB) + .setIntelligence(3).throwBombs(); + private static Random rand = new Random(); + public String name = "minotaur"; + public String tex = "Brown"; + public float health = 50; + public float poundDamage = 8; + public float goreDamage = 8; + public float beserkDamage = 12; + public int beserkThreshold = 40; + public int grabChance = 10; + public int grabChanceBeserk = 25; + public int throwChance = 20; + public int disarmChance = 10; + public ArrayList pool; + public int intelligenceLvl = 0; + + public int experienceValue; + public boolean isSpecial = true; + public String weaponTier; + public int armour_rating; + public boolean throwsBombs = false; + + public MinotaurBreed(ArrayList pool, String name, String tex, String weapons, int xp, float health, + float poundDamage, float goreDamage, int AR) { + this.pool = pool; + pool.add(this); + this.name = name; + this.tex = tex; + this.health = health; + this.poundDamage = poundDamage; + this.goreDamage = goreDamage; + this.beserkDamage = poundDamage * 1.5F; + this.weaponTier = weapons; + this.experienceValue = xp; + this.armour_rating = AR; + } + + public static int getRandomMinotaur(int species) { + return getRandomMinotaur(species == 1 ? MinotaurBreed.nether : MinotaurBreed.normal); + } + + public static int getRandomMinotaur(ArrayList pool) { + if (pool.size() <= 1) { + return 0; + } + return rand.nextInt(pool.size()); + } + + public static MinotaurBreed getBreed(int species, int id) { + return getBreed(species == 2 ? MinotaurBreed.frost : species == 1 ? MinotaurBreed.nether : MinotaurBreed.normal, + id); + } + + public static MinotaurBreed getBreed(ArrayList pool, int id) { + if (id >= pool.size()) { + id = (pool.size() - 1); + } + return pool.get(id); + } + + public static int getEnvironment(EntityMinotaur mob) { + return getEnvironment(mob.worldObj, (int) mob.posX, (int) mob.posZ, mob.dimension); + } + + public static int getEnvironment(World world, int x, int z, int dimension) { + if (dimension == -1) + return 1;// NETHER + + BiomeGenBase biome = world.getBiomeGenForCoords(x, z); + if (biome != null) { + if (biome.getEnableSnow() || biome.temperature <= 0.25F + || biome.getTempCategory() == BiomeGenBase.TempCategory.COLD) { + return 2;// FROST + } + } + return 0;// BROWN + } + + /** + * What environment is a particular structure + */ + public static int getEnvironment(String subtype) { + return subtype.equalsIgnoreCase("Frost") ? (byte) 2 : subtype.equalsIgnoreCase("Nether") ? (byte) 1 : (byte) 0; + } + + /** + * Set beserk stats + * + * @param threshold the percent (0-100) health where it triggers (Default 25%) + * @param damage (The damage done by melee) + * @param grabChance the percent (0-100) chance to grab enemies when beserked (Default + * 25%) + */ + public MinotaurBreed setBeserk(int threshold, float damage, int grabChance) { + this.beserkThreshold = threshold; + this.beserkDamage = damage; + this.grabChanceBeserk = grabChance; + return this; + } + + /** + * @param grabChance the percent (0-100) chance to disarm enemies with a power attack + * (Default 10%) + * @param grabChance the percent (0-100) chance to grab enemies (Default 10%) + * @param grabChance the percent (0-100) chance to throw grabbed enemies when hit + * (Default 20%) + * @return + */ + public MinotaurBreed setGrabs(int disarmChance, int grabChance, int throwChance) { + this.disarmChance = disarmChance; + this.grabChance = grabChance; + this.throwChance = throwChance; + return this; + } + + /** + * Set the intelligence for the mob 0 For docile... 1 For basic... 2 For Orderly + */ + public MinotaurBreed setIntelligence(int level) { + this.intelligenceLvl = level; + return this; + } + + /** + * Enables spawning and despawning + */ + public MinotaurBreed setLesser() { + this.isSpecial = false; + return this; + } + + public MinotaurBreed throwBombs() { + this.throwsBombs = true; + return this; + } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/PoisonBreath.java b/src/main/java/minefantasy/mf2/entity/mob/PoisonBreath.java index fe3ea8ac..1222e416 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/PoisonBreath.java +++ b/src/main/java/minefantasy/mf2/entity/mob/PoisonBreath.java @@ -13,67 +13,55 @@ import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.world.World; -public class PoisonBreath extends DragonBreath -{ +public class PoisonBreath extends DragonBreath { - public PoisonBreath(String name) - { - super(name); - } + public PoisonBreath(String name) { + super(name); + } - @Override - public DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter) - { - return shooter == null ? new DamageSource("acidblastBase") : (new EntityDamageSourceIndirect("acidblast", breath, shooter)); - } + @Override + public DamageSource getDamageSource(EntityDragonBreath breath, EntityLivingBase shooter) { + return shooter == null ? new DamageSource("acidblastBase") + : (new EntityDamageSourceIndirect("acidblast", breath, shooter)); + } - @Override - @SideOnly(Side.CLIENT) - public String getTexture(EntityDragonBreath instance) - { - return "textures/projectile/dragonbreath_poison"; - } - - public void onHitEntity(Entity target, EntityDragonBreath instance) - { - super.onHitEntity(target, instance); - if(target instanceof EntityLivingBase) - { - float dam = instance.getDamage(); - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(Potion.poison.id, 40, (int)dam)); - ((EntityLivingBase)target).addPotionEffect(new PotionEffect(Potion.confusion.id, 50, 10)); - - if(instance.rand.nextInt(10) == 0) - { - for(int a = 0; a < 5; a++) - { - ItemStack item = ((EntityLivingBase)target).getEquipmentInSlot(a); - if(item != null) - { - item.damageItem((int)dam, ((EntityLivingBase)target)); - if(item.getItemDamage() >= item.getMaxDamage()) - { - ((EntityLivingBase)target).renderBrokenItemStack(item); - ((EntityLivingBase)target).setCurrentItemOrArmor(a, null); - } - } - } - } - } - } - - @Override - public float modifyDamage(Entity hit, float dam) - { - if(hit instanceof EntityCogwork) - { - return dam * 2; - } - return dam; - } - - @Override - public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) - { - } + @Override + @SideOnly(Side.CLIENT) + public String getTexture(EntityDragonBreath instance) { + return "textures/projectile/dragonbreath_poison"; + } + + public void onHitEntity(Entity target, EntityDragonBreath instance) { + super.onHitEntity(target, instance); + if (target instanceof EntityLivingBase) { + float dam = instance.getDamage(); + ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.poison.id, 40, (int) dam)); + ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.confusion.id, 50, 10)); + + if (instance.rand.nextInt(10) == 0) { + for (int a = 0; a < 5; a++) { + ItemStack item = ((EntityLivingBase) target).getEquipmentInSlot(a); + if (item != null) { + item.damageItem((int) dam, ((EntityLivingBase) target)); + if (item.getItemDamage() >= item.getMaxDamage()) { + ((EntityLivingBase) target).renderBrokenItemStack(item); + ((EntityLivingBase) target).setCurrentItemOrArmor(a, null); + } + } + } + } + } + } + + @Override + public float modifyDamage(Entity hit, float dam) { + if (hit instanceof EntityCogwork) { + return dam * 2; + } + return dam; + } + + @Override + public void hitBlock(World world, EntityDragonBreath instance, int x, int y, int z, boolean impact) { + } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/ai/AI_CommonSprint.java b/src/main/java/minefantasy/mf2/entity/mob/ai/AI_CommonSprint.java index cc48557d..14355540 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/ai/AI_CommonSprint.java +++ b/src/main/java/minefantasy/mf2/entity/mob/ai/AI_CommonSprint.java @@ -5,41 +5,36 @@ import net.minecraft.pathfinding.PathEntity; import net.minecraft.pathfinding.PathPoint; -public class AI_CommonSprint extends EntityAIBase -{ - public EntityLiving entity; - public float range; - public AI_CommonSprint(EntityLiving entity, float range) - { - this.entity = entity; - this.range = range; - } - @Override - public boolean shouldExecute() - { - return !this.entity.isChild(); - } - - @Override - public void updateTask() - { - double distance = 0; - PathEntity path = this.entity.getNavigator().getPath(); - if(path != null) - { - PathPoint end = path.getFinalPathPoint(); - if(path != null) - { - distance = this.entity.getDistanceSq(end.xCoord, end.yCoord, end.zCoord); - } - - } - boolean isSprinting = this.entity.isSprinting(); - boolean shouldSprint = distance >= this.range; - if(isSprinting != shouldSprint) - { - this.entity.setSprinting(shouldSprint); - } +public class AI_CommonSprint extends EntityAIBase { + public EntityLiving entity; + public float range; + + public AI_CommonSprint(EntityLiving entity, float range) { + this.entity = entity; + this.range = range; + } + + @Override + public boolean shouldExecute() { + return !this.entity.isChild(); + } + + @Override + public void updateTask() { + double distance = 0; + PathEntity path = this.entity.getNavigator().getPath(); + if (path != null) { + PathPoint end = path.getFinalPathPoint(); + if (path != null) { + distance = this.entity.getDistanceSq(end.xCoord, end.yCoord, end.zCoord); + } + + } + boolean isSprinting = this.entity.isSprinting(); + boolean shouldSprint = distance >= this.range; + if (isSprinting != shouldSprint) { + this.entity.setSprinting(shouldSprint); + } } } diff --git a/src/main/java/minefantasy/mf2/entity/mob/ai/AI_MinotaurFindTarget.java b/src/main/java/minefantasy/mf2/entity/mob/ai/AI_MinotaurFindTarget.java index e922fbb3..e7b3ee39 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/ai/AI_MinotaurFindTarget.java +++ b/src/main/java/minefantasy/mf2/entity/mob/ai/AI_MinotaurFindTarget.java @@ -1,53 +1,47 @@ package minefantasy.mf2.entity.mob.ai; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - import minefantasy.mf2.entity.mob.EntityMinotaur; import net.minecraft.command.IEntitySelector; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAITarget; -public class AI_MinotaurFindTarget extends EntityAITarget -{ +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class AI_MinotaurFindTarget extends EntityAITarget { private final Class targetClass; private final int targetChance; private final AI_MinotaurFindTarget.Sorter theNearestAttackableTargetSorter; private final IEntitySelector targetEntitySelector; - private EntityLivingBase targetEntity; - private final EntityMinotaur minotaur; + private EntityLivingBase targetEntity; - public AI_MinotaurFindTarget(EntityMinotaur mob, Class target, int chance, boolean sight) - { + public AI_MinotaurFindTarget(EntityMinotaur mob, Class target, int chance, boolean sight) { this(mob, target, chance, sight, false); } - public AI_MinotaurFindTarget(EntityMinotaur mob, Class target, int chance, boolean sight, boolean nearby) - { - this(mob, target, chance, sight, nearby, (IEntitySelector)null); + public AI_MinotaurFindTarget(EntityMinotaur mob, Class target, int chance, boolean sight, boolean nearby) { + this(mob, target, chance, sight, nearby, (IEntitySelector) null); } - public AI_MinotaurFindTarget(EntityMinotaur mob, Class target, int chance, boolean sight, boolean nearby, final IEntitySelector selector) - { + public AI_MinotaurFindTarget(EntityMinotaur mob, Class target, int chance, boolean sight, boolean nearby, + final IEntitySelector selector) { super(mob, sight, nearby); this.minotaur = mob; this.targetClass = target; this.targetChance = chance; this.theNearestAttackableTargetSorter = new AI_MinotaurFindTarget.Sorter(mob); this.setMutexBits(1); - this.targetEntitySelector = new IEntitySelector() - { - public boolean isEntityApplicable(Entity target) - { - if(target instanceof EntityMinotaur) - { - return false; - } - return !(target instanceof EntityLivingBase) ? false : (selector != null && !selector.isEntityApplicable(target) ? false : AI_MinotaurFindTarget.this.isSuitableTarget((EntityLivingBase)target, false)); + this.targetEntitySelector = new IEntitySelector() { + public boolean isEntityApplicable(Entity target) { + if (target instanceof EntityMinotaur) { + return false; + } + return !(target instanceof EntityLivingBase) ? false + : (selector != null && !selector.isEntityApplicable(target) ? false + : AI_MinotaurFindTarget.this.isSuitableTarget((EntityLivingBase) target, false)); } }; } @@ -55,33 +49,26 @@ public boolean isEntityApplicable(Entity target) /** * Returns whether the EntityAIBase should begin execution. */ - public boolean shouldExecute() - { - if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0) - { + public boolean shouldExecute() { + if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0) { return false; - } - else - { + } else { double d0 = this.getTargetDistance(); - if(minotaur.isDocile())//Docile are less aggro when calm + if (minotaur.isDocile())// Docile are less aggro when calm { - if(minotaur.getRageLevel() < 10) - { - d0 = 1.5D; - } + if (minotaur.getRageLevel() < 10) { + d0 = 1.5D; + } } - - List list = this.taskOwner.worldObj.selectEntitiesWithinAABB(this.targetClass, this.taskOwner.boundingBox.expand(d0, 4.0D, d0), this.targetEntitySelector); + + List list = this.taskOwner.worldObj.selectEntitiesWithinAABB(this.targetClass, + this.taskOwner.boundingBox.expand(d0, 4.0D, d0), this.targetEntitySelector); Collections.sort(list, this.theNearestAttackableTargetSorter); - if (list.isEmpty()) - { + if (list.isEmpty()) { return false; - } - else - { - this.targetEntity = (EntityLivingBase)list.get(0); + } else { + this.targetEntity = (EntityLivingBase) list.get(0); return true; } } @@ -90,31 +77,26 @@ public boolean shouldExecute() /** * Execute a one shot task or start executing a continuous task */ - public void startExecuting() - { + public void startExecuting() { this.taskOwner.setAttackTarget(this.targetEntity); super.startExecuting(); } - public static class Sorter implements Comparator - { - private final Entity theEntity; + public static class Sorter implements Comparator { + private final Entity theEntity; - public Sorter(Entity p_i1662_1_) - { - this.theEntity = p_i1662_1_; - } + public Sorter(Entity p_i1662_1_) { + this.theEntity = p_i1662_1_; + } - public int compare(Entity p_compare_1_, Entity p_compare_2_) - { - double d0 = this.theEntity.getDistanceSqToEntity(p_compare_1_); - double d1 = this.theEntity.getDistanceSqToEntity(p_compare_2_); - return d0 < d1 ? -1 : (d0 > d1 ? 1 : 0); - } + public int compare(Entity p_compare_1_, Entity p_compare_2_) { + double d0 = this.theEntity.getDistanceSqToEntity(p_compare_1_); + double d1 = this.theEntity.getDistanceSqToEntity(p_compare_2_); + return d0 < d1 ? -1 : (d0 > d1 ? 1 : 0); + } - public int compare(Object p_compare_1_, Object p_compare_2_) - { - return this.compare((Entity)p_compare_1_, (Entity)p_compare_2_); - } + public int compare(Object p_compare_1_, Object p_compare_2_) { + return this.compare((Entity) p_compare_1_, (Entity) p_compare_2_); } + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/mob/ai/hound/AI_HoundBeg.java b/src/main/java/minefantasy/mf2/entity/mob/ai/hound/AI_HoundBeg.java index 70cacbf8..9003e1be 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/ai/hound/AI_HoundBeg.java +++ b/src/main/java/minefantasy/mf2/entity/mob/ai/hound/AI_HoundBeg.java @@ -7,17 +7,15 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class AI_HoundBeg extends EntityAIBase -{ +public class AI_HoundBeg extends EntityAIBase { + private static final String __OBFID = "CL_00001576"; private EntityHound theWolf; private EntityPlayer thePlayer; private World worldObject; private float minPlayerDistance; private int field_75384_e; - private static final String __OBFID = "CL_00001576"; - public AI_HoundBeg(EntityHound p_i1617_1_, float p_i1617_2_) - { + public AI_HoundBeg(EntityHound p_i1617_1_, float p_i1617_2_) { this.theWolf = p_i1617_1_; this.worldObject = p_i1617_1_.worldObj; this.minPlayerDistance = p_i1617_2_; @@ -27,25 +25,25 @@ public AI_HoundBeg(EntityHound p_i1617_1_, float p_i1617_2_) /** * Returns whether the EntityAIBase should begin execution. */ - public boolean shouldExecute() - { - this.thePlayer = this.worldObject.getClosestPlayerToEntity(this.theWolf, (double)this.minPlayerDistance); + public boolean shouldExecute() { + this.thePlayer = this.worldObject.getClosestPlayerToEntity(this.theWolf, this.minPlayerDistance); return this.thePlayer == null ? false : this.hasPlayerGotBoneInHand(this.thePlayer); } /** * Returns whether an in-progress EntityAIBase should continue executing */ - public boolean continueExecuting() - { - return !this.thePlayer.isEntityAlive() ? false : (this.theWolf.getDistanceSqToEntity(this.thePlayer) > (double)(this.minPlayerDistance * this.minPlayerDistance) ? false : this.field_75384_e > 0 && this.hasPlayerGotBoneInHand(this.thePlayer)); + public boolean continueExecuting() { + return !this.thePlayer.isEntityAlive() ? false + : (this.theWolf.getDistanceSqToEntity(this.thePlayer) > this.minPlayerDistance * this.minPlayerDistance + ? false + : this.field_75384_e > 0 && this.hasPlayerGotBoneInHand(this.thePlayer)); } /** * Execute a one shot task or start executing a continuous task */ - public void startExecuting() - { + public void startExecuting() { this.theWolf.func_70918_i(true); this.field_75384_e = 40 + this.theWolf.getRNG().nextInt(40); } @@ -53,8 +51,7 @@ public void startExecuting() /** * Resets the task */ - public void resetTask() - { + public void resetTask() { this.theWolf.func_70918_i(false); this.thePlayer = null; } @@ -62,18 +59,20 @@ public void resetTask() /** * Updates the task */ - public void updateTask() - { - this.theWolf.getLookHelper().setLookPosition(this.thePlayer.posX, this.thePlayer.posY + (double)this.thePlayer.getEyeHeight(), this.thePlayer.posZ, 10.0F, (float)this.theWolf.getVerticalFaceSpeed()); + public void updateTask() { + this.theWolf.getLookHelper().setLookPosition(this.thePlayer.posX, + this.thePlayer.posY + this.thePlayer.getEyeHeight(), this.thePlayer.posZ, 10.0F, + this.theWolf.getVerticalFaceSpeed()); --this.field_75384_e; } /** * Gets if the Player has the Bone in the hand. */ - private boolean hasPlayerGotBoneInHand(EntityPlayer p_75382_1_) - { + private boolean hasPlayerGotBoneInHand(EntityPlayer p_75382_1_) { ItemStack itemstack = p_75382_1_.inventory.getCurrentItem(); - return itemstack == null ? false : (!this.theWolf.isTamed() && itemstack.getItem() == Items.bone ? true : this.theWolf.isBreedingItem(itemstack)); + return itemstack == null ? false + : (!this.theWolf.isTamed() && itemstack.getItem() == Items.bone ? true + : this.theWolf.isBreedingItem(itemstack)); } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/entity/mob/ai/hound/AI_HoundFollow.java b/src/main/java/minefantasy/mf2/entity/mob/ai/hound/AI_HoundFollow.java index 273d84a4..3dce898d 100644 --- a/src/main/java/minefantasy/mf2/entity/mob/ai/hound/AI_HoundFollow.java +++ b/src/main/java/minefantasy/mf2/entity/mob/ai/hound/AI_HoundFollow.java @@ -7,20 +7,18 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class AI_HoundFollow extends EntityAIBase -{ +public class AI_HoundFollow extends EntityAIBase { + World theWorld; + float maxDist; + float minDist; private EntityHound thePet; private EntityLivingBase theOwner; - World theWorld; private double field_75336_f; private PathNavigate petPathfinder; private int field_75343_h; - float maxDist; - float minDist; private boolean field_75344_i; - public AI_HoundFollow(EntityHound dog, double p_i1625_2_, float min, float max) - { + public AI_HoundFollow(EntityHound dog, double p_i1625_2_, float min, float max) { this.thePet = dog; this.theWorld = dog.worldObj; this.field_75336_f = p_i1625_2_; @@ -33,24 +31,16 @@ public AI_HoundFollow(EntityHound dog, double p_i1625_2_, float min, float max) /** * Returns whether the EntityAIBase should begin execution. */ - public boolean shouldExecute() - { + public boolean shouldExecute() { EntityLivingBase entitylivingbase = this.thePet.getOwner(); - if (entitylivingbase == null) - { + if (entitylivingbase == null) { return false; - } - else if (this.thePet.isSitting()) - { + } else if (this.thePet.isSitting()) { return false; - } - else if (this.thePet.getDistanceSqToEntity(entitylivingbase) < (double)(this.minDist * this.minDist)) - { + } else if (this.thePet.getDistanceSqToEntity(entitylivingbase) < this.minDist * this.minDist) { return false; - } - else - { + } else { this.theOwner = entitylivingbase; return true; } @@ -59,16 +49,16 @@ else if (this.thePet.getDistanceSqToEntity(entitylivingbase) < (double)(this.min /** * Returns whether an in-progress EntityAIBase should continue executing */ - public boolean continueExecuting() - { - return !this.petPathfinder.noPath() && this.thePet.getDistanceSqToEntity(this.theOwner) > (double)(this.maxDist * this.maxDist) && !this.thePet.isSitting(); + public boolean continueExecuting() { + return !this.petPathfinder.noPath() + && this.thePet.getDistanceSqToEntity(this.theOwner) > this.maxDist * this.maxDist + && !this.thePet.isSitting(); } /** * Execute a one shot task or start executing a continuous task */ - public void startExecuting() - { + public void startExecuting() { this.field_75343_h = 0; this.field_75344_i = this.thePet.getNavigator().getAvoidsWater(); this.thePet.getNavigator().setAvoidsWater(false); @@ -77,8 +67,7 @@ public void startExecuting() /** * Resets the task */ - public void resetTask() - { + public void resetTask() { this.theOwner = null; this.petPathfinder.clearPathEntity(); this.thePet.getNavigator().setAvoidsWater(this.field_75344_i); @@ -87,33 +76,29 @@ public void resetTask() /** * Updates the task */ - public void updateTask() - { - this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float)this.thePet.getVerticalFaceSpeed()); + public void updateTask() { + this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, this.thePet.getVerticalFaceSpeed()); - if (!this.thePet.isSitting() && this.thePet.shouldFollowOwner()) - { - if (--this.field_75343_h <= 0) - { + if (!this.thePet.isSitting() && this.thePet.shouldFollowOwner()) { + if (--this.field_75343_h <= 0) { this.field_75343_h = 10; - if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.field_75336_f)) - { - if (!this.thePet.getLeashed()) - { - if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)//Teleport + if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.field_75336_f)) { + if (!this.thePet.getLeashed()) { + if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)// Teleport { int i = MathHelper.floor_double(this.theOwner.posX) - 2; int j = MathHelper.floor_double(this.theOwner.posZ) - 2; int k = MathHelper.floor_double(this.theOwner.boundingBox.minY); - for (int l = 0; l <= 4; ++l) - { - for (int i1 = 0; i1 <= 4; ++i1) - { - if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && World.doesBlockHaveSolidTopSurface(this.theWorld, i + l, k - 1, j + i1) && !this.theWorld.getBlock(i + l, k, j + i1).isNormalCube() && !this.theWorld.getBlock(i + l, k + 1, j + i1).isNormalCube()) - { - this.thePet.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch); + for (int l = 0; l <= 4; ++l) { + for (int i1 = 0; i1 <= 4; ++i1) { + if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) + && World.doesBlockHaveSolidTopSurface(this.theWorld, i + l, k - 1, j + i1) + && !this.theWorld.getBlock(i + l, k, j + i1).isNormalCube() + && !this.theWorld.getBlock(i + l, k + 1, j + i1).isNormalCube()) { + this.thePet.setLocationAndAngles(i + l + 0.5F, k, j + i1 + 0.5F, + this.thePet.rotationYaw, this.thePet.rotationPitch); this.petPathfinder.clearPathEntity(); return; } diff --git a/src/main/java/minefantasy/mf2/farming/FarmingHelper.java b/src/main/java/minefantasy/mf2/farming/FarmingHelper.java index 0c2783ff..73b86666 100644 --- a/src/main/java/minefantasy/mf2/farming/FarmingHelper.java +++ b/src/main/java/minefantasy/mf2/farming/FarmingHelper.java @@ -1,7 +1,5 @@ package minefantasy.mf2.farming; -import java.util.Random; - import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.farming.CustomHoeEntry; import net.minecraft.item.Item.ToolMaterial; @@ -9,57 +7,46 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class FarmingHelper -{ - private static Random rand = new Random(); - private static float hoeFailChanceModifier = 1.0F; - - - public static boolean isEnabled = true; - - public static float hoeFailChanceCfg = 1.0F; - public static float farmBreakCfg = 1.0F; - - public static boolean didHoeFail(ItemStack hoe, World world, boolean grass) - { - if(!isEnabled) - { - return false; - } - float chanceMax = 30F*hoeFailChanceModifier*hoeFailChanceCfg; - float chance = rand.nextFloat()*chanceMax; - float efficiency = (getHoeEfficiency(hoe)*(grass ? 2.0F : 3.0F)); - - MineFantasyAPI.debugMsg("Hoe Chance Fail = " + chance + " / " + efficiency + " (max= " + chanceMax + ")"); - return chance > efficiency;//Dirt is easier to hoe - } - - public static boolean didHarvestRuinBlock(World world, boolean scythe) - { - if(!isEnabled) - { - return false; - } - float chance = 20F + (world.difficultySetting.getDifficultyId()*10F); - if(scythe)chance *= 2F; - return rand.nextFloat()*100F <= chance*farmBreakCfg ; - } - - private static float getHoeEfficiency(ItemStack hoe) - { - if(hoe != null) - { - if(hoe.getItem() instanceof ItemHoe) - { - String name = ((ItemHoe)hoe.getItem()).getToolMaterialName(); - ToolMaterial mat = ToolMaterial.valueOf(name); - - if(mat != null) - { - return CustomHoeEntry.getEntryEfficiency(hoe, mat.getEfficiencyOnProperMaterial()); - } - } - } - return CustomHoeEntry.getEntryEfficiency(hoe, 6.0F); - } +import java.util.Random; + +public class FarmingHelper { + public static boolean isEnabled = true; + public static float hoeFailChanceCfg = 1.0F; + public static float farmBreakCfg = 1.0F; + private static Random rand = new Random(); + private static float hoeFailChanceModifier = 1.0F; + + public static boolean didHoeFail(ItemStack hoe, World world, boolean grass) { + if (!isEnabled) { + return false; + } + float chanceMax = 30F * hoeFailChanceModifier * hoeFailChanceCfg; + float chance = rand.nextFloat() * chanceMax; + float efficiency = (getHoeEfficiency(hoe) * (grass ? 2.0F : 3.0F)); + + MineFantasyAPI.debugMsg("Hoe Chance Fail = " + chance + " / " + efficiency + " (max= " + chanceMax + ")"); + return chance > efficiency;// Dirt is easier to hoe + } + + public static boolean didHarvestRuinBlock(World world, boolean scythe) { + if (!isEnabled) { + return false; + } + float chance = 20F + (world.difficultySetting.getDifficultyId() * 10F); + if (scythe) + chance *= 2F; + return rand.nextFloat() * 100F <= chance * farmBreakCfg; + } + + private static float getHoeEfficiency(ItemStack hoe) { + if (hoe != null && hoe.getItem() instanceof ItemHoe) { + String name = ((ItemHoe) hoe.getItem()).getToolMaterialName(); + ToolMaterial mat = ToolMaterial.valueOf(name); + + if (mat != null) { + return CustomHoeEntry.getEntryEfficiency(hoe, mat.getEfficiencyOnProperMaterial()); + } + } + return CustomHoeEntry.getEntryEfficiency(hoe, 6.0F); + } } diff --git a/src/main/java/minefantasy/mf2/hunger/HungerSystemMF.java b/src/main/java/minefantasy/mf2/hunger/HungerSystemMF.java index 376078e5..bbfaf925 100644 --- a/src/main/java/minefantasy/mf2/hunger/HungerSystemMF.java +++ b/src/main/java/minefantasy/mf2/hunger/HungerSystemMF.java @@ -1,119 +1,100 @@ package minefantasy.mf2.hunger; -import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.api.MineFantasyAPI; -import net.minecraft.entity.player.EntityPlayer; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; +import minefantasy.mf2.api.MineFantasyAPI; +import net.minecraft.entity.player.EntityPlayer; + +public class HungerSystemMF { + private static final String prevFoodNBT = "MF_previousFoodLevel"; + private static final String tempFoodNBT = "MF_tempFood"; + private static final String saturationNBT = "MF_saturationTicks"; + public static int slowdownRate = 3; -public class HungerSystemMF -{ - private static final String prevFoodNBT = "MF_previousFoodLevel"; - private static final String tempFoodNBT = "MF_tempFood"; - private static final String saturationNBT = "MF_saturationTicks"; - @SubscribeEvent - public void onPlayerTick(TickEvent.PlayerTickEvent event) - { - if(!event.player.worldObj.isRemote) - { - if(event.phase == TickEvent.Phase.START) - { - event.player.getEntityData().setInteger(prevFoodNBT, event.player.getFoodStats().getFoodLevel()); - } - if(event.phase == TickEvent.Phase.END) - { - slowHunger(event.player); - } + public static void setSaturation(EntityPlayer user, float value) { + user.getEntityData().setFloat(saturationNBT, value); + } + + public static float getSaturation(EntityPlayer user) { + if (user.getEntityData().hasKey(saturationNBT)) { + return user.getEntityData().getFloat(saturationNBT); } - } - - public void slowHunger(EntityPlayer player) - { - //init vars - int food = player.getFoodStats().getFoodLevel(); - - int prevFood = food; - if(player.getEntityData().hasKey(prevFoodNBT)) - { - prevFood = player.getEntityData().getInteger(prevFoodNBT); - } - - if(food < prevFood) - { - float sat = getSaturation(player); - float temp = getTempFood(player); - MineFantasyAPI.debugMsg("Saturation: " + sat + " Temp: " + temp); - - if(slowdownRate < 0 || temp > 0) - { - MineFantasyAPI.debugMsg("Hunger drop cancelled: Temp"); - setTempFood(player, temp-1); - player.getFoodStats().addStats(1, 0.0F); - } - else if(sat > 0) - { - decrSaturation(player); - MineFantasyAPI.debugMsg("Hunger drop cancelled: Sat = " + (sat-1)); - player.getFoodStats().addStats(1, 0.0F); - } - - if(temp <= 0) - { - setTempFood(player, getTempSlowdownLvl(player)); - } - } + return 0F; + } + + public static void setTempFood(EntityPlayer user, float value) { + user.getEntityData().setFloat(tempFoodNBT, value); + } + + public static float getTempFood(EntityPlayer user) { + if (user.getEntityData().hasKey(tempFoodNBT)) { + return user.getEntityData().getFloat(tempFoodNBT); + } + return 0F; + } + + public static void decrSaturation(EntityPlayer user) { + float sat = getSaturation(user); + sat--; + if (sat < 0) { + sat = -1; + } + if (!user.worldObj.isRemote) { + setSaturation(user, sat); + } + } + + public static void applySaturation(EntityPlayer consumer, float newValue) { + float value = getSaturation(consumer); + + if (newValue > value) { + setSaturation(consumer, newValue); + } + } + + @SubscribeEvent + public void onPlayerTick(TickEvent.PlayerTickEvent event) { + if (!event.player.worldObj.isRemote) { + if (event.phase == TickEvent.Phase.START) { + event.player.getEntityData().setInteger(prevFoodNBT, event.player.getFoodStats().getFoodLevel()); + } + if (event.phase == TickEvent.Phase.END) { + slowHunger(event.player); + } + } + } + + public void slowHunger(EntityPlayer player) { + // init vars + int food = player.getFoodStats().getFoodLevel(); + + int prevFood = food; + if (player.getEntityData().hasKey(prevFoodNBT)) { + prevFood = player.getEntityData().getInteger(prevFoodNBT); + } + + if (food < prevFood) { + float sat = getSaturation(player); + float temp = getTempFood(player); + MineFantasyAPI.debugMsg("Saturation: " + sat + " Temp: " + temp); + + if (slowdownRate < 0 || temp > 0) { + MineFantasyAPI.debugMsg("Hunger drop cancelled: Temp"); + setTempFood(player, temp - 1); + player.getFoodStats().addStats(1, 0.0F); + } else if (sat > 0) { + decrSaturation(player); + MineFantasyAPI.debugMsg("Hunger drop cancelled: Sat = " + (sat - 1)); + player.getFoodStats().addStats(1, 0.0F); + } + + if (temp <= 0) { + setTempFood(player, getTempSlowdownLvl(player)); + } + } + } + + private float getTempSlowdownLvl(EntityPlayer player) { + return slowdownRate; } - - private float getTempSlowdownLvl(EntityPlayer player) - { - return slowdownRate; - } - public static int slowdownRate = 3; - - public static void setSaturation(EntityPlayer user, float value) - { - user.getEntityData().setFloat(saturationNBT, value); - } - public static float getSaturation(EntityPlayer user) - { - if(user.getEntityData().hasKey(saturationNBT)) - { - return user.getEntityData().getFloat(saturationNBT); - } - return 0F; - } - public static void setTempFood(EntityPlayer user, float value) - { - user.getEntityData().setFloat(tempFoodNBT, value); - } - public static float getTempFood(EntityPlayer user) - { - if(user.getEntityData().hasKey(tempFoodNBT)) - { - return user.getEntityData().getFloat(tempFoodNBT); - } - return 0F; - } - public static void decrSaturation(EntityPlayer user) - { - float sat = getSaturation(user); - sat --; - if(sat < 0) - { - sat = -1; - } - if(!user.worldObj.isRemote) - { - setSaturation(user, sat); - } - } - public static void applySaturation(EntityPlayer consumer, float newValue) - { - float value = getSaturation(consumer); - - if(newValue > value) - { - setSaturation(consumer, newValue); - } - } } diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/MTCommands.java b/src/main/java/minefantasy/mf2/integration/minetweaker/MTCommands.java new file mode 100644 index 00000000..20a64a92 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/MTCommands.java @@ -0,0 +1,46 @@ +package minefantasy.mf2.integration.minetweaker; + +import minefantasy.mf2.api.material.CustomMaterial; +import minefantasy.mf2.api.rpg.RPGElements; +import minefantasy.mf2.api.rpg.Skill; +import minetweaker.MineTweakerAPI; +import minetweaker.MineTweakerImplementationAPI; +import minetweaker.api.player.IPlayer; +import minetweaker.api.server.ICommandFunction; +import scala.actors.threadpool.Arrays; + +import java.util.Map; + +public class MTCommands implements ICommandFunction { + + @Override + public void execute(String[] arguments, IPlayer player) { + if (arguments.length < 1) { + player.sendChat("Please, specify a MF command"); + return; + } + + if (arguments[0].equals("materials")) { + MineTweakerAPI.logCommand("MineFantasy materials list:"); + for (Map.Entry entry : CustomMaterial.materialList.entrySet()) { + CustomMaterial material = entry.getValue(); + MineTweakerAPI.logCommand(String.format(" %s (type: %s, color (RGB): %s, tier: %d, hardness: %.2f, durability: %.2f, flexibility: %.2f, sharpness: %.2f, resistance: %.2f, density: %.2f)", material.name, material.type, Arrays.toString(material.colourRGB), material.tier, material.hardness, material.durability, material.flexibility, material.sharpness, material.resistance, material.density)); + } + + if (player != null) { + player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Materials list generated; see minetweaker.log in your minecraft dir")); + } + } + if (arguments[0].equals("skills")) { + MineTweakerAPI.logCommand("MineFantasy skills list:"); + + for (Skill skill : RPGElements.skillsList) { + MineTweakerAPI.logCommand(String.format("Skill %s registered as %s", skill.getDisplayName(), skill.skillName)); + } + + if (player != null) { + player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Skills list generated; see minetweaker.log in your minecraft dir")); + } + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/MTCompat.java b/src/main/java/minefantasy/mf2/integration/minetweaker/MTCompat.java new file mode 100644 index 00000000..d5391c1e --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/MTCompat.java @@ -0,0 +1,47 @@ +package minefantasy.mf2.integration.minetweaker; + +import cpw.mods.fml.common.Optional; +import minefantasy.mf2.integration.minetweaker.tweakers.*; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; + +public class MTCompat { + + private static final String[] COMMAND_DESC = { + "MineFantasy commands:", + " /minetweaker mf materials", + " Lists all MF materials", + " /minetweaker mf skills", + " Lists all MF skills" + }; + + public static void loadTweakers() { + MineTweakerAPI.registerClass(Anvil.class); + MineTweakerAPI.registerClass(Bloomery.class); + MineTweakerAPI.registerClass(BigFurnace.class); + MineTweakerAPI.registerClass(BlastFurnace.class); + MineTweakerAPI.registerClass(CarpentersBench.class); + MineTweakerAPI.registerClass(Cooking.class); + MineTweakerAPI.registerClass(Crucible.class); + MineTweakerAPI.registerClass(Forge.class); + MineTweakerAPI.registerClass(TanningRack.class); + MineTweakerAPI.registerClass(Quern.class); + MineTweakerAPI.registerClass(SalvageTweaker.class); + MineTweakerAPI.registerRemover(new MFRecipeRemover()); + } + + public static void registerCommands() { + MineTweakerAPI.server.addMineTweakerCommand("mf", COMMAND_DESC, new MTCommands()); + } + + @Optional.Interface(iface = "minetweaker.IRecipeRemover", modid = "MineTweaker3") + public static class MFRecipeRemover implements minetweaker.IRecipeRemover { + @Optional.Method(modid = "MineTweaker3") + @Override + public void remove(IIngredient iIngredient) { + Bloomery.remove(iIngredient, null); + Quern.remove(iIngredient, null); + TanningRack.remove(iIngredient, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedAlloyRecipe.java b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedAlloyRecipe.java new file mode 100644 index 00000000..9eea79bb --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedAlloyRecipe.java @@ -0,0 +1,59 @@ +package minefantasy.mf2.integration.minetweaker.helpers; + +import minefantasy.mf2.api.refine.Alloy; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class TweakedAlloyRecipe extends Alloy { + + public TweakedAlloyRecipe(IItemStack output, int requiredLevel, List items) { + super(MineTweakerMC.getItemStack(output), requiredLevel, items); + } + + @Override + public boolean matches(ItemStack[] inv) { + ArrayList check = new ArrayList(recipeItems); + ArrayList check2 = new ArrayList(recipeItems); + for (ItemStack stack : inv) { + if (stack != null) { + boolean matches = false; + Iterator it = check.iterator(); + while (it.hasNext()) { + IIngredient ingred = (IIngredient) it.next(); + for (IItemStack i : ingred.getItems()) { + ItemStack is = MineTweakerMC.getItemStack(i); + if (stack.isItemEqual(is) && (is.getItemDamage() == OreDictionary.WILDCARD_VALUE + || is.getItemDamage() == stack.getItemDamage())) { + matches = true; + check2.remove(ingred); + break; + } + if (areBothCarbon(is, stack)) { + matches = true; + check2.remove(ingred); + break; + } + } + if (matches) + break; + } + if (!matches) + return false; + } + } + boolean empty = true; + for (Object o : check2) { + if (o != null) + empty = false; + } + return empty; + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapedAnvilRecipe.java b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapedAnvilRecipe.java new file mode 100644 index 00000000..82fdeef3 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapedAnvilRecipe.java @@ -0,0 +1,144 @@ +package minefantasy.mf2.integration.minetweaker.helpers; + +import minefantasy.mf2.api.crafting.anvil.AnvilCraftMatrix; +import minefantasy.mf2.api.crafting.anvil.IAnvilRecipe; +import minefantasy.mf2.api.rpg.Skill; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; + +import java.util.List; + +public class TweakedShapedAnvilRecipe implements IAnvilRecipe { + + private int hammer, anvil, time, recipeWidth, recipeHeight; + private float exp; + private IItemStack result; + private IIngredient[][] ingredients; + private Skill skill; + private String research, tool; + private boolean hot; + + public TweakedShapedAnvilRecipe(IIngredient[][] input, IItemStack output, String tool, int time, int hammer, + int anvil, float exp, boolean hot, String research, Skill skill) { + this.ingredients = input; + this.result = output; + this.tool = tool; + this.hammer = hammer; + this.anvil = anvil; + this.exp = exp; + this.hot = hot; + this.research = research; + this.skill = skill; + this.time = time; + calculateRecipeSize(); + } + + @Override + public int getAnvil() { + return anvil; + } + + @Override + public int getCraftTime() { + return time; + } + + @Override + public ItemStack getCraftingResult(AnvilCraftMatrix arg0) { + return this.getRecipeOutput().copy(); + } + + @Override + public float getExperiance() { + return exp; + } + + @Override + public int getRecipeHammer() { + return hammer; + } + + @Override + public ItemStack getRecipeOutput() { + return MineTweakerMC.getItemStack(result).copy(); + } + + @Override + public int getRecipeSize() { + return this.recipeWidth * this.recipeHeight; + } + + @Override + public String getResearch() { + return research; + } + + @Override + public Skill getSkill() { + return this.skill; + } + + @Override + public String getToolType() { + return tool; + } + + @Override + public boolean matches(AnvilCraftMatrix matrix) { + for (int x = 0; x <= this.recipeWidth; ++x) { + for (int y = 0; y <= this.recipeHeight; ++y) { + ItemStack inputItem = matrix.getStackInRowAndColumn(x, y); + /*if(x >= this.recipeWidth || y >= this.recipeHeight) { + return false; + }*/ + + if (inputItem == null && ingredients[x][y] != null || inputItem != null && ingredients[x][y] == null) { + return false; + } + + IIngredient recipeStack = ingredients[x][y]; + + if (!isInList(inputItem, ingredients[x][y].getItems())) { + return false; + } + } + } + + return true; + } + + private boolean isInList(ItemStack inputStack, List items) { + for (IItemStack i : items) { + ItemStack recipeStack = MineTweakerMC.getItemStack(i); + if (inputStack.getItem() == recipeStack.getItem() && inputStack.getItemDamage() == recipeStack.getItemDamage()) { + /*if (!CustomToolHelper.doesMatchForRecipe(inputStack, recipeStack)) { + return false; + }*/ + return true; + } + } + return false; + } + + private void calculateRecipeSize() { + this.recipeHeight = this.ingredients.length; + for (int x = 0; x < this.recipeHeight; x++) { + if (this.ingredients[x] != null && this.ingredients[x].length > this.recipeWidth) { + this.recipeWidth = this.ingredients[x].length; + } + } + } + + @Override + public boolean outputHot() { + return hot; + } + + @Override + public boolean useCustomTiers() { + return false; + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapedCBRecipes.java b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapedCBRecipes.java new file mode 100644 index 00000000..68ffa330 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapedCBRecipes.java @@ -0,0 +1,128 @@ +package minefantasy.mf2.integration.minetweaker.helpers; + +import minefantasy.mf2.api.crafting.carpenter.CarpenterCraftMatrix; +import minefantasy.mf2.api.crafting.carpenter.ICarpenterRecipe; +import minefantasy.mf2.api.rpg.Skill; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; + +public class TweakedShapedCBRecipes implements ICarpenterRecipe { + + private int hammer, anvil, /* craft, */ + time, width, height; + private float exp; + private IItemStack result; + private IIngredient[][] ingreds; + private Skill s; + private String research, tool, sound; + + public TweakedShapedCBRecipes(IIngredient[][] input, IItemStack output, String tool, int time, int hammer, + int anvil, float exp, String sound, String research, Skill s) { + this.height = 4; + this.width = 6; + this.ingreds = input; + this.result = output; + this.tool = tool; + this.hammer = hammer; + this.anvil = anvil; + this.exp = exp; + this.sound = sound; + this.research = research; + this.s = s; + this.time = time; + } + + @Override + public int getAnvil() { + return anvil; + } + + @Override + public int getCraftTime() { + return time; + } + + @Override + public ItemStack getCraftingResult(CarpenterCraftMatrix arg0) { + return this.getRecipeOutput().copy(); + } + + @Override + public float getExperiance() { + return exp; + } + + @Override + public int getRecipeHammer() { + return hammer; + } + + @Override + public ItemStack getRecipeOutput() { + return MineTweakerMC.getItemStack(result).copy(); + } + + @Override + public int getRecipeSize() { + return this.width * this.height; + } + + @Override + public String getResearch() { + return research; + } + + @Override + public Skill getSkill() { + return this.s; + } + + @Override + public String getToolType() { + return tool; + } + + @Override + public boolean matches(CarpenterCraftMatrix inv) { + boolean matches = true; + for (int x = 0; x < 4; x++) { + for (int y = 0; y < 4; y++) { + if (!matches) + return false; + ItemStack stack = inv.getStackInRowAndColumn(x, y); + + // int a = y + x * 4; + if (stack == null && this.ingreds[y][x] == null) { + continue; + } + boolean hasMatch = false; + if (stack != null && this.ingreds[y][x] != null) { + for (IItemStack i : this.ingreds[y][x].getItems()) { + ItemStack ingred = MineTweakerMC.getItemStack(i); + if (stack.getItem() == ingred.getItem() && stack.getItemDamage() == stack.getItemDamage()) { + hasMatch = true; + } + } + } else { + matches = false; + } + if (!hasMatch) + matches = false; + } + } + return matches; + } + + @Override + public String getSound() { + return sound; + } + + @Override + public boolean outputHot() { + return false; + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapelessAnvilRecipe.java b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapelessAnvilRecipe.java new file mode 100644 index 00000000..3a433a4b --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapelessAnvilRecipe.java @@ -0,0 +1,141 @@ +package minefantasy.mf2.integration.minetweaker.helpers; + +import minefantasy.mf2.api.crafting.anvil.AnvilCraftMatrix; +import minefantasy.mf2.api.crafting.anvil.IAnvilRecipe; +import minefantasy.mf2.api.rpg.Skill; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; + +public class TweakedShapelessAnvilRecipe implements IAnvilRecipe { + + private int hammer, anvil, /* craft, */ + time, width, height; + private float exp; + private IItemStack result; + private IIngredient[] ingreds; + private Skill s; + private String research, tool; + private boolean hot; + + public TweakedShapelessAnvilRecipe(IIngredient[] input, IItemStack output, String tool, int time, int hammer, + int anvil, float exp, boolean hot, String research, Skill s) { + this.height = 4; + this.width = 4; + this.ingreds = input; + this.result = output; + this.tool = tool; + this.hammer = hammer; + this.anvil = anvil; + this.exp = exp; + this.hot = hot; + this.research = research; + this.s = s; + this.time = time; + } + + @Override + public int getAnvil() { + return anvil; + } + + @Override + public int getCraftTime() { + return time; + } + + @Override + public ItemStack getCraftingResult(AnvilCraftMatrix arg0) { + return this.getRecipeOutput().copy(); + } + + @Override + public float getExperiance() { + return exp; + } + + @Override + public int getRecipeHammer() { + return hammer; + } + + @Override + public ItemStack getRecipeOutput() { + return MineTweakerMC.getItemStack(result).copy(); + } + + @Override + public int getRecipeSize() { + return this.width * this.height; + } + + @Override + public String getResearch() { + return research; + } + + @Override + public Skill getSkill() { + return s; + } + + @Override + public String getToolType() { + return tool; + } + + @Override + public boolean matches(AnvilCraftMatrix inv) { + boolean matches[] = new boolean[this.ingreds.length]; + boolean items[][] = new boolean[6][4]; + for (int a = 0; a < this.ingreds.length; a++) { + IIngredient i = this.ingreds[a]; + for (IItemStack s : i.getItems()) { + ItemStack ingred = MineTweakerMC.getItemStack(s); + boolean found = false; + for (int x = 0; x < 6; x++) { + for (int y = 0; y < 4; y++) { + ItemStack stack = inv.getStackInRowAndColumn(x, y); + if (stack == null) + continue; + if (stack.getItem() == ingred.getItem() && stack.getItemDamage() == ingred.getItemDamage() + && !items[x][y]) { + matches[a] = true; + items[x][y] = true; + found = true; + break; + } + } + if (found) + break; + } + if (found) + break; + } + } + boolean isMatch = true; + for (boolean b : matches) + if (!b) + isMatch = false; + for (int x = 0; x < 6; x++) { + for (int y = 0; y < 4; y++) { + if (!items[x][y] && inv.getStackInRowAndColumn(x, y) != null) + isMatch = false; + } + } + return isMatch; + } + + @Override + public boolean outputHot() { + return hot; + } + + @Override + public boolean useCustomTiers() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapelessCBRecipes.java b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapelessCBRecipes.java new file mode 100644 index 00000000..3088acff --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/helpers/TweakedShapelessCBRecipes.java @@ -0,0 +1,139 @@ +package minefantasy.mf2.integration.minetweaker.helpers; + +import minefantasy.mf2.api.crafting.carpenter.CarpenterCraftMatrix; +import minefantasy.mf2.api.crafting.carpenter.ICarpenterRecipe; +import minefantasy.mf2.api.rpg.Skill; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; + +public class TweakedShapelessCBRecipes implements ICarpenterRecipe { + + private int hammer, anvil, /* craft, */ + time, width, height; + private float exp; + private IItemStack result; + private IIngredient[] ingreds; + private Skill s; + private String research, tool, sound; + + public TweakedShapelessCBRecipes(IIngredient[] input, IItemStack output, String tool, int time, int hammer, + int anvil, float exp, String sound, String research, Skill s) { + this.height = 4; + this.width = 4; + this.ingreds = input; + this.result = output; + this.tool = tool; + this.hammer = hammer; + this.anvil = anvil; + this.exp = exp; + this.sound = sound; + this.research = research; + this.s = s; + this.time = 1; + } + + @Override + public int getAnvil() { + return anvil; + } + + @Override + public int getCraftTime() { + return time; + } + + @Override + public ItemStack getCraftingResult(CarpenterCraftMatrix arg0) { + return this.getRecipeOutput().copy(); + } + + @Override + public float getExperiance() { + return exp; + } + + @Override + public int getRecipeHammer() { + return hammer; + } + + @Override + public ItemStack getRecipeOutput() { + return MineTweakerMC.getItemStack(result).copy(); + } + + @Override + public int getRecipeSize() { + return this.width * this.height; + } + + @Override + public String getResearch() { + return research; + } + + @Override + public Skill getSkill() { + return s; + } + + @Override + public String getToolType() { + return tool; + } + + @Override + public boolean matches(CarpenterCraftMatrix inv) { + boolean matches[] = new boolean[this.ingreds.length]; + boolean items[][] = new boolean[4][4]; + for (int a = 0; a < this.ingreds.length; a++) { + IIngredient i = this.ingreds[a]; + for (IItemStack s : i.getItems()) { + ItemStack ingred = MineTweakerMC.getItemStack(s); + boolean found = false; + for (int x = 0; x < 4; x++) { + for (int y = 0; y < 4; y++) { + ItemStack stack = inv.getStackInRowAndColumn(x, y); + if (stack == null) + continue; + if (stack.getItem() == ingred.getItem() && stack.getItemDamage() == ingred.getItemDamage() + && !items[x][y]) { + matches[a] = true; + items[x][y] = true; + found = true; + break; + } + } + if (found) + break; + } + if (found) + break; + } + } + boolean isMatch = true; + for (boolean b : matches) + if (!b) + isMatch = false; + for (int x = 0; x < 4; x++) { + for (int y = 0; y < 4; y++) { + if (!items[x][y] && inv.getStackInRowAndColumn(x, y) != null) + isMatch = false; + } + } + return isMatch; + } + + @Override + public boolean outputHot() { + return false; + } + + @Override + public String getSound() { + return sound; + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Anvil.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Anvil.java new file mode 100644 index 00000000..ab36385b --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Anvil.java @@ -0,0 +1,110 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.crafting.anvil.CraftingManagerAnvil; +import minefantasy.mf2.api.crafting.anvil.IAnvilRecipe; +import minefantasy.mf2.api.rpg.RPGElements; +import minefantasy.mf2.api.rpg.Skill; +import minefantasy.mf2.integration.minetweaker.helpers.TweakedShapedAnvilRecipe; +import minefantasy.mf2.integration.minetweaker.helpers.TweakedShapelessAnvilRecipe; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.NotNull; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.minefantasy.Anvil") +public class Anvil { + + @ZenMethod + public static void addShapedRecipe(@NotNull IItemStack output, String skill, String research, boolean hot, + double exp, String tool, int hammer, int anvil, int time, IIngredient[][] ingreds) { + MineTweakerAPI.apply(new AnvilAction(output, RPGElements.getSkillByName(skill), research, hot, (float) exp, + tool, hammer, anvil, time, ingreds)); + } + + @ZenMethod + public static void addShapelessRecipe(@NotNull IItemStack output, String skill, String research, boolean hot, + double exp, String tool, int hammer, int anvil, int time, IIngredient[] ingreds) { + MineTweakerAPI.apply(new AnvilAction(output, RPGElements.getSkillByName(skill), research, hot, (float) exp, + tool, hammer, anvil, time, ingreds)); + } + + public static class AnvilAction implements IUndoableAction { + + IItemStack output; + Skill s; + String research, tool; + boolean hot; + float exp; + int hammer, anvil, time; + IIngredient[][] ingreds; + IIngredient[] ingreds2; + boolean shaped; + IAnvilRecipe recipe; + + public AnvilAction(IItemStack out, Skill s, String research, boolean hot, float exp, String tool, int hammer, + int anvil, int time, IIngredient[][] ingreds) { + this.output = out; + this.s = s; + this.research = research; + this.tool = tool; + this.hot = hot; + this.exp = exp; + this.hammer = hammer; + this.anvil = anvil; + this.time = time; + this.ingreds = ingreds; + this.shaped = true; + recipe = new TweakedShapedAnvilRecipe(ingreds, out, tool, time, hammer, anvil, exp, hot, research, s); + } + + public AnvilAction(IItemStack out, Skill s, String research, boolean hot, float exp, String tool, int hammer, + int anvil, int time, IIngredient[] ingreds) { + this.output = out; + this.s = s; + this.research = research; + this.tool = tool; + this.hot = hot; + this.exp = exp; + this.hammer = hammer; + this.anvil = anvil; + this.time = time; + this.ingreds2 = ingreds; + this.shaped = false; + recipe = new TweakedShapelessAnvilRecipe(ingreds2, out, tool, time, hammer, anvil, exp, hot, research, s); + } + + @Override + public void apply() { + CraftingManagerAnvil.getInstance().recipes.add(recipe); + } + + @Override + public String describe() { + return "Adding a " + (hot ? "hot" : "") + " Anvil Recipe resulting in " + MineTweakerMC.getItemStack(output); + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public String describeUndo() { + return "Undoing Anvil Recipe"; + } + + @Override + public void undo() { + CraftingManagerAnvil.getInstance().recipes.remove(recipe); + } + } +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/BigFurnace.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/BigFurnace.java new file mode 100644 index 00000000..d201db8f --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/BigFurnace.java @@ -0,0 +1,79 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.refine.BigFurnaceRecipes; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@ZenClass("mods.minefantasy.BigFurnace") +public class BigFurnace { + + @ZenMethod + public static void addRecipe(IItemStack output, IIngredient input, @Optional int tier) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, tier)); + } + + private static class AddRecipeAction implements IUndoableAction { + private final IItemStack output; + private final IIngredient input; + private final int tier; + private final List addedRecipes = new ArrayList(); + + public AddRecipeAction(IItemStack output, IIngredient input, int tier) { + this.output = output; + this.input = input; + this.tier = tier; + } + + @Override + public void apply() { + for (IIngredient ingredient : input.getItems()) { + ItemStack mcInput = MineTweakerMC.getItemStack(ingredient); + addedRecipes.add(BigFurnaceRecipes.addRecipe(mcInput, MineTweakerMC.getItemStack(output), tier)); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public void undo() { + for (Map.Entry entry : BigFurnaceRecipes.recipeList.entrySet()) { + for (BigFurnaceRecipes recipeToRemove : addedRecipes) { + if (entry.getValue().equals(recipeToRemove)) { + BigFurnaceRecipes.recipeList.remove(entry); + } + } + } + addedRecipes.clear(); + } + + @Override + public String describe() { + return "Adding big furnace recipe for " + output.getDisplayName(); + } + + @Override + public String describeUndo() { + return "Removing big furnace recipe for " + output.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/BlastFurnace.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/BlastFurnace.java new file mode 100644 index 00000000..5fbc8aad --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/BlastFurnace.java @@ -0,0 +1,74 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.refine.BlastFurnaceRecipes; +import minefantasy.mf2.util.Utils; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +import java.util.Map; + +@ZenClass("mods.minefantasy.BlastFurnace") +public class BlastFurnace { + + @ZenMethod + public static void addRecipe(IItemStack output, IIngredient input) { + MineTweakerAPI.apply(new AddRecipeAction(output, input)); + } + + private static class AddRecipeAction implements IUndoableAction { + + private final IItemStack output; + private final IIngredient input; + + public AddRecipeAction(IItemStack output, IIngredient input) { + this.output = output; + this.input = input; + } + + @Override + public void apply() { + ItemStack mcOutput = MineTweakerMC.getItemStack(output); + for (IIngredient ingredient : input.getItems()) { + ItemStack mcInput = MineTweakerMC.getItemStack(ingredient); + BlastFurnaceRecipes.smelting().addRecipe(mcInput, mcOutput); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public void undo() { + for (IIngredient ingredient : input.getItems()) { + for (Map.Entry entry : BlastFurnaceRecipes.smelting().getSmeltingList().entrySet()) { + if (Utils.doesMatch(entry.getKey(), MineTweakerMC.getItemStack(ingredient)) && Utils.doesMatch(entry.getValue(), MineTweakerMC.getItemStack(output))) { + BlastFurnaceRecipes.smelting().getSmeltingList().remove(entry); + } + } + } + } + + @Override + public String describe() { + return "Adding blast furnace recipe for " + output.getDisplayName(); + } + + @Override + public String describeUndo() { + return "Removing blast furnace recipe for " + output.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Bloomery.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Bloomery.java new file mode 100644 index 00000000..c634a6b2 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Bloomery.java @@ -0,0 +1,141 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.crafting.refine.BloomRecipe; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import minetweaker.mc1710.item.MCItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.NotNull; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ZenClass("mods.minefantasy.Bloomery") +public class Bloomery { + + @ZenMethod + public static void addRecipe(IItemStack result, IIngredient input) { + MineTweakerAPI.apply(new AddRecipeAction(result, input)); + } + + @ZenMethod + public static void remove(@NotNull IIngredient output, @Optional IIngredient input) { + if (output == null) + throw new IllegalArgumentException("Output value cannot be null"); + + HashMap recipeList = BloomRecipe.recipeList; + + List toRemove = new ArrayList(); + List toRemoveValues = new ArrayList(); + for (Map.Entry entry : recipeList.entrySet()) { + if (output.matches(new MCItemStack(entry.getValue())) + && (input == null || input.matches(new MCItemStack(entry.getKey())))) { + toRemove.add(entry.getKey()); + toRemoveValues.add(entry.getValue()); + } + } + + if (!toRemove.isEmpty()) { + MineTweakerAPI.apply(new RemoveAction(toRemove, toRemoveValues)); + } else { + MineTweakerAPI.logWarning("No bloomery recipes for " + output.toString()); + } + } + + private static class AddRecipeAction implements IUndoableAction { + IItemStack result; + IIngredient input; + + public AddRecipeAction(IItemStack result, IIngredient input) { + this.result = result; + this.input = input; + } + + @Override + public void apply() { + for (IItemStack stack : input.getItems()) { + ItemStack s = MineTweakerMC.getItemStack(stack); + BloomRecipe.addRecipe(s, MineTweakerMC.getItemStack(result)); + } + } + + @Override + public String describe() { + return "Adding bloomery recipe for " + result.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public String describeUndo() { + return "Removing bloomery recipe for " + result.getDisplayName(); + } + + @Override + public void undo() { + BloomRecipe.recipeList.remove(input); + } + + } + + private static class RemoveAction implements IUndoableAction { + private final List items; + private final List values; + + public RemoveAction(List items, List values) { + this.items = items; + this.values = values; + } + + @Override + public void apply() { + for (ItemStack item : items) { + BloomRecipe.recipeList.remove(item); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public void undo() { + for (int i = 0; i < items.size(); i++) { + BloomRecipe.recipeList.put(items.get(i), values.get(i)); + } + } + + @Override + public String describe() { + return "Removing " + items.size() + " bloomery recipes"; + } + + @Override + public String describeUndo() { + return "Restoring " + items.size() + " bloomery recipes"; + } + + @Override + public Object getOverrideKey() { + return null; + } + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/CarpentersBench.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/CarpentersBench.java new file mode 100644 index 00000000..c585a65d --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/CarpentersBench.java @@ -0,0 +1,113 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.crafting.carpenter.CraftingManagerCarpenter; +import minefantasy.mf2.api.crafting.carpenter.ICarpenterRecipe; +import minefantasy.mf2.api.rpg.RPGElements; +import minefantasy.mf2.api.rpg.Skill; +import minefantasy.mf2.integration.minetweaker.helpers.TweakedShapedCBRecipes; +import minefantasy.mf2.integration.minetweaker.helpers.TweakedShapelessCBRecipes; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import stanhebben.zenscript.annotations.NotNull; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.minefantasy.CarpenterBench") +public class CarpentersBench { + + @ZenMethod + public static void addShapedRecipe(@NotNull IItemStack output, String skill, String research, String sound, + double exp, String tool, int hammer, int anvil, int time, IIngredient[][] ingreds) { + MineTweakerAPI.apply(new CarpentersAction(output, RPGElements.getSkillByName(skill), research, sound, + (float) exp, tool, hammer, anvil, time, ingreds)); + } + + @ZenMethod + public static void addShapelessRecipe(@NotNull IItemStack output, String skill, String research, String sound, + double exp, String tool, int hammer, int anvil, int time, IIngredient[] ingreds) { + MineTweakerAPI.apply(new CarpentersAction(output, RPGElements.getSkillByName(skill), research, sound, + (float) exp, tool, hammer, anvil, time, ingreds)); + } + + public static class CarpentersAction implements IUndoableAction { + + IItemStack out; + Skill s; + String research, tool, sound; + float exp; + int hammer, anvil, time; + IIngredient[][] ingreds; + IIngredient[] ingreds2; + boolean shaped; + ICarpenterRecipe r; + + // private static final char[] chars = + // {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','recipe','s','t','u','v','w','x','y','z'}; + + public CarpentersAction(IItemStack out, Skill s, String research, String sound, float exp, String tool, + int hammer, int anvil, int time, IIngredient[][] ingreds) { + this.out = out; + this.s = s; + this.research = research; + this.tool = tool; + this.sound = sound; + this.exp = exp; + this.hammer = hammer; + this.anvil = anvil; + this.time = time; + this.ingreds = ingreds; + this.shaped = true; + r = new TweakedShapedCBRecipes(ingreds, out, tool, time, hammer, anvil, exp, sound, research, s); + } + + public CarpentersAction(IItemStack out, Skill s, String research, String sound, float exp, String tool, + int hammer, int anvil, int time, IIngredient[] ingreds) { + this.out = out; + this.s = s; + this.research = research; + this.tool = tool; + this.sound = sound; + this.exp = exp; + this.hammer = hammer; + this.anvil = anvil; + this.time = time; + this.ingreds2 = ingreds; + this.shaped = false; + r = new TweakedShapelessCBRecipes(ingreds2, out, tool, time, hammer, anvil, exp, sound, research, s); + } + + @Override + public void apply() { + CraftingManagerCarpenter.getInstance().recipes.add(r); + } + + @Override + public String describe() { + return "Adding Carpenters Bench Recipe..."; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public String describeUndo() { + return "Undoing Carpenters Recipe"; + } + + @Override + public void undo() { + CraftingManagerCarpenter.getInstance().recipes.remove(r); + } + + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Cooking.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Cooking.java new file mode 100644 index 00000000..fc759bfb --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Cooking.java @@ -0,0 +1,85 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.cooking.CookRecipe; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@ZenClass("mods.minefantasy.Cooking") +public class Cooking { + + @ZenMethod + public static void addRecipe(IItemStack output, IIngredient input, int minTemp, int maxTemp, int time, int burnTime, boolean requireBaking, @Optional boolean canBurn) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, minTemp, maxTemp, time, burnTime, requireBaking, canBurn)); + } + + private static class AddRecipeAction implements IUndoableAction { + private final IItemStack output; + private final IIngredient input; + private final int minTemp, maxTemp, time, burnTime; + private final boolean requireBaking, canBurn; + private final List addedRecipes = new ArrayList(); + + public AddRecipeAction(IItemStack output, IIngredient input, int minTemp, int maxTemp, int time, int burnTime, boolean requireBaking, boolean canBurn) { + this.output = output; + this.input = input; + this.minTemp = minTemp; + this.maxTemp = maxTemp; + this.time = time; + this.burnTime = burnTime; + this.requireBaking = requireBaking; + this.canBurn = canBurn; + } + + @Override + public void apply() { + for (IIngredient ingredient : input.getItems()) { + ItemStack mcInput = MineTweakerMC.getItemStack(ingredient); + addedRecipes.add(CookRecipe.addRecipe(MineTweakerMC.getItemStack(output), mcInput, new ItemStack(CookRecipe.burnt_food), minTemp, maxTemp, time, burnTime, requireBaking, canBurn)); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public void undo() { + for (Map.Entry recipeEntry : CookRecipe.recipeList.entrySet()) { + for (CookRecipe recipe : addedRecipes) { + if (recipe.equals(recipe)) { + CookRecipe.recipeList.remove(recipeEntry); + } + } + } + addedRecipes.clear(); + } + + @Override + public String describe() { + return null; + } + + @Override + public String describeUndo() { + return null; + } + + @Override + public Object getOverrideKey() { + return null; + } + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Crucible.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Crucible.java new file mode 100644 index 00000000..ddfb8c34 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Crucible.java @@ -0,0 +1,61 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.refine.Alloy; +import minefantasy.mf2.api.refine.AlloyRecipes; +import minefantasy.mf2.integration.minetweaker.helpers.TweakedAlloyRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.OneWayAction; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +import java.util.ArrayList; +import java.util.List; + +@ZenClass("mods.minefantasy.Crucible") +public class Crucible { + + @ZenMethod + public static void addAlloy(IItemStack out, @Optional int level, int dupe, IIngredient[] ingred) { + MineTweakerAPI.apply(new AddAlloyAction(out, level, ingred, dupe)); + } + + private static class AddAlloyAction extends OneWayAction { + + private Alloy alloy; + private IItemStack out; + private int level; + private List ingreds; + private int dupe; + + public AddAlloyAction(IItemStack out, int level, IIngredient[] ingreds, int dupe) { + this.out = out; + this.level = level; + this.ingreds = new ArrayList(); + this.dupe = dupe; + for (IIngredient i : ingreds) { + this.ingreds.add(i); + } + alloy = new TweakedAlloyRecipe(out, level, this.ingreds); + } + + @Override + public void apply() { + AlloyRecipes.addAlloy(alloy); + } + + @Override + public String describe() { + return "Adding Custom Alloy"; + } + + @Override + public Object getOverrideKey() { + return null; + } + + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Forge.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Forge.java new file mode 100644 index 00000000..200ac403 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Forge.java @@ -0,0 +1,65 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.heating.Heatable; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.minefantasy.Forge") +public class Forge { + + @ZenMethod + public static void addHeatableItem(IIngredient input, int min, int unstable, int max) { + MineTweakerAPI.apply(new AddHeatableAction(input, min, unstable, max)); + } + + private static class AddHeatableAction implements IUndoableAction { + private final IIngredient input; + private final int min, unstable, max; + + public AddHeatableAction(IIngredient input, int min, int unstable, int max) { + this.input = input; + this.min = min; + this.unstable = unstable; + this.max = max; + } + + @Override + public void apply() { + for (IItemStack s : input.getItems()) { + Heatable.addItem(MineTweakerMC.getItemStack(s), min, unstable, max); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public String describe() { + return "Adding a heatable item"; + } + + @Override + public String describeUndo() { + return "Removing heatable item"; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public void undo() { + for (IItemStack s : input.getItems()) { + Heatable.registerList.remove(Heatable.getRegistrationForItem(MineTweakerMC.getItemStack(s))); + } + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Fuels.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Fuels.java new file mode 100644 index 00000000..9ca5189a --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Fuels.java @@ -0,0 +1,19 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minetweaker.api.item.IItemStack; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.minefantasy.Fuel") +public class Fuels { + + @ZenMethod + public static void addCarbon(IItemStack stack, int uses) { + + } + + public static class addFuelAction { + + } + +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Quern.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Quern.java new file mode 100644 index 00000000..f42a4d57 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/Quern.java @@ -0,0 +1,130 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.crafting.refine.QuernRecipes; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import minetweaker.mc1710.item.MCItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.NotNull; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +import java.util.ArrayList; + +@ZenClass("mods.minefantasy.Quern") +public class Quern { + + @ZenMethod + public static void addRecipe(IItemStack output, IIngredient input, @Optional int tier, @Optional boolean consumePot) { + MineTweakerAPI.apply(new AddRecipeAction(output, input, tier, consumePot)); + } + + @ZenMethod + public static void remove(@NotNull IIngredient output, @Optional IIngredient input) { + ArrayList recipesToRemove = new ArrayList(); + for (QuernRecipes recipes : QuernRecipes.recipeList) { + if (output.matches(new MCItemStack(recipes.result)) && (input == null || input.matches(new MCItemStack(recipes.input)))) { + recipesToRemove.add(recipes); + } + } + + MineTweakerAPI.apply(new RemoveAction(recipesToRemove)); + } + + private static class AddRecipeAction implements IUndoableAction { + private final IItemStack output; + private final IIngredient input; + private final int tier; + private final boolean consumePot; + private final ArrayList recipesToRemove = new ArrayList(); + + public AddRecipeAction(IItemStack result, IIngredient input, int tier, boolean consumePot) { + this.output = result; + this.input = input; + this.tier = tier; + this.consumePot = consumePot; + } + + @Override + public void apply() { + for (IItemStack stack : input.getItems()) { + ItemStack s = MineTweakerMC.getItemStack(stack); + recipesToRemove.add(QuernRecipes.addRecipe(s, MineTweakerMC.getItemStack(output), this.tier, consumePot)); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public void undo() { + for (QuernRecipes recipes : recipesToRemove) { + QuernRecipes.recipeList.remove(recipes); + } + recipesToRemove.clear(); + } + + @Override + public String describe() { + return "Adding quern recipe for " + output.getDisplayName(); + } + + @Override + public String describeUndo() { + return "Removing quern recipe for " + output.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + } + + private static class RemoveAction implements IUndoableAction { + private final ArrayList recipesToRemove; + + public RemoveAction(ArrayList recipesToRemove) { + this.recipesToRemove = recipesToRemove; + } + + @Override + public void apply() { + for (QuernRecipes recipe : recipesToRemove) { + QuernRecipes.recipeList.remove(recipe); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public void undo() { + for (QuernRecipes recipe : recipesToRemove) { + QuernRecipes.recipeList.add(recipe); + } + } + + @Override + public String describe() { + return "Removing " + recipesToRemove.size() + " bloomery recipes"; + } + + @Override + public String describeUndo() { + return "Restoring " + recipesToRemove.size() + " bloomery recipes"; + } + + @Override + public Object getOverrideKey() { + return null; + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/SalvageTweaker.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/SalvageTweaker.java new file mode 100644 index 00000000..d2446bb1 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/SalvageTweaker.java @@ -0,0 +1,100 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.crafting.Salvage; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.minefantasy.SalvageTweaker") +public class SalvageTweaker { + + @ZenMethod + public static void addSalvage(IItemStack output, IIngredient input) { + MineTweakerAPI.apply(new AddSalvageAction(output, input)); + } + + private static class AddSalvageAction implements IUndoableAction { + private final IItemStack output; + private final IIngredient input; + + public AddSalvageAction(IItemStack output, IIngredient input) { + this.output = output; + this.input = input; + } + + @Override + public void apply() { + for (IItemStack stack : input.getItems()) { + ItemStack s = MineTweakerMC.getItemStack(stack); + Salvage.addSalvage(s, MineTweakerMC.getItemStack(output)); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public void undo() { + Salvage.salvageList.remove(input); + } + + @Override + public String describe() { + return null; + } + + @Override + public String describeUndo() { + return null; + } + + @Override + public Object getOverrideKey() { + return null; + } + } + + private static class RemoveAction implements IUndoableAction { + + public RemoveAction() { + + } + + @Override + public void apply() { + + } + + @Override + public boolean canUndo() { + return false; + } + + @Override + public void undo() { + + } + + @Override + public String describe() { + return null; + } + + @Override + public String describeUndo() { + return null; + } + + @Override + public Object getOverrideKey() { + return null; + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/TanningRack.java b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/TanningRack.java new file mode 100644 index 00000000..17ccc68b --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/minetweaker/tweakers/TanningRack.java @@ -0,0 +1,142 @@ +package minefantasy.mf2.integration.minetweaker.tweakers; + +import minefantasy.mf2.api.crafting.tanning.TanningRecipe; +import minetweaker.IUndoableAction; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import minetweaker.mc1710.item.MCItemStack; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.NotNull; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +import java.util.ArrayList; +import java.util.List; + +@ZenClass("mods.minefantasy.TanningRack") +public class TanningRack { + + @ZenMethod + public static void addTieredAndToolRecipe(IItemStack output, IIngredient input, float time, @Optional int tier, @Optional String tool) { + MineTweakerAPI.apply(new TanningAction(output, input, time, tier, tool)); + } + + @ZenMethod + public static void remove(@NotNull IIngredient output, @Optional IIngredient input) { + ArrayList recipeList = TanningRecipe.recipeList; + List recipesToRemove = new ArrayList(); + + for (TanningRecipe recipe : recipeList) { + if (output.matches(new MCItemStack(recipe.output)) && (input == null || input.matches(new MCItemStack(recipe.input)))) { + recipesToRemove.add(recipe); + } + } + + if (recipesToRemove.isEmpty()) { + MineTweakerAPI.logWarning("No tanning rack recipes for " + output.toString()); + return; + } + + MineTweakerAPI.apply(new RemoveAction(recipesToRemove)); + } + + public static class TanningAction implements IUndoableAction { + private final IItemStack output; + private final IIngredient input; + private final float time; + private final int tier; + private final String tool; + private final List addedRecipes = new ArrayList(); + + public TanningAction(IItemStack output, IIngredient input, float time, int tier, String tool) { + this.output = output; + this.input = input; + this.time = time; + this.tier = tier; + this.tool = tool; + } + + @Override + public void apply() { + for (IItemStack s : input.getItems()) { + ItemStack stack = MineTweakerMC.getItemStack(s); + addedRecipes.add(TanningRecipe.addRecipe(stack, time, tier, tool, MineTweakerMC.getItemStack(output))); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public void undo() { + for (TanningRecipe recipe : addedRecipes) { + TanningRecipe.recipeList.remove(recipe); + } + addedRecipes.clear(); + } + + @Override + public String describe() { + return "Adding tanning rack recipe for " + output.getDisplayName(); + } + + @Override + public String describeUndo() {/**/ + return "Removing tanning rack recipe for " + output.getDisplayName(); + } + + @Override + public Object getOverrideKey() { + return null; + } + + } + + public static class RemoveAction implements IUndoableAction { + private final List recipes; + + public RemoveAction(List recipes) { + this.recipes = recipes; + } + + @Override + public void apply() { + for (TanningRecipe recipe : recipes) { + TanningRecipe.recipeList.remove(recipe); + } + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public void undo() { + for (TanningRecipe recipe : recipes) { + TanningRecipe.recipeList.add(recipe); + } + recipes.clear(); + } + + @Override + public String describe() { + return "Removing " + recipes.size() + " tanning rack recipes"; + } + + @Override + public String describeUndo() { + return "Restoring " + recipes.size() + " tanning rack recipes"; + } + + @Override + public Object getOverrideKey() { + return null; + } + } +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/integration/nei/MFPositionedStack.java b/src/main/java/minefantasy/mf2/integration/nei/MFPositionedStack.java new file mode 100644 index 00000000..aefe9ee8 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/MFPositionedStack.java @@ -0,0 +1,61 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.nei.ItemList; +import codechicken.nei.PositionedStack; +import minefantasy.mf2.api.helpers.CustomToolHelper; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; +import java.util.List; + +public class MFPositionedStack extends PositionedStack { + public boolean permutated = false; + + public MFPositionedStack(Object object, int x, int y) { + this(object, x, y, true); + } + + public MFPositionedStack(Object object, int x, int y, boolean genPerm) { + super(object, x, y, genPerm); + } + + @Override + public void generatePermutations() { + if (permutated) + return; + + ArrayList stacks = new ArrayList(); + for (ItemStack item : items) { + if (item == null || item.getItem() == null) + continue; + + if (item.getItemDamage() == Short.MAX_VALUE) { + List permutations = ItemList.itemMap.get(item.getItem()); + if (!permutations.isEmpty()) { + for (ItemStack stack : permutations) { + if (item.getItem().equals(stack.getItem()) + && CustomToolHelper.doesMatchForRecipe(item, stack)) { // TODO: + // Rework + stacks.add(stack.copy()); + } + } + } else { + ItemStack base = new ItemStack(item.getItem(), item.stackSize); + base.setTagCompound(item.getTagCompound()); + stacks.add(base); + } + continue; + } + + stacks.add(item.copy()); + } + items = stacks.toArray(new ItemStack[0]); + + if (items.length == 0) + items = new ItemStack[]{new ItemStack(Blocks.fire)}; + + permutated = true; + setPermutationToRender(0); + } +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/integration/nei/NEIConfig.java b/src/main/java/minefantasy/mf2/integration/nei/NEIConfig.java new file mode 100644 index 00000000..8643cf54 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/NEIConfig.java @@ -0,0 +1,58 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; +import cpw.mods.fml.common.Optional; +import minefantasy.mf2.MineFantasyII; +import minefantasy.mf2.config.ConfigIntegration; + +@Optional.Interface(iface = "codechicken.nei.api.IConfigureNEI", modid = "NotEnoughItems") +public class NEIConfig implements IConfigureNEI { + + @Override + public String getName() { + return MineFantasyII.NAME + " NEI Plugin"; + } + + @Override + public String getVersion() { + return MineFantasyII.VERSION; + } + + @Override + public void loadConfig() { + if (ConfigIntegration.neiIntegration) { + RecipeHandlerCarpenter handlerCarpenter = new RecipeHandlerCarpenter(); + API.registerRecipeHandler(handlerCarpenter); + API.registerUsageHandler(handlerCarpenter); + + RecipeHandlerAnvil handlerAnvil = new RecipeHandlerAnvil(); + API.registerRecipeHandler(handlerAnvil); + API.registerUsageHandler(handlerAnvil); + + RecipeHandlerBloom handlerBloom = new RecipeHandlerBloom(); + API.registerRecipeHandler(handlerBloom); + API.registerUsageHandler(handlerBloom); + + RecipeHandlerQuern handlerQuern = new RecipeHandlerQuern(); + API.registerRecipeHandler(handlerQuern); + API.registerUsageHandler(handlerQuern); + + /*RecipeHandlerTanning handlerTanning = new RecipeHandlerTanning(); + API.registerRecipeHandler(handlerTanning); + API.registerUsageHandler(handlerTanning);*/ + + RecipeHandlerCrucible handlerCrucible = new RecipeHandlerCrucible(); + API.registerRecipeHandler(handlerCrucible); + API.registerUsageHandler(handlerCrucible); + + RecipeHandlerBigFurnace handlerBigFurnace = new RecipeHandlerBigFurnace(); + API.registerRecipeHandler(handlerBigFurnace); + API.registerUsageHandler(handlerBigFurnace); + + RecipeHandlerBlastFurnace handlerBlastFurnace = new RecipeHandlerBlastFurnace(); + API.registerRecipeHandler(handlerBlastFurnace); + API.registerUsageHandler(handlerBlastFurnace); + } + } +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/integration/nei/NEIHelper.java b/src/main/java/minefantasy/mf2/integration/nei/NEIHelper.java new file mode 100644 index 00000000..618b5e09 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/NEIHelper.java @@ -0,0 +1,36 @@ +package minefantasy.mf2.integration.nei; + +import minefantasy.mf2.api.crafting.ITieredComponent; +import minefantasy.mf2.api.crafting.anvil.IAnvilRecipe; +import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.api.material.CustomMaterial; +import net.minecraft.item.ItemStack; + +public class NEIHelper { + + public static ItemStack fillMaterials(IAnvilRecipe recipe, ItemStack componentStack, ItemStack outputStack) { + if (componentStack.getItem() instanceof ITieredComponent) { + String componentType = ((ITieredComponent) componentStack.getItem()).getMaterialType(componentStack); + if (componentType != null) { + if (componentType.equalsIgnoreCase("metal")) { + CustomMaterial resultPrimaryMaterial = CustomToolHelper.getCustomPrimaryMaterial(outputStack); + if (resultPrimaryMaterial != null) { + CustomMaterial.addMaterial(componentStack, CustomToolHelper.slot_main, resultPrimaryMaterial.name); + } + } + if (componentType.equalsIgnoreCase("wood")) { + CustomMaterial resultSecondaryMaterial = CustomToolHelper.getCustomSecondaryMaterial(outputStack); + if (resultSecondaryMaterial != null) { + CustomMaterial.addMaterial(componentStack, CustomToolHelper.slot_main, resultSecondaryMaterial.name); + } + } + } + + /*if (recipe.outputHot() && componentStack.getItem() instanceof IHotItem) { + ItemHeated.setTemp(componentStack, 1400); + }*/ + } + + return componentStack; + } +} diff --git a/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerAnvil.java b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerAnvil.java new file mode 100644 index 00000000..20e77115 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerAnvil.java @@ -0,0 +1,182 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import minefantasy.mf2.api.crafting.anvil.CraftingManagerAnvil; +import minefantasy.mf2.api.crafting.anvil.IAnvilRecipe; +import minefantasy.mf2.api.crafting.anvil.ShapedAnvilRecipes; +import minefantasy.mf2.api.crafting.anvil.ShapelessAnvilRecipes; +import minefantasy.mf2.api.crafting.exotic.SpecialForging; +import minefantasy.mf2.api.heating.Heatable; +import minefantasy.mf2.api.heating.IHotItem; +import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.api.knowledge.ResearchLogic; +import minefantasy.mf2.knowledge.KnowledgeListMF; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class RecipeHandlerAnvil extends TemplateRecipeHandler { + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("method.anvil"); + } + + @Override + public String getGuiTexture() { + return "minefantasy2:textures/gui/knowledge/anvilGrid.png"; + } + + @Override + public void drawBackground(int recipe) { + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 22, 166, 147); + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @SuppressWarnings("unchecked") + @Override + public void loadCraftingRecipes(ItemStack inputStack) { + ItemStack hiddenStack = null; + + if (inputStack.getItem() instanceof IHotItem) { + inputStack = Heatable.getItem(inputStack); + } + + if (ResearchLogic.hasInfoUnlocked(Minecraft.getMinecraft().thePlayer, KnowledgeListMF.smeltDragonforge)) { + for (Map.Entry entry : SpecialForging.dragonforgeCrafts.entrySet()) { + if (CustomToolHelper.areEqual(new ItemStack(entry.getValue()), inputStack)) { + hiddenStack = CustomToolHelper.tryDeconstruct(new ItemStack(entry.getKey()), inputStack); + } + } + } + + /*if (inputStack.getItem() instanceof ISpecialCraftItem) { + for (Map.Entry entry : SpecialForging.specialCrafts.entrySet()) { + ItemStack dragonForgedStack = new ItemStack(entry.getValue()); + if (CustomToolHelper.areEqual(dragonForgedStack, inputStack)) { + String design = ((ISpecialCraftItem)entry.getValue()).getDesign(dragonForgedStack); + for (IAnvilRecipe irecipe : (List) CraftingManagerAnvil.getInstance().getRecipeList()) { + ItemStack ingridient = new ItemStack(SpecialForging.getSpecialCraft(design, irecipe.getRecipeOutput())); + if(ingridient != null) { + hiddenStack = CustomToolHelper.tryDeconstruct(ingridient, inputStack); + } + } + } + } + }*/ + + for (IAnvilRecipe irecipe : (List) CraftingManagerAnvil.getInstance().getRecipeList()) { + if ((hiddenStack != null && CustomToolHelper.areEqual(irecipe.getRecipeOutput(), hiddenStack)) || CustomToolHelper.areEqual(irecipe.getRecipeOutput(), inputStack)) { + if (ResearchLogic.hasInfoUnlocked(Minecraft.getMinecraft().thePlayer, irecipe.getResearch())) { + CachedAnvilRecipe recipe = handleRecipe(irecipe, inputStack); + + if (recipe == null) { + continue; + } + + arecipes.add(recipe); + } + } + } + } + + @SuppressWarnings("unchecked") + @Override + public void loadUsageRecipes(ItemStack ingredient) { + if (ingredient.getItem() instanceof IHotItem) { + ingredient = Heatable.getItem(ingredient); + } + + for (IAnvilRecipe irecipe : (List) CraftingManagerAnvil.getInstance().getRecipeList()) { + if (!ResearchLogic.hasInfoUnlocked(Minecraft.getMinecraft().thePlayer, irecipe.getResearch())) { + continue; + } + + CachedAnvilRecipe recipe = handleRecipe(irecipe, null); + if (recipe == null || !recipe.contains(recipe.ingredients, ingredient)) { + continue; + } + + recipe.setIngredientPermutation(recipe.ingredients, ingredient); + arecipes.add(recipe); + } + } + + private CachedAnvilRecipe handleRecipe(IAnvilRecipe irecipe, ItemStack inputStack) { + if (irecipe instanceof ShapedAnvilRecipes) { + return new CachedAnvilRecipe((ShapedAnvilRecipes) irecipe, inputStack); + } + if (irecipe instanceof ShapelessAnvilRecipes) { + return new CachedAnvilRecipe((ShapelessAnvilRecipes) irecipe); + } + + return null; + } + + //TODO: Implement wood permutations, add additional helper method for custom material support in crafting and usage handlers + private class CachedAnvilRecipe extends CachedRecipe { + + private final ArrayList ingredients = new ArrayList(); + private ItemStack inputStack; + private IAnvilRecipe iAnvilRecipe; + + private CachedAnvilRecipe(ShapedAnvilRecipes recipe, ItemStack inputStack) { + iAnvilRecipe = recipe; + if (inputStack != null) { + this.inputStack = inputStack; + this.inputStack.stackSize = recipe.getRecipeOutput().stackSize; + } else { + this.inputStack = recipe.getRecipeOutput(); + } + setShapedRecipeIngredients(recipe.recipeWidth, recipe.recipeHeight, recipe.recipeItems); + } + + private CachedAnvilRecipe(ShapelessAnvilRecipes recipe) { + iAnvilRecipe = recipe; + inputStack = recipe.getRecipeOutput(); + } + + private void setShapedRecipeIngredients(int width, int height, Object[] items) { + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + if (items[y * width + x] == null) { + continue; + } + + ItemStack cachedStack = ((ItemStack) items[y * width + x]).copy(); + NEIHelper.fillMaterials(iAnvilRecipe, cachedStack, inputStack); + PositionedStack stack = new PositionedStack(cachedStack, 31 + x * 18, 54 + y * 18, false); + stack.setMaxSize(1); + ingredients.add(stack); + } + } + } + + @Override + public List getIngredients() { + return getCycledIngredients(cycleticks / 20, ingredients); + } + + @Override + public PositionedStack getResult() { + return new PositionedStack(inputStack, 75, 20); + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerBigFurnace.java b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerBigFurnace.java new file mode 100644 index 00000000..58fbdfae --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerBigFurnace.java @@ -0,0 +1,109 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.ItemList; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.api.refine.BigFurnaceRecipes; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +import java.util.ArrayList; + +public class RecipeHandlerBigFurnace extends TemplateRecipeHandler { + + private static ArrayList recipeList; + + @Override + public TemplateRecipeHandler newInstance() { + if (recipeList == null || recipeList.isEmpty()) { + fillRecipeList(); + } + + return super.newInstance(); + } + + private void fillRecipeList() { + recipeList = new ArrayList(); + for (ItemStack item : ItemList.items) { + BigFurnaceRecipes tempRecipe = BigFurnaceRecipes.getResult(item); + if (tempRecipe != null) { + recipeList.add(new RecipePair(item, tempRecipe.result)); + } + } + } + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("nei.method.big_furnace"); + } + + @Override + public String getGuiTexture() { + return "minefantasy2:textures/gui/furnace_top.png"; + } + + @Override + public int recipiesPerPage() { + return 2; + } + + @Override + public void drawBackground(int recipe) { + GL11.glColor4f(1, 1, 1, 1); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 166, 63); + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (RecipePair recipePair : recipeList) { + if (CustomToolHelper.areEqual(recipePair.outputStack, result)) { + BigFurnaceRecipe cachedRecipe = new BigFurnaceRecipe(recipePair.inputStack, recipePair.outputStack); + arecipes.add(cachedRecipe); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + BigFurnaceRecipes recipe = BigFurnaceRecipes.getResult(ingredient); + if (recipe != null) { + BigFurnaceRecipe cachedRecipe = new BigFurnaceRecipe(ingredient, recipe.result); + arecipes.add(cachedRecipe); + } + } + + private class RecipePair { + private ItemStack inputStack; + private ItemStack outputStack; + + private RecipePair(ItemStack input, ItemStack output) { + inputStack = input; + outputStack = output; + } + } + + private class BigFurnaceRecipe extends CachedRecipe { + + private PositionedStack input; + private PositionedStack output; + + private BigFurnaceRecipe(ItemStack inputStack, ItemStack outputStack) { + input = new PositionedStack(inputStack, 31, 15); + output = new PositionedStack(outputStack, 102, 16); // Hell of a perfectionist + } + + @Override + public PositionedStack getOtherStack() { + return input; + } + + @Override + public PositionedStack getResult() { + return output; + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerBlastFurnace.java b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerBlastFurnace.java new file mode 100644 index 00000000..7fb06dc2 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerBlastFurnace.java @@ -0,0 +1,85 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.api.knowledge.ResearchLogic; +import minefantasy.mf2.api.refine.BlastFurnaceRecipes; +import minefantasy.mf2.knowledge.KnowledgeListMF; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +import java.util.Map.Entry; + +public class RecipeHandlerBlastFurnace extends TemplateRecipeHandler { + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("method.blastfurnace"); + } + + @Override + public String getGuiTexture() { + return "minefantasy2:textures/gui/blast_chamber.png"; + } + + @Override + public void drawBackground(int recipe) { + GL11.glColor4f(1, 1, 1, 1); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 0, 133, 112); + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + if (ResearchLogic.hasInfoUnlocked(Minecraft.getMinecraft().thePlayer, KnowledgeListMF.blastfurn)) { + for (Entry entry : BlastFurnaceRecipes.smelting().getSmeltingList().entrySet()) { + if (CustomToolHelper.areEqual(entry.getValue(), result)) { + CachedBlastFurnaceRecipe recipe = new CachedBlastFurnaceRecipe(entry.getKey(), result); + arecipes.add(recipe); + } + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + if (ResearchLogic.hasInfoUnlocked(Minecraft.getMinecraft().thePlayer, KnowledgeListMF.blastfurn)) { + ItemStack result = BlastFurnaceRecipes.smelting().getSmeltingResult(ingredient); + if (result != null) { + CachedBlastFurnaceRecipe recipe = new CachedBlastFurnaceRecipe(ingredient, result); + arecipes.add(recipe); + } + } + } + + private class CachedBlastFurnaceRecipe extends CachedRecipe { + + private PositionedStack input; + private PositionedStack output; + + private CachedBlastFurnaceRecipe(ItemStack inputStack, ItemStack outputStack) { + input = new PositionedStack(inputStack, 75, 30); + output = new PositionedStack(outputStack, 75, 68); + } + + @Override + public PositionedStack getOtherStack() { + return input; + } + + @Override + public PositionedStack getResult() { + return output; + } + + } +} diff --git a/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerBloom.java b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerBloom.java new file mode 100644 index 00000000..18ebef7f --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerBloom.java @@ -0,0 +1,118 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import minefantasy.mf2.api.crafting.MineFantasyFuels; +import minefantasy.mf2.api.crafting.refine.BloomRecipe; +import minefantasy.mf2.api.heating.ForgeFuel; +import minefantasy.mf2.api.heating.ForgeItemHandler; +import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFC; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +public class RecipeHandlerBloom extends TemplateRecipeHandler { + + private static ArrayList afuels; + + private static void findFuels() { + afuels = new ArrayList(); + for (ForgeFuel fuel : ForgeItemHandler.forgeFuel) { + ItemStack item = fuel.fuel; + if (TileEntityBlastFC.isCarbon(item) && MineFantasyFuels.getCarbon(item) > 0) { + afuels.add(new FuelPair(item.copy())); + } + } + } + + @Override + public TemplateRecipeHandler newInstance() { + if (afuels == null || afuels.isEmpty()) { + findFuels(); + } + return super.newInstance(); + } + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("method.bloomery"); + } + + @Override + public String getGuiTexture() { + return "minefantasy2:textures/gui/bloomery.png"; + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public void drawBackground(int recipe) { + GL11.glColor4f(1, 1, 1, 1); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 0, 11, 176, 89); + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + Map recipes = BloomRecipe.recipeList; + for (Entry recipe : recipes.entrySet()) { + if (CustomToolHelper.areEqual(recipe.getValue(), result)) { + arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue())); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + ItemStack result = BloomRecipe.getSmeltingResult(ingredient); + if (result != null) { + SmeltingPair arecipe = new SmeltingPair(ingredient, result); + arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); + arecipes.add(arecipe); + } + } + + private static class FuelPair { + private PositionedStack stack; + + private FuelPair(ItemStack fuel) { + this.stack = new PositionedStack(fuel, 75, 57, false); + } + } + + private class SmeltingPair extends CachedRecipe { + private PositionedStack ingred; + private PositionedStack result; + + private SmeltingPair(ItemStack ingred, ItemStack result) { + this.ingred = new PositionedStack(ingred, 75, 19); + this.result = new PositionedStack(result, 120, 29); + } + + @Override + public List getIngredients() { + return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred)); + } + + @Override + public PositionedStack getResult() { + return result; + } + + @Override + public PositionedStack getOtherStack() { + return afuels.get((cycleticks / 48) % afuels.size()).stack; + } + } +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerCarpenter.java b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerCarpenter.java new file mode 100644 index 00000000..85fd0eeb --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerCarpenter.java @@ -0,0 +1,159 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import minefantasy.mf2.api.crafting.carpenter.CraftingManagerCarpenter; +import minefantasy.mf2.api.crafting.carpenter.ICarpenterRecipe; +import minefantasy.mf2.api.crafting.carpenter.ShapedCarpenterRecipes; +import minefantasy.mf2.api.crafting.carpenter.ShapelessCarpenterRecipes; +import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.api.knowledge.ResearchLogic; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +import java.util.ArrayList; +import java.util.List; + +public class RecipeHandlerCarpenter extends TemplateRecipeHandler { + + public int[][] stackorder = new int[][]{{0, 0}, {1, 0}, {0, 1}, {1, 1}, {0, 2}, {1, 2}, {2, 0}, + {2, 1}, {2, 2}}; + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("method.carpenter"); + } + + @Override + public String getGuiTexture() { + return "minefantasy2:textures/gui/knowledge/carpenterGrid.png"; + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @SuppressWarnings("unchecked") + @Override + public void loadCraftingRecipes(ItemStack result) { + for (ICarpenterRecipe irecipe : (List) CraftingManagerCarpenter.getInstance() + .getRecipeList()) { + if (CustomToolHelper.areEqual(irecipe.getRecipeOutput(), result) + && ResearchLogic.hasInfoUnlocked(Minecraft.getMinecraft().thePlayer, irecipe.getResearch())) { + CachedCarpenterRecipe recipe = handleRecipe(irecipe); + + if (recipe == null) + continue; + + recipe.computeVisuals(); + arecipes.add(recipe); + } + } + } + + @SuppressWarnings("unchecked") + @Override + public void loadUsageRecipes(ItemStack ingredient) { + for (ICarpenterRecipe irecipe : (List) CraftingManagerCarpenter.getInstance() + .getRecipeList()) { + + if (ResearchLogic.hasInfoUnlocked(Minecraft.getMinecraft().thePlayer, irecipe.getResearch())) { + continue; + } + + CachedCarpenterRecipe recipe = handleRecipe(irecipe); + + if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem())) + continue; + + recipe.computeVisuals(); + if (recipe.contains(recipe.ingredients, ingredient)) { + recipe.setIngredientPermutation(recipe.ingredients, ingredient); + arecipes.add(recipe); + } + } + } + + @Override + public void drawBackground(int recipe) { + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 33, 166, 171); + } + + private CachedCarpenterRecipe handleRecipe(ICarpenterRecipe irecipe) { + if (irecipe instanceof ShapedCarpenterRecipes) { + return new CachedCarpenterRecipe((ShapedCarpenterRecipes) irecipe); + } else if (irecipe instanceof ShapelessCarpenterRecipes) { + return new CachedCarpenterRecipe((ShapelessCarpenterRecipes) irecipe); + } + return null; + } + + class CachedCarpenterRecipe extends CachedRecipe { + + ICarpenterRecipe carpRecipe; + ArrayList ingredients = new ArrayList(); + PositionedStack result; + + public CachedCarpenterRecipe(ShapedCarpenterRecipes recipe) { + carpRecipe = recipe; + result = new PositionedStack(recipe.getRecipeOutput(), 75, 8); + setIngredients(recipe.recipeWidth, recipe.recipeHeight, recipe.recipeItems); + } + + @SuppressWarnings("unchecked") + public CachedCarpenterRecipe(ShapelessCarpenterRecipes recipe) { + carpRecipe = recipe; + result = new PositionedStack(recipe.getRecipeOutput(), 75, 8); + setIngredients(recipe.recipeItems); + } + + public void setIngredients(int width, int height, Object[] items) { + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + if (items[y * width + x] == null) + continue; + + MFPositionedStack stack = new MFPositionedStack(items[y * width + x], 41 + x * 23, 47 + y * 23, + false); + stack.setMaxSize(1); + ingredients.add(stack); + } + } + } + + public void computeVisuals() { + for (PositionedStack p : ingredients) { + p.generatePermutations(); + } + } + + @Override + public List getIngredients() { + return getCycledIngredients(cycleticks / 20, ingredients); + } + + public void setIngredients(List items) { + ingredients.clear(); + for (int ingred = 0; ingred < items.size(); ingred++) { + MFPositionedStack stack = new MFPositionedStack(items.get(ingred), 41 + stackorder[ingred][0] * 23, + 47 + stackorder[ingred][1] * 12); + stack.setMaxSize(1); + ingredients.add(stack); + } + } + + @Override + public PositionedStack getResult() { + return result; + } + } +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerCrucible.java b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerCrucible.java new file mode 100644 index 00000000..b22662c0 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerCrucible.java @@ -0,0 +1,116 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.api.refine.Alloy; +import minefantasy.mf2.api.refine.AlloyRecipes; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +import java.util.ArrayList; +import java.util.List; + +public class RecipeHandlerCrucible extends TemplateRecipeHandler { + + private String recipeName = "method.crucible"; + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal(recipeName); + } + + @Override + public String getGuiTexture() { + return getTexture(0); + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (Alloy alloy : AlloyRecipes.alloys) { + if (CustomToolHelper.areEqual(alloy.recipeOutput, result)) { + CachedAlloyRecipe recipe = new CachedAlloyRecipe(alloy); + arecipes.add(recipe); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + for (Alloy alloy : AlloyRecipes.alloys) { + for (Object object : alloy.recipeItems) { + ItemStack recipeIngredient = (ItemStack) object; + if (CustomToolHelper.areEqual(recipeIngredient, ingredient)) { + CachedAlloyRecipe recipe = new CachedAlloyRecipe(alloy); + arecipes.add(recipe); + } + } + } + } + + @Override + public void drawBackground(int recipe) { + CachedAlloyRecipe cachedRecipe = (CachedAlloyRecipe) arecipes.get(recipe); + GL11.glColor4f(1, 1, 1, 1); + GuiDraw.changeTexture(getTexture(cachedRecipe.tier)); + GuiDraw.drawTexturedModalRect(0, 0, 5, 0, 151, 94); + } + + private String getTexture(int tier) { + if (tier == 1) { + return "minefantasy2:textures/gui/crucible_advanced.png"; + } + if (tier >= 2) { + return "minefantasy2:textures/gui/crucible_mythic.png"; + } + return "minefantasy2:textures/gui/crucible.png"; + } + + private class CachedAlloyRecipe extends CachedRecipe { + + private ArrayList ingredients = new ArrayList(); + private PositionedStack output; + private int tier; + + @SuppressWarnings("unchecked") + private CachedAlloyRecipe(Alloy alloy) { + setIngridients(alloy.recipeItems); + output = new PositionedStack(alloy.recipeOutput, 124, 32); + tier = alloy.level; + } + + private void setIngridients(List recipeItems) { + for (int x = 0; x < 3; x++) { + for (int y = 0; y < 3; y++) { + int index = y * 3 + x; + if (recipeItems.size() > index) { + ItemStack currentStack = (ItemStack) recipeItems.get(index); + if (currentStack == null) { + continue; + } + + PositionedStack stack = new PositionedStack(currentStack, 57 + x * 18, 14 + y * 18); + ingredients.add(stack); + } + } + } + } + + @Override + public List getIngredients() { + return getCycledIngredients(cycleticks / 20, ingredients); + } + + @Override + public PositionedStack getResult() { + return output; + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerQuern.java b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerQuern.java new file mode 100644 index 00000000..b1f8496a --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerQuern.java @@ -0,0 +1,94 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import minefantasy.mf2.api.crafting.refine.QuernRecipes; +import minefantasy.mf2.api.helpers.CustomToolHelper; +import minefantasy.mf2.item.list.ComponentListMF; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +public class RecipeHandlerQuern extends TemplateRecipeHandler { + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("method.quern"); + } + + @Override + public String getGuiTexture() { + return "minefantasy2:textures/gui/quern.png"; + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public void drawBackground(int recipe) { + GL11.glColor4f(1, 1, 1, 1); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 0, 122, 80); + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (QuernRecipes recipe : QuernRecipes.recipeList) { + if (CustomToolHelper.areEqual(recipe.result, result)) { + CachedQuernRecipe cachedRecipe = new CachedQuernRecipe(recipe); + arecipes.add(cachedRecipe); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + if (ingredient != null) { + if (ingredient.getItem().equals(ComponentListMF.clay_pot)) { + for (QuernRecipes recipe : QuernRecipes.recipeList) { + CachedQuernRecipe cachedRecipe = new CachedQuernRecipe(recipe); + arecipes.add(cachedRecipe); + } + return; + } + + QuernRecipes output = QuernRecipes.getResult(ingredient); + if (output != null) { + CachedQuernRecipe recipe = new CachedQuernRecipe(output); + arecipes.add(recipe); + } + } + } + + private class CachedQuernRecipe extends CachedRecipe { + private ItemStack input, output; + private boolean consumePot; + + private CachedQuernRecipe(QuernRecipes recipe) { + input = recipe.input; + output = recipe.result; + consumePot = recipe.consumePot; + } + + @Override + public PositionedStack getIngredient() { + return new PositionedStack(input, 76, 9); + } + + @Override + public PositionedStack getOtherStack() { + if (consumePot) { + return new PositionedStack(new ItemStack(ComponentListMF.clay_pot), 76, 32); + } + return null; + } + + @Override + public PositionedStack getResult() { + return new PositionedStack(output, 76, 55); + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerTanning.java b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerTanning.java new file mode 100644 index 00000000..2fbddd11 --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/nei/RecipeHandlerTanning.java @@ -0,0 +1,79 @@ +package minefantasy.mf2.integration.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import minefantasy.mf2.api.crafting.tanning.TanningRecipe; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; + +import java.util.Arrays; + +public class RecipeHandlerTanning extends TemplateRecipeHandler { + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal("tile.tannerStrong.name"); + } + + @Override + public String getGuiTexture() { + return "minefantasy2:textures/gui/quern.png"; // need to draw texture + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + for (TanningRecipe recipe : TanningRecipe.recipeList) { + if (NEIServerUtils.areStacksSameTypeCrafting(result, recipe.output)) { + TanningPair cachedRecipe = new TanningPair(recipe); + arecipes.add(cachedRecipe); + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + TanningRecipe recipe = TanningRecipe.getRecipe(ingredient); + if (recipe != null) { + TanningPair cachedRecipe = new TanningPair(recipe); + cachedRecipe.setIngredientPermutation(Arrays.asList(cachedRecipe.input), ingredient); + arecipes.add(cachedRecipe); + } + } + + @Override + public void drawExtras(int recipe) { + TanningPair cachedRecipe = (TanningPair) this.arecipes.get(recipe); + GuiDraw.drawString(String.format("%s: %s", StatCollector.translateToLocal("nei.method.tanning.tool"), + cachedRecipe.toolType), 10, 85, -16777216, false); + } + + @Override + public int recipiesPerPage() { + return 1; + } + + private class TanningPair extends CachedRecipe { + + private PositionedStack input; + private PositionedStack output; + private String toolType; + + private TanningPair(TanningRecipe recipe) { + input = new PositionedStack(recipe.input, 50, 20); + output = new PositionedStack(recipe.output, 100, 20); + toolType = recipe.toolType; + } + + @Override + public PositionedStack getOtherStack() { + return input; + } + + @Override + public PositionedStack getResult() { + return output; + } + } +} diff --git a/src/main/java/minefantasy/mf2/integration/thaumcraft/TCCompat.java b/src/main/java/minefantasy/mf2/integration/thaumcraft/TCCompat.java new file mode 100644 index 00000000..05484fdf --- /dev/null +++ b/src/main/java/minefantasy/mf2/integration/thaumcraft/TCCompat.java @@ -0,0 +1,9 @@ +package minefantasy.mf2.integration.thaumcraft; + +public class TCCompat { + + public static void load() { + + } + +} diff --git a/src/main/java/minefantasy/mf2/item/AdvancedFuelHandlerMF.java b/src/main/java/minefantasy/mf2/item/AdvancedFuelHandlerMF.java index ce81b6f4..c5fb6236 100644 --- a/src/main/java/minefantasy/mf2/item/AdvancedFuelHandlerMF.java +++ b/src/main/java/minefantasy/mf2/item/AdvancedFuelHandlerMF.java @@ -1,5 +1,6 @@ package minefantasy.mf2.item; +import cpw.mods.fml.common.IFuelHandler; import minefantasy.mf2.api.crafting.MineFantasyFuels; import minefantasy.mf2.item.list.ComponentListMF; import net.minecraft.init.Blocks; @@ -7,42 +8,34 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.common.IFuelHandler; -public class AdvancedFuelHandlerMF implements IFuelHandler -{ +public class AdvancedFuelHandlerMF implements IFuelHandler { + + public static void registerItems() { + MineFantasyFuels.addCarbon(new ItemStack(Items.coal, 1, OreDictionary.WILDCARD_VALUE), 1); + MineFantasyFuels.addCarbon(ComponentListMF.coke, 1); + MineFantasyFuels.addCarbon(ComponentListMF.coal_flux, 1); + MineFantasyFuels.addCarbon(Blocks.coal_block, 9); + } - public static void registerItems() - { - MineFantasyFuels.addCarbon( new ItemStack(Items.coal, 1, OreDictionary.WILDCARD_VALUE), 1); - MineFantasyFuels.addCarbon(ComponentListMF.coke, 1); - MineFantasyFuels.addCarbon(ComponentListMF.coal_flux, 1); - MineFantasyFuels.addCarbon(Blocks.coal_block, 9); - } - @Override - public int getBurnTime(ItemStack fuel) - { - if(fuel == null) - { - return 0; - } - if(fuel.getItem() == ComponentListMF.coalDust) - { - return 300;//15s - } - if(fuel.getItem() == ComponentListMF.coke) - { - return 2400; - } - if(fuel.getItem() == Items.coal) - { - return 1200; - } - if(fuel.getItem() == Item.getItemFromBlock(Blocks.coal_block)) - { - return 10800; - } - return 0; - } + @Override + public int getBurnTime(ItemStack fuel) { + if (fuel == null) { + return 0; + } + if (fuel.getItem() == ComponentListMF.coalDust) { + return 300;// 15s + } + if (fuel.getItem() == ComponentListMF.coke) { + return 2400; + } + if (fuel.getItem() == Items.coal) { + return 3650; + } + if (fuel.getItem() == Item.getItemFromBlock(Blocks.coal_block)) { + return 10800; + } + return 0; + } } diff --git a/src/main/java/minefantasy/mf2/item/ClientItemsMF.java b/src/main/java/minefantasy/mf2/item/ClientItemsMF.java index 5ddcdd8a..cf493ff1 100644 --- a/src/main/java/minefantasy/mf2/item/ClientItemsMF.java +++ b/src/main/java/minefantasy/mf2/item/ClientItemsMF.java @@ -1,33 +1,27 @@ package minefantasy.mf2.item; -import java.util.List; - -import org.lwjgl.input.Keyboard; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.util.StatCollector; +import org.lwjgl.input.Keyboard; + +import java.util.List; @SideOnly(Side.CLIENT) -public class ClientItemsMF -{ +public class ClientItemsMF { - public static boolean showSpecials(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - if(GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak)) - { - return true; - } - else - { - String keyname = Keyboard.getKeyName(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode()); - list.add("Hold [" + EnumChatFormatting.AQUA + keyname.toUpperCase() + EnumChatFormatting.GRAY + "] for more information."); - return false; - } - } + public static boolean showSpecials(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + if (GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak)) { + return true; + } else { + String keyname = Keyboard.getKeyName(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode()); + list.add(StatCollector.translateToLocalFormatted("info.tooltip.moreinfo", keyname.toUpperCase())); + return false; + } + } } diff --git a/src/main/java/minefantasy/mf2/item/FuelHandlerMF.java b/src/main/java/minefantasy/mf2/item/FuelHandlerMF.java index 75d7743c..f8706e66 100644 --- a/src/main/java/minefantasy/mf2/item/FuelHandlerMF.java +++ b/src/main/java/minefantasy/mf2/item/FuelHandlerMF.java @@ -1,33 +1,27 @@ package minefantasy.mf2.item; +import cpw.mods.fml.common.IFuelHandler; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.item.list.ComponentListMF; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.IFuelHandler; -public class FuelHandlerMF implements IFuelHandler -{ +public class FuelHandlerMF implements IFuelHandler { - @Override - public int getBurnTime(ItemStack fuel) - { - if(fuel.getItem() == null) - { - return 0; - } - if(fuel.getItem() == ComponentListMF.plank) - { - return (int)(200 * CustomToolHelper.getBurnModifier(fuel)); - } - if(fuel.getItem() == ComponentListMF.coalDust) - { - return 400; - } - if(fuel.getItem() == ComponentListMF.coke) - { - return 2400; - } - return 0; - } + @Override + public int getBurnTime(ItemStack fuel) { + if (fuel.getItem() == null) { + return 0; + } + if (fuel.getItem() == ComponentListMF.plank) { + return (int) (200 * CustomToolHelper.getBurnModifier(fuel)); + } + if (fuel.getItem() == ComponentListMF.coalDust) { + return 400; + } + if (fuel.getItem() == ComponentListMF.coke) { + return 2400; + } + return 0; + } } diff --git a/src/main/java/minefantasy/mf2/item/ItemArtefact.java b/src/main/java/minefantasy/mf2/item/ItemArtefact.java index 5e7f4ca3..04296d16 100644 --- a/src/main/java/minefantasy/mf2/item/ItemArtefact.java +++ b/src/main/java/minefantasy/mf2/item/ItemArtefact.java @@ -1,7 +1,5 @@ package minefantasy.mf2.item; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -23,165 +21,146 @@ import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class ItemArtefact extends Item implements IArtefact -{ - public static final String MYTHIC = "mythic_artefacts"; - public static final String DWARVEN = "dwarven_artefacts"; - public static final String GNOMISH = "gnomish_artefacts"; - - private static final Artefact[] types = new Artefact[] - { - new Artefact("ancient_jewel", "mithril_jewel", 20, 2, MYTHIC, 2, "smeltMithril", "smeltMaster"), - new Artefact("ancient_jewel", "adamant_jewel", 20, 2, MYTHIC, 2, "smeltAdamantium", "smeltMaster"), - new Artefact("ancient_jewel", "master_jewel", 30, 2, MYTHIC, 1, "smeltMaster"), - new Artefact("trilogy_jewel", "trilogy_jewel", 3, null, 1), - new Artefact("schem_bomb", "schem_bomb", 50, 2, null, 1, "bombObsidian", "mineObsidian"), - new Artefact("schem_crossbow", "schem_crossbow", 50, 2, null, 1, "crossShaftAdvanced", "crossHeadAdvanced"), - new Artefact("schem_forge", "schem_forge", 50, 2, null, 1 , "advforge", "advcrucible"), - new Artefact("schem_gears", "schem_gears", 50, 2, null, 1, "cogArmour"), - new Artefact("schem_cogwork", "schem_cogwork", 50, 2, null, 1 , "cogArmour"), - new Artefact("schem_alloy", "schem_alloy", 50, 2, null, 1 , "compPlate"), - }; - - @SideOnly(Side.CLIENT) - private static IIcon[] icons; - public ItemArtefact(String name) - { - this(name, 2); - } - - public ItemArtefact(String name, int rarity) - { - this.setCreativeTab(CreativeTabMF.tabMaterialsMF); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setHasSubtypes(true); - } - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int dam) - { - return icons[Math.min(dam, icons.length-1)]; - } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - icons = new IIcon[types.length]; - for(int i = 0; i < types.length; ++i) - { - icons[i] = reg.registerIcon("minefantasy2:artefact/"+types[i].tex); - } - } - @Override - public String getUnlocalizedName(ItemStack item) - { - return "item."+getArtefact(item).name; - } - private Artefact getArtefact(ItemStack item) - { - return types[Math.min(item.getItemDamage(), types.length-1)]; - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List list) - { - for(int i = 0; i < types.length; i ++) - { - list.add(new ItemStack(item, 1, i)); - } +import java.util.List; + +public class ItemArtefact extends Item implements IArtefact { + public static final String MYTHIC = "mythic_artefacts"; + public static final String DWARVEN = "dwarven_artefacts"; + public static final String GNOMISH = "gnomish_artefacts"; + + private static final Artefact[] types = new Artefact[]{ + new Artefact("ancient_jewel", "mithril_jewel", 20, 2, MYTHIC, 2, "smeltMithril", "smeltMaster"), + new Artefact("ancient_jewel", "adamant_jewel", 20, 2, MYTHIC, 2, "smeltAdamantium", "smeltMaster"), + new Artefact("ancient_jewel", "master_jewel", 30, 2, MYTHIC, 1, "smeltMaster"), + new Artefact("trilogy_jewel", "trilogy_jewel", 3, null, 1), + new Artefact("schem_bomb", "schem_bomb", 50, 2, null, 1, "bombObsidian", "mineObsidian"), + new Artefact("schem_crossbow", "schem_crossbow", 50, 2, null, 1, "crossShaftAdvanced", "crossHeadAdvanced"), + new Artefact("schem_forge", "schem_forge", 50, 2, null, 1, "advforge", "advcrucible"), + new Artefact("schem_gears", "schem_gears", 50, 2, null, 1, "cogArmour"), + new Artefact("schem_cogwork", "schem_cogwork", 50, 2, null, 1, "cogArmour"), + new Artefact("schem_alloy", "schem_alloy", 50, 2, null, 1, "compPlate"),}; + + @SideOnly(Side.CLIENT) + private static IIcon[] icons; + + public ItemArtefact(String name) { + this(name, 2); + } + + public ItemArtefact(String name, int rarity) { + this.setCreativeTab(CreativeTabMF.tabMaterialsMF); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setHasSubtypes(true); } - @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = getArtefact(item).rarity+1; - - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= ToolListMF.rarity.length) - { - lvl = ToolListMF.rarity.length-1; - } - return ToolListMF.rarity[lvl]; - } - - public void registerAll() - { - for(int id = 0; id < types.length; id++) - { - types[id].register(this, id); - } - } - - @Override - public int getStudyTime(ItemStack item) - { - return getArtefact(item).time; - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - int meta = item.getItemDamage(); - if(!world.isRemote && meta > 3) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, user, false); - - if (movingobjectposition == null) - { - return item; - } - else - { - if(BlockSchematic.useSchematic(item, world, user, movingobjectposition)) - { - item.stackSize --; - return item; - } - } - } - return item; + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int dam) { + return icons[Math.min(dam, icons.length - 1)]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + icons = new IIcon[types.length]; + for (int i = 0; i < types.length; ++i) { + icons[i] = reg.registerIcon("minefantasy2:artefact/" + types[i].tex); + } + } + + @Override + public String getUnlocalizedName(ItemStack item) { + return "item." + getArtefact(item).name; + } + + private Artefact getArtefact(ItemStack item) { + return types[Math.min(item.getItemDamage(), types.length - 1)]; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < types.length; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public EnumRarity getRarity(ItemStack item) { + int lvl = getArtefact(item).rarity + 1; + + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (lvl >= ToolListMF.rarity.length) { + lvl = ToolListMF.rarity.length - 1; + } + return ToolListMF.rarity[lvl]; + } + + public void registerAll() { + for (int id = 0; id < types.length; id++) { + types[id].register(this, id); + } + } + + @Override + public int getStudyTime(ItemStack item) { + return getArtefact(item).time; + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + int meta = item.getItemDamage(); + if (!world.isRemote && meta > 3) { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, user, false); + + if (movingobjectposition == null) { + return item; + } else { + if (BlockSchematic.useSchematic(item, world, user, movingobjectposition)) { + item.stackSize--; + return item; + } + } + } + return item; } } -class Artefact -{ - public final String name, tex; - public final int rarity, time; - public final String[] researches; - public final String lootType; - public final int dropWeight; - Artefact(String name, String tex, int rarity, String lootType, int dropChance) - { - this(name, tex, 0, rarity, lootType, dropChance); - } - Artefact(String name, String tex, int time, int rarity, String lootType, int dropChance, String...researches) - { - this.name = name; - this.time = time; - this.tex = tex; - this.rarity = rarity; - this.researches = researches; - this.lootType = lootType; - this.dropWeight = dropChance; - } - public void register(Item item, int id) - { - if(researches != null) - { - for(String research : this.researches) - { - ResearchArtefacts.addArtefact(new ItemStack(item, 1, id), research.toLowerCase()); - } - } - if(lootType != null) - { - ChestGenHooks.addItem(lootType, new WeightedRandomChestContent(new ItemStack(item, 1, id), 1, 1, dropWeight)); - } - } + +class Artefact { + public final String name, tex; + public final int rarity, time; + public final String[] researches; + public final String lootType; + public final int dropWeight; + + Artefact(String name, String tex, int rarity, String lootType, int dropChance) { + this(name, tex, 0, rarity, lootType, dropChance); + } + + Artefact(String name, String tex, int time, int rarity, String lootType, int dropChance, String... researches) { + this.name = name; + this.time = time; + this.tex = tex; + this.rarity = rarity; + this.researches = researches; + this.lootType = lootType; + this.dropWeight = dropChance; + } + + public void register(Item item, int id) { + if (researches != null) { + for (String research : this.researches) { + ResearchArtefacts.addArtefact(new ItemStack(item, 1, id), research.toLowerCase()); + } + } + if (lootType != null) { + ChestGenHooks.addItem(lootType, + new WeightedRandomChestContent(new ItemStack(item, 1, id), 1, 1, dropWeight)); + } + } } diff --git a/src/main/java/minefantasy/mf2/item/ItemBandage.java b/src/main/java/minefantasy/mf2/item/ItemBandage.java index f6325209..8b469821 100644 --- a/src/main/java/minefantasy/mf2/item/ItemBandage.java +++ b/src/main/java/minefantasy/mf2/item/ItemBandage.java @@ -1,5 +1,6 @@ package minefantasy.mf2.item; +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.item.list.CreativeTabMF; @@ -12,176 +13,154 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -public class ItemBandage extends Item -{ +public class ItemBandage extends Item { + private static final String healingID = "MF_Bandage_progress"; private String name; private float healPwr; - private float secondsToUse = 5F; + private float secondsToUse = 5F; - public ItemBandage(String id, float healAmount) - { + public ItemBandage(String id, float healAmount) { super(); name = id; healPwr = healAmount; setMaxStackSize(16); setCreativeTab(CreativeTabMF.tabGadget); - setTextureName("minefantasy2:Other/"+name); - GameRegistry.registerItem(this, "MF_Aid_"+name, MineFantasyII.MODID); - this.setUnlocalizedName(name); + setTextureName("minefantasy2:Other/" + name); + GameRegistry.registerItem(this, "MF_Aid_" + name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } @Override - public EnumRarity getRarity(ItemStack item) - { - if(healPwr <= 5) - { - return ToolListMF.poor; - } - return super.getRarity(item); - } + public EnumRarity getRarity(ItemStack item) { + if (healPwr <= 5) { + return ToolListMF.poor; + } + return super.getRarity(item); + } + /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + * Called whenever this item is equipped and the right mouse button is pressed. + * Args: itemStack, world, entityPlayer */ @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(!user.isSneaking() && canHeal(user) && user.hurtResistantTime <= 0) - { - int time = this.getMaxItemUseDuration(item); - if(ResearchLogic.hasInfoUnlocked(user, "firstaid")) - { - time /= 3; - } - user.setItemInUse(item, time); - } + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (!user.isSneaking() && canHeal(user) && user.hurtResistantTime <= 0) { + int time = this.getMaxItemUseDuration(item); + if (ResearchLogic.hasInfoUnlocked(user, "firstaid")) { + time /= 3; + } + user.setItemInUse(item, time); + } return item; } + /** - * returns the action that specifies what animation to play when the items is being used + * returns the action that specifies what animation to play when the items is + * being used */ @Override - public EnumAction getItemUseAction(ItemStack item) - { + public EnumAction getItemUseAction(ItemStack item) { return EnumAction.block; } + @Override - public int getMaxItemUseDuration(ItemStack item) - { - return (int)(20F*secondsToUse); + public int getMaxItemUseDuration(ItemStack item) { + return (int) (20F * secondsToUse); } + @Override - public ItemStack onEaten(ItemStack item, World world, EntityPlayer player) - { - return heal(player, player, item); + public ItemStack onEaten(ItemStack item, World world, EntityPlayer player) { + return heal(player, player, item); } - + @Override - public void onUsingTick(ItemStack stack, EntityPlayer player, int count) - { - super.onUsingTick(stack, player, count); - - if(!canHeal(player) && !player.worldObj.isRemote) - { - player.stopUsingItem(); - } - if(count % 5 == 0) - { - player.playSound("dig.cloth", 1F, 0.005F); - } - player.swingItem(); + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { + super.onUsingTick(stack, player, count); + + if (!canHeal(player) && !player.worldObj.isRemote) { + player.stopUsingItem(); + } + if (count % 5 == 0) { + player.playSound("dig.cloth", 1F, 0.005F); + } + player.swingItem(); } - + @Override - public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) - { - if(player.isSneaking() && isReadyToHeal(player, entity)) - { - heal(player, entity, itemstack); - return true; + public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) { + if (player.isSneaking() && isReadyToHeal(player, entity)) { + heal(player, entity, itemstack); + return true; } return super.itemInteractionForEntity(itemstack, player, entity); } - private ItemStack heal(EntityPlayer player, EntityLivingBase toHeal, ItemStack item) - { - if(player.worldObj.isRemote) - { - return item; - } - - if(toHeal != null) - { - if(canHeal(toHeal)) - { - toHeal.worldObj.playSoundEffect(toHeal.posX, toHeal.posY, toHeal.posZ, "dig.cloth", 1.0F, 3.0F); - player.swingItem(); - - if(!player.worldObj.isRemote) - { - float power = healPwr; - if(ResearchLogic.hasInfoUnlocked(player, "doctor")) - { - power *= 1.5F; - } - toHeal.heal(power); - - if(!player.capabilities.isCreativeMode) - { - item.stackSize --; - if(item.stackSize <= 0) - { - - } - } - } - toHeal.getEntityData().setInteger(EventManagerMF.injuredNBT, 0); - } + + private ItemStack heal(EntityPlayer player, EntityLivingBase toHeal, ItemStack item) { + if (player.worldObj.isRemote) { + return item; + } + + if (toHeal != null) { + if (canHeal(toHeal)) { + toHeal.worldObj.playSoundEffect(toHeal.posX, toHeal.posY, toHeal.posZ, "dig.cloth", 1.0F, 3.0F); + player.swingItem(); + + if (!player.worldObj.isRemote) { + float power = healPwr; + if (ResearchLogic.hasInfoUnlocked(player, "doctor")) { + power *= 1.5F; + } + toHeal.heal(power); + + if (!player.capabilities.isCreativeMode) { + item.stackSize--; + if (item.stackSize <= 0) { + + } + } + } + toHeal.getEntityData().setInteger(EventManagerMF.injuredNBT, 0); + } + } + return item; + } + + private boolean canHeal(EntityLivingBase toHeal) { + return toHeal.hurtResistantTime <= 0 + && (toHeal.getHealth() <= (toHeal.getMaxHealth() - 1F) || EventManagerMF.getInjuredTime(toHeal) > 0) + && !toHeal.isBurning(); + } + + public boolean isReadyToHeal(EntityPlayer player, EntityLivingBase patient) { + int time = getUserHealTime(patient) + 1; + if (ResearchLogic.hasInfoUnlocked(player, "firstaid")) { + time += 3; + } + patient.playSound("dig.cloth", 1F, 0.005F); + player.swingItem(); + + if (time >= (int) (4 * secondsToUse)) { + setUserHealTime(patient, 0); + return true; + } + + setUserHealTime(patient, time); + return false; + } + + public void setUserHealTime(EntityLivingBase user, int value) { + if (user.getEntityData() != null) { + user.getEntityData().setInteger(healingID, value); } - return item; - } - - private boolean canHeal(EntityLivingBase toHeal) - { - return toHeal.hurtResistantTime <= 0 && (toHeal.getHealth() <= (toHeal.getMaxHealth()-1F) || EventManagerMF.getInjuredTime(toHeal) > 0) && !toHeal.isBurning(); - } - - public boolean isReadyToHeal(EntityPlayer player, EntityLivingBase patient) - { - int time = getUserHealTime(patient) + 1; - if(ResearchLogic.hasInfoUnlocked(player, "firstaid")) - { - time += 3; - } - patient.playSound("dig.cloth", 1F, 0.005F); - player.swingItem(); - - if(time >= (int)(4*secondsToUse)) - { - setUserHealTime(patient, 0); - return true; - } - - setUserHealTime(patient, time); - return false; - } - public void setUserHealTime(EntityLivingBase user, int value) - { - if(user.getEntityData() != null) - { - user.getEntityData().setInteger(healingID, value); - } - } - public int getUserHealTime(EntityLivingBase user) - { - if(user.getEntityData() != null) - { - if(user.getEntityData().hasKey(healingID)) - { - return user.getEntityData().getInteger(healingID); - } - } - return 0; - } - private static final String healingID = "MF_Bandage_progress"; + } + + public int getUserHealTime(EntityLivingBase user) { + if (user.getEntityData() != null) { + if (user.getEntityData().hasKey(healingID)) { + return user.getEntityData().getInteger(healingID); + } + } + return 0; + } } diff --git a/src/main/java/minefantasy/mf2/item/ItemBurntFood.java b/src/main/java/minefantasy/mf2/item/ItemBurntFood.java index 7e021b99..fb340e4a 100644 --- a/src/main/java/minefantasy/mf2/item/ItemBurntFood.java +++ b/src/main/java/minefantasy/mf2/item/ItemBurntFood.java @@ -1,43 +1,39 @@ package minefantasy.mf2.item; -import java.util.Random; - import minefantasy.mf2.item.food.FoodListMF; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class ItemBurntFood extends ItemComponentMF -{ +import java.util.Random; + +public class ItemBurntFood extends ItemComponentMF { + + private Random rand = new Random(); + + public ItemBurntFood(String name) { + super(name, -1); + setTextureName("minefantasy2:food/" + name); + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { + if (this == FoodListMF.burnt_food) { + if (!world.isRemote && rand.nextInt(5) == 0) { + player.entityDropItem(new ItemStack(Items.coal, 1, 1), 0.0F); + } + --item.stackSize; + return item; + } + if (!world.isRemote) { + player.entityDropItem(new ItemStack(FoodListMF.burnt_food, item.stackSize), 0.0F); + } + return item.getItem().getContainerItem(item); + } - public ItemBurntFood(String name) - { - super(name, -1); - setTextureName("minefantasy2:food/"+name); - } - private Random rand = new Random(); - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { - if(this == FoodListMF.burnt_food) - { - if(!world.isRemote && rand.nextInt(5) == 0) - { - player.entityDropItem(new ItemStack(Items.coal, 1, 1), 0.0F); - } - --item.stackSize; - return item; - } - if(!world.isRemote) - { - player.entityDropItem(new ItemStack(FoodListMF.burnt_food, item.stackSize), 0.0F); - } - return item.getItem().getContainerItem(item); - } - @Override - public ItemStack getContainerItem(ItemStack itemStack) - { + @Override + public ItemStack getContainerItem(ItemStack itemStack) { return new ItemStack(getContainerItem(), itemStack.stackSize); } } diff --git a/src/main/java/minefantasy/mf2/item/ItemComponentMF.java b/src/main/java/minefantasy/mf2/item/ItemComponentMF.java index 17983e5d..f77f7232 100644 --- a/src/main/java/minefantasy/mf2/item/ItemComponentMF.java +++ b/src/main/java/minefantasy/mf2/item/ItemComponentMF.java @@ -1,9 +1,5 @@ package minefantasy.mf2.item; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -24,339 +20,309 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * @author Anonymous Productions */ -public class ItemComponentMF extends Item implements ITieredComponent -{ - protected String name; - public ItemComponentMF(int rarity) - { - itemRarity = rarity; - } - public ItemComponentMF(String name) - { - this(name, 0); - } - public ItemComponentMF(String name, int rarity) - { - itemRarity = rarity; - this.name = name; - setTextureName("minefantasy2:component/"+name); - this.setCreativeTab(CreativeTabMF.tabMaterialsMF); - GameRegistry.registerItem(this, "MF_Com_"+name, MineFantasyII.MODID); - - - - this.setUnlocalizedName(name); - } - - /*private int itemRarity; - @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = itemRarity+1; - - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= ToolListMF.rarity.length) - { - lvl = ToolListMF.rarity.length-1; - } - return ToolListMF.rarity[lvl]; - }*/ - +public class ItemComponentMF extends Item implements ITieredComponent { + protected String name; + protected int itemRarity; + // STORAGE + protected String blocktex; + protected String storageType; + + /* + * private int itemRarity; + * + * @Override public EnumRarity getRarity(ItemStack item) { int lvl = + * itemRarity+1; + * + * if(item.isItemEnchanted()) { if(lvl == 0) { lvl++; } lvl ++; } if(lvl >= + * ToolListMF.rarity.length) { lvl = ToolListMF.rarity.length-1; } return + * ToolListMF.rarity[lvl]; } + */ + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float unitCount = 1; + private IIcon componentTex = null; + private String materialType = null; + + public ItemComponentMF(int rarity) { + itemRarity = rarity; + } + + public ItemComponentMF(String name) { + this(name, 0); + } + + public ItemComponentMF(String name, int rarity) { + itemRarity = rarity; + this.name = name; + setTextureName("minefantasy2:component/" + name); + this.setCreativeTab(CreativeTabMF.tabMaterialsMF); + GameRegistry.registerItem(this, "MF_Com_" + name, MineFantasyII.MODID); + + this.setUnlocalizedName(name); + } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(this.getCreativeTab() != CreativeTabMF.tabMaterialsMF) - { - super.getSubItems(item, tab, list); - return; - } - - if(this != ComponentListMF.plank) - { - return; - } - - for(Item ingot: ComponentListMF.ingots) - { - if(ingot == ComponentListMF.ingots[3]) - { - add(list, Items.iron_ingot); - } - if(ingot == ComponentListMF.ingots[7]) - { - add(list, Items.gold_ingot); - } - add(list, ingot); - } - - if(isCustom) - { - ArrayList wood = CustomMaterial.getList("wood"); - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorWood = wood.iterator(); - while(iteratorWood.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); - list.add( this.construct(customMat.name) ); - list.add( ((ItemComponentMF)ComponentListMF.plank_pane).construct(customMat.name) ); - } - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - list.add( ComponentListMF.bar(customMat.name) ); - } - } - - add(list, ComponentListMF.nail); - add(list, ComponentListMF.rivet); - add(list, ComponentListMF.thread); - add(list, ComponentListMF.clay_pot_uncooked); - add(list, ComponentListMF.clay_pot); - add(list, ComponentListMF.ingot_mould_uncooked); - add(list, ComponentListMF.ingot_mould); - - add(list, ComponentListMF.leather_strip); - add(list, ComponentListMF.rawhideSmall); - add(list, ComponentListMF.rawhideMedium); - add(list, ComponentListMF.rawhideLarge); - add(list, ComponentListMF.hideSmall); - add(list, ComponentListMF.hideMedium); - add(list, ComponentListMF.hideLarge); - - add(list, ComponentListMF.oreCopper); - add(list, ComponentListMF.oreTin); - add(list, ComponentListMF.oreIron); - add(list, ComponentListMF.oreSilver); - add(list, ComponentListMF.oreGold); - add(list, ComponentListMF.oreTungsten); - - add(list, ComponentListMF.flux); - add(list, ComponentListMF.flux_strong); - add(list, ComponentListMF.flux_pot); - add(list, ComponentListMF.coal_flux); - add(list, ComponentListMF.coke); - add(list, ComponentListMF.diamond_shards); - add(list, ComponentListMF.fletching); - add(list, ComponentListMF.plant_oil); - - add(list, ComponentListMF.coalDust); - add(list, ComponentListMF.iron_prep); - add(list, ComponentListMF.obsidian_rock); - add(list, ComponentListMF.sulfur); - add(list, ComponentListMF.nitre); - add(list, ComponentListMF.blackpowder); - add(list, ComponentListMF.blackpowder_advanced); - add(list, ComponentListMF.bomb_fuse); - add(list, ComponentListMF.bomb_fuse_long); - add(list, ComponentListMF.shrapnel); - add(list, ComponentListMF.magma_cream_refined); - add(list, ComponentListMF.bomb_casing_uncooked); - add(list, ComponentListMF.bomb_casing); - add(list, ComponentListMF.mine_casing_uncooked); - add(list, ComponentListMF.mine_casing); - add(list, ComponentListMF.bomb_casing_iron); - add(list, ComponentListMF.mine_casing_iron); - add(list, ComponentListMF.bomb_casing_obsidian); - add(list, ComponentListMF.mine_casing_obsidian); - add(list, ComponentListMF.bomb_casing_crystal); - add(list, ComponentListMF.mine_casing_crystal); - add(list, ComponentListMF.bomb_casing_arrow); - add(list, ComponentListMF.bomb_casing_bolt); - - add(list, ComponentListMF.clay_brick); - add(list, ComponentListMF.kaolinite); - add(list, ComponentListMF.kaolinite_dust); - add(list, ComponentListMF.fireclay); - add(list, ComponentListMF.fireclay_brick); - add(list, ComponentListMF.strong_brick); - add(list, ComponentListMF.dragon_heart); - add(list, ComponentListMF.ornate_items); - - add(list, ComponentListMF.talisman_lesser); - add(list, ComponentListMF.talisman_greater); - - add(list, ComponentListMF.bolt); - add(list, ComponentListMF.iron_frame); - add(list, ComponentListMF.iron_strut); - add(list, ComponentListMF.steel_tube); - add(list, ComponentListMF.bronze_gears); - add(list, ComponentListMF.tungsten_gears); - add(list, ComponentListMF.cogwork_shaft); - add(list, ComponentListMF.ingotCompositeAlloy); - - add(list, ComponentListMF.crossbow_handle_wood); - add(list, ComponentListMF.crossbow_stock_wood); - add(list, ComponentListMF.crossbow_stock_iron); - - add(list, ComponentListMF.cross_arms_basic); - add(list, ComponentListMF.cross_arms_light); - add(list, ComponentListMF.cross_arms_heavy); - add(list, ComponentListMF.cross_arms_advanced); - - add(list, ComponentListMF.cross_ammo); - add(list, ComponentListMF.cross_scope); - add(list, ComponentListMF.cross_bayonet); - - add(list, ComponentListMF.copper_coin); - add(list, ComponentListMF.silver_coin); - add(list, ComponentListMF.gold_coin); + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (this.getCreativeTab() != CreativeTabMF.tabMaterialsMF) { + super.getSubItems(item, tab, list); + return; + } + + if (this != ComponentListMF.plank) { + return; + } + + for (Item ingot : ComponentListMF.ingots) { + if (ingot == ComponentListMF.ingots[3]) { + add(list, Items.iron_ingot); + } + if (ingot == ComponentListMF.ingots[7]) { + add(list, Items.gold_ingot); + } + add(list, ingot); + } + + if (isCustom) { + ArrayList wood = CustomMaterial.getList("wood"); + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorWood = wood.iterator(); + while (iteratorWood.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); + list.add(this.construct(customMat.name)); + list.add(((ItemComponentMF) ComponentListMF.plank_pane).construct(customMat.name)); + } + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + list.add(ComponentListMF.bar(customMat.name)); + } + } + + add(list, ComponentListMF.nail); + add(list, ComponentListMF.rivet); + add(list, ComponentListMF.thread); + add(list, ComponentListMF.clay_pot_uncooked); + add(list, ComponentListMF.clay_pot); + add(list, ComponentListMF.ingot_mould_uncooked); + add(list, ComponentListMF.ingot_mould); + + add(list, ComponentListMF.leather_strip); + add(list, ComponentListMF.rawhideSmall); + add(list, ComponentListMF.rawhideMedium); + add(list, ComponentListMF.rawhideLarge); + add(list, ComponentListMF.hideSmall); + add(list, ComponentListMF.hideMedium); + add(list, ComponentListMF.hideLarge); + + add(list, ComponentListMF.oreCopper); + add(list, ComponentListMF.oreTin); + add(list, ComponentListMF.oreIron); + add(list, ComponentListMF.oreSilver); + add(list, ComponentListMF.oreGold); + add(list, ComponentListMF.oreTungsten); + + add(list, ComponentListMF.flux); + add(list, ComponentListMF.flux_strong); + add(list, ComponentListMF.flux_pot); + add(list, ComponentListMF.coal_flux); + add(list, ComponentListMF.coke); + add(list, ComponentListMF.diamond_shards); + add(list, ComponentListMF.fletching); + add(list, ComponentListMF.plant_oil); + + add(list, ComponentListMF.coalDust); + add(list, ComponentListMF.iron_prep); + add(list, ComponentListMF.obsidian_rock); + add(list, ComponentListMF.sulfur); + add(list, ComponentListMF.nitre); + add(list, ComponentListMF.blackpowder); + add(list, ComponentListMF.blackpowder_advanced); + add(list, ComponentListMF.bomb_fuse); + add(list, ComponentListMF.bomb_fuse_long); + add(list, ComponentListMF.shrapnel); + add(list, ComponentListMF.magma_cream_refined); + add(list, ComponentListMF.bomb_casing_uncooked); + add(list, ComponentListMF.bomb_casing); + add(list, ComponentListMF.mine_casing_uncooked); + add(list, ComponentListMF.mine_casing); + add(list, ComponentListMF.bomb_casing_iron); + add(list, ComponentListMF.mine_casing_iron); + add(list, ComponentListMF.bomb_casing_obsidian); + add(list, ComponentListMF.mine_casing_obsidian); + add(list, ComponentListMF.bomb_casing_crystal); + add(list, ComponentListMF.mine_casing_crystal); + add(list, ComponentListMF.bomb_casing_arrow); + add(list, ComponentListMF.bomb_casing_bolt); + + add(list, ComponentListMF.clay_brick); + add(list, ComponentListMF.kaolinite); + add(list, ComponentListMF.kaolinite_dust); + add(list, ComponentListMF.fireclay); + add(list, ComponentListMF.fireclay_brick); + add(list, ComponentListMF.strong_brick); + add(list, ComponentListMF.dragon_heart); + add(list, ComponentListMF.ornate_items); + + add(list, ComponentListMF.talisman_lesser); + add(list, ComponentListMF.talisman_greater); + + add(list, ComponentListMF.bolt); + add(list, ComponentListMF.iron_frame); + add(list, ComponentListMF.iron_strut); + add(list, ComponentListMF.steel_tube); + add(list, ComponentListMF.bronze_gears); + add(list, ComponentListMF.tungsten_gears); + add(list, ComponentListMF.cogwork_shaft); + add(list, ComponentListMF.ingotCompositeAlloy); + + add(list, ComponentListMF.crossbow_handle_wood); + add(list, ComponentListMF.crossbow_stock_wood); + add(list, ComponentListMF.crossbow_stock_iron); + + add(list, ComponentListMF.cross_arms_basic); + add(list, ComponentListMF.cross_arms_light); + add(list, ComponentListMF.cross_arms_heavy); + add(list, ComponentListMF.cross_arms_advanced); + + add(list, ComponentListMF.cross_ammo); + add(list, ComponentListMF.cross_scope); + add(list, ComponentListMF.cross_bayonet); + + add(list, ComponentListMF.copper_coin); + add(list, ComponentListMF.silver_coin); + add(list, ComponentListMF.gold_coin); + add(list, ComponentListMF.dwarven_fuel); } - private void add(List list, Item item) - { - list.add(new ItemStack(item)); + + private void add(List list, Item item) { + list.add(new ItemStack(item)); } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + super.addInformation(item, user, list, extra); - if(isCustom) - { - CustomToolHelper.addComponentString(item, list,CustomMaterial.getMaterialFor(item,CustomToolHelper.slot_main), this.unitCount); + if (isCustom) { + CustomToolHelper.addComponentString(item, list, + CustomMaterial.getMaterialFor(item, CustomToolHelper.slot_main), this.unitCount); } } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - private float unitCount = 1; - public ItemComponentMF setCustom(float units, String type) - { - canRepair = false; - this.unitCount = units; - setTextureName("minefantasy2:custom/component/"+name); - isCustom = true; - this.setHasSubtypes(true); - this.materialType = type; - return this; - } - - - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon componentTex = null; + + public ItemComponentMF setCustom(float units, String type) { + canRepair = false; + this.unitCount = units; + setTextureName("minefantasy2:custom/component/" + name); + isCustom = true; + this.setHasSubtypes(true); + this.materialType = type; + return this; + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - componentTex = reg.registerIcon(this.getIconString()); - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + componentTex = reg.registerIcon(this.getIconString()); + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom ) - { - return componentTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom) { + return componentTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - ////Probably not the cleanest way to do this, but I decided to because for this item, - /// the color will always be only one layer from only one material - - public int getColorFromItemStack(ItemStack item, int layer) - { - //return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); - if(isCustom) - { - CustomMaterial mat = CustomMaterial.getMaterialFor(item,CustomToolHelper.slot_main); - if(mat != null) - return mat.getColourInt(); - } - return super.getColorFromItemStack(item, layer); + //// Probably not the cleanest way to do this, but I decided to because for this + //// item, + /// the color will always be only one layer from only one material + + public int getColorFromItemStack(ItemStack item, int layer) { + // return CustomToolHelper.getColourFromItemStack(item, layer, + // super.getColorFromItemStack(item, layer)); + if (isCustom) { + CustomMaterial mat = CustomMaterial.getMaterialFor(item, CustomToolHelper.slot_main); + if (mat != null) + return mat.getColourInt(); + } + return super.getColorFromItemStack(item, layer); } - - protected int itemRarity; + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } - - public ItemStack construct(String main) - { - return construct(main, 1); - } - public ItemStack construct(String main, int stacksize) - { - return CustomToolHelper.constructSingleColoredLayer(this, main, stacksize); - } - - + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + + public ItemStack construct(String main) { + return construct(main, 1); + } + + public ItemStack construct(String main, int stacksize) { + return CustomToolHelper.constructSingleColoredLayer(this, main, stacksize); + } + // ====================================================== CUSTOM END + // ==============================================================\\ + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - if(isCustom){ - return CustomToolHelper.getLocalisedName(item, "item.commodity_"+name+".name"); - } - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + if (isCustom) { + return CustomToolHelper.getLocalisedName(item, "item.commodity_" + name + ".name"); + } + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - private String materialType = null; + @Override - public String getMaterialType(ItemStack item) - { - return isCustom ? materialType : null; - } - //====================================================== CUSTOM END ==============================================================\\ + public String getMaterialType(ItemStack item) { + return isCustom ? materialType : null; + } - //STORAGE - protected String blocktex; - protected String storageType; - - public ItemComponentMF setStoragePlacement(String type, String tex) - { - this.blocktex = tex; - this.storageType = type; - return this; - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if (!world.isRemote && storageType != null) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, user, false); - - if (movingobjectposition == null) - { - return item; - } else - { - int placed = BlockComponent.useComponent(item, storageType, blocktex, world, user, movingobjectposition); - if (placed > 0) - { - item.stackSize -= placed; - return item; - } - } - } - return super.onItemRightClick(item, world, user); - } + public ItemComponentMF setStoragePlacement(String type, String tex) { + this.blocktex = tex; + this.storageType = type; + return this; + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (!world.isRemote && storageType != null) { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, user, false); + + if (movingobjectposition == null) { + return item; + } else { + int placed = BlockComponent.useComponent(item, storageType, blocktex, world, user, + movingobjectposition); + if (placed > 0) { + item.stackSize -= placed; + return item; + } + } + } + return super.onItemRightClick(item, world, user); + } } diff --git a/src/main/java/minefantasy/mf2/item/ItemFilledMould.java b/src/main/java/minefantasy/mf2/item/ItemFilledMould.java index 258e477a..41072294 100644 --- a/src/main/java/minefantasy/mf2/item/ItemFilledMould.java +++ b/src/main/java/minefantasy/mf2/item/ItemFilledMould.java @@ -1,10 +1,7 @@ package minefantasy.mf2.item; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.heating.Heatable; import minefantasy.mf2.api.heating.TongsHelper; import minefantasy.mf2.item.list.ComponentListMF; import net.minecraft.entity.item.EntityItem; @@ -12,122 +9,113 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class ItemFilledMould extends ItemComponentMF -{ - - public ItemFilledMould() - { - super("ingot_mould_filled"); - //setMaxStackSize(1); - this.setUnlocalizedName("ingot_mould"); - } - private static final String itemNBT = "MF_HeldItem"; - public static ItemStack createMould(ItemStack fill) - { - ItemStack mould = new ItemStack(ComponentListMF.ingot_mould_filled); - NBTTagCompound nbt = getOrCreateNBT(mould); - NBTTagCompound save = new NBTTagCompound(); - fill.writeToNBT(save); - nbt.setTag(itemNBT, save); - return mould; - } - public ItemStack getHeldItem(ItemStack item) - { - NBTTagCompound nbt = getOrCreateNBT(item); - if(nbt.hasKey(itemNBT)) - { - return ItemStack.loadItemStackFromNBT(nbt.getCompoundTag(itemNBT)); - } - return null; - } - public static NBTTagCompound getOrCreateNBT(ItemStack item) - { - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - return item.getTagCompound(); - } - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - ItemStack held = getHeldItem(item); - if(held != null) - { - list.add(held.getDisplayName()); - } - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - - if (movingobjectposition == null) { - return item; - } else { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!world.canMineBlock(player, i, j, k)) { - return item; - } - - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { - return item; - } - - float water = TongsHelper.getWaterSource(world, i, j, k); - ItemStack drop = getHeldItem(item); - - if (drop != null && water >= 0) - { - player.playSound("random.splash", 1F, 1F); - player.playSound("random.fizz", 2F, 0.5F); - - for (int a = 0; a < 5; a++) { - world.spawnParticle("largesmoke", i + 0.5F, j + 1, k + 0.5F, 0, 0.065F, 0); - } - - if (!world.isRemote) - { - ItemStack mould = new ItemStack(ComponentListMF.ingot_mould); - if(!world.getBlock(i, j+1, k).getMaterial().isSolid()) - { - dropItem(world, i, j+1, k, drop); - dropItem(world, i, j+1, k, mould); - } - else - { - dropItem(world, player.posX, player.posY, player.posZ, drop, false); - dropItem(world, player.posX, player.posY, player.posZ, mould, false); - } - } - - --item.stackSize; - } - } - - return item; - } - } - private void dropItem(World world, int i, int j, int k, ItemStack drop) - { - dropItem(world, i+0.5, j+0.5, k+0.5, drop, true); - } - private void dropItem(World world, double i, double j, double k, ItemStack drop, boolean delay) - { - EntityItem entity = new EntityItem(world, i, j, k, drop); - if(delay) - entity.delayBeforeCanPickup = 20; - entity.motionX = entity.motionY = entity.motionZ = 0F; - world.spawnEntityInWorld(entity); - } +import java.util.List; + +public class ItemFilledMould extends ItemComponentMF { + + private static final String itemNBT = "MF_HeldItem"; + + public ItemFilledMould() { + super("ingot_mould_filled"); + // setMaxStackSize(1); + this.setUnlocalizedName("ingot_mould"); + } + + public static ItemStack createMould(ItemStack fill) { + ItemStack mould = new ItemStack(ComponentListMF.ingot_mould_filled); + NBTTagCompound nbt = getOrCreateNBT(mould); + NBTTagCompound save = new NBTTagCompound(); + fill.writeToNBT(save); + nbt.setTag(itemNBT, save); + return mould; + } + + public static NBTTagCompound getOrCreateNBT(ItemStack item) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + return item.getTagCompound(); + } + + public ItemStack getHeldItem(ItemStack item) { + NBTTagCompound nbt = getOrCreateNBT(item); + if (nbt.hasKey(itemNBT)) { + return ItemStack.loadItemStackFromNBT(nbt.getCompoundTag(itemNBT)); + } + return null; + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + ItemStack held = getHeldItem(item); + if (held != null) { + list.add(held.getDisplayName()); + } + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + + if (movingobjectposition == null) { + return item; + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + if (!world.canMineBlock(player, i, j, k)) { + return item; + } + + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { + return item; + } + + float water = TongsHelper.getWaterSource(world, i, j, k); + ItemStack drop = getHeldItem(item); + + if (drop != null && water >= 0) { + player.playSound("random.splash", 1F, 1F); + player.playSound("random.fizz", 2F, 0.5F); + + for (int a = 0; a < 5; a++) { + world.spawnParticle("largesmoke", i + 0.5F, j + 1, k + 0.5F, 0, 0.065F, 0); + } + + if (!world.isRemote) { + ItemStack mould = new ItemStack(ComponentListMF.ingot_mould); + if (!world.getBlock(i, j + 1, k).getMaterial().isSolid()) { + dropItem(world, i, j + 1, k, drop); + dropItem(world, i, j + 1, k, mould); + } else { + dropItem(world, player.posX, player.posY, player.posZ, drop, false); + dropItem(world, player.posX, player.posY, player.posZ, mould, false); + } + } + + --item.stackSize; + } + } + + return item; + } + } + + private void dropItem(World world, int i, int j, int k, ItemStack drop) { + dropItem(world, i + 0.5, j + 0.5, k + 0.5, drop, true); + } + + private void dropItem(World world, double i, double j, double k, ItemStack drop, boolean delay) { + EntityItem entity = new EntityItem(world, i, j, k, drop); + if (delay) + entity.delayBeforeCanPickup = 20; + entity.motionX = entity.motionY = entity.motionZ = 0F; + world.spawnEntityInWorld(entity); + } } diff --git a/src/main/java/minefantasy/mf2/item/ItemHide.java b/src/main/java/minefantasy/mf2/item/ItemHide.java index b376fa83..3e90248b 100644 --- a/src/main/java/minefantasy/mf2/item/ItemHide.java +++ b/src/main/java/minefantasy/mf2/item/ItemHide.java @@ -1,106 +1,90 @@ package minefantasy.mf2.item; -import java.util.Random; - import minefantasy.mf2.api.heating.IQuenchBlock; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -public class ItemHide extends ItemComponentMF -{ - private final Item result; - private float hardness; - public ItemHide(String name, Item result, float hardness) - { - super(name, -1); - this.result = result; - this.hardness = hardness; - } +import java.util.Random; + +public class ItemHide extends ItemComponentMF { + private final Item result; + private float hardness; + private Random rand = new Random(); - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { + public ItemHide(String name, Item result, float hardness) { + super(name, -1); + this.result = result; + this.hardness = hardness; + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return item; - } - else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; - if (!world.canMineBlock(player, i, j, k)) - { + if (!world.canMineBlock(player, i, j, k)) { return item; } - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) - { + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { return item; } - if (isWaterSource(world, i, j, k)) - { - tryClean(item, world, player); + if (isWaterSource(world, i, j, k)) { + tryClean(item, world, player); } } return item; } } - - private Random rand = new Random(); - private void tryClean(ItemStack item, World world, EntityPlayer player) - { + + private void tryClean(ItemStack item, World world, EntityPlayer player) { player.swingItem(); - if (!world.isRemote) - { - world.playSoundAtEntity(player, "random.splash", 0.125F + rand.nextFloat()/4F, 0.5F + rand.nextFloat()); - if (rand.nextFloat()*2*hardness < 1.0F) - { + if (!world.isRemote) { + world.playSoundAtEntity(player, "random.splash", 0.125F + rand.nextFloat() / 4F, 0.5F + rand.nextFloat()); + if (rand.nextFloat() * 2 * hardness < 1.0F) { item.stackSize--; - EntityItem resultItem = new EntityItem(world, player.posX, player.posY, player.posZ, new ItemStack(result)); + EntityItem resultItem = new EntityItem(world, player.posX, player.posY, player.posZ, + new ItemStack(result)); world.spawnEntityInWorld(resultItem); } } - } - + } + private boolean isWaterSource(World world, int i, int j, int k) { - if(world.getBlock(i, j, k).getMaterial() == Material.water) - { - return true; - } - if(isCauldron(world, i, j, k)) - { - return true; - } - if(isTrough(world, i, j, k)) - { - return true; - } - return false; - } - - public boolean isTrough(World world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - return tile != null && tile instanceof IQuenchBlock; + if (world.getBlock(i, j, k).getMaterial() == Material.water) { + return true; + } + if (isCauldron(world, i, j, k)) { + return true; + } + if (isTrough(world, i, j, k)) { + return true; + } + return false; + } + + public boolean isTrough(World world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + return tile != null && tile instanceof IQuenchBlock; } - public boolean isCauldron(World world, int x, int y, int z) - { - return world.getBlock(x, y, z) == Blocks.cauldron && world.getBlockMetadata(x, y, z)>0; + + public boolean isCauldron(World world, int x, int y, int z) { + return world.getBlock(x, y, z) == Blocks.cauldron && world.getBlockMetadata(x, y, z) > 0; } } diff --git a/src/main/java/minefantasy/mf2/item/ItemMFBowl.java b/src/main/java/minefantasy/mf2/item/ItemMFBowl.java index 6dc55115..aad5a55e 100644 --- a/src/main/java/minefantasy/mf2/item/ItemMFBowl.java +++ b/src/main/java/minefantasy/mf2/item/ItemMFBowl.java @@ -1,94 +1,78 @@ package minefantasy.mf2.item; -import java.util.Random; - import minefantasy.mf2.item.food.FoodListMF; import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -public class ItemMFBowl extends ItemComponentMF -{ - public ItemMFBowl(String name) - { - super(name, 0); - } +import java.util.Random; + +public class ItemMFBowl extends ItemComponentMF { + private Random rand = new Random(); - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { + public ItemMFBowl(String name) { + super(name, 0); + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - if (movingobjectposition == null) - { + if (movingobjectposition == null) { return super.onItemRightClick(item, world, player); - } - else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; - if (!world.canMineBlock(player, i, j, k)) - { + if (!world.canMineBlock(player, i, j, k)) { return super.onItemRightClick(item, world, player); } - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) - { + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { return super.onItemRightClick(item, world, player); } - if (isWaterSource(world, i, j, k)) - { - gather(item, world, player); - return item; + if (isWaterSource(world, i, j, k)) { + gather(item, world, player); + return item; } } } return super.onItemRightClick(item, world, player); } - - private Random rand = new Random(); - private void gather(ItemStack item, World world, EntityPlayer player) - { + + private void gather(ItemStack item, World world, EntityPlayer player) { player.swingItem(); - if (!world.isRemote) - { - world.playSoundAtEntity(player, "random.splash", 0.125F + rand.nextFloat()/4F, 0.5F + rand.nextFloat()); + if (!world.isRemote) { + world.playSoundAtEntity(player, "random.splash", 0.125F + rand.nextFloat() / 4F, 0.5F + rand.nextFloat()); item.stackSize--; - EntityItem resultItem = new EntityItem(world, player.posX, player.posY, player.posZ, new ItemStack(FoodListMF.bowl_water_salt)); + EntityItem resultItem = new EntityItem(world, player.posX, player.posY, player.posZ, + new ItemStack(FoodListMF.bowl_water_salt)); world.spawnEntityInWorld(resultItem); } - } - - private boolean isWaterSource(World world, int i, int j, int k) - { - if(world.getBlock(i, j, k).getMaterial() != Material.water) - { - return false; - } - - BiomeGenBase biome = world.getBiomeGenForCoords(i, k); - if(biome == BiomeGenBase.ocean || biome == BiomeGenBase.deepOcean || biome == BiomeGenBase.beach) - { - return true; - } - MFLogUtil.logDebug("Biome = " + biome.biomeName); - if(world.getBlock(i, j-1, k) == Blocks.sand) - { - return true; - } - return false; - } + } + + private boolean isWaterSource(World world, int i, int j, int k) { + if (world.getBlock(i, j, k).getMaterial() != Material.water) { + return false; + } + + BiomeGenBase biome = world.getBiomeGenForCoords(i, k); + if (biome == BiomeGenBase.ocean || biome == BiomeGenBase.deepOcean || biome == BiomeGenBase.beach) { + return true; + } + MFLogUtil.logDebug("Biome = " + biome.biomeName); + if (world.getBlock(i, j - 1, k) == Blocks.sand) { + return true; + } + return false; + } } diff --git a/src/main/java/minefantasy/mf2/item/ItemRawOreMF.java b/src/main/java/minefantasy/mf2/item/ItemRawOreMF.java index 158e4f41..e8d92506 100644 --- a/src/main/java/minefantasy/mf2/item/ItemRawOreMF.java +++ b/src/main/java/minefantasy/mf2/item/ItemRawOreMF.java @@ -1,17 +1,15 @@ package minefantasy.mf2.item; +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.item.list.CreativeTabMF; -import cpw.mods.fml.common.registry.GameRegistry; -public class ItemRawOreMF extends ItemComponentMF -{ - public ItemRawOreMF(String name, int rarity) - { - super(rarity); - setTextureName("minefantasy2:oreItem/"+name); - this.setCreativeTab(CreativeTabMF.tabMaterialsMF); - GameRegistry.registerItem(this, "MF_Ore_"+name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - } +public class ItemRawOreMF extends ItemComponentMF { + public ItemRawOreMF(String name, int rarity) { + super(rarity); + setTextureName("minefantasy2:oreItem/" + name); + this.setCreativeTab(CreativeTabMF.tabMaterialsMF); + GameRegistry.registerItem(this, "MF_Ore_" + name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + } } diff --git a/src/main/java/minefantasy/mf2/item/ItemResearchBook.java b/src/main/java/minefantasy/mf2/item/ItemResearchBook.java index e5fc7ff6..a494924f 100644 --- a/src/main/java/minefantasy/mf2/item/ItemResearchBook.java +++ b/src/main/java/minefantasy/mf2/item/ItemResearchBook.java @@ -1,11 +1,9 @@ package minefantasy.mf2.item; -import java.util.List; - -import org.lwjgl.input.Keyboard; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.api.knowledge.KnowledgeType; import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.item.list.CreativeTabMF; @@ -13,50 +11,43 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemResearchBook extends Item -{ - public ItemResearchBook() - { +import java.util.List; + +public class ItemResearchBook extends Item { + public ItemResearchBook() { super(); setMaxStackSize(1); setCreativeTab(CreativeTabMF.tabGadget); - GameRegistry.registerItem(this, "MF_ResearchBook", MineFantasyII.MODID); - this.setUnlocalizedName("infobook"); - this.setTextureName("minefantasy2:Other/research_book"); - setContainerItem(this); + GameRegistry.registerItem(this, "MF_ResearchBook", MineFantasyII.MODID); + this.setUnlocalizedName("infobook"); + this.setTextureName("minefantasy2:Other/research_book"); + setContainerItem(this); } @Override - public EnumRarity getRarity(ItemStack item) - { - return EnumRarity.uncommon; - } - + public EnumRarity getRarity(ItemStack item) { + return EnumRarity.uncommon; + } + /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + * Called whenever this item is equipped and the right mouse button is pressed. + * Args: itemStack, world, entityPlayer */ @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(!world.isRemote) - { - ResearchLogic.syncData(user); - RPGElements.syncAll(user); - } - user.openGui(MineFantasyII.instance, 1, world, 0, -1, 0); + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (!world.isRemote) { + ResearchLogic.syncData(user); + RPGElements.syncAll(user); + } + user.openGui(MineFantasyII.instance, 1, world, 0, -1, 0); return item; } - + @SideOnly(Side.CLIENT) @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - super.addInformation(item, user, list, fullInfo); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + super.addInformation(item, user, list, fullInfo); } } diff --git a/src/main/java/minefantasy/mf2/item/ItemSkillBook.java b/src/main/java/minefantasy/mf2/item/ItemSkillBook.java index 354c6e90..3401264a 100644 --- a/src/main/java/minefantasy/mf2/item/ItemSkillBook.java +++ b/src/main/java/minefantasy/mf2/item/ItemSkillBook.java @@ -1,94 +1,73 @@ package minefantasy.mf2.item; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - -import minefantasy.mf2.api.knowledge.InformationBase; -import minefantasy.mf2.api.knowledge.InformationList; -import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.api.rpg.Skill; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.ToolListMF; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class ItemSkillBook extends ItemComponentMF -{ - private Skill skill; - private String name; - private boolean isMax = false; - public ItemSkillBook(String name, Skill skill) - { - super(name, 1); - setMaxStackSize(16); - setTextureName("minefantasy2:Other/"+name); - this.setCreativeTab(CreativeTabMF.tabGadget); - this.skill = skill; - this.name=name; - } - - public Item setMax() - { - isMax = true; - return setMaxStackSize(1); - } - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - if(isMax) - { - list.add(StatCollector.translateToLocal("item."+name+".desc")); - } - else - { - list.add(StatCollector.translateToLocalFormatted("item."+name+".desc", 1)); - } - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - boolean used = false; - if(skill != null) - { - int lvl = RPGElements.getLevel(user, skill); - if(lvl < skill.getMaxLevel()) - { - if(isMax) - { - skill.manualLvlUp(user, 100); - } - else - { - skill.addXP(user, skill.getLvlXP(lvl, user)); - } - used = true; - } - } - if(used) - { - user.worldObj.playSoundEffect(user.posX, user.posY, user.posZ, "minefantasy2:updateResearch", 1.0F, 1.0F); - if(!user.capabilities.isCreativeMode) - { - --item.stackSize; - } - } - return item; - } - @Override - public EnumRarity getRarity(ItemStack item) - { - return isMax ? EnumRarity.epic : EnumRarity.uncommon; - } +import java.util.List; + +public class ItemSkillBook extends ItemComponentMF { + private Skill skill; + private String name; + private boolean isMax = false; + + public ItemSkillBook(String name, Skill skill) { + super(name, 1); + setMaxStackSize(16); + setTextureName("minefantasy2:Other/" + name); + this.setCreativeTab(CreativeTabMF.tabGadget); + this.skill = skill; + this.name = name; + } + + public Item setMax() { + isMax = true; + return setMaxStackSize(1); + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + if (isMax) { + list.add(StatCollector.translateToLocal("item." + name + ".desc")); + } else { + list.add(StatCollector.translateToLocalFormatted("item." + name + ".desc", 1)); + } + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + boolean used = false; + if (skill != null) { + int lvl = RPGElements.getLevel(user, skill); + if (lvl < skill.getMaxLevel()) { + if (isMax) { + skill.manualLvlUp(user, 100); + } else { + skill.addXP(user, world.rand.nextInt(skill.getLvlXP(lvl, user))); + } + used = true; + } + } + if (used) { + user.worldObj.playSoundEffect(user.posX, user.posY, user.posZ, "minefantasy2:updateResearch", 1.0F, 1.0F); + if (!user.capabilities.isCreativeMode) { + --item.stackSize; + } + } + return item; + } + + @Override + public EnumRarity getRarity(ItemStack item) { + return isMax ? EnumRarity.epic : EnumRarity.uncommon; + } } diff --git a/src/main/java/minefantasy/mf2/item/ItemSpecialDesign.java b/src/main/java/minefantasy/mf2/item/ItemSpecialDesign.java index aded5355..833e4fd1 100644 --- a/src/main/java/minefantasy/mf2/item/ItemSpecialDesign.java +++ b/src/main/java/minefantasy/mf2/item/ItemSpecialDesign.java @@ -3,18 +3,17 @@ import minefantasy.mf2.api.crafting.exotic.ISpecialCraftItem; import net.minecraft.item.ItemStack; -public class ItemSpecialDesign extends ItemComponentMF implements ISpecialCraftItem -{ - private String design; - public ItemSpecialDesign(String name, int rarity, String design) - { - super(name, rarity); - this.design = design; - } - @Override - public String getDesign(ItemStack item) - { - return this.design; - } +public class ItemSpecialDesign extends ItemComponentMF implements ISpecialCraftItem { + private String design; + + public ItemSpecialDesign(String name, int rarity, String design) { + super(name, rarity); + this.design = design; + } + + @Override + public String getDesign(ItemStack item) { + return this.design; + } } diff --git a/src/main/java/minefantasy/mf2/item/ItemWorldGenPlacer.java b/src/main/java/minefantasy/mf2/item/ItemWorldGenPlacer.java index f42d0e4d..75667ab0 100644 --- a/src/main/java/minefantasy/mf2/item/ItemWorldGenPlacer.java +++ b/src/main/java/minefantasy/mf2/item/ItemWorldGenPlacer.java @@ -1,12 +1,9 @@ package minefantasy.mf2.item; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.mechanics.worldGen.structure.WorldGenAncientAlter; import minefantasy.mf2.mechanics.worldGen.structure.WorldGenAncientForge; import minefantasy.mf2.mechanics.worldGen.structure.WorldGenStructureBase; @@ -15,138 +12,113 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class ItemWorldGenPlacer extends Item -{ - private static final String[] types = new String[]{"AncientForge", "AncientAlter", "DwarvenStronghold"}; - public IIcon[] icons; - - public ItemWorldGenPlacer() - { - this.setCreativeTab(CreativeTabs.tabMisc); - GameRegistry.registerItem(this, "PlaceWorldGenMF", MineFantasyII.MODID); - this.setHasSubtypes(true); - } - @Override - public boolean onItemUse(ItemStack item, EntityPlayer user, World world, int x, int y, int z, int side, float offsetX, float offsetY, float offsetZ) - { - if (side == 0) - { +import java.util.List; + +public class ItemWorldGenPlacer extends Item { + private static final String[] types = new String[]{"AncientForge", "AncientAlter", "DwarvenStronghold"}; + public IIcon[] icons; + + public ItemWorldGenPlacer() { + this.setCreativeTab(CreativeTabs.tabMisc); + GameRegistry.registerItem(this, "PlaceWorldGenMF", MineFantasyII.MODID); + this.setHasSubtypes(true); + } + + @Override + public boolean onItemUse(ItemStack item, EntityPlayer user, World world, int x, int y, int z, int side, + float offsetX, float offsetY, float offsetZ) { + if (side == 0) { --y; } - if (side == 1) - { + if (side == 1) { ++y; } - if (side == 2) - { + if (side == 2) { --z; } - if (side == 3) - { + if (side == 3) { ++z; } - if (side == 4) - { + if (side == 4) { --x; } - if (side == 5) - { + if (side == 5) { ++x; } - if (!user.canPlayerEdit(x, y, z, side, item)) - { + if (!user.canPlayerEdit(x, y, z, side, item)) { return false; - } - else - { - if(!world.isRemote) - { - WorldGenStructureBase wg = getWorldGen(item.getItemDamage()); - if(wg instanceof WorldGenDwarvenStronghold) - { - WorldGenDwarvenStronghold ds = (WorldGenDwarvenStronghold)wg; - MFLogUtil.logDebug("DS: Try Cliff Build"); - if(!ds.generate(world, itemRand, x, y, z)) - { - MFLogUtil.logDebug("Failed... DS: Try Surface Build"); - ds.setSurfaceMode(true); - if(ds.generate(world, itemRand, x, y, z)) - { - MFLogUtil.logDebug("Success... DS: Placed Surface Build"); - } - else - { - MFLogUtil.logDebug("Failed... DS: No Build Placed"); - } - } - else - { - MFLogUtil.logDebug("Success... DS: Placed Cliff Build"); - } - } - else - { - wg.generate(world, itemRand, x, y, z); - } - } + } else { + if (!world.isRemote) { + WorldGenStructureBase wg = getWorldGen(item.getItemDamage()); + if (wg instanceof WorldGenDwarvenStronghold) { + WorldGenDwarvenStronghold ds = (WorldGenDwarvenStronghold) wg; + MFLogUtil.logDebug("DS: Try Cliff Build"); + if (!ds.generate(world, itemRand, x, y, z)) { + MFLogUtil.logDebug("Failed... DS: Try Surface Build"); + ds.setSurfaceMode(true); + if (ds.generate(world, itemRand, x, y, z)) { + MFLogUtil.logDebug("Success... DS: Placed Surface Build"); + } else { + MFLogUtil.logDebug("Failed... DS: No Build Placed"); + } + } else { + MFLogUtil.logDebug("Success... DS: Placed Cliff Build"); + } + } else { + wg.generate(world, itemRand, x, y, z); + } + } return true; } } - @Override - public String getItemStackDisplayName(ItemStack item) - { - int d = MathHelper.clamp_int(item.getItemDamage(), 0, types.length-1); - return "World Gen " + types[d]; - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List list) - { - for(int id = 0; id < types.length; id++) - list.add(new ItemStack(item, 1, id)); + + @Override + public String getItemStackDisplayName(ItemStack item) { + int d = MathHelper.clamp_int(item.getItemDamage(), 0, types.length - 1); + return "World Gen " + types[d]; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int id = 0; id < types.length; id++) + list.add(new ItemStack(item, 1, id)); } - - private WorldGenStructureBase getWorldGen(int meta) - { - if(meta == 1) - { - return new WorldGenAncientAlter(); - } - if(meta == 2) - { - return new WorldGenDwarvenStronghold(); - } - return new WorldGenAncientForge(); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int d) - { - return icons[Math.min(icons.length-1, d)]; + + private WorldGenStructureBase getWorldGen(int meta) { + if (meta == 1) { + return new WorldGenAncientAlter(); + } + if (meta == 2) { + return new WorldGenDwarvenStronghold(); + } + return new WorldGenAncientForge(); } - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister reg) - { - icons = new IIcon[types.length]; - for(int i = 0; i < types.length; i ++) - { - icons[i] = reg.registerIcon("minefantasy2:Other/generate_"+types[i]); - } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int d) { + return icons[Math.min(icons.length - 1, d)]; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister reg) { + icons = new IIcon[types.length]; + for (int i = 0; i < types.length; i++) { + icons[i] = reg.registerIcon("minefantasy2:Other/generate_" + types[i]); + } } } diff --git a/src/main/java/minefantasy/mf2/item/archery/ArrowFireFlint.java b/src/main/java/minefantasy/mf2/item/archery/ArrowFireFlint.java index 466edb72..d009e70c 100644 --- a/src/main/java/minefantasy/mf2/item/archery/ArrowFireFlint.java +++ b/src/main/java/minefantasy/mf2/item/archery/ArrowFireFlint.java @@ -11,70 +11,59 @@ import net.minecraft.world.World; /** - * This class is an example used to fire custom arrows. + * This class is an example used to fire custom arrows. */ -public class ArrowFireFlint implements IArrowHandler -{ +public class ArrowFireFlint implements IArrowHandler { - @Override - public boolean onFireArrow(World world, ItemStack arrow, ItemStack bow, EntityPlayer user, float charge, boolean infinite) - { - if(infinite || arrow.getItem() != Items.arrow) - { - return false; - } - float maxCharge = 20F; - if(bow != null && bow.getItem() instanceof ISpecialBow) - { - maxCharge = ((ISpecialBow)bow.getItem()).getMaxCharge(); - } - float firepower = charge / maxCharge; + @Override + public boolean onFireArrow(World world, ItemStack arrow, ItemStack bow, EntityPlayer user, float charge, + boolean infinite) { + if (infinite || arrow.getItem() != Items.arrow) { + return false; + } + float maxCharge = 20F; + if (bow != null && bow.getItem() instanceof ISpecialBow) { + maxCharge = ((ISpecialBow) bow.getItem()).getMaxCharge(); + } + float firepower = charge / maxCharge; - if (firepower < 0.1D) - { + if (firepower < 0.1D) { return false; } - if (firepower > 1.0F) - { + if (firepower > 1.0F) { firepower = 1.0F; } - + EntityArrow entArrow = new EntityArrow(world, user, firepower * 2.0F); int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, bow); - if (var9 > 0) - { + if (var9 > 0) { entArrow.setDamage(entArrow.getDamage() + var9 * 0.5D + 0.5D); } int var10 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, bow); - if (var10 > 0) - { + if (var10 > 0) { entArrow.setKnockbackStrength(var10); } - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, bow) > 0) - { + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, bow) > 0) { entArrow.setFire(100); } - if(infinite) - { - entArrow.canBePickedUp = 2; + if (infinite) { + entArrow.canBePickedUp = 2; } - - if(bow != null && bow.getItem() != null && bow.getItem() instanceof ISpecialBow) - { - entArrow = (EntityArrow) ((ISpecialBow)bow.getItem()).modifyArrow(bow, entArrow); + + if (bow != null && bow.getItem() != null && bow.getItem() instanceof ISpecialBow) { + entArrow = (EntityArrow) ((ISpecialBow) bow.getItem()).modifyArrow(bow, entArrow); } - if (!world.isRemote) - { + if (!world.isRemote) { world.spawnEntityInWorld(entArrow); } - - return true; - } + + return true; + } } diff --git a/src/main/java/minefantasy/mf2/item/archery/ArrowFirerMF.java b/src/main/java/minefantasy/mf2/item/archery/ArrowFirerMF.java index b6a438fa..2e69f24c 100644 --- a/src/main/java/minefantasy/mf2/item/archery/ArrowFirerMF.java +++ b/src/main/java/minefantasy/mf2/item/archery/ArrowFirerMF.java @@ -10,79 +10,66 @@ import net.minecraft.world.World; /** - * This class is an example used to fire custom arrows. + * This class is an example used to fire custom arrows. */ -public class ArrowFirerMF implements IArrowHandler -{ +public class ArrowFirerMF implements IArrowHandler { - @Override - public boolean onFireArrow(World world, ItemStack arrow, ItemStack bow, EntityPlayer user, float charge, boolean infinite) - { - if(arrow == null || !(arrow.getItem() instanceof ItemArrowMF)) - { - return false; - } - - float maxCharge = 20F; - if(bow != null && bow.getItem() instanceof ISpecialBow) - { - //maxCharge = ((ISpecialBow)bow.getItem()).getMaxCharge(); - } - else - { - return false; - } - float firepower = charge / maxCharge * 20F; - - if (firepower < 0.1D) - { + @Override + public boolean onFireArrow(World world, ItemStack arrow, ItemStack bow, EntityPlayer user, float charge, + boolean infinite) { + if (arrow == null || !(arrow.getItem() instanceof ItemArrowMF)) { return false; } - if (firepower > 1.0F) - { + + float maxCharge = 20F; + if (bow != null && bow.getItem() instanceof ISpecialBow) { + // maxCharge = ((ISpecialBow)bow.getItem()).getMaxCharge(); + } else { + return false; + } + float firepower = charge / maxCharge * 20F; + + if (firepower < 0.1D) { + return false; + } + if (firepower > 1.0F) { firepower = 1.0F; } - - ItemArrowMF ammo = (ItemArrowMF)arrow.getItem(); - float spread = 1.0F; - if(bow != null && bow.getItem() instanceof ISpecialBow) - { - firepower *= ((ISpecialBow)bow.getItem()).getRange(bow); - spread = ((ISpecialBow)bow.getItem()).getSpread(bow); - } - - EntityArrowMF entArrow = ammo.getFiredArrow(new EntityArrowMF(world, user, spread, firepower*2.0F), arrow); + + ItemArrowMF ammo = (ItemArrowMF) arrow.getItem(); + float spread = 1.0F; + if (bow != null && bow.getItem() instanceof ISpecialBow) { + firepower *= ((ISpecialBow) bow.getItem()).getRange(bow); + spread = ((ISpecialBow) bow.getItem()).getSpread(bow); + } + + EntityArrowMF entArrow = ammo.getFiredArrow(new EntityArrowMF(world, user, spread, firepower * 2.0F), arrow); int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, bow); - entArrow.setPower(1+(0.25F*var9)); + entArrow.setPower(1 + (0.25F * var9)); int var10 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, bow); - if (var10 > 0) - { + if (var10 > 0) { entArrow.setKnockbackStrength(var10); } - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, bow) > 0) - { + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, bow) > 0) { entArrow.setFire(100); } - if(infinite) - { - entArrow.canBePickedUp = 2; + if (infinite) { + entArrow.canBePickedUp = 2; } - - if(bow != null && bow.getItem() != null && bow.getItem() instanceof ISpecialBow) - { - entArrow = (EntityArrowMF) ((ISpecialBow)bow.getItem()).modifyArrow(bow, entArrow); + + if (bow != null && bow.getItem() != null && bow.getItem() instanceof ISpecialBow) { + entArrow = (EntityArrowMF) ((ISpecialBow) bow.getItem()).modifyArrow(bow, entArrow); } - if (!world.isRemote) - { + if (!world.isRemote) { world.spawnEntityInWorld(entArrow); } - - return true; - } + + return true; + } } diff --git a/src/main/java/minefantasy/mf2/item/archery/ArrowType.java b/src/main/java/minefantasy/mf2/item/archery/ArrowType.java index 455975a8..37924d40 100644 --- a/src/main/java/minefantasy/mf2/item/archery/ArrowType.java +++ b/src/main/java/minefantasy/mf2/item/archery/ArrowType.java @@ -2,42 +2,42 @@ import java.util.HashMap; -public class ArrowType -{ - public static HashMaparrowMap = new HashMap(); - public final float weightModifier; - public final float damageModifier; - public final float velocity; - public final String name; - public float[] ratio = new float[]{0F, 0F, 1F}; - - public static ArrowType BOLT = new ArrowType("bolt", 1.50F, 1.50F, 1.50F).setRatio(0F, 1F, 0F);//Crossbow Bolt - public static ArrowType EXPLOSIVEBOLT = new ArrowType("explosivebolt", 1.50F, 1.50F, 0.25F).setRatio(0F, 0F, 1F);//Blunt - - public static ArrowType NORMAL = new ArrowType("normal", 1.00F, 1.00F, 1.00F).setRatio(1F, 3F, 0F);//Some cut, most pierce - public static ArrowType BODKIN = new ArrowType("bodkin", 1.50F, 0.65F, 0.75F).setRatio(0F, 1F, 0F);//Pure piercing - public static ArrowType BROADHEAD = new ArrowType("broad", 0.80F, 1.20F, 1.50F).setRatio(1F, 2F, 0F);//More cutting than normal - public static ArrowType EXPLOSIVE = new ArrowType("explosive", 1.0F, 1.50F, 0.25F).setRatio(0F, 0F, 1F);//Blunt +public class ArrowType { + public static HashMap arrowMap = new HashMap(); + public static ArrowType BOLT = new ArrowType("bolt", 1.50F, 1.50F, 1.50F).setRatio(0F, 1F, 0F);// Crossbow Bolt + public static ArrowType EXPLOSIVEBOLT = new ArrowType("explosivebolt", 1.50F, 1.50F, 0.25F).setRatio(0F, 0F, 1F);// Blunt + public static ArrowType NORMAL = new ArrowType("normal", 1.00F, 1.00F, 1.00F).setRatio(1F, 3F, 0F);// Some cut, most + // pierce + public static ArrowType BODKIN = new ArrowType("bodkin", 1.50F, 0.65F, 0.75F).setRatio(0F, 1F, 0F);// Pure piercing + public static ArrowType BROADHEAD = new ArrowType("broad", 0.80F, 1.20F, 1.50F).setRatio(1F, 2F, 0F);// More cutting + // than + // normal + public static ArrowType EXPLOSIVE = new ArrowType("explosive", 1.0F, 1.50F, 0.25F).setRatio(0F, 0F, 1F);// Blunt + public final float weightModifier; + public final float damageModifier; + public final float velocity; + public final String name; + public float[] ratio = new float[]{0F, 0F, 1F}; + + public ArrowType(String name, float velocity, float weightModifier, float damageModifier) { + this.name = name; + this.velocity = velocity; + this.weightModifier = weightModifier; + this.damageModifier = damageModifier; + arrowMap.put(name, this); + } + + /** + * Sets up a ratio system for damage values + * + * @param cutting the amount cutting damage + * @param piercing the amount piercing damage + * @param blunt the amount blunt damage + * @return + */ + public ArrowType setRatio(float cutting, float piercing, float blunt) { + ratio = new float[]{cutting, blunt, piercing}; + return this; + } - public ArrowType(String name, float velocity, float weightModifier, float damageModifier) - { - this.name = name; - this.velocity = velocity; - this.weightModifier = weightModifier; - this.damageModifier = damageModifier; - arrowMap.put(name, this); - } - /** - * Sets up a ratio system for damage values - * @param cutting the amount cutting damage - * @param piercing the amount piercing damage - * @param blunt the amount blunt damage - * @return - */ - public ArrowType setRatio(float cutting, float piercing, float blunt) - { - ratio = new float[]{cutting, blunt, piercing}; - return this; - } - } diff --git a/src/main/java/minefantasy/mf2/item/archery/EnumBowType.java b/src/main/java/minefantasy/mf2/item/archery/EnumBowType.java index 113ecd1e..5b692327 100644 --- a/src/main/java/minefantasy/mf2/item/archery/EnumBowType.java +++ b/src/main/java/minefantasy/mf2/item/archery/EnumBowType.java @@ -1,34 +1,32 @@ package minefantasy.mf2.item.archery; -public enum EnumBowType -{ - /** - * Standard bow Reinforced with metal - */ - SHORTBOW(1.0F, 1.0F, 1.0F, 1.0F, 1.0F), - /** - * Larger varient, more power - */ - LONGBOW(1.0F, 1.5F, 1.0F, 1.5F, 0.5F); - - public final float damageModifier; - public final float velocity; - public final float spread; - public final float chargeTime; - public final float durabilityModifier; - - /** - * @param dam modifes damage (1.0=normal) - * @param time is how many seconds until it reaches full charge - * @param durability modifies the durability (1.0=normal) - * @param velocity modifies the speed of the fired projectile - */ - private EnumBowType(float dam, float time, float durability, float velocity, float spread) - { - this.damageModifier = dam; - this.chargeTime = time*20F; - this.durabilityModifier = durability; - this.velocity = velocity; - this.spread = spread; - } +public enum EnumBowType { + /** + * Standard bow Reinforced with metal + */ + SHORTBOW(1.0F, 1.0F, 1.0F, 1.0F, 1.0F), + /** + * Larger varient, more power + */ + LONGBOW(1.0F, 1.5F, 1.0F, 1.5F, 0.5F); + + public final float damageModifier; + public final float velocity; + public final float spread; + public final float chargeTime; + public final float durabilityModifier; + + /** + * @param dam modifes damage (1.0=normal) + * @param time is how many seconds until it reaches full charge + * @param durability modifies the durability (1.0=normal) + * @param velocity modifies the speed of the fired projectile + */ + private EnumBowType(float dam, float time, float durability, float velocity, float spread) { + this.damageModifier = dam; + this.chargeTime = time * 20F; + this.durabilityModifier = durability; + this.velocity = velocity; + this.spread = spread; + } } diff --git a/src/main/java/minefantasy/mf2/item/archery/ItemArrowMF.java b/src/main/java/minefantasy/mf2/item/archery/ItemArrowMF.java index 4160b9c4..da2799b4 100644 --- a/src/main/java/minefantasy/mf2/item/archery/ItemArrowMF.java +++ b/src/main/java/minefantasy/mf2/item/archery/ItemArrowMF.java @@ -1,10 +1,9 @@ package minefantasy.mf2.item.archery; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.archery.AmmoMechanicsMF; import minefantasy.mf2.api.archery.IAmmo; @@ -15,8 +14,6 @@ import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.material.BaseMaterialMF; import minefantasy.mf2.mechanics.MFArrowDispenser; -import minefantasy.mf2.util.MFLogUtil; -import mods.battlegear2.api.quiver.QuiverArrowRegistry; import net.minecraft.block.BlockDispenser; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -28,246 +25,228 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * @author Anonymous Productions */ -public class ItemArrowMF extends Item implements IArrowMF, IAmmo -{ - protected float damage; - protected String arrowName; - protected ArrowType design; - private ToolMaterial arrowMat; - public static final DecimalFormat decimal_format = new DecimalFormat("#.##"); - public static final MFArrowDispenser dispenser = new MFArrowDispenser(); - - public ItemArrowMF(String name, ArrowType type, int stackSize) - { - this(name, 0, ToolMaterial.WOOD, type); - setMaxStackSize(stackSize); - } - public ItemArrowMF(String name, ArrowType type) - { - this(name, 0, ToolMaterial.WOOD, type); - } - public ItemArrowMF(String name) - { - this(name, 0, ToolMaterial.WOOD); - } - public ItemArrowMF(String name, int rarity, ToolMaterial material) - { - this(name, rarity, material, ArrowType.NORMAL); - } - public ItemArrowMF(String name, int rarity, ToolMaterial material, ArrowType type) - { - name = convertName(name); - material = convertMaterial(material); - - super.setUnlocalizedName((type == ArrowType.EXPLOSIVE || type == ArrowType.EXPLOSIVEBOLT) ? name : type == ArrowType.BOLT ? (name+"_bolt") : (name+"_arrow")); - name = getName(name, type); - design = type; - arrowName = name; - arrowMat = material; - damage = (3+material.getDamageVsEntity()) * type.damageModifier; - if(type == ArrowType.EXPLOSIVE || type == ArrowType.EXPLOSIVEBOLT) - { - damage = 1; - } - itemRarity = rarity; - setTextureName("minefantasy2:Ammo/"+name); - setCreativeTab(CreativeTabMF.tabOldTools); - GameRegistry.registerItem(this, "MF_Com_"+name, MineFantasyII.MODID); - - AmmoMechanicsMF.addArrow(new ItemStack(this)); - QuiverArrowRegistry.addArrowToRegistry(new ItemStack(this), null); - BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenser); - } - private ToolMaterial convertMaterial(ToolMaterial material) - { - if(material == BaseMaterialMF.getMaterial("ornate").getToolConversion()) - { - return BaseMaterialMF.getMaterial("silver").getToolConversion(); - } - return material; - } - private String convertName(String name) - { - if(name.equalsIgnoreCase("ornate")) - { - return "silver"; - } - return name; - } - - private String getName(String mat, ArrowType type) - { - if(type == ArrowType.EXPLOSIVE) - { - return "exploding_arrow"; - } - if(type == ArrowType.EXPLOSIVEBOLT) - { - return "exploding_bolt"; - } - if(type.name.equalsIgnoreCase("normal")) - { - return mat +"_arrow"; - } - if(type.name.equalsIgnoreCase("bolt")) - { - return mat +"_bolt"; - } - return mat + "_arrow_" + type.name.toLowerCase(); - } - - public EntityArrowMF getFiredArrow(EntityArrowMF instance, ItemStack arrow) - { - instance.modifyVelocity(design.velocity); - return instance.setArrow(arrow).setArrowTex(arrowName); - } - @Override - public void onHitEntity(Entity arrowInstance, Entity shooter, Entity hit, float damage) - { - if(arrowMat == BaseMaterialMF.getMaterial("dragonforge").getToolConversion()) - { - hit.setFire((int)(damage * (arrowInstance.isBurning() ? 2.0F : 1.0F))); - } - } - public ItemArrowMF setAmmoType(String type) - { - ammoType = type; - return this; - } - private String ammoType = "arrow"; - @Override - public String getAmmoType(ItemStack arrow) - { - return ammoType; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemArrowMF setCustom(String designType) - { - canRepair = false; - setTextureName("minefantasy2:custom/ammo/"+designType+"/"+arrowName); - isCustom = true; - return this; - } - - @Override - public float getDamageModifier(ItemStack arrow) - { - return (4F + CustomToolHelper.getMeleeDamage(arrow, damage)) * design.damageModifier; - } - @Override - public float getGravityModifier(ItemStack arrow) - { - float weight = 1.0F * design.weightModifier; - return CustomToolHelper.getWeightModifier(arrow, weight); - } - - protected int itemRarity; - @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } +public class ItemArrowMF extends Item implements IArrowMF, IAmmo { + public static final DecimalFormat decimal_format = new DecimalFormat("#.##"); + public static final MFArrowDispenser dispenser = new MFArrowDispenser(); + protected float damage; + protected String arrowName; + protected ArrowType design; + protected int itemRarity; + private ToolMaterial arrowMat; + private String ammoType = "arrow"; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; @SideOnly(Side.CLIENT) private IIcon detailTex; - + + public ItemArrowMF(String name, ArrowType type, int stackSize) { + this(name, 0, ToolMaterial.WOOD, type); + setMaxStackSize(stackSize); + } + + public ItemArrowMF(String name, ArrowType type) { + this(name, 0, ToolMaterial.WOOD, type); + } + + public ItemArrowMF(String name) { + this(name, 0, ToolMaterial.WOOD); + } + + public ItemArrowMF(String name, int rarity, ToolMaterial material) { + this(name, rarity, material, ArrowType.NORMAL); + } + + public ItemArrowMF(String name, int rarity, ToolMaterial material, ArrowType type) { + name = convertName(name); + material = convertMaterial(material); + + super.setUnlocalizedName((type == ArrowType.EXPLOSIVE || type == ArrowType.EXPLOSIVEBOLT) ? name + : type == ArrowType.BOLT ? (name + "_bolt") : (name + "_arrow")); + name = getName(name, type); + design = type; + arrowName = name; + arrowMat = material; + damage = (3 + material.getDamageVsEntity()) * type.damageModifier; + if (type == ArrowType.EXPLOSIVE || type == ArrowType.EXPLOSIVEBOLT) { + damage = 1; + } + itemRarity = rarity; + setTextureName("minefantasy2:Ammo/" + name); + setCreativeTab(CreativeTabMF.tabOldTools); + GameRegistry.registerItem(this, "MF_Com_" + name, MineFantasyII.MODID); + + AmmoMechanicsMF.addArrow(new ItemStack(this)); + if(Loader.isModLoaded("battlegear2")) { + mods.battlegear2.api.quiver.QuiverArrowRegistry.addArrowToRegistry(new ItemStack(this), null); + } + BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenser); + } + + private ToolMaterial convertMaterial(ToolMaterial material) { + if (material == BaseMaterialMF.getMaterial("ornate").getToolConversion()) { + return BaseMaterialMF.getMaterial("silver").getToolConversion(); + } + return material; + } + + private String convertName(String name) { + if (name.equalsIgnoreCase("ornate")) { + return "silver"; + } + return name; + } + + private String getName(String mat, ArrowType type) { + if (type == ArrowType.EXPLOSIVE) { + return "exploding_arrow"; + } + if (type == ArrowType.EXPLOSIVEBOLT) { + return "exploding_bolt"; + } + if (type.name.equalsIgnoreCase("normal")) { + return mat + "_arrow"; + } + if (type.name.equalsIgnoreCase("bolt")) { + return mat + "_bolt"; + } + return mat + "_arrow_" + type.name.toLowerCase(); + } + + public EntityArrowMF getFiredArrow(EntityArrowMF instance, ItemStack arrow) { + instance.modifyVelocity(design.velocity); + return instance.setArrow(arrow).setArrowTex(arrowName); + } + + @Override + public void onHitEntity(Entity arrowInstance, Entity shooter, Entity hit, float damage) { + if (arrowMat == BaseMaterialMF.getMaterial("dragonforge").getToolConversion()) { + hit.setFire((int) (damage * (arrowInstance.isBurning() ? 2.0F : 1.0F))); + } + } + + public ItemArrowMF setAmmoType(String type) { + ammoType = type; + return this; + } + + @Override + public String getAmmoType(ItemStack arrow) { + return ammoType; + } + + public ItemArrowMF setCustom(String designType) { + canRepair = false; + setTextureName("minefantasy2:custom/ammo/" + designType + "/" + arrowName); + isCustom = true; + return this; + } + + @Override + public float getDamageModifier(ItemStack arrow) { + return (4F + CustomToolHelper.getMeleeDamage(arrow, damage)) * design.damageModifier; + } + + @Override + public float getGravityModifier(ItemStack arrow) { + float weight = 1.0F * design.weightModifier; + return CustomToolHelper.getWeightModifier(arrow, weight); + } + + @Override + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + } + super.registerIcons(reg); } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass > 0 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass > 0 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - int c = CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); - - return c; + public int getColorFromItemStack(ItemStack item, int layer) { + int c = CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + + return c; + } + + public ItemStack construct(String main) { + return CustomToolHelper.construct(this, main, null); } - - public ItemStack construct(String main) - { - return CustomToolHelper.construct(this, main, null); - } - + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name)); - } - } - } + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name)); + } + } + } } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); - list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("attribute.arrowPower.name") + ": " + decimal_format.format(getDamageModifier(item))); + list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("attribute.arrowPower.name") + ": " + + decimal_format.format(getDamageModifier(item))); } - + @Override - public String getItemStackDisplayName(ItemStack item) - { - String name = ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(item) + ".name")).trim(); - - if(isCustom) - name = CustomToolHelper.getLocalisedName(item, name); - - if(design != ArrowType.NORMAL && design != ArrowType.EXPLOSIVE && design != ArrowType.BOLT && design != ArrowType.EXPLOSIVEBOLT) - { - name += " (" + StatCollector.translateToLocal("arrow.head."+ design.name.toLowerCase() +".name") + ")"; + public String getItemStackDisplayName(ItemStack item) { + String name = ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(item) + ".name")) + .trim(); + + if (isCustom) + name = CustomToolHelper.getLocalisedName(item, name); + + if (design != ArrowType.NORMAL && design != ArrowType.EXPLOSIVE && design != ArrowType.BOLT + && design != ArrowType.EXPLOSIVEBOLT) { + name += " (" + StatCollector.translateToLocal("arrow.head." + design.name.toLowerCase() + ".name") + ")"; } - + return name; } + @Override - public float getBreakChance(Entity entityArrow, ItemStack arrow) - { - int maxUses = CustomToolHelper.getMaxDamage(arrow, arrowMat.getMaxUses()); - return 1F / (maxUses/150); - } - + public float getBreakChance(Entity entityArrow, ItemStack arrow) { + int maxUses = CustomToolHelper.getMaxDamage(arrow, arrowMat.getMaxUses()); + return 1F / (maxUses / 150); + } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/archery/ItemBowMF.java b/src/main/java/minefantasy/mf2/item/archery/ItemBowMF.java index f7d7814f..4e4263aa 100644 --- a/src/main/java/minefantasy/mf2/item/archery/ItemBowMF.java +++ b/src/main/java/minefantasy/mf2/item/archery/ItemBowMF.java @@ -1,25 +1,14 @@ package minefantasy.mf2.item.archery; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.api.archery.AmmoMechanicsMF; -import minefantasy.mf2.api.archery.IAmmo; -import minefantasy.mf2.api.archery.IDisplayMFAmmo; -import minefantasy.mf2.api.archery.IFirearm; -import minefantasy.mf2.api.archery.ISpecialBow; +import minefantasy.mf2.api.archery.*; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.CustomToolListMF; -import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.item.tool.ToolMaterialMF; -import minefantasy.mf2.material.BaseMaterialMF; -import mods.battlegear2.api.PlayerEventChild.OffhandAttackEvent; import mods.battlegear2.api.weapons.IBattlegearWeapon; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -29,11 +18,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; -import net.minecraft.item.EnumAction; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBow; -import net.minecraft.item.ItemStack; +import net.minecraft.item.*; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; @@ -43,135 +28,135 @@ import net.minecraftforge.event.entity.player.ArrowLooseEvent; import net.minecraftforge.event.entity.player.ArrowNockEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.container.ContainerReload; - -public class ItemBowMF extends ItemBow implements ISpecialBow, IDisplayMFAmmo, IBattlegearWeapon, IFirearm -{ - public static final DecimalFormat decimal_format = new DecimalFormat("#.##"); - private final EnumBowType model; - private ToolMaterial material = ToolMaterial.WOOD; - private int itemRarity; - private float baseDamage = 1.0F; - private String name; - - public ItemBowMF(String name, EnumBowType type) - { - this(name, ToolMaterial.WOOD, type, 0); - } - public ItemBowMF(String name, ToolMaterial mat, EnumBowType type, int rarity) - { - this(name, (int)(mat.getMaxUses()*type.durabilityModifier), type, mat.getDamageVsEntity(), rarity); - material = mat; - this.enchantmentLvl = mat.getEnchantability(); - } - - private ItemBowMF(String name, int dura, EnumBowType type, float damage, int rarity) - { - this.name=name; - this.baseDamage = damage; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +@Optional.Interface(iface = "mods.battlegear2.api.weapons.IBattlegearWeapon", modid = "battlegear2") +public class ItemBowMF extends ItemBow implements ISpecialBow, IDisplayMFAmmo, IBattlegearWeapon, IFirearm { + public static final DecimalFormat decimal_format = new DecimalFormat("#.##"); + private final EnumBowType model; + public IIcon[] mainIcons = new IIcon[3]; + public IIcon cus_metal_standby; + public IIcon[] cus_metal_pulling = new IIcon[3]; + public IIcon cus_wood_standby; + public IIcon[] cus_wood_pulling = new IIcon[3]; + public IIcon cus_detail_standby; + public IIcon[] cus_detail_pulling = new IIcon[3]; + private int itemRarity; + private float baseDamage = 1.0F; + private String name; + /** + * Return the enchantability factor of the item, most of the time is based on + * material. + */ + private int enchantmentLvl = 1; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private String designType = "standard"; + + public ItemBowMF(String name, EnumBowType type) { + this(name, ToolMaterial.WOOD, type, 0); + } + + public ItemBowMF(String name, ToolMaterial mat, EnumBowType type, int rarity) { + this(name, (int) (mat.getMaxUses() * type.durabilityModifier), type, mat.getDamageVsEntity(), rarity); + this.enchantmentLvl = mat.getEnchantability(); + } + + private ItemBowMF(String name, int dura, EnumBowType type, float damage, int rarity) { + this.name = name; + this.baseDamage = damage; model = type; this.maxStackSize = 1; this.setMaxDamage(dura); itemRarity = rarity; - setTextureName("minefantasy2:Bow/"+name); - this.setUnlocalizedName(name); + setTextureName("minefantasy2:Bow/" + name); + this.setUnlocalizedName(name); GameRegistry.registerItem(this, name, MineFantasyII.MODID); setCreativeTab(CreativeTabMF.tabOldTools); } - + @Override - @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) /** * Returns True is the item is renderer in full 3D when hold. */ - public boolean isFull3D() - { + public boolean isFull3D() { return true; } /** - * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount + * called when the player releases the use item button. Args: itemstack, world, + * entityplayer, itemInUseCount */ @Override - public void onPlayerStoppedUsing(ItemStack item, World world, EntityPlayer player, int time) - { + public void onPlayerStoppedUsing(ItemStack item, World world, EntityPlayer player, int time) { int power = (this.getMaxItemUseDuration(item) - time); - + ArrowLooseEvent event = new ArrowLooseEvent(player, item, power); MinecraftForge.EVENT_BUS.post(event); - - if (event.isCanceled()) - { + + if (event.isCanceled()) { return; } - boolean var5 = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, item) > 0; + boolean var5 = player.capabilities.isCreativeMode + || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, item) > 0; power = event.charge; - - if (var5 || player.inventory.hasItem(Items.arrow)) - { + if (var5 || player.inventory.hasItem(Items.arrow)) { float firepower = power / model.chargeTime; - if (firepower < 0.1D) - { + if (firepower < 0.1D) { return; } - if (firepower > 1.0F) - { + if (firepower > 1.0F) { firepower = 1.0F; } - + EntityArrow var8 = new EntityArrow(world, player, firepower * 2.0F); - if (firepower == 1.0F) - { + if (firepower == 1.0F) { var8.setIsCritical(true); } int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, item); - if (var9 > 0) - { + if (var9 > 0) { var8.setDamage(var8.getDamage() + var9 * 0.5D + 0.5D); } int var10 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, item); - if (var10 > 0) - { + if (var10 > 0) { var8.setKnockbackStrength(var10); } - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, item) > 0) - { + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, item) > 0) { var8.setFire(100); } AmmoMechanicsMF.damageContainer(item, player, 1); - world.playSoundAtEntity(player, "minefantasy2:weapon.bowFire", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + firepower * 0.5F); + world.playSoundAtEntity(player, "minefantasy2:weapon.bowFire", 1.0F, + 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + firepower * 0.5F); - if (var5) - { + if (var5) { var8.canBePickedUp = 2; - } - else - { + } else { player.inventory.consumeInventoryItem(Items.arrow); } var8 = (EntityArrow) modifyArrow(item, var8); - if (!world.isRemote) - { + if (!world.isRemote) { world.spawnEntityInWorld(var8); } } } - public ItemStack onFoodEaten(ItemStack item, World world, EntityPlayer player) - { + public ItemStack onFoodEaten(ItemStack item, World world, EntityPlayer player) { return item; } @@ -179,389 +164,324 @@ public ItemStack onFoodEaten(ItemStack item, World world, EntityPlayer player) * How long it takes to use or consume an item */ @Override - public int getMaxItemUseDuration(ItemStack item) - { + public int getMaxItemUseDuration(ItemStack item) { return 72000; } /** - * returns the action that specifies what animation to play when the items is being used + * returns the action that specifies what animation to play when the items is + * being used */ @Override - public EnumAction getItemUseAction(ItemStack item) - { + public EnumAction getItemUseAction(ItemStack item) { return EnumAction.bow; } - + @Override - public void addInformation(ItemStack item, EntityPlayer player, List desc, boolean flag) - { - super.addInformation(item, player, desc, flag); - - CustomToolHelper.addBowInformation(item, desc); - ItemStack ammo = AmmoMechanicsMF.getAmmo(item); - if(ammo != null) - { - desc.add(EnumChatFormatting.DARK_GRAY + ammo.getDisplayName() + " x" + ammo.stackSize); - } - - desc.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.bowPower.name", decimal_format.format(getBowDamage(item)))); - } - - /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + public void addInformation(ItemStack item, EntityPlayer player, List desc, boolean flag) { + super.addInformation(item, player, desc, flag); + + CustomToolHelper.addBowInformation(item, desc); + ItemStack ammo = AmmoMechanicsMF.getAmmo(item); + if (ammo != null) { + desc.add(EnumChatFormatting.DARK_GRAY + ammo.getDisplayName() + " x" + ammo.stackSize); + } + + desc.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.bowPower.name", + decimal_format.format(getBowDamage(item)))); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. + * Args: itemStack, world, entityPlayer */ @Override - ///Item is the bow. - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { - - if(!world.isRemote && player.isSneaking() || AmmoMechanicsMF.isDepleted(item)) - { - reloadBow(item, player); - return item; - } + /// Item is the bow. + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { + + if (!world.isRemote && player.isSneaking() || AmmoMechanicsMF.isDepleted(item)) { + reloadBow(item, player); + return item; + } ArrowNockEvent event = new ArrowNockEvent(player, item); MinecraftForge.EVENT_BUS.post(event); - if (event.isCanceled()) - { + if (event.isCanceled()) { return event.result; } return item; - - //player.inventory.hasItem(Items.arrow) - } - - public boolean canAccept(ItemStack ammo) - { - String ammoType = "null"; - ItemStack weapon = new ItemStack(this); - if(ammo != null && ammo.getItem() instanceof IAmmo) - { - ammoType = ((IAmmo)ammo.getItem()).getAmmoType(ammo); - } - - if(weapon != null && weapon.getItem() instanceof IFirearm) - { - return ((IFirearm)weapon.getItem()).canAcceptAmmo(weapon, ammoType); - } - - return ammoType.equalsIgnoreCase("arrow"); - } - - private void reloadBow(ItemStack item, EntityPlayer player) - { - player.openGui(MineFantasyII.instance, 1, player.worldObj, 1, 0, 0); - } - - /** - * Return the enchantability factor of the item, most of the time is based on material. - */ - private int enchantmentLvl = 1; + + // player.inventory.hasItem(Items.arrow) + } + + public boolean canAccept(ItemStack ammo) { + String ammoType = "null"; + ItemStack weapon = new ItemStack(this); + if (ammo != null && ammo.getItem() instanceof IAmmo) { + ammoType = ((IAmmo) ammo.getItem()).getAmmoType(ammo); + } + + if (weapon != null && weapon.getItem() instanceof IFirearm) { + return ((IFirearm) weapon.getItem()).canAcceptAmmo(weapon, ammoType); + } + + return ammoType.equalsIgnoreCase("arrow"); + } + + private void reloadBow(ItemStack item, EntityPlayer player) { + player.openGui(MineFantasyII.instance, 1, player.worldObj, 1, 0, 0); + } + @Override - public int getItemEnchantability() - { + public int getItemEnchantability() { return enchantmentLvl; } - + @Override - public void onUpdate(ItemStack item, World world, Entity entity, int i, boolean b) - { - super.onUpdate(item, world, entity, i, b); - if(!item.hasTagCompound()) - item.setTagCompound(new NBTTagCompound()); - item.stackTagCompound.setInteger("Use", i); - } - - public int getDrawAmount(int timer) - { - float maxCharge = this.getMaxCharge(); - if (timer > (maxCharge*0.9F)) + public void onUpdate(ItemStack item, World world, Entity entity, int i, boolean b) { + super.onUpdate(item, world, entity, i, b); + if (!item.hasTagCompound()) + item.setTagCompound(new NBTTagCompound()); + item.stackTagCompound.setInteger("Use", i); + } + + public int getDrawAmount(int timer) { + float maxCharge = this.getMaxCharge(); + if (timer > (maxCharge * 0.9F)) return 2; - else if (timer > (maxCharge*0.65F)) - return 1; + else if (timer > (maxCharge * 0.65F)) + return 1; else if (timer > 0) - return 0; - - return -2; - } - @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = itemRarity; - - EnumRarity[] rarity = new EnumRarity[]{EnumRarity.common, EnumRarity.uncommon, EnumRarity.rare, EnumRarity.epic}; - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= rarity.length) - { - lvl = rarity.length-1; - } - return rarity[lvl]; - } - - - private EnumRarity rarity(ItemStack item, int lvl) - { - EnumRarity[] rarity = new EnumRarity[]{EnumRarity.common, EnumRarity.uncommon, EnumRarity.rare, EnumRarity.epic}; - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= rarity.length) - { - lvl = rarity.length-1; - } - return rarity[lvl]; - } - - @Override - public Entity modifyArrow(ItemStack bow, Entity arrow) - { - if(this.isCustom) - { - CustomMaterial custom = CustomToolHelper.getCustomPrimaryMaterial(bow); - if(custom != null) - { - if(custom.name.equalsIgnoreCase("silver")) - { - arrow.getEntityData().setBoolean("MF_Silverbow", true); - } - } - } - - - float dam = getBowDamage(bow); - - arrow.getEntityData().setFloat("MF_Bow_Damage", dam); - arrow.getEntityData().setString("Design", designType); - - return arrow; - } - - public boolean canUseRenderer(ItemStack item) - { - return true; - } - - private void addSet(List list, Item[] items) - { - for(Item item:items) - { - list.add(new ItemStack(item)); - } - } - - @Override - public boolean sheatheOnBack(ItemStack item) { - return true; - } - - @Override - public boolean isOffhandHandDual(ItemStack off) { - return false; - } - - @Override - public boolean offhandAttackEntity(OffhandAttackEvent event, - ItemStack mainhandItem, ItemStack offhandItem) { - return false; - } - - @Override - public boolean offhandClickAir(PlayerInteractEvent event, - ItemStack mainhandItem, ItemStack offhandItem) { - return false; - } - - @Override - public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) - { - return false; - } - - @Override - public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem) - { - } - - @Override - public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) - { - return false; - } - - @Override - public boolean canAcceptAmmo(ItemStack weapon, String ammo) - { - return ammo.equalsIgnoreCase("arrow"); - } - - @Override - public int getAmmoCapacity(ItemStack item) { - return 1; - } - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - private String designType = "standard"; - public ItemBowMF setCustom(String designType) - { - canRepair = false; - setTextureName("minefantasy2:custom/bow/"+designType+"/"+name); - isCustom = true; - this.designType = designType; - return this; - } - public IIcon[] mainIcons = new IIcon[3]; - - public IIcon cus_metal_standby; - public IIcon[] cus_metal_pulling = new IIcon[3]; - public IIcon cus_wood_standby; - public IIcon[] cus_wood_pulling = new IIcon[3]; - public IIcon cus_detail_standby; - public IIcon[] cus_detail_pulling = new IIcon[3]; - - - @Override + return 0; + + return -2; + } + + @Override + public EnumRarity getRarity(ItemStack item) { + int lvl = itemRarity; + + EnumRarity[] rarity = new EnumRarity[]{EnumRarity.common, EnumRarity.uncommon, EnumRarity.rare, + EnumRarity.epic}; + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (lvl >= rarity.length) { + lvl = rarity.length - 1; + } + return rarity[lvl]; + } + + private EnumRarity rarity(ItemStack item, int lvl) { + EnumRarity[] rarity = new EnumRarity[]{EnumRarity.common, EnumRarity.uncommon, EnumRarity.rare, + EnumRarity.epic}; + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (lvl >= rarity.length) { + lvl = rarity.length - 1; + } + return rarity[lvl]; + } + + @Override + public Entity modifyArrow(ItemStack bow, Entity arrow) { + if (this.isCustom) { + CustomMaterial custom = CustomToolHelper.getCustomPrimaryMaterial(bow); + if (custom != null) { + if (custom.name.equalsIgnoreCase("silver")) { + arrow.getEntityData().setBoolean("MF_Silverbow", true); + } + } + } + + float dam = getBowDamage(bow); + + arrow.getEntityData().setFloat("MF_Bow_Damage", dam); + arrow.getEntityData().setString("Design", designType); + + return arrow; + } + + public boolean canUseRenderer(ItemStack item) { + return true; + } + + private void addSet(List list, Item[] items) { + for (Item item : items) { + list.add(new ItemStack(item)); + } + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + @Optional.Method(modid = "battlegear2") + public boolean offhandAttackEntity(mods.battlegear2.api.PlayerEventChild.OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem) { + return false; + } + + @Override + public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) { + return false; + } + + @Override + public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) { + return false; + } + + @Override + public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem) { + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return false; + } + + @Override + public boolean canAcceptAmmo(ItemStack weapon, String ammo) { + return ammo.equalsIgnoreCase("arrow"); + } + + @Override + public int getAmmoCapacity(ItemStack item) { + return 1; + } + + public ItemBowMF setCustom(String designType) { + canRepair = false; + setTextureName("minefantasy2:custom/bow/" + designType + "/" + name); + isCustom = true; + this.designType = designType; + return this; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack stack, int pass) { + return getIcon(stack, pass, -1); + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack bow, int layer, int pull) { + if (!isCustom) { + return pull >= 0 ? mainIcons[pull] : this.itemIcon; + } + + if (layer == 0) { + return pull >= 0 ? cus_metal_pulling[pull] : cus_metal_standby; + } + if (layer == 1) { + return pull >= 0 ? cus_wood_pulling[pull] : cus_wood_standby; + } else { + return pull >= 0 ? cus_detail_pulling[pull] : cus_detail_standby; + } + } + @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack stack, int pass) - { - return getIcon(stack, pass, -1); - } - @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack bow, int layer, int pull) - { - if(!isCustom) - { - return pull >= 0 ? mainIcons[pull] : this.itemIcon; - } - - if(layer == 0) - { - return pull >= 0 ? cus_metal_pulling[pull] : cus_metal_standby; - } - if(layer == 1) - { - return pull >= 0 ? cus_wood_pulling[pull] : cus_wood_standby; - } - else - { - return pull >= 0 ? cus_detail_pulling[pull] : cus_detail_standby; - } - } - @SideOnly(Side.CLIENT) @Override - public void registerIcons(IIconRegister reg) - { - this.itemIcon = reg.registerIcon(this.getIconString()+"_standby"); - for (int i = 0; i < 3; ++i) - { + public void registerIcons(IIconRegister reg) { + this.itemIcon = reg.registerIcon(this.getIconString() + "_standby"); + for (int i = 0; i < 3; ++i) { this.mainIcons[i] = reg.registerIcon(this.getIconString() + "_pulling_" + (i)); } - - if(isCustom) - { - this.cus_metal_standby = reg.registerIcon(this.getIconString()+"_standby"); - this.cus_wood_standby = reg.registerIcon(this.getIconString()+"_standby_haft"); - this.cus_detail_standby = reg.registerIcon(this.getIconString()+"_standby_detail"); - - for (int i = 0; i < 3; ++i) - { - this.cus_metal_pulling[i] = reg.registerIcon(this.getIconString() + "_pulling_" + (i)); - this.cus_wood_pulling[i] = reg.registerIcon(this.getIconString() + "_pulling_" + (i) + "_haft"); - this.cus_detail_pulling[i] = reg.registerIcon(this.getIconString() + "_pulling_" + (i) + "_detail"); - } + + if (isCustom) { + this.cus_metal_standby = reg.registerIcon(this.getIconString() + "_standby"); + this.cus_wood_standby = reg.registerIcon(this.getIconString() + "_standby_haft"); + this.cus_detail_standby = reg.registerIcon(this.getIconString() + "_standby_detail"); + + for (int i = 0; i < 3; ++i) { + this.cus_metal_pulling[i] = reg.registerIcon(this.getIconString() + "_pulling_" + (i)); + this.cus_wood_pulling[i] = reg.registerIcon(this.getIconString() + "_pulling_" + (i) + "_haft"); + this.cus_detail_pulling[i] = reg.registerIcon(this.getIconString() + "_pulling_" + (i) + "_detail"); + } } } - - @Override + + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - int c = CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); - return c; - } - - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - + public int getColorFromItemStack(ItemStack item, int layer) { + int c = CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + return c; + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getWoodenLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getWoodenLocalisedName(item, unlocalName); } - + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList wood = CustomMaterial.getList("wood"); - Iterator iteratorWood = wood.iterator(); - while(iteratorWood.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct("Iron", customMat.name)); - } - } - return; - } - } - - public float getBowDamage(ItemStack item) - { - return CustomToolHelper.getBowDamage(item, baseDamage) * model.damageModifier; - } - @Override - public float getRange(ItemStack item) - { - return model.velocity; - } - @Override - public float getSpread(ItemStack item) - { - return model.spread; - } - //====================================================== CUSTOM END ==============================================================\\ - @Override - public float getMaxCharge() - { - return model.chargeTime; - } + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList wood = CustomMaterial.getList("wood"); + Iterator iteratorWood = wood.iterator(); + while (iteratorWood.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct("Iron", customMat.name)); + } + } + return; + } + } + + public float getBowDamage(ItemStack item) { + return CustomToolHelper.getBowDamage(item, baseDamage) * model.damageModifier; + } + + @Override + public float getRange(ItemStack item) { + return model.velocity; + } + + @Override + public float getSpread(ItemStack item) { + return model.spread; + } + + // ====================================================== CUSTOM END + // ==============================================================\\ + @Override + public float getMaxCharge() { + return model.chargeTime; + } } diff --git a/src/main/java/minefantasy/mf2/item/armour/ItemApron.java b/src/main/java/minefantasy/mf2/item/armour/ItemApron.java index a4510e15..2afba183 100644 --- a/src/main/java/minefantasy/mf2/item/armour/ItemApron.java +++ b/src/main/java/minefantasy/mf2/item/armour/ItemApron.java @@ -1,28 +1,19 @@ package minefantasy.mf2.item.armour; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.entity.EntityLivingBase; +import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import minefantasy.mf2.api.armour.ArmourDesign; -import minefantasy.mf2.material.BaseMaterialMF; -public class ItemApron extends ItemClothingMF -{ - public ItemApron(String name, BaseMaterialMF material, String tex, int rarity) - { - super(name, material, 1, tex, rarity); - } - - public static boolean isUserProtected(EntityPlayer user) - { - ItemStack worn = user.getCurrentArmor(2); - if(worn == null) - { - return false; - } - return worn.getItem() instanceof ItemApron; - } +public class ItemApron extends ItemClothingMF { + public ItemApron(String name, BaseMaterialMF material, String tex, int rarity) { + super(name, material, 1, tex, rarity); + } + + public static boolean isUserProtected(EntityPlayer user) { + ItemStack worn = user.getCurrentArmor(2); + if (worn == null) { + return false; + } + return worn.getItem() instanceof ItemApron; + } } diff --git a/src/main/java/minefantasy/mf2/item/armour/ItemArmourMF.java b/src/main/java/minefantasy/mf2/item/armour/ItemArmourMF.java index b15c5b6b..9ffc2305 100644 --- a/src/main/java/minefantasy/mf2/item/armour/ItemArmourMF.java +++ b/src/main/java/minefantasy/mf2/item/armour/ItemArmourMF.java @@ -1,7 +1,5 @@ package minefantasy.mf2.item.armour; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -17,7 +15,6 @@ import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.material.BaseMaterialMF; -import minefantasy.mf2.mechanics.CombatMechanics; import minefantasy.mf2.util.MFLogUtil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -33,246 +30,211 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; -public class ItemArmourMF extends ItemArmourMFBase implements IElementalResistance -{ - @SideOnly(Side.CLIENT) - private static Object fullplate; - - private int itemRarity; - protected BaseMaterialMF baseMaterial; - - public ItemArmourMF(String name, BaseMaterialMF material, ArmourDesign AD, int slot, String tex, int rarity) - { - super(name, material.getArmourConversion(), AD, slot, tex); - baseMaterial = material; - this.setTextureName("minefantasy2:apparel/"+AD.getName().toLowerCase()+"/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - setCreativeTab(CreativeTabMF.tabArmour); - - itemRarity = rarity; - } - - public ItemArmourMF(String name, BaseMaterialMF material, ArmourDesign AD, int slot, String tex, int rarity, float customBulk) - { - this(name, material, AD, slot, tex, rarity); - this.suitBulk = customBulk; - } - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) - { - if(source.isMagicDamage() && this.getMagicResistance(stack, source) > 100F) - { - return; - } - if(source.isFireDamage() && this.getFireResistance(stack, source) > 100F) - { - return; - } - if(ArmourListMF.isUnbreakable(baseMaterial, entity)) - { - return; - } - initArmourDamage(entity, stack, damage); - } - - @Override - public float getMagicResistance(ItemStack item, DamageSource source) - { - CustomMaterial custom = getCustomMaterial(item); - if(custom != null) - { - return custom.resistance; - } - return material.magicResistanceModifier; - } - - @Override - public float getFireResistance(ItemStack item, DamageSource source) - { - CustomMaterial custom = getCustomMaterial(item); - if(custom != null) - { - MFLogUtil.logDebug("Fire Resist: " + custom.getFireResistance()); - return custom.getFireResistance() * design.getRating(); - } - return material.fireResistanceModifier; - } - - @Override - public float getArrowDeflection(ItemStack item, DamageSource source) - { - return (design == ArmourDesign.MAIL || design == ArmourDesign.PLATE) ? 0.5F : 0.0F; - } - - @Override - public float getBaseResistance(ItemStack item, DamageSource source) - { - if(baseMaterial == BaseMaterialMF.getMaterial("ender") && source.getSourceOfDamage() != null && source.getSourceOfDamage() instanceof EntityEnderPearl) - { - return 100F; - } - return 0; - } - - - @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = itemRarity + 1; - - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(design == ArmourDesign.PLATE) - { - lvl ++; - } - if(lvl >= ToolListMF.rarity.length) - { - lvl = ToolListMF.rarity.length-1; - } - return ToolListMF.rarity[lvl]; - } - @Override - protected boolean isUnbreakable() - { - return baseMaterial == BaseMaterialMF.getMaterial("ender"); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(this != ArmourListMF.leather[0]) - { - return; - } - list.add(new ItemStack(ArmourListMF.leatherapron)); - addSet(list, ArmourListMF.leather); - } - private void addSet(List list, Item[] items) - { - for(Item item:items) - { - list.add(new ItemStack(item)); - } - } - - @SideOnly(Side.CLIENT) +import java.util.List; + +public class ItemArmourMF extends ItemArmourMFBase implements IElementalResistance { + @SideOnly(Side.CLIENT) + private static Object fullplate; + protected BaseMaterialMF baseMaterial; + private int itemRarity; + @SideOnly(Side.CLIENT) private IIcon clothIcon; - @SideOnly(Side.CLIENT) + @SideOnly(Side.CLIENT) private IIcon armourIcon; - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(!canColour()) - { - super.registerIcons(reg); - } - else - { - String baseLayer = isMetal() ? "" : "_overlay"; - this.armourIcon = reg.registerIcon(this.getIconString()+baseLayer); - String dyeLayer = isMetal() ? "_cloth" : ""; - this.clothIcon = reg.registerIcon(this.getIconString()+dyeLayer); - } - } - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass(int dam, int layer) - { - if(!canColour()) - { - return super.getIconFromDamage(dam); - } - return layer == 1 ? armourIcon : clothIcon; - } - - public boolean canColour() - { - return design == ArmourDesign.PADDING || design == ArmourDesign.LEATHER || design == ArmourDesign.CLOTH || isMetal(); - } - public boolean isMetal() - { - return design == ArmourDesign.MAIL || design == ArmourDesign.PLATE; - } - - @SideOnly(Side.CLIENT) - @Override - public boolean requiresMultipleRenderPasses() - { + + public ItemArmourMF(String name, BaseMaterialMF material, ArmourDesign AD, int slot, String tex, int rarity) { + super(name, material.getArmourConversion(), AD, slot, tex); + baseMaterial = material; + this.setTextureName("minefantasy2:apparel/" + AD.getName().toLowerCase() + "/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + setCreativeTab(CreativeTabMF.tabArmour); + + itemRarity = rarity; + } + + public ItemArmourMF(String name, BaseMaterialMF material, ArmourDesign AD, int slot, String tex, int rarity, + float customBulk) { + this(name, material, AD, slot, tex, rarity); + this.suitBulk = customBulk; + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + if (source.isMagicDamage() && this.getMagicResistance(stack, source) > 100F) { + return; + } + if (source.isFireDamage() && this.getFireResistance(stack, source) > 100F) { + return; + } + if (ArmourListMF.isUnbreakable(baseMaterial, entity)) { + return; + } + initArmourDamage(entity, stack, damage); + } + + @Override + public float getMagicResistance(ItemStack item, DamageSource source) { + CustomMaterial custom = getCustomMaterial(item); + if (custom != null) { + return custom.resistance; + } + return material.magicResistanceModifier; + } + + @Override + public float getFireResistance(ItemStack item, DamageSource source) { + CustomMaterial custom = getCustomMaterial(item); + if (custom != null) { + MFLogUtil.logDebug("Fire Resist: " + custom.getFireResistance()); + return custom.getFireResistance() * design.getRating(); + } + return material.fireResistanceModifier; + } + + @Override + public float getArrowDeflection(ItemStack item, DamageSource source) { + return (design == ArmourDesign.MAIL || design == ArmourDesign.PLATE) ? 0.5F : 0.0F; + } + + @Override + public float getBaseResistance(ItemStack item, DamageSource source) { + if (baseMaterial == BaseMaterialMF.getMaterial("ender") && source.getSourceOfDamage() != null + && source.getSourceOfDamage() instanceof EntityEnderPearl) { + return 100F; + } + return 0; + } + + @Override + public EnumRarity getRarity(ItemStack item) { + int lvl = itemRarity + 1; + + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (design == ArmourDesign.PLATE) { + lvl++; + } + if (lvl >= ToolListMF.rarity.length) { + lvl = ToolListMF.rarity.length - 1; + } + return ToolListMF.rarity[lvl]; + } + + @Override + protected boolean isUnbreakable() { + return baseMaterial == BaseMaterialMF.getMaterial("ender"); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (this != ArmourListMF.leather[0]) { + return; + } + list.add(new ItemStack(ArmourListMF.leatherapron)); + addSet(list, ArmourListMF.leather); + } + + private void addSet(List list, Item[] items) { + for (Item item : items) { + list.add(new ItemStack(item)); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + if (!canColour()) { + super.registerIcons(reg); + } else { + String baseLayer = isMetal() ? "" : "_overlay"; + this.armourIcon = reg.registerIcon(this.getIconString() + baseLayer); + String dyeLayer = isMetal() ? "_cloth" : ""; + this.clothIcon = reg.registerIcon(this.getIconString() + dyeLayer); + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int dam, int layer) { + if (!canColour()) { + return super.getIconFromDamage(dam); + } + return layer == 1 ? armourIcon : clothIcon; + } + + public boolean canColour() { + return design == ArmourDesign.PADDING || design == ArmourDesign.LEATHER || design == ArmourDesign.CLOTH + || isMetal(); + } + + public boolean isMetal() { + return design == ArmourDesign.MAIL || design == ArmourDesign.PLATE; + } + + @SideOnly(Side.CLIENT) + @Override + public boolean requiresMultipleRenderPasses() { return canColour(); } - - /** + + /** * Return whether the specified armor ItemStack has a color. */ - @Override - public boolean hasColor(ItemStack item) - { - return !canColour() ? false : (!item.hasTagCompound() ? false : (!item.getTagCompound().hasKey("display", 10) ? false : item.getTagCompound().getCompoundTag("display").hasKey("color", 3))); - } - /** - * The Colour of the armour when not dyed - */ - public int getBaseColour(ItemStack item) - { - if(!this.isCustom()) - { - return 10511680; - } - return -1; - } + @Override + public boolean hasColor(ItemStack item) { + return !canColour() ? false + : (!item.hasTagCompound() ? false + : (!item.getTagCompound().hasKey("display", 10) ? false + : item.getTagCompound().getCompoundTag("display").hasKey("color", 3))); + } + + /** + * The Colour of the armour when not dyed + */ + public int getBaseColour(ItemStack item) { + if (!this.isCustom()) { + return 10511680; + } + return -1; + } /** * Return the color for the specified armor ItemStack. */ - @Override - public int getColor(ItemStack item) - { - int metal = getBaseColour(item); - if (!canColour()) - { + @Override + public int getColor(ItemStack item) { + int metal = getBaseColour(item); + if (!canColour()) { return metal; - } - else - { + } else { NBTTagCompound nbttagcompound = item.getTagCompound(); - if (nbttagcompound == null) - { + if (nbttagcompound == null) { return metal; - } - else - { + } else { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); - return nbttagcompound1 == null ? metal : (nbttagcompound1.hasKey("color", 3) ? nbttagcompound1.getInteger("color") : metal); + return nbttagcompound1 == null ? metal + : (nbttagcompound1.hasKey("color", 3) ? nbttagcompound1.getInteger("color") : metal); } } } - - /** + + /** * Remove the color from the specified armor ItemStack. */ - @Override - public void removeColor(ItemStack item) - { - if (canColour()) - { + @Override + public void removeColor(ItemStack item) { + if (canColour()) { NBTTagCompound nbttagcompound = item.getTagCompound(); - if (nbttagcompound != null) - { + if (nbttagcompound != null) { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); - if (nbttagcompound1.hasKey("color")) - { + if (nbttagcompound1.hasKey("color")) { nbttagcompound1.removeTag("color"); } } @@ -280,226 +242,198 @@ public void removeColor(ItemStack item) } @Override - public void func_82813_b(ItemStack item, int colour) - { - if (!canColour()) - { + public void func_82813_b(ItemStack item, int colour) { + if (!canColour()) { return; - } - else - { + } else { NBTTagCompound nbttagcompound = item.getTagCompound(); - if (nbttagcompound == null) - { + if (nbttagcompound == null) { nbttagcompound = new NBTTagCompound(); item.setTagCompound(nbttagcompound); } NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); - if (!nbttagcompound.hasKey("display", 10)) - { + if (!nbttagcompound.hasKey("display", 10)) { nbttagcompound.setTag("display", nbttagcompound1); } nbttagcompound1.setInteger("color", colour); } } + + @Override + public float getMagicAC(float AC, DamageSource source, double damage, EntityLivingBase player) { + if (damage > 1 && material.isMythic) { + return AC; + } + return 0F; + } + + @Override + public String getSuitWeigthType(ItemStack item) { + if (design == ArmourDesign.MAIL) { + return "medium"; + } + if (design == ArmourDesign.PLATE) { + return "heavy"; + } + return super.getSuitWeigthType(item); + } + + public ItemStack construct(String plate) { + ItemStack item = new ItemStack(this); + CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, plate.toLowerCase()); + return item; + } + + /** + * A bit of the new system, gets custom materials for armour Only used on + * cogwork armour though + */ + public CustomMaterial getCustomMaterial(ItemStack item) { + CustomMaterial material = CustomMaterial.getMaterialFor(item, CustomToolHelper.slot_main); + if (material != null) { + return material; + } + return null; + } + + @Override + public float getDRValue(EntityLivingBase user, ItemStack armour, DamageSource src) { + float DR = getProtectionRatio(armour) * scalePiece(); + + if (ArmourCalculator.advancedDamageTypes && !user.worldObj.isRemote) { + DR = ArmourCalculator.adjustACForDamage(src, DR, getProtectiveTrait(armour, 0), + getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); + } + MFLogUtil.logDebug(">>>>DR<<<< = " + DR); + return DR; + } + + @Override + protected float getProtectionRatio(ItemStack item) { + CustomMaterial main = getCustomMaterial(item); + if (main != null) { + return main.hardness * design.getRating(); + } + return super.getProtectionRatio(item); + } + + /** + * Gets the modifier for a certain damage type (Cutting, Blunt, Piercing) + */ + @Override + public float getProtectiveTrait(ItemStack item, int dtype) { + float value = super.getProtectiveTrait(item, dtype); + float cutting = 1.0F; + float piercing = 1.0F; + float blunt = 1.0F; + + CustomMaterial material = getCustomMaterial(item); + if (material != null) { + cutting = material.getArmourProtection(0); + blunt = material.getArmourProtection(1); + piercing = material.getArmourProtection(2); + } + + if (dtype == 0)// Cutting + { + value *= cutting; + } + if (dtype == 2)// Piercing + { + value *= piercing; + } + if (dtype == 1)// Blunt + { + value *= blunt; + } + return value; + } + + public float getResistanceModifier(ItemStack item, String hazard) { + CustomMaterial custom = getCustomMaterial(item); + if (custom != null) { + return custom.resistance; + } + return super.getResistanceModifier(item, hazard); + } + + public boolean isCustom() { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean full) { + CustomToolHelper.addInformation(item, list); + float mass = getPieceWeight(item, armorType); + + list.add(CustomMaterial.getWeightString(mass)); + super.addInformation(item, user, list, full); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + if (entity instanceof EntityPlayer && armorType < 2 && design == ArmourDesign.FIELDPLATE + && ConfigClient.customModel) { + return getArmourTextureName(stack, entity, slot, type) + "_S.png"; + } + return getArmourTextureName(stack, entity, slot, type) + ".png"; + } + + public String getArmourTextureName(ItemStack stack, Entity entity, int slot, String type) { + String tex = "minefantasy2:textures/models/armour/" + design.getName().toLowerCase() + "/" + texture; + if (type == null && canColour())// bottom layer + { + return tex + "_cloth"; + } + return tex; + } + @Override - public float getMagicAC(float AC, DamageSource source, double damage, EntityLivingBase player) - { - if(damage > 1 && material.isMythic) - { - return AC; - } - return 0F; - } - - @Override - public String getSuitWeigthType(ItemStack item) - { - if(design == ArmourDesign.MAIL) - { - return "medium"; - } - if(design == ArmourDesign.PLATE) - { - return "heavy"; - } - return super.getSuitWeigthType(item); - } - - - public ItemStack construct(String plate) - { - ItemStack item = new ItemStack(this); - CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, plate.toLowerCase()); - return item; - } - - /** - * A bit of the new system, gets custom materials for armour Only used on cogwork armour though - */ - public CustomMaterial getCustomMaterial(ItemStack item) - { - CustomMaterial material = CustomMaterial.getMaterialFor(item, CustomToolHelper.slot_main); - if(material != null) - { - return material; - } - return null; - } - - @Override - public float getDRValue(EntityLivingBase user, ItemStack armour, DamageSource src) - { - float DR = getProtectionRatio(armour)*scalePiece(); - - if(ArmourCalculator.advancedDamageTypes && !user.worldObj.isRemote) - { - DR = ArmourCalculator.adjustACForDamage(src, DR, getProtectiveTrait(armour, 0), getProtectiveTrait(armour, 1), getProtectiveTrait(armour, 2)); - } - MFLogUtil.logDebug(">>>>DR<<<< = " + DR); - return DR; - } - @Override - protected float getProtectionRatio(ItemStack item) - { - CustomMaterial main = getCustomMaterial(item); - if(main != null) - { - return main.hardness*design.getRating(); - } - return super.getProtectionRatio(item); - } - - /** - * Gets the modifier for a certain damage type (Cutting, Blunt, Piercing) - */ - @Override - public float getProtectiveTrait(ItemStack item, int dtype) - { - float value = super.getProtectiveTrait(item, dtype); - float cutting = 1.0F; - float piercing = 1.0F; - float blunt = 1.0F; - - CustomMaterial material = getCustomMaterial(item); - if(material != null) - { - cutting = material.getArmourProtection(0); - blunt = material.getArmourProtection(1); - piercing = material.getArmourProtection(2); - } - - if(dtype == 0)//Cutting - { - value *= cutting; - } - if(dtype == 2)//Piercing - { - value *= piercing; - } - if(dtype == 1)//Blunt - { - value *= blunt; - } - return value; - } - public float getResistanceModifier(ItemStack item, String hazard) - { - CustomMaterial custom = getCustomMaterial(item); - if(custom != null) - { - return custom.resistance; - } - return super.getResistanceModifier(item, hazard); - } - - public boolean isCustom() { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean full) - { - CustomToolHelper.addInformation(item, list); - float mass = getPieceWeight(item, armorType); - - list.add(CustomMaterial.getWeightString(mass)); - super.addInformation(item, user, list, full); - } - - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - if(entity instanceof EntityPlayer && armorType < 2 && design == ArmourDesign.FIELDPLATE && ConfigClient.customModel) - { - return getArmourTextureName(stack, entity, slot, type) + "_S.png"; - } - return getArmourTextureName(stack, entity, slot, type) + ".png"; - } - public String getArmourTextureName(ItemStack stack, Entity entity, int slot, String type) - { - String tex = "minefantasy2:textures/models/armour/"+design.getName().toLowerCase()+"/"+texture; - if(type == null && canColour())//bottom layer - { - return tex + "_cloth"; - } - return tex; - } - - @Override - @SideOnly(Side.CLIENT) - public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) - { - if( !(entityLiving instanceof EntityPlayer) || armorType >= 2 || !ConfigClient.customModel) - { - return super.getArmorModel(entityLiving, itemStack, armorSlot); - } - - if(fullplate == null) - { - fullplate = new minefantasy.mf2.client.render.armour.ModelFullplate(1.0F); - } - net.minecraft.client.model.ModelBiped model = this.design == ArmourDesign.FIELDPLATE ? (net.minecraft.client.model.ModelBiped)fullplate : null; - if( model == null) - { - return super.getArmorModel(entityLiving, itemStack, armorSlot); - } - if(entityLiving != null) - { - model.heldItemRight = entityLiving.getHeldItem() != null ? 1 : 0; - model.aimedBow = false; - if(entityLiving instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)entityLiving; - ItemStack held = player.getHeldItem(); - if (held != null && player.getItemInUseCount() > 0) - { - EnumAction enumaction = held.getItemUseAction(); - - if (enumaction == EnumAction.block) - { - model.heldItemRight = 3; - } - else if (enumaction == EnumAction.bow) - { - model.aimedBow = true; - } - } - } - } - model.bipedHead.showModel = (this.armorType == 0); - model.bipedHeadwear.showModel = (this.armorType == 0); - - model.bipedCloak.showModel = (this.armorType == 1); - model.bipedBody.showModel = (this.armorType == 1); - model.bipedLeftArm.showModel = (this.armorType == 1); - model.bipedRightArm.showModel = (this.armorType == 1); + @SideOnly(Side.CLIENT) + public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, + int armorSlot) { + if (!(entityLiving instanceof EntityPlayer) || armorType >= 2 || !ConfigClient.customModel) { + return super.getArmorModel(entityLiving, itemStack, armorSlot); + } + + if (fullplate == null) { + fullplate = new minefantasy.mf2.client.render.armour.ModelFullplate(1.0F); + } + net.minecraft.client.model.ModelBiped model = this.design == ArmourDesign.FIELDPLATE + ? (net.minecraft.client.model.ModelBiped) fullplate + : null; + if (model == null) { + return super.getArmorModel(entityLiving, itemStack, armorSlot); + } + if (entityLiving != null) { + model.heldItemRight = entityLiving.getHeldItem() != null ? 1 : 0; + model.aimedBow = false; + if (entityLiving instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entityLiving; + ItemStack held = player.getHeldItem(); + if (held != null && player.getItemInUseCount() > 0) { + EnumAction enumaction = held.getItemUseAction(); + + if (enumaction == EnumAction.block) { + model.heldItemRight = 3; + } else if (enumaction == EnumAction.bow) { + model.aimedBow = true; + } + } + } + } + model.bipedHead.showModel = (this.armorType == 0); + model.bipedHeadwear.showModel = (this.armorType == 0); + + model.bipedCloak.showModel = (this.armorType == 1); + model.bipedBody.showModel = (this.armorType == 1); + model.bipedLeftArm.showModel = (this.armorType == 1); + model.bipedRightArm.showModel = (this.armorType == 1); return model; } } diff --git a/src/main/java/minefantasy/mf2/item/armour/ItemClothingMF.java b/src/main/java/minefantasy/mf2/item/armour/ItemClothingMF.java index 07227440..eaf3d53b 100644 --- a/src/main/java/minefantasy/mf2/item/armour/ItemClothingMF.java +++ b/src/main/java/minefantasy/mf2/item/armour/ItemClothingMF.java @@ -1,60 +1,51 @@ package minefantasy.mf2.item.armour; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.armour.ArmourDesign; import minefantasy.mf2.config.ConfigClient; import minefantasy.mf2.material.BaseMaterialMF; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; -public class ItemClothingMF extends ItemArmourMF -{ - @SideOnly(Side.CLIENT) - private Object model; - /** - * @param piece 0head, 1body, 2legs, 3boots - */ - public ItemClothingMF(String name, BaseMaterialMF material, int piece, String tex, int rarity) - { - super(name, material, ArmourDesign.CLOTH, piece, tex, rarity); - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) - { - String tex = "minefantasy2:textures/models/armour/"+design.getName().toLowerCase()+"/"+texture; - if(type == null && canColour())//bottom layer - { - return tex + "_cloth.png"; - } - return tex+".png"; - } - - @Override - @SideOnly(Side.CLIENT) - public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) - { - - if(!ConfigClient.customModel) - { - return super.getArmorModel(entityLiving, itemStack, armorSlot); - } - if(model == null) - { - model = new net.minecraft.client.model.ModelBiped(0.25F); - } - - if(entityLiving != null) - { - ((net.minecraft.client.model.ModelBiped)model).heldItemRight = entityLiving.getHeldItem() != null ? 1 : 0; - } - return (net.minecraft.client.model.ModelBiped)model; +public class ItemClothingMF extends ItemArmourMF { + @SideOnly(Side.CLIENT) + private Object model; + + /** + * @param piece 0head, 1body, 2legs, 3boots + */ + public ItemClothingMF(String name, BaseMaterialMF material, int piece, String tex, int rarity) { + super(name, material, ArmourDesign.CLOTH, piece, tex, rarity); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + String tex = "minefantasy2:textures/models/armour/" + design.getName().toLowerCase() + "/" + texture; + if (type == null && canColour())// bottom layer + { + return tex + "_cloth.png"; + } + return tex + ".png"; + } + + @Override + @SideOnly(Side.CLIENT) + public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, + int armorSlot) { + + if (!ConfigClient.customModel) { + return super.getArmorModel(entityLiving, itemStack, armorSlot); + } + if (model == null) { + model = new net.minecraft.client.model.ModelBiped(0.25F); + } + + if (entityLiving != null) { + ((net.minecraft.client.model.ModelBiped) model).heldItemRight = entityLiving.getHeldItem() != null ? 1 : 0; + } + return (net.minecraft.client.model.ModelBiped) model; } - + } diff --git a/src/main/java/minefantasy/mf2/item/armour/ItemCustomArmour.java b/src/main/java/minefantasy/mf2/item/armour/ItemCustomArmour.java index 263183bf..fbead90a 100644 --- a/src/main/java/minefantasy/mf2/item/armour/ItemCustomArmour.java +++ b/src/main/java/minefantasy/mf2/item/armour/ItemCustomArmour.java @@ -1,16 +1,12 @@ package minefantasy.mf2.item.armour; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.armour.ArmourDesign; import minefantasy.mf2.api.helpers.ArmourCalculator; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.TacticalManager; import minefantasy.mf2.api.material.CustomMaterial; -import minefantasy.mf2.entity.mob.EntityDragon; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.CustomArmourListMF; import minefantasy.mf2.material.BaseMaterialMF; @@ -20,218 +16,197 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemCustomArmour extends ItemArmourMF -{ - private String specialDesign = "standard"; - private float ratingModifier = 1.0F; - public ItemCustomArmour(String craftDesign, String name, ArmourDesign AD, int slot, String tex, int rarity) - { - super(craftDesign + "_"+name, BaseMaterialMF.iron, AD, slot, craftDesign + "_"+tex, rarity); - this.setTextureName("minefantasy2:custom/apparel/" + craftDesign + "/"+craftDesign+"_"+name); - this.specialDesign = craftDesign; - canRepair = false; - } - public ItemCustomArmour modifyRating(float rating) - { - this.ratingModifier = rating; - return this; - } - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) - { - super.damageArmor(entity, stack, source, damage, slot); - } - - @Override +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class ItemCustomArmour extends ItemArmourMF { + private String specialDesign = "standard"; + private float ratingModifier = 1.0F; + private IIcon plateIcon, detailIcon; + + public ItemCustomArmour(String craftDesign, String name, ArmourDesign AD, int slot, String tex, int rarity) { + super(craftDesign + "_" + name, BaseMaterialMF.iron, AD, slot, craftDesign + "_" + tex, rarity); + this.setTextureName("minefantasy2:custom/apparel/" + craftDesign + "/" + craftDesign + "_" + name); + this.specialDesign = craftDesign; + canRepair = false; + } + + /** + * Adds a suit ONLY IF the material ingot exists + */ + public static void tryAddSuits(List list, String plating) { + ArrayList mats = OreDictionary.getOres("ingot" + plating); + if (MineFantasyII.isDebug() || (mats != null && !mats.isEmpty())) { + addSuits(list, plating); + } + } + + public static void addSuits(List list, String material) { + list.add(CustomArmourListMF.standard_chain_helmet.construct(material)); + list.add(CustomArmourListMF.standard_chain_chest.construct(material)); + list.add(CustomArmourListMF.standard_chain_legs.construct(material)); + list.add(CustomArmourListMF.standard_chain_boots.construct(material)); + + list.add(CustomArmourListMF.standard_scale_helmet.construct(material)); + list.add(CustomArmourListMF.standard_scale_chest.construct(material)); + list.add(CustomArmourListMF.standard_scale_legs.construct(material)); + list.add(CustomArmourListMF.standard_scale_boots.construct(material)); + + list.add(CustomArmourListMF.standard_splint_helmet.construct(material)); + list.add(CustomArmourListMF.standard_splint_chest.construct(material)); + list.add(CustomArmourListMF.standard_splint_legs.construct(material)); + list.add(CustomArmourListMF.standard_splint_boots.construct(material)); + + list.add(CustomArmourListMF.standard_plate_helmet.construct(material)); + list.add(CustomArmourListMF.standard_plate_chest.construct(material)); + list.add(CustomArmourListMF.standard_plate_legs.construct(material)); + list.add(CustomArmourListMF.standard_plate_boots.construct(material)); + } + + public ItemCustomArmour modifyRating(float rating) { + this.ratingModifier = rating; + return this; + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + super.damageArmor(entity, stack, source, damage, slot); + } + + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); - } - - @Override - public String getArmourTextureName(ItemStack stack, Entity entity, int slot, String type) - { - String tex = "minefantasy2:textures/models/armour/custom/" + specialDesign + "/"+texture; - if(type == null)//bottom layer - { - return tex;//COLOUR LAYER - } - return tex +"_detail";//STATIC LAYER - } - - @Override - public boolean hasColor(ItemStack item) - { + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); + } + + @Override + public String getArmourTextureName(ItemStack stack, Entity entity, int slot, String type) { + String tex = "minefantasy2:textures/models/armour/custom/" + specialDesign + "/" + texture; + if (type == null)// bottom layer + { + return tex;// COLOUR LAYER + } + return tex + "_detail";// STATIC LAYER + } + + @Override + public boolean hasColor(ItemStack item) { return true; } - @Override - public boolean canColour() - { + + @Override + public boolean canColour() { return true; } /** * Return the colour of the material it is made of. */ - @Override - public int getBaseColour(ItemStack item) - { - CustomMaterial material = getCustomMaterial(item); - if(material == null) - { - return (255 << 16) + (255 << 8) + 255; - } + @Override + public int getBaseColour(ItemStack item) { + CustomMaterial material = getCustomMaterial(item); + if (material == null) { + return (255 << 16) + (255 << 8) + 255; + } return material.getColourInt(); } - - @Override - public CustomMaterial getCustomMaterial(ItemStack item) - { - CustomMaterial material = CustomMaterial.getMaterialFor(item, CustomToolHelper.slot_main); - if(material != null) - { - return material; - } - return null; - } - - /** - * Adds a suit ONLY IF the material ingot exists - */ - public static void tryAddSuits(List list, String plating) - { - ArrayList mats = OreDictionary.getOres("ingot"+plating); - if(MineFantasyII.isDebug() || (mats != null && !mats.isEmpty())) - { - addSuits(list, plating); - } - } - public static void addSuits(List list, String material) - { - list.add(CustomArmourListMF.standard_chain_helmet.construct(material)); - list.add(CustomArmourListMF.standard_chain_chest.construct(material)); - list.add(CustomArmourListMF.standard_chain_legs.construct(material)); - list.add(CustomArmourListMF.standard_chain_boots.construct(material)); - - list.add(CustomArmourListMF.standard_scale_helmet.construct(material)); - list.add(CustomArmourListMF.standard_scale_chest.construct(material)); - list.add(CustomArmourListMF.standard_scale_legs.construct(material)); - list.add(CustomArmourListMF.standard_scale_boots.construct(material)); - - list.add(CustomArmourListMF.standard_splint_helmet.construct(material)); - list.add(CustomArmourListMF.standard_splint_chest.construct(material)); - list.add(CustomArmourListMF.standard_splint_legs.construct(material)); - list.add(CustomArmourListMF.standard_splint_boots.construct(material)); - - list.add(CustomArmourListMF.standard_plate_helmet.construct(material)); - list.add(CustomArmourListMF.standard_plate_chest.construct(material)); - list.add(CustomArmourListMF.standard_plate_legs.construct(material)); - list.add(CustomArmourListMF.standard_plate_boots.construct(material)); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - if(this.getCreativeTab() != CreativeTabMF.tabArmour) - { - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - - if(customMat.getItem() != null) - { - list.add(construct(customMat.name)); - } - } - return; - } - if(this != CustomArmourListMF.standard_chain_boots)return; - - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - - if(customMat.getItem() != null) - { - addSuits(list, customMat.name); - } - } - } - - private IIcon plateIcon, detailIcon; - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - this.plateIcon = reg.registerIcon(this.getIconString()); - this.detailIcon = reg.registerIcon(this.getIconString()+"_detail"); - } - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass(int dam, int layer) - { - return layer == 1 ? detailIcon : plateIcon; - } - @SideOnly(Side.CLIENT) - @Override - public boolean requiresMultipleRenderPasses() - { + + @Override + public CustomMaterial getCustomMaterial(ItemStack item) { + CustomMaterial material = CustomMaterial.getMaterialFor(item, CustomToolHelper.slot_main); + if (material != null) { + return material; + } + return null; + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + if (this.getCreativeTab() != CreativeTabMF.tabArmour) { + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + + if (customMat.getItem() != null) { + list.add(construct(customMat.name)); + } + } + return; + } + if (this != CustomArmourListMF.standard_chain_boots) + return; + + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + + if (customMat.getItem() != null) { + addSuits(list, customMat.name); + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + this.plateIcon = reg.registerIcon(this.getIconString()); + this.detailIcon = reg.registerIcon(this.getIconString() + "_detail"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int dam, int layer) { + return layer == 1 ? detailIcon : plateIcon; + } + + @SideOnly(Side.CLIENT) + @Override + public boolean requiresMultipleRenderPasses() { return true; } - - @Override - public float getPieceWeight(ItemStack item, int slot) - { - float baseWeight = armourWeight * ArmourCalculator.sizes[slot]; - CustomMaterial material = this.getCustomMaterial(item); - if(material != null) - { - baseWeight *= material.density; - } - return baseWeight; - } - - public int getMaxDamage(ItemStack stack) - { - CustomMaterial material = this.getCustomMaterial(stack); - if(material != null) - { - return (int)((material.durability*250) * (design.getDurability()/2F)); - } + + @Override + public float getPieceWeight(ItemStack item, int slot) { + float baseWeight = armourWeight * ArmourCalculator.sizes[slot]; + CustomMaterial material = this.getCustomMaterial(item); + if (material != null) { + baseWeight *= material.density; + } + return baseWeight; + } + + public int getMaxDamage(ItemStack stack) { + CustomMaterial material = this.getCustomMaterial(stack); + if (material != null) { + return (int) ((material.durability * 250) * (design.getDurability() / 2F)); + } return getMaxDamage(); } - - public boolean isCustom() { - return true; - } - - @Override - protected float getSpecialModifier(ItemStack armour, DamageSource source) - { - float modifier = CombatMechanics.getSpecialModifier(this.getCustomMaterial(armour), this.specialDesign, source.getEntity(), false); - - MFLogUtil.logDebug("Modifier = " + modifier); - - return super.getSpecialModifier(armour, source) * modifier; - } - @Override - protected float getProtectionRatio(ItemStack item) - { - return super.getProtectionRatio(item)*ratingModifier; - } + + public boolean isCustom() { + return true; + } + + @Override + protected float getSpecialModifier(ItemStack armour, DamageSource source) { + float modifier = CombatMechanics.getSpecialModifier(this.getCustomMaterial(armour), this.specialDesign, + source.getEntity(), false); + + MFLogUtil.logDebug("Modifier = " + modifier); + + return super.getSpecialModifier(armour, source) * modifier; + } + + @Override + protected float getProtectionRatio(ItemStack item) { + return super.getProtectionRatio(item) * ratingModifier; + } } diff --git a/src/main/java/minefantasy/mf2/item/custom/ItemCustomComponent.java b/src/main/java/minefantasy/mf2/item/custom/ItemCustomComponent.java index 3971ed99..72e1c48b 100644 --- a/src/main/java/minefantasy/mf2/item/custom/ItemCustomComponent.java +++ b/src/main/java/minefantasy/mf2/item/custom/ItemCustomComponent.java @@ -1,9 +1,5 @@ package minefantasy.mf2.item.custom; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,207 +21,187 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class ItemCustomComponent extends Item implements ITieredComponent -{ - @SideOnly(Side.CLIENT) - public IIcon baseTex; - private String name; - private float mass; - - public ItemCustomComponent(String name, String type) - { - this(name, -1F, type); - } - public ItemCustomComponent(String name, float mass, String type) - { - this.name = name; - this.setCreativeTab(CreativeTabMF.tabMaterials); - GameRegistry.registerItem(this, "custom_"+name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - this.mass=mass; - this.materialType = type; - } - private boolean canDamage = false;; - public ItemCustomComponent setCanDamage() - { - this.canDamage = true; - this.setHasSubtypes(false); - return this; - } - @Override - public boolean isDamageable() - { - return canDamage; - } - @Override - public boolean isRepairable() - { +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class ItemCustomComponent extends Item implements ITieredComponent { + private final String materialType; + @SideOnly(Side.CLIENT) + public IIcon baseTex; + private String name; + private float mass; + private boolean canDamage = false; + // STORAGE + private String blocktex; + ; + private String storageType; + + public ItemCustomComponent(String name, String type) { + this(name, -1F, type); + } + + public ItemCustomComponent(String name, float mass, String type) { + this.name = name; + this.setCreativeTab(CreativeTabMF.tabMaterials); + GameRegistry.registerItem(this, "custom_" + name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + this.mass = mass; + this.materialType = type; + } + + public ItemCustomComponent setCanDamage() { + this.canDamage = true; + this.setHasSubtypes(false); + return this; + } + + @Override + public boolean isDamageable() { + return canDamage; + } + + @Override + public boolean isRepairable() { return false; } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if (tab != CreativeTabMF.tabMaterialsMF) - { - ArrayList wood = CustomMaterial.getList("metal"); - Iterator iteratorWood = wood.iterator(); - while (iteratorWood.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); - list.add(this.createComm(customMat.name)); - } - } - } - - public float getWeightInKg(ItemStack tool) - { - CustomMaterial base = getBase(tool); - if(base != null) - { - return base.density * mass; - } - return mass; - } - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack tool, EntityPlayer user, List list, boolean fullInfo) - { - super.addInformation(tool, user, list, fullInfo); - if(!canDamage) - { - CustomToolHelper.addComponentString(tool, list, getBase(tool), mass); - } - if(this == ComponentListMF.cogwork_armour) - { - int AR = EntityCogwork.getArmourRating(getBase(tool)); - list.add(StatCollector.translateToLocal("attribute.armour.protection") + " " + AR); - if(mass > 0) - list.add(CustomMaterial.getWeightString(getWeightInKg(tool))); - } - } - - @Override - public String getItemStackDisplayName(ItemStack tool) - { - return CustomToolHelper.getLocalisedName(tool, "item.commodity_"+name+".name"); - } - - public CustomMaterial getBase(ItemStack component) - { - return CustomToolHelper.getCustomPrimaryMaterial(component); - } - - @Override + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (tab != CreativeTabMF.tabMaterialsMF) { + ArrayList wood = CustomMaterial.getList("metal"); + Iterator iteratorWood = wood.iterator(); + while (iteratorWood.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); + list.add(this.createComm(customMat.name)); + } + } + } + + public float getWeightInKg(ItemStack tool) { + CustomMaterial base = getBase(tool); + if (base != null) { + return base.density * mass; + } + return mass; + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack tool, EntityPlayer user, List list, boolean fullInfo) { + super.addInformation(tool, user, list, fullInfo); + if (!canDamage) { + CustomToolHelper.addComponentString(tool, list, getBase(tool), mass); + } + if (this == ComponentListMF.cogwork_armour) { + int AR = EntityCogwork.getArmourRating(getBase(tool)); + list.add(StatCollector.translateToLocal("attribute.armour.protection") + " " + AR); + if (mass > 0) + list.add(CustomMaterial.getWeightString(getWeightInKg(tool))); + } + } + + @Override + public String getItemStackDisplayName(ItemStack tool) { + return CustomToolHelper.getLocalisedName(tool, "item.commodity_" + name + ".name"); + } + + public CustomMaterial getBase(ItemStack component) { + return CustomToolHelper.getCustomPrimaryMaterial(component); + } + + @Override @SideOnly(Side.CLIENT) - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 1; } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - CustomMaterial base = getBase(item); - if(base != null) - { - return base.getColourInt(); - } - return super.getColorFromItemStack(item, layer); + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack item, int layer) { + CustomMaterial base = getBase(item); + if (base != null) { + return base.getColourInt(); + } + return super.getColorFromItemStack(item, layer); } + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack item, int layer) - { - return baseTex; + public IIcon getIcon(ItemStack item, int layer) { + return baseTex; } - + @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - baseTex = reg.registerIcon("minefantasy2:custom/component/"+name); - } - - public ItemStack createComm(String base) - { - return createComm(base, 1); - } - public ItemStack createComm(String base, int stack) - { - return createComm(base, stack, 0); - } - public ItemStack createComm(String base, int stack, float damage) - { - ItemStack item = new ItemStack(this, stack); - CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, base); - int maxdam = this.getMaxDamage(item); - - item.setItemDamage( (int) ((float)maxdam*damage)); - return item; - } - - @Override - public int getMaxDamage(ItemStack stack) - { - if(canDamage) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - return super.getMaxDamage(stack); - } - public ItemStack createComm(String base, int stack, int damage) - { - ItemStack item = new ItemStack(this, stack, damage); - CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, base); - return item; - } - private final String materialType; - @Override - public String getMaterialType(ItemStack item) - { - return materialType; - } - //STORAGE - private String blocktex; - private String storageType; - - public ItemCustomComponent setStoragePlacement(String type, String tex) - { - this.blocktex = tex; - this.storageType = type; - return this; - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(!world.isRemote && storageType != null) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, user, false); - - if (movingobjectposition == null) - { - return item; - } - else - { - int placed = BlockComponent.useComponent(item, storageType, blocktex, world, user, movingobjectposition); - if(placed > 0) - { - item.stackSize -= placed; - return item; - } - } - } - return item; + public void registerIcons(IIconRegister reg) { + baseTex = reg.registerIcon("minefantasy2:custom/component/" + name); + } + + public ItemStack createComm(String base) { + return createComm(base, 1); + } + + public ItemStack createComm(String base, int stack) { + return createComm(base, stack, 0); + } + + public ItemStack createComm(String base, int stack, float damage) { + ItemStack item = new ItemStack(this, stack); + CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, base); + int maxdam = this.getMaxDamage(item); + + item.setItemDamage((int) (maxdam * damage)); + return item; + } + + @Override + public int getMaxDamage(ItemStack stack) { + if (canDamage) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + return super.getMaxDamage(stack); + } + + public ItemStack createComm(String base, int stack, int damage) { + ItemStack item = new ItemStack(this, stack, damage); + CustomMaterial.addMaterial(item, CustomToolHelper.slot_main, base); + return item; + } + + @Override + public String getMaterialType(ItemStack item) { + return materialType; + } + + public ItemCustomComponent setStoragePlacement(String type, String tex) { + this.blocktex = tex; + this.storageType = type; + return this; + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (!world.isRemote && storageType != null) { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, user, false); + + if (movingobjectposition == null) { + return item; + } else { + int placed = BlockComponent.useComponent(item, storageType, blocktex, world, user, + movingobjectposition); + if (placed > 0) { + item.stackSize -= placed; + return item; + } + } + } + return item; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/item/food/FoodListMF.java b/src/main/java/minefantasy/mf2/item/food/FoodListMF.java index 705caafe..44590209 100644 --- a/src/main/java/minefantasy/mf2/item/food/FoodListMF.java +++ b/src/main/java/minefantasy/mf2/item/food/FoodListMF.java @@ -10,144 +10,167 @@ import net.minecraft.item.Item; import net.minecraft.potion.Potion; -public class FoodListMF -{ - //MORSELS - public static Item wolf_raw = (new ItemFoodMF("wolf_raw", 2, 0.2F, true)); - public static Item wolf_cooked = (new ItemFoodMF("wolf_cooked", 6, 0.6F, true)); - public static Item horse_raw = (new ItemFoodMF("horse_raw", 4, 0.4F, true)).setPotionEffect(Potion.hunger.id, 50, 0, 0.5F); - public static Item horse_cooked = (new ItemFoodMF("horse_cooked", 10, 1.0F, true)); - - public static Item generic_meat_uncooked = (new ItemFoodMF("generic_meat_uncooked", 2, 0.2F, true)); - public static Item generic_meat_cooked = (new ItemFoodMF("generic_meat_cooked", 5, 0.5F, true)); - public static Item generic_meat_strip_uncooked = (new ItemFoodMF("generic_meat_strip_uncooked", 2, 0.2F, true)); - public static Item generic_meat_strip_cooked = (new ItemFoodMF("generic_meat_strip_cooked", 5, 0.5F, true)); - public static Item generic_meat_chunk_uncooked = (new ItemFoodMF("generic_meat_chunk_uncooked", 2, 0.2F, true)); - public static Item generic_meat_chunk_cooked = (new ItemFoodMF("generic_meat_chunk_cooked", 5, 0.5F, true)); - public static Item generic_meat_mince_uncooked = (new ItemFoodMF("generic_meat_mince_uncooked", 2, 0.2F, true)).setContainerItem(ComponentListMF.clay_pot); - public static Item generic_meat_mince_cooked = (new ItemFoodMF("generic_meat_mince_cooked", 5, 0.5F, true)).setContainerItem(ComponentListMF.clay_pot); - - public static Item flour = new ItemComponentMF("flour", 0).setCreativeTab(CreativeTabMF.tabFood).setContainerItem(ComponentListMF.clay_pot); - public static Item breadcrumbs = new ItemComponentMF("breadcrumbs", 0).setCreativeTab(CreativeTabMF.tabFood).setContainerItem(ComponentListMF.clay_pot); - public static Item guts = new ItemComponentMF("guts", 0).setCreativeTab(CreativeTabMF.tabFood); - - public static Item breadroll = (new ItemFoodMF("breadroll", 5, 1.0F, false)); - public static Item breadSlice = (new ItemFoodMF("breadslice", 2, 1.0F, false)); - - public static Item curds = new ItemUnfinishedFood("curds"); - public static Item cheese_pot = new ItemUnfinishedFood("cheese_pot").setContainerItem(ComponentListMF.clay_pot); - public static Item cheese_slice = (new ItemFoodMF("cheese_slice", 4, 1.0F, false, 0).setFoodStats(1, 0.0F, 0.0F, 1.0F)); - - //T1 (basic mixing) - //Util: Roast, Prep Block (Stone-Bronze Age) - public static Item stew = (new ItemFoodMF("stew" , 5, 1.0F, false, 0)).setFoodStats(1, 0.0F, 0.0F, 1.0F).setReturnItem(Items.bowl).setMaxStackSize(1); - public static Item oats = (new ItemFoodMF("oats" , 5, 1.0F, false, 0)).setFoodStats(1, 0.0F, 0.8F, 0.2F).setReturnItem(Items.bowl).setMaxStackSize(1); - - //T2 (Basic baking, stone oven, processed mixing) - //Util: Stone Oven, Prep Block (Bronze Age - Early Iron Age) - public static Item cheese_roll = (new ItemFoodMF("cheese_roll", 6, 1.0F, false, 0)).setFoodStats(2, 0.0F, 0.4F, 0.6F).setMaxStackSize(1); - public static Item jerky = (new ItemFoodMF("jerky", 6, 1.0F, true, 0)).setFoodStats(2, 0.0F, 0.0F, 1.0F).setMaxStackSize(8); - public static Item saussage_raw = (new ItemFoodMF("saussage_raw", 4, 1.0F, true, 0)).setFoodStats(2, 0.0F, 0.1F, 0.6F).setMaxStackSize(16); - public static Item saussage_cooked = (new ItemFoodMF("saussage_cooked", 8, 1.0F, true, 0)).setFoodStats(2, 0.0F, 0.2F, 0.8F).setMaxStackSize(16); - public static Item sweetroll_uniced = (new ItemFoodMF("sweetroll_uniced", 5, 1.0F, false, 0)).setFoodStats(2, 0.5F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(64); - public static Item sweetroll = (new ItemMultiFood("sweetroll", 2,3, 1.0F, false, 0)).setFoodStats(2, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible(); - public static Item sandwitch_meat = (new ItemMultiFood("sandwitch_meat", 2,6, 1.0F, false, 0)).setFoodStats(2, 0.0F, 0.5F, 0.5F).setTextureName("minefantasy2:food/sandwitch").setUnlocalizedName("sandwitch"); - public static Item sandwitch_big = (new ItemMultiFood("sandwitch_big", 4,6, 1.0F, false, 1)).setFoodStats(2, 0.0F, 0.5F, 0.5F).setTextureName("minefantasy2:food/sandwitchbig").setUnlocalizedName("sandwitch"); - - //T3 (Quality baking, metal oven) - //Util: Metal Oven, Prep Block, Steel Tools (Mid Iron Age) - public static Item meatpie_slice = (new ItemFoodMF("meatpie_slice", 8, 1.0F, false, 0)).setFoodStats(3, 0.0F, 0.2F, 0.8F).setMaxStackSize(1); - public static Item pieslice_apple = (new ItemFoodMF("pieslice_apple", 5, 1.0F, false, 0)).setFoodStats(3, 0.8F, 0.2F, 0.0F).setEatTime(16).setAlwaysEdible().setAlwaysEdible().setTextureName("minefantasy2:food/applepie_slice").setMaxStackSize(1); - public static Item pieslice_berry = (new ItemFoodMF("pieslice_berry", 5 , 1.0F, false, 0)).setFoodStats(3, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setAlwaysEdible().setTextureName("minefantasy2:food/berrypie_slice").setMaxStackSize(1); - - //T4 (Advanced baking, multiple processes, temperature regulation) - //Util : Metal Oven, Prep Block, Full tool set, Proper kitchen setup (Mid Iron Age) - public static Item pieslice_shepards = (new ItemFoodMF("pieslice_shepards", 10, 1.0F, false, 1)).setFoodStats(4, 0.0F, 0.5F, 0.5F).setTextureName("minefantasy2:food/shepardspie_slice").setMaxStackSize(1); - - public static Item cake_slice = (new ItemFoodMF("cake_slice", 3, 0.8F, false, 0)).setFoodStats(3, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(1); - public static Item carrotcake_slice = (new ItemFoodMF("carrotcake_slice",4, 0.8F, false, 0)).setFoodStats(4, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(1); - public static Item choccake_slice = (new ItemFoodMF("choccake_slice", 4, 0.8F, false, 0)).setFoodStats(4, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(1); - - //T5 (Advanced baking, multiple process, temperature regulation, many ingreedients) - - //T6 (Perfeted meals, extremely difficylt to create) - public static Item bfcake_slice = (new ItemFoodMF("bfcake_slice", 6, 1.0F, false, 1)).setFoodStats(5, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(1); - public static Item eclair_uniced = (new ItemFoodMF("eclair_uniced", 5, 1.0F, false, 0)).setFoodStats(5, 0.3F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(64).setTextureName("minefantasy2:food/unfinished/eclair_uniced"); - public static Item eclair_empty = (new ItemFoodMF("eclair_empty", 5, 1.0F, false, 0)).setFoodStats(5, 0.5F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(64).setTextureName("minefantasy2:food/unfinished/eclair_empty"); - public static Item eclair = (new ItemMultiFood("eclair", 4,4, 1.0F, false, 1)).setFoodStats(5, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(1); - - //MISC - public static Item cake_tin = new ItemComponentMF("cake_tin", 0).setCreativeTab(CreativeTabMF.tabFood); - public static Item pie_tray = new ItemComponentMF("pie_tin", 0).setStoragePlacement("bigplate", "tray").setCreativeTab(CreativeTabMF.tabFood); - public static Item icing = new ItemComponentMF("icing", 0).setCreativeTab(CreativeTabMF.tabFood).setContainerItem(ComponentListMF.clay_pot); - public static Item custard = new ItemComponentMF("custard", 0).setCreativeTab(CreativeTabMF.tabFood).setContainerItem(ComponentListMF.clay_pot); - public static Item coca_powder = new ItemComponentMF("coca_powder", 0).setCreativeTab(CreativeTabMF.tabFood).setContainerItem(ComponentListMF.clay_pot); - public static Item chocolate = new ItemComponentMF("chocolate", 0).setCreativeTab(CreativeTabMF.tabFood).setContainerItem(ComponentListMF.clay_pot); - public static Item chocchips = new ItemComponentMF("chocchips", 0).setCreativeTab(CreativeTabMF.tabFood).setContainerItem(ComponentListMF.clay_pot); - public static Item berries = (new ItemFoodMF("berries", 2, 2.0F, false)).setEatTime(10).setStaminaRestore(10F).setAlwaysEdible(); - public static Item berriesJuicy = (new ItemFoodMF("berriesJuicy", 3, 5.0F, false)).setEatTime(10).setStaminaRestore(25F).setRarity(1).setAlwaysEdible(); - - public static Item sweetroll_raw = new ItemUnfinishedFood("sweetroll_raw").setMaxStackSize(64); - public static Item eclair_raw = new ItemUnfinishedFood("eclair_raw").setMaxStackSize(64); - public static Item cake_raw = new ItemUnfinishedFood("cake_raw"); - public static Item cake_simple_raw = new ItemUnfinishedFood("cake_simple_raw"); - public static Item cake_carrot_raw = new ItemUnfinishedFood("cake_carrot_raw"); - public static Item cake_choc_raw = new ItemUnfinishedFood("cake_choc_raw"); - public static Item cake_bf_raw = new ItemUnfinishedFood("cake_bf_raw"); - - public static Item cake_uniced = new ItemUnfinishedFood("cake_uniced").setContainerItem(cake_tin); - public static Item cake_simple_uniced = new ItemUnfinishedFood("cake_simple_uniced").setContainerItem(cake_tin); - public static Item cake_carrot_uniced = new ItemUnfinishedFood("cake_carrot_uniced").setContainerItem(cake_tin); - public static Item cake_choc_uniced = new ItemUnfinishedFood("cake_choc_uniced").setContainerItem(cake_tin); - public static Item cake_bf_uniced = new ItemUnfinishedFood("cake_bf_uniced").setContainerItem(cake_tin); - - public static Item pie_meat_uncooked = new ItemUnfinishedFood("pie_meat_uncooked").setTextureName("minefantasy2:food/unfinished/pie_meat_uncooked"); - - public static Item pie_apple_uncooked = new ItemUnfinishedFood("pie_apple_uncooked"); - public static Item pie_berry_uncooked = new ItemUnfinishedFood("pie_berry_uncooked"); - public static Item pie_shepard_uncooked = new ItemUnfinishedFood("pie_shepard_uncooked"); - public static Item pie_pumpkin_uncooked = new ItemUnfinishedFood("pie_pumpkin_uncooked"); - - public static Item pie_meat_cooked = new ItemUnfinishedFood("pie_meat_cooked").setTextureName("minefantasy2:food/unfinished/pie_meat_cooked").setContainerItem(pie_tray); - - public static Item pie_apple_cooked = new ItemUnfinishedFood("pie_apple_cooked").setContainerItem(pie_tray); - public static Item pie_berry_cooked = new ItemUnfinishedFood("pie_berry_cooked").setContainerItem(pie_tray); - public static Item pie_shepard_cooked = new ItemUnfinishedFood("pie_shepard_cooked").setContainerItem(pie_tray); - public static Item pie_pumpkin_cooked = new ItemUnfinishedFood("pie_pumpkin_cooked").setContainerItem(pie_tray); - public static Item salt = new ItemComponentMF("salt", 0).setCreativeTab(CreativeTabMF.tabFood).setContainerItem(ComponentListMF.clay_pot); - public static Item sugarpot = new ItemComponentMF("sugarpot", 0).setCreativeTab(CreativeTabMF.tabFood).setContainerItem(ComponentListMF.clay_pot); - public static Item bowl_water_salt = new ItemComponentMF("bowl_water_salt", 0).setCreativeTab(CreativeTabMF.tabFood); - - public static Item dough = new ItemUnfinishedFood("dough").setMaxStackSize(64); - public static Item pastry = new ItemUnfinishedFood("pastry").setMaxStackSize(64); - public static Item raw_bread = new ItemUnfinishedFood("raw_bread").setMaxStackSize(64); - - public static Item jug_uncooked = new ItemJug("uncooked"); - public static Item jug_empty = new ItemJug("empty").setStoragePlacement("jug", "jug"); - public static Item jug_water = new ItemJug("water").setStoragePlacement("jug", "jugwater").setContainerItem(jug_empty); - public static Item jug_milk = new ItemJug("milk").setStoragePlacement("jug", "jugmilk").setContainerItem(jug_empty); - - public static Item burnt_food = new ItemBurntFood("burnt_food"); - public static Item burnt_pot = new ItemBurntFood("burnt_pot").setContainerItem(ComponentListMF.clay_pot); - public static Item burnt_pie = new ItemBurntFood("burnt_pie").setContainerItem(pie_tray); - public static Item burnt_cake = new ItemBurntFood("burnt_cake").setContainerItem(cake_tin); - //SPECIAL RECIPES - - public static final float satModifier = 1.0F; - public static void load() - { - CookRecipe.burnt_food = burnt_food; - } - - /** - * FOOD TYPES: - * Sugar: Stamina Regen - * Dairy: Saturation - * Grain: Stamina Max - * - * Protien: Saturation / Stamina Max - * Fruit: Stamina Max / Stamina Time - * Vegetable: Stamina Time / Saturation - */ +public class FoodListMF { + public static final float satModifier = 1.0F; + // MORSELS + public static Item wolf_raw = (new ItemFoodMF("wolf_raw", 2, 0.2F, true)); + public static Item wolf_cooked = (new ItemFoodMF("wolf_cooked", 6, 0.6F, true)); + public static Item horse_raw = (new ItemFoodMF("horse_raw", 4, 0.4F, true)).setPotionEffect(Potion.hunger.id, 50, 0, + 0.5F); + public static Item horse_cooked = (new ItemFoodMF("horse_cooked", 10, 1.0F, true)); + public static Item generic_meat_uncooked = (new ItemFoodMF("generic_meat_uncooked", 2, 0.2F, true)); + public static Item generic_meat_cooked = (new ItemFoodMF("generic_meat_cooked", 5, 0.5F, true)); + public static Item generic_meat_strip_uncooked = (new ItemFoodMF("generic_meat_strip_uncooked", 2, 0.2F, true)); + public static Item generic_meat_strip_cooked = (new ItemFoodMF("generic_meat_strip_cooked", 5, 0.5F, true)); + public static Item generic_meat_chunk_uncooked = (new ItemFoodMF("generic_meat_chunk_uncooked", 2, 0.2F, true)); + public static Item generic_meat_chunk_cooked = (new ItemFoodMF("generic_meat_chunk_cooked", 5, 0.5F, true)); + public static Item generic_meat_mince_uncooked = (new ItemFoodMF("generic_meat_mince_uncooked", 2, 0.2F, true)) + .setContainerItem(ComponentListMF.clay_pot); + public static Item generic_meat_mince_cooked = (new ItemFoodMF("generic_meat_mince_cooked", 5, 0.5F, true)) + .setContainerItem(ComponentListMF.clay_pot); + public static Item flour = new ItemComponentMF("flour", 0).setCreativeTab(CreativeTabMF.tabFood) + .setContainerItem(ComponentListMF.clay_pot); + public static Item breadcrumbs = new ItemComponentMF("breadcrumbs", 0).setCreativeTab(CreativeTabMF.tabFood) + .setContainerItem(ComponentListMF.clay_pot); + public static Item guts = new ItemComponentMF("guts", 0).setCreativeTab(CreativeTabMF.tabFood); + public static Item breadroll = (new ItemFoodMF("breadroll", 5, 1.0F, false)); + public static Item breadSlice = (new ItemFoodMF("breadslice", 2, 1.0F, false)); + public static Item curds = new ItemUnfinishedFood("curds"); + public static Item cheese_pot = new ItemUnfinishedFood("cheese_pot").setContainerItem(ComponentListMF.clay_pot); + public static Item cheese_slice = (new ItemFoodMF("cheese_slice", 4, 1.0F, false, 0).setFoodStats(1, 0.0F, 0.0F, + 1.0F)); + // T1 (basic mixing) + // Util: Roast, Prep Block (Stone-Bronze Age) + public static Item stew = (new ItemFoodMF("stew", 5, 1.0F, false, 0)).setFoodStats(1, 0.0F, 0.0F, 1.0F) + .setReturnItem(Items.bowl).setMaxStackSize(1); + public static Item oats = (new ItemFoodMF("oats", 5, 1.0F, false, 0)).setFoodStats(1, 0.0F, 0.8F, 0.2F) + .setReturnItem(Items.bowl).setMaxStackSize(1); + // T2 (Basic baking, stone oven, processed mixing) + // Util: Stone Oven, Prep Block (Bronze Age - Early Iron Age) + public static Item cheese_roll = (new ItemFoodMF("cheese_roll", 6, 1.0F, false, 0)) + .setFoodStats(2, 0.0F, 0.4F, 0.6F).setMaxStackSize(1); + public static Item jerky = (new ItemFoodMF("jerky", 6, 1.0F, true, 0)).setFoodStats(2, 0.0F, 0.0F, 1.0F) + .setMaxStackSize(8); + public static Item saussage_raw = (new ItemFoodMF("saussage_raw", 4, 1.0F, true, 0)) + .setFoodStats(2, 0.0F, 0.1F, 0.6F).setMaxStackSize(16); + public static Item saussage_cooked = (new ItemFoodMF("saussage_cooked", 8, 1.0F, true, 0)) + .setFoodStats(2, 0.0F, 0.2F, 0.8F).setMaxStackSize(16); + public static Item sweetroll_uniced = (new ItemFoodMF("sweetroll_uniced", 5, 1.0F, false, 0)) + .setFoodStats(2, 0.5F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(64); + public static Item sweetroll = (new ItemMultiFood("sweetroll", 2, 3, 1.0F, false, 0)) + .setFoodStats(2, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible(); + public static Item sandwitch_meat = (new ItemMultiFood("sandwitch_meat", 2, 6, 1.0F, false, 0)) + .setFoodStats(2, 0.0F, 0.5F, 0.5F).setTextureName("minefantasy2:food/sandwitch") + .setUnlocalizedName("sandwitch"); + public static Item sandwitch_big = (new ItemMultiFood("sandwitch_big", 4, 6, 1.0F, false, 1)) + .setFoodStats(2, 0.0F, 0.5F, 0.5F).setTextureName("minefantasy2:food/sandwitchbig") + .setUnlocalizedName("sandwitch"); + // T3 (Quality baking, metal oven) + // Util: Metal Oven, Prep Block, Steel Tools (Mid Iron Age) + public static Item meatpie_slice = (new ItemFoodMF("meatpie_slice", 8, 1.0F, false, 0)) + .setFoodStats(3, 0.0F, 0.2F, 0.8F).setMaxStackSize(1); + public static Item pieslice_apple = (new ItemFoodMF("pieslice_apple", 5, 1.0F, false, 0)) + .setFoodStats(3, 0.8F, 0.2F, 0.0F).setEatTime(16).setAlwaysEdible().setAlwaysEdible() + .setTextureName("minefantasy2:food/applepie_slice").setMaxStackSize(1); + public static Item pieslice_berry = (new ItemFoodMF("pieslice_berry", 5, 1.0F, false, 0)) + .setFoodStats(3, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setAlwaysEdible() + .setTextureName("minefantasy2:food/berrypie_slice").setMaxStackSize(1); + // T4 (Advanced baking, multiple processes, temperature regulation) + // Util : Metal Oven, Prep Block, Full tool set, Proper kitchen setup (Mid Iron + // Age) + public static Item pieslice_shepards = (new ItemFoodMF("pieslice_shepards", 10, 1.0F, false, 1)) + .setFoodStats(4, 0.0F, 0.5F, 0.5F).setTextureName("minefantasy2:food/shepardspie_slice").setMaxStackSize(1); + public static Item cake_slice = (new ItemFoodMF("cake_slice", 3, 0.8F, false, 0)).setFoodStats(3, 1.0F, 0.0F, 0.0F) + .setEatTime(16).setAlwaysEdible().setMaxStackSize(1); + public static Item carrotcake_slice = (new ItemFoodMF("carrotcake_slice", 4, 0.8F, false, 0)) + .setFoodStats(4, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(1); + + // T5 (Advanced baking, multiple process, temperature regulation, many + // ingreedients) + public static Item choccake_slice = (new ItemFoodMF("choccake_slice", 4, 0.8F, false, 0)) + .setFoodStats(4, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(1); + // T6 (Perfeted meals, extremely difficylt to create) + public static Item bfcake_slice = (new ItemFoodMF("bfcake_slice", 6, 1.0F, false, 1)) + .setFoodStats(5, 1.0F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(1); + public static Item eclair_uniced = (new ItemFoodMF("eclair_uniced", 5, 1.0F, false, 0)) + .setFoodStats(5, 0.3F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(64) + .setTextureName("minefantasy2:food/unfinished/eclair_uniced"); + public static Item eclair_empty = (new ItemFoodMF("eclair_empty", 5, 1.0F, false, 0)) + .setFoodStats(5, 0.5F, 0.0F, 0.0F).setEatTime(16).setAlwaysEdible().setMaxStackSize(64) + .setTextureName("minefantasy2:food/unfinished/eclair_empty"); + public static Item eclair = (new ItemMultiFood("eclair", 4, 4, 1.0F, false, 1)).setFoodStats(5, 1.0F, 0.0F, 0.0F) + .setEatTime(16).setAlwaysEdible().setMaxStackSize(1); + // MISC + public static Item cake_tin = new ItemComponentMF("cake_tin", 0).setCreativeTab(CreativeTabMF.tabFood); + public static Item pie_tray = new ItemComponentMF("pie_tin", 0).setStoragePlacement("bigplate", "tray") + .setCreativeTab(CreativeTabMF.tabFood); + public static Item icing = new ItemComponentMF("icing", 0).setCreativeTab(CreativeTabMF.tabFood) + .setContainerItem(ComponentListMF.clay_pot); + public static Item custard = new ItemComponentMF("custard", 0).setCreativeTab(CreativeTabMF.tabFood) + .setContainerItem(ComponentListMF.clay_pot); + public static Item coca_powder = new ItemComponentMF("coca_powder", 0).setCreativeTab(CreativeTabMF.tabFood) + .setContainerItem(ComponentListMF.clay_pot); + public static Item chocolate = new ItemComponentMF("chocolate", 0).setCreativeTab(CreativeTabMF.tabFood) + .setContainerItem(ComponentListMF.clay_pot); + public static Item chocchips = new ItemComponentMF("chocchips", 0).setCreativeTab(CreativeTabMF.tabFood) + .setContainerItem(ComponentListMF.clay_pot); + public static Item berries = (new ItemFoodMF("berries", 2, 2.0F, false)).setEatTime(10).setStaminaRestore(10F) + .setAlwaysEdible(); + public static Item berriesJuicy = (new ItemFoodMF("berriesJuicy", 3, 5.0F, false)).setEatTime(10) + .setStaminaRestore(25F).setRarity(1).setAlwaysEdible(); + public static Item sweetroll_raw = new ItemUnfinishedFood("sweetroll_raw").setMaxStackSize(64); + public static Item eclair_raw = new ItemUnfinishedFood("eclair_raw").setMaxStackSize(64); + public static Item cake_raw = new ItemUnfinishedFood("cake_raw"); + public static Item cake_simple_raw = new ItemUnfinishedFood("cake_simple_raw"); + public static Item cake_carrot_raw = new ItemUnfinishedFood("cake_carrot_raw"); + public static Item cake_choc_raw = new ItemUnfinishedFood("cake_choc_raw"); + public static Item cake_bf_raw = new ItemUnfinishedFood("cake_bf_raw"); + public static Item cake_uniced = new ItemUnfinishedFood("cake_uniced").setContainerItem(cake_tin); + public static Item cake_simple_uniced = new ItemUnfinishedFood("cake_simple_uniced").setContainerItem(cake_tin); + public static Item cake_carrot_uniced = new ItemUnfinishedFood("cake_carrot_uniced").setContainerItem(cake_tin); + public static Item cake_choc_uniced = new ItemUnfinishedFood("cake_choc_uniced").setContainerItem(cake_tin); + public static Item cake_bf_uniced = new ItemUnfinishedFood("cake_bf_uniced").setContainerItem(cake_tin); + public static Item pie_meat_uncooked = new ItemUnfinishedFood("pie_meat_uncooked") + .setTextureName("minefantasy2:food/unfinished/pie_meat_uncooked"); + public static Item pie_apple_uncooked = new ItemUnfinishedFood("pie_apple_uncooked"); + public static Item pie_berry_uncooked = new ItemUnfinishedFood("pie_berry_uncooked"); + public static Item pie_shepard_uncooked = new ItemUnfinishedFood("pie_shepard_uncooked"); + public static Item pie_pumpkin_uncooked = new ItemUnfinishedFood("pie_pumpkin_uncooked"); + public static Item pie_meat_cooked = new ItemUnfinishedFood("pie_meat_cooked") + .setTextureName("minefantasy2:food/unfinished/pie_meat_cooked").setContainerItem(pie_tray); + public static Item pie_apple_cooked = new ItemUnfinishedFood("pie_apple_cooked").setContainerItem(pie_tray); + public static Item pie_berry_cooked = new ItemUnfinishedFood("pie_berry_cooked").setContainerItem(pie_tray); + public static Item pie_shepard_cooked = new ItemUnfinishedFood("pie_shepard_cooked").setContainerItem(pie_tray); + public static Item pie_pumpkin_cooked = new ItemUnfinishedFood("pie_pumpkin_cooked").setContainerItem(pie_tray); + public static Item salt = new ItemComponentMF("salt", 0).setCreativeTab(CreativeTabMF.tabFood) + .setContainerItem(ComponentListMF.clay_pot); + public static Item sugarpot = new ItemComponentMF("sugarpot", 0).setCreativeTab(CreativeTabMF.tabFood) + .setContainerItem(ComponentListMF.clay_pot); + public static Item bowl_water_salt = new ItemComponentMF("bowl_water_salt", 0) + .setCreativeTab(CreativeTabMF.tabFood); + public static Item dough = new ItemUnfinishedFood("dough").setMaxStackSize(64); + public static Item pastry = new ItemUnfinishedFood("pastry").setMaxStackSize(64); + public static Item raw_bread = new ItemUnfinishedFood("raw_bread").setMaxStackSize(64); + public static Item jug_uncooked = new ItemJug("uncooked"); + public static Item jug_empty = new ItemJug("empty").setStoragePlacement("jug", "jug"); + public static Item jug_water = new ItemJug("water").setStoragePlacement("jug", "jugwater") + .setContainerItem(jug_empty); + public static Item jug_milk = new ItemJug("milk").setStoragePlacement("jug", "jugmilk").setContainerItem(jug_empty); + public static Item burnt_food = new ItemBurntFood("burnt_food"); + public static Item burnt_pot = new ItemBurntFood("burnt_pot").setContainerItem(ComponentListMF.clay_pot); + public static Item burnt_pie = new ItemBurntFood("burnt_pie").setContainerItem(pie_tray); + // SPECIAL RECIPES + public static Item burnt_cake = new ItemBurntFood("burnt_cake").setContainerItem(cake_tin); + + public static void load() { + CookRecipe.burnt_food = burnt_food; + } + + /** + * FOOD TYPES: Sugar: Stamina Regen Dairy: Saturation Grain: Stamina Max + * + * Protien: Saturation / Stamina Max Fruit: Stamina Max / Stamina Time + * Vegetable: Stamina Time / Saturation + */ } diff --git a/src/main/java/minefantasy/mf2/item/food/ItemFoodMF.java b/src/main/java/minefantasy/mf2/item/food/ItemFoodMF.java index 49023e3e..942918db 100644 --- a/src/main/java/minefantasy/mf2/item/food/ItemFoodMF.java +++ b/src/main/java/minefantasy/mf2/item/food/ItemFoodMF.java @@ -1,16 +1,14 @@ package minefantasy.mf2.item.food; -import java.text.DecimalFormat; -import java.util.List; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.hunger.HungerSystemMF; import minefantasy.mf2.item.ClientItemsMF; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.mechanics.TierHelper; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -24,357 +22,307 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemFoodMF extends ItemFood -{ - private static final String eatDelayNBT = "MF_EatenFoodDelay"; - private float staminaRestore = 0F; - private Item leftOver; - private float mfSaturation = 0F; - protected int hungerLevel; - protected float saturationLevel; - - public ItemFoodMF(String name, int hunger, float saturation, boolean isMeat) - { - super(hunger, 0F, isMeat); - - hungerLevel = hunger; - saturationLevel = saturation; - setCreativeTab(CreativeTabMF.tabFood); - GameRegistry.registerItem(this, "MF2_food_"+name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - this.setTextureName("minefantasy2:food/"+name); - } - - public ItemFoodMF(String name, int hunger, float saturation, boolean isMeat, int rarity) - { - this(name, hunger, saturation, isMeat); - itemRarity = rarity; - } - protected void onMFFoodEaten(ItemStack food, World world, EntityPlayer consumer) - { - if(StaminaBar.isSystemActive) - { - if(staminaRestore > 0) - { - StaminaBar.modifyStaminaValue(consumer, staminaRestore); - } - if(staminaSeconds > 0) - { - StaminaBar.buffStamina(consumer, staminaBuff, staminaSeconds); - } - if(staminaRegenSeconds > 0) - { - StaminaBar.buffStaminaRegen(consumer, staminaRegenBuff, staminaRegenSeconds); - } - } - if(mfSaturation > 0) - { - int foodLeftOver = consumer.getFoodStats().getFoodLevel(); - - float saturation = mfSaturation - (20-foodLeftOver); - - if(saturation > 0) - { - HungerSystemMF.applySaturation(consumer, saturation); - - } - } - - if(this == FoodListMF.berriesJuicy) - { - PotionEffect poison = consumer.getActivePotionEffect(Potion.poison); - if(poison != null) - { - poison.addCurativeItem(food); - consumer.curePotionEffects(food); - } - } +import java.text.DecimalFormat; +import java.util.List; + +public class ItemFoodMF extends ItemFood { + public static final DecimalFormat decimal_format = new DecimalFormat("#.#"); + private static final String eatDelayNBT = "MF_EatenFoodDelay"; + private static final String leftOverNbt = "MF_Food_leftover"; + public int itemRarity; + protected int hungerLevel; + protected float saturationLevel; + private float staminaRestore = 0F; + private Item leftOver; + private float mfSaturation = 0F; + private boolean hasEffect = false; + private float staminaBuff = 0F; + private int staminaSeconds = 0; + private boolean staminaInMinutes = false; + private boolean staminaInHours = false; + private float staminaRegenBuff = 0F; + private int staminaRegenSeconds = 0; + private boolean staminaRegenInMinutes = false; + private int useTime = 32; + + public ItemFoodMF(String name, int hunger, float saturation, boolean isMeat) { + super(hunger, 0F, isMeat); + + hungerLevel = hunger; + saturationLevel = saturation; + setCreativeTab(CreativeTabMF.tabFood); + GameRegistry.registerItem(this, "MF2_food_" + name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + this.setTextureName("minefantasy2:food/" + name); + } + + public ItemFoodMF(String name, int hunger, float saturation, boolean isMeat, int rarity) { + this(name, hunger, saturation, isMeat); + itemRarity = rarity; + } + + public static void setLeftOver(ItemStack food, ItemStack leftover) { + if (!food.hasTagCompound()) { + food.setTagCompound(new NBTTagCompound()); + } + NBTTagCompound savedItem = new NBTTagCompound(); + leftover.writeToNBT(savedItem); + food.getTagCompound().setTag(leftOverNbt, savedItem); + } + + public static void onTick(EntityPlayer player) { + int time = getEatDelay(player); + if (time > 0) { + time--; + setEatDelay(player, time); + } + } + + private static void setEatDelay(EntityPlayer player, int time) { + time += getEatDelay(player);// add to existing + + player.getEntityData().setInteger(eatDelayNBT, time); + } + + private static int getEatDelay(EntityPlayer player) { + if (player.getEntityData().hasKey(eatDelayNBT)) { + return player.getEntityData().getInteger(eatDelayNBT); + } + return 0; + } + + protected void onMFFoodEaten(ItemStack food, World world, EntityPlayer consumer) { + if (StaminaBar.isSystemActive) { + if (staminaRestore > 0) { + StaminaBar.modifyStaminaValue(consumer, staminaRestore); + } + if (staminaSeconds > 0) { + StaminaBar.buffStamina(consumer, staminaBuff, staminaSeconds); + } + if (staminaRegenSeconds > 0) { + StaminaBar.buffStaminaRegen(consumer, staminaRegenBuff, staminaRegenSeconds); + } + } + if (mfSaturation > 0) { + int foodLeftOver = consumer.getFoodStats().getFoodLevel(); + + float saturation = mfSaturation - (20 - foodLeftOver); + + if (saturation > 0) { + HungerSystemMF.applySaturation(consumer, saturation); + + } + } + + if (this == FoodListMF.berriesJuicy) { + PotionEffect poison = consumer.getActivePotionEffect(Potion.poison); + if (poison != null) { + poison.addCurativeItem(food); + consumer.curePotionEffects(food); + } + } + } + + public ItemFoodMF setRarity(int i) { + itemRarity = i; + return this; + } + + public ItemFoodMF setStaminaRestore(float f) { + staminaRestore = f; + hasEffect = true; + return this; + } + + /** + * Grade Sugar, Carbs and Fats from 0-1 and tier does the rest 0 means + * non-existent + * + * @param sugar restore stamina and add regen + * @param carbs increase max stamina for 1 hr + * @param fats saturation + */ + public ItemFoodMF setFoodStats(int tier, float sugar, float carbs, float fats) { + return setFoodStats(sugar * tier, carbs * tier, fats * tier); + } + + /** + * New system for setting food vales: Values should be based on tier value (t1, + * t2, t3,...,tx) 0 means non-existent + * + * @param sugar restore stamina and add regen + * @param carbs increase max stamina for 1 hr + * @param fats saturation + */ + public ItemFoodMF setFoodStats(float sugar, float carbs, float fats) { + if (sugar > 0) { + setStaminaRestore((int) (sugar * 50)); + setStaminaRegenModifier((int) sugar, sugar / 30); + } + if (carbs > 0) { + setStaminaModifier(50 * carbs, 1F); + } + if (fats > 0) { + setSaturation(10 * fats); + } + return this; } - public ItemFoodMF setRarity(int i) - { - itemRarity = i; - return this; - } - public ItemFoodMF setStaminaRestore(float f) - { - staminaRestore = f; - hasEffect = true; - return this; - } - - /** - * Grade Sugar, Carbs and Fats from 0-1 and tier does the rest - * 0 means non-existent - * @param sugar restore stamina and add regen - * @param carbs increase max stamina for 1 hr - * @param fats saturation - */ - public ItemFoodMF setFoodStats(int tier, float sugar, float carbs, float fats) - { - return setFoodStats(sugar*tier, carbs*tier, fats*tier); - } - /** - * New system for setting food vales: Values should be based on tier value (t1, t2, t3,...,tx) - * 0 means non-existent - * @param sugar restore stamina and add regen - * @param carbs increase max stamina for 1 hr - * @param fats saturation - */ - public ItemFoodMF setFoodStats(float sugar, float carbs, float fats) - { - if(sugar > 0) - { - setStaminaRestore((int)(sugar*50)); - setStaminaRegenModifier((int)sugar, sugar/30); - } - if(carbs > 0) - { - setStaminaModifier(50*carbs, 1F); - } - if(fats > 0) - { - setSaturation(10*fats); - } - return this; - } - public ItemFoodMF setSaturation(float amount) - { - hasEffect = true; - this.mfSaturation = amount * FoodListMF.satModifier; - return this; - } - - public ItemFoodMF setStaminaModifier(float buff, float hours) - { - int secondsLasting = (int) (hours*3600F); - staminaBuff = buff; - staminaSeconds = secondsLasting; - staminaInMinutes = secondsLasting > 60; - staminaInHours = secondsLasting > 3600; - hasEffect = true; - return this; - } - public ItemFoodMF setStaminaRegenModifier(float buff, float minutesLasting) - { - int secondsLasting = (int) (minutesLasting*60F); - staminaRegenBuff = buff; - staminaRegenSeconds = secondsLasting; - staminaRegenInMinutes = secondsLasting > 60; - hasEffect = true; - return this; - } - public static final DecimalFormat decimal_format = new DecimalFormat("#.#"); - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack food, EntityPlayer user, List list, boolean extra) - { + + public ItemFoodMF setSaturation(float amount) { + hasEffect = true; + this.mfSaturation = amount * FoodListMF.satModifier; + return this; + } + + public ItemFoodMF setStaminaModifier(float buff, float hours) { + int secondsLasting = (int) (hours * 3600F); + staminaBuff = buff; + staminaSeconds = secondsLasting; + staminaInMinutes = secondsLasting > 60; + staminaInHours = secondsLasting > 3600; + hasEffect = true; + return this; + } + + public ItemFoodMF setStaminaRegenModifier(float buff, float minutesLasting) { + int secondsLasting = (int) (minutesLasting * 60F); + staminaRegenBuff = buff; + staminaRegenSeconds = secondsLasting; + staminaRegenInMinutes = secondsLasting > 60; + hasEffect = true; + return this; + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack food, EntityPlayer user, List list, boolean extra) { super.addInformation(food, user, list, extra); list.add(StatCollector.translateToLocalFormatted("food.stat.hunger.name", hungerLevel)); - - if(hasEffect && ClientItemsMF.showSpecials(food, user, list, extra)) - { - list.add(""); - list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("food.stat.list.name")); - if(mfSaturation > 0) - { - list.add(StatCollector.translateToLocalFormatted("food.stat.saturation.name", decimal_format.format(mfSaturation))); - } - if(staminaRestore > 0) - { - list.add(StatCollector.translateToLocalFormatted("food.stat.staminaPlus.name", (int)staminaRestore)); - } - if(staminaBuff > 0) - { - if(staminaInHours) - { - list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffHours.name", decimal_format.format(staminaBuff), decimal_format.format(staminaSeconds/3600F))); - } - else if(staminaInMinutes) - { - list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffMinutes.name", decimal_format.format(staminaBuff), decimal_format.format(staminaSeconds/60F))); - } - else - { - list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffSeconds.name", decimal_format.format(staminaBuff), decimal_format.format(staminaSeconds))); - } - } - if(staminaRegenBuff > 0) - { - if(staminaRegenInMinutes) - { - list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffRegenMinutes.name", decimal_format.format(staminaRegenBuff), decimal_format.format(staminaRegenSeconds/60F))); - } - else - { - list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffRegenSeconds.name", decimal_format.format(staminaRegenBuff), decimal_format.format(staminaRegenSeconds))); - } - } + + if (hasEffect && ClientItemsMF.showSpecials(food, user, list, extra)) { + list.add(""); + list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("food.stat.list.name")); + if (mfSaturation > 0) { + list.add(StatCollector.translateToLocalFormatted("food.stat.saturation.name", + decimal_format.format(mfSaturation))); + } + if (staminaRestore > 0) { + list.add(StatCollector.translateToLocalFormatted("food.stat.staminaPlus.name", (int) staminaRestore)); + } + if (staminaBuff > 0) { + if (staminaInHours) { + list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffHours.name", + decimal_format.format(staminaBuff), decimal_format.format(staminaSeconds / 3600F))); + } else if (staminaInMinutes) { + list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffMinutes.name", + decimal_format.format(staminaBuff), decimal_format.format(staminaSeconds / 60F))); + } else { + list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffSeconds.name", + decimal_format.format(staminaBuff), decimal_format.format(staminaSeconds))); + } + } + if (staminaRegenBuff > 0) { + if (staminaRegenInMinutes) { + list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffRegenMinutes.name", + decimal_format.format(staminaRegenBuff), decimal_format.format(staminaRegenSeconds / 60F))); + } else { + list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffRegenSeconds.name", + decimal_format.format(staminaRegenBuff), decimal_format.format(staminaRegenSeconds))); + } + } } - if(this == FoodListMF.berriesJuicy) - { - list.add(StatCollector.translateToLocal("food.stat.cure.poison")); + if (this == FoodListMF.berriesJuicy) { + list.add(StatCollector.translateToLocal("food.stat.cure.poison")); + } + } + + @Override + public EnumRarity getRarity(ItemStack item) { + int lvl = itemRarity + 1; + + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (lvl >= ToolListMF.rarity.length) { + lvl = ToolListMF.rarity.length - 1; } + return ToolListMF.rarity[lvl]; + } + + public ItemFoodMF setReturnItem(Item item) { + leftOver = item; + return this; } - - public int itemRarity; + @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = itemRarity+1; - - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= ToolListMF.rarity.length) - { - lvl = ToolListMF.rarity.length-1; - } - return ToolListMF.rarity[lvl]; - } - - private boolean hasEffect = false; - private float staminaBuff = 0F; - private int staminaSeconds = 0; - private boolean staminaInMinutes = false; - private boolean staminaInHours = false; - - private float staminaRegenBuff = 0F; - private int staminaRegenSeconds = 0; - private boolean staminaRegenInMinutes = false; - - private static final String leftOverNbt = "MF_Food_leftover"; - - public ItemFoodMF setReturnItem(Item item) - { - leftOver = item; - return this; - } - @Override - public ItemStack onEaten(ItemStack food, World world, EntityPlayer consumer) - { + public ItemStack onEaten(ItemStack food, World world, EntityPlayer consumer) { setEatDelay(consumer, 10); consumer.getFoodStats().func_151686_a(this, food); world.playSoundAtEntity(consumer, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); this.onMFFoodEaten(food, world, consumer); - - if(this.isDamageable())//Multifood + + if (this.isDamageable())// Multifood { - if(food.attemptDamageItem(1, consumer.getRNG())) - { - --food.stackSize; - if(food.stackSize < 0) - { - food.stackSize = 0; - } - } - } - else//Food + if (food.attemptDamageItem(1, consumer.getRNG())) { + --food.stackSize; + if (food.stackSize < 0) { + food.stackSize = 0; + } + } + } else// Food { - ItemStack left = getLeftOver(food); - if(left != null) - { - if(food.stackSize == 1) - { - return left; - } - if(!consumer.inventory.addItemStackToInventory(left) && !consumer.worldObj.isRemote) - { - consumer.entityDropItem(left, 1.0F); - } - } - -- food.stackSize; + ItemStack left = getLeftOver(food); + if (left != null) { + if (food.stackSize == 1) { + return left; + } + if (!consumer.inventory.addItemStackToInventory(left) && !consumer.worldObj.isRemote) { + consumer.entityDropItem(left, 1.0F); + } + } + --food.stackSize; } return food; } - - public static void setLeftOver(ItemStack food, ItemStack leftover) - { - if(!food.hasTagCompound()) - { - food.setTagCompound(new NBTTagCompound()); - } - NBTTagCompound savedItem = new NBTTagCompound(); - leftover.writeToNBT(savedItem); - food.getTagCompound().setTag(leftOverNbt, savedItem); - } - - protected ItemStack getLeftOver(ItemStack food) - { - if(food.hasTagCompound() && food.getTagCompound().hasKey(leftOverNbt)) - { - return ItemStack.loadItemStackFromNBT(food.getTagCompound().getCompoundTag(leftOverNbt)); - } - if(leftOver != null) - { - return new ItemStack(leftOver); - } - return getContainerItem(food); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - ItemStack food = new ItemStack(item); - if(this.getUnlocalizedName().contains("stew")) - { - setLeftOver(food, new ItemStack(Items.bowl)); - } - list.add(food); - } - private int useTime = 32; - - public ItemFoodMF setEatTime(int i) - { - useTime = i; - return this; - } - - @Override - public int getMaxItemUseDuration(ItemStack item) - { + + protected ItemStack getLeftOver(ItemStack food) { + if (food.hasTagCompound() && food.getTagCompound().hasKey(leftOverNbt)) { + return ItemStack.loadItemStackFromNBT(food.getTagCompound().getCompoundTag(leftOverNbt)); + } + if (leftOver != null) { + return new ItemStack(leftOver); + } + return getContainerItem(food); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + ItemStack food = new ItemStack(item); + if (this.getUnlocalizedName().contains("stew")) { + setLeftOver(food, new ItemStack(Items.bowl)); + } + list.add(food); + } + + public ItemFoodMF setEatTime(int i) { + useTime = i; + return this; + } + + @Override + public int getMaxItemUseDuration(ItemStack item) { return useTime; } - public static void onTick(EntityPlayer player) - { - int time = getEatDelay(player); - if(time > 0) - { - time --; - setEatDelay(player, time); - } - } - - private static void setEatDelay(EntityPlayer player, int time) - { - time += getEatDelay(player);//add to existing - - player.getEntityData().setInteger(eatDelayNBT , time); - } - private static int getEatDelay(EntityPlayer player) - { - if(player.getEntityData().hasKey(eatDelayNBT)) - { - return player.getEntityData().getInteger(eatDelayNBT); - } - return 0; - } - @Override - public ItemStack onItemRightClick(ItemStack food, World world, EntityPlayer user) - { - if(getEatDelay(user) > 0) - { - return food; - } + @Override + public ItemStack onItemRightClick(ItemStack food, World world, EntityPlayer user) { + if (getEatDelay(user) > 0) { + return food; + } return super.onItemRightClick(food, world, user); } } diff --git a/src/main/java/minefantasy/mf2/item/food/ItemMultiFood.java b/src/main/java/minefantasy/mf2/item/food/ItemMultiFood.java index cf600881..5034a9d5 100644 --- a/src/main/java/minefantasy/mf2/item/food/ItemMultiFood.java +++ b/src/main/java/minefantasy/mf2/item/food/ItemMultiFood.java @@ -1,57 +1,50 @@ package minefantasy.mf2.item.food; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemMultiFood extends ItemFoodMF -{ - private IIcon[] icons; - private int bites = 6; - public ItemMultiFood(String name, int bites, int hunger, float saturation, int rarity) - { - this(name, bites, hunger, saturation, false, rarity); - } - public ItemMultiFood(String name, int bites, int hunger, float saturation, boolean meat, int rarity) - { - super(name, hunger, saturation, meat, rarity); - setMaxStackSize(1); - this.bites = bites; - setMaxDamage(bites-1); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int damage) - { - int index = MathHelper.clamp_int(damage, 0, bites-1); +public class ItemMultiFood extends ItemFoodMF { + private IIcon[] icons; + private int bites = 6; + + public ItemMultiFood(String name, int bites, int hunger, float saturation, int rarity) { + this(name, bites, hunger, saturation, false, rarity); + } + + public ItemMultiFood(String name, int bites, int hunger, float saturation, boolean meat, int rarity) { + super(name, hunger, saturation, meat, rarity); + setMaxStackSize(1); + this.bites = bites; + setMaxDamage(bites - 1); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int damage) { + int index = MathHelper.clamp_int(damage, 0, bites - 1); return this.icons[index]; } - - @Override - public boolean isRepairable() - { - return false; + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public boolean isItemTool(ItemStack item) { + return false; } - - @Override - public boolean isItemTool(ItemStack item) - { - return false; - } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister register) - { + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister register) { this.icons = new IIcon[bites]; - for (int i = 0; i < bites; ++i) - { + for (int i = 0; i < bites; ++i) { this.icons[i] = register.registerIcon(this.getIconString() + "_" + i); } } diff --git a/src/main/java/minefantasy/mf2/item/food/ItemUnfinishedFood.java b/src/main/java/minefantasy/mf2/item/food/ItemUnfinishedFood.java index 1540e3f1..187221af 100644 --- a/src/main/java/minefantasy/mf2/item/food/ItemUnfinishedFood.java +++ b/src/main/java/minefantasy/mf2/item/food/ItemUnfinishedFood.java @@ -1,5 +1,6 @@ package minefantasy.mf2.item.food; +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; @@ -7,48 +8,43 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; + /** * @author Anonymous Productions */ -public class ItemUnfinishedFood extends Item -{ - public ItemUnfinishedFood(String name) - { - this(name, 0); - } - public ItemUnfinishedFood(String name, int rarity) - { - super(); - setMaxStackSize(1); - itemRarity = rarity; - setTextureName("minefantasy2:food/unfinished/"+name); - this.setCreativeTab(CreativeTabMF.tabFood); - GameRegistry.registerItem(this, "MF_UFood"+name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - } - - private int itemRarity; +public class ItemUnfinishedFood extends Item { + private int itemRarity; + + public ItemUnfinishedFood(String name) { + this(name, 0); + } + + public ItemUnfinishedFood(String name, int rarity) { + super(); + setMaxStackSize(1); + itemRarity = rarity; + setTextureName("minefantasy2:food/unfinished/" + name); + this.setCreativeTab(CreativeTabMF.tabFood); + GameRegistry.registerItem(this, "MF_UFood" + name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = itemRarity+1; - - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= ToolListMF.rarity.length) - { - lvl = ToolListMF.rarity.length-1; - } - return ToolListMF.rarity[lvl]; - } - public void onCrafted(EntityPlayer user, ItemStack item) - { - } + public EnumRarity getRarity(ItemStack item) { + int lvl = itemRarity + 1; + + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (lvl >= ToolListMF.rarity.length) { + lvl = ToolListMF.rarity.length - 1; + } + return ToolListMF.rarity[lvl]; + } + + public void onCrafted(EntityPlayer user, ItemStack item) { + } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/EnumCasingType.java b/src/main/java/minefantasy/mf2/item/gadget/EnumCasingType.java index 7ffcd9c5..46c47e02 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/EnumCasingType.java +++ b/src/main/java/minefantasy/mf2/item/gadget/EnumCasingType.java @@ -1,44 +1,34 @@ package minefantasy.mf2.item.gadget; -public enum EnumCasingType -{ - CRUDE("crude", 0.5F, 3F, 1.0F), - CERAMIC("ceramic", 1.0F, 5F, 1.0F), - IRON("iron", 1.5F, 4F, 2.0F), - OBSIDIAN("obsidian",2.0F, 4F, 1.5F), - CRYSTAL("crystal", 1.5F, 5F, 0.75F); - - public String name; - public float damageModifier; - public float rangeModifier; - public float weightModifier; - - private EnumCasingType(String name, float damage, float range, float weight) - { - this.name = name; - this.damageModifier = damage; - this.rangeModifier = range; - this.weightModifier = weight; - } - - public static EnumCasingType getType(byte i) - { - if(i == -1) - { - return CRUDE; - } - if(i == 1) - { - return IRON; - } - if(i == 2) - { - return OBSIDIAN; - } - if(i == 3) - { - return CRYSTAL; - } - return CERAMIC; - } +public enum EnumCasingType { + CRUDE("crude", 0.5F, 3F, 1.0F), CERAMIC("ceramic", 1.0F, 5F, 1.0F), IRON("iron", 1.5F, 4F, + 2.0F), OBSIDIAN("obsidian", 2.0F, 4F, 1.5F), CRYSTAL("crystal", 1.5F, 5F, 0.75F); + + public String name; + public float damageModifier; + public float rangeModifier; + public float weightModifier; + + private EnumCasingType(String name, float damage, float range, float weight) { + this.name = name; + this.damageModifier = damage; + this.rangeModifier = range; + this.weightModifier = weight; + } + + public static EnumCasingType getType(byte i) { + if (i == -1) { + return CRUDE; + } + if (i == 1) { + return IRON; + } + if (i == 2) { + return OBSIDIAN; + } + if (i == 3) { + return CRYSTAL; + } + return CERAMIC; + } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/EnumExplosiveType.java b/src/main/java/minefantasy/mf2/item/gadget/EnumExplosiveType.java index 5e22b1fb..9b405477 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/EnumExplosiveType.java +++ b/src/main/java/minefantasy/mf2/item/gadget/EnumExplosiveType.java @@ -1,32 +1,25 @@ package minefantasy.mf2.item.gadget; -public enum EnumExplosiveType -{ - BASIC("basic", 24F, 1.0F), - SHRAPNEL("shrapnel", 32F, 1.0F), - FIRE("fire", 40F, 1.0F); - - public String name; - public float damage; - public float range; - - private EnumExplosiveType(String name, float damage, float range) - { - this.name = name; - this.damage = damage; - this.range = range; - } - - public static EnumExplosiveType getType(byte i) - { - if(i == 1) - { - return SHRAPNEL; - } - if(i == 2) - { - return FIRE; - } - return BASIC; - } +public enum EnumExplosiveType { + BASIC("basic", 24F, 1.0F), SHRAPNEL("shrapnel", 32F, 1.0F), FIRE("fire", 40F, 1.0F); + + public String name; + public float damage; + public float range; + + private EnumExplosiveType(String name, float damage, float range) { + this.name = name; + this.damage = damage; + this.range = range; + } + + public static EnumExplosiveType getType(byte i) { + if (i == 1) { + return SHRAPNEL; + } + if (i == 2) { + return FIRE; + } + return BASIC; + } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/EnumFuseType.java b/src/main/java/minefantasy/mf2/item/gadget/EnumFuseType.java index b5a64871..064945ad 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/EnumFuseType.java +++ b/src/main/java/minefantasy/mf2/item/gadget/EnumFuseType.java @@ -1,25 +1,20 @@ package minefantasy.mf2.item.gadget; -public enum EnumFuseType -{ - BASIC("basic", 30), - LONGFUSE("long", 60); - - public String name; - public int time; - - private EnumFuseType(String name, int time) - { - this.name = name; - this.time = time; - } - - public static EnumFuseType getType(byte i) - { - if(i == 1) - { - return LONGFUSE; - } - return BASIC; - } +public enum EnumFuseType { + BASIC("basic", 30), LONGFUSE("long", 60); + + public String name; + public int time; + + private EnumFuseType(String name, int time) { + this.name = name; + this.time = time; + } + + public static EnumFuseType getType(byte i) { + if (i == 1) { + return LONGFUSE; + } + return BASIC; + } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/EnumPowderType.java b/src/main/java/minefantasy/mf2/item/gadget/EnumPowderType.java index 20a80241..46639e3c 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/EnumPowderType.java +++ b/src/main/java/minefantasy/mf2/item/gadget/EnumPowderType.java @@ -1,27 +1,22 @@ package minefantasy.mf2.item.gadget; -public enum EnumPowderType -{ - BLACKPOWDER("blackpowder", 1.0F, 1.0F), - ADVBLACKPOWDER("advBlackpowder", 1.5F, 1.0F); - - public String name; - public float damageModifier; - public float rangeModifier; - - private EnumPowderType(String name, float damage, float range) - { - this.name = name; - this.damageModifier = damage; - this.rangeModifier = range; - } - - public static EnumPowderType getType(byte i) - { - if(i == 1) - { - return ADVBLACKPOWDER; - } - return BLACKPOWDER; - } +public enum EnumPowderType { + BLACKPOWDER("blackpowder", 1.0F, 1.0F), ADVBLACKPOWDER("advBlackpowder", 1.5F, 1.0F); + + public String name; + public float damageModifier; + public float rangeModifier; + + private EnumPowderType(String name, float damage, float range) { + this.name = name; + this.damageModifier = damage; + this.rangeModifier = range; + } + + public static EnumPowderType getType(byte i) { + if (i == 1) { + return ADVBLACKPOWDER; + } + return BLACKPOWDER; + } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/IScope.java b/src/main/java/minefantasy/mf2/item/gadget/IScope.java index 598b381c..588f5e49 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/IScope.java +++ b/src/main/java/minefantasy/mf2/item/gadget/IScope.java @@ -3,5 +3,5 @@ import net.minecraft.item.ItemStack; public interface IScope { - public float getZoom(ItemStack item); + public float getZoom(ItemStack item); } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemArtefactLoot.java b/src/main/java/minefantasy/mf2/item/gadget/ItemArtefactLoot.java index 55de42d7..830d1145 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemArtefactLoot.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemArtefactLoot.java @@ -1,29 +1,9 @@ package minefantasy.mf2.item.gadget; -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.item.ItemComponentMF; -import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.ToolListMF; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandomChestContent; -import net.minecraft.world.World; -import net.minecraftforge.common.ChestGenHooks; - -public class ItemArtefactLoot extends ItemLootSack -{ - public ItemArtefactLoot(String name, String pool, int ammount) - { - super(name, ammount, 2); - this.pool=pool; - setTextureName("minefantasy2:artefact/box/"+name); - } +public class ItemArtefactLoot extends ItemLootSack { + public ItemArtefactLoot(String name, String pool, int ammount) { + super(name, ammount, 2); + this.pool = pool; + setTextureName("minefantasy2:artefact/box/" + name); + } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemBomb.java b/src/main/java/minefantasy/mf2/item/gadget/ItemBomb.java index 1ba07ed9..d29f616e 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemBomb.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemBomb.java @@ -1,7 +1,5 @@ package minefantasy.mf2.item.gadget; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -27,330 +25,296 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class ItemBomb extends Item implements ISpecialSalvage, IAmmo -{ - public ItemBomb(String name) - { +import java.util.List; + +public class ItemBomb extends Item implements ISpecialSalvage, IAmmo { + private static final String powderNBT = "MineFantasy_PowderType"; + private static final String fuseNBT = "MineFantasy_FuseType"; + private static final String fillingNBT = "MineFantasy_ExplosiveType"; + private static final String casingNBT = "MineFantasy_CaseType"; + public IIcon[] icons = new IIcon[2]; + private IIcon[] bombs = new IIcon[4]; + + public ItemBomb(String name) { this.maxStackSize = 16; this.setCreativeTab(CreativeTabMF.tabGadget); - setTextureName("minefantasy2:Other/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - BlockDispenser.dispenseBehaviorRegistry.putObject(this, new BombDispenser()); + setTextureName("minefantasy2:Other/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, new BombDispenser()); + } + + public static void setSticky(ItemStack item) { + NBTTagCompound nbt = getNBT(item); + nbt.setBoolean("stickyBomb", true); + } + + public static void setFuse(ItemStack item, byte fuse) { + NBTTagCompound nbt = getNBT(item); + nbt.setByte(fuseNBT, fuse); + } + + public static byte getFuse(ItemStack item) { + NBTTagCompound nbt = getNBT(item); + if (item.getItem() instanceof ItemBomb) { + return ((ItemBomb) item.getItem()).getItemFuse(nbt.getByte(fuseNBT)); + } + return nbt.getByte(fuseNBT); + } + + public static void setPowder(ItemStack item, byte powder) { + NBTTagCompound nbt = getNBT(item); + nbt.setByte(powderNBT, powder); + } + + public static byte getPowder(ItemStack item) { + NBTTagCompound nbt = getNBT(item); + if (item.getItem() instanceof ItemBomb) { + return ((ItemBomb) item.getItem()).getItemPowder(nbt.getByte(powderNBT)); + } + return nbt.getByte(powderNBT); + } + + /** + * 0 = Basic 1 = Shrapnel 2 = Fire + */ + public static void setFilling(ItemStack item, byte filling) { + NBTTagCompound nbt = getNBT(item); + nbt.setByte(fillingNBT, filling); + } + + public static byte getFilling(ItemStack item) { + NBTTagCompound nbt = getNBT(item); + if (item.getItem() instanceof ItemBomb) { + return ((ItemBomb) item.getItem()).getItemFilling(nbt.getByte(fillingNBT)); + } + return nbt.getByte(fillingNBT); + } + + /** + * 0 = Ceramic 1 = Iron + */ + public static void setCasing(ItemStack item, byte casing) { + NBTTagCompound nbt = getNBT(item); + nbt.setByte(casingNBT, casing); + } + + public static byte getCasing(ItemStack item) { + NBTTagCompound nbt = getNBT(item); + if (item.getItem() instanceof ItemBomb) { + return ((ItemBomb) item.getItem()).getItemCasing(nbt.getByte(casingNBT)); + } + return nbt.getByte(casingNBT); + } + + public static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) + item.setTagCompound(new NBTTagCompound()); + return item.getTagCompound(); + } + + public static ItemStack createExplosive(Item item, byte casing, byte filling, byte fuse, byte powder, int stackSize, + boolean sticky) { + ItemStack bomb = new ItemStack(item, stackSize); + setFilling(bomb, filling); + setCasing(bomb, casing); + setFuse(bomb, fuse); + setPowder(bomb, powder); + if (sticky) { + setSticky(bomb); + } + return bomb; + } + + public static ItemStack createExplosive(Item item, byte casing, byte filling, byte fuse, byte powder, + int stackSize) { + return createExplosive(item, casing, filling, fuse, powder, stackSize, false); } @Override - public EnumAction getItemUseAction(ItemStack item) - { + public EnumAction getItemUseAction(ItemStack item) { return EnumAction.block; } - + @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(!user.isSwingInProgress) - { - world.playSoundEffect(user.posX, user.posY + 1.5D, user.posZ, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - world.playSoundEffect(user.posX, user.posY+1.5, user.posZ, "game.tnt.primed", 1.0F, 1.0F); - user.setItemInUse(item, getMaxItemUseDuration(item)); - } - return item; + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (!user.isSwingInProgress) { + world.playSoundEffect(user.posX, user.posY + 1.5D, user.posZ, "fire.ignite", 1.0F, + itemRand.nextFloat() * 0.4F + 0.8F); + world.playSoundEffect(user.posX, user.posY + 1.5, user.posZ, "game.tnt.primed", 1.0F, 1.0F); + user.setItemInUse(item, getMaxItemUseDuration(item)); + } + return item; } + @Override - public int getMaxItemUseDuration(ItemStack item) - { + public int getMaxItemUseDuration(ItemStack item) { return 15; } + @Override - public ItemStack onEaten(ItemStack item, World world, EntityPlayer user) - { - user.swingItem(); - if (!user.capabilities.isCreativeMode) - { + public ItemStack onEaten(ItemStack item, World world, EntityPlayer user) { + user.swingItem(); + if (!user.capabilities.isCreativeMode) { --item.stackSize; } - if (!world.isRemote) - { - EntityBomb bomb = new EntityBomb(world, user).setType(getFilling(item), getCasing(item), getFuse(item), getPowder(item)); - world.spawnEntityInWorld(bomb); - if(item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) - { - bomb.getEntityData().setBoolean("stickyBomb", true); - } + if (!world.isRemote) { + EntityBomb bomb = new EntityBomb(world, user).setType(getFilling(item), getCasing(item), getFuse(item), + getPowder(item)); + world.spawnEntityInWorld(bomb); + if (item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) { + bomb.getEntityData().setBoolean("stickyBomb", true); + } } return item; } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - super.addInformation(item, user, list, fullInfo); - - if(item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) - { - list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("bomb.case.sticky") + EnumChatFormatting.GRAY); - } - EnumExplosiveType fill = EnumExplosiveType.getType(getFilling(item)); - EnumCasingType casing = EnumCasingType.getType(getCasing(item)); - EnumFuseType fuse = EnumFuseType.getType(getFuse(item)); - EnumPowderType powder = EnumPowderType.getType(getPowder(item)); - - int damage = (int) (fill.damage*casing.damageModifier*powder.damageModifier); - float range = fill.range*casing.rangeModifier*powder.rangeModifier; - float fusetime = (float)fuse.time/20F; - - list.add(StatCollector.translateToLocal("bomb.case."+casing.name+".name")); - list.add(StatCollector.translateToLocal("bomb.powder."+powder.name+".name")); - list.add(StatCollector.translateToLocal("bomb.fuse."+fuse.name+".name")); - list.add(""); - list.add(StatCollector.translateToLocalFormatted("bomb.fusetime.name", fusetime)); - list.add(StatCollector.translateToLocal("bomb.damage.name")+": "+damage); - list.add(StatCollector.translateToLocalFormatted("bomb.range.metric.name", range)); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + super.addInformation(item, user, list, fullInfo); + + if (item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) { + list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("bomb.case.sticky") + + EnumChatFormatting.GRAY); + } + EnumExplosiveType fill = EnumExplosiveType.getType(getFilling(item)); + EnumCasingType casing = EnumCasingType.getType(getCasing(item)); + EnumFuseType fuse = EnumFuseType.getType(getFuse(item)); + EnumPowderType powder = EnumPowderType.getType(getPowder(item)); + + int damage = (int) (fill.damage * casing.damageModifier * powder.damageModifier); + float range = fill.range * casing.rangeModifier * powder.rangeModifier; + float fusetime = fuse.time / 20F; + + list.add(StatCollector.translateToLocal("bomb.case." + casing.name + ".name")); + list.add(StatCollector.translateToLocal("bomb.powder." + powder.name + ".name")); + list.add(StatCollector.translateToLocal("bomb.fuse." + fuse.name + ".name")); + list.add(""); + list.add(StatCollector.translateToLocalFormatted("bomb.fusetime.name", fusetime)); + list.add(StatCollector.translateToLocal("bomb.damage.name") + ": " + damage); + list.add(StatCollector.translateToLocalFormatted("bomb.range.metric.name", range)); } + @Override - public String getUnlocalizedName(ItemStack item) - { - EnumExplosiveType type = EnumExplosiveType.getType(getFilling(item)); - return "item.bomb_"+type.name; + public String getUnlocalizedName(ItemStack item) { + EnumExplosiveType type = EnumExplosiveType.getType(getFilling(item)); + return "item.bomb_" + type.name; } - private static final String powderNBT = "MineFantasy_PowderType"; - private static final String fuseNBT = "MineFantasy_FuseType"; - private static final String fillingNBT = "MineFantasy_ExplosiveType"; - private static final String casingNBT = "MineFantasy_CaseType"; - - public static void setSticky(ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - nbt.setBoolean("stickyBomb", true); - } - - public static void setFuse(ItemStack item, byte fuse) - { - NBTTagCompound nbt = getNBT(item); - nbt.setByte(fuseNBT, fuse); - } - public static byte getFuse(ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - if(item.getItem() instanceof ItemBomb) - { - return ((ItemBomb)item.getItem()).getItemFuse(nbt.getByte(fuseNBT)); - } - return nbt.getByte(fuseNBT); - } - - public static void setPowder(ItemStack item, byte powder) - { - NBTTagCompound nbt = getNBT(item); - nbt.setByte(powderNBT, powder); - } - public static byte getPowder(ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - if(item.getItem() instanceof ItemBomb) - { - return ((ItemBomb)item.getItem()).getItemPowder(nbt.getByte(powderNBT)); - } - return nbt.getByte(powderNBT); - } - /** - * 0 = Basic - * 1 = Shrapnel - * 2 = Fire - */ - public static void setFilling(ItemStack item, byte filling) - { - NBTTagCompound nbt = getNBT(item); - nbt.setByte(fillingNBT, filling); - } - public static byte getFilling(ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - if(item.getItem() instanceof ItemBomb) - { - return ((ItemBomb)item.getItem()).getItemFilling(nbt.getByte(fillingNBT)); - } - return nbt.getByte(fillingNBT); - } - - /** - * 0 = Ceramic - * 1 = Iron - */ - public static void setCasing(ItemStack item, byte casing) - { - NBTTagCompound nbt = getNBT(item); - nbt.setByte(casingNBT, casing); - } - public static byte getCasing(ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - if(item.getItem() instanceof ItemBomb) - { - return ((ItemBomb)item.getItem()).getItemCasing(nbt.getByte(casingNBT)); - } - return nbt.getByte(casingNBT); - } - - public static NBTTagCompound getNBT(ItemStack item) - { - if(!item.hasTagCompound())item.setTagCompound(new NBTTagCompound()); - return item.getTagCompound(); - } - - public static ItemStack createExplosive(Item item, byte casing, byte filling, byte fuse, byte powder, int stackSize, boolean sticky) - { - ItemStack bomb = new ItemStack(item, stackSize); - setFilling(bomb, filling); - setCasing(bomb, casing); - setFuse(bomb, fuse); - setPowder(bomb, powder); - if(sticky) - { - setSticky(bomb); - } - return bomb; - } - - public static ItemStack createExplosive(Item item, byte casing, byte filling, byte fuse, byte powder, int stackSize) - { - return createExplosive(item, casing, filling, fuse, powder, stackSize, false); - } - - public ItemStack createBomb(byte casing, byte filling, byte fuse, byte powder, int stackSize) - { - return ItemBomb.createExplosive(this, casing, filling, fuse, powder, stackSize); + + public ItemStack createBomb(byte casing, byte filling, byte fuse, byte powder, int stackSize) { + return ItemBomb.createExplosive(this, casing, filling, fuse, powder, stackSize); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - list.add(createBomb((byte)0, (byte)0, (byte)0, (byte)0, 1)); - list.add(createBomb((byte)0, (byte)1, (byte)0, (byte)0, 1)); - list.add(createBomb((byte)0, (byte)2, (byte)0, (byte)0, 1)); - - list.add(createBomb((byte)1, (byte)0, (byte)0, (byte)0, 1)); - list.add(createBomb((byte)1, (byte)1, (byte)0, (byte)0, 1)); - list.add(createBomb((byte)1, (byte)2, (byte)0, (byte)0, 1)); - - list.add(createBomb((byte)2, (byte)0, (byte)0, (byte)0, 1)); - list.add(createBomb((byte)2, (byte)1, (byte)0, (byte)0, 1)); - list.add(createBomb((byte)2, (byte)2, (byte)0, (byte)0, 1)); - - list.add(createBomb((byte)3, (byte)0, (byte)0, (byte)0, 1)); - list.add(createBomb((byte)3, (byte)1, (byte)0, (byte)0, 1)); - list.add(createBomb((byte)3, (byte)2, (byte)0, (byte)0, 1)); - } - - //TODO Icons + public void getSubItems(Item item, CreativeTabs tab, List list) { + list.add(createBomb((byte) 0, (byte) 0, (byte) 0, (byte) 0, 1)); + list.add(createBomb((byte) 0, (byte) 1, (byte) 0, (byte) 0, 1)); + list.add(createBomb((byte) 0, (byte) 2, (byte) 0, (byte) 0, 1)); + + list.add(createBomb((byte) 1, (byte) 0, (byte) 0, (byte) 0, 1)); + list.add(createBomb((byte) 1, (byte) 1, (byte) 0, (byte) 0, 1)); + list.add(createBomb((byte) 1, (byte) 2, (byte) 0, (byte) 0, 1)); + + list.add(createBomb((byte) 2, (byte) 0, (byte) 0, (byte) 0, 1)); + list.add(createBomb((byte) 2, (byte) 1, (byte) 0, (byte) 0, 1)); + list.add(createBomb((byte) 2, (byte) 2, (byte) 0, (byte) 0, 1)); + + list.add(createBomb((byte) 3, (byte) 0, (byte) 0, (byte) 0, 1)); + list.add(createBomb((byte) 3, (byte) 1, (byte) 0, (byte) 0, 1)); + list.add(createBomb((byte) 3, (byte) 2, (byte) 0, (byte) 0, 1)); + } + + // TODO Icons @SideOnly(Side.CLIENT) - public IIcon getIcon(byte type) - { - if(type < 0) - { - return ToolListMF.bomb_crude.getIcon(type); - } - return bombs[type]; - } - public IIcon[] icons = new IIcon[2]; - private IIcon[] bombs = new IIcon[4]; - + public IIcon getIcon(byte type) { + if (type < 0) { + return ToolListMF.bomb_crude.getIcon(type); + } + return bombs[type]; + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { + public void registerIcons(IIconRegister reg) { icons[0] = reg.registerIcon("minefantasy2:Other/bomb_icon_shrapnel"); icons[1] = reg.registerIcon("minefantasy2:Other/bomb_icon_fire"); - + this.itemIcon = bombs[0] = reg.registerIcon("minefantasy2:Other/bomb_ceramic"); bombs[1] = reg.registerIcon("minefantasy2:Other/bomb_iron"); bombs[2] = reg.registerIcon("minefantasy2:Other/bomb_obsidian"); bombs[3] = reg.registerIcon("minefantasy2:Other/bomb_crystal"); } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIconIndex(ItemStack item) - { - int type = getCasing(item); - return bombs[type]; + public IIcon getIconIndex(ItemStack item) { + int type = getCasing(item); + return bombs[type]; } - + @Override @SideOnly(Side.CLIENT) - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack item, int layer) - { - boolean sticky = item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb"); - if(layer == 0 && sticky) - { - return Items.slime_ball.getIconFromDamage(0); - } - if(layer > (sticky ? 1 : 0)) - { - int type = getFilling(item); - if(type != 0) - { - return icons[type-1]; - } - } - return getIconIndex(item); - } - + public IIcon getIcon(ItemStack item, int layer) { + boolean sticky = item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb"); + if (layer == 0 && sticky) { + return Items.slime_ball.getIconFromDamage(0); + } + if (layer > (sticky ? 1 : 0)) { + int type = getFilling(item); + if (type != 0) { + return icons[type - 1]; + } + } + return getIconIndex(item); + } + @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + public EnumRarity getRarity(ItemStack item) { + if (getFilling(item) >= 2 || getCasing(item) >= 2) { + return EnumRarity.uncommon; + } + return EnumRarity.common; } - + @Override - public EnumRarity getRarity(ItemStack item) - { - if(getFilling(item) >= 2 || getCasing(item) >= 2) - { - return EnumRarity.uncommon; - } - return EnumRarity.common; - } - - @Override - public Object[] getSalvage(ItemStack item) - { - return new Object[] - { - ItemBombComponent.getBombComponent("bombcase", getCasing(item)), - ItemBombComponent.getBombComponent("fuse", getFuse(item)), - ItemBombComponent.getBombComponent("powder", getPowder(item)), - ItemBombComponent.getBombComponent("filling", getFilling(item)), - }; - } - - public byte getItemFuse(byte value) - { - return value; - } - public byte getItemFilling(byte value) - { - return value; - } - public byte getItemCasing(byte value) - { - return value; - } - public byte getItemPowder(byte value) - { - return value; - } - - @Override - public String getAmmoType(ItemStack arrow) { - return "mine"; - } + public Object[] getSalvage(ItemStack item) { + return new Object[]{ItemBombComponent.getBombComponent("bombcase", getCasing(item)), + ItemBombComponent.getBombComponent("fuse", getFuse(item)), + ItemBombComponent.getBombComponent("powder", getPowder(item)), + ItemBombComponent.getBombComponent("filling", getFilling(item)),}; + } + + public byte getItemFuse(byte value) { + return value; + } + + public byte getItemFilling(byte value) { + return value; + } + + public byte getItemCasing(byte value) { + return value; + } + + public byte getItemPowder(byte value) { + return value; + } + + @Override + public String getAmmoType(ItemStack arrow) { + return "mine"; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemBombComponent.java b/src/main/java/minefantasy/mf2/item/gadget/ItemBombComponent.java index 8263f33b..27a3d666 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemBombComponent.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemBombComponent.java @@ -1,69 +1,62 @@ package minefantasy.mf2.item.gadget; -import java.util.HashMap; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.crafting.ISalvageDrop; import minefantasy.mf2.api.crafting.engineer.IBombComponent; import minefantasy.mf2.item.ItemComponentMF; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import java.util.HashMap; +import java.util.List; + +public class ItemBombComponent extends ItemComponentMF implements IBombComponent, ISalvageDrop { + private static HashMap components = new HashMap(); + + private byte tier; + private String type; + + public ItemBombComponent(String name, String type, int tier) { + this(name, 0, type, tier); + } + + public ItemBombComponent(String name, int rarity, String type, int tier) { + super(name, rarity); + this.type = type; + this.tier = (byte) tier; + components.put(type + tier, this); + } -public class ItemBombComponent extends ItemComponentMF implements IBombComponent, ISalvageDrop -{ - private static HashMap components = new HashMap(); - - private byte tier; - private String type; - public ItemBombComponent(String name, String type, int tier) - { - this(name, 0, type, tier); - } - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("bomb.component.name")); - list.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("bomb.component." + type)); - } - public ItemBombComponent(String name, int rarity, String type, int tier) - { - super(name, rarity); - this.type = type; - this.tier = (byte)tier; - components.put(type+tier, this); - } + public static Item getBombComponent(String name, int tier) { + return components.get(name + tier); + } - @Override - public String getComponentType() - { - return type; - } + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("bomb.component.name")); + list.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("bomb.component." + type)); + } - @Override - public byte getTier() - { - return tier; - } + @Override + public String getComponentType() { + return type; + } - public static Item getBombComponent(String name, int tier) - { - return components.get(name+tier); - } + @Override + public byte getTier() { + return tier; + } - @Override - public boolean canSalvage(EntityPlayer user, ItemStack item) - { - if(getContainerItem() != null) - { - return false; - } - return true; - } + @Override + public boolean canSalvage(EntityPlayer user, ItemStack item) { + if (getContainerItem() != null) { + return false; + } + return true; + } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemClimbingPick.java b/src/main/java/minefantasy/mf2/item/gadget/ItemClimbingPick.java index 4f480225..8b74cdd8 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemClimbingPick.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemClimbingPick.java @@ -1,254 +1,204 @@ package minefantasy.mf2.item.gadget; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.api.tier.IToolMaterial; -import minefantasy.mf2.config.ConfigTools; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.item.tool.ToolMaterialMF; import minefantasy.mf2.item.weapon.ItemWeaponMF; import net.minecraft.block.Block; -import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; + +import java.util.Random; /** * @author Anonymous Productions */ -public class ItemClimbingPick extends ItemPickaxe implements IToolMaterial -{ - private Random rand = new Random(); - - public ItemClimbingPick(String name, ToolMaterial material, int rarity) - { +public class ItemClimbingPick extends ItemPickaxe implements IToolMaterial { + private Random rand = new Random(); + private int itemRarity; + + public ItemClimbingPick(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabGadget); - - setTextureName("minefantasy2:Other/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - setMaxDamage(material.getMaxUses()); + + setTextureName("minefantasy2:Other/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + setMaxDamage(material.getMaxUses()); } - - private int itemRarity; + + public static boolean tryPerformAbility(EntityLivingBase user, float points) { + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user)) { + points *= StaminaBar.getClimbinbDecayModifier(user, true); + if (StaminaBar.isStaminaAvailable(user, points, true)) { + ItemWeaponMF.applyFatigue(user, points); + return true; + } else { + return false; + } + } + return true; + } + @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = itemRarity+1; - - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= ToolListMF.rarity.length) - { - lvl = ToolListMF.rarity.length-1; - } - return ToolListMF.rarity[lvl]; - } - + public EnumRarity getRarity(ItemStack item) { + int lvl = itemRarity + 1; + + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (lvl >= ToolListMF.rarity.length) { + lvl = ToolListMF.rarity.length - 1; + } + return ToolListMF.rarity[lvl]; + } + @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - @Override - public int getMaxDamage(ItemStack stack) - { - return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); - } - - public boolean isInWall(EntityPlayer player, boolean init) - { - if(player.getHeldItem() == null)return false; - - World world = player.worldObj; - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - - if (movingobjectposition == null) - { - return false; - } else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - int x = movingobjectposition.blockX; - int y = movingobjectposition.blockY; - int z = movingobjectposition.blockZ; - - NBTTagCompound nbt = getOrCreateNBT(player.getHeldItem()); - if(init) - { - nbt.setInteger("MF_HeldPosX", x); - nbt.setInteger("MF_HeldPosY", y); - nbt.setInteger("MF_HeldPosZ", z); - } - else - { - int x1 = nbt.getInteger("MF_HeldPosX"); - int y1 = nbt.getInteger("MF_HeldPosY"); - int z1 = nbt.getInteger("MF_HeldPosZ"); - - if(x1 != x || y1 != y || z1 != z) - { - player.stopUsingItem(); - return false; - } - } - - Block block = world.getBlock(x, y, z); - - if(player.posY < (y+2.8F) && player.posY > (y-3) && player.getDistance(x+0.5, player.posY, z+0.5) < 1D && player.fallDistance < 5 && block.getMaterial().isSolid() && block.isOpaqueCube()) - { - return true; - } - } - } - return false; - } - - private NBTTagCompound getOrCreateNBT(ItemStack item) - { - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - return item.getTagCompound(); - } - - @Override - public void onUsingTick(ItemStack stack, EntityPlayer player, int count) - { - float cost = 0.5F; - if(stack.getItemDamage() >= stack.getMaxDamage()) - { - player.destroyCurrentEquippedItem(); - } - World world = player.worldObj; - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - - if (movingobjectposition == null) - { - if(!world.isRemote && StaminaBar.isSystemActive && !tryPerformAbility(player, cost)) - { - player.stopUsingItem(); - } - return; - } else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - int x = movingobjectposition.blockX; - int y = movingobjectposition.blockY; - int z = movingobjectposition.blockZ; - Block block = world.getBlock(x, y, z); - - if(isInWall(player, false)) - { - if(!player.isSwingInProgress) - { - cost *= 0.5F; - player.motionY = 0; - } - else - { - - player.fallDistance = 0; - if(!player.isSneaking() && player.posY < y+3) - { - player.motionY = 0.05D; - } - else if(player.isSneaking() && player.posY > y-2) - { - player.motionY = -0.05D; - cost *= 0.75F; - } - else - { - player.motionY = 0; - cost *= 0.5F; - } - } - } - } - } - if(!world.isRemote && StaminaBar.isSystemActive && !tryPerformAbility(player, cost)) - { - player.stopUsingItem(); - } - } - - @Override - public EnumAction getItemUseAction(ItemStack item) - { + public ToolMaterial getMaterial() { + return toolMaterial; + } + + @Override + public int getMaxDamage(ItemStack stack) { + return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); + } + + public boolean isInWall(EntityPlayer player, boolean init) { + if (player.getHeldItem() == null) + return false; + + World world = player.worldObj; + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + + if (movingobjectposition == null) { + return false; + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + int x = movingobjectposition.blockX; + int y = movingobjectposition.blockY; + int z = movingobjectposition.blockZ; + + NBTTagCompound nbt = getOrCreateNBT(player.getHeldItem()); + if (init) { + nbt.setInteger("MF_HeldPosX", x); + nbt.setInteger("MF_HeldPosY", y); + nbt.setInteger("MF_HeldPosZ", z); + } else { + int x1 = nbt.getInteger("MF_HeldPosX"); + int y1 = nbt.getInteger("MF_HeldPosY"); + int z1 = nbt.getInteger("MF_HeldPosZ"); + + if (x1 != x || y1 != y || z1 != z) { + player.stopUsingItem(); + return false; + } + } + + Block block = world.getBlock(x, y, z); + + if (player.posY < (y + 2.8F) && player.posY > (y - 3) + && player.getDistance(x + 0.5, player.posY, z + 0.5) < 1D && player.fallDistance < 5 + && block.getMaterial().isSolid() && block.isOpaqueCube()) { + return true; + } + } + } + return false; + } + + private NBTTagCompound getOrCreateNBT(ItemStack item) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + return item.getTagCompound(); + } + + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { + float cost = 0.5F; + if (stack.getItemDamage() >= stack.getMaxDamage()) { + player.destroyCurrentEquippedItem(); + } + World world = player.worldObj; + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + + if (movingobjectposition == null) { + if (!world.isRemote && StaminaBar.isSystemActive && !tryPerformAbility(player, cost)) { + player.stopUsingItem(); + } + return; + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + int x = movingobjectposition.blockX; + int y = movingobjectposition.blockY; + int z = movingobjectposition.blockZ; + Block block = world.getBlock(x, y, z); + + if (isInWall(player, false)) { + if (!player.isSwingInProgress) { + cost *= 0.5F; + player.motionY = 0; + } else { + + player.fallDistance = 0; + if (!player.isSneaking() && player.posY < y + 3) { + player.motionY = 0.05D; + } else if (player.isSneaking() && player.posY > y - 2) { + player.motionY = -0.05D; + cost *= 0.75F; + } else { + player.motionY = 0; + cost *= 0.5F; + } + } + } + } + } + if (!world.isRemote && StaminaBar.isSystemActive && !tryPerformAbility(player, cost)) { + player.stopUsingItem(); + } + } + + @Override + public EnumAction getItemUseAction(ItemStack item) { return EnumAction.bow; } - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(user.isUsingItem())return item; - if(StaminaBar.isSystemActive && !StaminaBar.isAnyStamina(user, true)) - { - return item; - } - - if(isInWall(user, true)) - { - user.setItemInUse(item, getMaxItemUseDuration(item)); - if(!world.isRemote) - { - item.damageItem(1, user); - } - user.playSound("mob.sheep.shear", 1.0F, 2.0F); - } - return item; + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (user.isUsingItem()) + return item; + if (StaminaBar.isSystemActive && !StaminaBar.isAnyStamina(user, true)) { + return item; + } + + if (isInWall(user, true)) { + user.setItemInUse(item, getMaxItemUseDuration(item)); + if (!world.isRemote) { + item.damageItem(1, user); + } + user.playSound("mob.sheep.shear", 1.0F, 2.0F); + } + return item; } - @Override - public int getMaxItemUseDuration(ItemStack item) - { + + @Override + public int getMaxItemUseDuration(ItemStack item) { return Integer.MAX_VALUE; } - - public static boolean tryPerformAbility(EntityLivingBase user, float points) - { - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user)) - { - points *= StaminaBar.getClimbinbDecayModifier(user, true); - if(StaminaBar.isStaminaAvailable(user, points, true)) - { - ItemWeaponMF.applyFatigue(user, points); - return true; - } - else - { - return false; - } - } - return true; - } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemCrossbow.java b/src/main/java/minefantasy/mf2/item/gadget/ItemCrossbow.java index cc35152d..de5aed75 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemCrossbow.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemCrossbow.java @@ -1,7 +1,5 @@ package minefantasy.mf2.item.gadget; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -38,526 +36,481 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class ItemCrossbow extends Item implements IFirearm, IDisplayMFAmmo, IDamageModifier, IRackItem, IDamageType, IScope, ISpecialSalvage -{ - public ItemCrossbow() - { - String name = "MF_CrossbowCustom"; +import java.util.List; + +public class ItemCrossbow extends Item + implements IFirearm, IDisplayMFAmmo, IDamageModifier, IRackItem, IDamageType, IScope, ISpecialSalvage { + private static final String partNBT = "MineFantasy_GunPiece_"; + public static String useTypeNBT = "MF_ActionInUse"; + private String[] fullParts = new String[]{"mod", "muzzle", "mechanism", "stock"}; + private IIcon[] strings; + + public ItemCrossbow() { + String name = "MF_CrossbowCustom"; this.setCreativeTab(CreativeTabMF.tabGadget); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - this.setFull3D(); - this.setTextureName("minefantasy2:gun/stock/cross_stock_wood"); - this.setMaxDamage(150); - this.setMaxStackSize(1); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + this.setFull3D(); + this.setTextureName("minefantasy2:gun/stock/cross_stock_wood"); + this.setMaxDamage(150); + this.setMaxStackSize(1); + } + + public static void setUseAction(ItemStack item, String action) { + AmmoMechanicsMF.getNBT(item).setString(useTypeNBT, action); + } + + public static String getUseAction(ItemStack item) { + String action = AmmoMechanicsMF.getNBT(item).getString(useTypeNBT); + + return action != null ? action : "null"; + } + + public static void setPart(String part, ItemStack item, int id) { + NBTTagCompound nbt = getNBT(item); + nbt.setInteger(partNBT + part, id); + } + + public static int getPart(String part, ItemStack item) { + NBTTagCompound nbt = getNBT(item); + if (nbt.hasKey(partNBT + part)) { + return nbt.getInteger(partNBT + part); + } + return -1; + } + + public static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) + item.setTagCompound(new NBTTagCompound()); + return item.getTagCompound(); } @Override - public EnumAction getItemUseAction(ItemStack item) - { - String action = getUseAction(item); - if(action.equalsIgnoreCase("reload")) - { - return EnumAction.block; + public EnumAction getItemUseAction(ItemStack item) { + String action = getUseAction(item); + if (action.equalsIgnoreCase("reload")) { + return EnumAction.block; } return EnumAction.bow; } - + @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(!world.isRemote && user.isSneaking() || AmmoMechanicsMF.isDepleted(item))//OPEN INV - { - user.openGui(MineFantasyII.instance, 1, user.worldObj, 1, 0, 0); - return item; - } - ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); - if(loaded == null || user.isSwingInProgress)//RELOAD - { - startUse(user, item, "reload"); - return item; - } - else //FIRE - { - } - startUse(user, item, "fire"); - return item; + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (!world.isRemote && user.isSneaking() || AmmoMechanicsMF.isDepleted(item))// OPEN INV + { + user.openGui(MineFantasyII.instance, 1, user.worldObj, 1, 0, 0); + return item; + } + ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); + if (loaded == null || user.isSwingInProgress)// RELOAD + { + startUse(user, item, "reload"); + return item; + } else // FIRE + { + } + startUse(user, item, "fire"); + return item; } + @Override - public ItemStack onEaten(ItemStack item, World world, EntityPlayer user) - { - boolean infinity = EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, item) > 0; - user.swingItem(); - ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); - ItemStack storage = AmmoMechanicsMF.getAmmo(item); - String action = getUseAction(item); - boolean shouldConsume = true; - - if(action.equalsIgnoreCase("reload")) - { - if(storage == null && infinity) - { - shouldConsume = false; - storage = CustomToolListMF.standard_bolt.construct("Magic"); - } - if(storage != null)//RELOAD - { - boolean success = false; - if(loaded == null) - { - ItemStack ammo = storage.copy(); - ammo.stackSize = 1; - if(shouldConsume) - AmmoMechanicsMF.consumeAmmo(user, item); - AmmoMechanicsMF.putAmmoOnFirearm(item, ammo); - success = true; - } - else if(loaded.isItemEqual(storage) && loaded.stackSize < getAmmoCapacity(item)) - { - if(shouldConsume) - AmmoMechanicsMF.consumeAmmo(user, item); - ++loaded.stackSize; - AmmoMechanicsMF.putAmmoOnFirearm(item, loaded); - success = true; - } - if(success) - { - user.playSound("random.click", 1.0F, 1.0F); - } - } - } - return super.onEaten(item, world, user); - } - + public ItemStack onEaten(ItemStack item, World world, EntityPlayer user) { + boolean infinity = EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, item) > 0; + user.swingItem(); + ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); + ItemStack storage = AmmoMechanicsMF.getAmmo(item); + String action = getUseAction(item); + boolean shouldConsume = true; + + if (action.equalsIgnoreCase("reload")) { + if (storage == null && infinity) { + shouldConsume = false; + storage = CustomToolListMF.standard_bolt.construct("Magic"); + } + if (storage != null)// RELOAD + { + boolean success = false; + if (loaded == null) { + ItemStack ammo = storage.copy(); + ammo.stackSize = 1; + if (shouldConsume) + AmmoMechanicsMF.consumeAmmo(user, item); + AmmoMechanicsMF.putAmmoOnFirearm(item, ammo); + success = true; + } else if (loaded.isItemEqual(storage) && loaded.stackSize < getAmmoCapacity(item)) { + if (shouldConsume) + AmmoMechanicsMF.consumeAmmo(user, item); + ++loaded.stackSize; + AmmoMechanicsMF.putAmmoOnFirearm(item, loaded); + success = true; + } + if (success) { + user.playSound("random.click", 1.0F, 1.0F); + } + } + } + return super.onEaten(item, world, user); + } + @Override - public void onUsingTick(ItemStack item, EntityPlayer player, int time) - { - ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); - int max = getMaxItemUseDuration(item); - - if(time == (max-5) && getUseAction(item).equalsIgnoreCase("reload") && (loaded == null || loaded.stackSize < getAmmoCapacity(item))) - { - player.playSound("minefantasy2:weapon.crossbowload", 1.0F, 1 / (getFullValue(item, "speed") / 4F)); - } + public void onUsingTick(ItemStack item, EntityPlayer player, int time) { + ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); + int max = getMaxItemUseDuration(item); + + if (time == (max - 5) && getUseAction(item).equalsIgnoreCase("reload") + && (loaded == null || loaded.stackSize < getAmmoCapacity(item))) { + player.playSound("minefantasy2:weapon.crossbowload", 1.0F, 1 / (getFullValue(item, "speed") / 4F)); + } } + @Override - public void onPlayerStoppedUsing(ItemStack item, World world, EntityPlayer user, int time) - { - ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); - String action = getUseAction(item); - - if(action.equalsIgnoreCase("fire") && this.onFireArrow(user.worldObj, AmmoMechanicsMF.getArrowOnBow(item), item, user, this.getFullValue(item, "power"), false)) - { - if(loaded != null) - { - --loaded.stackSize; - AmmoMechanicsMF.putAmmoOnFirearm(item, (loaded.stackSize > 0 ? loaded : null)); - } - recoilUser(user, getFullValue(item, "recoil")); - AmmoMechanicsMF.damageContainer(item, user, 1); - } - stopUse(item); - } - public void startUse(EntityPlayer user, ItemStack item, String action) - { - setUseAction(item, action); - if(user != null) - user.setItemInUse(item, getMaxItemUseDuration(item)); - } - public void stopUse(ItemStack item) - { - startUse(null, item, "null"); + public void onPlayerStoppedUsing(ItemStack item, World world, EntityPlayer user, int time) { + ItemStack loaded = AmmoMechanicsMF.getArrowOnBow(item); + String action = getUseAction(item); + + if (action.equalsIgnoreCase("fire") && this.onFireArrow(user.worldObj, AmmoMechanicsMF.getArrowOnBow(item), + item, user, this.getFullValue(item, "power"), false)) { + if (loaded != null) { + --loaded.stackSize; + AmmoMechanicsMF.putAmmoOnFirearm(item, (loaded.stackSize > 0 ? loaded : null)); + } + recoilUser(user, getFullValue(item, "recoil")); + AmmoMechanicsMF.damageContainer(item, user, 1); + } + stopUse(item); } - public static String useTypeNBT = "MF_ActionInUse"; - public static void setUseAction(ItemStack item, String action) - { - AmmoMechanicsMF.getNBT(item).setString(useTypeNBT, action); - } - public static String getUseAction(ItemStack item) - { - String action = AmmoMechanicsMF.getNBT(item).getString(useTypeNBT); - - return action != null ? action : "null"; - } - - private void recoilUser(EntityPlayer user, float value) - { - if(PowerArmour.isPowered(user)) - { - return; - } - float str = CombatMechanics.getStrengthEnhancement(user)+1; - value /= str; - - float angle = value; - user.rotationPitch -= itemRand.nextFloat()*angle; - user.rotationYawHead += itemRand.nextFloat()*angle-0.5F; - } - - @Override - public int getMaxItemUseDuration(ItemStack item) - { - String action = getUseAction(item); - if(action.equalsIgnoreCase("reload")) - { - return (int)(getFullValue(item, "speed")*20F); + + public void startUse(EntityPlayer user, ItemStack item, String action) { + setUseAction(item, action); + if (user != null) + user.setItemInUse(item, getMaxItemUseDuration(item)); + } + + public void stopUse(ItemStack item) { + startUse(null, item, "null"); + } + + private void recoilUser(EntityPlayer user, float value) { + if (PowerArmour.isPowered(user)) { + return; } - return 72000; - } - - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - super.addInformation(item, user, list, fullInfo); - - list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.power.name", getFullValue(item, "power"))); - list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.speed.name", getFullValue(item, "speed"))); - list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.recoil.name", getFullValue(item, "recoil"))); - list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.spread.name", getFullValue(item, "spread"))); - list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.capacity.name", getAmmoCapacity(item))); - list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.bash.name", getMeleeDmg(item))); - } - - public String getItemStackDisplayName(ItemStack item) - { - String base = getNameModifier(item, "stock"); - String arms = getNameModifier(item, "mechanism"); - String mod = getNameModifier(item, "mod"); - - String fullName = "Crossbow"; - - if(base != null)fullName=base; - if(arms != null)fullName=arms + " " + fullName; - if(mod != null)fullName=mod + " " + fullName; - - return fullName; + float str = CombatMechanics.getStrengthEnhancement(user) + 1; + value /= str; + + float angle = value; + user.rotationPitch -= itemRand.nextFloat() * angle; + user.rotationYawHead += itemRand.nextFloat() * angle - 0.5F; } - private static final String partNBT = "MineFantasy_GunPiece_"; - - public static void setPart(String part, ItemStack item, int id) - { - NBTTagCompound nbt = getNBT(item); - nbt.setInteger(partNBT+part, id); - } - public static int getPart(String part, ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - if(nbt.hasKey(partNBT+part)) - { - return nbt.getInteger(partNBT+part); - } - return -1; - } - + + @Override + public int getMaxItemUseDuration(ItemStack item) { + String action = getUseAction(item); + if (action.equalsIgnoreCase("reload")) { + return (int) (getFullValue(item, "speed") * 20F); + } + return 72000; + } + + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + super.addInformation(item, user, list, fullInfo); + + list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.power.name", getFullValue(item, "power"))); + list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.speed.name", getFullValue(item, "speed"))); + list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.recoil.name", + getFullValue(item, "recoil"))); + list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.spread.name", + getFullValue(item, "spread"))); + list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.capacity.name", getAmmoCapacity(item))); + list.add(StatCollector.translateToLocalFormatted("attribute.crossbow.bash.name", getMeleeDmg(item))); + } + + public String getItemStackDisplayName(ItemStack item) { + String base = getNameModifier(item, "stock"); + String arms = getNameModifier(item, "mechanism"); + String mod = getNameModifier(item, "mod"); + + String fullName = "Crossbow"; + + if (base != null) + fullName = base; + if (arms != null) + fullName = arms + " " + fullName; + if (mod != null) + fullName = mod + " " + fullName; + + return fullName; + } + /** * Constructs a crossbow with a list of parts */ - public ItemStack constructCrossbow(ICrossbowPart...crossbowParts) - { - ItemStack crossbow = new ItemStack(this); - - for(ICrossbowPart part : crossbowParts) - { - if(part != null) - { - setPart(crossbow, part); - } - } - return crossbow; + public ItemStack constructCrossbow(ICrossbowPart... crossbowParts) { + ItemStack crossbow = new ItemStack(this); + + for (ICrossbowPart part : crossbowParts) { + if (part != null) { + setPart(crossbow, part); + } + } + return crossbow; } + /** * Adds a part to a crossbow */ - public ItemStack setPart(ItemStack item, ICrossbowPart part) - { - setPart(part.getComponentType(), item, part.getID()); - return item; - } - - public static NBTTagCompound getNBT(ItemStack item) - { - if(!item.hasTagCompound())item.setTagCompound(new NBTTagCompound()); - return item.getTagCompound(); - } - + public ItemStack setPart(ItemStack item, ICrossbowPart part) { + setPart(part.getComponentType(), item, part.getID()); + return item; + } + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack item, int layer) - { - IIcon stock = getPartIcon(item, "stock"); - if(stock != null && layer == 0) - { - return stock; - } - IIcon muzzle = getPartIcon(item, "muzzle"); - if(muzzle != null && layer == 1) - { - return muzzle; - } - IIcon mod = getPartIcon(item, "mod"); - if(mod != null && layer == 2) - { - return mod; - } - IIcon head = getPartIcon(item, "mechanism"); - return head != null ? head : getIconIndex(item); - } - + public IIcon getIcon(ItemStack item, int layer) { + IIcon stock = getPartIcon(item, "stock"); + if (stock != null && layer == 0) { + return stock; + } + IIcon muzzle = getPartIcon(item, "muzzle"); + if (muzzle != null && layer == 1) { + return muzzle; + } + IIcon mod = getPartIcon(item, "mod"); + if (mod != null && layer == 2) { + return mod; + } + IIcon head = getPartIcon(item, "mechanism"); + return head != null ? head : getIconIndex(item); + } + @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; } + @Override - @SideOnly(Side.CLIENT) - public int getRenderPasses(int metadata) - { + @SideOnly(Side.CLIENT) + public int getRenderPasses(int metadata) { return 4; } - + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - list.add(constructCrossbow((ICrossbowPart)ComponentListMF.crossbow_handle_wood, (ICrossbowPart)ComponentListMF.cross_arms_basic)); - list.add(constructCrossbow((ICrossbowPart)ComponentListMF.crossbow_stock_wood, (ICrossbowPart)ComponentListMF.cross_arms_light)); - - list.add(constructCrossbow((ICrossbowPart)ComponentListMF.crossbow_stock_wood, (ICrossbowPart)ComponentListMF.cross_arms_basic, (ICrossbowPart)ComponentListMF.cross_ammo)); - list.add(constructCrossbow((ICrossbowPart)ComponentListMF.crossbow_stock_wood, (ICrossbowPart)ComponentListMF.cross_arms_heavy, (ICrossbowPart)ComponentListMF.cross_bayonet)); - list.add(constructCrossbow((ICrossbowPart)ComponentListMF.crossbow_stock_iron, (ICrossbowPart)ComponentListMF.cross_arms_advanced, (ICrossbowPart)ComponentListMF.cross_scope)); + public void getSubItems(Item item, CreativeTabs tab, List list) { + list.add(constructCrossbow((ICrossbowPart) ComponentListMF.crossbow_handle_wood, + (ICrossbowPart) ComponentListMF.cross_arms_basic)); + list.add(constructCrossbow((ICrossbowPart) ComponentListMF.crossbow_stock_wood, + (ICrossbowPart) ComponentListMF.cross_arms_light)); + + list.add(constructCrossbow((ICrossbowPart) ComponentListMF.crossbow_stock_wood, + (ICrossbowPart) ComponentListMF.cross_arms_basic, (ICrossbowPart) ComponentListMF.cross_ammo)); + list.add(constructCrossbow((ICrossbowPart) ComponentListMF.crossbow_stock_wood, + (ICrossbowPart) ComponentListMF.cross_arms_heavy, (ICrossbowPart) ComponentListMF.cross_bayonet)); + list.add(constructCrossbow((ICrossbowPart) ComponentListMF.crossbow_stock_iron, + (ICrossbowPart) ComponentListMF.cross_arms_advanced, (ICrossbowPart) ComponentListMF.cross_scope)); } + @SideOnly(Side.CLIENT) - public IIcon getPartIcon(ItemStack item, String partname) - { - if(partname.equalsIgnoreCase("string")) - { - return strings[AmmoMechanicsMF.getArrowOnBow(item) != null ? 1 : 0]; - } - ICrossbowPart part = ItemCrossbowPart.getPart(partname, getPart(partname, item)); - if(part != null) - { - return part.getIcon(); - } - return null; - } - - public String getNameModifier(ItemStack item, String partname) - { - ICrossbowPart part = ItemCrossbowPart.getPart(partname, getPart(partname, item)); - if(part != null) - { - String name = part.getUnlocalisedName(); - if(name != null) - { - return StatCollector.translateToLocal(name); - } - } - return null; - } - /** - * Get the modifier for a part (such as power, speed, recoil, capacity and spread) - */ - public float getModifierForPart(ItemStack item, String partName, String variable) - { - ICrossbowPart part = ItemCrossbowPart.getPart(partName, getPart(partName, item)); - if(part != null) - { - return part.getModifier(variable); - } - return 0F; - } - private String[] fullParts = new String[]{"mod", "muzzle", "mechanism", "stock"}; - - /** - * Checks all "fullParts" for value modifiers - */ - public float getFullValue(ItemStack item, String variable) - { - float min = variable.equalsIgnoreCase("speed") ? 0.5F: 0F; - float value = 0F; - - for(String part: fullParts) - { - value += getModifierForPart(item, part, variable); - } - - return Math.max(min, value); - } - - @Override - public int getAmmoCapacity(ItemStack item) - { - return 1 + (int)getModifierForPart(item, "mod", "capacity");//only mod affects capacity - } - public float getMeleeDmg(ItemStack item) - { - return 1 + getModifierForPart(item, "muzzle", "bash");//only muzzle affects capacity - } - - @Override - public boolean canAcceptAmmo(ItemStack weapon, String ammo) - { - return ammo.equalsIgnoreCase("bolt"); - } - - @Override - public float[] getDamageRatio(Object... implement) - { - if(implement.length > 0 && implement[0] instanceof ItemStack) - { - if(this.getMeleeDmg((ItemStack)implement[0]) > 1.0F)//Bayonet is used - { - return new float[]{0F, 0F, 1F}; - } - } - - return new float[]{0F, 1F, 0F}; - } - - @Override - public float getPenetrationLevel(Object implement) { - return 0; - } - - private IIcon[] strings; - @Override + public IIcon getPartIcon(ItemStack item, String partname) { + if (partname.equalsIgnoreCase("string")) { + return strings[AmmoMechanicsMF.getArrowOnBow(item) != null ? 1 : 0]; + } + ICrossbowPart part = ItemCrossbowPart.getPart(partname, getPart(partname, item)); + if (part != null) { + return part.getIcon(); + } + return null; + } + + public String getNameModifier(ItemStack item, String partname) { + ICrossbowPart part = ItemCrossbowPart.getPart(partname, getPart(partname, item)); + if (part != null) { + String name = part.getUnlocalisedName(); + if (name != null) { + return StatCollector.translateToLocal(name); + } + } + return null; + } + + /** + * Get the modifier for a part (such as power, speed, recoil, capacity and + * spread) + */ + public float getModifierForPart(ItemStack item, String partName, String variable) { + ICrossbowPart part = ItemCrossbowPart.getPart(partName, getPart(partName, item)); + if (part != null) { + return part.getModifier(variable); + } + return 0F; + } + + /** + * Checks all "fullParts" for value modifiers + */ + public float getFullValue(ItemStack item, String variable) { + float min = variable.equalsIgnoreCase("speed") ? 0.5F : 0F; + float value = 0F; + + for (String part : fullParts) { + value += getModifierForPart(item, part, variable); + } + + return Math.max(min, value); + } + + @Override + public int getAmmoCapacity(ItemStack item) { + return 1 + (int) getModifierForPart(item, "mod", "capacity");// only mod affects capacity + } + + public float getMeleeDmg(ItemStack item) { + return 1 + getModifierForPart(item, "muzzle", "bash");// only muzzle affects capacity + } + + @Override + public boolean canAcceptAmmo(ItemStack weapon, String ammo) { + return ammo.equalsIgnoreCase("bolt"); + } + + @Override + public float[] getDamageRatio(Object... implement) { + if (implement.length > 0 && implement[0] instanceof ItemStack) { + if (this.getMeleeDmg((ItemStack) implement[0]) > 1.0F)// Bayonet is used + { + return new float[]{0F, 0F, 1F}; + } + } + + return new float[]{0F, 1F, 0F}; + } + + @Override + public float getPenetrationLevel(Object implement) { + return 0; + } + + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - super.registerIcons(reg); - strings = new IIcon[2]; - strings[0] = reg.registerIcon("minefantasy2:gun/mechanism/cross_string_unload"); - strings[1] = reg.registerIcon("minefantasy2:gun/mechanism/cross_string_load"); - } - - @Override - public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, boolean properHit) - { - return initialDam + this.getMeleeDmg(item)-1; - } - - public boolean onFireArrow(World world, ItemStack arrow, ItemStack bow, EntityPlayer user, float charge, boolean infinite) - { - if(arrow == null || !(arrow.getItem() instanceof ItemArrowMF)) - { - return false; - } - ItemArrowMF ammo = (ItemArrowMF)arrow.getItem(); - if(!(ammo.getAmmoType(arrow).equalsIgnoreCase("bolt"))) - { - return false; - } - //TODO Arrow entity instance - EntityArrowMF entArrow = ammo.getFiredArrow(new EntityArrowMF(world, user, getFullValue(bow, "spread"), charge*2.0F), arrow); + public void registerIcons(IIconRegister reg) { + super.registerIcons(reg); + strings = new IIcon[2]; + strings[0] = reg.registerIcon("minefantasy2:gun/mechanism/cross_string_unload"); + strings[1] = reg.registerIcon("minefantasy2:gun/mechanism/cross_string_load"); + } + + @Override + public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, + boolean properHit) { + return initialDam + this.getMeleeDmg(item) - 1; + } + + public boolean onFireArrow(World world, ItemStack arrow, ItemStack bow, EntityPlayer user, float charge, + boolean infinite) { + if (arrow == null || !(arrow.getItem() instanceof ItemArrowMF)) { + return false; + } + ItemArrowMF ammo = (ItemArrowMF) arrow.getItem(); + if (!(ammo.getAmmoType(arrow).equalsIgnoreCase("bolt"))) { + return false; + } + // TODO Arrow entity instance + EntityArrowMF entArrow = ammo + .getFiredArrow(new EntityArrowMF(world, user, getFullValue(bow, "spread"), charge * 2.0F), arrow); int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, bow); - entArrow.setPower(1+(0.25F*var9)); + entArrow.setPower(1 + (0.25F * var9)); int var10 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, bow); - if (var10 > 0) - { + if (var10 > 0) { entArrow.setKnockbackStrength(var10); } - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, bow) > 0) - { + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, bow) > 0) { entArrow.setFire(100); } - if(infinite) - { - entArrow.canBePickedUp = 2; + if (infinite) { + entArrow.canBePickedUp = 2; } - - if(bow != null && bow.getItem() != null && bow.getItem() instanceof ISpecialBow) - { - entArrow = (EntityArrowMF) ((ISpecialBow)bow.getItem()).modifyArrow(bow, entArrow); + + if (bow != null && bow.getItem() != null && bow.getItem() instanceof ISpecialBow) { + entArrow = (EntityArrowMF) ((ISpecialBow) bow.getItem()).modifyArrow(bow, entArrow); } - if (!world.isRemote) - { + if (!world.isRemote) { world.spawnEntityInWorld(entArrow); } world.playSoundAtEntity(user, "minefantasy2:weapon.crossbow_fire", 1.0F, 1.0F); - - return true; - } - - @Override - public float getZoom(ItemStack item) - { - return getUseAction(item).equalsIgnoreCase("fire") ? getModifierForPart(item, "mod", "zoom") : 0F;//only mod affects zoom; - } - - @Override - public Object[] getSalvage(ItemStack item) - { - return new Object[] - { - getItem(item, "stock"), - getItem(item, "mechanism"), - getItem(item, "muzzle"), - getItem(item, "mod") - }; - } - - private Object getItem(ItemStack item, String type) - { - return ItemCrossbowPart.getPart(type, this.getPart(type, item)); - } - - @Override - public int getMaxDamage(ItemStack item) - { - return super.getMaxDamage(item) + (int)getFullValue(item, "durability"); - } - - @Override - public float getScale(ItemStack itemstack) { - return 1.0F; - } - - @Override - public float getOffsetX(ItemStack itemstack) { - return 0F; - } - - @Override - public float getOffsetY(ItemStack itemstack) - { - return (isHandCrossbow(itemstack) ? 0F : 0.5F) + 1/8F; - } - - @Override - public float getOffsetZ(ItemStack itemstack) { - return 0.25F; - } - - @Override - public float getRotationOffset(ItemStack itemstack) { - return 0; - } - - @Override - public boolean canHang(TileEntityRack rack, ItemStack item, int slot) - { - if(slot == 0 || slot == 3)return false; - - return isHandCrossbow(item) || rack.hasRackBelow(slot); - } - - @Override - public boolean isSpecialRender(ItemStack item) { - return true; - } - - public boolean isHandCrossbow(ItemStack item) - { - ICrossbowPart part = ItemCrossbowPart.getPart("stock", getPart("stock", item)); - if(part != null) - { - return part.makesSmallWeapon(); - } - return true; - } + + return true; + } + + @Override + public float getZoom(ItemStack item) { + return getUseAction(item).equalsIgnoreCase("fire") ? getModifierForPart(item, "mod", "zoom") : 0F;// only mod + // affects + // zoom; + } + + @Override + public Object[] getSalvage(ItemStack item) { + return new Object[]{getItem(item, "stock"), getItem(item, "mechanism"), getItem(item, "muzzle"), + getItem(item, "mod")}; + } + + private Object getItem(ItemStack item, String type) { + return ItemCrossbowPart.getPart(type, this.getPart(type, item)); + } + + @Override + public int getMaxDamage(ItemStack item) { + return super.getMaxDamage(item) + (int) getFullValue(item, "durability"); + } + + @Override + public float getScale(ItemStack itemstack) { + return 1.0F; + } + + @Override + public float getOffsetX(ItemStack itemstack) { + return 0F; + } + + @Override + public float getOffsetY(ItemStack itemstack) { + return (isHandCrossbow(itemstack) ? 0F : 0.5F) + 1 / 8F; + } + + @Override + public float getOffsetZ(ItemStack itemstack) { + return 0.25F; + } + + @Override + public float getRotationOffset(ItemStack itemstack) { + return 0; + } + + @Override + public boolean canHang(TileEntityRack rack, ItemStack item, int slot) { + if (slot == 0 || slot == 3) + return false; + + return isHandCrossbow(item) || rack.hasRackBelow(slot); + } + + @Override + public boolean isSpecialRender(ItemStack item) { + return true; + } + + public boolean isHandCrossbow(ItemStack item) { + ICrossbowPart part = ItemCrossbowPart.getPart("stock", getPart("stock", item)); + if (part != null) { + return part.makesSmallWeapon(); + } + return true; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemCrossbowPart.java b/src/main/java/minefantasy/mf2/item/gadget/ItemCrossbowPart.java index b26953c8..74ca2dfa 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemCrossbowPart.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemCrossbowPart.java @@ -1,160 +1,156 @@ package minefantasy.mf2.item.gadget; -import java.util.HashMap; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.crafting.engineer.ICrossbowPart; import minefantasy.mf2.item.ItemComponentMF; import minefantasy.mf2.item.list.ComponentListMF; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemCrossbowPart extends ItemComponentMF implements ICrossbowPart -{ - private int tier; - private String type, partname; - public IIcon modelIcon; - - public ItemCrossbowPart(String name, String type) - { - this(name, type, ICrossbowPart.components.size(), name); - } - - public ItemCrossbowPart(String name, String type, int tier) - { - this(name, type, tier, name); - } - public ItemCrossbowPart(String name, String type, int tier, String model) - { - super(name, 0); - this.setFull3D(); - this.type = type; - this.tier = tier; - this.partname=model; - MineFantasyAPI.registerCrossbowPart(this); - } - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("crossbow.component.name")); - list.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("crossbow.component." + type)); - list.add(EnumChatFormatting.DARK_GRAY + StatCollector.translateToLocal(getUnlocalizedName() + ".desc")); - } - - @Override - public String getComponentType() - { - return type; - } - - @Override - public int getID() - { - return tier; - } - - public static ICrossbowPart getPart(String type, int id) - { - return components.get(type+id); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon() { - return modelIcon; - } - - @Override +import java.util.List; + +public class ItemCrossbowPart extends ItemComponentMF implements ICrossbowPart { + public IIcon modelIcon; + private int tier; + private String type, partname; + private int capacity = 0, durability = 50; + private float power, spread, recoil, speed, bash, zoom; + private boolean isHandle = false; + + public ItemCrossbowPart(String name, String type) { + this(name, type, ICrossbowPart.components.size(), name); + } + + public ItemCrossbowPart(String name, String type, int tier) { + this(name, type, tier, name); + } + + public ItemCrossbowPart(String name, String type, int tier, String model) { + super(name, 0); + this.setFull3D(); + this.type = type; + this.tier = tier; + this.partname = model; + MineFantasyAPI.registerCrossbowPart(this); + } + + public static ICrossbowPart getPart(String type, int id) { + return components.get(type + id); + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("crossbow.component.name")); + list.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("crossbow.component." + type)); + list.add(EnumChatFormatting.DARK_GRAY + StatCollector.translateToLocal(getUnlocalizedName() + ".desc")); + } + + @Override + public String getComponentType() { + return type; + } + + @Override + public int getID() { + return tier; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon() { + return modelIcon; + } + + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - super.registerIcons(reg); - modelIcon = reg.registerIcon("minefantasy2:gun/"+type+"/"+partname); - } - - @Override - public String getUnlocalisedName() - { - if(this == ComponentListMF.cross_arms_basic) - { - return null; - } - return "crosspart."+type+"."+partname; - } - - private int capacity = 0, durability = 50; - private float power, spread, recoil, speed, bash, zoom; - public ItemCrossbowPart addPower(float power) - { - this.power = power; - return this; - } - public ItemCrossbowPart setScope(float zoom) - { - this.zoom = zoom; - return this; - } - public ItemCrossbowPart addSpread(float spread) - { - this.spread = spread; - return this; - } - public ItemCrossbowPart addRecoil(float recoil) - { - this.recoil = recoil; - return this; - } - public ItemCrossbowPart addSpeed(float speed) - { - this.speed = speed; - return this; - } - public ItemCrossbowPart addBash(float bash) - { - this.bash = bash; - return this; - } - public ItemCrossbowPart addCapacity(int capacity) - { - this.capacity = capacity; - return this; - } - public ItemCrossbowPart addDurability(int durability) - { - this.durability = durability; - return this; - } - public ItemCrossbowPart setHandCrossbow(boolean flag) - { - this.isHandle = flag; - return this; - } - @Override - public float getModifier(String type) - { - if(type.equalsIgnoreCase("power"))return power; - if(type.equalsIgnoreCase("spread"))return spread; - if(type.equalsIgnoreCase("recoil"))return recoil; - if(type.equalsIgnoreCase("speed"))return speed; - if(type.equalsIgnoreCase("capacity"))return capacity; - if(type.equalsIgnoreCase("bash"))return bash; - if(type.equalsIgnoreCase("zoom"))return zoom; - if(type.equalsIgnoreCase("durability"))return durability; - return 0F; - } - private boolean isHandle = false; - @Override - public boolean makesSmallWeapon() { - return isHandle; - } + public void registerIcons(IIconRegister reg) { + super.registerIcons(reg); + modelIcon = reg.registerIcon("minefantasy2:gun/" + type + "/" + partname); + } + + @Override + public String getUnlocalisedName() { + if (this == ComponentListMF.cross_arms_basic) { + return null; + } + return "crosspart." + type + "." + partname; + } + + public ItemCrossbowPart addPower(float power) { + this.power = power; + return this; + } + + public ItemCrossbowPart setScope(float zoom) { + this.zoom = zoom; + return this; + } + + public ItemCrossbowPart addSpread(float spread) { + this.spread = spread; + return this; + } + + public ItemCrossbowPart addRecoil(float recoil) { + this.recoil = recoil; + return this; + } + + public ItemCrossbowPart addSpeed(float speed) { + this.speed = speed; + return this; + } + + public ItemCrossbowPart addBash(float bash) { + this.bash = bash; + return this; + } + + public ItemCrossbowPart addCapacity(int capacity) { + this.capacity = capacity; + return this; + } + + public ItemCrossbowPart addDurability(int durability) { + this.durability = durability; + return this; + } + + public ItemCrossbowPart setHandCrossbow(boolean flag) { + this.isHandle = flag; + return this; + } + + @Override + public float getModifier(String type) { + if (type.equalsIgnoreCase("power")) + return power; + if (type.equalsIgnoreCase("spread")) + return spread; + if (type.equalsIgnoreCase("recoil")) + return recoil; + if (type.equalsIgnoreCase("speed")) + return speed; + if (type.equalsIgnoreCase("capacity")) + return capacity; + if (type.equalsIgnoreCase("bash")) + return bash; + if (type.equalsIgnoreCase("zoom")) + return zoom; + if (type.equalsIgnoreCase("durability")) + return durability; + return 0F; + } + + @Override + public boolean makesSmallWeapon() { + return isHandle; + } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemCrudeBomb.java b/src/main/java/minefantasy/mf2/item/gadget/ItemCrudeBomb.java index 01ed9fac..c6a17b76 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemCrudeBomb.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemCrudeBomb.java @@ -1,134 +1,105 @@ package minefantasy.mf2.item.gadget; -import java.util.ArrayList; -import java.util.List; - -import minefantasy.mf2.MineFantasyII; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.crafting.ISpecialSalvage; -import minefantasy.mf2.entity.EntityBomb; import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.mechanics.BombDispenser; -import net.minecraft.block.BlockDispenser; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; -import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; -import net.minecraft.item.ItemMonsterPlacer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemCrudeBomb extends ItemBomb implements ISpecialSalvage -{ - public ItemCrudeBomb(String name) - { - super(name); +import java.util.List; + +public class ItemCrudeBomb extends ItemBomb implements ISpecialSalvage { + private IIcon basicIcon; + + public ItemCrudeBomb(String name) { + super(name); } + @Override - public int getMaxItemUseDuration(ItemStack item) - { + public int getMaxItemUseDuration(ItemStack item) { return 20; } + @Override - public String getUnlocalizedName(ItemStack item) - { - return "item.bomb_crude"; + public String getUnlocalizedName(ItemStack item) { + return "item.bomb_crude"; } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - list.add(new ItemStack(this)); + public void getSubItems(Item item, CreativeTabs tab, List list) { + list.add(new ItemStack(this)); } - //TODO Icons + // TODO Icons @SideOnly(Side.CLIENT) - public IIcon getIcon(byte type) - { - return basicIcon; - } - private IIcon basicIcon; - + public IIcon getIcon(byte type) { + return basicIcon; + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { + public void registerIcons(IIconRegister reg) { basicIcon = reg.registerIcon("minefantasy2:Other/bomb_crude"); } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIconIndex(ItemStack item) - { - return basicIcon; + public IIcon getIconIndex(ItemStack item) { + return basicIcon; } + @Override @SideOnly(Side.CLIENT) - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 1; } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack item, int layer) { + return getIconIndex(item); + } + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack item, int layer) - { - return getIconIndex(item); + public boolean requiresMultipleRenderPasses() { + return false; + } + + @Override + public EnumRarity getRarity(ItemStack item) { + return ToolListMF.poor; } - + @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return false; + public Object[] getSalvage(ItemStack item) { + return new Object[]{Items.paper, ComponentListMF.thread, ComponentListMF.blackpowder}; } - + @Override - public EnumRarity getRarity(ItemStack item) - { - return ToolListMF.poor; - } - - @Override - public Object[] getSalvage(ItemStack item) - { - return new Object[] - { - Items.paper, ComponentListMF.thread, ComponentListMF.blackpowder - }; - } - - @Override - public byte getItemFuse(byte value) - { - return 0; - } - @Override - public byte getItemFilling(byte value) - { - return 0; - } - @Override - public byte getItemCasing(byte value) - { - return -1; - } - @Override - public byte getItemPowder(byte value) - { - return 0; - } + public byte getItemFuse(byte value) { + return 0; + } + + @Override + public byte getItemFilling(byte value) { + return 0; + } + + @Override + public byte getItemCasing(byte value) { + return -1; + } + + @Override + public byte getItemPowder(byte value) { + return 0; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemExplodingArrow.java b/src/main/java/minefantasy/mf2/item/gadget/ItemExplodingArrow.java index 549d06f3..e261c9f6 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemExplodingArrow.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemExplodingArrow.java @@ -1,14 +1,5 @@ package minefantasy.mf2.item.gadget; -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; import minefantasy.mf2.api.crafting.ISpecialSalvage; import minefantasy.mf2.entity.EntityArrowMF; import minefantasy.mf2.item.archery.ArrowType; @@ -17,79 +8,77 @@ import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.material.BaseMaterialMF; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import java.util.List; -public class ItemExplodingArrow extends ItemArrowMF implements ISpecialSalvage -{ +public class ItemExplodingArrow extends ItemArrowMF implements ISpecialSalvage { - public ItemExplodingArrow() - { - super("exploding_arrow", 1, BaseMaterialMF.iron.getToolConversion(), ArrowType.EXPLOSIVE); - setCreativeTab(CreativeTabMF.tabGadget); - setMaxStackSize(16); - } - @Override - public EntityArrowMF getFiredArrow(EntityArrowMF instance, ItemStack arrow) - { - instance = super.getFiredArrow(instance, arrow); - instance.canBePickedUp = 0; - return instance.setBombStats(ItemBomb.getPowder(arrow), ItemBomb.getFilling(arrow)); + public ItemExplodingArrow() { + super("exploding_arrow", 1, BaseMaterialMF.iron.getToolConversion(), ArrowType.EXPLOSIVE); + setCreativeTab(CreativeTabMF.tabGadget); + setMaxStackSize(16); } - - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - super.addInformation(item, user, list, fullInfo); - - if(item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) - { - list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("bomb.case.sticky") + EnumChatFormatting.GRAY); - } - EnumExplosiveType fill = EnumExplosiveType.getType(ItemBomb.getFilling(item)); - EnumPowderType powder = EnumPowderType.getType(ItemBomb.getPowder(item)); - - int damage = (int) (fill.damage*powder.damageModifier*0.5F); - float range = fill.range*powder.rangeModifier*0.5F; - - list.add(StatCollector.translateToLocal(ToolListMF.bomb_custom.getUnlocalizedName(item)+".name")); - list.add(StatCollector.translateToLocal("bomb.powder."+powder.name+".name")); - list.add(""); - list.add(StatCollector.translateToLocal("bomb.damage.name")+": "+damage); - list.add(StatCollector.translateToLocalFormatted("bomb.range.metric.name", range)); + + public static ItemStack createBombArrow(byte powder, byte filling) { + return createBombArrow(ToolListMF.exploding_arrow, powder, filling); + } + + public static ItemStack createBombArrow(Item design, byte powder, byte filling) { + ItemStack arrow = new ItemStack(design); + + ItemBomb.setFilling(arrow, filling); + ItemBomb.setPowder(arrow, powder); + + return arrow; + } + + @Override + public EntityArrowMF getFiredArrow(EntityArrowMF instance, ItemStack arrow) { + instance = super.getFiredArrow(instance, arrow); + instance.canBePickedUp = 0; + return instance.setBombStats(ItemBomb.getPowder(arrow), ItemBomb.getFilling(arrow)); } - - public static ItemStack createBombArrow(byte powder, byte filling) - { - return createBombArrow(ToolListMF.exploding_arrow, powder, filling); - } - public static ItemStack createBombArrow(Item design, byte powder, byte filling) - { - ItemStack arrow = new ItemStack(design); - - ItemBomb.setFilling(arrow, filling); - ItemBomb.setPowder(arrow, powder); - - return arrow; - } - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - for(byte pdr = 0; pdr < 2; pdr ++) - { - for(byte fill = 0; fill < 3; fill ++) - { - list.add(createBombArrow(pdr, fill)); - } - } + + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + super.addInformation(item, user, list, fullInfo); + + if (item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) { + list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("bomb.case.sticky") + + EnumChatFormatting.GRAY); + } + EnumExplosiveType fill = EnumExplosiveType.getType(ItemBomb.getFilling(item)); + EnumPowderType powder = EnumPowderType.getType(ItemBomb.getPowder(item)); + + int damage = (int) (fill.damage * powder.damageModifier * 0.5F); + float range = fill.range * powder.rangeModifier * 0.5F; + + list.add(StatCollector.translateToLocal(ToolListMF.bomb_custom.getUnlocalizedName(item) + ".name")); + list.add(StatCollector.translateToLocal("bomb.powder." + powder.name + ".name")); + list.add(""); + list.add(StatCollector.translateToLocal("bomb.damage.name") + ": " + damage); + list.add(StatCollector.translateToLocalFormatted("bomb.range.metric.name", range)); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (byte pdr = 0; pdr < 2; pdr++) { + for (byte fill = 0; fill < 3; fill++) { + list.add(createBombArrow(pdr, fill)); + } + } + } + + @Override + public Object[] getSalvage(ItemStack item) { + return new Object[]{ComponentListMF.bomb_casing_arrow, + ItemBombComponent.getBombComponent("powder", ItemBomb.getPowder(item)), + ItemBombComponent.getBombComponent("filling", ItemBomb.getFilling(item)),}; } - - @Override - public Object[] getSalvage(ItemStack item) - { - return new Object[] - { - ComponentListMF.bomb_casing_arrow, - ItemBombComponent.getBombComponent("powder", ItemBomb.getPowder(item)), - ItemBombComponent.getBombComponent("filling", ItemBomb.getFilling(item)), - }; - } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemExplodingBolt.java b/src/main/java/minefantasy/mf2/item/gadget/ItemExplodingBolt.java index 691421fa..264d10a5 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemExplodingBolt.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemExplodingBolt.java @@ -1,14 +1,5 @@ package minefantasy.mf2.item.gadget; -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; import minefantasy.mf2.api.crafting.ISpecialSalvage; import minefantasy.mf2.entity.EntityArrowMF; import minefantasy.mf2.item.archery.ArrowType; @@ -17,72 +8,69 @@ import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.material.BaseMaterialMF; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; + +import java.util.List; -public class ItemExplodingBolt extends ItemArrowMF implements ISpecialSalvage -{ +public class ItemExplodingBolt extends ItemArrowMF implements ISpecialSalvage { - public ItemExplodingBolt() - { - super("exploding_bolt", 1, BaseMaterialMF.iron.getToolConversion(), ArrowType.EXPLOSIVEBOLT); - setCreativeTab(CreativeTabMF.tabGadget); - setAmmoType("bolt"); - setMaxStackSize(20); - } - @Override - public EntityArrowMF getFiredArrow(EntityArrowMF instance, ItemStack arrow) - { - instance = super.getFiredArrow(instance, arrow); - instance.canBePickedUp = 0; - return instance.setBombStats(ItemBomb.getPowder(arrow), ItemBomb.getFilling(arrow)); + public ItemExplodingBolt() { + super("exploding_bolt", 1, BaseMaterialMF.iron.getToolConversion(), ArrowType.EXPLOSIVEBOLT); + setCreativeTab(CreativeTabMF.tabGadget); + setAmmoType("bolt"); + setMaxStackSize(20); } - - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - super.addInformation(item, user, list, fullInfo); - - EnumExplosiveType fill = EnumExplosiveType.getType(ItemBomb.getFilling(item)); - EnumPowderType powder = EnumPowderType.getType(ItemBomb.getPowder(item)); - - int damage = (int) (fill.damage*powder.damageModifier*0.5F); - float range = fill.range*powder.rangeModifier*0.5F; - - list.add(StatCollector.translateToLocal(ToolListMF.bomb_custom.getUnlocalizedName(item)+".name")); - list.add(StatCollector.translateToLocal("bomb.powder."+powder.name+".name")); - list.add(""); - list.add(StatCollector.translateToLocal("bomb.damage.name")+": "+damage); - list.add(StatCollector.translateToLocalFormatted("bomb.range.metric.name", range)); + + public static ItemStack createBombArrow(byte powder, byte filling) { + ItemStack arrow = new ItemStack(ToolListMF.exploding_bolt); + + ItemBomb.setFilling(arrow, filling); + ItemBomb.setPowder(arrow, powder); + + return arrow; } - - public static ItemStack createBombArrow(byte powder, byte filling) - { - ItemStack arrow = new ItemStack(ToolListMF.exploding_bolt); - - ItemBomb.setFilling(arrow, filling); - ItemBomb.setPowder(arrow, powder); - - return arrow; - } - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - for(byte pdr = 0; pdr < 2; pdr ++) - { - for(byte fill = 0; fill < 3; fill ++) - { - list.add(createBombArrow(pdr, fill)); - } - } + + @Override + public EntityArrowMF getFiredArrow(EntityArrowMF instance, ItemStack arrow) { + instance = super.getFiredArrow(instance, arrow); + instance.canBePickedUp = 0; + return instance.setBombStats(ItemBomb.getPowder(arrow), ItemBomb.getFilling(arrow)); + } + + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + super.addInformation(item, user, list, fullInfo); + + EnumExplosiveType fill = EnumExplosiveType.getType(ItemBomb.getFilling(item)); + EnumPowderType powder = EnumPowderType.getType(ItemBomb.getPowder(item)); + + int damage = (int) (fill.damage * powder.damageModifier * 0.5F); + float range = fill.range * powder.rangeModifier * 0.5F; + + list.add(StatCollector.translateToLocal(ToolListMF.bomb_custom.getUnlocalizedName(item) + ".name")); + list.add(StatCollector.translateToLocal("bomb.powder." + powder.name + ".name")); + list.add(""); + list.add(StatCollector.translateToLocal("bomb.damage.name") + ": " + damage); + list.add(StatCollector.translateToLocalFormatted("bomb.range.metric.name", range)); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (byte pdr = 0; pdr < 2; pdr++) { + for (byte fill = 0; fill < 3; fill++) { + list.add(createBombArrow(pdr, fill)); + } + } + } + + @Override + public Object[] getSalvage(ItemStack item) { + return new Object[]{ComponentListMF.bomb_casing_bolt, + ItemBombComponent.getBombComponent("powder", ItemBomb.getPowder(item)), + ItemBombComponent.getBombComponent("filling", ItemBomb.getFilling(item)),}; } - - @Override - public Object[] getSalvage(ItemStack item) - { - return new Object[] - { - ComponentListMF.bomb_casing_bolt, - ItemBombComponent.getBombComponent("powder", ItemBomb.getPowder(item)), - ItemBombComponent.getBombComponent("filling", ItemBomb.getFilling(item)), - }; - } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemJug.java b/src/main/java/minefantasy/mf2/item/gadget/ItemJug.java index 403984c0..d5c5ac47 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemJug.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemJug.java @@ -1,182 +1,145 @@ package minefantasy.mf2.item.gadget; -import java.util.Iterator; -import java.util.Random; - import minefantasy.mf2.api.heating.TongsHelper; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.block.decor.BlockComponent; import minefantasy.mf2.item.ItemComponentMF; import minefantasy.mf2.item.food.FoodListMF; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.util.MFLogUtil; -import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; - -public class ItemJug extends ItemComponentMF -{ - private String type; - public ItemJug(String type) - { - super("jug_"+type, 0); - setCreativeTab(CreativeTabMF.tabFood); - this.type = type; - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { - if(type.equalsIgnoreCase("uncooked")) - { - return super.onItemRightClick(item, world, player); - } - if(type.equalsIgnoreCase("empty")) - { - return rightClickEmpty(item, world, player); - } - return useFilled(item, world, player); + +import java.util.Random; + +public class ItemJug extends ItemComponentMF { + private String type; + private Random rand = new Random(); + + public ItemJug(String type) { + super("jug_" + type, 0); + setCreativeTab(CreativeTabMF.tabFood); + this.type = type; } - - @Override - public ItemStack onEaten(ItemStack item, World world, EntityPlayer user) - { - if (!world.isRemote) - { - if(type.equalsIgnoreCase("milk")) - { - curePotionEffects(user); - } - if(StaminaBar.isSystemActive) - { - StaminaBar.modifyStaminaValue(user, 10); - } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { + if (type.equalsIgnoreCase("uncooked")) { + return super.onItemRightClick(item, world, player); + } + if (type.equalsIgnoreCase("empty")) { + return rightClickEmpty(item, world, player); + } + return useFilled(item, world, player); + } + + @Override + public ItemStack onEaten(ItemStack item, World world, EntityPlayer user) { + if (!world.isRemote) { + if (type.equalsIgnoreCase("milk")) { + curePotionEffects(user); + } + if (StaminaBar.isSystemActive) { + StaminaBar.modifyStaminaValue(user, 10); + } } ItemStack container = getContainerItem(item); - if(item.stackSize > 1) - { - if (!user.capabilities.isCreativeMode) - { + if (item.stackSize > 1) { + if (!user.capabilities.isCreativeMode) { --item.stackSize; } - if(!user.inventory.addItemStackToInventory(container)) - { - user.entityDropItem(container, 0F); - } - return item; + if (!user.inventory.addItemStackToInventory(container)) { + user.entityDropItem(container, 0F); + } + return item; } return container; } - private void curePotionEffects(EntityPlayer user) - { - user.clearActivePotions(); - } + private void curePotionEffects(EntityPlayer user) { + user.clearActivePotions(); + } - /** + /** * How long it takes to use or consume an item */ - @Override - public int getMaxItemUseDuration(ItemStack item) - { + @Override + public int getMaxItemUseDuration(ItemStack item) { return 24; } /** - * returns the action that specifies what animation to play when the items is being used + * returns the action that specifies what animation to play when the items is + * being used */ - @Override - public EnumAction getItemUseAction(ItemStack item) - { + @Override + public EnumAction getItemUseAction(ItemStack item) { return EnumAction.drink; } - - private ItemStack rightClickEmpty(ItemStack item, World world, EntityPlayer player) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - if (movingobjectposition == null) - { + private ItemStack rightClickEmpty(ItemStack item, World world, EntityPlayer player) { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + + if (movingobjectposition == null) { return super.onItemRightClick(item, world, player); - } - else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int i = movingobjectposition.blockX; int j = movingobjectposition.blockY; int k = movingobjectposition.blockZ; - if (!world.canMineBlock(player, i, j, k)) - { + if (!world.canMineBlock(player, i, j, k)) { return super.onItemRightClick(item, world, player); } - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) - { + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { return super.onItemRightClick(item, world, player); } - if (isWaterSource(world, i, j, k)) - { - gather(item, world, player); - return item; + if (isWaterSource(world, i, j, k)) { + gather(item, world, player); + return item; } } return super.onItemRightClick(item, world, player); } - } + } - private Random rand = new Random(); - private void gather(ItemStack item, World world, EntityPlayer player) - { + private void gather(ItemStack item, World world, EntityPlayer player) { player.swingItem(); - if (!world.isRemote) - { - world.playSoundAtEntity(player, "random.splash", 0.125F + rand.nextFloat()/4F, 0.5F + rand.nextFloat()); + if (!world.isRemote) { + world.playSoundAtEntity(player, "random.splash", 0.125F + rand.nextFloat() / 4F, 0.5F + rand.nextFloat()); item.stackSize--; - EntityItem resultItem = new EntityItem(world, player.posX, player.posY, player.posZ, new ItemStack(FoodListMF.jug_water)); + EntityItem resultItem = new EntityItem(world, player.posX, player.posY, player.posZ, + new ItemStack(FoodListMF.jug_water)); world.spawnEntityInWorld(resultItem); } - } - - private boolean isWaterSource(World world, int i, int j, int k) - { - return TongsHelper.getWaterSource(world, i, j, k) >= 0; - } - - public ItemStack useFilled(ItemStack item, World world, EntityPlayer user) - { - if (!world.isRemote && storageType != null) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, user, false); - - if (movingobjectposition == null) - { - return item; - } - else - { - int placed = BlockComponent.useComponent(item, storageType, blocktex, world, user, movingobjectposition); - if (placed > 0) - { - item.stackSize -= placed; - return item; - } - } - } - user.setItemInUse(item, getMaxItemUseDuration(item)); - return item; - } + } + + private boolean isWaterSource(World world, int i, int j, int k) { + return TongsHelper.getWaterSource(world, i, j, k) >= 0; + } + + public ItemStack useFilled(ItemStack item, World world, EntityPlayer user) { + if (!world.isRemote && storageType != null) { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, user, false); + + if (movingobjectposition == null) { + return item; + } else { + int placed = BlockComponent.useComponent(item, storageType, blocktex, world, user, + movingobjectposition); + if (placed > 0) { + item.stackSize -= placed; + return item; + } + } + } + user.setItemInUse(item, getMaxItemUseDuration(item)); + return item; + } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemLootSack.java b/src/main/java/minefantasy/mf2/item/gadget/ItemLootSack.java index b0717e83..88ac4e62 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemLootSack.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemLootSack.java @@ -1,10 +1,8 @@ package minefantasy.mf2.item.gadget; -import java.util.Random; - +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.item.ItemComponentMF; import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; @@ -17,212 +15,221 @@ import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -import cpw.mods.fml.common.registry.GameRegistry; -public class ItemLootSack extends Item -{ - public static final String COMMON = "commonLootBag"; - public static final String VALUABLE = "valuableLootBag"; - public static final String EXQUISITE = "exquisiteLootBag"; - - protected int amount, tier; - protected String pool; - public ItemLootSack(String name, int amount, int tier) - { +import java.util.Random; + +public class ItemLootSack extends Item { + public static final String COMMON = "commonLootBag"; + public static final String VALUABLE = "valuableLootBag"; + public static final String EXQUISITE = "exquisiteLootBag"; + + protected int amount, tier; + protected String pool; + + public ItemLootSack(String name, int amount, int tier) { this.setCreativeTab(CreativeTabMF.tabGadget); this.amount = amount; this.tier = tier; pool = tier == 0 ? COMMON : tier == 1 ? VALUABLE : EXQUISITE; - setTextureName("minefantasy2:Other/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(user.isSwingInProgress)return item; - - user.swingItem(); - if (!user.capabilities.isCreativeMode) - { + setTextureName("minefantasy2:Other/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + } + + public static void addItems() { + String loot = COMMON; // Some books, Commodities + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_artisanry), 1, 1, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_construction), 1, 1, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_provisioning), 1, 1, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_engineering), 1, 1, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_combat), 1, 1, 5)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_basic), 1, 1, 10)); + + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.coal), 4, 12, 20)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(ComponentListMF.plank.construct("OakWood"), 1, 8, 20)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(ComponentListMF.bar("Iron"), 1, 4, 20)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.leather), 1, 4, 20)); + + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.string), 1, 2, 10)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(ComponentListMF.plank.construct("RefinedWood"), 1, 2, 10)); + + loot = VALUABLE; // Books, Valued commodities + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_artisanry), 1, 3, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_construction), 1, 3, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_provisioning), 1, 3, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_engineering), 1, 3, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_combat), 1, 3, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_advanced), 1, 1, 2)); + + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ComponentListMF.kaolinite), 1, 8, 10)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.dye, 1, 4), 1, 8, 20)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(ComponentListMF.bar("Gold"), 1, 4, 20)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(ComponentListMF.bar("Silver"), 1, 4, 20));// Silver + + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.diamond), 1, 2, 10)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.emerald), 1, 2, 10)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.ender_pearl), 1, 2, 10)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 4, 10)); + addRecords(loot, 2); + + loot = EXQUISITE; // Many books, Highly sought commodities + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_artisanry), 2, 5, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_construction), 2, 5, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_provisioning), 2, 5, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_engineering), 2, 5, 5)); + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_combat), 2, 5, 5)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_ornate), 1, 1, 5)); + + ChestGenHooks.addItem(loot, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.flux_strong), 12, 32, 20)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.diamond), 4, 8, 20)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.emerald), 4, 8, 20)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.ender_eye), 4, 8, 20)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(ComponentListMF.bar("Silver"), 1, 4, 20));// Wolframite + + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.golden_apple, 1, 1), 1, 1, 10)); + addRecords(loot, 5); + + } + + private static void addRecords(String loot, int rarity) { + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_11), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_13), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_blocks), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_cat), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_chirp), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_far), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_mall), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_mellohi), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_stal), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_strad), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_wait), 1, 1, rarity)); + ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_ward), 1, 1, rarity)); + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (user.isSwingInProgress) + return item; + + user.swingItem(); + if (!user.capabilities.isCreativeMode) { --item.stackSize; } - user.playSound("mob.horse.leather", 1.0F, 1.5F); - - if(!world.isRemote) - { - ChestGenHooks gen = ChestGenHooks.getInfo(pool); - IInventory inv = new Loot(amount); - Random rand = new Random(); - WeightedRandomChestContent.generateChestContents(rand, gen.getItems(rand), inv, 1 + rand.nextInt(amount)); - for(int a = 0; a < inv.getSizeInventory(); a++) - { - if(inv.getStackInSlot(a) != null) - { - ItemStack drop = inv.getStackInSlot(a); - if(!user.inventory.addItemStackToInventory(drop)) - { - user.entityDropItem(drop, 0F); - } - } - } - } - return item; - } - @Override - public EnumRarity getRarity(ItemStack item) - { - return tier == 0 ? EnumRarity.common : tier == 1 ? EnumRarity.uncommon : EnumRarity.epic; + user.playSound("mob.horse.leather", 1.0F, 1.5F); + + if (!world.isRemote) { + ChestGenHooks gen = ChestGenHooks.getInfo(pool); + IInventory inv = new Loot(amount); + Random rand = new Random(); + WeightedRandomChestContent.generateChestContents(rand, gen.getItems(rand), inv, 1 + rand.nextInt(amount)); + for (int a = 0; a < inv.getSizeInventory(); a++) { + if (inv.getStackInSlot(a) != null) { + ItemStack drop = inv.getStackInSlot(a); + if (!user.inventory.addItemStackToInventory(drop)) { + user.entityDropItem(drop, 0F); + } + } + } + } + return item; + } + + @Override + public EnumRarity getRarity(ItemStack item) { + return tier == 0 ? EnumRarity.common : tier == 1 ? EnumRarity.uncommon : EnumRarity.epic; + } + + public static class Loot implements IInventory { + public ItemStack[] contents; + + public Loot(int count) { + contents = new ItemStack[count]; + } + + @Override + public int getSizeInventory() { + return contents.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return contents[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int num) { + contents[slot].stackSize -= num; + return contents[slot]; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return null; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack item) { + contents[slot] = item; + } + + @Override + public String getInventoryName() { + return null; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public void markDirty() { + // TODO Auto-generated method stub + + } + + @Override + public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { + return false; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { + return false; + } + } - - public static class Loot implements IInventory - { - public ItemStack[] contents; - public Loot(int count) - { - contents = new ItemStack[count]; - } - @Override - public int getSizeInventory() - { - return contents.length; - } - - @Override - public ItemStack getStackInSlot(int slot) { - return contents[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int num) - { - contents[slot].stackSize -= num; - return contents[slot]; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - return null; - } - - @Override - public void setInventorySlotContents(int slot, - ItemStack item) { - contents[slot] = item; - } - - @Override - public String getInventoryName() - { - return null; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public void markDirty() { - // TODO Auto-generated method stub - - } - - @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { - return false; - } - - @Override - public void openInventory() { - } - - @Override - public void closeInventory() { - } - - @Override - public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { - return false; - } - - } - public static void addItems() - { - String loot = COMMON; //Some books, Commodities - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_artisanry), 1, 1, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_construction), 1, 1, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_provisioning), 1, 1, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_engineering), 1, 1, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_combat), 1, 1, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_basic), 1, 1, 10)); - - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.coal), 4, 12, 20)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(((ItemComponentMF)ComponentListMF.plank).construct("OakWood"), 1, 8, 20)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(ComponentListMF.bar("Iron"), 1, 4, 20)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.leather), 1, 4, 20)); - - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.string), 1, 2, 10)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), 1, 2, 10)); - - - loot = VALUABLE; //Books, Valued commodities - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_artisanry), 1, 3, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_construction), 1, 3, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_provisioning), 1, 3, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_engineering), 1, 3, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_combat), 1, 3, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_advanced), 1, 1, 2)); - - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ComponentListMF.kaolinite), 1, 8, 10)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.dye, 1, 4), 1, 8, 20)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(ComponentListMF.bar("Gold"), 1, 4, 20)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(ComponentListMF.bar("Silver"), 1, 4, 20));//Silver - - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.diamond), 1, 2, 10)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.emerald), 1, 2, 10)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.ender_pearl), 1, 2, 10)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 4, 10)); - addRecords(loot, 2); - - loot = EXQUISITE; //Many books, Highly sought commodities - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_artisanry), 2, 5, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_construction), 2, 5, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_provisioning), 2, 5, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_engineering), 2, 5, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ToolListMF.skillbook_combat), 2, 5, 5)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_ornate), 1, 1, 5)); - - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(ComponentListMF.flux_strong), 12, 32, 20)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.diamond), 4, 8, 20)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.emerald), 4, 8, 20)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.ender_eye), 4, 8, 20)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(ComponentListMF.bar("Silver"), 1, 4, 20));//Wolframite - - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.golden_apple, 1, 1), 1, 1, 10)); - addRecords(loot, 5); - - } - - private static void addRecords(String loot, int rarity) - { - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_11), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_13), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_blocks), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_cat), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_chirp), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_far), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_mall), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_mellohi), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_stal), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_strad), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_wait), 1, 1, rarity)); - ChestGenHooks.addItem(loot, new WeightedRandomChestContent(new ItemStack(Items.record_ward), 1, 1, rarity)); - } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemMine.java b/src/main/java/minefantasy/mf2/item/gadget/ItemMine.java index 1bc74957..e9c43c1b 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemMine.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemMine.java @@ -1,7 +1,5 @@ package minefantasy.mf2.item.gadget; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,259 +23,233 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class ItemMine extends Item implements ISpecialSalvage, IAmmo -{ - public ItemMine(String name) - { - this.maxStackSize = 16; +import java.util.List; + +public class ItemMine extends Item implements ISpecialSalvage, IAmmo { + private static final String powderNBT = "MineFantasy_PowderType"; + private static final String fuseNBT = "MineFantasy_FuseType"; + private static final String fillingNBT = "MineFantasy_ExplosiveType"; + private static final String casingNBT = "MineFantasy_CaseType"; + private IIcon[] mines = new IIcon[4]; + + public ItemMine(String name) { + this.maxStackSize = 16; this.setCreativeTab(CreativeTabMF.tabGadget); - setTextureName("minefantasy2:Other/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - BlockDispenser.dispenseBehaviorRegistry.putObject(this, new BombDispenser()); + setTextureName("minefantasy2:Other/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, new BombDispenser()); + } + + public static void setFuse(ItemStack item, byte fuse) { + NBTTagCompound nbt = getNBT(item); + nbt.setByte(fuseNBT, fuse); + } + + public static byte getFuse(ItemStack item) { + NBTTagCompound nbt = getNBT(item); + if (nbt.hasKey(fuseNBT)) { + return nbt.getByte(fuseNBT); + } + return (byte) 0; + } + + public static void setPowder(ItemStack item, byte powder) { + NBTTagCompound nbt = getNBT(item); + nbt.setByte(powderNBT, powder); + } + + public static byte getPowder(ItemStack item) { + NBTTagCompound nbt = getNBT(item); + if (nbt.hasKey(powderNBT)) { + return nbt.getByte(powderNBT); + } + return (byte) 0; + } + + /** + * 0 = Basic 1 = Shrapnel 2 = Fire + */ + public static void setFilling(ItemStack item, byte filling) { + NBTTagCompound nbt = getNBT(item); + nbt.setByte(fillingNBT, filling); + } + + public static byte getFilling(ItemStack item) { + NBTTagCompound nbt = getNBT(item); + if (nbt.hasKey(fillingNBT)) { + return nbt.getByte(fillingNBT); + } + return (byte) 0; + } + + /** + * 0 = Ceramic 1 = Iron + */ + public static void setCasing(ItemStack item, byte casing) { + NBTTagCompound nbt = getNBT(item); + nbt.setByte(casingNBT, casing); + } + + public static byte getCasing(ItemStack item) { + NBTTagCompound nbt = getNBT(item); + if (nbt.hasKey(casingNBT)) { + return nbt.getByte(casingNBT); + } + return (byte) 0; + } + + public static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) + item.setTagCompound(new NBTTagCompound()); + return item.getTagCompound(); } @Override - public EnumAction getItemUseAction(ItemStack item) - { + public EnumAction getItemUseAction(ItemStack item) { return EnumAction.block; } - + @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(!user.isSwingInProgress) - { - world.playSoundEffect(user.posX, user.posY + 1.5D, user.posZ, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - user.setItemInUse(item, getMaxItemUseDuration(item)); - } - return item; + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (!user.isSwingInProgress) { + world.playSoundEffect(user.posX, user.posY + 1.5D, user.posZ, "fire.ignite", 1.0F, + itemRand.nextFloat() * 0.4F + 0.8F); + user.setItemInUse(item, getMaxItemUseDuration(item)); + } + return item; } + @Override - public int getMaxItemUseDuration(ItemStack item) - { + public int getMaxItemUseDuration(ItemStack item) { return 35; } + @Override - public ItemStack onEaten(ItemStack item, World world, EntityPlayer user) - { - world.playSoundEffect(user.posX, user.posY+1.5, user.posZ, "random.click", 1.0F, 1.0F); - user.swingItem(); - if (!user.capabilities.isCreativeMode) - { + public ItemStack onEaten(ItemStack item, World world, EntityPlayer user) { + world.playSoundEffect(user.posX, user.posY + 1.5, user.posZ, "random.click", 1.0F, 1.0F); + user.swingItem(); + if (!user.capabilities.isCreativeMode) { --item.stackSize; } - if (!world.isRemote) - { - world.spawnEntityInWorld(new EntityMine(world, user).setType(getFilling(item), getCasing(item), getFuse(item), getPowder(item))); + if (!world.isRemote) { + world.spawnEntityInWorld(new EntityMine(world, user).setType(getFilling(item), getCasing(item), + getFuse(item), getPowder(item))); } return item; } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) - { - super.addInformation(item, user, list, fullInfo); - - EnumExplosiveType fill = EnumExplosiveType.getType(getFilling(item)); - EnumCasingType casing = EnumCasingType.getType(getCasing(item)); - EnumFuseType fuse = EnumFuseType.getType(getFuse(item)); - EnumPowderType powder = EnumPowderType.getType(getPowder(item)); - - int damage = (int) (fill.damage*casing.damageModifier*powder.damageModifier); - float range = fill.range*casing.rangeModifier*powder.rangeModifier; - float fusetime = (float)fuse.time/20F; - - list.add(StatCollector.translateToLocal("bomb.case."+casing.name+".name")); - list.add(StatCollector.translateToLocal("bomb.powder."+powder.name+".name")); - list.add(StatCollector.translateToLocal("bomb.fuse."+fuse.name+".name")); - list.add(""); - list.add(StatCollector.translateToLocalFormatted("bomb.fusetime.name", fusetime)); - list.add(StatCollector.translateToLocal("bomb.damage.name")+": "+damage); - list.add(StatCollector.translateToLocalFormatted("bomb.range.metric.name", range)); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean fullInfo) { + super.addInformation(item, user, list, fullInfo); + + EnumExplosiveType fill = EnumExplosiveType.getType(getFilling(item)); + EnumCasingType casing = EnumCasingType.getType(getCasing(item)); + EnumFuseType fuse = EnumFuseType.getType(getFuse(item)); + EnumPowderType powder = EnumPowderType.getType(getPowder(item)); + + int damage = (int) (fill.damage * casing.damageModifier * powder.damageModifier); + float range = fill.range * casing.rangeModifier * powder.rangeModifier; + float fusetime = fuse.time / 20F; + + list.add(StatCollector.translateToLocal("bomb.case." + casing.name + ".name")); + list.add(StatCollector.translateToLocal("bomb.powder." + powder.name + ".name")); + list.add(StatCollector.translateToLocal("bomb.fuse." + fuse.name + ".name")); + list.add(""); + list.add(StatCollector.translateToLocalFormatted("bomb.fusetime.name", fusetime)); + list.add(StatCollector.translateToLocal("bomb.damage.name") + ": " + damage); + list.add(StatCollector.translateToLocalFormatted("bomb.range.metric.name", range)); } + @Override - public String getUnlocalizedName(ItemStack item) - { - EnumExplosiveType type = EnumExplosiveType.getType(getFilling(item)); - return "item.mine_"+type.name; - } - private static final String powderNBT = "MineFantasy_PowderType"; - private static final String fuseNBT = "MineFantasy_FuseType"; - private static final String fillingNBT = "MineFantasy_ExplosiveType"; - private static final String casingNBT = "MineFantasy_CaseType"; - - - public static void setFuse(ItemStack item, byte fuse) - { - NBTTagCompound nbt = getNBT(item); - nbt.setByte(fuseNBT, fuse); - } - public static byte getFuse(ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - if(nbt.hasKey(fuseNBT)) - { - return nbt.getByte(fuseNBT); - } - return (byte)0; - } - - public static void setPowder(ItemStack item, byte powder) - { - NBTTagCompound nbt = getNBT(item); - nbt.setByte(powderNBT, powder); - } - public static byte getPowder(ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - if(nbt.hasKey(powderNBT)) - { - return nbt.getByte(powderNBT); - } - return (byte)0; - } - /** - * 0 = Basic - * 1 = Shrapnel - * 2 = Fire - */ - public static void setFilling(ItemStack item, byte filling) - { - NBTTagCompound nbt = getNBT(item); - nbt.setByte(fillingNBT, filling); - } - public static byte getFilling(ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - if(nbt.hasKey(fillingNBT)) - { - return nbt.getByte(fillingNBT); - } - return (byte)0; - } - - /** - * 0 = Ceramic - * 1 = Iron - */ - public static void setCasing(ItemStack item, byte casing) - { - NBTTagCompound nbt = getNBT(item); - nbt.setByte(casingNBT, casing); - } - public static byte getCasing(ItemStack item) - { - NBTTagCompound nbt = getNBT(item); - if(nbt.hasKey(casingNBT)) - { - return nbt.getByte(casingNBT); - } - return (byte)0; - } - - public static NBTTagCompound getNBT(ItemStack item) - { - if(!item.hasTagCompound())item.setTagCompound(new NBTTagCompound()); - return item.getTagCompound(); + public String getUnlocalizedName(ItemStack item) { + EnumExplosiveType type = EnumExplosiveType.getType(getFilling(item)); + return "item.mine_" + type.name; } - - public ItemStack createMine(byte casing, byte filling, byte fuse, byte powder, int stackSize) - { - return ItemBomb.createExplosive(this, casing, filling, fuse, powder, stackSize); + + public ItemStack createMine(byte casing, byte filling, byte fuse, byte powder, int stackSize) { + return ItemBomb.createExplosive(this, casing, filling, fuse, powder, stackSize); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - list.add(createMine((byte)0, (byte)0, (byte)0, (byte)0, 1)); - list.add(createMine((byte)0, (byte)1, (byte)0, (byte)0, 1)); - list.add(createMine((byte)0, (byte)2, (byte)0, (byte)0, 1)); - - list.add(createMine((byte)1, (byte)0, (byte)0, (byte)0, 1)); - list.add(createMine((byte)1, (byte)1, (byte)0, (byte)0, 1)); - list.add(createMine((byte)1, (byte)2, (byte)0, (byte)0, 1)); - - list.add(createMine((byte)2, (byte)0, (byte)0, (byte)0, 1)); - list.add(createMine((byte)2, (byte)1, (byte)0, (byte)0, 1)); - list.add(createMine((byte)2, (byte)2, (byte)0, (byte)0, 1)); - - list.add(createMine((byte)3, (byte)0, (byte)0, (byte)0, 1)); - list.add(createMine((byte)3, (byte)1, (byte)0, (byte)0, 1)); - list.add(createMine((byte)3, (byte)2, (byte)0, (byte)0, 1)); + public void getSubItems(Item item, CreativeTabs tab, List list) { + list.add(createMine((byte) 0, (byte) 0, (byte) 0, (byte) 0, 1)); + list.add(createMine((byte) 0, (byte) 1, (byte) 0, (byte) 0, 1)); + list.add(createMine((byte) 0, (byte) 2, (byte) 0, (byte) 0, 1)); + + list.add(createMine((byte) 1, (byte) 0, (byte) 0, (byte) 0, 1)); + list.add(createMine((byte) 1, (byte) 1, (byte) 0, (byte) 0, 1)); + list.add(createMine((byte) 1, (byte) 2, (byte) 0, (byte) 0, 1)); + + list.add(createMine((byte) 2, (byte) 0, (byte) 0, (byte) 0, 1)); + list.add(createMine((byte) 2, (byte) 1, (byte) 0, (byte) 0, 1)); + list.add(createMine((byte) 2, (byte) 2, (byte) 0, (byte) 0, 1)); + + list.add(createMine((byte) 3, (byte) 0, (byte) 0, (byte) 0, 1)); + list.add(createMine((byte) 3, (byte) 1, (byte) 0, (byte) 0, 1)); + list.add(createMine((byte) 3, (byte) 2, (byte) 0, (byte) 0, 1)); } - //TODO Icons + // TODO Icons @SideOnly(Side.CLIENT) - public IIcon getIcon(byte type) - { - return mines[type]; - } - private IIcon[] mines = new IIcon[4]; - + public IIcon getIcon(byte type) { + return mines[type]; + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { + public void registerIcons(IIconRegister reg) { this.itemIcon = mines[0] = reg.registerIcon("minefantasy2:Other/mine_ceramic"); mines[1] = reg.registerIcon("minefantasy2:Other/mine_iron"); mines[2] = reg.registerIcon("minefantasy2:Other/mine_obsidian"); mines[3] = reg.registerIcon("minefantasy2:Other/mine_crystal"); } - + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconIndex(ItemStack item) { + int type = getCasing(item); + return mines[type]; + } + @Override @SideOnly(Side.CLIENT) - public IIcon getIconIndex(ItemStack item) - { - int type = getCasing(item); - return mines[type]; + public IIcon getIcon(ItemStack item, int layer) { + if (layer > 0) { + int type = getFilling(item); + if (type != 0) { + return ToolListMF.bomb_custom.icons[type - 1]; + } + } + return getIconIndex(item); } + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack item, int layer) - { - if(layer > 0) - { - int type = getFilling(item); - if(type != 0) - { - return ToolListMF.bomb_custom.icons[type-1]; - } - } - return getIconIndex(item); + public boolean requiresMultipleRenderPasses() { + return true; } - + @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; + public EnumRarity getRarity(ItemStack item) { + if (getFilling(item) >= 2 || getCasing(item) >= 2) { + return EnumRarity.uncommon; + } + return EnumRarity.common; } - + @Override - public EnumRarity getRarity(ItemStack item) - { - if(getFilling(item) >= 2 || getCasing(item) >= 2) - { - return EnumRarity.uncommon; - } - return EnumRarity.common; + public Object[] getSalvage(ItemStack item) { + return new Object[]{ItemBombComponent.getBombComponent("minecase", getCasing(item)), + ItemBombComponent.getBombComponent("fuse", getFuse(item)), + ItemBombComponent.getBombComponent("powder", getPowder(item)), + ItemBombComponent.getBombComponent("filling", getFilling(item)),}; } + @Override - public Object[] getSalvage(ItemStack item) - { - return new Object[] - { - ItemBombComponent.getBombComponent("minecase", getCasing(item)), - ItemBombComponent.getBombComponent("fuse", getFuse(item)), - ItemBombComponent.getBombComponent("powder", getPowder(item)), - ItemBombComponent.getBombComponent("filling", getFilling(item)), - }; - } - - @Override - public String getAmmoType(ItemStack arrow) { - return "mine"; - } + public String getAmmoType(ItemStack arrow) { + return "mine"; + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemParachute.java b/src/main/java/minefantasy/mf2/item/gadget/ItemParachute.java index 22a46ca3..12d416ee 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemParachute.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemParachute.java @@ -9,29 +9,25 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class ItemParachute extends Item -{ - public ItemParachute() - { - String name = "parachute"; +public class ItemParachute extends Item { + public ItemParachute() { + String name = "parachute"; this.maxStackSize = 1; this.setCreativeTab(CreativeTabMF.tabGadget); - setTextureName("minefantasy2:Other/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); + setTextureName("minefantasy2:Other/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(!world.isRemote) - { - world.playSoundAtEntity(user, "mob.horse.leather", 1.0F, 0.5F); - EntityParachute chute = new EntityParachute(world, user.posX, user.posY, user.posZ); - world.spawnEntityInWorld(chute); - user.mountEntity(chute); - --item.stackSize; - } - return item; + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (!world.isRemote) { + world.playSoundAtEntity(user, "mob.horse.leather", 1.0F, 0.5F); + EntityParachute chute = new EntityParachute(world, user.posX, user.posY, user.posZ); + world.spawnEntityInWorld(chute); + user.mountEntity(chute); + --item.stackSize; + } + return item; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemSpyglass.java b/src/main/java/minefantasy/mf2/item/gadget/ItemSpyglass.java index 6bb7f0e8..db8bf9c6 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemSpyglass.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemSpyglass.java @@ -13,74 +13,66 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class ItemSpyglass extends Item implements IScope -{ - public ItemSpyglass() - { - this.setCreativeTab(CreativeTabMF.tabGadget); +public class ItemSpyglass extends Item implements IScope { + public IIcon[] icons = new IIcon[3]; + + public ItemSpyglass() { + this.setCreativeTab(CreativeTabMF.tabGadget); setTextureName("minefantasy2:Other/spyglass_small"); - GameRegistry.registerItem(this, "spyglass", MineFantasyII.MODID); - this.setUnlocalizedName("spyglass"); - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setMaxStackSize(1); - } - @Override - public EnumAction getItemUseAction(ItemStack item) - { + GameRegistry.registerItem(this, "spyglass", MineFantasyII.MODID); + this.setUnlocalizedName("spyglass"); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setMaxStackSize(1); + } + + @Override + public EnumAction getItemUseAction(ItemStack item) { return EnumAction.bow; } - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(user.isSneaking()) - { - world.playSoundEffect(user.posX, user.posY + 1.5D, user.posZ, "random.click", 1.0F, 1.5F); - toggleMode(item); - user.swingItem(); - } - else - { - user.setItemInUse(item, getMaxItemUseDuration(item)); - } - return item; + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (user.isSneaking()) { + world.playSoundEffect(user.posX, user.posY + 1.5D, user.posZ, "random.click", 1.0F, 1.5F); + toggleMode(item); + user.swingItem(); + } else { + user.setItemInUse(item, getMaxItemUseDuration(item)); + } + return item; + } + + private void toggleMode(ItemStack item) { + int dam = item.getItemDamage(); + item.setItemDamage(dam == 2 ? 0 : dam + 1); } - private void toggleMode(ItemStack item) - { - int dam = item.getItemDamage(); - item.setItemDamage(dam == 2 ? 0 : dam+1); - } - @Override - public int getMaxItemUseDuration(ItemStack item) - { + + @Override + public int getMaxItemUseDuration(ItemStack item) { return Integer.MAX_VALUE; } - - public IIcon[] icons = new IIcon[3]; - @Override + + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - icons[0] = reg.registerIcon("minefantasy2:Other/spyglass_small"); - icons[1] = reg.registerIcon("minefantasy2:Other/spyglass_medium"); + public void registerIcons(IIconRegister reg) { + icons[0] = reg.registerIcon("minefantasy2:Other/spyglass_small"); + icons[1] = reg.registerIcon("minefantasy2:Other/spyglass_medium"); icons[2] = reg.registerIcon("minefantasy2:Other/spyglass_long"); } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int id) - { - if(id > 2) - { - id = 2; - } - return icons[id]; + public IIcon getIconFromDamage(int id) { + if (id > 2) { + id = 2; + } + return icons[id]; } - + @Override - public float getZoom(ItemStack item) - { - int id = item.getItemDamage(); - return 0.5F + (0.25F* id); + public float getZoom(ItemStack item) { + int id = item.getItemDamage(); + return 0.5F + (0.25F * id); } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/ItemSyringe.java b/src/main/java/minefantasy/mf2/item/gadget/ItemSyringe.java index b3f58a8a..7e6fa229 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/ItemSyringe.java +++ b/src/main/java/minefantasy/mf2/item/gadget/ItemSyringe.java @@ -1,13 +1,7 @@ package minefantasy.mf2.item.gadget; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -30,204 +24,172 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class ItemSyringe extends ItemPotion -{ - public ItemSyringe() - { - super(); - this.setMaxStackSize(16); - String name = "syringe"; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class ItemSyringe extends ItemPotion { + private static final Map potionMap = new LinkedHashMap(); + private IIcon icon, fill; + + public ItemSyringe() { + super(); + this.setMaxStackSize(16); + String name = "syringe"; this.setCreativeTab(CreativeTabMF.tabGadget); - setTextureName("minefantasy2:Other/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); + setTextureName("minefantasy2:Other/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } - + @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 0, 0)); - - return map; - } + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", 0, 0)); + + return map; + } + @Override - public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase user) - { - World world = user.worldObj; - - target.playSound("random.drink", 1.0F, 2.0F); - target.playSound("minefantasy2:weapon.hit.blade.metal", 1.0F, 1.5F); - if (!world.isRemote) - { + public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase user) { + World world = user.worldObj; + + target.playSound("random.drink", 1.0F, 2.0F); + target.playSound("minefantasy2:weapon.hit.blade.metal", 1.0F, 1.5F); + if (!world.isRemote) { apply(target, item); } - if (user instanceof EntityPlayer && !((EntityPlayer)user).capabilities.isCreativeMode) - { + if (user instanceof EntityPlayer && !((EntityPlayer) user).capabilities.isCreativeMode) { --item.stackSize; - - if (item.stackSize <= 0) - { + + if (item.stackSize <= 0) { user.setCurrentItemOrArmor(0, new ItemStack(ToolListMF.syringe_empty)); - } - else - { - if(!((EntityPlayer)user).inventory.addItemStackToInventory(new ItemStack(ToolListMF.syringe_empty))) - { - user.entityDropItem(new ItemStack(ToolListMF.syringe_empty), 0F); - } + } else { + if (!((EntityPlayer) user).inventory.addItemStackToInventory(new ItemStack(ToolListMF.syringe_empty))) { + user.entityDropItem(new ItemStack(ToolListMF.syringe_empty), 0F); + } } } - + return true; } - + @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) - { - if(user.isSwingInProgress) - { - return item; - } - user.swingItem(); - - if (!user.capabilities.isCreativeMode) - { - --item.stackSize; - } - - user.playSound("random.drink", 1.0F, 2.0F); - user.playSound("minefantasy2:weapon.hit.blade.metal", 1.0F, 1.5F); - if (!world.isRemote) - { - apply(user, item); - } - - if (!user.capabilities.isCreativeMode) - { - if (item.stackSize <= 0) - { - return new ItemStack(ToolListMF.syringe_empty); - } - - if(!user.inventory.addItemStackToInventory(new ItemStack(ToolListMF.syringe_empty))) - { - user.entityDropItem(new ItemStack(ToolListMF.syringe_empty), 0F); - } - } - - return item; + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer user) { + if (user.isSwingInProgress) { + return item; + } + user.swingItem(); + + if (!user.capabilities.isCreativeMode) { + --item.stackSize; + } + + user.playSound("random.drink", 1.0F, 2.0F); + user.playSound("minefantasy2:weapon.hit.blade.metal", 1.0F, 1.5F); + if (!world.isRemote) { + apply(user, item); + } + + if (!user.capabilities.isCreativeMode) { + if (item.stackSize <= 0) { + return new ItemStack(ToolListMF.syringe_empty); + } + + if (!user.inventory.addItemStackToInventory(new ItemStack(ToolListMF.syringe_empty))) { + user.entityDropItem(new ItemStack(ToolListMF.syringe_empty), 0F); + } + } + + return item; } - private void apply(EntityLivingBase target, ItemStack item) - { - List list = this.getEffects(item); - if (list != null) - { + private void apply(EntityLivingBase target, ItemStack item) { + List list = this.getEffects(item); + + if (list != null) { Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { - PotionEffect potioneffect = (PotionEffect)iterator.next(); + while (iterator.hasNext()) { + PotionEffect potioneffect = (PotionEffect) iterator.next(); target.addPotionEffect(new PotionEffect(potioneffect)); } } - } - private IIcon icon, fill; + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { + public void registerIcons(IIconRegister reg) { this.icon = reg.registerIcon(this.getIconString()); this.fill = reg.registerIcon(this.getIconString() + "_" + "fill"); } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int p_77617_1_) - { + public IIcon getIconFromDamage(int p_77617_1_) { return icon; } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) - { + public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) { return p_77618_2_ == 0 ? fill : super.getIconFromDamageForRenderPass(p_77618_1_, p_77618_2_); } - + @Override - public String getItemStackDisplayName(ItemStack item) - { - if (item.getItemDamage() == 0) - { + public String getItemStackDisplayName(ItemStack item) { + if (item.getItemDamage() == 0) { return StatCollector.translateToLocal("item.syringe_empty.name"); - } - else - { + } else { String s = ""; List list = Items.potionitem.getEffects(item); String s1; - if (list != null && !list.isEmpty()) - { - s1 = ((PotionEffect)list.get(0)).getEffectName(); + if (list != null && !list.isEmpty()) { + s1 = ((PotionEffect) list.get(0)).getEffectName(); s1 = s1 + ".postfix"; return s + StatCollector.translateToLocal(s1).trim(); - } - else - { + } else { s1 = PotionHelper.func_77905_c(item.getItemDamage()); return StatCollector.translateToLocal(s1).trim() + " " + super.getItemStackDisplayName(item); } } } - private static final Map potionMap = new LinkedHashMap(); + @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List list) - { + public void getSubItems(Item item, CreativeTabs tab, List list) { int sub; - if (potionMap.isEmpty()) - { - for (int i = 0; i <= 15; ++i) - { - for (sub = 0; sub <= 0; ++sub) - { + if (potionMap.isEmpty()) { + for (int i = 0; i <= 15; ++i) { + for (sub = 0; sub <= 0; ++sub) { int k; - if (sub == 0) - { + if (sub == 0) { k = i | 8192; - } - else - { + } else { k = i | 16384; } - for (int l = 0; l <= 2; ++l) - { + for (int l = 0; l <= 2; ++l) { int i1 = k; - if (l != 0) - { - if (l == 1) - { + if (l != 0) { + if (l == 1) { i1 = k | 32; - } - else if (l == 2) - { + } else if (l == 2) { i1 = k | 64; } } List list1 = PotionHelper.getPotionEffects(i1, false); - if (list1 != null && !list1.isEmpty() && !ItemPotion.isSplash(i1)) - { + if (list1 != null && !list1.isEmpty() && !ItemPotion.isSplash(i1)) { potionMap.put(list1, Integer.valueOf(i1)); } } @@ -237,9 +199,8 @@ else if (l == 2) Iterator iterator = potionMap.values().iterator(); - while (iterator.hasNext()) - { - sub = ((Integer)iterator.next()).intValue(); + while (iterator.hasNext()) { + sub = ((Integer) iterator.next()).intValue(); list.add(new ItemStack(item, 1, sub)); } } diff --git a/src/main/java/minefantasy/mf2/item/gadget/MobSpawnerMF.java b/src/main/java/minefantasy/mf2/item/gadget/MobSpawnerMF.java index e909b342..6873b5a5 100644 --- a/src/main/java/minefantasy/mf2/item/gadget/MobSpawnerMF.java +++ b/src/main/java/minefantasy/mf2/item/gadget/MobSpawnerMF.java @@ -1,15 +1,13 @@ package minefantasy.mf2.item.gadget; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.entity.EntityCogwork; -import minefantasy.mf2.entity.mob.*; +import minefantasy.mf2.entity.mob.EntityDragon; +import minefantasy.mf2.entity.mob.EntityHound; +import minefantasy.mf2.entity.mob.EntityMinotaur; import minefantasy.mf2.item.ItemComponentMF; -import minefantasy.mf2.item.list.CreativeTabMF; import net.minecraft.block.Block; -import net.minecraft.block.BlockLiquid; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -17,80 +15,71 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Facing; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class MobSpawnerMF extends ItemComponentMF -{ - public String[] types = new String[]{"dragon", "minotaur", "hound", "cogwork"}; - public IIcon[] icons; - public MobSpawnerMF() - { - super("MF_Spawner"); - this.setHasSubtypes(true); - this.setCreativeTab(CreativeTabs.tabMisc); - } - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - list.add(StatCollector.translateToLocal("item.spawn_"+types[Math.min(types.length-1, item.getItemDamage())]+".desc")); - } - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - for(int i = 0; i < types.length; i ++) - { - list.add(new ItemStack(item, 1, i)); - } +import java.util.List; + +public class MobSpawnerMF extends ItemComponentMF { + public String[] types = new String[]{"dragon", "minotaur", "hound", "cogwork"}; + public IIcon[] icons; + + public MobSpawnerMF() { + super("MF_Spawner"); + this.setHasSubtypes(true); + this.setCreativeTab(CreativeTabs.tabMisc); } - - @Override + + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - return StatCollector.translateToLocal("item.spawn_"+types[Math.min(types.length-1, item.getItemDamage())]+".name"); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + list.add(StatCollector + .translateToLocal("item.spawn_" + types[Math.min(types.length - 1, item.getItemDamage())] + ".desc")); } - - @Override - public boolean onItemUse(ItemStack item, EntityPlayer user, World world, int blockX, int blockY, int blockZ, int face, float ox, float oy, float oz) - { - if (world.isRemote) - { - return true; + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < types.length; i++) { + list.add(new ItemStack(item, 1, i)); } - else - { + } + + @Override + @SideOnly(Side.CLIENT) + public String getItemStackDisplayName(ItemStack item) { + return StatCollector + .translateToLocal("item.spawn_" + types[Math.min(types.length - 1, item.getItemDamage())] + ".name"); + } + + @Override + public boolean onItemUse(ItemStack item, EntityPlayer user, World world, int blockX, int blockY, int blockZ, + int face, float ox, float oy, float oz) { + if (world.isRemote) { + return true; + } else { Block block = world.getBlock(blockX, blockY, blockZ); blockX += Facing.offsetsXForSide[face]; blockY += Facing.offsetsYForSide[face]; blockZ += Facing.offsetsZForSide[face]; double d0 = 0.0D; - if (face == 1 && block.getRenderType() == 11) - { + if (face == 1 && block.getRenderType() == 11) { d0 = 0.5D; } - Entity entity = spawnCreature(world, item.getItemDamage(), (double)blockX + 0.5D, (double)blockY + d0, (double)blockZ + 0.5D); + Entity entity = spawnCreature(world, item.getItemDamage(), blockX + 0.5D, blockY + d0, blockZ + 0.5D); - if (entity != null) - { - if (entity instanceof EntityLivingBase && item.hasDisplayName()) - { - ((EntityLiving)entity).setCustomNameTag(item.getDisplayName()); + if (entity != null) { + if (entity instanceof EntityLivingBase && item.hasDisplayName()) { + ((EntityLiving) entity).setCustomNameTag(item.getDisplayName()); } - if (!user.capabilities.isCreativeMode) - { + if (!user.capabilities.isCreativeMode) { --item.stackSize; } } @@ -99,52 +88,52 @@ public boolean onItemUse(ItemStack item, EntityPlayer user, World world, int blo } } - private Entity spawnCreature(World world, int itemDamage, double x, double y, double z) - { - EntityLivingBase entityliving = getLiving(world, itemDamage); - - entityliving.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F); + private Entity spawnCreature(World world, int itemDamage, double x, double y, double z) { + EntityLivingBase entityliving = getLiving(world, itemDamage); + + entityliving.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), + 0.0F); entityliving.rotationYawHead = entityliving.rotationYaw; entityliving.renderYawOffset = entityliving.rotationYaw; - if(entityliving instanceof EntityLiving) - { - ((EntityLiving) entityliving).onSpawnWithEgg((IEntityLivingData)null); + if (entityliving instanceof EntityLiving) { + ((EntityLiving) entityliving).onSpawnWithEgg((IEntityLivingData) null); } world.spawnEntityInWorld(entityliving); - if(entityliving instanceof EntityLiving) - { - ((EntityLiving) entityliving).playLivingSound(); + if (entityliving instanceof EntityLiving) { + ((EntityLiving) entityliving).playLivingSound(); } - + return entityliving; - } - - private EntityLivingBase getLiving(World world, int id) - { - switch(id) - { - case 0: return new EntityDragon(world); - case 1: return new EntityMinotaur(world); - case 2: return new EntityHound(world); - case 3: return new EntityCogwork(world); - - default: return new EntityDragon(world); - } - } - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int d) - { - return icons[Math.min(icons.length-1, d)]; } - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister reg) - { - icons = new IIcon[types.length]; - for(int i = 0; i < types.length; i ++) - { - icons[i] = reg.registerIcon("minefantasy2:Other/spawn_"+types[i]); - } + + private EntityLivingBase getLiving(World world, int id) { + switch (id) { + case 0: + return new EntityDragon(world); + case 1: + return new EntityMinotaur(world); + case 2: + return new EntityHound(world); + case 3: + return new EntityCogwork(world); + + default: + return new EntityDragon(world); + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int d) { + return icons[Math.min(icons.length - 1, d)]; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister reg) { + icons = new IIcon[types.length]; + for (int i = 0; i < types.length; i++) { + icons[i] = reg.registerIcon("minefantasy2:Other/spawn_" + types[i]); + } } } diff --git a/src/main/java/minefantasy/mf2/item/heatable/ItemHeated.java b/src/main/java/minefantasy/mf2/item/heatable/ItemHeated.java index 2b13be49..757a56ca 100644 --- a/src/main/java/minefantasy/mf2/item/heatable/ItemHeated.java +++ b/src/main/java/minefantasy/mf2/item/heatable/ItemHeated.java @@ -1,20 +1,15 @@ package minefantasy.mf2.item.heatable; -import java.awt.Color; -import java.util.List; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.heating.Heatable; import minefantasy.mf2.api.heating.IHotItem; import minefantasy.mf2.api.heating.TongsHelper; -import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.helpers.GuiHelper; -import minefantasy.mf2.api.material.CustomMaterial; -import minefantasy.mf2.config.ConfigHardcore; import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.util.MFLogUtil; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -27,347 +22,333 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public class ItemHeated extends Item implements IHotItem -{ - public ItemHeated() - { - GameRegistry.registerItem(this, "MF_Hot_Item", MineFantasyII.MODID); - this.setUnlocalizedName("MF_Hot_Item"); - this.setHasSubtypes(true); - this.setMaxStackSize(64); - } - - public static int getTemp(ItemStack item) { - return Heatable.getTemp(item); - } - public static int getWorkTemp(ItemStack item) { - return Heatable.getWorkTemp(item); - } - public static int getUnstableTemp(ItemStack item) { - return Heatable.getWorkTemp(item); - } - - public static ItemStack getItem(ItemStack item) - { - return Heatable.getItem(item); - } - - public static void setTemp(ItemStack item, int heat) { - NBTTagCompound nbt = getNBT(item); - - nbt.setInteger(Heatable.NBT_CurrentTemp, heat); - } - public static void setWorkTemp(ItemStack item, int heat) { - NBTTagCompound nbt = getNBT(item); - MFLogUtil.logDebug("Set Workable Temp: " + heat); - nbt.setInteger(Heatable.NBT_WorkableTemp, heat); - } - public static void setUnstableTemp(ItemStack item, int heat) { - NBTTagCompound nbt = getNBT(item); - MFLogUtil.logDebug("Set Unstable Temp: " + heat); - nbt.setInteger(Heatable.NBT_UnstableTemp, heat); - } - - public static ItemStack createHotItem(ItemStack item) { - return createHotItem(item, false); - } - public static ItemStack createHotItem(ItemStack item, int temp) - { - ItemStack hot = createHotItem(item, true); - setTemp(hot, temp); - - return hot; - } - public static ItemStack createHotItem(ItemStack item, boolean ignoreStats) - { - Heatable stats = Heatable.loadStats(item); - if(stats != null) - { - ItemStack out = new ItemStack(ComponentListMF.hotItem, item.stackSize); - NBTTagCompound nbt = getNBT(out); - NBTTagCompound save = new NBTTagCompound(); - item.writeToNBT(save); - nbt.setTag(Heatable.NBT_Item, save); - - nbt.setBoolean(Heatable.NBT_ShouldDisplay, true); - setWorkTemp(out, stats.getWorkableStat(item)); - setUnstableTemp(out, stats.getUnstableStat(item)); - - return out; - } - else if(ignoreStats) - { - ItemStack out = new ItemStack(ComponentListMF.hotItem, item.stackSize); - NBTTagCompound nbt = getNBT(out); - NBTTagCompound save = new NBTTagCompound(); - item.writeToNBT(save); - nbt.setTag(Heatable.NBT_Item, save); - - nbt.setBoolean(Heatable.NBT_ShouldDisplay, false); - setWorkTemp(out, 0); - setUnstableTemp(out, 0); - - return out; - } - return item; - } - - private static void shareTraits(NBTTagCompound nbt, ItemStack item) - { - NBTTagCompound itemtag = getNBT(item); - if(itemtag.hasKey("Unbreakable")) - { - nbt.setBoolean("Unbreakable", itemtag.getBoolean("Unbreakable")); - } - if(itemtag.hasKey("MF_Inferior")) - { - nbt.setBoolean("MF_Inferior", itemtag.getBoolean("MF_Inferior")); - } - if(itemtag.hasKey("MFCraftQuality")) - { - nbt.setFloat("MFCraftQuality", itemtag.getFloat("MFCraftQuality")); - } - } - - @Override - public String getItemStackDisplayName(ItemStack stack) - { - String name = ""; - - ItemStack item = getItem(stack); - if (item != null) - name = item.getItem().getItemStackDisplayName(item); - return StatCollector.translateToLocalFormatted("prefix.hotitem.name", name); - } - - @Override - public EnumRarity getRarity(ItemStack stack) { - ItemStack item = getItem(stack); - if (item != null) - return item.getItem().getRarity(item); - - return EnumRarity.common; - } - - public static boolean showTemp(ItemStack stack) { - if (stack == null) - return false; - - NBTTagCompound nbt = getNBT(stack); - - if (nbt == null) - return false; - - if (nbt.hasKey(Heatable.NBT_ShouldDisplay)) { - return nbt.getBoolean(Heatable.NBT_ShouldDisplay); - } - return false; - } - - private static NBTTagCompound getNBT(ItemStack item) { - if (!item.hasTagCompound()) - item.setTagCompound(new NBTTagCompound()); - return item.getTagCompound(); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { - ItemStack item = getItem(stack); - - if (item != null) { - item.getItem().addInformation(item, player, list, b); - } else - super.addInformation(stack, player, list, b); - - NBTTagCompound nbt = getNBT(stack); - if (nbt.hasKey(Heatable.NBT_ShouldDisplay)) { - if (nbt.getBoolean(Heatable.NBT_ShouldDisplay)) { - list.add(getHeatString(stack)); - if (!getWorkString(item, stack).equals("")) - list.add(getWorkString(item, stack)); - } - } - } - - private String getHeatString(ItemStack item) { - int heat = getTemp(item); - String unit = "*C"; - return heat + unit; - } - - private String getWorkString(ItemStack heated, ItemStack item) - { - byte stage = Heatable.getHeatableStage(item); - switch (stage) { - case 1: - return EnumChatFormatting.YELLOW + StatCollector.translateToLocal("state.workable"); - case 2: - return EnumChatFormatting.RED + StatCollector.translateToLocal("state.unstable"); - } - return ""; - } - - public IIcon getIcon(ItemStack stack, int renderPass) { - ItemStack item = getItem(stack); - - if (item != null) { - return item.getItem().getIcon(item, renderPass); - } - return Blocks.fire.getBlockTextureFromSide(2); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - - } - - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - - if (movingobjectposition == null) { - return item; - } else { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!world.canMineBlock(player, i, j, k)) { - return item; - } - - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { - return item; - } - float water = TongsHelper.getWaterSource(world, i, j, k); - - if (water >= 0) - { - player.playSound("random.splash", 1F, 1F); - player.playSound("random.fizz", 2F, 0.5F); - - for (int a = 0; a < 5; a++) { - world.spawnParticle("largesmoke", i + 0.5F, j + 1, k + 0.5F, 0, 0.065F, 0); - } - - ItemStack drop = getItem(item).copy(); - - if(Heatable.HCCquenchRuin) - { - float damageDone = 50F + (water > 0F ? water : 0F); - if(damageDone > 99F)damageDone = 99F; - - if(drop.isItemStackDamageable()) - { - drop.setItemDamage((int) (drop.getMaxDamage()*damageDone/100F)); - } - } - drop.stackSize = item.stackSize; - if (drop != null) { - item.stackSize = 0; - - if (item.stackSize <= 0) { - return drop.copy(); - } - } - } - } - - return item; - } - } - - public static boolean renderDynamicHotIngotRendering = true; - public int getColorFromItemStack(ItemStack item, int renderPass) - { - if (renderPass > 1 || !renderDynamicHotIngotRendering) - { - return Color.WHITE.getRGB(); - } - NBTTagCompound nbt = getNBT(item); - int heat = getTemp(item); - int maxHeat = Heatable.forgeMaximumMetalHeat; - double heatPer = (double) heat / (double) maxHeat * 100D; - - int red = getRedOnHeat(heatPer); - int green = getGreenOnHeat(heatPer); - int blue = getBlueOnHeat(heatPer); - - float curr_red = 1.0F; - float curr_green = 1.0F; - float curr_blue = 1.0F; - - ItemStack held = getItem(item); - if(held != null) - { - int colour = held.getItem().getColorFromItemStack(held, 0); - - curr_red = (float)(colour >> 16 & 255) / 255.0F; - curr_green = (float)(colour >> 8 & 255) / 255.0F; - curr_blue = (float)(colour & 255) / 255.0F; - - red = (int) ((float)red * curr_red); - green = (int) ((float)green * curr_green); - blue = (int) ((float)blue * curr_blue); - } - - return GuiHelper.getColourForRGB(red, green, blue); - } - - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() { - return true; - } - - private int getRedOnHeat(double percent) - { - if(percent <= 0)return 255; - return 255; - } - - private int getGreenOnHeat(double percent) - { - if(percent <= 0)return 255; - if (percent > 100) - percent = 100; - if (percent < 0) - percent = 0; - - if (percent <= 55) { - return (int) (255 - ((255 / 55) * percent)); - } else { - return (int) ((255 / 55) * (percent - 55)); - } - } - - private int getBlueOnHeat(double percent) - { - if(percent <= 0)return 255; - - if (percent > 100) - percent = 100; - if (percent < 0) - percent = 0; - - if (percent <= 55) { - return (int) (255 - ((255 / 55) * percent)); - } - return 0; - } - - @Override - public boolean isHot(ItemStack item) { - return true; - } - - @Override - public boolean isCoolable(ItemStack item) { - return true; - } +import java.awt.*; +import java.util.List; + +public class ItemHeated extends Item implements IHotItem { + public static boolean renderDynamicHotIngotRendering = true; + + public ItemHeated() { + GameRegistry.registerItem(this, "MF_Hot_Item", MineFantasyII.MODID); + this.setUnlocalizedName("MF_Hot_Item"); + this.setHasSubtypes(true); + this.setMaxStackSize(64); + } + + public static int getTemp(ItemStack item) { + return Heatable.getTemp(item); + } + + public static int getWorkTemp(ItemStack item) { + return Heatable.getWorkTemp(item); + } + + public static int getUnstableTemp(ItemStack item) { + return Heatable.getWorkTemp(item); + } + + public static ItemStack getItem(ItemStack item) { + return Heatable.getItem(item); + } + + public static void setTemp(ItemStack item, int heat) { + NBTTagCompound nbt = getNBT(item); + + nbt.setInteger(Heatable.NBT_CurrentTemp, heat); + } + + public static void setWorkTemp(ItemStack item, int heat) { + NBTTagCompound nbt = getNBT(item); + MFLogUtil.logDebug("Set Workable Temp: " + heat); + nbt.setInteger(Heatable.NBT_WorkableTemp, heat); + } + + public static void setUnstableTemp(ItemStack item, int heat) { + NBTTagCompound nbt = getNBT(item); + MFLogUtil.logDebug("Set Unstable Temp: " + heat); + nbt.setInteger(Heatable.NBT_UnstableTemp, heat); + } + + public static ItemStack createHotItem(ItemStack item) { + return createHotItem(item, false); + } + + public static ItemStack createHotItem(ItemStack item, int temp) { + ItemStack hot = createHotItem(item, true); + setTemp(hot, temp); + + return hot; + } + + public static ItemStack createHotItem(ItemStack item, boolean ignoreStats) { + Heatable stats = Heatable.loadStats(item); + if (stats != null) { + ItemStack out = new ItemStack(ComponentListMF.hotItem, item.stackSize); + NBTTagCompound nbt = getNBT(out); + NBTTagCompound save = new NBTTagCompound(); + item.writeToNBT(save); + nbt.setTag(Heatable.NBT_Item, save); + + nbt.setBoolean(Heatable.NBT_ShouldDisplay, true); + setWorkTemp(out, stats.getWorkableStat(item)); + setUnstableTemp(out, stats.getUnstableStat(item)); + + return out; + } else if (ignoreStats) { + ItemStack out = new ItemStack(ComponentListMF.hotItem, item.stackSize); + NBTTagCompound nbt = getNBT(out); + NBTTagCompound save = new NBTTagCompound(); + item.writeToNBT(save); + nbt.setTag(Heatable.NBT_Item, save); + + nbt.setBoolean(Heatable.NBT_ShouldDisplay, false); + setWorkTemp(out, 0); + setUnstableTemp(out, 0); + + return out; + } + return item; + } + + private static void shareTraits(NBTTagCompound nbt, ItemStack item) { + NBTTagCompound itemtag = getNBT(item); + if (itemtag.hasKey("Unbreakable")) { + nbt.setBoolean("Unbreakable", itemtag.getBoolean("Unbreakable")); + } + if (itemtag.hasKey("MF_Inferior")) { + nbt.setBoolean("MF_Inferior", itemtag.getBoolean("MF_Inferior")); + } + if (itemtag.hasKey("MFCraftQuality")) { + nbt.setFloat("MFCraftQuality", itemtag.getFloat("MFCraftQuality")); + } + } + + public static boolean showTemp(ItemStack stack) { + if (stack == null) + return false; + + NBTTagCompound nbt = getNBT(stack); + + if (nbt == null) + return false; + + if (nbt.hasKey(Heatable.NBT_ShouldDisplay)) { + return nbt.getBoolean(Heatable.NBT_ShouldDisplay); + } + return false; + } + + private static NBTTagCompound getNBT(ItemStack item) { + if (!item.hasTagCompound()) + item.setTagCompound(new NBTTagCompound()); + return item.getTagCompound(); + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + String name = ""; + + ItemStack item = getItem(stack); + if (item != null) + name = item.getItem().getItemStackDisplayName(item); + return StatCollector.translateToLocalFormatted("prefix.hotitem.name", name); + } + + @Override + public EnumRarity getRarity(ItemStack stack) { + ItemStack item = getItem(stack); + if (item != null) + return item.getItem().getRarity(item); + + return EnumRarity.common; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { + ItemStack item = getItem(stack); + + if (item != null) { + item.getItem().addInformation(item, player, list, b); + } else + super.addInformation(stack, player, list, b); + + NBTTagCompound nbt = getNBT(stack); + if (nbt.hasKey(Heatable.NBT_ShouldDisplay)) { + if (nbt.getBoolean(Heatable.NBT_ShouldDisplay)) { + list.add(getHeatString(stack)); + if (!getWorkString(item, stack).equals("")) + list.add(getWorkString(item, stack)); + } + } + } + + private String getHeatString(ItemStack item) { + int heat = getTemp(item); + String unit = "*C"; + return heat + unit; + } + + private String getWorkString(ItemStack heated, ItemStack item) { + byte stage = Heatable.getHeatableStage(item); + switch (stage) { + case 1: + return EnumChatFormatting.YELLOW + StatCollector.translateToLocal("state.workable"); + case 2: + return EnumChatFormatting.RED + StatCollector.translateToLocal("state.unstable"); + } + return ""; + } + + public IIcon getIcon(ItemStack stack, int renderPass) { + ItemStack item = getItem(stack); + + if (item != null) { + return item.getItem().getIcon(item, renderPass); + } + return Blocks.fire.getBlockTextureFromSide(2); + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + + } + + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + + if (movingobjectposition == null) { + return item; + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + if (!world.canMineBlock(player, i, j, k)) { + return item; + } + + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { + return item; + } + float water = TongsHelper.getWaterSource(world, i, j, k); + + if (water >= 0) { + player.playSound("random.splash", 1F, 1F); + player.playSound("random.fizz", 2F, 0.5F); + + for (int a = 0; a < 5; a++) { + world.spawnParticle("largesmoke", i + 0.5F, j + 1, k + 0.5F, 0, 0.065F, 0); + } + + ItemStack drop = getItem(item).copy(); + + if (Heatable.HCCquenchRuin) { + float damageDone = 50F + (water > 0F ? water : 0F); + if (damageDone > 99F) + damageDone = 99F; + + if (drop.isItemStackDamageable()) { + drop.setItemDamage((int) (drop.getMaxDamage() * damageDone / 100F)); + } + } + drop.stackSize = item.stackSize; + if (drop != null) { + item.stackSize = 0; + + if (item.stackSize <= 0) { + return drop.copy(); + } + } + } + } + + return item; + } + } + + public int getColorFromItemStack(ItemStack item, int renderPass) { + if (renderPass > 1 || !renderDynamicHotIngotRendering) { + return Color.WHITE.getRGB(); + } + NBTTagCompound nbt = getNBT(item); + int heat = getTemp(item); + int maxHeat = Heatable.forgeMaximumMetalHeat; + double heatPer = (double) heat / (double) maxHeat * 100D; + + int red = getRedOnHeat(heatPer); + int green = getGreenOnHeat(heatPer); + int blue = getBlueOnHeat(heatPer); + + float curr_red = 1.0F; + float curr_green = 1.0F; + float curr_blue = 1.0F; + + ItemStack held = getItem(item); + if (held != null) { + int colour = held.getItem().getColorFromItemStack(held, 0); + + curr_red = (colour >> 16 & 255) / 255.0F; + curr_green = (colour >> 8 & 255) / 255.0F; + curr_blue = (colour & 255) / 255.0F; + + red = (int) (red * curr_red); + green = (int) (green * curr_green); + blue = (int) (blue * curr_blue); + } + + return GuiHelper.getColourForRGB(red, green, blue); + } + + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + + private int getRedOnHeat(double percent) { + if (percent <= 0) + return 255; + return 255; + } + + private int getGreenOnHeat(double percent) { + if (percent <= 0) + return 255; + if (percent > 100) + percent = 100; + if (percent < 0) + percent = 0; + + if (percent <= 55) { + return (int) (255 - ((255 / 55) * percent)); + } else { + return (int) ((255 / 55) * (percent - 55)); + } + } + + private int getBlueOnHeat(double percent) { + if (percent <= 0) + return 255; + + if (percent > 100) + percent = 100; + if (percent < 0) + percent = 0; + + if (percent <= 55) { + return (int) (255 - ((255 / 55) * percent)); + } + return 0; + } + + @Override + public boolean isHot(ItemStack item) { + return true; + } + + @Override + public boolean isCoolable(ItemStack item) { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/item/list/ArmourListMF.java b/src/main/java/minefantasy/mf2/item/list/ArmourListMF.java index 0659241d..83cc67a1 100644 --- a/src/main/java/minefantasy/mf2/item/list/ArmourListMF.java +++ b/src/main/java/minefantasy/mf2/item/list/ArmourListMF.java @@ -2,7 +2,6 @@ import minefantasy.mf2.api.armour.ArmourDesign; import minefantasy.mf2.api.armour.ArmourMaterialMF; -import minefantasy.mf2.api.crafting.exotic.SpecialForging; import minefantasy.mf2.item.armour.ItemApron; import minefantasy.mf2.item.armour.ItemArmourMF; import minefantasy.mf2.material.BaseMaterialMF; @@ -13,70 +12,57 @@ /** * @author Anonymous Productions */ -public class ArmourListMF -{ - public static ArmourMaterialMF LEATHER = new ArmourMaterialMF("Leather", 5, 0.30F, 18, 1.00F); - public static ArmourMaterialMF APRON = new ArmourMaterialMF("Apron", 6, 0.30F, 0, 1.00F); - - public static final String[] leathermats = new String[] - { - "hide", - "roughleather", - "strongleather", - "studleather", - "padded", - }; - - public static ItemArmourMF[] leather = new ItemArmourMF[leathermats.length*4]; - public static ItemArmourMF leatherapron; - - - public static void load() - { - leatherapron = new ItemApron("leatherapron", BaseMaterialMF.leatherapron, "leatherapron_layer_1", 0); - - for(int a = 0; a < leathermats.length; a ++) - { - BaseMaterialMF baseMat = BaseMaterialMF.getMaterial(leathermats[a]); - String matName = baseMat.name; - int rarity = baseMat.rarity; - int id = a*4; - float bulk = baseMat.weight; - ArmourDesign design = baseMat == BaseMaterialMF.padding ? ArmourDesign.PADDING : ArmourDesign.LEATHER; - - leather[id+0] = new ItemArmourMF(matName.toLowerCase()+"_helmet", baseMat, design, 0, matName.toLowerCase()+"_layer_1", rarity, bulk); - leather[id+1] = new ItemArmourMF(matName.toLowerCase()+"_chest", baseMat, design, 1, matName.toLowerCase()+"_layer_1", rarity, bulk); - leather[id+2] = new ItemArmourMF(matName.toLowerCase()+"_legs", baseMat, design, 2, matName.toLowerCase()+"_layer_2", rarity, bulk); - leather[id+3] = new ItemArmourMF(matName.toLowerCase()+"_boots", baseMat, design, 3, matName.toLowerCase()+"_layer_1", rarity, bulk); - } - } - - public static ItemStack armour(ItemArmourMF[] pool, int tier, int piece) - { - int slot = tier*4+piece; - if(slot >= pool.length) - { - slot = pool.length-1; - } - return new ItemStack(pool[slot]); - } - public static Item armourItem(ItemArmourMF[] pool, int tier, int piece) - { - int slot = tier*4+piece; - if(slot >= pool.length) - { - slot = pool.length-1; - } - return pool[slot]; - } - - - public static boolean isUnbreakable(BaseMaterialMF material, EntityLivingBase user) - { - if(material == BaseMaterialMF.enderforge || material == BaseMaterialMF.ignotumite || material == BaseMaterialMF.mithium) - { - return true; - } - return false; - } +public class ArmourListMF { + public static final String[] leathermats = new String[]{"hide", "roughleather", "strongleather", "studleather", + "padded",}; + public static ArmourMaterialMF LEATHER = new ArmourMaterialMF("Leather", 5, 0.30F, 18, 1.00F); + public static ArmourMaterialMF APRON = new ArmourMaterialMF("Apron", 6, 0.30F, 0, 1.00F); + public static ItemArmourMF[] leather = new ItemArmourMF[leathermats.length * 4]; + public static ItemArmourMF leatherapron; + + public static void load() { + leatherapron = new ItemApron("leatherapron", BaseMaterialMF.leatherapron, "leatherapron_layer_1", 0); + + for (int a = 0; a < leathermats.length; a++) { + BaseMaterialMF baseMat = BaseMaterialMF.getMaterial(leathermats[a]); + String matName = baseMat.name; + int rarity = baseMat.rarity; + int id = a * 4; + float bulk = baseMat.weight; + ArmourDesign design = baseMat == BaseMaterialMF.padding ? ArmourDesign.PADDING : ArmourDesign.LEATHER; + + leather[id + 0] = new ItemArmourMF(matName.toLowerCase() + "_helmet", baseMat, design, 0, + matName.toLowerCase() + "_layer_1", rarity, bulk); + leather[id + 1] = new ItemArmourMF(matName.toLowerCase() + "_chest", baseMat, design, 1, + matName.toLowerCase() + "_layer_1", rarity, bulk); + leather[id + 2] = new ItemArmourMF(matName.toLowerCase() + "_legs", baseMat, design, 2, + matName.toLowerCase() + "_layer_2", rarity, bulk); + leather[id + 3] = new ItemArmourMF(matName.toLowerCase() + "_boots", baseMat, design, 3, + matName.toLowerCase() + "_layer_1", rarity, bulk); + } + } + + public static ItemStack armour(ItemArmourMF[] pool, int tier, int piece) { + int slot = tier * 4 + piece; + if (slot >= pool.length) { + slot = pool.length - 1; + } + return new ItemStack(pool[slot]); + } + + public static Item armourItem(ItemArmourMF[] pool, int tier, int piece) { + int slot = tier * 4 + piece; + if (slot >= pool.length) { + slot = pool.length - 1; + } + return pool[slot]; + } + + public static boolean isUnbreakable(BaseMaterialMF material, EntityLivingBase user) { + if (material == BaseMaterialMF.enderforge || material == BaseMaterialMF.ignotumite + || material == BaseMaterialMF.mithium) { + return true; + } + return false; + } } diff --git a/src/main/java/minefantasy/mf2/item/list/ComponentListMF.java b/src/main/java/minefantasy/mf2/item/list/ComponentListMF.java index e15cc610..d9eb112e 100644 --- a/src/main/java/minefantasy/mf2/item/list/ComponentListMF.java +++ b/src/main/java/minefantasy/mf2/item/list/ComponentListMF.java @@ -6,15 +6,7 @@ import minefantasy.mf2.api.mining.RandomDigs; import minefantasy.mf2.api.mining.RandomOre; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.item.AdvancedFuelHandlerMF; -import minefantasy.mf2.item.FuelHandlerMF; -import minefantasy.mf2.item.ItemArtefact; -import minefantasy.mf2.item.ItemComponentMF; -import minefantasy.mf2.item.ItemFilledMould; -import minefantasy.mf2.item.ItemHide; -import minefantasy.mf2.item.ItemMFBowl; -import minefantasy.mf2.item.ItemRawOreMF; -import minefantasy.mf2.item.ItemSpecialDesign; +import minefantasy.mf2.item.*; import minefantasy.mf2.item.custom.ItemCustomComponent; import minefantasy.mf2.item.food.FoodListMF; import minefantasy.mf2.item.gadget.ItemBombComponent; @@ -27,265 +19,259 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; + /** * @author Anonymous Productions */ -public class ComponentListMF -{ - public static final String[] ingotMats = new String[] - { - "copper", - "tin", - "bronze", - "pigiron", - "steel", - "encrusted", - "blacksteelweak", - "blacksteel", - "silver", - "redsteelweak", - "redsteel", - "bluesteelweak", - "bluesteel", - "adamantium", - "mithril", - "ignotumite", - "mithium", - "ender", - "tungsten", - "obsidian", - }; - - - - public static Item clay_pot = new ItemMFBowl("clay_pot").setStoragePlacement("pot", "pot"); - public static Item clay_pot_uncooked = new ItemComponentMF("clay_pot_uncooked", 0); - public static Item ingot_mould = new ItemComponentMF("ingot_mould").setStoragePlacement("bar", "mould"); - public static Item ingot_mould_uncooked = new ItemComponentMF("ingot_mould_uncooked", 0); - public static Item pie_tray_uncooked = new ItemComponentMF("pie_tray_uncooked", 0); - - public static ItemComponentMF[] ingots = new ItemComponentMF[ingotMats.length]; - - - public static ItemComponentMF plank = new ItemComponentMF("plank").setCustom(1, "wood").setStoragePlacement("plank", "plank"); - public static Item vine = new ItemComponentMF("vine", -1); - public static Item sharp_rock = new ItemComponentMF("sharp_rock", -1); - - public static Item flux = new ItemComponentMF("flux", 0); - public static Item flux_strong = new ItemComponentMF("flux_strong", 0); - - public static Item coalDust = new ItemComponentMF("coalDust", 0).setContainerItem(clay_pot); - public static Item nitre = new ItemComponentMF("nitre", 0); - public static Item sulfur = new ItemComponentMF("sulfur", 0); - public static Item iron_prep = new ItemComponentMF("iron_prep", 0); - public static Item blackpowder = new ItemBombComponent("blackpowder", 0, "powder", 0).setContainerItem(clay_pot); - public static Item blackpowder_advanced = new ItemBombComponent("blackpowder_advanced", 1, "powder", 1).setContainerItem(clay_pot); - public static Item fletching = new ItemComponentMF("fletching", 0); - public static Item shrapnel = new ItemBombComponent("shrapnel", 0, "filling", 1).setContainerItem(ComponentListMF.clay_pot); - public static Item magma_cream_refined = new ItemBombComponent("magma_cream_refined", 1, "filling", 2).setContainerItem(clay_pot); - public static Item bomb_fuse = new ItemBombComponent("bomb_fuse", 0, "fuse", 0); - public static Item bomb_fuse_long = new ItemBombComponent("bomb_fuse_long", 0, "fuse", 1); - public static Item bomb_casing_uncooked = new ItemComponentMF("bomb_casing_uncooked", 0); - public static Item bomb_casing = new ItemBombComponent("bomb_casing", 0, "bombcase", 0); - public static Item mine_casing_uncooked = new ItemComponentMF("mine_casing_uncooked", 0); - public static Item mine_casing = new ItemBombComponent("mine_casing", 0, "minecase", 0); - public static Item bomb_casing_iron = new ItemBombComponent("bomb_casing_iron", 0, "bombcase", 1); - public static Item mine_casing_iron = new ItemBombComponent("mine_casing_iron", 0, "minecase", 1); - public static Item bomb_casing_obsidian = new ItemBombComponent("bomb_casing_obsidian", 1, "bombcase", 2); - public static Item mine_casing_obsidian = new ItemBombComponent("mine_casing_obsidian", 1, "minecase", 2); - public static Item bomb_casing_crystal = new ItemBombComponent("bomb_casing_crystal", 1, "bombcase", 3); - public static Item mine_casing_crystal = new ItemBombComponent("mine_casing_crystal", 1, "minecase", 3); - public static Item bomb_casing_arrow = new ItemBombComponent("bomb_casing_arrow", 1, "arrow", 0); - public static Item bomb_casing_bolt = new ItemBombComponent("bomb_casing_bolt", 1, "bolt", 0); - - public static Item coke = new ItemComponentMF("coke", 1); - public static Item diamond_shards = new ItemComponentMF("diamond_shards", 0); - - public static Item clay_brick = new ItemComponentMF("clay_brick", 0); - public static Item kaolinite = new ItemComponentMF("kaolinite", 0); - public static Item kaolinite_dust = new ItemComponentMF("kaolinite_dust", 0).setContainerItem(clay_pot); - public static Item fireclay = new ItemComponentMF("fireclay", 0); - public static Item fireclay_brick = new ItemComponentMF("fireclay_brick", 0); - public static Item strong_brick = new ItemComponentMF("strong_brick", 0).setStoragePlacement("bar", "firebrick"); - - public static Item hideSmall = new ItemComponentMF("hideSmall", 0); - public static Item hideMedium = new ItemComponentMF("hideMedium", 0); - public static Item hideLarge = new ItemComponentMF("hideLarge", 0); - public static Item rawhideSmall = new ItemHide("rawhideSmall", hideSmall, 1.0F); - public static Item rawhideMedium = new ItemHide("rawhideMedium", hideMedium, 1.5F); - public static Item rawhideLarge = new ItemHide("rawhideLarge", hideLarge, 3.0F); - - public static Item dragon_heart = new ItemSpecialDesign("dragon_heart", 1, "dragon"); - - public static Item leather_strip = new ItemComponentMF("leather_strip", 0); - public static Item nail = new ItemComponentMF("nail", 0); - public static Item rivet = new ItemComponentMF("rivet", 0); - public static Item thread = new ItemComponentMF("thread", 0); - public static Item obsidian_rock = new ItemComponentMF("obsidian_rock", 0); - - public static Item oreCopper = new ItemRawOreMF("oreCopper", -1); - public static Item oreTin = new ItemRawOreMF("oreTin", -1); - public static Item oreIron = new ItemRawOreMF("oreIron", 0); - public static Item oreSilver = new ItemRawOreMF("oreSilver", 0); - public static Item oreGold = new ItemRawOreMF("oreGold", 0); - public static Item oreTungsten = new ItemRawOreMF("oreTungsten", 1); - - public static Item hotItem = new ItemHeated(); - - public static Item plant_oil = new ItemComponentMF("plant_oil", 0).setStoragePlacement("jug", "jugoil").setContainerItem(FoodListMF.jug_empty); - - public static Item talisman_lesser= new ItemComponentMF("talisman_lesser", 1); - public static Item talisman_greater= new ItemComponentMF("talisman_greater", 3); - - public static Item bolt = new ItemComponentMF("bolt", 0); - public static Item iron_frame = new ItemComponentMF("iron_frame", 0); - public static Item iron_strut = new ItemComponentMF("iron_strut", 0); - public static Item bronze_gears = new ItemComponentMF("bronze_gears", 0); - public static Item tungsten_gears = new ItemComponentMF("tungsten_gears", 1); - public static Item steel_tube = new ItemComponentMF("steel_tube", 0); - public static Item cogwork_shaft = new ItemComponentMF("cogwork_shaft", 1); - public static Item ingotCompositeAlloy = new ItemComponentMF("ingotCompositeAlloy", 1); - public static Item coal_prep = new ItemComponentMF("coal_prep", 0); - - public static Item ingot_mould_filled = new ItemFilledMould(); - - public static Item crossbow_stock_wood = new ItemCrossbowPart("cross_stock_wood", "stock").addSpeed(1.0F).addRecoil(0F); - public static Item crossbow_stock_iron = new ItemCrossbowPart("cross_stock_iron", "stock").addSpeed(1.0F).addRecoil(-2F).addDurability(150); - public static Item crossbow_handle_wood = new ItemCrossbowPart("cross_handle_wood", "stock").addSpeed(0.5F).addRecoil(2F).addSpread(1.0F).setHandCrossbow(true); - - public static Item cross_arms_basic = new ItemCrossbowPart("cross_arms_basic", "mechanism").addPower(1.00F).addSpeed(0.50F).addRecoil(4F).addSpread(1.00F); - public static Item cross_arms_light = new ItemCrossbowPart("cross_arms_light", "mechanism").addPower(0.85F).addSpeed(0.25F).addRecoil(2F).addSpread(0.50F); - public static Item cross_arms_heavy = new ItemCrossbowPart("cross_arms_heavy", "mechanism").addPower(1.15F).addSpeed(1.00F).addRecoil(8F).addSpread(2.00F); - public static Item cross_arms_advanced = new ItemCrossbowPart("cross_arms_advanced", "mechanism").addPower(1.15F).addSpeed(1.00F).addRecoil(6F).addSpread(0.25F).addDurability(150); - - public static Item cross_bayonet = new ItemCrossbowPart("cross_bayonet", "muzzle").addBash(4.0F).addRecoil(-1F).addSpeed(0.5F); - public static Item cross_ammo = new ItemCrossbowPart("cross_ammo", "mod").addCapacity(5).addSpread(2.00F); - public static Item cross_scope = new ItemCrossbowPart("cross_scope", "mod").setScope(0.75F); - - public static ItemCustomComponent chainmesh = new ItemCustomComponent("chainmesh", 1F, "metal").setStoragePlacement("sheet", "mail"); - public static ItemCustomComponent scalemesh = new ItemCustomComponent("scalemesh", 1F, "metal").setStoragePlacement("sheet", "scale"); - public static ItemCustomComponent splintmesh = new ItemCustomComponent("splintmesh", 1F, "metal").setStoragePlacement("sheet", "splint"); - public static ItemCustomComponent plate = new ItemCustomComponent("plate", 2F, "metal").setStoragePlacement("sheet", "plate"); - public static ItemCustomComponent plate_huge = new ItemCustomComponent("plate_huge", 8F, "metal").setStoragePlacement("bigplate", "bigplate"); - public static ItemCustomComponent metalHunk = new ItemCustomComponent("hunk", 0.25F, "metal"); - public static ItemCustomComponent arrowhead = new ItemCustomComponent("arrowhead", 1/4F, "metal"); - public static ItemCustomComponent bodkinhead = new ItemCustomComponent("bodkinhead", 1/4F, "metal"); - public static ItemCustomComponent broadhead = new ItemCustomComponent("broadhead", 1/4F, "metal"); - public static ItemCustomComponent cogwork_armour = (ItemCustomComponent) new ItemCustomComponent("cogwork_armour", 30F, "metal").setCanDamage().setCreativeTab(CreativeTabMF.tabGadget).setMaxStackSize(1); - public static ItemCustomComponent bar = (ItemCustomComponent) new ItemCustomComponent("bar", 1F, "metal").setStoragePlacement("bar", "bar").setCreativeTab(CreativeTabMF.tabMaterialsMF); - - public static Item flux_pot = new ItemComponentMF("flux_pot", 0).setContainerItem(clay_pot); - public static Item coal_flux = new ItemComponentMF("coal_flux", 0); - - public static Item copper_coin = new ItemComponentMF("copper_coin", 0); - public static Item silver_coin = new ItemComponentMF("silver_coin", 0); - public static Item gold_coin = new ItemComponentMF("gold_coin", 0); - - public static Item hinge = new ItemComponentMF("hinge", 0); - public static Item plank_cut = new ItemComponentMF("plank_cut").setCustom(1, "wood").setStoragePlacement("plank", "plankcut"); - public static Item plank_pane = new ItemComponentMF("plank_pane").setCustom(6, "wood").setStoragePlacement("sheet", "woodpane"); - - public static Item cogwork_pulley = new ItemComponentMF("cogwork_pulley", 1).setCreativeTab(CreativeTabMF.tabGadget); - - public static Item artefacts = new ItemArtefact("artefact_any"); - - public static Item ornate_items = new ItemSpecialDesign("ornate_items", 1, "ornate"); - - public static void load() - { - WoodMaterial.init(); - Items.potionitem.setContainerItem(Items.glass_bottle); - GameRegistry.registerFuelHandler(new FuelHandlerMF()); - MineFantasyAPI.registerFuelHandler(new AdvancedFuelHandlerMF()); - Items.iron_ingot.setTextureName("minefantasy2:component/ingotWroughtIron"); - Blocks.iron_block.setBlockTextureName("minefantasy2:metal/iron_block"); - Blocks.iron_bars.setBlockTextureName("minefantasy2:metal/iron_bars"); - for(int a = 0; a < ingotMats.length; a ++) - { - BaseMaterialMF mat = BaseMaterialMF.getMaterial(ingotMats[a]); - String name = mat.name; - int rarity = mat.rarity; - - ingots[a] = new ItemComponentMF("ingot"+name, rarity); - OreDictionary.registerOre("ingot"+name, ingots[a]); - - if(name.equalsIgnoreCase("PigIron")) - { - OreDictionary.registerOre("ingotRefinedIron", ingots[a]); - } - } - - addRandomDrops(); - initFuels(); - OreDictionary.registerOre("ingotCompositeAlloy", ingotCompositeAlloy); - OreDictionary.registerOre("ingotIron", Items.iron_ingot); - OreDictionary.registerOre("ingotGold", Items.gold_ingot); - - AdvancedFuelHandlerMF.registerItems(); - } - - private static void initFuels() - { - MineFantasyFuels.addForgeFuel(new ItemStack(Items.coal, 1, 0), 900, 1500);// 1500C , 45s - MineFantasyFuels.addForgeFuel(new ItemStack(Items.coal, 1, 1), 1200, 1800);// 1800C , 1m - MineFantasyFuels.addForgeFuel(Items.blaze_powder, 200, 3000, true);// 3000C , 10s - MineFantasyFuels.addForgeFuel(Items.blaze_rod, 300, 3000, true);// 3000C , 15s - MineFantasyFuels.addForgeFuel(Items.fire_charge, 1200, 3500,true);// 3500C , 1m - MineFantasyFuels.addForgeFuel(Items.lava_bucket, 2400, 5000, true);// 5000C , 2m - MineFantasyFuels.addForgeFuel(Items.magma_cream, 2400, 4000, true, true);// 4000C , 2m - - MineFantasyFuels.addForgeFuel(ComponentListMF.coke, 1200, 2500, false, true);// 2500C , 1m - MineFantasyFuels.addForgeFuel(ComponentListMF.magma_cream_refined, 2400, 5000, true, true);// 5000C , 2m - - MineFantasyFuels.addForgeFuel(ComponentListMF.coalDust, 1200, 180);// 180C , 60s - } - - private static void addRandomDrops() - { - RandomOre.addOre(new ItemStack(kaolinite), 1.5F, Blocks.stone, -1, 32,128, false); - RandomOre.addOre(new ItemStack(flux), 2F, Blocks.stone, -1, 0, 128, false); - RandomOre.addOre(new ItemStack(flux_strong), 1F, Blocks.stone, 2, 0, 128, false); - RandomOre.addOre(new ItemStack(flux), 20F, BlockListMF.limestone, 0, -1, 0, 256, true); - RandomOre.addOre(new ItemStack(flux_strong), 10F, BlockListMF.limestone, 0, 2, 0, 256, true); - RandomOre.addOre(new ItemStack(Items.coal), 2F, Blocks.stone, -1, 0, 128, false); - RandomOre.addOre(new ItemStack(sulfur), 2F, Blocks.stone, -1, 0, 16, false); - RandomOre.addOre(new ItemStack(nitre), 3F, Blocks.stone, -1, 0, 64, false); - RandomOre.addOre(new ItemStack(Items.redstone), 5F, Blocks.stone, 2, 0, 16, false); - RandomOre.addOre(new ItemStack(Items.flint), 1F, Blocks.stone, -1, 0, 64, false); - RandomOre.addOre(new ItemStack(diamond_shards), 0.2F,Blocks.stone, 2, 0, 16, false); - RandomOre.addOre(new ItemStack(Items.quartz), 0.5F,Blocks.stone, 3, 0, 16, false); - - RandomOre.addOre(new ItemStack(sulfur), 10F,Blocks.netherrack, -1, 0, 512, false); - RandomOre.addOre(new ItemStack(Items.glowstone_dust), 5F,Blocks.netherrack, -1, 0, 512, false); - RandomOre.addOre(new ItemStack(Items.quartz), 5F, Blocks.netherrack, -1, 0, 512, false); - RandomOre.addOre(new ItemStack(Items.blaze_powder), 5F, Blocks.netherrack, -1, 0, 512, false); - RandomOre.addOre(new ItemStack(Items.nether_wart), 1F, Blocks.netherrack, -1, 0, 512, false); - RandomOre.addOre(new ItemStack(Items.nether_star), 0.01F, Blocks.netherrack, -1, 0, 512,false); - - RandomDigs.addOre(new ItemStack(Blocks.skull, 1, 1), 0.1F, Blocks.soul_sand,3, 0, 256, false); - RandomDigs.addOre(new ItemStack(Items.bone), 5F, Blocks.dirt, -1, 0, 256, false); - RandomDigs.addOre(new ItemStack(Items.rotten_flesh), 2F, Blocks.dirt, -1, 0, 256, false); - RandomDigs.addOre(new ItemStack(Items.coal, 1, 1), 1F, Blocks.dirt, -1, 32, 64, false); - - RandomDigs.addOre(new ItemStack(Items.melon_seeds), 5F, Blocks.grass, -1, 0, 256, false); - RandomDigs.addOre(new ItemStack(Items.pumpkin_seeds), 8F, Blocks.grass, -1, 0, 256, false); - - RandomOre.addOre(new ItemStack(oreCopper), 4F, Blocks.stone, 0, 48, 96, false); - RandomOre.addOre(new ItemStack(oreTin), 2F,Blocks.stone, 0, 48, 96, false); - RandomOre.addOre(new ItemStack(oreIron), 5F, Blocks.stone, 0, 0, 64, false); - RandomOre.addOre(new ItemStack(oreSilver), 1.5F, Blocks.stone, 0, 0, 32, false); - RandomOre.addOre(new ItemStack(oreGold), 1F, Blocks.stone, 0, 0, 32, false); - - RandomOre.addOre(new ItemStack(oreTungsten), 2F, Blocks.stone, 3, 0, 16, false, "tungsten"); - } - - public static ItemStack bar(String material) - { - return bar(material, 1); - } - - public static ItemStack bar(String material, int stackSize) - { - return bar.createComm(material, stackSize); - } +public class ComponentListMF { + public static final String[] ingotMats = new String[]{"copper", "tin", "bronze", "pigiron", "steel", "encrusted", + "blacksteelweak", "blacksteel", "silver", "redsteelweak", "redsteel", "bluesteelweak", "bluesteel", + "adamantium", "mithril", "ignotumite", "mithium", "ender", "tungsten", "obsidian", "dwarfsteel", "emerald"}; + + public static Item clay_pot = new ItemMFBowl("clay_pot").setStoragePlacement("pot", "pot"); + public static Item clay_pot_uncooked = new ItemComponentMF("clay_pot_uncooked", 0); + public static Item ingot_mould = new ItemComponentMF("ingot_mould").setStoragePlacement("bar", "mould"); + public static Item ingot_mould_uncooked = new ItemComponentMF("ingot_mould_uncooked", 0); + public static Item pie_tray_uncooked = new ItemComponentMF("pie_tray_uncooked", 0); + + public static ItemComponentMF[] ingots = new ItemComponentMF[ingotMats.length]; + + public static ItemComponentMF plank = new ItemComponentMF("plank").setCustom(1, "wood").setStoragePlacement("plank", + "plank"); + public static Item vine = new ItemComponentMF("vine", -1); + public static Item sharp_rock = new ItemComponentMF("sharp_rock", -1); + + public static Item flux = new ItemComponentMF("flux", 0); + public static Item flux_strong = new ItemComponentMF("flux_strong", 0); + + public static Item coalDust = new ItemComponentMF("coalDust", 0).setContainerItem(clay_pot); + public static Item nitre = new ItemComponentMF("nitre", 0); + public static Item coal = new ItemComponentMF("coal", 0); + public static Item sulfur = new ItemComponentMF("sulfur", 0); + public static Item iron_prep = new ItemComponentMF("iron_prep", 0); + public static Item blackpowder = new ItemBombComponent("blackpowder", 0, "powder", 0).setContainerItem(clay_pot); + public static Item blackpowder_advanced = new ItemBombComponent("blackpowder_advanced", 1, "powder", 1) + .setContainerItem(clay_pot); + public static Item fletching = new ItemComponentMF("fletching", 0); + public static Item shrapnel = new ItemBombComponent("shrapnel", 0, "filling", 1) + .setContainerItem(ComponentListMF.clay_pot); + public static Item magma_cream_refined = new ItemBombComponent("magma_cream_refined", 1, "filling", 2) + .setContainerItem(clay_pot); + public static Item bomb_fuse = new ItemBombComponent("bomb_fuse", 0, "fuse", 0); + public static Item bomb_fuse_long = new ItemBombComponent("bomb_fuse_long", 0, "fuse", 1); + public static Item bomb_casing_uncooked = new ItemComponentMF("bomb_casing_uncooked", 0); + public static Item bomb_casing = new ItemBombComponent("bomb_casing", 0, "bombcase", 0); + public static Item mine_casing_uncooked = new ItemComponentMF("mine_casing_uncooked", 0); + public static Item mine_casing = new ItemBombComponent("mine_casing", 0, "minecase", 0); + public static Item bomb_casing_iron = new ItemBombComponent("bomb_casing_iron", 0, "bombcase", 1); + public static Item mine_casing_iron = new ItemBombComponent("mine_casing_iron", 0, "minecase", 1); + public static Item bomb_casing_obsidian = new ItemBombComponent("bomb_casing_obsidian", 1, "bombcase", 2); + public static Item mine_casing_obsidian = new ItemBombComponent("mine_casing_obsidian", 1, "minecase", 2); + public static Item bomb_casing_crystal = new ItemBombComponent("bomb_casing_crystal", 1, "bombcase", 3); + public static Item mine_casing_crystal = new ItemBombComponent("mine_casing_crystal", 1, "minecase", 3); + public static Item bomb_casing_arrow = new ItemBombComponent("bomb_casing_arrow", 1, "arrow", 0); + public static Item bomb_casing_bolt = new ItemBombComponent("bomb_casing_bolt", 1, "bolt", 0); + + public static Item coke = new ItemComponentMF("coke", 1); + public static Item diamond_shards = new ItemComponentMF("diamond_shards", 0); + + //NEW FUEL + public static Item dwarven_fuel = new ItemComponentMF("dwarven_fuel", 1); + + public static Item clay_brick = new ItemComponentMF("clay_brick", 0); + public static Item kaolinite = new ItemComponentMF("kaolinite", 0); + public static Item kaolinite_dust = new ItemComponentMF("kaolinite_dust", 0).setContainerItem(clay_pot); + public static Item fireclay = new ItemComponentMF("fireclay", 0); + public static Item fireclay_brick = new ItemComponentMF("fireclay_brick", 0); + public static Item strong_brick = new ItemComponentMF("strong_brick", 0).setStoragePlacement("bar", "firebrick"); + + public static Item hideSmall = new ItemComponentMF("hideSmall", 0); + public static Item hideMedium = new ItemComponentMF("hideMedium", 0); + public static Item hideLarge = new ItemComponentMF("hideLarge", 0); + public static Item rawhideSmall = new ItemHide("rawhideSmall", hideSmall, 1.0F); + public static Item rawhideMedium = new ItemHide("rawhideMedium", hideMedium, 1.5F); + public static Item rawhideLarge = new ItemHide("rawhideLarge", hideLarge, 3.0F); + + public static Item dragon_heart = new ItemSpecialDesign("dragon_heart", 1, "dragon"); + + public static Item leather_strip = new ItemComponentMF("leather_strip", 0); + public static Item nail = new ItemComponentMF("nail", 0); + public static Item rivet = new ItemComponentMF("rivet", 0); + public static Item thread = new ItemComponentMF("thread", 0); + public static Item obsidian_rock = new ItemComponentMF("obsidian_rock", 0); + + public static Item oreCopper = new ItemRawOreMF("oreCopper", -1); + public static Item oreTin = new ItemRawOreMF("oreTin", -1); + public static Item oreIron = new ItemRawOreMF("oreIron", 0); + public static Item oreSilver = new ItemRawOreMF("oreSilver", 0); + public static Item oreGold = new ItemRawOreMF("oreGold", 0); + public static Item oreTungsten = new ItemRawOreMF("oreTungsten", 1); + + public static Item hotItem = new ItemHeated(); + + public static Item plant_oil = new ItemComponentMF("plant_oil", 0).setStoragePlacement("jug", "jugoil") + .setContainerItem(FoodListMF.jug_empty); + + public static Item talisman_lesser = new ItemComponentMF("talisman_lesser", 1); + public static Item talisman_greater = new ItemComponentMF("talisman_greater", 3); + + public static Item bolt = new ItemComponentMF("bolt", 0); + public static Item iron_frame = new ItemComponentMF("iron_frame", 0); + public static Item iron_strut = new ItemComponentMF("iron_strut", 0); + public static Item bronze_gears = new ItemComponentMF("bronze_gears", 0); + public static Item tungsten_gears = new ItemComponentMF("tungsten_gears", 1); + public static Item steel_tube = new ItemComponentMF("steel_tube", 0); + public static Item cogwork_shaft = new ItemComponentMF("cogwork_shaft", 1); + public static Item ingotCompositeAlloy = new ItemComponentMF("ingotCompositeAlloy", 1); + public static Item coal_prep = new ItemComponentMF("coal_prep", 0); + + public static Item ingot_mould_filled = new ItemFilledMould(); + + public static Item crossbow_stock_wood = new ItemCrossbowPart("cross_stock_wood", "stock").addSpeed(1.0F) + .addRecoil(0F); + public static Item crossbow_stock_iron = new ItemCrossbowPart("cross_stock_iron", "stock").addSpeed(1.0F) + .addRecoil(-2F).addDurability(150); + public static Item crossbow_handle_wood = new ItemCrossbowPart("cross_handle_wood", "stock").addSpeed(0.5F) + .addRecoil(2F).addSpread(1.0F).setHandCrossbow(true); + + public static Item cross_arms_basic = new ItemCrossbowPart("cross_arms_basic", "mechanism").addPower(1.00F) + .addSpeed(0.50F).addRecoil(4F).addSpread(1.00F); + public static Item cross_arms_light = new ItemCrossbowPart("cross_arms_light", "mechanism").addPower(0.85F) + .addSpeed(0.25F).addRecoil(2F).addSpread(0.50F); + public static Item cross_arms_heavy = new ItemCrossbowPart("cross_arms_heavy", "mechanism").addPower(1.15F) + .addSpeed(1.00F).addRecoil(8F).addSpread(2.00F); + public static Item cross_arms_advanced = new ItemCrossbowPart("cross_arms_advanced", "mechanism").addPower(1.15F) + .addSpeed(1.00F).addRecoil(6F).addSpread(0.25F).addDurability(150); + + public static Item cross_bayonet = new ItemCrossbowPart("cross_bayonet", "muzzle").addBash(4.0F).addRecoil(-1F) + .addSpeed(0.5F); + public static Item cross_ammo = new ItemCrossbowPart("cross_ammo", "mod").addCapacity(5).addSpread(2.00F); + public static Item cross_scope = new ItemCrossbowPart("cross_scope", "mod").setScope(0.75F); + + public static ItemCustomComponent chainmesh = new ItemCustomComponent("chainmesh", 1F, "metal") + .setStoragePlacement("sheet", "mail"); + public static ItemCustomComponent scalemesh = new ItemCustomComponent("scalemesh", 1F, "metal") + .setStoragePlacement("sheet", "scale"); + public static ItemCustomComponent splintmesh = new ItemCustomComponent("splintmesh", 1F, "metal") + .setStoragePlacement("sheet", "splint"); + public static ItemCustomComponent plate = new ItemCustomComponent("plate", 2F, "metal").setStoragePlacement("sheet", + "plate"); + public static ItemCustomComponent plate_huge = new ItemCustomComponent("plate_huge", 8F, "metal") + .setStoragePlacement("bigplate", "bigplate"); + public static ItemCustomComponent metalHunk = new ItemCustomComponent("hunk", 0.25F, "metal"); + public static ItemCustomComponent arrowhead = new ItemCustomComponent("arrowhead", 1 / 4F, "metal"); + public static ItemCustomComponent bodkinhead = new ItemCustomComponent("bodkinhead", 1 / 4F, "metal"); + public static ItemCustomComponent broadhead = new ItemCustomComponent("broadhead", 1 / 4F, "metal"); + public static ItemCustomComponent cogwork_armour = (ItemCustomComponent) new ItemCustomComponent("cogwork_armour", + 30F, "metal").setCanDamage().setCreativeTab(CreativeTabMF.tabGadget).setMaxStackSize(1); + public static ItemCustomComponent bar = (ItemCustomComponent) new ItemCustomComponent("bar", 1F, "metal") + .setStoragePlacement("bar", "bar").setCreativeTab(CreativeTabMF.tabMaterialsMF); + + public static Item flux_pot = new ItemComponentMF("flux_pot", 0).setContainerItem(clay_pot); + public static Item coal_flux = new ItemComponentMF("coal_flux", 0); + + public static Item copper_coin = new ItemComponentMF("copper_coin", 0); + public static Item silver_coin = new ItemComponentMF("silver_coin", 0); + public static Item gold_coin = new ItemComponentMF("gold_coin", 0); + + public static Item hinge = new ItemComponentMF("hinge", 0); + public static Item plank_cut = new ItemComponentMF("plank_cut").setCustom(1, "wood").setStoragePlacement("plank", + "plankcut"); + public static Item plank_pane = new ItemComponentMF("plank_pane").setCustom(6, "wood").setStoragePlacement("sheet", + "woodpane"); + + public static Item cogwork_pulley = new ItemComponentMF("cogwork_pulley", 1) + .setCreativeTab(CreativeTabMF.tabGadget); + + public static Item artefacts = new ItemArtefact("artefact_any"); + + public static Item ornate_items = new ItemSpecialDesign("ornate_items", 1, "ornate"); + + public static void load() { + WoodMaterial.init(); + Items.potionitem.setContainerItem(Items.glass_bottle); + GameRegistry.registerFuelHandler(new FuelHandlerMF()); + MineFantasyAPI.registerFuelHandler(new AdvancedFuelHandlerMF()); + Items.iron_ingot.setTextureName("minefantasy2:component/ingotWroughtIron"); + Blocks.iron_block.setBlockTextureName("minefantasy2:metal/iron_block"); + Blocks.iron_bars.setBlockTextureName("minefantasy2:metal/iron_bars"); + for (int a = 0; a < ingotMats.length; a++) { + BaseMaterialMF mat = BaseMaterialMF.getMaterial(ingotMats[a]); + String name = mat.name; + int rarity = mat.rarity; + + ingots[a] = new ItemComponentMF("ingot" + name, rarity); + OreDictionary.registerOre("ingot" + name, ingots[a]); + } + + addRandomDrops(); + initFuels(); + OreDictionary.registerOre("ingotCompositeAlloy", ingotCompositeAlloy); + OreDictionary.registerOre("ingotIron", Items.iron_ingot); + OreDictionary.registerOre("ingotGold", Items.gold_ingot); + + AdvancedFuelHandlerMF.registerItems(); + } + + private static void initFuels() { + MineFantasyFuels.addForgeFuel(new ItemStack(Items.coal, 1, 0), 900, 1500);// 1500C , 45s + MineFantasyFuels.addForgeFuel(new ItemStack(Items.coal, 1, 1), 1200, 1800);// 1800C , 1m + MineFantasyFuels.addForgeFuel(Items.blaze_powder, 200, 3000, true);// 3000C , 10s + MineFantasyFuels.addForgeFuel(Items.blaze_rod, 300, 3000, true);// 3000C , 15s + MineFantasyFuels.addForgeFuel(Items.fire_charge, 1200, 3500, true);// 3500C , 1m + MineFantasyFuels.addForgeFuel(Items.lava_bucket, 2400, 5000, true);// 5000C , 2m + MineFantasyFuels.addForgeFuel(Items.magma_cream, 2400, 4000, true, true);// 4000C , 2m + MineFantasyFuels.addForgeFuel(ComponentListMF.dwarven_fuel, 2050, 3650); + + MineFantasyFuels.addForgeFuel(ComponentListMF.coke, 1200, 2500, false, true);// 2500C , 1m + MineFantasyFuels.addForgeFuel(ComponentListMF.magma_cream_refined, 2400, 5000, true, true);// 5000C , 2m + + MineFantasyFuels.addForgeFuel(ComponentListMF.coalDust, 1200, 180);// 180C , 60s + } + + private static void addRandomDrops() { + RandomOre.addOre(new ItemStack(kaolinite), 1.5F, Blocks.stone, -1, 32, 128, false); + RandomOre.addOre(new ItemStack(flux), 2F, Blocks.stone, -1, 0, 128, false); + RandomOre.addOre(new ItemStack(flux_strong), 1F, Blocks.stone, 2, 0, 128, false); + RandomOre.addOre(new ItemStack(flux), 20F, BlockListMF.limestone, 0, -1, 0, 256, true); + RandomOre.addOre(new ItemStack(flux_strong), 10F, BlockListMF.limestone, 0, 2, 0, 256, true); + RandomOre.addOre(new ItemStack(Items.coal), 2F, Blocks.stone, -1, 0, 128, false); + RandomOre.addOre(new ItemStack(sulfur), 2F, Blocks.stone, -1, 0, 16, false); + RandomOre.addOre(new ItemStack(nitre), 3F, Blocks.stone, -1, 0, 64, false); + RandomOre.addOre(new ItemStack(Items.redstone), 5F, Blocks.stone, 2, 0, 16, false); + RandomOre.addOre(new ItemStack(Items.flint), 1F, Blocks.stone, -1, 0, 64, false); + RandomOre.addOre(new ItemStack(diamond_shards), 0.2F, Blocks.stone, 2, 0, 16, false); + RandomOre.addOre(new ItemStack(Items.quartz), 0.5F, Blocks.stone, 3, 0, 16, false); + + RandomOre.addOre(new ItemStack(sulfur), 10F, Blocks.netherrack, -1, 0, 512, false); + RandomOre.addOre(new ItemStack(Items.glowstone_dust), 5F, Blocks.netherrack, -1, 0, 512, false); + RandomOre.addOre(new ItemStack(Items.quartz), 5F, Blocks.netherrack, -1, 0, 512, false); + RandomOre.addOre(new ItemStack(Items.blaze_powder), 5F, Blocks.netherrack, -1, 0, 512, false); + RandomOre.addOre(new ItemStack(Items.nether_wart), 1F, Blocks.netherrack, -1, 0, 512, false); + RandomOre.addOre(new ItemStack(Items.nether_star), 0.01F, Blocks.netherrack, -1, 0, 512, false); + + RandomDigs.addOre(new ItemStack(Blocks.skull, 1, 1), 0.1F, Blocks.soul_sand, 3, 0, 256, false); + RandomDigs.addOre(new ItemStack(Items.bone), 5F, Blocks.dirt, -1, 0, 256, false); + RandomDigs.addOre(new ItemStack(Items.rotten_flesh), 2F, Blocks.dirt, -1, 0, 256, false); + RandomDigs.addOre(new ItemStack(Items.coal, 1, 1), 1F, Blocks.dirt, -1, 32, 64, false); + + RandomDigs.addOre(new ItemStack(Items.melon_seeds), 5F, Blocks.grass, -1, 0, 256, false); + RandomDigs.addOre(new ItemStack(Items.pumpkin_seeds), 8F, Blocks.grass, -1, 0, 256, false); + + RandomOre.addOre(new ItemStack(oreCopper), 4F, Blocks.stone, 0, 48, 96, false); + RandomOre.addOre(new ItemStack(oreTin), 2F, Blocks.stone, 0, 48, 96, false); + RandomOre.addOre(new ItemStack(oreIron), 5F, Blocks.stone, 0, 0, 64, false); + RandomOre.addOre(new ItemStack(oreSilver), 1.5F, Blocks.stone, 0, 0, 32, false); + RandomOre.addOre(new ItemStack(oreGold), 1F, Blocks.stone, 0, 0, 32, false); + + RandomOre.addOre(new ItemStack(oreTungsten), 2F, Blocks.stone, 3, 0, 16, false, "tungsten"); + } + + public static ItemStack bar(String material) { + return bar(material, 1); + } + + public static ItemStack bar(String material, int stackSize) { + return bar.createComm(material, stackSize); + } } diff --git a/src/main/java/minefantasy/mf2/item/list/CreativeTabMF.java b/src/main/java/minefantasy/mf2/item/list/CreativeTabMF.java index 29d123a9..dc0d7ad6 100644 --- a/src/main/java/minefantasy/mf2/item/list/CreativeTabMF.java +++ b/src/main/java/minefantasy/mf2/item/list/CreativeTabMF.java @@ -1,71 +1,79 @@ package minefantasy.mf2.item.list; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.item.ItemComponentMF; -import minefantasy.mf2.item.archery.ItemBowMF; -import minefantasy.mf2.item.armour.ItemArmourMF; import minefantasy.mf2.item.food.FoodListMF; -import minefantasy.mf2.item.tool.ItemAxeMF; -import minefantasy.mf2.item.tool.advanced.ItemHandpick; -import minefantasy.mf2.item.tool.crafting.ItemHammer; import minefantasy.mf2.item.weapon.ItemSwordMF; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -public final class CreativeTabMF extends CreativeTabs -{ - public static CreativeTabs tabTool = new CreativeTabMF(CreativeTabs.getNextID(), "forgedtool", 1); - public static CreativeTabs tabWeapon = new CreativeTabMF(CreativeTabs.getNextID(), "forgedweapon", 2); - public static CreativeTabs tabArmour = new CreativeTabMF(CreativeTabs.getNextID(), "forgedarmour", 3); - public static CreativeTabs tabArcher = new CreativeTabMF(CreativeTabs.getNextID(), "MFBows", 4); - public static CreativeTabs tabUtil = new CreativeTabMF(CreativeTabs.getNextID(), "MFUtil", 5); - public static CreativeTabs tabGadget = new CreativeTabMF(CreativeTabs.getNextID(), "MFGadgets", 6); - public static CreativeTabs tabMaterialsMF = new CreativeTabMF(CreativeTabs.getNextID(), "MFMaterials", 7); - public static CreativeTabs tabToolAdvanced = new CreativeTabMF(CreativeTabs.getNextID(), "MFadvancedtool", 8); - public static CreativeTabs tabCraftTool = new CreativeTabMF(CreativeTabs.getNextID(), "MFcrafttool", 9); - public static CreativeTabs tabOres = new CreativeTabMF(CreativeTabs.getNextID(), "MFore", 10); - public static CreativeTabs tabFood = new CreativeTabMF(CreativeTabs.getNextID(), "MFfood", 11); - public static CreativeTabs tabDragonforged = new CreativeTabMF(CreativeTabs.getNextID(), "MFdragonforged", 12); - public static CreativeTabs tabOrnate = new CreativeTabMF(CreativeTabs.getNextID(), "MFornate", 13); - public static CreativeTabs tabOldTools = new CreativeTabMF(CreativeTabs.getNextID(), "MFOld", 14); - - - private int type; - CreativeTabMF(int id, String item, int t) - { +public final class CreativeTabMF extends CreativeTabs { + public static CreativeTabs tabTool = new CreativeTabMF(CreativeTabs.getNextID(), "forgedtool", 1); + public static CreativeTabs tabWeapon = new CreativeTabMF(CreativeTabs.getNextID(), "forgedweapon", 2); + public static CreativeTabs tabArmour = new CreativeTabMF(CreativeTabs.getNextID(), "forgedarmour", 3); + public static CreativeTabs tabArcher = new CreativeTabMF(CreativeTabs.getNextID(), "MFBows", 4); + public static CreativeTabs tabUtil = new CreativeTabMF(CreativeTabs.getNextID(), "MFUtil", 5); + public static CreativeTabs tabGadget = new CreativeTabMF(CreativeTabs.getNextID(), "MFGadgets", 6); + public static CreativeTabs tabMaterialsMF = new CreativeTabMF(CreativeTabs.getNextID(), "MFMaterials", 7); + public static CreativeTabs tabToolAdvanced = new CreativeTabMF(CreativeTabs.getNextID(), "MFadvancedtool", 8); + public static CreativeTabs tabCraftTool = new CreativeTabMF(CreativeTabs.getNextID(), "MFcrafttool", 9); + public static CreativeTabs tabOres = new CreativeTabMF(CreativeTabs.getNextID(), "MFore", 10); + public static CreativeTabs tabFood = new CreativeTabMF(CreativeTabs.getNextID(), "MFfood", 11); + public static CreativeTabs tabDragonforged = new CreativeTabMF(CreativeTabs.getNextID(), "MFdragonforged", 12); + public static CreativeTabs tabOrnate = new CreativeTabMF(CreativeTabs.getNextID(), "MFornate", 13); + public static CreativeTabs tabOldTools = new CreativeTabMF(CreativeTabs.getNextID(), "MFOld", 14); + public static CreativeTabs tabDwarvenforged = new CreativeTabMF(CreativeTabs.getNextID(), "MFdwarvenforged", 15); + + private int type; + + CreativeTabMF(int id, String item, int t) { super(id, item); type = t; } - @Override - @SideOnly(Side.CLIENT) - public ItemStack getIconItemStack() - { - switch(type) - { - case 1: return ((ItemAxeMF)CustomToolListMF.standard_axe).construct("Steel","OakWood"); - case 2: return ((ItemSwordMF)CustomToolListMF.standard_sword).construct("Steel","OakWood"); - case 3: return ((ItemArmourMF)CustomArmourListMF.standard_plate_helmet).construct("Steel"); - case 4: return ((ItemBowMF)CustomToolListMF.standard_bow).construct("Steel","OakWood"); - case 5: return new ItemStack(BlockListMF.anvil[1]); - case 6: return new ItemStack(ToolListMF.bomb_custom); - case 7: return ((ItemComponentMF)ComponentListMF.plank).construct("OakWood"); - case 8: return ((ItemHandpick)CustomToolListMF.standard_handpick).construct("Steel","OakWood"); - case 9: return ((ItemHammer)CustomToolListMF.standard_hammer).construct("Steel","OakWood"); - case 10: return new ItemStack(BlockListMF.oreCopper); - case 11: return new ItemStack(FoodListMF.sweetroll); - case 12: return new ItemStack(ComponentListMF.dragon_heart); - case 13: return new ItemStack(ComponentListMF.ornate_items); - case 14: return new ItemStack(ToolListMF.pickStone); - } - return new ItemStack(ComponentListMF.ingots[3]); - } - @Override - @SideOnly(Side.CLIENT) - public Item getTabIconItem() { - return CustomToolListMF.standard_axe; - } + + @Override + @SideOnly(Side.CLIENT) + public ItemStack getIconItemStack() { + switch (type) { + case 1: + return CustomToolListMF.standard_axe.construct("Steel", "OakWood"); + case 2: + return ((ItemSwordMF) CustomToolListMF.standard_sword).construct("Steel", "OakWood"); + case 3: + return CustomArmourListMF.standard_plate_helmet.construct("Steel"); + case 4: + return CustomToolListMF.standard_bow.construct("Steel", "OakWood"); + case 5: + return new ItemStack(BlockListMF.anvil[1]); + case 6: + return new ItemStack(ToolListMF.bomb_custom); + case 7: + return ComponentListMF.plank.construct("OakWood"); + case 8: + return CustomToolListMF.standard_handpick.construct("Steel", "OakWood"); + case 9: + return CustomToolListMF.standard_hammer.construct("Steel", "OakWood"); + case 10: + return new ItemStack(BlockListMF.oreCopper); + case 11: + return new ItemStack(FoodListMF.sweetroll); + case 12: + return new ItemStack(ComponentListMF.dragon_heart); + case 13: + return new ItemStack(ComponentListMF.ornate_items); + case 14: + return new ItemStack(ToolListMF.pickStone); + case 15: + return new ItemStack(CustomToolListMF.standard_longsword); + } + return new ItemStack(ComponentListMF.ingots[3]); + } + + @Override + @SideOnly(Side.CLIENT) + public Item getTabIconItem() { + return CustomToolListMF.standard_axe; + } } diff --git a/src/main/java/minefantasy/mf2/item/list/CustomArmourListMF.java b/src/main/java/minefantasy/mf2/item/list/CustomArmourListMF.java index 460d27b5..b72f96b9 100644 --- a/src/main/java/minefantasy/mf2/item/list/CustomArmourListMF.java +++ b/src/main/java/minefantasy/mf2/item/list/CustomArmourListMF.java @@ -1,41 +1,58 @@ package minefantasy.mf2.item.list; -import net.minecraft.creativetab.CreativeTabs; import minefantasy.mf2.api.armour.ArmourDesign; import minefantasy.mf2.item.armour.ItemArmourMF; import minefantasy.mf2.item.armour.ItemCustomArmour; -import minefantasy.mf2.material.BaseMaterialMF; - -public class CustomArmourListMF -{ - public static ItemArmourMF standard_scale_helmet, standard_scale_chest, standard_scale_legs, standard_scale_boots; - public static ItemArmourMF standard_chain_helmet, standard_chain_chest, standard_chain_legs, standard_chain_boots; - public static ItemArmourMF standard_splint_helmet, standard_splint_chest, standard_splint_legs, standard_splint_boots; - public static ItemArmourMF standard_plate_helmet, standard_plate_chest, standard_plate_legs, standard_plate_boots; - - public static void load() - { - String design = "standard"; - CreativeTabs tab = CreativeTabMF.tabArmour; - standard_scale_helmet = (ItemArmourMF) new ItemCustomArmour(design, "scale_helmet", ArmourDesign.SCALEMAIL, 0, "scale_layer_1", 0).setCreativeTab(tab); - standard_scale_chest = (ItemArmourMF) new ItemCustomArmour(design, "scale_chest", ArmourDesign.SCALEMAIL, 1, "scale_layer_1", 0).setCreativeTab(tab); - standard_scale_legs = (ItemArmourMF) new ItemCustomArmour(design, "scale_legs", ArmourDesign.SCALEMAIL, 2, "scale_layer_2", 0).setCreativeTab(tab); - standard_scale_boots = (ItemArmourMF) new ItemCustomArmour(design, "scale_boots", ArmourDesign.SCALEMAIL, 3, "scale_layer_1", 0).setCreativeTab(tab); - - standard_chain_helmet = (ItemArmourMF) new ItemCustomArmour(design, "chain_helmet", ArmourDesign.CHAINMAIL, 0, "chain_layer_1", 0).setCreativeTab(tab); - standard_chain_chest = (ItemArmourMF) new ItemCustomArmour(design, "chain_chest", ArmourDesign.CHAINMAIL, 1, "chain_layer_1", 0).setCreativeTab(tab); - standard_chain_legs = (ItemArmourMF) new ItemCustomArmour(design, "chain_legs", ArmourDesign.CHAINMAIL, 2, "chain_layer_2", 0).setCreativeTab(tab); - standard_chain_boots = (ItemArmourMF) new ItemCustomArmour(design, "chain_boots", ArmourDesign.CHAINMAIL, 3, "chain_layer_1", 0).setCreativeTab(tab); - - standard_splint_helmet = (ItemArmourMF) new ItemCustomArmour(design, "splint_helmet", ArmourDesign.SPLINTMAIL, 0, "splint_layer_1", 0).setCreativeTab(tab); - standard_splint_chest = (ItemArmourMF) new ItemCustomArmour(design, "splint_chest", ArmourDesign.SPLINTMAIL, 1, "splint_layer_1", 0).setCreativeTab(tab); - standard_splint_legs = (ItemArmourMF) new ItemCustomArmour(design, "splint_legs", ArmourDesign.SPLINTMAIL, 2, "splint_layer_2", 0).setCreativeTab(tab); - standard_splint_boots = (ItemArmourMF) new ItemCustomArmour(design, "splint_boots", ArmourDesign.SPLINTMAIL, 3, "splint_layer_1", 0).setCreativeTab(tab); - - standard_plate_helmet = (ItemArmourMF) new ItemCustomArmour(design, "plate_helmet", ArmourDesign.FIELDPLATE, 0, "plate_layer_1", 0).setCreativeTab(tab); - standard_plate_chest = (ItemArmourMF) new ItemCustomArmour(design, "plate_chest", ArmourDesign.FIELDPLATE, 1, "plate_layer_1", 0).setCreativeTab(tab); - standard_plate_legs = (ItemArmourMF) new ItemCustomArmour(design, "plate_legs", ArmourDesign.FIELDPLATE, 2, "plate_layer_2", 0).setCreativeTab(tab); - standard_plate_boots = (ItemArmourMF) new ItemCustomArmour(design, "plate_boots", ArmourDesign.FIELDPLATE, 3, "plate_layer_1", 0).setCreativeTab(tab); - - } +import net.minecraft.creativetab.CreativeTabs; + +public class CustomArmourListMF { + public static ItemArmourMF standard_scale_helmet, standard_scale_chest, standard_scale_legs, standard_scale_boots; + public static ItemArmourMF standard_chain_helmet, standard_chain_chest, standard_chain_legs, standard_chain_boots; + public static ItemArmourMF standard_splint_helmet, standard_splint_chest, standard_splint_legs, + standard_splint_boots; + public static ItemArmourMF standard_plate_helmet, standard_plate_chest, standard_plate_legs, standard_plate_boots; + + //public static ItemHorseArmorMF standart_plate_horse_armor; + + public static void load() { + String design = "standard"; + CreativeTabs tab = CreativeTabMF.tabArmour; + standard_scale_helmet = (ItemArmourMF) new ItemCustomArmour(design, "scale_helmet", ArmourDesign.SCALEMAIL, 0, + "scale_layer_1", 0).setCreativeTab(tab); + standard_scale_chest = (ItemArmourMF) new ItemCustomArmour(design, "scale_chest", ArmourDesign.SCALEMAIL, 1, + "scale_layer_1", 0).setCreativeTab(tab); + standard_scale_legs = (ItemArmourMF) new ItemCustomArmour(design, "scale_legs", ArmourDesign.SCALEMAIL, 2, + "scale_layer_2", 0).setCreativeTab(tab); + standard_scale_boots = (ItemArmourMF) new ItemCustomArmour(design, "scale_boots", ArmourDesign.SCALEMAIL, 3, + "scale_layer_1", 0).setCreativeTab(tab); + + standard_chain_helmet = (ItemArmourMF) new ItemCustomArmour(design, "chain_helmet", ArmourDesign.CHAINMAIL, 0, + "chain_layer_1", 0).setCreativeTab(tab); + standard_chain_chest = (ItemArmourMF) new ItemCustomArmour(design, "chain_chest", ArmourDesign.CHAINMAIL, 1, + "chain_layer_1", 0).setCreativeTab(tab); + standard_chain_legs = (ItemArmourMF) new ItemCustomArmour(design, "chain_legs", ArmourDesign.CHAINMAIL, 2, + "chain_layer_2", 0).setCreativeTab(tab); + standard_chain_boots = (ItemArmourMF) new ItemCustomArmour(design, "chain_boots", ArmourDesign.CHAINMAIL, 3, + "chain_layer_1", 0).setCreativeTab(tab); + + standard_splint_helmet = (ItemArmourMF) new ItemCustomArmour(design, "splint_helmet", ArmourDesign.SPLINTMAIL, + 0, "splint_layer_1", 0).setCreativeTab(tab); + standard_splint_chest = (ItemArmourMF) new ItemCustomArmour(design, "splint_chest", ArmourDesign.SPLINTMAIL, 1, + "splint_layer_1", 0).setCreativeTab(tab); + standard_splint_legs = (ItemArmourMF) new ItemCustomArmour(design, "splint_legs", ArmourDesign.SPLINTMAIL, 2, + "splint_layer_2", 0).setCreativeTab(tab); + standard_splint_boots = (ItemArmourMF) new ItemCustomArmour(design, "splint_boots", ArmourDesign.SPLINTMAIL, 3, + "splint_layer_1", 0).setCreativeTab(tab); + + standard_plate_helmet = (ItemArmourMF) new ItemCustomArmour(design, "plate_helmet", ArmourDesign.FIELDPLATE, 0, + "plate_layer_1", 0).setCreativeTab(tab); + standard_plate_chest = (ItemArmourMF) new ItemCustomArmour(design, "plate_chest", ArmourDesign.FIELDPLATE, 1, + "plate_layer_1", 0).setCreativeTab(tab); + standard_plate_legs = (ItemArmourMF) new ItemCustomArmour(design, "plate_legs", ArmourDesign.FIELDPLATE, 2, + "plate_layer_2", 0).setCreativeTab(tab); + standard_plate_boots = (ItemArmourMF) new ItemCustomArmour(design, "plate_boots", ArmourDesign.FIELDPLATE, 3, + "plate_layer_1", 0).setCreativeTab(tab); + + //standart_plate_horse_armor = new ItemHorseArmorMF("horse_armor", BaseMaterialMF.getMaterial("steel"), ArmourDesign.FIELDPLATE, "plate_layer_1", 0); + } } diff --git a/src/main/java/minefantasy/mf2/item/list/CustomToolListMF.java b/src/main/java/minefantasy/mf2/item/list/CustomToolListMF.java index d17957b1..79c3360a 100644 --- a/src/main/java/minefantasy/mf2/item/list/CustomToolListMF.java +++ b/src/main/java/minefantasy/mf2/item/list/CustomToolListMF.java @@ -1,130 +1,144 @@ package minefantasy.mf2.item.list; -import minefantasy.mf2.api.crafting.exotic.SpecialForging; import minefantasy.mf2.item.archery.ArrowType; import minefantasy.mf2.item.archery.EnumBowType; import minefantasy.mf2.item.archery.ItemArrowMF; import minefantasy.mf2.item.archery.ItemBowMF; import minefantasy.mf2.item.list.styles.DragonforgedStyle; import minefantasy.mf2.item.list.styles.OrnateStyle; -import minefantasy.mf2.item.tool.ItemAxeMF; -import minefantasy.mf2.item.tool.ItemHoeMF; -import minefantasy.mf2.item.tool.ItemPickMF; -import minefantasy.mf2.item.tool.ItemShearsMF; -import minefantasy.mf2.item.tool.ItemSpadeMF; -import minefantasy.mf2.item.tool.advanced.ItemHandpick; -import minefantasy.mf2.item.tool.advanced.ItemHvyPick; -import minefantasy.mf2.item.tool.advanced.ItemHvyShovel; -import minefantasy.mf2.item.tool.advanced.ItemLumberAxe; -import minefantasy.mf2.item.tool.advanced.ItemMattock; -import minefantasy.mf2.item.tool.advanced.ItemScythe; -import minefantasy.mf2.item.tool.advanced.ItemTrowMF; -import minefantasy.mf2.item.tool.crafting.ItemBasicCraftTool; -import minefantasy.mf2.item.tool.crafting.ItemHammer; -import minefantasy.mf2.item.tool.crafting.ItemKnifeMF; -import minefantasy.mf2.item.tool.crafting.ItemNeedle; -import minefantasy.mf2.item.tool.crafting.ItemSaw; -import minefantasy.mf2.item.tool.crafting.ItemSpanner; -import minefantasy.mf2.item.tool.crafting.ItemTongs; -import minefantasy.mf2.item.weapon.ItemBattleaxeMF; -import minefantasy.mf2.item.weapon.ItemDagger; -import minefantasy.mf2.item.weapon.ItemGreatswordMF; -import minefantasy.mf2.item.weapon.ItemHalbeardMF; -import minefantasy.mf2.item.weapon.ItemKatanaMF; -import minefantasy.mf2.item.weapon.ItemLance; -import minefantasy.mf2.item.weapon.ItemMaceMF; -import minefantasy.mf2.item.weapon.ItemSpearMF; -import minefantasy.mf2.item.weapon.ItemSwordMF; -import minefantasy.mf2.item.weapon.ItemWaraxeMF; -import minefantasy.mf2.item.weapon.ItemWarhammerMF; -import minefantasy.mf2.item.weapon.ItemWeaponMF; -import minefantasy.mf2.material.BaseMaterialMF; +import minefantasy.mf2.item.tool.*; +import minefantasy.mf2.item.tool.advanced.*; +import minefantasy.mf2.item.tool.crafting.*; +import minefantasy.mf2.item.weapon.*; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item.ToolMaterial; -public class CustomToolListMF -{ - //STANDARD - public static ItemWeaponMF standard_sword, standard_waraxe, standard_mace, standard_dagger, standard_spear; - public static ItemWeaponMF standard_greatsword, standard_battleaxe, standard_warhammer, standard_katana, standard_halbeard, standard_lance; - public static ItemPickMF standard_pick; - public static ItemAxeMF standard_axe; - public static ItemSpadeMF standard_spade; - public static ItemHoeMF standard_hoe; - public static ItemHvyPick standard_hvypick; - public static ItemHvyShovel standard_hvyshovel; - public static ItemHandpick standard_handpick; - public static ItemTrowMF standard_trow; - public static ItemScythe standard_scythe; - public static ItemMattock standard_mattock; - public static ItemLumberAxe standard_lumber; - - public static ItemHammer standard_hammer, standard_hvyhammer; - public static ItemTongs standard_tongs; - public static ItemShearsMF standard_shears; - public static ItemKnifeMF standard_knife; - public static ItemNeedle standard_needle; - public static ItemSaw standard_saw; - public static ItemSpanner standard_spanner; - public static ItemBasicCraftTool standard_spoon, standard_mallet; - - public static ItemBowMF standard_bow; - public static ItemArrowMF standard_arrow, standard_bolt, standard_arrow_bodkin, standard_arrow_broad; - - public static void load() - { - String design = "standard"; - CreativeTabs tab = CreativeTabMF.tabWeapon; - //Standard Weapons - standard_dagger = new ItemDagger(design+"_dagger", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_sword = new ItemSwordMF(design+"_sword", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_waraxe = new ItemWaraxeMF(design+"_waraxe", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_mace = new ItemMaceMF(design+"_mace", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_spear = new ItemSpearMF(design+"_spear", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_katana = new ItemKatanaMF(design+"_katana", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_greatsword = new ItemGreatswordMF(design+"_greatsword", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_battleaxe = new ItemBattleaxeMF(design+"_battleaxe", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_warhammer = new ItemWarhammerMF(design+"_warhammer", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_halbeard = new ItemHalbeardMF(design+"_halbeard", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - standard_lance = new ItemLance(design+"_lance", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); - - tab = CreativeTabMF.tabArcher; - standard_bow = (ItemBowMF) new ItemBowMF(design+"_bow", EnumBowType.SHORTBOW).setCustom(design).setCreativeTab(tab); - standard_bolt = (ItemArrowMF) new ItemArrowMF(design, ArrowType.BOLT, 20).setCustom(design).setAmmoType("bolt").setCreativeTab(tab); - standard_arrow = (ItemArrowMF) new ItemArrowMF(design, ArrowType.NORMAL, 16).setCustom(design).setCreativeTab(tab); - standard_arrow_bodkin = (ItemArrowMF) new ItemArrowMF(design, ArrowType.BODKIN, 16).setCustom(design).setCreativeTab(tab); - standard_arrow_broad = (ItemArrowMF) new ItemArrowMF(design, ArrowType.BROADHEAD, 16).setCustom(design).setCreativeTab(tab); - - tab = CreativeTabMF.tabTool; - //Standard Tools - standard_pick = (ItemPickMF) new ItemPickMF(design+"_pick", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_axe = (ItemAxeMF) new ItemAxeMF(design+"_axe", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_spade = (ItemSpadeMF) new ItemSpadeMF(design+"_spade", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_hoe = (ItemHoeMF) new ItemHoeMF(design+"_hoe", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - - tab = CreativeTabMF.tabToolAdvanced; - standard_handpick = (ItemHandpick) new ItemHandpick(design+"_handpick", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_hvypick = (ItemHvyPick) new ItemHvyPick(design+"_hvypick", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_trow = (ItemTrowMF) new ItemTrowMF(design+"_trow", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_hvyshovel = (ItemHvyShovel) new ItemHvyShovel(design+"_hvyshovel", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_scythe = (ItemScythe) new ItemScythe(design+"_scythe", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_mattock = (ItemMattock) new ItemMattock(design+"_mattock", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_lumber = (ItemLumberAxe) new ItemLumberAxe(design+"_lumber", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - //Standard Crafters - tab = CreativeTabMF.tabCraftTool; - standard_hammer = (ItemHammer) new ItemHammer(design+"_hammer", ToolMaterial.IRON, false, 0, 0).setCustom(design).setCreativeTab(tab); - standard_hvyhammer = (ItemHammer) new ItemHammer(design+"_hvyhammer", ToolMaterial.IRON, true, 0, 0).setCustom(design).setCreativeTab(tab); - standard_shears = (ItemShearsMF) new ItemShearsMF(design+"_shears", ToolMaterial.IRON, 0, 0).setCustom(design).setCreativeTab(tab); - standard_knife = (ItemKnifeMF) new ItemKnifeMF(design+"_knife", ToolMaterial.IRON, 0, 1F, 0).setCustom(design).setCreativeTab(tab); - standard_needle = (ItemNeedle) new ItemNeedle(design+"_needle", ToolMaterial.IRON, 0, 0).setCustom(design).setCreativeTab(tab); - standard_saw = (ItemSaw) new ItemSaw(design+"_saw", ToolMaterial.IRON, 0, 0).setCustom(design).setCreativeTab(tab); - standard_tongs = (ItemTongs) new ItemTongs(design+"_tongs", ToolMaterial.IRON, 0).setCustom(design).setCreativeTab(tab); - standard_spanner = (ItemSpanner) new ItemSpanner(design+"_spanner", 0, 0).setCustom(design).setCreativeTab(tab); - - standard_spoon = (ItemBasicCraftTool) new ItemBasicCraftTool(design+"_spoon", "spoon", 0, 64).setCustom(design).setCreativeTab(tab); - standard_mallet = (ItemBasicCraftTool) new ItemBasicCraftTool(design+"_mallet", "mallet", 0, 64).setCustom(design).setCreativeTab(tab); - - DragonforgedStyle.load(); - OrnateStyle.load(); - } +public class CustomToolListMF { + // STANDARD + public static ItemWeaponMF standard_sword, standard_waraxe, standard_mace, standard_dagger, standard_spear; + public static ItemWeaponMF standard_longsword, standard_battleaxe, standard_warhammer, standard_katana, + standard_halbeard, standard_lance, standard_greatsword, standard_shortsword, standard_saber, standard_gladius, standard_trident, + standard_nodachi, standard_claymore; + public static ItemPickMF standard_pick; + public static ItemAxeMF standard_axe; + public static ItemSpadeMF standard_spade; + public static ItemHoeMF standard_hoe; + public static ItemHvyPick standard_hvypick; + public static ItemHvyShovel standard_hvyshovel; + public static ItemHandpick standard_handpick; + public static ItemTrowMF standard_trow; + public static ItemScythe standard_scythe; + public static ItemMattock standard_mattock; + public static ItemLumberAxe standard_lumber; + + public static ItemHammer standard_hammer, standard_hvyhammer; + public static ItemTongs standard_tongs; + public static ItemShearsMF standard_shears; + public static ItemKnifeMF standard_knife; + public static ItemNeedle standard_needle; + public static ItemSaw standard_saw; + public static ItemSpanner standard_spanner; + public static ItemBasicCraftTool standard_spoon, standard_mallet; + + public static ItemBowMF standard_bow; + public static ItemArrowMF standard_arrow, standard_bolt, standard_arrow_bodkin, standard_arrow_broad; + + public static void load() { + String design = "standard"; + CreativeTabs tab = CreativeTabMF.tabWeapon; + // Standard Weapons + standard_dagger = new ItemDagger(design + "_dagger", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_sword = new ItemSwordMF(design + "_sword", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_waraxe = new ItemWaraxeMF(design + "_waraxe", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_mace = new ItemMaceMF(design + "_mace", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_spear = new ItemSpearMF(design + "_spear", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_katana = new ItemKatanaMF(design + "_katana", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_greatsword = new ItemGreatswordMF(design + "_greatsword", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + + //New Weapons + standard_longsword = new ItemLongswordMF(design + "_longsword", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_saber = new ItemSaber(design + "_saber", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_shortsword = new ItemShortsword(design + "_shortsword", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_gladius = new ItemGladius(design + "_gladius", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_trident = new ItemTrident(design + "_trident", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_nodachi = new ItemNodachi(design + "_nodachi", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + standard_claymore = new ItemClaymoreMF(design + "_claymore", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + + + + + + standard_battleaxe = new ItemBattleaxeMF(design + "_battleaxe", ToolMaterial.IRON, 0, 1F).setCustom(design) + .setTab(tab); + standard_warhammer = new ItemWarhammerMF(design + "_warhammer", ToolMaterial.IRON, 0, 1F).setCustom(design) + .setTab(tab); + standard_halbeard = new ItemHalbeardMF(design + "_halbeard", ToolMaterial.IRON, 0, 1F).setCustom(design) + .setTab(tab); + standard_lance = new ItemLance(design + "_lance", ToolMaterial.IRON, 0, 1F).setCustom(design).setTab(tab); + + tab = CreativeTabMF.tabArcher; + standard_bow = (ItemBowMF) new ItemBowMF(design + "_bow", EnumBowType.SHORTBOW).setCustom(design) + .setCreativeTab(tab); + standard_bolt = (ItemArrowMF) new ItemArrowMF(design, ArrowType.BOLT, 20).setCustom(design).setAmmoType("bolt") + .setCreativeTab(tab); + standard_arrow = (ItemArrowMF) new ItemArrowMF(design, ArrowType.NORMAL, 16).setCustom(design) + .setCreativeTab(tab); + standard_arrow_bodkin = (ItemArrowMF) new ItemArrowMF(design, ArrowType.BODKIN, 16).setCustom(design) + .setCreativeTab(tab); + standard_arrow_broad = (ItemArrowMF) new ItemArrowMF(design, ArrowType.BROADHEAD, 16).setCustom(design) + .setCreativeTab(tab); + + tab = CreativeTabMF.tabTool; + // Standard Tools + standard_pick = (ItemPickMF) new ItemPickMF(design + "_pick", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + standard_axe = (ItemAxeMF) new ItemAxeMF(design + "_axe", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + standard_spade = (ItemSpadeMF) new ItemSpadeMF(design + "_spade", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + standard_hoe = (ItemHoeMF) new ItemHoeMF(design + "_hoe", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + + tab = CreativeTabMF.tabToolAdvanced; + standard_handpick = (ItemHandpick) new ItemHandpick(design + "_handpick", ToolMaterial.IRON, 0) + .setCustom(design).setCreativeTab(tab); + standard_hvypick = (ItemHvyPick) new ItemHvyPick(design + "_hvypick", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + standard_trow = (ItemTrowMF) new ItemTrowMF(design + "_trow", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + standard_hvyshovel = (ItemHvyShovel) new ItemHvyShovel(design + "_hvyshovel", ToolMaterial.IRON, 0) + .setCustom(design).setCreativeTab(tab); + standard_scythe = (ItemScythe) new ItemScythe(design + "_scythe", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + standard_mattock = (ItemMattock) new ItemMattock(design + "_mattock", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + standard_lumber = (ItemLumberAxe) new ItemLumberAxe(design + "_lumber", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + // Standard Crafters + tab = CreativeTabMF.tabCraftTool; + standard_hammer = (ItemHammer) new ItemHammer(design + "_hammer", ToolMaterial.IRON, false, 0, 0) + .setCustom(design).setCreativeTab(tab); + standard_hvyhammer = (ItemHammer) new ItemHammer(design + "_hvyhammer", ToolMaterial.IRON, true, 0, 0) + .setCustom(design).setCreativeTab(tab); + standard_shears = (ItemShearsMF) new ItemShearsMF(design + "_shears", ToolMaterial.IRON, 0, 0).setCustom(design) + .setCreativeTab(tab); + standard_knife = (ItemKnifeMF) new ItemKnifeMF(design + "_knife", ToolMaterial.IRON, 0, 1F, 0).setCustom(design) + .setCreativeTab(tab); + standard_needle = (ItemNeedle) new ItemNeedle(design + "_needle", ToolMaterial.IRON, 0, 0).setCustom(design) + .setCreativeTab(tab); + standard_saw = (ItemSaw) new ItemSaw(design + "_saw", ToolMaterial.IRON, 0, 0).setCustom(design) + .setCreativeTab(tab); + standard_tongs = (ItemTongs) new ItemTongs(design + "_tongs", ToolMaterial.IRON, 0).setCustom(design) + .setCreativeTab(tab); + standard_spanner = (ItemSpanner) new ItemSpanner(design + "_spanner", 0, 0).setCustom(design) + .setCreativeTab(tab); + + standard_spoon = (ItemBasicCraftTool) new ItemBasicCraftTool(design + "_spoon", "spoon", 0, 64) + .setCustom(design).setCreativeTab(tab); + standard_mallet = (ItemBasicCraftTool) new ItemBasicCraftTool(design + "_mallet", "mallet", 0, 64) + .setCustom(design).setCreativeTab(tab); + + DragonforgedStyle.load(); + OrnateStyle.load(); + } } diff --git a/src/main/java/minefantasy/mf2/item/list/ToolListMF.java b/src/main/java/minefantasy/mf2/item/list/ToolListMF.java index 1d9444f4..46455341 100644 --- a/src/main/java/minefantasy/mf2/item/list/ToolListMF.java +++ b/src/main/java/minefantasy/mf2/item/list/ToolListMF.java @@ -4,35 +4,11 @@ import minefantasy.mf2.block.decor.ItemBedMF; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigHardcore; -import minefantasy.mf2.item.ItemBandage; -import minefantasy.mf2.item.ItemComponentMF; -import minefantasy.mf2.item.ItemResearchBook; -import minefantasy.mf2.item.ItemSkillBook; -import minefantasy.mf2.item.ItemWorldGenPlacer; +import minefantasy.mf2.item.*; import minefantasy.mf2.item.food.FoodListMF; -import minefantasy.mf2.item.gadget.ItemBomb; -import minefantasy.mf2.item.gadget.ItemClimbingPick; -import minefantasy.mf2.item.gadget.ItemCrossbow; -import minefantasy.mf2.item.gadget.ItemCrudeBomb; -import minefantasy.mf2.item.gadget.ItemExplodingArrow; -import minefantasy.mf2.item.gadget.ItemExplodingBolt; -import minefantasy.mf2.item.gadget.ItemLootSack; -import minefantasy.mf2.item.gadget.ItemMine; -import minefantasy.mf2.item.gadget.ItemParachute; -import minefantasy.mf2.item.gadget.ItemSpyglass; -import minefantasy.mf2.item.gadget.ItemSyringe; -import minefantasy.mf2.item.gadget.MobSpawnerMF; -import minefantasy.mf2.item.tool.ItemAxeMF; -import minefantasy.mf2.item.tool.ItemHoeMF; -import minefantasy.mf2.item.tool.ItemLighterMF; -import minefantasy.mf2.item.tool.ItemPickMF; -import minefantasy.mf2.item.tool.ItemSpadeMF; -import minefantasy.mf2.item.tool.crafting.ItemEAnvilTools; -import minefantasy.mf2.item.tool.crafting.ItemHammer; -import minefantasy.mf2.item.tool.crafting.ItemKnifeMF; -import minefantasy.mf2.item.tool.crafting.ItemNeedle; -import minefantasy.mf2.item.tool.crafting.ItemPaintBrush; -import minefantasy.mf2.item.tool.crafting.ItemTongs; +import minefantasy.mf2.item.gadget.*; +import minefantasy.mf2.item.tool.*; +import minefantasy.mf2.item.tool.crafting.*; import minefantasy.mf2.item.weapon.ItemMaceMF; import minefantasy.mf2.item.weapon.ItemSpearMF; import minefantasy.mf2.item.weapon.ItemSwordMF; @@ -52,238 +28,323 @@ /** * @author Anonymous Productions */ -public class ToolListMF -{ - public static EnumRarity poor = EnumHelper.addRarity("Poor", EnumChatFormatting.DARK_GRAY, "poor"); - public static EnumRarity unique = EnumHelper.addRarity("Unique", EnumChatFormatting.DARK_GREEN, "unique"); - public static EnumRarity rare = EnumHelper.addRarity("Rare", EnumChatFormatting.DARK_BLUE, "rare"); - - public static EnumRarity[] rarity = new EnumRarity[]{ToolListMF.poor, EnumRarity.common, EnumRarity.uncommon, EnumRarity.rare, EnumRarity.epic}; - - public static Item swordTraining = new ItemSwordMF("training_sword", ToolMaterial.WOOD, -1, 0.8F); - public static Item waraxeTraining = new ItemWaraxeMF("training_waraxe", ToolMaterial.WOOD, -1, 0.8F); - public static Item maceTraining = new ItemMaceMF("training_mace", ToolMaterial.WOOD, -1, 0.8F); - public static Item spearTraining = new ItemSpearMF("training_spear", ToolMaterial.WOOD, -1, 0.8F); - public static Item knifeStone = new ItemKnifeMF("stone_knife", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 3.5F, 0); - public static Item hammerStone = new ItemHammer("stone_hammer", BaseMaterialMF.getMaterial("stone").getToolConversion(),false, -1, 0); - public static Item tongsStone = new ItemTongs("stone_tongs", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1); - public static Item needleBone = new ItemNeedle("bone_needle", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 0); - - public static Item pickStone = new ItemPickMF("stone_pick", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1); - public static Item axeStone = new ItemAxeMF("stone_axe", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1); - public static Item spadeStone = new ItemSpadeMF("stone_spade", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1); - public static Item hoeStone = new ItemHoeMF("stone_hoe", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1); - - public static Item swordStone = new ItemSwordMF("stone_sword", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 2.0F); - public static Item maceStone = new ItemMaceMF("stone_mace", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 2.0F); - public static Item waraxeStone = new ItemWaraxeMF("stone_waraxe", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 2.0F); - public static Item spearStone = new ItemSpearMF("stone_spear", BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 2.0F); - - public static Item bandage_crude = new ItemBandage("bandage_crude", 5F); - public static Item bandage_wool = new ItemBandage("bandage_wool", 8F); - public static Item bandage_tough = new ItemBandage("bandage_tough", 12F); - - public static ItemCrudeBomb bomb_crude = new ItemCrudeBomb("bomb_crude"); - public static ItemBomb bomb_custom = new ItemBomb("bomb_basic"); - public static ItemMine mine_custom = new ItemMine("mine_basic"); - - public static ItemResearchBook researchBook = new ItemResearchBook(); - - public static Item dryrocks = new ItemLighterMF("dryrocks", 0.1F, 16); - public static Item tinderbox = new ItemLighterMF("tinderbox", 0.5F, 100); - - public static Item skillbook_artisanry = new ItemSkillBook("skillbook_artisanry", SkillList.artisanry); - public static Item skillbook_construction = new ItemSkillBook("skillbook_construction", SkillList.construction); - public static Item skillbook_provisioning = new ItemSkillBook("skillbook_provisioning", SkillList.provisioning); - public static Item skillbook_engineering = new ItemSkillBook("skillbook_engineering", SkillList.engineering); - public static Item skillbook_combat = new ItemSkillBook("skillbook_combat", SkillList.combat); - - public static Item skillbook_artisanry2 = new ItemSkillBook("skillbook_artisanry2", SkillList.artisanry).setMax(); - public static Item skillbook_construction2 = new ItemSkillBook("skillbook_construction2", SkillList.construction).setMax(); - public static Item skillbook_provisioning2 = new ItemSkillBook("skillbook_provisioning2", SkillList.provisioning).setMax(); - public static Item skillbook_engineering2 = new ItemSkillBook("skillbook_engineering2", SkillList.engineering).setMax(); - public static Item skillbook_combat2 = new ItemSkillBook("skillbook_combat2", SkillList.combat).setMax(); - - public static Item engin_anvil_tools = new ItemEAnvilTools("engin_anvil_tools", 64); - - public static Item exploding_arrow = new ItemExplodingArrow(); - public static Item spyglass = new ItemSpyglass(); - public static Item climbing_pick_basic; - public static Item parachute = new ItemParachute(); - - public static Item syringe = new ItemSyringe(); - public static Item syringe_empty = new ItemComponentMF("syringe_empty").setTextureName("minefantasy2:Other/syringe").setCreativeTab(CreativeTabMF.tabGadget); - - public static Item loot_sack = new ItemLootSack("loot_sack", 8, 0); - public static Item loot_sack_uc = new ItemLootSack("loot_sack_uc", 8, 1); - public static Item loot_sack_rare = new ItemLootSack("loot_sack_rare", 12, 2); - public static ItemCrossbow crossbow_custom = new ItemCrossbow(); - public static Item exploding_bolt = new ItemExplodingBolt(); - public static Item paint_brush = new ItemPaintBrush("paint_brush", 256); - - public static Item bedroll = new ItemBedMF("bedroll"); - - public static Item debug_place = new ItemWorldGenPlacer(); - public static Item debug_mob = new MobSpawnerMF(); - public static void load() - { - if(ConfigHardcore.HCCWeakItems) - { - weakenItems(); - } - climbing_pick_basic = new ItemClimbingPick("climbing_pick_basic", ToolMaterial.IRON, 0); - BlockListMF.load(); - ArmourListMF.load(); - FoodListMF.load(); - CustomToolListMF.load(); - CustomArmourListMF.load(); - - ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent(new ItemStack(skillbook_artisanry), 1, 5, 50)); - ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent(new ItemStack(skillbook_construction), 1, 1, 10)); - ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent(new ItemStack(ArmourListMF.leatherapron), 1, 1, 10)); - - ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 1, 2)); - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 1, 3)); - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 1, 3)); - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 1, 3)); - - ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 4, 10)); - ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 5)); - ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 1)); - - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 4, 10)); - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 5)); - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 1)); - - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 4, 10)); - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 5)); - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 1)); - - ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 6, 20)); - ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 1, 2)); - - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 4, 5)); - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 3)); - - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 3, 20)); - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 10)); - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 2)); - - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(skillbook_artisanry), 2, 6, 10)); - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(skillbook_construction), 2, 6, 10)); - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(skillbook_provisioning), 2, 6, 10)); - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(skillbook_engineering), 1, 4, 8)); - - ChestGenHooks.addItem(LootTypes.DWARVEN_STUDY, new WeightedRandomChestContent(new ItemStack(skillbook_engineering), 1, 1 , 20)); - ChestGenHooks.addItem(LootTypes.DWARVEN_STUDY, new WeightedRandomChestContent(new ItemStack(Items.paper), 5, 36, 100)); - ChestGenHooks.addItem(LootTypes.DWARVEN_STUDY, new WeightedRandomChestContent(new ItemStack(Items.feather), 1, 4 , 50)); - ChestGenHooks.addItem(LootTypes.DWARVEN_STUDY, new WeightedRandomChestContent(new ItemStack(Items.book), 5, 26, 80)); - - ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, new WeightedRandomChestContent(new ItemStack(skillbook_artisanry), 1, 1 , 40)); - ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, new WeightedRandomChestContent(new ItemStack(Items.coal), 5, 17, 100)); - ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, new WeightedRandomChestContent(ComponentListMF.bar("Iron"), 1, 4 , 50)); - ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, new WeightedRandomChestContent(new ItemStack(Items.leather), 1, 4 , 80)); - ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, new WeightedRandomChestContent(ComponentListMF.bar("Steel"), 1, 6, 40)); - - ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_basic), 1, 1, 100)); - ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_advanced), 1, 1, 50)); - ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, new WeightedRandomChestContent(new ItemStack(ComponentListMF.coke), 1, 10, 60)); - ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, new WeightedRandomChestContent(new ItemStack(skillbook_engineering), 1, 1 , 40)); - ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, new WeightedRandomChestContent(new ItemStack(ComponentListMF.bronze_gears), 1, 9, 30)); - ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, new WeightedRandomChestContent(new ItemStack(ComponentListMF.tungsten_gears), 1, 1, 20)); - - ChestGenHooks.addItem(LootTypes.DWARVEN_AMMO, new WeightedRandomChestContent(CustomToolListMF.standard_bolt.construct("Iron"), 1, 1, 100)); - ChestGenHooks.addItem(LootTypes.DWARVEN_AMMO, new WeightedRandomChestContent(CustomToolListMF.standard_bolt.construct("Encrusted"), 1, 1, 20)); - ChestGenHooks.addItem(LootTypes.DWARVEN_AMMO, new WeightedRandomChestContent(bomb_custom.createBomb((byte)1, (byte)1, (byte)0, (byte)0, 1), 1, 1, 25)); - ChestGenHooks.addItem(LootTypes.DWARVEN_AMMO, new WeightedRandomChestContent(mine_custom.createMine((byte)1, (byte)1, (byte)0, (byte)0, 1), 1, 1, 25)); - - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 1, 40)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 1, 10)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(Items.book), 1, 4, 60)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(Items.bowl), 1, 6, 100)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(ComponentListMF.clay_pot), 1, 7, 100)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(Items.bone), 1, 9, 80)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(Items.emerald), 1, 1, 20)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(Items.diamond), 1, 1, 20)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(ComponentListMF.bar("Iron"), 1, 4, 30)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(ComponentListMF.bar("Gold"), 1, 4, 20)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(ComponentListMF.bar("Silver"), 1, 4, 20)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(Items.bucket), 1, 1, 80)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, new WeightedRandomChestContent(new ItemStack(Items.clock), 1, 1, 20)); - - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 1, 40)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 10)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(Items.book), 1, 4, 20)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(Items.bowl), 1, 6, 30)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(ComponentListMF.clay_pot), 1, 7, 20)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(Items.bone), 1, 9, 10)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(Items.emerald), 1, 1, 50)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(Items.diamond), 1, 1, 50)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(ComponentListMF.bar("Iron"), 1, 4, 30)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(ComponentListMF.bar("Gold"), 1, 4, 50)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(ComponentListMF.bar("Silver"), 1, 4, 50)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(Items.bucket), 1, 1, 20)); - ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, new WeightedRandomChestContent(new ItemStack(Items.clock), 1, 1, 40)); - } - - private static void weakenItems() - { - weakenItem(Items.wooden_pickaxe, 5); - weakenItem(Items.wooden_axe, 5); - weakenItem(Items.wooden_shovel, 5); - weakenItem(Items.wooden_sword, 5); - weakenItem(Items.wooden_hoe, 5); - weakenItem(Items.leather_helmet); - weakenItem(Items.leather_chestplate); - weakenItem(Items.leather_leggings); - weakenItem(Items.leather_boots); - - weakenItem(Items.stone_pickaxe, 10); - weakenItem(Items.stone_axe, 10); - weakenItem(Items.stone_shovel, 10); - weakenItem(Items.stone_sword, 10); - weakenItem(Items.stone_hoe, 10); - - weakenItem(Items.iron_pickaxe, 25); - weakenItem(Items.iron_axe, 25); - weakenItem(Items.iron_shovel, 25); - weakenItem(Items.iron_sword, 25); - weakenItem(Items.iron_hoe, 25); - weakenItem(Items.iron_helmet); - weakenItem(Items.iron_chestplate); - weakenItem(Items.iron_leggings); - weakenItem(Items.iron_boots); - - weakenItem(Items.golden_pickaxe, 1); - weakenItem(Items.golden_axe, 1); - weakenItem(Items.golden_shovel, 1); - weakenItem(Items.golden_sword, 1); - weakenItem(Items.golden_hoe, 1); - weakenItem(Items.golden_helmet); - weakenItem(Items.golden_chestplate); - weakenItem(Items.golden_leggings); - weakenItem(Items.golden_boots); - - weakenItem(Items.diamond_pickaxe, 100); - weakenItem(Items.diamond_axe, 100); - weakenItem(Items.diamond_shovel, 100); - weakenItem(Items.diamond_sword, 100); - weakenItem(Items.diamond_hoe, 100); - weakenItem(Items.diamond_helmet); - weakenItem(Items.diamond_chestplate); - weakenItem(Items.diamond_leggings); - weakenItem(Items.diamond_boots); - } - private static void weakenItem(Item item) - { - weakenItem(item, (item.getMaxDamage()/10)+1); - } - private static void weakenItem(Item item, int hp) - { - if(item.isDamageable()) - { - item.setMaxDamage(hp); - } - } - +public class ToolListMF { + public static EnumRarity poor = EnumHelper.addRarity("Poor", EnumChatFormatting.DARK_GRAY, "poor"); + public static EnumRarity unique = EnumHelper.addRarity("Unique", EnumChatFormatting.DARK_GREEN, "unique"); + public static EnumRarity rare = EnumHelper.addRarity("Rare", EnumChatFormatting.DARK_BLUE, "rare"); + + public static EnumRarity[] rarity = new EnumRarity[]{ToolListMF.poor, EnumRarity.common, EnumRarity.uncommon, + EnumRarity.rare, EnumRarity.epic}; + + public static Item swordTraining = new ItemSwordMF("training_sword", ToolMaterial.WOOD, -1, 0.8F); + public static Item waraxeTraining = new ItemWaraxeMF("training_waraxe", ToolMaterial.WOOD, -1, 0.8F); + public static Item maceTraining = new ItemMaceMF("training_mace", ToolMaterial.WOOD, -1, 0.8F); + public static Item spearTraining = new ItemSpearMF("training_spear", ToolMaterial.WOOD, -1, 0.8F); + public static Item knifeStone = new ItemKnifeMF("stone_knife", + BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 3.5F, 0); + public static Item hammerStone = new ItemHammer("stone_hammer", + BaseMaterialMF.getMaterial("stone").getToolConversion(), false, -1, 0); + public static Item tongsStone = new ItemTongs("stone_tongs", + BaseMaterialMF.getMaterial("stone").getToolConversion(), -1); + public static Item needleBone = new ItemNeedle("bone_needle", + BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 0); + + public static Item pickStone = new ItemPickMF("stone_pick", BaseMaterialMF.getMaterial("stone").getToolConversion(), + -1); + public static Item axeStone = new ItemAxeMF("stone_axe", BaseMaterialMF.getMaterial("stone").getToolConversion(), + -1); + public static Item spadeStone = new ItemSpadeMF("stone_spade", + BaseMaterialMF.getMaterial("stone").getToolConversion(), -1); + public static Item hoeStone = new ItemHoeMF("stone_hoe", BaseMaterialMF.getMaterial("stone").getToolConversion(), + -1); + + public static Item swordStone = new ItemSwordMF("stone_sword", + BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 2.0F); + public static Item maceStone = new ItemMaceMF("stone_mace", BaseMaterialMF.getMaterial("stone").getToolConversion(), + -1, 2.0F); + public static Item waraxeStone = new ItemWaraxeMF("stone_waraxe", + BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 2.0F); + public static Item spearStone = new ItemSpearMF("stone_spear", + BaseMaterialMF.getMaterial("stone").getToolConversion(), -1, 2.0F); + + public static Item bandage_crude = new ItemBandage("bandage_crude", 5F); + public static Item bandage_wool = new ItemBandage("bandage_wool", 8F); + public static Item bandage_tough = new ItemBandage("bandage_tough", 12F); + + public static ItemCrudeBomb bomb_crude = new ItemCrudeBomb("bomb_crude"); + public static ItemBomb bomb_custom = new ItemBomb("bomb_basic"); + public static ItemMine mine_custom = new ItemMine("mine_basic"); + + public static ItemResearchBook researchBook = new ItemResearchBook(); + + public static Item dryrocks = new ItemLighterMF("dryrocks", 0.1F, 16); + public static Item tinderbox = new ItemLighterMF("tinderbox", 0.5F, 100); + + public static Item skillbook_artisanry = new ItemSkillBook("skillbook_artisanry", SkillList.artisanry); + public static Item skillbook_construction = new ItemSkillBook("skillbook_construction", SkillList.construction); + public static Item skillbook_provisioning = new ItemSkillBook("skillbook_provisioning", SkillList.provisioning); + public static Item skillbook_engineering = new ItemSkillBook("skillbook_engineering", SkillList.engineering); + public static Item skillbook_combat = new ItemSkillBook("skillbook_combat", SkillList.combat); + + public static Item skillbook_artisanry2 = new ItemSkillBook("skillbook_artisanry2", SkillList.artisanry).setMax(); + public static Item skillbook_construction2 = new ItemSkillBook("skillbook_construction2", SkillList.construction) + .setMax(); + public static Item skillbook_provisioning2 = new ItemSkillBook("skillbook_provisioning2", SkillList.provisioning) + .setMax(); + public static Item skillbook_engineering2 = new ItemSkillBook("skillbook_engineering2", SkillList.engineering) + .setMax(); + public static Item skillbook_combat2 = new ItemSkillBook("skillbook_combat2", SkillList.combat).setMax(); + + public static Item engin_anvil_tools = new ItemEAnvilTools("engin_anvil_tools", 64); + + public static Item exploding_arrow = new ItemExplodingArrow(); + public static Item spyglass = new ItemSpyglass(); + public static Item climbing_pick_basic; + public static Item parachute = new ItemParachute(); + + public static Item syringe = new ItemSyringe(); + public static Item syringe_empty = new ItemComponentMF("syringe_empty").setTextureName("minefantasy2:Other/syringe") + .setCreativeTab(CreativeTabMF.tabGadget); + + public static Item loot_sack = new ItemLootSack("loot_sack", 8, 0); + public static Item loot_sack_uc = new ItemLootSack("loot_sack_uc", 8, 1); + public static Item loot_sack_rare = new ItemLootSack("loot_sack_rare", 12, 2); + public static ItemCrossbow crossbow_custom = new ItemCrossbow(); + public static Item exploding_bolt = new ItemExplodingBolt(); + public static Item paint_brush = new ItemPaintBrush("paint_brush", 256); + + public static Item bedroll = new ItemBedMF("bedroll"); + + public static Item debug_place = new ItemWorldGenPlacer(); + public static Item debug_mob = new MobSpawnerMF(); + + public static void load() { + if (ConfigHardcore.HCCWeakItems) { + weakenItems(); + } + climbing_pick_basic = new ItemClimbingPick("climbing_pick_basic", ToolMaterial.IRON, 0); + BlockListMF.load(); + ArmourListMF.load(); + FoodListMF.load(); + CustomToolListMF.load(); + CustomArmourListMF.load(); + + ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, + new WeightedRandomChestContent(new ItemStack(skillbook_artisanry), 1, 5, 50)); + ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, + new WeightedRandomChestContent(new ItemStack(skillbook_construction), 1, 1, 10)); + ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, + new WeightedRandomChestContent(new ItemStack(ArmourListMF.leatherapron), 1, 1, 10)); + + ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 1, 2)); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 1, 3)); + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 1, 3)); + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.talisman_lesser), 1, 1, 3)); + + ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, + new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 4, 10)); + ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, + new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 5)); + ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, + new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 1)); + + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, + new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 4, 10)); + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, + new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 5)); + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, + new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 1)); + + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, + new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 4, 10)); + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, + new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 5)); + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, + new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 1)); + + ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, + new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 6, 20)); + ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, + new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 1, 2)); + + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, + new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 4, 5)); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, + new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 3)); + + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, + new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 3, 20)); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, + new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 2, 10)); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, + new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 2)); + + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, + new WeightedRandomChestContent(new ItemStack(skillbook_artisanry), 2, 6, 10)); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, + new WeightedRandomChestContent(new ItemStack(skillbook_construction), 2, 6, 10)); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, + new WeightedRandomChestContent(new ItemStack(skillbook_provisioning), 2, 6, 10)); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, + new WeightedRandomChestContent(new ItemStack(skillbook_engineering), 1, 4, 8)); + + ChestGenHooks.addItem(LootTypes.DWARVEN_STUDY, + new WeightedRandomChestContent(new ItemStack(skillbook_engineering), 1, 1, 20)); + ChestGenHooks.addItem(LootTypes.DWARVEN_STUDY, + new WeightedRandomChestContent(new ItemStack(Items.paper), 5, 36, 100)); + ChestGenHooks.addItem(LootTypes.DWARVEN_STUDY, + new WeightedRandomChestContent(new ItemStack(Items.feather), 1, 4, 50)); + ChestGenHooks.addItem(LootTypes.DWARVEN_STUDY, + new WeightedRandomChestContent(new ItemStack(Items.book), 5, 26, 80)); + + ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, + new WeightedRandomChestContent(new ItemStack(skillbook_artisanry), 1, 1, 40)); + ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, + new WeightedRandomChestContent(new ItemStack(Items.coal), 5, 17, 100)); + ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, + new WeightedRandomChestContent(ComponentListMF.bar("Iron"), 1, 4, 50)); + ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, + new WeightedRandomChestContent(new ItemStack(Items.leather), 1, 4, 80)); + ChestGenHooks.addItem(LootTypes.DWARVEN_FORGE, + new WeightedRandomChestContent(ComponentListMF.bar("Steel"), 1, 6, 40)); + + ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, + new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_basic), 1, 1, 100)); + ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, + new WeightedRandomChestContent(new ItemStack(BlockListMF.repair_advanced), 1, 1, 50)); + ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.coke), 1, 10, 60)); + ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, + new WeightedRandomChestContent(new ItemStack(skillbook_engineering), 1, 1, 40)); + ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.bronze_gears), 1, 9, 30)); + ChestGenHooks.addItem(LootTypes.DWARVEN_ARMOURY, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.tungsten_gears), 1, 1, 20)); + + ChestGenHooks.addItem(LootTypes.DWARVEN_AMMO, + new WeightedRandomChestContent(CustomToolListMF.standard_bolt.construct("Iron"), 1, 1, 100)); + ChestGenHooks.addItem(LootTypes.DWARVEN_AMMO, + new WeightedRandomChestContent(CustomToolListMF.standard_bolt.construct("Encrusted"), 1, 1, 20)); + ChestGenHooks.addItem(LootTypes.DWARVEN_AMMO, new WeightedRandomChestContent( + bomb_custom.createBomb((byte) 1, (byte) 1, (byte) 0, (byte) 0, 1), 1, 1, 25)); + ChestGenHooks.addItem(LootTypes.DWARVEN_AMMO, new WeightedRandomChestContent( + mine_custom.createMine((byte) 1, (byte) 1, (byte) 0, (byte) 0, 1), 1, 1, 25)); + + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(loot_sack), 1, 1, 40)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 1, 10)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(Items.book), 1, 4, 60)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(Items.bowl), 1, 6, 100)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.clay_pot), 1, 7, 100)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(Items.bone), 1, 9, 80)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(Items.emerald), 1, 1, 20)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(Items.diamond), 1, 1, 20)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(ComponentListMF.bar("Iron"), 1, 4, 30)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(ComponentListMF.bar("Gold"), 1, 4, 20)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(ComponentListMF.bar("Silver"), 1, 4, 20)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(Items.bucket), 1, 1, 80)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME, + new WeightedRandomChestContent(new ItemStack(Items.clock), 1, 1, 20)); + + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(loot_sack_uc), 1, 1, 40)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(loot_sack_rare), 1, 1, 10)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(Items.book), 1, 4, 20)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(Items.bowl), 1, 6, 30)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(ComponentListMF.clay_pot), 1, 7, 20)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(Items.bone), 1, 9, 10)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(Items.emerald), 1, 1, 50)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(Items.diamond), 1, 1, 50)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(ComponentListMF.bar("Iron"), 1, 4, 30)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(ComponentListMF.bar("Gold"), 1, 4, 50)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(ComponentListMF.bar("Silver"), 1, 4, 50)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(Items.bucket), 1, 1, 20)); + ChestGenHooks.addItem(LootTypes.DWARVEN_HOME_RICH, + new WeightedRandomChestContent(new ItemStack(Items.clock), 1, 1, 40)); + } + + private static void weakenItems() { + weakenItem(Items.wooden_pickaxe, 5); + weakenItem(Items.wooden_axe, 5); + weakenItem(Items.wooden_shovel, 5); + weakenItem(Items.wooden_sword, 5); + weakenItem(Items.wooden_hoe, 5); + weakenItem(Items.leather_helmet); + weakenItem(Items.leather_chestplate); + weakenItem(Items.leather_leggings); + weakenItem(Items.leather_boots); + + weakenItem(Items.stone_pickaxe, 10); + weakenItem(Items.stone_axe, 10); + weakenItem(Items.stone_shovel, 10); + weakenItem(Items.stone_sword, 10); + weakenItem(Items.stone_hoe, 10); + + weakenItem(Items.iron_pickaxe, 25); + weakenItem(Items.iron_axe, 25); + weakenItem(Items.iron_shovel, 25); + weakenItem(Items.iron_sword, 25); + weakenItem(Items.iron_hoe, 25); + weakenItem(Items.iron_helmet); + weakenItem(Items.iron_chestplate); + weakenItem(Items.iron_leggings); + weakenItem(Items.iron_boots); + + weakenItem(Items.golden_pickaxe, 1); + weakenItem(Items.golden_axe, 1); + weakenItem(Items.golden_shovel, 1); + weakenItem(Items.golden_sword, 1); + weakenItem(Items.golden_hoe, 1); + weakenItem(Items.golden_helmet); + weakenItem(Items.golden_chestplate); + weakenItem(Items.golden_leggings); + weakenItem(Items.golden_boots); + + weakenItem(Items.diamond_pickaxe, 100); + weakenItem(Items.diamond_axe, 100); + weakenItem(Items.diamond_shovel, 100); + weakenItem(Items.diamond_sword, 100); + weakenItem(Items.diamond_hoe, 100); + weakenItem(Items.diamond_helmet); + weakenItem(Items.diamond_chestplate); + weakenItem(Items.diamond_leggings); + weakenItem(Items.diamond_boots); + } + + private static void weakenItem(Item item) { + weakenItem(item, (item.getMaxDamage() / 10) + 1); + } + + private static void weakenItem(Item item, int hp) { + if (item.isDamageable()) { + item.setMaxDamage(hp); + } + } + } diff --git a/src/main/java/minefantasy/mf2/item/list/styles/DragonforgedStyle.java b/src/main/java/minefantasy/mf2/item/list/styles/DragonforgedStyle.java index 72e91e94..0d6a39e0 100644 --- a/src/main/java/minefantasy/mf2/item/list/styles/DragonforgedStyle.java +++ b/src/main/java/minefantasy/mf2/item/list/styles/DragonforgedStyle.java @@ -2,8 +2,8 @@ import minefantasy.mf2.api.armour.ArmourDesign; import minefantasy.mf2.api.crafting.exotic.SpecialForging; -import minefantasy.mf2.item.archery.*; -import minefantasy.mf2.item.armour.ItemArmourMF; +import minefantasy.mf2.item.archery.EnumBowType; +import minefantasy.mf2.item.archery.ItemBowMF; import minefantasy.mf2.item.armour.ItemCustomArmour; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.CustomArmourListMF; @@ -12,166 +12,208 @@ import minefantasy.mf2.item.tool.advanced.*; import minefantasy.mf2.item.tool.crafting.*; import minefantasy.mf2.item.weapon.*; -import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.common.util.EnumHelper; -public class DragonforgedStyle -{ - public static ToolMaterial dragonforged = EnumHelper.addToolMaterial("dragonforged", 2, 250, 6.0F, 2.0F, 15); - - public static ItemWeaponMF dragonforged_sword, dragonforged_waraxe, dragonforged_mace, dragonforged_dagger, dragonforged_spear; - public static ItemWeaponMF dragonforged_greatsword, dragonforged_battleaxe, dragonforged_warhammer, dragonforged_katana, dragonforged_halbeard, dragonforged_lance; - public static ItemPickMF dragonforged_pick; - public static ItemAxeMF dragonforged_axe; - public static ItemSpadeMF dragonforged_spade; - public static ItemHoeMF dragonforged_hoe; - public static ItemHvyPick dragonforged_hvypick; - public static ItemHvyShovel dragonforged_hvyshovel; - public static ItemHandpick dragonforged_handpick; - public static ItemTrowMF dragonforged_trow; - public static ItemScythe dragonforged_scythe; - public static ItemMattock dragonforged_mattock; - public static ItemLumberAxe dragonforged_lumber; - - public static ItemHammer dragonforged_hammer, dragonforged_hvyhammer; - public static ItemTongs dragonforged_tongs; - public static ItemShearsMF dragonforged_shears; - public static ItemKnifeMF dragonforged_knife; - public static ItemNeedle dragonforged_needle; - public static ItemSaw dragonforged_saw; - public static ItemSpanner dragonforged_spanner; - - public static ItemBowMF dragonforged_bow; - - public static ItemCustomArmour dragonforged_scale_helmet, dragonforged_scale_chest, dragonforged_scale_legs, dragonforged_scale_boots; - public static ItemCustomArmour dragonforged_chain_helmet, dragonforged_chain_chest, dragonforged_chain_legs, dragonforged_chain_boots; - public static ItemCustomArmour dragonforged_splint_helmet, dragonforged_splint_chest, dragonforged_splint_legs, dragonforged_splint_boots; - public static ItemCustomArmour dragonforged_plate_helmet, dragonforged_plate_chest, dragonforged_plate_legs, dragonforged_plate_boots; - - public static void load() - { - String design = "dragonforged"; - CreativeTabs tab = CreativeTabMF.tabDragonforged; - ToolMaterial mat = dragonforged; - float ratingMod = 1.2F; - - dragonforged_dagger = new ItemDagger(design+"_dagger", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_sword = new ItemSwordMF(design+"_sword", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_waraxe = new ItemWaraxeMF(design+"_waraxe", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_mace = new ItemMaceMF(design+"_mace", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_spear = new ItemSpearMF(design+"_spear", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_katana = new ItemKatanaMF(design+"_katana", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_greatsword = new ItemGreatswordMF(design+"_greatsword", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_battleaxe = new ItemBattleaxeMF(design+"_battleaxe", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_warhammer = new ItemWarhammerMF(design+"_warhammer", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_halbeard = new ItemHalbeardMF(design+"_halbeard", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - dragonforged_lance = new ItemLance(design+"_lance", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(1); - - - dragonforged_bow = (ItemBowMF) new ItemBowMF(design+"_bow", mat, EnumBowType.SHORTBOW, 1).setCustom(design).setCreativeTab(tab); - - //Tools - dragonforged_pick = (ItemPickMF) new ItemPickMF(design+"_pick", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_axe = (ItemAxeMF) new ItemAxeMF(design+"_axe", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_spade = (ItemSpadeMF) new ItemSpadeMF(design+"_spade", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_hoe = (ItemHoeMF) new ItemHoeMF(design+"_hoe", mat, 0).setCustom(design).setCreativeTab(tab); - - dragonforged_handpick = (ItemHandpick) new ItemHandpick(design+"_handpick", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_hvypick = (ItemHvyPick) new ItemHvyPick(design+"_hvypick", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_trow = (ItemTrowMF) new ItemTrowMF(design+"_trow", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_hvyshovel = (ItemHvyShovel) new ItemHvyShovel(design+"_hvyshovel", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_scythe = (ItemScythe) new ItemScythe(design+"_scythe", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_mattock = (ItemMattock) new ItemMattock(design+"_mattock", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_lumber = (ItemLumberAxe) new ItemLumberAxe(design+"_lumber", mat, 0).setCustom(design).setCreativeTab(tab); - - //Crafters - dragonforged_hammer = (ItemHammer) new ItemHammer(design+"_hammer", mat, false, 0, 0).setCustom(design).setCreativeTab(tab); - dragonforged_hvyhammer = (ItemHammer) new ItemHammer(design+"_hvyhammer", mat, true, 0, 0).setCustom(design).setCreativeTab(tab); - dragonforged_shears = (ItemShearsMF) new ItemShearsMF(design+"_shears", mat, 0, 0).setCustom(design).setCreativeTab(tab); - dragonforged_knife = (ItemKnifeMF) new ItemKnifeMF(design+"_knife", mat, 0, 1F, 0).setCustom(design).setCreativeTab(tab); - dragonforged_needle = (ItemNeedle) new ItemNeedle(design+"_needle", mat, 0, 0).setCustom(design).setCreativeTab(tab); - dragonforged_saw = (ItemSaw) new ItemSaw(design+"_saw", mat, 0, 0).setCustom(design).setCreativeTab(tab); - dragonforged_tongs = (ItemTongs) new ItemTongs(design+"_tongs", mat, 0).setCustom(design).setCreativeTab(tab); - dragonforged_spanner = (ItemSpanner) new ItemSpanner(design+"_spanner", 0, 0).setCustom(design).setCreativeTab(tab); - - dragonforged_chain_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "chain_helmet", ArmourDesign.CHAINMAIL, 0, "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_chain_chest = (ItemCustomArmour) new ItemCustomArmour(design, "chain_chest", ArmourDesign.CHAINMAIL, 1, "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_chain_legs = (ItemCustomArmour) new ItemCustomArmour(design, "chain_legs", ArmourDesign.CHAINMAIL, 2, "chain_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_chain_boots = (ItemCustomArmour) new ItemCustomArmour(design, "chain_boots", ArmourDesign.CHAINMAIL, 3, "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - - dragonforged_scale_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "scale_helmet", ArmourDesign.SCALEMAIL, 0, "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_scale_chest = (ItemCustomArmour) new ItemCustomArmour(design, "scale_chest", ArmourDesign.SCALEMAIL, 1, "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_scale_legs = (ItemCustomArmour) new ItemCustomArmour(design, "scale_legs", ArmourDesign.SCALEMAIL, 2, "scale_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_scale_boots = (ItemCustomArmour) new ItemCustomArmour(design, "scale_boots", ArmourDesign.SCALEMAIL, 3, "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - - dragonforged_splint_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "splint_helmet", ArmourDesign.SPLINTMAIL, 0, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_splint_chest = (ItemCustomArmour) new ItemCustomArmour(design, "splint_chest", ArmourDesign.SPLINTMAIL, 1, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_splint_legs = (ItemCustomArmour) new ItemCustomArmour(design, "splint_legs", ArmourDesign.SPLINTMAIL, 2, "splint_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_splint_boots = (ItemCustomArmour) new ItemCustomArmour(design, "splint_boots", ArmourDesign.SPLINTMAIL, 3, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - - dragonforged_plate_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "plate_helmet", ArmourDesign.FIELDPLATE, 0, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_plate_chest = (ItemCustomArmour) new ItemCustomArmour(design, "plate_chest", ArmourDesign.FIELDPLATE, 1, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_plate_legs = (ItemCustomArmour) new ItemCustomArmour(design, "plate_legs", ArmourDesign.FIELDPLATE, 2, "plate_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); - dragonforged_plate_boots = (ItemCustomArmour) new ItemCustomArmour(design, "plate_boots", ArmourDesign.FIELDPLATE, 3, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - } - - public static void loadCrafting() - { - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_dagger, dragonforged_dagger); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_sword, dragonforged_sword); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_mace, dragonforged_mace); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_waraxe, dragonforged_waraxe); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_spear, dragonforged_spear); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_katana, dragonforged_katana); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_greatsword, dragonforged_greatsword); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_warhammer, dragonforged_warhammer); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_battleaxe, dragonforged_battleaxe); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_halbeard, dragonforged_halbeard); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_lance, dragonforged_lance); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_bow, dragonforged_bow); - - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_pick, dragonforged_pick); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_axe, dragonforged_axe); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_spade, dragonforged_spade); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hoe, dragonforged_hoe); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_shears, dragonforged_shears); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hvypick, dragonforged_hvypick); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hvyshovel, dragonforged_hvyshovel); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_trow, dragonforged_trow); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_handpick, dragonforged_handpick); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_mattock, dragonforged_mattock); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_spade, dragonforged_spade); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_scythe, dragonforged_scythe); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_spanner, dragonforged_spanner); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_lumber, dragonforged_lumber); - - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hammer, dragonforged_hammer); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hvyhammer, dragonforged_hvyhammer); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_tongs, dragonforged_tongs); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_saw, dragonforged_saw); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_needle, dragonforged_needle); - SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_knife, dragonforged_knife); - - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_chain_boots, dragonforged_chain_boots); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_chain_legs, dragonforged_chain_legs); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_chain_chest, dragonforged_chain_chest); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_chain_helmet, dragonforged_chain_helmet); - - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_scale_boots, dragonforged_scale_boots); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_scale_legs, dragonforged_scale_legs); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_scale_chest, dragonforged_scale_chest); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_scale_helmet, dragonforged_scale_helmet); - - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_splint_boots, dragonforged_splint_boots); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_splint_legs, dragonforged_splint_legs); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_splint_chest, dragonforged_splint_chest); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_splint_helmet, dragonforged_splint_helmet); - - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_plate_boots, dragonforged_plate_boots); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_plate_legs, dragonforged_plate_legs); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_plate_chest, dragonforged_plate_chest); - SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_plate_helmet, dragonforged_plate_helmet); - } +public class DragonforgedStyle { + public static ToolMaterial dragonforged = EnumHelper.addToolMaterial("dragonforged", 2, 250, 6.0F, 2.0F, 15); + + public static ItemWeaponMF dragonforged_sword, dragonforged_waraxe, dragonforged_mace, dragonforged_dagger, + dragonforged_spear; + public static ItemWeaponMF dragonforged_greatsword, dragonforged_battleaxe, dragonforged_warhammer, + dragonforged_katana, dragonforged_halbeard, dragonforged_lance; + public static ItemPickMF dragonforged_pick; + public static ItemAxeMF dragonforged_axe; + public static ItemSpadeMF dragonforged_spade; + public static ItemHoeMF dragonforged_hoe; + public static ItemHvyPick dragonforged_hvypick; + public static ItemHvyShovel dragonforged_hvyshovel; + public static ItemHandpick dragonforged_handpick; + public static ItemTrowMF dragonforged_trow; + public static ItemScythe dragonforged_scythe; + public static ItemMattock dragonforged_mattock; + public static ItemLumberAxe dragonforged_lumber; + + public static ItemHammer dragonforged_hammer, dragonforged_hvyhammer; + public static ItemTongs dragonforged_tongs; + public static ItemShearsMF dragonforged_shears; + public static ItemKnifeMF dragonforged_knife; + public static ItemNeedle dragonforged_needle; + public static ItemSaw dragonforged_saw; + public static ItemSpanner dragonforged_spanner; + + public static ItemBowMF dragonforged_bow; + + public static ItemCustomArmour dragonforged_scale_helmet, dragonforged_scale_chest, dragonforged_scale_legs, + dragonforged_scale_boots; + public static ItemCustomArmour dragonforged_chain_helmet, dragonforged_chain_chest, dragonforged_chain_legs, + dragonforged_chain_boots; + public static ItemCustomArmour dragonforged_splint_helmet, dragonforged_splint_chest, dragonforged_splint_legs, + dragonforged_splint_boots; + public static ItemCustomArmour dragonforged_plate_helmet, dragonforged_plate_chest, dragonforged_plate_legs, + dragonforged_plate_boots; + + public static void load() { + String design = "dragonforged"; + CreativeTabs tab = CreativeTabMF.tabDragonforged; + ToolMaterial mat = dragonforged; + float ratingMod = 1.2F; + + dragonforged_dagger = new ItemDagger(design + "_dagger", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_sword = new ItemSwordMF(design + "_sword", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_waraxe = new ItemWaraxeMF(design + "_waraxe", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_mace = new ItemMaceMF(design + "_mace", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_spear = new ItemSpearMF(design + "_spear", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_katana = new ItemKatanaMF(design + "_katana", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_greatsword = new ItemGreatswordMF(design + "_greatsword", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_battleaxe = new ItemBattleaxeMF(design + "_battleaxe", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_warhammer = new ItemWarhammerMF(design + "_warhammer", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_halbeard = new ItemHalbeardMF(design + "_halbeard", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + dragonforged_lance = new ItemLance(design + "_lance", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(1); + + dragonforged_bow = (ItemBowMF) new ItemBowMF(design + "_bow", mat, EnumBowType.SHORTBOW, 1).setCustom(design) + .setCreativeTab(tab); + + // Tools + dragonforged_pick = (ItemPickMF) new ItemPickMF(design + "_pick", mat, 0).setCustom(design).setCreativeTab(tab); + dragonforged_axe = (ItemAxeMF) new ItemAxeMF(design + "_axe", mat, 0).setCustom(design).setCreativeTab(tab); + dragonforged_spade = (ItemSpadeMF) new ItemSpadeMF(design + "_spade", mat, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_hoe = (ItemHoeMF) new ItemHoeMF(design + "_hoe", mat, 0).setCustom(design).setCreativeTab(tab); + + dragonforged_handpick = (ItemHandpick) new ItemHandpick(design + "_handpick", mat, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_hvypick = (ItemHvyPick) new ItemHvyPick(design + "_hvypick", mat, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_trow = (ItemTrowMF) new ItemTrowMF(design + "_trow", mat, 0).setCustom(design).setCreativeTab(tab); + dragonforged_hvyshovel = (ItemHvyShovel) new ItemHvyShovel(design + "_hvyshovel", mat, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_scythe = (ItemScythe) new ItemScythe(design + "_scythe", mat, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_mattock = (ItemMattock) new ItemMattock(design + "_mattock", mat, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_lumber = (ItemLumberAxe) new ItemLumberAxe(design + "_lumber", mat, 0).setCustom(design) + .setCreativeTab(tab); + + // Crafters + dragonforged_hammer = (ItemHammer) new ItemHammer(design + "_hammer", mat, false, 0, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_hvyhammer = (ItemHammer) new ItemHammer(design + "_hvyhammer", mat, true, 0, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_shears = (ItemShearsMF) new ItemShearsMF(design + "_shears", mat, 0, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_knife = (ItemKnifeMF) new ItemKnifeMF(design + "_knife", mat, 0, 1F, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_needle = (ItemNeedle) new ItemNeedle(design + "_needle", mat, 0, 0).setCustom(design) + .setCreativeTab(tab); + dragonforged_saw = (ItemSaw) new ItemSaw(design + "_saw", mat, 0, 0).setCustom(design).setCreativeTab(tab); + dragonforged_tongs = (ItemTongs) new ItemTongs(design + "_tongs", mat, 0).setCustom(design).setCreativeTab(tab); + dragonforged_spanner = (ItemSpanner) new ItemSpanner(design + "_spanner", 0, 0).setCustom(design) + .setCreativeTab(tab); + + dragonforged_chain_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "chain_helmet", + ArmourDesign.CHAINMAIL, 0, "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_chain_chest = (ItemCustomArmour) new ItemCustomArmour(design, "chain_chest", + ArmourDesign.CHAINMAIL, 1, "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_chain_legs = (ItemCustomArmour) new ItemCustomArmour(design, "chain_legs", ArmourDesign.CHAINMAIL, + 2, "chain_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_chain_boots = (ItemCustomArmour) new ItemCustomArmour(design, "chain_boots", + ArmourDesign.CHAINMAIL, 3, "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + + dragonforged_scale_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "scale_helmet", + ArmourDesign.SCALEMAIL, 0, "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_scale_chest = (ItemCustomArmour) new ItemCustomArmour(design, "scale_chest", + ArmourDesign.SCALEMAIL, 1, "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_scale_legs = (ItemCustomArmour) new ItemCustomArmour(design, "scale_legs", ArmourDesign.SCALEMAIL, + 2, "scale_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_scale_boots = (ItemCustomArmour) new ItemCustomArmour(design, "scale_boots", + ArmourDesign.SCALEMAIL, 3, "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + + dragonforged_splint_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "splint_helmet", + ArmourDesign.SPLINTMAIL, 0, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_splint_chest = (ItemCustomArmour) new ItemCustomArmour(design, "splint_chest", + ArmourDesign.SPLINTMAIL, 1, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_splint_legs = (ItemCustomArmour) new ItemCustomArmour(design, "splint_legs", + ArmourDesign.SPLINTMAIL, 2, "splint_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_splint_boots = (ItemCustomArmour) new ItemCustomArmour(design, "splint_boots", + ArmourDesign.SPLINTMAIL, 3, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + + dragonforged_plate_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "plate_helmet", + ArmourDesign.FIELDPLATE, 0, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_plate_chest = (ItemCustomArmour) new ItemCustomArmour(design, "plate_chest", + ArmourDesign.FIELDPLATE, 1, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_plate_legs = (ItemCustomArmour) new ItemCustomArmour(design, "plate_legs", ArmourDesign.FIELDPLATE, + 2, "plate_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); + dragonforged_plate_boots = (ItemCustomArmour) new ItemCustomArmour(design, "plate_boots", + ArmourDesign.FIELDPLATE, 3, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + } + + public static void loadCrafting() { + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_dagger, dragonforged_dagger); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_sword, dragonforged_sword); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_mace, dragonforged_mace); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_waraxe, dragonforged_waraxe); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_spear, dragonforged_spear); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_katana, dragonforged_katana); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_greatsword, dragonforged_greatsword); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_warhammer, dragonforged_warhammer); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_battleaxe, dragonforged_battleaxe); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_halbeard, dragonforged_halbeard); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_lance, dragonforged_lance); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_bow, dragonforged_bow); + + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_pick, dragonforged_pick); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_axe, dragonforged_axe); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_spade, dragonforged_spade); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hoe, dragonforged_hoe); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_shears, dragonforged_shears); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hvypick, dragonforged_hvypick); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hvyshovel, dragonforged_hvyshovel); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_trow, dragonforged_trow); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_handpick, dragonforged_handpick); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_mattock, dragonforged_mattock); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_spade, dragonforged_spade); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_scythe, dragonforged_scythe); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_spanner, dragonforged_spanner); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_lumber, dragonforged_lumber); + + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hammer, dragonforged_hammer); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_hvyhammer, dragonforged_hvyhammer); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_tongs, dragonforged_tongs); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_saw, dragonforged_saw); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_needle, dragonforged_needle); + SpecialForging.addDragonforgeCraft(CustomToolListMF.standard_knife, dragonforged_knife); + + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_chain_boots, dragonforged_chain_boots); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_chain_legs, dragonforged_chain_legs); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_chain_chest, dragonforged_chain_chest); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_chain_helmet, dragonforged_chain_helmet); + + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_scale_boots, dragonforged_scale_boots); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_scale_legs, dragonforged_scale_legs); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_scale_chest, dragonforged_scale_chest); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_scale_helmet, dragonforged_scale_helmet); + + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_splint_boots, dragonforged_splint_boots); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_splint_legs, dragonforged_splint_legs); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_splint_chest, dragonforged_splint_chest); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_splint_helmet, dragonforged_splint_helmet); + + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_plate_boots, dragonforged_plate_boots); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_plate_legs, dragonforged_plate_legs); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_plate_chest, dragonforged_plate_chest); + SpecialForging.addDragonforgeCraft(CustomArmourListMF.standard_plate_helmet, dragonforged_plate_helmet); + } } diff --git a/src/main/java/minefantasy/mf2/item/list/styles/OrnateStyle.java b/src/main/java/minefantasy/mf2/item/list/styles/OrnateStyle.java index 3e4fa6de..c1eeb9af 100644 --- a/src/main/java/minefantasy/mf2/item/list/styles/OrnateStyle.java +++ b/src/main/java/minefantasy/mf2/item/list/styles/OrnateStyle.java @@ -2,8 +2,8 @@ import minefantasy.mf2.api.armour.ArmourDesign; import minefantasy.mf2.api.crafting.exotic.SpecialForging; -import minefantasy.mf2.item.archery.*; -import minefantasy.mf2.item.armour.ItemArmourMF; +import minefantasy.mf2.item.archery.EnumBowType; +import minefantasy.mf2.item.archery.ItemBowMF; import minefantasy.mf2.item.armour.ItemCustomArmour; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.CustomArmourListMF; @@ -12,168 +12,200 @@ import minefantasy.mf2.item.tool.advanced.*; import minefantasy.mf2.item.tool.crafting.*; import minefantasy.mf2.item.weapon.*; -import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.common.util.EnumHelper; -public class OrnateStyle -{ - public static ToolMaterial ornate = EnumHelper.addToolMaterial("ornate", 2, 250, 6.0F, 2.0F, 100); - - public static ItemWeaponMF ornate_sword, ornate_waraxe, ornate_mace, ornate_dagger, ornate_spear; - public static ItemWeaponMF ornate_greatsword, ornate_battleaxe, ornate_warhammer, ornate_katana, ornate_halbeard, ornate_lance; - public static ItemPickMF ornate_pick; - public static ItemAxeMF ornate_axe; - public static ItemSpadeMF ornate_spade; - public static ItemHoeMF ornate_hoe; - public static ItemHvyPick ornate_hvypick; - public static ItemHvyShovel ornate_hvyshovel; - public static ItemHandpick ornate_handpick; - public static ItemTrowMF ornate_trow; - public static ItemScythe ornate_scythe; - public static ItemMattock ornate_mattock; - public static ItemLumberAxe ornate_lumber; - - public static ItemHammer ornate_hammer, ornate_hvyhammer; - public static ItemTongs ornate_tongs; - public static ItemShearsMF ornate_shears; - public static ItemKnifeMF ornate_knife; - public static ItemNeedle ornate_needle; - public static ItemSaw ornate_saw; - public static ItemSpanner ornate_spanner; - - public static ItemBowMF ornate_bow; - - public static ItemCustomArmour ornate_scale_helmet, ornate_scale_chest, ornate_scale_legs, ornate_scale_boots; - public static ItemCustomArmour ornate_chain_helmet, ornate_chain_chest, ornate_chain_legs, ornate_chain_boots; - public static ItemCustomArmour ornate_splint_helmet, ornate_splint_chest, ornate_splint_legs, ornate_splint_boots; - public static ItemCustomArmour ornate_plate_helmet, ornate_plate_chest, ornate_plate_legs, ornate_plate_boots; - - public static void load() - { - String design = "ornate"; - CreativeTabs tab = CreativeTabMF.tabOrnate; - ToolMaterial mat = ornate; - float ratingMod = 0.8F; - - ornate_dagger = new ItemDagger(design+"_dagger", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_sword = new ItemSwordMF(design+"_sword", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_waraxe = new ItemWaraxeMF(design+"_waraxe", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_mace = new ItemMaceMF(design+"_mace", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_spear = new ItemSpearMF(design+"_spear", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_katana = new ItemKatanaMF(design+"_katana", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_greatsword = new ItemGreatswordMF(design+"_greatsword", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_battleaxe = new ItemBattleaxeMF(design+"_battleaxe", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_warhammer = new ItemWarhammerMF(design+"_warhammer", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_halbeard = new ItemHalbeardMF(design+"_halbeard", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - ornate_lance = new ItemLance(design+"_lance", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); - - - ornate_bow = (ItemBowMF) new ItemBowMF(design+"_bow", mat, EnumBowType.SHORTBOW, 1).setCustom(design).setCreativeTab(tab); - - //Tools - ornate_pick = (ItemPickMF) new ItemPickMF(design+"_pick", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_axe = (ItemAxeMF) new ItemAxeMF(design+"_axe", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_spade = (ItemSpadeMF) new ItemSpadeMF(design+"_spade", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_hoe = (ItemHoeMF) new ItemHoeMF(design+"_hoe", mat, 0).setCustom(design).setCreativeTab(tab); - - ornate_handpick = (ItemHandpick) new ItemHandpick(design+"_handpick", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_hvypick = (ItemHvyPick) new ItemHvyPick(design+"_hvypick", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_trow = (ItemTrowMF) new ItemTrowMF(design+"_trow", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_hvyshovel = (ItemHvyShovel) new ItemHvyShovel(design+"_hvyshovel", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_scythe = (ItemScythe) new ItemScythe(design+"_scythe", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_mattock = (ItemMattock) new ItemMattock(design+"_mattock", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_lumber = (ItemLumberAxe) new ItemLumberAxe(design+"_lumber", mat, 0).setCustom(design).setCreativeTab(tab); - - //Crafters - ornate_hammer = (ItemHammer) new ItemHammer(design+"_hammer", mat, false, 0, 0).setCustom(design).setCreativeTab(tab); - ornate_hvyhammer = (ItemHammer) new ItemHammer(design+"_hvyhammer", mat, true, 0, 0).setCustom(design).setCreativeTab(tab); - ornate_shears = (ItemShearsMF) new ItemShearsMF(design+"_shears", mat, 0, 0).setCustom(design).setCreativeTab(tab); - ornate_knife = (ItemKnifeMF) new ItemKnifeMF(design+"_knife", mat, 0, 1F, 0).setCustom(design).setCreativeTab(tab); - ornate_needle = (ItemNeedle) new ItemNeedle(design+"_needle", mat, 0, 0).setCustom(design).setCreativeTab(tab); - ornate_saw = (ItemSaw) new ItemSaw(design+"_saw", mat, 0, 0).setCustom(design).setCreativeTab(tab); - ornate_tongs = (ItemTongs) new ItemTongs(design+"_tongs", mat, 0).setCustom(design).setCreativeTab(tab); - ornate_spanner = (ItemSpanner) new ItemSpanner(design+"_spanner", 0, 0).setCustom(design).setCreativeTab(tab); - - ornate_chain_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "chain_helmet", ArmourDesign.CHAINMAIL, 0, "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_chain_chest = (ItemCustomArmour) new ItemCustomArmour(design, "chain_chest", ArmourDesign.CHAINMAIL, 1, "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_chain_legs = (ItemCustomArmour) new ItemCustomArmour(design, "chain_legs", ArmourDesign.CHAINMAIL, 2, "chain_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_chain_boots = (ItemCustomArmour) new ItemCustomArmour(design, "chain_boots", ArmourDesign.CHAINMAIL, 3, "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - - ornate_scale_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "scale_helmet", ArmourDesign.SCALEMAIL, 0, "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_scale_chest = (ItemCustomArmour) new ItemCustomArmour(design, "scale_chest", ArmourDesign.SCALEMAIL, 1, "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_scale_legs = (ItemCustomArmour) new ItemCustomArmour(design, "scale_legs", ArmourDesign.SCALEMAIL, 2, "scale_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_scale_boots = (ItemCustomArmour) new ItemCustomArmour(design, "scale_boots", ArmourDesign.SCALEMAIL, 3, "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - - ornate_splint_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "splint_helmet", ArmourDesign.SPLINTMAIL, 0, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_splint_chest = (ItemCustomArmour) new ItemCustomArmour(design, "splint_chest", ArmourDesign.SPLINTMAIL, 1, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_splint_legs = (ItemCustomArmour) new ItemCustomArmour(design, "splint_legs", ArmourDesign.SPLINTMAIL, 2, "splint_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_splint_boots = (ItemCustomArmour) new ItemCustomArmour(design, "splint_boots", ArmourDesign.SPLINTMAIL, 3, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - - ornate_plate_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "plate_helmet", ArmourDesign.FIELDPLATE, 0, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_plate_chest = (ItemCustomArmour) new ItemCustomArmour(design, "plate_chest", ArmourDesign.FIELDPLATE, 1, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_plate_legs = (ItemCustomArmour) new ItemCustomArmour(design, "plate_legs", ArmourDesign.FIELDPLATE, 2, "plate_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); - ornate_plate_boots = (ItemCustomArmour) new ItemCustomArmour(design, "plate_boots", ArmourDesign.FIELDPLATE, 3, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); - } - - public static void loadCrafting() - { - String id = "ornate"; - - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_dagger, ornate_dagger); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_sword, ornate_sword); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_mace, ornate_mace); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_waraxe, ornate_waraxe); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_spear, ornate_spear); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_katana, ornate_katana); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_greatsword, ornate_greatsword); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_warhammer, ornate_warhammer); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_battleaxe, ornate_battleaxe); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_halbeard, ornate_halbeard); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_lance, ornate_lance); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_bow, ornate_bow); - - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_pick, ornate_pick); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_axe, ornate_axe); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_spade, ornate_spade); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hoe, ornate_hoe); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_shears, ornate_shears); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hvypick, ornate_hvypick); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hvyshovel, ornate_hvyshovel); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_trow, ornate_trow); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_handpick, ornate_handpick); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_mattock, ornate_mattock); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_spade, ornate_spade); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_scythe, ornate_scythe); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_spanner, ornate_spanner); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_lumber, ornate_lumber); - - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hammer, ornate_hammer); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hvyhammer, ornate_hvyhammer); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_tongs, ornate_tongs); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_saw, ornate_saw); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_needle, ornate_needle); - SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_knife, ornate_knife); - - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_chain_boots, ornate_chain_boots); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_chain_legs, ornate_chain_legs); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_chain_chest, ornate_chain_chest); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_chain_helmet, ornate_chain_helmet); - - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_scale_boots, ornate_scale_boots); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_scale_legs, ornate_scale_legs); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_scale_chest, ornate_scale_chest); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_scale_helmet, ornate_scale_helmet); - - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_splint_boots, ornate_splint_boots); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_splint_legs, ornate_splint_legs); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_splint_chest, ornate_splint_chest); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_splint_helmet, ornate_splint_helmet); - - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_plate_boots, ornate_plate_boots); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_plate_legs, ornate_plate_legs); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_plate_chest, ornate_plate_chest); - SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_plate_helmet, ornate_plate_helmet); - } +public class OrnateStyle { + public static ToolMaterial ornate = EnumHelper.addToolMaterial("ornate", 2, 250, 6.0F, 2.0F, 100); + + public static ItemWeaponMF ornate_sword, ornate_waraxe, ornate_mace, ornate_dagger, ornate_spear; + public static ItemWeaponMF ornate_greatsword, ornate_battleaxe, ornate_warhammer, ornate_katana, ornate_halbeard, + ornate_lance; + public static ItemPickMF ornate_pick; + public static ItemAxeMF ornate_axe; + public static ItemSpadeMF ornate_spade; + public static ItemHoeMF ornate_hoe; + public static ItemHvyPick ornate_hvypick; + public static ItemHvyShovel ornate_hvyshovel; + public static ItemHandpick ornate_handpick; + public static ItemTrowMF ornate_trow; + public static ItemScythe ornate_scythe; + public static ItemMattock ornate_mattock; + public static ItemLumberAxe ornate_lumber; + + public static ItemHammer ornate_hammer, ornate_hvyhammer; + public static ItemTongs ornate_tongs; + public static ItemShearsMF ornate_shears; + public static ItemKnifeMF ornate_knife; + public static ItemNeedle ornate_needle; + public static ItemSaw ornate_saw; + public static ItemSpanner ornate_spanner; + + public static ItemBowMF ornate_bow; + + public static ItemCustomArmour ornate_scale_helmet, ornate_scale_chest, ornate_scale_legs, ornate_scale_boots; + public static ItemCustomArmour ornate_chain_helmet, ornate_chain_chest, ornate_chain_legs, ornate_chain_boots; + public static ItemCustomArmour ornate_splint_helmet, ornate_splint_chest, ornate_splint_legs, ornate_splint_boots; + public static ItemCustomArmour ornate_plate_helmet, ornate_plate_chest, ornate_plate_legs, ornate_plate_boots; + + public static void load() { + String design = "ornate"; + CreativeTabs tab = CreativeTabMF.tabOrnate; + ToolMaterial mat = ornate; + float ratingMod = 0.8F; + + ornate_dagger = new ItemDagger(design + "_dagger", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(-1); + ornate_sword = new ItemSwordMF(design + "_sword", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(-1); + ornate_waraxe = new ItemWaraxeMF(design + "_waraxe", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(-1); + ornate_mace = new ItemMaceMF(design + "_mace", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); + ornate_spear = new ItemSpearMF(design + "_spear", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(-1); + ornate_katana = new ItemKatanaMF(design + "_katana", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(-1); + ornate_greatsword = new ItemGreatswordMF(design + "_greatsword", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(-1); + ornate_battleaxe = new ItemBattleaxeMF(design + "_battleaxe", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(-1); + ornate_warhammer = new ItemWarhammerMF(design + "_warhammer", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(-1); + ornate_halbeard = new ItemHalbeardMF(design + "_halbeard", mat, 0, 1F).setCustom(design).setTab(tab) + .modifyBaseDamage(-1); + ornate_lance = new ItemLance(design + "_lance", mat, 0, 1F).setCustom(design).setTab(tab).modifyBaseDamage(-1); + + ornate_bow = (ItemBowMF) new ItemBowMF(design + "_bow", mat, EnumBowType.SHORTBOW, 1).setCustom(design) + .setCreativeTab(tab); + + // Tools + ornate_pick = (ItemPickMF) new ItemPickMF(design + "_pick", mat, 0).setCustom(design).setCreativeTab(tab); + ornate_axe = (ItemAxeMF) new ItemAxeMF(design + "_axe", mat, 0).setCustom(design).setCreativeTab(tab); + ornate_spade = (ItemSpadeMF) new ItemSpadeMF(design + "_spade", mat, 0).setCustom(design).setCreativeTab(tab); + ornate_hoe = (ItemHoeMF) new ItemHoeMF(design + "_hoe", mat, 0).setCustom(design).setCreativeTab(tab); + + ornate_handpick = (ItemHandpick) new ItemHandpick(design + "_handpick", mat, 0).setCustom(design) + .setCreativeTab(tab); + ornate_hvypick = (ItemHvyPick) new ItemHvyPick(design + "_hvypick", mat, 0).setCustom(design) + .setCreativeTab(tab); + ornate_trow = (ItemTrowMF) new ItemTrowMF(design + "_trow", mat, 0).setCustom(design).setCreativeTab(tab); + ornate_hvyshovel = (ItemHvyShovel) new ItemHvyShovel(design + "_hvyshovel", mat, 0).setCustom(design) + .setCreativeTab(tab); + ornate_scythe = (ItemScythe) new ItemScythe(design + "_scythe", mat, 0).setCustom(design).setCreativeTab(tab); + ornate_mattock = (ItemMattock) new ItemMattock(design + "_mattock", mat, 0).setCustom(design) + .setCreativeTab(tab); + ornate_lumber = (ItemLumberAxe) new ItemLumberAxe(design + "_lumber", mat, 0).setCustom(design) + .setCreativeTab(tab); + + // Crafters + ornate_hammer = (ItemHammer) new ItemHammer(design + "_hammer", mat, false, 0, 0).setCustom(design) + .setCreativeTab(tab); + ornate_hvyhammer = (ItemHammer) new ItemHammer(design + "_hvyhammer", mat, true, 0, 0).setCustom(design) + .setCreativeTab(tab); + ornate_shears = (ItemShearsMF) new ItemShearsMF(design + "_shears", mat, 0, 0).setCustom(design) + .setCreativeTab(tab); + ornate_knife = (ItemKnifeMF) new ItemKnifeMF(design + "_knife", mat, 0, 1F, 0).setCustom(design) + .setCreativeTab(tab); + ornate_needle = (ItemNeedle) new ItemNeedle(design + "_needle", mat, 0, 0).setCustom(design) + .setCreativeTab(tab); + ornate_saw = (ItemSaw) new ItemSaw(design + "_saw", mat, 0, 0).setCustom(design).setCreativeTab(tab); + ornate_tongs = (ItemTongs) new ItemTongs(design + "_tongs", mat, 0).setCustom(design).setCreativeTab(tab); + ornate_spanner = (ItemSpanner) new ItemSpanner(design + "_spanner", 0, 0).setCustom(design).setCreativeTab(tab); + + ornate_chain_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "chain_helmet", ArmourDesign.CHAINMAIL, 0, + "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_chain_chest = (ItemCustomArmour) new ItemCustomArmour(design, "chain_chest", ArmourDesign.CHAINMAIL, 1, + "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_chain_legs = (ItemCustomArmour) new ItemCustomArmour(design, "chain_legs", ArmourDesign.CHAINMAIL, 2, + "chain_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_chain_boots = (ItemCustomArmour) new ItemCustomArmour(design, "chain_boots", ArmourDesign.CHAINMAIL, 3, + "chain_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + + ornate_scale_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "scale_helmet", ArmourDesign.SCALEMAIL, 0, + "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_scale_chest = (ItemCustomArmour) new ItemCustomArmour(design, "scale_chest", ArmourDesign.SCALEMAIL, 1, + "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_scale_legs = (ItemCustomArmour) new ItemCustomArmour(design, "scale_legs", ArmourDesign.SCALEMAIL, 2, + "scale_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_scale_boots = (ItemCustomArmour) new ItemCustomArmour(design, "scale_boots", ArmourDesign.SCALEMAIL, 3, + "scale_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + + ornate_splint_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "splint_helmet", ArmourDesign.SPLINTMAIL, + 0, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_splint_chest = (ItemCustomArmour) new ItemCustomArmour(design, "splint_chest", ArmourDesign.SPLINTMAIL, + 1, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_splint_legs = (ItemCustomArmour) new ItemCustomArmour(design, "splint_legs", ArmourDesign.SPLINTMAIL, 2, + "splint_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_splint_boots = (ItemCustomArmour) new ItemCustomArmour(design, "splint_boots", ArmourDesign.SPLINTMAIL, + 3, "splint_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + + ornate_plate_helmet = (ItemCustomArmour) new ItemCustomArmour(design, "plate_helmet", ArmourDesign.FIELDPLATE, + 0, "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_plate_chest = (ItemCustomArmour) new ItemCustomArmour(design, "plate_chest", ArmourDesign.FIELDPLATE, 1, + "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_plate_legs = (ItemCustomArmour) new ItemCustomArmour(design, "plate_legs", ArmourDesign.FIELDPLATE, 2, + "plate_layer_2", 0).modifyRating(ratingMod).setCreativeTab(tab); + ornate_plate_boots = (ItemCustomArmour) new ItemCustomArmour(design, "plate_boots", ArmourDesign.FIELDPLATE, 3, + "plate_layer_1", 0).modifyRating(ratingMod).setCreativeTab(tab); + } + + public static void loadCrafting() { + String id = "ornate"; + + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_dagger, ornate_dagger); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_sword, ornate_sword); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_mace, ornate_mace); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_waraxe, ornate_waraxe); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_spear, ornate_spear); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_katana, ornate_katana); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_greatsword, ornate_greatsword); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_warhammer, ornate_warhammer); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_battleaxe, ornate_battleaxe); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_halbeard, ornate_halbeard); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_lance, ornate_lance); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_bow, ornate_bow); + + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_pick, ornate_pick); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_axe, ornate_axe); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_spade, ornate_spade); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hoe, ornate_hoe); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_shears, ornate_shears); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hvypick, ornate_hvypick); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hvyshovel, ornate_hvyshovel); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_trow, ornate_trow); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_handpick, ornate_handpick); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_mattock, ornate_mattock); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_spade, ornate_spade); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_scythe, ornate_scythe); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_spanner, ornate_spanner); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_lumber, ornate_lumber); + + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hammer, ornate_hammer); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_hvyhammer, ornate_hvyhammer); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_tongs, ornate_tongs); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_saw, ornate_saw); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_needle, ornate_needle); + SpecialForging.addSpecialCraft(id, CustomToolListMF.standard_knife, ornate_knife); + + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_chain_boots, ornate_chain_boots); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_chain_legs, ornate_chain_legs); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_chain_chest, ornate_chain_chest); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_chain_helmet, ornate_chain_helmet); + + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_scale_boots, ornate_scale_boots); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_scale_legs, ornate_scale_legs); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_scale_chest, ornate_scale_chest); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_scale_helmet, ornate_scale_helmet); + + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_splint_boots, ornate_splint_boots); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_splint_legs, ornate_splint_legs); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_splint_chest, ornate_splint_chest); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_splint_helmet, ornate_splint_helmet); + + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_plate_boots, ornate_plate_boots); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_plate_legs, ornate_plate_legs); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_plate_chest, ornate_plate_chest); + SpecialForging.addSpecialCraft(id, CustomArmourListMF.standard_plate_helmet, ornate_plate_helmet); + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/ItemAxeMF.java b/src/main/java/minefantasy/mf2/item/tool/ItemAxeMF.java index ebd97076..04b26b23 100644 --- a/src/main/java/minefantasy/mf2/item/tool/ItemAxeMF.java +++ b/src/main/java/minefantasy/mf2/item/tool/ItemAxeMF.java @@ -1,17 +1,16 @@ package minefantasy.mf2.item.tool; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.CustomToolListMF; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.SharedMonsterAttributes; @@ -22,197 +21,181 @@ import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraftforge.common.ForgeHooks; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemAxeMF extends ItemAxe implements IToolMaterial -{ - private String name; - private float baseDamage = 3F; - - public ItemAxeMF(String name, ToolMaterial material, int rarity) - { +public class ItemAxeMF extends ItemAxe implements IToolMaterial { + protected int itemRarity; + private String name; + private float baseDamage = 3F; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemAxeMF(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.name=name; - setTextureName("minefantasy2:Tool/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - } - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemAxeMF setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - canRepair = false; - return this; - } - public ItemAxeMF setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + this.name = name; + setTextureName("minefantasy2:Tool/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } - private float efficiencyMod = 1.0F; - public ItemAxeMF setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; - } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } + + public ItemAxeMF setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + canRepair = false; + return this; + } + + public ItemAxeMF setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemAxeMF setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } - public float func_150893_a(ItemStack stack, Block block) - { - float base = super.func_150893_a(stack, block); - return base <= 1.0F ? base : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); } + + public float func_150893_a(ItemStack stack, Block block) { + float base = super.func_150893_a(stack, block); + return base <= 1.0F ? base + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } - } - + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } + } + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } - + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/ItemHoeMF.java b/src/main/java/minefantasy/mf2/item/tool/ItemHoeMF.java index 46098f43..03a0aea5 100644 --- a/src/main/java/minefantasy/mf2/item/tool/ItemHoeMF.java +++ b/src/main/java/minefantasy/mf2/item/tool/ItemHoeMF.java @@ -1,181 +1,160 @@ package minefantasy.mf2.item.tool; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.CustomToolListMF; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraftforge.common.ForgeHooks; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemHoeMF extends ItemHoe implements IToolMaterial -{ - private String name; - private ToolMaterial toolMaterial; - public ItemHoeMF(String name, ToolMaterial material, int rarity) - { +public class ItemHoeMF extends ItemHoe implements IToolMaterial { + protected int itemRarity; + private String name; + private ToolMaterial toolMaterial; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemHoeMF(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.name=name; + this.name = name; this.toolMaterial = material; - setTextureName("minefantasy2:Tool/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - } - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemHoeMF setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - private float efficiencyMod = 1.0F; - public ItemHoeMF setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; - } - - private IIcon detailTex = null; - private IIcon haftTex = null; + setTextureName("minefantasy2:Tool/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + } + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } + + public ItemHoeMF setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemHoeMF setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } - public float getEfficiency(ItemStack stack) - { - return CustomToolHelper.getEfficiency(stack, 1.0F, efficiencyMod); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + + public float getEfficiency(ItemStack stack) { + return CustomToolHelper.getEfficiency(stack, 1.0F, efficiencyMod); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } - } - + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } + } + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/ItemLighterMF.java b/src/main/java/minefantasy/mf2/item/tool/ItemLighterMF.java index 7dd3a8c9..ec590a3a 100644 --- a/src/main/java/minefantasy/mf2/item/tool/ItemLighterMF.java +++ b/src/main/java/minefantasy/mf2/item/tool/ItemLighterMF.java @@ -1,5 +1,6 @@ package minefantasy.mf2.item.tool; +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.tool.ILighter; import minefantasy.mf2.item.list.CreativeTabMF; @@ -8,100 +9,85 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemFlintAndSteel; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -public class ItemLighterMF extends Item implements ILighter -{ - private float chance; - public ItemLighterMF(String name, float chance, int uses) - { - setTextureName("minefantasy2:Tool/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - setMaxDamage(uses); - this.chance = chance; - this.setMaxStackSize(1); - this.setCreativeTab(CreativeTabMF.tabGadget); - } - @Override - public boolean canLight() - { - return true; - } - @Override - public double getChance() - { - return chance; - } - //0 for N/A -1 for fail, 1 for succeed - public static int tryUse(ItemStack held, EntityPlayer user) - { - if(held == null)return 0; - - if(held.getItem() instanceof ItemFlintAndSteel) - { - return 1; - } - if(held.getItem() instanceof ILighter) - { - ILighter lighter = (ILighter)held.getItem(); - return (lighter.canLight() && user.getRNG().nextFloat() < lighter.getChance()) ? 1 : -1; - } - return 0; - } - - public boolean onItemUse(ItemStack item, EntityPlayer user, World world, int x, int y, int z, int face, float xo, float yo, float zo) - { - if (face == 0) - { +public class ItemLighterMF extends Item implements ILighter { + private float chance; + + public ItemLighterMF(String name, float chance, int uses) { + setTextureName("minefantasy2:Tool/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + setMaxDamage(uses); + this.chance = chance; + this.setMaxStackSize(1); + this.setCreativeTab(CreativeTabMF.tabGadget); + } + + // 0 for N/A -1 for fail, 1 for succeed + public static int tryUse(ItemStack held, EntityPlayer user) { + if (held == null) + return 0; + + if (held.getItem() instanceof ItemFlintAndSteel) { + return 1; + } + if (held.getItem() instanceof ILighter) { + ILighter lighter = (ILighter) held.getItem(); + return (lighter.canLight() && user.getRNG().nextFloat() < lighter.getChance()) ? 1 : -1; + } + return 0; + } + + @Override + public boolean canLight() { + return true; + } + + @Override + public double getChance() { + return chance; + } + + public boolean onItemUse(ItemStack item, EntityPlayer user, World world, int x, int y, int z, int face, float xo, + float yo, float zo) { + if (face == 0) { --y; } - if (face == 1) - { + if (face == 1) { ++y; } - if (face == 2) - { + if (face == 2) { --z; } - if (face == 3) - { + if (face == 3) { ++z; } - if (face == 4) - { + if (face == 4) { --x; } - if (face == 5) - { + if (face == 5) { ++x; } - if (!user.canPlayerEdit(x, y, z, face, item)) - { + if (!user.canPlayerEdit(x, y, z, face, item)) { return false; - } - else - { - boolean success = user.getRNG().nextFloat() < chance; - if (world.isAirBlock(x, y, z)) - { - world.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - if(success) - { - world.setBlock(x, y, z, Blocks.fire); + } else { + boolean success = user.getRNG().nextFloat() < chance; + if (world.isAirBlock(x, y, z)) { + world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F, + itemRand.nextFloat() * 0.4F + 0.8F); + if (success) { + world.setBlock(x, y, z, Blocks.fire); } } - if(success) - { - item.damageItem(1, user); + if (success) { + item.damageItem(1, user); } return true; } diff --git a/src/main/java/minefantasy/mf2/item/tool/ItemPickMF.java b/src/main/java/minefantasy/mf2/item/tool/ItemPickMF.java index 2ebb361c..b4766a11 100644 --- a/src/main/java/minefantasy/mf2/item/tool/ItemPickMF.java +++ b/src/main/java/minefantasy/mf2/item/tool/ItemPickMF.java @@ -1,15 +1,15 @@ package minefantasy.mf2.item.tool; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.CustomToolListMF; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -21,254 +21,228 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; +import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemPickMF extends ItemPickaxe implements IToolMaterial -{ - private String name; - private float baseDamage = 2F; - - public ItemPickMF(String name, ToolMaterial material, int rarity) - { +public class ItemPickMF extends ItemPickaxe implements IToolMaterial { + protected int itemRarity; + private String name; + private float baseDamage = 2F; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemPickMF(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.name=name; - - setTextureName("minefantasy2:Tool/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); + this.name = name; + + setTextureName("minefantasy2:Tool/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } - + @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { - if(!world.isRemote)return item; - - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - - if (movingobjectposition == null) - { - return item; - } else - { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!world.canMineBlock(player, i, j, k)) - { - return item; - } - - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { - return item; - } - - Block block = world.getBlock(i, j, k); - int blockTier = block.getHarvestLevel(world.getBlockMetadata(i, j, k)); - - int HL = CustomToolHelper.getHarvestLevel(item, toolMaterial.getHarvestLevel()); - if(blockTier > HL) - { - String msg = StatCollector.translateToLocalFormatted("prospect.cannotmine", HL, blockTier); - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + msg)); - } - else - { - String msg = StatCollector.translateToLocalFormatted("prospect.canmine", HL, blockTier); - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GREEN + msg)); - } - } - - return item; - } - } - - private boolean canMineBlock(World world, int i, int j, int k) { - // TODO Auto-generated method stub - return false; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemPickMF setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemPickMF setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + public ToolMaterial getMaterial() { + return toolMaterial; } - private float efficiencyMod = 1.0F; - public ItemPickMF setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; + + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { + if (!world.isRemote) + return item; + + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + + if (movingobjectposition == null) { + return item; + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + if (!world.canMineBlock(player, i, j, k)) { + return item; + } + + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { + return item; + } + + Block block = world.getBlock(i, j, k); + int blockTier = block.getHarvestLevel(world.getBlockMetadata(i, j, k)); + + int HL = CustomToolHelper.getHarvestLevel(item, toolMaterial.getHarvestLevel()); + if (blockTier > HL) { + String msg = StatCollector.translateToLocalFormatted("prospect.cannotmine", HL, blockTier); + player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + msg)); + } else { + String msg = StatCollector.translateToLocalFormatted("prospect.canmine", HL, blockTier); + player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GREEN + msg)); + } + } + + return item; + } + } + + private boolean canMineBlock(World world, int i, int j, int k) { + // TODO Auto-generated method stub + return false; + } + + public ItemPickMF setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + public ItemPickMF setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemPickMF setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } - public float func_150893_a(ItemStack stack, Block block) - { - return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); + } + + public float func_150893_a(ItemStack stack, Block block) { + return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil + && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/ItemShearsMF.java b/src/main/java/minefantasy/mf2/item/tool/ItemShearsMF.java index d9e78454..8383aed5 100644 --- a/src/main/java/minefantasy/mf2/item/tool/ItemShearsMF.java +++ b/src/main/java/minefantasy/mf2/item/tool/ItemShearsMF.java @@ -1,192 +1,168 @@ package minefantasy.mf2.item.tool; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.api.tool.IToolMF; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.CustomToolListMF; -import minefantasy.mf2.item.list.ToolListMF; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemShears; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraftforge.common.ForgeHooks; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemShearsMF extends ItemShears implements IToolMaterial, IToolMF -{ - private ToolMaterial toolMaterial; - private int tier; - private String name; - - public ItemShearsMF(String name, ToolMaterial material, int rarity, int tier) - { +public class ItemShearsMF extends ItemShears implements IToolMaterial, IToolMF { + protected int itemRarity; + private ToolMaterial toolMaterial; + private int tier; + private String name; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + + public ItemShearsMF(String name, ToolMaterial material, int rarity, int tier) { super(); - this.name=name; + this.name = name; this.tier = tier; itemRarity = rarity; toolMaterial = material; setCreativeTab(CreativeTabMF.tabOldTools); this.setMaxDamage(material.getMaxUses()); - setTextureName("minefantasy2:Tool/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemShearsMF setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - private float efficiencyMod = 1.0F; - public ItemShearsMF setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; - } - - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; + setTextureName("minefantasy2:Tool/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + } + + public ItemShearsMF setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemShearsMF setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass > 0 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass > 0 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name, "OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } - } - + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } + } + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } - @Override - public float getEfficiency(ItemStack item) - { - return CustomToolHelper.getEfficiency(item, toolMaterial.getEfficiencyOnProperMaterial(), efficiencyMod); - } + @Override + public float getEfficiency(ItemStack item) { + return CustomToolHelper.getEfficiency(item, toolMaterial.getEfficiencyOnProperMaterial(), efficiencyMod); + } - @Override - public int getTier(ItemStack item) - { - return CustomToolHelper.getCrafterTier(item, tier); - } - @Override + @Override + public int getTier(ItemStack item) { + return CustomToolHelper.getCrafterTier(item, tier); + } + + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); - } - //====================================================== CUSTOM END ==============================================================\\ - @Override - public String getToolType(ItemStack item) - { - return "shears"; - } - - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); + } + + // ====================================================== CUSTOM END + // ==============================================================\\ + @Override + public String getToolType(ItemStack item) { + return "shears"; + } + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/ItemSpadeMF.java b/src/main/java/minefantasy/mf2/item/tool/ItemSpadeMF.java index 73e11e4e..5abbd32a 100644 --- a/src/main/java/minefantasy/mf2/item/tool/ItemSpadeMF.java +++ b/src/main/java/minefantasy/mf2/item/tool/ItemSpadeMF.java @@ -1,17 +1,16 @@ package minefantasy.mf2.item.tool; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.CustomToolListMF; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.SharedMonsterAttributes; @@ -24,192 +23,178 @@ import net.minecraft.util.IIcon; import net.minecraftforge.common.ForgeHooks; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemSpadeMF extends ItemSpade implements IToolMaterial -{ - private String name; - private float baseDamage = 1F; - - public ItemSpadeMF(String name, ToolMaterial material, int rarity) - { +public class ItemSpadeMF extends ItemSpade implements IToolMaterial { + protected int itemRarity; + private String name; + private float baseDamage = 1F; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemSpadeMF(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.name=name; - setTextureName("minefantasy2:Tool/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - } - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemSpadeMF setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemSpadeMF setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + this.name = name; + setTextureName("minefantasy2:Tool/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } - private float efficiencyMod = 1.0F; - public ItemSpadeMF setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; - } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } + + public ItemSpadeMF setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemSpadeMF setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemSpadeMF setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } - public float func_150893_a(ItemStack stack, Block block) - { - float base = super.func_150893_a(stack, block); - return base <= 1.0F ? base : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); } + + public float func_150893_a(ItemStack stack, Block block) { + float base = super.func_150893_a(stack, block); + return base <= 1.0F ? base + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } - } - + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } + } + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/ToolMaterialMF.java b/src/main/java/minefantasy/mf2/item/tool/ToolMaterialMF.java index daf7d33b..0e5e77d7 100644 --- a/src/main/java/minefantasy/mf2/item/tool/ToolMaterialMF.java +++ b/src/main/java/minefantasy/mf2/item/tool/ToolMaterialMF.java @@ -2,27 +2,22 @@ import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.EnumHelper; -public class ToolMaterialMF -{ - /* - WOOD(0, 59, 2.0F, 0, 15), - STONE(1, 131, 4.0F, 1, 5), - IRON(2, 250, 6.0F, 2, 14), - EMERALD(3, 1561, 8.0F, 3, 10), - GOLD(0, 32, 12.0F, 0, 22); - */ -//public static EnumToolMaterial STEEL = EnumHelper.addToolMaterial("STEEL", 2, 1000, 7.8F, 2.5F, 22); +public class ToolMaterialMF { + /* + * WOOD(0, 59, 2.0F, 0, 15), STONE(1, 131, 4.0F, 1, 5), IRON(2, 250, 6.0F, 2, + * 14), EMERALD(3, 1561, 8.0F, 3, 10), GOLD(0, 32, 12.0F, 0, 22); + */ + // public static EnumToolMaterial STEEL = EnumHelper.addToolMaterial("STEEL", 2, + // 1000, 7.8F, 2.5F, 22); - //Misc - - //Basics stage1 - - public static boolean isUnbreakable(ToolMaterial toolMaterial) - { - return toolMaterial == BaseMaterialMF.enderforge.getToolConversion() || toolMaterial == BaseMaterialMF.ignotumite.getToolConversion() || toolMaterial == BaseMaterialMF.mithium.getToolConversion(); - } + // Misc + + // Basics stage1 + + public static boolean isUnbreakable(ToolMaterial toolMaterial) { + return toolMaterial == BaseMaterialMF.enderforge.getToolConversion() + || toolMaterial == BaseMaterialMF.ignotumite.getToolConversion() + || toolMaterial == BaseMaterialMF.mithium.getToolConversion(); + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHandpick.java b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHandpick.java index d35974a0..6503bc27 100644 --- a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHandpick.java +++ b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHandpick.java @@ -1,13 +1,7 @@ package minefantasy.mf2.item.tool.advanced; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -18,7 +12,6 @@ import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.config.ConfigTools; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -29,274 +22,258 @@ import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemPickaxe; -import net.minecraft.item.ItemStack; +import net.minecraft.item.*; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.oredict.OreDictionary; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + /** * @author Anonymous Productions */ -public class ItemHandpick extends ItemPickaxe implements IToolMaterial -{ - private String name; - private float baseDamage = 1F; - private Random rand = new Random(); - public ItemHandpick(String name, ToolMaterial material, int rarity) - { +public class ItemHandpick extends ItemPickaxe implements IToolMaterial { + protected int itemRarity; + private String name; + private float baseDamage = 1F; + private Random rand = new Random(); + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemHandpick(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.name=name; - setTextureName("minefantasy2:Tool/Advanced/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - setMaxDamage(material.getMaxUses()); + this.name = name; + setTextureName("minefantasy2:Tool/Advanced/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + setMaxDamage(material.getMaxUses()); } - @Override - public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase user) - { - boolean silk = EnchantmentHelper.getSilkTouchModifier(user); - int m = world.getBlockMetadata(x, y, z); - ArrayListdrops = block.getDrops(world, x, y, z, 0, m); - - if(!silk && drops != null && !drops.isEmpty()) - { - Iterator list = drops.iterator(); - while(list.hasNext()) - { - ItemStack drop = list.next(); - if(isOre(block, m) && !drop.isItemEqual(new ItemStack(block, 1, m)) && !(drop.getItem() instanceof ItemBlock) && rand.nextFloat() < getDoubleDropChance()) - { - dropItem(world, x, y, z, drop.copy()); - } - } - } - - if(!world.isRemote) - { - int meta = world.getBlockMetadata(x, y, z); - int harvestlvl = this.getMaterial().getHarvestLevel(); - int fortune = EnchantmentHelper.getFortuneModifier(user); - - ArrayListspecialdrops = RandomOre.getDroppedItems(user, block, meta, harvestlvl, fortune, silk, y); - - if(specialdrops != null && !specialdrops.isEmpty()) - { - Iterator list = specialdrops.iterator(); - - while(list.hasNext()) - { - ItemStack newdrop = (ItemStack)list.next(); - - if(newdrop != null) - { - if(newdrop.stackSize < 1)newdrop.stackSize = 1; - - dropItem(world, x, y, z, newdrop); - } - } - } - } - return super.onBlockDestroyed(item, world, block, x, y, z, user); - } - private boolean isOre(Block block, int meta) - { - if(!block.isToolEffective("pickaxe", meta)) - { - return false; - } - for(int i: OreDictionary.getOreIDs(new ItemStack(block, 1, meta))) - { - String orename = OreDictionary.getOreName(i); - if(orename != null && orename.startsWith("ore")) - { - return true; - } - } - return false; - } - private void dropItem(World world, int x, int y, int z, ItemStack drop) - { - if(world.isRemote)return; - - EntityItem dropItem = new EntityItem(world, x+0.5D, y+0.5D, z+0.5D, drop); - dropItem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(dropItem); - } - - private float getDoubleDropChance() - { - return ConfigTools.handpickBonus/100F; - } - + @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemHandpick setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemHandpick setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, + EntityLivingBase user) { + boolean silk = EnchantmentHelper.getSilkTouchModifier(user); + int m = world.getBlockMetadata(x, y, z); + ArrayList drops = block.getDrops(world, x, y, z, 0, m); + + if (!silk && drops != null && !drops.isEmpty()) { + Iterator list = drops.iterator(); + while (list.hasNext()) { + ItemStack drop = list.next(); + if (isOre(block, m) && !drop.isItemEqual(new ItemStack(block, 1, m)) + && !(drop.getItem() instanceof ItemBlock) && rand.nextFloat() < getDoubleDropChance()) { + dropItem(world, x, y, z, drop.copy()); + } + } + } + + if (!world.isRemote) { + int meta = world.getBlockMetadata(x, y, z); + int harvestlvl = this.getMaterial().getHarvestLevel(); + int fortune = EnchantmentHelper.getFortuneModifier(user); + + ArrayList specialdrops = RandomOre.getDroppedItems(user, block, meta, harvestlvl, fortune, silk, + y); + + if (specialdrops != null && !specialdrops.isEmpty()) { + Iterator list = specialdrops.iterator(); + + while (list.hasNext()) { + ItemStack newdrop = (ItemStack) list.next(); + + if (newdrop != null) { + if (newdrop.stackSize < 1) + newdrop.stackSize = 1; + + dropItem(world, x, y, z, newdrop); + } + } + } + } + return super.onBlockDestroyed(item, world, block, x, y, z, user); } - private float efficiencyMod = 1.0F; - public ItemHandpick setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; + + private boolean isOre(Block block, int meta) { + if (!block.isToolEffective("pickaxe", meta)) { + return false; + } + for (int i : OreDictionary.getOreIDs(new ItemStack(block, 1, meta))) { + String orename = OreDictionary.getOreName(i); + if (orename != null && orename.startsWith("ore")) { + return true; + } + } + return false; } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + private void dropItem(World world, int x, int y, int z, ItemStack drop) { + if (world.isRemote) + return; + + EntityItem dropItem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, drop); + dropItem.delayBeforeCanPickup = 10; + world.spawnEntityInWorld(dropItem); + } + + private float getDoubleDropChance() { + return ConfigTools.handpickBonus / 100F; + } + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } + + public ItemHandpick setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemHandpick setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemHandpick setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)) / 2; - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)) / 2; + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod/2); - } - public float func_150893_a(ItemStack stack, Block block) - { - return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod/2); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod / 2); } + + public float func_150893_a(ItemStack stack, Block block) { + return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil + && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod / 2); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHvyPick.java b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHvyPick.java index 55b14417..85ec70a0 100644 --- a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHvyPick.java +++ b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHvyPick.java @@ -1,13 +1,7 @@ package minefantasy.mf2.item.tool.advanced; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -17,6 +11,7 @@ import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.config.ConfigTools; import minefantasy.mf2.item.list.CreativeTabMF; +import minefantasy.mf2.util.BukkitUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -35,232 +30,228 @@ import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + /** * @author Anonymous Productions */ -public class ItemHvyPick extends ItemPickaxe implements IToolMaterial -{ - private String name; - private float baseDamage = 2F; - private Random rand = new Random(); - public ItemHvyPick(String name, ToolMaterial material, int rarity) - { +public class ItemHvyPick extends ItemPickaxe implements IToolMaterial { + protected int itemRarity; + private String name; + private float baseDamage = 2F; + private Random rand = new Random(); + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemHvyPick(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.name=name; - setTextureName("minefantasy2:Tool/Advanced/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - setMaxDamage(material.getMaxUses()); + this.name = name; + setTextureName("minefantasy2:Tool/Advanced/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + setMaxDamage(material.getMaxUses()); } - @Override - public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase user) - { - if(!world.isRemote && ForgeHooks.isToolEffective(item, block, world.getBlockMetadata(x, y, z)) && ItemLumberAxe.canAcceptCost(user)) - { - for(int x1 = -1; x1 <= 1; x1 ++) - { - for(int y1 = -1; y1 <= 1; y1 ++) - { - for(int z1 = -1; z1 <= 1; z1 ++) - { - ForgeDirection FD = getFDFor(user); - int blockX = x+x1 + FD.offsetX; - int blockY = y+y1 + FD.offsetY; - int blockZ = z+z1 + FD.offsetZ; - - if(!(x1+FD.offsetX == 0 && y1+FD.offsetY == 0 && z1+FD.offsetZ == 0)) - { - Block newblock = world.getBlock(blockX, blockY, blockZ); - int m = world.getBlockMetadata(blockX, blockY, blockZ); - - if(newblock != null && user instanceof EntityPlayer && ForgeHooks.canHarvestBlock(newblock, (EntityPlayer) user, m) && ForgeHooks.isToolEffective(item, newblock, m)) - { - if(rand.nextFloat()*100F < (100F - ConfigTools.hvyDropChance)) - { - newblock.dropBlockAsItem(world, blockX, blockY, blockZ, m, EnchantmentHelper.getFortuneModifier(user)); - } - world.setBlockToAir(blockX, blockY, blockZ); - item.damageItem(1, user); - ItemLumberAxe.tirePlayer(user, 1F); - } - } - } - } - } - } - return super.onBlockDestroyed(item, world, block, x, y, z, user); - } - - private ForgeDirection getFDFor(EntityLivingBase user) - { - return ForgeDirection.UNKNOWN;//TODO: FD - } - + @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemHvyPick setCustom(String s) - { - setCreativeTab(CreativeTabMF.tabOldTools); - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemHvyPick setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, + EntityLivingBase user) { + if (!world.isRemote && ForgeHooks.isToolEffective(item, block, world.getBlockMetadata(x, y, z)) + && ItemLumberAxe.canAcceptCost(user)) { + for (int x1 = -1; x1 <= 1; x1++) { + for (int y1 = -1; y1 <= 1; y1++) { + for (int z1 = -1; z1 <= 1; z1++) { + ForgeDirection FD = getFDFor(user); + int blockX = x + x1 + FD.offsetX; + int blockY = y + y1 + FD.offsetY; + int blockZ = z + z1 + FD.offsetZ; + + if (!(x1 + FD.offsetX == 0 && y1 + FD.offsetY == 0 && z1 + FD.offsetZ == 0)) { + Block newblock = world.getBlock(blockX, blockY, blockZ); + int m = world.getBlockMetadata(blockX, blockY, blockZ); + + if (newblock != null && user instanceof EntityPlayer + && ForgeHooks.canHarvestBlock(newblock, (EntityPlayer) user, m) + && ForgeHooks.isToolEffective(item, newblock, m)) { + if ((MineFantasyII.isBukkitServer() + && BukkitUtils.cantBreakBlock((EntityPlayer) user, blockX, blockY, blockZ))) { + continue; + } + + if (rand.nextFloat() * 100F < (100F - ConfigTools.hvyDropChance)) { + newblock.dropBlockAsItem(world, blockX, blockY, blockZ, m, + EnchantmentHelper.getFortuneModifier(user)); + } + world.setBlockToAir(blockX, blockY, blockZ); + item.damageItem(1, user); + ItemLumberAxe.tirePlayer(user, 1F); + } + } + } + } + } + } + return super.onBlockDestroyed(item, world, block, x, y, z, user); } - private float efficiencyMod = 1.0F; - public ItemHvyPick setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; + + private ForgeDirection getFDFor(EntityLivingBase user) { + return ForgeDirection.UNKNOWN;// TODO: FD } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } + + public ItemHvyPick setCustom(String s) { + setCreativeTab(CreativeTabMF.tabOldTools); + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemHvyPick setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemHvyPick setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)) * 2; - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)) * 2; + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod/10); - } - public float func_150893_a(ItemStack stack, Block block) - { - return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod/2); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod / 10); } + + public float func_150893_a(ItemStack stack, Block block) { + return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil + && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod / 2); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHvyShovel.java b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHvyShovel.java index 8c8d7950..0dc652a6 100644 --- a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHvyShovel.java +++ b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemHvyShovel.java @@ -1,13 +1,7 @@ package minefantasy.mf2.item.tool.advanced; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -17,6 +11,7 @@ import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.config.ConfigTools; import minefantasy.mf2.item.list.CreativeTabMF; +import minefantasy.mf2.util.BukkitUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -36,243 +31,240 @@ import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + /** * @author Anonymous Productions */ -public class ItemHvyShovel extends ItemSpade implements IToolMaterial -{ - private String name; - private float baseDamage = 2F; - private Random rand = new Random(); - public ItemHvyShovel(String name, ToolMaterial material, int rarity) - { +public class ItemHvyShovel extends ItemSpade implements IToolMaterial { + protected int itemRarity; + private String name; + private float baseDamage = 2F; + private Random rand = new Random(); + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemHvyShovel(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.name=name; - setTextureName("minefantasy2:Tool/Advanced/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - setMaxDamage(material.getMaxUses()); + this.name = name; + setTextureName("minefantasy2:Tool/Advanced/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + setMaxDamage(material.getMaxUses()); + } + + @Override + public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, + EntityLivingBase user) { + if (!world.isRemote && ForgeHooks.isToolEffective(item, block, world.getBlockMetadata(x, y, z)) + && ItemLumberAxe.canAcceptCost(user)) { + int range = 2; + for (int x1 = -range; x1 <= range; x1++) { + // for(int y1 = -1; y1 <= 1; y1 ++) + { + for (int z1 = -range; z1 <= range; z1++) { + if (getDistance(x + x1, y, z + z1, x, y, z) <= range * 1 + 0.5D) { + ForgeDirection FD = getFDFor(user); + int blockX = x + x1 + FD.offsetX; + int blockY = y + FD.offsetY; + int blockZ = z + z1 + FD.offsetZ; + + if (!(x1 + FD.offsetX == 0 && FD.offsetY == 0 && z1 + FD.offsetZ == 0)) { + Block newblock = world.getBlock(blockX, blockY, blockZ); + Block above = world.getBlock(blockX, blockY + 1, blockZ); + int m = world.getBlockMetadata(blockX, blockY, blockZ); + + if ((above == null || !above.getMaterial().isSolid()) && newblock != null + && user instanceof EntityPlayer + && ForgeHooks.canHarvestBlock(newblock, (EntityPlayer) user, m) + && ForgeHooks.isToolEffective(item, newblock, m)) { + if ((MineFantasyII.isBukkitServer() && BukkitUtils + .cantBreakBlock((EntityPlayer) user, blockX, blockY, blockZ))) { + continue; + } + + if (rand.nextFloat() * 100F < (100F - ConfigTools.hvyDropChance)) { + newblock.dropBlockAsItem(world, blockX, blockY, blockZ, m, + EnchantmentHelper.getFortuneModifier(user)); + } + world.setBlockToAir(blockX, blockY, blockZ); + item.damageItem(1, user); + ItemLumberAxe.tirePlayer(user, 1F); + } + } + } + } + } + } + } + return super.onBlockDestroyed(item, world, block, x, y, z, user); } - @Override - public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase user) - { - if(!world.isRemote && ForgeHooks.isToolEffective(item, block, world.getBlockMetadata(x, y, z)) && ItemLumberAxe.canAcceptCost(user)) - { - int range = 2; - for(int x1 = -range; x1 <= range; x1 ++) - { - //for(int y1 = -1; y1 <= 1; y1 ++) - { - for(int z1 = -range; z1 <= range; z1 ++) - { - if(getDistance(x+x1, y, z+z1, x, y, z) <= range*1+0.5D) - { - ForgeDirection FD = getFDFor(user); - int blockX = x+x1 + FD.offsetX; - int blockY = y + FD.offsetY; - int blockZ = z+z1 + FD.offsetZ; - - if(!(x1+FD.offsetX == 0 && FD.offsetY == 0 && z1+FD.offsetZ == 0)) - { - Block newblock = world.getBlock(blockX, blockY, blockZ); - Block above = world.getBlock(blockX, blockY+1, blockZ); - int m = world.getBlockMetadata(blockX, blockY, blockZ); - - if((above == null || !above.getMaterial().isSolid()) && newblock != null && user instanceof EntityPlayer && ForgeHooks.canHarvestBlock(newblock, (EntityPlayer) user, m) && ForgeHooks.isToolEffective(item, newblock, m)) - { - if(rand.nextFloat()*100F < (100F - ConfigTools.hvyDropChance)) - { - newblock.dropBlockAsItem(world, blockX, blockY, blockZ, m, EnchantmentHelper.getFortuneModifier(user)); - } - world.setBlockToAir(blockX, blockY, blockZ); - item.damageItem(1, user); - ItemLumberAxe.tirePlayer(user, 1F); - } - } - } - } - } - } - } - return super.onBlockDestroyed(item, world, block, x, y, z, user); - } - - public double getDistance(double x, double y, double z, int posX, int posY, int posZ) - { + + public double getDistance(double x, double y, double z, int posX, int posY, int posZ) { double var7 = posX - x; double var9 = posY - y; double var11 = posZ - z; return MathHelper.sqrt_double(var7 * var7 + var9 * var9 + var11 * var11); } - - private ForgeDirection getFDFor(EntityLivingBase user) - { - return ForgeDirection.UNKNOWN;//TODO: FD - } - + + private ForgeDirection getFDFor(EntityLivingBase user) { + return ForgeDirection.UNKNOWN;// TODO: FD + } + @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemHvyShovel setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemHvyShovel setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + public ToolMaterial getMaterial() { + return toolMaterial; } - private float efficiencyMod = 1.0F; - public ItemHvyShovel setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; + + public ItemHvyShovel setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + public ItemHvyShovel setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemHvyShovel setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)) * 2; - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)) * 2; + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod/10); - } - public float func_150893_a(ItemStack stack, Block block) - { - return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod/2); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod / 10); } + + public float func_150893_a(ItemStack stack, Block block) { + return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil + && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod / 2); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemLumberAxe.java b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemLumberAxe.java index c1e540cf..95c937c4 100644 --- a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemLumberAxe.java +++ b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemLumberAxe.java @@ -1,12 +1,12 @@ package minefantasy.mf2.item.tool.advanced; -import java.util.Random; - +import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.api.weapon.IRackItem; import minefantasy.mf2.block.tileentity.decor.TileEntityRack; import minefantasy.mf2.config.ConfigTools; import minefantasy.mf2.item.tool.ItemAxeMF; +import minefantasy.mf2.util.BukkitUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentHelper; @@ -17,170 +17,151 @@ import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.util.ForgeDirection; -public class ItemLumberAxe extends ItemAxeMF implements IRackItem -{ - private Random rand = new Random(); - public ItemLumberAxe(String name, ToolMaterial material, int rarity) - { - super(name, material, rarity); - this.setMaxDamage(getMaxDamage()*5); - } - - @Override - public float getScale(ItemStack itemstack) - { - return 2.0F; - } - - @Override - public float getOffsetX(ItemStack itemstack) - { - return 0; - } - - @Override - public float getOffsetY(ItemStack itemstack) - { - return 0; - } - - @Override - public float getOffsetZ(ItemStack itemstack) - { - return 0; - } - - @Override - public float getRotationOffset(ItemStack itemstack) - { - return 0; - } - - @Override - public boolean canHang(TileEntityRack rack, ItemStack item, int slot) - { - return true; - } - - @Override - public boolean isSpecialRender(ItemStack item) - { - return true; - } - - @Override - public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase user) - { - if(user instanceof EntityPlayer && canAcceptCost(user)) - { - breakChain(world, x, y, z, item, block, user, 32, block, world.getBlockMetadata(x, y, z)); - } - return super.onBlockDestroyed(item, world, block, x, y, z, user); - } - - private void breakChain(World world, int x, int y, int z, ItemStack item, Block block, EntityLivingBase user, int maxLogs, Block orient, int orientM) - { - if(maxLogs > 0 && isLog(world, x, y, z, orient, orientM)) - { - Block newblock = world.getBlock(x, y, z); - breakSurrounding(item, world, newblock, x, y, z, user); - if(rand.nextFloat()*100F < (100F - ConfigTools.hvyDropChance)) - { - newblock.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), EnchantmentHelper.getFortuneModifier(user)); - } - world.setBlockToAir(x, y, z); - item.damageItem(1, user); - - maxLogs --; - for(int x1 = -1; x1 <= 1; x1 ++) - { - for(int y1 = -1; y1 <= 1; y1 ++) - { - for(int z1 = -1; z1 <= 1; z1 ++) - { - breakChain(world, x+x1, y+y1, z+z1, item, newblock, user, maxLogs, orient, orientM); - } - } - } - if(user instanceof EntityPlayer) - { - tirePlayer(user, 0.5F); - } - } - } - - public static boolean canAcceptCost(EntityLivingBase user) - { - return canAcceptCost(user, 0.1F); - } - public static boolean canAcceptCost(EntityLivingBase user, float cost) - { - if(user instanceof EntityPlayer && StaminaBar.isSystemActive) - { - return StaminaBar.isPercentStamAvailable(user, cost, true); - } - return true; - } - - public static void tirePlayer(EntityLivingBase user, float points) - { - if(user instanceof EntityPlayer && StaminaBar.isSystemActive) - { - StaminaBar.modifyStaminaValue(user, -StaminaBar.getBaseDecayModifier(user, true, true)*points); - StaminaBar.ModifyIdleTime(user, 5F*points); - } - } - - private boolean isLog(World world, int x, int y, int z, Block orient, int orientM) - { - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - if(block != null) - { - return block == orient && block.getMaterial() == Material.wood; - } - return false; - } - - public void breakSurrounding(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase user) - { - if(!world.isRemote && ForgeHooks.isToolEffective(item, block, world.getBlockMetadata(x, y, z))) - { - for(int x1 = -2; x1 <= 2; x1 ++) - { - for(int y1 = -2; y1 <= 2; y1 ++) - { - for(int z1 = -2; z1 <= 2; z1 ++) - { - ForgeDirection FD = getFDFor(user); - int blockX = x+x1 + FD.offsetX; - int blockY = y+y1 + FD.offsetY; - int blockZ = z+z1 + FD.offsetZ; - - if(!(x1+FD.offsetX == 0 && y1+FD.offsetY == 0 && z1+FD.offsetZ == 0)) - { - Block newblock = world.getBlock(blockX, blockY, blockZ); - int m = world.getBlockMetadata(blockX, blockY, blockZ); - - if(item.getItemDamage() < item.getMaxDamage() && newblock != null && user instanceof EntityPlayer && newblock.getMaterial() == Material.leaves) - { - if(rand.nextFloat()*100F < (100F - ConfigTools.hvyDropChance)) - { - newblock.dropBlockAsItem(world, blockX, blockY, blockZ, m, EnchantmentHelper.getFortuneModifier(user)); - } - world.setBlockToAir(blockX, blockY, blockZ); - item.damageItem(1, user); - } - } - } - } - } - } - } - - private ForgeDirection getFDFor(EntityLivingBase user) - { - return ForgeDirection.UNKNOWN;//TODO: FD - } +import java.util.Random; + +public class ItemLumberAxe extends ItemAxeMF implements IRackItem { + private Random rand = new Random(); + + public ItemLumberAxe(String name, ToolMaterial material, int rarity) { + super(name, material, rarity); + this.setMaxDamage(getMaxDamage() * 5); + } + + public static boolean canAcceptCost(EntityLivingBase user) { + return canAcceptCost(user, 0.1F); + } + + public static boolean canAcceptCost(EntityLivingBase user, float cost) { + if (user instanceof EntityPlayer && StaminaBar.isSystemActive) { + return StaminaBar.isPercentStamAvailable(user, cost, true); + } + return true; + } + + public static void tirePlayer(EntityLivingBase user, float points) { + if (user instanceof EntityPlayer && StaminaBar.isSystemActive) { + StaminaBar.modifyStaminaValue(user, -StaminaBar.getBaseDecayModifier(user, true, true) * points); + StaminaBar.ModifyIdleTime(user, 5F * points); + } + } + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } + + @Override + public float getOffsetX(ItemStack itemstack) { + return 0; + } + + @Override + public float getOffsetY(ItemStack itemstack) { + return 0; + } + + @Override + public float getOffsetZ(ItemStack itemstack) { + return 0; + } + + @Override + public float getRotationOffset(ItemStack itemstack) { + return 0; + } + + @Override + public boolean canHang(TileEntityRack rack, ItemStack item, int slot) { + return true; + } + + @Override + public boolean isSpecialRender(ItemStack item) { + return true; + } + + @Override + public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, + EntityLivingBase user) { + if (user instanceof EntityPlayer && canAcceptCost(user)) { + breakChain(world, x, y, z, item, block, user, 32, block, world.getBlockMetadata(x, y, z)); + } + return super.onBlockDestroyed(item, world, block, x, y, z, user); + } + + private void breakChain(World world, int x, int y, int z, ItemStack item, Block block, EntityLivingBase user, + int maxLogs, Block orient, int orientM) { + if (maxLogs > 0 && isLog(world, x, y, z, orient, orientM)) { + if (MineFantasyII.isBukkitServer() && BukkitUtils.cantBreakBlock((EntityPlayer) user, x, y, z)) { + return; + } + + Block newblock = world.getBlock(x, y, z); + breakSurrounding(item, world, newblock, x, y, z, user); + if (rand.nextFloat() * 100F < (100F - ConfigTools.hvyDropChance)) { + newblock.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), + EnchantmentHelper.getFortuneModifier(user)); + } + world.setBlockToAir(x, y, z); + item.damageItem(1, user); + + maxLogs--; + for (int x1 = -1; x1 <= 1; x1++) { + for (int y1 = -1; y1 <= 1; y1++) { + for (int z1 = -1; z1 <= 1; z1++) { + breakChain(world, x + x1, y + y1, z + z1, item, newblock, user, maxLogs, orient, orientM); + } + } + } + tirePlayer(user, 0.5F); + } + } + + private boolean isLog(World world, int x, int y, int z, Block orient, int orientM) { + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + if (block != null) { + return block == orient && block.getMaterial() == Material.wood; + } + return false; + } + + public void breakSurrounding(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase user) { + if (!world.isRemote && ForgeHooks.isToolEffective(item, block, world.getBlockMetadata(x, y, z))) { + for (int x1 = -2; x1 <= 2; x1++) { + for (int y1 = -2; y1 <= 2; y1++) { + for (int z1 = -2; z1 <= 2; z1++) { + ForgeDirection FD = getFDFor(user); + int blockX = x + x1 + FD.offsetX; + int blockY = y + y1 + FD.offsetY; + int blockZ = z + z1 + FD.offsetZ; + + if (!(x1 + FD.offsetX == 0 && y1 + FD.offsetY == 0 && z1 + FD.offsetZ == 0)) { + if (MineFantasyII.isBukkitServer() && BukkitUtils.cantBreakBlock((EntityPlayer) user, blockX, blockY, blockZ)) { + break; + } + + Block newblock = world.getBlock(blockX, blockY, blockZ); + int m = world.getBlockMetadata(blockX, blockY, blockZ); + + if (item.getItemDamage() < item.getMaxDamage() && newblock != null + && user instanceof EntityPlayer && newblock.getMaterial() == Material.leaves) { + if (rand.nextFloat() * 100F < (100F - ConfigTools.hvyDropChance)) { + newblock.dropBlockAsItem(world, blockX, blockY, blockZ, m, + EnchantmentHelper.getFortuneModifier(user)); + } + world.setBlockToAir(blockX, blockY, blockZ); + item.damageItem(1, user); + } + } + } + } + } + } + } + + private ForgeDirection getFDFor(EntityLivingBase user) { + return ForgeDirection.UNKNOWN;// TODO: FD + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemMattock.java b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemMattock.java index 8f916277..759822ab 100644 --- a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemMattock.java +++ b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemMattock.java @@ -1,12 +1,7 @@ package minefantasy.mf2.item.tool.advanced; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -33,69 +28,72 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * @author Anonymous Productions */ -public class ItemMattock extends ItemPickaxe implements IToolMaterial -{ - private String name; - public ItemMattock(String name, ToolMaterial material, int rarity) - { +public class ItemMattock extends ItemPickaxe implements IToolMaterial { + protected int itemRarity; + private String name; + // ===================================================== CUSTOM START + // =============================================================\\ + private float baseDamage = 1.0F; + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemMattock(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - - setTextureName("minefantasy2:Tool/Advanced/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setHarvestLevel("pickaxe", Math.max(0, material.getHarvestLevel()-2)); - this.setUnlocalizedName(name); - this.name = name; + + setTextureName("minefantasy2:Tool/Advanced/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setHarvestLevel("pickaxe", Math.max(0, material.getHarvestLevel() - 2)); + this.setUnlocalizedName(name); + this.name = name; } + @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - @Override - public boolean canHarvestBlock(Block block, ItemStack stack) - { - return super.canHarvestBlock(block, stack) || Items.iron_shovel.canHarvestBlock(block, stack); + public ToolMaterial getMaterial() { + return toolMaterial; } - @Override - public boolean onItemUse(ItemStack mattock, EntityPlayer player, World world, int x, int y, int z, int facing, float pitch, float yaw, float pan) - { - if (!player.canPlayerEdit(x, y, z, facing, mattock)) - { + + @Override + public boolean canHarvestBlock(Block block, ItemStack stack) { + return super.canHarvestBlock(block, stack) || Items.iron_shovel.canHarvestBlock(block, stack); + } + + @Override + public boolean onItemUse(ItemStack mattock, EntityPlayer player, World world, int x, int y, int z, int facing, + float pitch, float yaw, float pan) { + if (!player.canPlayerEdit(x, y, z, facing, mattock)) { return false; - } - else - { + } else { Block ground = world.getBlock(x, y, z); int groundmeta = world.getBlockMetadata(x, y, z); Block above = world.getBlock(x, y + 1, z); int meta = ground == Blocks.sand ? 1 : 0; - if (facing == 0 || above != Blocks.air) - { + if (facing == 0 || above != Blocks.air) { return false; - } - else if(ground == Blocks.grass || ground == Blocks.dirt || ground == Blocks.sand) - { + } else if (ground == Blocks.grass || ground == Blocks.dirt || ground == Blocks.sand) { Block var13 = BlockListMF.road; - if(ground == Blocks.grass) - { - ground = Blocks.dirt; + if (ground == Blocks.grass) { + ground = Blocks.dirt; } - world.playSoundEffect((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), "dig."+ground.stepSound.soundName, (var13.stepSound.getVolume() + 1.0F) / 2.0F, var13.stepSound.getPitch() * 0.8F); + world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, "dig." + ground.stepSound.soundName, + (var13.stepSound.getVolume() + 1.0F) / 2.0F, var13.stepSound.getPitch() * 0.8F); - if (world.isRemote) - { + if (world.isRemote) { return true; - } - else - { + } else { world.setBlock(x, y, z, var13, meta, 2); - + TileEntityRoad road = new TileEntityRoad(); road.setWorldObj(world); world.setTileEntity(x, y, z, road); @@ -103,169 +101,147 @@ else if(ground == Blocks.grass || ground == Blocks.dirt || ground == Blocks.sand mattock.damageItem(1, player); return true; } + } else { + return false; } - else - { - return false; + } + } + + public ItemMattock setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemMattock setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemMattock setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return isCustom; + } + + // Returns the number of render passes this item has. + @Override + public int getRenderPasses(int metadata) { + return 3; + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } + return super.getIcon(stack, pass); + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + } + + @Override + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + + @Override + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + + @Override + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); + } + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); + } + + @Override + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } } + } else { + super.getSubItems(item, tab, list); + } + } + + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } + super.addInformation(item, user, list, extra); + } + + @Override + @SideOnly(Side.CLIENT) + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - - - //===================================================== CUSTOM START =============================================================\\ - private float baseDamage = 1.0F; - private boolean isCustom = false; - public ItemMattock setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemMattock setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; - } - private float efficiencyMod = 1.0F; - public ItemMattock setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; - } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); - } - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return isCustom; - } - //Returns the number of render passes this item has. - @Override - public int getRenderPasses(int metadata) - { - return 3; - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } - return super.getIcon(stack, pass); - } - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); - } - @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; - @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } - @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); - } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } - @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); - } - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } - } - - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); - } - super.addInformation(item, user, list, extra); - } - @Override - @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); - } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemScythe.java b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemScythe.java index 43185db5..68eede2c 100644 --- a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemScythe.java +++ b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemScythe.java @@ -1,13 +1,7 @@ package minefantasy.mf2.item.tool.advanced; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -20,6 +14,7 @@ import minefantasy.mf2.block.tileentity.decor.TileEntityRack; import minefantasy.mf2.farming.FarmingHelper; import minefantasy.mf2.item.list.CreativeTabMF; +import minefantasy.mf2.util.BukkitUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -37,100 +32,103 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + /** * @author Anonymous Productions */ -public class ItemScythe extends Item implements IToolMaterial, IDamageType, IRackItem -{ - private Random rand = new Random(); - private ToolMaterial toolMaterial; - private String name; - /** - */ - public ItemScythe(String name, ToolMaterial material, int rarity) - { - this.toolMaterial = material; - this.setFull3D(); +public class ItemScythe extends Item implements IToolMaterial, IDamageType, IRackItem { + protected int itemRarity; + private Random rand = new Random(); + private ToolMaterial toolMaterial; + private String name; + private float baseDamage = 3.0F; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + /** + */ + public ItemScythe(String name, ToolMaterial material, int rarity) { + this.toolMaterial = material; + this.setFull3D(); itemRarity = rarity; - this.name=name; + this.name = name; setCreativeTab(CreativeTabMF.tabOldTools); - setTextureName("minefantasy2:Tool/Advanced/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - this.maxStackSize = 1; + setTextureName("minefantasy2:Tool/Advanced/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + this.maxStackSize = 1; this.setMaxDamage(material.getMaxUses()); } - - private float baseDamage = 3.0F; - + @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - private boolean cutGrass(World world, int x, int y, int z, int r, EntityPlayer entity, boolean leaf) - { - boolean flag = false; - ItemStack item = entity.getHeldItem(); - if(item == null)return false; - - for(int x2 = -r; x2 <= r; x2 ++) - { - for(int y2 = -r; y2 <= r; y2 ++) - { - for(int z2 = -r; z2 <= r; z2 ++) - { - Block block = world.getBlock(x+x2, y+y2, z+z2); - int meta = world.getBlockMetadata(x+x2, y+y2, z+z2); - if(block != null) - { - Material m = block.getMaterial(); - if(canCutMaterial(m, block.getBlockHardness(world, x+x2, y+y2, z+z2), leaf)) - { - if(getDistance(x+x2, y+y2, z+z2, x, y, z) < r*1) - { - flag = true; - - ArrayList items = block.getDrops(world, x+x2, y+y2, z+z2, meta, 0); - world.setBlockToAir(x+x2, y+y2, z+z2); - world.playAuxSFXAtEntity(entity, 2001, x+x2, y+y2, z+z2, Block.getIdFromBlock(block) + (world.getBlockMetadata(x+x2, y+y2, z+z2) << 16)); - tryBreakFarmland(world, x+x2, y+y2-1, z+z2); - if(!entity.capabilities.isCreativeMode) - { - ItemLumberAxe.tirePlayer(entity, 1F); - for (ItemStack drop : items) - { - if (world.rand.nextFloat() <= 1.0F) - { - dropBlockAsItem_do(world, x+x2, y+y2, z+z2, drop); - } - } - } - item.damageItem(1, entity); - } - } - } - } - } - } - return flag; - } - - private void tryBreakFarmland(World world, int x, int y, int z) - { - Block base = world.getBlock(x, y, z); - - if(base != null && base == Blocks.farmland && FarmingHelper.didHarvestRuinBlock(world, true)) - { - world.setBlock(x, y, z, Blocks.dirt); - } - } - - protected void dropBlockAsItem_do(World world, int x, int y, int z, ItemStack drop) - { - if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) - { + public ToolMaterial getMaterial() { + return toolMaterial; + } + + private boolean cutGrass(World world, int x, int y, int z, int r, EntityPlayer entity, boolean leaf) { + boolean flag = false; + ItemStack item = entity.getHeldItem(); + if (item == null) + return false; + + for (int x2 = -r; x2 <= r; x2++) { + for (int y2 = -r; y2 <= r; y2++) { + for (int z2 = -r; z2 <= r; z2++) { + Block block = world.getBlock(x + x2, y + y2, z + z2); + int meta = world.getBlockMetadata(x + x2, y + y2, z + z2); + if (block != null) { + Material m = block.getMaterial(); + if (canCutMaterial(m, block.getBlockHardness(world, x + x2, y + y2, z + z2), leaf)) { + if ((MineFantasyII.isBukkitServer() + && BukkitUtils.cantBreakBlock(entity, x + x2, y + y2, z + z2))) { + continue; + } + + if (getDistance(x + x2, y + y2, z + z2, x, y, z) < r * 1) { + flag = true; + + ArrayList items = block.getDrops(world, x + x2, y + y2, z + z2, meta, 0); + world.setBlockToAir(x + x2, y + y2, z + z2); + world.playAuxSFXAtEntity(entity, 2001, x + x2, y + y2, z + z2, + Block.getIdFromBlock(block) + + (world.getBlockMetadata(x + x2, y + y2, z + z2) << 16)); + tryBreakFarmland(world, x + x2, y + y2 - 1, z + z2); + if (!entity.capabilities.isCreativeMode) { + ItemLumberAxe.tirePlayer(entity, 1F); + for (ItemStack drop : items) { + if (world.rand.nextFloat() <= 1.0F) { + dropBlockAsItem_do(world, x + x2, y + y2, z + z2, drop); + } + } + } + item.damageItem(1, entity); + } + } + } + } + } + } + return flag; + } + + private void tryBreakFarmland(World world, int x, int y, int z) { + Block base = world.getBlock(x, y, z); + + if (base != null && base == Blocks.farmland && FarmingHelper.didHarvestRuinBlock(world, true)) { + world.setBlock(x, y, z, Blocks.dirt); + } + } + + protected void dropBlockAsItem_do(World world, int x, int y, int z, ItemStack drop) { + if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) { float var6 = 0.7F; double var7 = world.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D; double var9 = world.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D; @@ -140,266 +138,228 @@ protected void dropBlockAsItem_do(World world, int x, int y, int z, ItemStack dr world.spawnEntityInWorld(var13); } } - - private boolean canCutMaterial(Material m, float str, boolean leaf) - { - if(!leaf) - { - if(str <= 0.0F) - { - return - m == Material.vine - || m == Material.plants - || m == Material.grass - ;} - else return false; - } - return m == Material.leaves || m == Material.vine; - } - - public double getDistance(double x, double y, double z, int posX, int posY, int posZ) - { + + private boolean canCutMaterial(Material m, float str, boolean leaf) { + if (!leaf) { + if (str <= 0.0F) { + return m == Material.vine || m == Material.plants || m == Material.grass; + } else + return false; + } + return m == Material.leaves || m == Material.vine; + } + + public double getDistance(double x, double y, double z, int posX, int posY, int posZ) { double var7 = posX - x; double var9 = posY - y; double var11 = posZ - z; return MathHelper.sqrt_double(var7 * var7 + var9 * var9 + var11 * var11); } - - @Override - public boolean onItemUse(ItemStack hoe, EntityPlayer player, World world, int x, int y, int z, int facing, float pitch, float yaw, float pan) - { - if (!player.canPlayerEdit(x, y, z, facing, hoe) || !ItemLumberAxe.canAcceptCost(player)) - { + + @Override + public boolean onItemUse(ItemStack hoe, EntityPlayer player, World world, int x, int y, int z, int facing, + float pitch, float yaw, float pan) { + if (!player.canPlayerEdit(x, y, z, facing, hoe) || !ItemLumberAxe.canAcceptCost(player)) { return false; - } - else - { + } else { Block block = world.getBlock(x, y, z); - if(block != null) - { - Material m = block.getMaterial(); - float hard = block.getBlockHardness(world, x, y, z); - if(this.canCutMaterial(m, hard, false)) - { - if(cutGrass(world, x, y, z, 5, player, false)) - { - player.swingItem(); - } - } - else - if(this.canCutMaterial(m, hard, true)) - { - if(cutGrass(world, x, y, z, 3, player, true)) - { - player.swingItem(); - } - } + if (block != null) { + Material m = block.getMaterial(); + float hard = block.getBlockHardness(world, x, y, z); + if (this.canCutMaterial(m, hard, false)) { + if (cutGrass(world, x, y, z, 5, player, false)) { + player.swingItem(); + } + } else if (this.canCutMaterial(m, hard, true)) { + if (cutGrass(world, x, y, z, 3, player, true)) { + player.swingItem(); + } + } } } return false; } - @Override - public float[] getDamageRatio(Object... implement) - { - return new float[]{1,0, 2}; - } - @Override - public float getPenetrationLevel(Object implement) - { - return 0F; - } - - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemScythe setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemScythe setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + @Override + public float[] getDamageRatio(Object... implement) { + return new float[]{1, 0, 2}; } - private float efficiencyMod = 1.0F; - public ItemScythe setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; - } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + @Override + public float getPenetrationLevel(Object implement) { + return 0F; + } + + public ItemScythe setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemScythe setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemScythe setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } - } - + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } + } + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); - } - //====================================================== CUSTOM END ==============================================================\\ - - @Override - public float getScale(ItemStack itemstack) { - return 2.0F; - } - - @Override - public float getOffsetX(ItemStack itemstack) { - return 0; - } - - @Override - public float getOffsetY(ItemStack itemstack) { - return 5F/16F; - } - - @Override - public float getOffsetZ(ItemStack itemstack) { - return 0; - } - - @Override - public float getRotationOffset(ItemStack itemstack) { - return 0; - } - - @Override - public boolean canHang(TileEntityRack rack, ItemStack item, int slot) - { - return rack.hasRackBelow(slot); - } - - @Override - public boolean isSpecialRender(ItemStack item) { - return false; - } + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); + } + // ====================================================== CUSTOM END + // ==============================================================\\ + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } + + @Override + public float getOffsetX(ItemStack itemstack) { + return 0; + } + + @Override + public float getOffsetY(ItemStack itemstack) { + return 5F / 16F; + } + + @Override + public float getOffsetZ(ItemStack itemstack) { + return 0; + } + + @Override + public float getRotationOffset(ItemStack itemstack) { + return 0; + } + + @Override + public boolean canHang(TileEntityRack rack, ItemStack item, int slot) { + return rack.hasRackBelow(slot); + } + + @Override + public boolean isSpecialRender(ItemStack item) { + return false; + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemTrowMF.java b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemTrowMF.java index d929bb5a..0b2a24c1 100644 --- a/src/main/java/minefantasy/mf2/item/tool/advanced/ItemTrowMF.java +++ b/src/main/java/minefantasy/mf2/item/tool/advanced/ItemTrowMF.java @@ -1,10 +1,10 @@ package minefantasy.mf2.item.tool.advanced; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; @@ -25,258 +25,241 @@ import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; -import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; /** * @author Anonymous Productions */ -public class ItemTrowMF extends ItemSpade implements IToolMaterial -{ - private String name; - private float baseDamage = 1F; - private Random rand = new Random(); - public ItemTrowMF(String name, ToolMaterial material, int rarity) - { +public class ItemTrowMF extends ItemSpade implements IToolMaterial { + protected int itemRarity; + private String name; + private float baseDamage = 1F; + private Random rand = new Random(); + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemTrowMF(String name, ToolMaterial material, int rarity) { super(material); itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.name=name; - setTextureName("minefantasy2:Tool/Advanced/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - setMaxDamage(material.getMaxUses()); + this.name = name; + setTextureName("minefantasy2:Tool/Advanced/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + setMaxDamage(material.getMaxUses()); } - @Override - public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, EntityLivingBase user) - { - int m = world.getBlockMetadata(x, y, z); - alwaysDropFlint(block, item, world, user, x, y, z); - - if(!world.isRemote) - { - int meta = world.getBlockMetadata(x, y, z); - int harvestlvl = this.getMaterial().getHarvestLevel(); - int fortune = EnchantmentHelper.getFortuneModifier(user); - boolean silk = EnchantmentHelper.getSilkTouchModifier(user); - - ArrayListspecialdrops = RandomDigs.getDroppedItems(block, meta, harvestlvl, fortune, silk, y); - - if(specialdrops != null && !specialdrops.isEmpty()) - { - Iterator list = specialdrops.iterator(); - - while(list.hasNext()) - { - ItemStack newdrop = (ItemStack)list.next(); - - if(newdrop != null) - { - if(newdrop.stackSize < 1)newdrop.stackSize = 1; - - dropItem(world, x, y, z, newdrop); - } - } - } - } - return super.onBlockDestroyed(item, world, block, x, y, z, user); - } - - private void alwaysDropFlint(Block block, ItemStack item, World world, EntityLivingBase user, int x, int y, int z) - { - if(block == Blocks.gravel) - { - world.setBlockToAir(x, y, z); - int loot = 0; - int enc = EnchantmentHelper.getFortuneModifier(user); - if(enc > 0) - { - loot = rand.nextInt(enc); - } - dropItem(world, x, y, z, new ItemStack(Items.flint, 1 + loot)); - } - } - private void dropItem(World world, int x, int y, int z, ItemStack drop) - { - if(world.isRemote)return; - - EntityItem dropItem = new EntityItem(world, x+0.5D, y+0.5D, z+0.5D, drop); - dropItem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(dropItem); - } - + @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemTrowMF setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemTrowMF setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + public boolean onBlockDestroyed(ItemStack item, World world, Block block, int x, int y, int z, + EntityLivingBase user) { + int m = world.getBlockMetadata(x, y, z); + alwaysDropFlint(block, item, world, user, x, y, z); + + if (!world.isRemote) { + int meta = world.getBlockMetadata(x, y, z); + int harvestlvl = this.getMaterial().getHarvestLevel(); + int fortune = EnchantmentHelper.getFortuneModifier(user); + boolean silk = EnchantmentHelper.getSilkTouchModifier(user); + + ArrayList specialdrops = RandomDigs.getDroppedItems(block, meta, harvestlvl, fortune, silk, y); + + if (specialdrops != null && !specialdrops.isEmpty()) { + Iterator list = specialdrops.iterator(); + + while (list.hasNext()) { + ItemStack newdrop = (ItemStack) list.next(); + + if (newdrop != null) { + if (newdrop.stackSize < 1) + newdrop.stackSize = 1; + + dropItem(world, x, y, z, newdrop); + } + } + } + } + return super.onBlockDestroyed(item, world, block, x, y, z, user); } - private float efficiencyMod = 1.0F; - public ItemTrowMF setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; + + private void alwaysDropFlint(Block block, ItemStack item, World world, EntityLivingBase user, int x, int y, int z) { + if (block == Blocks.gravel) { + world.setBlockToAir(x, y, z); + int loot = 0; + int enc = EnchantmentHelper.getFortuneModifier(user); + if (enc > 0) { + loot = rand.nextInt(enc); + } + dropItem(world, x, y, z, new ItemStack(Items.flint, 1 + loot)); + } } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + private void dropItem(World world, int x, int y, int z, ItemStack drop) { + if (world.isRemote) + return; + + EntityItem dropItem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, drop); + dropItem.delayBeforeCanPickup = 10; + world.spawnEntityInWorld(dropItem); + } + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } + + public ItemTrowMF setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemTrowMF setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemTrowMF setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)) / 2; - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)) / 2; + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod/2); - } - public float func_150893_a(ItemStack stack, Block block) - { - return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod/2); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod / 2); } + + public float func_150893_a(ItemStack stack, Block block) { + return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil + && block.getMaterial() != Material.rock ? super.func_150893_a(stack, block) + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod / 2); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemBasicCraftTool.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemBasicCraftTool.java index 5b3a4098..cda00aff 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemBasicCraftTool.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemBasicCraftTool.java @@ -1,18 +1,15 @@ package minefantasy.mf2.item.tool.crafting; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import com.google.common.collect.Sets; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.ToolHelper; -import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.api.tool.IToolMF; import minefantasy.mf2.api.weapon.IDamageType; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.ToolListMF; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -21,137 +18,118 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; -import com.google.common.collect.Sets; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemBasicCraftTool extends ItemTool implements IToolMaterial, IToolMF, IDamageType -{ - private int tier; - private String name; - private String toolType; - public ItemBasicCraftTool(String name, String type, int tier, int uses) - { - super(1.0F, ToolMaterial.WOOD, Sets.newHashSet(new Block[] {})); +public class ItemBasicCraftTool extends ItemTool implements IToolMaterial, IToolMF, IDamageType { + protected int itemRarity; + private int tier; + private String name; + private String toolType; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + + public ItemBasicCraftTool(String name, String type, int tier, int uses) { + super(1.0F, ToolMaterial.WOOD, Sets.newHashSet(new Block[]{})); this.tier = tier; setCreativeTab(CreativeTabMF.tabCraftTool); - - this.name=name; + + this.name = name; toolType = type; - setTextureName("minefantasy2:Tool/Crafting/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - setMaxDamage(uses); - this.setMaxStackSize(1); + setTextureName("minefantasy2:Tool/Crafting/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + setMaxDamage(uses); + this.setMaxStackSize(1); } - + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); - } - - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - @Override - public String getToolType(ItemStack item) - { - return toolType; - } - - - @Override - public float[] getDamageRatio(Object... implement) - { - return new float[]{0,1, 0}; - } - - private void addSet(List list, Item[] items) - { - for(Item item:items) - { - list.add(new ItemStack(item)); - } - } - @Override - public float getPenetrationLevel(Object implement) - { - return 0F; - } - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemBasicCraftTool setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemStack construct(String main) - { - return CustomToolHelper.construct(this, main); - } - - @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - list.add(this.construct("OakWood")); - list.add(this.construct("IronbarkWood")); - list.add(this.construct("EbonyWood")); - } - else - { - super.getSubItems(item, tab, list); - } - } - + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + } + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } + + @Override + public String getToolType(ItemStack item) { + return toolType; + } + + @Override + public float[] getDamageRatio(Object... implement) { + return new float[]{0, 1, 0}; + } + + private void addSet(List list, Item[] items) { + for (Item item : items) { + list.add(new ItemStack(item)); + } + } + + @Override + public float getPenetrationLevel(Object implement) { + return 0F; + } + + public ItemBasicCraftTool setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemStack construct(String main) { + return CustomToolHelper.construct(this, main); + } + + @Override + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + list.add(this.construct("OakWood")); + list.add(this.construct("IronbarkWood")); + list.add(this.construct("EbonyWood")); + } else { + super.getSubItems(item, tab, list); + } + } + + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { super.addInformation(item, user, list, extra); } - private float efficiencyMod = 1.0F; - @Override - public float getEfficiency(ItemStack item) - { - return CustomToolHelper.getEfficiencyForHds(item, toolMaterial.getEfficiencyOnProperMaterial(), efficiencyMod); - } - - @Override - public int getTier(ItemStack item) - { - return CustomToolHelper.getCrafterTier(item, tier); - } - @Override + @Override + public float getEfficiency(ItemStack item) { + return CustomToolHelper.getEfficiencyForHds(item, toolMaterial.getEfficiencyOnProperMaterial(), efficiencyMod); + } + + @Override + public int getTier(ItemStack item) { + return CustomToolHelper.getCrafterTier(item, tier); + } + + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - protected int itemRarity; + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemEAnvilTools.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemEAnvilTools.java index 0b88399d..36710cb5 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemEAnvilTools.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemEAnvilTools.java @@ -1,50 +1,34 @@ package minefantasy.mf2.item.tool.crafting; -import java.util.List; - +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.ToolHelper; -import minefantasy.mf2.api.tier.IToolMaterial; -import minefantasy.mf2.api.tool.IToolMF; -import minefantasy.mf2.api.weapon.IDamageType; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.item.tool.ToolMaterialMF; -import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemTool; - -import com.google.common.collect.Sets; - -import cpw.mods.fml.common.registry.GameRegistry; /** * @author Anonymous Productions */ -public class ItemEAnvilTools extends Item -{ - public ItemEAnvilTools(String name, int uses) - { +public class ItemEAnvilTools extends Item { + public ItemEAnvilTools(String name, int uses) { setCreativeTab(CreativeTabMF.tabCraftTool); - - setTextureName("minefantasy2:Tool/Crafting/Engineer/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - this.setMaxDamage(uses); - setMaxStackSize(1); + + setTextureName("minefantasy2:Tool/Crafting/Engineer/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + this.setMaxDamage(uses); + setMaxStackSize(1); } + @Override - public ItemStack getContainerItem(ItemStack item) - { - item.setItemDamage(item.getItemDamage()+1); - return item.getItemDamage() >= item.getMaxDamage() ? null : item; + public ItemStack getContainerItem(ItemStack item) { + item.setItemDamage(item.getItemDamage() + 1); + return item.getItemDamage() >= item.getMaxDamage() ? null : item; } + @Override - public int getMaxDamage(ItemStack stack) - { - return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); - } + public int getMaxDamage(ItemStack stack) { + return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemEngineerTool.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemEngineerTool.java index 9d87bac2..ddbcaa7b 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemEngineerTool.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemEngineerTool.java @@ -1,7 +1,7 @@ package minefantasy.mf2.item.tool.crafting; -import java.util.List; - +import com.google.common.collect.Sets; +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.tier.IToolMaterial; @@ -9,100 +9,81 @@ import minefantasy.mf2.api.weapon.IDamageType; import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.item.tool.ToolMaterialMF; import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; -import com.google.common.collect.Sets; - -import cpw.mods.fml.common.registry.GameRegistry; - /** * @author Anonymous Productions */ -public class ItemEngineerTool extends ItemTool implements IToolMaterial, IToolMF, IDamageType -{ - private ToolMaterial material; - private int tier; - private String toolType; - - public ItemEngineerTool(String name, ToolMaterial material, int tier, String toolType, int rarity) - { - super(1.0F, material, Sets.newHashSet(new Block[] {})); - this.toolType=toolType; +public class ItemEngineerTool extends ItemTool implements IToolMaterial, IToolMF, IDamageType { + private ToolMaterial material; + private int tier; + private String toolType; + private int itemRarity; + + public ItemEngineerTool(String name, ToolMaterial material, int tier, String toolType, int rarity) { + super(1.0F, material, Sets.newHashSet(new Block[]{})); + this.toolType = toolType; this.material = material; this.tier = tier; itemRarity = rarity; setCreativeTab(CreativeTabMF.tabCraftTool); - - setTextureName("minefantasy2:Tool/Crafting/Engineer/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); + + setTextureName("minefantasy2:Tool/Crafting/Engineer/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } - private int itemRarity; + @Override - public EnumRarity getRarity(ItemStack item) - { - int lvl = itemRarity+1; - - if(item.isItemEnchanted()) - { - if(lvl == 0) - { - lvl++; - } - lvl ++; - } - if(lvl >= ToolListMF.rarity.length) - { - lvl = ToolListMF.rarity.length-1; - } - return ToolListMF.rarity[lvl]; - } - - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - @Override - public float getEfficiency(ItemStack item) - { - return ToolHelper.modifyDigOnQuality(item, material.getEfficiencyOnProperMaterial()); - } + public EnumRarity getRarity(ItemStack item) { + int lvl = itemRarity + 1; - @Override - public int getTier(ItemStack item) - { - return tier; - } + if (item.isItemEnchanted()) { + if (lvl == 0) { + lvl++; + } + lvl++; + } + if (lvl >= ToolListMF.rarity.length) { + lvl = ToolListMF.rarity.length - 1; + } + return ToolListMF.rarity[lvl]; + } - @Override - public String getToolType(ItemStack item) - { - return toolType; - } - - @Override - public int getMaxDamage(ItemStack stack) - { - return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); - } + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } - @Override - public float[] getDamageRatio(Object... implement) - { - return new float[]{0,1, 0}; - } + @Override + public float getEfficiency(ItemStack item) { + return ToolHelper.modifyDigOnQuality(item, material.getEfficiencyOnProperMaterial()); + } + + @Override + public int getTier(ItemStack item) { + return tier; + } - @Override - public float getPenetrationLevel(Object implement) - { - return 0F; - } + @Override + public String getToolType(ItemStack item) { + return toolType; + } + + @Override + public int getMaxDamage(ItemStack stack) { + return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); + } + + @Override + public float[] getDamageRatio(Object... implement) { + return new float[]{0, 1, 0}; + } + + @Override + public float getPenetrationLevel(Object implement) { + return 0F; + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemHammer.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemHammer.java index 6a5e9007..6ab49c19 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemHammer.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemHammer.java @@ -1,20 +1,18 @@ package minefantasy.mf2.item.tool.crafting; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.google.common.collect.Sets; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.api.tool.IToolMF; import minefantasy.mf2.api.weapon.IDamageType; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.item.tool.ItemAxeMF; -import minefantasy.mf2.item.tool.ToolMaterialMF; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -28,243 +26,217 @@ import net.minecraft.util.IIcon; import net.minecraftforge.common.ForgeHooks; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.collect.Sets; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemHammer extends ItemTool implements IToolMaterial, IToolMF, IDamageType -{ - private ToolMaterial material; - private int tier; - private boolean heavy; - private float baseDamage; - private String name; - public ItemHammer(String name, ToolMaterial material, boolean heavy, int rarity, int tier) - { - super(heavy ? 3.0F:2.0F, material, Sets.newHashSet(new Block[] {})); +public class ItemHammer extends ItemTool implements IToolMaterial, IToolMF, IDamageType { + protected int itemRarity; + private ToolMaterial material; + private int tier; + private boolean heavy; + private float baseDamage; + private String name; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + public ItemHammer(String name, ToolMaterial material, boolean heavy, int rarity, int tier) { + super(heavy ? 3.0F : 2.0F, material, Sets.newHashSet(new Block[]{})); this.heavy = heavy; this.material = material; this.name = name; itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.setMaxDamage(material.getMaxUses() *2); + this.setMaxDamage(material.getMaxUses() * 2); this.tier = tier; - setTextureName("minefantasy2:Tool/Crafting/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); + setTextureName("minefantasy2:Tool/Crafting/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - @Override - public String getToolType(ItemStack item) - { - return heavy ? "hvyHammer" : "hammer"; - } - - - @Override - public float[] getDamageRatio(Object... implement) - { - return new float[]{0,1, 0}; - } - - - private void addSet(List list, Item[] items) - { - for(Item item:items) - { - list.add(new ItemStack(item)); - } - } - @Override - public float getPenetrationLevel(Object implement) - { - return 0F; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemHammer setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemHammer setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; } - - - private float efficiencyMod = 1.0F; - public ItemHammer setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; + + @Override + public String getToolType(ItemStack item) { + return heavy ? "hvyHammer" : "hammer"; } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + @Override + public float[] getDamageRatio(Object... implement) { + return new float[]{0, 1, 0}; + } + + private void addSet(List list, Item[] items) { + for (Item item : items) { + list.add(new ItemStack(item)); + } + } + + @Override + public float getPenetrationLevel(Object implement) { + return 0F; + } + + public ItemHammer setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemHammer setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemHammer setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + } + + @Override + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public float getEfficiency(ItemStack item) { + return CustomToolHelper.getEfficiency(item, material.getEfficiencyOnProperMaterial(), efficiencyMod); + } + @Override - public float getEfficiency(ItemStack item) - { - return CustomToolHelper.getEfficiency(item, material.getEfficiencyOnProperMaterial(), efficiencyMod); - } - @Override - public int getTier(ItemStack item) - { - return CustomToolHelper.getCrafterTier(item, tier); - } - + public int getTier(ItemStack item) { + return CustomToolHelper.getCrafterTier(item, tier); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } - public float func_150893_a(ItemStack stack, Block block) - { - float base = super.func_150893_a(stack, block); - return base <= 1.0F ? base : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); + } + + public float func_150893_a(ItemStack stack, Block block) { + float base = super.func_150893_a(stack, block); + return base <= 1.0F ? base + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } - + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemKnifeMF.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemKnifeMF.java index 477cf5fe..755f614c 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemKnifeMF.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemKnifeMF.java @@ -1,271 +1,280 @@ package minefantasy.mf2.item.tool.crafting; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tool.IHuntingItem; import minefantasy.mf2.api.tool.IToolMF; import minefantasy.mf2.api.weapon.WeaponClass; -import minefantasy.mf2.item.list.CreativeTabMF; import minefantasy.mf2.item.weapon.ItemWeaponMF; +import minefantasy.mf2.util.XSTRandom; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.IShearable; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemKnifeMF extends ItemWeaponMF implements IToolMF, IHuntingItem -{ - private Random rand = new Random(); - private int tier; - private float baseDamage; - /** - * Knives are weapons used for hunting, and tools used for processing - */ - public ItemKnifeMF(String name, ToolMaterial material, int rarity, float weight, int tier) - { - super(material, name, rarity, weight); - this.tier = tier; - setTextureName("minefantasy2:Tool/Crafting/"+name); +public class ItemKnifeMF extends ItemWeaponMF implements IToolMF, IHuntingItem { + protected int itemRarity; + private int tier; + private float baseDamage; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + /** + * Knives are weapons used for hunting, and tools used for processing + */ + public ItemKnifeMF(String name, ToolMaterial material, int rarity, float weight, int tier) { + super(material, name, rarity, weight); + this.tier = tier; + setTextureName("minefantasy2:Tool/Crafting/" + name); + } + + @Override + public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) { + if (!player.worldObj.isRemote) { + Block block = player.worldObj.getBlock(x, y, z); + if (block instanceof IShearable) { + IShearable target = (IShearable) block; + if (target.isShearable(itemstack, player.worldObj, x, y, z)) { + XSTRandom rand = new XSTRandom(); + if(rand.nextInt(10) < 3) { //knife has reduced drop and can't be used to shear entity's + ArrayList drops = target.onSheared(itemstack, player.worldObj, x, y, z, + EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); + for (ItemStack stack : drops) { + float f = 0.7F; + double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + EntityItem entityitem = new EntityItem(player.worldObj, (double) x + d, (double) y + d1, (double) z + d2, stack); + entityitem.delayBeforeCanPickup = 10; + player.worldObj.spawnEntityInWorld(entityitem); + } + + itemstack.damageItem(1, player); + player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); + } + } + } + } + return false; } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { - return item; - } - - @Override - public boolean canRetrieveDrops(ItemStack item) - { - return true; - } - - @Override - public String getToolType(ItemStack item) - { - return "knife"; - } - - @Override - public boolean canBlock() - { - return false; - } - /** - * Determines if the weapon can parry - */ - @Override - public boolean canWeaponParry() - { - return false; - } - - @Override - protected float getStaminaMod() - { - return 0.5F; - } - @Override - public WeaponClass getWeaponClass() - { - return null; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemKnifeMF setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemKnifeMF setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { + return item; } - @Override - public float getEfficiency(ItemStack item) - { - return CustomToolHelper.getEfficiency(item, material.getEfficiencyOnProperMaterial(), efficiencyMod); - } - @Override - public int getTier(ItemStack item) - { - return CustomToolHelper.getCrafterTier(item, tier); - } - - private float efficiencyMod = 1.0F; - public ItemKnifeMF setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; + + @Override + public boolean canRetrieveDrops(ItemStack item) { + return true; } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, material.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + @Override + public String getToolType(ItemStack item) { + return "knife"; + } + + @Override + public boolean canBlock() { + return false; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return false; + } + + @Override + protected float getStaminaMod() { + return 0.5F; + } + + @Override + public WeaponClass getWeaponClass() { + return null; + } + + public ItemKnifeMF setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemKnifeMF setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + @Override + public float getEfficiency(ItemStack item) { + return CustomToolHelper.getEfficiency(item, material.getEfficiencyOnProperMaterial(), efficiencyMod); + } + + @Override + public int getTier(ItemStack item) { + return CustomToolHelper.getCrafterTier(item, tier); + } + + public ItemKnifeMF setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, material.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } - - public float func_150893_a(ItemStack stack, Block block) - { - float base = super.func_150893_a(stack, block); - return base <= 1.0F ? base : CustomToolHelper.getEfficiency(stack, material.getEfficiencyOnProperMaterial(), efficiencyMod); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); + } + + public float func_150893_a(ItemStack stack, Block block) { + float base = super.func_150893_a(stack, block); + return base <= 1.0F ? base + : CustomToolHelper.getEfficiency(stack, material.getEfficiencyOnProperMaterial(), efficiencyMod); } - + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } - + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemNeedle.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemNeedle.java index 08fa025f..61729fa3 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemNeedle.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemNeedle.java @@ -1,9 +1,11 @@ package minefantasy.mf2.item.tool.crafting; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.google.common.collect.Sets; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; @@ -22,178 +24,160 @@ import net.minecraft.item.ItemTool; import net.minecraft.util.IIcon; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.collect.Sets; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemNeedle extends ItemTool implements IToolMaterial, IToolMF -{ - private ToolMaterial material; - private int tier; - private float baseDamage; - private String name; - - public ItemNeedle(String name, ToolMaterial material, int rarity, int tier) - { - super(0F, material, Sets.newHashSet(new Block[] {})); +public class ItemNeedle extends ItemTool implements IToolMaterial, IToolMF { + protected int itemRarity; + private ToolMaterial material; + private int tier; + private float baseDamage; + private String name; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + + public ItemNeedle(String name, ToolMaterial material, int rarity, int tier) { + super(0F, material, Sets.newHashSet(new Block[]{})); this.material = material; this.name = name; itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.tier=tier; - setTextureName("minefantasy2:Tool/Crafting/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); + this.tier = tier; + setTextureName("minefantasy2:Tool/Crafting/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } - + @Override - public Multimap getItemAttributeModifiers() - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 0.5D, 0)); + public Multimap getItemAttributeModifiers() { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", 0.5D, 0)); return map; } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemNeedle setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - private float efficiencyMod = 1.0F; - public ItemNeedle setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; - } - - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - } - super.registerIcons(reg); - } - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return isCustom; - } - @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass > 0 && detailTex != null) - { - return detailTex; - } - return super.getIcon(stack, pass); - } - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); - } - @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - public ItemStack construct(String main) - { - return CustomToolHelper.construct(this, main, null); - } - protected int itemRarity; - @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } - @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); - } - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name)); - } - } - } - else - { - super.getSubItems(item, tab, list); - } - } - - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); - } - super.addInformation(item, user, list, extra); - } - - @Override - public float getEfficiency(ItemStack item) - { - return CustomToolHelper.getEfficiency(item, toolMaterial.getEfficiencyOnProperMaterial(), efficiencyMod); - } - - @Override - public int getTier(ItemStack item) - { - return CustomToolHelper.getCrafterTier(item, tier); - } - @Override - @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); - } - //====================================================== CUSTOM END ==============================================================\\ - @Override - public String getToolType(ItemStack item) - { - return "needle"; - } - - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } + + public ItemNeedle setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemNeedle setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + if (isCustom) { + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + } + super.registerIcons(reg); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return isCustom; + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass > 0 && detailTex != null) { + return detailTex; + } + return super.getIcon(stack, pass); + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + } + + @Override + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main) { + return CustomToolHelper.construct(this, main, null); + } + + @Override + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + + @Override + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name)); + } + } + } else { + super.getSubItems(item, tab, list); + } + } + + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); + } + super.addInformation(item, user, list, extra); + } + + @Override + public float getEfficiency(ItemStack item) { + return CustomToolHelper.getEfficiency(item, toolMaterial.getEfficiencyOnProperMaterial(), efficiencyMod); + } + + @Override + public int getTier(ItemStack item) { + return CustomToolHelper.getCrafterTier(item, tier); + } + + @Override + @SideOnly(Side.CLIENT) + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); + } + + // ====================================================== CUSTOM END + // ==============================================================\\ + @Override + public String getToolType(ItemStack item) { + return "needle"; + } + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemPaintBrush.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemPaintBrush.java index ee028183..d1ae56f7 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemPaintBrush.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemPaintBrush.java @@ -19,109 +19,103 @@ /** * @author Anonymous Productions */ -public class ItemPaintBrush extends ItemBasicCraftTool implements IRackItem -{ - public ItemPaintBrush(String name, int uses) - { - super(name, "brush", 0, uses); +public class ItemPaintBrush extends ItemBasicCraftTool implements IRackItem { + public ItemPaintBrush(String name, int uses) { + super(name, "brush", 0, uses); setCreativeTab(CreativeTabMF.tabCraftTool); - - //setTextureName("minefantasy2:Tool/Crafting/"+name); - //this.setUnlocalizedName(name); - //this.setMaxDamage(uses); - //setMaxStackSize(1); - this.setFull3D(); + + // setTextureName("minefantasy2:Tool/Crafting/"+name); + // this.setUnlocalizedName(name); + // this.setMaxDamage(uses); + // setMaxStackSize(1); + this.setFull3D(); } + @Override - public ItemStack getContainerItem(ItemStack item) - { - item.setItemDamage(item.getItemDamage()+1); - return item.getItemDamage() >= item.getMaxDamage() ? null : item; + public ItemStack getContainerItem(ItemStack item) { + item.setItemDamage(item.getItemDamage() + 1); + return item.getItemDamage() >= item.getMaxDamage() ? null : item; } + @Override - public int getMaxDamage(ItemStack stack) - { - return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); - } - - private boolean onUsedWithBlock(World world, int x, int y, int z, Block block, ItemStack item, EntityPlayer user) - { - Block newBlock = null; - int meta = world.getBlockMetadata(x, y, z); - ItemStack output = PaintOilRecipe.getPaintResult(new ItemStack(block, 1, meta)); - if(output != null && output.getItem() instanceof ItemBlock) - { - newBlock = Block.getBlockFromItem(output.getItem()); - if(output.getItemDamage() != OreDictionary.WILDCARD_VALUE) - { - meta = output.getItemDamage(); - } - } - if(newBlock != null) - { - world.playAuxSFXAtEntity(user, 2001, x, y, z, Block.getIdFromBlock(newBlock) + (meta << 12)); - - user.inventory.consumeInventoryItem(ComponentListMF.plant_oil); - ItemStack jug = new ItemStack(FoodListMF.jug_empty); - - if(!user.inventory.addItemStackToInventory(jug) && !world.isRemote) - { - user.entityDropItem(jug, 0F); - } - if(world.isRemote)return true; - - SkillList.construction.addXP(user, 1); - item.damageItem(1, user); - world.setBlock(x, y, z, newBlock); - world.setBlockMetadataWithNotify(x, y, z, meta, 2); - } - return false; - } - + public int getMaxDamage(ItemStack stack) { + return ToolHelper.setDuraOnQuality(stack, super.getMaxDamage()); + } + @Override - public boolean onItemUse(ItemStack item, EntityPlayer user, World world, int x, int y, int z, int side, float f, float f1, float f2) - { - if(!ResearchLogic.hasInfoUnlocked(user, "paint_brush")) - { - return false; - } - if (!user.canPlayerEdit(x, y, z, side, item)) - { - return false; + public boolean onItemUse(ItemStack item, EntityPlayer user, World world, int x, int y, int z, int side, float f, + float f1, float f2) { + if (user.canPlayerEdit(x, y, z, side, item) && ResearchLogic.hasInfoUnlocked(user, "paint_brush")) { + if (!user.isSwingInProgress && user.inventory.hasItem(ComponentListMF.plant_oil)) { + Block block = world.getBlock(x, y, z); + return onUsedWithBlock(world, x, y, z, block, item, user); + } } - else if(!user.isSwingInProgress && user.inventory.hasItem(ComponentListMF.plant_oil)) - { - Block block = world.getBlock(x, y, z); - return onUsedWithBlock(world, x, y, z, block, item, user); + return false; + } + + private boolean onUsedWithBlock(World world, int x, int y, int z, Block block, ItemStack item, EntityPlayer user) { + Block newBlock = null; + int meta = world.getBlockMetadata(x, y, z); + ItemStack output = PaintOilRecipe.getPaintResult(new ItemStack(block, 1, meta)); + if (output != null && output.getItem() instanceof ItemBlock) { + newBlock = Block.getBlockFromItem(output.getItem()); + if (output.getItemDamage() != OreDictionary.WILDCARD_VALUE) { + meta = output.getItemDamage(); + } } + if (newBlock != null) { + world.playAuxSFXAtEntity(user, 2001, x, y, z, Block.getIdFromBlock(newBlock) + (meta << 12)); + + user.inventory.consumeInventoryItem(ComponentListMF.plant_oil); + ItemStack jug = new ItemStack(FoodListMF.jug_empty); + + if (!user.inventory.addItemStackToInventory(jug) && !world.isRemote) { + user.entityDropItem(jug, 0F); + } + if (world.isRemote) + return true; + + SkillList.construction.addXP(user, 1); + item.damageItem(1, user); + world.setBlock(x, y, z, newBlock); + world.setBlockMetadataWithNotify(x, y, z, meta, 2); + } + return false; + } + + @Override + public float getScale(ItemStack itemstack) { + return 1.0F; + } + + @Override + public float getOffsetX(ItemStack itemstack) { + return 0; + } + + @Override + public float getOffsetY(ItemStack itemstack) { + return 9F / 16F; + } + + @Override + public float getOffsetZ(ItemStack itemstack) { + return 1F / 8F; + } + + @Override + public float getRotationOffset(ItemStack itemstack) { + return 90; + } + + @Override + public boolean canHang(TileEntityRack rack, ItemStack item, int slot) { + return true; + } + + @Override + public boolean isSpecialRender(ItemStack item) { return false; } - @Override - public float getScale(ItemStack itemstack) { - return 1.0F; - } - @Override - public float getOffsetX(ItemStack itemstack) { - return 0; - } - @Override - public float getOffsetY(ItemStack itemstack) { - return 9F/16F; - } - @Override - public float getOffsetZ(ItemStack itemstack) { - return 1F/8F; - } - @Override - public float getRotationOffset(ItemStack itemstack) { - return 90; - } - @Override - public boolean canHang(TileEntityRack rack, ItemStack item, int slot) { - return true; - } - @Override - public boolean isSpecialRender(ItemStack item) { - return false; - } } diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemSaw.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemSaw.java index d8459bc0..e783a292 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemSaw.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemSaw.java @@ -1,33 +1,22 @@ package minefantasy.mf2.item.tool.crafting; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.api.material.CustomMaterial; -import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.api.tool.IToolMF; import minefantasy.mf2.api.weapon.IDamageType; import minefantasy.mf2.api.weapon.IRackItem; import minefantasy.mf2.block.tileentity.decor.TileEntityRack; -import minefantasy.mf2.config.ConfigTools; import minefantasy.mf2.item.list.CreativeTabMF; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; @@ -36,272 +25,256 @@ import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.common.util.ForgeDirection; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemSaw extends ItemAxe implements IToolMaterial, IDamageType, IToolMF, IRackItem -{ - private float hitDamage; - private float baseDamage; - private String name; - private int tier; - /** - */ - public ItemSaw(String name, ToolMaterial material, int rarity, int tier) - { +public class ItemSaw extends ItemAxe implements IToolMaterial, IDamageType, IToolMF, IRackItem { + protected int itemRarity; + private float hitDamage; + private float baseDamage; + private String name; + private int tier; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + /** + */ + public ItemSaw(String name, ToolMaterial material, int rarity, int tier) { super(material); - this.tier=tier; + this.tier = tier; itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.hitDamage = (2.0F + material.getDamageVsEntity())/2F; - setTextureName("minefantasy2:Tool/Crafting/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - this.name = name; - this.setHarvestLevel("axe", material.getHarvestLevel()); - } - + this.hitDamage = (2.0F + material.getDamageVsEntity()) / 2F; + setTextureName("minefantasy2:Tool/Crafting/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + this.name = name; + this.setHarvestLevel("axe", material.getHarvestLevel()); + } + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } + @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - @Override - public Multimap getItemAttributeModifiers() - { + public Multimap getItemAttributeModifiers() { Multimap multimap = super.getItemAttributeModifiers(); - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", this.hitDamage, 0)); + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Tool modifier", this.hitDamage, 0)); return multimap; } - - @Override - public float[] getDamageRatio(Object... implement) - { - return new float[]{1,0, 0}; - } - - @Override - public String getToolType(ItemStack item) - { - return "saw"; - } - @Override - public float getPenetrationLevel(Object implement) - { - return 0.5F; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemSaw setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemSaw setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; - } - - @Override - public float getEfficiency(ItemStack item) - { - return CustomToolHelper.getEfficiency(item, toolMaterial.getEfficiencyOnProperMaterial(), efficiencyMod); - } - @Override - public int getTier(ItemStack item) - { - return CustomToolHelper.getCrafterTier(item, tier); - } - - private float efficiencyMod = 1.0F; - public ItemSaw setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; - } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + @Override + public float[] getDamageRatio(Object... implement) { + return new float[]{1, 0, 0}; + } + + @Override + public String getToolType(ItemStack item) { + return "saw"; + } + + @Override + public float getPenetrationLevel(Object implement) { + return 0.5F; + } + + public ItemSaw setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemSaw setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + @Override + public float getEfficiency(ItemStack item) { + return CustomToolHelper.getEfficiency(item, toolMaterial.getEfficiencyOnProperMaterial(), efficiencyMod); + } + + @Override + public int getTier(ItemStack item) { + return CustomToolHelper.getCrafterTier(item, tier); + } + + public ItemSaw setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } - public float func_150893_a(ItemStack stack, Block block) - { - float base = super.func_150893_a(stack, block); - return base <= 1.0F ? base : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); + } + + public float func_150893_a(ItemStack stack, Block block) { + float base = super.func_150893_a(stack, block); + return base <= 1.0F ? base + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } - } - + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } + } + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } - + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); - } - //====================================================== CUSTOM END ==============================================================\\ - - @Override - public float getScale(ItemStack itemstack) { - return 1.0F; - } - - @Override - public float getOffsetX(ItemStack itemstack) { - return 0; - } - - @Override - public float getOffsetY(ItemStack itemstack) { - return 9F/16F; - } - - @Override - public float getOffsetZ(ItemStack itemstack) { - return 0; - } - - @Override - public float getRotationOffset(ItemStack itemstack) { - return 90F; - } - - @Override - public boolean canHang(TileEntityRack rack, ItemStack item, int slot) { - return true; - } - - @Override - public boolean isSpecialRender(ItemStack item) { - return false; - } + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); + } + // ====================================================== CUSTOM END + // ==============================================================\\ + + @Override + public float getScale(ItemStack itemstack) { + return 1.0F; + } + + @Override + public float getOffsetX(ItemStack itemstack) { + return 0; + } + + @Override + public float getOffsetY(ItemStack itemstack) { + return 9F / 16F; + } + + @Override + public float getOffsetZ(ItemStack itemstack) { + return 0; + } + + @Override + public float getRotationOffset(ItemStack itemstack) { + return 90F; + } + + @Override + public boolean canHang(TileEntityRack rack, ItemStack item, int slot) { + return true; + } + + @Override + public boolean isSpecialRender(ItemStack item) { + return false; + } } diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemSpanner.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemSpanner.java index 82082a61..da543442 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemSpanner.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemSpanner.java @@ -1,23 +1,28 @@ package minefantasy.mf2.item.tool.crafting; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import buildcraft.api.tools.IToolWrench; +import cofh.api.item.IToolHammer; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.google.common.collect.Sets; +import cpw.mods.fml.common.Optional.Interface; +import cpw.mods.fml.common.Optional.InterfaceList; +import cpw.mods.fml.common.Optional.Method; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.api.tool.IToolMF; import minefantasy.mf2.api.weapon.IDamageType; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.item.tool.ItemAxeMF; -import minefantasy.mf2.item.tool.ToolMaterialMF; -import net.minecraft.block.Block; +import minefantasy.mf2.util.Utils; +import net.minecraft.block.*; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; @@ -26,243 +31,291 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraft.util.IIcon; +import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.util.ForgeDirection; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.collect.Sets; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.*; /** * @author Anonymous Productions */ -public class ItemSpanner extends ItemTool implements IToolMaterial, IToolMF, IDamageType -{ - private ToolMaterial material; - private int tier; - private float baseDamage; - private String name; - public ItemSpanner(String name, int rarity, int tier) - { - super(2.0F, ToolMaterial.IRON, Sets.newHashSet(new Block[] {})); + +@InterfaceList({ + @Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft|Core"), + @Interface(iface = "cofh.api.item.IToolHammer", modid = "CoFHAPI|item") +}) + +public class ItemSpanner extends ItemTool implements IToolMaterial, IToolMF, IDamageType, IToolWrench, IToolHammer { + protected int itemRarity; + private ToolMaterial material; + private int tier; + private float baseDamage; + private String name; + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + private IIcon haftTex = null; + + private final Set> shiftRotations = new HashSet>(); + private final Set> blacklistedRotations = new HashSet>(); + + public ItemSpanner(String name, int rarity, int tier) { + super(2.0F, ToolMaterial.IRON, Sets.newHashSet(new Block[]{})); this.material = ToolMaterial.IRON; this.name = name; itemRarity = rarity; setCreativeTab(CreativeTabMF.tabOldTools); - this.setMaxDamage(material.getMaxUses() *2); + this.setMaxDamage(material.getMaxUses() * 2); this.tier = tier; - setTextureName("minefantasy2:Tool/Crafting/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - } - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - @Override - public String getToolType(ItemStack item) - { - return "spanner"; - } - - - @Override - public float[] getDamageRatio(Object... implement) - { - return new float[]{0,1, 0}; - } - - - private void addSet(List list, Item[] items) - { - for(Item item:items) - { - list.add(new ItemStack(item)); - } - } - @Override - public float getPenetrationLevel(Object implement) - { - return 0F; - } - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemSpanner setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemSpanner setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; - } - - - private float efficiencyMod = 1.0F; - public ItemSpanner setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; - } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + setTextureName("minefantasy2:Tool/Crafting/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + + shiftRotations.add(BlockLever.class); + shiftRotations.add(BlockButton.class); + shiftRotations.add(BlockChest.class); + blacklistedRotations.add(BlockBed.class); + } + + @Override + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + Block block = world.getBlock(x, y, z); + + if (block == null || isClass(blacklistedRotations, block.getClass())) { + return false; + } + + if (player.isSneaking() != isClass(shiftRotations, block.getClass())) { + return false; + } + + if (block instanceof BlockChest && Utils.getOtherDoubleChest(world.getTileEntity(x, y, z)) != null) { + return false; + } + + if (block.rotateBlock(world, x, y, z, ForgeDirection.getOrientation(side))) { + player.swingItem(); + return !world.isRemote; + } + return false; + } + + private boolean isClass(Set> set, Class cls) { + for (Class shift : set) { + if (shift.isAssignableFrom(cls)) { + return true; + } + } + return false; + } + + @Override + public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) { + return true; + } + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; + } + + @Override + public String getToolType(ItemStack item) { + return "spanner"; + } + + @Override + public float[] getDamageRatio(Object... implement) { + return new float[]{0, 1, 0}; + } + + private void addSet(List list, Item[] items) { + for (Item item : items) { + list.add(new ItemStack(item)); + } + } + + @Override + public float getPenetrationLevel(Object implement) { + return 0F; + } + + public ItemSpanner setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemSpanner setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemSpanner setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } + @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getEfficiency(ItemStack item) - { - return CustomToolHelper.getEfficiency(item, material.getEfficiencyOnProperMaterial(), efficiencyMod); - } - @Override - public int getTier(ItemStack item) - { - return CustomToolHelper.getCrafterTier(item, tier); - } - + public float getEfficiency(ItemStack item) { + return CustomToolHelper.getEfficiency(item, material.getEfficiencyOnProperMaterial(), efficiencyMod); + } + + @Override + public int getTier(ItemStack item) { + return CustomToolHelper.getCrafterTier(item, tier); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } - public float func_150893_a(ItemStack stack, Block block) - { - float base = super.func_150893_a(stack, block); - return base <= 1.0F ? base : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); } + + public float func_150893_a(ItemStack stack, Block block) { + float base = super.func_150893_a(stack, block); + return base <= 1.0F ? base + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - } - else - { - super.getSubItems(item, tab, list); - } - } - + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + } else { + super.getSubItems(item, tab, list); + } + } + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); } super.addInformation(item, user, list, extra); } - + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); + } + + /* BuildCraft wrench support */ + @Override + @Method(modid = "BuildCraft|Core") + public boolean canWrench(EntityPlayer player, int x, int y, int z) { + return true; + } + + @Override + @Method(modid = "BuildCraft|Core") + public void wrenchUsed(EntityPlayer player, int x, int y, int z) { + player.getCurrentEquippedItem().damageItem(1, player); + player.swingItem(); + } + + /* COFH mods wrench support */ + @Override + @Method(modid = "CoFHAPI|item") + public boolean isUsable(ItemStack item, EntityLivingBase user, int x, int y, int z) { + return user instanceof EntityPlayer; + } + + @Override + @Method(modid = "CoFHAPI|item") + public void toolUsed(ItemStack item, EntityLivingBase user, int x, int y, int z) { + item.damageItem(1, user); } - //====================================================== CUSTOM END ==============================================================\\ -} +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemTongs.java b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemTongs.java index dc40e059..41dcbc95 100644 --- a/src/main/java/minefantasy/mf2/item/tool/crafting/ItemTongs.java +++ b/src/main/java/minefantasy/mf2/item/tool/crafting/ItemTongs.java @@ -1,23 +1,20 @@ package minefantasy.mf2.item.tool.crafting; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.google.common.collect.Sets; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.heating.Heatable; import minefantasy.mf2.api.heating.TongsHelper; import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.GuiHelper; -import minefantasy.mf2.api.helpers.ToolHelper; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.tier.IToolMaterial; import minefantasy.mf2.api.tool.ISmithTongs; import minefantasy.mf2.item.list.CreativeTabMF; -import minefantasy.mf2.item.list.ToolListMF; -import minefantasy.mf2.item.tool.ToolMaterialMF; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -25,7 +22,6 @@ import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -35,320 +31,278 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.collect.Sets; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; /** * @author Anonymous Productions */ -public class ItemTongs extends ItemTool implements IToolMaterial, ISmithTongs -{ - private ToolMaterial material; - private float baseDamage; - private String name; - - public ItemTongs(String name, ToolMaterial material, int rarity) - { - super(0F, material, Sets.newHashSet(new Block[] {})); +public class ItemTongs extends ItemTool implements IToolMaterial, ISmithTongs { + protected int itemRarity; + private ToolMaterial material; + private float baseDamage; + private String name; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private float efficiencyMod = 1.0F; + private IIcon detailTex = null; + + public ItemTongs(String name, ToolMaterial material, int rarity) { + super(0F, material, Sets.newHashSet(new Block[]{})); this.material = material; itemRarity = rarity; this.name = name; setCreativeTab(CreativeTabMF.tabOldTools); - setTextureName("minefantasy2:Tool/Crafting/"+name); - this.setMaxDamage(getMaxDamage()/5); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); + setTextureName("minefantasy2:Tool/Crafting/" + name); + this.setMaxDamage(getMaxDamage() / 5); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); } - + @Override - public Multimap getItemAttributeModifiers() - { - Multimap map = HashMultimap.create(); - map.clear(); + public Multimap getItemAttributeModifiers() { + Multimap map = HashMultimap.create(); + map.clear(); return map; } - - @Override - public ToolMaterial getMaterial() - { - return toolMaterial; - } - - - - - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) - { - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); - - if (movingobjectposition == null) { - return item; - } else { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!world.canMineBlock(player, i, j, k)) { - return item; - } - - if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { - return item; - } - - float water = TongsHelper.getWaterSource(world, i, j, k); - - if (TongsHelper.getHeldItem(item) != null && water >= 0) - { - ItemStack drop = TongsHelper.getHeldItem(item).copy(), cooled = drop; - - if (TongsHelper.isCoolableItem(drop)) - { - cooled = Heatable.getQuenchedItem(drop, water); - cooled.stackSize = drop.stackSize; - - player.playSound("random.splash", 1F, 1F); - player.playSound("random.fizz", 2F, 0.5F); - - for (int a = 0; a < 5; a++) { - world.spawnParticle("largesmoke", i + 0.5F, j + 1, k + 0.5F, 0, 0.065F, 0); - } - } - if (cooled != null && !world.isRemote) - { - if(world.isAirBlock(i, j+1, k)) - { - EntityItem entity = new EntityItem(world, i+0.5, j+1, k+0.5, cooled); - entity.delayBeforeCanPickup = 20; - entity.motionX = entity.motionY = entity.motionZ = 0F; - world.spawnEntityInWorld(entity); - } - else - { - player.entityDropItem(cooled, 0); - } - } - - return TongsHelper.clearHeldItem(item, player); - } - } - - return item; - } - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; - } - - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemTongs setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/tool/"+s+"/"+name); - isCustom = true; - return this; - } - public ItemTongs setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; + + @Override + public ToolMaterial getMaterial() { + return toolMaterial; } - - - private float efficiencyMod = 1.0F; - public ItemTongs setEfficiencyMod(float efficiencyMod) - { - this.efficiencyMod = efficiencyMod; - return this; + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + + if (movingobjectposition == null) { + return item; + } else { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + if (!world.canMineBlock(player, i, j, k)) { + return item; + } + + if (!player.canPlayerEdit(i, j, k, movingobjectposition.sideHit, item)) { + return item; + } + + float water = TongsHelper.getWaterSource(world, i, j, k); + + if (TongsHelper.getHeldItem(item) != null && water >= 0) { + ItemStack drop = TongsHelper.getHeldItem(item).copy(), cooled = drop; + + if (TongsHelper.isCoolableItem(drop)) { + cooled = Heatable.getQuenchedItem(drop, water); + cooled.stackSize = drop.stackSize; + + player.playSound("random.splash", 1F, 1F); + player.playSound("random.fizz", 2F, 0.5F); + + for (int a = 0; a < 5; a++) { + world.spawnParticle("largesmoke", i + 0.5F, j + 1, k + 0.5F, 0, 0.065F, 0); + } + } + if (cooled != null && !world.isRemote) { + if (world.isAirBlock(i, j + 1, k)) { + EntityItem entity = new EntityItem(world, i + 0.5, j + 1, k + 0.5, cooled); + entity.delayBeforeCanPickup = 20; + entity.motionX = entity.motionY = entity.motionZ = 0F; + world.spawnEntityInWorld(entity); + } else { + player.entityDropItem(cooled, 0); + } + } + + return TongsHelper.clearHeldItem(item, player); + } + } + + return item; + } } - - @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); - - return map; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, 1.0F); - } - private IIcon detailTex = null; + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - } - super.registerIcons(reg); + public boolean requiresMultipleRenderPasses() { + return true; } - + + public ItemTongs setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/tool/" + s + "/" + name); + isCustom = true; + return this; + } + + public ItemTongs setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + public ItemTongs setEfficiencyMod(float efficiencyMod) { + this.efficiencyMod = efficiencyMod; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + + return map; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, toolMaterial.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, 1.0F); + } + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - ItemStack item = TongsHelper.getHeldItem(stack); - boolean hasHeld = item != null; - int baseLayer = hasHeld ? 1 : 0; - - if (hasHeld && pass == 0) - { - return item.getItem().getIcon(item, pass); - } - if(!isCustom || pass == baseLayer && detailTex != null) - { - return super.getIcon(stack, pass); - } + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + if (isCustom) { + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + } + super.registerIcons(reg); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + ItemStack item = TongsHelper.getHeldItem(stack); + boolean hasHeld = item != null; + int baseLayer = hasHeld ? 1 : 0; + + if (hasHeld && pass == 0) { + return item.getItem().getIcon(item, pass); + } + if (!isCustom || pass == baseLayer && detailTex != null) { + return super.getIcon(stack, pass); + } return detailTex != null ? detailTex : super.getIcon(stack, pass); } + /* + * @Override + * + * @SideOnly(Side.CLIENT) public IIcon getIcon(ItemStack stack, int renderPass) + * { ItemStack item = TongsHelper.getHeldItem(stack); + * + * if (renderPass == 0 && item != null) { return item.getItem().getIcon(item, + * renderPass); } return itemIcon; } + */ + @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - /*@Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack stack, int renderPass) - { - ItemStack item = TongsHelper.getHeldItem(stack); - - if (renderPass == 0 && item != null) { - return item.getItem().getIcon(item, renderPass); - } - return itemIcon; - } - */ - + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - ItemStack held = TongsHelper.getHeldItem(item); - boolean hasHeld = held != null; - int baseLayer = hasHeld ? 1 : 0; - if (hasHeld) //Bottom Layer - { - if( layer == 0) - { - return held.getItem().getColorFromItemStack(held, 0); - } - return CustomToolHelper.getColourFromItemStack(item, layer-1, super.getColorFromItemStack(item, layer)); - } - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + public int getColorFromItemStack(ItemStack item, int layer) { + ItemStack held = TongsHelper.getHeldItem(item); + boolean hasHeld = held != null; + int baseLayer = hasHeld ? 1 : 0; + if (hasHeld) // Bottom Layer + { + if (layer == 0) { + return held.getItem().getColorFromItemStack(held, 0); + } + return CustomToolHelper.getColourFromItemStack(item, layer - 1, super.getColorFromItemStack(item, layer)); + } + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); } @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - - public ItemStack construct(String main) - { - return CustomToolHelper.construct(this, main, null); - } - protected int itemRarity; + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main) { + return CustomToolHelper.construct(this, main, null); + } + @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - if (!ForgeHooks.isToolEffective(stack, block, meta)) - { - return this.func_150893_a(stack, block); + public float getDigSpeed(ItemStack stack, Block block, int meta) { + if (!ForgeHooks.isToolEffective(stack, block, meta)) { + return this.func_150893_a(stack, block); } - return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); - } - public float func_150893_a(ItemStack stack, Block block) - { - float base = super.func_150893_a(stack, block); - return base <= 1.0F ? base : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + return CustomToolHelper.getEfficiency(stack, super.getDigSpeed(stack, block, meta), efficiencyMod); } + + public float func_150893_a(ItemStack stack, Block block) { + float base = super.func_150893_a(stack, block); + return base <= 1.0F ? base + : CustomToolHelper.getEfficiency(stack, this.efficiencyOnProperMaterial, efficiencyMod); + } + @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); + public int getHarvestLevel(ItemStack stack, String toolClass) { + return CustomToolHelper.getHarvestLevel(stack, super.getHarvestLevel(stack, toolClass)); } + @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name)); - } - } - } - else - { - super.getSubItems(item, tab, list); - } + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name)); + } + } + } else { + super.getSubItems(item, tab, list); + } } - + @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { - if(isCustom) - { - CustomToolHelper.addInformation(item, list); - }else{ - - ItemStack held = TongsHelper.getHeldItem(item); - if (held != null) { - list.add(""); - list.add(held.getItem().getItemStackDisplayName(held)); - held.getItem().addInformation(held, user, list, extra); - } + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { + if (isCustom) { + CustomToolHelper.addInformation(item, list); + } else { + + ItemStack held = TongsHelper.getHeldItem(item); + if (held != null) { + list.add(""); + list.add(held.getItem().getItemStackDisplayName(held)); + held.getItem().addInformation(held, user, list, extra); + } } - + super.addInformation(item, user, list, extra); } - + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); } - + @Override - public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase user) - { + public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase user) { return true; } - //====================================================== CUSTOM END ==============================================================\\ + // ====================================================== CUSTOM END + // ==============================================================\\ } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemBattleaxeMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemBattleaxeMF.java index aceea3eb..b2f004a7 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemBattleaxeMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemBattleaxeMF.java @@ -16,198 +16,178 @@ /** * @author Anonymous Productions */ -public class ItemBattleaxeMF extends ItemHeavyWeaponMF -{ - private float injuryChance = 0.05F; - /** - * A battleaxe is a heavy counterpart to the waraxe, it does more damage and knockback, can also parry easier - */ - public ItemBattleaxeMF(String name, ToolMaterial material, int rarity, float weight) - { - super(material, name, rarity, weight); +public class ItemBattleaxeMF extends ItemHeavyWeaponMF { + private float injuryChance = 0.05F; + + /** + * A battleaxe is a heavy counterpart to the waraxe, it does more damage and + * knockback, can also parry easier + */ + public ItemBattleaxeMF(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + public static void brutalise(EntityLivingBase entityHitting, EntityLivingBase entityHit, float power) { + if (!entityHit.worldObj.isRemote) { + if (entityHitting instanceof EntityPlayer) { + ((EntityPlayer) entityHitting).onCriticalHit(entityHit); + } + } } @Override - public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, boolean properHit) - { - float damage = super.modifyDamage(item, wielder, hit, initialDam, properHit); - if(!(hit instanceof EntityLivingBase)) - { - return damage; - } - EntityLivingBase target = (EntityLivingBase)hit; - - if(wielder.isSprinting()) - { - if(wielder.fallDistance > 0 && canLunge(wielder) && tryPerformAbility(wielder, lunge_cost, !properHit, true, true, true))//LUNGE: 20 Points - { - return chargeAt(wielder, target, true, damage, properHit); - } - else if(wielder.onGround && getHeightGap(target, wielder) <= 0.5F && tryPerformAbility(wielder, charge_cost))//CHARGE: 10 points - { - return chargeAt(wielder, target, false, damage, properHit); - } + public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, + boolean properHit) { + float damage = super.modifyDamage(item, wielder, hit, initialDam, properHit); + if (!(hit instanceof EntityLivingBase)) { + return damage; } - else if(wielder.fallDistance > 0 && !wielder.isOnLadder() && tryPerformAbility(wielder, jump_cost))//JUMP: 2 points + EntityLivingBase target = (EntityLivingBase) hit; + + if (wielder.isSprinting()) { + if (wielder.fallDistance > 0 && canLunge(wielder) + && tryPerformAbility(wielder, lunge_cost, !properHit, true, true, true))// LUNGE: 20 Points + { + return chargeAt(wielder, target, true, damage, properHit); + } else if (wielder.onGround && getHeightGap(target, wielder) <= 0.5F + && tryPerformAbility(wielder, charge_cost))// CHARGE: 10 points + { + return chargeAt(wielder, target, false, damage, properHit); + } + } else if (wielder.fallDistance > 0 && !wielder.isOnLadder() && tryPerformAbility(wielder, jump_cost))// JUMP: 2 + // points { - if(properHit) - brutalise(wielder, target, 1.0F); + if (properHit) + brutalise(wielder, target, 1.0F); return damage * 1.25F; } - return damage; - } - - private float chargeAt(EntityLivingBase entityHitting, EntityLivingBase entityHit, boolean lunge, float dam, boolean properHit) - { - if(properHit) - brutalise(entityHitting, entityHit, 1.0F); - - if(lunge) - { - float fallBonus = (Math.min(entityHitting.fallDistance, getMeleeDamage(entityHitting.getHeldItem())))/2F; - if(entityHit.onGround && !properHit) - { - entityHitting.hurtResistantTime = 20; - TacticalManager.knockbackEntity(entityHit, entityHitting, 4F, 0.5F); - TacticalManager.lungeEntity(entityHitting, entityHit, 2F, 0.1F); - } - if(properHit) - { - if(!entityHit.isPotionActive(Potion.moveSlowdown.id)) - { - entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 400, 3)); - entityHit.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 1)); - } - - entityHitting.fallDistance -= fallBonus; - } - if(fallBonus > 0) - { - dam += fallBonus; - } - } - else - { - if(properHit) - { - if(entityHitting.onGround && entityHit.onGround && !properHit) - { - entityHitting.hurtResistantTime = 20; - TacticalManager.lungeEntity(entityHitting, entityHit, 1F, 0.0F); - } - if(properHit) - { - if(!entityHit.isPotionActive(Potion.moveSlowdown.id)) - { - entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 3)); - entityHit.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0)); - } - } - } - } - return dam *1.25F; - } + return damage; + } + + private float chargeAt(EntityLivingBase entityHitting, EntityLivingBase entityHit, boolean lunge, float dam, + boolean properHit) { + if (properHit) + brutalise(entityHitting, entityHit, 1.0F); + + if (lunge) { + float fallBonus = (Math.min(entityHitting.fallDistance, getMeleeDamage(entityHitting.getHeldItem()))) / 2F; + if (entityHit.onGround && !properHit) { + entityHitting.hurtResistantTime = 20; + TacticalManager.knockbackEntity(entityHit, entityHitting, 4F, 0.5F); + TacticalManager.lungeEntity(entityHitting, entityHit, 2F, 0.1F); + } + if (properHit) { + if (!entityHit.isPotionActive(Potion.moveSlowdown.id)) { + entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 400, 3)); + entityHit.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 1)); + } + + entityHitting.fallDistance -= fallBonus; + } + if (fallBonus > 0) { + dam += fallBonus; + } + } else { + if (properHit) { + if (entityHitting.onGround && entityHit.onGround && !properHit) { + entityHitting.hurtResistantTime = 20; + TacticalManager.lungeEntity(entityHitting, entityHit, 1F, 0.0F); + } + if (properHit) { + if (!entityHit.isPotionActive(Potion.moveSlowdown.id)) { + entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 3)); + entityHit.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0)); + } + } + } + } + return dam * 1.25F; + } + + @Override + public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) { + if (rand.nextFloat() < injuryChance) { + hit.getEntityData().setInteger(EventManagerMF.injuredNBT, 300 + rand.nextInt(1000)); + } + super.onProperHit(user, weapon, hit, dam); + } + + /** + * Determines if sprint-jump lunges work + */ + private boolean canLunge(EntityLivingBase entityHitting) { + return true; + } + + private double getHeightGap(EntityLivingBase entityHit, EntityLivingBase entityHitting) { + double a = entityHitting.posY - entityHit.posY; + return Math.max(a, -a); + } + + @Override + public float getDigSpeed(ItemStack itemstack, Block block, int metadata) { + if (Items.iron_axe.getDigSpeed(itemstack, block, metadata) > 2.0F) { + return material.getEfficiencyOnProperMaterial() * 0.75F; + } + return super.getDigSpeed(itemstack, block, metadata); + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.75F); + return true; + } + @Override - public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) - { - if(rand.nextFloat() < injuryChance) - { - hit.getEntityData().setInteger(EventManagerMF.injuredNBT, 300 + rand.nextInt(1000)); - } - super.onProperHit(user, weapon, hit, dam); - } - /** - * Determines if sprint-jump lunges work - */ - private boolean canLunge(EntityLivingBase entityHitting) - { - return true; - } - - private double getHeightGap(EntityLivingBase entityHit, EntityLivingBase entityHitting) - { - double a = entityHitting.posY - entityHit.posY; - return Math.max(a, -a); - } - @Override - public float getDigSpeed(ItemStack itemstack, Block block, int metadata) - { - if(Items.iron_axe.getDigSpeed(itemstack, block, metadata) > 2.0F) - { - return material.getEfficiencyOnProperMaterial()*0.75F; - } - return super.getDigSpeed(itemstack, block, metadata); - } - - public static void brutalise(EntityLivingBase entityHitting, EntityLivingBase entityHit, float power) - { - if(!entityHit.worldObj.isRemote) - { - if(entityHitting instanceof EntityPlayer) - { - ((EntityPlayer)entityHitting).onCriticalHit(entityHit); - } - } - } - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.75F); - return true; - } - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModAxe; - } - @Override - public float getDamageModifier() - { - return damageModAxe; - } - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return hvyHackingDamage; - } - @Override - public float getPenetrationLevel(Object implement) - { - return axeAPModifier; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return axeParryTime + heavyParryTime; - } - - @Override - protected float getStaminaMod() - { - return heavyStaminaCost*axeStaminaCost; - } - - @Override - public WeaponClass getWeaponClass() - { - return WeaponClass.AXE; - } - @Override - public boolean canCounter() - { - return true; - } - @Override - public float[] getCounterRatio() - { - return crushingDamage; - } - @Override - public float getCounterDamage() - { - return 0.5F; - } + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModAxe; + } + + @Override + public float getDamageModifier() { + return damageModAxe; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return hvyHackingDamage; + } + + @Override + public float getPenetrationLevel(Object implement) { + return axeAPModifier; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return axeParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return heavyStaminaCost * axeStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.AXE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return crushingDamage; + } + + @Override + public float getCounterDamage() { + return 0.5F; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemClaymoreMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemClaymoreMF.java new file mode 100644 index 00000000..a629c880 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemClaymoreMF.java @@ -0,0 +1,128 @@ +package minefantasy.mf2.item.weapon; + +import java.util.Random; + +import minefantasy.mf2.api.weapon.WeaponClass; +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public class ItemClaymoreMF extends ItemClaymoreStats implements IExtendedReachWeapon { + private Random rand = new Random(); + + public ItemClaymoreMF(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + public boolean canWeaponEvade() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 2; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(EntityLivingBase user) { + return 20; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.5F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return user instanceof EntityPlayer ? 3.0F : 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 0.75F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getBalance() { + return 1.0F; + } + + @Override + protected boolean canAnyMobParry() { + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModClaymore; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return claymoreParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return claymoreStaminaCost * swordStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return claymoreSlashingDamage; + } + + @Override + public float getCounterDamage() { + return 1.0F; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 2.5F; + } + } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemClaymoreStats.java b/src/main/java/minefantasy/mf2/item/weapon/ItemClaymoreStats.java new file mode 100644 index 00000000..bb92b751 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemClaymoreStats.java @@ -0,0 +1,124 @@ +package minefantasy.mf2.item.weapon; + +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public abstract class ItemClaymoreStats extends ItemWeaponMF implements IExtendedReachWeapon { + + /** + * Heavy weapons are larger varients of their own counterparts(sword, waraxe, + * mace and spear). These have 2x the durability, have a wider parry arc, and do + * 50% more damage. + *

+ * Heavy weapons weigh more and throw you off balance when used. + */ + public ItemClaymoreStats(ToolMaterial material, String named, int rarity, float weight) { + super(material, named, rarity, weight); + setMaxDamage((int) (getMaxDamage() * 1.75F)); + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public boolean isHeavyWeapon() { + return true; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return true; + } + + public int getParryCooldown(EntityLivingBase user) { + return 18; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.0F; + } + + @Override + public float getBalance() { + return 0.75F; + } + + @Override + protected float getKnockbackStrength() { + return 1.8F; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 1.10F; + } + + @Override + protected boolean canAnyMobParry() { + return false; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModClaymore; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return claymoreSlashingDamage; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return claymoreParryFatigue; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return claymoreParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 50; + } + + @Override + protected float getStaminaMod() { + return claymoreStaminaCost; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 3.0F; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 1.75F; + } + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } +} + diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemDagger.java b/src/main/java/minefantasy/mf2/item/weapon/ItemDagger.java index 87fb317b..4acecae8 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemDagger.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemDagger.java @@ -1,140 +1,129 @@ package minefantasy.mf2.item.weapon; -import java.util.Random; - -import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.api.weapon.WeaponClass; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; +import java.util.Random; + /** * @author Anonymous Productions */ -public class ItemDagger extends ItemWeaponMF -{ - private Random rand = new Random(); - /** - * Daggers are fast and weak weapons, but are fast and light - * - * These are for the fast player - */ - public ItemDagger(String name, ToolMaterial material, int rarity, float weight) - { - super(material, name, rarity, weight); - } - - @Override - public boolean canBlock() - { - return true; - } - - /** - * Determines if the weapon can parry - */ - @Override - public boolean canWeaponParry() - { - return true; - } - - @Override - protected int getParryDamage(float dam) - { - return 2; - } - /** - * Gets the angle the weapon can parry - */ - @Override - public float getParryAngleModifier(EntityLivingBase user) - { - return 0.75F; - } - /** - * Gets the multiplier for the parry threshold - * @return - */ - @Override - public float getParryDamageModifier(EntityLivingBase user) - { - return 0.5F; - } - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 1.65F + (rand.nextFloat()*0.5F)); - return true; - } - - @Override - public float getDecayModifier(EntityLivingBase user, ItemStack item) - { - return 0.5F; - } - - @Override - public float getRegenModifier(EntityLivingBase user, ItemStack item) - { - return user.worldObj.difficultySetting.getDifficultyId() < 3 ? 1.5F : 1.0F; - } - - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - if(!StaminaBar.isSystemActive || StaminaBar.isAnyStamina(user, false)) - { - return speedModKatana; - } - return 0; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return daggerParryTime; - } - @Override - protected float getStaminaMod() - { - return daggerStaminaCost; - } - @Override - public WeaponClass getWeaponClass() - { - return WeaponClass.BLADE; - } - - @Override - public boolean canCounter() - { - return true; - } - @Override - public float[] getCounterRatio() - { - return piercingDamage; - } - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return piercingDamage; - } - @Override - public float getCounterDamage() - { - return 1.5F; - } - - @Override - protected float getMeleeDamage(ItemStack item) - { - return super.getMeleeDamage(item) /2; - } +public class ItemDagger extends ItemWeaponMF { + private Random rand = new Random(); + + /** + * Daggers are fast and weak weapons, but are fast and light + *

+ * These are for the fast player + */ + public ItemDagger(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 2; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 0.75F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return 0.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 1.65F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 0.5F; + } + + @Override + public float getRegenModifier(EntityLivingBase user, ItemStack item) { + return user.worldObj.difficultySetting.getDifficultyId() < 3 ? 1.5F : 1.0F; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + if (!StaminaBar.isSystemActive || StaminaBar.isAnyStamina(user, false)) { + return speedModKatana; + } + return 0; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return daggerParryTime; + } + + @Override + protected float getStaminaMod() { + return daggerStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return piercingDamage; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return piercingDamage; + } + + @Override + public float getCounterDamage() { + return 1.5F; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) / 2; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemGladius.java b/src/main/java/minefantasy/mf2/item/weapon/ItemGladius.java new file mode 100644 index 00000000..15edc939 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemGladius.java @@ -0,0 +1,132 @@ +package minefantasy.mf2.item.weapon; + +import java.util.Random; + +import minefantasy.mf2.api.weapon.WeaponClass; +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public class ItemGladius extends ItemGladiusStats implements IExtendedReachWeapon { + private Random rand = new Random(); + + /** + * Greatswords are heavy counterparts to swords, with added damage, knockback + * and parrying arc +0 */ + public ItemGladius(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + public boolean canWeaponEvade() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 1; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(EntityLivingBase user) { + return 12; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.5F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return user instanceof EntityPlayer ? 3.0F : 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 0.75F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getBalance() { + return 0.5F; + } + + @Override + protected boolean canAnyMobParry() { + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSword; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return swordParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return gladiusStaminacost * swordStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return slashingDamage; + } + + @Override + public float getCounterDamage() { + return 0.5F; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return -0.5F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemGladiusStats.java b/src/main/java/minefantasy/mf2/item/weapon/ItemGladiusStats.java new file mode 100644 index 00000000..f1505e39 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemGladiusStats.java @@ -0,0 +1,110 @@ +package minefantasy.mf2.item.weapon; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public abstract class ItemGladiusStats extends ItemWeaponMF { + + public ItemGladiusStats(ToolMaterial material, String named, int rarity, float weight) { + super(material, named, rarity, weight); + setMaxDamage((int) (getMaxDamage() * 1.0F)); + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public boolean isHeavyWeapon() { + return false; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return true; + } + + public int getParryCooldown(EntityLivingBase user) { + return 18; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.0F; + } + + @Override + public float getBalance() { + return 0.75F; + } + + @Override + protected float getKnockbackStrength() { + return 0.0F; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 1.25F; + } + + @Override + protected boolean canAnyMobParry() { + return false; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModGladius; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return slashingDamage; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return heavyParryFatigue; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return daggerParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 50; + } + + @Override + protected float getStaminaMod() { + return gladiusStaminacost; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 0.8F; + } + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemGreatswordMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemGreatswordMF.java index d68ba2e0..91052351 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemGreatswordMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemGreatswordMF.java @@ -1,7 +1,5 @@ package minefantasy.mf2.item.weapon; -import java.util.Random; - import minefantasy.mf2.api.weapon.WeaponClass; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -9,127 +7,122 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; +import java.util.Random; + /** * @author Anonymous Productions */ -public class ItemGreatswordMF extends ItemHeavyWeaponMF -{ - private Random rand = new Random(); - /** - * Greatswords are heavy counterparts to swords, with added damage, knockback and parrying arc - */ - public ItemGreatswordMF(String name, ToolMaterial material, int rarity, float weight) - { - super(material, name, rarity, weight); - } - - @Override - public boolean canBlock() - { - return true; - } - - /** - * Determines if the weapon can parry - */ - @Override - public boolean canWeaponParry() - { - return true; - } - - @Override - public boolean canWeaponEvade() - { - return true; - } - - @Override - protected int getParryDamage(float dam) - { - return 1; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(EntityLivingBase user) - { - return 12; - } - /** - * Gets the angle the weapon can parry - */ - @Override - public float getParryAngleModifier(EntityLivingBase user) - { - return 1.5F; - } - /** - * Gets the multiplier for the parry threshold - * @return - */ - @Override - public float getParryDamageModifier(EntityLivingBase user) - { - return user instanceof EntityPlayer ? 3.0F : 1.5F; - } - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 0.75F + (rand.nextFloat()*0.5F)); - return true; - } - - @Override - public float getBalance() - { - return 0.5F; - } - @Override - protected boolean canAnyMobParry() - { - return true; - } - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModSword; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return swordParryTime + heavyParryTime; - } - - @Override - protected float getStaminaMod() - { - return heavyStaminaCost*swordStaminaCost; - } - - @Override - public WeaponClass getWeaponClass() - { - return WeaponClass.BLADE; - } - - @Override - public boolean canCounter() - { - return true; - } - @Override - public float[] getCounterRatio() - { - return crushingDamage; - } - @Override - public float getCounterDamage() - { - return 0.5F; - } +public class ItemGreatswordMF extends ItemHeavyWeaponMF { + private Random rand = new Random(); + + /** + * Greatswords are heavy counterparts to swords, with added damage, knockback + * and parrying arc + */ + public ItemGreatswordMF(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + public boolean canWeaponEvade() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 1; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(EntityLivingBase user) { + return 12; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.5F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return user instanceof EntityPlayer ? 3.0F : 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 0.75F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getBalance() { + return 0.5F; + } + + @Override + protected boolean canAnyMobParry() { + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSword; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return swordParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return heavyStaminaCost * swordStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return crushingDamage; + } + + @Override + public float getCounterDamage() { + return 0.5F; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemHalbeardMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemHalbeardMF.java index 84e08b1e..da721db0 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemHalbeardMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemHalbeardMF.java @@ -8,104 +8,96 @@ /** * @author Anonymous Productions */ -public class ItemHalbeardMF extends ItemSpearMF -{ - /** - * The halbeard is the heavy counterpart for the spear: It has increased damage, knockback distance and parry arc - * - * Halbeards use a swinging attack rather than a stab, but will still stab when sprinting - */ - public ItemHalbeardMF(String name, ToolMaterial material, int rarity, float weight) - { - super(name, material, rarity, weight); - setMaxDamage(getMaxDamage()*2); +public class ItemHalbeardMF extends ItemSpearMF { + /** + * The halbeard is the heavy counterpart for the spear: It has increased damage, + * knockback distance and parry arc + *

+ * Halbeards use a swinging attack rather than a stab, but will still stab when + * sprinting + */ + public ItemHalbeardMF(String name, ToolMaterial material, int rarity, float weight) { + super(name, material, rarity, weight); + setMaxDamage(getMaxDamage() * 2); } @Override - public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) - { - return false; - } - - @Override - public float getReachModifierInBlocks(ItemStack stack) - { - return 3.0F; - } - - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.7F); - return true; - } - - @Override - protected int getParryDamage(float dam) - { - return (int)dam; - } - /** - * Gets the angle the weapon can parry - */ - @Override - public float getParryAngleModifier(EntityLivingBase user) - { - return user.isSneaking() ? 1.5F: 1.0F; - } - @Override - public float getBalance() - { - return 0.8F; - } - - @Override - protected float getKnockbackStrength() - { - return 3.5F; - } - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModSpear; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return spearParryTime + heavyParryTime; - } - - @Override - protected float getStaminaMod() - { - return heavyStaminaCost*spearStaminaCost; - } - @Override - protected float[] getWeaponRatio(ItemStack implement, EntityLivingBase user) - { - if(user.isSprinting()) - { - return piercingDamage; - } - return getWeaponRatio(implement); - } - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return hvyHackingDamage; - } - - @Override - protected float getMeleeDamage(ItemStack item) - { - return super.getMeleeDamage(item)*1.5F; - } - @Override - public float getScale(ItemStack itemstack) - { - return 3.0F; - } + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return false; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 3.0F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.7F); + return true; + } + + @Override + protected int getParryDamage(float dam) { + return (int) dam; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return user.isSneaking() ? 1.5F : 1.0F; + } + + @Override + public float getBalance() { + return 0.8F; + } + + @Override + protected float getKnockbackStrength() { + return 3.5F; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSpear; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return spearParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return heavyStaminaCost * spearStaminaCost; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement, EntityLivingBase user) { + if (user.isSprinting()) { + return piercingDamage; + } + return getWeaponRatio(implement); + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return hvyHackingDamage; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 1.5F; + } + + @Override + public float getScale(ItemStack itemstack) { + return 3.0F; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemHeavyWeaponMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemHeavyWeaponMF.java index 8adf652d..be01ac42 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemHeavyWeaponMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemHeavyWeaponMF.java @@ -6,130 +6,117 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -public abstract class ItemHeavyWeaponMF extends ItemWeaponMF implements IExtendedReachWeapon -{ - - /** - * Heavy weapons are larger varients of their own counterparts(sword, waraxe, mace and spear). - * These have 2x the durability, have a wider parry arc, and do 50% more damage. - * - * Heavy weapons weigh more and throw you off balance when used. - */ - public ItemHeavyWeaponMF(ToolMaterial material, String named, int rarity, float weight) - { - super(material, named, rarity, weight); - setMaxDamage((int) (getMaxDamage()*1.5F)); - } - - @Override - public boolean sheatheOnBack(ItemStack item) - { - return true; - } - - @Override - public boolean isHeavyWeapon() - { - return true; - } - @Override - public boolean isOffhandHandDual(ItemStack off) - { - return false; - } - - @Override - public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) - { - return false; - } - public int getParryCooldown(EntityLivingBase user) - { - return 18; - } - /** - * Gets the angle the weapon can parry - */ - @Override - public float getParryAngleModifier(EntityLivingBase user) - { - return 1.0F; - } - - @Override - public float getBalance() - { - return 0.75F; - } - - @Override - protected float getKnockbackStrength() - { - return 1.5F; - } - - @Override - public float getDecayModifier(EntityLivingBase user, ItemStack item) - { - return 1.25F; - } - - @Override - protected boolean canAnyMobParry() - { - return false; - } - - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModHeavy; - } - - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return hvySlashingDamage; - } - @Override - public float getParryStaminaDecay(DamageSource source, ItemStack weapon) - { - return heavyParryFatigue; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return heavyParryTime; - } - @Override - public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) - { - return 50; - } - @Override - protected float getStaminaMod() - { - return heavyStaminaCost; - } - - @Override - public float getReachModifierInBlocks(ItemStack stack) - { - return 2.0F; - } - - @Override - protected float getMeleeDamage(ItemStack item) - { - return super.getMeleeDamage(item)*1.5F; - } - - @Override - public float getScale(ItemStack itemstack) - { - return 2.0F; - } +public abstract class ItemHeavyWeaponMF extends ItemWeaponMF implements IExtendedReachWeapon { + + /** + * Heavy weapons are larger varients of their own counterparts(sword, waraxe, + * mace and spear). These have 2x the durability, have a wider parry arc, and do + * 50% more damage. + *

+ * Heavy weapons weigh more and throw you off balance when used. + */ + public ItemHeavyWeaponMF(ToolMaterial material, String named, int rarity, float weight) { + super(material, named, rarity, weight); + setMaxDamage((int) (getMaxDamage() * 1.5F)); + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public boolean isHeavyWeapon() { + return true; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return false; + } + + public int getParryCooldown(EntityLivingBase user) { + return 18; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.0F; + } + + @Override + public float getBalance() { + return 0.75F; + } + + @Override + protected float getKnockbackStrength() { + return 1.5F; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 1.25F; + } + + @Override + protected boolean canAnyMobParry() { + return false; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModHeavy; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return hvySlashingDamage; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return heavyParryFatigue; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return heavyParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 50; + } + + @Override + protected float getStaminaMod() { + return heavyStaminaCost; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 2.0F; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 1.5F; + } + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemKatanaMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemKatanaMF.java index 707b96a8..8b238398 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemKatanaMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemKatanaMF.java @@ -1,7 +1,5 @@ package minefantasy.mf2.item.weapon; -import java.util.Random; - import minefantasy.mf2.api.helpers.ArmourCalculator; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.api.weapon.WeaponClass; @@ -11,166 +9,158 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; +import java.util.Random; + /** * @author Anonymous Productions */ -public class ItemKatanaMF extends ItemHeavyWeaponMF -{ - private Random rand = new Random(); - /** - * Katanas are heavy counterparts to Tantos, unlike most heavy weapons: these act more like light-weapons - */ - public ItemKatanaMF(String name, ToolMaterial material, int rarity, float weight) - { - super(material, name, rarity, weight); - } - - @Override - public boolean canBlock() - { - return true; - } - - @Override - public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) - { - return true; - } - /** - * Determines if the weapon can parry - */ - @Override - public boolean canWeaponParry() - { - return true; - } - - @Override - protected int getParryDamage(float dam) - { - return 1; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(EntityLivingBase user) - { - return 8; - } - /** - * Gets the angle the weapon can parry - */ - @Override - public float getParryAngleModifier(EntityLivingBase user) - { - return 1.0F; - } - /** - * Gets the multiplier for the parry threshold - * @return - */ - @Override - public float getParryDamageModifier(EntityLivingBase user) - { - return 1.5F; - } - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 1.15F + (rand.nextFloat()*0.5F)); - return true; - } - - @Override - public float getBalance() - { - return 0.0F; - } - @Override - public float getDecayModifier(EntityLivingBase user, ItemStack item) - { - return 0.75F; - } - - @Override - public float getRegenModifier(EntityLivingBase user, ItemStack item) - { - return user.worldObj.difficultySetting.getDifficultyId() < 3 ? 1.25F : 1.0F; - } - - @Override - public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) - { - if(user.motionY < 0 && !user.onGround && (!(user instanceof EntityPlayer) || user.isSneaking()) && tryPerformAbility(user, cleave_cost)) - { - hurtInRange(user, 4D); - if(hit instanceof EntityLivingBase) - { - ArmourCalculator.damageArmour((EntityLivingBase)hit, (int)(dam*10)); - } - user.setSneaking(false); - } - super.onProperHit(user, weapon, hit, dam); - } - - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - if(!StaminaBar.isSystemActive || StaminaBar.isAnyStamina(user, false)) - { - return speedModKatana; - } - return speedModHeavy/2; - } - @Override - public float getParryStaminaDecay(DamageSource source, ItemStack weapon) - { - return 1.0F; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return swordParryTime; - } - @Override - protected float getStaminaMod() - { - return katanaStaminaCost; - } - @Override - public WeaponClass getWeaponClass() - { - return WeaponClass.BLADE; - } - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return slashingDamage; - } - - @Override - public boolean canCounter() - { - return true; - } - @Override - public float[] getCounterRatio() - { - return piercingDamage; - } - @Override - public float getCounterDamage() - { - return 1.5F; - } - - @Override - protected float getMeleeDamage(ItemStack item) - { - return super.getMeleeDamage(item)*0.5F; - } +public class ItemKatanaMF extends ItemHeavyWeaponMF { + private Random rand = new Random(); + + /** + * Katanas are heavy counterparts to Tantos, unlike most heavy weapons: these + * act more like light-weapons + */ + public ItemKatanaMF(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 1; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(EntityLivingBase user) { + return 8; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.0F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 1.15F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getBalance() { + return 0.0F; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 0.75F; + } + + @Override + public float getRegenModifier(EntityLivingBase user, ItemStack item) { + return user.worldObj.difficultySetting.getDifficultyId() < 3 ? 1.25F : 1.0F; + } + + @Override + public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) { + if (user.motionY < 0 && !user.onGround && (!(user instanceof EntityPlayer) || user.isSneaking()) + && tryPerformAbility(user, cleave_cost)) { + hurtInRange(user, 4D); + if (hit instanceof EntityLivingBase) { + ArmourCalculator.damageArmour((EntityLivingBase) hit, (int) (dam * 10)); + } + user.setSneaking(false); + } + super.onProperHit(user, weapon, hit, dam); + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + if (!StaminaBar.isSystemActive || StaminaBar.isAnyStamina(user, false)) { + return speedModKatana; + } + return speedModHeavy / 2; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return 1.0F; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return swordParryTime; + } + + @Override + protected float getStaminaMod() { + return katanaStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return slashingDamage; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return piercingDamage; + } + + @Override + public float getCounterDamage() { + return 1.5F; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 0.5F; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemLance.java b/src/main/java/minefantasy/mf2/item/weapon/ItemLance.java index e6fda7f2..970b0dbd 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemLance.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemLance.java @@ -1,7 +1,5 @@ package minefantasy.mf2.item.weapon; -import java.util.List; - import minefantasy.mf2.api.stamina.StaminaBar; import mods.battlegear2.api.shield.IShield; import net.minecraft.entity.Entity; @@ -11,127 +9,117 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import java.util.List; + /** * @author Anonymous Productions */ -public class ItemLance extends ItemSpearMF -{ - /** - */ - public ItemLance(String name, ToolMaterial material, int rarity, float weight) - { - super(name, material, rarity, weight); - setMaxDamage(getMaxDamage()*2); +public class ItemLance extends ItemSpearMF { + /** + */ + public ItemLance(String name, ToolMaterial material, int rarity, float weight) { + super(name, material, rarity, weight); + setMaxDamage(getMaxDamage() * 2); + } + + @Override + public void addInformation(ItemStack weapon, EntityPlayer user, List list, boolean extra) { + super.addInformation(weapon, user, list, extra); + + list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + 0, + decimal_format.format(getJoustDamage(weapon)), + StatCollector.translateToLocal("attribute.weapon.joustDam"))); + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return offhand == null || offhand.getItem() instanceof IShield; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 3.0F; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return hvyPiercingDamage; + } + + @Override + public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, + boolean properHit) { + float dam = super.modifyDamage(item, wielder, hit, initialDam, properHit); + if (hit instanceof EntityLivingBase) { + return joust((EntityLivingBase) hit, wielder, dam); + } + return dam; + } + + @Override + public boolean canWeaponParry() { + return false; } - + + // Higher stamina means more precice hits: Full stamina hits are perfect + @Override + public float getBalance(EntityLivingBase user) { + if (StaminaBar.isSystemActive) { + return 0.0F + (2 * (1 - StaminaBar.getStaminaDecimal(user))); + } + return 0.0F; + } + + @Override + protected float getKnockbackStrength() { + return 5.0F; + } + @Override - public void addInformation(ItemStack weapon, EntityPlayer user, List list, boolean extra) - { - super.addInformation(weapon, user, list, extra); - - list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus."+ 0, decimal_format.format(getJoustDamage(weapon)), StatCollector.translateToLocal("attribute.weapon.joustDam"))); + protected float getStaminaMod() { + return 5.0F; } @Override - public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) - { - return offhand==null || offhand.getItem() instanceof IShield; - } - - @Override - public float getReachModifierInBlocks(ItemStack stack) - { - return 3.0F; - } - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return hvyPiercingDamage; - } - - @Override - public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, boolean properHit) - { - float dam = super.modifyDamage(item, wielder, hit, initialDam, properHit); - if(hit instanceof EntityLivingBase) - { - return joust((EntityLivingBase)hit, wielder, dam); - } - return dam; - } - - @Override - public boolean canWeaponParry() - { - return false; - } - //Higher stamina means more precice hits: Full stamina hits are perfect - @Override - public float getBalance(EntityLivingBase user) - { - if(StaminaBar.isSystemActive) - { - return 0.0F + (2*(1-StaminaBar.getStaminaDecimal(user))); - } - return 0.0F; - } - - @Override - protected float getKnockbackStrength() - { - return 5.0F; - } - @Override - protected float getStaminaMod() - { - return 5.0F; - } - @Override - public boolean canBlock() - { - return false; - } - - public float joust(EntityLivingBase target, EntityLivingBase attacker, float dam) - { - float speedMod = 20F; - float speedCap = 5F; - - if(attacker.isRiding()) - { - Entity mount = attacker.ridingEntity; - float speed = (float)Math.hypot(mount.motionX, mount.motionZ) * speedMod; - if(speed > speedCap)speed = speedCap; - - dam += getJoustDamage(target.getHeldItem()) / speedCap * speed; - - if(attacker instanceof EntityPlayer) - { - ((EntityPlayer) attacker).onCriticalHit(target); + public boolean canBlock() { + return false; + } + + public float joust(EntityLivingBase target, EntityLivingBase attacker, float dam) { + float speedMod = 20F; + float speedCap = 5F; + + if (attacker.isRiding()) { + Entity mount = attacker.ridingEntity; + float speed = (float) Math.hypot(mount.motionX, mount.motionZ) * speedMod; + if (speed > speedCap) + speed = speedCap; + + dam += getJoustDamage(target.getHeldItem()) / speedCap * speed; + + if (attacker instanceof EntityPlayer) { + ((EntityPlayer) attacker).onCriticalHit(target); } - - if(target.isRiding() && speed > (speedCap/2F)) - { - target.dismountEntity(target.ridingEntity); - target.mountEntity(null); - } - } - return dam; - } - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModSpear*2; - } - - @Override - protected float getMeleeDamage(ItemStack item) - { - return 2F; - } - - protected float getJoustDamage(ItemStack item) - { - return super.getMeleeDamage(item)*2.5F; - } + + if (target.isRiding() && speed > (speedCap / 2F)) { + target.dismountEntity(target.ridingEntity); + target.mountEntity(null); + } + } + return dam; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSpear * 2; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return 2F; + } + + protected float getJoustDamage(ItemStack item) { + return super.getMeleeDamage(item) * 2.5F; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemLongswordMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemLongswordMF.java new file mode 100644 index 00000000..bc706dc8 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemLongswordMF.java @@ -0,0 +1,126 @@ +package minefantasy.mf2.item.weapon; + +import java.util.Random; + +import minefantasy.mf2.api.weapon.WeaponClass; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public class ItemLongswordMF extends ItemLongswordStats { + private Random rand = new Random(); + + /** + * Greatswords are heavy counterparts to swords, with added damage, knockback + * and parrying arc + */ + public ItemLongswordMF(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + public boolean canWeaponEvade() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 1; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(EntityLivingBase user) { + return 12; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.5F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return user instanceof EntityPlayer ? 3.0F : 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 0.75F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getBalance() { + return 0.5F; + } + + @Override + protected boolean canAnyMobParry() { + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSword; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return swordParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return heavyStaminaCost * swordStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return lsSlashingDamage; + } + + @Override + public float getCounterDamage() { + return 0.5F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemLongswordStats.java b/src/main/java/minefantasy/mf2/item/weapon/ItemLongswordStats.java new file mode 100644 index 00000000..53d2286f --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemLongswordStats.java @@ -0,0 +1,123 @@ +package minefantasy.mf2.item.weapon; + +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public abstract class ItemLongswordStats extends ItemWeaponMF implements IExtendedReachWeapon { + + /** + * Heavy weapons are larger varients of their own counterparts(sword, waraxe, + * mace and spear). These have 2x the durability, have a wider parry arc, and do + * 50% more damage. + *

+ * Heavy weapons weigh more and throw you off balance when used. + */ + public ItemLongswordStats(ToolMaterial material, String named, int rarity, float weight) { + super(material, named, rarity, weight); + setMaxDamage((int) (getMaxDamage() * 1.25F)); + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public boolean isHeavyWeapon() { + return true; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return true; + } + + public int getParryCooldown(EntityLivingBase user) { + return 18; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.0F; + } + + @Override + public float getBalance() { + return 0.75F; + } + + @Override + protected float getKnockbackStrength() { + return 0.5F; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 1.10F; + } + + @Override + protected boolean canAnyMobParry() { + return false; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModLongsword; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return lsSlashingDamage; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return heavyParryFatigue; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return heavyParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 50; + } + + @Override + protected float getStaminaMod() { + return longswordStaminaCost; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 1.0F; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 1.25F; + } + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemMaceMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemMaceMF.java index 2559f8c8..9c07e471 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemMaceMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemMaceMF.java @@ -12,101 +12,90 @@ /** * @author Anonymous Productions */ -public class ItemMaceMF extends ItemWeaponMF -{ - private float stunChance = 0.20F; - /** - * The mace does the most damage - * Maces also have more durability - * - * These are for the player who just wants to hit stuff - */ - public ItemMaceMF(String name, ToolMaterial material, int rarity, float weight) - { +public class ItemMaceMF extends ItemWeaponMF { + private float stunChance = 0.20F; + + /** + * The mace does the most damage Maces also have more durability + *

+ * These are for the player who just wants to hit stuff + */ + public ItemMaceMF(String name, ToolMaterial material, int rarity, float weight) { super(material, name, rarity, weight); - this.setMaxDamage((int) (getMaxDamage()*2F)); + this.setMaxDamage((int) (getMaxDamage() * 2F)); + } + + @Override + protected int getParryDamage(float dam) { + return (int) (dam * 2F); + } + + @Override + public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) { + if (!user.worldObj.isRemote && user.getRNG().nextInt(5) == 0) { + if (hit instanceof EntityLivingBase) { + ((EntityLivingBase) hit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1)); + } + } + super.onProperHit(user, weapon, hit, dam); + } + + @Override + public float getDigSpeed(ItemStack itemstack, Block block, int metadata) { + return super.getDigSpeed(itemstack, block, metadata) * 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 1.0F); + return true; + } + + @Override + protected float getKnockbackStrength() { + return 1.5F; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModMace; } - @Override - protected int getParryDamage(float dam) - { - return (int)(dam*2F); - } - - @Override - public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) - { - if(!user.worldObj.isRemote && user.getRNG().nextInt(5) == 0) - { - if(hit instanceof EntityLivingBase) - { - ((EntityLivingBase)hit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1)); - } - } - super.onProperHit(user, weapon, hit, dam); - } - - @Override - public float getDigSpeed(ItemStack itemstack, Block block, int metadata) - { - return super.getDigSpeed(itemstack, block, metadata)*1.5F; - } - - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 1.0F); - return true; - } - - @Override - protected float getKnockbackStrength() - { - return 1.5F; - } - - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModMace; - } - @Override - public float getDamageModifier() - { - return damageModMace; - } - - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return crushingDamage; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return maceParryTime; - } - @Override - public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) - { - return 40; - } - @Override - protected float getStaminaMod() - { - return maceStaminaCost; - } - @Override - public WeaponClass getWeaponClass() - { - return WeaponClass.BLUNT; - } - @Override - public boolean canCounter() - { - return false; - } + @Override + public float getDamageModifier() { + return damageModMace; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return crushingDamage; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return maceParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 40; + } + + @Override + protected float getStaminaMod() { + return maceStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLUNT; + } + + @Override + public boolean canCounter() { + return false; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemNodachi.java b/src/main/java/minefantasy/mf2/item/weapon/ItemNodachi.java new file mode 100644 index 00000000..87b08266 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemNodachi.java @@ -0,0 +1,128 @@ +package minefantasy.mf2.item.weapon; + +import java.util.Random; + +import minefantasy.mf2.api.weapon.WeaponClass; +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public class ItemNodachi extends ItemNodachiStats implements IExtendedReachWeapon { + private Random rand = new Random(); + + public ItemNodachi(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + public boolean canWeaponEvade() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 1; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(EntityLivingBase user) { + return 12; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.5F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return user instanceof EntityPlayer ? 3.0F : 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 0.75F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getBalance() { + return 0.5F; + } + + @Override + protected boolean canAnyMobParry() { + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSword; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return swordParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return heavyStaminaCost * swordStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return slashingDamage; + } + + @Override + public float getCounterDamage() { + return 0.5F; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 2.0F; + } + } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemNodachiStats.java b/src/main/java/minefantasy/mf2/item/weapon/ItemNodachiStats.java new file mode 100644 index 00000000..7fea20d0 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemNodachiStats.java @@ -0,0 +1,123 @@ +package minefantasy.mf2.item.weapon; + +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public abstract class ItemNodachiStats extends ItemWeaponMF implements IExtendedReachWeapon { + + /** + * Heavy weapons are larger varients of their own counterparts(sword, waraxe, + * mace and spear). These have 2x the durability, have a wider parry arc, and do + * 50% more damage. + *

+ * Heavy weapons weigh more and throw you off balance when used. + */ + public ItemNodachiStats(ToolMaterial material, String named, int rarity, float weight) { + super(material, named, rarity, weight); + setMaxDamage((int) (getMaxDamage() * 1.25F)); + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public boolean isHeavyWeapon() { + return true; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return true; + } + + public int getParryCooldown(EntityLivingBase user) { + return 25; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.5F; + } + + @Override + public float getBalance() { + return 0.95F; + } + + @Override + protected float getKnockbackStrength() { + return 1.75F; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 1.10F; + } + + @Override + protected boolean canAnyMobParry() { + return false; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModNodachi; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return nodachiSlashingDamage; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return heavyParryFatigue; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return nodachiParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 50; + } + + @Override + protected float getStaminaMod() { + return nodachiStaminaCost; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 2.0F; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 1.25F; + } + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemSaber.java b/src/main/java/minefantasy/mf2/item/weapon/ItemSaber.java new file mode 100644 index 00000000..27b91bc0 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemSaber.java @@ -0,0 +1,132 @@ +package minefantasy.mf2.item.weapon; + +import java.util.Random; + +import minefantasy.mf2.api.weapon.WeaponClass; +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public class ItemSaber extends ItemSaberStats implements IExtendedReachWeapon { + private Random rand = new Random(); + + /** + * Greatswords are heavy counterparts to swords, with added damage, knockback + * and parrying arc +0 */ + public ItemSaber(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + public boolean canWeaponEvade() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 1; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(EntityLivingBase user) { + return 12; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.5F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return user instanceof EntityPlayer ? 3.0F : 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 0.75F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getBalance() { + return 0.5F; + } + + @Override + protected boolean canAnyMobParry() { + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSword; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return swordParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return saberStaminaCost * swordStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return crushingDamage; + } + + @Override + public float getCounterDamage() { + return 0.5F; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 0.5F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemSaberStats.java b/src/main/java/minefantasy/mf2/item/weapon/ItemSaberStats.java new file mode 100644 index 00000000..cb06bdd3 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemSaberStats.java @@ -0,0 +1,117 @@ +package minefantasy.mf2.item.weapon; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public abstract class ItemSaberStats extends ItemWeaponMF { + + /** + * Heavy weapons are larger varients of their own counterparts(sword, waraxe, + * mace and spear). These have 2x the durability, have a wider parry arc, and do + * 50% more damage. + *

+ * Heavy weapons weigh more and throw you off balance when used. + */ + public ItemSaberStats(ToolMaterial material, String named, int rarity, float weight) { + super(material, named, rarity, weight); + setMaxDamage((int) (getMaxDamage() * 1.2F)); + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public boolean isHeavyWeapon() { + return false; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return true; + } + + public int getParryCooldown(EntityLivingBase user) { + return 18; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.0F; + } + + @Override + public float getBalance() { + return 0.75F; + } + + @Override + protected float getKnockbackStrength() { + return 1.5F; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 1.25F; + } + + @Override + protected boolean canAnyMobParry() { + return false; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSaber; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return slashingDamage; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return heavyParryFatigue; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return heavyParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 50; + } + + @Override + protected float getStaminaMod() { + return saberStaminaCost; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 1.2F; + } + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemShortsword.java b/src/main/java/minefantasy/mf2/item/weapon/ItemShortsword.java new file mode 100644 index 00000000..38bb8402 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemShortsword.java @@ -0,0 +1,132 @@ +package minefantasy.mf2.item.weapon; + +import java.util.Random; + +import minefantasy.mf2.api.weapon.WeaponClass; +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public class ItemShortsword extends ItemShortswordStats implements IExtendedReachWeapon { + private Random rand = new Random(); + + /** + * Greatswords are heavy counterparts to swords, with added damage, knockback + * and parrying arc +0 */ + public ItemShortsword(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + public boolean canWeaponEvade() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 1; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(EntityLivingBase user) { + return 12; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.5F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return user instanceof EntityPlayer ? 3.0F : 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 0.75F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getBalance() { + return 0.5F; + } + + @Override + protected boolean canAnyMobParry() { + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSword; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return swordParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return heavyStaminaCost * swordStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return crushingDamage; + } + + @Override + public float getCounterDamage() { + return 0.5F; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return -0.8F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemShortswordStats.java b/src/main/java/minefantasy/mf2/item/weapon/ItemShortswordStats.java new file mode 100644 index 00000000..ebfb5f3d --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemShortswordStats.java @@ -0,0 +1,118 @@ +package minefantasy.mf2.item.weapon; + +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public abstract class ItemShortswordStats extends ItemWeaponMF { + + /** + * Heavy weapons are larger varients of their own counterparts(sword, waraxe, + * mace and spear). These have 2x the durability, have a wider parry arc, and do + * 50% more damage. + *

+ * Heavy weapons weigh more and throw you off balance when used. + */ + public ItemShortswordStats(ToolMaterial material, String named, int rarity, float weight) { + super(material, named, rarity, weight); + setMaxDamage((int) (getMaxDamage() * 0.8F)); + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public boolean isHeavyWeapon() { + return false; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return true; + } + + public int getParryCooldown(EntityLivingBase user) { + return 18; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.0F; + } + + @Override + public float getBalance() { + return 0.75F; + } + + @Override + protected float getKnockbackStrength() { + return 1.5F; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 1.25F; + } + + @Override + protected boolean canAnyMobParry() { + return false; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModShortsword; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return slashingDamage; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return heavyParryFatigue; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return heavyParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 50; + } + + @Override + protected float getStaminaMod() { + return shortswordStaminaCost; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 0.8F; + } + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemSpearMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemSpearMF.java index 367dbcbf..75fedbb6 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemSpearMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemSpearMF.java @@ -1,11 +1,8 @@ package minefantasy.mf2.item.weapon; -import java.util.List; - import minefantasy.mf2.api.helpers.TacticalManager; import minefantasy.mf2.api.weapon.WeaponClass; import minefantasy.mf2.config.ConfigWeapon; -import minefantasy.mf2.item.tool.ToolMaterialMF; import mods.battlegear2.api.shield.IShield; import mods.battlegear2.api.weapons.IExtendedReachWeapon; import net.minecraft.entity.Entity; @@ -16,187 +13,167 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import java.util.List; + /** * @author Anonymous Productions */ -public class ItemSpearMF extends ItemWeaponMF implements IExtendedReachWeapon -{ - /** - * The spear is for the defensive player, it has a long reach, knockback and can be thrown. - * Spears are good for keeping enemies at a distance, Parrying is easier when sneaking - * - * These are for the defensive player - */ - public ItemSpearMF(String name, ToolMaterial material, int rarity, float weight) - { - super(material, name, rarity, weight); - } - - @Override - public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) - { - return offhand==null || offhand.getItem() instanceof IShield; - } - - @Override - public boolean isHeavyWeapon() - { - return true; - } - - @Override - public boolean isOffhandHandDual(ItemStack off) - { - return false; - } - - @Override - public boolean sheatheOnBack(ItemStack item) - { - return true; - } - - @Override - public float getReachModifierInBlocks(ItemStack stack) - { - return 3.0F; - } - - @Override - public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) - { +public class ItemSpearMF extends ItemWeaponMF implements IExtendedReachWeapon { + /** + * The spear is for the defensive player, it has a long reach, knockback and can + * be thrown. Spears are good for keeping enemies at a distance, Parrying is + * easier when sneaking + *

+ * These are for the defensive player + */ + public ItemSpearMF(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return offhand == null || offhand.getItem() instanceof IShield; + } + + @Override + public boolean isHeavyWeapon() { + return true; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 3.0F; + } + + @Override + public void addInformation(ItemStack item, EntityPlayer user, List list, boolean extra) { super.addInformation(item, user, list, extra); - if(material != ToolMaterial.WOOD) - { - list.add(EnumChatFormatting.DARK_GREEN+ - StatCollector.translateToLocalFormatted("attribute.modifier.plus."+ 0, - decimal_format.format(getMountedDamage()), StatCollector.translateToLocal("attribute.weapon.mountedBonus"))); - } - } - - @Override - public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, boolean properHit) - { - float damage = super.modifyDamage(item, wielder, hit, initialDam, properHit); - - if(!(hit instanceof EntityLivingBase) || this instanceof ItemLance) - { - return damage; - } - EntityLivingBase target = (EntityLivingBase)hit; - - if(wielder.isRiding() && tryPerformAbility(wielder, charge_cost)) - { + if (material != ToolMaterial.WOOD) { + list.add(EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocalFormatted( + "attribute.modifier.plus." + 0, decimal_format.format(getMountedDamage()), + StatCollector.translateToLocal("attribute.weapon.mountedBonus"))); + } + } + + @Override + public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, + boolean properHit) { + float damage = super.modifyDamage(item, wielder, hit, initialDam, properHit); + + if (!(hit instanceof EntityLivingBase) || this instanceof ItemLance) { + return damage; + } + EntityLivingBase target = (EntityLivingBase) hit; + + if (wielder.isRiding() && tryPerformAbility(wielder, charge_cost)) { ItemWaraxeMF.brutalise(wielder, target, 1.0F); return damage + getMountedDamage(); } - if(!wielder.isRiding() && wielder.isSprinting()) - { - if(this instanceof ItemHalbeardMF) - { - return Math.max(damage/1.25F, 1.0F); - } - else - { - return damage*1.25F; - } + if (!wielder.isRiding() && wielder.isSprinting()) { + if (this instanceof ItemHalbeardMF) { + return Math.max(damage / 1.25F, 1.0F); + } else { + return damage * 1.25F; + } } return damage; } - - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.8F); - return true; - } - - @Override - public void onParry(DamageSource source, EntityLivingBase user, Entity attacker, float dam) - { - super.onParry(source, user, attacker, dam); - if(ConfigWeapon.useBalance && user instanceof EntityPlayer) - { - TacticalManager.throwPlayerOffBalance((EntityPlayer)user, getBalance(), rand.nextBoolean()); - } - } - - private float getMountedDamage() - { - if(material == ToolMaterial.WOOD) - { - return 0; - } - return 4F; - } - - @Override - protected int getParryDamage(float dam) - { - return (int)dam; - } - /** - * Gets the angle the weapon can parry - */ - @Override - public float getParryAngleModifier(EntityLivingBase user) - { - return user.isSneaking() ? 1.2F: 0.85F; - } - @Override - public float getBalance() - { - return 0.5F; - } - - @Override - protected float getKnockbackStrength() - { - return 2.5F; - } - - @Override - protected boolean canAnyMobParry() - { - return false; - } - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModSpear; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return spearParryTime; - } - @Override - protected float getStaminaMod() - { - return spearStaminaCost; - } - @Override - public WeaponClass getWeaponClass() - { - return WeaponClass.POLEARM; - } - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return piercingDamage; - } - @Override - public boolean canCounter() - { - return false; - } - @Override - public float getScale(ItemStack itemstack) - { - return 3.0F; - } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.8F); + return true; + } + + @Override + public void onParry(DamageSource source, EntityLivingBase user, Entity attacker, float dam) { + super.onParry(source, user, attacker, dam); + if (ConfigWeapon.useBalance && user instanceof EntityPlayer) { + TacticalManager.throwPlayerOffBalance((EntityPlayer) user, getBalance(), rand.nextBoolean()); + } + } + + private float getMountedDamage() { + if (material == ToolMaterial.WOOD) { + return 0; + } + return 4F; + } + + @Override + protected int getParryDamage(float dam) { + return (int) dam; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return user.isSneaking() ? 1.2F : 0.85F; + } + + @Override + public float getBalance() { + return 0.5F; + } + + @Override + protected float getKnockbackStrength() { + return 2.5F; + } + + @Override + protected boolean canAnyMobParry() { + return false; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSpear; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return spearParryTime; + } + + @Override + protected float getStaminaMod() { + return spearStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.POLEARM; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return piercingDamage; + } + + @Override + public boolean canCounter() { + return false; + } + + @Override + public float getScale(ItemStack itemstack) { + return 3.0F; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemSwordMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemSwordMF.java index cc358e06..c58f77e3 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemSwordMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemSwordMF.java @@ -1,9 +1,6 @@ package minefantasy.mf2.item.weapon; -import java.util.Random; - import minefantasy.mf2.api.weapon.WeaponClass; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -12,92 +9,88 @@ /** * @author Anonymous Productions */ -public class ItemSwordMF extends ItemWeaponMF -{ - private Random rand = new Random(); - /** - * Swords are the average weapon. They do regular damage and are extremely effective at parrying balancing both attack and defense - * - * These are for the average player - */ - public ItemSwordMF(String name, ToolMaterial material, int rarity, float weight) - { - super(material, name, rarity, weight); +public class ItemSwordMF extends ItemWeaponMF { + /** + * Swords are the average weapon. They do regular damage and are extremely + * effective at parrying balancing both attack and defense + *

+ * These are for the average player + */ + public ItemSwordMF(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 1; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.0F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return user instanceof EntityPlayer ? 2.0F : 1.5F; + } + + /** + * Determines if the weapon can do those cool ninja evades + * + * @return + */ + @Override + public boolean canWeaponEvade() { + return true; + } + + @Override + protected boolean canAnyMobParry() { + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSword; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return swordParryTime; + } + + @Override + protected float getStaminaMod() { + return swordStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; } - - @Override - public boolean canBlock() - { - return true; - } - - /** - * Determines if the weapon can parry - */ - @Override - public boolean canWeaponParry() - { - return true; - } - - @Override - protected int getParryDamage(float dam) - { - return 1; - } - /** - * Gets the angle the weapon can parry - */ - @Override - public float getParryAngleModifier(EntityLivingBase user) - { - return 1.0F; - } - /** - * Gets the multiplier for the parry threshold - * @return - */ - @Override - public float getParryDamageModifier(EntityLivingBase user) - { - return user instanceof EntityPlayer ? 2.0F : 1.5F; - } - /** - * Determines if the weapon can do those cool ninja evades - * @return - */ - @Override - public boolean canWeaponEvade() - { - return true; - } - - @Override - protected boolean canAnyMobParry() - { - return true; - } - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModSword; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return swordParryTime; - } - @Override - protected float getStaminaMod() - { - return swordStaminaCost; - } - @Override - public WeaponClass getWeaponClass() - { - return WeaponClass.BLADE; - } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemTrident.java b/src/main/java/minefantasy/mf2/item/weapon/ItemTrident.java new file mode 100644 index 00000000..57838be5 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemTrident.java @@ -0,0 +1,128 @@ +package minefantasy.mf2.item.weapon; + +import java.util.Random; + +import minefantasy.mf2.api.weapon.WeaponClass; +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public class ItemTrident extends ItemTridentStats implements IExtendedReachWeapon { + private Random rand = new Random(); + + public ItemTrident(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + @Override + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + @Override + public boolean canWeaponParry() { + return true; + } + + @Override + public boolean canWeaponEvade() { + return true; + } + + @Override + protected int getParryDamage(float dam) { + return 1; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(EntityLivingBase user) { + return 12; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.5F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + @Override + public float getParryDamageModifier(EntityLivingBase user) { + return user instanceof EntityPlayer ? 3.0F : 1.5F; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "mob.zombie.metal", 1.0F, 0.75F + (rand.nextFloat() * 0.5F)); + return true; + } + + @Override + public float getBalance() { + return 0.5F; + } + + @Override + protected boolean canAnyMobParry() { + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModSword; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return swordParryTime + heavyParryTime; + } + + @Override + protected float getStaminaMod() { + return saberStaminaCost * swordStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLADE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return crushingDamage; + } + + @Override + public float getCounterDamage() { + return 0.5F; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 2.5F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemTridentStats.java b/src/main/java/minefantasy/mf2/item/weapon/ItemTridentStats.java new file mode 100644 index 00000000..6b1848f2 --- /dev/null +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemTridentStats.java @@ -0,0 +1,123 @@ +package minefantasy.mf2.item.weapon; + +import mods.battlegear2.api.weapons.IExtendedReachWeapon; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.util.DamageSource; + +public abstract class ItemTridentStats extends ItemWeaponMF implements IExtendedReachWeapon{ + + /** + * Heavy weapons are larger varients of their own counterparts(sword, waraxe, + * mace and spear). These have 2x the durability, have a wider parry arc, and do + * 50% more damage. + *

+ * Heavy weapons weigh more and throw you off balance when used. + */ + public ItemTridentStats(ToolMaterial material, String named, int rarity, float weight) { + super(material, named, rarity, weight); + setMaxDamage((int) (getMaxDamage() * 1.2F)); + } + + @Override + public boolean sheatheOnBack(ItemStack item) { + return true; + } + + @Override + public boolean isHeavyWeapon() { + return true; + } + + @Override + public boolean isOffhandHandDual(ItemStack off) { + return false; + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return true; + } + + public int getParryCooldown(EntityLivingBase user) { + return 18; + } + + /** + * Gets the angle the weapon can parry + */ + @Override + public float getParryAngleModifier(EntityLivingBase user) { + return 1.0F; + } + + @Override + public float getReachModifierInBlocks(ItemStack stack) { + return 2.5F; + } + + @Override + public float getBalance() { + return 0.75F; + } + + @Override + protected float getKnockbackStrength() { + return 1.5F; + } + + @Override + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 1.25F; + } + + @Override + protected boolean canAnyMobParry() { + return false; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModTrident; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return trSlashingDamage; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return heavyParryFatigue; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return heavyParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 50; + } + + @Override + protected float getStaminaMod() { + return tridentStaminaCost; + } + + @Override + protected float getMeleeDamage(ItemStack item) { + return super.getMeleeDamage(item) * 1.1F; + } + + @Override + public float getScale(ItemStack itemstack) { + return 2.0F; + } +} diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemWaraxeMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemWaraxeMF.java index 6f063430..eb00e749 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemWaraxeMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemWaraxeMF.java @@ -16,201 +16,180 @@ /** * @author Anonymous Productions */ -public class ItemWaraxeMF extends ItemWeaponMF -{ - private float injuryChance = 0.05F; - /** - * The waraxe is for brutal players. It does more damage and a higher bonus when sprinting or - * jumping. Waraxes are pure damage - * - * These are for the brutal player - */ - public ItemWaraxeMF(String name, ToolMaterial material, int rarity, float weight) - { - super(material, name, rarity, weight); +public class ItemWaraxeMF extends ItemWeaponMF { + private float injuryChance = 0.05F; + + /** + * The waraxe is for brutal players. It does more damage and a higher bonus when + * sprinting or jumping. Waraxes are pure damage + *

+ * These are for the brutal player + */ + public ItemWaraxeMF(String name, ToolMaterial material, int rarity, float weight) { + super(material, name, rarity, weight); + } + + public static void brutalise(EntityLivingBase entityHitting, EntityLivingBase entityHit, float power) { + if (!entityHit.worldObj.isRemote) { + if (entityHitting instanceof EntityPlayer) { + ((EntityPlayer) entityHitting).onCriticalHit(entityHit); + } + } } @Override - public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, boolean properHit) - { - float damage = super.modifyDamage(item, wielder, hit, initialDam, properHit); - if(!(hit instanceof EntityLivingBase)) - { - return damage; - } - EntityLivingBase target = (EntityLivingBase)hit; - - if(wielder.isSprinting()) - { - if(wielder.fallDistance > 0 && canLunge(wielder) && tryPerformAbility(wielder, lunge_cost, !properHit, true, true, true))//LUNGE: 20 Points - { - return chargeAt(wielder, target, true, damage, properHit); - } - else if(wielder.onGround && getHeightGap(target, wielder) <= 0.5F && tryPerformAbility(wielder, charge_cost))//CHARGE: 10 points - { - return chargeAt(wielder, target, false, damage, properHit); - } + public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, + boolean properHit) { + float damage = super.modifyDamage(item, wielder, hit, initialDam, properHit); + if (!(hit instanceof EntityLivingBase)) { + return damage; } - else if(wielder.fallDistance > 0 && !wielder.isOnLadder() && tryPerformAbility(wielder, jump_cost))//JUMP: 2 points + EntityLivingBase target = (EntityLivingBase) hit; + + if (wielder.isSprinting()) { + if (wielder.fallDistance > 0 && canLunge(wielder) + && tryPerformAbility(wielder, lunge_cost, !properHit, true, true, true))// LUNGE: 20 Points + { + return chargeAt(wielder, target, true, damage, properHit); + } else if (wielder.onGround && getHeightGap(target, wielder) <= 0.5F + && tryPerformAbility(wielder, charge_cost))// CHARGE: 10 points + { + return chargeAt(wielder, target, false, damage, properHit); + } + } else if (wielder.fallDistance > 0 && !wielder.isOnLadder() && tryPerformAbility(wielder, jump_cost))// JUMP: 2 + // points { - if(properHit) - brutalise(wielder, target, 1.0F); + if (properHit) + brutalise(wielder, target, 1.0F); return damage * 1.25F; } - return damage; - } - - private float chargeAt(EntityLivingBase entityHitting, EntityLivingBase entityHit, boolean lunge, float dam, boolean properHit) - { - if(properHit) - brutalise(entityHitting, entityHit, 1.0F); - - if(lunge) - { - float fallBonus = (Math.min(entityHitting.fallDistance, getMeleeDamage(entityHitting.getHeldItem())))/2F; - if(entityHit.onGround && !properHit) - { - entityHitting.hurtResistantTime = 20; - TacticalManager.knockbackEntity(entityHit, entityHitting, 4F, 0.5F); - TacticalManager.lungeEntity(entityHitting, entityHit, 2F, 0.1F); - } - if(properHit) - { - if(!entityHit.isPotionActive(Potion.moveSlowdown.id)) - { - entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 400, 3)); - entityHit.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 1)); - } - - entityHitting.fallDistance -= fallBonus; - } - if(fallBonus > 0) - { - dam += fallBonus; - } - } - else - { - if(properHit) - { - if(entityHitting.onGround && entityHit.onGround && !properHit) - { - entityHitting.hurtResistantTime = 20; - TacticalManager.lungeEntity(entityHitting, entityHit, 1F, 0.0F); - } - if(properHit) - { - if(!entityHit.isPotionActive(Potion.moveSlowdown.id)) - { - entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 3)); - entityHit.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0)); - } - } - } - } - return dam *1.25F; - } + return damage; + } + + private float chargeAt(EntityLivingBase entityHitting, EntityLivingBase entityHit, boolean lunge, float dam, + boolean properHit) { + if (properHit) + brutalise(entityHitting, entityHit, 1.0F); + + if (lunge) { + float fallBonus = (Math.min(entityHitting.fallDistance, getMeleeDamage(entityHitting.getHeldItem()))) / 2F; + if (entityHit.onGround && !properHit) { + entityHitting.hurtResistantTime = 20; + TacticalManager.knockbackEntity(entityHit, entityHitting, 4F, 0.5F); + TacticalManager.lungeEntity(entityHitting, entityHit, 2F, 0.1F); + } + if (properHit) { + if (!entityHit.isPotionActive(Potion.moveSlowdown.id)) { + entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 400, 3)); + entityHit.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 1)); + } + + entityHitting.fallDistance -= fallBonus; + } + if (fallBonus > 0) { + dam += fallBonus; + } + } else { + if (properHit) { + if (entityHitting.onGround && entityHit.onGround && !properHit) { + entityHitting.hurtResistantTime = 20; + TacticalManager.lungeEntity(entityHitting, entityHit, 1F, 0.0F); + } + if (properHit) { + if (!entityHit.isPotionActive(Potion.moveSlowdown.id)) { + entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 3)); + entityHit.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0)); + } + } + } + } + return dam * 1.25F; + } + + @Override + public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) { + if (rand.nextFloat() < injuryChance && dam > 0) { + hit.getEntityData().setInteger(EventManagerMF.injuredNBT, 200 + rand.nextInt(600)); + } + super.onProperHit(user, weapon, hit, dam); + } + + /** + * Determines if sprint-jump lunges work + */ + private boolean canLunge(EntityLivingBase entityHitting) { + return true; + } + + private double getHeightGap(EntityLivingBase entityHit, EntityLivingBase entityHitting) { + double a = entityHitting.posY - entityHit.posY; + return Math.max(a, -a); + } + + @Override + public float getDigSpeed(ItemStack itemstack, Block block, int metadata) { + if (Items.iron_axe.getDigSpeed(itemstack, block, metadata) > 2.0F) { + return material.getEfficiencyOnProperMaterial() * 0.75F; + } + return super.getDigSpeed(itemstack, block, metadata); + } @Override - public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) - { - if(rand.nextFloat() < injuryChance && dam > 0) - { - hit.getEntityData().setInteger(EventManagerMF.injuredNBT, 200 + rand.nextInt(600)); - } - super.onProperHit(user, weapon, hit, dam); - } - /** - * Determines if sprint-jump lunges work - */ - private boolean canLunge(EntityLivingBase entityHitting) - { - return true; - } - - private double getHeightGap(EntityLivingBase entityHit, EntityLivingBase entityHitting) - { - double a = entityHitting.posY - entityHit.posY; - return Math.max(a, -a); - } - @Override - public float getDigSpeed(ItemStack itemstack, Block block, int metadata) - { - if(Items.iron_axe.getDigSpeed(itemstack, block, metadata) > 2.0F) - { - return material.getEfficiencyOnProperMaterial()*0.75F; - } - return super.getDigSpeed(itemstack, block, metadata); - } - - public static void brutalise(EntityLivingBase entityHitting, EntityLivingBase entityHit, float power) - { - if(!entityHit.worldObj.isRemote) - { - if(entityHitting instanceof EntityPlayer) - { - ((EntityPlayer)entityHitting).onCriticalHit(entityHit); - } - } - } - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 1.0F); - return true; - } - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModAxe; - } - @Override - public float getDamageModifier() - { - return damageModAxe; - } - - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return hackingDamage; - } - @Override - public float getPenetrationLevel(Object implement) - { - return axeAPModifier; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return axeParryTime; - } - @Override - protected float getStaminaMod() - { - return axeStaminaCost; - } - @Override - public WeaponClass getWeaponClass() - { - return WeaponClass.AXE; - } - @Override - public boolean canCounter() - { - return true; - } - @Override - public float[] getCounterRatio() - { - return piercingDamage; - } - @Override - public float getCounterDamage() - { - return 1.0F; - } + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 1.0F); + return true; + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModAxe; + } + + @Override + public float getDamageModifier() { + return damageModAxe; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return hackingDamage; + } + + @Override + public float getPenetrationLevel(Object implement) { + return axeAPModifier; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return axeParryTime; + } + + @Override + protected float getStaminaMod() { + return axeStaminaCost; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.AXE; + } + + @Override + public boolean canCounter() { + return true; + } + + @Override + public float[] getCounterRatio() { + return piercingDamage; + } + + @Override + public float getCounterDamage() { + return 1.0F; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemWarhammerMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemWarhammerMF.java index 92ff32b9..5c7df404 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemWarhammerMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemWarhammerMF.java @@ -13,104 +13,94 @@ /** * @author Anonymous Productions */ -public class ItemWarhammerMF extends ItemHeavyWeaponMF -{ - private float stunChance = 0.20F; - - /** - * Warhammers are heavy counterparts to maces: They have more damage and knockback - * - * They can also strike heavy forces, being rather satisfying - */ - public ItemWarhammerMF(String name, ToolMaterial material, int rarity, float weight) - { +public class ItemWarhammerMF extends ItemHeavyWeaponMF { + private float stunChance = 0.20F; + + /** + * Warhammers are heavy counterparts to maces: They have more damage and + * knockback + *

+ * They can also strike heavy forces, being rather satisfying + */ + public ItemWarhammerMF(String name, ToolMaterial material, int rarity, float weight) { super(material, name, rarity, weight); - this.setMaxDamage((int) (getMaxDamage()*2F)); + this.setMaxDamage((int) (getMaxDamage() * 2F)); + } + + @Override + protected int getParryDamage(float dam) { + return (int) (dam * 2F); + } + + @Override + public float getDigSpeed(ItemStack itemstack, Block block, int metadata) { + return super.getDigSpeed(itemstack, block, metadata) * 1.5F; + } + + @Override + public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) { + if (!user.worldObj.isRemote && user.getRNG().nextInt(5) == 0) { + hit.worldObj.createExplosion(user, hit.posX, hit.posY, hit.posZ, 0.0F, false); + TacticalManager.knockbackEntity(hit, user, 2.0F, 1.5F); + if (hit instanceof EntityLivingBase) { + ((EntityLivingBase) hit).addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 10)); + ((EntityLivingBase) hit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 1)); + } + } + super.onProperHit(user, weapon, hit, dam); + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.75F); + return true; + } + + @Override + protected float getKnockbackStrength() { + return 2.0F; + } + + @Override + protected float getStaminaMod() { + return heavyStaminaCost * maceStaminaCost; } - @Override - protected int getParryDamage(float dam) - { - return (int)(dam*2F); - } - - @Override - public float getDigSpeed(ItemStack itemstack, Block block, int metadata) - { - return super.getDigSpeed(itemstack, block, metadata)*1.5F; - } - - @Override - public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) - { - if(!user.worldObj.isRemote && user.getRNG().nextInt(5) == 0) - { - hit.worldObj.createExplosion(user, hit.posX, hit.posY, hit.posZ, 0.0F, false); - TacticalManager.knockbackEntity(hit, user, 2.0F, 1.5F); - if(hit instanceof EntityLivingBase) - { - ((EntityLivingBase)hit).addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 10)); - ((EntityLivingBase)hit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 1)); - } - } - super.onProperHit(user, weapon, hit, dam); - } - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.75F); - return true; - } - - @Override - protected float getKnockbackStrength() - { - return 2.0F; - } - @Override - protected float getStaminaMod() - { - return heavyStaminaCost*maceStaminaCost; - } - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return super.modifyHitTime(user, item) + speedModMace; - } - - @Override - public float getDamageModifier() - { - return damageModMace; - } - - @Override - protected float[] getWeaponRatio(ItemStack implement) - { - return crushingDamage; - } - /** - * gets the time after being hit your guard will be let down - */ - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return maceParryTime + heavyParryTime; - } - @Override - public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) - { - return 80; - } - - @Override - public WeaponClass getWeaponClass() - { - return WeaponClass.BLUNT; - } - @Override - public boolean canCounter() - { - return false; - } + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return super.modifyHitTime(user, item) + speedModMace; + } + + @Override + public float getDamageModifier() { + return damageModMace; + } + + @Override + protected float[] getWeaponRatio(ItemStack implement) { + return crushingDamage; + } + + /** + * gets the time after being hit your guard will be let down + */ + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return maceParryTime + heavyParryTime; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 80; + } + + @Override + public WeaponClass getWeaponClass() { + return WeaponClass.BLUNT; + } + + @Override + public boolean canCounter() { + return false; + } } diff --git a/src/main/java/minefantasy/mf2/item/weapon/ItemWeaponMF.java b/src/main/java/minefantasy/mf2/item/weapon/ItemWeaponMF.java index 28b12c4e..c0b4c85e 100644 --- a/src/main/java/minefantasy/mf2/item/weapon/ItemWeaponMF.java +++ b/src/main/java/minefantasy/mf2/item/weapon/ItemWeaponMF.java @@ -1,14 +1,9 @@ package minefantasy.mf2.item.weapon; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; - +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,17 +17,8 @@ import minefantasy.mf2.api.stamina.IStaminaWeapon; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.api.tier.IToolMaterial; -import minefantasy.mf2.api.weapon.IDamageModifier; -import minefantasy.mf2.api.weapon.IDamageType; -import minefantasy.mf2.api.weapon.IKnockbackWeapon; -import minefantasy.mf2.api.weapon.IParryable; -import minefantasy.mf2.api.weapon.IPowerAttack; -import minefantasy.mf2.api.weapon.IRackItem; -import minefantasy.mf2.api.weapon.ISpecialCombatMob; +import minefantasy.mf2.api.weapon.*; import minefantasy.mf2.api.weapon.ISpecialEffect; -import minefantasy.mf2.api.weapon.IWeaponClass; -import minefantasy.mf2.api.weapon.IWeaponSpeed; -import minefantasy.mf2.api.weapon.IWeightedWeapon; import minefantasy.mf2.block.tileentity.decor.TileEntityRack; import minefantasy.mf2.config.ConfigWeapon; import minefantasy.mf2.item.list.CreativeTabMF; @@ -40,7 +26,6 @@ import minefantasy.mf2.item.tool.crafting.ItemKnifeMF; import minefantasy.mf2.material.BaseMaterialMF; import minefantasy.mf2.util.MFLogUtil; -import mods.battlegear2.api.PlayerEventChild.OffhandAttackEvent; import mods.battlegear2.api.weapons.IBackStabbable; import mods.battlegear2.api.weapons.IBattlegearWeapon; import mods.battlegear2.api.weapons.IExtendedReachWeapon; @@ -65,884 +50,810 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; +import net.minecraft.util.*; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; //Made this extend the sword class (allows them to be enchanted) -public abstract class ItemWeaponMF extends ItemSword implements ISpecialDesign, IPowerAttack, IDamageType, IKnockbackWeapon, IWeaponSpeed, IHeldStaminaItem, IStaminaWeapon, IBattlegearWeapon, IToolMaterial, IWeightedWeapon, IParryable, ISpecialEffect, IDamageModifier, IWeaponClass, IRackItem -{ +public abstract class ItemWeaponMF extends ItemSword implements ISpecialDesign, IPowerAttack, IDamageType, + IKnockbackWeapon, IWeaponSpeed, IHeldStaminaItem, IStaminaWeapon, IBattlegearWeapon, IToolMaterial, + IWeightedWeapon, IParryable, ISpecialEffect, IDamageModifier, IWeaponClass, IRackItem { public static final DecimalFormat decimal_format = new DecimalFormat("#.#"); + public static float axeAPModifier = -0.1F; + protected static int speedModHeavy = 5; + protected static int speedModSword = 0; + protected static int speedModAxe = 1; + protected static int speedModMace = 2; + protected static int speedModKatana = -5; + protected static int speedModSpear = 2; + protected static float damageModSword = 0.0F; + protected static float damageModAxe = 0.5F; + protected static float damageModMace = 1.0F; + + + //NEW STATS + + //Shortsword + protected static float damageModShortsword = -0.5F; + protected static int speedModShortsword = -1; + protected static float shortswordStaminaCost = 0.6F; + //Longsword + protected float[] lsSlashingDamage = new float[]{7F, 0F, 0F}; + protected static int speedModLongsword = 2; + protected float longswordStaminaCost = 1.25F; + //Saber + protected float saberStaminaCost = 0.8F; + protected static int speedModSaber = 1; + //Gladius + protected float gladiusStaminacost = 0.5F; + protected static int speedModGladius = -3; + //Trident + protected float[] trSlashingDamage = new float[]{1F, 0F, 10F}; + protected static int speedModTrident = -2; + protected float tridentStaminaCost = 1.3F; + //Nodachi + protected float nodachiStaminaCost = 1.75F; + protected static int speedModNodachi = 4; + protected int nodachiParryTime = 15; + protected float[] nodachiSlashingDamage = new float[]{9.5F, 1F, 4F}; + //Claymore + protected float claymoreStaminaCost = 2.75F; + protected static int speedModClaymore = 6; + protected int claymoreParryTime = 25; + protected float[] claymoreSlashingDamage = new float[]{12.0F, 12F, 0F}; + protected float claymoreParryFatigue = 2.5F; + + protected final ToolMaterial material; - protected String name; - /** - * The damage of the weapon without material modifiers - */ - private float baseDamage; - protected Random rand = new Random(); - - - protected float lunge_cost = 25; - protected float charge_cost = 10; - protected float jump_cost = 2; - - protected float cleave_cost = 40; - - /** - * The base file for Weapons in MineFantasy - * - * Size Varients, (Normal and Heavy) - * Normal weapons are as is, regular damage and weight - * Heavy weapons do more damage, exhaust more and have balance offset (+50% dam) - * - * Weapon Types: - * Blade: Parry Defensive, average damage and speed - * Axe: Brutal Offensive, slower than sword, more damage, Good against Armour - * Blunt: Simple Offensive, slower than axe, more damage, Good against Medium Armour - * Polearm: Ranged Defensive, Good against Heavy Armour - * Lightblade: Fast Offensive, Better against Unarmoured - */ - public ItemWeaponMF(ToolMaterial material, String named, int rarity, float weight) - { - super(material); - materialWeight = weight; - itemRarity = rarity; - //May be unsafe, but will allow others to add weapons using custom materials (also more efficent) - name = named; - this.material = material; - setCreativeTab(CreativeTabMF.tabOldTools); - setTextureName("minefantasy2:Weapon/"+name); - GameRegistry.registerItem(this, name, MineFantasyII.MODID); - this.setUnlocalizedName(name); - - this.baseDamage = 4 + getDamageModifier(); - - if(material == ToolMaterial.WOOD) - { - baseDamage = 0F; - } - if(isHeavyWeapon()) - { - WeaponRegistry.addTwoHanded(new ItemStack(this)); - } - else - { - WeaponRegistry.addDualWeapon(new ItemStack(this)); - } - } - - /** - * Gets the amount more damaged added to each item - */ - public float getDamageModifier() - { - return 0; - } - - /** - * Determines if the item can block/parry - */ - public boolean canBlock() - { - return true; - } - /** - * Determines if the weapon can parry - */ - public boolean canWeaponParry() - { - return true; - } - /** - * Gets the angle the weapon can parry - */ - public float getParryAngleModifier(EntityLivingBase user) - { - return 0.75F; - } - /** - * Gets the multiplier for the parry threshold - * @return - */ - public float getParryDamageModifier(EntityLivingBase user) - { - return 1.0F; - } - /** - * Determines if the weapon can do those cool ninja evades - * @return - */ - public boolean canWeaponEvade() - { - return true; - } - - //MECHANICS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - @Override - public ToolMaterial getMaterial() - { - return this.material; - } - - @SideOnly(Side.CLIENT) - @Override - public void addInformation(ItemStack weapon, EntityPlayer user, List list, boolean extra) - { + public String designType = "standard"; + protected String name; + protected Random rand = new Random(); + protected float lunge_cost = 25; + + // MECHANICS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + protected float charge_cost = 10; + protected float jump_cost = 2; + protected float cleave_cost = 40; + protected float[] slashingDamage = new float[]{1F, 0F, 0F}; + protected float[] crushingDamage = new float[]{0F, 1F, 0F}; + protected float[] hackingDamage = new float[]{4F, 1F, 0F}; + protected float[] hvyHackingDamage = new float[]{3F, 1F, 0F}; + protected float[] piercingDamage = new float[]{0F, 0F, 1F}; + protected float[] hvyPiercingDamage = new float[]{0F, 1F, 9F}; + protected float[] hvySlashingDamage = new float[]{9F, 1F, 0F}; + protected int defParryTime = 15; + protected int swordParryTime = 10; + protected int axeParryTime = 15; + protected int maceParryTime = 15; + protected int daggerParryTime = 5; + protected int spearParryTime = 20; + protected int heavyParryTime = 10; + protected float heavyParryFatigue = 2.0F; + protected float daggerStaminaCost = 0.50F; + protected float swordStaminaCost = 1.00F; + protected float katanaStaminaCost = 0.75F; + protected float axeStaminaCost = 1.20F; + protected float maceStaminaCost = 1.30F; + protected float spearStaminaCost = 1.40F; + protected float heavyStaminaCost = 1.50F; + protected int itemRarity; + /** + * The damage of the weapon without material modifiers + */ + private float baseDamage; + private float materialWeight = 1.0F; + // ===================================================== CUSTOM START + // =============================================================\\ + private boolean isCustom = false; + private IIcon detailTex = null; + private IIcon haftTex = null; + + /** + * The base file for Weapons in MineFantasy + *

+ * Size Varients, (Normal and Heavy) Normal weapons are as is, regular damage + * and weight Heavy weapons do more damage, exhaust more and have balance offset + * (+50% dam) + *

+ * Weapon Types: Blade: Parry Defensive, average damage and speed Axe: Brutal + * Offensive, slower than sword, more damage, Good against Armour Blunt: Simple + * Offensive, slower than axe, more damage, Good against Medium Armour Polearm: + * Ranged Defensive, Good against Heavy Armour Lightblade: Fast Offensive, + * Better against Unarmoured + */ + public ItemWeaponMF(ToolMaterial material, String named, int rarity, float weight) { + super(material); + materialWeight = weight; + itemRarity = rarity; + // May be unsafe, but will allow others to add weapons using custom materials + // (also more efficent) + name = named; + this.material = material; + setCreativeTab(CreativeTabMF.tabOldTools); + setTextureName("minefantasy2:Weapon/" + name); + GameRegistry.registerItem(this, name, MineFantasyII.MODID); + this.setUnlocalizedName(name); + + this.baseDamage = 4 + getDamageModifier(); + + if (material == ToolMaterial.WOOD) { + baseDamage = 0F; + } + if(Loader.isModLoaded("battlegear2")) { + if (isHeavyWeapon()) { + WeaponRegistry.addTwoHanded(new ItemStack(this)); + } else { + WeaponRegistry.addDualWeapon(new ItemStack(this)); + } + } + } + + public static int getParry(ItemStack item) { + if (item.hasTagCompound()) { + if (item.getTagCompound().hasKey("ParryAnimation")) { + return item.getTagCompound().getInteger("ParryAnimation"); + } + } + return -1; + } + + public static void setParry(ItemStack item, int i) { + NBTTagCompound nbt = getOrCreateNBT(item); + + nbt.setInteger("ParryAnimation", i); + } + + public static NBTTagCompound getOrCreateNBT(ItemStack item) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + } + return item.getTagCompound(); + } + + public static boolean canPerformAbility(EntityLivingBase user, float points) { + return tryPerformAbility(user, points, false, true, true, false); + } + + public static boolean tryPerformAbility(EntityLivingBase user, float points) { + return tryPerformAbility(user, points, true, true); + } + + public static boolean tryPerformAbility(EntityLivingBase user, float points, boolean armour, boolean weapon) { + return tryPerformAbility(user, points, true, armour, weapon, true); + } + + public static boolean tryPerformAbility(EntityLivingBase user, float points, boolean flash, boolean armour, + boolean weapon, boolean takePoints) { + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user)) { + points *= StaminaBar.getBaseDecayModifier(user, armour, weapon); + if (StaminaBar.isStaminaAvailable(user, points, flash)) { + if (takePoints && !user.worldObj.isRemote) { + applyFatigue(user, points); + } + return true; + } else { + return false; + } + } + return true; + } + + public static void applyFatigue(EntityLivingBase user, float points) { + applyFatigue(user, points, 50F); + } + + public static void applyFatigue(EntityLivingBase user, float points, float pause) { + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user)) { + float stam = StaminaBar.getStaminaValue(user); + if (stam > 0) { + StaminaBar.modifyStaminaValue(user, -points); + } + StaminaBar.setIdleTime(user, pause * StaminaBar.pauseModifier); + + if (!user.worldObj.isRemote) { + MFLogUtil.logDebug("Spent " + points + " Stamina Pts"); + } + } + } + + /** + * Gets the amount more damaged added to each item + */ + public float getDamageModifier() { + return 0; + } + + /** + * Determines if the item can block/parry + */ + public boolean canBlock() { + return true; + } + + /** + * Determines if the weapon can parry + */ + public boolean canWeaponParry() { + return true; + } + + /** + * Gets the angle the weapon can parry + */ + public float getParryAngleModifier(EntityLivingBase user) { + return 0.75F; + } + + /** + * Gets the multiplier for the parry threshold + * + * @return + */ + public float getParryDamageModifier(EntityLivingBase user) { + return 1.0F; + } + + /** + * Determines if the weapon can do those cool ninja evades + * + * @return + */ + public boolean canWeaponEvade() { + return true; + } + + @Override + public ToolMaterial getMaterial() { + return this.material; + } + + @SideOnly(Side.CLIENT) + @Override + public void addInformation(ItemStack weapon, EntityPlayer user, List list, boolean extra) { super.addInformation(weapon, user, list, extra); - - if(material == ToolMaterial.WOOD) - { - return; - } - - if(isCustom) - { - CustomToolHelper.addInformation(weapon, list); - } - - if(this instanceof IExtendedReachWeapon || this instanceof IPenetrateWeapon || this instanceof IHitTimeModifier){ + + if (material == ToolMaterial.WOOD) { + return; + } + + if (isCustom) { + CustomToolHelper.addInformation(weapon, list); + } + + if (this instanceof IExtendedReachWeapon || this instanceof IPenetrateWeapon + || this instanceof IHitTimeModifier) { list.add(""); - if(this instanceof IPenetrateWeapon) - { - list.add(EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocalFormatted("attribute.modifier.plus."+ 1, decimal_format.format(getAPDamText()), StatCollector.translateToLocal("attribute.weapon.penetrateArmor"))); + if (this instanceof IPenetrateWeapon) { + list.add(EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocalFormatted( + "attribute.modifier.plus." + 1, decimal_format.format(getAPDamText()), + StatCollector.translateToLocal("attribute.weapon.penetrateArmor"))); } - if(this instanceof IExtendedReachWeapon){ - float reach = ((IExtendedReachWeapon)this).getReachModifierInBlocks(weapon); - - if(reach > 0){ - list.add(EnumChatFormatting.DARK_GREEN+ - StatCollector.translateToLocalFormatted("attribute.modifier.plus."+ 0, - decimal_format.format(reach), - StatCollector.translateToLocal("attribute.weapon.extendedReach"))); - }else{ - list.add(EnumChatFormatting.RED+ - StatCollector.translateToLocalFormatted("attribute.modifier.take."+ 0, - decimal_format.format(-1 * reach), - StatCollector.translateToLocal("attribute.weapon.extendedReach"))); + if (this instanceof IExtendedReachWeapon) { + float reach = ((IExtendedReachWeapon) this).getReachModifierInBlocks(weapon); + + if (reach > 0) { + list.add(EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocalFormatted( + "attribute.modifier.plus." + 0, decimal_format.format(reach), + StatCollector.translateToLocal("attribute.weapon.extendedReach"))); + } else { + list.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted( + "attribute.modifier.take." + 0, decimal_format.format(-1 * reach), + StatCollector.translateToLocal("attribute.weapon.extendedReach"))); } } - if(this instanceof IHitTimeModifier){ - int hitMod = ((IHitTimeModifier)this).getHitTime(weapon, null); - if(hitMod > 0){ - list.add(EnumChatFormatting.RED+ - StatCollector.translateToLocalFormatted("attribute.modifier.take."+ 1, - decimal_format.format(hitMod / 10F * 100), - StatCollector.translateToLocal("attribute.weapon.attackSpeed"))); - }else{ - list.add(EnumChatFormatting.DARK_GREEN+ - StatCollector.translateToLocalFormatted("attribute.modifier.plus."+ 1, - decimal_format.format(-(float)hitMod / 10F * 100), - StatCollector.translateToLocal("attribute.weapon.attackSpeed"))); + if (this instanceof IHitTimeModifier) { + int hitMod = ((IHitTimeModifier) this).getHitTime(weapon, null); + if (hitMod > 0) { + list.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted( + "attribute.modifier.take." + 1, decimal_format.format(hitMod / 10F * 100), + StatCollector.translateToLocal("attribute.weapon.attackSpeed"))); + } else { + list.add(EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocalFormatted( + "attribute.modifier.plus." + 1, decimal_format.format(-(float) hitMod / 10F * 100), + StatCollector.translateToLocal("attribute.weapon.attackSpeed"))); } } - if(this instanceof IBackStabbable){ - list.add(EnumChatFormatting.GOLD+ - StatCollector.translateToLocal("attribute.weapon.backstab")); + if (this instanceof IBackStabbable) { + list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("attribute.weapon.backstab")); } } } - - protected float getAPDamText() - { - return 0F; - } - - @Override - public boolean sheatheOnBack(ItemStack item) - { - return isHeavyWeapon(); - } - - public boolean isHeavyWeapon() - { - return false; - } - - @Override - public boolean isOffhandHandDual(ItemStack off) - { - return true; - } - - @Override - public boolean offhandAttackEntity(OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem) - { - return true; - } - - @Override - public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) - { - return true; - } - - @Override - public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) - { - return true; - } - - @Override - public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem) - { - } - - @Override - public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) - { - return offhand != null; - } - protected void addXp(EntityLivingBase user, int chance) - { - if(ConfigWeapon.xpTrain && user instanceof EntityPlayer && material == ToolMaterial.WOOD) - { - if(chance == 0 || user.getRNG().nextInt(chance) == 0) - { - ((EntityPlayer)user).addExperience(1); - } - } + + protected float getAPDamText() { + return 0F; } - - public static int getParry(ItemStack item) - { - if(item.hasTagCompound()) - { - if(item.getTagCompound().hasKey("ParryAnimation")) - { - return item.getTagCompound().getInteger("ParryAnimation"); - } - } - return -1; + + @Override + public boolean sheatheOnBack(ItemStack item) { + return isHeavyWeapon(); } - - public static void setParry(ItemStack item, int i) - { - NBTTagCompound nbt = getOrCreateNBT(item); - - nbt.setInteger("ParryAnimation", i); - } - - public static NBTTagCompound getOrCreateNBT(ItemStack item) - { - if(!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - return item.getTagCompound(); - } - @Override - public void onParry(DamageSource source, EntityLivingBase user, Entity attacker, float dam) - { - ItemStack weapon = user.getHeldItem(); - int pd = getParryDamage(dam); - if(pd > 0) - { - weapon.damageItem(pd, user); - } - - addXp(user, 30); - } - - /** - * Gets the amount of durability lost when parrying - */ - protected int getParryDamage(float dam) - { - return (int)dam; - } - - @Override - public float getMaxDamageParry(EntityLivingBase user, ItemStack weapon) - { - float mod = 1.0F; - return getMeleeDamage(weapon)*getParryDamageModifier(user)*mod; - } - - @Override - public float getParryAngle(DamageSource source, EntityLivingBase blocker, ItemStack item) - { - float base = 30; - - if(source.isProjectile()) - { - if(!(blocker instanceof EntityPlayer)) - { - base = 0F; - } - base *= 0.25F; - } - if(blocker instanceof EntityZombie && !(blocker instanceof EntityPigZombie)) - { - base *= 2; - } - return base * getParryAngleModifier(blocker); - } - - @Override - public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) - { - if(ConfigWeapon.xpTrain && user instanceof EntityLivingBase && material == ToolMaterial.WOOD) - { - addXp(user, 50); - } - } - - protected float getKnockbackStrength() - { - return 0; - } - - @Override - public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) - { - if(material == ToolMaterial.WOOD) - { - blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 1.0F); - return true; - } - if(material == BaseMaterialMF.stone.getToolConversion()) - { - blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.5F); - return true; - } - return false; - } - @Override - public boolean canParry(DamageSource source, EntityLivingBase blocker, ItemStack item) - { - return canWeaponParry(); - } - @Override - public float getBalance(EntityLivingBase user) - { - return getBalance(); - } - public float getBalance() - { - return 0.0F; - } - - @Override - public float getStaminaDrainOnHit(EntityLivingBase user, ItemStack item) - { - return 2F * getStaminaMod() * getWeightModifier(item); - } - - protected float getStaminaMod() - { - return 1.0F; - } - - public static boolean canPerformAbility(EntityLivingBase user, float points) - { - return tryPerformAbility(user, points, false, true, true, false); - } - public static boolean tryPerformAbility(EntityLivingBase user, float points) - { - return tryPerformAbility(user, points, true, true); - } - - public static boolean tryPerformAbility(EntityLivingBase user, float points, boolean armour, boolean weapon) - { - return tryPerformAbility(user, points, true, armour, weapon, true); - } - - public static boolean tryPerformAbility(EntityLivingBase user, float points, boolean flash, boolean armour, boolean weapon, boolean takePoints) - { - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user)) - { - points *= StaminaBar.getBaseDecayModifier(user, armour, weapon); - if(StaminaBar.isStaminaAvailable(user, points, flash)) - { - if(takePoints && !user.worldObj.isRemote) - { - applyFatigue(user, points); - } - return true; - } - else - { - return false; - } - } - return true; - } - public static void applyFatigue(EntityLivingBase user, float points) - { - applyFatigue(user, points, 50F); - } - public static void applyFatigue(EntityLivingBase user, float points, float pause) - { - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user)) - { - float stam = StaminaBar.getStaminaValue(user); - if(stam > 0) - { - StaminaBar.modifyStaminaValue(user, -points); - } - StaminaBar.setIdleTime(user, pause * StaminaBar.pauseModifier); - - if(!user.worldObj.isRemote) - { - MFLogUtil.logDebug("Spent " + points + " Stamina Pts"); - } - } - } - @Override - public float getDecayMod(EntityLivingBase user, ItemStack item) - { - return getDecayModifier(user, item) * getWeightModifier(item); - } - - /** - * The Modifier for the weapon - */ - public float getDecayModifier(EntityLivingBase user, ItemStack item) - { - return 1.0F; - } - - @Override - public float getRegenModifier(EntityLivingBase user, ItemStack item) - { - return 1.0F; - } - - @Override - public float getIdleModifier(EntityLivingBase user, ItemStack item) - { - return 1.0F; - } - - protected void hurtInRange(EntityLivingBase user, double range) - { - AxisAlignedBB bb = user.boundingBox.expand(range, range, range); - Listhurt = user.worldObj.getEntitiesWithinAABBExcludingEntity(user, bb); - Iterator list = hurt.iterator(); - while(list.hasNext()) - { - Entity hit = (Entity) list.next(); - - if(user.canEntityBeSeen(hit)) - { - TacticalManager.knockbackEntity(hit, user, 1.5F, 0.2F); - if(StaminaBar.isSystemActive) - { - StaminaBar.setIdleTime(user, 60); - } - if(hit instanceof EntityLivingBase) - { - for(int a = 0; a < 4; a ++) - { - hit.worldObj.spawnParticle("blockcrack_" + Block.getIdFromBlock(Blocks.redstone_block) + "_0", hit.posX, hit.posY+hit.getEyeHeight(), hit.posZ, rand.nextDouble()/2D, rand.nextDouble()/2D, rand.nextDouble()/2D); - } - ((EntityLivingBase) hit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 0)); - } - } - } - } - @Override - public boolean canUserParry(EntityLivingBase user) - { - return user instanceof EntityPlayer || user instanceof ISpecialCombatMob || (canAnyMobParry() || rand.nextFloat() < 0.20F); - } - - protected boolean canAnyMobParry() - { - return false; - } - - @Override - public float getAddedKnockback(EntityLivingBase user, ItemStack item) - { - return getKnockbackStrength(); - } - - @Override - public int modifyHitTime(EntityLivingBase user, ItemStack item) - { - return 0; - } - - @Override - public float[] getDamageRatio(Object... implement) - { - if(implement.length > 1) - { - return getWeaponRatio((ItemStack)implement[0], (EntityLivingBase)implement[1]); - } - return getWeaponRatio((ItemStack)implement[0]); - } - @Override - public float getPenetrationLevel(Object implement) - { - ItemStack item = (ItemStack)implement; - return 0F; - } - - protected float[] getWeaponRatio(ItemStack implement) - { - return new float[]{1F, 0F, 0F}; - } - protected float[] getWeaponRatio(ItemStack implement, EntityLivingBase user) - { - if(canCounter(user, implement) == 1) - { - return getCounterRatio(); - } - return getWeaponRatio(implement); - } - - protected float[] slashingDamage = new float[]{1F, 0F, 0F}; - protected float[] crushingDamage = new float[]{0F, 1F, 0F}; - - protected float[] hackingDamage = new float[]{4F, 1F, 0F}; - protected float[] hvyHackingDamage = new float[]{3F, 1F, 0F}; - - protected float[] piercingDamage = new float[]{0F, 0F, 1F}; - protected float[] hvyPiercingDamage = new float[]{0F, 1F, 9F}; - protected float[] hvySlashingDamage = new float[]{9F, 1F, 0F}; - private float materialWeight = 1.0F; - - protected static int speedModHeavy = 5; - - protected static int speedModSword = 0; - protected static int speedModAxe = 1; - protected static int speedModMace = 2; - protected static int speedModKatana = -5; - protected static int speedModSpear = 2; - - protected static float damageModSword = 0.0F; - protected static float damageModAxe = 0.5F; - protected static float damageModMace = 1.0F; - - public static float axeAPModifier = -0.1F; - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) - { - if(isCustom) - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - if(MineFantasyII.isDebug() || customMat.getItem() != null) - { - list.add(this.construct(customMat.name,"OakWood")); - } - } - return; - } - - if(this instanceof ItemKnifeMF) - { - super.getSubItems(item, tab, list); - return; - } - if(this != ToolListMF.swordTraining) - { - return; - } - list.add(new ItemStack(ToolListMF.swordTraining)); - list.add(new ItemStack(ToolListMF.waraxeTraining)); - list.add(new ItemStack(ToolListMF.maceTraining)); - list.add(new ItemStack(ToolListMF.spearTraining)); - - list.add(new ItemStack(ToolListMF.swordStone)); - list.add(new ItemStack(ToolListMF.waraxeStone)); - list.add(new ItemStack(ToolListMF.maceStone)); - list.add(new ItemStack(ToolListMF.spearStone)); - } - - private void addSet(List list, Item[] items) - { - for(Item item:items) - { - list.add(new ItemStack(item)); - } - } - - @Override - public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, boolean properHit) - { - if(canCounter(wielder, item) == 1) - { - initialDam *= getCounterDamage(); - } - if(canCounter(wielder, item) == 0) - { - initialDam *= getFailCounterDamage(); - } - return initialDam; - } - - - @Override - public float getParryStaminaDecay(DamageSource source, ItemStack weapon) - { - return 1.0F; - } - @Override - public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) - { - return 15; - } - @Override - public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) - { - return 30; - } - @Override - public void onPowerAttack(float dam, EntityLivingBase user, Entity target, boolean properHit) - { - - } - - public boolean canCounter() - { - return true; - } - public float[] getCounterRatio() - { - return new float[]{0, 0, 1}; - } - public float getCounterDamage() - { - return 0.75F; - } - public float getFailCounterDamage() - { - return 0.5F; - } - /* - * 0 = Cannot Counter - * 1 = Can Counter - * -1 = Not Possible - */ - private int canCounter(EntityLivingBase user, ItemStack item) - { - if(user != null && user instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)user; - if(getParry(item) > 0) - { - if(ResearchLogic.hasInfoUnlocked(player, "counteratt")) - { - return 1;//Can - } - return 0;//Cannot - } - } - return -1;//N/A - } - protected int defParryTime = 15; - protected int swordParryTime = 10; - protected int axeParryTime = 15; - protected int maceParryTime = 15; - protected int daggerParryTime = 5; - protected int spearParryTime = 20; - - protected int heavyParryTime = 10; - - protected float heavyParryFatigue = 2.0F; - - protected float daggerStaminaCost = 0.50F; - protected float swordStaminaCost = 1.00F; - protected float katanaStaminaCost = 0.75F; - protected float axeStaminaCost = 1.20F; - protected float maceStaminaCost = 1.30F; - protected float spearStaminaCost = 1.40F; - - protected float heavyStaminaCost = 1.50F; - - - //===================================================== CUSTOM START =============================================================\\ - private boolean isCustom = false; - public ItemWeaponMF setCustom(String s) - { - canRepair = false; - setTextureName("minefantasy2:custom/weapon/"+s+"/"+name); - designType = s; - isCustom = true; - return this; + + public boolean isHeavyWeapon() { + return false; } - + @Override - public Multimap getAttributeModifiers(ItemStack item) - { - Multimap map = HashMultimap.create(); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); + public boolean isOffhandHandDual(ItemStack off) { + return true; + } + + @Override + @Optional.Method(modid = "battlegear2") + public boolean offhandAttackEntity(mods.battlegear2.api.PlayerEventChild.OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem) { + return true; + } + + @Override + public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) { + return true; + } + + @Override + public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) { + return true; + } + + @Override + public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem) { + } + + @Override + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) { + return offhand != null; + } + + protected void addXp(EntityLivingBase user, int chance) { + if (ConfigWeapon.xpTrain && user instanceof EntityPlayer && material == ToolMaterial.WOOD) { + if (chance == 0 || user.getRNG().nextInt(chance) == 0) { + ((EntityPlayer) user).addExperience(1); + } + } + } + + @Override + public void onParry(DamageSource source, EntityLivingBase user, Entity attacker, float dam) { + ItemStack weapon = user.getHeldItem(); + int pd = getParryDamage(dam); + if (pd > 0) { + weapon.damageItem(pd, user); + } + + addXp(user, 30); + } + + /** + * Gets the amount of durability lost when parrying + */ + protected int getParryDamage(float dam) { + return (int) dam; + } + + @Override + public float getMaxDamageParry(EntityLivingBase user, ItemStack weapon) { + float mod = 1.0F; + return getMeleeDamage(weapon) * getParryDamageModifier(user) * mod; + } + + @Override + public float getParryAngle(DamageSource source, EntityLivingBase blocker, ItemStack item) { + float base = 30; + + if (source.isProjectile()) { + if (!(blocker instanceof EntityPlayer)) { + base = 0F; + } + base *= 0.25F; + } + if (blocker instanceof EntityZombie && !(blocker instanceof EntityPigZombie)) { + base *= 2; + } + return base * getParryAngleModifier(blocker); + } + + @Override + public void onProperHit(EntityLivingBase user, ItemStack weapon, Entity hit, float dam) { + if (ConfigWeapon.xpTrain && user instanceof EntityLivingBase && material == ToolMaterial.WOOD) { + addXp(user, 50); + } + } + + protected float getKnockbackStrength() { + return 0; + } + + @Override + public boolean playCustomParrySound(EntityLivingBase blocker, Entity attacker, ItemStack weapon) { + if (material == ToolMaterial.WOOD) { + blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 1.0F); + return true; + } + if (material == BaseMaterialMF.stone.getToolConversion()) { + blocker.worldObj.playSoundAtEntity(blocker, "minefantasy2:weapon.wood_parry", 1.0F, 0.5F); + return true; + } + return false; + } + + @Override + public boolean canParry(DamageSource source, EntityLivingBase blocker, ItemStack item) { + return canWeaponParry(); + } + + @Override + public float getBalance(EntityLivingBase user) { + return getBalance(); + } + + public float getBalance() { + return 0.0F; + } + + @Override + public float getStaminaDrainOnHit(EntityLivingBase user, ItemStack item) { + return 2F * getStaminaMod() * getWeightModifier(item); + } + + protected float getStaminaMod() { + return 1.0F; + } + + @Override + public float getDecayMod(EntityLivingBase user, ItemStack item) { + return getDecayModifier(user, item) * getWeightModifier(item); + } + + /** + * The Modifier for the weapon + */ + public float getDecayModifier(EntityLivingBase user, ItemStack item) { + return 1.0F; + } + + @Override + public float getRegenModifier(EntityLivingBase user, ItemStack item) { + return 1.0F; + } + + @Override + public float getIdleModifier(EntityLivingBase user, ItemStack item) { + return 1.0F; + } + + protected void hurtInRange(EntityLivingBase user, double range) { + AxisAlignedBB bb = user.boundingBox.expand(range, range, range); + List hurt = user.worldObj.getEntitiesWithinAABBExcludingEntity(user, bb); + Iterator list = hurt.iterator(); + while (list.hasNext()) { + Entity hit = (Entity) list.next(); + + if (user.canEntityBeSeen(hit)) { + TacticalManager.knockbackEntity(hit, user, 1.5F, 0.2F); + if (StaminaBar.isSystemActive) { + StaminaBar.setIdleTime(user, 60); + } + if (hit instanceof EntityLivingBase) { + for (int a = 0; a < 4; a++) { + hit.worldObj.spawnParticle("blockcrack_" + Block.getIdFromBlock(Blocks.redstone_block) + "_0", + hit.posX, hit.posY + hit.getEyeHeight(), hit.posZ, rand.nextDouble() / 2D, + rand.nextDouble() / 2D, rand.nextDouble() / 2D); + } + ((EntityLivingBase) hit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 0)); + } + } + } + } + + @Override + public boolean canUserParry(EntityLivingBase user) { + return user instanceof EntityPlayer || user instanceof ISpecialCombatMob + || (canAnyMobParry() || rand.nextFloat() < 0.20F); + } + + protected boolean canAnyMobParry() { + return false; + } + + @Override + public float getAddedKnockback(EntityLivingBase user, ItemStack item) { + return getKnockbackStrength(); + } + + @Override + public int modifyHitTime(EntityLivingBase user, ItemStack item) { + return 0; + } + + @Override + public float[] getDamageRatio(Object... implement) { + if (implement.length > 1) { + return getWeaponRatio((ItemStack) implement[0], (EntityLivingBase) implement[1]); + } + return getWeaponRatio((ItemStack) implement[0]); + } + + @Override + public float getPenetrationLevel(Object implement) { + ItemStack item = (ItemStack) implement; + return 0F; + } + + protected float[] getWeaponRatio(ItemStack implement) { + return new float[]{1F, 0F, 0F}; + } + + protected float[] getWeaponRatio(ItemStack implement, EntityLivingBase user) { + if (canCounter(user, implement) == 1) { + return getCounterRatio(); + } + return getWeaponRatio(implement); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + if (isCustom) { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + if (MineFantasyII.isDebug() || customMat.getItem() != null) { + list.add(this.construct(customMat.name, "OakWood")); + } + } + return; + } + + if (this instanceof ItemKnifeMF) { + super.getSubItems(item, tab, list); + return; + } + if (this != ToolListMF.swordTraining) { + return; + } + list.add(new ItemStack(ToolListMF.swordTraining)); + list.add(new ItemStack(ToolListMF.waraxeTraining)); + list.add(new ItemStack(ToolListMF.maceTraining)); + list.add(new ItemStack(ToolListMF.spearTraining)); + + list.add(new ItemStack(ToolListMF.swordStone)); + list.add(new ItemStack(ToolListMF.waraxeStone)); + list.add(new ItemStack(ToolListMF.maceStone)); + list.add(new ItemStack(ToolListMF.spearStone)); + } + + private void addSet(List list, Item[] items) { + for (Item item : items) { + list.add(new ItemStack(item)); + } + } + + @Override + public float modifyDamage(ItemStack item, EntityLivingBase wielder, Entity hit, float initialDam, + boolean properHit) { + if (canCounter(wielder, item) == 1) { + initialDam *= getCounterDamage(); + } + if (canCounter(wielder, item) == 0) { + initialDam *= getFailCounterDamage(); + } + return initialDam; + } + + @Override + public float getParryStaminaDecay(DamageSource source, ItemStack weapon) { + return 1.0F; + } + + @Override + public int getParryCooldown(DamageSource source, float dam, ItemStack weapon) { + return 15; + } + + @Override + public int getParryModifier(ItemStack weapon, EntityLivingBase user, Entity target) { + return 30; + } + + @Override + public void onPowerAttack(float dam, EntityLivingBase user, Entity target, boolean properHit) { + + } + + public boolean canCounter() { + return true; + } + + public float[] getCounterRatio() { + return new float[]{0, 0, 1}; + } + + public float getCounterDamage() { + return 0.75F; + } + + public float getFailCounterDamage() { + return 0.5F; + } + + /* + * 0 = Cannot Counter 1 = Can Counter -1 = Not Possible + */ + private int canCounter(EntityLivingBase user, ItemStack item) { + if (user != null && user instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) user; + if (getParry(item) > 0) { + if (ResearchLogic.hasInfoUnlocked(player, "counteratt")) { + return 1;// Can + } + return 0;// Cannot + } + } + return -1;// N/A + } + + public ItemWeaponMF setCustom(String s) { + canRepair = false; + setTextureName("minefantasy2:custom/weapon/" + s + "/" + name); + designType = s; + isCustom = true; + return this; + } + + @Override + public Multimap getAttributeModifiers(ItemStack item) { + Multimap map = HashMultimap.create(); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(field_111210_e, "Weapon modifier", getMeleeDamage(item), 0)); return map; } - - - public ItemWeaponMF modifyBaseDamage(float mod) - { - this.baseDamage = Math.max(1.0F, baseDamage + mod); - return this; - } - public ItemWeaponMF setBaseDamage(float baseDamage) - { - this.baseDamage = baseDamage; - return this; - } - /** - * Gets a stack-sensitive value for the melee dmg - */ - protected float getMeleeDamage(ItemStack item) - { - return baseDamage + CustomToolHelper.getMeleeDamage(item, material.getDamageVsEntity()); - } - protected float getWeightModifier(ItemStack stack) - { - return CustomToolHelper.getWeightModifier(stack, materialWeight); - } - private IIcon detailTex = null; - private IIcon haftTex = null; + + public ItemWeaponMF modifyBaseDamage(float mod) { + this.baseDamage = Math.max(1.0F, baseDamage + mod); + return this; + } + + public ItemWeaponMF setBaseDamage(float baseDamage) { + this.baseDamage = baseDamage; + return this; + } + + /** + * Gets a stack-sensitive value for the melee dmg + */ + protected float getMeleeDamage(ItemStack item) { + return baseDamage + CustomToolHelper.getMeleeDamage(item, material.getDamageVsEntity()); + } + + protected float getWeightModifier(ItemStack stack) { + return CustomToolHelper.getWeightModifier(stack, materialWeight); + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) - { - if(isCustom) - { - haftTex = reg.registerIcon(this.getIconString()+"_haft"); - detailTex = reg.registerIcon(this.getIconString()+"_detail"); - - } - super.registerIcons(reg); + public void registerIcons(IIconRegister reg) { + if (isCustom) { + haftTex = reg.registerIcon(this.getIconString() + "_haft"); + detailTex = reg.registerIcon(this.getIconString() + "_detail"); + + } + super.registerIcons(reg); } + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { + public boolean requiresMultipleRenderPasses() { return isCustom; } - //Returns the number of render passes this item has. + + // Returns the number of render passes this item has. @Override - public int getRenderPasses(int metadata) - { + public int getRenderPasses(int metadata) { return 3; } - + @Override - public IIcon getIcon(ItemStack stack, int pass) - { - if(isCustom && pass == 1 && haftTex != null) - { - return haftTex; - } - if(isCustom && pass == 2 && detailTex != null) - { - return detailTex; - } + public IIcon getIcon(ItemStack stack, int pass) { + if (isCustom && pass == 1 && haftTex != null) { + return haftTex; + } + if (isCustom && pass == 2 && detailTex != null) { + return detailTex; + } return super.getIcon(stack, pass); } + @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack item, int layer) - { - return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); - } - @Override - public int getMaxDamage(ItemStack stack) - { - return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); - } - public ItemStack construct(String main, String haft) - { - return CustomToolHelper.construct(this, main, haft); - } - protected int itemRarity; - @Override - public EnumRarity getRarity(ItemStack item) - { - return CustomToolHelper.getRarity(item, itemRarity); - } + public int getColorFromItemStack(ItemStack item, int layer) { + return CustomToolHelper.getColourFromItemStack(item, layer, super.getColorFromItemStack(item, layer)); + } + + @Override + public int getMaxDamage(ItemStack stack) { + return CustomToolHelper.getMaxDamage(stack, super.getMaxDamage(stack)); + } + + public ItemStack construct(String main, String haft) { + return CustomToolHelper.construct(this, main, haft); + } + + @Override + public EnumRarity getRarity(ItemStack item) { + return CustomToolHelper.getRarity(item, itemRarity); + } + + // ====================================================== CUSTOM END + // ==============================================================\\ + @Override @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack item) - { - String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; - return CustomToolHelper.getLocalisedName(item, unlocalName); + public String getItemStackDisplayName(ItemStack item) { + String unlocalName = this.getUnlocalizedNameInefficiently(item) + ".name"; + return CustomToolHelper.getLocalisedName(item, unlocalName); + } + + public ItemWeaponMF setTab(CreativeTabs tab) { + setCreativeTab(tab); + return this; + } + + @Override + public float getScale(ItemStack itemstack) { + return 1.0F; + } + + @Override + public float getOffsetX(ItemStack itemstack) { + return 0; + } + + @Override + public float getOffsetY(ItemStack itemstack) { + if (this.getScale(itemstack) > 1.5F) { + return 0.5F; + } + return 0; + } + + @Override + public float getOffsetZ(ItemStack itemstack) { + return 0; + } + + @Override + public float getRotationOffset(ItemStack itemstack) { + return 0; + } + + @Override + public boolean canHang(TileEntityRack rack, ItemStack item, int slot) { + float scale = this.getScale(item); + if (scale > 1.5F && !rack.hasRackBelow(slot)) { + return false; + } + if (scale > 2.5F && !rack.hasRackAbove(slot)) { + return false; + } + return true; + } + + @Override + public boolean isSpecialRender(ItemStack item) { + return false; + } + + @Override + public String getDesign(ItemStack item) { + return designType; } - - //====================================================== CUSTOM END ==============================================================\\ - - public ItemWeaponMF setTab(CreativeTabs tab) - { - setCreativeTab(tab); - return this; - } - - @Override - public float getScale(ItemStack itemstack) - { - return 1.0F; - } - - @Override - public float getOffsetX(ItemStack itemstack) - { - return 0; - } - - @Override - public float getOffsetY(ItemStack itemstack) - { - if(this.getScale(itemstack) > 1.5F) - { - return 0.5F; - } - return 0; - } - - @Override - public float getOffsetZ(ItemStack itemstack) { - return 0; - } - - @Override - public float getRotationOffset(ItemStack itemstack) - { - return 0; - } - - @Override - public boolean canHang(TileEntityRack rack, ItemStack item, int slot) - { - float scale = this.getScale(item); - if(scale > 1.5F && !rack.hasRackBelow(slot)) - { - return false; - } - if(scale > 2.5F && !rack.hasRackAbove(slot)) - { - return false; - } - return true; - } - @Override - public boolean isSpecialRender(ItemStack item) { - return false; - } - - public String designType = "standard"; - @Override - public String getDesign(ItemStack item) - { - return designType; - } } diff --git a/src/main/java/minefantasy/mf2/knowledge/ArtefactListMF.java b/src/main/java/minefantasy/mf2/knowledge/ArtefactListMF.java index 5f960934..6a7fb708 100644 --- a/src/main/java/minefantasy/mf2/knowledge/ArtefactListMF.java +++ b/src/main/java/minefantasy/mf2/knowledge/ArtefactListMF.java @@ -13,157 +13,142 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class ArtefactListMF -{ - public static void init() - { - ((ItemArtefact)ComponentListMF.artefacts).registerAll(); - addArtisanry(); - addConstruction(); - addProvisioning(); - addEngineering(); - } - - private static void addEngineering() - { - add(KnowledgeListMF.blackpowder, ComponentListMF.nitre, ComponentListMF.sulfur, Items.coal, Items.gunpowder); - add(KnowledgeListMF.advblackpowder, Items.glowstone_dust, Items.redstone); - add(KnowledgeListMF.tungsten, ComponentListMF.oreTungsten, BlockListMF.oreTungsten); - add(KnowledgeListMF.coke, Items.coal, Items.redstone); - add(KnowledgeListMF.spyglass, ComponentListMF.bronze_gears, Blocks.glass); - add(KnowledgeListMF.parachute, Items.feather, Blocks.wool); - add(KnowledgeListMF.syringe, Items.potionitem); - add(KnowledgeListMF.engTanner, ComponentListMF.bronze_gears); - add(KnowledgeListMF.bombarrow, Items.feather, ComponentListMF.blackpowder); - add(KnowledgeListMF.bpress, ComponentListMF.bronze_gears, Blocks.lever); - add(KnowledgeListMF.bombs, ComponentListMF.blackpowder, Items.redstone, Items.string); - add(KnowledgeListMF.shrapnel, Items.flint); - add(KnowledgeListMF.firebomb, ComponentListMF.dragon_heart, Items.magma_cream); - add(KnowledgeListMF.stickybomb, Items.slime_ball); - add(KnowledgeListMF.mineCeramic, ComponentListMF.blackpowder, Blocks.stone_pressure_plate); - add(KnowledgeListMF.bombIron, Items.iron_ingot); - add(KnowledgeListMF.mineIron, Items.iron_ingot); - add(KnowledgeListMF.bombObsidian, Blocks.obsidian); - add(KnowledgeListMF.mineObsidian, Blocks.obsidian); - add(KnowledgeListMF.bombCrystal, Items.diamond); - add(KnowledgeListMF.mineCrystal, Items.diamond); - - add(KnowledgeListMF.crossbows, Items.string, ComponentListMF.plank, Blocks.lever); - add(KnowledgeListMF.crossShaftAdvanced, ComponentListMF.tungsten_gears); - add(KnowledgeListMF.crossHeadAdvanced, ComponentListMF.tungsten_gears); - add(KnowledgeListMF.crossAmmo, ComponentListMF.tungsten_gears); - add(KnowledgeListMF.crossScope, ToolListMF.spyglass); - add(KnowledgeListMF.crossBayonet, CustomToolListMF.standard_dagger); - } - - private static void addProvisioning() - { - add(KnowledgeListMF.jerky, FoodListMF.generic_meat_uncooked); - add(KnowledgeListMF.saussage, FoodListMF.generic_meat_uncooked, FoodListMF.guts); - add(KnowledgeListMF.sandwitch, FoodListMF.generic_meat_uncooked, FoodListMF.cheese_slice, Items.bread); - add(KnowledgeListMF.sandwitchBig, FoodListMF.generic_meat_uncooked, FoodListMF.cheese_slice, Items.bread); - - add(KnowledgeListMF.meatpie, FoodListMF.generic_meat_uncooked, FoodListMF.pastry); - add(KnowledgeListMF.shepardpie, FoodListMF.generic_meat_uncooked, Items.potato, FoodListMF.pastry); - add(KnowledgeListMF.berrypie, FoodListMF.berries, FoodListMF.pastry); - add(KnowledgeListMF.applepie, Items.apple, FoodListMF.pastry); - - add(KnowledgeListMF.sweetroll, Items.sugar, FoodListMF.berries, FoodListMF.sugarpot); - add(KnowledgeListMF.eclair, Items.egg, new ItemStack(Items.dye, 1, 3), FoodListMF.pastry); - add(KnowledgeListMF.cheeseroll, Items.bread, FoodListMF.cheese_slice); - - add(KnowledgeListMF.cake, FoodListMF.flour, Items.egg); - add(KnowledgeListMF.carrotcake, FoodListMF.flour, Items.egg, Items.carrot); - add(KnowledgeListMF.chococake, FoodListMF.flour, Items.egg, new ItemStack(Items.dye, 1, 3)); - add(KnowledgeListMF.bfcake, FoodListMF.flour, Items.egg, new ItemStack(Items.dye, 1, 3), FoodListMF.berriesJuicy); - - add(KnowledgeListMF.bandageadv, Blocks.wool, Items.leather); - } - - private static void addConstruction() - { - add(KnowledgeListMF.refined_planks, ComponentListMF.nail); - add(KnowledgeListMF.clay_wall, Items.clay_ball, ComponentListMF.nail); - add(KnowledgeListMF.paint_brush, Blocks.wool); - add(KnowledgeListMF.decorated_stone, Items.iron_ingot, BlockListMF.reinforced_stone); - add(KnowledgeListMF.bed_roll, Items.bed); - add(KnowledgeListMF.ammo_box, Blocks.chest); - add(KnowledgeListMF.big_box, Blocks.chest); - - } - - private static void addArtisanry() - { - for(ItemStack copper: OreDictionary.getOres("ingotCopper")) - { - for(ItemStack tin: OreDictionary.getOres("ingotTin")) - { - add(KnowledgeListMF.smeltBronze, copper, tin); - } - } - add(KnowledgeListMF.coalflux, Items.coal, ComponentListMF.flux); - add(KnowledgeListMF.smeltIron, Blocks.iron_ore); - add(KnowledgeListMF.crucible2, ComponentListMF.fireclay); - add(KnowledgeListMF.blastfurn, Items.iron_ingot, Blocks.iron_ore, Blocks.furnace, BlockListMF.bloomery, BlockListMF.limestone, ComponentListMF.kaolinite); - add(KnowledgeListMF.bigfurn, Items.iron_ingot, Blocks.furnace, BlockListMF.bloomery, ComponentListMF.kaolinite, Items.coal); - for(ItemStack pig: OreDictionary.getOres("ingotRefinedIron")) - { - add(KnowledgeListMF.smeltSteel, pig); - } - for(ItemStack steel: OreDictionary.getOres("ingotSteel")) - { - add(KnowledgeListMF.encrusted, steel, Items.diamond); - add(KnowledgeListMF.obsidian, steel, Blocks.obsidian); - for(ItemStack bronze: OreDictionary.getOres("ingotBronze")) - { - add(KnowledgeListMF.smeltBlackSteel, Blocks.obsidian, bronze, steel); - } - } - for(ItemStack black: OreDictionary.getOres("ingotBlackSteel")) - { - for(ItemStack silver: OreDictionary.getOres("ingotSilver")) - { - add(KnowledgeListMF.smeltBlueSteel, Items.blaze_powder, silver, black, new ItemStack(Items.dye, 1, 4), ComponentListMF.flux_strong); - } - add(KnowledgeListMF.smeltRedSteel, Items.blaze_powder, Items.gold_ingot, Items.redstone, black, ComponentListMF.flux_strong); - } - - - for(ItemStack silver: OreDictionary.getOres("ingotSilver")) - { - add(KnowledgeListMF.smeltMithril, BlockListMF.oreMythic, silver); - } - add(KnowledgeListMF.smeltAdamant, BlockListMF.oreMythic, Items.gold_ingot); - - for(ItemStack mithril: OreDictionary.getOres("ingotMithril")) - { - add(KnowledgeListMF.smeltMithium, mithril, Items.ghast_tear, Items.diamond); - for(ItemStack adamant: OreDictionary.getOres("ingotAdamantium")) - { - add(KnowledgeListMF.smeltIgnotumite, adamant, Items.emerald, Items.blaze_powder); - add(KnowledgeListMF.smeltEnderforge, adamant, mithril, Items.ender_pearl); - } - } - add(KnowledgeListMF.craftArmourMedium, Items.leather); - add(KnowledgeListMF.craftArmourHeavy, Items.leather, Blocks.wool, Items.feather); - add(KnowledgeListMF.smeltDragonforge, ComponentListMF.dragon_heart); - - add(KnowledgeListMF.craftOrnate, new ItemStack(Items.dye, 1, 4)); - - - add(KnowledgeListMF.arrowsBodkin, Items.feather); - add(KnowledgeListMF.arrowsBroad, Items.feather, Items.flint); - - add(KnowledgeListMF.repair_basic, Items.leather, Items.flint, ComponentListMF.nail); - add(KnowledgeListMF.repair_advanced, BlockListMF.repair_basic, Items.slime_ball, Items.string); - add(KnowledgeListMF.repair_ornate, Items.diamond, Items.gold_ingot, BlockListMF.repair_advanced); - } - - private static void add(InformationBase info, Object... artifacts) - { - for(Object artifact : artifacts) - { - ResearchArtefacts.addArtefact(artifact, info); - } - } +public class ArtefactListMF { + public static void init() { + ((ItemArtefact) ComponentListMF.artefacts).registerAll(); + addArtisanry(); + addConstruction(); + addProvisioning(); + addEngineering(); + } + + private static void addEngineering() { + add(KnowledgeListMF.blackpowder, ComponentListMF.nitre, ComponentListMF.sulfur, Items.coal, Items.gunpowder); + add(KnowledgeListMF.advblackpowder, Items.glowstone_dust, Items.redstone); + add(KnowledgeListMF.tungsten, ComponentListMF.oreTungsten, BlockListMF.oreTungsten); + add(KnowledgeListMF.coke, Items.coal, Items.redstone); + add(KnowledgeListMF.spyglass, ComponentListMF.bronze_gears, Blocks.glass); + add(KnowledgeListMF.parachute, Items.feather, Blocks.wool); + add(KnowledgeListMF.syringe, Items.potionitem); + add(KnowledgeListMF.engTanner, ComponentListMF.bronze_gears); + add(KnowledgeListMF.bombarrow, Items.feather, ComponentListMF.blackpowder); + add(KnowledgeListMF.bpress, ComponentListMF.bronze_gears, Blocks.lever); + add(KnowledgeListMF.bombs, ComponentListMF.blackpowder, Items.redstone, Items.string); + add(KnowledgeListMF.shrapnel, Items.flint); + add(KnowledgeListMF.firebomb, ComponentListMF.dragon_heart, Items.magma_cream); + add(KnowledgeListMF.stickybomb, Items.slime_ball); + add(KnowledgeListMF.mineCeramic, ComponentListMF.blackpowder, Blocks.stone_pressure_plate); + add(KnowledgeListMF.bombIron, Items.iron_ingot); + add(KnowledgeListMF.mineIron, Items.iron_ingot); + add(KnowledgeListMF.bombObsidian, Blocks.obsidian); + add(KnowledgeListMF.mineObsidian, Blocks.obsidian); + add(KnowledgeListMF.bombCrystal, Items.diamond); + add(KnowledgeListMF.mineCrystal, Items.diamond); + + add(KnowledgeListMF.crossbows, Items.string, ComponentListMF.plank, Blocks.lever); + add(KnowledgeListMF.crossShaftAdvanced, ComponentListMF.tungsten_gears); + add(KnowledgeListMF.crossHeadAdvanced, ComponentListMF.tungsten_gears); + add(KnowledgeListMF.crossAmmo, ComponentListMF.tungsten_gears); + add(KnowledgeListMF.crossScope, ToolListMF.spyglass); + add(KnowledgeListMF.crossBayonet, CustomToolListMF.standard_dagger); + } + + private static void addProvisioning() { + add(KnowledgeListMF.jerky, FoodListMF.generic_meat_uncooked); + add(KnowledgeListMF.saussage, FoodListMF.generic_meat_uncooked, FoodListMF.guts); + add(KnowledgeListMF.sandwitch, FoodListMF.generic_meat_uncooked, FoodListMF.cheese_slice, Items.bread); + add(KnowledgeListMF.sandwitchBig, FoodListMF.generic_meat_uncooked, FoodListMF.cheese_slice, Items.bread); + + add(KnowledgeListMF.meatpie, FoodListMF.generic_meat_uncooked, FoodListMF.pastry); + add(KnowledgeListMF.shepardpie, FoodListMF.generic_meat_uncooked, Items.potato, FoodListMF.pastry); + add(KnowledgeListMF.berrypie, FoodListMF.berries, FoodListMF.pastry); + add(KnowledgeListMF.applepie, Items.apple, FoodListMF.pastry); + + add(KnowledgeListMF.sweetroll, Items.sugar, FoodListMF.berries, FoodListMF.sugarpot); + add(KnowledgeListMF.eclair, Items.egg, new ItemStack(Items.dye, 1, 3), FoodListMF.pastry); + add(KnowledgeListMF.cheeseroll, Items.bread, FoodListMF.cheese_slice); + + add(KnowledgeListMF.cake, FoodListMF.flour, Items.egg); + add(KnowledgeListMF.carrotcake, FoodListMF.flour, Items.egg, Items.carrot); + add(KnowledgeListMF.chococake, FoodListMF.flour, Items.egg, new ItemStack(Items.dye, 1, 3)); + add(KnowledgeListMF.bfcake, FoodListMF.flour, Items.egg, new ItemStack(Items.dye, 1, 3), + FoodListMF.berriesJuicy); + + add(KnowledgeListMF.bandageadv, Blocks.wool, Items.leather); + } + + private static void addConstruction() { + add(KnowledgeListMF.refined_planks, ComponentListMF.nail); + add(KnowledgeListMF.clay_wall, Items.clay_ball, ComponentListMF.nail); + add(KnowledgeListMF.paint_brush, Blocks.wool); + add(KnowledgeListMF.decorated_stone, Items.iron_ingot, BlockListMF.reinforced_stone); + add(KnowledgeListMF.bed_roll, Items.bed); + add(KnowledgeListMF.ammo_box, Blocks.chest); + add(KnowledgeListMF.big_box, Blocks.chest); + + } + + private static void addArtisanry() { + for (ItemStack copper : OreDictionary.getOres("ingotCopper")) { + for (ItemStack tin : OreDictionary.getOres("ingotTin")) { + add(KnowledgeListMF.smeltBronze, copper, tin); + } + } + add(KnowledgeListMF.coalflux, Items.coal, ComponentListMF.flux); + add(KnowledgeListMF.smeltIron, Blocks.iron_ore); + add(KnowledgeListMF.crucible2, ComponentListMF.fireclay); + add(KnowledgeListMF.blastfurn, Items.iron_ingot, Blocks.iron_ore, Blocks.furnace, BlockListMF.bloomery, + BlockListMF.limestone, ComponentListMF.kaolinite); + add(KnowledgeListMF.bigfurn, Items.iron_ingot, Blocks.furnace, BlockListMF.bloomery, ComponentListMF.kaolinite, + Items.coal); + for (ItemStack pig : OreDictionary.getOres("ingotPigIron")) { + add(KnowledgeListMF.smeltSteel, pig); + } + for (ItemStack steel : OreDictionary.getOres("ingotSteel")) { + add(KnowledgeListMF.encrusted, steel, Items.diamond); + add(KnowledgeListMF.obsidian, steel, Blocks.obsidian); + for (ItemStack bronze : OreDictionary.getOres("ingotBronze")) { + add(KnowledgeListMF.smeltBlackSteel, Blocks.obsidian, bronze, steel); + } + } + for (ItemStack black : OreDictionary.getOres("ingotBlackSteel")) { + for (ItemStack silver : OreDictionary.getOres("ingotSilver")) { + add(KnowledgeListMF.smeltBlueSteel, Items.blaze_powder, silver, black, new ItemStack(Items.dye, 1, 4), + ComponentListMF.flux_strong); + } + add(KnowledgeListMF.smeltRedSteel, Items.blaze_powder, Items.gold_ingot, Items.redstone, black, + ComponentListMF.flux_strong); + } + + for (ItemStack silver : OreDictionary.getOres("ingotSilver")) { + add(KnowledgeListMF.smeltMithril, BlockListMF.oreMythic, silver); + } + add(KnowledgeListMF.smeltAdamant, BlockListMF.oreMythic, Items.gold_ingot); + + for (ItemStack mithril : OreDictionary.getOres("ingotMithril")) { + add(KnowledgeListMF.smeltMithium, mithril, Items.ghast_tear, Items.diamond); + for (ItemStack adamant : OreDictionary.getOres("ingotAdamantium")) { + add(KnowledgeListMF.smeltIgnotumite, adamant, Items.emerald, Items.blaze_powder); + add(KnowledgeListMF.smeltEnderforge, adamant, mithril, Items.ender_pearl); + } + } + add(KnowledgeListMF.craftArmourMedium, Items.leather); + add(KnowledgeListMF.craftArmourHeavy, Items.leather, Blocks.wool, Items.feather); + add(KnowledgeListMF.smeltDragonforge, ComponentListMF.dragon_heart); + + add(KnowledgeListMF.craftOrnate, new ItemStack(Items.dye, 1, 4)); + + add(KnowledgeListMF.arrowsBodkin, Items.feather); + add(KnowledgeListMF.arrowsBroad, Items.feather, Items.flint); + + add(KnowledgeListMF.repair_basic, Items.leather, Items.flint, ComponentListMF.nail); + add(KnowledgeListMF.repair_advanced, BlockListMF.repair_basic, Items.slime_ball, Items.string); + add(KnowledgeListMF.repair_ornate, Items.diamond, Items.gold_ingot, BlockListMF.repair_advanced); + } + + private static void add(InformationBase info, Object... artifacts) { + for (Object artifact : artifacts) { + ResearchArtefacts.addArtefact(artifact, info); + } + } } diff --git a/src/main/java/minefantasy/mf2/knowledge/KnowledgeListMF.java b/src/main/java/minefantasy/mf2/knowledge/KnowledgeListMF.java index b1c278eb..ab6b5d9b 100644 --- a/src/main/java/minefantasy/mf2/knowledge/KnowledgeListMF.java +++ b/src/main/java/minefantasy/mf2/knowledge/KnowledgeListMF.java @@ -1,9 +1,5 @@ package minefantasy.mf2.knowledge; -import java.util.ArrayList; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import minefantasy.mf2.api.crafting.anvil.IAnvilRecipe; import minefantasy.mf2.api.crafting.carpenter.ICarpenterRecipe; import minefantasy.mf2.api.knowledge.InformationBase; @@ -13,316 +9,132 @@ import minefantasy.mf2.api.refine.Alloy; import minefantasy.mf2.api.rpg.SkillList; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.item.ItemComponentMF; import minefantasy.mf2.item.food.FoodListMF; -import minefantasy.mf2.item.list.ArmourListMF; -import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.item.list.CustomArmourListMF; -import minefantasy.mf2.item.list.CustomToolListMF; -import minefantasy.mf2.item.list.ToolListMF; +import minefantasy.mf2.item.list.*; import minefantasy.mf2.material.MetalMaterial; -import minefantasy.mf2.util.MFLogUtil; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; -public class KnowledgeListMF -{ - public static InformationPage artisanry = InformationList.artisanry; - public static InformationPage construction = InformationList.construction; - public static InformationPage engineering = InformationList.engineering; - public static InformationPage provisioning = InformationList.provisioning; - public static InformationPage mastery = InformationList.mastery; - - - //BASICS -FREE - public static InformationBase carpenter, gettingStarted, salvage, research, talisman, ores, plants, chimney, tanning, commodities, dust, craftCrafters, stamina, combat, craftArmourBasic, craftHCCTools, firemaker, dragons, minotaurs; - public static InformationBase bloomery, crucible, crucible2, smeltCopper, smeltBronze, smeltIron, coalflux, bigfurn, blastfurn, smeltPig, smeltSteel, encrusted, obsidian, smeltBlackSteel, smeltDragonforge, smeltBlueSteel, smeltRedSteel, smeltMithril, smeltAdamant, smeltMaster, smeltMithium, smeltIgnotumite, smeltEnderforge; - public static InformationBase bellows, trough, forge, anvil, bar, apron, craftTools, craftAdvTools, craftWeapons, craftAdvWeapons, arrows, craftOrnate, craftArmourLight, craftArmourMedium, craftArmourHeavy, arrowsBodkin, arrowsBroad, repair_basic, repair_advanced, repair_ornate; - public static InformationBase coke, etools, ecomponents, tungsten, climber, spyglass, parachute, syringe, engTanner, advforge, advcrucible, blackpowder, advblackpowder, bombs, bpress, bombarrow, bombFuse, shrapnel, firebomb, stickybomb, bombCeramic, bombIron, bombObsidian, bombCrystal, mineCeramic, mineIron, mineObsidian, mineCrystal, crossbows, crossShafts, crossHeads, crossHeadAdvanced, crossShaftAdvanced, crossAmmo, crossScope, crossBayonet, cogArmour, compPlate; - public static InformationBase constructionPts, refined_planks, reinforced_stone, clay_wall, glass, brickworks, decorated_stone, bars, thatch, easyRefine, paint_brush, tool_rack, food_box, ammo_box, big_box, bed_roll; - public static InformationBase toughness, fitness, armourpro, parrypro, counteratt, autoparry, scrapper, firstaid, doctor; - public static InformationBase cookingutensil, firepit, generic_meat, stew, jerky, saussage, sandwitch, sandwitchBig, meatpie, shepardpie, bread, oats, salt, jug, berry, icing, sweetroll, eclair, cake, carrotcake, chococake, bfcake, applepie, berrypie, cheese, cheeseroll, bandage, bandageadv; - - public static void init() - { - carpenter = (new InformationBase("carpenter", 0, -3, 0, BlockListMF.carpenter, (InformationBase)null)).registerStat().setUnlocked(); - salvage = (new InformationBase("salvage", 0, -4, 0, BlockListMF.salvage_basic, (InformationBase)null)).registerStat().setUnlocked(); - gettingStarted = (new InformationBase("gettingStarted", 0, 0, 0, Items.book, (InformationBase)null)).registerStat().setUnlocked(); - research = (new InformationBase("research", 1, 1, 0, ToolListMF.researchBook, (InformationBase)null)).registerStat().setUnlocked(); - talisman = (new InformationBase("talisman", 4, 2, 0, ComponentListMF.talisman_lesser, research)).registerStat().setUnlocked(); - ores = (new InformationBase("ores", 1, -2, 0, BlockListMF.oreCopper, (InformationBase)null)).registerStat().setUnlocked(); - plants = (new InformationBase("plants", 1, -3, 0, BlockListMF.log_ironbark, ores)).registerStat().setUnlocked(); - chimney = (new InformationBase("chimney", 0, 2, 0, BlockListMF.chimney_stone, (InformationBase)null)).registerStat().setUnlocked(); - tanning = (new InformationBase("tanning", 0, -2 ,0, Items.leather, (InformationBase)null)).registerStat().setUnlocked().setSpecial(); - commodities = (new InformationBase("commodities", -1 ,-2 ,0, ComponentListMF.nail, (InformationBase)null)).registerStat().setUnlocked(); - dust = (new InformationBase("dust", -1 ,-3 ,0, ComponentListMF.clay_pot, commodities)).registerStat().setUnlocked(); - craftCrafters = (new InformationBase("craftCrafters", -1, 1, 0, CustomToolListMF.standard_hammer, (InformationBase)null)).registerStat().setUnlocked(); - stamina = (new InformationBase("stamina", -3, 1, 0, Items.feather, craftCrafters)).registerStat().setUnlocked(); - combat = (new InformationBase("combat", -5, 2, 0, Items.iron_sword, stamina)).registerStat().setUnlocked(); - craftArmourBasic = (new InformationBase("craftArmourBasic", -5, 0, 5, ArmourListMF.armour(ArmourListMF.leather, 0, 1), combat)).registerStat().setUnlocked(); - firemaker = (new InformationBase("firemaker", 5, 1, 0, Items.flint_and_steel, (InformationBase)null)).registerStat().setUnlocked(); - - dragons = (new InformationBase("dragons", -1, 3, 0, ComponentListMF.dragon_heart, (InformationBase)null)).registerStat().setUnlocked(); - minotaurs = (new InformationBase("minotaurs", 1, 3, 0, Items.beef, (InformationBase)null)).registerStat().setUnlocked(); - - //ARTISANRY -From Not very to the most Expensive - bloomery = (new InformationBase("bloomery", 4, -2, 0, BlockListMF.bloomery, crucible)).registerStat().setPage(artisanry).setUnlocked().setSpecial(); - crucible = (new InformationBase("crucible", 4, 0, 0, BlockListMF.crucible, (InformationBase)null)).registerStat().setPage(artisanry).setUnlocked().setSpecial(); - crucible2 = (new InformationBase("crucible2", 6, 0, 1, BlockListMF.crucibleadv_active, crucible)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 40); - - smeltCopper = (new InformationBase("smeltCopper", 1, 0, 0, ComponentListMF.ingots[0], (InformationBase)null)).registerStat().setPage(artisanry).setUnlocked().setDescriptValues(getMetalTier("copper")); - smeltBronze = (new InformationBase("smeltBronze", 1, 2, 2, ComponentListMF.ingots[2], crucible)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 5).setDescriptValues(getMetalTier("bronze")); - smeltIron = (new InformationBase("smeltIron", 1, 4, 1, Items.iron_ingot, null)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 10).setDescriptValues(getMetalTier("iron")); - coalflux = (new InformationBase("coalflux", 1, 6, 2, ComponentListMF.coal_flux, smeltIron)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 15); - blastfurn = (new InformationBase("blastfurn", 2, 5, 5, BlockListMF.blast_heater_active, smeltIron)).registerStat().setPage(artisanry).setSpecial().addSkill(SkillList.artisanry, 25); - bigfurn = (new InformationBase("bigfurn", 0, 5, 4, BlockListMF.furnace_stone, smeltIron)).registerStat().setPage(artisanry).setSpecial().addSkill(SkillList.artisanry, 10); - smeltPig = (new InformationBase("smeltPig", 3, 3, 0, ComponentListMF.ingots[3], blastfurn)).registerStat().setPage(artisanry).setUnlocked().addSkill(SkillList.artisanry, 25); - smeltSteel = (new InformationBase("smeltSteel", 4, 5, 1, ComponentListMF.ingots[4], smeltPig)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 25).setDescriptValues(getMetalTier("Steel")); - encrusted = (new InformationBase("smeltEncrusted", 6, 5, 2, ComponentListMF.diamond_shards, smeltSteel)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 35).setDescriptValues(getMetalTier("encrusted")); - obsidian = (new InformationBase("smeltObsidian", 6, 3, 2, ComponentListMF.ingots[19], smeltSteel)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 40).setDescriptValues(getMetalTier("obsidian")); - smeltBlackSteel = (new InformationBase("smeltBlackSteel", 4, 7, 3, ComponentListMF.ingots[7], smeltSteel)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 50).setDescriptValues(getMetalTier("blacksteel")); - smeltDragonforge = (new InformationBase("smeltDragonforge", -4, -1, 1, ComponentListMF.dragon_heart, null)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 50); - smeltRedSteel = (new InformationBase("smeltRedSteel", 3, 9, 5, ComponentListMF.ingots[10], smeltBlackSteel)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 65).setDescriptValues(getMetalTier("redsteel")); - smeltBlueSteel = (new InformationBase("smeltBlueSteel", 5, 9, 5, ComponentListMF.ingots[12], smeltBlackSteel)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 65).setDescriptValues(getMetalTier("bluesteel")); - smeltMithril = (new InformationBase("smeltMithril", 5, 12, 3, ComponentListMF.ingots[14], null)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 75).setDescriptValues(getMetalTier("mithril")); - smeltAdamant = (new InformationBase("smeltAdamantium", 3, 12, 3, ComponentListMF.ingots[13], null)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 75).setDescriptValues(getMetalTier("adamantium")); - - smeltMaster = (new InformationBase("smeltMaster", 4, 13, 3, new ItemStack(ComponentListMF.artefacts, 1, 3), (InformationBase)null)).registerStat().setPage(artisanry).setSpecial().addSkill(SkillList.artisanry, 100); - smeltIgnotumite = (new InformationBase("smeltIgnotumite", 2, 15, 3, ComponentListMF.ingots[15], smeltMaster)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 100).setDescriptValues(getMetalTier("ignotumite")); - smeltMithium = (new InformationBase("smeltMithium", 6, 15, 3, ComponentListMF.ingots[16], smeltMaster)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 100).setDescriptValues(getMetalTier("mithium")); - smeltEnderforge = (new InformationBase("smeltEnder", 4, 16, 3, ComponentListMF.ingots[17], smeltMaster)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 100).setDescriptValues(getMetalTier("ender")); - - craftHCCTools = (new InformationBase("craftHCCTools", -1, -2, 0, ToolListMF.pickStone, (InformationBase)null)).registerStat().setPage(artisanry).setUnlocked(); - bellows = (new InformationBase("bellows", 0, -1,0, BlockListMF.bellows, (InformationBase)null)).registerStat().setPage(artisanry).setUnlocked(); - trough = (new InformationBase("trough", 0, -2,0, BlockListMF.trough_wood, bellows)).registerStat().setPage(artisanry).setUnlocked(); - forge = (new InformationBase("forge", 0, 0, 0, BlockListMF.forge, (InformationBase)null)).registerStat().setPage(artisanry).setUnlocked(); - anvil = (new InformationBase("anvil", -1, 0, 0, BlockListMF.anvil[1], forge)).registerStat().setPage(artisanry).setUnlocked().setSpecial(); - bar = (new InformationBase("bar", -1, 2, 0, ComponentListMF.bar, anvil)).registerStat().setPage(artisanry).setUnlocked(); - apron = (new InformationBase("apron", -1, -1, 0, ArmourListMF.leatherapron, anvil)).registerStat().setPage(artisanry).setUnlocked(); - craftTools = (new InformationBase("craftTools", -3, 2, 0, CustomToolListMF.standard_pick, bar)).registerStat().setPage(artisanry).setUnlocked(); - craftAdvTools = (new InformationBase("craftAdvTools", -5, 2, 0, CustomToolListMF.standard_hvypick, craftTools)).registerStat().setPage(artisanry).setUnlocked(); - craftWeapons = (new InformationBase("craftWeapons", -3, 1, 5, CustomToolListMF.standard_sword, bar)).registerStat().setPage(artisanry).setUnlocked(); - craftAdvWeapons = (new InformationBase("craftAdvWeapons", -5, 1, 0, CustomToolListMF.standard_battleaxe, craftWeapons)).registerStat().setPage(artisanry).setUnlocked(); - arrows = (new InformationBase("arrows", -3, 4, 0, CustomToolListMF.standard_arrow, bar)).registerStat().setPage(artisanry).setUnlocked(); - - craftOrnate = (new InformationBase("craftOrnate", -3, -1, 1, ComponentListMF.ornate_items, null)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 35); - craftArmourLight = (new InformationBase("craftArmourLight", -3, 3, 1, ArmourListMF.armour(ArmourListMF.leather, 3, 1), anvil)).registerStat().setPage(artisanry).setUnlocked(); - craftArmourMedium = (new InformationBase("craftArmourMedium", -4, 3, 1, CustomArmourListMF.standard_chain_chest, craftArmourLight)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 0); - craftArmourHeavy = (new InformationBase("craftArmourHeavy", -5, 3, 3, CustomArmourListMF.standard_plate_chest, craftArmourMedium)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 10); - arrowsBodkin = (new InformationBase("arrowsBodkin", -4, 5, 1, CustomToolListMF.standard_arrow_bodkin, arrows)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 10); - arrowsBroad = (new InformationBase("arrowsBroad", -5, 5, 2, CustomToolListMF.standard_arrow_broad, arrows)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 20); - - //ENGINEERING - Highly Expensive - etools = (new InformationBase("etools", 3, 0, 0, CustomToolListMF.standard_spanner, (InformationBase)null)).registerStat().setPage(engineering).setUnlocked(); - ecomponents = (new InformationBase("ecomponents", 5, 0, 0, ComponentListMF.bolt, etools)).registerStat().setPage(engineering).setUnlocked(); - tungsten = (new InformationBase("tungsten", 8, -1, 1, ComponentListMF.ingots[18], ecomponents)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 20).addSkill(SkillList.artisanry, 20); - coke = (new InformationBase("coke", 4, -1, 2, ComponentListMF.coke, ecomponents)).registerStat().setPage(engineering); - climber = (new InformationBase("climber", 7, 0, 1, ToolListMF.climbing_pick_basic, ecomponents)).registerStat().setPage(engineering).setUnlocked(); - spyglass = (new InformationBase("spyglass", 8, 1, 2, new ItemStack(ToolListMF.spyglass, 1, 2), climber)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 5); - parachute = (new InformationBase("parachute", 9, 2, 2, ToolListMF.parachute, climber)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 10); - syringe = (new InformationBase("syringe", 5, -2, 1, ToolListMF.syringe_empty, ecomponents)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 25); - engTanner = (new InformationBase("engTanner", 5, 2, 1, BlockListMF.engTanner, ecomponents)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 40).addSkill(SkillList.artisanry, 25); - advcrucible = (new InformationBase("advcrucible", 7, 3, 1, BlockListMF.crucibleauto, engTanner)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 50).addSkill(SkillList.artisanry, 35); - advforge = (new InformationBase("advforge", 9, 3, 1, BlockListMF.forge_metal, advcrucible)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 75).addSkill(SkillList.artisanry, 50); - - blackpowder = (new InformationBase("blackpowder", 0, 0, 4, ComponentListMF.blackpowder, (InformationBase)null)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 0); - advblackpowder = (new InformationBase("advblackpowder", 2, -2, 2, ComponentListMF.blackpowder_advanced, blackpowder)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 50); - bombs = (new InformationBase("bombs", 0, 2, 3, ToolListMF.bomb_custom, blackpowder)).registerStat().setPage(engineering).setSpecial().addSkill(SkillList.engineering, 10); - bpress = (new InformationBase("bpress", -1, 1, 2, BlockListMF.bombPress, bombs)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 30); - bombarrow = (new InformationBase("bombarrow", 1, 1, 2, ToolListMF.exploding_arrow, bombs)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 40); - bombFuse = (new InformationBase("bombFuse", 2, 2, 0, ComponentListMF.bomb_fuse, bombs)).registerStat().setUnlocked().setPage(engineering); - shrapnel = (new InformationBase("shrapnel", 0, 4, 1, ComponentListMF.shrapnel, bombs)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 25); - firebomb = (new InformationBase("firebomb", 0, 6, 2, Items.blaze_powder, shrapnel)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 85); - stickybomb = (new InformationBase("stickybomb", -2, 2, 1, Items.slime_ball, bombs)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 50); - bombCeramic = (new InformationBase("bombCeramic", 2, 3, 0, ComponentListMF.bomb_casing, bombs)).registerStat().setUnlocked().setPage(engineering); - bombIron = (new InformationBase("bombIron", 4, 5, 1, ComponentListMF.bomb_casing_iron, bombCeramic)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 20); - bombObsidian = (new InformationBase("bombObsidian", 4, 7, 2, ComponentListMF.bomb_casing_obsidian, bombIron)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 35); - bombCrystal = (new InformationBase("bombCrystal", 2, 9, 1, ComponentListMF.bomb_casing_crystal, bombObsidian)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 40); - mineCeramic = (new InformationBase("mineCeramic", -2, 3, 2, ComponentListMF.mine_casing, bombs)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 15); - mineIron = (new InformationBase("mineIron", -4, 5, 1, ComponentListMF.mine_casing_iron, mineCeramic)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 20); - mineObsidian = (new InformationBase("mineObsidian", -4, 7, 2, ComponentListMF.mine_casing_obsidian, mineIron)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 35); - mineCrystal = (new InformationBase("mineCrystal", -2, 9, 1, ComponentListMF.mine_casing_crystal, mineObsidian)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 40); - - crossbows = (new InformationBase("crossbows", -4, 0, 3, BlockListMF.crossbowBench, null)).registerStat().setPage(engineering).setSpecial().addSkill(SkillList.engineering, 0); - crossShafts = (new InformationBase("crossShafts", -6, 2, 0, ComponentListMF.crossbow_stock_wood, crossbows)).registerStat().setPage(engineering).setUnlocked(); - crossShaftAdvanced = (new InformationBase("crossShaftAdvanced", -6, 4, 2, ComponentListMF.crossbow_stock_iron, crossShafts)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 40); - crossHeads = (new InformationBase("crossHeads", -2, -2, 0, ComponentListMF.cross_arms_basic, crossbows)).registerStat().setPage(engineering).setUnlocked(); - crossHeadAdvanced = (new InformationBase("crossHeadAdvanced", -3, -3, 2, ComponentListMF.cross_arms_advanced, crossHeads)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 30); - crossBayonet = (new InformationBase("crossBayonet", -1, -3, 1, ComponentListMF.cross_bayonet, crossHeads)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 10); - crossAmmo = (new InformationBase("crossAmmo", -5, 3, 1, ComponentListMF.cross_ammo, crossShafts)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 30); - crossScope = (new InformationBase("crossScope", -7, 3, 1, ComponentListMF.cross_scope, crossShafts)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 20); - - cogArmour = (new InformationBase("cogArmour", 8, -3, 2, BlockListMF.cogwork_helm, tungsten)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 60); - compPlate = (new InformationBase("compPlate", 10, -3, 1, ComponentListMF.ingotCompositeAlloy, tungsten)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 50).addSkill(SkillList.artisanry, 40); - - repair_basic = (new InformationBase("repair_basic", 8, 0, 2, BlockListMF.repair_basic, (InformationBase)null)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 10); - repair_advanced = (new InformationBase("repair_advanced", 10, 0, 3, BlockListMF.repair_advanced, repair_basic)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 25); - repair_ornate = (new InformationBase("repair_ornate", 12, 2, 3, BlockListMF.repair_ornate, repair_advanced)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 50); - - constructionPts = (new InformationBase("constructionPts", 0, 0, 0, ComponentListMF.plank_cut, (InformationBase)null)).registerStat().setPage(construction).setUnlocked(); - reinforced_stone = (new InformationBase("reinforced_stone", 1, 0, 0, BlockListMF.reinforced_stone, (InformationBase)null)).registerStat().setPage(construction).setUnlocked(); - glass = (new InformationBase("glass", 0, 1, 0, BlockListMF.framed_glass, (InformationBase)null)).registerStat().setPage(construction).setUnlocked(); - brickworks = (new InformationBase("brickworks", 3, 0, 0, BlockListMF.cobble_brick, reinforced_stone)).registerStat().setPage(construction).setUnlocked(); - bars = (new InformationBase("bars", 0, 3, 0, BlockListMF.bars[2], glass)).registerStat().setPage(construction).setUnlocked(); - thatch = (new InformationBase("thatch", 0, -3, 0, BlockListMF.thatch, clay_wall)).registerStat().setPage(construction).setUnlocked(); - refined_planks = (new InformationBase("refined_planks", -1, 0, 1, BlockListMF.refined_planks, (InformationBase)null)).registerStat().setPage(construction).addSkill(SkillList.construction, 0); - clay_wall = (new InformationBase("clay_wall", 0, -1, 2, BlockListMF.clayWall, (InformationBase)null)).registerStat().setPage(construction).addSkill(SkillList.construction, 5); - paint_brush = (new InformationBase("paint_brush", -3, 0, 1, ToolListMF.paint_brush, refined_planks)).registerStat().setPage(construction).addSkill(SkillList.construction, 10); - decorated_stone = (new InformationBase("decorated_stone", 5, 0, 2, BlockListMF.reinforced_stone_framed, brickworks)).registerStat().setPage(construction).addSkill(SkillList.construction, 15); - - bed_roll = (new InformationBase("bed_roll", 2, 3, 1, ToolListMF.bedroll, (InformationBase)null)).registerStat().setPage(construction).setUnlocked(); - tool_rack = (new InformationBase("tool_rack", 2, 2, 0, BlockListMF.rack_wood, (InformationBase)null)).registerStat().setPage(construction).setUnlocked(); - food_box = (new InformationBase("food_box", 2, 4, 1, BlockListMF.food_box_basic, tool_rack)).registerStat().setPage(construction).setUnlocked(); - ammo_box = (new InformationBase("ammo_box", 4, 4, 1, BlockListMF.ammo_box_basic, food_box)).registerStat().setPage(construction).addSkill(SkillList.construction, 15); - big_box = (new InformationBase("big_box", 6, 4, 1, BlockListMF.crate_basic, ammo_box)).registerStat().setPage(construction).addSkill(SkillList.construction, 25); - - //COOKING -The Cheapest - cookingutensil = (new InformationBase("cookingutensil",-1, 0, 0, FoodListMF.pie_tray, (InformationBase)null)).registerStat().setPage(provisioning).setUnlocked(); - firepit = (new InformationBase("firepit", 0, 0, 0, BlockListMF.firepit, (InformationBase)null)).registerStat().setPage(provisioning).setUnlocked(); - - generic_meat = (new InformationBase("generic_meat", 0, -1, 0, FoodListMF.generic_meat_uncooked, (InformationBase)null)).registerStat().setPage(provisioning).setUnlocked(); - stew = (new InformationBase("stew", 0, -3, 0, FoodListMF.stew, generic_meat)).registerStat().setPage(provisioning).setUnlocked(); - jerky = (new InformationBase("jerky", 0, -5, 1, FoodListMF.jerky, stew)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 10); - saussage = (new InformationBase("saussage", 2, -5, 2, FoodListMF.saussage_cooked, jerky)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 35); - sandwitch = (new InformationBase("sandwitch", 1, -7, 3, FoodListMF.sandwitch_meat, jerky)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 15); - sandwitchBig = (new InformationBase("sandwitchBig", 3, -7, 3, FoodListMF.sandwitch_big, sandwitch)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 25); - meatpie = (new InformationBase("meatpie", -1, -7, 2, BlockListMF.pie_meat, jerky)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 35); - shepardpie = (new InformationBase("shepardpie", -2, -9, 3, BlockListMF.pie_shepards, meatpie)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 80); - bread = (new InformationBase("bread", 1, 0, 0, FoodListMF.breadroll, (InformationBase)null)).registerStat().setPage(provisioning).setUnlocked(); - oats = (new InformationBase("oats", 3, 0, 0, FoodListMF.oats, bread)).registerStat().setPage(provisioning).setUnlocked(); - - salt = (new InformationBase("salt", -2, -2, 0, FoodListMF.salt, (InformationBase)null)).registerStat().setPage(provisioning).setUnlocked(); - jug = (new InformationBase("jug", -1, -2, 0, FoodListMF.jug_water, (InformationBase)null)).registerStat().setPage(provisioning).setUnlocked(); - berry = (new InformationBase("berry", 0, 1, 0, FoodListMF.berries, (InformationBase)null)).registerStat().setPage(provisioning).setUnlocked(); - icing = (new InformationBase("icing", -1, 2, 0, FoodListMF.icing, berry)).registerStat().setPage(provisioning).setUnlocked(); - sweetroll = (new InformationBase("sweetroll", 0, 3, 2, FoodListMF.sweetroll, berry)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 15); - eclair = (new InformationBase("eclair", 2, 3, 3, FoodListMF.eclair, sweetroll)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 75); - cake = (new InformationBase("cake", 0, 5, 2, BlockListMF.cake_vanilla, sweetroll)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 25); - carrotcake = (new InformationBase("carrotcake", -1, 7, 3, BlockListMF.cake_carrot, cake)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 40); - chococake = (new InformationBase("chococake", 1, 7, 3, BlockListMF.cake_chocolate, cake)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 40); - bfcake = (new InformationBase("bfcake", 1, 9, 4, BlockListMF.cake_bf, chococake)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 90); - berrypie = (new InformationBase("berrypie", 2, 1, 2, BlockListMF.pie_berry, berry)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 20); - applepie = (new InformationBase("applepie", 4, 1, 2, BlockListMF.pie_apple, berrypie)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 30); - - cheese = (new InformationBase("cheese", 1, -1, 0, BlockListMF.cheese_wheel, (InformationBase)null)).registerStat().setPage(provisioning).setUnlocked(); - cheeseroll = (new InformationBase("cheeseroll", 3, -1, 2, FoodListMF.cheese_roll, cheese)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 15); - - bandage = (new InformationBase("bandage", -3, 0, 0, ToolListMF.bandage_wool, (InformationBase)null)).registerStat().setPage(provisioning).setUnlocked(); - bandageadv = (new InformationBase("bandageadv", -5, -1, 2, ToolListMF.bandage_tough, bandage)).registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 40); - - //MASTERY - toughness = (new InformationBase("toughness", -1, 0, 0, CustomArmourListMF.standard_plate_helmet, (InformationBase)null)).registerStat().setPage(mastery).addSkill(SkillList.combat, 10).setPerk(); - fitness = (new InformationBase("fitness", 1, 0, 0, ComponentListMF.dragon_heart, (InformationBase)null)).registerStat().setPage(mastery).addSkill(SkillList.combat, 20).setPerk(); - armourpro = (new InformationBase("armourpro", 2, -1, 0, Items.diamond_chestplate, fitness)).registerStat().setPage(mastery).addSkill(SkillList.combat, 60).setPerk(); - parrypro = (new InformationBase("parrypro", -2, -1, 0, Items.iron_sword, toughness)).registerStat().setPage(mastery).addSkill(SkillList.combat, 20).setPerk(); - counteratt = (new InformationBase("counteratt", -1, -2, 0, CustomToolListMF.standard_waraxe, parrypro)).registerStat().setPage(mastery).addSkill(SkillList.combat, 25).setPerk(); - autoparry = (new InformationBase("autoparry", -3, -2, 0, CustomToolListMF.standard_sword, parrypro)).registerStat().setPage(mastery).addSkill(SkillList.combat, 50).setPerk(); - firstaid = (new InformationBase("firstaid", 0, 1, 0, ToolListMF.bandage_wool, (InformationBase)null)).registerStat().setPage(mastery).addSkill(SkillList.provisioning, 25).setPerk(); - doctor = (new InformationBase("doctor", 0, 3, 0, ToolListMF.syringe, firstaid)).registerStat().setPage(mastery).addSkill(SkillList.provisioning, 50).setPerk(); - scrapper = (new InformationBase("scrapper", 0,-1, 0, BlockListMF.salvage_basic, (InformationBase)null)).registerStat().setPage(mastery).addSkill(SkillList.artisanry, 35).setPerk(); - - } - private static Object getMetalTier(String string) - { - CustomMaterial mat = MetalMaterial.getMaterial(string); - if(mat != null)return mat.crafterTier; - - return "?"; - } - public static IRecipe firepitRecipe, cooktopRecipe, carpenterRecipe, waterJugR, milkJugR, plantOilR, sugarRecipe, stickRecipe, dryrocksR, meatpieOut, shepardOut, cheeseOut, berryOut, appleOut, pumpPieOut; +import java.util.ArrayList; + +public class KnowledgeListMF { public static final ArrayList plankRecipe = new ArrayList(); public static final ArrayList stoneBricksR = new ArrayList(); - - public static IAnvilRecipe hunkR, ingotR, bucketR, crestR; public static final ArrayList barR = new ArrayList(); public static final ArrayList baringotR = new ArrayList(); - public static final ArrayList talismanRecipe = new ArrayList(); - public static ICarpenterRecipe artBookR, conBookR, proBookR, engBookR, comBookR, artBook2R, conBook2R, proBook2R, engBook2R, comBook2R; - public static IAnvilRecipe greatTalismanRecipe; - - public static ICarpenterRecipe fireclayR, fireBrickR, fireBricksR, fireBrickStairR, refinedPlankBlockR, clayWallR, bSalvageR, tannerRecipe, stoneAnvilRecipe, forgeRecipe, apronRecipe, woodTroughRecipe; - public static ICarpenterRecipe researchTableRecipe, framedGlassR, windowR, thatchR, thatchStairR; - public static IAnvilRecipe smokePipeR, framedStoneR, iframedStoneR, fluxR, nailR, rivetR; public static final ArrayList barsR = new ArrayList(); - - public static IAnvilRecipe tinderboxR, flintAndSteelR; - public static ICarpenterRecipe dirtRockR, lStripsR, threadR, stringR, sharpRocksR, stonePickR, stoneAxeR, stoneSpadeR, stoneHoeR, stoneSwordR, stoneWarR, stoneMaceR, stoneSpearR, stoneHammerR, stoneTongsR, boneNeedleR, stoneKnifeR, quernR, stoneovenRecipe; - - public static Alloy[] reStone, bronze, steel, obsidalloy, black, red, blue, mithril, adamantium, ignotumite, mithium, enderforge, wolframiteR; - public static IAnvilRecipe coalfluxR, encrustedR, steelR, obsidianHunkR, diamondR; - public static ICarpenterRecipe nailPlanksR, nailStairR, refinedStairR, strongRackR, bellowsRecipe, bloomeryR, crucibleRecipe, advCrucibleRecipe, trilogyRecipe, chimneyRecipe, wideChimneyRecipe, extractChimneyRecipe; - - public static ICarpenterRecipe hideHelmR, hideChestR, hideLegsR, hideBootsR, roughHelmetR, roughChestR, roughLegsR, roughBootsR, reHelmetR, reChestR, reLegsR, reBootsR; - public static IAnvilRecipe studHelmetR, studChestR, studLegsR, studBootsR; public static final ArrayList mailRecipes = new ArrayList(); public static final ArrayList mailHelmetR = new ArrayList(); public static final ArrayList mailChestR = new ArrayList(); public static final ArrayList mailLegsR = new ArrayList(); public static final ArrayList mailBootsR = new ArrayList(); - public static final ArrayList scaleRecipes = new ArrayList(); public static final ArrayList scaleHelmetR = new ArrayList(); public static final ArrayList scaleChestR = new ArrayList(); public static final ArrayList scaleLegsR = new ArrayList(); public static final ArrayList scaleBootsR = new ArrayList(); - public static final ArrayList splintRecipes = new ArrayList(); public static final ArrayList splintHelmetR = new ArrayList(); public static final ArrayList splintChestR = new ArrayList(); public static final ArrayList splintLegsR = new ArrayList(); public static final ArrayList splintBootsR = new ArrayList(); - public static final ArrayList plateRecipes = new ArrayList(); public static final ArrayList plateHelmetR = new ArrayList(); public static final ArrayList plateChestR = new ArrayList(); public static final ArrayList plateLegsR = new ArrayList(); public static final ArrayList plateBootsR = new ArrayList(); - public static final ArrayList ornateWepsR = new ArrayList(); public static final ArrayList advOrnateWepsR = new ArrayList(); - + public static final ArrayList arrowR = new ArrayList(); + public static final ArrayList meatRecipes = new ArrayList(); + public static final ArrayList easyPaintPlank = new ArrayList(); + public static final ArrayList refinedPlankR = new ArrayList(); + public static InformationPage artisanry = InformationList.artisanry; + public static InformationPage construction = InformationList.construction; + public static InformationPage engineering = InformationList.engineering; + public static InformationPage provisioning = InformationList.provisioning; + public static InformationPage mastery = InformationList.mastery; + // BASICS -FREE + public static InformationBase carpenter, gettingStarted, salvage, research, talisman, ores, plants, chimney, + tanning, commodities, dust, craftCrafters, stamina, combat, craftArmourBasic, craftHCCTools, firemaker, + dragons, minotaurs; + public static InformationBase bloomery, crucible, crucible2, smeltCopper, smeltBronze, smeltIron, coalflux, bigfurn, + blastfurn, smeltPig, smeltSteel, encrusted, obsidian, smeltBlackSteel, smeltDragonforge, smeltBlueSteel, + smeltRedSteel, smeltMithril, smeltAdamant, smeltMaster, smeltMithium, smeltIgnotumite, smeltEnderforge, smeltEmerald; + public static InformationBase bellows, trough, forge, anvil, bar, apron, craftTools, craftAdvTools, craftWeapons, + craftAdvWeapons, arrows, craftOrnate, craftArmourLight, craftArmourMedium, craftArmourHeavy, arrowsBodkin, + arrowsBroad, repair_basic, repair_advanced, repair_ornate; + public static InformationBase coke, etools, ecomponents, tungsten, climber, spyglass, parachute, syringe, engTanner, + advforge, advcrucible, blackpowder, advblackpowder, bombs, bpress, bombarrow, bombFuse, shrapnel, firebomb, + stickybomb, bombCeramic, bombIron, bombObsidian, bombCrystal, mineCeramic, mineIron, mineObsidian, + mineCrystal, crossbows, crossShafts, crossHeads, crossHeadAdvanced, crossShaftAdvanced, crossAmmo, + crossScope, crossBayonet, cogArmour, compPlate; + public static InformationBase constructionPts, refined_planks, reinforced_stone, clay_wall, glass, brickworks, + decorated_stone, bars, thatch, easyRefine, paint_brush, tool_rack, food_box, ammo_box, big_box, bed_roll; + public static InformationBase toughness, fitness, armourpro, parrypro, counteratt, autoparry, scrapper, firstaid, + doctor; + public static InformationBase cookingutensil, firepit, generic_meat, stew, jerky, saussage, sandwitch, sandwitchBig, + meatpie, shepardpie, bread, oats, salt, jug, berry, icing, sweetroll, eclair, cake, carrotcake, chococake, + bfcake, applepie, berrypie, cheese, cheeseroll, bandage, bandageadv; + public static IRecipe firepitRecipe, cooktopRecipe, carpenterRecipe, waterJugR, milkJugR, plantOilR, sugarRecipe, + stickRecipe, dryrocksR, meatpieOut, shepardOut, cheeseOut, berryOut, appleOut, pumpPieOut; + public static IAnvilRecipe hunkR, ingotR, bucketR, crestR; + public static ICarpenterRecipe artBookR, conBookR, proBookR, engBookR, comBookR, artBook2R, conBook2R, proBook2R, + engBook2R, comBook2R; + public static IAnvilRecipe greatTalismanRecipe; + public static ICarpenterRecipe fireclayR, fireBrickR, fireBricksR, fireBrickStairR, refinedPlankBlockR, clayWallR, + bSalvageR, tannerRecipe, stoneAnvilRecipe, forgeRecipe, apronRecipe, woodTroughRecipe; + public static ICarpenterRecipe researchTableRecipe, framedGlassR, windowR, thatchR, thatchStairR; + public static IAnvilRecipe smokePipeR, framedStoneR, iframedStoneR, fluxR, nailR, rivetR; + public static IAnvilRecipe tinderboxR, flintAndSteelR, dwarvenfuelR; + public static ICarpenterRecipe dirtRockR, lStripsR, threadR, stringR, sharpRocksR, stonePickR, stoneAxeR, + stoneSpadeR, stoneHoeR, stoneSwordR, stoneWarR, stoneMaceR, stoneSpearR, stoneHammerR, stoneTongsR, + boneNeedleR, stoneKnifeR, quernR, stoneovenRecipe; + public static Alloy[] reStone, bronze, steel, obsidalloy, black, red, blue, mithril, adamantium, ignotumite, + mithium, enderforge, wolframiteR, dwarfsteel, emerald; + public static IAnvilRecipe coalfluxR, encrustedR, steelR, obsidianHunkR, diamondR, dwarfsteelR, dwarffuelR, emeraldR; + public static ICarpenterRecipe nailPlanksR, nailStairR, refinedStairR, strongRackR, bellowsRecipe, bloomeryR, + crucibleRecipe, advCrucibleRecipe, trilogyRecipe, chimneyRecipe, wideChimneyRecipe, extractChimneyRecipe; + public static ICarpenterRecipe hideHelmR, hideChestR, hideLegsR, hideBootsR, roughHelmetR, roughChestR, roughLegsR, + roughBootsR, reHelmetR, reChestR, reLegsR, reBootsR; + public static IAnvilRecipe studHelmetR, studChestR, studLegsR, studBootsR; public static IAnvilRecipe pickR, axeR, spadeR, hoeR, shearsR; - public static IAnvilRecipe daggerR, swordR, waraxeR, maceR, spearR, bowR, katanaR, gswordR, whammerR, battleaxeR, halbeardR, lanceR; + public static IAnvilRecipe daggerR, swordR, waraxeR, maceR, spearR, bowR, katanaR, gswordR, whammerR, battleaxeR, + halbeardR, lanceR, longswordR, shortswordR, saberR, gladiusR, tridentR, nodachiR, claymoreR; public static IAnvilRecipe trowR, hvyPickR, hvyShovelR, handpickR, scytheR, mattockR, lumberR; public static IAnvilRecipe hammerR, tongsR, hvyHammerR, needleR, sawsR, knifeR, spannerR; public static IAnvilRecipe arrowheadR, bodkinheadR, broadheadR, crossBoltR; - public static ICarpenterRecipe fletchingR, fletchingR2, malletR, spoonR; - public static final ArrayList arrowR = new ArrayList(); - public static IAnvilRecipe ironPrepR, ironPrepR2, coalPrepR; public static IAnvilRecipe blastChamR, blastHeatR, bigFurnR, bigHeatR; - public static ICarpenterRecipe padding[] = new ICarpenterRecipe[4]; public static ICarpenterRecipe repairBasicR, repairAdvancedR, repairOrnateR; public static ICarpenterRecipe spyglassR, bombBenchCraft, bombPressCraft, advancedForgeR, engTannerR, autoCrucibleR; public static ICarpenterRecipe crudeBombR, bombFuseR, longFuseR; - public static ICarpenterRecipe crossBenchCraft, crossStockWoodR, crossStockIronR, crossHandleWoodR, crossHeadLightR, crossHeadMediumR, crossHeadHeavyR, crossHeadAdvancedR, crossAmmoR, crossScopeR; - + public static ICarpenterRecipe crossBenchCraft, crossStockWoodR, crossStockIronR, crossHandleWoodR, crossHeadLightR, + crossHeadMediumR, crossHeadHeavyR, crossHeadAdvancedR, crossAmmoR, crossScopeR; public static ICarpenterRecipe bombCaseCeramicR, mineCaseCeramicR, bombCaseCrystalR, mineCaseCrystalR; public static IAnvilRecipe bombCaseIronR, mineCaseIronR, bombCaseObsidianR, mineCaseObsidianR, crossBayonetR; - - public static final ArrayList meatRecipes = new ArrayList(); public static ICarpenterRecipe meatStripR, meatHunkR, gutsRecipe; public static IAnvilRecipe caketinRecipe; - public static ICarpenterRecipe breadSliceR, pastryRecipe, doughRecipe, breadRecipe, curdRecipe, oatsRecipe, custardRecipe, icingRecipe, stewRecipe, saussageR, jerkyRecipe, meatPieRecipe, sandwitchRecipe, sandwitchBigRecipe, shepardRecipe, sweetrollRecipe, iceSR, eclairDoughR, eclairIceR, eclairFillR; - public static ICarpenterRecipe pumpPieR, simpCakeR, simpCakeOut, berryR, appleR, cheeserollR, cakeR, carrotCakeR, chocoCakeR, bfCakeR, cakeI, carrotCakeI, chocoCakeI, bfCakeI; + public static ICarpenterRecipe breadSliceR, pastryRecipe, doughRecipe, breadRecipe, curdRecipe, oatsRecipe, + custardRecipe, icingRecipe, stewRecipe, saussageR, jerkyRecipe, meatPieRecipe, sandwitchRecipe, + sandwitchBigRecipe, shepardRecipe, sweetrollRecipe, iceSR, eclairDoughR, eclairIceR, eclairFillR; + public static ICarpenterRecipe pumpPieR, simpCakeR, simpCakeOut, berryR, appleR, cheeserollR, cakeR, carrotCakeR, + chocoCakeR, bfCakeR, cakeI, carrotCakeI, chocoCakeI, bfCakeI; public static ICarpenterRecipe syringeR, parachuteR, bandageR, badBandageR, goodBandageR, cogShaftR; - - public static IAnvilRecipe hingeRecipe, brushRecipe, climbPickbR, iframeR, boltR, istrutR, bgearR, tgearR, stubeR, eatoolsR, bombarrowR, bombBoltR, compPlateR; - public static ICarpenterRecipe mouldRecipe, jugRecipe, potRecipe, pieTrayRecipe, blackpowderRec, advblackpowderRec, magmaRefinedR, chocoRecipe, bedrollR; - + + public static IAnvilRecipe hingeRecipe, brushRecipe, climbPickbR, iframeR, boltR, istrutR, bgearR, tgearR, stubeR, + eatoolsR, bombarrowR, bombBoltR, compPlateR; + public static ICarpenterRecipe mouldRecipe, jugRecipe, potRecipe, pieTrayRecipe, blackpowderRec, advblackpowderRec, + magmaRefinedR, chocoRecipe, bedrollR; + public static IAnvilRecipe frameBlockR, cogPulleyR, cogLegsR, cogChestR, cogHelmR; public static ArrayList hugePlateR = new ArrayList(); public static ArrayList cogPlateR = new ArrayList(); - - public static final ArrayList easyPaintPlank = new ArrayList(); - public static final ArrayList refinedPlankR = new ArrayList(); - public static ArrayList sawnPlankR = new ArrayList(); public static ArrayList plankPaneR = new ArrayList(); public static ArrayList rackRecipe = new ArrayList(); @@ -330,4 +142,355 @@ private static Object getMetalTier(String string) public static ArrayList ammoboxR = new ArrayList(); public static ArrayList bigboxR = new ArrayList(); public static ArrayList nailTroughR = new ArrayList(); + + public static void init() { + carpenter = (new InformationBase("carpenter", 0, -3, 0, BlockListMF.carpenter, (InformationBase) null)) + .registerStat().setUnlocked(); + salvage = (new InformationBase("salvage", 0, -4, 0, BlockListMF.salvage_basic, (InformationBase) null)) + .registerStat().setUnlocked(); + gettingStarted = (new InformationBase("gettingStarted", 0, 0, 0, Items.book, (InformationBase) null)) + .registerStat().setUnlocked(); + research = (new InformationBase("research", 1, 1, 0, ToolListMF.researchBook, (InformationBase) null)) + .registerStat().setUnlocked(); + talisman = (new InformationBase("talisman", 4, 2, 0, ComponentListMF.talisman_lesser, research)).registerStat() + .setUnlocked(); + ores = (new InformationBase("ores", 1, -2, 0, BlockListMF.oreCopper, (InformationBase) null)).registerStat() + .setUnlocked(); + plants = (new InformationBase("plants", 1, -3, 0, BlockListMF.log_ironbark, ores)).registerStat().setUnlocked(); + chimney = (new InformationBase("chimney", 0, 2, 0, BlockListMF.chimney_stone, (InformationBase) null)) + .registerStat().setUnlocked(); + tanning = (new InformationBase("tanning", 0, -2, 0, Items.leather, (InformationBase) null)).registerStat() + .setUnlocked().setSpecial(); + commodities = (new InformationBase("commodities", -1, -2, 0, ComponentListMF.nail, (InformationBase) null)) + .registerStat().setUnlocked(); + dust = (new InformationBase("dust", -1, -3, 0, ComponentListMF.clay_pot, commodities)).registerStat() + .setUnlocked(); + craftCrafters = (new InformationBase("craftCrafters", -1, 1, 0, CustomToolListMF.standard_hammer, + (InformationBase) null)).registerStat().setUnlocked(); + stamina = (new InformationBase("stamina", -3, 1, 0, Items.feather, craftCrafters)).registerStat().setUnlocked(); + combat = (new InformationBase("combat", -5, 2, 0, Items.iron_sword, stamina)).registerStat().setUnlocked(); + craftArmourBasic = (new InformationBase("craftArmourBasic", -5, 0, 5, + ArmourListMF.armour(ArmourListMF.leather, 0, 1), combat)).registerStat().setUnlocked(); + firemaker = (new InformationBase("firemaker", 5, 1, 0, Items.flint_and_steel, (InformationBase) null)) + .registerStat().setUnlocked(); + + dragons = (new InformationBase("dragons", -1, 3, 0, ComponentListMF.dragon_heart, (InformationBase) null)) + .registerStat().setUnlocked(); + minotaurs = (new InformationBase("minotaurs", 1, 3, 0, Items.beef, (InformationBase) null)).registerStat() + .setUnlocked(); + + // ARTISANRY -From Not very to the most Expensive + bloomery = (new InformationBase("bloomery", 4, -2, 0, BlockListMF.bloomery, crucible)).registerStat() + .setPage(artisanry).setUnlocked().setSpecial(); + crucible = (new InformationBase("crucible", 4, 0, 0, BlockListMF.crucible, (InformationBase) null)) + .registerStat().setPage(artisanry).setUnlocked().setSpecial(); + crucible2 = (new InformationBase("crucible2", 6, 0, 1, BlockListMF.crucibleadv_active, crucible)).registerStat() + .setPage(artisanry).addSkill(SkillList.artisanry, 40); + + smeltCopper = (new InformationBase("smeltCopper", 1, 0, 0, ComponentListMF.ingots[0], (InformationBase) null)) + .registerStat().setPage(artisanry).setUnlocked().setDescriptValues(getMetalTier("copper")); + smeltBronze = (new InformationBase("smeltBronze", 1, 2, 2, ComponentListMF.ingots[2], crucible)).registerStat() + .setPage(artisanry).addSkill(SkillList.artisanry, 5).setDescriptValues(getMetalTier("bronze")); + smeltIron = (new InformationBase("smeltIron", 1, 4, 1, Items.iron_ingot, null)).registerStat() + .setPage(artisanry).addSkill(SkillList.artisanry, 10).setDescriptValues(getMetalTier("iron")); + coalflux = (new InformationBase("coalflux", 1, 6, 2, ComponentListMF.coal_flux, smeltIron)).registerStat() + .setPage(artisanry).addSkill(SkillList.artisanry, 15); + blastfurn = (new InformationBase("blastfurn", 2, 5, 5, BlockListMF.blast_heater_active, smeltIron)) + .registerStat().setPage(artisanry).setSpecial().addSkill(SkillList.artisanry, 25); + bigfurn = (new InformationBase("bigfurn", 0, 5, 4, BlockListMF.furnace_stone, smeltIron)).registerStat() + .setPage(artisanry).setSpecial().addSkill(SkillList.artisanry, 10); + smeltPig = (new InformationBase("smeltPig", 3, 3, 0, ComponentListMF.ingots[3], blastfurn)).registerStat() + .setPage(artisanry).setUnlocked().addSkill(SkillList.artisanry, 25); + smeltSteel = (new InformationBase("smeltSteel", 4, 5, 1, ComponentListMF.ingots[4], smeltPig)).registerStat() + .setPage(artisanry).addSkill(SkillList.artisanry, 25).setDescriptValues(getMetalTier("Steel")); + encrusted = (new InformationBase("smeltEncrusted", 6, 5, 2, ComponentListMF.diamond_shards, smeltSteel)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 35) + .setDescriptValues(getMetalTier("encrusted")); + obsidian = (new InformationBase("smeltObsidian", 6, 3, 2, ComponentListMF.ingots[19], smeltSteel)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 40) + .setDescriptValues(getMetalTier("obsidian")); + smeltBlackSteel = (new InformationBase("smeltBlackSteel", 4, 7, 3, ComponentListMF.ingots[7], smeltSteel)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 50) + .setDescriptValues(getMetalTier("blacksteel")); + smeltDragonforge = (new InformationBase("smeltDragonforge", -4, -1, 1, ComponentListMF.dragon_heart, null)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 50); + smeltRedSteel = (new InformationBase("smeltRedSteel", 3, 9, 5, ComponentListMF.ingots[10], smeltBlackSteel)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 65) + .setDescriptValues(getMetalTier("redsteel")); + smeltBlueSteel = (new InformationBase("smeltBlueSteel", 5, 9, 5, ComponentListMF.ingots[12], smeltBlackSteel)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 65) + .setDescriptValues(getMetalTier("bluesteel")); + smeltMithril = (new InformationBase("smeltMithril", 5, 12, 3, ComponentListMF.ingots[14], null)).registerStat() + .setPage(artisanry).addSkill(SkillList.artisanry, 75).setDescriptValues(getMetalTier("mithril")); + smeltAdamant = (new InformationBase("smeltAdamantium", 3, 12, 3, ComponentListMF.ingots[13], null)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 75) + .setDescriptValues(getMetalTier("adamantium")); + //new + + + + smeltMaster = (new InformationBase("smeltMaster", 4, 13, 3, new ItemStack(ComponentListMF.artefacts, 1, 3), + (InformationBase) null)).registerStat().setPage(artisanry).setSpecial().addSkill(SkillList.artisanry, + 100); + smeltIgnotumite = (new InformationBase("smeltIgnotumite", 2, 15, 3, ComponentListMF.ingots[15], smeltMaster)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 100) + .setDescriptValues(getMetalTier("ignotumite")); + smeltMithium = (new InformationBase("smeltMithium", 6, 15, 3, ComponentListMF.ingots[16], smeltMaster)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 100) + .setDescriptValues(getMetalTier("mithium")); + smeltEnderforge = (new InformationBase("smeltEnder", 4, 16, 3, ComponentListMF.ingots[17], smeltMaster)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 100) + .setDescriptValues(getMetalTier("ender")); + + craftHCCTools = (new InformationBase("craftHCCTools", -1, -2, 0, ToolListMF.pickStone, (InformationBase) null)) + .registerStat().setPage(artisanry).setUnlocked(); + bellows = (new InformationBase("bellows", 0, -1, 0, BlockListMF.bellows, (InformationBase) null)).registerStat() + .setPage(artisanry).setUnlocked(); + trough = (new InformationBase("trough", 0, -2, 0, BlockListMF.trough_wood, bellows)).registerStat() + .setPage(artisanry).setUnlocked(); + forge = (new InformationBase("forge", 0, 0, 0, BlockListMF.forge, (InformationBase) null)).registerStat() + .setPage(artisanry).setUnlocked(); + anvil = (new InformationBase("anvil", -1, 0, 0, BlockListMF.anvil[1], forge)).registerStat().setPage(artisanry) + .setUnlocked().setSpecial(); + bar = (new InformationBase("bar", -1, 2, 0, ComponentListMF.bar, anvil)).registerStat().setPage(artisanry) + .setUnlocked(); + apron = (new InformationBase("apron", -1, -1, 0, ArmourListMF.leatherapron, anvil)).registerStat() + .setPage(artisanry).setUnlocked(); + craftTools = (new InformationBase("craftTools", -3, 2, 0, CustomToolListMF.standard_pick, bar)).registerStat() + .setPage(artisanry).setUnlocked(); + craftAdvTools = (new InformationBase("craftAdvTools", -5, 2, 0, CustomToolListMF.standard_hvypick, craftTools)) + .registerStat().setPage(artisanry).setUnlocked(); + craftWeapons = (new InformationBase("craftWeapons", -3, 1, 5, CustomToolListMF.standard_sword, bar)) + .registerStat().setPage(artisanry).setUnlocked(); + craftAdvWeapons = (new InformationBase("craftAdvWeapons", -5, 1, 0, CustomToolListMF.standard_battleaxe, + craftWeapons)).registerStat().setPage(artisanry).setUnlocked(); + arrows = (new InformationBase("arrows", -3, 4, 0, CustomToolListMF.standard_arrow, bar)).registerStat() + .setPage(artisanry).setUnlocked(); + + craftOrnate = (new InformationBase("craftOrnate", -3, -1, 1, ComponentListMF.ornate_items, null)).registerStat() + .setPage(artisanry).addSkill(SkillList.artisanry, 35); + craftArmourLight = (new InformationBase("craftArmourLight", -3, 3, 1, + ArmourListMF.armour(ArmourListMF.leather, 3, 1), anvil)).registerStat().setPage(artisanry) + .setUnlocked(); + craftArmourMedium = (new InformationBase("craftArmourMedium", -4, 3, 1, CustomArmourListMF.standard_chain_chest, + craftArmourLight)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 0); + craftArmourHeavy = (new InformationBase("craftArmourHeavy", -5, 3, 3, CustomArmourListMF.standard_plate_chest, + craftArmourMedium)).registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 10); + arrowsBodkin = (new InformationBase("arrowsBodkin", -4, 5, 1, CustomToolListMF.standard_arrow_bodkin, arrows)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 10); + arrowsBroad = (new InformationBase("arrowsBroad", -5, 5, 2, CustomToolListMF.standard_arrow_broad, arrows)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 20); + + // ENGINEERING - Highly Expensive + etools = (new InformationBase("etools", 3, 0, 0, CustomToolListMF.standard_spanner, (InformationBase) null)) + .registerStat().setPage(engineering).setUnlocked(); + ecomponents = (new InformationBase("ecomponents", 5, 0, 0, ComponentListMF.bolt, etools)).registerStat() + .setPage(engineering).setUnlocked(); + tungsten = (new InformationBase("tungsten", 8, -1, 1, ComponentListMF.ingots[18], ecomponents)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 20).addSkill(SkillList.artisanry, 20); + coke = (new InformationBase("coke", 4, -1, 2, ComponentListMF.coke, ecomponents)).registerStat() + .setPage(engineering); + climber = (new InformationBase("climber", 7, 0, 1, ToolListMF.climbing_pick_basic, ecomponents)).registerStat() + .setPage(engineering).setUnlocked(); + spyglass = (new InformationBase("spyglass", 8, 1, 2, new ItemStack(ToolListMF.spyglass, 1, 2), climber)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 5); + parachute = (new InformationBase("parachute", 9, 2, 2, ToolListMF.parachute, climber)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 10); + syringe = (new InformationBase("syringe", 5, -2, 1, ToolListMF.syringe_empty, ecomponents)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 25); + engTanner = (new InformationBase("engTanner", 5, 2, 1, BlockListMF.engTanner, ecomponents)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 40).addSkill(SkillList.artisanry, 25); + advcrucible = (new InformationBase("advcrucible", 7, 3, 1, BlockListMF.crucibleauto, engTanner)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 50).addSkill(SkillList.artisanry, 35); + advforge = (new InformationBase("advforge", 9, 3, 1, BlockListMF.forge_metal, advcrucible)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 75).addSkill(SkillList.artisanry, 50); + + blackpowder = (new InformationBase("blackpowder", 0, 0, 4, ComponentListMF.blackpowder, (InformationBase) null)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 0); + advblackpowder = (new InformationBase("advblackpowder", 2, -2, 2, ComponentListMF.blackpowder_advanced, + blackpowder)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 50); + bombs = (new InformationBase("bombs", 0, 2, 3, ToolListMF.bomb_custom, blackpowder)).registerStat() + .setPage(engineering).setSpecial().addSkill(SkillList.engineering, 10); + bpress = (new InformationBase("bpress", -1, 1, 2, BlockListMF.bombPress, bombs)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 30); + bombarrow = (new InformationBase("bombarrow", 1, 1, 2, ToolListMF.exploding_arrow, bombs)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 40); + bombFuse = (new InformationBase("bombFuse", 2, 2, 0, ComponentListMF.bomb_fuse, bombs)).registerStat() + .setUnlocked().setPage(engineering); + shrapnel = (new InformationBase("shrapnel", 0, 4, 1, ComponentListMF.shrapnel, bombs)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 25); + firebomb = (new InformationBase("firebomb", 0, 6, 2, Items.blaze_powder, shrapnel)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 85); + stickybomb = (new InformationBase("stickybomb", -2, 2, 1, Items.slime_ball, bombs)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 50); + bombCeramic = (new InformationBase("bombCeramic", 2, 3, 0, ComponentListMF.bomb_casing, bombs)).registerStat() + .setUnlocked().setPage(engineering); + bombIron = (new InformationBase("bombIron", 4, 5, 1, ComponentListMF.bomb_casing_iron, bombCeramic)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 20); + bombObsidian = (new InformationBase("bombObsidian", 4, 7, 2, ComponentListMF.bomb_casing_obsidian, bombIron)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 35); + bombCrystal = (new InformationBase("bombCrystal", 2, 9, 1, ComponentListMF.bomb_casing_crystal, bombObsidian)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 40); + mineCeramic = (new InformationBase("mineCeramic", -2, 3, 2, ComponentListMF.mine_casing, bombs)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 15); + mineIron = (new InformationBase("mineIron", -4, 5, 1, ComponentListMF.mine_casing_iron, mineCeramic)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 20); + mineObsidian = (new InformationBase("mineObsidian", -4, 7, 2, ComponentListMF.mine_casing_obsidian, mineIron)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 35); + mineCrystal = (new InformationBase("mineCrystal", -2, 9, 1, ComponentListMF.mine_casing_crystal, mineObsidian)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 40); + + crossbows = (new InformationBase("crossbows", -4, 0, 3, BlockListMF.crossbowBench, null)).registerStat() + .setPage(engineering).setSpecial().addSkill(SkillList.engineering, 0); + crossShafts = (new InformationBase("crossShafts", -6, 2, 0, ComponentListMF.crossbow_stock_wood, crossbows)) + .registerStat().setPage(engineering).setUnlocked(); + crossShaftAdvanced = (new InformationBase("crossShaftAdvanced", -6, 4, 2, ComponentListMF.crossbow_stock_iron, + crossShafts)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 40); + crossHeads = (new InformationBase("crossHeads", -2, -2, 0, ComponentListMF.cross_arms_basic, crossbows)) + .registerStat().setPage(engineering).setUnlocked(); + crossHeadAdvanced = (new InformationBase("crossHeadAdvanced", -3, -3, 2, ComponentListMF.cross_arms_advanced, + crossHeads)).registerStat().setPage(engineering).addSkill(SkillList.engineering, 30); + crossBayonet = (new InformationBase("crossBayonet", -1, -3, 1, ComponentListMF.cross_bayonet, crossHeads)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 10); + crossAmmo = (new InformationBase("crossAmmo", -5, 3, 1, ComponentListMF.cross_ammo, crossShafts)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 30); + crossScope = (new InformationBase("crossScope", -7, 3, 1, ComponentListMF.cross_scope, crossShafts)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 20); + + cogArmour = (new InformationBase("cogArmour", 8, -3, 2, BlockListMF.cogwork_helm, tungsten)).registerStat() + .setPage(engineering).addSkill(SkillList.engineering, 60); + compPlate = (new InformationBase("compPlate", 10, -3, 1, ComponentListMF.ingotCompositeAlloy, tungsten)) + .registerStat().setPage(engineering).addSkill(SkillList.engineering, 50) + .addSkill(SkillList.artisanry, 40); + + repair_basic = (new InformationBase("repair_basic", 8, 0, 2, BlockListMF.repair_basic, (InformationBase) null)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 10); + repair_advanced = (new InformationBase("repair_advanced", 10, 0, 3, BlockListMF.repair_advanced, repair_basic)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 25); + repair_ornate = (new InformationBase("repair_ornate", 12, 2, 3, BlockListMF.repair_ornate, repair_advanced)) + .registerStat().setPage(artisanry).addSkill(SkillList.artisanry, 50); + + constructionPts = (new InformationBase("constructionPts", 0, 0, 0, ComponentListMF.plank_cut, + (InformationBase) null)).registerStat().setPage(construction).setUnlocked(); + reinforced_stone = (new InformationBase("reinforced_stone", 1, 0, 0, BlockListMF.reinforced_stone, + (InformationBase) null)).registerStat().setPage(construction).setUnlocked(); + glass = (new InformationBase("glass", 0, 1, 0, BlockListMF.framed_glass, (InformationBase) null)).registerStat() + .setPage(construction).setUnlocked(); + brickworks = (new InformationBase("brickworks", 3, 0, 0, BlockListMF.cobble_brick, reinforced_stone)) + .registerStat().setPage(construction).setUnlocked(); + bars = (new InformationBase("bars", 0, 3, 0, BlockListMF.bars[2], glass)).registerStat().setPage(construction) + .setUnlocked(); + thatch = (new InformationBase("thatch", 0, -3, 0, BlockListMF.thatch, clay_wall)).registerStat() + .setPage(construction).setUnlocked(); + refined_planks = (new InformationBase("refined_planks", -1, 0, 1, BlockListMF.refined_planks, + (InformationBase) null)).registerStat().setPage(construction).addSkill(SkillList.construction, 0); + clay_wall = (new InformationBase("clay_wall", 0, -1, 2, BlockListMF.clayWall, (InformationBase) null)) + .registerStat().setPage(construction).addSkill(SkillList.construction, 5); + paint_brush = (new InformationBase("paint_brush", -3, 0, 1, ToolListMF.paint_brush, refined_planks)) + .registerStat().setPage(construction).addSkill(SkillList.construction, 10); + decorated_stone = (new InformationBase("decorated_stone", 5, 0, 2, BlockListMF.reinforced_stone_framed, + brickworks)).registerStat().setPage(construction).addSkill(SkillList.construction, 15); + + bed_roll = (new InformationBase("bed_roll", 2, 3, 1, ToolListMF.bedroll, (InformationBase) null)).registerStat() + .setPage(construction).setUnlocked(); + tool_rack = (new InformationBase("tool_rack", 2, 2, 0, BlockListMF.rack_wood, (InformationBase) null)) + .registerStat().setPage(construction).setUnlocked(); + food_box = (new InformationBase("food_box", 2, 4, 1, BlockListMF.food_box_basic, tool_rack)).registerStat() + .setPage(construction).setUnlocked(); + ammo_box = (new InformationBase("ammo_box", 4, 4, 1, BlockListMF.ammo_box_basic, food_box)).registerStat() + .setPage(construction).addSkill(SkillList.construction, 15); + big_box = (new InformationBase("big_box", 6, 4, 1, BlockListMF.crate_basic, ammo_box)).registerStat() + .setPage(construction).addSkill(SkillList.construction, 25); + + // COOKING -The Cheapest + cookingutensil = (new InformationBase("cookingutensil", -1, 0, 0, FoodListMF.pie_tray, (InformationBase) null)) + .registerStat().setPage(provisioning).setUnlocked(); + firepit = (new InformationBase("firepit", 0, 0, 0, BlockListMF.firepit, (InformationBase) null)).registerStat() + .setPage(provisioning).setUnlocked(); + + generic_meat = (new InformationBase("generic_meat", 0, -1, 0, FoodListMF.generic_meat_uncooked, + (InformationBase) null)).registerStat().setPage(provisioning).setUnlocked(); + stew = (new InformationBase("stew", 0, -3, 0, FoodListMF.stew, generic_meat)).registerStat() + .setPage(provisioning).setUnlocked(); + jerky = (new InformationBase("jerky", 0, -5, 1, FoodListMF.jerky, stew)).registerStat().setPage(provisioning) + .addSkill(SkillList.provisioning, 10); + saussage = (new InformationBase("saussage", 2, -5, 2, FoodListMF.saussage_cooked, jerky)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 35); + sandwitch = (new InformationBase("sandwitch", 1, -7, 3, FoodListMF.sandwitch_meat, jerky)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 15); + sandwitchBig = (new InformationBase("sandwitchBig", 3, -7, 3, FoodListMF.sandwitch_big, sandwitch)) + .registerStat().setPage(provisioning).addSkill(SkillList.provisioning, 25); + meatpie = (new InformationBase("meatpie", -1, -7, 2, BlockListMF.pie_meat, jerky)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 35); + shepardpie = (new InformationBase("shepardpie", -2, -9, 3, BlockListMF.pie_shepards, meatpie)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 80); + bread = (new InformationBase("bread", 1, 0, 0, FoodListMF.breadroll, (InformationBase) null)).registerStat() + .setPage(provisioning).setUnlocked(); + oats = (new InformationBase("oats", 3, 0, 0, FoodListMF.oats, bread)).registerStat().setPage(provisioning) + .setUnlocked(); + + salt = (new InformationBase("salt", -2, -2, 0, FoodListMF.salt, (InformationBase) null)).registerStat() + .setPage(provisioning).setUnlocked(); + jug = (new InformationBase("jug", -1, -2, 0, FoodListMF.jug_water, (InformationBase) null)).registerStat() + .setPage(provisioning).setUnlocked(); + berry = (new InformationBase("berry", 0, 1, 0, FoodListMF.berries, (InformationBase) null)).registerStat() + .setPage(provisioning).setUnlocked(); + icing = (new InformationBase("icing", -1, 2, 0, FoodListMF.icing, berry)).registerStat().setPage(provisioning) + .setUnlocked(); + sweetroll = (new InformationBase("sweetroll", 0, 3, 2, FoodListMF.sweetroll, berry)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 15); + eclair = (new InformationBase("eclair", 2, 3, 3, FoodListMF.eclair, sweetroll)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 75); + cake = (new InformationBase("cake", 0, 5, 2, BlockListMF.cake_vanilla, sweetroll)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 25); + carrotcake = (new InformationBase("carrotcake", -1, 7, 3, BlockListMF.cake_carrot, cake)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 40); + chococake = (new InformationBase("chococake", 1, 7, 3, BlockListMF.cake_chocolate, cake)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 40); + bfcake = (new InformationBase("bfcake", 1, 9, 4, BlockListMF.cake_bf, chococake)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 90); + berrypie = (new InformationBase("berrypie", 2, 1, 2, BlockListMF.pie_berry, berry)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 20); + applepie = (new InformationBase("applepie", 4, 1, 2, BlockListMF.pie_apple, berrypie)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 30); + + cheese = (new InformationBase("cheese", 1, -1, 0, BlockListMF.cheese_wheel, (InformationBase) null)) + .registerStat().setPage(provisioning).setUnlocked(); + cheeseroll = (new InformationBase("cheeseroll", 3, -1, 2, FoodListMF.cheese_roll, cheese)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 15); + + bandage = (new InformationBase("bandage", -3, 0, 0, ToolListMF.bandage_wool, (InformationBase) null)) + .registerStat().setPage(provisioning).setUnlocked(); + bandageadv = (new InformationBase("bandageadv", -5, -1, 2, ToolListMF.bandage_tough, bandage)).registerStat() + .setPage(provisioning).addSkill(SkillList.provisioning, 40); + + // MASTERY + toughness = (new InformationBase("toughness", -1, 0, 0, CustomArmourListMF.standard_plate_helmet, + (InformationBase) null)).registerStat().setPage(mastery).addSkill(SkillList.combat, 10).setPerk(); + fitness = (new InformationBase("fitness", 1, 0, 0, ComponentListMF.dragon_heart, (InformationBase) null)) + .registerStat().setPage(mastery).addSkill(SkillList.combat, 20).setPerk(); + armourpro = (new InformationBase("armourpro", 2, -1, 0, Items.diamond_chestplate, fitness)).registerStat() + .setPage(mastery).addSkill(SkillList.combat, 60).setPerk(); + parrypro = (new InformationBase("parrypro", -2, -1, 0, Items.iron_sword, toughness)).registerStat() + .setPage(mastery).addSkill(SkillList.combat, 20).setPerk(); + counteratt = (new InformationBase("counteratt", -1, -2, 0, CustomToolListMF.standard_waraxe, parrypro)) + .registerStat().setPage(mastery).addSkill(SkillList.combat, 25).setPerk(); + autoparry = (new InformationBase("autoparry", -3, -2, 0, CustomToolListMF.standard_sword, parrypro)) + .registerStat().setPage(mastery).addSkill(SkillList.combat, 50).setPerk(); + firstaid = (new InformationBase("firstaid", 0, 1, 0, ToolListMF.bandage_wool, (InformationBase) null)) + .registerStat().setPage(mastery).addSkill(SkillList.provisioning, 25).setPerk(); + doctor = (new InformationBase("doctor", 0, 3, 0, ToolListMF.syringe, firstaid)).registerStat().setPage(mastery) + .addSkill(SkillList.provisioning, 50).setPerk(); + scrapper = (new InformationBase("scrapper", 0, -1, 0, BlockListMF.salvage_basic, (InformationBase) null)) + .registerStat().setPage(mastery).addSkill(SkillList.artisanry, 35).setPerk(); + + } + + private static Object getMetalTier(String string) { + CustomMaterial mat = MetalMaterial.getMaterial(string); + if (mat != null) + return mat.crafterTier; + + return "?"; + } } diff --git a/src/main/java/minefantasy/mf2/material/BaseMaterialMF.java b/src/main/java/minefantasy/mf2/material/BaseMaterialMF.java index 8e9a217d..266b96e2 100644 --- a/src/main/java/minefantasy/mf2/material/BaseMaterialMF.java +++ b/src/main/java/minefantasy/mf2/material/BaseMaterialMF.java @@ -1,283 +1,290 @@ package minefantasy.mf2.material; -import java.util.HashMap; - -import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.armour.ArmourMaterialMF; -import minefantasy.mf2.api.helpers.ArmourCalculator; import minefantasy.mf2.util.MFLogUtil; import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.common.util.EnumHelper; +import java.util.HashMap; + /** - * This is used to create both tool and armour materials. Variables needed: Durability, protection, sharpness, enchantment, weight, harvestLvl + * This is used to create both tool and armour materials. Variables needed: + * Durability, protection, sharpness, enchantment, weight, harvestLvl */ -public class BaseMaterialMF -{ - public static HashMap materialMap = new HashMap(); - public static BaseMaterialMF linen, wool, leatherapron, hide, rough, reinforced, padding, studded, scaled, dragonscale;//Cloth and leather - public static BaseMaterialMF stone, tin, pigiron, silver, gold, ornate, weakblacksteel, weakredsteel, weakbluesteel, tungsten;//Misc Mats - public static BaseMaterialMF copper, bronze, iron, steel, encrusted, obsidian, blacksteel, bluesteel, redsteel,dragonforge, adamantium, mithril, ignotumite, mithium, enderforge;//Tiers - - public static BaseMaterialMF cogworks, compositeAlloy;//Engineer - /** - * This scales armour so a sword hitting full mail of equal tier has this as a result - * Used so armour can scale up with weapon damage - */ - private static final float armourVsSwordBalance = 2.0F; - /** - * The base damage for swords used with players. (Swords are 4+dam, adding 1 dam for player base hit dam) - */ - private static final float swordDam = 5F; - - private static float ACrounding = 10F; //round to nearest 10 - /* - * WOOD(0, 59, 2.0F, 0.0F, 15), - STONE(1, 131, 4.0F, 1.0F, 5), - IRON(2, 250, 6.0F, 2.0F, 14), - EMERALD(3, 1561, 8.0F, 3.0F, 10), - GOLD(0, 32, 12.0F, 0.0F, 22); +public class BaseMaterialMF { + /** + * This scales armour so a sword hitting full mail of equal tier has this as a + * result Used so armour can scale up with weapon damage + */ + private static final float armourVsSwordBalance = 2.0F; + /** + * The base damage for swords used with players. (Swords are 4+dam, adding 1 dam + * for player base hit dam) + */ + private static final float swordDam = 5F; + public static HashMap materialMap = new HashMap(); + public static BaseMaterialMF linen, wool, leatherapron, hide, rough, reinforced, padding, studded, scaled, + dragonscale;// Cloth and leather + public static BaseMaterialMF stone, tin, pigiron, silver, gold, ornate, weakblacksteel, weakredsteel, weakbluesteel, + tungsten;// Misc Mats + public static BaseMaterialMF copper, bronze, iron, steel, encrusted, obsidian, blacksteel, bluesteel, redsteel, + dragonforge, adamantium, mithril, ignotumite, mithium, enderforge, dwarfsteel, emerald;// Tiers + public static BaseMaterialMF cogworks, compositeAlloy;// Engineer + private static float ACrounding = 10F; // round to nearest 10 + /* + * WOOD(0, 59, 2.0F, 0.0F, 15), STONE(1, 131, 4.0F, 1.0F, 5), IRON(2, 250, 6.0F, + * 2.0F, 14), EMERALD(3, 1561, 8.0F, 3.0F, 10), GOLD(0, 32, 12.0F, 0.0F, 22); + * + * To get variables: X = sword damage, Y = Armour Ratio(+1 of value), Z = Damage + * + * X = Z * Y Y = X / Z Z = X / Y + */ + // Rounding off to nearest 0.5 makes about an 0.03 difference, but the AR is + // cleaner + // Hardness isn't added, it calculats armour itself to match sharpness + // name dura, AC enchant weight + public String name; + + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~CLASS + // START~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// + /** + * This variable determines max uses + */ + public int durability; + /** + * This variable determines the protection : Hardness and sharpness are normally + * relevant to each other (so armour vs weapon equal tier has the same + * after-calculation damage) + */ + public float hardness; + /** + * This variable determines damage and dig speed : Hardness and sharpness are + * normally relevant to each other (so armour vs weapon equal tier has the same + * after-calculation damage) + */ + public float sharpness; + /** + * This variable determines enchantement + */ + public int enchantment; + public float weight; + /** + * The required level to craft + */ + public int requiredLevel; + /** + * The tier the material is on + */ + public int tier; + public int harvestLevel; + // FORGING + public int hammerTier; + public int anvilTier; + public float craftTimeModifier = 2.0F; + + // TIERING + public int workableTemp = 100; + public int unstableTemp = 150; + // RESISTANCES + public float fireResistance; + public float arcaneResistance; + public boolean isMythic = false; + public int rarity; + // SPECIALS + private ArmourMaterialMF armourConversion; + private ToolMaterial toolConversion; + + public BaseMaterialMF(String name, int tier, int durability, int harvestLevel, float hardness, float sharpness, + int enchantment, float weight, int lvl) { + this.requiredLevel = lvl; + this.name = name; + this.tier = tier; + this.durability = durability; + this.hardness = hardness; + this.sharpness = sharpness; + this.enchantment = enchantment; + this.weight = weight; + this.harvestLevel = harvestLevel; + } + + public static void init() { + // LEATHER AND CLOTH + linen = addArmourSpecificMaterial("Linen", 0, 10, 0.1F, 0, 1.00F, 0); + wool = addArmourSpecificMaterial("Wool", 1, 15, 0.1F, 0, 1.00F, 5); + + leatherapron = addArmourSpecificMaterial("LeatherApron", 0, 10, 1.5F, 0, 0.50F, 0); + hide = addArmourSpecificMaterial("Hide", 0, 100, 1.5F, 0, 1.00F, 0); + rough = addArmourSpecificMaterial("RoughLeather", 0, 150, 1.5F, 1, 1.00F, 0); + reinforced = addArmourSpecificMaterial("StrongLeather", 1, 250, 2.0F, 1, 1.00F, 5); + padding = addArmourSpecificMaterial("Padded", 1, 200, 2.0F, 0, 1.00F, 5); + studded = addArmourSpecificMaterial("StudLeather", 1, 500, 2.5F, 5, 1.20F, 15); + scaled = addArmourSpecificMaterial("ScaleLeather", 2, 1000, 2.8F, 8, 1.50F, 25); + dragonscale = addArmourSpecificMaterial("Dragonscale", 3, 3000, 5F, 20, 1.20F, 85).setRarity(2); + + // name Tier dura, harvest sharpness enchant weight + // MISC + weakblacksteel = addMaterial("BlackSteelWeak", -1, 250, 4, 2.0F, 0, 1.00F, 40).setForgeStats(4, 4, 4.0F, 150, + 500); + weakredsteel = addMaterial("RedSteelWeak", -1, 400, 5, 3.0F, 0, 1.10F, 65).setForgeStats(4, 4, 4.0F, 200, 500); + weakbluesteel = addMaterial("BlueSteelWeak", -1, 300, 5, 2.5F, 0, 0.90F, 65).setForgeStats(4, 4, 4.0F, 175, + 500); + stone = addMaterial("Stone", 0, 50, 0, 0.1F, 0.0F, 0, 2.00F, 0).setForgeStats(0, 0, 0.75F, 0, 0); + tin = addMaterial("Tin", 0, 100, 0, 0.2F, 5, 0.80F, 0).setForgeStats(0, 0, 0, 85, 100); + pigiron = addMaterial("PigIron", 0, 250, 0, 1.5F, 3, 1.00F, 0).setForgeStats(2, 2, 2.0F, 100, 400); + silver = addMaterial("Silver", -1, 150, 0, 0.0F, 10, 0.70F, 0).setForgeStats(1, 1, 3F, 90, 120); + gold = addMaterial("Gold", -1, 150, 0, 0.0F, 25, 1.50F, 0).setForgeStats(1, 1, 3F, 90, 120); + // goldPure = addMaterial("PureGold", -1, 50 , 0, 0.0F, 50, 2.00F, + // 0).setRarity(1); + ornate = addMaterial("Ornate", -1, 300, 0, 0.0F, 30, 1.00F, 30).setRarity(1).setForgeStats(1, 1, 4F, 120, 150); + tungsten = addMaterial("Tungsten", 2, 600, 3, 4F, 5, 1.50F, 0).setRarity(1).setForgeStats(3, 3, 5.0F, 150, 300); + + // TIERS + // Basic / Common Materials (0-2) Levels 0-50 + copper = addMaterial("Copper", 0, 200, 1, 1.0F, 5, 1.00F, 0).setForgeStats(0, 0, 1.0F, 95, 250); // lvl 0-4 + bronze = addMaterial("Bronze", 1, 300, 2, 1.5F, 5, 1.00F, 5).setForgeStats(1, 1, 2.5F, 100, 250); // lvl 5-14 + iron = addMaterial("Iron", 2, 500, 2, 2.0F, 5, 1.00F, 15).setForgeStats(2, 2, 2.0F, 90, 250); // lvl 15-24 + steel = addMaterial("Steel", 3, 750, 2, 2.5F, 10, 1.00F, 25).setForgeStats(3, 3, 2.5F, 120, 250); // lvl 25-39 + encrusted = addMaterial("Encrusted", 3, 2000, 3, 3.5F, 25, 1.00F, 40).setForgeStats(3, 3, 5.0F, 130, 240); // lvl + // 40-49 + obsidian = addMaterial("Obsidian", 3, 2000, 3, 3.5F, 25, 1.00F, 40).setForgeStats(3, 3, 5.0F, 130, 240); // lvl + // 40-49 + // Advanced Materials (3 - 4) Levels 50-75 + blacksteel = addMaterial("BlackSteel", 4, 1500, 4, 4.0F, 12, 1.00F, 50).setForgeStats(4, 4, 4.0F, 150, 350);// lvl + // 50 + dragonforge = addMaterial("Dragonforge", 4, 1500, 4, 5.0F, 14, 1.00F, 60).setForgeStats(4, 4, 8.0F, 250, 350) + .setRarity(1).setResistances(100F, 0F);// lvl 60 + redsteel = addMaterial("RedSteel", 5, 2000, 5, 6.0F, 1, 1.15F, 75).setForgeStats(5, 5, 6.5F, 200, 350) + .setResistances(20F, 0F);// lvl 75 + bluesteel = addMaterial("BlueSteel", 5, 1800, 5, 5.0F, 20, 0.75F, 75).setForgeStats(5, 5, 4.5F, 175, 325) + .setResistances(0F, 20F);// lvl 75 + // Mythic Materials (5) Levels 75-100 + adamantium = addMaterial("Adamantium", 6, 3000, 6, 8.0F, 10, 1.25F, 90).setForgeStats(6, 5, 9.0F, 300, 400) + .setRarity(1).setResistances(35F, 0F);// lvl 90 + mithril = addMaterial("Mithril", 6, 2500, 6, 7.0F, 30, 0.50F, 90).setForgeStats(6, 5, 6.0F, 280, 400) + .setRarity(1).setResistances(0F, 35F);// lvl 90 + // Masterwork Materials (6) Level 100 + ignotumite = addMaterial("Ignotumite", 7, 1000, 7, 14.0F, 20, 2.00F, 100).setForgeStats(7, 5, 15.0F, 350, 400) + .setRarity(2).setResistances(50F, 0F);// High damage, heavy, fire resist lvl 100 + mithium = addMaterial("Mithium", 7, 1000, 7, 10.0F, 40, 0.25F, 100).setForgeStats(7, 5, 15.0F, 330, 400) + .setRarity(2).setResistances(0F, 50F);// Low damage, light, magic resist lvl 100 + enderforge = addMaterial("Ender", 7, 1000, 7, 12.0F, 20, 1.00F, 100).setForgeStats(7, 5, 15.0F, 400, 450) + .setRarity(2).setResistances(25F, 25F);// Middle lvl 100 + // Engineer Materials + // steel = addMaterial("Steel", 3, 750, 2, 2.5F, 10, 1.00F, 25).setForgeStats(3, + // 3, 2.5F, 120, 250); //lvl 25-39 + cogworks = addArmourSpecificMaterial("Cogworks", 4, 500, 1.0F, 10, 1.00F, 85).setForgeStats(3, 3, 2.5F, 120, + 250); + compositeAlloy = addArmourSpecificMaterial("CompositeAlloy", 4, 1800, 4.0F, 10, 2.00F, 85) + .setForgeStats(3, 3, 2.5F, 120, 250).setResistances(95F, 85F); - * To get variables: X = sword damage, Y = Armour Ratio(+1 of value), Z = Damage - * - * X = Z * Y - * Y = X / Z - * Z = X / Y - */ - //Rounding off to nearest 0.5 makes about an 0.03 difference, but the AR is cleaner - //Hardness isn't added, it calculats armour itself to match sharpness - // name dura, AC enchant weight - public static void init() - { - //LEATHER AND CLOTH - linen = addArmourSpecificMaterial("Linen", 0, 10 , 0.1F, 0, 1.00F, 0); - wool = addArmourSpecificMaterial("Wool" , 1, 15 , 0.1F, 0, 1.00F, 5); - - leatherapron = addArmourSpecificMaterial("LeatherApron", 0, 10 , 1.5F, 0, 0.50F, 0); - hide = addArmourSpecificMaterial("Hide", 0, 100 , 1.5F, 0, 1.00F, 0); - rough = addArmourSpecificMaterial("RoughLeather", 0, 150 , 1.5F, 1, 1.00F, 0); - reinforced = addArmourSpecificMaterial("StrongLeather", 1, 250, 2.0F, 1, 1.00F, 5); - padding = addArmourSpecificMaterial("Padded", 1, 200 , 2.0F, 0, 1.00F, 5); - studded = addArmourSpecificMaterial("StudLeather", 1, 500, 2.5F, 5, 1.20F, 15); - scaled = addArmourSpecificMaterial("ScaleLeather", 2, 1000, 2.8F, 8, 1.50F, 25); - dragonscale = addArmourSpecificMaterial("Dragonscale", 3, 3000, 5F, 20, 1.20F, 85).setRarity(2); - - // name Tier dura, harvest sharpness enchant weight - //MISC - weakblacksteel = addMaterial("BlackSteelWeak", -1, 250, 4, 2.0F, 0, 1.00F, 40).setForgeStats(4, 4, 4.0F, 150, 500); - weakredsteel = addMaterial("RedSteelWeak", -1, 400, 5, 3.0F, 0, 1.10F, 65).setForgeStats(4, 4, 4.0F, 200, 500); - weakbluesteel = addMaterial("BlueSteelWeak", -1, 300, 5, 2.5F, 0, 0.90F, 65).setForgeStats(4, 4, 4.0F, 175, 500); - stone = addMaterial("Stone", 0, 50 , 0, 0.1F, 0.0F, 0, 2.00F, 0).setForgeStats(0, 0, 0.75F, 0, 0); - tin = addMaterial("Tin", 0, 100, 0, 0.2F, 5 , 0.80F, 0).setForgeStats(0, 0, 0, 85, 100); - pigiron = addMaterial("PigIron", 0, 250, 0, 1.5F, 3 , 1.00F, 0).setForgeStats(2, 2, 2.0F, 100, 400); - silver = addMaterial("Silver", -1, 150, 0, 0.0F, 10, 0.70F, 0).setForgeStats(1, 1, 3F, 90, 120); - gold = addMaterial("Gold", -1, 150, 0, 0.0F, 25, 1.50F, 0).setForgeStats(1, 1, 3F, 90, 120); - //goldPure = addMaterial("PureGold", -1, 50 , 0, 0.0F, 50, 2.00F, 0).setRarity(1); - ornate = addMaterial("Ornate", -1, 300, 0, 0.0F, 30, 1.00F, 30).setRarity(1).setForgeStats(1, 1, 4F, 120, 150); - tungsten = addMaterial("Tungsten", 2, 600, 3, 4F, 5 , 1.50F, 0).setRarity(1).setForgeStats(3, 3, 5.0F, 150, 300); - - //TIERS - //Basic / Common Materials (0-2) Levels 0-50 - copper = addMaterial("Copper", 0, 200, 1, 1.0F, 5, 1.00F, 0).setForgeStats(0, 0, 1.0F, 95, 250); //lvl 0-4 - bronze = addMaterial("Bronze", 1, 300, 2, 1.5F, 5 , 1.00F, 5).setForgeStats(1, 1, 2.5F, 100, 250); //lvl 5-14 - iron = addMaterial("Iron", 2, 500, 2, 2.0F, 5 , 1.00F, 15).setForgeStats(2, 2, 2.0F, 90, 250); //lvl 15-24 - steel = addMaterial("Steel", 3, 750, 2, 2.5F, 10, 1.00F, 25).setForgeStats(3, 3, 2.5F, 120, 250); //lvl 25-39 - encrusted = addMaterial("Encrusted", 3, 2000, 3, 3.5F, 25, 1.00F, 40).setForgeStats(3, 3, 5.0F, 130, 240); //lvl 40-49 - obsidian = addMaterial("Obsidian", 3, 2000, 3, 3.5F, 25, 1.00F, 40).setForgeStats(3, 3, 5.0F, 130, 240); //lvl 40-49 - //Advanced Materials (3 - 4) Levels 50-75 - blacksteel = addMaterial("BlackSteel", 4, 1500, 4, 4.0F, 12, 1.00F, 50).setForgeStats(4, 4, 4.0F, 150, 350);//lvl 50 - dragonforge = addMaterial("Dragonforge", 4, 1500, 4, 5.0F, 14, 1.00F, 60).setForgeStats(4, 4, 8.0F, 250, 350).setRarity(1).setResistances(100F, 0F);//lvl 60 - redsteel = addMaterial("RedSteel", 5, 2000, 5, 6.0F, 1 , 1.15F, 75).setForgeStats(5, 5, 6.5F, 200, 350).setResistances(20F, 0F);//lvl 75 - bluesteel = addMaterial("BlueSteel", 5, 1800, 5, 5.0F, 20, 0.75F, 75).setForgeStats(5, 5, 4.5F, 175, 325).setResistances(0F, 20F);//lvl 75 - //Mythic Materials (5) Levels 75-100 - adamantium = addMaterial("Adamantium", 6, 3000, 6, 8.0F, 10 , 1.25F, 90).setForgeStats(6, 5, 9.0F, 300, 400).setRarity(1).setResistances(35F, 0F);//lvl 90 - mithril = addMaterial("Mithril", 6, 2500, 6, 7.0F, 30, 0.50F, 90).setForgeStats(6, 5, 6.0F, 280, 400).setRarity(1).setResistances(0F, 35F);//lvl 90 - //Masterwork Materials (6) Level 100 - ignotumite = addMaterial("Ignotumite", 7, 1000, 7, 14.0F, 20 , 2.00F, 100).setForgeStats(7, 5, 15.0F, 350, 400).setRarity(2).setResistances(50F, 0F);//High damage, heavy, fire resist lvl 100 - mithium = addMaterial("Mithium", 7, 1000, 7, 10.0F, 40, 0.25F, 100).setForgeStats(7, 5, 15.0F, 330, 400).setRarity(2).setResistances(0F, 50F);//Low damage, light, magic resist lvl 100 - enderforge = addMaterial("Ender", 7, 1000, 7, 12.0F, 20, 1.00F, 100).setForgeStats(7, 5, 15.0F, 400, 450).setRarity(2).setResistances(25F, 25F);//Middle lvl 100 - //Engineer Materials - //steel = addMaterial("Steel", 3, 750, 2, 2.5F, 10, 1.00F, 25).setForgeStats(3, 3, 2.5F, 120, 250); //lvl 25-39 - cogworks = addArmourSpecificMaterial("Cogworks", 4, 500, 1.0F, 10, 1.00F, 85).setForgeStats(3, 3, 2.5F, 120, 250); - compositeAlloy = addArmourSpecificMaterial("CompositeAlloy", 4, 1800, 4.0F, 10, 2.00F, 85).setForgeStats(3, 3, 2.5F, 120, 250).setResistances(95F, 85F); - - } + //NEW name Tier dura, harvest sharpness enchant weight + dwarfsteel = addMaterial("DwarfSteel", 4, 1500, 4, 4.0F, 12, 0.85F, 50).setForgeStats(4, 4, 4.0F, 150, 350);// lvl + emerald = addMaterial("Emerald", 4, 1500, 4, 4.0F, 12, 0.85F, 50).setForgeStats(4, 4, 4.0F, 150, 350);// lvl + } + + /** + * This method auto-calculates the Armour Rating to scale the damage + */ + public static BaseMaterialMF addArmourSpecificMaterial(String name, int tier, int durability, float AC, + int enchantment, float weight, int lvl) { + return addMaterial(name, tier, durability, -1, AC, -1, enchantment, weight, lvl); + } + + public static BaseMaterialMF addMaterial(String name, int tier, int durability, int harvestLevel, float sharpness, + int enchantment, float weight, int lvl) { + float AC = 0; + AC = ((sharpness + swordDam) / armourVsSwordBalance) - 1.0F; + MFLogUtil.logDebug("Added Ratio Armour Material " + name + " AR = " + AC); + float initAc = AC; + + AC = Math.round(AC * (100F / ACrounding)); + AC = AC / (100F / ACrounding); + + if (initAc != AC) { + MFLogUtil.logDebug("Auto-Calculated ArmourRating for tier: " + name + ", modified to " + AC); + } + return addMaterial(name, tier, durability, harvestLevel, AC, sharpness, enchantment, weight, lvl); + } + + public static BaseMaterialMF addMaterial(String name, int tier, int durability, int harvestLevel, float hardness, + float sharpness, int enchantment, float weight, int lvl) { + return register(new BaseMaterialMF(name, tier, durability, harvestLevel, hardness, sharpness, enchantment, + weight, lvl)); + } + + public static BaseMaterialMF register(BaseMaterialMF material) { + materialMap.put(material.name.toLowerCase(), material); + return material; + } + + private static ArmourMaterialMF getMFArmourMaterial(String name) { + BaseMaterialMF material = materialMap.get(name); + return material != null ? getMFArmourMaterial(material) : null; + } + + public static ArmourMaterialMF getMFArmourMaterial(BaseMaterialMF material) { + return material.convertToMFArmour(); + } + + public static ToolMaterial getToolMaterial(String name) { + BaseMaterialMF material = materialMap.get(name); + return material != null ? getToolMaterial(material) : null; + } + + public static ToolMaterial getToolMaterial(BaseMaterialMF material) { + return material.convertToTool(); + } + + public static BaseMaterialMF getMaterial(String name) { + return materialMap.get(name.toLowerCase()); + } + + protected BaseMaterialMF setForgeStats(int hammer, int anvil, float timer, int workable, int unstable) { + hammerTier = hammer; + anvilTier = anvil; + craftTimeModifier = (timer * 2F) + 2.0F; + workableTemp = workable; + unstableTemp = unstable; + return this; + } + + protected BaseMaterialMF setResistances(float fire, float arcane) { + fireResistance = fire; + arcaneResistance = arcane; + return this; + } + + protected BaseMaterialMF setRarity(int value) { + rarity = value; + return this; + } + + protected BaseMaterialMF setMythic() { + isMythic = true; + return this; + } + + private ArmourMaterialMF convertToMFArmour() { + return new ArmourMaterialMF("MF" + name, durability, hardness, enchantment, weight) + .setFireResistance(fireResistance).setMagicResistance(arcaneResistance).setMythic(isMythic); + } + + private ToolMaterial convertToTool() { + return EnumHelper.addToolMaterial("MF" + name, harvestLevel, durability, 2.0F + (sharpness * 2F), sharpness, + enchantment); + } + + public ArmourMaterialMF getArmourConversion() { + if (armourConversion == null) { + armourConversion = getMFArmourMaterial(this); + } + return armourConversion; + } -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~CLASS START~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// - /** - * This method auto-calculates the Armour Rating to scale the damage - */ - public static BaseMaterialMF addArmourSpecificMaterial(String name, int tier, int durability, float AC, int enchantment, float weight, int lvl) - { - return addMaterial(name, tier, durability, -1, AC, -1, enchantment, weight, lvl); - } - - public static BaseMaterialMF addMaterial(String name, int tier, int durability, int harvestLevel, float sharpness, int enchantment, float weight, int lvl) - { - float AC = 0; - AC = ((sharpness+swordDam)/armourVsSwordBalance) - 1.0F; - MFLogUtil.logDebug("Added Ratio Armour Material " + name + " AR = " + AC); - float initAc = AC; - - AC = Math.round(AC*(100F/ACrounding)); - AC = AC/(100F/ACrounding); - - if(initAc != AC) - { - MFLogUtil.logDebug("Auto-Calculated ArmourRating for tier: " + name + ", modified to " + AC); - } - return addMaterial(name, tier, durability, harvestLevel, AC, sharpness, enchantment, weight, lvl); - } - - public static BaseMaterialMF addMaterial(String name, int tier, int durability, int harvestLevel, float hardness, float sharpness, int enchantment, float weight, int lvl) - { - return register(new BaseMaterialMF(name, tier, durability, harvestLevel, hardness, sharpness, enchantment, weight, lvl)); - } - - public static BaseMaterialMF register(BaseMaterialMF material) - { - materialMap.put(material.name.toLowerCase(), material); - return material; - } - - public String name; - - /** - * This variable determines max uses - */ - public int durability; - /** - * This variable determines the protection - * : Hardness and sharpness are normally relevant to each other (so armour vs weapon equal tier has the same after-calculation damage) - */ - public float hardness; - /** - * This variable determines damage and dig speed - * : Hardness and sharpness are normally relevant to each other (so armour vs weapon equal tier has the same after-calculation damage) - */ - public float sharpness; - /** - * This variable determines enchantement - */ - public int enchantment; - public float weight; - - /** - * The required level to craft - */ - public int requiredLevel; - - //TIERING - /** - * The tier the material is on - */ - public int tier; - public int harvestLevel; - - //FORGING - public int hammerTier; - public int anvilTier; - public float craftTimeModifier = 2.0F; - public int workableTemp = 100; - public int unstableTemp = 150; - - //RESISTANCES - public float fireResistance; - public float arcaneResistance; - public boolean isMythic = false; - - //SPECIALS - private ArmourMaterialMF armourConversion; - private ToolMaterial toolConversion; - public int rarity; - - public BaseMaterialMF(String name, int tier, int durability, int harvestLevel, float hardness, float sharpness, int enchantment, float weight, int lvl) - { - this.requiredLevel = lvl; - this.name = name; - this.tier = tier; - this.durability = durability; - this.hardness = hardness; - this.sharpness = sharpness; - this.enchantment = enchantment; - this.weight = weight; - this.harvestLevel = harvestLevel; - } - - protected BaseMaterialMF setForgeStats(int hammer, int anvil, float timer, int workable, int unstable) - { - hammerTier = hammer; - anvilTier = anvil; - craftTimeModifier = (timer*2F) + 2.0F; - workableTemp = workable; - unstableTemp = unstable; - return this; - } - protected BaseMaterialMF setResistances(float fire, float arcane) - { - fireResistance = fire; - arcaneResistance = arcane; - return this; - } - protected BaseMaterialMF setRarity(int value) - { - rarity = value; - return this; - } - protected BaseMaterialMF setMythic() - { - isMythic = true; - return this; - } - private ArmourMaterialMF convertToMFArmour() - { - return new ArmourMaterialMF("MF"+name, durability, hardness, enchantment, weight).setFireResistance(fireResistance).setMagicResistance(arcaneResistance).setMythic(isMythic); - } - - private ToolMaterial convertToTool() - { - return EnumHelper.addToolMaterial("MF"+name, harvestLevel, durability, 2.0F+(sharpness*2F), sharpness, enchantment); - } - - private static ArmourMaterialMF getMFArmourMaterial(String name) - { - BaseMaterialMF material = materialMap.get(name); - return material != null ? getMFArmourMaterial(material) : null; - } - public ArmourMaterialMF getArmourConversion() - { - if(armourConversion == null) - { - armourConversion = getMFArmourMaterial(this); - } - return armourConversion; - } - public static ArmourMaterialMF getMFArmourMaterial(BaseMaterialMF material) - { - return material.convertToMFArmour(); - } - - public static ToolMaterial getToolMaterial(String name) - { - BaseMaterialMF material = materialMap.get(name); - return material != null ? getToolMaterial(material) : null; - } - public ToolMaterial getToolConversion() - { - if(toolConversion == null) - { - toolConversion = getToolMaterial(this); - } - return toolConversion; - } - - public static ToolMaterial getToolMaterial(BaseMaterialMF material) - { - return material.convertToTool(); - } - - public static BaseMaterialMF getMaterial(String name) - { - return materialMap.get(name.toLowerCase()); - } + public ToolMaterial getToolConversion() { + if (toolConversion == null) { + toolConversion = getToolMaterial(this); + } + return toolConversion; + } } diff --git a/src/main/java/minefantasy/mf2/material/LeatherMaterial.java b/src/main/java/minefantasy/mf2/material/LeatherMaterial.java index cdcf38a1..bab8d94f 100644 --- a/src/main/java/minefantasy/mf2/material/LeatherMaterial.java +++ b/src/main/java/minefantasy/mf2/material/LeatherMaterial.java @@ -2,27 +2,25 @@ import minefantasy.mf2.api.material.CustomMaterial; -public class LeatherMaterial extends CustomMaterial -{ - public LeatherMaterial(String name, int tier, float hardness, float durability, float flexibility, float sharpness, float resistance, float density) - { - super(name, "leather", tier, hardness, durability, flexibility, sharpness, resistance, density); - } - - public static CustomMaterial getOrAddWood(String name, int tier, float hardness, float durability, float flexibility, float sharpness, float resistance, float density, int red, int green, int blue) - { - if(getMaterial(name) != null) - { - return CustomMaterial.getMaterial(name); - } - return new LeatherMaterial(name, tier, hardness, durability, flexibility, sharpness, resistance, density).setColour(red, green, blue).register(); - } - - public static void init() - { - getOrAddWood("Leather", 0, 1.0F, 0.4F, 1.2F, 0F, 0.5F, 0.1F, 198, 92 , 53 ); - getOrAddWood("HardLeather", 1, 1.5F, 0.8F, 1.0F, 0F, 0.5F, 0.2F, 154, 72 , 41 ); - getOrAddWood("MinotaurSkin", 2, 2.0F, 1.5F, 0.8F, 0F, 1.0F, 0.5F, 118, 69 , 48 ); - getOrAddWood("DragonSkin", 3, 3.0F, 2.0F, 1.0F, 0F, 1.2F, 0.75F, 56 , 43 , 66); - } +public class LeatherMaterial extends CustomMaterial { + public LeatherMaterial(String name, int tier, float hardness, float durability, float flexibility, float sharpness, + float resistance, float density) { + super(name, "leather", tier, hardness, durability, flexibility, sharpness, resistance, density); + } + + public static CustomMaterial getOrAddWood(String name, int tier, float hardness, float durability, + float flexibility, float sharpness, float resistance, float density, int red, int green, int blue) { + if (getMaterial(name) != null) { + return CustomMaterial.getMaterial(name); + } + return new LeatherMaterial(name, tier, hardness, durability, flexibility, sharpness, resistance, density) + .setColour(red, green, blue).register(); + } + + public static void init() { + getOrAddWood("Leather", 0, 1.0F, 0.4F, 1.2F, 0F, 0.5F, 0.1F, 198, 92, 53); + getOrAddWood("HardLeather", 1, 1.5F, 0.8F, 1.0F, 0F, 0.5F, 0.2F, 154, 72, 41); + getOrAddWood("MinotaurSkin", 2, 2.0F, 1.5F, 0.8F, 0F, 1.0F, 0.5F, 118, 69, 48); + getOrAddWood("DragonSkin", 3, 3.0F, 2.0F, 1.0F, 0F, 1.2F, 0.75F, 56, 43, 66); + } } diff --git a/src/main/java/minefantasy/mf2/material/MetalMaterial.java b/src/main/java/minefantasy/mf2/material/MetalMaterial.java index 412cd248..f600158b 100644 --- a/src/main/java/minefantasy/mf2/material/MetalMaterial.java +++ b/src/main/java/minefantasy/mf2/material/MetalMaterial.java @@ -1,129 +1,180 @@ package minefantasy.mf2.material; -import java.util.ArrayList; -import java.util.Iterator; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.util.MFLogUtil; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.ArrayList; +import java.util.Iterator; + +public class MetalMaterial extends CustomMaterial { + public MetalMaterial(String name, int tier, float hardness, float durability, float flexibility, float sharpness, + float resistance, float density) { + super(name, "metal", tier, hardness, durability, flexibility, resistance, sharpness, density); + setArmourStats(1.0F, flexibility, 1F / flexibility);// Harder materials absorb blunt less but resist cutting and + // piercing more + } + + /** + * Adds a new metal + * + * @param name The name, and register for the metal + * @param tier What tier the metal is + * @param hardness How hard the material is to break + * @param flexibility How well the metal can bend + * @param sharpness How well the metal can be sharpened + * @param resistance The resistance to elements such as fire and corrosion, right now + * its just 0-100 for armour resistance against elements + * @param density The overall mass (Kg) for an ingot + */ + public static CustomMaterial getOrAddMetal(String name, int tier, float durability, float flexibility, + float sharpness, float resistance, float density, int red, int green, int blue) { + if (getMaterial(name) != null) { + return CustomMaterial.getMaterial(name); + } + float hardness = ((sharpness + 5F) / 2F) - 1F; + return new MetalMaterial(name, tier, hardness, durability, flexibility, sharpness, resistance, density) + .setColour(red, green, blue).register(); + } + + public static CustomMaterial getOrAddMetal(String name, int tier, float hardness, float durability, + float flexibility, float sharpness, float resistance, float density, int red, int green, int blue) { + if (getMaterial(name) != null) { + return CustomMaterial.getMaterial(name); + } + return new MetalMaterial(name, tier, hardness, durability, flexibility, sharpness, resistance, density) + .setColour(red, green, blue).register(); + } + + public static void init() { + /* + * BaseMaterialMF WOOD(0, 59, 2.0F, 0.0F, 15), STONE(1, 131, 4.0F, 1.0F, 5), + * IRON(2, 250, 6.0F, 2.0F, 14), EMERALD(3, 1561, 8.0F, 3.0F, 10), GOLD(0, 32, + * 12.0F, 0.0F, 22); + */ + + // Weak Mats Name T Dur Flx Shp Rst Wg + getOrAddMetal("Tin", 0, 1.0F, 0.5F, 0.0F, 10F, 2.0F, 164, 177, 177).setRarity(-1).setMeltingPoint(900); + getOrAddMetal("Copper", 0, 1.0F, 1.0F, 0.0F, 50F, 3.0F, 255, 132, 66).setMeltingPoint(1000); + + // Standard Mats Name T Dur Flx Shp Rst Wg + getOrAddMetal("Bronze", 1, 1.5F, 1.0F, 1.5F, 20F, 3.0F, 207, 165, 118).setCrafterTiers(1).setMeltingPoint(1200); + getOrAddMetal("Iron", 2, 2.0F, 1.0F, 2.0F, 20F, 2.5F, 140, 120, 100).setCrafterTiers(2).setMeltingPoint(1200) + .setArmourStats(1.0F, 1.0F, 1.0F);// Standard + getOrAddMetal("PigIron", 2, 2.0F, 0.8F, 2.0F, 20F, 2.5F, 120, 95, 95).setCrafterTiers(2).setMeltingPoint(1200) + .setArmourStats(1.1F, 0.8F, 1.1F);// Less Blunt for more cutting/piercing + getOrAddMetal("Steel", 4, 3.5F, 1.0F, 3.0F, 35F, 2.5F, 168, 168, 168).setCrafterTiers(3).setMeltingPoint(1500); + getOrAddMetal("Encrusted", 4, 8.0F, 1.0F, 3.0F, 35F, 3.0F, 64, 255, 255).setCrafterTiers(3) + .setMeltingPoint(1800).setArmourStats(1.0F, 1.0F, 1.2F);// Better Piercing + getOrAddMetal("Obsidian", 4, 8.0F, 1.0F, 3.0F, 35F, 3.0F, 90, 45, 90).setCrafterTiers(3).setMeltingPoint(2000) + .setArmourStats(1.0F, 1.3F, 1.0F);// Better Blunt + getOrAddMetal("Tungsten", 4, 8.0F, 0.8F, 3.0F, 35F, 4.0F, 66, 86, 65).setCrafterTiers(3).setMeltingPoint(2000) + .setArmourStats(1.3F, 1.0F, 1.3F);// Better Cutting/Piercing + getOrAddMetal("BlackSteel", 5, 6.0F, 1.0F, 4.0F, 50F, 3.0F, 80, 80, 80).setCrafterTiers(4).setMeltingPoint(2000) + .setArmourStats(1.1F, 1.2F, 1.0F);// Standard + getOrAddMetal("BlueSteel", 6, 7.0F, 1.2F, 5.0F, 65F, 2.0F, 28, 31, 159).setCrafterTiers(5).setMeltingPoint(2000) + .setArmourStats(1.0F, 1.2F, 0.8F);// Better Blunt and Resist + getOrAddMetal("RedSteel", 6, 8.0F, 0.8F, 6.0F, 50F, 3.5F, 219, 56, 56).setCrafterTiers(5).setMeltingPoint(2000) + .setArmourStats(0.9F, 0.9F, 1.2F);// Better AC and Piercing + + // Precious Mats + getOrAddMetal("Silver", 0, 2.5F, 1.0F, 0.0F, 40F, 3.5F, 155, 206, 205).setMeltingPoint(1200); + getOrAddMetal("Gold", 0, 2.0F, 1.0F, 0.0F, 40F, 3.5F, 243, 222, 49).setMeltingPoint(1200); + + // Mythic Mats Name T Dur Flx Shp Rst Wg + getOrAddMetal("Mithril", 7, 10.0F, 0.8F, 7.0F, 90F, 1.0F, 102, 204, 255).setMeltingPoint(2500) + .setCrafterTiers(6).setRarity(1); + getOrAddMetal("Adamantium", 7, 12.0F, 0.8F, 8.0F, 80F, 3.5F, 100, 200, 100).setMeltingPoint(2500) + .setCrafterTiers(6).setRarity(1); + getOrAddMetal("Mithium", 8, 15.0F, 0.8F, 10.0F, 95F, 2.0F, 60, 200, 255).setMeltingPoint(2500) + .setCrafterTiers(7).setRarity(2).setUnbreakable(); + getOrAddMetal("Ignotumite", 8, 15.0F, 0.8F, 14.0F, 85F, 3.5F, 20, 255, 100).setMeltingPoint(3000) + .setCrafterTiers(7).setRarity(2).setUnbreakable(); + getOrAddMetal("Ender", 8, 15.0F, 0.8F, 12.0F, 90F, 3.0F, 255, 63, 243).setMeltingPoint(3000).setCrafterTiers(7) + .setRarity(2).setUnbreakable(); + + // Non-MF + getOrAddMetal("StainlessSteel", 3, 5.0F, 1.0F, 2.5F, 40F, 2.5F, 188, 188, 198).setMeltingPoint(1600) + .setCrafterTiers(3); + getOrAddMetal("Titanium", 6, 10.0F, 1.0F, 4.0F, 50F, 1.0F, 190, 190, 160).setMeltingPoint(2000) + .setCrafterTiers(3); + + getOrAddMetal("Thaumium", 4, 4.0F, 1.0F, 3.0F, 65F, 2.5F, 115, 65, 183).setMeltingPoint(1500) + .setCrafterTiers(3); + getOrAddMetal("Void", 4, 10.0F, 2.0F, 4.0F, 75F, 1.0F, 75, 45, 75).setMeltingPoint(1800).setCrafterTiers(3); + getOrAddMetal("Manasteel", 2, 3.0F, 1.0F, 2.0F, 40F, 2.5F, 88, 195, 231).setMeltingPoint(1500) + .setArmourStats(1.0F, 1.2F, 1.0F).setCrafterTiers(2);// More Resistant, Stronger than iron + getOrAddMetal("ElvenElementium", 3, 4.0F, 1.0F, 2.5F, 40F, 2.5F, 235, 108, 235).setMeltingPoint(1800) + .setArmourStats(1.1F, 1.0F, 1.1F).setCrafterTiers(2);// Similar to Manasteel, Slightly stronger + getOrAddMetal("Terrasteel", 4, 6.0F, 1.0F, 4.0F, 40F, 2.5F, 88, 250, 150).setMeltingPoint(1500) + .setArmourStats(1.0F, 0.9F, 1.0F).setCrafterTiers(3); + + + //String name, int tier, float durability, float flexibility, + //float sharpness, float resistance, float density, int red, int green, int blue + + + + + //NEW METALLURGY Name T Dur Flx Shp Rst Wg + getOrAddMetal("Atlarus", 5, 4.0F, 8.0F, 4.5F, 40F, 2.5F, 216, 183, 17).setMeltingPoint(2400) + .setArmourStats(0.9F, 0.8F, 0.7F).setCrafterTiers(4); + getOrAddMetal("DamascusSteel", 3, 3.3F, 2.6F, 2.5F, 30F, 2.5F, 131, 98, 45).setMeltingPoint(2100) + .setArmourStats(1.0F, 0.9F, 0.8F).setCrafterTiers(3); + getOrAddMetal("Vulcanite", 6, 13.0F, 11.0F, 5.5F, 40F, 2.5F, 187, 68, 8).setMeltingPoint(2250) + .setArmourStats(1.4F, 1.2F, 1.1F).setCrafterTiers(5); + getOrAddMetal("Platinum", 3, 2.0F, 7.0F, 3.5F, 40F, 2.5F, 51, 102, 153).setMeltingPoint(1800) + .setArmourStats(0.9F, 0.8F, 0.5F).setCrafterTiers(3); + getOrAddMetal("Angmallen", 3, 3.2F, 12.0F, 3.0F, 40F, 2.5F, 255, 255, 102).setMeltingPoint(2050) + .setArmourStats(0.9F, 0.8F, 0.7F).setCrafterTiers(3); + getOrAddMetal("Orichalcum", 6, 16.0F, 12.0F, 6.0F, 40F, 2.5F, 28, 125, 45).setMeltingPoint(2350) + .setArmourStats(1.3F, 1.3F, 1.2F).setCrafterTiers(5); + getOrAddMetal("Haderoth", 6, 16.0F, 12.0F, 6.5F, 40F, 2.5F, 102, 68, 0).setMeltingPoint(2350) + .setArmourStats(1.4F, 1.4F, 1.3F).setCrafterTiers(5); + getOrAddMetal("Tartarite", 7, 16.0F, 12.0F, 6.0F, 40F, 2.5F, 255, 0, 0).setMeltingPoint(2450) + .setArmourStats(1.6F, 1.6F, 1.4F).setCrafterTiers(5); + getOrAddMetal("ShadowIron", 2, 2.0F, 2.0F, 3.0F, 40F, 2.5F, 32, 28, 31).setMeltingPoint(645) + .setArmourStats(0.6F, 0.6F, 0.5F).setCrafterTiers(2); + + //NEW + getOrAddMetal("DwarfSteel", 5, 6.5F, 1.6F, 3.6F, 50F, 3.5F, 84, 95, 132).setCrafterTiers(3).setMeltingPoint(2100) + .setArmourStats(1.1F, 1.1F, 0.9F);// Better than steel + getOrAddMetal("Emerald", 4, 8.0F, 1.0F, 3.0F, 35F, 3.0F, 25, 255, 0).setCrafterTiers(3) + .setMeltingPoint(1800).setArmourStats(1.1F, 1.0F, 1.1F);// Better Piercing + + + // Alloy + getOrAddMetal("CompositeAlloy", 4, 4.5F, 10.0F, 1.0F, 2.5F, 75F, 4.0F, 65, 75, 65).setMeltingPoint(2500) + .setRarity(1).setCrafterTiers(3).modifyCraftTime(5.0F);// Powerful All-Rounder + } + + public static void addHeatables() { + ArrayList metal = CustomMaterial.getList("metal"); + Iterator iteratorMetal = metal.iterator(); + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + int[] stats = customMat.getHeatableStats(); + MFLogUtil.logDebug( + "Set Heatable Stats for " + customMat.name + ": " + stats[0] + "," + stats[1] + "," + stats[2]); + + MineFantasyAPI.setHeatableStats("ingot" + customMat.name, stats[0], stats[1], stats[2]); + MineFantasyAPI.setHeatableStats("hunk" + customMat.name, stats[0], stats[1], stats[2]); + } + + MineFantasyAPI.setHeatableStats(ComponentListMF.rivet, 1000, 2000, 3000); + MineFantasyAPI.setHeatableStats(ComponentListMF.metalHunk, -1, -1, -1); + MineFantasyAPI.setHeatableStats(ComponentListMF.bar, -1, -1, -1); + } -public class MetalMaterial extends CustomMaterial -{ - public MetalMaterial(String name, int tier, float hardness, float durability, float flexibility, float sharpness, float resistance, float density) - { - super(name, "metal", tier, hardness, durability, flexibility, resistance, sharpness, density); - setArmourStats(1.0F, flexibility, 1F/flexibility);//Harder materials absorb blunt less but resist cutting and piercing more - } - - /** - * Adds a new metal - * @param name The name, and register for the metal - * @param tier What tier the metal is - * @param hardness How hard the material is to break - * @param flexibility How well the metal can bend - * @param sharpness How well the metal can be sharpened - * @param resistance The resistance to elements such as fire and corrosion, right now its just 0-100 for armour resistance against elements - * @param density The overall mass (Kg) for an ingot - */ - public static CustomMaterial getOrAddMetal(String name, int tier, float durability, float flexibility, float sharpness, float resistance, float density, int red, int green, int blue) - { - if(getMaterial(name) != null) - { - return CustomMaterial.getMaterial(name); - } - float hardness = ((sharpness+5F)/2F)-1F; - return new MetalMaterial(name, tier, hardness, durability, flexibility, sharpness, resistance, density).setColour(red, green, blue).register(); - } - public static CustomMaterial getOrAddMetal(String name, int tier, float hardness, float durability, float flexibility, float sharpness, float resistance, float density, int red, int green, int blue) - { - if(getMaterial(name) != null) - { - return CustomMaterial.getMaterial(name); - } - return new MetalMaterial(name, tier, hardness, durability, flexibility, sharpness, resistance, density).setColour(red, green, blue).register(); - } - - public static void init() - { - /* BaseMaterialMF - * WOOD(0, 59, 2.0F, 0.0F, 15), - STONE(1, 131, 4.0F, 1.0F, 5), - IRON(2, 250, 6.0F, 2.0F, 14), - EMERALD(3, 1561, 8.0F, 3.0F, 10), - GOLD(0, 32, 12.0F, 0.0F, 22); - */ - - //Weak Mats Name T Dur Flx Shp Rst Wg - getOrAddMetal("Tin", 0, 1.0F, 0.5F, 0.0F, 10F, 2.0F, 164, 177, 177).setRarity(-1).setMeltingPoint(900); - getOrAddMetal("Copper", 0, 1.0F, 1.0F, 0.0F, 50F, 3.0F, 255, 132, 66).setMeltingPoint(1000); - - //Standard Mats Name T Dur Flx Shp Rst Wg - getOrAddMetal("Bronze", 1, 1.5F, 1.0F, 1.5F, 20F, 3.0F, 207, 165, 118).setCrafterTiers(1).setMeltingPoint(1200); - getOrAddMetal("Iron", 2, 2.0F, 1.0F, 2.0F, 20F, 2.5F, 140, 120, 100).setCrafterTiers(2).setMeltingPoint(1200).setArmourStats(1.0F, 1.0F, 1.0F);//Standard - getOrAddMetal("RefinedIron", 2, 2.0F, 0.8F, 2.0F, 20F, 2.5F, 120, 95, 95).setCrafterTiers(2).setMeltingPoint(1200).setArmourStats(1.1F, 0.8F, 1.1F);//Less Blunt for more cutting/piercing - getOrAddMetal("Steel", 3, 3.0F, 1.0F, 2.5F, 30F, 2.5F, 168, 168, 168).setCrafterTiers(3).setMeltingPoint(1500); - getOrAddMetal("Encrusted", 4, 8.0F, 1.0F, 3.0F, 35F, 3.0F, 64, 255, 255).setCrafterTiers(3).setMeltingPoint(1800).setArmourStats(1.0F, 1.0F, 1.2F);//Better Piercing - getOrAddMetal("Obsidian", 4, 8.0F, 1.0F, 3.0F, 35F, 3.0F, 90 , 45 , 90).setCrafterTiers(3).setMeltingPoint(2000).setArmourStats(1.0F, 1.3F, 1.0F);//Better Blunt - getOrAddMetal("Tungsten", 4, 8.0F, 0.8F, 3.0F, 35F, 4.0F, 66 , 86 , 65).setCrafterTiers(3).setMeltingPoint(2000).setArmourStats(1.3F, 1.0F, 1.3F);//Better Cutting/Piercing - getOrAddMetal("BlackSteel", 5, 6.0F, 1.0F, 4.0F, 50F, 3.0F, 80 , 80 , 80).setCrafterTiers(4).setMeltingPoint(2000).setArmourStats(1.0F, 1.0F, 1.0F);//Standard - getOrAddMetal("BlueSteel", 6, 7.0F, 1.2F, 5.0F, 65F, 2.0F, 28, 31, 159).setCrafterTiers(5).setMeltingPoint(2000).setArmourStats(1.0F, 1.2F, 0.8F);//Better Blunt and Resist - getOrAddMetal("RedSteel", 6, 8.0F, 0.8F, 6.0F, 50F, 3.5F, 219, 56, 56).setCrafterTiers(5).setMeltingPoint(2000).setArmourStats(0.9F, 0.9F, 1.2F);//Better AC and Piercing - - //Precious Mats - getOrAddMetal("Silver", 0, 2.5F, 1.0F, 0.0F, 40F, 3.5F, 155, 206, 205).setMeltingPoint(1200); - getOrAddMetal("Gold", 0, 2.0F, 1.0F, 0.0F, 40F, 3.5F, 243, 222, 49).setMeltingPoint(1200); - - //Mythic Mats Name T Dur Flx Shp Rst Wg - getOrAddMetal("Mithril", 7, 10.0F, 0.8F, 7.0F, 90F, 2.0F, 250, 180, 250).setMeltingPoint(2500).setCrafterTiers(6).setRarity(1); - getOrAddMetal("Adamantium", 7, 12.0F, 0.8F, 8.0F, 80F, 3.5F, 100, 200, 100).setMeltingPoint(2500).setCrafterTiers(6).setRarity(1); - getOrAddMetal("Mithium", 8, 15.0F, 0.8F, 10.0F, 95F, 2.0F, 60 , 200, 255).setMeltingPoint(2500).setCrafterTiers(7).setRarity(2).setUnbreakable(); - getOrAddMetal("Ignotumite", 8, 15.0F, 0.8F, 14.0F, 85F, 3.5F, 20 , 255, 100).setMeltingPoint(3000).setCrafterTiers(7).setRarity(2).setUnbreakable(); - getOrAddMetal("Ender", 8, 15.0F, 0.8F, 12.0F, 90F, 3.0F, 255, 63 , 243).setMeltingPoint(3000).setCrafterTiers(7).setRarity(2).setUnbreakable(); - - //Non-MF - getOrAddMetal("StainlessSteel", 3, 5.0F, 1.0F, 2.5F, 40F, 2.5F, 188, 188, 198).setMeltingPoint(1600).setCrafterTiers(3); - getOrAddMetal("Titanium", 6, 10.0F, 1.0F, 4.0F, 50F, 1.0F, 190, 190, 160).setMeltingPoint(2000).setCrafterTiers(3); - - getOrAddMetal("Thaumium", 4, 4.0F, 1.0F, 3.0F, 65F, 2.5F, 115, 65 , 183).setMeltingPoint(1500).setCrafterTiers(3); - getOrAddMetal("Void", 4, 10.0F, 2.0F, 4.0F, 75F, 1.0F, 75 , 45 , 75).setMeltingPoint(1800).setCrafterTiers(3); - getOrAddMetal("Manasteel", 2, 3.0F, 1.0F, 2.0F, 40F, 2.5F, 88 , 195, 231).setMeltingPoint(1500).setArmourStats(1.0F, 1.2F, 1.0F).setCrafterTiers(2);//More Resistant, Stronger than iron - getOrAddMetal("ElvenElementium",3, 4.0F, 1.0F, 2.5F, 40F, 2.5F, 235, 108, 235).setMeltingPoint(1800).setArmourStats(1.1F, 1.0F, 1.1F).setCrafterTiers(2);//Similar to Manasteel, Slightly stronger - getOrAddMetal("Terrasteel", 4, 6.0F, 1.0F, 4.0F, 40F, 2.5F, 88 , 250, 150).setMeltingPoint(1500).setArmourStats(1.0F, 0.9F, 1.0F).setCrafterTiers(3); - - //Alloy - getOrAddMetal("CompositeAlloy", 4, 4.5F, 10.0F, 1.0F, 2.5F, 75F, 4.0F, 65, 75 ,65).setMeltingPoint(2500).setRarity(1).setCrafterTiers(3).modifyCraftTime(5.0F);//Powerful All-Rounder - } - - public static void addHeatables() - { - ArrayList metal = CustomMaterial.getList("metal"); - Iterator iteratorMetal = metal.iterator(); - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - int[] stats = customMat.getHeatableStats(); - MFLogUtil.logDebug("Set Heatable Stats for " + customMat.name + ": " + stats[0] + "," + stats[1] + "," + stats[2]); - - MineFantasyAPI.setHeatableStats("ingot"+customMat.name, stats[0], stats[1], stats[2]); - MineFantasyAPI.setHeatableStats("hunk"+customMat.name, stats[0], stats[1], stats[2]); - } - - MineFantasyAPI.setHeatableStats(ComponentListMF.rivet, 1000, 2000, 3000); - MineFantasyAPI.setHeatableStats(ComponentListMF.metalHunk, -1, -1, -1); - MineFantasyAPI.setHeatableStats(ComponentListMF.bar, -1, -1, -1); - } - - @Override - public ItemStack getItem() - { - ArrayList list = OreDictionary.getOres("ingot"+name); - if(list != null && !list.isEmpty()) - { - return list.get(0); - } - return null; - } + @Override + public ItemStack getItem() { + ArrayList list = OreDictionary.getOres("ingot" + name); + if (list != null && !list.isEmpty()) { + return list.get(0); + } + return null; + } } diff --git a/src/main/java/minefantasy/mf2/material/WoodMaterial.java b/src/main/java/minefantasy/mf2/material/WoodMaterial.java index be31a6e9..42a347dc 100644 --- a/src/main/java/minefantasy/mf2/material/WoodMaterial.java +++ b/src/main/java/minefantasy/mf2/material/WoodMaterial.java @@ -1,109 +1,110 @@ package minefantasy.mf2.material; -import java.util.ArrayList; - +import minefantasy.mf2.api.material.CustomMaterial; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; -import minefantasy.mf2.api.material.CustomMaterial; -public class WoodMaterial extends CustomMaterial -{ - public WoodMaterial(String name, int tier, float hardness, float durability, float flexibility, float sharpness, float resistance, float density) - { - super(name, "wood", tier, hardness, durability, flexibility, resistance, sharpness, density); - } - - /** - * @param name The name of the wood - * @param tier Tier of the material - * @param hardness The impact it can take (used for reinforcment in BG shields), usually an armour rating based value - * @param durability how many uses / 250 - * @param flexibility The ability to flex and reshape, used in bow power - * @param resistance Resistance to rot - * @param density How much a unit (timber plank) weighs in Kg - */ - public static CustomMaterial getOrAddWood(String name, int tier, float hardness, float durability, float flexibility, float resistance, float density, int red, int green, int blue) - { - if(getMaterial(name) != null) - { - return CustomMaterial.getMaterial(name); - } - return new WoodMaterial(name, tier, hardness, durability, flexibility, 0F, resistance, density).setColour(red, green, blue).register(); - } - @Override - public String getMaterialString() - { - return StatCollector.translateToLocalFormatted("materialtype."+this.type+".name", this.tier); - } - public static void init() - { - new CustomMaterial("magic", "Magic", -1, 1F, 0F, 1F, 0F, 0F, 0F).setColour(157, 157, 255).register(); - - MetalMaterial.init(); - LeatherMaterial.init(); - //Hardness-The Impact it can take. Used for armour rating, in this case nothing. - //Durability- how many uses it has, 1 pt per 250 uses (1/5th this adds to durability to tools if used as a haft). - //Flexibility- how well the wood can bend and reshape, affects bow damage. This is the direct damage modifier of the bow - //Resistance- Score of how well the wood withstands rot and weathering. - //Density- how much weight (Kg) does the timber plank weigh. - - // Name T Hds Dua Flx Rst Wgt R G B - getOrAddWood("ScrapWood", 0, 0.10F, 0.50F, 0.50F, 10F, 0.5F, 100, 95, 80); - - getOrAddWood("OakWood", 1, 0.70F, 1.00F, 1.30F, 40F, 0.8F, 149, 119, 70).setCrafterTiers(1); - getOrAddWood("SpruceWood", 1, 0.20F, 0.90F, 1.00F, 20F, 0.4F, 102, 79, 47).setCrafterTiers(1); - getOrAddWood("BirchWood", 1, 0.50F, 0.90F, 1.30F, 10F, 0.7F, 200, 183, 122).setCrafterTiers(1); - getOrAddWood("JungleWood", 1, 0.40F, 1.00F, 1.20F, 50F, 0.6F, 159, 113, 74).setCrafterTiers(1); - getOrAddWood("AcaciaWood", 1, 0.50F, 1.20F, 1.00F, 20F, 0.6F, 173, 93, 50).setCrafterTiers(1); - getOrAddWood("DarkOakWood", 1, 1.20F, 1.50F, 1.30F, 50F, 1.0F, 62, 41, 18).setCrafterTiers(1); - - getOrAddWood("RefinedWood", 2, 0.80F, 2.00F, 1.30F, 50F, 0.8F, 95, 40, 24).setCrafterTiers(2).setRarity(1); - getOrAddWood("YewWood", 2, 0.70F, 2.00F, 2.00F, 40F, 0.7F, 195, 138, 54).setCrafterTiers(2).setRarity(1); - getOrAddWood("IronbarkWood", 2, 0.90F, 3.50F, 1.10F, 50F, 0.9F, 202, 92, 29).setCrafterTiers(2).setRarity(1); - - getOrAddWood("EbonyWood", 3, 1.30F, 4.00F, 1.60F, 80F, 1.0F, 50, 46, 40).setCrafterTiers(3).setRarity(2); - - getOrAddWood("SilverwoodWood", 2, 1.00F, 3.50F, 2.20F, 75F, 0.8F, 224, 220, 208).setCrafterTiers(2); - getOrAddWood("GreatwoodWood", 2, 1.20F, 1.50F, 1.00F, 50F, 1.5F, 37, 25, 23).setCrafterTiers(2); - /* - //OTHERS. playing around with, mainly forestry - getOrAddWood("PineWood", 0, 1, 1, 1, 1, 1, 1, 189, 147, 63); - getOrAddWood("CherryWood", 0, 1, 1, 1, 1, 1, 1, 162, 116, 47); - getOrAddWood("PapayaWood", 0, 1, 1, 1, 1, 1, 1, 214, 194, 91); - getOrAddWood("CitrusWood", 0, 1, 1, 1, 1, 1, 1, 142, 153, 27); - getOrAddWood("PoplarWood", 0, 1, 1, 1, 1, 1, 1, 198, 198, 107); - getOrAddWood("MapleWood", 0, 1, 1, 1, 1, 1, 1, 158, 99, 39); - getOrAddWood("MahoeWood", 0, 1, 1, 1, 1, 1, 1, 111, 138, 158); - getOrAddWood("GreenheartWood", 0, 1, 1, 1, 1, 1, 1, 65, 103, 77); - getOrAddWood("PalmWood", 0, 1, 1, 1, 1, 1, 1, 195, 114, 56); - getOrAddWood("LimeWood", 0, 1, 1, 1, 1, 1, 1, 190, 147, 96); - getOrAddWood("BalsaWood", 0, 1, 1, 1, 1, 1, 1, 159, 152, 143); - getOrAddWood("WalnutWood", 0, 1, 1, 1, 1, 1, 1, 85, 69, 55); - getOrAddWood("KapokWood", 0, 1, 1, 1, 1, 1, 1, 99, 95, 45); - getOrAddWood("ChestnutWood", 0, 1, 1, 1, 1, 1, 1, 156, 147, 74); - getOrAddWood("BaobabWood", 0, 1, 1, 1, 1, 1, 1, 116, 126, 84); - getOrAddWood("LarchWood", 0, 1, 1, 1, 1, 1, 1, 200, 143, 122); - getOrAddWood("WillowWood", 0, 1, 1, 1, 1, 1, 1, 149, 152, 74); - getOrAddWood("TeakWood", 0, 1, 1, 1, 1, 1, 1, 111, 107, 91); - getOrAddWood("SequoiaWood", 0, 1, 1, 1, 1, 1, 1, 123, 81, 75); - getOrAddWood("MahoganyWood", 0, 1, 1, 1, 1, 1, 1, 95, 56, 49); - getOrAddWood("WengeWood", 0, 1, 1, 1, 1, 1, 1, 76, 72, 62); - getOrAddWood("RedwoodWood", 0, 1, 1, 1, 1, 1, 1, 148, 104, 55); - getOrAddWood("FirWood", 0, 1, 1, 1, 1, 1, 1, 114, 111, 63); - getOrAddWood("PurpleHeartWood", 0, 1, 1, 1, 1, 1, 1, 55, 25, 49); - */ - - } - @Override - public ItemStack getItem() - { - ArrayList list = OreDictionary.getOres("planks"+name); - if(list != null && !list.isEmpty()) - { - return list.get(0); - } - return null; - } - +import java.util.ArrayList; + +public class WoodMaterial extends CustomMaterial { + public WoodMaterial(String name, int tier, float hardness, float durability, float flexibility, float sharpness, + float resistance, float density) { + super(name, "wood", tier, hardness, durability, flexibility, resistance, sharpness, density); + } + + /** + * @param name The name of the wood + * @param tier Tier of the material + * @param hardness The impact it can take (used for reinforcment in BG shields), + * usually an armour rating based value + * @param durability how many uses / 250 + * @param flexibility The ability to flex and reshape, used in bow power + * @param resistance Resistance to rot + * @param density How much a unit (timber plank) weighs in Kg + */ + public static CustomMaterial getOrAddWood(String name, int tier, float hardness, float durability, + float flexibility, float resistance, float density, int red, int green, int blue) { + if (getMaterial(name) != null) { + return CustomMaterial.getMaterial(name); + } + return new WoodMaterial(name, tier, hardness, durability, flexibility, 0F, resistance, density) + .setColour(red, green, blue).register(); + } + + public static void init() { + new CustomMaterial("magic", "Magic", -1, 1F, 0F, 1F, 0F, 0F, 0F).setColour(157, 157, 255).register(); + + MetalMaterial.init(); + LeatherMaterial.init(); + // Hardness-The Impact it can take. Used for armour rating, in this case + // nothing. + // Durability- how many uses it has, 1 pt per 250 uses (1/5th this adds to + // durability to tools if used as a haft). + // Flexibility- how well the wood can bend and reshape, affects bow damage. This + // is the direct damage modifier of the bow + // Resistance- Score of how well the wood withstands rot and weathering. + // Density- how much weight (Kg) does the timber plank weigh. + + // Name T Hds Dua Flx Rst Wgt R G B + getOrAddWood("ScrapWood", 0, 0.10F, 0.50F, 0.50F, 10F, 0.5F, 100, 95, 80); + + getOrAddWood("OakWood", 1, 0.70F, 1.00F, 1.30F, 40F, 0.8F, 149, 119, 70).setCrafterTiers(1); + getOrAddWood("SpruceWood", 1, 0.20F, 0.90F, 1.00F, 20F, 0.4F, 102, 79, 47).setCrafterTiers(1); + getOrAddWood("BirchWood", 1, 0.50F, 0.90F, 1.30F, 10F, 0.7F, 200, 183, 122).setCrafterTiers(1); + getOrAddWood("JungleWood", 1, 0.40F, 1.00F, 1.20F, 50F, 0.6F, 159, 113, 74).setCrafterTiers(1); + getOrAddWood("AcaciaWood", 1, 0.50F, 1.20F, 1.00F, 20F, 0.6F, 173, 93, 50).setCrafterTiers(1); + getOrAddWood("DarkOakWood", 1, 1.20F, 1.50F, 1.30F, 50F, 1.0F, 62, 41, 18).setCrafterTiers(1); + + getOrAddWood("RefinedWood", 2, 0.80F, 2.00F, 1.30F, 50F, 0.8F, 95, 40, 24).setCrafterTiers(2).setRarity(1); + getOrAddWood("YewWood", 2, 0.70F, 2.00F, 2.00F, 40F, 0.7F, 195, 138, 54).setCrafterTiers(2).setRarity(1); + getOrAddWood("IronbarkWood", 2, 0.90F, 3.50F, 1.10F, 50F, 0.9F, 202, 92, 29).setCrafterTiers(2).setRarity(1); + + getOrAddWood("EbonyWood", 3, 1.30F, 4.00F, 1.60F, 80F, 1.0F, 50, 46, 40).setCrafterTiers(3).setRarity(2); + + getOrAddWood("SilverwoodWood", 2, 1.00F, 3.50F, 2.20F, 75F, 0.8F, 224, 220, 208).setCrafterTiers(2); + getOrAddWood("GreatwoodWood", 2, 1.20F, 1.50F, 1.00F, 50F, 1.5F, 37, 25, 23).setCrafterTiers(2); + /* + * //OTHERS. playing around with, mainly forestry getOrAddWood("PineWood", 0, 1, + * 1, 1, 1, 1, 1, 189, 147, 63); getOrAddWood("CherryWood", 0, 1, 1, 1, 1, 1, 1, + * 162, 116, 47); getOrAddWood("PapayaWood", 0, 1, 1, 1, 1, 1, 1, 214, 194, 91); + * getOrAddWood("CitrusWood", 0, 1, 1, 1, 1, 1, 1, 142, 153, 27); + * getOrAddWood("PoplarWood", 0, 1, 1, 1, 1, 1, 1, 198, 198, 107); + * getOrAddWood("MapleWood", 0, 1, 1, 1, 1, 1, 1, 158, 99, 39); + * getOrAddWood("MahoeWood", 0, 1, 1, 1, 1, 1, 1, 111, 138, 158); + * getOrAddWood("GreenheartWood", 0, 1, 1, 1, 1, 1, 1, 65, 103, 77); + * getOrAddWood("PalmWood", 0, 1, 1, 1, 1, 1, 1, 195, 114, 56); + * getOrAddWood("LimeWood", 0, 1, 1, 1, 1, 1, 1, 190, 147, 96); + * getOrAddWood("BalsaWood", 0, 1, 1, 1, 1, 1, 1, 159, 152, 143); + * getOrAddWood("WalnutWood", 0, 1, 1, 1, 1, 1, 1, 85, 69, 55); + * getOrAddWood("KapokWood", 0, 1, 1, 1, 1, 1, 1, 99, 95, 45); + * getOrAddWood("ChestnutWood", 0, 1, 1, 1, 1, 1, 1, 156, 147, 74); + * getOrAddWood("BaobabWood", 0, 1, 1, 1, 1, 1, 1, 116, 126, 84); + * getOrAddWood("LarchWood", 0, 1, 1, 1, 1, 1, 1, 200, 143, 122); + * getOrAddWood("WillowWood", 0, 1, 1, 1, 1, 1, 1, 149, 152, 74); + * getOrAddWood("TeakWood", 0, 1, 1, 1, 1, 1, 1, 111, 107, 91); + * getOrAddWood("SequoiaWood", 0, 1, 1, 1, 1, 1, 1, 123, 81, 75); + * getOrAddWood("MahoganyWood", 0, 1, 1, 1, 1, 1, 1, 95, 56, 49); + * getOrAddWood("WengeWood", 0, 1, 1, 1, 1, 1, 1, 76, 72, 62); + * getOrAddWood("RedwoodWood", 0, 1, 1, 1, 1, 1, 1, 148, 104, 55); + * getOrAddWood("FirWood", 0, 1, 1, 1, 1, 1, 1, 114, 111, 63); + * getOrAddWood("PurpleHeartWood", 0, 1, 1, 1, 1, 1, 1, 55, 25, 49); + */ + + } + + @Override + public String getMaterialString() { + return StatCollector.translateToLocalFormatted("materialtype." + this.type + ".name", this.tier); + } + + @Override + public ItemStack getItem() { + ArrayList list = OreDictionary.getOres("planks" + name); + if (list != null && !list.isEmpty()) { + return list.get(0); + } + return null; + } + } diff --git a/src/main/java/minefantasy/mf2/mechanics/ArrowHandlerMF.java b/src/main/java/minefantasy/mf2/mechanics/ArrowHandlerMF.java index d4ba400d..770a0089 100644 --- a/src/main/java/minefantasy/mf2/mechanics/ArrowHandlerMF.java +++ b/src/main/java/minefantasy/mf2/mechanics/ArrowHandlerMF.java @@ -1,8 +1,8 @@ package minefantasy.mf2.mechanics; +import cpw.mods.fml.common.eventhandler.EventPriority; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import minefantasy.mf2.api.archery.AmmoMechanicsMF; -import minefantasy.mf2.api.rpg.RPGElements; -import minefantasy.mf2.api.rpg.SkillList; import minefantasy.mf2.api.stamina.StaminaBar; import minefantasy.mf2.config.ConfigStamina; import net.minecraft.enchantment.Enchantment; @@ -14,184 +14,150 @@ import net.minecraft.world.World; import net.minecraftforge.event.entity.player.ArrowLooseEvent; import net.minecraftforge.event.entity.player.ArrowNockEvent; -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent.ItemPickupEvent; - -public class ArrowHandlerMF -{ - /** - * When the arrow is pulled back it initiates - */ - @SubscribeEvent - public void readyBow(ArrowNockEvent event) - { - EntityPlayer user = event.entityPlayer; - ItemStack bow = event.result; - - if(AmmoMechanicsMF.arrows == null || AmmoMechanicsMF.arrows.size() <= 0) - { - if(getIsInfinite(event.entityPlayer, event.result)) - { - user.setItemInUse(bow, bow.getMaxItemUseDuration());//Starts pullback - event.setCanceled(true); - } - return; - } - - /*Checks over registered arrows and finds one to load - * The Quiver can be used to determine this - */ - ItemStack arrowToFire = AmmoMechanicsMF.reloadBow(bow); - if(arrowToFire != null) - { - user.setItemInUse(bow, bow.getMaxItemUseDuration());//Starts pullback - loadArrow(user, bow, arrowToFire);//adds the arrow to NBT for rendering and later use - event.setCanceled(true); - return; - } - else - { - if(getIsInfinite(event.entityPlayer, event.result)) - { - user.setItemInUse(bow, bow.getMaxItemUseDuration());//Starts pullback - event.setCanceled(true); - return; - } - } - /* - for(int a = 0; a < AmmoMechanicsMF.arrows.size(); a ++) - { - ItemStack arrow = AmmoMechanicsMF.arrows.get(a); - if(user.inventory.hasItemStack(arrow)) - { - user.setItemInUse(bow, bow.getMaxItemUseDuration());//Starts pullback - loadArrow(user, bow, arrow);//adds the arrow to NBT for rendering and later use - event.setCanceled(true); - return; - } - } - */ - } - - /** - * This method adds arrows to the bow - */ - public static void loadArrow(EntityPlayer player, ItemStack bow, ItemStack arrow) - { - if(player.worldObj.isRemote) - { - return; - } - NBTTagCompound nbt = getOrApplyNBT(bow); - - if(arrow == null) - { - nbt.removeTag("loadedArrow"); - } - else - { - NBTTagCompound loaded = new NBTTagCompound(); - arrow.writeToNBT(loaded); - nbt.setTag("loadedArrow", loaded); - } - } - - /** - * Gets the NBT, if there is none, it creates it - */ - private static NBTTagCompound getOrApplyNBT(ItemStack bow) - { - if(!bow.hasTagCompound()) - { - bow.setTagCompound(new NBTTagCompound()); - } - return bow.getTagCompound(); - } - - @SubscribeEvent (priority=EventPriority.HIGHEST) - public void applyExhaustArrow(ArrowLooseEvent event) - { - if(StaminaBar.isSystemActive && !StaminaBar.isAnyStamina(event.entityPlayer, false)) - { - if(ConfigStamina.weaponDrain < 1.0F) - event.charge *= ConfigStamina.weaponDrain; - } - } - /** - * This initates when firing a bow - * @param event - */ - @SubscribeEvent - public void fireArrow(ArrowLooseEvent event) - { - float power = event.charge; - EntityPlayer user = event.entityPlayer; - - ItemStack bow = event.bow; - World world = event.entity.worldObj; - boolean creative = user.capabilities.isCreativeMode; - - float charge = power / 20.0F; + +public class ArrowHandlerMF { + /** + * This method adds arrows to the bow + */ + public static void loadArrow(EntityPlayer player, ItemStack bow, ItemStack arrow) { + if (player.worldObj.isRemote) { + return; + } + NBTTagCompound nbt = getOrApplyNBT(bow); + + if (arrow == null) { + nbt.removeTag("loadedArrow"); + } else { + NBTTagCompound loaded = new NBTTagCompound(); + arrow.writeToNBT(loaded); + nbt.setTag("loadedArrow", loaded); + } + } + + /** + * Gets the NBT, if there is none, it creates it + */ + private static NBTTagCompound getOrApplyNBT(ItemStack bow) { + if (!bow.hasTagCompound()) { + bow.setTagCompound(new NBTTagCompound()); + } + return bow.getTagCompound(); + } + + /** + * When the arrow is pulled back it initiates + */ + @SubscribeEvent + public void readyBow(ArrowNockEvent event) { + EntityPlayer user = event.entityPlayer; + ItemStack bow = event.result; + + if (AmmoMechanicsMF.arrows == null || AmmoMechanicsMF.arrows.size() <= 0) { + if (getIsInfinite(event.entityPlayer, event.result)) { + user.setItemInUse(bow, bow.getMaxItemUseDuration());// Starts pullback + event.setCanceled(true); + } + return; + } + + /* + * Checks over registered arrows and finds one to load The Quiver can be used to + * determine this + */ + ItemStack arrowToFire = AmmoMechanicsMF.reloadBow(bow); + if (arrowToFire != null) { + user.setItemInUse(bow, bow.getMaxItemUseDuration());// Starts pullback + loadArrow(user, bow, arrowToFire);// adds the arrow to NBT for rendering and later use + event.setCanceled(true); + return; + } else { + if (getIsInfinite(event.entityPlayer, event.result)) { + user.setItemInUse(bow, bow.getMaxItemUseDuration());// Starts pullback + event.setCanceled(true); + return; + } + } + /* + * for(int a = 0; a < AmmoMechanicsMF.arrows.size(); a ++) { ItemStack arrow = + * AmmoMechanicsMF.arrows.get(a); if(user.inventory.hasItemStack(arrow)) { + * user.setItemInUse(bow, bow.getMaxItemUseDuration());//Starts pullback + * loadArrow(user, bow, arrow);//adds the arrow to NBT for rendering and later + * use event.setCanceled(true); return; } } + */ + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void applyExhaustArrow(ArrowLooseEvent event) { + if (StaminaBar.isSystemActive && !StaminaBar.isAnyStamina(event.entityPlayer, false)) { + if (ConfigStamina.weaponDrain < 1.0F) + event.charge *= ConfigStamina.weaponDrain; + } + } + + /** + * This initates when firing a bow + * + * @param event + */ + @SubscribeEvent + public void fireArrow(ArrowLooseEvent event) { + float power = event.charge; + EntityPlayer user = event.entityPlayer; + + ItemStack bow = event.bow; + World world = event.entity.worldObj; + boolean creative = user.capabilities.isCreativeMode; + + float charge = power / 20.0F; charge = (charge * charge + charge * 2.0F) / 3.0F; - if (charge < 0.1D) - { + if (charge < 0.1D) { return; } - if (charge > 1.0F) - { + if (charge > 1.0F) { charge = 1.0F; } - - - //Default is flint arrow - ItemStack arrow = new ItemStack(Items.arrow); - if(AmmoMechanicsMF.getArrowOnBow(bow) != null) - { - //if an arrow is on the bow, it uses that - arrow = AmmoMechanicsMF.getArrowOnBow(bow); - } - if(AmmoMechanicsMF.handlers != null && AmmoMechanicsMF.handlers.size() > 0) - { - for(int a = 0; a < AmmoMechanicsMF.handlers.size(); a ++) - { - //If the Arrow handler succeeds at firing an arrow - if(AmmoMechanicsMF.handlers.get(a).onFireArrow(world, arrow, bow, user, charge, creative)) - { - if(!user.capabilities.isCreativeMode) - { - bow.damageItem(1, user); - } - world.playSoundAtEntity(user, "minefantasy2:weapon.bowFire", 0.5F, 1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + charge * 0.5F); - loadArrow(user, bow, null); - event.setCanceled(true); - AmmoMechanicsMF.consumeAmmo(user, bow); - break; - } - } - } - } - private boolean getIsInfinite(EntityPlayer user, ItemStack bow) - { - return user.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) > 0; - } - - //Used to take an item/subId from the inventory - private boolean consumePlayerItem(EntityPlayer player, ItemStack item) - { - for(int a = 0; a < player.inventory.getSizeInventory(); a ++) - { - ItemStack i = player.inventory.getStackInSlot(a); - if(i != null && i.isItemEqual(item)) - { - player.inventory.decrStackSize(a, 1); - return true; - } - } - return false; - } - + + // Default is flint arrow + ItemStack arrow = new ItemStack(Items.arrow); + if (AmmoMechanicsMF.getArrowOnBow(bow) != null) { + // if an arrow is on the bow, it uses that + arrow = AmmoMechanicsMF.getArrowOnBow(bow); + } + if (AmmoMechanicsMF.handlers != null && AmmoMechanicsMF.handlers.size() > 0) { + for (int a = 0; a < AmmoMechanicsMF.handlers.size(); a++) { + // If the Arrow handler succeeds at firing an arrow + if (AmmoMechanicsMF.handlers.get(a).onFireArrow(world, arrow, bow, user, charge, creative)) { + if (!user.capabilities.isCreativeMode) { + bow.damageItem(1, user); + } + world.playSoundAtEntity(user, "minefantasy2:weapon.bowFire", 0.5F, + 1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + charge * 0.5F); + loadArrow(user, bow, null); + event.setCanceled(true); + AmmoMechanicsMF.consumeAmmo(user, bow); + break; + } + } + } + } + + private boolean getIsInfinite(EntityPlayer user, ItemStack bow) { + return user.capabilities.isCreativeMode + || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) > 0; + } + + // Used to take an item/subId from the inventory + private boolean consumePlayerItem(EntityPlayer player, ItemStack item) { + for (int a = 0; a < player.inventory.getSizeInventory(); a++) { + ItemStack i = player.inventory.getStackInSlot(a); + if (i != null && i.isItemEqual(item)) { + player.inventory.decrStackSize(a, 1); + return true; + } + } + return false; + } + } diff --git a/src/main/java/minefantasy/mf2/mechanics/ArrowListMF.java b/src/main/java/minefantasy/mf2/mechanics/ArrowListMF.java index 01dc5bc3..42a311e6 100644 --- a/src/main/java/minefantasy/mf2/mechanics/ArrowListMF.java +++ b/src/main/java/minefantasy/mf2/mechanics/ArrowListMF.java @@ -1,25 +1,23 @@ package minefantasy.mf2.mechanics; +import net.minecraft.item.ItemStack; + import java.util.ArrayList; import java.util.List; -import net.minecraft.item.ItemStack; - @Deprecated -public class ArrowListMF -{ - public static List useableArrows = new ArrayList(); - private static void addArrow(ItemStack arrow) - { - useableArrows.add(arrow); - } - private static boolean canShootArrow(ItemStack arrow) - { - for(ItemStack Comparearrow: useableArrows) - { - if(Comparearrow.isItemEqual(arrow)) - return true; - } - return false; - } +public class ArrowListMF { + public static List useableArrows = new ArrayList(); + + private static void addArrow(ItemStack arrow) { + useableArrows.add(arrow); + } + + private static boolean canShootArrow(ItemStack arrow) { + for (ItemStack Comparearrow : useableArrows) { + if (Comparearrow.isItemEqual(arrow)) + return true; + } + return false; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/BombDispenser.java b/src/main/java/minefantasy/mf2/mechanics/BombDispenser.java index 7d9380e9..6ec8d8ac 100644 --- a/src/main/java/minefantasy/mf2/mechanics/BombDispenser.java +++ b/src/main/java/minefantasy/mf2/mechanics/BombDispenser.java @@ -11,73 +11,68 @@ import net.minecraft.util.EnumFacing; import net.minecraft.world.World; -public class BombDispenser implements IBehaviorDispenseItem -{ +public class BombDispenser implements IBehaviorDispenseItem { - @Override - public ItemStack dispense(IBlockSource dispenser, ItemStack item) - { - EnumFacing direction = BlockDispenser.func_149937_b(dispenser.getBlockMetadata()); - //BlockDispenser - if(item == null)return null; - - if(item.getItem() instanceof ItemBomb) - { - ItemBomb itembomb = (ItemBomb)item.getItem(); - World world = dispenser.getWorld(); - - double posX = dispenser.getX() + ((float)direction.getFrontOffsetX()/2F); - double posY = dispenser.getY() + ((float)direction.getFrontOffsetY()/2F); - double posZ = dispenser.getZ() + ((float)direction.getFrontOffsetZ()/2F); - - double xVelocity = + direction.getFrontOffsetX(); - double yVelocity = + direction.getFrontOffsetY(); - double zVelocity = + direction.getFrontOffsetZ(); - float velocityModifier = 1.5F; - - if (!world.isRemote) - { - EntityBomb bomb = new EntityBomb(world).setType(ItemBomb.getFilling(item), ItemBomb.getCasing(item), ItemBomb.getFuse(item), ItemBomb.getPowder(item)); - bomb.setPosition(posX, posY, posZ); - bomb.setThrowableHeading(xVelocity, yVelocity, zVelocity, 1.0F, velocityModifier); - world.spawnEntityInWorld(bomb); - if(item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) - { - bomb.getEntityData().setBoolean("stickyBomb", true); - } - } - item.splitStack(1); - } - - if(item.getItem() instanceof ItemMine) - { - ItemMine itembomb = (ItemMine)item.getItem(); - World world = dispenser.getWorld(); - - double posX = dispenser.getX() + ((float)direction.getFrontOffsetX()/2F); - double posY = dispenser.getY() + ((float)direction.getFrontOffsetY()/2F); - double posZ = dispenser.getZ() + ((float)direction.getFrontOffsetZ()/2F); - - double xVelocity = + direction.getFrontOffsetX(); - double yVelocity = + direction.getFrontOffsetY(); - double zVelocity = + direction.getFrontOffsetZ(); - float velocityModifier = 0.5F; - - if (!world.isRemote) - { - EntityMine bomb = new EntityMine(world).setType(ItemBomb.getFilling(item), ItemBomb.getCasing(item), ItemBomb.getFuse(item), ItemBomb.getPowder(item)); - bomb.setPosition(posX, posY, posZ); - bomb.setThrowableHeading(xVelocity, yVelocity, zVelocity, 1.0F, velocityModifier); - world.spawnEntityInWorld(bomb); - if(item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) - { - bomb.getEntityData().setBoolean("stickyBomb", true); - } - } - item.splitStack(1); - } - - return item; - } + @Override + public ItemStack dispense(IBlockSource dispenser, ItemStack item) { + EnumFacing direction = BlockDispenser.func_149937_b(dispenser.getBlockMetadata()); + // BlockDispenser + if (item == null) + return null; + + if (item.getItem() instanceof ItemBomb) { + ItemBomb itembomb = (ItemBomb) item.getItem(); + World world = dispenser.getWorld(); + + double posX = dispenser.getX() + (direction.getFrontOffsetX() / 2F); + double posY = dispenser.getY() + (direction.getFrontOffsetY() / 2F); + double posZ = dispenser.getZ() + (direction.getFrontOffsetZ() / 2F); + + double xVelocity = +direction.getFrontOffsetX(); + double yVelocity = +direction.getFrontOffsetY(); + double zVelocity = +direction.getFrontOffsetZ(); + float velocityModifier = 1.5F; + + if (!world.isRemote) { + EntityBomb bomb = new EntityBomb(world).setType(ItemBomb.getFilling(item), ItemBomb.getCasing(item), + ItemBomb.getFuse(item), ItemBomb.getPowder(item)); + bomb.setPosition(posX, posY, posZ); + bomb.setThrowableHeading(xVelocity, yVelocity, zVelocity, 1.0F, velocityModifier); + world.spawnEntityInWorld(bomb); + if (item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) { + bomb.getEntityData().setBoolean("stickyBomb", true); + } + } + item.splitStack(1); + } + + if (item.getItem() instanceof ItemMine) { + ItemMine itembomb = (ItemMine) item.getItem(); + World world = dispenser.getWorld(); + + double posX = dispenser.getX() + (direction.getFrontOffsetX() / 2F); + double posY = dispenser.getY() + (direction.getFrontOffsetY() / 2F); + double posZ = dispenser.getZ() + (direction.getFrontOffsetZ() / 2F); + + double xVelocity = +direction.getFrontOffsetX(); + double yVelocity = +direction.getFrontOffsetY(); + double zVelocity = +direction.getFrontOffsetZ(); + float velocityModifier = 0.5F; + + if (!world.isRemote) { + EntityMine bomb = new EntityMine(world).setType(ItemBomb.getFilling(item), ItemBomb.getCasing(item), + ItemBomb.getFuse(item), ItemBomb.getPowder(item)); + bomb.setPosition(posX, posY, posZ); + bomb.setThrowableHeading(xVelocity, yVelocity, zVelocity, 1.0F, velocityModifier); + world.spawnEntityInWorld(bomb); + if (item.hasTagCompound() && item.getTagCompound().hasKey("stickyBomb")) { + bomb.getEntityData().setBoolean("stickyBomb", true); + } + } + item.splitStack(1); + } + + return item; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/CombatMechanics.java b/src/main/java/minefantasy/mf2/mechanics/CombatMechanics.java index eb7d0d7e..2301848a 100644 --- a/src/main/java/minefantasy/mf2/mechanics/CombatMechanics.java +++ b/src/main/java/minefantasy/mf2/mechanics/CombatMechanics.java @@ -1,28 +1,14 @@ package minefantasy.mf2.mechanics; -import java.util.Map; -import java.util.Random; - import cpw.mods.fml.common.eventhandler.SubscribeEvent; import minefantasy.mf2.api.armour.IElementalResistance; -import minefantasy.mf2.api.helpers.ArmourCalculator; -import minefantasy.mf2.api.helpers.ArrowEffectsMF; -import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.PowerArmour; -import minefantasy.mf2.api.helpers.TacticalManager; +import minefantasy.mf2.api.helpers.*; import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.api.rpg.SkillList; import minefantasy.mf2.api.stamina.StaminaBar; -import minefantasy.mf2.api.weapon.IDamageModifier; -import minefantasy.mf2.api.weapon.IKnockbackWeapon; -import minefantasy.mf2.api.weapon.IParryable; -import minefantasy.mf2.api.weapon.IPowerAttack; -import minefantasy.mf2.api.weapon.ISpecialCombatMob; -import minefantasy.mf2.api.weapon.ISpecialEffect; -import minefantasy.mf2.api.weapon.IWeaponSpeed; -import minefantasy.mf2.api.weapon.IWeightedWeapon; +import minefantasy.mf2.api.weapon.*; import minefantasy.mf2.config.ConfigArmour; import minefantasy.mf2.config.ConfigExperiment; import minefantasy.mf2.config.ConfigStamina; @@ -30,20 +16,18 @@ import minefantasy.mf2.entity.EntityCogwork; import minefantasy.mf2.entity.Shockwave; import minefantasy.mf2.entity.mob.EntityMinotaur; -import minefantasy.mf2.item.weapon.ItemBattleaxeMF; -import minefantasy.mf2.item.weapon.ItemDagger; -import minefantasy.mf2.item.weapon.ItemKatanaMF; -import minefantasy.mf2.item.weapon.ItemWaraxeMF; -import minefantasy.mf2.item.weapon.ItemWeaponMF; +import minefantasy.mf2.item.weapon.*; import minefantasy.mf2.knowledge.KnowledgeListMF; import minefantasy.mf2.network.packet.DodgeCommand; import minefantasy.mf2.network.packet.ParryPacket; import minefantasy.mf2.util.MFLogUtil; +import minefantasy.mf2.util.XSTRandom; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; @@ -63,158 +47,373 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; -public class CombatMechanics -{ - public static final String parryCooldownNBT = "MF_Parry_Cooldown"; - public static final String posthitCooldownNBT = "MF_PostHit"; - private static Random rand = new Random(); - /** Damage done by silver to undead/witches*/ - public static final float specialUnholyModifier = 2.0F; - /** Damage done by silver to werewolves*/ - public static final float specialWerewolfModifier = 8.0F; - /** Damage done with dragonforged design to dragons*/ - public static final float specialDragonModifier = 1.5F; - /** Damage done with ornate design to undead/witches*/ - public static final float specialOrnateModifier = 1.5F; - public static boolean swordSkeleton = true; - - protected float jumpEvade_cost = 30; - protected float evade_cost = 10; - - @SubscribeEvent - public void initAttack(LivingAttackEvent event) - { - EntityLivingBase hitter = getHitter(event.source); - int spd = EventManagerMF.getHitspeedTime(hitter); - if(hitter != null && !hitter.worldObj.isRemote) - { - if(spd > 0 && !(event.entityLiving instanceof EntityPlayer)) - { event.setCanceled(true); - return; - } - } - DamageSource src = event.source; - EntityLivingBase hit = event.entityLiving; - World world = hit.worldObj; - boolean powerArmour = PowerArmour.isFullyArmoured(hit); - float damage = modifyDamage(src, world, hit, event.ammount, false); - - if(event.source.isProjectile() && !event.source.isFireDamage()) - { - if(powerArmour || (damage < event.ammount && hit.getTotalArmorValue() > 0))//only if dam has been reduced - { - if(ConfigArmour.resistArrow && !event.isCanceled() && (damage <= 0.5F))//TacticalManager.resistArrow(event.entityLiving, event.source, damage)) - { - if(event.source.getSourceOfDamage() != null && !event.source.getSourceOfDamage().getEntityData().hasKey("arrowDeflectMF") && !(event.source.getEntity() instanceof EntityEnderPearl)) - { - event.source.getSourceOfDamage().getEntityData().setBoolean("arrowDeflectMF", true); - event.entityLiving.worldObj.playSoundAtEntity(event.entityLiving, "random.break", 1.0F, 0.5F); - event.setCanceled(true); - } - } - } - } - - if(damage <= 0) - { - event.setCanceled(true); - } - if(hitter != null && hitter instanceof EntityLivingBase) - { - int hitTime = 5; - if(hitter.getHeldItem() != null) - { - ItemStack weapon = hitter.getHeldItem(); - if(weapon.getItem() instanceof IWeaponSpeed) - { - hitTime += ((IWeaponSpeed)weapon.getItem()).modifyHitTime(hitter, weapon); - } - } - if(hitTime > 0) - EventManagerMF.setHitTime(hitter, hitTime); - } - } - - /** - * gets the melee hitter - */ - private EntityLivingBase getHitter(DamageSource source) - { - if(source != null && source.getEntity() != null && source.getEntity() == source.getSourceOfDamage() && source.getEntity() instanceof EntityLivingBase) - { - return (EntityLivingBase) source.getEntity(); - } - return null; - } - - @SubscribeEvent - public void onHit(LivingHurtEvent event) - { - DamageSource src = event.source; - EntityLivingBase hit = event.entityLiving; - if(src != null && src == DamageSource.fall) - { - onFall(hit, event.ammount); - } - World world = hit.worldObj; - float damage = modifyDamage(src, world, hit, event.ammount, true); - - if(damage > 0 && hit.isSprinting()) - { - hit.setSprinting(false); - } - //TODO: Zombie armour - if(event.entityLiving.getEntityData().hasKey(MonsterUpgrader.zombieArmourNBT) && event.entityLiving instanceof EntityZombie) - { - float percent = 1.0F; - ItemStack[] armours = new ItemStack[4]; - for(int a = 1; a < 5; a ++) - { - armours[a-1]=event.entityLiving.getEquipmentInSlot(a); - } - damage = ISpecialArmor.ArmorProperties.ApplyArmor(event.entityLiving, armours, event.source, damage); - } - //TODO: Stick arrows (EXPERIMENTAL) - if(ConfigExperiment.stickArrows && event.source.getSourceOfDamage() != null && event.source.getSourceOfDamage() instanceof EntityArrow) - { - if(!event.entity.worldObj.isRemote) - { - ArrowEffectsMF.stickArrowIn(event.entity, ArrowEffectsMF.getDroppedArrow(event.source.getSourceOfDamage()), event.source.getSourceOfDamage()); - } - } - if(damage > 0) - { - onOfficialHit(src, hit, damage); - - if (event.source instanceof EntityDamageSource && !(event.source instanceof EntityDamageSourceIndirect) && !event.source.damageType.equals("battlegearExtra")) - { - Entity entityHitter = ((EntityDamageSource) event.source).getEntity(); - - if (entityHitter instanceof EntityLivingBase) - { - EntityLivingBase attacker = (EntityLivingBase) entityHitter; - StaminaMechanics.onAttack(attacker, hit); - ItemStack weapon = attacker.getHeldItem(); - HitSoundGenerator.makeHitSound(weapon, event.entityLiving); - } - } - } - event.ammount = damage; +import java.util.Map; + +public class CombatMechanics { + public static final String parryCooldownNBT = "MF_Parry_Cooldown"; + public static final String posthitCooldownNBT = "MF_PostHit"; + /** + * Damage done by silver to undead/witches + */ + public static final float specialUnholyModifier = 2.0F; + /** + * Damage done by silver to werewolves + */ + public static final float specialWerewolfModifier = 8.0F; + /** + * Damage done with dragonforged design to dragons + */ + public static final float specialDragonModifier = 1.5F; + /** + * Damage done with ornate design to undead/witches + */ + public static final float specialOrnateModifier = 1.5F; + private static final float power_attack_base = 25F; + private static final float parryFatigue = 5F; + public static boolean swordSkeleton = true; + private static boolean debugParry = true; + private static XSTRandom random = new XSTRandom(); + protected float jumpEvade_cost = 30; + protected float evade_cost = 10; + + /** + * 0 = false 1 = true -1 = failure + */ + private static int initPowerAttack(EntityLivingBase user, Entity target, boolean properHit) { + if (!canExecutePower(user)) { + return 0; + } + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user)) { + float points = power_attack_base * (StaminaBar.getBaseDecayModifier(user, true, true) * 0.5F + 0.5F); + if (StaminaBar.isStaminaAvailable(user, points, properHit)) { + if (properHit) { + ItemWeaponMF.applyFatigue(user, points); + } + return getPostHitCooldown(user) > 0 ? -1 : 1; + } else { + return 0; + } + } + return 1; + } + + private static boolean canExecutePower(EntityLivingBase user) { + if (user.isInWater()) { + return false; + } + if (user instanceof EntityPlayer) { + if (!isFightStance(user)) + return false; + } + return user.fallDistance > 0 && !user.isOnLadder(); + } + + private static boolean isFightStance(EntityLivingBase user) { + return user.isSneaking(); + } + + public static void applyUndeadBane(EntityLivingBase living) { + living.playSound("random.fizz", 0.5F, 0.5F); + living.addPotionEffect(new PotionEffect(Potion.weakness.id, 1200, 2)); + living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 1200, 2)); + if (random.nextInt(5) == 0) { + living.setFire(3); + } + } + + protected static void performEffects(Map map, EntityLivingBase entityHit) { + double roll = Math.random(); + if (map == null || map.isEmpty()) { + return; + } + + for (PotionEffect effect : map.keySet()) { + // add effects if they aren't already applied, with corresponding chance factor + if (!entityHit.isPotionActive(effect.getPotionID()) && map.get(effect) > roll) { + entityHit.addPotionEffect(new PotionEffect(effect)); + } + } + } + + public static void setParryCooldown(EntityLivingBase user, int ticks) { + user.getEntityData().setInteger(parryCooldownNBT, ticks); + + if (!user.worldObj.isRemote && user instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) user; + ((WorldServer) player.worldObj).getEntityTracker().func_151248_b(player, + new ParryPacket(ticks, player).generatePacket()); + } + } + + public static int getParryCooldown(EntityLivingBase user) { + if (user.getEntityData().hasKey(parryCooldownNBT)) { + return user.getEntityData().getInteger(parryCooldownNBT); + } + return 0; + } + + public static void tickParryCooldown(EntityLivingBase user) { + int ticks = getParryCooldown(user); + if (ticks > 0) { + setParryCooldown(user, ticks - 1); + } + } + + public static boolean isParryAvailable(EntityLivingBase user) { + return getParryCooldown(user) <= 0; + } + + public static void setPostHitCooldown(EntityLivingBase user, int ticks) { + user.getEntityData().setInteger(posthitCooldownNBT, ticks); + } + + public static int getPostHitCooldown(EntityLivingBase user) { + if (user.getEntityData().hasKey(posthitCooldownNBT)) { + return user.getEntityData().getInteger(posthitCooldownNBT); + } + return 0; + } + + public static void tickPostHitCooldown(EntityLivingBase user) { + int ticks = getPostHitCooldown(user); + if (ticks > 0) { + setPostHitCooldown(user, ticks - 1); + } + } + + /** + * Client-sided dodge + */ + private static void commandDodge(EntityPlayer user, int type) { + initDodge(user, type); + ((EntityClientPlayerMP) user).sendQueue.addToSendQueue(new DodgeCommand(user, type).generatePacket()); + } + + public static void initDodge(EntityPlayer user, int type) { + float bulk = ArmourCalculator.getTotalBulk(user); + int cost = (int) ((type == 0 ? 15 : 10) * (bulk + 1));// Medium armour cost 2x more + + if (bulk <= 1.0F && ItemWeaponMF.tryPerformAbility(user, cost)) { + float force = 1.0F - (bulk * 0.25F);// Medium armour gives 75% + + float direction = user.rotationYaw; + if (type == 0) + direction += 180;// BACK + if (type == 1) + direction -= 90;// LEFT + if (type == -1) + direction += 90;// RIGHT + TacticalManager.leap(user, direction, force, 0.0F); + } + } + + /* + * Causes the victim to 'Spaz out' which never stops being funny (Apply every + * tick) + */ + public static void panic(EntityLivingBase victim, float speed, int directionTimer) { + if (!shouldPanic(victim)) { + return; + } + double moveX = victim.getEntityData().getDouble("MF2_PanicX"); + double moveZ = victim.getEntityData().getDouble("MF2_PanicZ"); + victim.setJumping(true); + + if ((moveX == 0 && moveZ == 0) || random.nextInt(directionTimer) == 0) { + moveX = (random.nextDouble() - 0.5D) * 0.85D * speed; + moveZ = (random.nextDouble() - 0.5D) * 0.85D * speed; + + victim.getEntityData().setDouble("MF2_PanicX", moveX); + victim.getEntityData().setDouble("MF2_PanicZ", moveZ); + if (victim.onGround) + victim.motionY = 0.25F; + victim.rotationYaw = (float) (Math.atan2(moveX, moveZ)); + } + victim.swingItem(); + victim.limbSwing = 1.0F; + victim.moveEntity(moveX, 0D, moveZ); + } + + private static boolean shouldPanic(EntityLivingBase victim) { + if (victim instanceof EntityMinotaur) { + return ((EntityMinotaur) victim).getRageLevel() < 80; + } + return !(victim instanceof EntityPlayer || victim instanceof EntityCogwork); + } + + /** + * How much strength is added (directly adds to melee dmg) + */ + public static float getStrengthEnhancement(EntityLivingBase user) { + float mod = 0F; + if (PowerArmour.isPowered(user)) { + mod += 3F; + } + return Math.max(-0.5F, mod); + } + + public static float getSpecialModifier(CustomMaterial material, String design, Entity target, boolean addEffect) { + if (target == null) + return 1.0F; + + float modifier = 1.0F; + + if (design != null) { + if (design.equalsIgnoreCase("dragonforged")) { + if (TacticalManager.isDragon(target)) { + modifier *= specialDragonModifier; + } + } + + if (design.equalsIgnoreCase("ornate")) { + if (TacticalManager.isUnholyCreature(target)) { + modifier *= specialOrnateModifier; + } + } + } + + if (material != null) { + if (isSilverishMaterial(material.name) && target instanceof EntityLivingBase) { + if (target.getClass().getName().contains("Werewolf")) { + modifier *= specialWerewolfModifier; + applyUndeadBane((EntityLivingBase) target); + } else if (TacticalManager.isUnholyCreature(target)) { + modifier *= specialUnholyModifier; + applyUndeadBane((EntityLivingBase) target); + } + } + } + + return modifier; + } + + public static boolean isSilverishMaterial(String material) { + return material.equalsIgnoreCase("silver"); + } + + @SubscribeEvent + public void initAttack(LivingAttackEvent event) { + EntityLivingBase hitter = getHitter(event.source); + int spd = EventManagerMF.getHitspeedTime(hitter); + if (hitter != null && !hitter.worldObj.isRemote) { + if (spd > 0 && !(event.entityLiving instanceof EntityPlayer || event.entityLiving instanceof EntityEnderman)) { + event.setCanceled(true); + return; + } + } + DamageSource src = event.source; + EntityLivingBase hit = event.entityLiving; + World world = hit.worldObj; + boolean powerArmour = PowerArmour.isFullyArmoured(hit); + float damage = modifyDamage(src, world, hit, event.ammount, false); + + if (event.source.isProjectile() && !event.source.isFireDamage()) { + if (powerArmour || (damage < event.ammount && hit.getTotalArmorValue() > 0))// only if dam has been reduced + { + if (ConfigArmour.resistArrow && !event.isCanceled() && (damage <= 0.5F))// TacticalManager.resistArrow(event.entityLiving, + // event.source, damage)) + { + if (event.source.getSourceOfDamage() != null + && !event.source.getSourceOfDamage().getEntityData().hasKey("arrowDeflectMF") + && !(event.source.getEntity() instanceof EntityEnderPearl)) { + event.source.getSourceOfDamage().getEntityData().setBoolean("arrowDeflectMF", true); + event.entityLiving.worldObj.playSoundAtEntity(event.entityLiving, "random.break", 1.0F, 0.5F); + event.setCanceled(true); + } + } + } + } + + if (damage <= 0) { + event.setCanceled(true); + } + if (hitter != null && hitter instanceof EntityLivingBase) { + int hitTime = 5; + if (hitter.getHeldItem() != null) { + ItemStack weapon = hitter.getHeldItem(); + if (weapon.getItem() instanceof IWeaponSpeed) { + hitTime += ((IWeaponSpeed) weapon.getItem()).modifyHitTime(hitter, weapon); + } + } + if (hitTime > 0) + EventManagerMF.setHitTime(hitter, hitTime); + } + } + + /** + * gets the melee hitter + */ + private EntityLivingBase getHitter(DamageSource source) { + if (source != null && source.getEntity() != null && source.getEntity() == source.getSourceOfDamage() + && source.getEntity() instanceof EntityLivingBase) { + return (EntityLivingBase) source.getEntity(); + } + return null; + } + + @SubscribeEvent + public void onHit(LivingHurtEvent event) { + DamageSource src = event.source; + EntityLivingBase hit = event.entityLiving; + + if (src != null && src == DamageSource.fall) { + onFall(hit, event.ammount); + } + World world = hit.worldObj; + float damage = modifyDamage(src, world, hit, event.ammount, true); + + if (damage > 0 && hit.isSprinting()) { + hit.setSprinting(false); + } + // TODO: Zombie armour + if (event.entityLiving.getEntityData().hasKey(MonsterUpgrader.zombieArmourNBT) + && event.entityLiving instanceof EntityZombie) { + float percent = 1.0F; + ItemStack[] armours = new ItemStack[4]; + for (int a = 1; a < 5; a++) { + armours[a - 1] = event.entityLiving.getEquipmentInSlot(a); + } + damage = ISpecialArmor.ArmorProperties.ApplyArmor(event.entityLiving, armours, event.source, damage); + } + // TODO: Stick arrows (EXPERIMENTAL) + if (ConfigExperiment.stickArrows && event.source.getSourceOfDamage() != null + && event.source.getSourceOfDamage() instanceof EntityArrow) { + if (!event.entity.worldObj.isRemote) { + ArrowEffectsMF.stickArrowIn(event.entity, + ArrowEffectsMF.getDroppedArrow(event.source.getSourceOfDamage()), + event.source.getSourceOfDamage()); + } + } + if (damage > 0) { + onOfficialHit(src, hit, damage); + + if (event.source instanceof EntityDamageSource && !(event.source instanceof EntityDamageSourceIndirect) + && !event.source.damageType.equals("battlegearExtra")) { + Entity entityHitter = event.source.getEntity(); + + if (entityHitter instanceof EntityLivingBase) { + EntityLivingBase attacker = (EntityLivingBase) entityHitter; + StaminaMechanics.onAttack(attacker, hit); + ItemStack weapon = attacker.getHeldItem(); + HitSoundGenerator.makeHitSound(weapon, event.entityLiving); + } + } + } + event.ammount = damage; } - - private void onFall(EntityLivingBase fallen, float height) - { - float weight = ArmourCalculator.getTotalWeightOfWorn(fallen, false); - if(weight > 100) - { - weight -= 100F; - float power = (height/4F) * (weight/100F); - newShockwave(fallen, fallen.posX, fallen.posY, fallen.posZ, power, false, true); - } - } - public Shockwave newShockwave(Entity source, double x, double y, double z, float power, boolean fire, boolean smoke) - { - Shockwave explosion = new Shockwave("humanstomp", source.worldObj, source, x, y, z, power); + + private void onFall(EntityLivingBase fallen, float height) { + float weight = ArmourCalculator.getTotalWeightOfWorn(fallen, false); + if (weight > 100) { + weight -= 100F; + float power = (height / 4F) * (weight / 100F); + newShockwave(fallen, fallen.posX, fallen.posY, fallen.posZ, power, false, true); + } + } + + public Shockwave newShockwave(Entity source, double x, double y, double z, float power, boolean fire, + boolean smoke) { + Shockwave explosion = new Shockwave("humanstomp", source.worldObj, source, x, y, z, power); explosion.isFlaming = fire; explosion.isSmoking = smoke; explosion.initiate(); @@ -222,880 +421,520 @@ public Shockwave newShockwave(Entity source, double x, double y, double z, float return explosion; } - private float modifyDamage(DamageSource src, World world, EntityLivingBase hit, float dam, boolean properHit) - { - Entity source = src.getSourceOfDamage(); - Entity hitter = src.getEntity(); - - if(PowerArmour.allowDamageToBlock(src)) - { - dam = PowerArmour.modifyDamage(hit, dam, src); - } - - if(properHit && hit instanceof EntityPlayer) - { - dam = modifyPlayerDamage((EntityPlayer)hit, dam); - } - - if(source != null && hitter != null && hitter instanceof EntityLivingBase) - { - dam = modifyUserHitDamage(dam, (EntityLivingBase)hitter, source, hitter == source, hit, properHit); - } - if(src.isExplosion() && isSkeleton(hit)) - { - dam *= 5F; - } - - //TODO: Elemental resistance - dam *= TacticalManager.getResistance(hit, src); - if(src.isFireDamage()) - { - if(dam <= 0.0F) - { - hit.extinguish(); - } - } - dam = onUserHit(hit, hitter, src, dam, properHit); - return dam; - } - - private boolean isSkeleton(Entity target) - { - return target instanceof EntitySkeleton; - } - - //TODO: damage modifier - private float modifyUserHitDamage(float dam, EntityLivingBase user, Entity source, boolean melee, Entity target, boolean properHit) - { - dam = modifyMobDamage(user, dam); - String special = "standard"; - //Power Attack - if(melee) - { - int powerAttack = initPowerAttack(user, target, properHit); - if(powerAttack == 1) - { - dam *= (2F/1.5F); - onPowerAttack(dam, user, target, properHit); - - if(isSkeleton(target)) - { - dam *= 1.5F; - if(properHit) - { - if(rand.nextInt(2) == 0) - { - target.entityDropItem(new ItemStack(Items.bone), 0.5F); - } - } - } - } - if(powerAttack == -1) - { - dam /= 2F; - } - } - else - { - String arrowDesign = source.getEntityData().getString("Design"); - if(arrowDesign != null && arrowDesign.length() > 0) - { - special = arrowDesign; - } - } - if(user instanceof EntityLivingBase) - { - EntityLivingBase player = user; - - //TODO: Stamina Traits - if(StaminaBar.isSystemActive) - { - if(StaminaBar.getStaminaValue(player) <= 0) - { - dam *= ConfigStamina.weaponDrain; - } - } - } - if(user.hurtResistantTime > 12) - { - dam *= 0.5F; - } - - ItemStack weapon = user.getHeldItem(); - if(weapon != null) - { - if(weapon.getItem() instanceof IDamageModifier) - { - //TODO: IDamageModifier, this mods the damage for weapons - dam = ((IDamageModifier)weapon.getItem()).modifyDamage(weapon, user, target, dam, properHit); - } - CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(weapon); - String weaponType = CustomToolHelper.getCustomStyle(weapon); - dam *= getSpecialModifier(material, weaponType, target, true); - } - return dam; - } - - private void onPowerAttack(float dam, EntityLivingBase user, Entity target, boolean properHit) - { - ItemStack weapon = user.getHeldItem(); - int ticks = 20; - if(weapon != null && weapon.getItem() instanceof IPowerAttack) - { - ((IPowerAttack)weapon.getItem()).onPowerAttack(dam, user, target, properHit); - ticks = ((IPowerAttack)weapon.getItem()).getParryModifier(weapon, user, target); - } - if(target instanceof EntityLivingBase) - { - if(ticks > getParryCooldown((EntityLivingBase)target)) - { - setParryCooldown((EntityLivingBase)target, ticks); - } - } - if(!user.worldObj.isRemote) - { - user.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 5)); - user.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20, 10)); - } - if(user instanceof EntityPlayer) - { - TacticalManager.lungeEntity(user, target, 0.5F, 0F); - TacticalManager.throwPlayerOffBalance((EntityPlayer) user, 0.5F, true); - } - - target.worldObj.playSoundAtEntity(target, "minefantasy2:weapon.critical", 1.0F, 1.0F); - } - - private static final float power_attack_base = 25F; - /** - * 0 = false - * 1 = true - * -1 = failure - */ - private static int initPowerAttack(EntityLivingBase user, Entity target, boolean properHit) - { - if(!canExecutePower(user)) - { - return 0; - } - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user)) - { - float points = power_attack_base * (StaminaBar.getBaseDecayModifier(user, true, true)*0.5F + 0.5F); - if(StaminaBar.isStaminaAvailable(user, points, properHit)) - { - if(properHit) - { - ItemWeaponMF.applyFatigue(user, points); - } - return getPostHitCooldown(user) > 0 ? -1 : 1; - } - else - { - return 0; - } - } - return 1; - } - - private static boolean canExecutePower(EntityLivingBase user) - { - if(user.isInWater()) - { - return false; - } - if(user instanceof EntityPlayer) - { - if(!isFightStance(user))return false; - } - return user.fallDistance > 0 && !user.isOnLadder(); - } - - private static boolean isFightStance(EntityLivingBase user) - { - return user.isSneaking(); - } - - private float modifyMobDamage(EntityLivingBase user, float dam) - { - if(user instanceof EntityZombie && user.isChild()) - { - dam *= 0.65F; - } - return dam + getStrengthEnhancement(user); - } - - public static void applyUndeadBane(EntityLivingBase living) - { - living.playSound("random.fizz", 0.5F, 0.5F); - living.addPotionEffect(new PotionEffect(Potion.weakness.id, 1200, 2)); - living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 1200, 2)); - if(rand.nextInt(5) == 0) - { - living.setFire(3); - } - } - - private void onOfficialHit(DamageSource src, EntityLivingBase target, float damage) - { - Entity source = src.getSourceOfDamage(); - Entity hitter = src.getEntity(); - - if(source != null && hitter != null && hitter instanceof EntityLivingBase) - { - if(source == hitter) - { - EntityLivingBase user = (EntityLivingBase)hitter; - ItemStack weapon = user.getHeldItem(); - if(weapon != null) - { - onWeaponHit(user, weapon, target, damage); - } - if(RPGElements.isSystemActive && user instanceof EntityPlayer && !user.worldObj.isRemote) - { - SkillList.combat.addXP((EntityPlayer)user, (int)(damage/5F)); - } - } - else - { - if(source instanceof EntityArrow && src.isProjectile()) - { - onArrowHit(source, target, hitter, damage); - } - } - } - CombatMechanics.setPostHitCooldown(target, 10); - } - private void onWeaponHit(EntityLivingBase user, ItemStack weapon, Entity target, float dam) - { - if(target instanceof EntityLivingBase && weapon.getItem() instanceof ISpecialEffect) - { - ((ISpecialEffect)weapon.getItem()).onProperHit(user, weapon, target, dam); - } - - if(weapon.getItem() instanceof IWeaponSpeed) - { - target.hurtResistantTime += ((IWeaponSpeed)weapon.getItem()).modifyHitTime(user, weapon); - } - if(weapon.getItem() instanceof IKnockbackWeapon) - { - float kb = ((IKnockbackWeapon)weapon.getItem()).getAddedKnockback(user, weapon); - - if(kb > 0) - { - TacticalManager.knockbackEntity(target, user, kb, 0F); - } - } - if (ConfigWeapon.useBalance && user instanceof EntityPlayer) - { - applyBalance((EntityPlayer)user); - } - } - private void onArrowHit(Entity arrow, Entity target, Entity shooter, float damage) - { - /* - if(RPGElements.isSystemActive && shooter instanceof EntityPlayer) - { - SkillList.archery.addXP((EntityPlayer) shooter, (int)damage); - } - */ - } - - protected static void performEffects(Map map, EntityLivingBase entityHit) - { - double roll = Math.random(); - if(map == null || map.isEmpty()) - { - return; - } - - for(PotionEffect effect:map.keySet()) - { - //add effects if they aren't already applied, with corresponding chance factor - if(!entityHit.isPotionActive(effect.getPotionID()) && map.get(effect) > roll) + private float modifyDamage(DamageSource src, World world, EntityLivingBase hit, float dam, boolean properHit) { + Entity source = src.getSourceOfDamage(); + Entity hitter = src.getEntity(); + + if (PowerArmour.allowDamageToBlock(src)) { + dam = PowerArmour.modifyDamage(hit, dam, src); + } + + if (properHit && hit instanceof EntityPlayer) { + dam = modifyPlayerDamage((EntityPlayer) hit, dam); + } + + if (source != null && hitter != null && hitter instanceof EntityLivingBase) { + dam = modifyUserHitDamage(dam, (EntityLivingBase) hitter, source, hitter == source, hit, properHit); + } + if (src.isExplosion() && isSkeleton(hit)) { + dam *= 5F; + } + + // TODO: Elemental resistance + dam *= TacticalManager.getResistance(hit, src); + if (src.isFireDamage()) { + if (dam <= 0.0F) { + hit.extinguish(); + } + } + + return onUserHit(hit, hitter, src, dam, properHit); + } + + private boolean isSkeleton(Entity target) { + return target instanceof EntitySkeleton; + } + + // TODO: damage modifier + private float modifyUserHitDamage(float dam, EntityLivingBase user, Entity source, boolean melee, Entity target, + boolean properHit) { + dam = modifyMobDamage(user, dam); + String special = "standard"; + // Power Attack + if (melee) { + int powerAttack = initPowerAttack(user, target, properHit); + if (powerAttack == 1) { + dam *= (2F / 1.5F); + onPowerAttack(dam, user, target, properHit); + + if (isSkeleton(target)) { + dam *= 1.5F; + if (properHit) { + if (random.nextInt(2) == 0) { + target.entityDropItem(new ItemStack(Items.bone), 0.5F); + } + } + } + } + if (powerAttack == -1) { + dam /= 2F; + } + } else { + String arrowDesign = source.getEntityData().getString("Design"); + if (arrowDesign != null && arrowDesign.length() > 0) { + special = arrowDesign; + } + } + if (user instanceof EntityLivingBase) { + EntityLivingBase player = user; + + // TODO: Stamina Traits + if (StaminaBar.isSystemActive) { + if (StaminaBar.getStaminaValue(player) <= 0) { + dam *= ConfigStamina.weaponDrain; + } + } + } + if (user.hurtResistantTime > 12) { + dam *= 0.5F; + } + + ItemStack weapon = user.getHeldItem(); + if (weapon != null) { + if (weapon.getItem() instanceof IDamageModifier) { + // TODO: IDamageModifier, this mods the damage for weapons + dam = ((IDamageModifier) weapon.getItem()).modifyDamage(weapon, user, target, dam, properHit); + } + CustomMaterial material = CustomToolHelper.getCustomPrimaryMaterial(weapon); + String weaponType = CustomToolHelper.getCustomStyle(weapon); + dam *= getSpecialModifier(material, weaponType, target, true); + } + return dam; + } + + private void onPowerAttack(float dam, EntityLivingBase user, Entity target, boolean properHit) { + ItemStack weapon = user.getHeldItem(); + int ticks = 20; + if (weapon != null && weapon.getItem() instanceof IPowerAttack) { + ((IPowerAttack) weapon.getItem()).onPowerAttack(dam, user, target, properHit); + ticks = ((IPowerAttack) weapon.getItem()).getParryModifier(weapon, user, target); + } + if (target instanceof EntityLivingBase) { + if (ticks > getParryCooldown((EntityLivingBase) target)) { + setParryCooldown((EntityLivingBase) target, ticks); + } + } + if (!user.worldObj.isRemote) { + user.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 5)); + user.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20, 10)); + } + if (user instanceof EntityPlayer) { + TacticalManager.lungeEntity(user, target, 0.5F, 0F); + TacticalManager.throwPlayerOffBalance((EntityPlayer) user, 0.5F, true); + } + + target.worldObj.playSoundAtEntity(target, "minefantasy2:weapon.critical", 1.0F, 1.0F); + } + + private float modifyMobDamage(EntityLivingBase user, float dam) { + if (user instanceof EntityZombie && user.isChild()) { + dam *= 0.65F; + } + return dam + getStrengthEnhancement(user); + } + + private void onOfficialHit(DamageSource src, EntityLivingBase target, float damage) { + Entity source = src.getSourceOfDamage(); + Entity hitter = src.getEntity(); + + if (source != null && hitter != null && hitter instanceof EntityLivingBase) { + if (source == hitter) { + EntityLivingBase user = (EntityLivingBase) hitter; + ItemStack weapon = user.getHeldItem(); + if (weapon != null) { + onWeaponHit(user, weapon, target, damage); + } + if (RPGElements.isSystemActive && user instanceof EntityPlayer && !user.worldObj.isRemote) { + SkillList.combat.addXP((EntityPlayer) user, (int) (damage / 5F)); + } + } else { + if (source instanceof EntityArrow && src.isProjectile()) { + onArrowHit(source, target, hitter, damage); + } + } + } + CombatMechanics.setPostHitCooldown(target, 10); + } + + private void onWeaponHit(EntityLivingBase user, ItemStack weapon, Entity target, float dam) { + if (target instanceof EntityLivingBase && weapon.getItem() instanceof ISpecialEffect) { + ((ISpecialEffect) weapon.getItem()).onProperHit(user, weapon, target, dam); + } + + if (weapon.getItem() instanceof IWeaponSpeed) { + target.hurtResistantTime += ((IWeaponSpeed) weapon.getItem()).modifyHitTime(user, weapon); + } + if (weapon.getItem() instanceof IKnockbackWeapon) { + float kb = ((IKnockbackWeapon) weapon.getItem()).getAddedKnockback(user, weapon); + + if (kb > 0) { + TacticalManager.knockbackEntity(target, user, kb, 0F); + } + } + if (ConfigWeapon.useBalance && user instanceof EntityPlayer) { + applyBalance((EntityPlayer) user); + } + } + + private void onArrowHit(Entity arrow, Entity target, Entity shooter, float damage) { + /* + * if(RPGElements.isSystemActive && shooter instanceof EntityPlayer) { + * SkillList.archery.addXP((EntityPlayer) shooter, (int)damage); } + */ + } + + private float onUserHit(EntityLivingBase user, Entity entityHitting, DamageSource source, float dam, + boolean properHit) { + ItemStack weapon = user.getHeldItem(); + if ((properHit || source.isProjectile()) && weapon != null && !source.isUnblockable() + && !source.isExplosion()) { + float threshold = 10;// DEFAULT PARRY THRESHOLD + float weaponFatigue = 2.0F;// DEFAULT FATIGUE + int ticks = 18;// DEFAULT TICKS + IParryable parry = null; + + if (weapon.getItem() instanceof IParryable) { + parry = (IParryable) weapon.getItem(); + + ticks = parry.getParryCooldown(source, dam, weapon); + threshold = parry.getMaxDamageParry(user, weapon); + weaponFatigue = parry.getParryStaminaDecay(source, weapon); + } + if (StaminaBar.isSystemActive && !StaminaBar.isAnyStamina(user, false)) { + threshold /= 2; + } + threshold *= TacticalManager.getHighgroundModifier(user, entityHitting, 1.15F); + + if (ArmourCalculator.advancedDamageTypes && !user.worldObj.isRemote) { + threshold = ArmourCalculator.adjustACForDamage(source, threshold, 1.0F, 0.75F, 0.5F); + } + + if (debugParry && !user.worldObj.isRemote) { + MFLogUtil.logDebug("Init Parry: Damage = " + dam + " Threshold = " + threshold); + } + + // USED FOR PARRYING its harder to block arrows + if (TacticalManager.canParry(source, user, entityHitting, weapon)) { + float previousDam = dam; + dam = Math.max(0F, dam - threshold); + + if (properHit || dam <= 0) { + user.hurtResistantTime = user.maxHurtResistantTime; + user.hurtTime = 0; + + int result = onParry(source, user, entityHitting, dam, previousDam, parry); + + if (result == 1) { + dam = 0; + } + ticks = ArmourCalculator.modifyParryCooldown(user, ticks); + + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user) + && !StaminaBar.isAnyStamina(user, false)) { + ticks *= 3; + } + if (ticks > getParryCooldown(user)) { + setParryCooldown(user, ticks); + } + + ItemWeaponMF.applyFatigue(user, TacticalManager.getHighgroundModifier(user, entityHitting, 2.0F) + * (dam + 1F) * parryFatigue * weaponFatigue); + if (parry == null) { + user.worldObj.playSoundAtEntity(user, getDefaultParrySound(weapon), 1.0F, + 1.25F + (random.nextFloat() * 0.5F)); + } else if (!parry.playCustomParrySound(user, entityHitting, weapon)) { + user.worldObj.playSoundAtEntity(user, "mob.zombie.metal", 1.0F, + 1.25F + (random.nextFloat() * 0.5F)); + } + if (user instanceof EntityPlayer) { + ((EntityPlayer) user).stopUsingItem(); + ItemWeaponMF.setParry(weapon, 20); + } + + if (entityHitting != null && entityHitting instanceof EntityLivingBase) { + EntityLivingBase hitter = (EntityLivingBase) entityHitting; + int hitTime = 5; + if (hitter.getHeldItem() != null) { + ItemStack attackingWep = hitter.getHeldItem(); + if (attackingWep.getItem() instanceof IWeaponSpeed) { + hitTime += ((IWeaponSpeed) attackingWep.getItem()).modifyHitTime(hitter, weapon); + } + } + if (hitTime > 0) { + MFLogUtil.logDebug("Recoil hitter: " + hitter.getCommandSenderName() + " for " + hitTime * 3 + + " ticks."); + EventManagerMF.setHitTime(hitter, hitTime * 3); + } + } + } + } + } + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user) && !StaminaBar.isAnyStamina(user, false)) { + dam *= Math.max(1.0F, ConfigStamina.exhaustDamage); + } + + // Fire dura degrade + if (properHit && source.isFireDamage() && dam > 0) { + for (int a = 0; a < 4; a++) { + ItemStack armour = user.getEquipmentInSlot(a + 1); + if (armour != null) { + int dura = (int) (dam) + 1; + if (!user.worldObj.isRemote && !isArmourFireImmune(armour, source)) { + MFLogUtil.logDebug("Armour Flame Damage: " + dura); + if (armour.getItemDamage() + dura < armour.getMaxDamage()) { + armour.damageItem(dura, user); + } else { + armour.setItemDamage(armour.getMaxDamage()); + } + } + if (armour.getItemDamage() >= armour.getMaxDamage()) { + user.setCurrentItemOrArmor(a + 1, null); + user.worldObj.playSoundEffect(user.posX, user.posY + user.getEyeHeight() - (0.4F * a), + user.posZ, "random.break", 1.0F, 1.0F); + } + } + } + } + + if (dam > 0 && user instanceof EntityPlayer + || (entityHitting != null && entityHitting instanceof EntityPlayer)) { + if (!user.worldObj.isRemote) { + String type = "Mixed"; + float[] f = ArmourCalculator.getRatioForSource(source); + if (f == null) { + type = "Basic"; + } else { + if (f[0] > f[1] && f[0] > f[2]) + type = "Cutting"; + if (f[2] > f[1] && f[2] > f[0]) + type = "Piercing"; + if (f[1] > f[0] && f[1] > f[2]) + type = "Blunt"; + } + + MFLogUtil.logDebug(dam + "x " + type + " Damage inflicted to: " + user.getCommandSenderName() + " (" + + user.getEntityId() + ")"); + } + } + return dam; + } + + private boolean isArmourFireImmune(ItemStack armour, DamageSource src) { + if (armour != null && armour.getItem() instanceof IElementalResistance) { + return ((IElementalResistance) armour.getItem()).getFireResistance(armour, src) >= 100F; + } + return false; + } + + private String getDefaultParrySound(ItemStack weapon) { + if (weapon.getUnlocalizedName().contains("wood") || weapon.getUnlocalizedName().contains("Wood") + || weapon.getUnlocalizedName().contains("stone") || weapon.getUnlocalizedName().contains("Stone")) { + return "minefantasy2:weapon.wood_parry"; + } + return "mob.zombie.metal"; + } + + /** + * @return 0 for normal parry and 1 for evade + */ + private int onParry(DamageSource source, EntityLivingBase user, Entity attacker, float dam, float prevDam, + IParryable parry) { + /* + * if(RPGElements.isSystemActive && user instanceof EntityPlayer) { + * SkillList.block.addXP((EntityPlayer)user, 10 + (int)prevDam*2); } + */ + if (RPGElements.isSystemActive && user instanceof EntityPlayer) { + SkillList.combat.addXP((EntityPlayer) user, (int) (prevDam / 3F)); + } + if (parry != null) { + parry.onParry(source, user, attacker, dam); + } + if (user instanceof ISpecialCombatMob) { + ((ISpecialCombatMob) user).onParry(source, attacker, dam); + } + + boolean groundBlock = user.onGround; + ItemStack weapon = user.getHeldItem(); + + // Redirect + if (!user.worldObj.isRemote && !TacticalManager.isRanged(source)) { + if (canEvade(user)) { + float powerMod = attacker.isSprinting() ? 4.0F : 2.5F; + + attacker.setSprinting(false); + TacticalManager.lungeEntity(attacker, user, powerMod, 0.0F); + TacticalManager.lungeEntity(user, attacker, 3F, 0.0F); + return 1; + } + } + return 0; + } + + /** + * Determines if an evade can be made (jump or normal) + */ + private boolean canEvade(EntityLivingBase user) { + float stamModifier = 1.0F; + if (user instanceof EntityPlayer) { + if (!ResearchLogic.hasInfoUnlocked((EntityPlayer) user, "parrypro")) { + return false; + } + + if (!isFightStance(user)) { + return false; + } + } else { + if (random.nextInt(10) != 0)// Mobs can evade { - entityHit.addPotionEffect(new PotionEffect(effect)); + return false; } } + + if (!user.onGround && !tryJumpEvade(user, stamModifier)) { + return false; + } + return tryGroundEvade(user, stamModifier); + } + + /** + * If the player can slip past enemies Should be any armour but heavy + */ + private boolean tryGroundEvade(EntityLivingBase user, float cost) { + return ItemWeaponMF.tryPerformAbility(user, evade_cost * cost, true, false); } - - private static boolean debugParry = true; - private static final float parryFatigue = 5F; - private float onUserHit(EntityLivingBase user, Entity entityHitting, DamageSource source, float dam, boolean properHit) - { - ItemStack weapon = user.getHeldItem(); - if((properHit || source.isProjectile()) && weapon != null && !source.isUnblockable() &&!source.isExplosion()) - { - float threshold = 10;//DEFAULT PARRY THRESHOLD - float weaponFatigue = 2.0F;//DEFAULT FATIGUE - int ticks = 18;//DEFAULT TICKS - IParryable parry = null; - - if(weapon.getItem() instanceof IParryable) - { - parry = (IParryable)weapon.getItem(); - - ticks = parry.getParryCooldown(source, dam, weapon); - threshold = parry.getMaxDamageParry(user, weapon); - weaponFatigue = parry.getParryStaminaDecay(source, weapon); - } - if(StaminaBar.isSystemActive && !StaminaBar.isAnyStamina(user, false)) - { - threshold /= 2; - } - threshold *= TacticalManager.getHighgroundModifier(user, entityHitting, 1.15F); - - if(ArmourCalculator.advancedDamageTypes && !user.worldObj.isRemote) - { - threshold = ArmourCalculator.adjustACForDamage(source, threshold, 1.0F, 0.75F, 0.5F); - } - - if(debugParry && !user.worldObj.isRemote){MFLogUtil.logDebug("Init Parry: Damage = " + dam + " Threshold = " + threshold);} - - //USED FOR PARRYING its harder to block arrows - if(TacticalManager.canParry(source, user, entityHitting, weapon)) - { - float previousDam = dam; - dam = Math.max(0F, dam - threshold); - - if(properHit || dam <= 0) - { - user.hurtResistantTime = user.maxHurtResistantTime; - user.hurtTime = 0; - - int result = onParry(source, user, entityHitting, dam, previousDam, parry); - - if(result == 1) - { - dam = 0; - } - ticks = ArmourCalculator.modifyParryCooldown(user, ticks); - - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user) && !StaminaBar.isAnyStamina(user, false)) - { - ticks *= 3; - } - if(ticks > getParryCooldown(user)) - { - setParryCooldown(user, ticks); - } - - ItemWeaponMF.applyFatigue(user, TacticalManager.getHighgroundModifier(user, entityHitting, 2.0F)*(dam+1F)*parryFatigue*weaponFatigue); - if(parry == null) - { - user.worldObj.playSoundAtEntity(user, getDefaultParrySound(weapon), 1.0F, 1.25F + (rand.nextFloat()*0.5F)); - } - else if(!parry.playCustomParrySound(user, entityHitting, weapon)) - { - user.worldObj.playSoundAtEntity(user, "mob.zombie.metal", 1.0F, 1.25F + (rand.nextFloat()*0.5F)); - } - if(user instanceof EntityPlayer) - { - ((EntityPlayer)user).stopUsingItem(); - ItemWeaponMF.setParry(weapon, 20); - } - - if(entityHitting != null && entityHitting instanceof EntityLivingBase) - { - EntityLivingBase hitter = (EntityLivingBase)entityHitting; - int hitTime = 5; - if(hitter.getHeldItem() != null) - { - ItemStack attackingWep = hitter.getHeldItem(); - if(attackingWep.getItem() instanceof IWeaponSpeed) - { - hitTime += ((IWeaponSpeed)attackingWep.getItem()).modifyHitTime(hitter, weapon); - } - } - if(hitTime > 0) - { - MFLogUtil.logDebug("Recoil hitter: " + hitter.getCommandSenderName() + " for " + hitTime*3 + " ticks."); - EventManagerMF.setHitTime(hitter, hitTime * 3); - } - } - } - } - } - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user) && !StaminaBar.isAnyStamina(user, false)) - { - dam *= Math.max(1.0F, ConfigStamina.exhaustDamage); - } - - //Fire dura degrade - if(properHit && source.isFireDamage() && dam > 0) - { - for(int a = 0; a < 4; a++) - { - ItemStack armour = user.getEquipmentInSlot(a+1); - if(armour != null) - { - int dura = (int)(dam)+1; - if(!user.worldObj.isRemote && !isArmourFireImmune(armour, source)) - { - MFLogUtil.logDebug("Armour Flame Damage: " + dura); - if(armour.getItemDamage() + dura < armour.getMaxDamage()) - { - armour.damageItem(dura, user); - } - else - { - armour.setItemDamage(armour.getMaxDamage()); - } - } - if(armour.getItemDamage() >= armour.getMaxDamage()) - { - user.setCurrentItemOrArmor(a+1, null); - user.worldObj.playSoundEffect(user.posX, user.posY+user.getEyeHeight() - (0.4F*a), user.posZ, "random.break", 1.0F, 1.0F); - } - } - } - } - - if(dam > 0 && user instanceof EntityPlayer || (entityHitting != null && entityHitting instanceof EntityPlayer)) - { - if(!user.worldObj.isRemote) - { - String type = "Mixed"; - float[] f = ArmourCalculator.getRatioForSource(source); - if(f == null) - { - type = "Basic"; - } - else - { - if(f[0] > f[1] && f[0] > f[2])type = "Cutting"; - if(f[2] > f[1] && f[2] > f[0])type = "Piercing"; - if(f[1] > f[0] && f[1] > f[2])type = "Blunt"; - } - - MFLogUtil.logDebug(dam + "x "+ type +" Damage inflicted to: " + user.getCommandSenderName() + " (" + user.getEntityId() + ")"); - } - } - return dam; - } - private boolean isArmourFireImmune(ItemStack armour, DamageSource src) - { - if(armour != null && armour.getItem() instanceof IElementalResistance) - { - return ((IElementalResistance)armour.getItem()).getFireResistance(armour, src) >= 100F; - } - return false; - } - - private String getDefaultParrySound(ItemStack weapon) - { - if(weapon.getUnlocalizedName().contains("wood") || weapon.getUnlocalizedName().contains("Wood") || weapon.getUnlocalizedName().contains("stone") || weapon.getUnlocalizedName().contains("Stone")) - { - return "minefantasy2:weapon.wood_parry"; - } - return "mob.zombie.metal"; - } - - /** - * @return 0 for normal parry and 1 for evade - */ - private int onParry(DamageSource source, EntityLivingBase user, Entity attacker, float dam, float prevDam, IParryable parry) - { - /* - if(RPGElements.isSystemActive && user instanceof EntityPlayer) - { - SkillList.block.addXP((EntityPlayer)user, 10 + (int)prevDam*2); - } - */ - if(RPGElements.isSystemActive && user instanceof EntityPlayer ) - { - SkillList.combat.addXP((EntityPlayer)user, (int)(prevDam/3F)); - } - if(parry != null) - { - parry.onParry(source, user, attacker, dam); - } - if(user instanceof ISpecialCombatMob) - { - ((ISpecialCombatMob)user).onParry(source, attacker, dam); - } - - boolean groundBlock = user.onGround; - ItemStack weapon = user.getHeldItem(); - - //Redirect - if(!user.worldObj.isRemote && !TacticalManager.isRanged(source)) - { - if(canEvade(user)) - { - float powerMod = attacker.isSprinting() ? 4.0F : 2.5F; - - attacker.setSprinting(false); - TacticalManager.lungeEntity(attacker, user, powerMod, 0.0F); - TacticalManager.lungeEntity(user, attacker, 3F, 0.0F); - return 1; - } - } - return 0; - } - - /** - * Determines if an evade can be made (jump or normal) - */ - private boolean canEvade(EntityLivingBase user) - { - float stamModifier = 1.0F; - if(user instanceof EntityPlayer) - { - if(!ResearchLogic.hasInfoUnlocked((EntityPlayer)user, "parrypro")) - { - return false; - } - - if(!isFightStance(user)) - { - return false; - } - } - else - { - if(rand.nextInt(10) != 0)//Mobs can evade - { - return false; - } - } - - if(!user.onGround && !tryJumpEvade(user, stamModifier)) - { - return false; - } - return tryGroundEvade(user, stamModifier); - } - /** - * If the player can slip past enemies - * Should be any armour but heavy - */ - private boolean tryGroundEvade(EntityLivingBase user, float cost) - { - return ItemWeaponMF.tryPerformAbility(user, evade_cost*cost, true, false); - } - - /** - * If the player can jump over enemies in evading - * Only ment for unarmoured/Lightarmour - */ - private boolean tryJumpEvade(EntityLivingBase user, float cost) - { - return ItemWeaponMF.tryPerformAbility(user, jumpEvade_cost*cost, true, false); - } - - @SubscribeEvent - public void updateLiving(LivingUpdateEvent event) - { - EntityLivingBase living = event.entityLiving; - - tickParryCooldown(living); - tickPostHitCooldown(living); - if(living instanceof EntityLiving) - { - EntityLiving mob = (EntityLiving)living; - ItemStack held = mob.getHeldItem(); - - { - EntityLivingBase tar = mob.getAttackTarget(); - - if(tar != null && tar instanceof EntityPlayer && ((EntityPlayer)tar).isBlocking()) - { - double dist = mob.getDistanceSqToEntity(tar); - - if(tar instanceof EntityZombie && mob.onGround && mob.getRNG().nextInt(10) == 0 && dist > 1D && dist < 4D) - { - mob.motionY = 0.5F; - } - } - } - if(isAxe(held)) - { - EntityLivingBase tar = mob.getAttackTarget(); - - if(tar != null) - { - double dist = mob.getDistanceSqToEntity(tar); - - if(mob.onGround && mob.getRNG().nextInt(5) == 0 && dist > 1D && dist < 4.0D) - { - mob.motionY = 0.5F; - } - } - if(mob.getRNG().nextInt(100) == 0 && !mob.isSprinting() && !mob.isChild()) - { - mob.setSprinting(true); - } - } - if(isFastblade(held)) - { - EntityLivingBase tar = mob.getAttackTarget(); - - if(tar != null) - { - double dist = mob.getDistanceSqToEntity(tar); - - if(mob.onGround && mob.getRNG().nextInt(20) == 0 && dist > 1D && dist < 4.0D) - { - mob.motionY = 0.5F; - } - } - if(mob.getRNG().nextInt(20) == 0 && !mob.isSprinting() && !mob.isChild()) - { - mob.setSprinting(true); - } - } - if(living.isBurning() && !living.isImmuneToFire()) - { - panic(living, 0.25F, 5); - } - } - } - private boolean isAxe(ItemStack held) - { - return held != null && held.getItem() instanceof ItemWaraxeMF || held != null && held.getItem() instanceof ItemBattleaxeMF; - } - private boolean isFastblade(ItemStack held) - { - return held != null && held.getItem() instanceof ItemDagger || held != null && held.getItem() instanceof ItemKatanaMF; - } - - private void applyBalance(EntityPlayer entityPlayer) - { - MFLogUtil.logDebug("Weapon Balance Init"); - ItemStack weapon = entityPlayer.getHeldItem(); + + /** + * If the player can jump over enemies in evading Only ment for + * unarmoured/Lightarmour + */ + private boolean tryJumpEvade(EntityLivingBase user, float cost) { + return ItemWeaponMF.tryPerformAbility(user, jumpEvade_cost * cost, true, false); + } + + @SubscribeEvent + public void updateLiving(LivingUpdateEvent event) { + EntityLivingBase living = event.entityLiving; + + tickParryCooldown(living); + tickPostHitCooldown(living); + if (living instanceof EntityLiving) { + EntityLiving mob = (EntityLiving) living; + ItemStack held = mob.getHeldItem(); + + { + EntityLivingBase tar = mob.getAttackTarget(); + + if (tar != null && tar instanceof EntityPlayer && ((EntityPlayer) tar).isBlocking()) { + double dist = mob.getDistanceSqToEntity(tar); + + if (tar instanceof EntityZombie && mob.onGround && mob.getRNG().nextInt(10) == 0 && dist > 1D + && dist < 4D) { + mob.motionY = 0.5F; + } + } + } + if (isAxe(held)) { + EntityLivingBase tar = mob.getAttackTarget(); + + if (tar != null) { + double dist = mob.getDistanceSqToEntity(tar); + + if (mob.onGround && mob.getRNG().nextInt(5) == 0 && dist > 1D && dist < 4.0D) { + mob.motionY = 0.5F; + } + } + if (mob.getRNG().nextInt(100) == 0 && !mob.isSprinting() && !mob.isChild()) { + mob.setSprinting(true); + } + } + if (isFastblade(held)) { + EntityLivingBase tar = mob.getAttackTarget(); + + if (tar != null) { + double dist = mob.getDistanceSqToEntity(tar); + + if (mob.onGround && mob.getRNG().nextInt(20) == 0 && dist > 1D && dist < 4.0D) { + mob.motionY = 0.5F; + } + } + if (mob.getRNG().nextInt(20) == 0 && !mob.isSprinting() && !mob.isChild()) { + mob.setSprinting(true); + } + } + if (living.isBurning() && !living.isImmuneToFire()) { + panic(living, 0.25F, 5); + } + } + } + + private boolean isAxe(ItemStack held) { + return held != null && held.getItem() instanceof ItemWaraxeMF + || held != null && held.getItem() instanceof ItemBattleaxeMF; + } + + private boolean isFastblade(ItemStack held) { + return held != null && held.getItem() instanceof ItemDagger + || held != null && held.getItem() instanceof ItemKatanaMF; + } + + private void applyBalance(EntityPlayer entityPlayer) { + MFLogUtil.logDebug("Weapon Balance Init"); + ItemStack weapon = entityPlayer.getHeldItem(); float balance = 0.0F; - - if(weapon != null && weapon.getItem() instanceof IWeightedWeapon) - { - balance = ((IWeightedWeapon)weapon.getItem()).getBalance(entityPlayer); - } - - if (ConfigWeapon.useBalance && balance > 0 && entityPlayer != null) - { - TacticalManager.throwPlayerOffBalance(entityPlayer, balance, true); - } - } - - public static void setParryCooldown(EntityLivingBase user, int ticks) - { - user.getEntityData().setInteger(parryCooldownNBT, ticks); - - if(!user.worldObj.isRemote && user instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer)user; - ((WorldServer)player.worldObj).getEntityTracker().func_151248_b(player, new ParryPacket(ticks, player).generatePacket()); - } - } - public static int getParryCooldown(EntityLivingBase user) - { - if(user.getEntityData().hasKey(parryCooldownNBT)) - { - return user.getEntityData().getInteger(parryCooldownNBT); - } - return 0; - } - public static void tickParryCooldown(EntityLivingBase user) - { - int ticks = getParryCooldown(user); - if(ticks > 0) - { - setParryCooldown(user, ticks-1); - } - } - public static boolean isParryAvailable(EntityLivingBase user) - { - return getParryCooldown(user)<= 0; - } - - public static void setPostHitCooldown(EntityLivingBase user, int ticks) - { - user.getEntityData().setInteger(posthitCooldownNBT, ticks); - } - public static int getPostHitCooldown(EntityLivingBase user) - { - if(user.getEntityData().hasKey(posthitCooldownNBT)) - { - return user.getEntityData().getInteger(posthitCooldownNBT); - } - return 0; - } - public static void tickPostHitCooldown(EntityLivingBase user) - { - int ticks = getPostHitCooldown(user); - if(ticks > 0) - { - setPostHitCooldown(user, ticks-1); - } - } - @SubscribeEvent - public void jump(LivingJumpEvent event) - { - if(event.entityLiving instanceof EntityPlayer) - { - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(event.entityLiving)) - { - StaminaMechanics.onJump(event.entityLiving); - } - } - if(event.entityLiving.worldObj.isRemote && event.entityLiving instanceof EntityPlayer) - { - tryDodge((EntityPlayer)event.entityLiving); - } - } - - private void tryDodge(EntityPlayer user) - { - if(user.isBlocking()) - { - float forward = user.moveForward; - float side = user.moveStrafing; - - if(side > 0F)//LEFT - { - commandDodge(user, 1); - } - else if(side < 0)//RIGHT - { - commandDodge(user, -1); - } - else if(forward < 0)//BACK - { - commandDodge(user, 0); - } - } - } - /** - * Client-sided dodge - */ - private static void commandDodge(EntityPlayer user, int type) - { - initDodge(user, type); - ((EntityClientPlayerMP)user).sendQueue.addToSendQueue(new DodgeCommand(user, type).generatePacket()); - } - public static void initDodge(EntityPlayer user, int type) - { - float bulk = ArmourCalculator.getTotalBulk(user); - int cost = (int) ((type == 0 ? 15 : 10) * (bulk+1));//Medium armour cost 2x more - - if(bulk <= 1.0F && ItemWeaponMF.tryPerformAbility(user, cost)) - { - float force = 1.0F - (bulk*0.25F);//Medium armour gives 75% - - float direction = user.rotationYaw; - if(type == 0) direction += 180;//BACK - if(type == 1) direction -= 90;//LEFT - if(type == -1) direction += 90;//RIGHT - TacticalManager.leap(user, direction, force, 0.0F); - } - } - - /* - * Causes the victim to 'Spaz out' which never stops being funny (Apply every tick) - */ - public static void panic(EntityLivingBase victim, float speed, int directionTimer) - { - if(!shouldPanic(victim)) - { - return; - } - double moveX = victim.getEntityData().getDouble("MF2_PanicX"); - double moveZ = victim.getEntityData().getDouble("MF2_PanicZ"); - victim.setJumping(true); - - if((moveX == 0 && moveZ == 0) || rand.nextInt(directionTimer) == 0) - { - moveX = (rand.nextDouble()-0.5D)*0.85D * speed; - moveZ = (rand.nextDouble()-0.5D)*0.85D * speed; - - victim.getEntityData().setDouble("MF2_PanicX", moveX); - victim.getEntityData().setDouble("MF2_PanicZ", moveZ); - if(victim.onGround)victim.motionY = 0.25F; - victim.rotationYaw = (float)(Math.atan2(moveX, moveZ)); - } - victim.swingItem(); - victim.limbSwing = 1.0F; - victim.moveEntity(moveX, 0D, moveZ); - } - - - - private static boolean shouldPanic(EntityLivingBase victim) - { - if(victim instanceof EntityMinotaur) - { - return ((EntityMinotaur)victim).getRageLevel() < 80; - } - return !(victim instanceof EntityPlayer || victim instanceof EntityCogwork); - } - - private float modifyPlayerDamage(EntityPlayer hit, float dam) - { - if(ResearchLogic.hasInfoUnlocked(hit, KnowledgeListMF.toughness)) - { - dam *= 0.9F;//10% Resist - } - return dam; - } - - /** - * How much strength is added (directly adds to melee dmg) - */ - public static float getStrengthEnhancement(EntityLivingBase user) - { - float mod = 0F; - if(PowerArmour.isPowered(user)) - { - mod += 3F; - } - return Math.max(-0.5F, mod); - } - - public static float getSpecialModifier(CustomMaterial material, String design, Entity target, boolean addEffect) - { - if(target == null)return 1.0F; - - float modifier = 1.0F; - - if(design != null) - { - if(design.equalsIgnoreCase("dragonforged")) - { - if(TacticalManager.isDragon(target)) - { - modifier *= specialDragonModifier; - } - } - - if(design.equalsIgnoreCase("ornate")) - { - if(TacticalManager.isUnholyCreature(target)) - { - modifier *= specialOrnateModifier; - } - } - } - - if(material != null) - { - if(isSilverishMaterial(material.name) && target instanceof EntityLivingBase) - { - if(target.getClass().getName().contains("Werewolf")) - { - modifier *= specialWerewolfModifier; - applyUndeadBane((EntityLivingBase)target); - } - else if(TacticalManager.isUnholyCreature(target)) - { - modifier *= specialUnholyModifier; - applyUndeadBane((EntityLivingBase)target); - } - } - } - - return modifier; - } - public static boolean isSilverishMaterial(String material) - { - return material.equalsIgnoreCase("silver"); - } + + if (weapon != null && weapon.getItem() instanceof IWeightedWeapon) { + balance = ((IWeightedWeapon) weapon.getItem()).getBalance(entityPlayer); + } + + if (ConfigWeapon.useBalance && balance > 0 && entityPlayer != null) { + TacticalManager.throwPlayerOffBalance(entityPlayer, balance, true); + } + } + + @SubscribeEvent + public void jump(LivingJumpEvent event) { + if (event.entityLiving instanceof EntityPlayer) { + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(event.entityLiving)) { + StaminaMechanics.onJump(event.entityLiving); + } + } + if (event.entityLiving.worldObj.isRemote && event.entityLiving instanceof EntityPlayer) { + tryDodge((EntityPlayer) event.entityLiving); + } + } + + private void tryDodge(EntityPlayer user) { + if (user.isBlocking()) { + float forward = user.moveForward; + float side = user.moveStrafing; + + if (side > 0F)// LEFT + { + commandDodge(user, 1); + } else if (side < 0)// RIGHT + { + commandDodge(user, -1); + } else if (forward < 0)// BACK + { + commandDodge(user, 0); + } + } + } + + private float modifyPlayerDamage(EntityPlayer hit, float dam) { + if (ResearchLogic.hasInfoUnlocked(hit, KnowledgeListMF.toughness)) { + dam *= 0.9F;// 10% Resist + } + return dam; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/EventManagerMF.java b/src/main/java/minefantasy/mf2/mechanics/EventManagerMF.java index 3fa8a6d9..c54fba4a 100644 --- a/src/main/java/minefantasy/mf2/mechanics/EventManagerMF.java +++ b/src/main/java/minefantasy/mf2/mechanics/EventManagerMF.java @@ -1,10 +1,5 @@ package minefantasy.mf2.mechanics; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -14,13 +9,7 @@ import minefantasy.mf2.api.armour.ItemArmourMFBase; import minefantasy.mf2.api.heating.IHotItem; import minefantasy.mf2.api.heating.TongsHelper; -import minefantasy.mf2.api.helpers.ArmourCalculator; -import minefantasy.mf2.api.helpers.ArrowEffectsMF; -import minefantasy.mf2.api.helpers.CustomToolHelper; -import minefantasy.mf2.api.helpers.EntityHelper; -import minefantasy.mf2.api.helpers.PowerArmour; -import minefantasy.mf2.api.helpers.TacticalManager; -import minefantasy.mf2.api.helpers.ToolHelper; +import minefantasy.mf2.api.helpers.*; import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.rpg.LevelupEvent; @@ -46,6 +35,7 @@ import minefantasy.mf2.network.packet.LevelupPacket; import minefantasy.mf2.network.packet.SkillPacket; import minefantasy.mf2.util.MFLogUtil; +import minefantasy.mf2.util.XSTRandom; import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; import net.minecraft.client.Minecraft; @@ -53,35 +43,17 @@ import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderPlayer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityAgeable; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.*; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityWitch; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.monster.IMob; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.passive.EntityCow; -import net.minecraft.entity.passive.EntityHorse; -import net.minecraft.entity.passive.EntityPig; -import net.minecraft.entity.passive.EntitySheep; -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.entity.passive.EntityWolf; -import net.minecraft.entity.passive.IAnimals; +import net.minecraft.entity.passive.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor; -import net.minecraft.item.ItemBow; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.item.*; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; @@ -91,1068 +63,853 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.client.event.RenderLivingEvent; import net.minecraftforge.client.event.RenderPlayerEvent; +import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import net.minecraftforge.event.entity.player.EntityItemPickupEvent; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import net.minecraftforge.event.entity.player.PlayerEvent; -import net.minecraftforge.event.entity.player.PlayerUseItemEvent; -import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; -import net.minecraftforge.event.entity.player.UseHoeEvent; +import net.minecraftforge.event.entity.player.*; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; -import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.oredict.OreDictionary; -public class EventManagerMF -{ - public static Random rand = new Random(); - @SubscribeEvent - public void tryDropItems(LivingDropsEvent event) - { - EntityLivingBase dropper = event.entityLiving; - - if(dropper instanceof EntityChicken) - { - int dropCount = 1 + rand.nextInt(event.lootingLevel+1*4); - - for(int a = 0; a < dropCount; a++) - { - dropper.entityDropItem(new ItemStack(Items.feather), 0.0F); - } - } - if(dropper.getEntityData().hasKey("MF_LootDrop")) - { - int id = dropper.getEntityData().getInteger("MF_LootDrop"); - Item drop = id == 0 ? ToolListMF.loot_sack : id == 1 ? ToolListMF.loot_sack_uc : ToolListMF.loot_sack_rare; - dropper.entityDropItem(new ItemStack(drop), 0.0F); - } - if(dropper instanceof EntityAgeable && dropper.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD) - { - EntityAgeable a; - if(rand.nextFloat() * (1+event.lootingLevel) < 0.05F) - { - dropper.entityDropItem(new ItemStack(FoodListMF.guts), 0.0F); - } - } - if(dropper instanceof IAnimals && !(dropper instanceof IMob)) - { - if(ConfigHardcore.hunterKnife && !dropper.getEntityData().hasKey("hunterKill")) - { - event.setCanceled(true); - return; - } - if(ConfigHardcore.lessHunt) - { - alterDrops(dropper, event); - } - } - if(getRegisterName(dropper).contains("Horse")) - { - int dropCount = rand.nextInt(3 + event.lootingLevel); - if(ConfigHardcore.lessHunt) - { - dropCount = 1 + rand.nextInt(event.lootingLevel+1); - } - - Item meat = dropper.isBurning() ? FoodListMF.horse_cooked : FoodListMF.horse_raw; - for(int a = 0; a < dropCount; a++) - { - dropper.entityDropItem(new ItemStack(meat), 0.0F); - } - } - if(getRegisterName(dropper).contains("Wolf")) - { - int dropCount = rand.nextInt(3 + event.lootingLevel); - if(ConfigHardcore.lessHunt) - { - dropCount = 1 + rand.nextInt(event.lootingLevel+1); - } - - Item meat = dropper.isBurning() ? FoodListMF.wolf_cooked : FoodListMF.wolf_raw; - for(int a = 0; a < dropCount; a++) - { - dropper.entityDropItem(new ItemStack(meat), 0.0F); - } - } - dropLeather(event.entityLiving, event); - - if(dropper instanceof EntitySkeleton) - { - EntitySkeleton skeleton = (EntitySkeleton)dropper; - - if((skeleton.getHeldItem() == null || !(skeleton.getHeldItem().getItem() instanceof ItemBow)) && event.drops != null && !event.drops.isEmpty()) - { - Iterator list = event.drops.iterator(); - - while(list.hasNext()) - { - EntityItem entItem = list.next(); - ItemStack drop = entItem.getEntityItem(); - - if(drop.getItem() == Items.arrow) - { - entItem.setDead(); - } - } - } - } - } - - private void dropLeather(EntityLivingBase mob, LivingDropsEvent event) - { - boolean dropHide = shouldAnimalDropHide(mob); - Item hide = getHideFor(mob); - - if(event.drops != null && !event.drops.isEmpty()) - { - Iterator list = event.drops.iterator(); - - while(list.hasNext()) - { - EntityItem entItem = list.next(); - ItemStack drop = entItem.getEntityItem(); - - if(drop.getItem() == Items.leather) - { - entItem.setDead(); - dropHide = true; - } - } - } - if(dropHide && hide != null && !(ConfigHardcore.hunterKnife && !mob.getEntityData().hasKey("hunterKill"))) - { - mob.entityDropItem(new ItemStack(hide), 0.0F); - } - } - - private Item getHideFor(EntityLivingBase mob) - { - Item[] hide = new Item[]{ComponentListMF.rawhideSmall, ComponentListMF.rawhideMedium, ComponentListMF.rawhideLarge}; - int size = getHideSizeFor(mob); - if(mob.isChild()) - { - size --; - } - - if(size <= 0) - { - return null; - } - if(size > hide.length) - { - size = hide.length; - } - - return hide[size-1]; - } - private int getHideSizeFor(EntityLivingBase mob) - { - if(mob.getClass().getName().endsWith("EntityCow") || mob.getClass().getName().endsWith("EntityHorse")) - { - return 3; - } - if(mob.getClass().getName().endsWith("EntitySheep")) - { - return 2; - } - if(mob.getClass().getName().endsWith("EntityPig")) - { - return 1; - } - - int size = mob.myEntitySize.ordinal()+1; - if(size <= 1) - { - return 0; - } - if(size == 2) - { - return 1; - } - else if(size <= 4) - { - return 2; - } - return 3; - } - - private boolean shouldAnimalDropHide(EntityLivingBase mob) - { - if(mob.getClass().getName().endsWith("EntityWolf") || mob.getClass().getName().endsWith("EntityPig") || mob.getClass().getName().endsWith("EntitySheep") || mob.getClass().getName().endsWith("EntityCow") || mob.getClass().getName().endsWith("EntityHorse")) - { - return true; - } - if(mob instanceof EntityWolf || mob instanceof EntityCow || mob instanceof EntityPig || mob instanceof EntitySheep || mob instanceof EntityHorse) - { - return true; - } - return false; - } - - @SubscribeEvent - public void onDeath(LivingDeathEvent event) - { - if(!event.entityLiving.worldObj.isRemote && event.entityLiving instanceof EntityDragon && event.source != null && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) - { - PlayerTickHandlerMF.addDragonKill((EntityPlayer)event.source.getEntity()); - } - if(!event.entityLiving.worldObj.isRemote && event.entityLiving instanceof EntityPlayer && event.source != null && event.source.getEntity() != null && event.source.getEntity() instanceof EntityDragon) - { - PlayerTickHandlerMF.addDragonEnemyPts((EntityPlayer)event.entityLiving, -1); - } - Entity dropper = event.entity; - - boolean useArrows = true; - try - { - Class.forName("minefantasy.mf2.api.helpers.ArrowEffectsMF"); - } - catch(Exception e) - { - useArrows = false; - } - if(dropper != null && useArrows && ConfigExperiment.stickArrows && !dropper.worldObj.isRemote) - { - ArrayList stuckArrows = (ArrayList) ArrowEffectsMF.getStuckArrows(dropper); - if(stuckArrows != null && !stuckArrows.isEmpty()) - { - Iterator list = stuckArrows.iterator(); - - while(list.hasNext()) - { - ItemStack arrow = (ItemStack) list.next(); - if(arrow != null) - { - dropper.entityDropItem(arrow, 0.0F); - } - } - } - } - - } - - @SubscribeEvent - public void spawnEntity(EntityJoinWorldEvent event) - { - if(event.entity.isDead) - { - return; - } - if(event.entity instanceof EntityItem && !(event.entity instanceof EntityItemUnbreakable)) - { - EntityItem eitem = (EntityItem)event.entity; - if(eitem.getEntityItem() != null) - { - if(eitem.getEntityItem().hasTagCompound() && eitem.getEntityItem().getTagCompound().hasKey("Unbreakable")) - { - EntityItem newEntity = new EntityItemUnbreakable(event.world, eitem); - event.world.spawnEntityInWorld(newEntity); - eitem.setDead(); - } - if(isDragonforge(eitem.getEntityItem())) - { - MFLogUtil.logDebug("Found dragon heart"); - EntityItem newEntity = new EntityItemUnbreakable(event.world, eitem); - event.world.spawnEntityInWorld(newEntity); - eitem.setDead(); - } - } - } +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class EventManagerMF { + + public static final String hitspeedNBT = "MF_HitCooldown"; + public static final String injuredNBT = "MF_Injured"; + public static boolean displayOreDict = false; + + private static XSTRandom random = new XSTRandom(); + + public static void addArmourDT(ItemStack armour, EntityPlayer user, List list, boolean extra) { + list.add(""); + String AC = ArmourCalculator.getArmourClass(armour); + if (AC != null) { + list.add(StatCollector.translateToLocal("attribute.armour." + AC)); + } + list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("attribute.armour.protection")); + addSingleDT(armour, user, 0, list, extra); + addSingleDT(armour, user, 2, list, extra); + addSingleDT(armour, user, 1, list, extra); } - private boolean isDragonforge(ItemStack itemstack) - { - return itemstack.getItem() == ComponentListMF.dragon_heart; - } - - public void alterDrops(EntityLivingBase dropper, LivingDropsEvent event) - { - ArrayList meats = new ArrayList(); - - if(event.drops != null && !event.drops.isEmpty()) - { - Iterator list = event.drops.iterator(); - - while(list.hasNext()) - { - EntityItem entItem = list.next(); - ItemStack drop = entItem.getEntityItem(); - boolean dropItem = true; - - if(drop.getItem() instanceof ItemFood) - { - entItem.setDead(); - - if(!meats.isEmpty()) - { - for(int a = 0; a < meats.size(); a ++) - { - ItemStack compare = meats.get(a); - if(drop.isItemEqual(compare)) - { - dropItem = false; - } - } - } - if(dropItem) - { - drop.stackSize = 1; - if(event.lootingLevel > 0) - { - drop.stackSize += dropper.getRNG().nextInt(event.lootingLevel+1); - } - meats.add(drop.copy()); - } - } - } - - for(int a = 0; a < meats.size(); a ++) - { - ItemStack meat = meats.get(a); - dropper.entityDropItem(meat, 0.0F); - } - } - } - - @SubscribeEvent - public void killEntity(LivingDeathEvent event) - { - //killsCount - EntityLivingBase dead = event.entityLiving; - EntityLivingBase hunter = null; - ItemStack weapon = null; - DamageSource source = event.source; - - if(dead instanceof EntityWitch) - { - dropBook(dead, 0); - } - if(dead instanceof EntityVillager) - { - dropBook(dead, 1); - } - if(dead instanceof EntityZombie) - { - dropBook(dead, 2); - } - if(source != null && source.getEntity() != null) - { - if(source.getEntity() instanceof EntityLivingBase) - { - hunter = (EntityLivingBase)source.getEntity(); - weapon = hunter.getHeldItem(); - if(hunter instanceof EntityPlayer) - { - addKill((EntityPlayer)hunter, dead); - } - } - } - if(weapon != null) - { - String type = ToolHelper.getCrafterTool(weapon); - if(weapon.getItem() instanceof IHuntingItem) - { - if(((IHuntingItem)weapon.getItem()).canRetrieveDrops(weapon)) - { - dead.getEntityData().setBoolean("hunterKill", true); - } - } - else if (type != null && type.equalsIgnoreCase("knife")) - { - dead.getEntityData().setBoolean("hunterKill", true); - } - } - } - - private void dropBook(EntityLivingBase dead, int id) - { - if(dead.worldObj.isRemote)return; - Item book = null; - if(id == 0) - { - float chance = rand.nextFloat(); - if(chance > 0.75F) - { - book = ToolListMF.skillbook_engineering; - } - else - { - book = ToolListMF.skillbook_provisioning; - } - } - else if(id == 1 && rand.nextInt(5) == 0) - { - float chance = rand.nextFloat(); - if(chance > 0.9F) - { - book = ToolListMF.skillbook_engineering; - } - else if(chance > 0.6F) - { - book = ToolListMF.skillbook_artisanry; - } - else if(chance > 0.3F) - { - book = ToolListMF.skillbook_construction; - } - else - { - book = ToolListMF.skillbook_provisioning; - } - } - else if(id == 2 && rand.nextInt(25) == 0) - { - float chance = rand.nextFloat(); - if(chance > 0.9F) - { - book = ToolListMF.skillbook_engineering; - } - else if(chance > 0.6F) - { - book = ToolListMF.skillbook_artisanry; - } - else if(chance > 0.3F) - { - book = ToolListMF.skillbook_construction; - } - else - { - book = ToolListMF.skillbook_provisioning; - } - } - if(book != null) - { - dead.entityDropItem(new ItemStack(book), 0F); - } - } - - private void addKill(EntityPlayer hunter, EntityLivingBase dead) - { - addKillTo(hunter, "killsCount"); - if(dead instanceof IMob) - { - addKillTo(hunter, "killsCountMob"); - } - else if(dead instanceof IAnimals) - { - addKillTo(hunter, "killsCountAnimal"); - } - if(dead instanceof EntityPlayer) - { - addKillTo(hunter, "killsCountPlayer"); - } - } - - @SubscribeEvent - public void useHoe(UseHoeEvent event) - { - Block block = event.world.getBlock(event.x, event.y, event.z); - if(block != Blocks.farmland && FarmingHelper.didHoeFail(event.current, event.world, block == Blocks.grass)) - { - event.entityPlayer.swingItem(); - event.world.playAuxSFXAtEntity(event.entityPlayer, 2001, event.x, event.y, event.z, Block.getIdFromBlock(block) + (event.world.getBlockMetadata(event.x, event.y, event.z) << 12)); - event.setCanceled(true); - } - } - - @SubscribeEvent - public void breakBlock(BreakEvent event) - { - Block block = event.block; - Block base = event.world.getBlock(event.x, event.y-1, event.z); - int meta = event.blockMetadata; - - if(base != null && base == Blocks.farmland && FarmingHelper.didHarvestRuinBlock(event.world, false)) - { - event.world.setBlock(event.x, event.y-1, event.z, Blocks.dirt); - } - if(event.getPlayer() != null) - { - playerMineBlock(event); - } - } - public void playerMineBlock(BlockEvent.BreakEvent event) - { - if(event.getPlayer() == null)return; - - if(event.getPlayer().capabilities.isCreativeMode)return; - - ItemStack held = event.getPlayer().getHeldItem(); - Block broken = event.block; - - if(broken != null && ConfigHardcore.HCCallowRocks) - { - if(broken == Blocks.stone && held == null) - { - entityDropItem(event.world, event.x, event.y, event.z, new ItemStack(ComponentListMF.sharp_rock, rand.nextInt(3)+1)); - } - if(broken instanceof BlockLeavesBase && held != null && held.getItem() == ComponentListMF.sharp_rock) - { - if(rand.nextInt(5) == 0) - { - entityDropItem(event.world, event.x, event.y, event.z, new ItemStack(Items.stick, rand.nextInt(3)+1)); - } - if(rand.nextInt(3) == 0) - { - entityDropItem(event.world, event.x, event.y, event.z, new ItemStack(ComponentListMF.vine, rand.nextInt(3)+1)); - } - } - } - - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(event.getPlayer()) && ConfigStamina.affectMining) - { - float points = 2.0F*ConfigStamina.miningSpeed; - ItemWeaponMF.applyFatigue(event.getPlayer(), points, 20F); - - if(points > 0 && !StaminaBar.isAnyStamina(event.getPlayer(), false)) - { - event.getPlayer().addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 100, 1)); - } - } - } - - public EntityItem entityDropItem(World world, int x, int y, int z, ItemStack item) - { - if (item.stackSize != 0 && item.getItem() != null) - { - EntityItem entityitem = new EntityItem(world, x+0.5D, y+0.5D, z+0.5D, item); + + public static void addSingleDT(ItemStack armour, EntityPlayer user, int id, List list, boolean extra) { + int slot = ((ItemArmor) armour.getItem()).armorType; + String attatch = ""; + + int rating = (int) (ArmourCalculator.getDTForDisplayPiece(armour, id) * 100F); + int equipped = (int) (ArmourCalculator.getDTForDisplayPiece(user.getCurrentArmor(3 - slot), id) * 100F); + + if (rating > 0 || equipped > 0) { + if (equipped > 0 && rating != equipped) { + float d = rating - equipped; + if (d > 0) { + attatch += EnumChatFormatting.DARK_GREEN; + } + if (d < 0) { + attatch += EnumChatFormatting.RED; + } + String d2 = ItemWeaponMF.decimal_format.format(d); + attatch += " (" + (d > 0 ? "+" : "") + d2 + ")"; + } + list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("attribute.armour.rating." + id) + " " + + rating + attatch); + } + } + + public static void addArmourDR(ItemStack armour, EntityPlayer user, List list, boolean extra) { + list.add(""); + String AC = ArmourCalculator.getArmourClass(armour); + if (AC != null) { + list.add(StatCollector.translateToLocal("attribute.armour." + AC)); + } + if (armour.getItem() instanceof ISpecialArmourMF) { + if (ArmourCalculator.advancedDamageTypes) { + list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("attribute.armour.protection")); + addSingleDR(armour, user, 0, list, extra, true); + addSingleDR(armour, user, 2, list, extra, true); + addSingleDR(armour, user, 1, list, extra, true); + } else { + addSingleDR(armour, user, 0, list, extra, false); + } + } + } + + public static void addSingleDR(ItemStack armour, EntityPlayer user, int id, List list, boolean extra, + boolean advanced) { + int slot = ((ItemArmor) armour.getItem()).armorType; + String attatch = ""; + + int rating = (int) (ArmourCalculator.getDRForDisplayPiece(armour, id) * 100F); + int equipped = (int) (ArmourCalculator.getDRForDisplayPiece(user.getCurrentArmor(3 - slot), id) * 100F); + + if (rating > 0 || equipped > 0) { + if (equipped > 0 && rating != equipped) { + float d = rating - equipped; + if (d > 0) { + attatch += EnumChatFormatting.DARK_GREEN; + } + if (d < 0) { + attatch += EnumChatFormatting.RED; + } + String d2 = ItemWeaponMF.decimal_format.format(d); + attatch += " (" + (d > 0 ? "+" : "") + d2 + ")"; + } + if (advanced) { + list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("attribute.armour.rating." + id) + " " + + rating + attatch); + } else { + list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("attribute.armour.protection") + ": " + + rating + attatch); + } + } + } + + public static String getRegisterName(Entity entity) { + String s = EntityList.getEntityString(entity); + + if (s == null) { + s = "generic"; + } + + return s; + } + + public static void tickHitSpeeds(EntityLivingBase user) { + int time = getHitspeedTime(user); + if (time > 0) { + time--; + user.getEntityData().setInteger(hitspeedNBT, time); + } + + } + + public static void setHitTime(EntityLivingBase user, int time) { + user.getEntityData().setInteger(hitspeedNBT, time); + } + + public static int getHitspeedTime(Entity entity) { + if (entity != null && entity.getEntityData().hasKey(hitspeedNBT)) { + return entity.getEntityData().getInteger(hitspeedNBT); + } + return 0; + } + + public static int getInjuredTime(Entity entity) { + if (entity.getEntityData().hasKey(injuredNBT)) { + return entity.getEntityData().getInteger(injuredNBT); + } + return 0; + } + + @SubscribeEvent + public void tryDropItems(LivingDropsEvent event) { + EntityLivingBase dropper = event.entityLiving; + + if (dropper instanceof EntityChicken) { + int dropCount = 1 + random.nextInt(event.lootingLevel + 1 * 4); + + for (int a = 0; a < dropCount; a++) { + dropper.entityDropItem(new ItemStack(Items.feather), 0.0F); + } + } + if (dropper.getEntityData().hasKey("MF_LootDrop")) { + int id = dropper.getEntityData().getInteger("MF_LootDrop"); + Item drop = id == 0 ? ToolListMF.loot_sack : id == 1 ? ToolListMF.loot_sack_uc : ToolListMF.loot_sack_rare; + dropper.entityDropItem(new ItemStack(drop), 0.0F); + } + if (dropper instanceof EntityAgeable && dropper.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD) { + if (random.nextFloat() * (1 + event.lootingLevel) < 0.05F) { + dropper.entityDropItem(new ItemStack(FoodListMF.guts), 0.0F); + } + } + if (dropper instanceof IAnimals && !(dropper instanceof IMob)) { + if (ConfigHardcore.hunterKnife && !dropper.getEntityData().hasKey("hunterKill")) { + event.setCanceled(true); + return; + } + if (ConfigHardcore.lessHunt) { + alterDrops(dropper, event); + } + } + if (getRegisterName(dropper).contains("Horse")) { + int dropCount = random.nextInt(3 + event.lootingLevel); + if (ConfigHardcore.lessHunt) { + dropCount = 1 + random.nextInt(event.lootingLevel + 1); + } + + Item meat = dropper.isBurning() ? FoodListMF.horse_cooked : FoodListMF.horse_raw; + for (int a = 0; a < dropCount; a++) { + dropper.entityDropItem(new ItemStack(meat), 0.0F); + } + } + if (getRegisterName(dropper).contains("Wolf")) { + int dropCount = random.nextInt(3 + event.lootingLevel); + if (ConfigHardcore.lessHunt) { + dropCount = 1 + random.nextInt(event.lootingLevel + 1); + } + + Item meat = dropper.isBurning() ? FoodListMF.wolf_cooked : FoodListMF.wolf_raw; + for (int a = 0; a < dropCount; a++) { + dropper.entityDropItem(new ItemStack(meat), 0.0F); + } + } + dropLeather(event.entityLiving, event); + + if (dropper instanceof EntitySkeleton) { + EntitySkeleton skeleton = (EntitySkeleton) dropper; + + if ((skeleton.getHeldItem() == null || !(skeleton.getHeldItem().getItem() instanceof ItemBow)) + && event.drops != null && !event.drops.isEmpty()) { + Iterator list = event.drops.iterator(); + + while (list.hasNext()) { + EntityItem entItem = list.next(); + ItemStack drop = entItem.getEntityItem(); + + if (drop.getItem() == Items.arrow) { + entItem.setDead(); + } + } + } + } + } + + private void dropLeather(EntityLivingBase mob, LivingDropsEvent event) { + boolean dropHide = shouldAnimalDropHide(mob); + Item hide = getHideFor(mob); + + if (event.drops != null && !event.drops.isEmpty()) { + Iterator list = event.drops.iterator(); + + while (list.hasNext()) { + EntityItem entItem = list.next(); + ItemStack drop = entItem.getEntityItem(); + + if (drop.getItem() == Items.leather) { + entItem.setDead(); + dropHide = true; + } + } + } + if (dropHide && hide != null && !(ConfigHardcore.hunterKnife && !mob.getEntityData().hasKey("hunterKill"))) { + mob.entityDropItem(new ItemStack(hide), 0.0F); + } + } + + private Item getHideFor(EntityLivingBase mob) { + Item[] hide = new Item[]{ComponentListMF.rawhideSmall, ComponentListMF.rawhideMedium, + ComponentListMF.rawhideLarge}; + int size = getHideSizeFor(mob); + if (mob.isChild()) { + size--; + } + + if (size <= 0) { + return null; + } + if (size > hide.length) { + size = hide.length; + } + + return hide[size - 1]; + } + + private int getHideSizeFor(EntityLivingBase mob) { + String mobName = mob.getClass().getName(); + if (mobName.endsWith("EntityCow") || mobName.endsWith("EntityHorse")) { + return 3; + } + if (mobName.endsWith("EntitySheep")) { + return 2; + } + if (mobName.endsWith("EntityPig")) { + return 1; + } + + int size = mob.myEntitySize.ordinal() + 1; + if (size <= 1) { + return 0; + } + if (size == 2) { + return 1; + } else if (size <= 4) { + return 2; + } + return 3; + } + + private boolean shouldAnimalDropHide(EntityLivingBase mob) { + String mobName = mob.getClass().getName(); + if (mobName.endsWith("EntityWolf") || mobName.endsWith("EntityPig") || mobName.endsWith("EntitySheep") + || mobName.endsWith("EntityCow") || mobName.endsWith("EntityHorse")) { + return true; + } + if (mob instanceof EntityWolf || mob instanceof EntityCow || mob instanceof EntityPig + || mob instanceof EntitySheep || mob instanceof EntityHorse) { + return true; + } + return false; + } + + @SubscribeEvent + public void onDeath(LivingDeathEvent event) { + if (!event.entityLiving.worldObj.isRemote && event.entityLiving instanceof EntityDragon && event.source != null + && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + PlayerTickHandlerMF.addDragonKill((EntityPlayer) event.source.getEntity()); + } + if (!event.entityLiving.worldObj.isRemote && event.entityLiving instanceof EntityPlayer && event.source != null + && event.source.getEntity() != null && event.source.getEntity() instanceof EntityDragon) { + PlayerTickHandlerMF.addDragonEnemyPts((EntityPlayer) event.entityLiving, -1); + } + Entity dropper = event.entity; + + boolean useArrows = true; + try { + Class.forName("minefantasy.mf2.api.helpers.ArrowEffectsMF"); + } catch (Exception e) { + useArrows = false; + } + if (dropper != null && useArrows && ConfigExperiment.stickArrows && !dropper.worldObj.isRemote) { + ArrayList stuckArrows = (ArrayList) ArrowEffectsMF.getStuckArrows(dropper); + if (stuckArrows != null && !stuckArrows.isEmpty()) { + Iterator list = stuckArrows.iterator(); + + while (list.hasNext()) { + ItemStack arrow = (ItemStack) list.next(); + if (arrow != null) { + dropper.entityDropItem(arrow, 0.0F); + } + } + } + } + + } + + @SubscribeEvent + public void spawnEntity(EntityJoinWorldEvent event) { + if (event.entity.isDead) { + return; + } + if (event.entity instanceof EntityItem && !(event.entity instanceof EntityItemUnbreakable)) { + EntityItem eitem = (EntityItem) event.entity; + if (eitem.getEntityItem() != null) { + if (eitem.getEntityItem().hasTagCompound() + && eitem.getEntityItem().getTagCompound().hasKey("Unbreakable")) { + EntityItem newEntity = new EntityItemUnbreakable(event.world, eitem); + event.world.spawnEntityInWorld(newEntity); + eitem.setDead(); + } + if (isDragonforge(eitem.getEntityItem())) { + MFLogUtil.logDebug("Found dragon heart"); + EntityItem newEntity = new EntityItemUnbreakable(event.world, eitem); + event.world.spawnEntityInWorld(newEntity); + eitem.setDead(); + } + } + } + } + + private boolean isDragonforge(ItemStack itemstack) { + return itemstack.getItem() == ComponentListMF.dragon_heart; + } + + public void alterDrops(EntityLivingBase dropper, LivingDropsEvent event) { + ArrayList meats = new ArrayList(); + + if (event.drops != null && !event.drops.isEmpty()) { + Iterator list = event.drops.iterator(); + + while (list.hasNext()) { + EntityItem entItem = list.next(); + ItemStack drop = entItem.getEntityItem(); + boolean dropItem = true; + + if (drop.getItem() instanceof ItemFood) { + entItem.setDead(); + + if (!meats.isEmpty()) { + for (int a = 0; a < meats.size(); a++) { + ItemStack compare = meats.get(a); + if (drop.isItemEqual(compare)) { + dropItem = false; + } + } + } + if (dropItem) { + drop.stackSize = 1; + if (event.lootingLevel > 0) { + drop.stackSize += dropper.getRNG().nextInt(event.lootingLevel + 1); + } + meats.add(drop.copy()); + } + } + } + + for (int a = 0; a < meats.size(); a++) { + ItemStack meat = meats.get(a); + dropper.entityDropItem(meat, 0.0F); + } + } + } + + @SubscribeEvent + public void killEntity(LivingDeathEvent event) { + // killsCount + EntityLivingBase dead = event.entityLiving; + EntityLivingBase hunter = null; + ItemStack weapon = null; + DamageSource source = event.source; + + if (dead instanceof EntityWitch) { + dropBook(dead, 0); + } + if (dead instanceof EntityVillager) { + dropBook(dead, 1); + } + if (dead instanceof EntityZombie) { + dropBook(dead, 2); + } + if (source != null && source.getEntity() != null) { + if (source.getEntity() instanceof EntityLivingBase) { + hunter = (EntityLivingBase) source.getEntity(); + weapon = hunter.getHeldItem(); + if (hunter instanceof EntityPlayer) { + addKill((EntityPlayer) hunter, dead); + } + } + } + if (weapon != null) { + String type = ToolHelper.getCrafterTool(weapon); + if (weapon.getItem() instanceof IHuntingItem) { + if (((IHuntingItem) weapon.getItem()).canRetrieveDrops(weapon)) { + dead.getEntityData().setBoolean("hunterKill", true); + } + } else if (type != null && type.equalsIgnoreCase("knife")) { + dead.getEntityData().setBoolean("hunterKill", true); + } + } + } + + private void dropBook(EntityLivingBase dead, int id) { + if (dead.worldObj.isRemote) + return; + Item book = null; + if (id == 0) { + float chance = random.nextFloat(); + if (chance > 0.75F) { + book = ToolListMF.skillbook_engineering; + } else { + book = ToolListMF.skillbook_provisioning; + } + } else if (id == 1 && random.nextInt(5) == 0) { + float chance = random.nextFloat(); + if (chance > 0.9F) { + book = ToolListMF.skillbook_engineering; + } else if (chance > 0.6F) { + book = ToolListMF.skillbook_artisanry; + } else if (chance > 0.3F) { + book = ToolListMF.skillbook_construction; + } else { + book = ToolListMF.skillbook_provisioning; + } + } else if (id == 2 && random.nextInt(25) == 0) { + float chance = random.nextFloat(); + if (chance > 0.9F) { + book = ToolListMF.skillbook_engineering; + } else if (chance > 0.6F) { + book = ToolListMF.skillbook_artisanry; + } else if (chance > 0.3F) { + book = ToolListMF.skillbook_construction; + } else { + book = ToolListMF.skillbook_provisioning; + } + } + if (book != null) { + dead.entityDropItem(new ItemStack(book), 0F); + } + } + + private void addKill(EntityPlayer hunter, EntityLivingBase dead) { + addKillTo(hunter, "killsCount"); + if (dead instanceof IMob) { + addKillTo(hunter, "killsCountMob"); + } else if (dead instanceof IAnimals) { + addKillTo(hunter, "killsCountAnimal"); + } + if (dead instanceof EntityPlayer) { + addKillTo(hunter, "killsCountPlayer"); + } + } + + @SubscribeEvent + public void useHoe(UseHoeEvent event) { + Block block = event.world.getBlock(event.x, event.y, event.z); + if (block != Blocks.farmland && FarmingHelper.didHoeFail(event.current, event.world, block == Blocks.grass)) { + event.entityPlayer.swingItem(); + event.world.playAuxSFXAtEntity(event.entityPlayer, 2001, event.x, event.y, event.z, + Block.getIdFromBlock(block) + (event.world.getBlockMetadata(event.x, event.y, event.z) << 12)); + event.setCanceled(true); + } + } + + @SubscribeEvent + public void breakBlock(BreakEvent event) { + // Block block = event.block; + Block base = event.world.getBlock(event.x, event.y - 1, event.z); + // int meta = event.blockMetadata; + + if (base != null && base == Blocks.farmland && FarmingHelper.didHarvestRuinBlock(event.world, false)) { + event.world.setBlock(event.x, event.y - 1, event.z, Blocks.dirt); + } + + EntityPlayer player = event.getPlayer(); + if (player != null && !player.capabilities.isCreativeMode && !(player instanceof FakePlayer)) { + playerMineBlock(event); + } + } + + /*@SubscribeEvent + public void loadChunk(ChunkEvent.Load event) { + }*/ + + public void playerMineBlock(BlockEvent.BreakEvent event) { + EntityPlayer player = event.getPlayer(); + ItemStack held = player.getHeldItem(); + Block broken = event.block; + + if (broken != null && ConfigHardcore.HCCallowRocks) { + if (broken == Blocks.stone && held == null) { + entityDropItem(event.world, event.x, event.y, event.z, + new ItemStack(ComponentListMF.sharp_rock, random.nextInt(3) + 1)); + } + if (broken instanceof BlockLeavesBase && held != null && held.getItem() == ComponentListMF.sharp_rock) { + if (random.nextInt(5) == 0) { + entityDropItem(event.world, event.x, event.y, event.z, + new ItemStack(Items.stick, random.nextInt(3) + 1)); + } + if (random.nextInt(3) == 0) { + entityDropItem(event.world, event.x, event.y, event.z, + new ItemStack(ComponentListMF.vine, random.nextInt(3) + 1)); + } + } + } + + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(player) && ConfigStamina.affectMining) { + float points = 2.0F * ConfigStamina.miningSpeed; + ItemWeaponMF.applyFatigue(player, points, 20F); + + if (points > 0 && !StaminaBar.isAnyStamina(player, false)) { + player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 100, 1)); + } + } + } + + public EntityItem entityDropItem(World world, int x, int y, int z, ItemStack item) { + if (item.stackSize != 0 && item.getItem() != null) { + EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, item); entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); return entityitem; - } - else - { + } else { return null; } } - - private void addKillTo(EntityPlayer hunter, String type) - { - int kills = hunter.getEntityData().hasKey(type) ? hunter.getEntityData().getInteger(type) : 0; - kills ++; - hunter.getEntityData().setInteger(type, kills); - } - public static boolean displayOreDict = false; - - @SubscribeEvent - public void setTooltip(ItemTooltipEvent event) - { - if(!event.entity.worldObj.isRemote) - { - return; - } - - if(event.itemStack != null) - { - boolean saidArtefact = false; - int[] ids = OreDictionary.getOreIDs(event.itemStack); - boolean hasInfo = false; - if(ids != null) - { - for(int id : ids) - { - String s = OreDictionary.getOreName(id); - if(s != null) - { - if(!hasInfo && s.startsWith("ingot")) - { - String s2 = s.substring(5, s.length()); - CustomMaterial material = CustomMaterial.getMaterial(s2); - if(material != null)hasInfo = true; - - CustomToolHelper.addComponentString(event.itemStack, event.toolTip, material); - } - if(s.startsWith("Artefact-")) - { - if(!saidArtefact) - { - String knowledge = s.substring(9).toLowerCase(); - - if(!ResearchLogic.hasInfoUnlocked(event.entityPlayer, knowledge)) - { - saidArtefact = true; - event.toolTip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("info.hasKnowledge")); - } - } - } - else if(displayOreDict) - { - event.toolTip.add("oreDict: " + s); - } - } - } - } - - if(event.itemStack.hasTagCompound() && event.itemStack.getTagCompound().hasKey("MF_Inferior")) - { - if(event.itemStack.getTagCompound().getBoolean("MF_Inferior")) - { - event.toolTip.add(EnumChatFormatting.RED + StatCollector.translateToLocal("attribute.inferior.name")); - } - if(!event.itemStack.getTagCompound().getBoolean("MF_Inferior")) - { - event.toolTip.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("attribute.superior.name")); - } - } - if(event.itemStack.getItem() instanceof ItemArmor && (!(event.itemStack.getItem() instanceof ItemArmourMFBase) || ClientItemsMF.showSpecials(event.itemStack, event.entityPlayer, event.toolTip, event.showAdvancedItemTooltips))) - { - addArmourDR(event.itemStack, event.entityPlayer, event.toolTip, event.showAdvancedItemTooltips); - } - if(ArmourCalculator.advancedDamageTypes && ArmourCalculator.getRatioForWeapon(event.itemStack) != null) - { - displayWeaponTraits(ArmourCalculator.getRatioForWeapon(event.itemStack), event.toolTip); - } - if(ToolHelper.shouldShowTooltip(event.itemStack)) - { - showCrafterTooltip(event.itemStack, event.toolTip); - } - if(event.itemStack.hasTagCompound() && event.itemStack.getTagCompound().hasKey("MF_CraftedByName")) - { - String name = event.itemStack.getTagCompound().getString("MF_CraftedByName"); - boolean special = MineFantasyII.isNameModder(name);//Mod creators have highlights - - event.toolTip.add((special ? EnumChatFormatting.GREEN : "") + StatCollector.translateToLocal("attribute.mfcraftedbyname.name") + ": " + name + EnumChatFormatting.GRAY); - } - WeaponClass WC = WeaponClass.findClassForAny(event.itemStack); - if(WC != null && RPGElements.isSystemActive && WC.parentSkill != null) - { - event.toolTip.add(StatCollector.translateToLocal("weaponclass."+WC.name.toLowerCase())); - float skillMod = RPGElements.getWeaponModifier(event.entityPlayer, WC.parentSkill) * 100F; - if(skillMod > 100) - event.toolTip.add(StatCollector.translateToLocal("rpg.skillmod") + ItemWeaponMF.decimal_format.format(skillMod-100) + "%"); - - } - } - } - - private void displayWeaponTraits(float[] ratio, List list) - { - int cutting = (int) (ratio[0] / (ratio[0]+ratio[1]+ratio[2]) * 100F); - int piercing = (int) (ratio[2] / (ratio[0]+ratio[1]+ratio[2]) * 100F); - int blunt = (int) (ratio[1] / (ratio[0]+ratio[1]+ratio[2]) * 100F); - - addDamageType(list, cutting, "cutting"); - addDamageType(list, piercing, "piercing"); - addDamageType(list, blunt, "blunt"); - } - private void addDamageType(List list, int value, String name) - { - if(value > 0) - { - String s = StatCollector.translateToLocal("attribute.weapon."+name); - if(value < 100) - { - s += " " + value + "%"; - } - list.add(s); - } - } - public static void addArmourDT(ItemStack armour, EntityPlayer user, List list, boolean extra) - { - list.add(""); - String AC = ArmourCalculator.getArmourClass(armour); - if(AC != null) - { - list.add(StatCollector.translateToLocal("attribute.armour." + AC)); - } - list.add(EnumChatFormatting.BLUE+StatCollector.translateToLocal("attribute.armour.protection")); - addSingleDT(armour, user, 0, list, extra); - addSingleDT(armour, user, 2, list, extra); - addSingleDT(armour, user, 1, list, extra); + + private void addKillTo(EntityPlayer hunter, String type) { + int kills = hunter.getEntityData().hasKey(type) ? hunter.getEntityData().getInteger(type) : 0; + kills++; + hunter.getEntityData().setInteger(type, kills); } - public static void addSingleDT(ItemStack armour, EntityPlayer user, int id, List list, boolean extra) - { - int slot = ((ItemArmor)armour.getItem()).armorType; - String attatch = ""; - - int rating = (int)(ArmourCalculator.getDTForDisplayPiece(armour, id)*100F); - int equipped = (int)(ArmourCalculator.getDTForDisplayPiece(user.getCurrentArmor(3-slot), id)*100F); - - if(rating > 0 || equipped > 0) - { - if(equipped > 0 && rating != equipped) - { - float d = rating-equipped; - if(d > 0) - { - attatch += EnumChatFormatting.DARK_GREEN; - } - if(d < 0) - { - attatch += EnumChatFormatting.RED; - } - String d2 = ItemWeaponMF.decimal_format.format(d); - attatch += " (" + (d > 0 ? "+" : "") + d2 + ")"; - } - list.add(EnumChatFormatting.BLUE+StatCollector.translateToLocal("attribute.armour.rating."+id) + " " + rating + attatch); + + @SubscribeEvent + public void setTooltip(ItemTooltipEvent event) { + if (!event.entity.worldObj.isRemote) { + return; + } + + if (event.itemStack != null) { + boolean saidArtefact = false; + int[] ids = OreDictionary.getOreIDs(event.itemStack); + boolean hasInfo = false; + if (ids != null) { + for (int id : ids) { + String s = OreDictionary.getOreName(id); + if (s != null) { + if (!hasInfo && s.startsWith("ingot")) { + String s2 = s.substring(5, s.length()); + CustomMaterial material = CustomMaterial.getMaterial(s2); + if (material != null) + hasInfo = true; + + CustomToolHelper.addComponentString(event.itemStack, event.toolTip, material); + } + if (s.startsWith("Artefact-")) { + if (!saidArtefact) { + String knowledge = s.substring(9).toLowerCase(); + + if (!ResearchLogic.hasInfoUnlocked(event.entityPlayer, knowledge)) { + saidArtefact = true; + event.toolTip.add(EnumChatFormatting.AQUA + + StatCollector.translateToLocal("info.hasKnowledge")); + } + } + } else if (displayOreDict) { + event.toolTip.add("oreDict: " + s); + } + } + } + } + + if (event.itemStack.hasTagCompound() && event.itemStack.getTagCompound().hasKey("MF_Inferior")) { + if (event.itemStack.getTagCompound().getBoolean("MF_Inferior")) { + event.toolTip + .add(EnumChatFormatting.RED + StatCollector.translateToLocal("attribute.inferior.name")); + } + if (!event.itemStack.getTagCompound().getBoolean("MF_Inferior")) { + event.toolTip + .add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("attribute.superior.name")); + } + } + if (event.itemStack.getItem() instanceof ItemArmor + && (!(event.itemStack.getItem() instanceof ItemArmourMFBase) || ClientItemsMF.showSpecials( + event.itemStack, event.entityPlayer, event.toolTip, event.showAdvancedItemTooltips))) { + addArmourDR(event.itemStack, event.entityPlayer, event.toolTip, event.showAdvancedItemTooltips); + } + if (ArmourCalculator.advancedDamageTypes && ArmourCalculator.getRatioForWeapon(event.itemStack) != null) { + displayWeaponTraits(ArmourCalculator.getRatioForWeapon(event.itemStack), event.toolTip); + } + if (ToolHelper.shouldShowTooltip(event.itemStack)) { + showCrafterTooltip(event.itemStack, event.toolTip); + } + if (event.itemStack.hasTagCompound() && event.itemStack.getTagCompound().hasKey("MF_CraftedByName")) { + String name = event.itemStack.getTagCompound().getString("MF_CraftedByName"); + boolean special = MineFantasyII.isNameModder(name);// Mod creators have highlights + + event.toolTip.add((special ? EnumChatFormatting.GREEN : "") + + StatCollector.translateToLocal("attribute.mfcraftedbyname.name") + ": " + name + + EnumChatFormatting.GRAY); + } + WeaponClass WC = WeaponClass.findClassForAny(event.itemStack); + if (WC != null && RPGElements.isSystemActive && WC.parentSkill != null) { + event.toolTip.add(StatCollector.translateToLocal("weaponclass." + WC.name.toLowerCase())); + float skillMod = RPGElements.getWeaponModifier(event.entityPlayer, WC.parentSkill) * 100F; + if (skillMod > 100) + event.toolTip.add(StatCollector.translateToLocal("rpg.skillmod") + + ItemWeaponMF.decimal_format.format(skillMod - 100) + "%"); + + } } } - public static void addArmourDR(ItemStack armour, EntityPlayer user, List list, boolean extra) - { - list.add(""); - String AC = ArmourCalculator.getArmourClass(armour); - if(AC != null) - { - list.add(StatCollector.translateToLocal("attribute.armour." + AC)); - } - if(armour.getItem() instanceof ISpecialArmourMF) - { - if(ArmourCalculator.advancedDamageTypes) - { - list.add(EnumChatFormatting.BLUE+StatCollector.translateToLocal("attribute.armour.protection")); - addSingleDR(armour, user, 0, list, extra, true); - addSingleDR(armour, user, 2, list, extra, true); - addSingleDR(armour, user, 1, list, extra, true); - } - else - { - addSingleDR(armour, user, 0, list, extra, false); - } - } + + private void displayWeaponTraits(float[] ratio, List list) { + int cutting = (int) (ratio[0] / (ratio[0] + ratio[1] + ratio[2]) * 100F); + int piercing = (int) (ratio[2] / (ratio[0] + ratio[1] + ratio[2]) * 100F); + int blunt = (int) (ratio[1] / (ratio[0] + ratio[1] + ratio[2]) * 100F); + + addDamageType(list, cutting, "cutting"); + addDamageType(list, piercing, "piercing"); + addDamageType(list, blunt, "blunt"); } - public static void addSingleDR(ItemStack armour, EntityPlayer user, int id, List list, boolean extra, boolean advanced) - { - int slot = ((ItemArmor)armour.getItem()).armorType; - String attatch = ""; - - int rating = (int)(ArmourCalculator.getDRForDisplayPiece(armour, id)*100F); - int equipped = (int)(ArmourCalculator.getDRForDisplayPiece(user.getCurrentArmor(3-slot), id)*100F); - - if(rating > 0 || equipped > 0) - { - if(equipped > 0 && rating != equipped) - { - float d = rating-equipped; - if(d > 0) - { - attatch += EnumChatFormatting.DARK_GREEN; - } - if(d < 0) - { - attatch += EnumChatFormatting.RED; - } - String d2 = ItemWeaponMF.decimal_format.format(d); - attatch += " (" + (d > 0 ? "+" : "") + d2 + ")"; - } - if(advanced) - { - list.add(EnumChatFormatting.BLUE+StatCollector.translateToLocal("attribute.armour.rating."+id) + " " + rating + attatch); - } - else - { - list.add(EnumChatFormatting.BLUE+StatCollector.translateToLocal("attribute.armour.protection") + ": " + rating + attatch); - } + + private void addDamageType(List list, int value, String name) { + if (value > 0) { + String s = StatCollector.translateToLocal("attribute.weapon." + name); + if (value < 100) { + s += " " + value + "%"; + } + list.add(s); } } - private void showCrafterTooltip(ItemStack tool, List list) - { - String toolType = ToolHelper.getCrafterTool(tool); - int tier = ToolHelper.getCrafterTier(tool); - float efficiency = ToolHelper.getCrafterEfficiency(tool); - - list.add(StatCollector.translateToLocal("attribute.mfcrafttool.name") + ": " + StatCollector.translateToLocal("tooltype." + toolType)); - list.add(StatCollector.translateToLocal("attribute.mfcrafttier.name") + ": " + tier); - list.add(StatCollector.translateToLocal("attribute.mfcrafteff.name") + ": " + efficiency); - } - - - @SubscribeEvent - public void loadChunk(ChunkEvent.Load event) - { - } - - - - - private void dropItem(World world, ItemStack itemstack, double x, double y, double z) - { - if (itemstack != null) - { - float f = EventManagerMF.rand .nextFloat() * 0.8F + 0.1F; - float f1 = EventManagerMF.rand.nextFloat() * 0.8F + 0.1F; - float f2 = EventManagerMF.rand.nextFloat() * 0.8F + 0.1F; + private void showCrafterTooltip(ItemStack tool, List list) { + String toolType = ToolHelper.getCrafterTool(tool); + int tier = ToolHelper.getCrafterTier(tool); + float efficiency = ToolHelper.getCrafterEfficiency(tool); - while (itemstack.stackSize > 0) - { - int j1 = EventManagerMF.rand.nextInt(21) + 10; + list.add(StatCollector.translateToLocal("attribute.mfcrafttool.name") + ": " + + StatCollector.translateToLocal("tooltype." + toolType)); + list.add(StatCollector.translateToLocal("attribute.mfcrafttier.name") + ": " + tier); + list.add(StatCollector.translateToLocal("attribute.mfcrafteff.name") + ": " + efficiency); + } - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + @SubscribeEvent + public void updateEntity(LivingUpdateEvent event) { + if (event.entity instanceof EntityCogwork) { + return; + } + EntityLivingBase entity = event.entityLiving; - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, (float)x + f, (float)y + f1, (float)z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + float lowHp = entity.getMaxHealth() / 5F; + int injury = getInjuredTime(entity); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + if (ConfigHardcore.critLimp && (entity instanceof EntityLiving + || !(entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode))) { + if (entity.getHealth() <= lowHp || injury > 0) { + if (entity.getRNG().nextInt(10) == 0 && entity.onGround && !entity.isRiding()) { + entity.motionX = 0F; + entity.motionZ = 0F; + } + if (entity.ticksExisted % 15 == 0) { + entity.limbSwing = 2.0F; + float x = (float) (entity.posX + (random.nextFloat() - 0.5F) / 4F); + float y = (float) (entity.posY + entity.getEyeHeight() + (random.nextFloat() - 0.5F) / 4F); + float z = (float) (entity.posZ + (random.nextFloat() - 0.5F) / 4F); + entity.worldObj.spawnParticle("reddust", x, y, z, 0F, 0F, 0F); } + } + if (!entity.worldObj.isRemote && entity.getHealth() <= (lowHp / 2) && entity.getRNG().nextInt(200) == 0) { + entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 50)); + } + } + if (injury > 0 && !entity.worldObj.isRemote) { + injury--; + entity.getEntityData().setInteger(injuredNBT, injury); + } + if (StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(entity)) { + StaminaMechanics.tickEntity(event.entityLiving); + } + tickHitSpeeds(event.entityLiving); - float f3 = 0.05F; - entityitem.motionX = (float)EventManagerMF.rand.nextGaussian() * f3; - entityitem.motionY = (float)EventManagerMF.rand.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)EventManagerMF.rand.nextGaussian() * f3; - world.spawnEntityInWorld(entityitem); + /*if (event.entity.ticksExisted == 1 && event.entity instanceof EntityPlayer && !event.entity.worldObj.isRemote) { + }*/ + + } + + @SubscribeEvent + public void clonePlayer(PlayerEvent.Clone event) { + EntityPlayer origin = event.original; + EntityPlayer spawn = event.entityPlayer; + if (origin != null && spawn != null) { + EntityHelper.cloneNBT(origin, spawn); + } + } + + @SubscribeEvent + public void startUseItem(PlayerUseItemEvent.Start event) { + EntityPlayer player = event.entityPlayer; + if (event.item != null && event.item.getItemUseAction() == EnumAction.block) { + if ((StaminaBar.isSystemActive && TacticalManager.shouldStaminaBlock + && !StaminaBar.isAnyStamina(player, false)) || !CombatMechanics.isParryAvailable(player)) { + event.setCanceled(true); } } - } - - public static String getRegisterName(Entity entity) - { - String s = EntityList.getEntityString(entity); + } - if (s == null) + @SubscribeEvent + public void levelup(LevelupEvent event) { + EntityPlayer player = event.thePlayer; + if (!player.worldObj.isRemote) { + ((WorldServer) player.worldObj).getEntityTracker().func_151248_b(player, + new LevelupPacket(player, event.theSkill, event.theLevel).generatePacket()); + ((WorldServer) player.worldObj).getEntityTracker().func_151248_b(player, + new SkillPacket(player, event.theSkill).generatePacket()); + } + } + + @SubscribeEvent + public void syncSkill(SyncSkillEvent event) { + EntityPlayer player = event.thePlayer; + if (!player.worldObj.isRemote) { + ((WorldServer) player.worldObj).getEntityTracker().func_151248_b(player, + new SkillPacket(player, event.theSkill).generatePacket()); + } + } + + @SubscribeEvent + public void itemEvent(EntityItemPickupEvent event) { + EntityPlayer player = event.entityPlayer; + + EntityItem drop = event.item; + ItemStack item = drop.getEntityItem(); + ItemStack held = player.getHeldItem(); + + if (held != null && held.getItem() instanceof ISmithTongs) { + if (!TongsHelper.hasHeldItem(held)) { + if (isHotItem(item)) { + if (TongsHelper.trySetHeldItem(held, item)) { + drop.setDead(); + + if (event.isCancelable()) { + event.setCanceled(true); + } + return; + } + } + } + } { - s = "generic"; + if (ConfigHardcore.HCChotBurn && item != null && isHotItem(item)) { + if (event.isCancelable()) { + event.setCanceled(true); + } + } } + } - return s; + @SubscribeEvent + public void wakeUp(PlayerWakeUpEvent event) { + PlayerTickHandlerMF.wakeUp(event.entityPlayer); + } + + private boolean isHotItem(ItemStack item) { + return item != null && (item.getItem() instanceof IHotItem); } - @SubscribeEvent - public void updateEntity(LivingUpdateEvent event) - { - if(event.entity instanceof EntityCogwork) - { - return; - } - EntityLivingBase entity = event.entityLiving; - float lowHp = entity.getMaxHealth()/5F; - int injury = getInjuredTime(entity); - - if(ConfigHardcore.critLimp && (entity instanceof EntityLiving || !(entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.isCreativeMode))) - { - if(entity.getHealth() <= lowHp || injury > 0) - { - if(entity.getRNG().nextInt(10) == 0 && entity.onGround && !entity.isRiding()) - { - entity.motionX = 0F; - entity.motionZ = 0F; - } - if(entity.ticksExisted % 15 == 0) - { - entity.limbSwing = 2.0F; - float x = (float) (entity.posX + (rand.nextFloat()-0.5F)/4F); - float y = (float) (entity.posY + entity.getEyeHeight() + (rand.nextFloat()-0.5F)/4F); - float z = (float) (entity.posZ + (rand.nextFloat()-0.5F)/4F); - entity.worldObj.spawnParticle("reddust", x, y, z, 0F, 0F, 0F); - } - } - if(!entity.worldObj.isRemote && entity.getHealth() <= (lowHp/2) && entity.getRNG().nextInt(200) == 0) - { - entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 50)); - } - } - if(injury > 0 && !entity.worldObj.isRemote) - { - injury --; - entity.getEntityData().setInteger(injuredNBT, injury); - } - if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(entity)) - { - StaminaMechanics.tickEntity(event.entityLiving); - } - tickHitSpeeds(event.entityLiving); - - if(event.entity.ticksExisted == 1 && event.entity instanceof EntityPlayer && !event.entity.worldObj.isRemote) - { - } - - } - public static void tickHitSpeeds(EntityLivingBase user) - { - int time = getHitspeedTime(user); - if(time > 0) - { - time --; - user.getEntityData().setInteger(hitspeedNBT, time); - } - - } - public static final String hitspeedNBT = "MF_HitCooldown"; - public static void setHitTime(EntityLivingBase user, int time) - { - user.getEntityData().setInteger(hitspeedNBT, time); - } - public static int getHitspeedTime(Entity entity) - { - if(entity != null && entity.getEntityData().hasKey(hitspeedNBT)) - { - return entity.getEntityData().getInteger(hitspeedNBT); - } - return 0; - } - public static final String injuredNBT = "MF_Injured"; - public static int getInjuredTime(Entity entity) - { - if(entity.getEntityData().hasKey(injuredNBT)) - { - return entity.getEntityData().getInteger(injuredNBT); - } - return 0; - } - private boolean isEntityMoving(EntityLivingBase entity) - { - return Math.hypot(entity.motionX, entity.motionZ) > 0.05F; - } - - @SubscribeEvent - public void clonePlayer(PlayerEvent.Clone event) - { - EntityPlayer origin = event.original; - EntityPlayer spawn = event.entityPlayer; - if(origin != null && spawn != null) - { - EntityHelper.cloneNBT(origin, spawn); - } - } - + + @SideOnly(Side.CLIENT) @SubscribeEvent - public void startUseItem(PlayerUseItemEvent.Start event) - { - EntityPlayer player = event.entityPlayer; - if(event.item.getItemUseAction() == EnumAction.block) - { - if((StaminaBar.isSystemActive && TacticalManager.shouldStaminaBlock && !StaminaBar.isAnyStamina(player, false)) || !CombatMechanics.isParryAvailable(player)) - { - event.setCanceled(true); - } - } + public void renderEntity(RenderPlayerEvent.Specials.Pre event) { + Minecraft mc = Minecraft.getMinecraft(); + boolean showHeld = true; + if (PowerArmour.isWearingCogwork(event.entityPlayer) && mc.gameSettings.thirdPersonView != 0) { + IPowerArmour cogwork = (IPowerArmour) event.entity.ridingEntity; + showHeld = !cogwork.isArmoured("right_arm"); + } + event.renderItem = showHeld; } - private boolean canItemBlock(ItemStack item) - { - // TODO Auto-generated method stub - return true; - } - - @SubscribeEvent - public void levelup(LevelupEvent event) - { - EntityPlayer player = event.thePlayer; - if(!player.worldObj.isRemote) - { - ((WorldServer)player.worldObj).getEntityTracker().func_151248_b(player, new LevelupPacket(player, event.theSkill, event.theLevel).generatePacket()); - ((WorldServer)player.worldObj).getEntityTracker().func_151248_b(player, new SkillPacket(player, event.theSkill).generatePacket()); - } - } - @SubscribeEvent - public void syncSkill(SyncSkillEvent event) - { - EntityPlayer player = event.thePlayer; - if(!player.worldObj.isRemote) - { - ((WorldServer)player.worldObj).getEntityTracker().func_151248_b(player, new SkillPacket(player, event.theSkill).generatePacket()); - } - } - - @SubscribeEvent - public void itemEvent(EntityItemPickupEvent event) - { - EntityPlayer player = event.entityPlayer; - - EntityItem drop = event.item; - ItemStack item = drop.getEntityItem(); - ItemStack held = player.getHeldItem(); - - if(held != null && held.getItem() instanceof ISmithTongs) - { - if(!TongsHelper.hasHeldItem(held)) - { - if(isHotItem(item)) - { - if(TongsHelper.trySetHeldItem(held, item)) - { - drop.setDead(); - - if(event.isCancelable()) - { - event.setCanceled(true); - } - return; - } - } - } - } - { - if(ConfigHardcore.HCChotBurn && item != null && isHotItem(item)) - { - if(event.isCancelable()) - { - event.setCanceled(true); - } - } - } - } - - @SubscribeEvent - public void wakeUp(PlayerWakeUpEvent event) - { - PlayerTickHandlerMF.wakeUp(event.entityPlayer); - } - - private boolean isHotItem(ItemStack item) - { - return item != null && (item.getItem() instanceof IHotItem); - } - - @SideOnly(Side.CLIENT) - @SubscribeEvent - public void renderEntity (RenderPlayerEvent.Specials.Pre event) - { - Minecraft mc = Minecraft.getMinecraft(); - boolean showHeld = true; - if(PowerArmour.isWearingCogwork(event.entityPlayer) && mc.gameSettings.thirdPersonView != 0) - { - IPowerArmour cogwork = (IPowerArmour)event.entity.ridingEntity; - showHeld = !cogwork.isArmoured("right_arm"); - } - event.renderItem = showHeld; - } - @SideOnly(Side.CLIENT) - @SubscribeEvent - public void renderEntity (RenderLivingEvent.Pre event) - { - if(!(event.renderer instanceof RenderPowerArmour)) - { - boolean renderHead = false; - boolean renderBody = false; - boolean renderLeftArm = false; - boolean renderRightArm = false; - boolean renderLeftLeg = false; - boolean renderRightLeg = false; - Minecraft mc = Minecraft.getMinecraft(); - - if(event.entity instanceof EntityPlayer && !(event.entity == mc.thePlayer && ( mc.currentScreen instanceof GuiContainerCreative ||mc.currentScreen instanceof GuiInventory) ) && PowerArmour.isWearingCogwork(event.entity) && mc.gameSettings.thirdPersonView != 0) - { - IPowerArmour cogwork = (IPowerArmour)event.entity.ridingEntity; - renderHead = cogwork.isArmoured("left_leg"); - renderBody = cogwork.isArmoured("right_leg"); - renderLeftArm = cogwork.isArmoured("left_arm"); - renderRightArm = cogwork.isArmoured("right_arm"); - renderLeftLeg = cogwork.isArmoured("left_leg"); - renderRightLeg = cogwork.isArmoured("right_leg"); - } - - if(event.renderer instanceof RenderPlayer) - { - RenderPlayer RP = (RenderPlayer)event.renderer; - ModelBiped[] layers = new ModelBiped[]{RP.modelArmor, RP.modelArmorChestplate}; - - for(ModelBiped model : layers) - { - model.bipedHead.isHidden = model.bipedHeadwear.isHidden = model.bipedEars.isHidden = renderHead; - model.bipedBody.isHidden = model.bipedCloak.isHidden = renderBody; - - model.bipedLeftArm.isHidden = renderLeftArm; - model.bipedRightArm.isHidden = renderRightArm; - model.bipedLeftLeg.isHidden = renderLeftLeg; - model.bipedRightLeg.isHidden = renderRightLeg; - } - } - } - } + @SideOnly(Side.CLIENT) + @SubscribeEvent + public void renderEntity(RenderLivingEvent.Pre event) { + if (!(event.renderer instanceof RenderPowerArmour)) { + boolean renderHead = false; + boolean renderBody = false; + boolean renderLeftArm = false; + boolean renderRightArm = false; + boolean renderLeftLeg = false; + boolean renderRightLeg = false; + Minecraft mc = Minecraft.getMinecraft(); + + if (event.entity instanceof EntityPlayer && !(event.entity == mc.thePlayer + && (mc.currentScreen instanceof GuiContainerCreative || mc.currentScreen instanceof GuiInventory)) + && PowerArmour.isWearingCogwork(event.entity) && mc.gameSettings.thirdPersonView != 0) { + IPowerArmour cogwork = (IPowerArmour) event.entity.ridingEntity; + renderHead = cogwork.isArmoured("left_leg"); + renderBody = cogwork.isArmoured("right_leg"); + renderLeftArm = cogwork.isArmoured("left_arm"); + renderRightArm = cogwork.isArmoured("right_arm"); + renderLeftLeg = cogwork.isArmoured("left_leg"); + renderRightLeg = cogwork.isArmoured("right_leg"); + } + + if (event.renderer instanceof RenderPlayer) { + RenderPlayer RP = (RenderPlayer) event.renderer; + ModelBiped[] layers = new ModelBiped[]{RP.modelArmor, RP.modelArmorChestplate}; + + for (ModelBiped model : layers) { + model.bipedHead.isHidden = model.bipedHeadwear.isHidden = model.bipedEars.isHidden = renderHead; + model.bipedBody.isHidden = model.bipedCloak.isHidden = renderBody; + + model.bipedLeftArm.isHidden = renderLeftArm; + model.bipedRightArm.isHidden = renderRightArm; + model.bipedLeftLeg.isHidden = renderLeftLeg; + model.bipedRightLeg.isHidden = renderRightLeg; + } + } + } + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/ExtendedReachMF.java b/src/main/java/minefantasy/mf2/mechanics/ExtendedReachMF.java index e72e6902..ccc53f27 100644 --- a/src/main/java/minefantasy/mf2/mechanics/ExtendedReachMF.java +++ b/src/main/java/minefantasy/mf2/mechanics/ExtendedReachMF.java @@ -1,7 +1,8 @@ package minefantasy.mf2.mechanics; -import java.util.List; - +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; import mods.battlegear2.api.weapons.IExtendedReachWeapon; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; @@ -11,70 +12,51 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; -/** - * This class exists because minecraft hunger seems to decrease faster than windows stock - */ -public class ExtendedReachMF -{ - //SPRINT JUMPING - //DEFAULT:= 0:22 (50seconds till starve, 35s till nosprint) (16m in MC time for 4 missing bars) - //SLOW=5: = 2:20 (5mins till starve, 3:30 till nosprint) (1h 40m in MC time for 4 missing bars) - //EXHAUSTION SCALE = 3.0F = 1hunger - @SubscribeEvent - public void onPlayerTick(TickEvent.PlayerTickEvent event) - { - if(event.phase == TickEvent.Phase.END) - { - tickEnd(event.player); +import java.util.List; + +public class ExtendedReachMF { + + @SubscribeEvent + public void onPlayerTick(TickEvent.PlayerTickEvent event) { + if (event.phase == TickEvent.Phase.END) { + tickEnd(event.player); } } - public void tickEnd(EntityPlayer entityPlayer) - { - //If we JUST swung an Item - if (entityPlayer.swingProgressInt == 1) - { + public void tickEnd(EntityPlayer entityPlayer) { + // If we JUST swung an Item + if (entityPlayer.swingProgressInt == 1) { ItemStack mainhand = entityPlayer.getCurrentEquippedItem(); - if (mainhand != null && mainhand.getItem() instanceof IExtendedReachWeapon) - { + if (mainhand != null && mainhand.getItem() instanceof IExtendedReachWeapon) { float extendedReach = ((IExtendedReachWeapon) mainhand.getItem()).getReachModifierInBlocks(mainhand); - if(extendedReach > 0){ + if (extendedReach > 0) { MovingObjectPosition mouseOver = getMouseOver(0, extendedReach + 4); - if (mouseOver != null && mouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) - { + if (mouseOver != null && mouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { Entity target = mouseOver.entityHit; - if (target instanceof EntityLiving && target != entityPlayer) - { - if (target.hurtResistantTime != ((EntityLiving) target).maxHurtResistantTime) - { - FMLClientHandler.instance().getClient().playerController.attackEntity(entityPlayer, target); + if (target instanceof EntityLiving && target != entityPlayer) { + if (target.hurtResistantTime != ((EntityLiving) target).maxHurtResistantTime) { + FMLClientHandler.instance().getClient().playerController.attackEntity(entityPlayer, + target); } } } } } } - } - - public MovingObjectPosition getMouseOver(float tickPart, float maxDist) - { + } + + public MovingObjectPosition getMouseOver(float tickPart, float maxDist) { Minecraft mc = FMLClientHandler.instance().getClient(); - if (mc.renderViewEntity != null) - { - if (mc.theWorld != null) - { + if (mc.renderViewEntity != null) { + if (mc.theWorld != null) { mc.pointedEntity = null; double d0 = maxDist; MovingObjectPosition objectMouseOver = mc.renderViewEntity.rayTrace(d0, tickPart); double d1 = d0; Vec3 vec3 = mc.renderViewEntity.getPosition(tickPart); - if (objectMouseOver != null) - { + if (objectMouseOver != null) { d1 = objectMouseOver.hitVec.distanceTo(vec3); } @@ -82,33 +64,28 @@ public MovingObjectPosition getMouseOver(float tickPart, float maxDist) Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0); Entity pointedEntity = null; float f1 = 1.0F; - List list = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.renderViewEntity, mc.renderViewEntity.boundingBox.addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand(f1, f1, f1)); + List list = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.renderViewEntity, + mc.renderViewEntity.boundingBox + .addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand(f1, f1, 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()) - { + if (entity.canBeCollidedWith()) { float f2 = entity.getCollisionBorderSize(); AxisAlignedBB axisalignedbb = entity.boundingBox.expand(f2, f2, f2); MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32); - if (axisalignedbb.isVecInside(vec3)) - { - if (0.0D < d2 || d2 == 0.0D) - { + if (axisalignedbb.isVecInside(vec3)) { + if (0.0D < d2 || d2 == 0.0D) { pointedEntity = entity; d2 = 0.0D; } - } - else if (movingobjectposition != null) - { + } else if (movingobjectposition != null) { double d3 = vec3.distanceTo(movingobjectposition.hitVec); - if (d3 < d2 || d2 == 0.0D) - { + if (d3 < d2 || d2 == 0.0D) { pointedEntity = entity; d2 = d3; } @@ -116,8 +93,7 @@ else if (movingobjectposition != null) } } - if (pointedEntity != null && (d2 < d1 || objectMouseOver == null)) - { + if (pointedEntity != null && (d2 < d1 || objectMouseOver == null)) { objectMouseOver = new MovingObjectPosition(pointedEntity); } @@ -126,5 +102,5 @@ else if (movingobjectposition != null) } return null; } - + } diff --git a/src/main/java/minefantasy/mf2/mechanics/HitSoundGenerator.java b/src/main/java/minefantasy/mf2/mechanics/HitSoundGenerator.java index 5e2bd0b7..d475ea8b 100644 --- a/src/main/java/minefantasy/mf2/mechanics/HitSoundGenerator.java +++ b/src/main/java/minefantasy/mf2/mechanics/HitSoundGenerator.java @@ -1,6 +1,5 @@ package minefantasy.mf2.mechanics; -import minefantasy.mf2.api.weapon.IWeaponClass; import minefantasy.mf2.api.weapon.WeaponClass; import minefantasy.mf2.network.packet.HitSoundPacket; import net.minecraft.entity.Entity; @@ -10,59 +9,47 @@ import net.minecraft.item.ItemTool; import net.minecraft.world.WorldServer; -public class HitSoundGenerator -{ - public static void makeHitSound(ItemStack weapon, Entity target) - { - WeaponClass WC = WeaponClass.findClassForAny(weapon); - String material = "metal"; - String type = "blunt"; - - material = getMaterial(material, weapon); - if(WC != null) - { - type = WC.getSound(); - String sndString = "minefantasy2:weapon.hit." + type + "." + material; - - if(!target.worldObj.isRemote) - { - ((WorldServer)target.worldObj).getEntityTracker().func_151248_b(target, new HitSoundPacket(sndString, target).generatePacket()); - } - } - } +public class HitSoundGenerator { + public static void makeHitSound(ItemStack weapon, Entity target) { + WeaponClass WC = WeaponClass.findClassForAny(weapon); + String material = "metal"; + String type = "blunt"; - public static String getMaterial(String material, ItemStack itemstack) - { - if(itemstack == null) - { - return "metal"; - } - Item item = itemstack.getItem(); - if(item instanceof ItemTool) - { - if(((ItemTool)item).getToolMaterialName().equalsIgnoreCase("WOOD")) - { - material = "wood"; - } - if(((ItemTool)item).getToolMaterialName().equalsIgnoreCase("STONE")) - { - material = "stone"; - } - } - - if(item instanceof ItemSword) - { - if(((ItemSword)item).getToolMaterialName().equalsIgnoreCase("WOOD")) - { - material = "wood"; - } - if(((ItemSword)item).getToolMaterialName().equalsIgnoreCase("STONE")) - { - material = "stone"; - } - } - - return material; - } -} + material = getMaterial(material, weapon); + if (WC != null) { + type = WC.getSound(); + String sndString = "minefantasy2:weapon.hit." + type + "." + material; + + if (!target.worldObj.isRemote) { + ((WorldServer) target.worldObj).getEntityTracker().func_151248_b(target, + new HitSoundPacket(sndString, target).generatePacket()); + } + } + } + + public static String getMaterial(String material, ItemStack itemstack) { + if (itemstack == null) { + return "metal"; + } + Item item = itemstack.getItem(); + if (item instanceof ItemTool) { + if (((ItemTool) item).getToolMaterialName().equalsIgnoreCase("WOOD")) { + material = "wood"; + } + if (((ItemTool) item).getToolMaterialName().equalsIgnoreCase("STONE")) { + material = "stone"; + } + } + if (item instanceof ItemSword) { + if (((ItemSword) item).getToolMaterialName().equalsIgnoreCase("WOOD")) { + material = "wood"; + } + if (((ItemSword) item).getToolMaterialName().equalsIgnoreCase("STONE")) { + material = "stone"; + } + } + + return material; + } +} diff --git a/src/main/java/minefantasy/mf2/mechanics/MFArrowDispenser.java b/src/main/java/minefantasy/mf2/mechanics/MFArrowDispenser.java index d055e691..458cede4 100644 --- a/src/main/java/minefantasy/mf2/mechanics/MFArrowDispenser.java +++ b/src/main/java/minefantasy/mf2/mechanics/MFArrowDispenser.java @@ -6,34 +6,30 @@ import net.minecraft.dispenser.BehaviorDefaultDispenseItem; import net.minecraft.dispenser.IBlockSource; import net.minecraft.dispenser.IPosition; -import net.minecraft.entity.Entity; -import net.minecraft.entity.IProjectile; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; -public class MFArrowDispenser extends BehaviorDefaultDispenseItem -{ +public class MFArrowDispenser extends BehaviorDefaultDispenseItem { /** * Dispense the specified stack, play the dispense sound and spawn particles. */ - public ItemStack dispenseStack(IBlockSource dispenser, ItemStack item) - { + public ItemStack dispenseStack(IBlockSource dispenser, ItemStack item) { World world = dispenser.getWorld(); IPosition iposition = BlockDispenser.func_149939_a(dispenser); EnumFacing direction = BlockDispenser.func_149937_b(dispenser.getBlockMetadata()); - double posX = dispenser.getX() + ((float)direction.getFrontOffsetX()); - double posY = dispenser.getY() + ((float)direction.getFrontOffsetY()); - double posZ = dispenser.getZ() + ((float)direction.getFrontOffsetZ()); - - if(item.getItem() instanceof ItemArrowMF) - { - ItemArrowMF arrowitem = (ItemArrowMF)item.getItem(); - EntityArrowMF arrow = arrowitem.getFiredArrow(new EntityArrowMF(world, posX, posY, posZ), item); - arrow.setThrowableHeading((double)direction.getFrontOffsetX(), (double)((float)direction.getFrontOffsetY() + 0.1F), (double)direction.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a()); - world.spawnEntityInWorld((Entity)arrow); - arrow.canBePickedUp = 1; - item.splitStack(1); + double posX = dispenser.getX() + (direction.getFrontOffsetX()); + double posY = dispenser.getY() + (direction.getFrontOffsetY()); + double posZ = dispenser.getZ() + (direction.getFrontOffsetZ()); + + if (item.getItem() instanceof ItemArrowMF) { + ItemArrowMF arrowitem = (ItemArrowMF) item.getItem(); + EntityArrowMF arrow = arrowitem.getFiredArrow(new EntityArrowMF(world, posX, posY, posZ), item); + arrow.setThrowableHeading(direction.getFrontOffsetX(), direction.getFrontOffsetY() + 0.1F, + direction.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a()); + world.spawnEntityInWorld(arrow); + arrow.canBePickedUp = 1; + item.splitStack(1); } return item; } @@ -41,18 +37,15 @@ public ItemStack dispenseStack(IBlockSource dispenser, ItemStack item) /** * Play the dispense sound from the specified block. */ - protected void playDispenseSound(IBlockSource p_82485_1_) - { + protected void playDispenseSound(IBlockSource p_82485_1_) { p_82485_1_.getWorld().playAuxSFX(1002, p_82485_1_.getXInt(), p_82485_1_.getYInt(), p_82485_1_.getZInt(), 0); } - protected float func_82498_a() - { + protected float func_82498_a() { return 6.0F; } - protected float func_82500_b() - { + protected float func_82500_b() { return 1.1F; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/mechanics/MonsterUpgrader.java b/src/main/java/minefantasy/mf2/mechanics/MonsterUpgrader.java index c5c00f40..98a17b72 100644 --- a/src/main/java/minefantasy/mf2/mechanics/MonsterUpgrader.java +++ b/src/main/java/minefantasy/mf2/mechanics/MonsterUpgrader.java @@ -1,240 +1,181 @@ package minefantasy.mf2.mechanics; -import java.util.Random; - +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.config.ConfigHardcore; -import minefantasy.mf2.item.armour.ItemCustomArmour; -import minefantasy.mf2.item.list.ArmourListMF; import minefantasy.mf2.item.list.CustomArmourListMF; import minefantasy.mf2.item.list.CustomToolListMF; -import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.item.weapon.ItemWeaponMF; +import minefantasy.mf2.util.XSTRandom; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntityPigZombie; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.EntitySpider; -import net.minecraft.entity.monster.EntityWitch; -import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.monster.*; import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -public class MonsterUpgrader -{ - private static final float zombieWepChance = 10F; - private static final float zombieKnightChance = 200F; - private static final float zombieBruteChance = 200F; - - private static final float creeperJockeyChance = 60F; - private static final float witchRiderChance = 100F; - - private static Random rand = new Random(); - public static final String zombieArmourNBT = "MF_ZombieArmour"; - - public void upgradeMob(EntityLivingBase mob) - { - int diff = mob.worldObj.difficultySetting.getDifficultyId(); +public class MonsterUpgrader { + public static final String zombieArmourNBT = "MF_ZombieArmour"; + private static final float zombieWepChance = 10F; + private static final float zombieKnightChance = 200F; + private static final float zombieBruteChance = 200F; + private static final float creeperJockeyChance = 60F; + private static final float witchRiderChance = 100F; + + private static XSTRandom random = new XSTRandom(); - if(ConfigHardcore.upgradeZombieWep) - { - if(mob instanceof EntitySkeleton) - { - if(((EntitySkeleton)mob).getSkeletonType() == 1) - { - giveEntityWeapon(mob, "Diamond", rand.nextInt(8)); - } - else if(CombatMechanics.swordSkeleton && rand.nextInt(3) == 0) - { - mob.setCurrentItemOrArmor(0, CustomToolListMF.standard_sword.construct("Bronze","OakWood")); - ((EntitySkeleton)mob).setCombatTask(); - } - } - else if(mob instanceof EntityZombie) - { - String tier = "Iron"; - if(mob instanceof EntityPigZombie) - { - tier = "Obsidian"; - giveEntityWeapon(mob, tier, rand.nextInt(7)); - if(mob.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null) - { - mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); - } - } - else - { - if(mob.getHeldItem() != null && mob.getHeldItem().getItem() == Items.iron_sword) - { - giveEntityWeapon(mob, tier, 0); - if(mob.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null) - { - mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); - } - } - else - { - float mod = diff >= 2 ? ConfigHardcore.zombieWepChance*2 : diff < 1 ? ConfigHardcore.zombieWepChance/2 : ConfigHardcore.zombieWepChance; - float chance = rand.nextFloat()*100F*mod; - if(chance >= (100F-zombieWepChance)) - { - giveEntityWeapon(mob, tier, rand.nextInt(5)); - if(mob.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null) - { - mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); - } - } - } - } - if(rand.nextFloat()*(zombieKnightChance) < diff) - { - createZombieKnight((EntityZombie)mob); - } - else if(rand.nextFloat()*(zombieBruteChance) < diff) - { - createZombieBrute((EntityZombie)mob); - } - else if(ConfigHardcore.fastZombies) - { - mob.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3F); - } - } - } - else if(mob instanceof EntitySpider) - { - if(mob.riddenByEntity == null) - { - if(rand.nextFloat()*(witchRiderChance) < diff) - { - EntityWitch rider = new EntityWitch(mob.worldObj); - rider.setPosition(mob.posX, mob.posY, mob.posZ); - mob.worldObj.spawnEntityInWorld(rider); - rider.mountEntity(mob); - } - else if(rand.nextFloat()*(creeperJockeyChance) < diff) - { - EntityCreeper rider = new EntityCreeper(mob.worldObj); - rider.setPosition(mob.posX, mob.posY, mob.posZ); - mob.worldObj.spawnEntityInWorld(rider); - rider.mountEntity(mob); - } - } - } - else - { - if(mob.getHeldItem() != null && mob.getHeldItem().getItem() == Items.iron_sword) - { - giveEntityWeapon(mob, "iron", 0); - } - } - if(mob instanceof EntityPigZombie) - { - mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); - } + public void upgradeMob(EntityLivingBase mob) { + int diff = mob.worldObj.difficultySetting.getDifficultyId(); + + if (ConfigHardcore.upgradeZombieWep) { + if (mob instanceof EntitySkeleton) { + if (((EntitySkeleton) mob).getSkeletonType() == 1) { + giveEntityWeapon(mob, "Diamond", random.nextInt(8)); + } else if (CombatMechanics.swordSkeleton && random.nextInt(3) == 0) { + mob.setCurrentItemOrArmor(0, CustomToolListMF.standard_sword.construct("Bronze", "OakWood")); + ((EntitySkeleton) mob).setCombatTask(); + } + } else if (mob instanceof EntityZombie) { + String tier = "Iron"; + if (mob instanceof EntityPigZombie) { + tier = "Obsidian"; + giveEntityWeapon(mob, tier, random.nextInt(7)); + if (mob.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null) { + mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); + } + } else { + if (mob.getHeldItem() != null && mob.getHeldItem().getItem() == Items.iron_sword) { + giveEntityWeapon(mob, tier, 0); + if (mob.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null) { + mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); + } + } else { + float mod = diff >= 2 ? ConfigHardcore.zombieWepChance * 2 + : diff < 1 ? ConfigHardcore.zombieWepChance / 2 : ConfigHardcore.zombieWepChance; + float chance = random.nextFloat() * 100F * mod; + if (chance >= (100F - zombieWepChance)) { + giveEntityWeapon(mob, tier, random.nextInt(5)); + if (mob.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null) { + mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); + } + } + } + } + if (random.nextFloat() * (zombieKnightChance) < diff) { + createZombieKnight((EntityZombie) mob); + } else if (random.nextFloat() * (zombieBruteChance) < diff) { + createZombieBrute((EntityZombie) mob); + } else if (ConfigHardcore.fastZombies) { + mob.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3F); + } + } + } else if (mob instanceof EntitySpider) { + if (mob.riddenByEntity == null) { + if (random.nextFloat() * (witchRiderChance) < diff) { + EntityWitch rider = new EntityWitch(mob.worldObj); + rider.setPosition(mob.posX, mob.posY, mob.posZ); + mob.worldObj.spawnEntityInWorld(rider); + rider.mountEntity(mob); + } else if (random.nextFloat() * (creeperJockeyChance) < diff) { + EntityCreeper rider = new EntityCreeper(mob.worldObj); + rider.setPosition(mob.posX, mob.posY, mob.posZ); + mob.worldObj.spawnEntityInWorld(rider); + rider.mountEntity(mob); + } + } + } else { + if (mob.getHeldItem() != null && mob.getHeldItem().getItem() == Items.iron_sword) { + giveEntityWeapon(mob, "iron", 0); + } + } + if (mob instanceof EntityPigZombie) { + mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); + } } - - private void createZombieKnight(EntityZombie mob) - { - if(mob.isChild())return; - String tier = "steel"; - int lootId = 0; - if(mob instanceof EntityPigZombie) - { - lootId = 1; - tier = "encrusted"; - } - mob.setVillager(false); - mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); - mob.setCurrentItemOrArmor(0, CustomToolListMF.standard_greatsword.construct(tier,"OakWood")); - setArmour(mob, 1, tier); - mob.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2F); - mob.getEntityData().setInteger("MF_LootDrop", lootId); - } - private void setArmour(EntityLivingBase mob, int id, String tier) - { - if(id == 1) - { - mob.setCurrentItemOrArmor(1, CustomArmourListMF.standard_plate_boots.construct(tier)); - mob.setCurrentItemOrArmor(2, CustomArmourListMF.standard_plate_legs.construct(tier)); - mob.setCurrentItemOrArmor(3, CustomArmourListMF.standard_plate_chest.construct(tier)); - mob.setCurrentItemOrArmor(4, CustomArmourListMF.standard_plate_helmet.construct(tier)); - return; - } - mob.setCurrentItemOrArmor(1, CustomArmourListMF.standard_chain_boots.construct(tier)); - mob.setCurrentItemOrArmor(2, CustomArmourListMF.standard_chain_legs.construct(tier)); - mob.setCurrentItemOrArmor(3, CustomArmourListMF.standard_chain_chest.construct(tier)); - mob.setCurrentItemOrArmor(4, CustomArmourListMF.standard_chain_helmet.construct(tier)); - } + private void createZombieKnight(EntityZombie mob) { + if (mob.isChild()) + return; + String tier = "steel"; + int lootId = 0; + if (mob instanceof EntityPigZombie) { + lootId = 1; + tier = "encrusted"; + } + mob.setVillager(false); + mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); + mob.setCurrentItemOrArmor(0, CustomToolListMF.standard_greatsword.construct(tier, "OakWood")); + setArmour(mob, 1, tier); + mob.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2F); + mob.getEntityData().setInteger("MF_LootDrop", lootId); + } + private void setArmour(EntityLivingBase mob, int id, String tier) { + if (id == 1) { + mob.setCurrentItemOrArmor(1, CustomArmourListMF.standard_plate_boots.construct(tier)); + mob.setCurrentItemOrArmor(2, CustomArmourListMF.standard_plate_legs.construct(tier)); + mob.setCurrentItemOrArmor(3, CustomArmourListMF.standard_plate_chest.construct(tier)); + mob.setCurrentItemOrArmor(4, CustomArmourListMF.standard_plate_helmet.construct(tier)); + return; + } + mob.setCurrentItemOrArmor(1, CustomArmourListMF.standard_chain_boots.construct(tier)); + mob.setCurrentItemOrArmor(2, CustomArmourListMF.standard_chain_legs.construct(tier)); + mob.setCurrentItemOrArmor(3, CustomArmourListMF.standard_chain_chest.construct(tier)); + mob.setCurrentItemOrArmor(4, CustomArmourListMF.standard_chain_helmet.construct(tier)); + } - private void createZombieBrute(EntityZombie mob) - { - if(mob.isChild())return; - String tier = "iron"; - int lootId = 0; - if(mob instanceof EntityPigZombie) - { - lootId = 1; - tier = "encrusted"; - } - mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); - mob.setCurrentItemOrArmor(0, CustomToolListMF.standard_waraxe.construct(tier,"OakWood")); - setArmour(mob, 0, tier); - mob.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35F); - mob.getEntityData().setInteger("MF_LootDrop", lootId); - } + private void createZombieBrute(EntityZombie mob) { + if (mob.isChild()) + return; + String tier = "iron"; + int lootId = 0; + if (mob instanceof EntityPigZombie) { + lootId = 1; + tier = "encrusted"; + } + mob.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0F); + mob.setCurrentItemOrArmor(0, CustomToolListMF.standard_waraxe.construct(tier, "OakWood")); + setArmour(mob, 0, tier); + mob.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35F); + mob.getEntityData().setInteger("MF_LootDrop", lootId); + } + + /** + * 1=Axe.....2=Mace.....3=dagger.....4=spear.....else sword + */ + private void giveEntityWeapon(EntityLivingBase mob, String tier, int weaponType) { + if (CustomMaterial.getMaterial(tier) == null) + return; + + ItemWeaponMF weapon = CustomToolListMF.standard_sword; + if (weaponType == 1) { + weapon = CustomToolListMF.standard_waraxe; + } + if (weaponType == 2) { + weapon = CustomToolListMF.standard_mace; + } + if (weaponType == 3) { + weapon = CustomToolListMF.standard_dagger; + } + if (weaponType == 4) { + weapon = CustomToolListMF.standard_spear; + } + if (mob != null && weapon != null) { + mob.setCurrentItemOrArmor(0, weapon.construct(tier, "OakWood")); + } + } - /** - * 1=Axe.....2=Mace.....3=dagger.....4=spear.....else sword - */ - private void giveEntityWeapon(EntityLivingBase mob, String tier, int weaponType) - { - if(CustomMaterial.getMaterial(tier) == null)return; - - ItemWeaponMF weapon = CustomToolListMF.standard_sword; - if(weaponType == 1) - { - weapon = CustomToolListMF.standard_waraxe; - } - if(weaponType == 2) - { - weapon = CustomToolListMF.standard_mace; - } - if(weaponType == 3) - { - weapon = CustomToolListMF.standard_dagger; - } - if(weaponType == 4) - { - weapon = CustomToolListMF.standard_spear; - } - if(mob != null && weapon != null) - { - mob.setCurrentItemOrArmor(0, weapon.construct(tier,"OakWood")); - } - } - - @SubscribeEvent - public void updateLiving(LivingUpdateEvent event) - { - EntityLivingBase living = event.entityLiving; - - if(isEnabled() && !living.worldObj.isRemote && !living.getEntityData().hasKey("giveMFWeapon")) - { - living.getEntityData().setBoolean("giveMFWeapon", true); - upgradeMob(event.entityLiving); - } - } + @SubscribeEvent + public void updateLiving(LivingUpdateEvent event) { + EntityLivingBase living = event.entityLiving; + if (isEnabled() && !living.worldObj.isRemote && !living.getEntityData().hasKey("giveMFWeapon")) { + living.getEntityData().setBoolean("giveMFWeapon", true); + upgradeMob(event.entityLiving); + } + } - private boolean isEnabled() - { - return true; - } + private boolean isEnabled() { + return true; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/PlayerTickHandlerMF.java b/src/main/java/minefantasy/mf2/mechanics/PlayerTickHandlerMF.java index 1c94c67a..94ffce65 100644 --- a/src/main/java/minefantasy/mf2/mechanics/PlayerTickHandlerMF.java +++ b/src/main/java/minefantasy/mf2/mechanics/PlayerTickHandlerMF.java @@ -1,9 +1,5 @@ package minefantasy.mf2.mechanics; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; import cpw.mods.fml.common.gameevent.TickEvent; @@ -26,430 +22,383 @@ import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.item.weapon.ItemWeaponMF; import minefantasy.mf2.util.MFLogUtil; +import minefantasy.mf2.util.XSTRandom; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; +import net.minecraft.util.*; import net.minecraft.world.EnumDifficulty; -import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; - -public class PlayerTickHandlerMF -{ - private static Random rand = new Random(); - private static ItemStack lastStack; - //SPRINT JUMPING - //DEFAULT:= 0:22 (50seconds till starve, 35s till nosprint) (16m in MC time for 4 missing bars) - //SLOW=5: = 2:20 (5mins till starve, 3:30 till nosprint) (1h 40m in MC time for 4 missing bars) - //EXHAUSTION SCALE = 3.0F = 1hunger - @SubscribeEvent - public void onPlayerTick(TickEvent.PlayerTickEvent event) - { - if(event.phase == TickEvent.Phase.END) - { - ItemStack held = event.player.getHeldItem(); - if(held != null) - { - int parry = ItemWeaponMF.getParry(held); - if(parry > 0) - { - ItemWeaponMF.setParry(held, parry-1); - } - } - - //COMMON - TacticalManager.applyArmourWeight(event.player); - - if(event.player.worldObj.isRemote) - { - if(isNextStep(event.player)) - { - onStep(event.player, event.player.getEntityData().getInteger(stepNBT) % 2 == 0); - } - } - /* - if(RPGElements.isSystemActive) - { - if(event.player.isSprinting() && event.player.ticksExisted % 10 == 0) - { - SkillList.athletics.addXP(event.player, 1); - } - else if(event.player.isSneaking() && TacticalManager.isEntityMoving(event.player) && event.player.ticksExisted % 10 == 0) - { - SkillList.sneak.addXP(event.player, 1); - } - } - */ - //DRAGON EVENT - if(!event.player.worldObj.isRemote) - { - tickDragonSpawner(event.player); - } - if(!event.player.worldObj.isRemote) - { - tryResetBed(event.player); - } - //updatePitch(event.player); (This keeps track of player camera angles, could make a mechanic based on swinging the camera) + +import java.util.Iterator; +import java.util.List; + +public class PlayerTickHandlerMF { + private static ItemStack lastStack; + private static String stepNBT = "MF_LastStep"; + private static String chunkCoords = "MF_BedPos"; + private static String resetBed = "MF_Resetbed"; + + private static XSTRandom random = new XSTRandom(); + + public static void spawnDragon(EntityPlayer player) { + spawnDragon(player, 64); + } + + public static void spawnDragon(EntityPlayer player, int offset) { + int y = (int) (player.posY + offset); + boolean canMobSpawn = !player.worldObj.isRemote && canDragonSpawnOnPlayer(player, y); + if (canMobSpawn && !player.worldObj.isRemote) { + int tier = getDragonTier(player);// Gets tier on kills + EntityDragon dragon = new EntityDragon(player.worldObj); + dragon.setPosition(player.posX, y, player.posZ); + player.worldObj.spawnEntityInWorld(dragon); + dragon.setDragon(tier); + dragon.disengage(100); + player.worldObj.playSoundEffect(dragon.posX, dragon.posY - 16D, dragon.posZ, "mob.enderdragon.growl", 3.0F, + 1.5F); + dragon.fireBreathCooldown = 200; + + if (ConfigMobs.dragonMSG && !player.worldObj.isRemote) { + player.addChatMessage(new ChatComponentText( + EnumChatFormatting.GOLD + StatCollector.translateToLocal("event.dragonnear.name"))); + + List list = player.worldObj.playerEntities; + Iterator players = list.iterator(); + while (players.hasNext()) { + Object instance = players.next(); + if (instance != null && instance instanceof EntityPlayer) { + if (((EntityPlayer) instance).getDistanceToEntity(player) < 256D && instance != player) { + ((EntityPlayer) instance).addChatMessage(new ChatComponentText( + EnumChatFormatting.GOLD + StatCollector.translateToLocal("event.dragonnear.name"))); + } + } + } + } + } + } + + private static boolean canDragonSpawnOnPlayer(EntityPlayer player, int y) { + for (int x = -3; x <= 3; x++) { + for (int z = -3; z <= 3; z++) { + if (!player.worldObj.canBlockSeeTheSky((int) player.posX + x, y, (int) player.posZ + z)) { + return false; + } + } + } + return true; + } + + public static int getDragonTier(EntityPlayer player) { + int kills = getDragonEnemyPoints(player); + if (kills < 5) { + return 0;// Young 100% + } + if (kills < 10) { + if (random.nextInt(5) == 0) + return 0;// 20% chance for Young + return 1;// Adult + } + if (kills < 15) { + if (random.nextInt(10) == 0) + return 0;// 10% chance for Young + return 1;// Adult + } + if (kills < 25) { + if (random.nextInt(20) == 0) + return 0;// 5% chance for Young + if (random.nextInt(10) == 0) + return 2;// 10% chance for Mature + return 1;// Adult + } + if (kills < 35) { + if (random.nextInt(4) == 0) + return 2;// 25% chance for Mature + return 1;// Adult + } + if (kills >= 50) { + if (random.nextInt(10) == 0) + return 1;// 10% chance for Adult + if (random.nextInt(5) == 0) + return 3;// 20% chance Elder + return 2;// Mature + } + if (kills > 75) { + if (random.nextInt(100) == 0) + return 4;// 1% chance Ancient + if (random.nextInt(2) == 0) + return 3;// 50% chance Elder + return 2;// Mature + } + + return 0;// Young 100% + } + + public static void addDragonKill(EntityPlayer player) { + addDragonEnemyPts(player, 1); + } + + public static void addDragonEnemyPts(EntityPlayer player, int i) { + setDragonEnemyPts(player, getDragonEnemyPoints(player) + i); + } + + public static void setDragonEnemyPts(EntityPlayer player, int i) { + if (i < 0) { + i = 0; + } + NBTTagCompound nbt = PlayerTagData.getPersistedData(player); + nbt.setInteger("MF_DragonKills", i); + } + + public static int getDragonEnemyPoints(EntityPlayer player) { + NBTTagCompound nbt = PlayerTagData.getPersistedData(player); + return nbt.getInteger("MF_DragonKills"); + } + + public static void wakeUp(EntityPlayer player) { + if (StaminaBar.isSystemActive) { + StaminaBar.setStaminaValue(player, StaminaBar.getBaseMaxStamina(player)); + } + if (player.getEntityData().hasKey(chunkCoords + "_x")) { + player.getEntityData().setBoolean(resetBed, true); + } + } + + public static void readyToResetBedPosition(EntityPlayer player) { + ChunkCoordinates coords = player.getBedLocation(player.dimension); + if (coords != null) { + player.getEntityData().setInteger(chunkCoords + "_x", coords.posX); + player.getEntityData().setInteger(chunkCoords + "_y", coords.posY); + player.getEntityData().setInteger(chunkCoords + "_z", coords.posZ); + } + } + + // SPRINT JUMPING + // DEFAULT:= 0:22 (50seconds till starve, 35s till nosprint) (16m in MC time for + // 4 missing bars) + // SLOW=5: = 2:20 (5mins till starve, 3:30 till nosprint) (1h 40m in MC time for + // 4 missing bars) + // EXHAUSTION SCALE = 3.0F = 1hunger + @SubscribeEvent + public void onPlayerTick(TickEvent.PlayerTickEvent event) { + if (event.phase == TickEvent.Phase.END) { + ItemStack held = event.player.getHeldItem(); + if (held != null) { + int parry = ItemWeaponMF.getParry(held); + if (parry > 0) { + ItemWeaponMF.setParry(held, parry - 1); + } + } + + // COMMON + TacticalManager.applyArmourWeight(event.player); + + if (event.player.worldObj.isRemote) { + if (isNextStep(event.player)) { + onStep(event.player, event.player.getEntityData().getInteger(stepNBT) % 2 == 0); + } + } + /* + * if(RPGElements.isSystemActive) { if(event.player.isSprinting() && + * event.player.ticksExisted % 10 == 0) { + * SkillList.athletics.addXP(event.player, 1); } else + * if(event.player.isSneaking() && TacticalManager.isEntityMoving(event.player) + * && event.player.ticksExisted % 10 == 0) { SkillList.sneak.addXP(event.player, + * 1); } } + */ + // DRAGON EVENT + if (!event.player.worldObj.isRemote) { + tickDragonSpawner(event.player); + } + if (!event.player.worldObj.isRemote) { + tryResetBed(event.player); + } + // updatePitch(event.player); (This keeps track of player camera angles, could + // make a mechanic based on swinging the camera) + } + + if (event.phase == TickEvent.Phase.START) { + applyBalance(event.player); + ItemFoodMF.onTick(event.player); + + if (!event.player.worldObj.isRemote + && !(!ConfigHardcore.HCChotBurn && ItemApron.isUserProtected(event.player)) + && event.player.ticksExisted % 100 == 0) { + for (int a = 0; a < event.player.inventory.getSizeInventory(); a++) { + ItemStack item = event.player.inventory.getStackInSlot(a); + if (item != null && item.getItem() instanceof IHotItem) { + event.player.setFire(5); + event.player.attackEntityFrom(DamageSource.onFire, 1.0F); + } + } + } + if (event.player.worldObj.isRemote) { + ItemStack item = event.player.getHeldItem(); + if (lastStack == null && item != null) { + if (item.getItem() instanceof IFirearm) { + NBTTagCompound nbt = AmmoMechanicsMF.getNBT(item); + if (nbt.hasKey(ItemCrossbow.useTypeNBT) + && nbt.getString(ItemCrossbow.useTypeNBT).equalsIgnoreCase("fire")) { + nbt.setString(ItemCrossbow.useTypeNBT, "null"); + } + } + } + if (lastStack != null && (item == null || item != lastStack)) { + if (lastStack.getItem() instanceof IFirearm) { + NBTTagCompound nbt = AmmoMechanicsMF.getNBT(lastStack); + if (nbt.hasKey(ItemCrossbow.useTypeNBT) + && nbt.getString(ItemCrossbow.useTypeNBT).equalsIgnoreCase("fire")) { + nbt.setString(ItemCrossbow.useTypeNBT, "null"); + } + } + } + lastStack = item; + } + + float weight = ArmourCalculator.getTotalWeightOfWorn(event.player, false); + if (weight > 100F) { + if (event.player.isInWater()) { + event.player.motionY -= (weight / 20000F); + } + } } - - if(event.phase == TickEvent.Phase.START) - { - applyBalance(event.player); - ItemFoodMF.onTick(event.player); - - if(!event.player.worldObj.isRemote && !(!ConfigHardcore.HCChotBurn && ItemApron.isUserProtected(event.player)) && event.player.ticksExisted % 100 == 0) - { - for(int a = 0; a < event.player.inventory.getSizeInventory(); a++) - { - ItemStack item = event.player.inventory.getStackInSlot(a); - if(item != null && item.getItem() instanceof IHotItem) - { - event.player.setFire(5); - event.player.attackEntityFrom(DamageSource.onFire, 1.0F); - } - } - } - if(event.player.worldObj.isRemote) - { - ItemStack item = event.player.getHeldItem(); - if(lastStack == null && item != null) - { - if(item.getItem() instanceof IFirearm) - { - NBTTagCompound nbt = AmmoMechanicsMF.getNBT(item); - if(nbt.hasKey(ItemCrossbow.useTypeNBT) && nbt.getString(ItemCrossbow.useTypeNBT).equalsIgnoreCase("fire")) - { - nbt.setString(ItemCrossbow.useTypeNBT, "null"); - } - } - } - if(lastStack != null && (item == null || item != lastStack)) - { - if(lastStack.getItem() instanceof IFirearm) - { - NBTTagCompound nbt = AmmoMechanicsMF.getNBT(lastStack); - if(nbt.hasKey(ItemCrossbow.useTypeNBT) && nbt.getString(ItemCrossbow.useTypeNBT).equalsIgnoreCase("fire")) - { - nbt.setString(ItemCrossbow.useTypeNBT, "null"); - } - } - } - lastStack = item; - } - - float weight = ArmourCalculator.getTotalWeightOfWorn(event.player, false); - if(weight > 100F) - { - if(event.player.isInWater()) - { - event.player.motionY -= (weight/20000F); - } - } + } + + private void onStep(EntityPlayer player, boolean alternateStep) { + if (ArmourCalculator.getTotalWeightOfWorn(player, false) >= 50) { + player.playSound("mob.irongolem.throw", 1.0F, 1.0F); } } - private void onStep(EntityPlayer player, boolean alternateStep) - { - if(ArmourCalculator.getTotalWeightOfWorn(player, false) >= 50) - { - player.playSound("mob.irongolem.throw", 1.0F, 1.0F); + private boolean isNextStep(EntityPlayer player) { + int prevStep = player.getEntityData().getInteger(stepNBT); + int stepcount = (int) player.distanceWalkedOnStepModified; + player.getEntityData().setInteger(stepNBT, stepcount); + + return prevStep != stepcount; + } + + /* + * private static String lastPitchNBT = "MF_last_AimPitch"; public static void + * setLastPitch(EntityPlayer user, float value) { + * user.getEntityData().setFloat(lastPitchNBT, value); } public static void + * updatePitch(EntityPlayer user) { user.getEntityData().setFloat(lastPitchNBT, + * user.rotationPitch); } public static float getPitchMovement(EntityPlayer + * user) { float lastPitch = user.getEntityData().getFloat(lastPitchNBT) + + * 1000F; float nowPitch = user.rotationPitch + 1000F; + * + * return nowPitch - lastPitch; } + */ + private void tickDragonSpawner(EntityPlayer player) { + if (player.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && player.dimension == 0) { + int i = ConfigMobs.dragonInterval; + float chance = ConfigMobs.dragonChance; + + if (PlayerTickHandlerMF.getDragonEnemyPoints(player) >= 100) { + i /= 2;// twice as frequent + } + if (PlayerTickHandlerMF.getDragonEnemyPoints(player) >= 50) { + chance *= 2;// twice the chance + } + if (!player.worldObj.isRemote && player.worldObj.getTotalWorldTime() % i == 0 + && random.nextFloat() * 100F < chance) { + spawnDragon(player); + } } - } - private static String stepNBT = "MF_LastStep"; - private boolean isNextStep(EntityPlayer player) - { - int prevStep = player.getEntityData().getInteger(stepNBT); - int stepcount = (int) player.distanceWalkedOnStepModified; - player.getEntityData().setInteger(stepNBT, stepcount); - - return prevStep != stepcount; - } - - /* - private static String lastPitchNBT = "MF_last_AimPitch"; - public static void setLastPitch(EntityPlayer user, float value) - { - user.getEntityData().setFloat(lastPitchNBT, value); - } - public static void updatePitch(EntityPlayer user) - { - user.getEntityData().setFloat(lastPitchNBT, user.rotationPitch); - } - public static float getPitchMovement(EntityPlayer user) - { - float lastPitch = user.getEntityData().getFloat(lastPitchNBT) + 1000F; - float nowPitch = user.rotationPitch + 1000F; - - return nowPitch - lastPitch; - } - */ - private void tickDragonSpawner(EntityPlayer player) - { - if(player.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && player.dimension == 0) - { - int i = ConfigMobs.dragonInterval; - float chance = ConfigMobs.dragonChance; - - if(this.getDragonEnemyPoints(player) >= 100) - { - i /= 2;//twice as frequent - } - if(this.getDragonEnemyPoints(player) >= 50) - { - chance *= 2;//twice the chance - } - if(!player.worldObj.isRemote && player.worldObj.getTotalWorldTime() % i == 0 && rand.nextFloat()*100F < chance) - { - spawnDragon(player); - } - } - } - - public static void spawnDragon(EntityPlayer player) - { - spawnDragon(player, 64); - } - public static void spawnDragon(EntityPlayer player, int offset) - { - int y = (int) (player.posY + offset); - boolean canMobSpawn = !player.worldObj.isRemote && canDragonSpawnOnPlayer(player, y); - if(canMobSpawn && !player.worldObj.isRemote) - { - int tier = getDragonTier(player);//Gets tier on kills - EntityDragon dragon = new EntityDragon(player.worldObj); - dragon.setPosition(player.posX, y, player.posZ); - player.worldObj.spawnEntityInWorld(dragon); - dragon.setDragon(tier); - dragon.disengage(100); - player.worldObj.playSoundEffect(dragon.posX, dragon.posY-16D, dragon.posZ, "mob.enderdragon.growl", 3.0F, 1.5F); - dragon.fireBreathCooldown = 200; - - if(ConfigMobs.dragonMSG && !player.worldObj.isRemote) - { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + StatCollector.translateToLocal("event.dragonnear.name"))); - - List list = player.worldObj.playerEntities; - Iterator players = list.iterator(); - while(players.hasNext()) - { - Object instance = players.next(); - if(instance != null && instance instanceof EntityPlayer) - { - if(((EntityPlayer)instance).getDistanceToEntity(player) < 256D && instance != player) - { - ((EntityPlayer)instance).addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + StatCollector.translateToLocal("event.dragonnear.name"))); - } - } - } - } - } - } - - private static boolean canDragonSpawnOnPlayer(EntityPlayer player, int y) - { - for(int x = -3; x <= 3; x++) - { - for(int z = -3; z <= 3; z++) - { - if(!player.worldObj.canBlockSeeTheSky((int)player.posX + x, y, (int)player.posZ + z)) - { - return false; - } - } - } - return true; - } - - private void applyBalance(EntityPlayer entityPlayer) - { + } + + private void applyBalance(EntityPlayer entityPlayer) { float weight = 2.0F; - float pitchBalance = entityPlayer.getEntityData().hasKey("MF_Balance_Pitch") ? entityPlayer.getEntityData().getFloat("MF_Balance_Pitch"): 0F; - float yawBalance = entityPlayer.getEntityData().hasKey("MF_Balance_Yaw") ? entityPlayer.getEntityData().getFloat("MF_Balance_Yaw"): 0F; - - if(pitchBalance > 0) - { - if(pitchBalance < 1.0F && pitchBalance > -1.0F)weight = pitchBalance; - pitchBalance -= weight; - - if(ConfigWeapon.useBalance) - { - entityPlayer.rotationPitch += pitchBalance > 0 ? weight : -weight; + float pitchBalance = entityPlayer.getEntityData().hasKey("MF_Balance_Pitch") + ? entityPlayer.getEntityData().getFloat("MF_Balance_Pitch") + : 0F; + float yawBalance = entityPlayer.getEntityData().hasKey("MF_Balance_Yaw") + ? entityPlayer.getEntityData().getFloat("MF_Balance_Yaw") + : 0F; + + if (pitchBalance > 0) { + if (pitchBalance < 1.0F && pitchBalance > -1.0F) + weight = pitchBalance; + pitchBalance -= weight; + + if (ConfigWeapon.useBalance) { + entityPlayer.rotationPitch += pitchBalance > 0 ? weight : -weight; } - - if(pitchBalance < 0)pitchBalance = 0; + + if (pitchBalance < 0) + pitchBalance = 0; } - if(yawBalance > 0) - { - if(yawBalance < 1.0F && yawBalance > -1.0F)weight = yawBalance; - yawBalance -= weight; - - if(ConfigWeapon.useBalance) - { - MFLogUtil.logDebug("Weapon Balance Move"); - entityPlayer.rotationYaw += yawBalance > 0 ? weight : -weight; + if (yawBalance > 0) { + if (yawBalance < 1.0F && yawBalance > -1.0F) + weight = yawBalance; + yawBalance -= weight; + + if (ConfigWeapon.useBalance) { + MFLogUtil.logDebug("Weapon Balance Move"); + entityPlayer.rotationYaw += yawBalance > 0 ? weight : -weight; } - - if(yawBalance < 0)yawBalance = 0; + + if (yawBalance < 0) + yawBalance = 0; } - entityPlayer.getEntityData().setFloat("MF_Balance_Pitch", pitchBalance); - entityPlayer.getEntityData().setFloat("MF_Balance_Yaw", yawBalance); - } - - @SubscribeEvent - public void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) - { - onPlayerEnterWorld(event.player); + entityPlayer.getEntityData().setFloat("MF_Balance_Pitch", pitchBalance); + entityPlayer.getEntityData().setFloat("MF_Balance_Yaw", yawBalance); + } + + @SubscribeEvent + public void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) { + onPlayerEnterWorld(event.player); } - @SubscribeEvent - public void onPlayerTravel(PlayerEvent.PlayerChangedDimensionEvent event) - { - onPlayerEnterWorld(event.player); + + @SubscribeEvent + public void onPlayerTravel(PlayerEvent.PlayerChangedDimensionEvent event) { + onPlayerEnterWorld(event.player); } - @SubscribeEvent - public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) - { - onPlayerEnterWorld(event.player); + + @SubscribeEvent + public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { + onPlayerEnterWorld(event.player); } - public void onPlayerEnterWorld(EntityPlayer player) - { - if(player.worldObj.isRemote)return; - - NBTTagCompound persist = PlayerTagData.getPersistedData(player); - MFLogUtil.logDebug("Sync data"); - ResearchLogic.syncData((EntityPlayer) player); - - if(!persist.hasKey("MF_HasBook")) - { - persist.setBoolean("MF_HasBook", true); - if(player.capabilities.isCreativeMode)return; - - player.inventory.addItemStackToInventory(new ItemStack(ToolListMF.researchBook)); - } - if(RPGElements.isSystemActive) - { - RPGElements.initSkills(player); - } + + public void onPlayerEnterWorld(EntityPlayer player) { + if (player.worldObj.isRemote) + return; + + NBTTagCompound persist = PlayerTagData.getPersistedData(player); + MFLogUtil.logDebug("Sync data"); + ResearchLogic.syncData(player); + + if (!persist.hasKey("MF_HasBook")) { + persist.setBoolean("MF_HasBook", true); + if (player.capabilities.isCreativeMode) + return; + + player.inventory.addItemStackToInventory(new ItemStack(ToolListMF.researchBook)); + } + if (RPGElements.isSystemActive) { + RPGElements.initSkills(player); + } + } + + private void tryResetBed(EntityPlayer player) { + if (player.getEntityData().hasKey(resetBed)) { + player.getEntityData().removeTag(resetBed); + resetBedPosition(player); + } + } + + private void resetBedPosition(EntityPlayer player) { + if (player.getEntityData().hasKey(chunkCoords + "_x")) { + MFLogUtil.logDebug("Reset bed data for " + player.getCommandSenderName()); + int x = player.getEntityData().getInteger(chunkCoords + "_x"); + int y = player.getEntityData().getInteger(chunkCoords + "_y"); + int z = player.getEntityData().getInteger(chunkCoords + "_z"); + ChunkCoordinates coords = new ChunkCoordinates(x, y, z); + + player.getEntityData().removeTag(chunkCoords + "_x"); + player.getEntityData().removeTag(chunkCoords + "_y"); + player.getEntityData().removeTag(chunkCoords + "_z"); + + player.setSpawnChunk(coords, false); + } } - - public static int getDragonTier(EntityPlayer player) - { - int kills = getDragonEnemyPoints(player); - if(kills < 5) - { - return 0;//Young 100% - } - if(kills < 10) - { - if(rand.nextInt(5) == 0)return 0;//20% chance for Young - return 1;//Adult - } - if(kills < 15) - { - if(rand.nextInt(10) == 0)return 0;//10% chance for Young - return 1;//Adult - } - if(kills < 25) - { - if(rand.nextInt(20) == 0)return 0;//5% chance for Young - if(rand.nextInt(10) == 0)return 2;//10% chance for Mature - return 1;//Adult - } - if(kills < 35) - { - if(rand.nextInt(4) == 0)return 2;//25% chance for Mature - return 1;//Adult - } - if(kills >= 50) - { - if(rand.nextInt(10) == 0)return 1;//10% chance for Adult - if(rand.nextInt(5) == 0)return 3;//20% chance Elder - return 2;//Mature - } - if(kills > 75) - { - if(rand.nextInt(100) == 0)return 4;//1% chance Ancient - if(rand.nextInt(2) == 0)return 3;//50% chance Elder - return 2;//Mature - } - - return 0;//Young 100% - } - - public static void addDragonKill(EntityPlayer player) - { - addDragonEnemyPts(player, 1); - } - public static void addDragonEnemyPts(EntityPlayer player, int i) - { - setDragonEnemyPts(player, getDragonEnemyPoints(player)+i); - } - public static void setDragonEnemyPts(EntityPlayer player, int i) - { - if(i < 0) - { - i = 0; - } - NBTTagCompound nbt = PlayerTagData.getPersistedData(player); - nbt.setInteger("MF_DragonKills", i); - } - - public static int getDragonEnemyPoints(EntityPlayer player) - { - NBTTagCompound nbt = PlayerTagData.getPersistedData(player); - return nbt.getInteger("MF_DragonKills"); - } - - private static String chunkCoords = "MF_BedPos"; - private static String resetBed = "MF_Resetbed"; - - public static void wakeUp(EntityPlayer player) - { - if(StaminaBar.isSystemActive) - { - StaminaBar.setStaminaValue(player, StaminaBar.getBaseMaxStamina(player)); - } - if(player.getEntityData().hasKey(chunkCoords + "_x")) - { - player.getEntityData().setBoolean(resetBed, true); - } - } - - private void tryResetBed(EntityPlayer player) - { - if(player.getEntityData().hasKey(resetBed)) - { - player.getEntityData().removeTag(resetBed); - resetBedPosition(player); - } - } - public static void readyToResetBedPosition(EntityPlayer player) - { - ChunkCoordinates coords = player.getBedLocation(player.dimension); - if(coords != null) - { - player.getEntityData().setInteger(chunkCoords + "_x", coords.posX); - player.getEntityData().setInteger(chunkCoords + "_y", coords.posY); - player.getEntityData().setInteger(chunkCoords + "_z", coords.posZ); - } - } - private void resetBedPosition(EntityPlayer player) - { - if(player.getEntityData().hasKey(chunkCoords + "_x")) - { - MFLogUtil.logDebug("Reset bed data for " + player.getCommandSenderName()); - int x = player.getEntityData().getInteger(chunkCoords + "_x"); - int y = player.getEntityData().getInteger(chunkCoords + "_y"); - int z = player.getEntityData().getInteger(chunkCoords + "_z"); - ChunkCoordinates coords = new ChunkCoordinates(x, y, z); - - player.getEntityData().removeTag(chunkCoords + "_x"); - player.getEntityData().removeTag(chunkCoords + "_y"); - player.getEntityData().removeTag(chunkCoords + "_z"); - - player.setSpawnChunk(coords, false); - } - } } diff --git a/src/main/java/minefantasy/mf2/mechanics/StaminaMechanics.java b/src/main/java/minefantasy/mf2/mechanics/StaminaMechanics.java index 4f307afe..1e0aff6a 100644 --- a/src/main/java/minefantasy/mf2/mechanics/StaminaMechanics.java +++ b/src/main/java/minefantasy/mf2/mechanics/StaminaMechanics.java @@ -19,259 +19,213 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.world.WorldServer; -public class StaminaMechanics -{ - private static boolean hurtAdreneline = true; - private static int bowSeconds = 30; +public class StaminaMechanics { + private static boolean hurtAdreneline = true; + private static int bowSeconds = 30; - public static void tickEntity(EntityLivingBase entity) - { - if(entity.ticksExisted % 20 == 0) - { - ArmourCalculator.setTotalWeightOfWorn(entity, true); - ArmourCalculator.setTotalWeightOfWorn(entity, false); - } - - float[] packet = new float[]{StaminaBar.getStaminaValue(entity), StaminaBar.getBaseMaxStamina(entity), StaminaBar.getFlashTime(entity), StaminaBar.getBonusStamina(entity)}; - float[] values = new float[]{StaminaBar.getStaminaValue(entity), StaminaBar.getTotalMaxStamina(entity)}; - if(entity.worldObj.isRemote && ConfigClient.playBreath) - { - if(!StaminaBar.isPercentStamAvailable(entity, 0.2F, false) && !entity.isInsideOfMaterial(Material.water)) - { - if(entity.ticksExisted % 20 == 0) - { - entity.playSound("mob.blaze.breathe", 0.1F, 1.8F); - } - if(entity.ticksExisted+5 % 20 == 0) - { - entity.playSound("mob.blaze.breathe", 0.15F, 1.5F); - } - } - return; - } - float decay = getConstantDecay(entity); - //Decay - if(decay > 0) - { - if(values[0] > 0) - { - StaminaBar.modifyStaminaValue(entity, -decay); - } - StaminaBar.setIdleTime(entity, 60F * getIdleRate(entity)); - } + public static void tickEntity(EntityLivingBase entity) { + if (entity.ticksExisted % 20 == 0) { + ArmourCalculator.setTotalWeightOfWorn(entity, true); + ArmourCalculator.setTotalWeightOfWorn(entity, false); + } - //Regen - if(decay <= 0 && StaminaBar.getIdleTime(entity) <= 0) - { - float regen = getRegenRate(entity); - if(values[0] < values[1]) - { - StaminaBar.modifyStaminaValue(entity, regen); - } - } - //Bonus Regen - if(decay <= 0) - { - float regen = StaminaBar.getRegenBonus(entity); - if(values[0] < values[1]) - { - StaminaBar.modifyStaminaValue(entity, regen); - } - } - - //float[] stam = new float[]{StaminaBar.getStaminaValue(player), StaminaBar.getMaxStamina(player)}; - - //out of stamina - if(values[0] <= 0) - { - if(ConfigStamina.affectSpeed) - { - entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2)); - } - entity.addPotionEffect(new PotionEffect(Potion.hunger.id, 2)); - //Drain air when exhausted, you will drown faster - if(isInWater(entity) && entity.getAir() > -20 && entity.ticksExisted % 20 == 0) - { - entity.setAir(entity.getAir() -1); - } - if(entity instanceof EntityPlayer && TacticalManager.shouldStaminaBlock) - { - if(((EntityPlayer) entity).isUsingItem() && (entity.getHeldItem() != null && entity.getHeldItem().getItemUseAction() == EnumAction.block)) - { - ((EntityPlayer) entity).stopUsingItem(); - } - } - } - //This phase decreases the cooldown - if(StaminaBar.getIdleTime(entity) > 0) - { - StaminaBar.ModifyIdleTime(entity, -1); - } - if(StaminaBar.getFlashTime(entity) > 0) - { - StaminaBar.ModifyFlashTime(entity, -1); - } - - //REFRESH - StaminaBar.refreshSystem(entity); - - StaminaBar.tickBonus(entity); - StaminaBar.tickBonusRegen(entity); - - //if changed, resync - //if((StaminaBar.getStaminaValue(player) != stam[0] || StaminaBar.getMaxStamina(player) != stam[1]) || player.ticksExisted % 20 == 0) - if(entity instanceof EntityPlayer) - { - syncStamina((EntityPlayer) entity, packet); - } - } - - private static void syncStamina(EntityPlayer player, float[]stam) - { - if(!player.worldObj.isRemote) - { - ((WorldServer)player.worldObj).getEntityTracker().func_151248_b(player, new StaminaPacket(stam, player).generatePacket()); - } - } - - public static float getConstantDecay(EntityLivingBase user) - { - if(user instanceof EntityPlayer && ((EntityPlayer)user).capabilities.isCreativeMode) - { - return 0F; - } - float value = 0.0F; - boolean countArmour = false; - - if(user.isSprinting() && ConfigStamina.sprintModifier > 0 && user.ridingEntity == null) - { - float sprintingSeconds = 60F; - countArmour = true;//Armour gets factored in with sprinting - value += value += (5F / sprintingSeconds)*ConfigStamina.sprintModifier; - } - if(user instanceof EntityPlayer) - { - if(user.getHeldItem() != null && ((EntityPlayer) user).isUsingItem() && ConfigStamina.bowModifier > 0) - { - if(user.getHeldItem().getItemUseAction() == EnumAction.bow) - { - //Item gets factored in with bow - value += StaminaBar.getDefaultMax(user) / 20F / bowSeconds * ConfigStamina.bowModifier; - } - } - } - return value * StaminaBar.getBaseDecayModifier(user, countArmour, true); - } - - public static float getRegenRate(EntityLivingBase user) - { - if(user instanceof EntityPlayer && ((EntityPlayer)user).capabilities.isCreativeMode) - { - return 100F; - } - if(StaminaBar.getIdleTime(user) > 0) - { - return 0; - } - if(isInWater(user) && user.getActivePotionEffect(Potion.waterBreathing) == null) - { - return 0;//can't catch your breath when underwater - } - //The base time it takes to regen - float value = StaminaBar.getTotalMaxStamina(user) / 20 / ConfigStamina.fullRegenSeconds; - if(hurtAdreneline && user.getHealth() <= 2F) - { - value *= 1.5F; - } - return value * StaminaBar.getBaseRegenModifier(user, true, true); - } - - private static boolean isInWater(EntityLivingBase user) - { - return user.isInsideOfMaterial(Material.water); - } + float[] packet = new float[]{StaminaBar.getStaminaValue(entity), StaminaBar.getBaseMaxStamina(entity), + StaminaBar.getFlashTime(entity), StaminaBar.getBonusStamina(entity)}; + float[] values = new float[]{StaminaBar.getStaminaValue(entity), StaminaBar.getTotalMaxStamina(entity)}; + if (entity.worldObj.isRemote && ConfigClient.playBreath) { + if (!StaminaBar.isPercentStamAvailable(entity, 0.2F, false) && !entity.isInsideOfMaterial(Material.water)) { + if (entity.ticksExisted % 20 == 0) { + entity.playSound("mob.blaze.breathe", 0.1F, 1.8F); + } + if (entity.ticksExisted + 5 % 20 == 0) { + entity.playSound("mob.blaze.breathe", 0.15F, 1.5F); + } + } + return; + } + float decay = getConstantDecay(entity); + // Decay + if (decay > 0) { + if (values[0] > 0) { + StaminaBar.modifyStaminaValue(entity, -decay); + } + StaminaBar.setIdleTime(entity, 60F * getIdleRate(entity)); + } - public static float getIdleRate(EntityLivingBase user) - { - float value = 1.0F; - - if(hurtAdreneline && user.getHealth() <= 4F) - { - value *= 0.2F; - } - - return value * StaminaBar.getBaseIdleModifier(user, true, true); - } - - public static void onJump(EntityLivingBase user) - { - if(user.worldObj.isRemote) - { - return; - } - float stam = StaminaBar.getStaminaValue(user); - if(stam > 0) - { - StaminaBar.modifyStaminaValue(user, -getJumpDecay(user)); - } - StaminaBar.setIdleTime(user, 40F * getIdleRate(user)); - //syncStamina(user, new float[]{stam, StaminaBar.getMaxStamina(user)}); - } - - public static float getJumpDecay(EntityLivingBase user) - { - float value = 2.0F; - - if(user.isSprinting()) - { - value = 3.0F; - } - return value * StaminaBar.getBaseDecayModifier(user, true, false); - } - - public static void onAttack(EntityLivingBase user, Entity target) - { - applyHitFatigue(user, 1.0F * TacticalManager.getHighgroundModifier(target, user, 1.5F)); - } - - public static void applyHitFatigue(EntityLivingBase user, float modifier) - { - float stam = StaminaBar.getStaminaValue(user); - - if(stam > 0) - { - StaminaBar.modifyStaminaValue(user, -getWeaponModifier(user)*modifier); - } - StaminaBar.setIdleTime(user, 50F * getIdleRate(user)); - //syncStamina(user, new float[]{stam, StaminaBar.getMaxStamina(user)}); - } - - public static float getWeaponModifier(EntityLivingBase user) - { - ItemStack weapon = user.getHeldItem(); - float value = 0.0F; - - if(weapon != null) - { - value = 2F; - - if(weapon.getItem() instanceof IStaminaWeapon) - { - value = ((IStaminaWeapon)weapon.getItem()).getStaminaDrainOnHit(user, weapon); - } - else - { - if(weapon.getItem() instanceof ItemSword) - { - value = 5; - } - if(weapon.getItem() instanceof ItemTool) - { - value = 10; - } - } - } - - return value * ConfigStamina.weaponModifier * StaminaBar.getBaseDecayModifier(user, true, true); - } + // Regen + if (decay <= 0 && StaminaBar.getIdleTime(entity) <= 0) { + float regen = getRegenRate(entity); + if (values[0] < values[1]) { + StaminaBar.modifyStaminaValue(entity, regen); + } + } + // Bonus Regen + if (decay <= 0) { + float regen = StaminaBar.getRegenBonus(entity); + if (values[0] < values[1]) { + StaminaBar.modifyStaminaValue(entity, regen); + } + } + + // float[] stam = new float[]{StaminaBar.getStaminaValue(player), + // StaminaBar.getMaxStamina(player)}; + + // out of stamina + if (values[0] <= 0) { + if (ConfigStamina.affectSpeed) { + entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2)); + } + entity.addPotionEffect(new PotionEffect(Potion.hunger.id, 2)); + // Drain air when exhausted, you will drown faster + if (isInWater(entity) && entity.getAir() > -20 && entity.ticksExisted % 20 == 0) { + entity.setAir(entity.getAir() - 1); + } + if (entity instanceof EntityPlayer && TacticalManager.shouldStaminaBlock) { + if (((EntityPlayer) entity).isUsingItem() && (entity.getHeldItem() != null + && entity.getHeldItem().getItemUseAction() == EnumAction.block)) { + ((EntityPlayer) entity).stopUsingItem(); + } + } + } + // This phase decreases the cooldown + if (StaminaBar.getIdleTime(entity) > 0) { + StaminaBar.ModifyIdleTime(entity, -1); + } + if (StaminaBar.getFlashTime(entity) > 0) { + StaminaBar.ModifyFlashTime(entity, -1); + } + + // REFRESH + StaminaBar.refreshSystem(entity); + + StaminaBar.tickBonus(entity); + StaminaBar.tickBonusRegen(entity); + + // if changed, resync + // if((StaminaBar.getStaminaValue(player) != stam[0] || + // StaminaBar.getMaxStamina(player) != stam[1]) || player.ticksExisted % 20 == + // 0) + if (entity instanceof EntityPlayer) { + syncStamina((EntityPlayer) entity, packet); + } + } + + private static void syncStamina(EntityPlayer player, float[] stam) { + if (!player.worldObj.isRemote) { + ((WorldServer) player.worldObj).getEntityTracker().func_151248_b(player, + new StaminaPacket(stam, player).generatePacket()); + } + } + + public static float getConstantDecay(EntityLivingBase user) { + if (user instanceof EntityPlayer && ((EntityPlayer) user).capabilities.isCreativeMode) { + return 0F; + } + float value = 0.0F; + boolean countArmour = false; + + if (user.isSprinting() && ConfigStamina.sprintModifier > 0 && user.ridingEntity == null) { + float sprintingSeconds = 60F; + countArmour = true;// Armour gets factored in with sprinting + value += value += (5F / sprintingSeconds) * ConfigStamina.sprintModifier; + } + if (user instanceof EntityPlayer) { + if (user.getHeldItem() != null && ((EntityPlayer) user).isUsingItem() && ConfigStamina.bowModifier > 0) { + if (user.getHeldItem().getItemUseAction() == EnumAction.bow) { + // Item gets factored in with bow + value += StaminaBar.getDefaultMax(user) / 20F / bowSeconds * ConfigStamina.bowModifier; + } + } + } + return value * StaminaBar.getBaseDecayModifier(user, countArmour, true); + } + + public static float getRegenRate(EntityLivingBase user) { + if (user instanceof EntityPlayer && ((EntityPlayer) user).capabilities.isCreativeMode) { + return 100F; + } + if (StaminaBar.getIdleTime(user) > 0) { + return 0; + } + if (isInWater(user) && user.getActivePotionEffect(Potion.waterBreathing) == null) { + return 0;// can't catch your breath when underwater + } + // The base time it takes to regen + float value = StaminaBar.getTotalMaxStamina(user) / 20 / ConfigStamina.fullRegenSeconds; + if (hurtAdreneline && user.getHealth() <= 2F) { + value *= 1.5F; + } + return value * StaminaBar.getBaseRegenModifier(user, true, true); + } + + private static boolean isInWater(EntityLivingBase user) { + return user.isInsideOfMaterial(Material.water); + } + + public static float getIdleRate(EntityLivingBase user) { + float value = 1.0F; + + if (hurtAdreneline && user.getHealth() <= 4F) { + value *= 0.2F; + } + + return value * StaminaBar.getBaseIdleModifier(user, true, true); + } + + public static void onJump(EntityLivingBase user) { + if (user.worldObj.isRemote) { + return; + } + float stam = StaminaBar.getStaminaValue(user); + if (stam > 0) { + StaminaBar.modifyStaminaValue(user, -getJumpDecay(user)); + } + StaminaBar.setIdleTime(user, 40F * getIdleRate(user)); + // syncStamina(user, new float[]{stam, StaminaBar.getMaxStamina(user)}); + } + + public static float getJumpDecay(EntityLivingBase user) { + float value = 2.0F; + + if (user.isSprinting()) { + value = 3.0F; + } + return value * StaminaBar.getBaseDecayModifier(user, true, false); + } + + public static void onAttack(EntityLivingBase user, Entity target) { + applyHitFatigue(user, 1.0F * TacticalManager.getHighgroundModifier(target, user, 1.5F)); + } + + public static void applyHitFatigue(EntityLivingBase user, float modifier) { + float stam = StaminaBar.getStaminaValue(user); + + if (stam > 0) { + StaminaBar.modifyStaminaValue(user, -getWeaponModifier(user) * modifier); + } + StaminaBar.setIdleTime(user, 50F * getIdleRate(user)); + // syncStamina(user, new float[]{stam, StaminaBar.getMaxStamina(user)}); + } + + public static float getWeaponModifier(EntityLivingBase user) { + ItemStack weapon = user.getHeldItem(); + float value = 0.0F; + + if (weapon != null) { + value = 2F; + + if (weapon.getItem() instanceof IStaminaWeapon) { + value = ((IStaminaWeapon) weapon.getItem()).getStaminaDrainOnHit(user, weapon); + } else { + if (weapon.getItem() instanceof ItemSword) { + value = 5; + } + if (weapon.getItem() instanceof ItemTool) { + value = 10; + } + } + } + + return value * ConfigStamina.weaponModifier * StaminaBar.getBaseDecayModifier(user, true, true); + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/TierHelper.java b/src/main/java/minefantasy/mf2/mechanics/TierHelper.java index b091033f..0fd60d82 100644 --- a/src/main/java/minefantasy/mf2/mechanics/TierHelper.java +++ b/src/main/java/minefantasy/mf2/mechanics/TierHelper.java @@ -1,25 +1,24 @@ package minefantasy.mf2.mechanics; +public class TierHelper { + /** + * This gets the "points" on how powerful food is (This is used to help balance + * cost) + */ + public static int getPointsWorthForFood(int hunger, float saturation, float staminaMax, float staminaMaxTime, + float staminaSpeed, float staminaSpeedTime) { + float satCost = 5F;// Pts for each hour + float boostCost = 1F;// Pts for each 1 per day + float regenCost = 2F;// Pts for each 1s per minute -public class TierHelper -{ - /** - * This gets the "points" on how powerful food is (This is used to help balance cost) - */ - public static int getPointsWorthForFood(int hunger, float saturation, float staminaMax, float staminaMaxTime, float staminaSpeed, float staminaSpeedTime) - { - float satCost = 5F;//Pts for each hour - float boostCost = 1F;//Pts for each 1 per day - float regenCost = 2F;//Pts for each 1s per minute - - float staminaPoints = (staminaMax) * (staminaMaxTime/1200F); - float staminaRegenPoints = (staminaSpeed) * (staminaSpeedTime/60F); - - float pts = 0; - pts += saturation /3600F * satCost; - pts += staminaPoints * boostCost; - pts += staminaRegenPoints * regenCost; - - return (int)pts; - } + float staminaPoints = (staminaMax) * (staminaMaxTime / 1200F); + float staminaRegenPoints = (staminaSpeed) * (staminaSpeedTime / 60F); + + float pts = 0; + pts += saturation / 3600F * satCost; + pts += staminaPoints * boostCost; + pts += staminaRegenPoints * regenCost; + + return (int) pts; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenBiological.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenBiological.java index f91dab52..62f8a7c2 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenBiological.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenBiological.java @@ -1,7 +1,5 @@ package minefantasy.mf2.mechanics.worldGen; -import java.util.Random; - import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigWorldGen; @@ -12,121 +10,115 @@ import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; -public class WorldGenBiological -{ - public static void generate(Random seed, int chunkX, int chunkZ, World world, int dimension) - { - boolean debug = world.getWorldInfo().getTerrainType() == WorldType.FLAT && MineFantasyII.isDebug(); - - BiomeGenBase biome = world.getBiomeGenForCoords(chunkX*16, chunkZ*16); - if(debug || isBiomeInConstraint(biome, ConfigWorldGen.berryMinTemp, ConfigWorldGen.berryMaxTemp, ConfigWorldGen.berryMinRain, ConfigWorldGen.berryMaxRain)) - { - generatePlant(seed, chunkX, chunkZ, world, BlockListMF.berryBush, 0, ConfigWorldGen.berryRarity, 6); - } - if(debug || isBiomeInConstraint(biome, ConfigWorldGen.yewMinTemp, ConfigWorldGen.yewMaxTemp, ConfigWorldGen.yewMinRain, ConfigWorldGen.yewMaxRain)) - { - generateTree(seed, chunkX, chunkZ, world, BlockListMF.log_yew, BlockListMF.leaves_yew, ConfigWorldGen.yewRarity); - } - if(debug || isBiomeInConstraint(biome, ConfigWorldGen.ironbarkMinTemp, ConfigWorldGen.ironbarkMaxTemp, ConfigWorldGen.ironbarkMinRain, ConfigWorldGen.ironbarkMaxRain)) - { - generateTree(seed, chunkX, chunkZ, world, BlockListMF.log_ironbark, BlockListMF.leaves_ironbark, ConfigWorldGen.ironbarkRarity); - } - if(debug || isBiomeInConstraint(biome, ConfigWorldGen.ebonyMinTemp, ConfigWorldGen.ebonyMaxTemp, ConfigWorldGen.ebonyMinRain, ConfigWorldGen.ebonyMaxRain)) - { - generateTree(seed, chunkX, chunkZ, world, BlockListMF.log_ebony, BlockListMF.leaves_ebony, ConfigWorldGen.ebonyRarity); - } - } - public static boolean isBiomeInConstraint(BiomeGenBase biome, float tempMin, float tempMax, float rainMin, float rainMax) - { - if(biome != null) - { - return biome.temperature >= tempMin && biome.temperature < tempMax && biome.rainfall >= rainMin && biome.rainfall < rainMax; - } - return false; - } - - private static void generatePlant(Random seed, int chunkX, int chunkZ, World world, Block plant, int meta, float chance, int count) - { - boolean doGen = world.getWorldInfo().getTerrainType() != WorldType.FLAT; - if (doGen && seed.nextFloat() < chance) - { - for(int a = 0; a < count; a ++) - { - int j = chunkX*16 + seed.nextInt(16); - int k = chunkZ*16 + seed.nextInt(16); - int l = world.getTopSolidOrLiquidBlock(j, k); - (new WorldGenBush(plant, meta)).generate(world, seed, j, l, k); - } - } - } - private static void generateTree(Random seed, int chunkX, int chunkZ, World world, Block log, Block leaves, float chance) - { - boolean doGen = world.getWorldInfo().getTerrainType() != WorldType.FLAT || (doGen = MineFantasyII.isDebug() && world.getWorldInfo().getTerrainType() == WorldType.FLAT); - if (doGen && seed.nextFloat() < chance) - { - int j = chunkX*16 + seed.nextInt(16); - int k = chunkZ*16 + seed.nextInt(16); +import java.util.Random; + +public class WorldGenBiological { + public static void generate(Random seed, int chunkX, int chunkZ, World world, int dimension) { + boolean debug = world.getWorldInfo().getTerrainType() == WorldType.FLAT && MineFantasyII.isDebug(); + + BiomeGenBase biome = world.getBiomeGenForCoords(chunkX * 16, chunkZ * 16); + if (debug || isBiomeInConstraint(biome, ConfigWorldGen.berryMinTemp, ConfigWorldGen.berryMaxTemp, + ConfigWorldGen.berryMinRain, ConfigWorldGen.berryMaxRain)) { + generatePlant(seed, chunkX, chunkZ, world, BlockListMF.berryBush, 0, ConfigWorldGen.berryRarity, 6); + } + if (debug || isBiomeInConstraint(biome, ConfigWorldGen.yewMinTemp, ConfigWorldGen.yewMaxTemp, + ConfigWorldGen.yewMinRain, ConfigWorldGen.yewMaxRain)) { + generateTree(seed, chunkX, chunkZ, world, BlockListMF.log_yew, BlockListMF.leaves_yew, + ConfigWorldGen.yewRarity); + } + if (debug || isBiomeInConstraint(biome, ConfigWorldGen.ironbarkMinTemp, ConfigWorldGen.ironbarkMaxTemp, + ConfigWorldGen.ironbarkMinRain, ConfigWorldGen.ironbarkMaxRain)) { + generateTree(seed, chunkX, chunkZ, world, BlockListMF.log_ironbark, BlockListMF.leaves_ironbark, + ConfigWorldGen.ironbarkRarity); + } + if (debug || isBiomeInConstraint(biome, ConfigWorldGen.ebonyMinTemp, ConfigWorldGen.ebonyMaxTemp, + ConfigWorldGen.ebonyMinRain, ConfigWorldGen.ebonyMaxRain)) { + generateTree(seed, chunkX, chunkZ, world, BlockListMF.log_ebony, BlockListMF.leaves_ebony, + ConfigWorldGen.ebonyRarity); + } + } + + public static boolean isBiomeInConstraint(BiomeGenBase biome, float tempMin, float tempMax, float rainMin, + float rainMax) { + if (biome != null) { + return biome.temperature >= tempMin && biome.temperature < tempMax && biome.rainfall >= rainMin + && biome.rainfall < rainMax; + } + return false; + } + + private static void generatePlant(Random seed, int chunkX, int chunkZ, World world, Block plant, int meta, + float chance, int count) { + boolean doGen = world.getWorldInfo().getTerrainType() != WorldType.FLAT; + if (doGen && seed.nextFloat() < chance) { + for (int a = 0; a < count; a++) { + int j = chunkX * 16 + seed.nextInt(16); + int k = chunkZ * 16 + seed.nextInt(16); + int l = world.getTopSolidOrLiquidBlock(j, k); + (new WorldGenBush(plant, meta)).generate(world, seed, j, l, k); + } + } + } + + private static void generateTree(Random seed, int chunkX, int chunkZ, World world, Block log, Block leaves, + float chance) { + boolean doGen = world.getWorldInfo().getTerrainType() != WorldType.FLAT + || (doGen = MineFantasyII.isDebug() && world.getWorldInfo().getTerrainType() == WorldType.FLAT); + if (doGen && seed.nextFloat() < chance) { + int j = chunkX * 16 + seed.nextInt(16); + int k = chunkZ * 16 + seed.nextInt(16); int l = world.getTopSolidOrLiquidBlock(j, k); (new WorldGenMFTree(false, log, leaves)).generate(world, seed, j, l, k); - } - } - - private static void generateOreWithNeighbour(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, Material neighbour, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax) - { - int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); - if(seed.nextFloat() < rarity) - { - for(int count = 0; count < frequency; count ++) - { - int x = chunkX*16 + seed.nextInt(16); - int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); - int z = chunkZ*16 + seed.nextInt(16); - - if(isNeibourNear(world, x, y, z, neighbour)) - { - if((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) - { - } - } - } - } - } - private static void generateOreWithNeighbour(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, Block neighbour, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax) - { - int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); - if(seed.nextFloat() < rarity) - { - for(int count = 0; count < frequency; count ++) - { - int x = chunkX*16 + seed.nextInt(16); - int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); - int z = chunkZ*16 + seed.nextInt(16); - - if(isNeibourNear(world, x, y, z, neighbour)) - { - if((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) - { - } - } - } - } - } - private static boolean isNeibourNear(World world, int x, int y, int z, Block neighbour) - { - return world.getBlock(x-1, y, z) == neighbour - || world.getBlock(+1, y, z) == neighbour - || world.getBlock(x, y-1, z) == neighbour - || world.getBlock(x, y+1, z) == neighbour - || world.getBlock(x, y, z-1) == neighbour - || world.getBlock(x, y, z+1) == neighbour; - } - private static boolean isNeibourNear(World world, int x, int y, int z, Material neighbour) - { - return world.getBlock(x-1, y, z).getMaterial() == neighbour - || world.getBlock(+1, y, z).getMaterial() == neighbour - || world.getBlock(x, y-1, z).getMaterial() == neighbour - || world.getBlock(x, y+1, z).getMaterial() == neighbour - || world.getBlock(x, y, z-1).getMaterial() == neighbour - || world.getBlock(x, y, z+1).getMaterial() == neighbour; - } + } + } + + private static void generateOreWithNeighbour(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, + Material neighbour, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, + int layerMax) { + int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); + if (seed.nextFloat() < rarity) { + for (int count = 0; count < frequency; count++) { + int x = chunkX * 16 + seed.nextInt(16); + int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); + int z = chunkZ * 16 + seed.nextInt(16); + + if (isNeibourNear(world, x, y, z, neighbour)) { + if ((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) { + } + } + } + } + } + + private static void generateOreWithNeighbour(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, + Block neighbour, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax) { + int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); + if (seed.nextFloat() < rarity) { + for (int count = 0; count < frequency; count++) { + int x = chunkX * 16 + seed.nextInt(16); + int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); + int z = chunkZ * 16 + seed.nextInt(16); + + if (isNeibourNear(world, x, y, z, neighbour)) { + if ((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) { + } + } + } + } + } + + private static boolean isNeibourNear(World world, int x, int y, int z, Block neighbour) { + return world.getBlock(x - 1, y, z) == neighbour || world.getBlock(+1, y, z) == neighbour + || world.getBlock(x, y - 1, z) == neighbour || world.getBlock(x, y + 1, z) == neighbour + || world.getBlock(x, y, z - 1) == neighbour || world.getBlock(x, y, z + 1) == neighbour; + } + + private static boolean isNeibourNear(World world, int x, int y, int z, Material neighbour) { + return world.getBlock(x - 1, y, z).getMaterial() == neighbour + || world.getBlock(+1, y, z).getMaterial() == neighbour + || world.getBlock(x, y - 1, z).getMaterial() == neighbour + || world.getBlock(x, y + 1, z).getMaterial() == neighbour + || world.getBlock(x, y, z - 1).getMaterial() == neighbour + || world.getBlock(x, y, z + 1).getMaterial() == neighbour; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenBush.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenBush.java index ae0a5741..05199c6b 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenBush.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenBush.java @@ -1,34 +1,31 @@ package minefantasy.mf2.mechanics.worldGen; -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public class WorldGenBush extends WorldGenerator -{ - private Block block; - private int meta; - - public WorldGenBush(Block block, int meta) - { - super(); - this.block = block; - this.meta = meta; - } - @Override - public boolean generate(World world, Random rand, int x, int y, int z) - { - for (int l = 0; l < 8; ++l) - { +import java.util.Random; + +public class WorldGenBush extends WorldGenerator { + private Block block; + private int meta; + + public WorldGenBush(Block block, int meta) { + super(); + this.block = block; + this.meta = meta; + } + + @Override + public boolean generate(World world, Random rand, int x, int y, int z) { + for (int l = 0; l < 8; ++l) { int i1 = x + rand.nextInt(8) - rand.nextInt(8); int j1 = y + rand.nextInt(4) - rand.nextInt(4); int k1 = z + rand.nextInt(8) - rand.nextInt(8); - if (world.isAirBlock(i1, j1, k1) && world.getBlock(i1, j1 - 1, k1) == Blocks.grass && block.canPlaceBlockAt(world, i1, j1, k1)) - { + if (world.isAirBlock(i1, j1, k1) && world.getBlock(i1, j1 - 1, k1) == Blocks.grass + && block.canPlaceBlockAt(world, i1, j1, k1)) { world.setBlock(i1, j1, k1, block, meta, 2); } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenDuelMinable.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenDuelMinable.java index 2bd55c02..719bc0c7 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenDuelMinable.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenDuelMinable.java @@ -1,54 +1,54 @@ package minefantasy.mf2.mechanics.worldGen; -import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public class WorldGenDuelMinable extends WorldGenerator -{ +import java.util.Random; + +public class WorldGenDuelMinable extends WorldGenerator { private Block ore, specialOre; - /** The number of blocks to generate. */ + /** + * The number of blocks to generate. + */ private int veinSize; private Block bed; private int oreMeta, specialMeta; private float chanceForSpecial; - public WorldGenDuelMinable(Block main, int number, Block extra, float chance) - { - this(main, 0, number, Blocks.stone, extra, 0, chance); + public WorldGenDuelMinable(Block main, int number, Block extra, float chance) { + this(main, 0, number, Blocks.stone, extra, 0, chance); } - public WorldGenDuelMinable(Block main, int mainMeta, int number, Block target, Block extra, int extraMeta, float chance) - { - this.ore = main; - this.oreMeta = mainMeta; - this.veinSize = number; - this.bed = target; - this.specialOre = extra; - this.specialMeta = extraMeta; - this.chanceForSpecial = chance; + + public WorldGenDuelMinable(Block main, int mainMeta, int number, Block target, Block extra, int extraMeta, + float chance) { + this.ore = main; + this.oreMeta = mainMeta; + this.veinSize = number; + this.bed = target; + this.specialOre = extra; + this.specialMeta = extraMeta; + this.chanceForSpecial = chance; } - public boolean generate(World world, Random seed, int x, int y, int z) - { - float f = seed.nextFloat() * (float)Math.PI; - double d0 = (double)((float)(x + 8) + MathHelper.sin(f) * (float)this.veinSize / 8.0F); - double d1 = (double)((float)(x + 8) - MathHelper.sin(f) * (float)this.veinSize / 8.0F); - double d2 = (double)((float)(z + 8) + MathHelper.cos(f) * (float)this.veinSize / 8.0F); - double d3 = (double)((float)(z + 8) - MathHelper.cos(f) * (float)this.veinSize / 8.0F); - double d4 = (double)(y + seed.nextInt(3) - 2); - double d5 = (double)(y + seed.nextInt(3) - 2); + public boolean generate(World world, Random seed, int x, int y, int z) { + float f = seed.nextFloat() * (float) Math.PI; + double d0 = x + 8 + MathHelper.sin(f) * this.veinSize / 8.0F; + double d1 = x + 8 - MathHelper.sin(f) * this.veinSize / 8.0F; + double d2 = z + 8 + MathHelper.cos(f) * this.veinSize / 8.0F; + double d3 = z + 8 - MathHelper.cos(f) * this.veinSize / 8.0F; + double d4 = y + seed.nextInt(3) - 2; + double d5 = y + seed.nextInt(3) - 2; - for (int l = 0; l <= this.veinSize; ++l) - { - double d6 = d0 + (d1 - d0) * (double)l / (double)this.veinSize; - double d7 = d4 + (d5 - d4) * (double)l / (double)this.veinSize; - double d8 = d2 + (d3 - d2) * (double)l / (double)this.veinSize; - double d9 = seed.nextDouble() * (double)this.veinSize / 16.0D; - double d10 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.veinSize) + 1.0F) * d9 + 1.0D; - double d11 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.veinSize) + 1.0F) * d9 + 1.0D; + for (int l = 0; l <= this.veinSize; ++l) { + double d6 = d0 + (d1 - d0) * l / this.veinSize; + double d7 = d4 + (d5 - d4) * l / this.veinSize; + double d8 = d2 + (d3 - d2) * l / this.veinSize; + double d9 = seed.nextDouble() * this.veinSize / 16.0D; + double d10 = (MathHelper.sin(l * (float) Math.PI / this.veinSize) + 1.0F) * d9 + 1.0D; + double d11 = (MathHelper.sin(l * (float) Math.PI / this.veinSize) + 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); @@ -56,32 +56,24 @@ public boolean generate(World world, Random seed, int x, int y, int z) 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 = (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 = (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 = (i3 + 0.5D - d8) / (d10 / 2.0D); - if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlock(k2, l2, i3).isReplaceableOreGen(world, k2, l2, i3, bed)) - { - if(seed.nextFloat() < chanceForSpecial) - { - world.setBlock(k2, l2, i3, this.specialOre, specialMeta, 2);//Special Block - } - else - { - world.setBlock(k2, l2, i3, this.ore, oreMeta, 2);//Ore - } + if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D + && world.getBlock(k2, l2, i3).isReplaceableOreGen(world, k2, l2, i3, bed)) { + if (seed.nextFloat() < chanceForSpecial) { + world.setBlock(k2, l2, i3, this.specialOre, specialMeta, 2);// Special Block + } else { + world.setBlock(k2, l2, i3, this.ore, oreMeta, 2);// Ore + } } } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenGeological.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenGeological.java index 1bda06a2..f3f7bbf3 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenGeological.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenGeological.java @@ -1,7 +1,5 @@ package minefantasy.mf2.mechanics.worldGen; -import java.util.Random; - import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigWorldGen; import net.minecraft.block.Block; @@ -11,135 +9,153 @@ import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenMinable; -public class WorldGenGeological -{ - public static void generate(Random seed, int chunkX, int chunkZ, World world, int dimension) - { - generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreCopper, Blocks.stone, ConfigWorldGen.copperSize, ConfigWorldGen.copperFrequencyMin, ConfigWorldGen.copperFrequencyMax, ConfigWorldGen.copperRarity, ConfigWorldGen.copperLayerMin, ConfigWorldGen.copperLayerMax); - generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreTin, Blocks.stone, ConfigWorldGen.tinSize, ConfigWorldGen.tinFrequencyMin, ConfigWorldGen.tinFrequencyMax, ConfigWorldGen.tinRarity, ConfigWorldGen.tinLayerMin, ConfigWorldGen.tinLayerMax); - generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreSilver, Blocks.stone, ConfigWorldGen.silverSize, ConfigWorldGen.silverFrequencyMin, ConfigWorldGen.silverFrequencyMax, ConfigWorldGen.silverRarity, ConfigWorldGen.silverLayerMin, ConfigWorldGen.silverLayerMax); - generateOreWithNeighbour(seed, chunkX, chunkZ, world, BlockListMF.oreMythic, Blocks.stone, Blocks.bedrock, ConfigWorldGen.mythicSize, ConfigWorldGen.mythicFrequencyMin, ConfigWorldGen.mythicFrequencyMax, ConfigWorldGen.mythicRarity, ConfigWorldGen.mythicLayerMin, ConfigWorldGen.mythicLayerMax); - - generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreKaolinite, Blocks.stone, ConfigWorldGen.kaoliniteSize, ConfigWorldGen.kaoliniteFrequencyMin, ConfigWorldGen.kaoliniteFrequencyMax, ConfigWorldGen.kaoliniteRarity, ConfigWorldGen.kaoliniteLayerMin, ConfigWorldGen.kaoliniteLayerMax); - generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreClay, Blocks.dirt, ConfigWorldGen.claySize, ConfigWorldGen.clayFrequencyMin, ConfigWorldGen.clayFrequencyMax, ConfigWorldGen.clayRarity, ConfigWorldGen.clayLayerMin, ConfigWorldGen.clayLayerMax); - generateOreWithNeighbour(seed, chunkX, chunkZ, world, BlockListMF.oreNitre, Blocks.stone, Blocks.air, ConfigWorldGen.nitreSize, ConfigWorldGen.nitreFrequencyMin, ConfigWorldGen.nitreFrequencyMax, ConfigWorldGen.nitreRarity, ConfigWorldGen.nitreLayerMin, ConfigWorldGen.nitreLayerMax); - generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreSulfur, Blocks.stone, ConfigWorldGen.sulfurSize, ConfigWorldGen.sulfurFrequencyMin, ConfigWorldGen.sulfurFrequencyMax, ConfigWorldGen.sulfurRarity, ConfigWorldGen.sulfurLayerMin, ConfigWorldGen.sulfurLayerMax); - generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreBorax, Blocks.stone, ConfigWorldGen.boraxSize, ConfigWorldGen.boraxFrequencyMin, ConfigWorldGen.boraxFrequencyMax, ConfigWorldGen.boraxRarity, ConfigWorldGen.boraxLayerMin, ConfigWorldGen.boraxLayerMax); - generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreTungsten, Blocks.stone, ConfigWorldGen.wolframiteSize, ConfigWorldGen.wolframiteFrequencyMin, ConfigWorldGen.wolframiteFrequencyMax, ConfigWorldGen.wolframiteRarity, ConfigWorldGen.wolframiteLayerMin, ConfigWorldGen.wolframiteLayerMax); - generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreCoalRich, Blocks.stone, ConfigWorldGen.coalSize, ConfigWorldGen.coalFrequencyMin, ConfigWorldGen.coalFrequencyMax, ConfigWorldGen.coalRarity, ConfigWorldGen.coalLayerMin, ConfigWorldGen.coalLayerMax); - - generateOre(seed, chunkX, chunkZ, world, BlockListMF.limestone, Blocks.stone, ConfigWorldGen.limestoneSize, ConfigWorldGen.limestoneFrequencyMin, ConfigWorldGen.limestoneFrequencyMax, ConfigWorldGen.limestoneRarity, ConfigWorldGen.limestoneLayerMin, ConfigWorldGen.limestoneLayerMax); - } - - /** - * Not used yet, allows a vein consisting of two block types - */ - private static void generateDuelOre(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax, Block special, float chance) - { - int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); - if(seed.nextFloat() < rarity) - { - for(int count = 0; count < frequency; count ++) - { - int x = chunkX*16 + seed.nextInt(16); - int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); - int z = chunkZ*16 + seed.nextInt(16); - (new WorldGenDuelMinable(ore, size, special, chance)).generate(world, seed, x, y, z); - } - } - } - private static void generateOre(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax) - { - int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); - if(seed.nextFloat() < rarity) - { - for(int count = 0; count < frequency; count ++) - { - int x = chunkX*16 + seed.nextInt(16); - int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); - int z = chunkZ*16 + seed.nextInt(16); - (new WorldGenMinable(ore, size, bed)).generate(world, seed, x, y, z); - } - } - } - - private static void generateOreWithNeighbour(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, Material neighbour, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax) - { - int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); - if(seed.nextFloat() < rarity) - { - for(int count = 0; count < frequency; count ++) - { - int x = chunkX*16 + seed.nextInt(16); - int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); - int z = chunkZ*16 + seed.nextInt(16); - - if(isNeibourNear(world, x, y, z, neighbour)) - { - if((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) - { - } - } - } - } - } - private static void generateOreWithNeighbour2(Random seed, int chunkX, int chunkZ, World world, Block basic, float chance, Block special, Block bed, Block neighbour, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax) - { - int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); - if(seed.nextFloat() < rarity) - { - for(int count = 0; count < frequency; count ++) - { - int x = chunkX*16 + seed.nextInt(16); - int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); - int z = chunkZ*16 + seed.nextInt(16); - - if(isNeibourNear(world, x, y, z, neighbour)) - { - Block ore = (seed.nextFloat() <= chance ? special : basic); - if((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) - { - } - } - } - } - } - private static void generateOreWithNeighbour(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, Block neighbour, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax) - { - int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); - if(seed.nextFloat() < rarity) - { - for(int count = 0; count < frequency; count ++) - { - int x = chunkX*16 + seed.nextInt(16); - int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); - int z = chunkZ*16 + seed.nextInt(16); - - if(isNeibourNear(world, x, y, z, neighbour)) - { - if((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) - { - } - } - } - } - } - private static boolean isNeibourNear(World world, int x, int y, int z, Block neighbour) - { - return world.getBlock(x-1, y, z) == neighbour - || world.getBlock(+1, y, z) == neighbour - || world.getBlock(x, y-1, z) == neighbour - || world.getBlock(x, y+1, z) == neighbour - || world.getBlock(x, y, z-1) == neighbour - || world.getBlock(x, y, z+1) == neighbour; - } - private static boolean isNeibourNear(World world, int x, int y, int z, Material neighbour) - { - return world.getBlock(x-1, y, z).getMaterial() == neighbour - || world.getBlock(+1, y, z).getMaterial() == neighbour - || world.getBlock(x, y-1, z).getMaterial() == neighbour - || world.getBlock(x, y+1, z).getMaterial() == neighbour - || world.getBlock(x, y, z-1).getMaterial() == neighbour - || world.getBlock(x, y, z+1).getMaterial() == neighbour; - } +import java.util.Random; + +public class WorldGenGeological { + public static void generate(Random seed, int chunkX, int chunkZ, World world, int dimension) { + generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreCopper, Blocks.stone, ConfigWorldGen.copperSize, + ConfigWorldGen.copperFrequencyMin, ConfigWorldGen.copperFrequencyMax, ConfigWorldGen.copperRarity, + ConfigWorldGen.copperLayerMin, ConfigWorldGen.copperLayerMax); + generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreTin, Blocks.stone, ConfigWorldGen.tinSize, + ConfigWorldGen.tinFrequencyMin, ConfigWorldGen.tinFrequencyMax, ConfigWorldGen.tinRarity, + ConfigWorldGen.tinLayerMin, ConfigWorldGen.tinLayerMax); + generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreSilver, Blocks.stone, ConfigWorldGen.silverSize, + ConfigWorldGen.silverFrequencyMin, ConfigWorldGen.silverFrequencyMax, ConfigWorldGen.silverRarity, + ConfigWorldGen.silverLayerMin, ConfigWorldGen.silverLayerMax); + generateOreWithNeighbour(seed, chunkX, chunkZ, world, BlockListMF.oreMythic, Blocks.stone, Blocks.bedrock, + ConfigWorldGen.mythicSize, ConfigWorldGen.mythicFrequencyMin, ConfigWorldGen.mythicFrequencyMax, + ConfigWorldGen.mythicRarity, ConfigWorldGen.mythicLayerMin, ConfigWorldGen.mythicLayerMax); + + //NEW ORES + generateOreWithNeighbour(seed, chunkX, chunkZ, world, BlockListMF.oreMithril, Blocks.stone, Blocks.bedrock, + ConfigWorldGen.mithrilSize, ConfigWorldGen.mithrilFrequencyMin, ConfigWorldGen.mithrilFrequencyMax, + ConfigWorldGen.mithrilRarity, ConfigWorldGen.mithrilLayerMin, ConfigWorldGen.mithrilLayerMax); + + + //MF + generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreKaolinite, Blocks.stone, ConfigWorldGen.kaoliniteSize, + ConfigWorldGen.kaoliniteFrequencyMin, ConfigWorldGen.kaoliniteFrequencyMax, + ConfigWorldGen.kaoliniteRarity, ConfigWorldGen.kaoliniteLayerMin, ConfigWorldGen.kaoliniteLayerMax); + generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreClay, Blocks.dirt, ConfigWorldGen.claySize, + ConfigWorldGen.clayFrequencyMin, ConfigWorldGen.clayFrequencyMax, ConfigWorldGen.clayRarity, + ConfigWorldGen.clayLayerMin, ConfigWorldGen.clayLayerMax); + generateOreWithNeighbour(seed, chunkX, chunkZ, world, BlockListMF.oreNitre, Blocks.stone, Blocks.air, + ConfigWorldGen.nitreSize, ConfigWorldGen.nitreFrequencyMin, ConfigWorldGen.nitreFrequencyMax, + ConfigWorldGen.nitreRarity, ConfigWorldGen.nitreLayerMin, ConfigWorldGen.nitreLayerMax); + generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreSulfur, Blocks.stone, ConfigWorldGen.sulfurSize, + ConfigWorldGen.sulfurFrequencyMin, ConfigWorldGen.sulfurFrequencyMax, ConfigWorldGen.sulfurRarity, + ConfigWorldGen.sulfurLayerMin, ConfigWorldGen.sulfurLayerMax); + generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreBorax, Blocks.stone, ConfigWorldGen.boraxSize, + ConfigWorldGen.boraxFrequencyMin, ConfigWorldGen.boraxFrequencyMax, ConfigWorldGen.boraxRarity, + ConfigWorldGen.boraxLayerMin, ConfigWorldGen.boraxLayerMax); + generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreTungsten, Blocks.stone, ConfigWorldGen.wolframiteSize, + ConfigWorldGen.wolframiteFrequencyMin, ConfigWorldGen.wolframiteFrequencyMax, + ConfigWorldGen.wolframiteRarity, ConfigWorldGen.wolframiteLayerMin, ConfigWorldGen.wolframiteLayerMax); + generateOre(seed, chunkX, chunkZ, world, BlockListMF.oreCoalRich, Blocks.stone, ConfigWorldGen.coalSize, + ConfigWorldGen.coalFrequencyMin, ConfigWorldGen.coalFrequencyMax, ConfigWorldGen.coalRarity, + ConfigWorldGen.coalLayerMin, ConfigWorldGen.coalLayerMax); + + generateOre(seed, chunkX, chunkZ, world, BlockListMF.limestone, Blocks.stone, ConfigWorldGen.limestoneSize, + ConfigWorldGen.limestoneFrequencyMin, ConfigWorldGen.limestoneFrequencyMax, + ConfigWorldGen.limestoneRarity, ConfigWorldGen.limestoneLayerMin, ConfigWorldGen.limestoneLayerMax); + } + + /** + * Not used yet, allows a vein consisting of two block types + */ + private static void generateDuelOre(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, + int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax, Block special, + float chance) { + int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); + if (seed.nextFloat() < rarity) { + for (int count = 0; count < frequency; count++) { + int x = chunkX * 16 + seed.nextInt(16); + int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); + int z = chunkZ * 16 + seed.nextInt(16); + (new WorldGenDuelMinable(ore, size, special, chance)).generate(world, seed, x, y, z); + } + } + } + + private static void generateOre(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, int size, + int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax) { + int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); + if (seed.nextFloat() < rarity) { + for (int count = 0; count < frequency; count++) { + int x = chunkX * 16 + seed.nextInt(16); + int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); + int z = chunkZ * 16 + seed.nextInt(16); + (new WorldGenMinable(ore, size, bed)).generate(world, seed, x, y, z); + } + } + } + + private static void generateOreWithNeighbour(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, + Material neighbour, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, + int layerMax) { + int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); + if (seed.nextFloat() < rarity) { + for (int count = 0; count < frequency; count++) { + int x = chunkX * 16 + seed.nextInt(16); + int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); + int z = chunkZ * 16 + seed.nextInt(16); + + if (isNeibourNear(world, x, y, z, neighbour)) { + if ((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) { + } + } + } + } + } + + private static void generateOreWithNeighbour2(Random seed, int chunkX, int chunkZ, World world, Block basic, + float chance, Block special, Block bed, Block neighbour, int size, int frequencyMin, int frequencyMax, + float rarity, int layerMin, int layerMax) { + int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); + if (seed.nextFloat() < rarity) { + for (int count = 0; count < frequency; count++) { + int x = chunkX * 16 + seed.nextInt(16); + int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); + int z = chunkZ * 16 + seed.nextInt(16); + + if (isNeibourNear(world, x, y, z, neighbour)) { + Block ore = (seed.nextFloat() <= chance ? special : basic); + if ((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) { + } + } + } + } + } + + private static void generateOreWithNeighbour(Random seed, int chunkX, int chunkZ, World world, Block ore, Block bed, + Block neighbour, int size, int frequencyMin, int frequencyMax, float rarity, int layerMin, int layerMax) { + int frequency = MathHelper.getRandomIntegerInRange(seed, frequencyMin, frequencyMax); + if (seed.nextFloat() < rarity) { + for (int count = 0; count < frequency; count++) { + int x = chunkX * 16 + seed.nextInt(16); + int y = MathHelper.getRandomIntegerInRange(seed, layerMin, layerMax); + int z = chunkZ * 16 + seed.nextInt(16); + + if (isNeibourNear(world, x, y, z, neighbour)) { + if ((new WorldGenMinableMF(ore, size, bed)).generate(world, seed, x, y, z)) { + } + } + } + } + } + + private static boolean isNeibourNear(World world, int x, int y, int z, Block neighbour) { + return world.getBlock(x - 1, y, z) == neighbour || world.getBlock(+1, y, z) == neighbour + || world.getBlock(x, y - 1, z) == neighbour || world.getBlock(x, y + 1, z) == neighbour + || world.getBlock(x, y, z - 1) == neighbour || world.getBlock(x, y, z + 1) == neighbour; + } + + private static boolean isNeibourNear(World world, int x, int y, int z, Material neighbour) { + return world.getBlock(x - 1, y, z).getMaterial() == neighbour + || world.getBlock(+1, y, z).getMaterial() == neighbour + || world.getBlock(x, y - 1, z).getMaterial() == neighbour + || world.getBlock(x, y + 1, z).getMaterial() == neighbour + || world.getBlock(x, y, z - 1).getMaterial() == neighbour + || world.getBlock(x, y, z + 1).getMaterial() == neighbour; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMFBase.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMFBase.java index 7524dff7..d9a73ca8 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMFBase.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMFBase.java @@ -1,26 +1,21 @@ package minefantasy.mf2.mechanics.worldGen; -import java.util.HashMap; -import java.util.Random; - -import minefantasy.mf2.util.MFLogUtil; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; +import cpw.mods.fml.common.IWorldGenerator; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; -import cpw.mods.fml.common.IWorldGenerator; -public class WorldGenMFBase implements IWorldGenerator -{ - @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) - { - generate(random, chunkX, chunkZ, world, world.provider.dimensionId); - } - public void generate(Random random, int chunkX, int chunkZ, World world, int dimension) - { - WorldGenGeological.generate(random, chunkX, chunkZ, world, dimension); - WorldGenBiological.generate(random, chunkX, chunkZ, world, dimension); - WorldGenStructures.generate(random, chunkX, chunkZ, world, dimension); - } +import java.util.Random; + +public class WorldGenMFBase implements IWorldGenerator { + @Override + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, + IChunkProvider chunkProvider) { + generate(random, chunkX, chunkZ, world, world.provider.dimensionId); + } + + public void generate(Random random, int chunkX, int chunkZ, World world, int dimension) { + WorldGenGeological.generate(random, chunkX, chunkZ, world, dimension); + WorldGenBiological.generate(random, chunkX, chunkZ, world, dimension); + WorldGenStructures.generate(random, chunkX, chunkZ, world, dimension); + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMFTree.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMFTree.java index 5d49be0e..42cc8f1d 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMFTree.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMFTree.java @@ -1,7 +1,5 @@ package minefantasy.mf2.mechanics.worldGen; -import java.util.Random; - import minefantasy.mf2.block.list.BlockListMF; import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; @@ -11,18 +9,20 @@ import net.minecraft.world.gen.feature.WorldGenAbstractTree; import net.minecraftforge.common.util.ForgeDirection; -public class WorldGenMFTree extends WorldGenAbstractTree -{ +import java.util.Random; + +public class WorldGenMFTree extends WorldGenAbstractTree { /** - * Contains three sets of two values that provide complimentary indices for a given 'major' index - 1 and 2 for 0, 0 - * and 2 for 1, and 0 and 1 for 2. + * Contains three sets of two values that provide complimentary indices for a + * given 'major' index - 1 and 2 for 0, 0 and 2 for 1, and 0 and 1 for 2. + */ + static final byte[] otherCoordPairs = new byte[]{(byte) 2, (byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 1}; + private final Block log, leaves; + /** + * Reference to the World object. */ - static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; - /** random seed for GenBigTree */ - Random rand = new Random(); - /** Reference to the World object. */ World worldObj; - int[] basePos = new int[] {0, 0, 0}; + int[] basePos = new int[]{0, 0, 0}; int heightLimit; int height; double heightAttenuation = 0.618D; @@ -30,56 +30,61 @@ public class WorldGenMFTree extends WorldGenAbstractTree double branchSlope = 0.381D; double scaleWidth = 1.0D; double leafDensity = 1.0D; - /** Currently always 1, can be set to 2 in the class constructor to generate a double-sized tree trunk for big trees. */ + /** + * Currently always 1, can be set to 2 in the class constructor to generate a + * double-sized tree trunk for big trees. + */ int trunkSize = 1; - /** Sets the limit of the random value used to initialize the height limit. */ + /** + * Sets the limit of the random value used to initialize the height limit. + */ int heightLimitLimit = 12; - /** Sets the distance limit for how far away the generator will populate leaves from the base leaf node. */ + /** + * Sets the distance limit for how far away the generator will populate leaves + * from the base leaf node. + */ int leafDistanceLimit = 4; - /** Contains a list of a points at which to generate groups of leaves. */ + /** + * Contains a list of a points at which to generate groups of leaves. + */ int[][] leafNodes; - private final Block log, leaves; private int leafMeta = 0; - public WorldGenMFTree(boolean update, Block log, Block leaves) - { + public WorldGenMFTree(boolean update, Block log, Block leaves) { super(update); this.log = log; this.leaves = leaves; - if(log == BlockListMF.log_ironbark) - { - leafDistanceLimit = 2; + if (log == BlockListMF.log_ironbark) { + leafDistanceLimit = 2; } - heightLimitLimit = log == BlockListMF.log_ebony ? 10 : 8; + heightLimitLimit = log == BlockListMF.log_ebony ? 10 : 8; } - public WorldGenMFTree setSaplingGrown() - { - leafMeta = 1; - return this; + + public WorldGenMFTree setSaplingGrown() { + leafMeta = 1; + return this; } - public WorldGenMFTree setLimits(int height, int leaf) - { - heightLimitLimit = height; - leafDistanceLimit = leaf; - return this; + + public WorldGenMFTree setLimits(int height, int leaf) { + heightLimitLimit = height; + leafDistanceLimit = leaf; + return this; } /** - * Generates a list of leaf nodes for the tree, to be populated by generateLeaves. + * Generates a list of leaf nodes for the tree, to be populated by + * generateLeaves. */ - void generateLeafNodeList() - { - this.height = (int)((double)this.heightLimit * this.heightAttenuation); + void generateLeafNodeList() { + this.height = (int) (this.heightLimit * this.heightAttenuation); - if (this.height >= this.heightLimit) - { + if (this.height >= this.heightLimit) { this.height = this.heightLimit - 1; } - int i = (int)(1.382D + Math.pow(this.leafDensity * (double)this.heightLimit / 13.0D, 2.0D)); + int i = (int) (1.382D + Math.pow(this.leafDensity * this.heightLimit / 13.0D, 2.0D)); - if (i < 1) - { + if (i < 1) { i = 1; } @@ -94,44 +99,35 @@ void generateLeafNodeList() aint[0][3] = l; --j; - while (i1 >= 0) - { + while (i1 >= 0) { int j1 = 0; float f = this.layerSize(i1); - if (f < 0.0F) - { + if (f < 0.0F) { --j; --i1; - } - else - { - for (double d0 = 0.5D; j1 < i; ++j1) - { - double d1 = this.scaleWidth * (double)f * ((double)this.rand.nextFloat() + 0.328D); - double d2 = (double)this.rand.nextFloat() * 2.0D * Math.PI; - int k1 = MathHelper.floor_double(d1 * Math.sin(d2) + (double)this.basePos[0] + d0); - int l1 = MathHelper.floor_double(d1 * Math.cos(d2) + (double)this.basePos[2] + d0); - int[] aint1 = new int[] {k1, j, l1}; - int[] aint2 = new int[] {k1, j + this.leafDistanceLimit, l1}; - - if (this.checkBlockLine(aint1, aint2) == -1) - { - int[] aint3 = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; - double d3 = Math.sqrt(Math.pow((double)Math.abs(this.basePos[0] - aint1[0]), 2.0D) + Math.pow((double)Math.abs(this.basePos[2] - aint1[2]), 2.0D)); + } else { + for (double d0 = 0.5D; j1 < i; ++j1) { + double d1 = this.scaleWidth * f * (worldObj.rand.nextFloat() + 0.328D); + double d2 = worldObj.rand.nextFloat() * 2.0D * Math.PI; + int k1 = MathHelper.floor_double(d1 * Math.sin(d2) + this.basePos[0] + d0); + int l1 = MathHelper.floor_double(d1 * Math.cos(d2) + this.basePos[2] + d0); + int[] aint1 = new int[]{k1, j, l1}; + int[] aint2 = new int[]{k1, j + this.leafDistanceLimit, l1}; + + if (this.checkBlockLine(aint1, aint2) == -1) { + int[] aint3 = new int[]{this.basePos[0], this.basePos[1], this.basePos[2]}; + double d3 = Math.sqrt(Math.pow(Math.abs(this.basePos[0] - aint1[0]), 2.0D) + + Math.pow(Math.abs(this.basePos[2] - aint1[2]), 2.0D)); double d4 = d3 * this.branchSlope; - if ((double)aint1[1] - d4 > (double)l) - { + if (aint1[1] - d4 > l) { aint3[1] = l; - } - else - { - aint3[1] = (int)((double)aint1[1] - d4); + } else { + aint3[1] = (int) (aint1[1] - d4); } - if (this.checkBlockLine(aint3, aint1) == -1) - { + if (this.checkBlockLine(aint3, aint1) == -1) { aint[k][0] = k1; aint[k][1] = j; aint[k][2] = l1; @@ -150,40 +146,32 @@ void generateLeafNodeList() System.arraycopy(aint, 0, this.leafNodes, 0, k); } - void generateLeaf(int x, int y, int z, float f, byte b, Block block) - { - int l = (int)((double)f + 0.618D); + void generateLeaf(int x, int y, int z, float f, byte b, Block block) { + int l = (int) (f + 0.618D); byte b1 = otherCoordPairs[b]; byte b2 = otherCoordPairs[b + 3]; - int[] aint = new int[] {x, y, z}; - int[] aint1 = new int[] {0, 0, 0}; + int[] aint = new int[]{x, y, z}; + int[] aint1 = new int[]{0, 0, 0}; int i1 = -l; int j1 = -l; - for (aint1[b] = aint[b]; i1 <= l; ++i1) - { + for (aint1[b] = aint[b]; i1 <= l; ++i1) { aint1[b1] = aint[b1] + i1; j1 = -l; - while (j1 <= l) - { - double d0 = Math.pow((double)Math.abs(i1) + 0.5D, 2.0D) + Math.pow((double)Math.abs(j1) + 0.5D, 2.0D); + while (j1 <= l) { + double d0 = Math.pow(Math.abs(i1) + 0.5D, 2.0D) + Math.pow(Math.abs(j1) + 0.5D, 2.0D); - if (d0 > (double)(f * f)) - { + if (d0 > f * f) { ++j1; - } - else - { + } else { aint1[b2] = aint[b2] + j1; Block block1 = this.worldObj.getBlock(aint1[0], aint1[1], aint1[2]); - if (!block1.isAir(worldObj, aint1[0], aint1[1], aint1[2]) && !block1.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) - { + if (!block1.isAir(worldObj, aint1[0], aint1[1], aint1[2]) + && !block1.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) { ++j1; - } - else - { + } else { this.setBlockAndNotifyAdequately(this.worldObj, aint1[0], aint1[1], aint1[2], block, leafMeta); ++j1; } @@ -195,29 +183,20 @@ void generateLeaf(int x, int y, int z, float f, byte b, Block block) /** * Gets the rough size of a layer of the tree. */ - float layerSize(int layer) - { - if ((double)layer < (double)((float)this.heightLimit) * 0.3D) - { + float layerSize(int layer) { + if (layer < (this.heightLimit) * 0.3D) { return -1.618F; - } - else - { - float f = (float)this.heightLimit / 2.0F; - float f1 = (float)this.heightLimit / 2.0F - (float)layer; + } else { + float f = this.heightLimit / 2.0F; + float f1 = this.heightLimit / 2.0F - layer; float f2; - if (f1 == 0.0F) - { + if (f1 == 0.0F) { f2 = f; - } - else if (Math.abs(f1) >= f) - { + } else if (Math.abs(f1) >= f) { f2 = 0.0F; - } - else - { - f2 = (float)Math.sqrt(Math.pow((double)Math.abs(f), 2.0D) - Math.pow((double)Math.abs(f1), 2.0D)); + } else { + f2 = (float) Math.sqrt(Math.pow(Math.abs(f), 2.0D) - Math.pow(Math.abs(f1), 2.0D)); } f2 *= 0.5F; @@ -225,79 +204,66 @@ else if (Math.abs(f1) >= f) } } - float leafSize(int layer) - { - return layer >= 0 && layer < this.leafDistanceLimit ? (layer != 0 && layer != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; + float leafSize(int layer) { + return layer >= 0 && layer < this.leafDistanceLimit + ? (layer != 0 && layer != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) + : -1.0F; } /** * Generates the leaves surrounding an individual entry in the leafNodes list. */ - void generateLeafNode(int x, int y, int z) - { + void generateLeafNode(int x, int y, int z) { int l = y; - for (int i1 = y + this.leafDistanceLimit; l < i1; ++l) - { + for (int i1 = y + this.leafDistanceLimit; l < i1; ++l) { float f = this.leafSize(l - y); - this.generateLeaf(x, l, z, f, (byte)1, this.leaves); + this.generateLeaf(x, l, z, f, (byte) 1, this.leaves); } } - void func_150530_a(int[] x, int[] y, Block block) - { - int[] aint2 = new int[] {0, 0, 0}; + void func_150530_a(int[] x, int[] y, Block block) { + int[] aint2 = new int[]{0, 0, 0}; byte b0 = 0; byte b1; - for (b1 = 0; b0 < 3; ++b0) - { + for (b1 = 0; b0 < 3; ++b0) { aint2[b0] = y[b0] - x[b0]; - if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) - { + if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) { b1 = b0; } } - if (aint2[b1] != 0) - { + if (aint2[b1] != 0) { byte b2 = otherCoordPairs[b1]; byte b3 = otherCoordPairs[b1 + 3]; byte b4; - if (aint2[b1] > 0) - { + if (aint2[b1] > 0) { b4 = 1; - } - else - { + } else { b4 = -1; } - double d0 = (double)aint2[b2] / (double)aint2[b1]; - double d1 = (double)aint2[b3] / (double)aint2[b1]; - int[] aint3 = new int[] {0, 0, 0}; + double d0 = (double) aint2[b2] / (double) aint2[b1]; + double d1 = (double) aint2[b3] / (double) aint2[b1]; + int[] aint3 = new int[]{0, 0, 0}; int i = 0; - for (int j = aint2[b1] + b4; i != j; i += b4) - { - aint3[b1] = MathHelper.floor_double((double)(x[b1] + i) + 0.5D); - aint3[b2] = MathHelper.floor_double((double)x[b2] + (double)i * d0 + 0.5D); - aint3[b3] = MathHelper.floor_double((double)x[b3] + (double)i * d1 + 0.5D); + for (int j = aint2[b1] + b4; i != j; i += b4) { + aint3[b1] = MathHelper.floor_double(x[b1] + i + 0.5D); + aint3[b2] = MathHelper.floor_double(x[b2] + i * d0 + 0.5D); + aint3[b3] = MathHelper.floor_double(x[b3] + i * d1 + 0.5D); byte b5 = 0; int k = Math.abs(aint3[0] - x[0]); int l = Math.abs(aint3[2] - x[2]); int i1 = Math.max(k, l); - if (i1 > 0) - { - if (k == i1) - { + if (i1 > 0) { + if (k == i1) { b5 = 4; - } - else if (l == i1) - { + } else if (l == i1) { b5 = 8; } } @@ -310,12 +276,10 @@ else if (l == i1) /** * Generates the leaf portion of the tree as specified by the leafNodes list. */ - void generateLeaves() - { + void generateLeaves() { int i = 0; - for (int j = this.leafNodes.length; i < j; ++i) - { + for (int j = this.leafNodes.length; i < j; ++i) { int k = this.leafNodes[i][0]; int l = this.leafNodes[i][1]; int i1 = this.leafNodes[i][2]; @@ -324,29 +288,27 @@ void generateLeaves() } /** - * Indicates whether or not a leaf node requires additional wood to be added to preserve integrity. + * Indicates whether or not a leaf node requires additional wood to be added to + * preserve integrity. */ - boolean leafNodeNeedsBase(int p_76493_1_) - { - return (double)p_76493_1_ >= (double)this.heightLimit * 0.2D; + boolean leafNodeNeedsBase(int p_76493_1_) { + return p_76493_1_ >= this.heightLimit * 0.2D; } /** - * Places the trunk for the big tree that is being generated. Able to generate double-sized trunks by changing a - * field that is always 1 to 2. + * Places the trunk for the big tree that is being generated. Able to generate + * double-sized trunks by changing a field that is always 1 to 2. */ - void generateTrunk() - { + void generateTrunk() { int i = this.basePos[0]; int j = this.basePos[1]; int k = this.basePos[1] + this.height; int l = this.basePos[2]; - int[] aint = new int[] {i, j, l}; - int[] aint1 = new int[] {i, k, l}; + int[] aint = new int[]{i, j, l}; + int[] aint1 = new int[]{i, k, l}; this.func_150530_a(aint, aint1, this.log); - if (this.trunkSize == 2) - { + if (this.trunkSize == 2) { ++aint[0]; ++aint1[0]; this.func_150530_a(aint, aint1, this.log); @@ -360,81 +322,69 @@ void generateTrunk() } /** - * Generates additional wood blocks to fill out the bases of different leaf nodes that would otherwise degrade. + * Generates additional wood blocks to fill out the bases of different leaf + * nodes that would otherwise degrade. */ - void generateLeafNodeBases() - { + void generateLeafNodeBases() { int i = 0; int j = this.leafNodes.length; - for (int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; i < j; ++i) - { + for (int[] aint = new int[]{this.basePos[0], this.basePos[1], this.basePos[2]}; i < j; ++i) { int[] aint1 = this.leafNodes[i]; - int[] aint2 = new int[] {aint1[0], aint1[1], aint1[2]}; + int[] aint2 = new int[]{aint1[0], aint1[1], aint1[2]}; aint[1] = aint1[3]; int k = aint[1] - this.basePos[1]; - if (this.leafNodeNeedsBase(k)) - { + if (this.leafNodeNeedsBase(k)) { this.func_150530_a(aint, aint2, this.log); } } } /** - * Checks a line of blocks in the world from the first coordinate to triplet to the second, returning the distance - * (in blocks) before a non-air, non-leaf block is encountered and/or the end is encountered. + * Checks a line of blocks in the world from the first coordinate to triplet to + * the second, returning the distance (in blocks) before a non-air, non-leaf + * block is encountered and/or the end is encountered. */ - int checkBlockLine(int[] p_76496_1_, int[] p_76496_2_) - { - int[] aint2 = new int[] {0, 0, 0}; + int checkBlockLine(int[] p_76496_1_, int[] p_76496_2_) { + int[] aint2 = new int[]{0, 0, 0}; byte b0 = 0; byte b1; - for (b1 = 0; b0 < 3; ++b0) - { + for (b1 = 0; b0 < 3; ++b0) { aint2[b0] = p_76496_2_[b0] - p_76496_1_[b0]; - if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) - { + if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) { b1 = b0; } } - if (aint2[b1] == 0) - { + if (aint2[b1] == 0) { return -1; - } - else - { + } else { byte b2 = otherCoordPairs[b1]; byte b3 = otherCoordPairs[b1 + 3]; byte b4; - if (aint2[b1] > 0) - { + if (aint2[b1] > 0) { b4 = 1; - } - else - { + } else { b4 = -1; } - double d0 = (double)aint2[b2] / (double)aint2[b1]; - double d1 = (double)aint2[b3] / (double)aint2[b1]; - int[] aint3 = new int[] {0, 0, 0}; + double d0 = (double) aint2[b2] / (double) aint2[b1]; + double d1 = (double) aint2[b3] / (double) aint2[b1]; + int[] aint3 = new int[]{0, 0, 0}; int i = 0; int j; - for (j = aint2[b1] + b4; i != j; i += b4) - { + for (j = aint2[b1] + b4; i != j; i += b4) { aint3[b1] = p_76496_1_[b1] + i; - aint3[b2] = MathHelper.floor_double((double)p_76496_1_[b2] + (double)i * d0); - aint3[b3] = MathHelper.floor_double((double)p_76496_1_[b3] + (double)i * d1); + aint3[b2] = MathHelper.floor_double(p_76496_1_[b2] + i * d0); + aint3[b3] = MathHelper.floor_double(p_76496_1_[b3] + i * d1); Block block = this.worldObj.getBlock(aint3[0], aint3[1], aint3[2]); - if (!this.isReplaceable(worldObj, aint3[0], aint3[1], aint3[2])) - { + if (!this.isReplaceable(worldObj, aint3[0], aint3[1], aint3[2])) { break; } } @@ -444,34 +394,26 @@ int checkBlockLine(int[] p_76496_1_, int[] p_76496_2_) } /** - * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height - * limit, is valid. + * Returns a boolean indicating whether or not the current location for the + * tree, spanning basePos to to the height limit, is valid. */ - boolean validTreeLocation() - { - int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; - int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; + boolean validTreeLocation() { + int[] aint = new int[]{this.basePos[0], this.basePos[1], this.basePos[2]}; + int[] aint1 = new int[]{this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); - boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling); - if (!isSoil) - { + boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, + (BlockSapling) Blocks.sapling); + if (!isSoil) { return false; - } - else - { + } else { int i = this.checkBlockLine(aint, aint1); - if (i == -1) - { + if (i == -1) { return true; - } - else if (i < 6) - { + } else if (i < 6) { return false; - } - else - { + } else { this.heightLimit = i; return true; } @@ -481,12 +423,10 @@ else if (i < 6) /** * Rescales the generator settings, only used in WorldGenBigTree */ - public void setScale(double p_76487_1_, double p_76487_3_, double p_76487_5_) - { - this.heightLimitLimit = (int)(p_76487_1_ * 12.0D); + public void setScale(double p_76487_1_, double p_76487_3_, double p_76487_5_) { + this.heightLimitLimit = (int) (p_76487_1_ * 12.0D); - if (p_76487_1_ > 0.5D) - { + if (p_76487_1_ > 0.5D) { this.leafDistanceLimit = 5; } @@ -494,33 +434,28 @@ public void setScale(double p_76487_1_, double p_76487_3_, double p_76487_5_) this.leafDensity = p_76487_5_; } - 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) { this.worldObj = world; long l = rand.nextLong(); - this.rand.setSeed(l); + world.rand.setSeed(l); this.basePos[0] = x; this.basePos[1] = y; this.basePos[2] = z; - if (this.heightLimit == 0) - { - this.heightLimit = 5 + this.rand.nextInt(this.heightLimitLimit); + if (this.heightLimit == 0) { + this.heightLimit = 5 + world.rand.nextInt(this.heightLimitLimit); } - if (!this.validTreeLocation()) - { - this.worldObj = null; //Fix vanilla Mem leak, holds latest world + if (!this.validTreeLocation()) { + this.worldObj = null; // Fix vanilla Mem leak, holds latest world return false; - } - else - { + } else { this.generateLeafNodeList(); this.generateLeaves(); this.generateTrunk(); this.generateLeafNodeBases(); worldObj.setBlock(x, y, z, log, 15, 2); - this.worldObj = null; //Fix vanilla Mem leak, holds latest world + this.worldObj = null; // Fix vanilla Mem leak, holds latest world return true; } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMinableMF.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMinableMF.java index e9f166ba..e5c8bbff 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMinableMF.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenMinableMF.java @@ -1,46 +1,43 @@ package minefantasy.mf2.mechanics.worldGen; -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public class WorldGenMinableMF extends WorldGenerator -{ +import java.util.Random; + +public class WorldGenMinableMF extends WorldGenerator { + private static final String __OBFID = "CL_00000426"; private Block oreBlock; - /** The number of blocks to generate. */ + /** + * The number of blocks to generate. + */ private int numberOfBlocks; private Block beddingBlock; - private static final String __OBFID = "CL_00000426"; private int mineableBlockMeta; - public WorldGenMinableMF(Block ore, int size) - { + public WorldGenMinableMF(Block ore, int size) { this(ore, size, Blocks.stone); } - public WorldGenMinableMF(Block ore, int size, Block bed) - { + public WorldGenMinableMF(Block ore, int size, Block bed) { this.oreBlock = ore; this.numberOfBlocks = size; this.beddingBlock = bed; } - public WorldGenMinableMF(Block block, int meta, int number, Block target) - { + public WorldGenMinableMF(Block block, int meta, int number, Block target) { this(block, number, target); this.mineableBlockMeta = meta; } @Override - public boolean generate(World world, Random seed, int x, int y, int z) - { - boolean success = false; - - float f = seed.nextFloat() * (float)Math.PI; + public boolean generate(World world, Random seed, int x, int y, int z) { + boolean success = false; + + float f = seed.nextFloat() * (float) Math.PI; double d0 = x + 8 + MathHelper.sin(f) * this.numberOfBlocks / 8.0F; double d1 = x + 8 - MathHelper.sin(f) * this.numberOfBlocks / 8.0F; double d2 = z + 8 + MathHelper.cos(f) * this.numberOfBlocks / 8.0F; @@ -48,14 +45,13 @@ public boolean generate(World world, Random seed, int x, int y, int z) double d4 = y + seed.nextInt(3) - 2; double d5 = y + seed.nextInt(3) - 2; - for (int l = 0; l <= this.numberOfBlocks; ++l) - { + for (int l = 0; l <= this.numberOfBlocks; ++l) { double d6 = d0 + (d1 - d0) * l / this.numberOfBlocks; double d7 = d4 + (d5 - d4) * l / this.numberOfBlocks; double d8 = d2 + (d3 - d2) * l / this.numberOfBlocks; double d9 = seed.nextDouble() * this.numberOfBlocks / 16.0D; - double d10 = (MathHelper.sin(l * (float)Math.PI / this.numberOfBlocks) + 1.0F) * d9 + 1.0D; - double d11 = (MathHelper.sin(l * (float)Math.PI / this.numberOfBlocks) + 1.0F) * d9 + 1.0D; + double d10 = (MathHelper.sin(l * (float) Math.PI / this.numberOfBlocks) + 1.0F) * d9 + 1.0D; + double d11 = (MathHelper.sin(l * (float) Math.PI / 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); @@ -63,25 +59,20 @@ public boolean generate(World world, Random seed, int x, int y, int z) int i2 = MathHelper.floor_double(d7 + d11 / 2.0D); int j2 = MathHelper.floor_double(d8 + d10 / 2.0D); - for (int oreX = i1; oreX <= l1; ++oreX) - { + for (int oreX = i1; oreX <= l1; ++oreX) { double d12 = (oreX + 0.5D - d6) / (d10 / 2.0D); - if (d12 * d12 < 1.0D) - { - for (int oreY = j1; oreY <= i2; ++oreY) - { + if (d12 * d12 < 1.0D) { + for (int oreY = j1; oreY <= i2; ++oreY) { double d13 = (oreY + 0.5D - d7) / (d11 / 2.0D); - if (d12 * d12 + d13 * d13 < 1.0D) - { - for (int oreZ = k1; oreZ <= j2; ++oreZ) - { + if (d12 * d12 + d13 * d13 < 1.0D) { + for (int oreZ = k1; oreZ <= j2; ++oreZ) { double d14 = (oreZ + 0.5D - d8) / (d10 / 2.0D); - if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlock(oreX, oreY, oreZ).isReplaceableOreGen(world, oreX, oreY, oreZ, beddingBlock)) - { - success = true; + if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlock(oreX, oreY, oreZ) + .isReplaceableOreGen(world, oreX, oreY, oreZ, beddingBlock)) { + success = true; world.setBlock(oreX, oreY, oreZ, this.oreBlock, mineableBlockMeta, 2); } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenStructures.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenStructures.java index 471a9b9a..c678aa58 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenStructures.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/WorldGenStructures.java @@ -1,7 +1,5 @@ package minefantasy.mf2.mechanics.worldGen; -import java.util.Random; - import minefantasy.mf2.config.ConfigWorldGen; import minefantasy.mf2.mechanics.worldGen.structure.WorldGenAncientAlter; import minefantasy.mf2.mechanics.worldGen.structure.WorldGenAncientForge; @@ -10,129 +8,113 @@ import net.minecraft.init.Blocks; import net.minecraft.world.World; -public class WorldGenStructures -{ - public static void generate(Random seed, int chunkX, int chunkZ, World world, int dimension) - { - ++chunkCount; - if(dimension == 0) - { - if(seed.nextFloat() < ConfigWorldGen.MFChance) - { - generateAncientForge(seed, chunkX, chunkZ, world); - } - if(seed.nextFloat() < ConfigWorldGen.MAChance) - { - generateAncientAlter(seed, chunkX, chunkZ, world); - } - if(confineToGrid(chunkX, chunkZ, ConfigWorldGen.DSGrid)) - { - if(seed.nextFloat() < ConfigWorldGen.DSChance) - { - generateDwarvenStronghold(seed, chunkX, chunkZ, world); - } - else - { - //placeGridBeacon(world, chunkX, chunkZ); - } - } - } - } - /** - * Used in testing to determine the potential areas for dwarven entries - */ - private static void placeGridBeacon(World world, int chunkX, int chunkZ) - { - int x = (16*chunkX); - int z = (16*chunkZ); - int y = world.getTopSolidOrLiquidBlock(x, z)+1; - for(int x1 = 0; x1 < 3; x1 ++) - { - for(int z1 = 0; z1 < 3; z1 ++) - { - world.setBlock(x+x1, y, z+z1, (x == 0 && z == 0) ? Blocks.gold_block : Blocks.iron_block); - } - } - world.setBlock(x+1, y+1, z+1, Blocks.beacon); - } - private static boolean confineToGrid( int chunkX, int chunkZ, int chunkSize) - { - return chunkX % chunkSize == 0 && chunkZ % chunkSize == 0; - } - private static void generateAncientForge(Random seed, int chunkX, int chunkZ, World world) - { - int x = (16*chunkX); - int z = (16*chunkZ); - WorldGenAncientForge forge = new WorldGenAncientForge(); - for(int x1 = 0; x1 < 16; x1++) - { - for(int z1 = 0; z1 < 16; z1++) - { - if(forge.generate(world, seed, x+x1, 0, z+z1)) - { - MFLogUtil.logDebug("Placed Ancient Forge at " + x+x1 + " " + z+z1); - return; - } - } - } - forge = null; - } - private static int strongholdCount, chunkCount; - private static void generateDwarvenStronghold(Random seed, int chunkX, int chunkZ, World world) - { - int x = (16*chunkX); - int z = (16*chunkZ); - WorldGenDwarvenStronghold stronghold = new WorldGenDwarvenStronghold(); - for(int x1 = 0; x1 < 16; x1++) - { - for(int z1 = 0; z1 < 16; z1++) - { - if(stronghold.generate(world, seed, x+x1, 0, z+z1)) - { - ++strongholdCount; - MFLogUtil.logDebug("Placed Dwarven Stronghold in wall at " + x+x1 + " " + z+z1); - String s = "Gen: " + strongholdCount + " Strongholds in " + chunkCount + " Chunks = " + ((float)strongholdCount/(float)chunkCount*100F)+ "% cases"; - System.out.println(s); - return; - } - } - } - stronghold.setSurfaceMode(true); - int x1 = seed.nextInt(16); - int z1 = seed.nextInt(16); - if(stronghold.generate(world, seed, x+x1, 0, z+z1)) - { - ++strongholdCount; - MFLogUtil.logDebug("Placed Dwarven Stronghold on ground at " + x+x1 + " " + z+z1); - String s = "Gen: " + strongholdCount + " Strongholds in " + chunkCount + " Chunks = " + ((float)strongholdCount/(float)chunkCount*100F)+ "% cases"; - System.out.println(s); - return; - } - stronghold = null; - } - private static void generateAncientAlter(Random seed, int chunkX, int chunkZ, World world) - { - int spawnZ = world.getSpawnPoint().posZ; - int spawnChunkZ = (int)( (float)spawnZ/16F); - - if(chunkZ == spawnChunkZ) - { - int x = (16*chunkX); - int z = (16*chunkZ); - - WorldGenAncientAlter ruin = new WorldGenAncientAlter(); - for(int x1 = 0; x1 < 16; x1++) - { - //for(int z1 = 0; z1 < 16; z1++) - { - if(ruin.generate(world, seed, x+x1, 0, spawnZ)) - { - MFLogUtil.logDebug("Placed Ancient Alter at " + x+x1 + " " + spawnZ); - return; - } - } - } - ruin = null; - } - } +import java.util.Random; + +public class WorldGenStructures { + private static int strongholdCount, chunkCount; + + public static void generate(Random seed, int chunkX, int chunkZ, World world, int dimension) { + ++chunkCount; + if (dimension == 0) { + if (seed.nextFloat() < ConfigWorldGen.MFChance) { + generateAncientForge(seed, chunkX, chunkZ, world); + } + if (seed.nextFloat() < ConfigWorldGen.MAChance) { + generateAncientAlter(seed, chunkX, chunkZ, world); + } + if (confineToGrid(chunkX, chunkZ, ConfigWorldGen.DSGrid)) { + if (seed.nextFloat() < ConfigWorldGen.DSChance) { + generateDwarvenStronghold(seed, chunkX, chunkZ, world); + } else { + // placeGridBeacon(world, chunkX, chunkZ); + } + } + } + } + + /** + * Used in testing to determine the potential areas for dwarven entries + */ + private static void placeGridBeacon(World world, int chunkX, int chunkZ) { + int x = (16 * chunkX); + int z = (16 * chunkZ); + int y = world.getTopSolidOrLiquidBlock(x, z) + 1; + for (int x1 = 0; x1 < 3; x1++) { + for (int z1 = 0; z1 < 3; z1++) { + world.setBlock(x + x1, y, z + z1, (x == 0 && z == 0) ? Blocks.gold_block : Blocks.iron_block); + } + } + world.setBlock(x + 1, y + 1, z + 1, Blocks.beacon); + } + + private static boolean confineToGrid(int chunkX, int chunkZ, int chunkSize) { + return chunkX % chunkSize == 0 && chunkZ % chunkSize == 0; + } + + private static void generateAncientForge(Random seed, int chunkX, int chunkZ, World world) { + int x = (16 * chunkX); + int z = (16 * chunkZ); + WorldGenAncientForge forge = new WorldGenAncientForge(); + for (int x1 = 0; x1 < 16; x1++) { + for (int z1 = 0; z1 < 16; z1++) { + if (forge.generate(world, seed, x + x1, 0, z + z1)) { + MFLogUtil.logDebug("Placed Ancient Forge at " + x + x1 + " " + z + z1); + return; + } + } + } + forge = null; + } + + private static void generateDwarvenStronghold(Random seed, int chunkX, int chunkZ, World world) { + int x = (16 * chunkX); + int z = (16 * chunkZ); + WorldGenDwarvenStronghold stronghold = new WorldGenDwarvenStronghold(); + for (int x1 = 0; x1 < 16; x1++) { + for (int z1 = 0; z1 < 16; z1++) { + if (stronghold.generate(world, seed, x + x1, 0, z + z1)) { + ++strongholdCount; + MFLogUtil.logDebug("Placed Dwarven Stronghold in wall at " + x + x1 + " " + z + z1); + String s = "Gen: " + strongholdCount + " Strongholds in " + chunkCount + " Chunks = " + + ((float) strongholdCount / (float) chunkCount * 100F) + "% cases"; + System.out.println(s); + return; + } + } + } + stronghold.setSurfaceMode(true); + int x1 = seed.nextInt(16); + int z1 = seed.nextInt(16); + if (stronghold.generate(world, seed, x + x1, 0, z + z1)) { + ++strongholdCount; + MFLogUtil.logDebug("Placed Dwarven Stronghold on ground at " + x + x1 + " " + z + z1); + String s = "Gen: " + strongholdCount + " Strongholds in " + chunkCount + " Chunks = " + + ((float) strongholdCount / (float) chunkCount * 100F) + "% cases"; + System.out.println(s); + return; + } + stronghold = null; + } + + private static void generateAncientAlter(Random seed, int chunkX, int chunkZ, World world) { + int spawnZ = world.getSpawnPoint().posZ; + int spawnChunkZ = (int) (spawnZ / 16F); + + if (chunkZ == spawnChunkZ) { + int x = (16 * chunkX); + int z = (16 * chunkZ); + + WorldGenAncientAlter ruin = new WorldGenAncientAlter(); + for (int x1 = 0; x1 < 16; x1++) { + // for(int z1 = 0; z1 < 16; z1++) + { + if (ruin.generate(world, seed, x + x1, 0, spawnZ)) { + MFLogUtil.logDebug("Placed Ancient Alter at " + x + x1 + " " + spawnZ); + return; + } + } + } + ruin = null; + } + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/LootTypes.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/LootTypes.java index e1ab5037..2711bf88 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/LootTypes.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/LootTypes.java @@ -1,10 +1,10 @@ package minefantasy.mf2.mechanics.worldGen.structure; public class LootTypes { - public static final String DWARVEN_ARMOURY = "DwarvenArmoury"; - public static final String DWARVEN_AMMO = "DwarvenAmmo"; - public static final String DWARVEN_FORGE = "DwarvenForge"; - public static final String DWARVEN_HOME = "DwarvenHouse"; - public static final String DWARVEN_HOME_RICH = "DwarvenHouseRich"; - public static final String DWARVEN_STUDY = "DwarvenStudy"; + public static final String DWARVEN_ARMOURY = "DwarvenArmoury"; + public static final String DWARVEN_AMMO = "DwarvenAmmo"; + public static final String DWARVEN_FORGE = "DwarvenForge"; + public static final String DWARVEN_HOME = "DwarvenHouse"; + public static final String DWARVEN_HOME_RICH = "DwarvenHouseRich"; + public static final String DWARVEN_STUDY = "DwarvenStudy"; } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAFRoom.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAFRoom.java index 7b7c1a41..0255bcc5 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAFRoom.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAFRoom.java @@ -1,124 +1,103 @@ package minefantasy.mf2.mechanics.worldGen.structure; -import net.minecraftforge.common.ChestGenHooks; - -import java.util.Random; - import minefantasy.mf2.item.list.ComponentListMF; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -import net.minecraftforge.common.DungeonHooks; -public class StructureGenAFRoom extends StructureModuleMF -{ - private Random rand = new Random(); - public StructureGenAFRoom(World world, int x, int y, int z, int d) - { - super(world, x, y, z, d); - } - public StructureGenAFRoom(World world, StructureCoordinates position) - { - super(world, position); - } +public class StructureGenAFRoom extends StructureModuleMF { + + private String lootType = ChestGenHooks.DUNGEON_CHEST; + private boolean hasTrinket = false; + + public StructureGenAFRoom(World world, int x, int y, int z, int d) { + super(world, x, y, z, d); + } + + public StructureGenAFRoom(World world, StructureCoordinates position) { + super(world, position); + } - @Override - public void generate() { - int width = 7; - int depth = 6; - //FLOOR - for(int x = -width/2; x <= width/2; x ++) - { - for(int z = 0; z <= depth; z ++) - { - placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, 0, z); - } - } - - //CEIL - for(int x = -width/2; x <= width/2; x ++) - { - for(int z = 0; z <= depth; z ++) - { - placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, 5, z); - } - } - //INT - for (int x = -width / 2; x <= width / 2; x++) - { - for (int z = 0; z <= depth; z++) - { - for (int y = 1; y <= 4; y++) - { - placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, y, z); - } - } - } - //HOLLOW - for (int x = (-width / 2)+1; x <= (width / 2)-1; x++) - { - for (int z = 1; z <= depth-1; z++) - { - for (int y = 1; y <= 4; y++) - { - placeBlock(Blocks.air, 0, x, y, z); - } - } - } - - //CHEST - { - int x = 0; - int y = 0; - int z = depth/2; - - placeChest(0, 1, depth-1, lootType); - placeSpawner(0, 1, z, "Silverfish"); - - for(int x2 = -1; x2 <= 1; x2++) - { - placeBlock(Blocks.air, 0, x2, 1, 0); - placeBlock(Blocks.air, 0, x2, 2, 0); - } - placeBlock(Blocks.air, 0, 0, 3, 0); - - } - } - - private void placeChest(int x, int y, int z, String loot) - { - int[] coords = this.offsetPos(x, y, z, direction); - worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.chest, direction, 2); - TileEntityChest tileentitychest = (TileEntityChest)worldObj.getTileEntity(coords[0], coords[1], coords[2]); + @Override + public void generate() { + int width = 7; + int depth = 6; + // FLOOR + for (int x = -width / 2; x <= width / 2; x++) { + for (int z = 0; z <= depth; z++) { + placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, 0, z); + } + } + + // CEIL + for (int x = -width / 2; x <= width / 2; x++) { + for (int z = 0; z <= depth; z++) { + placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, 5, z); + } + } + // INT + for (int x = -width / 2; x <= width / 2; x++) { + for (int z = 0; z <= depth; z++) { + for (int y = 1; y <= 4; y++) { + placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, y, z); + } + } + } + // HOLLOW + for (int x = (-width / 2) + 1; x <= (width / 2) - 1; x++) { + for (int z = 1; z <= depth - 1; z++) { + for (int y = 1; y <= 4; y++) { + placeBlock(Blocks.air, 0, x, y, z); + } + } + } - if (tileentitychest != null) + // CHEST { - WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tileentitychest, ChestGenHooks.getCount(loot, rand)); - if(hasTrinket) - { - //North = -z, South = +z - int sp = worldObj.getSpawnPoint().posZ; - int item = (coords[2] < sp) ? 1 : 0; - int artId = rand.nextInt(tileentitychest.getSizeInventory()); - tileentitychest.setInventorySlotContents(artId, new ItemStack(ComponentListMF.artefacts, 1, item)); + int x = 0; + int y = 0; + int z = depth / 2; + + placeChest(0, 1, depth - 1, lootType); + placeSpawner(0, 1, z, "Silverfish"); + + for (int x2 = -1; x2 <= 1; x2++) { + placeBlock(Blocks.air, 0, x2, 1, 0); + placeBlock(Blocks.air, 0, x2, 2, 0); + } + placeBlock(Blocks.air, 0, 0, 3, 0); + + } + } + + private void placeChest(int x, int y, int z, String loot) { + int[] coords = this.offsetPos(x, y, z, direction); + worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.chest, direction, 2); + TileEntityChest tileentitychest = (TileEntityChest) worldObj.getTileEntity(coords[0], coords[1], coords[2]); + + if (tileentitychest != null) { + WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tileentitychest, + ChestGenHooks.getCount(loot, rand)); + if (hasTrinket) { + // North = -z, South = +z + int sp = worldObj.getSpawnPoint().posZ; + int item = (coords[2] < sp) ? 1 : 0; + int artId = rand.nextInt(tileentitychest.getSizeInventory()); + tileentitychest.setInventorySlotContents(artId, new ItemStack(ComponentListMF.artefacts, 1, item)); } } - } - - private String lootType = ChestGenHooks.DUNGEON_CHEST; - public StructureModuleMF setLoot(String loot) - { - this.lootType = loot; - return this; - } - private boolean hasTrinket = false; - public StructureModuleMF giveTrinket() - { - hasTrinket = true; - return this; - } + } + + public StructureModuleMF setLoot(String loot) { + this.lootType = loot; + return this; + } + + public StructureModuleMF giveTrinket() { + hasTrinket = true; + return this; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientAlter.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientAlter.java index 6201d0ce..cbdc3664 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientAlter.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientAlter.java @@ -1,120 +1,113 @@ package minefantasy.mf2.mechanics.worldGen.structure; -import net.minecraftforge.common.ChestGenHooks; - -import java.util.Random; - import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -import net.minecraftforge.common.DungeonHooks; - -public class StructureGenAncientAlter extends StructureModuleMF -{ - public StructureGenAncientAlter(World world, int x, int y, int z, int d) - { - super(world, x, y, z, d); - } - StructureGenAncientAlter(World world, StructureCoordinates position) - { - super(world, position); - } - @Override - public void generate() - { - int radius = 2; - //FLOOR - for(int x = -radius; x <= radius; x ++) - { - for(int z = -radius; z <= radius; z ++) - { - placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, 0, z); - - Object[] array = getFoundation(radius, x, z); - if(array != null) - { - int m = (Boolean)array[1] ? -1 : 0; - buildFoundation((Block)array[0], m, x, -1, z, 32, 3, false); - } - } - } - for(int p = -1; p <= 1; p++) - { - placeBlock(Blocks.stone_brick_stairs, 0, -radius, 0, p, 0); - placeBlock(Blocks.stone_brick_stairs, 1, radius, 0, p, 0); - placeBlock(Blocks.stone_brick_stairs, 2, p, 0, -radius, 0); - placeBlock(Blocks.stone_brick_stairs, 3, p, 0, radius, 0); - } - placeBlock(BlockListMF.mythic_decor, 1, -radius, 0, -radius); - placeBlock(BlockListMF.mythic_decor, 1, radius, 0, -radius); - placeBlock(BlockListMF.mythic_decor, 1, -radius, 0, radius); - placeBlock(BlockListMF.mythic_decor, 1, radius, 0, radius); - - placeBlock(BlockListMF.mythic_decor, 0, -radius, 1, -radius); - placeBlock(BlockListMF.mythic_decor, 0, radius, 1, -radius); - placeBlock(BlockListMF.mythic_decor, 0, -radius, 1, radius); - placeBlock(BlockListMF.mythic_decor, 0, radius, 1, radius); - - placeBlock(BlockListMF.mythic_decor, 1, -radius, 2, -radius); - placeBlock(BlockListMF.mythic_decor, 1, radius, 2, -radius); - placeBlock(BlockListMF.mythic_decor, 1, -radius, 2, radius); - placeBlock(BlockListMF.mythic_decor, 1, radius, 2, radius); - - //CHEST - { - int x = 0; - int y = 0; - int z = 0; - - placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, y+1, z); - placeChest(0, y+2, z, lootType); - placeSpawner(0, y, z, "Enderman"); - } - - } - - private Object[] getFoundation(int radius, int x, int z) - { - if(x == -radius && z == -radius)return null; - if(x == radius && z == -radius)return null; - if(x == -radius && z == radius)return null; - if(x == radius && z == radius)return null; - - if(x == 0 && z == -radius)return new Object[]{Blocks.obsidian, false}; - if(x == 0 && z == radius)return new Object[]{Blocks.obsidian, false}; - if(x == -radius && z == 0)return new Object[]{Blocks.obsidian, false}; - if(x == radius && z == 0)return new Object[]{Blocks.obsidian, false}; - - return new Object[]{Blocks.stonebrick, true}; - } - - private void placeChest(int x, int y, int z, String loot) - { - int[] coords = this.offsetPos(x, y, z, direction); - worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.chest, direction, 2); - TileEntityChest tileentitychest = (TileEntityChest)worldObj.getTileEntity(coords[0], coords[1], coords[2]); - - if (tileentitychest != null) + +public class StructureGenAncientAlter extends StructureModuleMF { + private String lootType = ChestGenHooks.DUNGEON_CHEST; + + public StructureGenAncientAlter(World world, int x, int y, int z, int d) { + super(world, x, y, z, d); + } + + StructureGenAncientAlter(World world, StructureCoordinates position) { + super(world, position); + } + + @Override + public void generate() { + int radius = 2; + // FLOOR + for (int x = -radius; x <= radius; x++) { + for (int z = -radius; z <= radius; z++) { + placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, 0, z); + + Object[] array = getFoundation(radius, x, z); + if (array != null) { + int m = (Boolean) array[1] ? -1 : 0; + buildFoundation((Block) array[0], m, x, -1, z, 32, 3, false); + } + } + } + for (int p = -1; p <= 1; p++) { + placeBlock(Blocks.stone_brick_stairs, 0, -radius, 0, p, 0); + placeBlock(Blocks.stone_brick_stairs, 1, radius, 0, p, 0); + placeBlock(Blocks.stone_brick_stairs, 2, p, 0, -radius, 0); + placeBlock(Blocks.stone_brick_stairs, 3, p, 0, radius, 0); + } + placeBlock(BlockListMF.mythic_decor, 1, -radius, 0, -radius); + placeBlock(BlockListMF.mythic_decor, 1, radius, 0, -radius); + placeBlock(BlockListMF.mythic_decor, 1, -radius, 0, radius); + placeBlock(BlockListMF.mythic_decor, 1, radius, 0, radius); + + placeBlock(BlockListMF.mythic_decor, 0, -radius, 1, -radius); + placeBlock(BlockListMF.mythic_decor, 0, radius, 1, -radius); + placeBlock(BlockListMF.mythic_decor, 0, -radius, 1, radius); + placeBlock(BlockListMF.mythic_decor, 0, radius, 1, radius); + + placeBlock(BlockListMF.mythic_decor, 1, -radius, 2, -radius); + placeBlock(BlockListMF.mythic_decor, 1, radius, 2, -radius); + placeBlock(BlockListMF.mythic_decor, 1, -radius, 2, radius); + placeBlock(BlockListMF.mythic_decor, 1, radius, 2, radius); + + // CHEST { - WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tileentitychest, ChestGenHooks.getCount(loot, rand)); - - int artId = rand.nextInt(tileentitychest.getSizeInventory()); - tileentitychest.setInventorySlotContents(artId, new ItemStack(ComponentListMF.artefacts, 1, 2)); + int x = 0; + int y = 0; + int z = 0; + + placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, y + 1, z); + placeChest(0, y + 2, z, lootType); + placeSpawner(0, y, z, "Enderman"); } - } - - private String lootType = ChestGenHooks.DUNGEON_CHEST; - public StructureModuleMF setLoot(String loot) - { - this.lootType = loot; - return this; - } + + } + + private Object[] getFoundation(int radius, int x, int z) { + if (x == -radius && z == -radius) + return null; + if (x == radius && z == -radius) + return null; + if (x == -radius && z == radius) + return null; + if (x == radius && z == radius) + return null; + + if (x == 0 && z == -radius) + return new Object[]{Blocks.obsidian, false}; + if (x == 0 && z == radius) + return new Object[]{Blocks.obsidian, false}; + if (x == -radius && z == 0) + return new Object[]{Blocks.obsidian, false}; + if (x == radius && z == 0) + return new Object[]{Blocks.obsidian, false}; + + return new Object[]{Blocks.stonebrick, true}; + } + + private void placeChest(int x, int y, int z, String loot) { + int[] coords = this.offsetPos(x, y, z, direction); + worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.chest, direction, 2); + TileEntityChest tileentitychest = (TileEntityChest) worldObj.getTileEntity(coords[0], coords[1], coords[2]); + + if (tileentitychest != null) { + WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tileentitychest, + ChestGenHooks.getCount(loot, rand)); + + int artId = rand.nextInt(tileentitychest.getSizeInventory()); + tileentitychest.setInventorySlotContents(artId, new ItemStack(ComponentListMF.artefacts, 1, 2)); + } + } + + public StructureModuleMF setLoot(String loot) { + this.lootType = loot; + return this; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientForge.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientForge.java index 1e2088c9..f902a8e9 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientForge.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientForge.java @@ -1,183 +1,154 @@ package minefantasy.mf2.mechanics.worldGen.structure; - -import java.util.Random; - import minefantasy.mf2.block.list.BlockListMF; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class StructureGenAncientForge extends StructureModuleMF -{ - private Random rand = new Random(); - public StructureGenAncientForge(World world, int x, int y, int z, int d) { - super(world, x, y, z, d); - } - public StructureGenAncientForge(World world, StructureCoordinates position) - { - super(world, position); - } - @Override - public void generate() - { - placeBlock(Blocks.stonebrick, getRandomMetadata(rand), 0, 0, -1); - - int width = 14; - int depth = 16; - //FLOOR - for(int x = -width/2; x <= width/2; x ++) - { - for(int z = 0; z <= depth; z ++) - { - placeBlock(Blocks.stonebrick, getRandomMetadata(rand), x, 0, z); - } - } - - //CEIL - for(int x = -width/2; x <= width/2; x ++) - { - for(int z = 0; z <= depth; z ++) - { - placeBlock(Blocks.stonebrick, getRandomMetadata(rand), x, 5, z); - } - } - //WALLS - for (int x = -width / 2; x <= width / 2; x++) { - for (int z = 0; z <= depth; z++) { - for (int y = 1; y <= 4; y++) - { - placeBlock(Blocks.stonebrick, getRandomMetadata(rand), x, y, z); - } - } - } - //INTERIOR - for (int x = (-width / 2)+1; x <= (width / 2)-1; x++) - { - for (int z = 1; z <= depth-1; z++) - { - for (int y = 1; y <= 4; y++) - { - if(x % 4 != 0 || z % 4 != 0) - placeBlock(Blocks.air, 0, x, y, z); - } - } - } - - //OBSIDIAN - for (int x = -3; x <= 3; x++) { - for (int z = 5; z <= 11; z++) - { - for (int y = -3; y <= 0; y++) - { - placeBlock(y == 0 ? BlockListMF.mythic_decor : Blocks.obsidian, 0, x, y, z); - } - } - } - //HOLLOW - for (int x = -2; x <= 2; x++) - { - for (int z = 6; z <= 10; z++) - { - for (int y = -2; y <= 0; y++) - { - placeBlock(Blocks.air, 0, x, y, z); - } - } - } - //LAVA - for (int x = -2; x <= 2; x++) - { - for (int z = 6; z <= 10; z++) - { - placeBlock(Blocks.lava, 0, x, -2, z); - } - } - placeBlock(Blocks.air, 0, 0, 2, depth/2); - placeBlock(Blocks.air, 0, 0, 3, depth/2); - placeBlock(Blocks.air, 0, 0, 4, depth/2); - - placeBlock(BlockListMF.mythic_decor, 1, -3, 0, depth/2); - placeBlock(BlockListMF.mythic_decor, 1, +3, 0, depth/2); - placeBlock(BlockListMF.mythic_decor, 1, 0, 0, depth/2+3); - placeBlock(BlockListMF.mythic_decor, 1, 0, 0, depth/2-3); - - placeBlock(BlockListMF.mythic_decor, 1, -3, 0, depth/2-3); - placeBlock(BlockListMF.mythic_decor, 1, -3, 0, depth/2+3); - placeBlock(BlockListMF.mythic_decor, 1, +3, 0, depth/2-3); - placeBlock(BlockListMF.mythic_decor, 1, +3, 0, depth/2+3); - - placeBlock(Blocks.obsidian, 0, 0, 0, depth/2); - placeBlock(Blocks.obsidian, 0, 0, 0, depth / 2 - 1); - placeBlock(Blocks.obsidian, 0, 0, 0, depth / 2 - 2); - - placeBlock(BlockListMF.cruciblemythic, 0, 0, 1, depth/2); - placeBlock(Blocks.end_portal_frame, 0, 3, 0, depth/2-1); - placeBlock(Blocks.end_portal_frame, 0, -3, 0, depth/2-1); - placeBlock(Blocks.end_portal_frame, 0, -1, 0, depth/2+3); - placeBlock(Blocks.end_portal_frame, 0, -1, 0, depth/2-3); - - placeBlock(Blocks.end_portal_frame, 0, 3, 0, depth/2+1); - placeBlock(Blocks.end_portal_frame, 0, -3, 0, depth/2+1); - placeBlock(Blocks.end_portal_frame, 0, 1, 0, depth/2+3); - placeBlock(Blocks.end_portal_frame, 0, 1, 0, depth/2-3); - - - for(int y = 0; y < 4; y ++) - { - placeBlock(Blocks.air, 0, 0, y+1, depth/2-4); - } - placeBlock(Blocks.glowstone, 0, 0, 5, depth/2); - placeBlock(Blocks.air, 0, 0, 1, 0); - placeBlock(Blocks.air, 0, 0, 2, 0); - - getRandomForge(0, 0, depth, direction).generate(); - - getRandomForge(width/2, 0, depth/2, rotateLeft()).generate(); - getRandomForge(-width/2, 0, depth/2, rotateRight()).generate(); - - } - - private StructureModuleMF getRandomForge(int x, int y, int z, int newDirection) - { - int[] coord = this.offsetPos(x, y, z, direction); - StructureGenAFRoom room = new StructureGenAFRoom(worldObj, coord[0], coord[1], coord[2], newDirection); - - if(newDirection == direction) - { - room.giveTrinket(); - } - room.setLoot(getRandomLoot()); - - return room; - } - - private String getRandomLoot() - { - int i = rand.nextInt(3); - if(i == 0) - { - return rand.nextBoolean() ? ChestGenHooks.STRONGHOLD_CORRIDOR : ChestGenHooks.STRONGHOLD_CROSSING; - } - if(i == 1) - { - return rand.nextBoolean() ? ChestGenHooks.PYRAMID_DESERT_CHEST : ChestGenHooks.PYRAMID_JUNGLE_CHEST; - } - return ChestGenHooks.DUNGEON_CHEST; - } - - public static int getRandomMetadata(Random RNG) - { +import java.util.Random; + +public class StructureGenAncientForge extends StructureModuleMF { + public StructureGenAncientForge(World world, int x, int y, int z, int d) { + super(world, x, y, z, d); + } + + public StructureGenAncientForge(World world, StructureCoordinates position) { + super(world, position); + } + + public static int getRandomMetadata(Random RNG) { float f = RNG.nextFloat(); - if (f < 0.2F) - { + if (f < 0.2F) { return 2; - } - else if (f < 0.5F) - { - return 1; + } else if (f < 0.5F) { + return 1; } return 0; - } + } + + @Override + public void generate() { + placeBlock(Blocks.stonebrick, getRandomMetadata(rand), 0, 0, -1); + + int width = 14; + int depth = 16; + // FLOOR + for (int x = -width / 2; x <= width / 2; x++) { + for (int z = 0; z <= depth; z++) { + placeBlock(Blocks.stonebrick, getRandomMetadata(rand), x, 0, z); + } + } + + // CEIL + for (int x = -width / 2; x <= width / 2; x++) { + for (int z = 0; z <= depth; z++) { + placeBlock(Blocks.stonebrick, getRandomMetadata(rand), x, 5, z); + } + } + // WALLS + for (int x = -width / 2; x <= width / 2; x++) { + for (int z = 0; z <= depth; z++) { + for (int y = 1; y <= 4; y++) { + placeBlock(Blocks.stonebrick, getRandomMetadata(rand), x, y, z); + } + } + } + // INTERIOR + for (int x = (-width / 2) + 1; x <= (width / 2) - 1; x++) { + for (int z = 1; z <= depth - 1; z++) { + for (int y = 1; y <= 4; y++) { + if (x % 4 != 0 || z % 4 != 0) + placeBlock(Blocks.air, 0, x, y, z); + } + } + } + + // OBSIDIAN + for (int x = -3; x <= 3; x++) { + for (int z = 5; z <= 11; z++) { + for (int y = -3; y <= 0; y++) { + placeBlock(y == 0 ? BlockListMF.mythic_decor : Blocks.obsidian, 0, x, y, z); + } + } + } + // HOLLOW + for (int x = -2; x <= 2; x++) { + for (int z = 6; z <= 10; z++) { + for (int y = -2; y <= 0; y++) { + placeBlock(Blocks.air, 0, x, y, z); + } + } + } + // LAVA + for (int x = -2; x <= 2; x++) { + for (int z = 6; z <= 10; z++) { + placeBlock(Blocks.lava, 0, x, -2, z); + } + } + placeBlock(Blocks.air, 0, 0, 2, depth / 2); + placeBlock(Blocks.air, 0, 0, 3, depth / 2); + placeBlock(Blocks.air, 0, 0, 4, depth / 2); + + placeBlock(BlockListMF.mythic_decor, 1, -3, 0, depth / 2); + placeBlock(BlockListMF.mythic_decor, 1, +3, 0, depth / 2); + placeBlock(BlockListMF.mythic_decor, 1, 0, 0, depth / 2 + 3); + placeBlock(BlockListMF.mythic_decor, 1, 0, 0, depth / 2 - 3); + + placeBlock(BlockListMF.mythic_decor, 1, -3, 0, depth / 2 - 3); + placeBlock(BlockListMF.mythic_decor, 1, -3, 0, depth / 2 + 3); + placeBlock(BlockListMF.mythic_decor, 1, +3, 0, depth / 2 - 3); + placeBlock(BlockListMF.mythic_decor, 1, +3, 0, depth / 2 + 3); + + placeBlock(Blocks.obsidian, 0, 0, 0, depth / 2); + placeBlock(Blocks.obsidian, 0, 0, 0, depth / 2 - 1); + placeBlock(Blocks.obsidian, 0, 0, 0, depth / 2 - 2); + + placeBlock(BlockListMF.cruciblemythic, 0, 0, 1, depth / 2); + placeBlock(Blocks.end_portal_frame, 0, 3, 0, depth / 2 - 1); + placeBlock(Blocks.end_portal_frame, 0, -3, 0, depth / 2 - 1); + placeBlock(Blocks.end_portal_frame, 0, -1, 0, depth / 2 + 3); + placeBlock(Blocks.end_portal_frame, 0, -1, 0, depth / 2 - 3); + + placeBlock(Blocks.end_portal_frame, 0, 3, 0, depth / 2 + 1); + placeBlock(Blocks.end_portal_frame, 0, -3, 0, depth / 2 + 1); + placeBlock(Blocks.end_portal_frame, 0, 1, 0, depth / 2 + 3); + placeBlock(Blocks.end_portal_frame, 0, 1, 0, depth / 2 - 3); + + for (int y = 0; y < 4; y++) { + placeBlock(Blocks.air, 0, 0, y + 1, depth / 2 - 4); + } + placeBlock(Blocks.glowstone, 0, 0, 5, depth / 2); + placeBlock(Blocks.air, 0, 0, 1, 0); + placeBlock(Blocks.air, 0, 0, 2, 0); + + getRandomForge(0, 0, depth, direction).generate(); + + getRandomForge(width / 2, 0, depth / 2, rotateLeft()).generate(); + getRandomForge(-width / 2, 0, depth / 2, rotateRight()).generate(); + + } + + private StructureModuleMF getRandomForge(int x, int y, int z, int newDirection) { + int[] coord = this.offsetPos(x, y, z, direction); + StructureGenAFRoom room = new StructureGenAFRoom(worldObj, coord[0], coord[1], coord[2], newDirection); + + if (newDirection == direction) { + room.giveTrinket(); + } + room.setLoot(getRandomLoot()); + + return room; + } + + private String getRandomLoot() { + int i = rand.nextInt(3); + if (i == 0) { + return rand.nextBoolean() ? ChestGenHooks.STRONGHOLD_CORRIDOR : ChestGenHooks.STRONGHOLD_CROSSING; + } + if (i == 1) { + return rand.nextBoolean() ? ChestGenHooks.PYRAMID_DESERT_CHEST : ChestGenHooks.PYRAMID_JUNGLE_CHEST; + } + return ChestGenHooks.DUNGEON_CHEST; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientForgeEntry.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientForgeEntry.java index 98d77c71..e67eaa3d 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientForgeEntry.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureGenAncientForgeEntry.java @@ -1,62 +1,52 @@ package minefantasy.mf2.mechanics.worldGen.structure; -import java.util.Random; - import net.minecraft.init.Blocks; import net.minecraft.world.World; -public class StructureGenAncientForgeEntry extends StructureModuleMF -{ - - private Random rand = new Random(); - - public StructureGenAncientForgeEntry(World world, int x, int y, int z, int d) - { - super(world, x, y, z, d); - } - public StructureGenAncientForgeEntry(World world, StructureCoordinates position) - { - super(world, position); - } - - @Override - public void generate() - { - //Stairway - int length = 8 + rand.nextInt(8); - if(yCoord > 48) length += (yCoord-48); - for(int d = 1; d <= length; d ++) - { - for(int w = 0; w < 3; w ++) - { - for(int h = 0; h < 6; h ++) - { - if(d != 1 || h != 5) - placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), -1+w, -d+h-1, d+1); - } - } - - for(int h = 0; h < 4; h ++) - placeBlock(Blocks.air, 0, 0, -d+h, d+1); - placeBlock(Blocks.stone_brick_stairs, getStairDirection(reverse()), 0, -d, d+1); - } - placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), 0, 2, 2); - for(int x = -1; x <= 1; x ++) - { - for(int y = -1; y <= 5; y ++) - { - placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, y-3, 1); - } - } - placeBlock(Blocks.air, 0, 0, 0, 1); - placeBlock(Blocks.air, 0, 0, 1, 1); - - int[] coord = offsetPos(0, -length+1, length+1, direction); - int x = coord[0]; - int y = coord[1]; - int z = coord[2]; - - StructureModuleMF structure = new StructureGenAncientForge(worldObj, x, y, z, direction); - structure.generate(); - } +public class StructureGenAncientForgeEntry extends StructureModuleMF { + + public StructureGenAncientForgeEntry(World world, int x, int y, int z, int d) { + super(world, x, y, z, d); + } + + public StructureGenAncientForgeEntry(World world, StructureCoordinates position) { + super(world, position); + } + + @Override + public void generate() { + // Stairway + int length = 8 + rand.nextInt(8); + if (yCoord > 48) + length += (yCoord - 48); + for (int d = 1; d <= length; d++) { + for (int w = 0; w < 3; w++) { + for (int h = 0; h < 6; h++) { + if (d != 1 || h != 5) + placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), -1 + w, + -d + h - 1, d + 1); + } + } + + for (int h = 0; h < 4; h++) + placeBlock(Blocks.air, 0, 0, -d + h, d + 1); + placeBlock(Blocks.stone_brick_stairs, getStairDirection(reverse()), 0, -d, d + 1); + } + placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), 0, 2, 2); + for (int x = -1; x <= 1; x++) { + for (int y = -1; y <= 5; y++) { + placeBlock(Blocks.stonebrick, StructureGenAncientForge.getRandomMetadata(rand), x, y - 3, 1); + } + } + placeBlock(Blocks.air, 0, 0, 0, 1); + placeBlock(Blocks.air, 0, 0, 1, 1); + + int[] coord = offsetPos(0, -length + 1, length + 1, direction); + int x = coord[0]; + int y = coord[1]; + int z = coord[2]; + + StructureModuleMF structure = new StructureGenAncientForge(worldObj, x, y, z, direction); + structure.generate(); + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureModuleMF.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureModuleMF.java index 77765e88..671346b4 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureModuleMF.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/StructureModuleMF.java @@ -1,9 +1,8 @@ package minefantasy.mf2.mechanics.worldGen.structure; -import java.util.Random; - import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.block.tileentity.TileEntityWorldGenMarker; +import minefantasy.mf2.util.XSTRandom; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; @@ -13,380 +12,349 @@ import net.minecraft.world.World; import net.minecraftforge.common.DungeonHooks; -public abstract class StructureModuleMF -{ - public final int xCoord; - public final int yCoord; - public final int zCoord; - /** - * (0-3) South, West, North, East - */ - public final int direction; - public final World worldObj; - protected Random rand = new Random(); - /** - * How much longer can units be added - */ - public int lengthId; - /** - * How many more branches can be added - */ - public int deviationCount; - protected String subtype = "Normal"; - - public StructureModuleMF(World world, StructureCoordinates position) - { - worldObj = world; - xCoord = position.posX; - yCoord = position.posY; - zCoord = position.posZ; - direction = position.direction; - - } - public StructureModuleMF(World world, int x, int y, int z, int d) - { - this(world, new StructureCoordinates(x, y, z, d)); - } - public StructureModuleMF(World world, int x, int y, int z) - { - this(world, x, y, z, 0); - } - - public abstract void generate(); - - public boolean canGenerate() - { - return true; - } - public int rotateLeft() - { - switch(direction) - { - case 0: - return 3; - case 1: - return 0; - case 2: - return 1; - case 3: - return 2; - } - return 0; - } - - public int rotateRight() - { - switch(direction) - { - case 0: - return 1; - case 1: - return 2; - case 2: - return 3; - case 3: - return 0; - } - return 0; - } - - public int reverse() - { - switch(direction) - { - case 0: - return 2; - case 1: - return 3; - case 2: - return 0; - case 3: - return 1; - } - return 0; - } - /** - * Places a block and rotates it on it's base direction for pregen - * designed not to override the worldGen marker - * @param id The blockID - * @param meta the block metadata - * @param x The x offset(relation to xCoord) - * @param y The y offset(relation to yCoord) - * @param z The z offset(relation to zCoord) - */ - public void pregenPlaceBlock(Block id, int meta, int x, int y, int z) - { - if(! (x == 0 && y== 0 && z == 0)) - { - placeBlock(id, meta, x, y, z, direction); - } - } - /** - * Places a block and rotates it on it's base direction - * @param id The blockID - * @param meta the block metadata - * @param x The x offset(relation to xCoord) - * @param y The y offset(relation to yCoord) - * @param z The z offset(relation to zCoord) - */ - public void placeBlock(Block id, int meta, int x, int y, int z) - { - placeBlock(id, meta, x, y, z, direction); - } - - /** - * Places a block and rotates it on direction - * @param id The blockID - * @param meta the block metadata - * @param xo The x offset(relation to xCoord) - * @param yo The y offset(relation to yCoord) - * @param zo The z offset(relation to zCoord) - * @param dir The direction to face - */ - public void placeBlock(Block id, int meta, int xo, int yo, int zo, int dir) - { - int[] offset = offsetPos(xo, yo, zo, dir); - worldObj.setBlock(offset[0], offset[1], offset[2], id, meta, 2); - } - - public void placeBlockIfAir(Block id, int meta, int xo, int yo, int zo) - { - int[] offset = offsetPos(xo, yo, zo, direction); - if(worldObj.getBlock(offset[0], offset[1], offset[2]).isReplaceable(worldObj, offset[0], offset[1], offset[2])) - { - worldObj.setBlock(offset[0], offset[1], offset[2], id, meta, 2); - } - } - - public void placeEntity(Entity entity, int x, int y, int z) - { - placeEntity(entity, x, y, z, direction); - } - public void placeEntity(Entity entity, int xo, int yo, int zo, int dir) - { - int[] offset = offsetPos(xo, yo, zo, dir); - entity.setLocationAndAngles(offset[0]+0.5D, offset[1]+entity.height-1.0F, offset[2]+0.5D, MathHelper.wrapAngleTo180_float(worldObj.rand.nextFloat() * 360.0F), 0.0F); - worldObj.spawnEntityInWorld(entity); - } - - protected void buildFoundation(Block block, int meta, int x, int z) - { - buildFoundation(block, meta, x, -1, z, 32, 0, false); - } - /** - * Builds a foundation column from -1y - * @param block The block used - * @param meta metadata used - * @param x the relative x position - * @param y the relative y position to start - * @param z the relative z position - * @param max the max depth - * @param penetrance how many solid blocks can it pass through - * @param relative whether or not it must be stopped by concecutive blocks. - */ - protected void buildFoundation(Block block, int meta, int x, int y, int z, int max, int penetrance, boolean relative) - { - penetrance -= y; - int init_penetrance = penetrance; - while(-y < max) - { - Block current = getBlock(x, y, z, direction); - boolean empty = current.getMaterial().isReplaceable(); - - if(isUnbreakable(x, y, z, direction)) - { - return; - } - if(!empty) - { - -- penetrance; - } - else if(!relative) - { - penetrance = init_penetrance; - } - - if(empty || penetrance >= 0) - { - placeBlock(block, meta == -1 ? StructureGenAncientForge.getRandomMetadata(rand) : meta, x, y, z); - --y; - } - else - { - return; - } - } - } - - public TileEntity getTileEntity(int xo, int yo, int zo, int dir) - { - int[] offset = offsetPos(xo, yo, zo, dir); - return worldObj.getTileEntity(offset[0], offset[1], offset[2]); - } - - public Block getBlock(int x, int y, int z) - { - return getBlock(x, y, z, direction); - } - public Block getBlock(int xo, int yo, int zo, int dir) - { - int[] offset = offsetPos(xo, yo, zo, dir); - return worldObj.getBlock(offset[0], offset[1], offset[2]); - } - public boolean isUnbreakable(int xo, int yo, int zo, int dir) - { - return getHardness(xo, yo, zo, dir) < 0; - } - public float getHardness(int xo, int yo, int zo, int dir) - { - int[] offset = offsetPos(xo, yo, zo, dir); - return worldObj.getBlock(offset[0], offset[1], offset[2]).getBlockHardness(worldObj, offset[0], offset[1], offset[2]); - } - - public void notifyBlock(Block id, int xo, int yo, int zo, int dir) - { - int[] offset = offsetPos(xo, yo, zo, dir); - worldObj.notifyBlockChange(offset[0], offset[1], offset[2], id); - } - - public int[] offsetPos(int xo, int yo, int zo, int dir) - { - int u = 2; - int x = xCoord; - int y = yCoord+yo; - int z = zCoord; - - switch(dir) - { - case 0://NORTH - x += xo; - z += zo; - break; - - case 1://EAST - x -= zo; - z += xo; - break; - - case 2://SOUTH - x -= xo; - z -= zo; - break; - - case 3://WEST - x += zo; - z -= xo; - break; - } - - - return new int[]{x, y, z}; - } - protected void mapStructure(int x, int y, int z, Class piece) - { - mapStructure(x, y, z, direction, piece); - } - protected void mapStructure(int x, int y, int z, int dir, Class piece) - { - mapStructure(x, y, z, dir, piece, 0); - } - protected void mapStructure(int x, int y, int z, int dir, Class piece, int delay) - { - int[] offset = offsetPos(x, y, z, this.direction); - - Block block = worldObj.getBlock(offset[0], offset[1], offset[2]); - int meta = worldObj.getBlockMetadata(offset[0], offset[1], offset[2]); - - worldObj.setBlock(offset[0], offset[1], offset[2], BlockListMF.WG_Mark, dir, 2); - TileEntity tile = worldObj.getTileEntity(offset[0], offset[1], offset[2]); - if(tile != null && tile instanceof TileEntityWorldGenMarker) - { - ((TileEntityWorldGenMarker)tile).className = piece.getName(); - ((TileEntityWorldGenMarker)tile).length = lengthId - 1; - ((TileEntityWorldGenMarker)tile).deviation = deviationCount; - ((TileEntityWorldGenMarker)tile).prevID = Block.getIdFromBlock(block); - ((TileEntityWorldGenMarker)tile).prevMeta = meta; - ((TileEntityWorldGenMarker)tile).ticks -= delay; - ((TileEntityWorldGenMarker)tile).type = this.subtype; - } - block = null; - } - - - public static void placeStructure(String classname, String subtype, int lengthID, int deviation, World world, int x, int y, int z, int dir) - { - try - { +public abstract class StructureModuleMF { + public final int xCoord; + public final int yCoord; + public final int zCoord; + /** + * (0-3) South, West, North, East + */ + public final int direction; + public final World worldObj; + /** + * How much longer can units be added + */ + public int lengthId; + /** + * How many more branches can be added + */ + public int deviationCount; + protected XSTRandom rand = new XSTRandom(); + protected String subtype = "Normal"; + + public StructureModuleMF(World world, StructureCoordinates position) { + worldObj = world; + xCoord = position.posX; + yCoord = position.posY; + zCoord = position.posZ; + direction = position.direction; + + } + + public StructureModuleMF(World world, int x, int y, int z, int d) { + this(world, new StructureCoordinates(x, y, z, d)); + } + + public StructureModuleMF(World world, int x, int y, int z) { + this(world, x, y, z, 0); + } + + public static void placeStructure(String classname, String subtype, int lengthID, int deviation, World world, int x, + int y, int z, int dir) { + try { Class oclass = Class.forName(classname); - if (oclass != null) - { - StructureModuleMF module = (StructureModuleMF)oclass.getConstructor(new Class[] {World.class, StructureCoordinates.class}).newInstance(world, new StructureCoordinates(x, y, z, dir)); - - if(module != null) - { - module.subtype = subtype; - module.lengthId = lengthID; - module.deviationCount = deviation; - if(module.canGenerate()) - { - module.generate(); - } - } + if (oclass != null) { + StructureModuleMF module = (StructureModuleMF) oclass + .getConstructor(new Class[]{World.class, StructureCoordinates.class}) + .newInstance(world, new StructureCoordinates(x, y, z, dir)); + + if (module != null) { + module.subtype = subtype; + module.lengthId = lengthID; + module.deviationCount = deviation; + if (module.canGenerate()) { + module.generate(); + } + } } - } - catch (Exception exception) - { + } catch (Exception exception) { exception.printStackTrace(); } - } - protected int getStairDirection(int d) - { - switch (d) { - case 0: - return 2; - - case 1: - return 1; - - case 2: - return 3; - - case 3: - return 0; - - } - return 0; - } - - public static class StructureCoordinates - { - public final int posX, posY, posZ, direction; - public StructureCoordinates(int x, int y, int z, int direction) - { - this.posX = x; - this.posY = y; - this.posZ = z; - this.direction = direction; - } - } - - public void placeSpawner(int x, int y, int z) - { - placeSpawner(x, y, z, DungeonHooks.getRandomDungeonMob(rand)); - } - public void placeSpawner(int x, int y, int z, String mob) - { - this.placeBlock(Blocks.mob_spawner, 0, x, y, z); - TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)getTileEntity(x, y, z, direction); - - if (tileentitymobspawner != null) - { + } + + public abstract void generate(); + + public boolean canGenerate() { + return true; + } + + public int rotateLeft() { + switch (direction) { + case 0: + return 3; + case 1: + return 0; + case 2: + return 1; + case 3: + return 2; + } + return 0; + } + + public int rotateRight() { + switch (direction) { + case 0: + return 1; + case 1: + return 2; + case 2: + return 3; + case 3: + return 0; + } + return 0; + } + + public int reverse() { + switch (direction) { + case 0: + return 2; + case 1: + return 3; + case 2: + return 0; + case 3: + return 1; + } + return 0; + } + + /** + * Places a block and rotates it on it's base direction for pregen designed not + * to override the worldGen marker + * + * @param id The blockID + * @param meta the block metadata + * @param x The x offset(relation to xCoord) + * @param y The y offset(relation to yCoord) + * @param z The z offset(relation to zCoord) + */ + public void pregenPlaceBlock(Block id, int meta, int x, int y, int z) { + if (!(x == 0 && y == 0 && z == 0)) { + placeBlock(id, meta, x, y, z, direction); + } + } + + /** + * Places a block and rotates it on it's base direction + * + * @param id The blockID + * @param meta the block metadata + * @param x The x offset(relation to xCoord) + * @param y The y offset(relation to yCoord) + * @param z The z offset(relation to zCoord) + */ + public void placeBlock(Block id, int meta, int x, int y, int z) { + placeBlock(id, meta, x, y, z, direction); + } + + /** + * Places a block and rotates it on direction + * + * @param id The blockID + * @param meta the block metadata + * @param xo The x offset(relation to xCoord) + * @param yo The y offset(relation to yCoord) + * @param zo The z offset(relation to zCoord) + * @param dir The direction to face + */ + public void placeBlock(Block id, int meta, int xo, int yo, int zo, int dir) { + int[] offset = offsetPos(xo, yo, zo, dir); + worldObj.setBlock(offset[0], offset[1], offset[2], id, meta, 2); + } + + public void placeBlockIfAir(Block id, int meta, int xo, int yo, int zo) { + int[] offset = offsetPos(xo, yo, zo, direction); + if (worldObj.getBlock(offset[0], offset[1], offset[2]).isReplaceable(worldObj, offset[0], offset[1], + offset[2])) { + worldObj.setBlock(offset[0], offset[1], offset[2], id, meta, 2); + } + } + + public void placeEntity(Entity entity, int x, int y, int z) { + placeEntity(entity, x, y, z, direction); + } + + public void placeEntity(Entity entity, int xo, int yo, int zo, int dir) { + int[] offset = offsetPos(xo, yo, zo, dir); + entity.setLocationAndAngles(offset[0] + 0.5D, offset[1] + entity.height - 1.0F, offset[2] + 0.5D, + MathHelper.wrapAngleTo180_float(worldObj.rand.nextFloat() * 360.0F), 0.0F); + worldObj.spawnEntityInWorld(entity); + } + + protected void buildFoundation(Block block, int meta, int x, int z) { + buildFoundation(block, meta, x, -1, z, 32, 0, false); + } + + /** + * Builds a foundation column from -1y + * + * @param block The block used + * @param meta metadata used + * @param x the relative x position + * @param y the relative y position to start + * @param z the relative z position + * @param max the max depth + * @param penetrance how many solid blocks can it pass through + * @param relative whether or not it must be stopped by concecutive blocks. + */ + protected void buildFoundation(Block block, int meta, int x, int y, int z, int max, int penetrance, + boolean relative) { + penetrance -= y; + int init_penetrance = penetrance; + while (-y < max) { + Block current = getBlock(x, y, z, direction); + boolean empty = current.getMaterial().isReplaceable(); + + if (isUnbreakable(x, y, z, direction)) { + return; + } + if (!empty) { + --penetrance; + } else if (!relative) { + penetrance = init_penetrance; + } + + if (empty || penetrance >= 0) { + placeBlock(block, meta == -1 ? StructureGenAncientForge.getRandomMetadata(rand) : meta, x, y, z); + --y; + } else { + return; + } + } + } + + public TileEntity getTileEntity(int xo, int yo, int zo, int dir) { + int[] offset = offsetPos(xo, yo, zo, dir); + return worldObj.getTileEntity(offset[0], offset[1], offset[2]); + } + + public Block getBlock(int x, int y, int z) { + return getBlock(x, y, z, direction); + } + + public Block getBlock(int xo, int yo, int zo, int dir) { + int[] offset = offsetPos(xo, yo, zo, dir); + return worldObj.getBlock(offset[0], offset[1], offset[2]); + } + + public boolean isUnbreakable(int xo, int yo, int zo, int dir) { + return getHardness(xo, yo, zo, dir) < 0; + } + + public float getHardness(int xo, int yo, int zo, int dir) { + int[] offset = offsetPos(xo, yo, zo, dir); + return worldObj.getBlock(offset[0], offset[1], offset[2]).getBlockHardness(worldObj, offset[0], offset[1], + offset[2]); + } + + public void notifyBlock(Block id, int xo, int yo, int zo, int dir) { + int[] offset = offsetPos(xo, yo, zo, dir); + worldObj.notifyBlockChange(offset[0], offset[1], offset[2], id); + } + + public int[] offsetPos(int xo, int yo, int zo, int dir) { + int u = 2; + int x = xCoord; + int y = yCoord + yo; + int z = zCoord; + + switch (dir) { + case 0:// NORTH + x += xo; + z += zo; + break; + + case 1:// EAST + x -= zo; + z += xo; + break; + + case 2:// SOUTH + x -= xo; + z -= zo; + break; + + case 3:// WEST + x += zo; + z -= xo; + break; + } + + return new int[]{x, y, z}; + } + + protected void mapStructure(int x, int y, int z, Class piece) { + mapStructure(x, y, z, direction, piece); + } + + protected void mapStructure(int x, int y, int z, int dir, Class piece) { + mapStructure(x, y, z, dir, piece, 0); + } + + protected void mapStructure(int x, int y, int z, int dir, Class piece, int delay) { + int[] offset = offsetPos(x, y, z, this.direction); + + Block block = worldObj.getBlock(offset[0], offset[1], offset[2]); + int meta = worldObj.getBlockMetadata(offset[0], offset[1], offset[2]); + + worldObj.setBlock(offset[0], offset[1], offset[2], BlockListMF.WG_Mark, dir, 2); + TileEntity tile = worldObj.getTileEntity(offset[0], offset[1], offset[2]); + if (tile != null && tile instanceof TileEntityWorldGenMarker) { + ((TileEntityWorldGenMarker) tile).className = piece.getName(); + ((TileEntityWorldGenMarker) tile).length = lengthId - 1; + ((TileEntityWorldGenMarker) tile).deviation = deviationCount; + ((TileEntityWorldGenMarker) tile).prevID = Block.getIdFromBlock(block); + ((TileEntityWorldGenMarker) tile).prevMeta = meta; + ((TileEntityWorldGenMarker) tile).ticks -= delay; + ((TileEntityWorldGenMarker) tile).type = this.subtype; + } + block = null; + } + + protected int getStairDirection(int d) { + switch (d) { + case 0: + return 2; + + case 1: + return 1; + + case 2: + return 3; + + case 3: + return 0; + + } + return 0; + } + + public void placeSpawner(int x, int y, int z) { + placeSpawner(x, y, z, DungeonHooks.getRandomDungeonMob(rand)); + } + + public void placeSpawner(int x, int y, int z, String mob) { + this.placeBlock(Blocks.mob_spawner, 0, x, y, z); + TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) getTileEntity(x, y, z, direction); + + if (tileentitymobspawner != null) { tileentitymobspawner.func_145881_a().setEntityName(mob); + } else { + this.placeBlock(Blocks.air, 0, x, y, z); } - else - { - this.placeBlock(Blocks.air, 0, x, y, z); + } + + public static class StructureCoordinates { + public final int posX, posY, posZ, direction; + + public StructureCoordinates(int x, int y, int z, int direction) { + this.posX = x; + this.posY = y; + this.posZ = z; + this.direction = direction; } - } + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenAncientAlter.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenAncientAlter.java index 0dc6a0ce..17661930 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenAncientAlter.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenAncientAlter.java @@ -1,40 +1,34 @@ package minefantasy.mf2.mechanics.worldGen.structure; -import java.util.Random; - -import minefantasy.mf2.util.MFLogUtil; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; import net.minecraft.world.World; +public class WorldGenAncientAlter extends WorldGenStructureBase { + public WorldGenAncientAlter() { + } + + @Override + protected StructureModuleMF getStartPiece(World world, int x, int y, int z, int direction) { + return new StructureGenAncientAlter(world, x, y, z, direction); + } + + @Override + protected boolean isBlockAcceptableOrigin(World world, int x, int y, int z) { + return world.getBlock(x, y, z).getMaterial().isSolid() && isValidGround(world, x, y, z) + && world.canBlockSeeTheSky(x, y + 2, z); + } + + @Override + protected boolean canStructureBuild(StructureModuleMF piece) { + return true; + } + + @Override + protected boolean isDirectionRandom() { + return true; + } -public class WorldGenAncientAlter extends WorldGenStructureBase -{ - public WorldGenAncientAlter() - { - } - @Override - protected StructureModuleMF getStartPiece(World world, int x, int y, int z, int direction) - { - return new StructureGenAncientAlter(world, x, y, z, direction); - } - @Override - protected boolean isBlockAcceptableOrigin(World world, int x, int y, int z) - { - return world.getBlock(x, y, z).getMaterial().isSolid() && isValidGround(world, x, y, z) && world.canBlockSeeTheSky(x, y+2, z); - } - @Override - protected boolean canStructureBuild(StructureModuleMF piece) - { - return true; - } - @Override - protected boolean isDirectionRandom() - { - return true; - } - @Override - protected int[] getYGenBounds(World world) { - return new int[]{64, 255}; - } + @Override + protected int[] getYGenBounds(World world) { + return new int[]{64, 255}; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenAncientForge.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenAncientForge.java index ce3d08f2..f7ae98d3 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenAncientForge.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenAncientForge.java @@ -1,70 +1,57 @@ package minefantasy.mf2.mechanics.worldGen.structure; -import java.util.Random; - -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; import net.minecraft.world.World; +public class WorldGenAncientForge extends WorldGenStructureBase { + public WorldGenAncientForge() { + } + + @Override + protected StructureModuleMF getStartPiece(World world, int x, int y, int z, int direction) { + return new StructureGenAncientForgeEntry(world, x, y, z, direction); + } + + @Override + protected boolean isBlockAcceptableOrigin(World world, int x, int y, int z) { + return world.getBlock(x, y, z).getMaterial().isSolid() && isValidGround(world, x, y, z); + } + + @Override + protected boolean canStructureBuild(StructureModuleMF piece) { + // SEARCH FOR CLIFF + for (int x = -1; x <= 1; x++) { + for (int y = 0; y < 3; y++) { + for (int z = 1; z <= 2; z++) { + int[] pos = piece.offsetPos(x, y, z, piece.direction); + Material material = piece.worldObj.getBlock(pos[0], pos[1], pos[2]).getMaterial(); + + if (!material.isOpaque()) { + return false; + } + if (!material.isSolid()) { + return false; + } + } + for (int z = 0; z > -2; z--) { + Block block = piece.getBlock(x, y, z); + if (block.getMaterial().isSolid()) { + return false; + } + } + } + } + return true; + } + + @Override + protected boolean isDirectionRandom() { + return false; + } -public class WorldGenAncientForge extends WorldGenStructureBase -{ - public WorldGenAncientForge() - { - } - @Override - protected StructureModuleMF getStartPiece(World world, int x, int y, int z, int direction) - { - return new StructureGenAncientForgeEntry(world, x, y, z, direction); - } - @Override - protected boolean isBlockAcceptableOrigin(World world, int x, int y, int z) - { - return world.getBlock(x, y, z).getMaterial().isSolid() && isValidGround(world, x, y, z); - } - @Override - protected boolean canStructureBuild(StructureModuleMF piece) - { - //SEARCH FOR CLIFF - for(int x = -1; x <= 1; x ++) - { - for(int y = 0; y < 3; y ++) - { - for(int z = 1; z <= 2; z ++) - { - int[] pos = piece.offsetPos(x, y, z, piece.direction); - Material material = piece.worldObj.getBlock(pos[0], pos[1], pos[2]).getMaterial(); - - if(!material.isOpaque()) - { - return false; - } - if(!material.isSolid()) - { - return false; - } - } - for(int z = 0; z > -2; z--) - { - Block block = piece.getBlock(x, y, z); - if(block.getMaterial().isSolid()) - { - return false; - } - } - } - } - return true; - } - @Override - protected boolean isDirectionRandom() { - return false; - } - @Override - protected int[] getYGenBounds(World world) - { - return new int[]{64, 255}; - } + @Override + protected int[] getYGenBounds(World world) { + return new int[]{64, 255}; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenStructureBase.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenStructureBase.java index 007cb064..c69833da 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenStructureBase.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/WorldGenStructureBase.java @@ -1,87 +1,78 @@ package minefantasy.mf2.mechanics.worldGen.structure; -import java.util.Random; - -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +import java.util.Random; -public abstract class WorldGenStructureBase extends WorldGenerator -{ - public WorldGenStructureBase() - { - } - @Override - public boolean generate(World world, Random random, int i, int j, int k) - { - StructureModuleMF building; - int[] bounds = getYGenBounds(world); - for(int y = bounds[1]; y >= bounds[0]; y --) - { - if(isBlockAcceptableOrigin(world, i, y, k)) - { - if(isDirectionRandom()) - { - building = getStartPiece(world, i, y+1, k, random.nextInt(4)); - if(building != null && canStructureBuild(building)) - { - building.generate(); - return true; - } - } - else - { - for(int d = 0; d < 4; d++) - { - building = getStartPiece(world, i, y+1, k, d); - if(building != null && canStructureBuild(building)) - { - building.generate(); - return true; - } - } - } - building = null; - return false; - } - } - building = null; +public abstract class WorldGenStructureBase extends WorldGenerator { + public WorldGenStructureBase() { + } + + @Override + public boolean generate(World world, Random random, int i, int j, int k) { + StructureModuleMF building; + int[] bounds = getYGenBounds(world); + for (int y = bounds[1]; y >= bounds[0]; y--) { + if (isBlockAcceptableOrigin(world, i, y, k)) { + if (isDirectionRandom()) { + building = getStartPiece(world, i, y + 1, k, random.nextInt(4)); + if (building != null && canStructureBuild(building)) { + building.generate(); + return true; + } + } else { + for (int d = 0; d < 4; d++) { + building = getStartPiece(world, i, y + 1, k, d); + if (building != null && canStructureBuild(building)) { + building.generate(); + return true; + } + } + } + building = null; + return false; + } + } + building = null; return false; } - - protected boolean isValidGround(World world, int x, int y, int z) - { - Block block = world.getBlock(x, y, z); - if(!block.getMaterial().isSolid()) - { - return false; - } - - return block.getMaterial() == Material.rock || block.getMaterial() == Material.ground || block.getMaterial() == Material.grass; - } - - /** - * The min then max values which y axis allows generation - */ - protected abstract int[] getYGenBounds(World world); - /** - * Whether or not a particular block allows a generation - */ - protected abstract boolean isBlockAcceptableOrigin(World world, int x, int y, int z); - /** - * Called after IsBlockAcceptableOrigin: If a specific structure can generate here - */ - protected abstract boolean canStructureBuild(StructureModuleMF ruin) ; - /** - * True if direction is random, false if it tries one of four - */ - protected abstract boolean isDirectionRandom(); - /** - * The "Entry" instance - */ - protected abstract StructureModuleMF getStartPiece(World world, int x, int y, int z, int direction); + + protected boolean isValidGround(World world, int x, int y, int z) { + Block block = world.getBlock(x, y, z); + if (!block.getMaterial().isSolid()) { + return false; + } + + return block.getMaterial() == Material.rock || block.getMaterial() == Material.ground + || block.getMaterial() == Material.grass; + } + + /** + * The min then max values which y axis allows generation + */ + protected abstract int[] getYGenBounds(World world); + + /** + * Whether or not a particular block allows a generation + */ + protected abstract boolean isBlockAcceptableOrigin(World world, int x, int y, int z); + + /** + * Called after IsBlockAcceptableOrigin: If a specific structure can generate + * here + */ + protected abstract boolean canStructureBuild(StructureModuleMF ruin); + + /** + * True if direction is random, false if it tries one of four + */ + protected abstract boolean isDirectionRandom(); + + /** + * The "Entry" instance + */ + protected abstract StructureModuleMF getStartPiece(World world, int x, int y, int z, int direction); } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureDSSurfaceAppendage.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureDSSurfaceAppendage.java index 451de8b9..854c00c5 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureDSSurfaceAppendage.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureDSSurfaceAppendage.java @@ -2,10 +2,6 @@ import minefantasy.mf2.block.decor.BlockRack; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.block.tileentity.decor.TileEntityAmmoBox; -import minefantasy.mf2.entity.EntityCogwork; -import minefantasy.mf2.item.ItemArtefact; -import minefantasy.mf2.material.WoodMaterial; import minefantasy.mf2.mechanics.worldGen.structure.LootTypes; import minefantasy.mf2.mechanics.worldGen.structure.StructureGenAncientForge; import minefantasy.mf2.mechanics.worldGen.structure.StructureModuleMF; @@ -16,261 +12,218 @@ import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class StructureDSSurfaceAppendage extends StructureModuleMF -{ - private String type; - public StructureDSSurfaceAppendage(World world, StructureCoordinates position) - { - super(world, position); - type = randomiseType(); - } - - - private String randomiseType() - { - return rand.nextInt(3) == 0 ? "Tower" : "Room"; - } +public class StructureDSSurfaceAppendage extends StructureModuleMF { + private String type; + public StructureDSSurfaceAppendage(World world, StructureCoordinates position) { + super(world, position); + type = randomiseType(); + } - protected int getHeight() - { - return type == "Tower" ? 12 : 5; - } - protected int getDepth() - { - return 6; - } - protected int getWidth() - { - return 3; - } - @Override - public boolean canGenerate() - { - int width = getWidth(), depth = getDepth(), height = getHeight(); - int filledSpaces = 0, emptySpaces = 0; - - for(int x = -width; x <= width; x ++) - { - for(int y = 0; y <= height; y ++) - { - for(int z = 1; z <= depth; z ++) - { - Block block = this.getBlock(x, y, z); - if(!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) - { - return false; - } - if(!block.getMaterial().isSolid()) - { - ++emptySpaces; - } - else - { - ++filledSpaces; - } - } - } - } - if(WorldGenDwarvenStronghold.debug_air) - { - return true; - } - return ((float) emptySpaces / (float)filledSpaces) > 1.0F;//at least 50% empty - } - private boolean allowBuildOverBlock(Block block) - { - if(block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) - { - return false; - } - return true; - } - - - @Override - public void generate() - { - int width = getWidth(), depth = getDepth(), height = getHeight(); - - for(int x = -width; x <= width; x ++) - { - for(int z = 0; z <= depth; z ++) - { - Object[] blockarray; - - //FLOOR - blockarray = getFloor(width, depth, x, z); - if(blockarray != null) - { - placeBlock((Block)blockarray[0], 0, x, 0, z); - } - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, -1, z); - if(z < depth) - { - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, -2, z); - } - if(z < depth-1) - { - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, -3, z); - } - //WALLS - for(int y = 0; y <= height; y ++) - { - blockarray = getWalls(width, depth, height, x, y, z); - if(blockarray != null && this.allowBuildOverBlock(getBlock(x, y, z))) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, y, z); - } - } - //CEILING - blockarray = getCeiling(width, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height, z); - } - //BATTLEMENT - if(type == "Tower") - { - blockarray = getRoofDecor(width, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height+1, z); - } - } - } - } - placeBlock(Blocks.air, 0, 0, 1, 0); - placeBlock(Blocks.air, 0, 0, 2, 0); - - placeBlock(BlockListMF.reinforced_stone_framed, 0, -1, 1, -1); - placeBlock(BlockListMF.reinforced_stone, 0, -1, 2, -1); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, -1, 3, -1); - - placeBlock(BlockListMF.reinforced_stone_framed, 0, 1, 1, -1); - placeBlock(BlockListMF.reinforced_stone, 0, 1, 2, -1); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, 1, 3, -1); - - placeBlock(BlockListMF.reinforced_stone, 1, 0, 3, -1); - placeBlock(Blocks.air, 0, 0, 1, -1); - placeBlock(Blocks.air, 0, 0, 2, -1); - - if(type == "Tower") - { - decorateTower(width, depth, height); - } - else - { - buildHomeFurnishings(width, depth, height); - } - } + private String randomiseType() { + return rand.nextInt(3) == 0 ? "Tower" : "Room"; + } - private Object[] getFloor(int width, int depth, int x, int z) - { - if(x<= -(width-1) || x >= (width-1) || z <= 1 || z >= depth-1) - { - return new Object[]{BlockListMF.reinforced_stone, 0}; - } - return new Object[]{BlockListMF.cobble_pavement, 0}; - } - private Object[] getCeiling(int width, int depth, int x, int z) - { - if(x== -width || x == width || z == 0 || z == depth) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - private Object[] getRoofDecor(int width, int depth, int x, int z) - { - if(x== -width || x == width || z == 0 || z == depth) - { - if(x == 0 || x== -width || x == width) - { - if(z == 0 || z == depth/2 || z == depth) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - } - return new Object[]{BlockListMF.bars[0], false}; - } - return null; - } - private Object[] getWalls(int radius, int depth, int height, int x, int y, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - if((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - if(type == "Tower" && y == (height/2)) - { - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - if(y <= 0) - { - return null; - } - return new Object[]{Blocks.air, false}; - } - private void decorateTower(int width, int depth, int height) - { - for(int y = 1; y <= height; y ++) - { - if(y >=2 && y <= (height-2) && (y < (height/2)-1 || y > (height/2)+1) ) - { - this.placeBlock(BlockListMF.bars[0], 0, -width, y, depth/2); - this.placeBlock(BlockListMF.bars[0], 0, width, y, depth/2); - this.placeBlock(BlockListMF.bars[0], 0, 0, y, depth); - if(y > (height/2)+1) - { - this.placeBlock(BlockListMF.bars[0], 0, 0, y, 0); - } - } - this.placeBlock(Blocks.ladder, BlockRack.getDirection(direction), -1, y, 1); - } - this.placeBlock(Blocks.glowstone, 0, 0, height/2, depth/2); - - } - private void buildHomeFurnishings(int width, int depth, int height) - { - for(int x = width-1; x >= (width-4); x --) - { - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 1, 3); - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 2, 3); - placeBlock(Blocks.stone_slab, 0, x, 3, 3); - } - placeBlock(Blocks.stone_slab, 0, width-1, 1, depth-1); - placeBlock(Blocks.stone_slab, 0, width-2, 1, depth-1); - - placeChest(width-3, 1, depth-1, rotateLeft(), LootTypes.DWARVEN_HOME); - - for(int x = -(width-1); x < width; x ++) - { - for(int z = 1; z < depth; z ++) - { - if(x == width-1 || x == -(width-1) || z == 1 || z == (depth-1)) - { - placeBlock(BlockListMF.reinforced_stone, 0, x, height+1, z); - } - } - } - } - private void placeChest(int x, int y, int z, int d, String loot) - { - placeBlock(Blocks.chest, d, x, y, z); - TileEntityChest tile = (TileEntityChest)getTileEntity(x, y, z, direction); + protected int getHeight() { + return type == "Tower" ? 12 : 5; + } - if (tile != null) - { - WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tile, 2+rand.nextInt(3)); + protected int getDepth() { + return 6; + } + + protected int getWidth() { + return 3; + } + + @Override + public boolean canGenerate() { + int width = getWidth(), depth = getDepth(), height = getHeight(); + int filledSpaces = 0, emptySpaces = 0; + + for (int x = -width; x <= width; x++) { + for (int y = 0; y <= height; y++) { + for (int z = 1; z <= depth; z++) { + Block block = this.getBlock(x, y, z); + if (!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) { + return false; + } + if (!block.getMaterial().isSolid()) { + ++emptySpaces; + } else { + ++filledSpaces; + } + } + } + } + if (WorldGenDwarvenStronghold.debug_air) { + return true; + } + return ((float) emptySpaces / (float) filledSpaces) > 1.0F;// at least 50% empty + } + + private boolean allowBuildOverBlock(Block block) { + if (block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) { + return false; + } + return true; + } + + @Override + public void generate() { + int width = getWidth(), depth = getDepth(), height = getHeight(); + + for (int x = -width; x <= width; x++) { + for (int z = 0; z <= depth; z++) { + Object[] blockarray; + + // FLOOR + blockarray = getFloor(width, depth, x, z); + if (blockarray != null) { + placeBlock((Block) blockarray[0], 0, x, 0, z); + } + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, -1, + z); + if (z < depth) { + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, + -2, z); + } + if (z < depth - 1) { + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, + -3, z); + } + // WALLS + for (int y = 0; y <= height; y++) { + blockarray = getWalls(width, depth, height, x, y, z); + if (blockarray != null && this.allowBuildOverBlock(getBlock(x, y, z))) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, y, z); + } + } + // CEILING + blockarray = getCeiling(width, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height, z); + } + // BATTLEMENT + if (type == "Tower") { + blockarray = getRoofDecor(width, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height + 1, z); + } + } + } + } + placeBlock(Blocks.air, 0, 0, 1, 0); + placeBlock(Blocks.air, 0, 0, 2, 0); + + placeBlock(BlockListMF.reinforced_stone_framed, 0, -1, 1, -1); + placeBlock(BlockListMF.reinforced_stone, 0, -1, 2, -1); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, -1, 3, -1); + + placeBlock(BlockListMF.reinforced_stone_framed, 0, 1, 1, -1); + placeBlock(BlockListMF.reinforced_stone, 0, 1, 2, -1); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, 1, 3, -1); + + placeBlock(BlockListMF.reinforced_stone, 1, 0, 3, -1); + placeBlock(Blocks.air, 0, 0, 1, -1); + placeBlock(Blocks.air, 0, 0, 2, -1); + + if (type == "Tower") { + decorateTower(width, depth, height); + } else { + buildHomeFurnishings(width, depth, height); + } + } + + private Object[] getFloor(int width, int depth, int x, int z) { + if (x <= -(width - 1) || x >= (width - 1) || z <= 1 || z >= depth - 1) { + return new Object[]{BlockListMF.reinforced_stone, 0}; + } + return new Object[]{BlockListMF.cobble_pavement, 0}; + } + + private Object[] getCeiling(int width, int depth, int x, int z) { + if (x == -width || x == width || z == 0 || z == depth) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + private Object[] getRoofDecor(int width, int depth, int x, int z) { + if (x == -width || x == width || z == 0 || z == depth) { + if (x == 0 || x == -width || x == width) { + if (z == 0 || z == depth / 2 || z == depth) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + } + return new Object[]{BlockListMF.bars[0], false}; + } + return null; + } + + private Object[] getWalls(int radius, int depth, int height, int x, int y, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + if ((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + if (type == "Tower" && y == (height / 2)) { + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + if (y <= 0) { + return null; + } + return new Object[]{Blocks.air, false}; + } + + private void decorateTower(int width, int depth, int height) { + for (int y = 1; y <= height; y++) { + if (y >= 2 && y <= (height - 2) && (y < (height / 2) - 1 || y > (height / 2) + 1)) { + this.placeBlock(BlockListMF.bars[0], 0, -width, y, depth / 2); + this.placeBlock(BlockListMF.bars[0], 0, width, y, depth / 2); + this.placeBlock(BlockListMF.bars[0], 0, 0, y, depth); + if (y > (height / 2) + 1) { + this.placeBlock(BlockListMF.bars[0], 0, 0, y, 0); + } + } + this.placeBlock(Blocks.ladder, BlockRack.getDirection(direction), -1, y, 1); + } + this.placeBlock(Blocks.glowstone, 0, 0, height / 2, depth / 2); + + } + + private void buildHomeFurnishings(int width, int depth, int height) { + for (int x = width - 1; x >= (width - 4); x--) { + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 1, 3); + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 2, 3); + placeBlock(Blocks.stone_slab, 0, x, 3, 3); + } + placeBlock(Blocks.stone_slab, 0, width - 1, 1, depth - 1); + placeBlock(Blocks.stone_slab, 0, width - 2, 1, depth - 1); + + placeChest(width - 3, 1, depth - 1, rotateLeft(), LootTypes.DWARVEN_HOME); + + for (int x = -(width - 1); x < width; x++) { + for (int z = 1; z < depth; z++) { + if (x == width - 1 || x == -(width - 1) || z == 1 || z == (depth - 1)) { + placeBlock(BlockListMF.reinforced_stone, 0, x, height + 1, z); + } + } + } + } + + private void placeChest(int x, int y, int z, int d, String loot) { + placeBlock(Blocks.chest, d, x, y, z); + TileEntityChest tile = (TileEntityChest) getTileEntity(x, y, z, direction); + + if (tile != null) { + WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tile, + 2 + rand.nextInt(3)); } - } + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSCrossroads.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSCrossroads.java index cfc90c94..3ec1a634 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSCrossroads.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSCrossroads.java @@ -1,321 +1,260 @@ package minefantasy.mf2.mechanics.worldGen.structure.dwarven; -import minefantasy.mf2.api.material.CustomMaterial; -import minefantasy.mf2.block.decor.BlockRack; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.block.tileentity.decor.TileEntityAmmoBox; -import minefantasy.mf2.block.tileentity.decor.TileEntityRack; import minefantasy.mf2.config.ConfigWorldGen; import minefantasy.mf2.entity.mob.EntityMinotaur; import minefantasy.mf2.entity.mob.MinotaurBreed; -import minefantasy.mf2.item.ItemArtefact; -import minefantasy.mf2.item.gadget.ItemBomb; -import minefantasy.mf2.item.gadget.ItemMine; -import minefantasy.mf2.item.list.CustomToolListMF; -import minefantasy.mf2.item.weapon.ItemWeaponMF; -import minefantasy.mf2.material.WoodMaterial; -import minefantasy.mf2.mechanics.worldGen.structure.LootTypes; import minefantasy.mf2.mechanics.worldGen.structure.StructureGenAncientForge; import minefantasy.mf2.mechanics.worldGen.structure.StructureModuleMF; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class StructureGenDSCrossroads extends StructureModuleMF -{ - public StructureGenDSCrossroads(World world, StructureCoordinates position) - { - super(world, position); - } - public StructureGenDSCrossroads(World world, int x, int y, int z, int direction) - { - super(world, x, y, z, direction); - } - @Override - public boolean canGenerate() - { - if(lengthId == -100) - { - return true; - } - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - int filledSpaces = 0, emptySpaces = 0; - for(int x = -width_span; x <= width_span; x ++) - { - for(int y = 0; y <= height; y ++) - { - for(int z = 1; z <= depth; z ++) - { - Block block = this.getBlock(x, y, z); - if(!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) - { - return false; - } - if(!block.getMaterial().isSolid()) - { - ++emptySpaces; - } - else - { - ++filledSpaces; - } - } - } - } - if(WorldGenDwarvenStronghold.debug_air) - { - return true; - } - return ((float) emptySpaces / (float)(emptySpaces+filledSpaces) ) < WorldGenDwarvenStronghold.maxAir;//at least 75% full - } - - private boolean allowBuildOverBlock(Block block) - { - if(block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) - { - return false; - } - return true; - } - @Override - public void generate() - { - if(lengthId == -100) - { - this.lengthId = ConfigWorldGen.DSLength; - this.deviationCount = ConfigWorldGen.DSDeviations; - } - - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - for(int x = -width_span; x <= width_span; x ++) - { - for(int z = 0; z <= depth; z ++) - { - Object[] blockarray; - //FLOOR - blockarray = getFloor(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, 0, z); - } - //WALLS - for(int y = 1; y <= height+1; y ++) - { - blockarray = getWalls(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, y, z); - } - } - //CEILING - blockarray = getCeiling(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height+1, z); - } - - //TRIM - blockarray = getTrim(width_span, depth, x, z); - if(blockarray != null) - { - int meta = 0; - if(blockarray[1] instanceof Integer) - { - meta = (Integer)blockarray[1]; - } - if(blockarray[1] instanceof Boolean) - { - meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - } - placeBlock((Block)blockarray[0], meta, x, height, z); - placeBlock(BlockListMF.reinforced_stone, meta, x, 4, z); - if((Block)blockarray[0] == BlockListMF.reinforced_stone_framed) - { - for(int h = height-1; h > 1; h --) - { - placeBlock(h == 5 ? Blocks.glowstone : BlockListMF.reinforced_stone, h==2 ? 1 : 0, x, h, z); - } - placeBlock(BlockListMF.reinforced_stone_framed, 0, x, 1, z); - } - } - - } - } - - //DOORWAY - buildDoorway(width_span, depth, height); - - generateCrossroad(); - } - - protected void buildDoorway(int width_span, int depth, int height) - { - for(int x = -1; x <= 1; x++) - { - for(int y = 1; y <= 3; y ++) - { - for(int z = 0; z >= -1; z --) - { - placeBlock(Blocks.air, 0, x, y, z); - } - } - } - } - protected int getHeight() - { - return 7; - } - protected int getDepthSpan() - { - return 19; - } - protected int getWidthSpan() - { - return 7; - } - - private Object[] getTrim(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - return null; - } - if(x == -(radius-1) || x == (radius-1)) - { - if(z == (int)Math.ceil( (float)depth / 2) || z == (int)Math.floor( (float)depth / 2)) - { - return new Object[]{BlockListMF.reinforced_stone_framed, false}; - } - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - if((x == -(radius-1) && (z == (depth-1) || z == 1)) || (x == (radius-1) && (z == (depth-1) || z == 1))) - { - return new Object[]{BlockListMF.reinforced_stone_framed, false}; - } - int m = 0; - if(x == 0 || z == 5 || z == (depth-5)) - { - m = 1; - } - return new Object[]{BlockListMF.reinforced_stone, m}; - } - return null; - } - private Object[] getCeiling(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - return null; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - - private Object[] getFloor(int radius, int depth, int x, int z) - { - if(z < 2 && x >= -1 && x <= 1) - { - return new Object[]{floor_block, false}; - } - if(x == -radius || x == radius || z == depth || z == 0) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{floor_block, false}; - } - - private Object[] getWalls(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - if((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - return new Object[]{Blocks.air, false}; - } - - protected String lootType = ChestGenHooks.DUNGEON_CHEST; - public StructureModuleMF setLoot(String loot) - { - this.lootType = loot; - return this; - } - protected Block floor_block = BlockListMF.cobble_pavement; - - public void generateCrossroad() - { - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - - int zOffset = 4; - - boolean stairSide = rand.nextBoolean(); - - tryPlaceCrossroadHall(0, 0, depth+1, direction, stairSide, 0); - - tryPlaceCrossroadHall((width_span+1), 0, zOffset, rotateLeft(), stairSide, 20); - tryPlaceCrossroadHall((width_span+1), 0, depth-zOffset, rotateLeft(), !stairSide, 40); - - tryPlaceCrossroadHall(-(width_span+1), 0, zOffset, rotateRight(), stairSide, 60); - tryPlaceCrossroadHall(-(width_span+1), 0, depth-zOffset, rotateRight(), !stairSide, 80); - - this.placeMinotaur(0, 1, depth-2, 1); - this.placeMinotaur(0, 1, 2, 1); - - int w = 2, d = 3; - for(int x = -w; x <= w; x ++) - { - for(int z = -d; z <= d; z ++) - { - Block block = Blocks.water; - if(z == -d || z == d || x == -w || x == w) - { - block = BlockListMF.reinforced_stone; - } - this.placeBlock(block, 0, x, 1, depth/2 + z); - } - } - - } - - private void placeMinotaur(int x, int y, int z, int tier) - { - EntityMinotaur mob = new EntityMinotaur(worldObj); - this.placeEntity(mob, x, y, z); - mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); - mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), tier); - } - protected void tryPlaceCrossroadHall(int x, int y, int z, int d, boolean stair, int delay) - { - Class extension = stair ? StructureGenDSStairs.class : StructureGenDSHall.class; - if(extension != null) - { - mapStructure(x, y, z, d, extension, delay); - } - } +public class StructureGenDSCrossroads extends StructureModuleMF { + protected String lootType = ChestGenHooks.DUNGEON_CHEST; + protected Block floor_block = BlockListMF.cobble_pavement; + + public StructureGenDSCrossroads(World world, StructureCoordinates position) { + super(world, position); + } + + public StructureGenDSCrossroads(World world, int x, int y, int z, int direction) { + super(world, x, y, z, direction); + } + + @Override + public boolean canGenerate() { + if (lengthId == -100) { + return true; + } + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + int filledSpaces = 0, emptySpaces = 0; + for (int x = -width_span; x <= width_span; x++) { + for (int y = 0; y <= height; y++) { + for (int z = 1; z <= depth; z++) { + Block block = this.getBlock(x, y, z); + if (!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) { + return false; + } + if (!block.getMaterial().isSolid()) { + ++emptySpaces; + } else { + ++filledSpaces; + } + } + } + } + if (WorldGenDwarvenStronghold.debug_air) { + return true; + } + return ((float) emptySpaces / (float) (emptySpaces + filledSpaces)) < WorldGenDwarvenStronghold.maxAir;// at + // least + // 75% + // full + } + + private boolean allowBuildOverBlock(Block block) { + if (block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) { + return false; + } + return true; + } + + @Override + public void generate() { + if (lengthId == -100) { + this.lengthId = ConfigWorldGen.DSLength; + this.deviationCount = ConfigWorldGen.DSDeviations; + } + + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + for (int x = -width_span; x <= width_span; x++) { + for (int z = 0; z <= depth; z++) { + Object[] blockarray; + // FLOOR + blockarray = getFloor(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, 0, z); + } + // WALLS + for (int y = 1; y <= height + 1; y++) { + blockarray = getWalls(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, y, z); + } + } + // CEILING + blockarray = getCeiling(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height + 1, z); + } + + // TRIM + blockarray = getTrim(width_span, depth, x, z); + if (blockarray != null) { + int meta = 0; + if (blockarray[1] instanceof Integer) { + meta = (Integer) blockarray[1]; + } + if (blockarray[1] instanceof Boolean) { + meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + } + placeBlock((Block) blockarray[0], meta, x, height, z); + placeBlock(BlockListMF.reinforced_stone, meta, x, 4, z); + if ((Block) blockarray[0] == BlockListMF.reinforced_stone_framed) { + for (int h = height - 1; h > 1; h--) { + placeBlock(h == 5 ? Blocks.glowstone : BlockListMF.reinforced_stone, h == 2 ? 1 : 0, x, h, + z); + } + placeBlock(BlockListMF.reinforced_stone_framed, 0, x, 1, z); + } + } + + } + } + + // DOORWAY + buildDoorway(width_span, depth, height); + + generateCrossroad(); + } + + protected void buildDoorway(int width_span, int depth, int height) { + for (int x = -1; x <= 1; x++) { + for (int y = 1; y <= 3; y++) { + for (int z = 0; z >= -1; z--) { + placeBlock(Blocks.air, 0, x, y, z); + } + } + } + } + + protected int getHeight() { + return 7; + } + + protected int getDepthSpan() { + return 19; + } + + protected int getWidthSpan() { + return 7; + } + + private Object[] getTrim(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + return null; + } + if (x == -(radius - 1) || x == (radius - 1)) { + if (z == (int) Math.ceil((float) depth / 2) || z == (int) Math.floor((float) depth / 2)) { + return new Object[]{BlockListMF.reinforced_stone_framed, false}; + } + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + if ((x == -(radius - 1) && (z == (depth - 1) || z == 1)) + || (x == (radius - 1) && (z == (depth - 1) || z == 1))) { + return new Object[]{BlockListMF.reinforced_stone_framed, false}; + } + int m = 0; + if (x == 0 || z == 5 || z == (depth - 5)) { + m = 1; + } + return new Object[]{BlockListMF.reinforced_stone, m}; + } + return null; + } + + private Object[] getCeiling(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + return null; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + private Object[] getFloor(int radius, int depth, int x, int z) { + if (z < 2 && x >= -1 && x <= 1) { + return new Object[]{floor_block, false}; + } + if (x == -radius || x == radius || z == depth || z == 0) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{floor_block, false}; + } + + private Object[] getWalls(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + if ((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + return new Object[]{Blocks.air, false}; + } + + public StructureModuleMF setLoot(String loot) { + this.lootType = loot; + return this; + } + + public void generateCrossroad() { + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + + int zOffset = 4; + + boolean stairSide = rand.nextBoolean(); + + tryPlaceCrossroadHall(0, 0, depth + 1, direction, stairSide, 0); + + tryPlaceCrossroadHall((width_span + 1), 0, zOffset, rotateLeft(), stairSide, 20); + tryPlaceCrossroadHall((width_span + 1), 0, depth - zOffset, rotateLeft(), !stairSide, 40); + + tryPlaceCrossroadHall(-(width_span + 1), 0, zOffset, rotateRight(), stairSide, 60); + tryPlaceCrossroadHall(-(width_span + 1), 0, depth - zOffset, rotateRight(), !stairSide, 80); + + this.placeMinotaur(0, 1, depth - 2, 1); + this.placeMinotaur(0, 1, 2, 1); + + int w = 2, d = 3; + for (int x = -w; x <= w; x++) { + for (int z = -d; z <= d; z++) { + Block block = Blocks.water; + if (z == -d || z == d || x == -w || x == w) { + block = BlockListMF.reinforced_stone; + } + this.placeBlock(block, 0, x, 1, depth / 2 + z); + } + } + + } + + private void placeMinotaur(int x, int y, int z, int tier) { + EntityMinotaur mob = new EntityMinotaur(worldObj); + this.placeEntity(mob, x, y, z); + mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); + mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), tier); + } + + protected void tryPlaceCrossroadHall(int x, int y, int z, int d, boolean stair, int delay) { + Class extension = stair ? StructureGenDSStairs.class : StructureGenDSHall.class; + if (extension != null) { + mapStructure(x, y, z, d, extension, delay); + } + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSEntry.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSEntry.java index 5bbdb06c..19c3e3a3 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSEntry.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSEntry.java @@ -1,8 +1,6 @@ package minefantasy.mf2.mechanics.worldGen.structure.dwarven; -import minefantasy.mf2.block.decor.BlockRack; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.config.ConfigWorldGen; import minefantasy.mf2.entity.mob.EntityMinotaur; import minefantasy.mf2.entity.mob.MinotaurBreed; import minefantasy.mf2.mechanics.worldGen.structure.StructureGenAncientForge; @@ -12,233 +10,199 @@ import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class StructureGenDSEntry extends StructureModuleMF -{ - public boolean isSurfaceBuild; - public StructureGenDSEntry(World world, StructureCoordinates position) - { - super(world, position); - } - public StructureGenDSEntry(World world, int x, int y, int z, int direction, boolean surface) - { - super(world, x, y, z, direction); - this.isSurfaceBuild = surface; - } - @Override - public void generate() - { - int environment = MinotaurBreed.getEnvironment(worldObj, xCoord, zCoord, 0); - subtype = environment == 2 ? "Frost" : "Normal"; - - int width_span = 4; - int depth = 10; - int height = 5; - for(int x = -width_span; x <= width_span; x ++) - { - for(int z = 0; z <= depth; z ++) - { - //FOUNDATION - Object[] blockarray = getFoundation(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? -1 : 0; - this.buildFoundation((Block)blockarray[0], meta, x, -1, z, 32, 4, false); - } - - //FLOOR - blockarray = getFloor(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, 0, z); - } - //WALLS - for(int y = 1; y <= height+1; y ++) - { - blockarray = getWalls(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, y, z); - } - } - //CEILING - blockarray = getCeiling(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height+1, z); - } - - //TRIM - blockarray = getTrim(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height+2, z); - placeBlock((Block)blockarray[0], meta, x, height, z); - if((Block)blockarray[0] == BlockListMF.reinforced_stone_framed) - { - for(int h = height-1; h > 1; h --) - { - placeBlock(BlockListMF.reinforced_stone, h==2 ? 1 : 0, x, h, z); - } - placeBlock(BlockListMF.reinforced_stone_framed, 0, x, 1, z); - } - } - - } - } - - //DOORWAY - for(int x = -1; x <= 1; x++) - { - for(int y = 1; y <= 3; y ++) - { - placeBlock(Blocks.air, 0, x, y, 0); - } - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 0, -1); - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 0, -2); - - placeBlock(BlockListMF.reinforced_stone, 0, x, -1, -1); - placeBlock(BlockListMF.reinforced_stone, 0, x, -1, -2); - placeBlock(BlockListMF.reinforced_stone, 0, x, 0, -3); - } - placeBlock(BlockListMF.reinforced_stone, 0, -2, 0, -1); - placeBlock(BlockListMF.reinforced_stone, 0, -2, 0, -2); - placeBlock(BlockListMF.reinforced_stone, 0, 2, 0, -1); - placeBlock(BlockListMF.reinforced_stone, 0, 2, 0, -2); - - placeDoorway(-1, width_span, height, depth); - placeDoorway(1, width_span, height, depth); - placeBlock(BlockListMF.reinforced_stone, 0, 0, height-1, -3); - placeBlock(BlockListMF.reinforced_stone, 0, 0, height, -1); - - EntityMinotaur mob = new EntityMinotaur(worldObj); - this.placeEntity(mob, 0, 1, depth/2); - mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 1); - - this.lengthId = -99; - mapStructure(0, 0, depth, StructureGenDSStairs.class); - - if(isSurfaceBuild) - { - mapStructure(-width_span, 0, depth-1, rotateRight(), StructureDSSurfaceAppendage.class); - mapStructure(-width_span, 0, 2, rotateRight(), StructureDSSurfaceAppendage.class); - - mapStructure(width_span, 0, depth-1, rotateLeft(), StructureDSSurfaceAppendage.class); - mapStructure(width_span, 0, 2, rotateLeft(), StructureDSSurfaceAppendage.class); - } - } - - private void placeDoorway(int mod, int width_span, int height, int depth) - { - int h = height; - placeBlock(BlockListMF.reinforced_stone, 0, 3*mod, 1, -1); - placeBlock(BlockListMF.reinforced_stone, 0, 3*mod, 1, -2); - for(int y = 1; y < h; y ++) - { - placeBlock(BlockListMF.reinforced_stone, 0, 2*mod, y, -3); - } - placeBlock(BlockListMF.reinforced_stone, 0, 1*mod, height-1, -3); - - placeBlock(BlockListMF.reinforced_stone, 0, 2*mod, height, -3); - placeBlock(BlockListMF.reinforced_stone, 0, 2*mod, height, -2); - placeBlock(BlockListMF.reinforced_stone, 0, 1*mod, height, -1); - placeBlock(BlockListMF.reinforced_stone, 0, 2*mod, height, -1); - placeBlock(BlockListMF.reinforced_stone, 0, 3*mod, height, -1); - - placeBlock(BlockListMF.reinforced_stone, 0, 2*mod, height+1, -1); - placeBlock(BlockListMF.reinforced_stone, 0, 2*mod, height+2, -1); - placeBlock(BlockListMF.reinforced_stone, 0, 2*mod, height+2, 0); - } - private Object[] getTrim(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - return null; - } - if(x == -(radius-1) || x == (radius-1)) - { - if(z == (int)Math.ceil( (float)depth / 2)) - { - return new Object[]{BlockListMF.reinforced_stone_framed, false}; - } - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - if((x == -(radius-1) && (z == (depth-1) || z == 1)) || (x == (radius-1) && (z == (depth-1) || z == 1))) - { - return new Object[]{BlockListMF.reinforced_stone_framed, false}; - } - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return null; - } - private Object[] getCeiling(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - return null; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - - private Object[] getFloor(int radius, int depth, int x, int z) - { - if(z < 2 && x >= -1 && x <= 1) - { - return new Object[]{floor, false}; - } - if(x == -radius || x == radius || z == depth || z == 0) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{floor, false}; - } - - private Object[] getFoundation(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - if(x == -radius || x == radius || x == 0) - { - if(z == depth || z == Math.ceil( (float)depth/2) || z == 0) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - } - } - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - - private Object[] getWalls(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - if((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - return new Object[]{Blocks.air, false}; - } - - private String lootType = ChestGenHooks.DUNGEON_CHEST; - public StructureModuleMF setLoot(String loot) - { - this.lootType = loot; - return this; - } - private static Block floor = BlockListMF.cobble_pavement; +public class StructureGenDSEntry extends StructureModuleMF { + private static Block floor = BlockListMF.cobble_pavement; + public boolean isSurfaceBuild; + private String lootType = ChestGenHooks.DUNGEON_CHEST; + + public StructureGenDSEntry(World world, StructureCoordinates position) { + super(world, position); + } + + public StructureGenDSEntry(World world, int x, int y, int z, int direction, boolean surface) { + super(world, x, y, z, direction); + this.isSurfaceBuild = surface; + } + + @Override + public void generate() { + int environment = MinotaurBreed.getEnvironment(worldObj, xCoord, zCoord, 0); + subtype = environment == 2 ? "Frost" : "Normal"; + + int width_span = 4; + int depth = 10; + int height = 5; + for (int x = -width_span; x <= width_span; x++) { + for (int z = 0; z <= depth; z++) { + // FOUNDATION + Object[] blockarray = getFoundation(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? -1 : 0; + this.buildFoundation((Block) blockarray[0], meta, x, -1, z, 32, 4, false); + } + + // FLOOR + blockarray = getFloor(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, 0, z); + } + // WALLS + for (int y = 1; y <= height + 1; y++) { + blockarray = getWalls(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, y, z); + } + } + // CEILING + blockarray = getCeiling(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height + 1, z); + } + + // TRIM + blockarray = getTrim(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height + 2, z); + placeBlock((Block) blockarray[0], meta, x, height, z); + if ((Block) blockarray[0] == BlockListMF.reinforced_stone_framed) { + for (int h = height - 1; h > 1; h--) { + placeBlock(BlockListMF.reinforced_stone, h == 2 ? 1 : 0, x, h, z); + } + placeBlock(BlockListMF.reinforced_stone_framed, 0, x, 1, z); + } + } + + } + } + + // DOORWAY + for (int x = -1; x <= 1; x++) { + for (int y = 1; y <= 3; y++) { + placeBlock(Blocks.air, 0, x, y, 0); + } + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 0, -1); + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 0, -2); + + placeBlock(BlockListMF.reinforced_stone, 0, x, -1, -1); + placeBlock(BlockListMF.reinforced_stone, 0, x, -1, -2); + placeBlock(BlockListMF.reinforced_stone, 0, x, 0, -3); + } + placeBlock(BlockListMF.reinforced_stone, 0, -2, 0, -1); + placeBlock(BlockListMF.reinforced_stone, 0, -2, 0, -2); + placeBlock(BlockListMF.reinforced_stone, 0, 2, 0, -1); + placeBlock(BlockListMF.reinforced_stone, 0, 2, 0, -2); + + placeDoorway(-1, width_span, height, depth); + placeDoorway(1, width_span, height, depth); + placeBlock(BlockListMF.reinforced_stone, 0, 0, height - 1, -3); + placeBlock(BlockListMF.reinforced_stone, 0, 0, height, -1); + + EntityMinotaur mob = new EntityMinotaur(worldObj); + this.placeEntity(mob, 0, 1, depth / 2); + mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 1); + + this.lengthId = -99; + mapStructure(0, 0, depth, StructureGenDSStairs.class); + + if (isSurfaceBuild) { + mapStructure(-width_span, 0, depth - 1, rotateRight(), StructureDSSurfaceAppendage.class); + mapStructure(-width_span, 0, 2, rotateRight(), StructureDSSurfaceAppendage.class); + + mapStructure(width_span, 0, depth - 1, rotateLeft(), StructureDSSurfaceAppendage.class); + mapStructure(width_span, 0, 2, rotateLeft(), StructureDSSurfaceAppendage.class); + } + } + + private void placeDoorway(int mod, int width_span, int height, int depth) { + int h = height; + placeBlock(BlockListMF.reinforced_stone, 0, 3 * mod, 1, -1); + placeBlock(BlockListMF.reinforced_stone, 0, 3 * mod, 1, -2); + for (int y = 1; y < h; y++) { + placeBlock(BlockListMF.reinforced_stone, 0, 2 * mod, y, -3); + } + placeBlock(BlockListMF.reinforced_stone, 0, 1 * mod, height - 1, -3); + + placeBlock(BlockListMF.reinforced_stone, 0, 2 * mod, height, -3); + placeBlock(BlockListMF.reinforced_stone, 0, 2 * mod, height, -2); + placeBlock(BlockListMF.reinforced_stone, 0, 1 * mod, height, -1); + placeBlock(BlockListMF.reinforced_stone, 0, 2 * mod, height, -1); + placeBlock(BlockListMF.reinforced_stone, 0, 3 * mod, height, -1); + + placeBlock(BlockListMF.reinforced_stone, 0, 2 * mod, height + 1, -1); + placeBlock(BlockListMF.reinforced_stone, 0, 2 * mod, height + 2, -1); + placeBlock(BlockListMF.reinforced_stone, 0, 2 * mod, height + 2, 0); + } + + private Object[] getTrim(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + return null; + } + if (x == -(radius - 1) || x == (radius - 1)) { + if (z == (int) Math.ceil((float) depth / 2)) { + return new Object[]{BlockListMF.reinforced_stone_framed, false}; + } + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + if ((x == -(radius - 1) && (z == (depth - 1) || z == 1)) + || (x == (radius - 1) && (z == (depth - 1) || z == 1))) { + return new Object[]{BlockListMF.reinforced_stone_framed, false}; + } + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return null; + } + + private Object[] getCeiling(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + return null; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + private Object[] getFloor(int radius, int depth, int x, int z) { + if (z < 2 && x >= -1 && x <= 1) { + return new Object[]{floor, false}; + } + if (x == -radius || x == radius || z == depth || z == 0) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{floor, false}; + } + + private Object[] getFoundation(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + if (x == -radius || x == radius || x == 0) { + if (z == depth || z == Math.ceil((float) depth / 2) || z == 0) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + } + } + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + private Object[] getWalls(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + if ((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + return new Object[]{Blocks.air, false}; + } + + public StructureModuleMF setLoot(String loot) { + this.lootType = loot; + return this; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSHall.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSHall.java index a89b6cac..7cbf46f1 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSHall.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSHall.java @@ -1,7 +1,5 @@ package minefantasy.mf2.mechanics.worldGen.structure.dwarven; -import java.util.Random; - import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.mechanics.worldGen.structure.StructureGenAncientForge; import minefantasy.mf2.mechanics.worldGen.structure.StructureModuleMF; @@ -10,278 +8,238 @@ import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class StructureGenDSHall extends StructureModuleMF -{ - public StructureGenDSHall(World world, StructureCoordinates position) - { - super(world, position); - } - public StructureGenDSHall(World world, int x, int y, int z, int direction) - { - super(world, x, y, z, direction); - } - @Override - public boolean canGenerate() - { - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - int empty_spaces = 0; - int filledSpaces = 0, emptySpaces = 0; - for(int x = -width_span; x <= width_span; x ++) - { - for(int y = 0; y <= height; y ++) - { - for(int z = 1; z <= depth; z ++) - { - Block block = this.getBlock(x, y, z); - if(!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) - { - return false; - } - if(!block.getMaterial().isSolid()) - { - ++emptySpaces; - } - else - { - ++filledSpaces; - } - } - } - } - if(WorldGenDwarvenStronghold.debug_air) - { - return true; - } - return ((float) emptySpaces / (float)(emptySpaces+filledSpaces) ) < WorldGenDwarvenStronghold.maxAir;//at least 75% full - } - - private boolean allowBuildOverBlock(Block block) - { - if(block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) - { - return false; - } - return true; - } - @Override - public void generate() - { - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - for(int x = -width_span; x <= width_span; x ++) - { - for(int z = 0; z <= depth; z ++) - { - Object[] blockarray; - - //FLOOR - blockarray = getFloor(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, 0, z); - } - //WALLS - for(int y = 1; y <= height+1; y ++) - { - blockarray = getWalls(width_span, height, depth, x, y, z); - if(blockarray != null) - { - int meta = 0; - if(blockarray[1] instanceof Integer) - { - meta = (Integer)blockarray[1]; - } - if(blockarray[1] instanceof Boolean) - { - meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - } - if(blockarray[1] instanceof String) - { - meta = (String)blockarray[1]=="Hall" ? getRandomEngravedWall(rand) : 0; - } - placeBlock((Block)blockarray[0], meta, x, y, z); - } - } - //CEILING - blockarray = getCeiling(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height+1, z); - } - - //TRIM - blockarray = getTrim(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height, z); - if((Block)blockarray[0] == BlockListMF.reinforced_stone_framed) - { - for(int h = height-1; h > 1; h --) - { - placeBlock(BlockListMF.reinforced_stone, h==2 ? 1 : 0, x, h, z); - } - placeBlock(BlockListMF.reinforced_stone_framed, 0, x, 1, z); - } - } - - } - } - - //DOORWAY - buildDoorway(width_span, depth, height); - - if(lengthId > 0) - { - buildNext(width_span, depth, height); - } - else - { - mapStructure(0, 0, depth, StructureGenDSRoom.class); - } - if(rand.nextInt(3) != 0) - { - tryPlaceMinorRoom((width_span), 0, (int)Math.floor((float) depth / 2), rotateLeft()); - } - if(rand.nextInt(3) != 0) - { - tryPlaceMinorRoom(-(width_span), 0, (int)Math.floor((float) depth / 2), rotateRight()); - } - if(this instanceof StructureGenDSIntersection || this.lengthId % 2 == 0) - { - placeBlock(Blocks.glowstone, 0, 0, height+1, depth/2); - } - } - - protected void buildDoorway(int width_span, int depth, int height) - { - for(int x = -1; x <= 1; x++) - { - for(int y = 1; y <= 3; y ++) - { - for(int z = 0; z >= -1; z --) - { - placeBlock(Blocks.air, 0, x, y, z); - } - } - } - } - protected void buildNext(int width_span, int depth, int height) - { - tryPlaceHall(0, 0, depth, direction); - } - protected void tryPlaceHall(int x, int y, int z, int d) - { - Class extension = getRandomExtension(); - if(extension != null) - { - mapStructure(x, y, z, d, extension); - } - } - - protected void tryPlaceMinorRoom(int x, int y, int z, int d) - { - Class extension = getRandomMinorRoom(); - if(extension != null) - { - mapStructure(x, y, z, d, extension); - } - } - protected int getHeight() { - return 4; - } - protected int getDepthSpan() { - return 9; - } - protected int getWidthSpan() { - return 3; - } - protected Class getRandomMinorRoom() - { - return StructureGenDSRoomSml.class; - } - protected Class getRandomExtension() - { - if(lengthId == 1) - { - return StructureGenDSRoom.class; - } - if(deviationCount > 0 && rand.nextInt(4) == 0) - { - return StructureGenDSIntersection.class; - } - if( rand.nextInt(16) == 0 && this.yCoord >= StructureGenDSStairs.minLevel) - { - return StructureGenDSStairs.class; - } - return StructureGenDSHall.class; - } - protected Object[] getTrim(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius) - { - return null; - } - - if(x == -(radius-1) || x == (radius-1)) - { - if(z == Math.floor( (float)depth/2)) - { - return new Object[]{BlockListMF.reinforced_stone_framed, false}; - } - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return null; - } - protected Object[] getCeiling(int radius, int depth, int x, int z) - { - return x == 0 ? new Object[]{BlockListMF.reinforced_stone, false} : new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - - protected Object[] getFloor(int radius, int depth, int x, int z) - { - if(x >= -1 && x <= 1) - { - return new Object[]{floor, false}; - } - if(x == -radius || x == radius || z == depth || z == 0) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{floor, false}; - } - - protected Object[] getWalls(int radius, int height, int depth, int x, int y, int z) - { - if(x != -radius && x != radius && z == 0) - { - return new Object[]{Blocks.air, false}; - } - if(x == -radius || x == radius || z == depth) - { - return y == height/2 ? new Object[]{BlockListMF.reinforced_stone, "Hall"} : new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - return new Object[]{Blocks.air, false}; - } +import java.util.Random; + +public class StructureGenDSHall extends StructureModuleMF { + protected static Block floor = BlockListMF.cobble_pavement; + protected String lootType = ChestGenHooks.DUNGEON_CHEST; + + public StructureGenDSHall(World world, StructureCoordinates position) { + super(world, position); + } + + public StructureGenDSHall(World world, int x, int y, int z, int direction) { + super(world, x, y, z, direction); + } + + public static int getRandomEngravedWall(Random rand) { + return 2 + rand.nextInt(3); + } + + @Override + public boolean canGenerate() { + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + int empty_spaces = 0; + int filledSpaces = 0, emptySpaces = 0; + for (int x = -width_span; x <= width_span; x++) { + for (int y = 0; y <= height; y++) { + for (int z = 1; z <= depth; z++) { + Block block = this.getBlock(x, y, z); + if (!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) { + return false; + } + if (!block.getMaterial().isSolid()) { + ++emptySpaces; + } else { + ++filledSpaces; + } + } + } + } + if (WorldGenDwarvenStronghold.debug_air) { + return true; + } + return ((float) emptySpaces / (float) (emptySpaces + filledSpaces)) < WorldGenDwarvenStronghold.maxAir;// at + // least + // 75% + // full + } + + private boolean allowBuildOverBlock(Block block) { + if (block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) { + return false; + } + return true; + } + + @Override + public void generate() { + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + for (int x = -width_span; x <= width_span; x++) { + for (int z = 0; z <= depth; z++) { + Object[] blockarray; + + // FLOOR + blockarray = getFloor(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, 0, z); + } + // WALLS + for (int y = 1; y <= height + 1; y++) { + blockarray = getWalls(width_span, height, depth, x, y, z); + if (blockarray != null) { + int meta = 0; + if (blockarray[1] instanceof Integer) { + meta = (Integer) blockarray[1]; + } + if (blockarray[1] instanceof Boolean) { + meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + } + if (blockarray[1] instanceof String) { + meta = (String) blockarray[1] == "Hall" ? getRandomEngravedWall(rand) : 0; + } + placeBlock((Block) blockarray[0], meta, x, y, z); + } + } + // CEILING + blockarray = getCeiling(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height + 1, z); + } + + // TRIM + blockarray = getTrim(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height, z); + if ((Block) blockarray[0] == BlockListMF.reinforced_stone_framed) { + for (int h = height - 1; h > 1; h--) { + placeBlock(BlockListMF.reinforced_stone, h == 2 ? 1 : 0, x, h, z); + } + placeBlock(BlockListMF.reinforced_stone_framed, 0, x, 1, z); + } + } + + } + } + + // DOORWAY + buildDoorway(width_span, depth, height); + + if (lengthId > 0) { + buildNext(width_span, depth, height); + } else { + mapStructure(0, 0, depth, StructureGenDSRoom.class); + } + if (rand.nextInt(3) != 0) { + tryPlaceMinorRoom((width_span), 0, (int) Math.floor((float) depth / 2), rotateLeft()); + } + if (rand.nextInt(3) != 0) { + tryPlaceMinorRoom(-(width_span), 0, (int) Math.floor((float) depth / 2), rotateRight()); + } + if (this instanceof StructureGenDSIntersection || this.lengthId % 2 == 0) { + placeBlock(Blocks.glowstone, 0, 0, height + 1, depth / 2); + } + } + + protected void buildDoorway(int width_span, int depth, int height) { + for (int x = -1; x <= 1; x++) { + for (int y = 1; y <= 3; y++) { + for (int z = 0; z >= -1; z--) { + placeBlock(Blocks.air, 0, x, y, z); + } + } + } + } + + protected void buildNext(int width_span, int depth, int height) { + tryPlaceHall(0, 0, depth, direction); + } + + protected void tryPlaceHall(int x, int y, int z, int d) { + Class extension = getRandomExtension(); + if (extension != null) { + mapStructure(x, y, z, d, extension); + } + } + + protected void tryPlaceMinorRoom(int x, int y, int z, int d) { + Class extension = getRandomMinorRoom(); + if (extension != null) { + mapStructure(x, y, z, d, extension); + } + } + + protected int getHeight() { + return 4; + } + + protected int getDepthSpan() { + return 9; + } + + protected int getWidthSpan() { + return 3; + } + + protected Class getRandomMinorRoom() { + return StructureGenDSRoomSml.class; + } + + protected Class getRandomExtension() { + if (lengthId == 1) { + return StructureGenDSRoom.class; + } + if (deviationCount > 0 && rand.nextInt(4) == 0) { + return StructureGenDSIntersection.class; + } + if (rand.nextInt(16) == 0 && this.yCoord >= StructureGenDSStairs.minLevel) { + return StructureGenDSStairs.class; + } + return StructureGenDSHall.class; + } + + protected Object[] getTrim(int radius, int depth, int x, int z) { + if (x == -radius || x == radius) { + return null; + } + + if (x == -(radius - 1) || x == (radius - 1)) { + if (z == Math.floor((float) depth / 2)) { + return new Object[]{BlockListMF.reinforced_stone_framed, false}; + } + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return null; + } + + protected Object[] getCeiling(int radius, int depth, int x, int z) { + return x == 0 ? new Object[]{BlockListMF.reinforced_stone, false} + : new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + protected Object[] getFloor(int radius, int depth, int x, int z) { + if (x >= -1 && x <= 1) { + return new Object[]{floor, false}; + } + if (x == -radius || x == radius || z == depth || z == 0) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{floor, false}; + } + + protected Object[] getWalls(int radius, int height, int depth, int x, int y, int z) { + if (x != -radius && x != radius && z == 0) { + return new Object[]{Blocks.air, false}; + } + if (x == -radius || x == radius || z == depth) { + return y == height / 2 ? new Object[]{BlockListMF.reinforced_stone, "Hall"} + : new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + return new Object[]{Blocks.air, false}; + } - protected String lootType = ChestGenHooks.DUNGEON_CHEST; - public StructureModuleMF setLoot(String loot) - { - this.lootType = loot; - return this; - } - protected static Block floor = BlockListMF.cobble_pavement; - public static int getRandomEngravedWall(Random rand) - { - return 2 + rand.nextInt(3); - } + public StructureModuleMF setLoot(String loot) { + this.lootType = loot; + return this; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSIntersection.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSIntersection.java index 700abde8..1aac8feb 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSIntersection.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSIntersection.java @@ -7,164 +7,137 @@ import net.minecraft.init.Blocks; import net.minecraft.world.World; -public class StructureGenDSIntersection extends StructureGenDSHall -{ - - public StructureGenDSIntersection(World world, StructureCoordinates position) - { - super(world, position); - } - @Override - protected void buildNext(int width_span, int depth, int height) - { - --deviationCount; - int offset = 0; - boolean[] intersection = getRandomIntersectionPattern(); - if(intersection[0]) - { - tryPlaceHall(0, 0, depth+offset, direction); - } - if(intersection[1]) - { - tryPlaceHall(-(width_span+offset), 0, (int)Math.floor((float)depth/2), rotateRight()); - } - if(intersection[2]) - { - tryPlaceHall((width_span+offset), 0, (int)Math.floor((float)depth/2), rotateLeft()); - } - } - private boolean[] getRandomIntersectionPattern() - { - boolean [][] groups = new boolean[][] - { - new boolean[]{true, true, true}, - new boolean[]{true, true, false}, - new boolean[]{true, false, true}, - new boolean[]{false, true, true}, - }; - - return groups[rand.nextInt(groups.length)]; - } - @Override - protected int getHeight() - { - return 4; - } - @Override - protected int getDepthSpan() - { - return 8; - } - @Override - protected int getWidthSpan() - { - return 4; - } - - protected void tryPlaceMinorRoom(int x, int y, int z, int d) - { - } - @Override - protected Object[] getTrim(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - return null; - } - - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - if((x == -(radius-1) && (z == (depth-1) || z == 1)) || (x == (radius-1) && (z == (depth-1) || z == 1))) - { - return new Object[]{BlockListMF.reinforced_stone_framed, false}; - } - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return null; - } - @Override - protected Object[] getCeiling(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - return null; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - @Override - protected Object[] getFloor(int radius, int depth, int x, int z) - { - if(z == 0 && x >= -1 && x <= 1) - { - return new Object[]{floor, false}; - } - if(x == -radius || x == radius || z == depth || z == 0) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{floor, false}; - } - - @Override - protected Object[] getWalls(int radius, int height, int depth, int x, int y, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - if((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - - return y == height/2 ? new Object[]{BlockListMF.reinforced_stone, "Hall"} : new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - return new Object[]{Blocks.air, false}; - } - - @Override - protected void buildDoorway(int width_span, int depth, int height) - { - for(int x = -2; x <= 2; x++) - { - for(int y = 1; y <= 3; y ++) - { - for(int z = 0; z >= -1; z --) - { - placeBlock(Blocks.air, 0, x, y, z); - } - } - } - for(int x = -1; x <= 1; x++) - { - for(int z = 0; z >= -1; z --) - { - placeBlock(Blocks.air, 0, x, 4, z); - } - } - - placeBlock(BlockListMF.reinforced_stone, 0, -2, 4, 0); - placeBlock(BlockListMF.reinforced_stone, 0, 2, 4, 0); - - EntityMinotaur mob = new EntityMinotaur(worldObj); - this.placeEntity(mob, 0, 0, depth/2); - mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); - mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 1); - } - - @Override - protected Class getRandomExtension() - { - if(lengthId == 1) - { - return StructureGenDSRoom.class; - } - return (yCoord >= StructureGenDSStairs.minLevel && rand.nextInt(3) == 0) ? StructureGenDSStairs.class : StructureGenDSHall.class; - } +public class StructureGenDSIntersection extends StructureGenDSHall { + + public StructureGenDSIntersection(World world, StructureCoordinates position) { + super(world, position); + } + + @Override + protected void buildNext(int width_span, int depth, int height) { + --deviationCount; + int offset = 0; + boolean[] intersection = getRandomIntersectionPattern(); + if (intersection[0]) { + tryPlaceHall(0, 0, depth + offset, direction); + } + if (intersection[1]) { + tryPlaceHall(-(width_span + offset), 0, (int) Math.floor((float) depth / 2), rotateRight()); + } + if (intersection[2]) { + tryPlaceHall((width_span + offset), 0, (int) Math.floor((float) depth / 2), rotateLeft()); + } + } + + private boolean[] getRandomIntersectionPattern() { + boolean[][] groups = new boolean[][]{new boolean[]{true, true, true}, new boolean[]{true, true, false}, + new boolean[]{true, false, true}, new boolean[]{false, true, true},}; + + return groups[rand.nextInt(groups.length)]; + } + + @Override + protected int getHeight() { + return 4; + } + + @Override + protected int getDepthSpan() { + return 8; + } + + @Override + protected int getWidthSpan() { + return 4; + } + + protected void tryPlaceMinorRoom(int x, int y, int z, int d) { + } + + @Override + protected Object[] getTrim(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + return null; + } + + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + if ((x == -(radius - 1) && (z == (depth - 1) || z == 1)) + || (x == (radius - 1) && (z == (depth - 1) || z == 1))) { + return new Object[]{BlockListMF.reinforced_stone_framed, false}; + } + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return null; + } + + @Override + protected Object[] getCeiling(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + return null; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + @Override + protected Object[] getFloor(int radius, int depth, int x, int z) { + if (z == 0 && x >= -1 && x <= 1) { + return new Object[]{floor, false}; + } + if (x == -radius || x == radius || z == depth || z == 0) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{floor, false}; + } + + @Override + protected Object[] getWalls(int radius, int height, int depth, int x, int y, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + if ((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + + return y == height / 2 ? new Object[]{BlockListMF.reinforced_stone, "Hall"} + : new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + return new Object[]{Blocks.air, false}; + } + + @Override + protected void buildDoorway(int width_span, int depth, int height) { + for (int x = -2; x <= 2; x++) { + for (int y = 1; y <= 3; y++) { + for (int z = 0; z >= -1; z--) { + placeBlock(Blocks.air, 0, x, y, z); + } + } + } + for (int x = -1; x <= 1; x++) { + for (int z = 0; z >= -1; z--) { + placeBlock(Blocks.air, 0, x, 4, z); + } + } + + placeBlock(BlockListMF.reinforced_stone, 0, -2, 4, 0); + placeBlock(BlockListMF.reinforced_stone, 0, 2, 4, 0); + + EntityMinotaur mob = new EntityMinotaur(worldObj); + this.placeEntity(mob, 0, 0, depth / 2); + mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); + mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 1); + } + + @Override + protected Class getRandomExtension() { + if (lengthId == 1) { + return StructureGenDSRoom.class; + } + return (yCoord >= StructureGenDSStairs.minLevel && rand.nextInt(3) == 0) ? StructureGenDSStairs.class + : StructureGenDSHall.class; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoom.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoom.java index 201dc5f4..4ea1b96a 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoom.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoom.java @@ -24,580 +24,504 @@ import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class StructureGenDSRoom extends StructureModuleMF -{ - private String type = "Basic"; - private static final String[] possible_types = new String[]{"Living","Forge","Study","Armoury"}; - public StructureGenDSRoom(World world, StructureCoordinates position) - { - super(world, position); - randomiseType(); - } - public StructureGenDSRoom(World world, int x, int y, int z, int direction) - { - super(world, x, y, z, direction); - randomiseType(); - } - private void randomiseType() - { - type = geRandomType(); - } - /** - * @return - * 10% for Armoury----20& for Forge----30% for Study----40% for Living - */ - private String geRandomType() - { - int c = rand.nextInt(10); - if(c == 0)return "Armoury";//0 (10%) - else if(c < 3) return "Forge";//1,2 (20%) - else if(c < 6) return "Study";//3,4,5 (30%) - - return "Living";//6,7,8,9 (40%) - } - @Override - public boolean canGenerate() - { - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - int filledSpaces = 0, emptySpaces = 0; - for(int x = -width_span; x <= width_span; x ++) - { - for(int y = 0; y <= height; y ++) - { - for(int z = 1; z <= depth; z ++) - { - Block block = this.getBlock(x, y, z); - if(!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) - { - return false; - } - if(!block.getMaterial().isSolid()) - { - ++emptySpaces; - } - else - { - ++filledSpaces; - } - } - } - } - if(WorldGenDwarvenStronghold.debug_air) - { - return true; - } - return ((float) emptySpaces / (float)(emptySpaces+filledSpaces) ) < WorldGenDwarvenStronghold.maxAir;//at least 75% full - } - - private boolean allowBuildOverBlock(Block block) - { - if(block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) - { - return false; - } - return true; - } - @Override - public void generate() - { - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - for(int x = -width_span; x <= width_span; x ++) - { - for(int z = 0; z <= depth; z ++) - { - Object[] blockarray; - //FLOOR - blockarray = getFloor(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, 0, z); - } - //WALLS - for(int y = 1; y <= height+1; y ++) - { - blockarray = getWalls(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, y, z); - } - } - //CEILING - blockarray = getCeiling(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height+1, z); - } - - //TRIM - blockarray = getTrim(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height, z); - if((Block)blockarray[0] == BlockListMF.reinforced_stone_framed) - { - for(int h = height-1; h > 1; h --) - { - placeBlock(h == 4 ? Blocks.glowstone : BlockListMF.reinforced_stone, h == 2 ? 1 : 0, x, h, z); - } - placeBlock(BlockListMF.reinforced_stone_framed, 0, x, 1, z); - } - } - - } - } - - //DOORWAY - buildDoorway(width_span, depth, height); - - if(type.equalsIgnoreCase("Living")) - { - generateLivingHub(); - } - if(type.equalsIgnoreCase("Armoury")) - { - generateArmoury(); - } - if(type.equalsIgnoreCase("Forge")) - { - generateForge(); - } - if(type.equalsIgnoreCase("Study")) - { - generateStudy(); - } - } - - protected void buildDoorway(int width_span, int depth, int height) - { - for(int x = -1; x <= 1; x++) - { - for(int y = 1; y <= 3; y ++) - { - for(int z = 0; z >= -1; z --) - { - placeBlock(Blocks.air, 0, x, y, z); - } - } - } - } - protected void tryPlaceHall(int x, int y, int z, int d) - { - Class extension = getRandomExtension(); - if(extension != null) - { - mapStructure(x, y, z, d, extension); - } - } - protected int getHeight() - { - if(type.equalsIgnoreCase("Forge")) - { - return 7; - } - return 5; - } - protected int getDepthSpan() - { - if(type.equalsIgnoreCase("Living")) - { - return 19; - } - return 13; - } - protected int getWidthSpan() - { - return 5; - } - protected Class getRandomExtension() - { - if(rand.nextInt(4) == 0) - { - return StructureGenDSIntersection.class; - } - if( rand.nextInt(8) == 0 && this.yCoord > 24) - { - return StructureGenDSStairs.class; - } - return StructureGenDSRoom.class; - } - - - private Object[] getTrim(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - return null; - } - if(x == -(radius-1) || x == (radius-1)) - { - if(z == (int)Math.ceil( (float)depth / 2) || z == (int)Math.floor( (float)depth / 2)) - { - return new Object[]{BlockListMF.reinforced_stone_framed, false}; - } - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - if((x == -(radius-1) && (z == (depth-1) || z == 1)) || (x == (radius-1) && (z == (depth-1) || z == 1))) - { - return new Object[]{BlockListMF.reinforced_stone_framed, false}; - } - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return null; - } - private Object[] getCeiling(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - return null; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - - private Object[] getFloor(int radius, int depth, int x, int z) - { - if(type.equalsIgnoreCase("Living") || type.equalsIgnoreCase("Study")) - { - floor_block = BlockListMF.refined_planks; - if(x > -2 && x < 2 && z > 3 && z < (depth-3)) - { - floor_block = Blocks.obsidian; - } - } - if(z < 2 && x >= -1 && x <= 1) - { - return new Object[]{floor_block, false}; - } - if(x == -radius || x == radius || z == depth || z == 0) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{floor_block, false}; - } - - private Object[] getWalls(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius || z == depth || z == 0) - { - if((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - return new Object[]{Blocks.air, false}; - } - - protected String lootType = ChestGenHooks.DUNGEON_CHEST; - public StructureModuleMF setLoot(String loot) - { - this.lootType = loot; - return this; - } - protected Block floor_block = BlockListMF.cobble_pavement; - - public void generateLivingHub() - { - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - - int zOffset = 4; - - boolean hall1 = rand.nextInt(3) == 0, hall2 = rand.nextInt(3) == 0, hall3 = rand.nextInt(3) == 0; - int offset1 = hall1 ? width_span+1 : width_span; - int offset2 = hall2 ? -(width_span+1) : -width_span; - int offset3 = hall3 ? depth+1 : depth; - - tryPlaceMinorRoom(width_span, 0, zOffset, rotateLeft(), false); - tryPlaceMinorRoom(offset1, 0, depth-zOffset, rotateLeft(), hall1); - - tryPlaceMinorRoom(-width_span, 0, zOffset, rotateRight(), false); - tryPlaceMinorRoom(offset2, 0, depth-zOffset, rotateRight(), hall2); - tryPlaceMinorRoom(0, 0, offset3, direction, hall3); - //this.placeSpawner(0, 1, depth-5); - - EntityMinotaur mob = new EntityMinotaur(worldObj); - this.placeEntity(mob, 0, 1, depth-5); - mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); - mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 1); - - } - - public void generateStudy() - { - int width = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - - for(int z = 0; z < depth; z ++) - { - int ystart = 1; - if(z == (int)Math.ceil((float)depth/2)+1 || z == (int)Math.floor((float)depth/2)-1) - { - ystart = 3; - placeChest(-(width-1), 1, z, rotateLeft(), LootTypes.DWARVEN_STUDY); - placeChest(width-1, 1, z, rotateRight(), LootTypes.DWARVEN_STUDY); - } - for(int y = ystart; y < height; y ++) - { - if(getBlock(-(width-1), y, z).getMaterial().isReplaceable()) - { - placeBlock(Blocks.bookshelf, 0, -(width-1), y, z); - } - if(getBlock(width-1, y, z).getMaterial().isReplaceable()) - { - placeBlock(Blocks.bookshelf, 0, width-1, y, z); - } - } - } - for(int x = 0; x < 3; x ++) - { - placeBlock(Blocks.double_stone_slab, 0, -1+x, 1, (int)Math.floor((float)depth/2)-1); - placeBlock(Blocks.double_stone_slab, 0, -1+x, 1, (int)Math.ceil((float)depth/2)+1); - } - placeBlock(BlockListMF.schematic_general, 0, 0, 2, (int)Math.floor((float)depth/2)-1); - placeBlock(BlockListMF.schematic_general, 1, 0, 2, (int)Math.ceil((float)depth/2)+1); - //this.placeSpawner(0, 1, depth/2, "Silverfish"); - EntityMinotaur mob = new EntityMinotaur(worldObj); - this.placeEntity(mob, 0, 1, depth/2); - mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); - mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 2); - } - - public void generateArmoury() - { - int width = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - - for(int y = 1; y <= 4; y ++) - { - placeBlock(BlockListMF.frame_block, 0, 0, y, depth-1); - - placeBlock(BlockListMF.frame_block, 0, -1, y, depth-2); - placeBlock(BlockListMF.frame_block, 0, 1, y, depth-2); - } - placeBlock(BlockListMF.cogwork_builder, 0, 0, 4, depth-2); - - int z = (int)Math.ceil( (float)depth / 2); - for(int x = -width; x <= width; x ++) - { - placeBlock(x == 0 ? BlockListMF.reinforced_stone_framediron : BlockListMF.reinforced_stone, 0, x, height, z); - if(x <-1 || x > 1) - { - if(getBlock(x, 1, z).getMaterial().isReplaceable()) - { - Block block = (x==-2 || x==2) ? BlockListMF.reinforced_stone_framed : BlockListMF.reinforced_stone; - placeBlock(block, 0, x, 1, z); - } - } - for(int y = 2; y < height; y ++) - { - if(x <-1 || x > 1 || y > 3) - { - if(getBlock(x, y, z).getMaterial().isReplaceable()) - { - placeBlock(BlockListMF.bars[0], 0, x, y, z); - } - } - } - } - placeChest(-(width-2), 1, z-1, direction, LootTypes.DWARVEN_ARMOURY); - placeChest(-(width-3), 1, z-1, direction, LootTypes.DWARVEN_ARMOURY); - placeChest((width-2), 1, z-1, direction, LootTypes.DWARVEN_ARMOURY); - placeChest((width-3), 1, z-1, direction, LootTypes.DWARVEN_ARMOURY); - - for(int z1 = 1; z1 < z; z1 ++) - { - for(int y = 1; y < height; y ++) - { - if(getBlock(-(width-1), y, z1).getMaterial().isReplaceable()) - { - if(y == 1 || y == 3) - { - placeAmmoBox(-(width-1), y, z1, rotateRight(), LootTypes.DWARVEN_AMMO); - } - else - { - placeBlock(Blocks.stone_slab, 11, -(width-1), y, z1); - } - } - if(getBlock((width-1), y, z1).getMaterial().isReplaceable()) - { - if(y == 1 || y == 3) - { - placeAmmoBox((width-1), y, z1, rotateLeft(), LootTypes.DWARVEN_AMMO); - } - else - { - placeBlock(Blocks.stone_slab, 11, (width-1), y, z1); - } - } - } - } - for(int z1 = 0; z1 < 4; z1 ++) - { - placeRack((width-1), 2, depth-2-z1, rotateRight()); - placeRack(-(width-1), 2, depth-2-z1, rotateLeft()); - } - placeBlock(BlockListMF.schematic_general, 3, -2, 2, depth-1); - placeBlock(BlockListMF.schematic_general, 4, 2, 2, depth-1); - placeBlock(BlockListMF.reinforced_stone, 0, -2, 1, depth-1); - placeBlock(BlockListMF.reinforced_stone, 0, 2, 1, depth-1); - EntityMinotaur mob = new EntityMinotaur(worldObj); - this.placeEntity(mob, 0, 1, z); - mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); - mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 3); - } - - private void placeRack(int x, int y, int z, int newDirection) - { - placeBlock(BlockListMF.rack_wood, BlockRack.getDirection(newDirection), x, y, z); - TileEntity tile = this.getTileEntity(x, y, z, direction); - if(tile != null && tile instanceof TileEntityRack) - { - setupRack((TileEntityRack)tile); - } - } - private void setupRack(TileEntityRack rack) - { - rack.setMaterial(CustomMaterial.getMaterial("ScrapWood")); - ItemWeaponMF[] items = new ItemWeaponMF[]{CustomToolListMF.standard_sword, CustomToolListMF.standard_waraxe, CustomToolListMF.standard_mace, CustomToolListMF.standard_dagger}; - for(int i = 0; i < rack.getSizeInventory(); i ++) - { - if(rand.nextInt(3) != 0) - { - ItemWeaponMF loot = items[rand.nextInt(items.length)]; - rack.setInventorySlotContents(i, loot.construct("Iron", "ScrapWood")); - } - } - } - private void generateForge() - { - boolean reverseForge = rand.nextBoolean(); - int width = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - int z = (int)Math.ceil( (float)depth / 2); - - int position = reverseForge ? -1 : 1; - - placeBlock(BlockListMF.chimney_stone_extractor, 0, (width*position), 2, z); - placeBlock(BlockListMF.chimney_stone_extractor, 0, (width*position), 2, z-1); - placeBlock(BlockListMF.chimney_pipe, 0, (width*position), 3, z); - placeBlock(BlockListMF.chimney_pipe, 0, (width*position), 3, z-1); - placeBlock(BlockListMF.chimney_pipe, 0, (width*position), 3, z+1); - placeBlock(BlockListMF.chimney_pipe, 0, (width*position), 3, z+2); - placeBlock(BlockListMF.chimney_pipe, 0, ( (width-1)*position), 3, z+2); - placeBlock(BlockListMF.chimney_pipe, 0, ( (width-1)*position), 4, z+2); - placeBlock(BlockListMF.chimney_pipe, 0, ( (width-1)*position), 5, z+2); - - int chestFacing = position < 0 ? rotateLeft() : rotateRight(); - placeChest((-(width-2)*position), 1, z, chestFacing, LootTypes.DWARVEN_FORGE); - placeChest((-(width-2)*position), 1, z-1, chestFacing, LootTypes.DWARVEN_FORGE); - - placeBlock(BlockListMF.forge, 0, ( (width-1)*position), 1, z); - placeBlock(BlockListMF.forge, 0, ( (width-1)*position), 1, z-1); - placeBlock(Blocks.air, 0, ( (width-1)*position), 2, z); - placeBlock(Blocks.air, 0, ( (width-1)*position), 2, z-1); - - placeBlock(BlockListMF.schematic_general, 2,( (width-1)*position), 2, z+2); - placeBlock(BlockListMF.schematic_general, 5,( (width-1)*position), 2, z-3); - placeBlock(BlockListMF.reinforced_stone, 0, ( (width-1)*position), 1, z+2); - placeBlock(BlockListMF.reinforced_stone, 0, ( (width-1)*position), 1, z-3); - - placeBlock(BlockListMF.reinforced_stone_framed, 0, ( (width-1)*position), 1, z-2); - placeBlock(BlockListMF.reinforced_stone_framed, 0, ( (width-1)*position), 1, z+1); - placeBlock(BlockListMF.reinforced_stone, 0, ( (width-1)*position), 2, z-2); - placeBlock(BlockListMF.reinforced_stone, 0, ( (width-1)*position), 2, z+1); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, ( (width-1)*position), 3, z-2); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, ( (width-1)*position), 3, z+1); - - placeBlock(BlockListMF.anvil[1], rotateLeft(), position*2, 1, z); - placeBlock(Blocks.cauldron, 0, position*2, 1, z-1); - - placeMiscMachine1(-(width-2)*position, 0, depth-3); - placeMiscMachine1(-(width-2)*position, 0, 3); - //this.placeSpawner(0, 1, depth/2); - - EntityMinotaur mob = new EntityMinotaur(worldObj); - this.placeEntity(mob, 0, 1, depth/2); - mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); - mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 2); - - } - - private void placeMiscMachine1(int x, int y, int z) - { - placeBlock(Blocks.lava, 0, x, y, z); - placeBlock(BlockListMF.reinforced_stone_framed, 0, x-1, y+1, z-1); - placeBlock(BlockListMF.reinforced_stone_framed, 0, x-1, y+1, z+1); - placeBlock(BlockListMF.reinforced_stone_framed, 0, x+1, y+1, z-1); - placeBlock(BlockListMF.reinforced_stone_framed, 0, x+1, y+1, z+1); - placeBlock(BlockListMF.reinforced_stone, 0, x-1, y+2, z-1); - placeBlock(BlockListMF.reinforced_stone, 0, x-1, y+2, z+1); - placeBlock(BlockListMF.reinforced_stone, 0, x+1, y+2, z-1); - placeBlock(BlockListMF.reinforced_stone, 0, x+1, y+2, z+1); - placeBlock(BlockListMF.reinforced_stone, 0, x, y+2, z); - placeBlock(BlockListMF.reinforced_stone, 0, x, y+3, z); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, x+1, y+2, z); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, x-1, y+2, z); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, x, y+2, z+1); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, x, y+2, z-1); - - } - private void placeChest(int x, int y, int z, int d, String loot) - { - placeBlock(Blocks.chest, d, x, y, z); - TileEntityChest tile = (TileEntityChest)getTileEntity(x, y, z, direction); - - if (tile != null) - { - WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tile, 5+rand.nextInt(5)); - } - } - private void placeAmmoBox(int x, int y, int z, int d, String loot) - { - placeBlock(BlockListMF.ammo_box_basic, d, x, y, z); - TileEntityAmmoBox tile = (TileEntityAmmoBox)getTileEntity(x, y, z, direction); - - if (tile != null) - { +public class StructureGenDSRoom extends StructureModuleMF { + private static final String[] possible_types = new String[]{"Living", "Forge", "Study", "Armoury"}; + protected String lootType = ChestGenHooks.DUNGEON_CHEST; + protected Block floor_block = BlockListMF.cobble_pavement; + private String type = "Basic"; + + public StructureGenDSRoom(World world, StructureCoordinates position) { + super(world, position); + randomiseType(); + } + + public StructureGenDSRoom(World world, int x, int y, int z, int direction) { + super(world, x, y, z, direction); + randomiseType(); + } + + private void randomiseType() { + type = geRandomType(); + } + + /** + * @return 10% for Armoury----20& for Forge----30% for Study----40% for Living + */ + private String geRandomType() { + int c = rand.nextInt(10); + if (c == 0) + return "Armoury";// 0 (10%) + else if (c < 3) + return "Forge";// 1,2 (20%) + else if (c < 6) + return "Study";// 3,4,5 (30%) + + return "Living";// 6,7,8,9 (40%) + } + + @Override + public boolean canGenerate() { + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + int filledSpaces = 0, emptySpaces = 0; + for (int x = -width_span; x <= width_span; x++) { + for (int y = 0; y <= height; y++) { + for (int z = 1; z <= depth; z++) { + Block block = this.getBlock(x, y, z); + if (!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) { + return false; + } + if (!block.getMaterial().isSolid()) { + ++emptySpaces; + } else { + ++filledSpaces; + } + } + } + } + if (WorldGenDwarvenStronghold.debug_air) { + return true; + } + return ((float) emptySpaces / (float) (emptySpaces + filledSpaces)) < WorldGenDwarvenStronghold.maxAir;// at + // least + // 75% + // full + } + + private boolean allowBuildOverBlock(Block block) { + if (block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) { + return false; + } + return true; + } + + @Override + public void generate() { + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + for (int x = -width_span; x <= width_span; x++) { + for (int z = 0; z <= depth; z++) { + Object[] blockarray; + // FLOOR + blockarray = getFloor(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, 0, z); + } + // WALLS + for (int y = 1; y <= height + 1; y++) { + blockarray = getWalls(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, y, z); + } + } + // CEILING + blockarray = getCeiling(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height + 1, z); + } + + // TRIM + blockarray = getTrim(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height, z); + if ((Block) blockarray[0] == BlockListMF.reinforced_stone_framed) { + for (int h = height - 1; h > 1; h--) { + placeBlock(h == 4 ? Blocks.glowstone : BlockListMF.reinforced_stone, h == 2 ? 1 : 0, x, h, + z); + } + placeBlock(BlockListMF.reinforced_stone_framed, 0, x, 1, z); + } + } + + } + } + + // DOORWAY + buildDoorway(width_span, depth, height); + + if (type.equalsIgnoreCase("Living")) { + generateLivingHub(); + } + if (type.equalsIgnoreCase("Armoury")) { + generateArmoury(); + } + if (type.equalsIgnoreCase("Forge")) { + generateForge(); + } + if (type.equalsIgnoreCase("Study")) { + generateStudy(); + } + } + + protected void buildDoorway(int width_span, int depth, int height) { + for (int x = -1; x <= 1; x++) { + for (int y = 1; y <= 3; y++) { + for (int z = 0; z >= -1; z--) { + placeBlock(Blocks.air, 0, x, y, z); + } + } + } + } + + protected void tryPlaceHall(int x, int y, int z, int d) { + Class extension = getRandomExtension(); + if (extension != null) { + mapStructure(x, y, z, d, extension); + } + } + + protected int getHeight() { + if (type.equalsIgnoreCase("Forge")) { + return 7; + } + return 5; + } + + protected int getDepthSpan() { + if (type.equalsIgnoreCase("Living")) { + return 19; + } + return 13; + } + + protected int getWidthSpan() { + return 5; + } + + protected Class getRandomExtension() { + if (rand.nextInt(4) == 0) { + return StructureGenDSIntersection.class; + } + if (rand.nextInt(8) == 0 && this.yCoord > 24) { + return StructureGenDSStairs.class; + } + return StructureGenDSRoom.class; + } + + private Object[] getTrim(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + return null; + } + if (x == -(radius - 1) || x == (radius - 1)) { + if (z == (int) Math.ceil((float) depth / 2) || z == (int) Math.floor((float) depth / 2)) { + return new Object[]{BlockListMF.reinforced_stone_framed, false}; + } + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + if ((x == -(radius - 1) && (z == (depth - 1) || z == 1)) + || (x == (radius - 1) && (z == (depth - 1) || z == 1))) { + return new Object[]{BlockListMF.reinforced_stone_framed, false}; + } + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return null; + } + + private Object[] getCeiling(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + return null; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + private Object[] getFloor(int radius, int depth, int x, int z) { + if (type.equalsIgnoreCase("Living") || type.equalsIgnoreCase("Study")) { + floor_block = BlockListMF.refined_planks; + if (x > -2 && x < 2 && z > 3 && z < (depth - 3)) { + floor_block = Blocks.obsidian; + } + } + if (z < 2 && x >= -1 && x <= 1) { + return new Object[]{floor_block, false}; + } + if (x == -radius || x == radius || z == depth || z == 0) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{floor_block, false}; + } + + private Object[] getWalls(int radius, int depth, int x, int z) { + if (x == -radius || x == radius || z == depth || z == 0) { + if ((x == -radius && (z == depth || z == 0)) || (x == radius && (z == depth || z == 0))) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + return new Object[]{Blocks.air, false}; + } + + public StructureModuleMF setLoot(String loot) { + this.lootType = loot; + return this; + } + + public void generateLivingHub() { + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + + int zOffset = 4; + + boolean hall1 = rand.nextInt(3) == 0, hall2 = rand.nextInt(3) == 0, hall3 = rand.nextInt(3) == 0; + int offset1 = hall1 ? width_span + 1 : width_span; + int offset2 = hall2 ? -(width_span + 1) : -width_span; + int offset3 = hall3 ? depth + 1 : depth; + + tryPlaceMinorRoom(width_span, 0, zOffset, rotateLeft(), false); + tryPlaceMinorRoom(offset1, 0, depth - zOffset, rotateLeft(), hall1); + + tryPlaceMinorRoom(-width_span, 0, zOffset, rotateRight(), false); + tryPlaceMinorRoom(offset2, 0, depth - zOffset, rotateRight(), hall2); + tryPlaceMinorRoom(0, 0, offset3, direction, hall3); + // this.placeSpawner(0, 1, depth-5); + + EntityMinotaur mob = new EntityMinotaur(worldObj); + this.placeEntity(mob, 0, 1, depth - 5); + mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); + mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 1); + + } + + public void generateStudy() { + int width = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + + for (int z = 0; z < depth; z++) { + int ystart = 1; + if (z == (int) Math.ceil((float) depth / 2) + 1 || z == (int) Math.floor((float) depth / 2) - 1) { + ystart = 3; + placeChest(-(width - 1), 1, z, rotateLeft(), LootTypes.DWARVEN_STUDY); + placeChest(width - 1, 1, z, rotateRight(), LootTypes.DWARVEN_STUDY); + } + for (int y = ystart; y < height; y++) { + if (getBlock(-(width - 1), y, z).getMaterial().isReplaceable()) { + placeBlock(Blocks.bookshelf, 0, -(width - 1), y, z); + } + if (getBlock(width - 1, y, z).getMaterial().isReplaceable()) { + placeBlock(Blocks.bookshelf, 0, width - 1, y, z); + } + } + } + for (int x = 0; x < 3; x++) { + placeBlock(Blocks.double_stone_slab, 0, -1 + x, 1, (int) Math.floor((float) depth / 2) - 1); + placeBlock(Blocks.double_stone_slab, 0, -1 + x, 1, (int) Math.ceil((float) depth / 2) + 1); + } + placeBlock(BlockListMF.schematic_general, 0, 0, 2, (int) Math.floor((float) depth / 2) - 1); + placeBlock(BlockListMF.schematic_general, 1, 0, 2, (int) Math.ceil((float) depth / 2) + 1); + // this.placeSpawner(0, 1, depth/2, "Silverfish"); + EntityMinotaur mob = new EntityMinotaur(worldObj); + this.placeEntity(mob, 0, 1, depth / 2); + mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); + mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 2); + } + + public void generateArmoury() { + int width = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + + for (int y = 1; y <= 4; y++) { + placeBlock(BlockListMF.frame_block, 0, 0, y, depth - 1); + + placeBlock(BlockListMF.frame_block, 0, -1, y, depth - 2); + placeBlock(BlockListMF.frame_block, 0, 1, y, depth - 2); + } + placeBlock(BlockListMF.cogwork_builder, 0, 0, 4, depth - 2); + + int z = (int) Math.ceil((float) depth / 2); + for (int x = -width; x <= width; x++) { + placeBlock(x == 0 ? BlockListMF.reinforced_stone_framediron : BlockListMF.reinforced_stone, 0, x, height, + z); + if (x < -1 || x > 1) { + if (getBlock(x, 1, z).getMaterial().isReplaceable()) { + Block block = (x == -2 || x == 2) ? BlockListMF.reinforced_stone_framed + : BlockListMF.reinforced_stone; + placeBlock(block, 0, x, 1, z); + } + } + for (int y = 2; y < height; y++) { + if (x < -1 || x > 1 || y > 3) { + if (getBlock(x, y, z).getMaterial().isReplaceable()) { + placeBlock(BlockListMF.bars[0], 0, x, y, z); + } + } + } + } + placeChest(-(width - 2), 1, z - 1, direction, LootTypes.DWARVEN_ARMOURY); + placeChest(-(width - 3), 1, z - 1, direction, LootTypes.DWARVEN_ARMOURY); + placeChest((width - 2), 1, z - 1, direction, LootTypes.DWARVEN_ARMOURY); + placeChest((width - 3), 1, z - 1, direction, LootTypes.DWARVEN_ARMOURY); + + for (int z1 = 1; z1 < z; z1++) { + for (int y = 1; y < height; y++) { + if (getBlock(-(width - 1), y, z1).getMaterial().isReplaceable()) { + if (y == 1 || y == 3) { + placeAmmoBox(-(width - 1), y, z1, rotateRight(), LootTypes.DWARVEN_AMMO); + } else { + placeBlock(Blocks.stone_slab, 11, -(width - 1), y, z1); + } + } + if (getBlock((width - 1), y, z1).getMaterial().isReplaceable()) { + if (y == 1 || y == 3) { + placeAmmoBox((width - 1), y, z1, rotateLeft(), LootTypes.DWARVEN_AMMO); + } else { + placeBlock(Blocks.stone_slab, 11, (width - 1), y, z1); + } + } + } + } + for (int z1 = 0; z1 < 4; z1++) { + placeRack((width - 1), 2, depth - 2 - z1, rotateRight()); + placeRack(-(width - 1), 2, depth - 2 - z1, rotateLeft()); + } + placeBlock(BlockListMF.schematic_general, 3, -2, 2, depth - 1); + placeBlock(BlockListMF.schematic_general, 4, 2, 2, depth - 1); + placeBlock(BlockListMF.reinforced_stone, 0, -2, 1, depth - 1); + placeBlock(BlockListMF.reinforced_stone, 0, 2, 1, depth - 1); + EntityMinotaur mob = new EntityMinotaur(worldObj); + this.placeEntity(mob, 0, 1, z); + mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); + mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 3); + } + + private void placeRack(int x, int y, int z, int newDirection) { + placeBlock(BlockListMF.rack_wood, BlockRack.getDirection(newDirection), x, y, z); + TileEntity tile = this.getTileEntity(x, y, z, direction); + if (tile != null && tile instanceof TileEntityRack) { + setupRack((TileEntityRack) tile); + } + } + + private void setupRack(TileEntityRack rack) { + rack.setMaterial(CustomMaterial.getMaterial("ScrapWood")); + ItemWeaponMF[] items = new ItemWeaponMF[]{CustomToolListMF.standard_sword, CustomToolListMF.standard_waraxe, + CustomToolListMF.standard_mace, CustomToolListMF.standard_dagger}; + for (int i = 0; i < rack.getSizeInventory(); i++) { + if (rand.nextInt(3) != 0) { + ItemWeaponMF loot = items[rand.nextInt(items.length)]; + rack.setInventorySlotContents(i, loot.construct("Iron", "ScrapWood")); + } + } + } + + private void generateForge() { + boolean reverseForge = rand.nextBoolean(); + int width = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + int z = (int) Math.ceil((float) depth / 2); + + int position = reverseForge ? -1 : 1; + + placeBlock(BlockListMF.chimney_stone_extractor, 0, (width * position), 2, z); + placeBlock(BlockListMF.chimney_stone_extractor, 0, (width * position), 2, z - 1); + placeBlock(BlockListMF.chimney_pipe, 0, (width * position), 3, z); + placeBlock(BlockListMF.chimney_pipe, 0, (width * position), 3, z - 1); + placeBlock(BlockListMF.chimney_pipe, 0, (width * position), 3, z + 1); + placeBlock(BlockListMF.chimney_pipe, 0, (width * position), 3, z + 2); + placeBlock(BlockListMF.chimney_pipe, 0, ((width - 1) * position), 3, z + 2); + placeBlock(BlockListMF.chimney_pipe, 0, ((width - 1) * position), 4, z + 2); + placeBlock(BlockListMF.chimney_pipe, 0, ((width - 1) * position), 5, z + 2); + + int chestFacing = position < 0 ? rotateLeft() : rotateRight(); + placeChest((-(width - 2) * position), 1, z, chestFacing, LootTypes.DWARVEN_FORGE); + placeChest((-(width - 2) * position), 1, z - 1, chestFacing, LootTypes.DWARVEN_FORGE); + + placeBlock(BlockListMF.forge, 0, ((width - 1) * position), 1, z); + placeBlock(BlockListMF.forge, 0, ((width - 1) * position), 1, z - 1); + placeBlock(Blocks.air, 0, ((width - 1) * position), 2, z); + placeBlock(Blocks.air, 0, ((width - 1) * position), 2, z - 1); + + placeBlock(BlockListMF.schematic_general, 2, ((width - 1) * position), 2, z + 2); + placeBlock(BlockListMF.schematic_general, 5, ((width - 1) * position), 2, z - 3); + placeBlock(BlockListMF.reinforced_stone, 0, ((width - 1) * position), 1, z + 2); + placeBlock(BlockListMF.reinforced_stone, 0, ((width - 1) * position), 1, z - 3); + + placeBlock(BlockListMF.reinforced_stone_framed, 0, ((width - 1) * position), 1, z - 2); + placeBlock(BlockListMF.reinforced_stone_framed, 0, ((width - 1) * position), 1, z + 1); + placeBlock(BlockListMF.reinforced_stone, 0, ((width - 1) * position), 2, z - 2); + placeBlock(BlockListMF.reinforced_stone, 0, ((width - 1) * position), 2, z + 1); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, ((width - 1) * position), 3, z - 2); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, ((width - 1) * position), 3, z + 1); + + placeBlock(BlockListMF.anvil[1], rotateLeft(), position * 2, 1, z); + placeBlock(Blocks.cauldron, 0, position * 2, 1, z - 1); + + placeMiscMachine1(-(width - 2) * position, 0, depth - 3); + placeMiscMachine1(-(width - 2) * position, 0, 3); + // this.placeSpawner(0, 1, depth/2); + + EntityMinotaur mob = new EntityMinotaur(worldObj); + this.placeEntity(mob, 0, 1, depth / 2); + mob.setSpecies(MinotaurBreed.getEnvironment(subtype)); + mob.worldGenTier(MinotaurBreed.getEnvironment(subtype), 2); + + } + + private void placeMiscMachine1(int x, int y, int z) { + placeBlock(Blocks.lava, 0, x, y, z); + placeBlock(BlockListMF.reinforced_stone_framed, 0, x - 1, y + 1, z - 1); + placeBlock(BlockListMF.reinforced_stone_framed, 0, x - 1, y + 1, z + 1); + placeBlock(BlockListMF.reinforced_stone_framed, 0, x + 1, y + 1, z - 1); + placeBlock(BlockListMF.reinforced_stone_framed, 0, x + 1, y + 1, z + 1); + placeBlock(BlockListMF.reinforced_stone, 0, x - 1, y + 2, z - 1); + placeBlock(BlockListMF.reinforced_stone, 0, x - 1, y + 2, z + 1); + placeBlock(BlockListMF.reinforced_stone, 0, x + 1, y + 2, z - 1); + placeBlock(BlockListMF.reinforced_stone, 0, x + 1, y + 2, z + 1); + placeBlock(BlockListMF.reinforced_stone, 0, x, y + 2, z); + placeBlock(BlockListMF.reinforced_stone, 0, x, y + 3, z); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, x + 1, y + 2, z); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, x - 1, y + 2, z); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, x, y + 2, z + 1); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, x, y + 2, z - 1); + + } + + private void placeChest(int x, int y, int z, int d, String loot) { + placeBlock(Blocks.chest, d, x, y, z); + TileEntityChest tile = (TileEntityChest) getTileEntity(x, y, z, direction); + + if (tile != null) { + WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tile, + 5 + rand.nextInt(5)); + } + } + + private void placeAmmoBox(int x, int y, int z, int d, String loot) { + placeBlock(BlockListMF.ammo_box_basic, d, x, y, z); + TileEntityAmmoBox tile = (TileEntityAmmoBox) getTileEntity(x, y, z, direction); + + if (tile != null) { ItemStack ammo = ChestGenHooks.getOneItem(loot, rand); tile.setMaterial(WoodMaterial.getMaterial("RefinedWood")); tile.ammo = ammo; - tile.stock = ammo.getMaxStackSize() * (rand.nextInt(2) + 1) + (ammo.stackSize > 1 ? rand.nextInt(ammo.stackSize) : 0); - if(ammo.getItem() instanceof ItemBomb || ammo.getItem() instanceof ItemMine) - { - tile.stock = Math.max(1, tile.stock / 4); + tile.stock = ammo.getMaxStackSize() * (rand.nextInt(2) + 1) + + (ammo.stackSize > 1 ? rand.nextInt(ammo.stackSize) : 0); + if (ammo.getItem() instanceof ItemBomb || ammo.getItem() instanceof ItemMine) { + tile.stock = Math.max(1, tile.stock / 4); } ammo = null; } - } - protected void tryPlaceMinorRoom(int x, int y, int z, int d, boolean hall) - { - Class extension = hall ? StructureGenDSHall.class : StructureGenDSRoomSml2.class; - if(extension != null) - { - mapStructure(x, y, z, d, extension); - } - } + } + + protected void tryPlaceMinorRoom(int x, int y, int z, int d, boolean hall) { + Class extension = hall ? StructureGenDSHall.class : StructureGenDSRoomSml2.class; + if (extension != null) { + mapStructure(x, y, z, d, extension); + } + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoomSml.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoomSml.java index f88bfd13..dca41b80 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoomSml.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoomSml.java @@ -1,10 +1,6 @@ package minefantasy.mf2.mechanics.worldGen.structure.dwarven; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.block.tileentity.decor.TileEntityAmmoBox; -import minefantasy.mf2.entity.EntityCogwork; -import minefantasy.mf2.item.ItemArtefact; -import minefantasy.mf2.material.WoodMaterial; import minefantasy.mf2.mechanics.worldGen.structure.LootTypes; import minefantasy.mf2.mechanics.worldGen.structure.StructureGenAncientForge; import minefantasy.mf2.mechanics.worldGen.structure.StructureModuleMF; @@ -15,184 +11,159 @@ import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class StructureGenDSRoomSml extends StructureModuleMF -{ - public StructureGenDSRoomSml(World world, StructureCoordinates position) - { - super(world, position); - } - - protected int getHeight() - { - return 5; - } - protected int getDepth() - { - return 8; - } - protected int getWidth() - { - return 4; - } - @Override - public boolean canGenerate() - { - int width = getWidth(), depth = getDepth(), height = getHeight(); - int filledSpaces = 0, emptySpaces = 0; - - for(int x = -width; x <= width; x ++) - { - for(int y = 0; y <= height; y ++) - { - for(int z = 1; z <= depth; z ++) - { - Block block = this.getBlock(x, y, z); - if(!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) - { - return false; - } - if(!block.getMaterial().isSolid()) - { - ++emptySpaces; - } - else - { - ++filledSpaces; - } - } - } - } - if(WorldGenDwarvenStronghold.debug_air) - { - return true; - } - return ((float) emptySpaces / (float)(emptySpaces+filledSpaces) ) < WorldGenDwarvenStronghold.maxAir;//at least 75% full - } - private boolean allowBuildOverBlock(Block block) - { - if(block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) - { - return false; - } - return true; - } - - - @Override - public void generate() - { - int width = getWidth(), depth = getDepth(), height = getHeight(); - - for(int x = -width; x <= width; x ++) - { - for(int z = 0; z <= depth; z ++) - { - Object[] blockarray; - //FLOOR - blockarray = getFloor(width, depth, x, z); - if(blockarray != null) - { - placeBlock((Block)blockarray[0], 0, x, 0, z); - } - //WALLS - for(int y = 1; y <= height; y ++) - { - blockarray = getWalls(width, depth, x, z); - if(blockarray != null && this.allowBuildOverBlock(getBlock(x, y, z))) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, y, z); - } - } - //CEILING - blockarray = getCeiling(width, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height, z); - } - } - } - placeBlock(Blocks.air, 0, 0, 1, 0); - placeBlock(Blocks.air, 0, 0, 2, 0); - - placeBlock(BlockListMF.reinforced_stone_framed, 0, -1, 1, -1); - placeBlock(BlockListMF.reinforced_stone, 0, -1, 2, -1); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, -1, 3, -1); - - placeBlock(BlockListMF.reinforced_stone_framed, 0, 1, 1, -1); - placeBlock(BlockListMF.reinforced_stone, 0, 1, 2, -1); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, 1, 3, -1); - - placeBlock(BlockListMF.reinforced_stone, 1, 0, 3, -1); - placeBlock(Blocks.air, 0, 0, 1, -1); - placeBlock(Blocks.air, 0, 0, 2, -1); - - buildHomeFurnishings(width, depth, height); - } - - private Object[] getFloor(int width, int depth, int x, int z) - { - if(x== -(width-1) || x == (width-1) || z == 1 || z == depth-1) - { - return new Object[]{BlockListMF.reinforced_stone, 0}; - } - return new Object[]{BlockListMF.cobble_pavement, 0}; - } - private Object[] getCeiling(int width, int depth, int x, int z) - { - if(x== -(width-1) || x == (width-1) || z == 1 || z == depth-1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - private Object[] getWalls(int width, int depth, int x, int z) - { - if(x == -width || x == width || z == depth ||z == 0) - { - if((x == -width && (z == depth || z == 0)) || (x == width && (z == depth || z == 0))) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - return new Object[]{Blocks.air, false}; - } - - private void buildHomeFurnishings(int width, int depth, int height) - { - placeBlock(Blocks.furnace, rotateLeft(), width, 2, 2); - - placeBlock(Blocks.double_stone_slab, 0, width-3, 1, 1); - placeBlock(Blocks.double_stone_slab, 0, width-3, 1, 2); - - for(int x = width-1; x >= (width-4); x --) - { - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 1, 4); - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 2, 4); - placeBlock(Blocks.stone_slab, 0, x, 3, 4); - } - placeBlock(Blocks.stone_slab, 0, width-1, 1, 6); - placeBlock(Blocks.stone_slab, 0, width-2, 1, 6); - placeBlock(Blocks.cauldron, 0, width-2, 1, 1); - - placeBlock(Blocks.stone_brick_stairs, this.getStairDirection(reverse()), -(width-1), 1, 1); - placeBlock(Blocks.stone_slab, 8, -(width-1), 1, 2); - placeBlock(Blocks.stone_brick_stairs, this.getStairDirection(direction), -(width-1), 1, 3); - - - placeChest(width-3, 1, 6, rotateLeft(), LootTypes.DWARVEN_HOME); - } - private void placeChest(int x, int y, int z, int d, String loot) - { - placeBlock(Blocks.chest, d, x, y, z); - TileEntityChest tile = (TileEntityChest)getTileEntity(x, y, z, direction); - - if (tile != null) - { - WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tile, 2+rand.nextInt(3)); +public class StructureGenDSRoomSml extends StructureModuleMF { + public StructureGenDSRoomSml(World world, StructureCoordinates position) { + super(world, position); + } + + protected int getHeight() { + return 5; + } + + protected int getDepth() { + return 8; + } + + protected int getWidth() { + return 4; + } + + @Override + public boolean canGenerate() { + int width = getWidth(), depth = getDepth(), height = getHeight(); + int filledSpaces = 0, emptySpaces = 0; + + for (int x = -width; x <= width; x++) { + for (int y = 0; y <= height; y++) { + for (int z = 1; z <= depth; z++) { + Block block = this.getBlock(x, y, z); + if (!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) { + return false; + } + if (!block.getMaterial().isSolid()) { + ++emptySpaces; + } else { + ++filledSpaces; + } + } + } + } + if (WorldGenDwarvenStronghold.debug_air) { + return true; + } + return ((float) emptySpaces / (float) (emptySpaces + filledSpaces)) < WorldGenDwarvenStronghold.maxAir;// at + // least + // 75% + // full + } + + private boolean allowBuildOverBlock(Block block) { + if (block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) { + return false; + } + return true; + } + + @Override + public void generate() { + int width = getWidth(), depth = getDepth(), height = getHeight(); + + for (int x = -width; x <= width; x++) { + for (int z = 0; z <= depth; z++) { + Object[] blockarray; + // FLOOR + blockarray = getFloor(width, depth, x, z); + if (blockarray != null) { + placeBlock((Block) blockarray[0], 0, x, 0, z); + } + // WALLS + for (int y = 1; y <= height; y++) { + blockarray = getWalls(width, depth, x, z); + if (blockarray != null && this.allowBuildOverBlock(getBlock(x, y, z))) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, y, z); + } + } + // CEILING + blockarray = getCeiling(width, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height, z); + } + } + } + placeBlock(Blocks.air, 0, 0, 1, 0); + placeBlock(Blocks.air, 0, 0, 2, 0); + + placeBlock(BlockListMF.reinforced_stone_framed, 0, -1, 1, -1); + placeBlock(BlockListMF.reinforced_stone, 0, -1, 2, -1); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, -1, 3, -1); + + placeBlock(BlockListMF.reinforced_stone_framed, 0, 1, 1, -1); + placeBlock(BlockListMF.reinforced_stone, 0, 1, 2, -1); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, 1, 3, -1); + + placeBlock(BlockListMF.reinforced_stone, 1, 0, 3, -1); + placeBlock(Blocks.air, 0, 0, 1, -1); + placeBlock(Blocks.air, 0, 0, 2, -1); + + buildHomeFurnishings(width, depth, height); + } + + private Object[] getFloor(int width, int depth, int x, int z) { + if (x == -(width - 1) || x == (width - 1) || z == 1 || z == depth - 1) { + return new Object[]{BlockListMF.reinforced_stone, 0}; + } + return new Object[]{BlockListMF.cobble_pavement, 0}; + } + + private Object[] getCeiling(int width, int depth, int x, int z) { + if (x == -(width - 1) || x == (width - 1) || z == 1 || z == depth - 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + private Object[] getWalls(int width, int depth, int x, int z) { + if (x == -width || x == width || z == depth || z == 0) { + if ((x == -width && (z == depth || z == 0)) || (x == width && (z == depth || z == 0))) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + return new Object[]{Blocks.air, false}; + } + + private void buildHomeFurnishings(int width, int depth, int height) { + placeBlock(Blocks.furnace, rotateLeft(), width, 2, 2); + + placeBlock(Blocks.double_stone_slab, 0, width - 3, 1, 1); + placeBlock(Blocks.double_stone_slab, 0, width - 3, 1, 2); + + for (int x = width - 1; x >= (width - 4); x--) { + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 1, 4); + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 2, 4); + placeBlock(Blocks.stone_slab, 0, x, 3, 4); + } + placeBlock(Blocks.stone_slab, 0, width - 1, 1, 6); + placeBlock(Blocks.stone_slab, 0, width - 2, 1, 6); + placeBlock(Blocks.cauldron, 0, width - 2, 1, 1); + + placeBlock(Blocks.stone_brick_stairs, this.getStairDirection(reverse()), -(width - 1), 1, 1); + placeBlock(Blocks.stone_slab, 8, -(width - 1), 1, 2); + placeBlock(Blocks.stone_brick_stairs, this.getStairDirection(direction), -(width - 1), 1, 3); + + placeChest(width - 3, 1, 6, rotateLeft(), LootTypes.DWARVEN_HOME); + } + + private void placeChest(int x, int y, int z, int d, String loot) { + placeBlock(Blocks.chest, d, x, y, z); + TileEntityChest tile = (TileEntityChest) getTileEntity(x, y, z, direction); + + if (tile != null) { + WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tile, + 2 + rand.nextInt(3)); } - } + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoomSml2.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoomSml2.java index e5ef5dbf..5a30c241 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoomSml2.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSRoomSml2.java @@ -1,9 +1,6 @@ package minefantasy.mf2.mechanics.worldGen.structure.dwarven; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.block.tileentity.decor.TileEntityAmmoBox; -import minefantasy.mf2.item.ItemArtefact; -import minefantasy.mf2.material.WoodMaterial; import minefantasy.mf2.mechanics.worldGen.structure.LootTypes; import minefantasy.mf2.mechanics.worldGen.structure.StructureGenAncientForge; import minefantasy.mf2.mechanics.worldGen.structure.StructureModuleMF; @@ -14,185 +11,160 @@ import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class StructureGenDSRoomSml2 extends StructureModuleMF -{ - public StructureGenDSRoomSml2(World world, StructureCoordinates position) - { - super(world, position); - } - - protected int getHeight() - { - return 5; - } - protected int getDepth() - { - return 10; - } - protected int getWidth() - { - return 4; - } - @Override - public boolean canGenerate() - { - int width = getWidth(), depth = getDepth(), height = getHeight(); - int filledSpaces = 0, emptySpaces = 0; - - for(int x = -width; x <= width; x ++) - { - for(int y = 0; y <= height; y ++) - { - for(int z = 1; z <= depth; z ++) - { - Block block = this.getBlock(x, y, z); - if(!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) - { - return false; - } - if(!block.getMaterial().isSolid()) - { - ++emptySpaces; - } - else - { - ++filledSpaces; - } - } - } - } - if(WorldGenDwarvenStronghold.debug_air) - { - return true; - } - return ((float) emptySpaces / (float)(emptySpaces+filledSpaces) ) < WorldGenDwarvenStronghold.maxAir;//at least 75% full - } - private boolean allowBuildOverBlock(Block block) - { - if(block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) - { - return false; - } - return true; - } - - - @Override - public void generate() - { - int width = getWidth(), depth = getDepth(), height = getHeight(); - - for(int x = -width; x <= width; x ++) - { - for(int z = 0; z <= depth; z ++) - { - Object[] blockarray; - //FLOOR - blockarray = getFloor(width, depth, x, z); - if(blockarray != null) - { - placeBlock((Block)blockarray[0], 0, x, 0, z); - } - //WALLS - for(int y = 1; y <= height; y ++) - { - blockarray = getWalls(width, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, y, z); - } - } - //CEILING - blockarray = getCeiling(width, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height, z); - } - } - } - placeBlock(Blocks.air, 0, 0, 1, 0); - placeBlock(Blocks.air, 0, 0, 2, 0); - - placeBlock(BlockListMF.reinforced_stone_framed, 0, -1, 1, -1); - placeBlock(BlockListMF.reinforced_stone, 0, -1, 2, -1); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, -1, 3, -1); - - placeBlock(BlockListMF.reinforced_stone_framed, 0, 1, 1, -1); - placeBlock(BlockListMF.reinforced_stone, 0, 1, 2, -1); - placeBlock(BlockListMF.reinforced_stone_framediron, 0, 1, 3, -1); - - placeBlock(BlockListMF.reinforced_stone, 1, 0, 3, -1); - placeBlock(Blocks.air, 0, 0, 1, -1); - placeBlock(Blocks.air, 0, 0, 2, -1); - - buildHomeFurnishings(width, depth, height); - } - - private Object[] getFloor(int width, int depth, int x, int z) - { - if(x== -(width-1) || x == (width-1) || z == 1 || z == depth-1) - { - return new Object[]{BlockListMF.reinforced_stone, 0}; - } - return new Object[]{BlockListMF.refined_planks, 0}; - } - private Object[] getCeiling(int width, int depth, int x, int z) - { - if(x== -(width-1) || x == (width-1) || z == 1 || z == depth-1) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - private Object[] getWalls(int width, int depth, int x, int z) - { - if(x == -width || x == width || z == depth ||z == 0) - { - if((x == -width && (z == depth || z == 0)) || (x == width && (z == depth || z == 0))) - { - return new Object[]{BlockListMF.reinforced_stone, false}; - } - - return new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - return new Object[]{Blocks.air, false}; - } - - private void buildHomeFurnishings(int width, int depth, int height) - { - placeBlock(Blocks.furnace, rotateLeft(), width, 2, 2); - placeBlock(Blocks.double_stone_slab, 0, width-3, 1, 1); - placeBlock(Blocks.double_stone_slab, 0, width-3, 1, 2); - - for(int x = width-1; x >= (width-4); x --) - { - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 1, 5); - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 2, 5); - placeBlock(Blocks.stone_slab, 0, x, 3, 5); - } - placeBlock(Blocks.stone_slab, 0, width-1, 1, 7); - placeBlock(Blocks.stone_slab, 0, width-2, 1, 7); - placeBlock(Blocks.stone_slab, 0, width-1, 1, 8); - placeBlock(Blocks.stone_slab, 0, width-2, 1, 8); - placeBlock(Blocks.cauldron, 0, width-2, 1, 1); - - placeBlock(Blocks.stone_brick_stairs, this.getStairDirection(reverse()), -(width-1), 1, 1); - placeBlock(Blocks.stone_slab, 8, -(width-1), 1, 2); - placeBlock(Blocks.stone_brick_stairs, this.getStairDirection(direction), -(width-1), 1, 3); - - - placeChest(width-3, 1, 7, rotateLeft(), LootTypes.DWARVEN_HOME_RICH); - } - private void placeChest(int x, int y, int z, int d, String loot) - { - placeBlock(Blocks.chest, d, x, y, z); - TileEntityChest tile = (TileEntityChest)getTileEntity(x, y, z, direction); - - if (tile != null) - { - WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tile, 2+rand.nextInt(3)); +public class StructureGenDSRoomSml2 extends StructureModuleMF { + public StructureGenDSRoomSml2(World world, StructureCoordinates position) { + super(world, position); + } + + protected int getHeight() { + return 5; + } + + protected int getDepth() { + return 10; + } + + protected int getWidth() { + return 4; + } + + @Override + public boolean canGenerate() { + int width = getWidth(), depth = getDepth(), height = getHeight(); + int filledSpaces = 0, emptySpaces = 0; + + for (int x = -width; x <= width; x++) { + for (int y = 0; y <= height; y++) { + for (int z = 1; z <= depth; z++) { + Block block = this.getBlock(x, y, z); + if (!allowBuildOverBlock(block) || this.isUnbreakable(x, y, z, direction)) { + return false; + } + if (!block.getMaterial().isSolid()) { + ++emptySpaces; + } else { + ++filledSpaces; + } + } + } + } + if (WorldGenDwarvenStronghold.debug_air) { + return true; + } + return ((float) emptySpaces / (float) (emptySpaces + filledSpaces)) < WorldGenDwarvenStronghold.maxAir;// at + // least + // 75% + // full + } + + private boolean allowBuildOverBlock(Block block) { + if (block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) { + return false; + } + return true; + } + + @Override + public void generate() { + int width = getWidth(), depth = getDepth(), height = getHeight(); + + for (int x = -width; x <= width; x++) { + for (int z = 0; z <= depth; z++) { + Object[] blockarray; + // FLOOR + blockarray = getFloor(width, depth, x, z); + if (blockarray != null) { + placeBlock((Block) blockarray[0], 0, x, 0, z); + } + // WALLS + for (int y = 1; y <= height; y++) { + blockarray = getWalls(width, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, y, z); + } + } + // CEILING + blockarray = getCeiling(width, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height, z); + } + } + } + placeBlock(Blocks.air, 0, 0, 1, 0); + placeBlock(Blocks.air, 0, 0, 2, 0); + + placeBlock(BlockListMF.reinforced_stone_framed, 0, -1, 1, -1); + placeBlock(BlockListMF.reinforced_stone, 0, -1, 2, -1); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, -1, 3, -1); + + placeBlock(BlockListMF.reinforced_stone_framed, 0, 1, 1, -1); + placeBlock(BlockListMF.reinforced_stone, 0, 1, 2, -1); + placeBlock(BlockListMF.reinforced_stone_framediron, 0, 1, 3, -1); + + placeBlock(BlockListMF.reinforced_stone, 1, 0, 3, -1); + placeBlock(Blocks.air, 0, 0, 1, -1); + placeBlock(Blocks.air, 0, 0, 2, -1); + + buildHomeFurnishings(width, depth, height); + } + + private Object[] getFloor(int width, int depth, int x, int z) { + if (x == -(width - 1) || x == (width - 1) || z == 1 || z == depth - 1) { + return new Object[]{BlockListMF.reinforced_stone, 0}; + } + return new Object[]{BlockListMF.refined_planks, 0}; + } + + private Object[] getCeiling(int width, int depth, int x, int z) { + if (x == -(width - 1) || x == (width - 1) || z == 1 || z == depth - 1) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + private Object[] getWalls(int width, int depth, int x, int z) { + if (x == -width || x == width || z == depth || z == 0) { + if ((x == -width && (z == depth || z == 0)) || (x == width && (z == depth || z == 0))) { + return new Object[]{BlockListMF.reinforced_stone, false}; + } + + return new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + return new Object[]{Blocks.air, false}; + } + + private void buildHomeFurnishings(int width, int depth, int height) { + placeBlock(Blocks.furnace, rotateLeft(), width, 2, 2); + placeBlock(Blocks.double_stone_slab, 0, width - 3, 1, 1); + placeBlock(Blocks.double_stone_slab, 0, width - 3, 1, 2); + + for (int x = width - 1; x >= (width - 4); x--) { + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 1, 5); + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, 2, 5); + placeBlock(Blocks.stone_slab, 0, x, 3, 5); + } + placeBlock(Blocks.stone_slab, 0, width - 1, 1, 7); + placeBlock(Blocks.stone_slab, 0, width - 2, 1, 7); + placeBlock(Blocks.stone_slab, 0, width - 1, 1, 8); + placeBlock(Blocks.stone_slab, 0, width - 2, 1, 8); + placeBlock(Blocks.cauldron, 0, width - 2, 1, 1); + + placeBlock(Blocks.stone_brick_stairs, this.getStairDirection(reverse()), -(width - 1), 1, 1); + placeBlock(Blocks.stone_slab, 8, -(width - 1), 1, 2); + placeBlock(Blocks.stone_brick_stairs, this.getStairDirection(direction), -(width - 1), 1, 3); + + placeChest(width - 3, 1, 7, rotateLeft(), LootTypes.DWARVEN_HOME_RICH); + } + + private void placeChest(int x, int y, int z, int d, String loot) { + placeBlock(Blocks.chest, d, x, y, z); + TileEntityChest tile = (TileEntityChest) getTileEntity(x, y, z, direction); + + if (tile != null) { + WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(loot, rand), tile, + 2 + rand.nextInt(3)); } - } + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSStairs.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSStairs.java index f1bd729c..39366b5e 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSStairs.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/StructureGenDSStairs.java @@ -8,292 +8,247 @@ import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -public class StructureGenDSStairs extends StructureModuleMF -{ - /** - * The minimal height for a stairway to be created - */ - public static final int minLevel = 20; - public StructureGenDSStairs(World world, StructureCoordinates position) - { - super(world, position); - } - public StructureGenDSStairs(World world, int x, int y, int z, int direction) - { - super(world, x, y, z, direction); - } - @Override - public boolean canGenerate() - { - if(lengthId == -100) - { - return true; - } - - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - int empty_spaces = 0; - int filledSpaces = 0, emptySpaces = 0; - for(int x = -width_span; x <= width_span; x ++) - { - for(int y = 0; y <= height; y ++) - { - for(int z = 1; z <= depth; z ++) - { - Block block = this.getBlock(x, y-z, z); - if(!allowBuildOverBlock(block) || this.isUnbreakable(x, y-z, z, direction)) - { - return false; - } - if(!block.getMaterial().isSolid()) - { - ++emptySpaces; - } - else - { - ++filledSpaces; - } - } - } - } - if(WorldGenDwarvenStronghold.debug_air) - { - return true; - } - return ((float) emptySpaces / (float)(emptySpaces+filledSpaces) ) < WorldGenDwarvenStronghold.maxAir;//at least 75% full - } - - private boolean allowBuildOverBlock(Block block) - { - if(block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) - { - return false; - } - return true; - } - @Override - public void generate() - { - int width_span = getWidthSpan(); - int depth = getDepthSpan(); - int height = getHeight(); - for(int x = -width_span; x <= width_span; x ++) - { - for(int z = 0; z <= depth; z ++) - { - Object[] blockarray; - - //FLOOR - blockarray = getFloor(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Integer)blockarray[1]; - placeBlock((Block)blockarray[0], meta, x, -z-1, z); - - placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, -z-2, z); - - if(x == (width_span-1) || x == -(width_span-1)) - { - placeBlock(BlockListMF.reinforced_stone, 0, x, -z, z); - } - else - { - placeBlock(Blocks.air, 0, x, -z, z); - } - } - //WALLS - for(int y = 0; y <= height+1; y ++) - { - blockarray = getWalls(width_span, height, depth, x, y, z); - if(blockarray != null) - { - int meta = 0; - if(blockarray[1] instanceof Integer) - { - meta = (Integer)blockarray[1]; - } - if(blockarray[1] instanceof Boolean) - { - meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - } - if(blockarray[1] instanceof String) - { - meta = (String)blockarray[1]=="Hall" ? StructureGenDSHall.getRandomEngravedWall(rand) : 0; - } - placeBlock((Block)blockarray[0], meta, x, y-z, z); - } - } - //CEILING - blockarray = getCeiling(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height+1-z, z); - } - - //TRIM - blockarray = getTrim(width_span, depth, x, z); - if(blockarray != null) - { - int meta = (Boolean)blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; - placeBlock((Block)blockarray[0], meta, x, height-z, z); - if((Block)blockarray[0] == BlockListMF.reinforced_stone_framed) - { - placeBlock(BlockListMF.reinforced_stone, 0, x, height-z, z); - placeBlock(BlockListMF.reinforced_stone_framed, 0, x, height-z-1, z); - - for(int h = height-1; h > 1; h --) - { - placeBlock(BlockListMF.reinforced_stone, h==2 ? 1 : 0, x, h-z-1, z); - } - placeBlock(BlockListMF.reinforced_stone_framed, 0, x, -z, z); - } - } - - } - } - - //DOORWAY - buildDoorway(width_span, depth, height); - - if(lengthId == -100) - { - this.lengthId = -99; - if( (yCoord > 64 && rand.nextInt(3) != 0) || (yCoord >= 56 && rand.nextInt(3) == 0)) - { - mapStructure(0, -depth, depth, StructureGenDSStairs.class); - } - else - { - mapStructure(0, -depth, depth, StructureGenDSCrossroads.class); - } - } - ++lengthId;//Stairs don't count toward length - if(lengthId > 0) - { - buildNext(width_span, depth, height); - } - } - - protected void buildDoorway(int width_span, int depth, int height) - { - for(int x = -1; x <= 1; x++) - { - for(int y = 1; y <= 3; y ++) - { - for(int z = 0; z >= -1; z --) - { - placeBlock(Blocks.air, 0, x, y, z); - } - } - placeBlock(BlockListMF.cobble_pavement_stair, getStairDirection(reverse()), x, 0, -1); - } - } - protected void buildNext(int width_span, int depth, int height) - { - if(lengthId > 1 && rand.nextInt(3) == 0 && yCoord >= minLevel) - { - mapStructure(0, -depth, depth, StructureGenDSStairs.class); - } - else - { - tryPlaceHall(0, -depth, depth, direction); - } - } - protected void tryPlaceHall(int x, int y, int z, int d) - { - Class extension = getRandomExtension(); - if(extension != null) - { - mapStructure(x, y, z, d, extension); - } - } - protected int getHeight() { - return 4; - } - protected int getDepthSpan() { - return 9; - } - protected int getWidthSpan() { - return 3; - } - protected Class getRandomExtension() - { - if( rand.nextInt(20) == 0 && this.yCoord > 24) - { - return StructureGenDSStairs.class; - } - if(lengthId == 1) - { - return StructureGenDSRoom.class; - } - if(deviationCount > 0 && rand.nextInt(4) == 0) - { - return StructureGenDSIntersection.class; - } - return StructureGenDSHall.class; - } - protected Object[] getTrim(int radius, int depth, int x, int z) - { - if(x == -radius || x == radius) - { - return null; - } - - if(x == -(radius-1) || x == (radius-1)) - { - if(z == Math.floor( (float)depth/2)) - { - return new Object[]{BlockListMF.reinforced_stone_framed, false}; - } - return new Object[]{BlockListMF.reinforced_stone, false}; - } - return null; - } - protected Object[] getCeiling(int radius, int depth, int x, int z) - { - return x == 0 ? new Object[]{BlockListMF.reinforced_stone, false} : new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - - protected Object[] getFloor(int radius, int depth, int x, int z) - { - if(x >= -1 && x <= 1) - { - if(z >= depth-1) - { - return new Object[]{BlockListMF.cobble_pavement, 0}; - } - return new Object[]{BlockListMF.cobble_pavement_stair, Integer.valueOf(getStairDirection(reverse()))}; - } - if(x == -radius || x == radius || z == depth || z == 0) - { - return new Object[]{BlockListMF.reinforced_stone, Integer.valueOf(0)}; - } - if(x == -(radius-1) || x == (radius-1) || z == (depth-1) || z == 1) - { - return new Object[]{BlockListMF.reinforced_stone, Integer.valueOf(0)}; - } - return new Object[]{BlockListMF.cobble_pavement, 0}; - } - - protected Object[] getWalls(int radius, int height, int depth, int x, int y, int z) - { - if(x != -radius && x != radius && z == 0) - { - return new Object[]{Blocks.air, false}; - } - if(x == -radius || x == radius || z == depth) - { - return y == height/2 ? new Object[]{BlockListMF.reinforced_stone, "Hall"} : new Object[]{BlockListMF.reinforced_stone_bricks, true}; - } - return new Object[]{Blocks.air, false}; - } +public class StructureGenDSStairs extends StructureModuleMF { + /** + * The minimal height for a stairway to be created + */ + public static final int minLevel = 20; + protected String lootType = ChestGenHooks.DUNGEON_CHEST; - protected String lootType = ChestGenHooks.DUNGEON_CHEST; - public StructureModuleMF setLoot(String loot) - { - this.lootType = loot; - return this; - } + public StructureGenDSStairs(World world, StructureCoordinates position) { + super(world, position); + } + + public StructureGenDSStairs(World world, int x, int y, int z, int direction) { + super(world, x, y, z, direction); + } + + @Override + public boolean canGenerate() { + if (lengthId == -100) { + return true; + } + + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + int empty_spaces = 0; + int filledSpaces = 0, emptySpaces = 0; + for (int x = -width_span; x <= width_span; x++) { + for (int y = 0; y <= height; y++) { + for (int z = 1; z <= depth; z++) { + Block block = this.getBlock(x, y - z, z); + if (!allowBuildOverBlock(block) || this.isUnbreakable(x, y - z, z, direction)) { + return false; + } + if (!block.getMaterial().isSolid()) { + ++emptySpaces; + } else { + ++filledSpaces; + } + } + } + } + if (WorldGenDwarvenStronghold.debug_air) { + return true; + } + return ((float) emptySpaces / (float) (emptySpaces + filledSpaces)) < WorldGenDwarvenStronghold.maxAir;// at + // least + // 75% + // full + } + + private boolean allowBuildOverBlock(Block block) { + if (block == BlockListMF.reinforced_stone_bricks || block == BlockListMF.reinforced_stone) { + return false; + } + return true; + } + + @Override + public void generate() { + int width_span = getWidthSpan(); + int depth = getDepthSpan(); + int height = getHeight(); + for (int x = -width_span; x <= width_span; x++) { + for (int z = 0; z <= depth; z++) { + Object[] blockarray; + + // FLOOR + blockarray = getFloor(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Integer) blockarray[1]; + placeBlock((Block) blockarray[0], meta, x, -z - 1, z); + + placeBlock(BlockListMF.reinforced_stone_bricks, StructureGenAncientForge.getRandomMetadata(rand), x, + -z - 2, z); + + if (x == (width_span - 1) || x == -(width_span - 1)) { + placeBlock(BlockListMF.reinforced_stone, 0, x, -z, z); + } else { + placeBlock(Blocks.air, 0, x, -z, z); + } + } + // WALLS + for (int y = 0; y <= height + 1; y++) { + blockarray = getWalls(width_span, height, depth, x, y, z); + if (blockarray != null) { + int meta = 0; + if (blockarray[1] instanceof Integer) { + meta = (Integer) blockarray[1]; + } + if (blockarray[1] instanceof Boolean) { + meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + } + if (blockarray[1] instanceof String) { + meta = (String) blockarray[1] == "Hall" ? StructureGenDSHall.getRandomEngravedWall(rand) + : 0; + } + placeBlock((Block) blockarray[0], meta, x, y - z, z); + } + } + // CEILING + blockarray = getCeiling(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height + 1 - z, z); + } + + // TRIM + blockarray = getTrim(width_span, depth, x, z); + if (blockarray != null) { + int meta = (Boolean) blockarray[1] ? StructureGenAncientForge.getRandomMetadata(rand) : 0; + placeBlock((Block) blockarray[0], meta, x, height - z, z); + if ((Block) blockarray[0] == BlockListMF.reinforced_stone_framed) { + placeBlock(BlockListMF.reinforced_stone, 0, x, height - z, z); + placeBlock(BlockListMF.reinforced_stone_framed, 0, x, height - z - 1, z); + + for (int h = height - 1; h > 1; h--) { + placeBlock(BlockListMF.reinforced_stone, h == 2 ? 1 : 0, x, h - z - 1, z); + } + placeBlock(BlockListMF.reinforced_stone_framed, 0, x, -z, z); + } + } + + } + } + + // DOORWAY + buildDoorway(width_span, depth, height); + + if (lengthId == -100) { + this.lengthId = -99; + if ((yCoord > 64 && rand.nextInt(3) != 0) || (yCoord >= 56 && rand.nextInt(3) == 0)) { + mapStructure(0, -depth, depth, StructureGenDSStairs.class); + } else { + mapStructure(0, -depth, depth, StructureGenDSCrossroads.class); + } + } + ++lengthId;// Stairs don't count toward length + if (lengthId > 0) { + buildNext(width_span, depth, height); + } + } + + protected void buildDoorway(int width_span, int depth, int height) { + for (int x = -1; x <= 1; x++) { + for (int y = 1; y <= 3; y++) { + for (int z = 0; z >= -1; z--) { + placeBlock(Blocks.air, 0, x, y, z); + } + } + placeBlock(BlockListMF.cobble_pavement_stair, getStairDirection(reverse()), x, 0, -1); + } + } + + protected void buildNext(int width_span, int depth, int height) { + if (lengthId > 1 && rand.nextInt(3) == 0 && yCoord >= minLevel) { + mapStructure(0, -depth, depth, StructureGenDSStairs.class); + } else { + tryPlaceHall(0, -depth, depth, direction); + } + } + + protected void tryPlaceHall(int x, int y, int z, int d) { + Class extension = getRandomExtension(); + if (extension != null) { + mapStructure(x, y, z, d, extension); + } + } + + protected int getHeight() { + return 4; + } + + protected int getDepthSpan() { + return 9; + } + + protected int getWidthSpan() { + return 3; + } + + protected Class getRandomExtension() { + if (rand.nextInt(20) == 0 && this.yCoord > 24) { + return StructureGenDSStairs.class; + } + if (lengthId == 1) { + return StructureGenDSRoom.class; + } + if (deviationCount > 0 && rand.nextInt(4) == 0) { + return StructureGenDSIntersection.class; + } + return StructureGenDSHall.class; + } + + protected Object[] getTrim(int radius, int depth, int x, int z) { + if (x == -radius || x == radius) { + return null; + } + + if (x == -(radius - 1) || x == (radius - 1)) { + if (z == Math.floor((float) depth / 2)) { + return new Object[]{BlockListMF.reinforced_stone_framed, false}; + } + return new Object[]{BlockListMF.reinforced_stone, false}; + } + return null; + } + + protected Object[] getCeiling(int radius, int depth, int x, int z) { + return x == 0 ? new Object[]{BlockListMF.reinforced_stone, false} + : new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + + protected Object[] getFloor(int radius, int depth, int x, int z) { + if (x >= -1 && x <= 1) { + if (z >= depth - 1) { + return new Object[]{BlockListMF.cobble_pavement, 0}; + } + return new Object[]{BlockListMF.cobble_pavement_stair, Integer.valueOf(getStairDirection(reverse()))}; + } + if (x == -radius || x == radius || z == depth || z == 0) { + return new Object[]{BlockListMF.reinforced_stone, Integer.valueOf(0)}; + } + if (x == -(radius - 1) || x == (radius - 1) || z == (depth - 1) || z == 1) { + return new Object[]{BlockListMF.reinforced_stone, Integer.valueOf(0)}; + } + return new Object[]{BlockListMF.cobble_pavement, 0}; + } + + protected Object[] getWalls(int radius, int height, int depth, int x, int y, int z) { + if (x != -radius && x != radius && z == 0) { + return new Object[]{Blocks.air, false}; + } + if (x == -radius || x == radius || z == depth) { + return y == height / 2 ? new Object[]{BlockListMF.reinforced_stone, "Hall"} + : new Object[]{BlockListMF.reinforced_stone_bricks, true}; + } + return new Object[]{Blocks.air, false}; + } + + public StructureModuleMF setLoot(String loot) { + this.lootType = loot; + return this; + } } diff --git a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/WorldGenDwarvenStronghold.java b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/WorldGenDwarvenStronghold.java index 75e6497b..8c308d1f 100644 --- a/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/WorldGenDwarvenStronghold.java +++ b/src/main/java/minefantasy/mf2/mechanics/worldGen/structure/dwarven/WorldGenDwarvenStronghold.java @@ -1,90 +1,76 @@ package minefantasy.mf2.mechanics.worldGen.structure.dwarven; -import java.util.Random; - -import minefantasy.mf2.entity.mob.MinotaurBreed; import minefantasy.mf2.mechanics.worldGen.structure.StructureModuleMF; import minefantasy.mf2.mechanics.worldGen.structure.WorldGenStructureBase; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; import net.minecraft.world.World; +public class WorldGenDwarvenStronghold extends WorldGenStructureBase { + /** + * A debug method used to allow strongholds to generate in the air, for easy + * observation of shape and size. + */ + public static final boolean debug_air = false; + /** + * Max percentage of air blocks allowed for structures to build + */ + public static float maxAir = 0.25F; + private boolean isSurfaceBuild = false; + + public WorldGenDwarvenStronghold() { + } + + public void setSurfaceMode(boolean flag) { + isSurfaceBuild = flag; + } + + @Override + protected StructureModuleMF getStartPiece(World world, int x, int y, int z, int direction) { + return new StructureGenDSEntry(world, x, y - 1, z, direction, isSurfaceBuild); + /* + * if(startPiece == null) { startPiece = new StructureGenDSEntry(world, x, y-1, + * z, direction, isSurfaceBuild); } startPiece.direction = direction; return + * startPiece; + * + */ + } + + @Override + protected boolean isBlockAcceptableOrigin(World world, int x, int y, int z) { + return isValidGround(world, x, y, z);// && world.canBlockSeeTheSky(x, y+2, z); + } + + @Override + protected boolean canStructureBuild(StructureModuleMF piece) { + if (debug_air || isSurfaceBuild) { + return true; + } + // SEARCH FOR CLIFF + for (int x = -3; x <= 3; x++) { + for (int y = 0; y < 5; y++) { + for (int z = 4; z <= 8; z++) { + int[] pos = piece.offsetPos(x, y, z, piece.direction); + Material material = piece.worldObj.getBlock(pos[0], pos[1], pos[2]).getMaterial(); + + if (!material.isOpaque()) { + return false; + } + if (!material.isSolid()) { + return false; + } + } + } + } + return true; + } + + @Override + protected boolean isDirectionRandom() { + return isSurfaceBuild; + } -public class WorldGenDwarvenStronghold extends WorldGenStructureBase -{ - /** - * Max percentage of air blocks allowed for structures to build - */ - public static float maxAir = 0.25F; - /** - * A debug method used to allow strongholds to generate in the air, for easy observation of shape and size. - */ - public static final boolean debug_air = false; - private boolean isSurfaceBuild = false; - public WorldGenDwarvenStronghold() - { - } - public void setSurfaceMode(boolean flag) - { - isSurfaceBuild = flag; - } - @Override - protected StructureModuleMF getStartPiece(World world, int x, int y, int z, int direction) - { - return new StructureGenDSEntry(world, x, y-1, z, direction, isSurfaceBuild); - /* - if(startPiece == null) - { - startPiece = new StructureGenDSEntry(world, x, y-1, z, direction, isSurfaceBuild); - } - startPiece.direction = direction; - return startPiece; - * - */ - } - @Override - protected boolean isBlockAcceptableOrigin(World world, int x, int y, int z) - { - return isValidGround(world, x, y, z);// && world.canBlockSeeTheSky(x, y+2, z); - } - @Override - protected boolean canStructureBuild(StructureModuleMF piece) - { - if(debug_air || isSurfaceBuild) - { - return true; - } - //SEARCH FOR CLIFF - for(int x = -3; x <= 3; x ++) - { - for(int y = 0; y < 5; y ++) - { - for(int z = 4; z <= 8; z ++) - { - int[] pos = piece.offsetPos(x, y, z, piece.direction); - Material material = piece.worldObj.getBlock(pos[0], pos[1], pos[2]).getMaterial(); - - if(!material.isOpaque()) - { - return false; - } - if(!material.isSolid()) - { - return false; - } - } - } - } - return true; - } - @Override - protected boolean isDirectionRandom() - { - return isSurfaceBuild; - } - @Override - protected int[] getYGenBounds(World world) { - return new int[]{60, 255}; - } + @Override + protected int[] getYGenBounds(World world) { + return new int[]{60, 255}; + } } diff --git a/src/main/java/minefantasy/mf2/network/ClientProxyMF.java b/src/main/java/minefantasy/mf2/network/ClientProxyMF.java index e0269429..4d0d1097 100644 --- a/src/main/java/minefantasy/mf2/network/ClientProxyMF.java +++ b/src/main/java/minefantasy/mf2/network/ClientProxyMF.java @@ -1,7 +1,5 @@ package minefantasy.mf2.network; -import org.lwjgl.input.Keyboard; - import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -10,16 +8,21 @@ import minefantasy.mf2.api.helpers.ClientTickHandler; import minefantasy.mf2.api.knowledge.InformationList; import minefantasy.mf2.block.tileentity.*; -import minefantasy.mf2.block.tileentity.blastfurnace.*; -import minefantasy.mf2.block.tileentity.decor.*; +import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFC; +import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFH; +import minefantasy.mf2.block.tileentity.decor.TileEntityAmmoBox; +import minefantasy.mf2.block.tileentity.decor.TileEntityRack; +import minefantasy.mf2.block.tileentity.decor.TileEntityTrough; import minefantasy.mf2.client.KnowledgePageRegistry; import minefantasy.mf2.client.gui.*; import minefantasy.mf2.client.render.*; import minefantasy.mf2.client.render.block.*; -import minefantasy.mf2.client.render.block.component.*; +import minefantasy.mf2.client.render.block.component.TileEntityComponentRenderer; import minefantasy.mf2.client.render.mob.*; import minefantasy.mf2.entity.*; -import minefantasy.mf2.entity.mob.*; +import minefantasy.mf2.entity.mob.EntityDragon; +import minefantasy.mf2.entity.mob.EntityHound; +import minefantasy.mf2.entity.mob.EntityMinotaur; import minefantasy.mf2.item.list.CustomToolListMF; import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.item.list.styles.DragonforgedStyle; @@ -33,259 +36,270 @@ import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; +import org.lwjgl.input.Keyboard; + /** * @author Anonymous Productions */ -public class ClientProxyMF extends CommonProxyMF -{ +public class ClientProxyMF extends CommonProxyMF { - @Override - public World getClientWorld() - { + /** + * Is the player trying to jump (assuming no screens are open) + */ + public static boolean isUserJumpCommand(Entity user) { + return Minecraft.getMinecraft().currentScreen == null && user == Minecraft.getMinecraft().thePlayer + && Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindJump.getKeyCode()); + } + + @Override + public World getClientWorld() { return FMLClientHandler.instance().getClient().theWorld; } - - @Override - public void preInit() - { - } - - @Override - public void registerMain() - { - super.registerMain(); - } - - @Override - public void postInit() - { - super.postInit(); - registerRenders(); - MineFantasyAPI.init(); - KnowledgePageRegistry.registerPages(); - } - - @Override - public void registerTickHandlers() - { - super.registerTickHandlers(); - FMLCommonHandler.instance().bus().register(new PlayerTickHandlerMF()); - FMLCommonHandler.instance().bus().register(new AnimationHandlerMF()); - FMLCommonHandler.instance().bus().register(new ExtendedReachMF()); - MinecraftForge.EVENT_BUS.register(new HudHandlerMF()); - FMLCommonHandler.instance().bus().register(new ClientTickHandler()); - - RenderingRegistry.registerBlockHandler(new RenderAnvilMF()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAnvilMF.class, new TileEntityAnvilMFRenderer()); - RenderingRegistry.registerBlockHandler(new RenderCarpenter()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCarpenterMF.class, new TileEntityCarpenterRenderer()); - RenderingRegistry.registerBlockHandler(new RenderBombBench()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBombBench.class, new TileEntityBombBenchRenderer()); - RenderingRegistry.registerBlockHandler(new RenderTanningRack()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTanningRack.class, new TileEntityTanningRackRenderer()); - RenderingRegistry.registerBlockHandler(new RenderForge()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityForge.class, new TileEntityForgeRenderer()); - RenderingRegistry.registerBlockHandler(new RenderBellows()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBellows.class, new TileEntityBellowsRenderer()); - RenderingRegistry.registerBlockHandler(new RenderResearch()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityResearch.class, new TileEntityResearchRenderer()); - RenderingRegistry.registerBlockHandler(new RenderTrough()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTrough.class, new TileEntityTroughRenderer()); - RenderingRegistry.registerBlockHandler(new RenderBombPress()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBombPress.class, new TileEntityBombPressRenderer()); - RenderingRegistry.registerBlockHandler(new RenderBloomery()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloomery.class, new TileEntityBloomeryRenderer()); - RenderingRegistry.registerBlockHandler(new RenderCrossbowBench()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrossbowBench.class, new TileEntityCrossbowBenchRenderer()); - RenderingRegistry.registerBlockHandler(new RenderQuern()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityQuern.class, new TileEntityQuernRenderer()); - RenderingRegistry.registerBlockHandler(new RenderFirepit()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFirepit.class, new TileEntityFirepitRenderer()); - RenderingRegistry.registerBlockHandler(new RenderRoast()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRoast.class, new TileEntityRoastRenderer()); - RenderingRegistry.registerBlockHandler(new RenderBigFurnace()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBigFurnace.class, new TileEntityBigFurnaceRenderer()); - RenderingRegistry.registerBlockHandler(new RenderRack()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRack.class, new TileEntityRackRenderer()); - RenderingRegistry.registerBlockHandler(new RenderAmmoBox()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAmmoBox.class, new TileEntityAmmoBoxRenderer()); - RenderingRegistry.registerBlockHandler(new RenderSmokePipe()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChimney.class, new TileEntitySmokePipeRenderer()); - - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityComponent.class, new TileEntityComponentRenderer()); - } - - public void registerEntityRenderer() - { - RenderingRegistry.registerEntityRenderingHandler(EntityArrowMF.class, new RenderArrowMF()); - RenderingRegistry.registerEntityRenderingHandler(EntityBomb.class, new RenderBombIcon());//Switch to RenderBomb when syncing is fixed - RenderingRegistry.registerEntityRenderingHandler(EntityMine.class, new RenderMine()); - RenderingRegistry.registerEntityRenderingHandler(EntityShrapnel.class, new RenderShrapnel("shrapnel")); - RenderingRegistry.registerEntityRenderingHandler(EntityFireBlast.class, new RenderFireBlast()); - RenderingRegistry.registerEntityRenderingHandler(EntitySmoke.class, new RenderFireBlast()); - RenderingRegistry.registerEntityRenderingHandler(EntityDragonBreath.class, new RenderDragonBreath()); - RenderingRegistry.registerEntityRenderingHandler(EntityParachute.class, new RenderParachute()); - RenderingRegistry.registerEntityRenderingHandler(EntityCogwork.class, new RenderPowerArmour()); - - RenderingRegistry.registerEntityRenderingHandler(EntityDragon.class, new RenderDragon(2F)); - RenderingRegistry.registerEntityRenderingHandler(EntityMinotaur.class, new RenderMinotaur(new ModelMinotaur(), 1.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityHound.class, new RenderHound(new ModelHound())); - } - - @Override - public EntityPlayer getClientPlayer() - { + + @Override + public void preInit() { + } + + @Override + public void registerMain() { + super.registerMain(); + registerRenders(); + } + + @Override + public void postInit() { + super.postInit(); + MineFantasyAPI.init(); + KnowledgePageRegistry.registerPages(); + } + + @Override + public void registerTickHandlers() { + super.registerTickHandlers(); + FMLCommonHandler.instance().bus().register(new PlayerTickHandlerMF()); + FMLCommonHandler.instance().bus().register(new AnimationHandlerMF()); + FMLCommonHandler.instance().bus().register(new ExtendedReachMF()); + MinecraftForge.EVENT_BUS.register(new HudHandlerMF()); + FMLCommonHandler.instance().bus().register(new ClientTickHandler()); + + RenderingRegistry.registerBlockHandler(new RenderAnvilMF()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAnvilMF.class, new TileEntityAnvilMFRenderer()); + RenderingRegistry.registerBlockHandler(new RenderCarpenter()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCarpenterMF.class, new TileEntityCarpenterRenderer()); + RenderingRegistry.registerBlockHandler(new RenderBombBench()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBombBench.class, new TileEntityBombBenchRenderer()); + RenderingRegistry.registerBlockHandler(new RenderTanningRack()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTanningRack.class, new TileEntityTanningRackRenderer()); + RenderingRegistry.registerBlockHandler(new RenderForge()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityForge.class, new TileEntityForgeRenderer()); + RenderingRegistry.registerBlockHandler(new RenderBellows()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBellows.class, new TileEntityBellowsRenderer()); + RenderingRegistry.registerBlockHandler(new RenderResearch()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityResearch.class, new TileEntityResearchRenderer()); + RenderingRegistry.registerBlockHandler(new RenderTrough()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTrough.class, new TileEntityTroughRenderer()); + RenderingRegistry.registerBlockHandler(new RenderBombPress()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBombPress.class, new TileEntityBombPressRenderer()); + RenderingRegistry.registerBlockHandler(new RenderBloomery()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloomery.class, new TileEntityBloomeryRenderer()); + RenderingRegistry.registerBlockHandler(new RenderCrossbowBench()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrossbowBench.class, + new TileEntityCrossbowBenchRenderer()); + RenderingRegistry.registerBlockHandler(new RenderQuern()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityQuern.class, new TileEntityQuernRenderer()); + RenderingRegistry.registerBlockHandler(new RenderFirepit()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFirepit.class, new TileEntityFirepitRenderer()); + RenderingRegistry.registerBlockHandler(new RenderRoast()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRoast.class, new TileEntityRoastRenderer()); + RenderingRegistry.registerBlockHandler(new RenderBigFurnace()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBigFurnace.class, new TileEntityBigFurnaceRenderer()); + RenderingRegistry.registerBlockHandler(new RenderRack()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRack.class, new TileEntityRackRenderer()); + RenderingRegistry.registerBlockHandler(new RenderAmmoBox()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAmmoBox.class, new TileEntityAmmoBoxRenderer()); + RenderingRegistry.registerBlockHandler(new RenderSmokePipe()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChimney.class, new TileEntitySmokePipeRenderer()); + + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityComponent.class, new TileEntityComponentRenderer()); + } + + public void registerEntityRenderer() { + RenderingRegistry.registerEntityRenderingHandler(EntityArrowMF.class, new RenderArrowMF()); + RenderingRegistry.registerEntityRenderingHandler(EntityBomb.class, new RenderBombIcon());// Switch to RenderBomb + // when syncing is + // fixed + RenderingRegistry.registerEntityRenderingHandler(EntityMine.class, new RenderMine()); + RenderingRegistry.registerEntityRenderingHandler(EntityShrapnel.class, new RenderShrapnel("shrapnel")); + RenderingRegistry.registerEntityRenderingHandler(EntityFireBlast.class, new RenderFireBlast()); + RenderingRegistry.registerEntityRenderingHandler(EntitySmoke.class, new RenderFireBlast()); + RenderingRegistry.registerEntityRenderingHandler(EntityDragonBreath.class, new RenderDragonBreath()); + RenderingRegistry.registerEntityRenderingHandler(EntityParachute.class, new RenderParachute()); + RenderingRegistry.registerEntityRenderingHandler(EntityCogwork.class, new RenderPowerArmour()); + + RenderingRegistry.registerEntityRenderingHandler(EntityDragon.class, new RenderDragon(2F)); + RenderingRegistry.registerEntityRenderingHandler(EntityMinotaur.class, + new RenderMinotaur(new ModelMinotaur(), 1.5F)); + RenderingRegistry.registerEntityRenderingHandler(EntityHound.class, new RenderHound(new ModelHound())); + } + + @Override + public EntityPlayer getClientPlayer() { return Minecraft.getMinecraft().thePlayer; } - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - Minecraft mc = Minecraft.getMinecraft(); - if(ID == 0) - { - TileEntity tile = world.getTileEntity(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if(tile == null) - { - return null; - } - - if(tile instanceof TileEntityAnvilMF) - { - return new GuiAnvilMF(player.inventory, (TileEntityAnvilMF) tile); - } - if(tile instanceof TileEntityCarpenterMF) - { - return new GuiCarpenterMF(player.inventory, (TileEntityCarpenterMF) tile); - } - if(tile instanceof TileEntityBombBench) - { - return new GuiBombBench(player.inventory, (TileEntityBombBench) tile); - } - if(tile instanceof TileEntityBlastFH) - { - return new GuiBlastHeater(player.inventory, (TileEntityBlastFH) tile); - } - if(tile instanceof TileEntityBlastFC) - { - return new GuiBlastChamber(player.inventory, (TileEntityBlastFC) tile); - } - if(tile instanceof TileEntityCrucible) - { - return new GuiCrucible(player.inventory, (TileEntityCrucible) tile); - } - if(tile instanceof TileEntityForge) - { - return new GuiForge(player.inventory, (TileEntityForge) tile); - } - if(tile instanceof TileEntityResearch) - { - return new GuiResearchBlock(player.inventory, (TileEntityResearch) tile); - } - if(tile instanceof TileEntityBloomery) - { - return new GuiBloomery(player.inventory, (TileEntityBloomery) tile); - } - if(tile instanceof TileEntityCrossbowBench) - { - return new GuiCrossbowBench(player.inventory, (TileEntityCrossbowBench) tile); - } - if(tile instanceof TileEntityQuern) - { - return new GuiQuern(player.inventory, (TileEntityQuern) tile); - } - if(tile instanceof TileEntityBigFurnace) - { - return new GuiBigFurnace(player, (TileEntityBigFurnace) tile); - } - return null; - } - if(ID == 1) - { - if(x == 0) - {//GuiAchievements - if(y >= 0) - { - return new GuiKnowledgeEntry(mc.currentScreen, InformationList.knowledgeList.get(y)); - } - return new GuiKnowledge(player); - } - if(x == 1 && player.getHeldItem() != null) - { - return new GuiReload(player.inventory, player.getHeldItem()); - } - } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + Minecraft mc = Minecraft.getMinecraft(); + if (ID == 0) { + TileEntity tile = world.getTileEntity(x, y, z); + // int meta = world.getBlockMetadata(x, y, z); + + if (tile == null) { + return null; + } + + if (tile instanceof TileEntityAnvilMF) { + return new GuiAnvilMF(player.inventory, (TileEntityAnvilMF) tile); + } + if (tile instanceof TileEntityCarpenterMF) { + return new GuiCarpenterMF(player.inventory, (TileEntityCarpenterMF) tile); + } + if (tile instanceof TileEntityBombBench) { + return new GuiBombBench(player.inventory, (TileEntityBombBench) tile); + } + if (tile instanceof TileEntityBlastFH) { + return new GuiBlastHeater(player.inventory, (TileEntityBlastFH) tile); + } + if (tile instanceof TileEntityBlastFC) { + return new GuiBlastChamber(player.inventory, (TileEntityBlastFC) tile); + } + if (tile instanceof TileEntityCrucible) { + return new GuiCrucible(player.inventory, (TileEntityCrucible) tile); + } + if (tile instanceof TileEntityForge) { + return new GuiForge(player.inventory, (TileEntityForge) tile); + } + if (tile instanceof TileEntityResearch) { + return new GuiResearchBlock(player.inventory, (TileEntityResearch) tile); + } + if (tile instanceof TileEntityBloomery) { + return new GuiBloomery(player.inventory, (TileEntityBloomery) tile); + } + if (tile instanceof TileEntityCrossbowBench) { + return new GuiCrossbowBench(player.inventory, (TileEntityCrossbowBench) tile); + } + if (tile instanceof TileEntityQuern) { + return new GuiQuern(player.inventory, (TileEntityQuern) tile); + } + if (tile instanceof TileEntityBigFurnace) { + return new GuiBigFurnace(player, (TileEntityBigFurnace) tile); + } + return null; + } + if (ID == 1) { + if (x == 0) {// GuiAchievements + if (y >= 0) { + return new GuiKnowledgeEntry(mc.currentScreen, InformationList.knowledgeList.get(y)); + } + return new GuiKnowledge(player); + } + if (x == 1 && player.getHeldItem() != null) { + return new GuiReload(player.inventory, player.getHeldItem()); + } + } return null; } - private void registerRenders() - { - registerEntityRenderer(); - - MinecraftForgeClient.registerItemRenderer(ToolListMF.swordStone, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(ToolListMF.maceStone, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(ToolListMF.waraxeStone, new RenderSword().setAxe()); - MinecraftForgeClient.registerItemRenderer(ToolListMF.spearStone, new RenderSpear()); - MinecraftForgeClient.registerItemRenderer(ToolListMF.swordTraining, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(ToolListMF.crossbow_custom, new RenderCrossbow(2.0F)); - - //STANDARD - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_dagger, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_sword, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_waraxe, new RenderSword().setAxe()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_mace, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_scythe, new RenderHeavyWeapon().setBlunt()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_warhammer, new RenderHeavyWeapon().setBlunt()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_battleaxe, new RenderHeavyWeapon().setBlunt().setParryable()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_greatsword, new RenderHeavyWeapon().setGreatsword().setParryable()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_katana, new RenderHeavyWeapon().setKatana().setParryable()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_spear, new RenderSpear()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_halbeard, new RenderSpear(true)); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_lance, new RenderLance()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_lumber, new RenderHeavyWeapon().setBlunt()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_saw, new RenderSaw()); - MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_bow, new RenderBow(false)); - //DRAGONFORGED - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_dagger, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_sword, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_waraxe, new RenderSword().setAxe()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_mace, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_warhammer, new RenderHeavyWeapon().setBlunt()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_battleaxe, new RenderHeavyWeapon().setBlunt().setParryable()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_greatsword, new RenderHeavyWeapon().setGreatsword().setParryable()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_katana, new RenderHeavyWeapon().setKatana().setParryable()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_spear, new RenderSpear()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_halbeard, new RenderSpear(true)); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_lance, new RenderLance()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_scythe, new RenderHeavyWeapon().setBlunt()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_lumber, new RenderHeavyWeapon().setBlunt()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_saw, new RenderSaw()); - MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_bow, new RenderBow(false)); - - //ORNATE - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_dagger, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_sword, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_waraxe, new RenderSword().setAxe()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_mace, new RenderSword()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_warhammer, new RenderHeavyWeapon().setBlunt()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_battleaxe, new RenderHeavyWeapon().setBlunt().setParryable()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_greatsword, new RenderHeavyWeapon().setGreatsword().setParryable()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_katana, new RenderHeavyWeapon().setKatana().setParryable()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_spear, new RenderSpear()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_halbeard, new RenderSpear(true)); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_lance, new RenderLance()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_scythe, new RenderHeavyWeapon().setBlunt()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_lumber, new RenderHeavyWeapon().setBlunt()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_saw, new RenderSaw()); - MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_bow, new RenderBow(false)); - - } - /** - * Is the player trying to jump (assuming no screens are open) - */ - public static boolean isUserJumpCommand(Entity user) - { - return Minecraft.getMinecraft().currentScreen == null && user == Minecraft.getMinecraft().thePlayer && Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindJump.getKeyCode()); - } + private void registerRenders() { + registerEntityRenderer(); + + MinecraftForgeClient.registerItemRenderer(ToolListMF.swordStone, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(ToolListMF.maceStone, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(ToolListMF.waraxeStone, new RenderSword().setAxe()); + MinecraftForgeClient.registerItemRenderer(ToolListMF.spearStone, new RenderSpear()); + MinecraftForgeClient.registerItemRenderer(ToolListMF.swordTraining, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(ToolListMF.crossbow_custom, new RenderCrossbow(2.0F)); + + // STANDARD + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_dagger, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_sword, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_waraxe, new RenderSword().setAxe()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_mace, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_scythe, new RenderHeavyWeapon().setBlunt()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_warhammer, + new RenderHeavyWeapon().setBlunt()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_battleaxe, + new RenderHeavyWeapon().setBlunt().setParryable()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_greatsword, + new RenderHeavyWeapon().setGreatsword().setParryable()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_katana, + new RenderHeavyWeapon().setKatana().setParryable()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_spear, new RenderSpear()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_halbeard, new RenderSpear(true)); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_lance, new RenderLance()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_lumber, new RenderHeavyWeapon().setBlunt()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_saw, new RenderSaw()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_bow, new RenderBow(false)); + + // NEW + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_longsword, + new RenderHeavyWeapon().setLongsword().setParryable()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_shortsword, new RenderSword().setShortsword()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_saber, + new RenderHeavyWeapon().setSaber().setParryable()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_gladius, new RenderSword().setGladius()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_trident, new RenderSpear()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_nodachi, + new RenderHeavyWeapon().setNodachi().setParryable()); + MinecraftForgeClient.registerItemRenderer(CustomToolListMF.standard_claymore, + new RenderHeavyWeapon().setClaymore().setParryable()); + + // DwarvenForged TODO + + + + // DRAGONFORGED + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_dagger, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_sword, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_waraxe, new RenderSword().setAxe()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_mace, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_warhammer, + new RenderHeavyWeapon().setBlunt()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_battleaxe, + new RenderHeavyWeapon().setBlunt().setParryable()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_greatsword, + new RenderHeavyWeapon().setGreatsword().setParryable()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_katana, + new RenderHeavyWeapon().setKatana().setParryable()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_spear, new RenderSpear()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_halbeard, new RenderSpear(true)); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_lance, new RenderLance()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_scythe, + new RenderHeavyWeapon().setBlunt()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_lumber, + new RenderHeavyWeapon().setBlunt()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_saw, new RenderSaw()); + MinecraftForgeClient.registerItemRenderer(DragonforgedStyle.dragonforged_bow, new RenderBow(false)); + + // ORNATE + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_dagger, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_sword, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_waraxe, new RenderSword().setAxe()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_mace, new RenderSword()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_warhammer, new RenderHeavyWeapon().setBlunt()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_battleaxe, + new RenderHeavyWeapon().setBlunt().setParryable()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_greatsword, + new RenderHeavyWeapon().setGreatsword().setParryable()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_katana, + new RenderHeavyWeapon().setKatana().setParryable()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_spear, new RenderSpear()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_halbeard, new RenderSpear(true)); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_lance, new RenderLance()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_scythe, new RenderHeavyWeapon().setBlunt()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_lumber, new RenderHeavyWeapon().setBlunt()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_saw, new RenderSaw()); + MinecraftForgeClient.registerItemRenderer(OrnateStyle.ornate_bow, new RenderBow(false)); + + } } diff --git a/src/main/java/minefantasy/mf2/network/CommonProxyMF.java b/src/main/java/minefantasy/mf2/network/CommonProxyMF.java index ef43fffc..7245af74 100644 --- a/src/main/java/minefantasy/mf2/network/CommonProxyMF.java +++ b/src/main/java/minefantasy/mf2/network/CommonProxyMF.java @@ -1,193 +1,168 @@ package minefantasy.mf2.network; -import java.util.Random; - import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.api.archery.AmmoMechanicsMF; import minefantasy.mf2.api.refine.ISmokeHandler; import minefantasy.mf2.api.refine.SmokeMechanics; import minefantasy.mf2.block.tileentity.*; -import minefantasy.mf2.block.tileentity.blastfurnace.*; -import minefantasy.mf2.block.tileentity.decor.*; +import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFC; +import minefantasy.mf2.block.tileentity.blastfurnace.TileEntityBlastFH; +import minefantasy.mf2.block.tileentity.decor.TileEntityAmmoBox; +import minefantasy.mf2.block.tileentity.decor.TileEntityRack; +import minefantasy.mf2.block.tileentity.decor.TileEntityTrough; +import minefantasy.mf2.config.ConfigIntegration; import minefantasy.mf2.container.*; import minefantasy.mf2.entity.EntitySmoke; import minefantasy.mf2.entity.list.EntityListMF; import minefantasy.mf2.hunger.HungerSystemMF; +import minefantasy.mf2.integration.minetweaker.MTCompat; import minefantasy.mf2.item.archery.ArrowFireFlint; import minefantasy.mf2.item.archery.ArrowFirerMF; -import minefantasy.mf2.mechanics.ArrowHandlerMF; -import minefantasy.mf2.mechanics.CombatMechanics; -import minefantasy.mf2.mechanics.EventManagerMF; -import minefantasy.mf2.mechanics.MonsterUpgrader; -import minefantasy.mf2.mechanics.PlayerTickHandlerMF; +import minefantasy.mf2.mechanics.*; +import minefantasy.mf2.util.XSTRandom; +import minetweaker.MineTweakerAPI; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; + /** * @author Anonymous Productions */ -public class CommonProxyMF implements IGuiHandler, ISmokeHandler -{ +public class CommonProxyMF implements IGuiHandler, ISmokeHandler { @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; } @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - if(ID == 1 && x == 1 && player.getHeldItem() != null) - { - return new ContainerReload(player.inventory, player.getHeldItem()); - } - else if(ID == 0) - { - TileEntity tile = world.getTileEntity(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - if(tile == null) - { - return null; - } - - if(tile instanceof TileEntityAnvilMF) - { - return new ContainerAnvilMF(player.inventory, (TileEntityAnvilMF) tile); - } - if(tile instanceof TileEntityCarpenterMF) - { - return new ContainerCarpenterMF(player.inventory, (TileEntityCarpenterMF) tile); - } - if(tile instanceof TileEntityBombBench) - { - return new ContainerBombBench(player.inventory, (TileEntityBombBench) tile); - } - if(tile instanceof TileEntityBlastFH) - { - return new ContainerBlastHeater(player.inventory, (TileEntityBlastFH) tile); - } - if(tile instanceof TileEntityBlastFC) - { - return new ContainerBlastChamber(player.inventory, (TileEntityBlastFC) tile); - } - if(tile instanceof TileEntityCrucible) - { - return new ContainerCrucible(player.inventory, (TileEntityCrucible) tile); - } - if(tile instanceof TileEntityForge) - { - return new ContainerForge(player.inventory, (TileEntityForge) tile); - } - if(tile instanceof TileEntityResearch) - { - return new ContainerResearch(player.inventory, (TileEntityResearch) tile); - } - if(tile instanceof TileEntityBloomery) - { - return new ContainerBloomery(player.inventory, (TileEntityBloomery) tile); - } - if(tile instanceof TileEntityCrossbowBench) - { - return new ContainerCrossbowBench(player.inventory, (TileEntityCrossbowBench) tile); - } - if(tile instanceof TileEntityQuern) - { - return new ContainerQuern(player.inventory, (TileEntityQuern) tile); - } - if(tile instanceof TileEntityBigFurnace) - { - return new ContainerBigFurnace(player, (TileEntityBigFurnace) tile); - } - } + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + if (ID == 1 && x == 1 && player.getHeldItem() != null) { + return new ContainerReload(player.inventory, player.getHeldItem()); + } else if (ID == 0) { + TileEntity tile = world.getTileEntity(x, y, z); + // int meta = world.getBlockMetadata(x, y, z); + if (tile == null) { + return null; + } + + if (tile instanceof TileEntityAnvilMF) { + return new ContainerAnvilMF(player.inventory, (TileEntityAnvilMF) tile); + } + if (tile instanceof TileEntityCarpenterMF) { + return new ContainerCarpenterMF(player.inventory, (TileEntityCarpenterMF) tile); + } + if (tile instanceof TileEntityBombBench) { + return new ContainerBombBench(player.inventory, (TileEntityBombBench) tile); + } + if (tile instanceof TileEntityBlastFH) { + return new ContainerBlastHeater(player.inventory, (TileEntityBlastFH) tile); + } + if (tile instanceof TileEntityBlastFC) { + return new ContainerBlastChamber(player.inventory, (TileEntityBlastFC) tile); + } + if (tile instanceof TileEntityCrucible) { + return new ContainerCrucible(player.inventory, (TileEntityCrucible) tile); + } + if (tile instanceof TileEntityForge) { + return new ContainerForge(player.inventory, (TileEntityForge) tile); + } + if (tile instanceof TileEntityResearch) { + return new ContainerResearch(player.inventory, (TileEntityResearch) tile); + } + if (tile instanceof TileEntityBloomery) { + return new ContainerBloomery(player.inventory, (TileEntityBloomery) tile); + } + if (tile instanceof TileEntityCrossbowBench) { + return new ContainerCrossbowBench(player.inventory, (TileEntityCrossbowBench) tile); + } + if (tile instanceof TileEntityQuern) { + return new ContainerQuern(player.inventory, (TileEntityQuern) tile); + } + if (tile instanceof TileEntityBigFurnace) { + return new ContainerBigFurnace(player, (TileEntityBigFurnace) tile); + } + } return null; } - public World getClientWorld() - { + public World getClientWorld() { return null; } - public void registerMain() - { - AmmoMechanicsMF.addHandler(new ArrowFireFlint()); - AmmoMechanicsMF.addHandler(new ArrowFirerMF()); - registerTileEntities(); - SmokeMechanics.handler = this; - } + public void registerMain() { + AmmoMechanicsMF.addHandler(new ArrowFireFlint()); + AmmoMechanicsMF.addHandler(new ArrowFirerMF()); + registerTileEntities(); + SmokeMechanics.handler = this; + if (Loader.isModLoaded("MineTweaker3") && ConfigIntegration.mtIntegration) { + MTCompat.loadTweakers(); + } + } - protected void registerTileEntities() - { - GameRegistry.registerTileEntity(TileEntityAnvilMF.class, "MF_Anvil"); - GameRegistry.registerTileEntity(TileEntityCarpenterMF.class, "MF_CarpenterBench"); - GameRegistry.registerTileEntity(TileEntityBombBench.class, "MF_BombBench"); - GameRegistry.registerTileEntity(TileEntityCrossbowBench.class, "MF_CrossbowBench"); - GameRegistry.registerTileEntity(TileEntityBlastFC.class, "MF_BlastChamber"); - GameRegistry.registerTileEntity(TileEntityBlastFH.class, "MF_BlastHeater"); - GameRegistry.registerTileEntity(TileEntityCrucible.class, "MF_Crucible"); - GameRegistry.registerTileEntity(TileEntityChimney.class, "MF_Chimney"); - GameRegistry.registerTileEntity(TileEntityTanningRack.class, "MF_Tanner"); - GameRegistry.registerTileEntity(TileEntityForge.class, "MF_Forge"); - GameRegistry.registerTileEntity(TileEntityBellows.class, "MF_Bellows"); - GameRegistry.registerTileEntity(TileEntityResearch.class, "MF_Research"); - GameRegistry.registerTileEntity(TileEntityTrough.class, "MF_Trough"); - GameRegistry.registerTileEntity(TileEntityBombPress.class, "MF_BombPress"); - GameRegistry.registerTileEntity(TileEntityBloomery.class, "MF_Bloomery"); - GameRegistry.registerTileEntity(TileEntityQuern.class, "MF_Quern"); - GameRegistry.registerTileEntity(TileEntityFirepit.class, "MF_Firepit"); - GameRegistry.registerTileEntity(TileEntityRoast.class, "MF_SpitRoast"); - GameRegistry.registerTileEntity(TileEntityBigFurnace.class, "MF_BigFurnace"); - GameRegistry.registerTileEntity(TileEntityRack.class, "MF_Rack"); - GameRegistry.registerTileEntity(TileEntityAmmoBox.class, "MF_AmmoBox"); - GameRegistry.registerTileEntity(TileEntityWorldGenMarker.class, "MF_WorldGenFlag"); - GameRegistry.registerTileEntity(TileEntityComponent.class, "MF_ComponentTile"); - GameRegistry.registerTileEntity(TileEntityRoad.class, "MF_Road"); - } + protected void registerTileEntities() { + GameRegistry.registerTileEntity(TileEntityAnvilMF.class, "MF_Anvil"); + GameRegistry.registerTileEntity(TileEntityCarpenterMF.class, "MF_CarpenterBench"); + GameRegistry.registerTileEntity(TileEntityBombBench.class, "MF_BombBench"); + GameRegistry.registerTileEntity(TileEntityCrossbowBench.class, "MF_CrossbowBench"); + GameRegistry.registerTileEntity(TileEntityBlastFC.class, "MF_BlastChamber"); + GameRegistry.registerTileEntity(TileEntityBlastFH.class, "MF_BlastHeater"); + GameRegistry.registerTileEntity(TileEntityCrucible.class, "MF_Crucible"); + GameRegistry.registerTileEntity(TileEntityChimney.class, "MF_Chimney"); + GameRegistry.registerTileEntity(TileEntityTanningRack.class, "MF_Tanner"); + GameRegistry.registerTileEntity(TileEntityForge.class, "MF_Forge"); + GameRegistry.registerTileEntity(TileEntityBellows.class, "MF_Bellows"); + GameRegistry.registerTileEntity(TileEntityResearch.class, "MF_Research"); + GameRegistry.registerTileEntity(TileEntityTrough.class, "MF_Trough"); + GameRegistry.registerTileEntity(TileEntityBombPress.class, "MF_BombPress"); + GameRegistry.registerTileEntity(TileEntityBloomery.class, "MF_Bloomery"); + GameRegistry.registerTileEntity(TileEntityQuern.class, "MF_Quern"); + GameRegistry.registerTileEntity(TileEntityFirepit.class, "MF_Firepit"); + GameRegistry.registerTileEntity(TileEntityRoast.class, "MF_SpitRoast"); + GameRegistry.registerTileEntity(TileEntityBigFurnace.class, "MF_BigFurnace"); + GameRegistry.registerTileEntity(TileEntityRack.class, "MF_Rack"); + GameRegistry.registerTileEntity(TileEntityAmmoBox.class, "MF_AmmoBox"); + GameRegistry.registerTileEntity(TileEntityWorldGenMarker.class, "MF_WorldGenFlag"); + GameRegistry.registerTileEntity(TileEntityComponent.class, "MF_ComponentTile"); + GameRegistry.registerTileEntity(TileEntityRoad.class, "MF_Road"); + } + public void preInit() { + } - public void preInit() - { - } + public void registerTickHandlers() { + FMLCommonHandler.instance().bus().register(new PlayerTickHandlerMF()); + FMLCommonHandler.instance().bus().register(new HungerSystemMF()); + MinecraftForge.EVENT_BUS.register(new EventManagerMF()); + MinecraftForge.EVENT_BUS.register(new CombatMechanics()); + MinecraftForge.EVENT_BUS.register(new MonsterUpgrader()); + MinecraftForge.EVENT_BUS.register(new ArrowHandlerMF()); + } - public void registerTickHandlers() - { - FMLCommonHandler.instance().bus().register(new PlayerTickHandlerMF()); - FMLCommonHandler.instance().bus().register(new HungerSystemMF()); - MinecraftForge.EVENT_BUS.register(new EventManagerMF()); - MinecraftForge.EVENT_BUS.register(new CombatMechanics()); - MinecraftForge.EVENT_BUS.register(new MonsterUpgrader()); - MinecraftForge.EVENT_BUS.register(new ArrowHandlerMF()); - } + public EntityPlayer getClientPlayer() { + return null; + } - public EntityPlayer getClientPlayer() - { - return null; - } - - public static int renderID = -1; - private static Random rand = new Random(); - @Override - public void spawnSmoke(World world, double x, double y, double z, int value) - { - for(int a = 0; a < value; a++) - { - float sprayRange = 0.005F; - float sprayX = (rand.nextFloat()*sprayRange) - (sprayRange/2); - float sprayZ = (rand.nextFloat()*sprayRange) - (sprayRange/2); - float height = 0.001F; - if(rand.nextInt(2) == 0) - { - EntitySmoke smoke = new EntitySmoke(world ,x, y-0.5D, z, sprayX, height, sprayZ); - world.spawnEntityInWorld(smoke); - } - } - } + @Override + public void spawnSmoke(World world, double x, double y, double z, int value) { + XSTRandom random = new XSTRandom(); + for (int a = 0; a < value; a++) { + float sprayRange = 0.005F; + float sprayX = (random.nextFloat() * sprayRange) - (sprayRange / 2); + float sprayZ = (random.nextFloat() * sprayRange) - (sprayRange / 2); + float height = 0.001F; + if (random.nextInt(2) == 0) { + EntitySmoke smoke = new EntitySmoke(world, x, y - 0.5D, z, sprayX, height, sprayZ); + world.spawnEntityInWorld(smoke); + } + } + } - public void postInit() - { - EntityListMF.register(); - } + public void postInit() { + EntityListMF.register(); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/network/NetworkUtils.java b/src/main/java/minefantasy/mf2/network/NetworkUtils.java new file mode 100644 index 00000000..c0e73e78 --- /dev/null +++ b/src/main/java/minefantasy/mf2/network/NetworkUtils.java @@ -0,0 +1,42 @@ +package minefantasy.mf2.network; + +import cpw.mods.fml.relauncher.ReflectionHelper; +import net.minecraft.network.Packet; +import net.minecraft.server.management.PlayerManager; +import net.minecraft.world.WorldServer; + +import java.lang.reflect.Method; + +/** + * Here I used code in Railcraft. + *

+ * https://github.com/Railcraft/Railcraft/blob/mc-1.7.10/src/main/java/mods/railcraft/common/util/network/PacketDispatcher.java + */ + +public class NetworkUtils { + private static final Class playerInstanceClass; + private static final Method getOrCreateChunkWatcher; + private static final Method sendToAllPlayersWatchingChunk; + + static { + try { + playerInstanceClass = PlayerManager.class.getDeclaredClasses()[0]; + getOrCreateChunkWatcher = ReflectionHelper.findMethod(PlayerManager.class, null, new String[]{"func_72690_a", "getOrCreateChunkWatcher"}, int.class, int.class, boolean.class); + sendToAllPlayersWatchingChunk = ReflectionHelper.findMethod(playerInstanceClass, null, new String[]{"func_151251_a", "sendToAllPlayersWatchingChunk"}, Packet.class); + getOrCreateChunkWatcher.setAccessible(true); + sendToAllPlayersWatchingChunk.setAccessible(true); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + public static void sendToWatchers(Packet packet, WorldServer world, int worldX, int worldZ) { + try { + Object playerInstance = getOrCreateChunkWatcher.invoke(world.getPlayerManager(), worldX >> 4, worldZ >> 4, false); + if (playerInstance != null) + sendToAllPlayersWatchingChunk.invoke(playerInstance, packet); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } +} diff --git a/src/main/java/minefantasy/mf2/network/packet/AmmoBoxPacket.java b/src/main/java/minefantasy/mf2/network/packet/AmmoBoxPacket.java index 5815d6c2..71d77f5b 100644 --- a/src/main/java/minefantasy/mf2/network/packet/AmmoBoxPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/AmmoBoxPacket.java @@ -7,52 +7,46 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -public class AmmoBoxPacket extends PacketMF -{ - public static final String packetName = "MF2_AmmoBoxPkt"; - private int[] coords = new int[3]; - private int stock; - private ItemStack ammo; - - public AmmoBoxPacket(TileEntityAmmoBox tile) - { - this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - this.ammo = tile.ammo; - this.stock = tile.stock; - } - public AmmoBoxPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { +public class AmmoBoxPacket extends PacketMF { + public static final String packetName = "MF2_AmmoBoxPkt"; + private int[] coords = new int[3]; + private int stock; + private ItemStack ammo; + + public AmmoBoxPacket(TileEntityAmmoBox tile) { + this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + this.ammo = tile.ammo; + this.stock = tile.stock; + } + + public AmmoBoxPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); stock = packet.readInt(); ammo = ByteBufUtils.readItemStack(packet); - - if(entity != null && entity instanceof TileEntityAmmoBox) - { - TileEntityAmmoBox tile = (TileEntityAmmoBox)entity; - tile.ammo = this.ammo; - tile.stock = this.stock; + + if (entity != null && entity instanceof TileEntityAmmoBox) { + TileEntityAmmoBox tile = (TileEntityAmmoBox) entity; + tile.ammo = this.ammo; + tile.stock = this.stock; + } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeInt(stock); - ByteBufUtils.writeItemStack(packet, ammo); - } + packet.writeInt(stock); + ByteBufUtils.writeItemStack(packet, ammo); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/AnvilPacket.java b/src/main/java/minefantasy/mf2/network/packet/AnvilPacket.java index 89387f4e..43afa9d5 100644 --- a/src/main/java/minefantasy/mf2/network/packet/AnvilPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/AnvilPacket.java @@ -1,94 +1,86 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; import minefantasy.mf2.block.tileentity.TileEntityAnvilMF; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; -public class AnvilPacket extends PacketMF -{ - public static final String packetName = "MF2_AnvilPacket"; - private int[] coords = new int[3]; - private String resultName; - private String toolNeeded; - private String research; - private float[] floats = new float[6]; - private int[] tiers = new int[2]; +public class AnvilPacket extends PacketMF { + public static final String packetName = "MF2_AnvilPacket"; + private int[] coords = new int[3]; + private String resultName; + private String toolNeeded; + private String research; + private float[] floats = new float[6]; + private int[] tiers = new int[2]; - public AnvilPacket(TileEntityAnvilMF tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - resultName = tile.getResultName(); - toolNeeded = tile.getToolNeeded(); - research = tile.getResearchNeeded(); - floats = new float[]{tile.progress, tile.progressMax, tile.qualityBalance, tile.thresholdPosition, tile.leftHit, tile.rightHit}; - tiers = new int[]{tile.getToolTierNeeded(), tile.getAnvilTierNeeded()}; - if(floats[1] <= 0) - { - floats[1] = 0; - } - } + public AnvilPacket(TileEntityAnvilMF tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + resultName = tile.getResultName(); + toolNeeded = tile.getToolNeeded(); + research = tile.getResearchNeeded(); + floats = new float[]{tile.progress, tile.progressMax, tile.qualityBalance, tile.thresholdPosition, + tile.leftHit, tile.rightHit}; + tiers = new int[]{tile.getToolTierNeeded(), tile.getAnvilTierNeeded()}; + if (floats[1] <= 0) { + floats[1] = 0; + } + } - public AnvilPacket() { - } + public AnvilPacket() { + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); - - if(entity != null && entity instanceof TileEntityAnvilMF) - { - floats[0] = packet.readFloat(); - floats[1] = packet.readFloat(); - floats[2] = packet.readFloat(); - floats[3] = packet.readFloat(); - floats[4] = packet.readFloat(); - floats[5] = packet.readFloat(); - tiers[0] = packet.readInt(); - tiers[1] = packet.readInt(); - resultName = ByteBufUtils.readUTF8String(packet); - toolNeeded = ByteBufUtils.readUTF8String(packet); - research = ByteBufUtils.readUTF8String(packet); - - TileEntityAnvilMF anvil = (TileEntityAnvilMF)entity; - anvil.resName = resultName; - anvil.setToolType(toolNeeded); - anvil.progress = floats[0]; - anvil.progressMax = floats[1]; - anvil.qualityBalance = floats[2]; - anvil.thresholdPosition = floats[3]; - anvil.leftHit = floats[4]; - anvil.rightHit = floats[5]; - anvil.setHammerUsed(tiers[0]); - anvil.setRequiredAnvil(tiers[1]); - anvil.setResearch(research); + + if (entity != null && entity instanceof TileEntityAnvilMF) { + floats[0] = packet.readFloat(); + floats[1] = packet.readFloat(); + floats[2] = packet.readFloat(); + floats[3] = packet.readFloat(); + floats[4] = packet.readFloat(); + floats[5] = packet.readFloat(); + tiers[0] = packet.readInt(); + tiers[1] = packet.readInt(); + resultName = ByteBufUtils.readUTF8String(packet); + toolNeeded = ByteBufUtils.readUTF8String(packet); + research = ByteBufUtils.readUTF8String(packet); + + TileEntityAnvilMF anvil = (TileEntityAnvilMF) entity; + anvil.resName = resultName; + anvil.setToolType(toolNeeded); + anvil.progress = floats[0]; + anvil.progressMax = floats[1]; + anvil.qualityBalance = floats[2]; + anvil.thresholdPosition = floats[3]; + anvil.leftHit = floats[4]; + anvil.rightHit = floats[5]; + anvil.setHammerUsed(tiers[0]); + anvil.setRequiredAnvil(tiers[1]); + anvil.setResearch(research); } - } + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public String getChannel() { + return packetName; + } - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - for(int a = 0; a < floats.length; a++) - { - packet.writeFloat(floats[a]); - } - packet.writeInt(tiers[0]); - packet.writeInt(tiers[1]); - ByteBufUtils.writeUTF8String(packet, resultName); - ByteBufUtils.writeUTF8String(packet, toolNeeded); - ByteBufUtils.writeUTF8String(packet, research); - } + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); + } + for (int a = 0; a < floats.length; a++) { + packet.writeFloat(floats[a]); + } + packet.writeInt(tiers[0]); + packet.writeInt(tiers[1]); + ByteBufUtils.writeUTF8String(packet, resultName); + ByteBufUtils.writeUTF8String(packet, toolNeeded); + ByteBufUtils.writeUTF8String(packet, research); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/BigFurnacePacket.java b/src/main/java/minefantasy/mf2/network/packet/BigFurnacePacket.java index 4e4a8948..e62954f3 100644 --- a/src/main/java/minefantasy/mf2/network/packet/BigFurnacePacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/BigFurnacePacket.java @@ -4,77 +4,68 @@ import minefantasy.mf2.block.tileentity.TileEntityBigFurnace; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; -public class BigFurnacePacket extends PacketMF -{ - public static final String packetName = "MF2_BigfurnPkt"; - private int[] coords = new int[3]; - private int fuel, progress, burn, doorAngle; - - public BigFurnacePacket(TileEntityBigFurnace tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - fuel = tile.fuel; - progress = tile.progress; - //heat = (int)tile.heat; - burn = tile.isBurning() ? 1 : 0; - //justShared = tile.justShared; - doorAngle = tile.doorAngle; - } +public class BigFurnacePacket extends PacketMF { + public static final String packetName = "MF2_BigfurnPkt"; + private int[] coords = new int[3]; + private int fuel, progress, burn, doorAngle; - public BigFurnacePacket() { - } + public BigFurnacePacket(TileEntityBigFurnace tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + fuel = tile.fuel; + progress = tile.progress; + // heat = (int)tile.heat; + burn = tile.isBurning() ? 1 : 0; + // justShared = tile.justShared; + doorAngle = tile.doorAngle; + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + public BigFurnacePacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; - + fuel = packet.readInt(); - progress = packet.readInt(); - //heat = packet.readInt(); - burn = packet.readInt(); - //justShared = packet.readInt(); - doorAngle = packet.readInt(); - + progress = packet.readInt(); + // heat = packet.readInt(); + burn = packet.readInt(); + // justShared = packet.readInt(); + doorAngle = packet.readInt(); + TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); - - if(entity != null && entity instanceof TileEntityBigFurnace) - { - TileEntityBigFurnace tile = (TileEntityBigFurnace)entity; - - tile.fuel = fuel; - tile.progress = progress; - //tile.heat = heat; - //tile.justShared = justShared; - tile.doorAngle = doorAngle; - - if(tile.getWorldObj().isRemote) - { - tile.isBurningClient = (burn == 1); - } + + if (entity != null && entity instanceof TileEntityBigFurnace) { + TileEntityBigFurnace tile = (TileEntityBigFurnace) entity; + + tile.fuel = fuel; + tile.progress = progress; + // tile.heat = heat; + // tile.justShared = justShared; + tile.doorAngle = doorAngle; + + if (tile.getWorldObj().isRemote) { + tile.isBurningClient = (burn == 1); + } } - } + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public String getChannel() { + return packetName; + } - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeInt(fuel); - packet.writeInt(progress); - //packet.writeInt(heat); - packet.writeInt(burn); - //packet.writeInt(justShared); - packet.writeInt(doorAngle); - } + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); + } + packet.writeInt(fuel); + packet.writeInt(progress); + // packet.writeInt(heat); + packet.writeInt(burn); + // packet.writeInt(justShared); + packet.writeInt(doorAngle); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/BloomeryPacket.java b/src/main/java/minefantasy/mf2/network/packet/BloomeryPacket.java index 0a8794d7..0ccc2b9b 100644 --- a/src/main/java/minefantasy/mf2/network/packet/BloomeryPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/BloomeryPacket.java @@ -4,55 +4,47 @@ import minefantasy.mf2.block.tileentity.TileEntityBloomery; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; - -public class BloomeryPacket extends PacketMF -{ - public static final String packetName = "MF2_BloomeryPacket"; - private int[] coords = new int[3]; - private boolean renderBloom, isActive; - - public BloomeryPacket(TileEntityBloomery tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - renderBloom = tile.hasBloom(); - isActive = tile.isActive; - } - - public BloomeryPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + +public class BloomeryPacket extends PacketMF { + public static final String packetName = "MF2_BloomeryPacket"; + private int[] coords = new int[3]; + private boolean renderBloom, isActive; + + public BloomeryPacket(TileEntityBloomery tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + renderBloom = tile.hasBloom(); + isActive = tile.isActive; + } + + public BloomeryPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); renderBloom = packet.readBoolean(); isActive = packet.readBoolean(); - - if(entity != null && entity instanceof TileEntityBloomery) - { - TileEntityBloomery tile = (TileEntityBloomery)entity; - tile.hasBloom = renderBloom; - tile.isActive = isActive; + + if (entity != null && entity instanceof TileEntityBloomery) { + TileEntityBloomery tile = (TileEntityBloomery) entity; + tile.hasBloom = renderBloom; + tile.isActive = isActive; + } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeBoolean(renderBloom); - packet.writeBoolean(isActive); - } + packet.writeBoolean(renderBloom); + packet.writeBoolean(isActive); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/BombBenchPacket.java b/src/main/java/minefantasy/mf2/network/packet/BombBenchPacket.java index bddd3760..851a86d5 100644 --- a/src/main/java/minefantasy/mf2/network/packet/BombBenchPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/BombBenchPacket.java @@ -4,60 +4,52 @@ import minefantasy.mf2.block.tileentity.TileEntityBombBench; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; - -public class BombBenchPacket extends PacketMF -{ - public static final String packetName = "MF2_BombBenchPkt"; - private int[] coords = new int[3]; - private float progress; - private float maxProgress; - private boolean hasRecipe; - - public BombBenchPacket(TileEntityBombBench tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - progress = tile.progress; - maxProgress = tile.maxProgress; - hasRecipe = tile.hasRecipe; - } - - public BombBenchPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + +public class BombBenchPacket extends PacketMF { + public static final String packetName = "MF2_BombBenchPkt"; + private int[] coords = new int[3]; + private float progress; + private float maxProgress; + private boolean hasRecipe; + + public BombBenchPacket(TileEntityBombBench tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + progress = tile.progress; + maxProgress = tile.maxProgress; + hasRecipe = tile.hasRecipe; + } + + public BombBenchPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); float newProgress = packet.readFloat(); float newMaxProgress = packet.readFloat(); boolean newRecipe = packet.readBoolean(); - - if(entity != null && entity instanceof TileEntityBombBench) - { - TileEntityBombBench tile = (TileEntityBombBench)entity; - tile.progress = newProgress; - tile.maxProgress = newMaxProgress; - tile.hasRecipe = newRecipe; + + if (entity != null && entity instanceof TileEntityBombBench) { + TileEntityBombBench tile = (TileEntityBombBench) entity; + tile.progress = newProgress; + tile.maxProgress = newMaxProgress; + tile.hasRecipe = newRecipe; + } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeFloat(progress); - packet.writeFloat(maxProgress); - packet.writeBoolean(hasRecipe); - } + packet.writeFloat(progress); + packet.writeFloat(maxProgress); + packet.writeBoolean(hasRecipe); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/CarpenterPacket.java b/src/main/java/minefantasy/mf2/network/packet/CarpenterPacket.java index b0015ddf..05e34796 100644 --- a/src/main/java/minefantasy/mf2/network/packet/CarpenterPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/CarpenterPacket.java @@ -1,84 +1,76 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; import minefantasy.mf2.block.tileentity.TileEntityCarpenterMF; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; -public class CarpenterPacket extends PacketMF -{ - public static final String packetName = "MF2_CarpenterPacket"; - private int[] coords = new int[3]; - private String resultName; - private String toolNeeded; - private float[] progress = new float[2]; - private int[] tiers = new int[2]; - private String research; +public class CarpenterPacket extends PacketMF { + public static final String packetName = "MF2_CarpenterPacket"; + private int[] coords = new int[3]; + private String resultName; + private String toolNeeded; + private float[] progress = new float[2]; + private int[] tiers = new int[2]; + private String research; - public CarpenterPacket(TileEntityCarpenterMF tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - resultName = tile.getResultName(); - toolNeeded = tile.getToolNeeded(); - progress = new float[]{tile.progress, tile.progressMax}; - tiers = new int[]{tile.getToolTierNeeded(), tile.getCarpenterTierNeeded()}; - if(progress[1] <= 0) - { - progress[1] = 0; - } - research = tile.getResearchNeeded(); - } + public CarpenterPacket(TileEntityCarpenterMF tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + resultName = tile.getResultName(); + toolNeeded = tile.getToolNeeded(); + progress = new float[]{tile.progress, tile.progressMax}; + tiers = new int[]{tile.getToolTierNeeded(), tile.getCarpenterTierNeeded()}; + if (progress[1] <= 0) { + progress[1] = 0; + } + research = tile.getResearchNeeded(); + } - public CarpenterPacket() { - } + public CarpenterPacket() { + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); - - if(entity != null && entity instanceof TileEntityCarpenterMF) - { - progress[0] = packet.readFloat(); - progress[1] = packet.readFloat(); - tiers[0] = packet.readInt(); - tiers[1] = packet.readInt(); - resultName = ByteBufUtils.readUTF8String(packet); - toolNeeded = ByteBufUtils.readUTF8String(packet); - research = ByteBufUtils.readUTF8String(packet); - - TileEntityCarpenterMF carpenter = (TileEntityCarpenterMF)entity; - carpenter.resName = resultName; - carpenter.setToolType(toolNeeded); - carpenter.setResearch(research); - carpenter.progress = progress[0]; - carpenter.progressMax = progress[1]; - carpenter.setToolTier(tiers[0]); - carpenter.setRequiredCarpenter(tiers[1]); + + if (entity != null && entity instanceof TileEntityCarpenterMF) { + progress[0] = packet.readFloat(); + progress[1] = packet.readFloat(); + tiers[0] = packet.readInt(); + tiers[1] = packet.readInt(); + resultName = ByteBufUtils.readUTF8String(packet); + toolNeeded = ByteBufUtils.readUTF8String(packet); + research = ByteBufUtils.readUTF8String(packet); + + TileEntityCarpenterMF carpenter = (TileEntityCarpenterMF) entity; + carpenter.resName = resultName; + carpenter.setToolType(toolNeeded); + carpenter.setResearch(research); + carpenter.progress = progress[0]; + carpenter.progressMax = progress[1]; + carpenter.setToolTier(tiers[0]); + carpenter.setRequiredCarpenter(tiers[1]); } - } + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public String getChannel() { + return packetName; + } - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeFloat(progress[0]); - packet.writeFloat(progress[1]); - packet.writeInt(tiers[0]); - packet.writeInt(tiers[1]); - ByteBufUtils.writeUTF8String(packet, resultName); - ByteBufUtils.writeUTF8String(packet, toolNeeded); - ByteBufUtils.writeUTF8String(packet, research); - } + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); + } + packet.writeFloat(progress[0]); + packet.writeFloat(progress[1]); + packet.writeInt(tiers[0]); + packet.writeInt(tiers[1]); + ByteBufUtils.writeUTF8String(packet, resultName); + ByteBufUtils.writeUTF8String(packet, toolNeeded); + ByteBufUtils.writeUTF8String(packet, research); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/ChimneyPacket.java b/src/main/java/minefantasy/mf2/network/packet/ChimneyPacket.java index f25310ce..98b3dd27 100644 --- a/src/main/java/minefantasy/mf2/network/packet/ChimneyPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/ChimneyPacket.java @@ -1,60 +1,50 @@ package minefantasy.mf2.network.packet; import io.netty.buffer.ByteBuf; -import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.block.tileentity.TileEntityChimney; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; - -public class ChimneyPacket extends PacketMF -{ - public static final String packetName = "MF2_ChimneyPacket"; - private int[] coords = new int[3]; - private int block, meta; - - public ChimneyPacket(TileEntityChimney tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - block = Block.getIdFromBlock(tile.maskBlock); - meta = tile.blockMetadata; - } - - public ChimneyPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + +public class ChimneyPacket extends PacketMF { + public static final String packetName = "MF2_ChimneyPacket"; + private int[] coords = new int[3]; + private int block, meta; + + public ChimneyPacket(TileEntityChimney tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + block = Block.getIdFromBlock(tile.maskBlock); + meta = tile.blockMetadata; + } + + public ChimneyPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); - - if(entity != null && entity instanceof TileEntityChimney) - { - TileEntityChimney tile = (TileEntityChimney)entity; - - int blockID = packet.readInt(); - int blockMetadata = packet.readInt(); - tile.setBlock(blockID, blockMetadata); + + if (entity != null && entity instanceof TileEntityChimney) { + TileEntityChimney tile = (TileEntityChimney) entity; + + int blockID = packet.readInt(); + int blockMetadata = packet.readInt(); + tile.setBlock(blockID, blockMetadata); + } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeInt(block); - packet.writeInt(meta); - } + packet.writeInt(block); + packet.writeInt(meta); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/CogworkControlPacket.java b/src/main/java/minefantasy/mf2/network/packet/CogworkControlPacket.java index b6925b83..aec41f03 100644 --- a/src/main/java/minefantasy/mf2/network/packet/CogworkControlPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/CogworkControlPacket.java @@ -1,61 +1,52 @@ package minefantasy.mf2.network.packet; import io.netty.buffer.ByteBuf; -import minefantasy.mf2.api.knowledge.InformationBase; -import minefantasy.mf2.api.knowledge.InformationList; -import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.entity.EntityCogwork; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -public class CogworkControlPacket extends PacketMF -{ - public static final String packetName = "MF2_CogworkCtrl"; - private EntityCogwork suit; - private float forward, strafe; - private boolean isJumping; - - public CogworkControlPacket(EntityCogwork suit) - { - this.suit = suit; - this.forward = suit.getMoveForward(); - this.strafe = suit.getMoveStrafe(); - this.isJumping = suit.getJumpControl(); - } - - public CogworkControlPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { - int id = packet.readInt(); - forward = packet.readFloat(); - strafe = packet.readFloat(); - isJumping = packet.readBoolean(); - Entity entity = player.worldObj.getEntityByID(id); - - if (entity != null && entity instanceof EntityCogwork) - { - suit = (EntityCogwork)entity; - suit.setMoveForward(forward); - suit.setMoveStrafe(strafe); - suit.setJumpControl(isJumping); +public class CogworkControlPacket extends PacketMF { + public static final String packetName = "MF2_CogworkCtrl"; + private EntityCogwork suit; + private float forward, strafe; + private boolean isJumping; + + public CogworkControlPacket(EntityCogwork suit) { + this.suit = suit; + this.forward = suit.getMoveForward(); + this.strafe = suit.getMoveStrafe(); + this.isJumping = suit.getJumpControl(); + } + + public CogworkControlPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { + int id = packet.readInt(); + forward = packet.readFloat(); + strafe = packet.readFloat(); + isJumping = packet.readBoolean(); + Entity entity = player.worldObj.getEntityByID(id); + + if (entity != null && entity instanceof EntityCogwork) { + suit = (EntityCogwork) entity; + suit.setMoveForward(forward); + suit.setMoveStrafe(strafe); + suit.setJumpControl(isJumping); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - packet.writeInt(suit.getEntityId()); - packet.writeFloat(forward); - packet.writeFloat(strafe); - packet.writeBoolean(isJumping); - } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + packet.writeInt(suit.getEntityId()); + packet.writeFloat(forward); + packet.writeFloat(strafe); + packet.writeBoolean(isJumping); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/CrossbowBenchPacket.java b/src/main/java/minefantasy/mf2/network/packet/CrossbowBenchPacket.java index c6880b75..dbe86168 100644 --- a/src/main/java/minefantasy/mf2/network/packet/CrossbowBenchPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/CrossbowBenchPacket.java @@ -4,60 +4,52 @@ import minefantasy.mf2.block.tileentity.TileEntityCrossbowBench; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; - -public class CrossbowBenchPacket extends PacketMF -{ - public static final String packetName = "MF2_CrossbowBenchPkt"; - private int[] coords = new int[3]; - private float progress; - private float maxProgress; - private boolean hasRecipe; - - public CrossbowBenchPacket(TileEntityCrossbowBench tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - progress = tile.progress; - maxProgress = tile.maxProgress; - hasRecipe = tile.hasRecipe; - } - - public CrossbowBenchPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + +public class CrossbowBenchPacket extends PacketMF { + public static final String packetName = "MF2_CrossbowBenchPkt"; + private int[] coords = new int[3]; + private float progress; + private float maxProgress; + private boolean hasRecipe; + + public CrossbowBenchPacket(TileEntityCrossbowBench tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + progress = tile.progress; + maxProgress = tile.maxProgress; + hasRecipe = tile.hasRecipe; + } + + public CrossbowBenchPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); float newProgress = packet.readFloat(); float newMaxProgress = packet.readFloat(); boolean newRecipe = packet.readBoolean(); - - if(entity != null && entity instanceof TileEntityCrossbowBench) - { - TileEntityCrossbowBench tile = (TileEntityCrossbowBench)entity; - tile.progress = newProgress; - tile.maxProgress = newMaxProgress; - tile.hasRecipe = newRecipe; + + if (entity != null && entity instanceof TileEntityCrossbowBench) { + TileEntityCrossbowBench tile = (TileEntityCrossbowBench) entity; + tile.progress = newProgress; + tile.maxProgress = newMaxProgress; + tile.hasRecipe = newRecipe; + } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeFloat(progress); - packet.writeFloat(maxProgress); - packet.writeBoolean(hasRecipe); - } + packet.writeFloat(progress); + packet.writeFloat(maxProgress); + packet.writeBoolean(hasRecipe); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/DodgeCommand.java b/src/main/java/minefantasy/mf2/network/packet/DodgeCommand.java index a458f2ac..b988ee19 100644 --- a/src/main/java/minefantasy/mf2/network/packet/DodgeCommand.java +++ b/src/main/java/minefantasy/mf2/network/packet/DodgeCommand.java @@ -1,53 +1,43 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; -import minefantasy.mf2.MineFantasyII; -import minefantasy.mf2.api.knowledge.InformationBase; -import minefantasy.mf2.api.knowledge.InformationList; -import minefantasy.mf2.api.knowledge.ResearchLogic; import minefantasy.mf2.mechanics.CombatMechanics; import net.minecraft.entity.player.EntityPlayer; -import cpw.mods.fml.common.network.ByteBufUtils; -public class DodgeCommand extends PacketMF -{ - public static final String packetName = "MF2_Command_Dodge"; - private EntityPlayer user; - private int ID; - private String username; - - public DodgeCommand(EntityPlayer user, int id) - { - this.ID = id; - this.username = user.getCommandSenderName(); - this.user = user; - } - - public DodgeCommand() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { - ID = packet.readInt(); - username = ByteBufUtils.readUTF8String(packet); - - if (username != null && player.getCommandSenderName().equals(username)) - { +public class DodgeCommand extends PacketMF { + public static final String packetName = "MF2_Command_Dodge"; + private EntityPlayer user; + private int ID; + private String username; + + public DodgeCommand(EntityPlayer user, int id) { + this.ID = id; + this.username = user.getCommandSenderName(); + this.user = user; + } + + public DodgeCommand() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { + ID = packet.readInt(); + username = ByteBufUtils.readUTF8String(packet); + + if (username != null && player.getCommandSenderName().equals(username)) { CombatMechanics.initDodge(player, ID); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - packet.writeInt(ID); + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + packet.writeInt(ID); ByteBufUtils.writeUTF8String(packet, username); - } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/FirepitPacket.java b/src/main/java/minefantasy/mf2/network/packet/FirepitPacket.java deleted file mode 100644 index d2bfed25..00000000 --- a/src/main/java/minefantasy/mf2/network/packet/FirepitPacket.java +++ /dev/null @@ -1,54 +0,0 @@ -package minefantasy.mf2.network.packet; - -import io.netty.buffer.ByteBuf; -import minefantasy.mf2.block.tileentity.TileEntityFirepit; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; - -public class FirepitPacket extends PacketMF -{ - public static final String packetName = "MF2_FirepitPacket"; - private int[] coords = new int[3]; - private int fuel = 0; - - public FirepitPacket(TileEntityFirepit tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - this.fuel = tile.fuel; - } - - public FirepitPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { - coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; - fuel = packet.readInt(); - - TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); - - if(entity != null && entity instanceof TileEntityFirepit) - { - TileEntityFirepit tile = (TileEntityFirepit)entity; - tile.fuel = fuel; - } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeInt(fuel); - } -} diff --git a/src/main/java/minefantasy/mf2/network/packet/ForgePacket.java b/src/main/java/minefantasy/mf2/network/packet/ForgePacket.java index 58373bb5..3d8e5910 100644 --- a/src/main/java/minefantasy/mf2/network/packet/ForgePacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/ForgePacket.java @@ -4,34 +4,29 @@ import minefantasy.mf2.block.tileentity.TileEntityForge; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; -public class ForgePacket extends PacketMF -{ - public static final String packetName = "MF2_ForgePacket"; - private int[] coords = new int[3]; - private float[] fuels = new float[2]; - private float[] temps = new float[3]; - private int workableState; - - public ForgePacket(TileEntityForge tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - fuels = new float[]{tile.fuel, tile.maxFuel}; - if(fuels[0] > fuels[1]) - { - fuels[0] = fuels[1]; - } - temps = new float[]{tile.temperature, tile.fuelTemperature, tile.getHeat()}; - workableState = tile.getWorkableState(); - } +public class ForgePacket extends PacketMF { + public static final String packetName = "MF2_ForgePacket"; + private int[] coords = new int[3]; + private float[] fuels = new float[2]; + private float[] temps = new float[3]; + private int workableState; - public ForgePacket() { - } + public ForgePacket(TileEntityForge tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + fuels = new float[]{tile.fuel, tile.maxFuel}; + if (fuels[0] > fuels[1]) { + fuels[0] = fuels[1]; + } + temps = new float[]{tile.temperature, tile.fuelTemperature, tile.getHeat()}; + workableState = tile.getWorkableState(); + } + + public ForgePacket() { + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; fuels[0] = packet.readFloat(); fuels[1] = packet.readFloat(); @@ -39,39 +34,35 @@ public void process(ByteBuf packet, EntityPlayer player) temps[1] = packet.readFloat(); temps[2] = packet.readFloat(); workableState = packet.readInt(); - + TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); - - if(entity != null && entity instanceof TileEntityForge) - { - TileEntityForge tile = (TileEntityForge)entity; - tile.fuel = fuels[0]; - tile.maxFuel = fuels[1]; - tile.temperature = temps[0]; - tile.fuelTemperature = temps[1]; - tile.exactTemperature = (int)temps[2]; - tile.workableState = workableState; + + if (entity != null && entity instanceof TileEntityForge) { + TileEntityForge tile = (TileEntityForge) entity; + tile.fuel = fuels[0]; + tile.maxFuel = fuels[1]; + tile.temperature = temps[0]; + tile.fuelTemperature = temps[1]; + tile.exactTemperature = (int) temps[2]; + tile.workableState = workableState; } - } + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public String getChannel() { + return packetName; + } - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeFloat(fuels[0]); - packet.writeFloat(fuels[1]); - packet.writeFloat(temps[0]); - packet.writeFloat(temps[1]); - packet.writeFloat(temps[2]); - packet.writeInt(workableState); - } + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); + } + packet.writeFloat(fuels[0]); + packet.writeFloat(fuels[1]); + packet.writeFloat(temps[0]); + packet.writeFloat(temps[1]); + packet.writeFloat(temps[2]); + packet.writeInt(workableState); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/HitSoundPacket.java b/src/main/java/minefantasy/mf2/network/packet/HitSoundPacket.java index bee43b92..d595e917 100644 --- a/src/main/java/minefantasy/mf2/network/packet/HitSoundPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/HitSoundPacket.java @@ -1,51 +1,44 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; import minefantasy.mf2.config.ConfigClient; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import cpw.mods.fml.common.network.ByteBufUtils; -public class HitSoundPacket extends PacketMF -{ - public static final String packetName = "MF2_Hitsound"; - private String sound; - private int entId; +public class HitSoundPacket extends PacketMF { + public static final String packetName = "MF2_Hitsound"; + private String sound; + private int entId; - public HitSoundPacket(String sound, Entity hit) - { - this.sound = sound; - this.entId = hit.getEntityId(); - } + public HitSoundPacket(String sound, Entity hit) { + this.sound = sound; + this.entId = hit.getEntityId(); + } - public HitSoundPacket() { - } + public HitSoundPacket() { + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + @Override + public void process(ByteBuf packet, EntityPlayer player) { entId = packet.readInt(); sound = ByteBufUtils.readUTF8String(packet); Entity entity = player.worldObj.getEntityByID(entId); - if (entity != null) - { - if(ConfigClient.playHitsound) - { - entity.worldObj.playSound(entity.posX, entity.posY, entity.posZ, sound, 1.0F, 1.0F, false); - } + if (entity != null) { + if (ConfigClient.playHitsound) { + entity.worldObj.playSound(entity.posX, entity.posY, entity.posZ, sound, 1.0F, 1.0F, false); + } } - } + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public String getChannel() { + return packetName; + } - @Override - public void write(ByteBuf packet) - { - packet.writeInt(entId); + @Override + public void write(ByteBuf packet) { + packet.writeInt(entId); ByteBufUtils.writeUTF8String(packet, sound); - } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/KnowledgePacket.java b/src/main/java/minefantasy/mf2/network/packet/KnowledgePacket.java index 86e861d7..cddaec7d 100644 --- a/src/main/java/minefantasy/mf2/network/packet/KnowledgePacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/KnowledgePacket.java @@ -1,85 +1,71 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; - -import java.util.ArrayList; -import java.util.Iterator; - -import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.knowledge.InformationBase; import minefantasy.mf2.api.knowledge.InformationList; import minefantasy.mf2.api.knowledge.ResearchLogic; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.entity.player.EntityPlayer; -import cpw.mods.fml.common.network.ByteBufUtils; -public class KnowledgePacket extends PacketMF -{ - public static final String packetName = "MF2_KnowledgeSync"; - private EntityPlayer user; - private String username; +import java.util.ArrayList; +import java.util.Iterator; + +public class KnowledgePacket extends PacketMF { + public static final String packetName = "MF2_KnowledgeSync"; + private EntityPlayer user; + private String username; + + public KnowledgePacket(EntityPlayer user) { + this.username = user.getCommandSenderName(); + this.user = user; + } - public KnowledgePacket(EntityPlayer user) - { - this.username = user.getCommandSenderName(); - this.user = user; - } + public KnowledgePacket() { + } - public KnowledgePacket() { - } + @Override + public void process(ByteBuf packet, EntityPlayer player) { + int size = InformationList.knowledgeList.size(); + ArrayList completed = new ArrayList(); + for (int a = 0; a < size; a++) { + boolean unlocked = packet.readBoolean(); + int artefactCount = packet.readInt(); - @Override - public void process(ByteBuf packet, EntityPlayer player) - { - int size = InformationList.knowledgeList.size(); - ArrayList completed = new ArrayList(); - for(int a = 0; a < size; a++) - { - boolean unlocked = packet.readBoolean(); - int artefactCount = packet.readInt(); - - InformationBase base = InformationList.knowledgeList.get(a); - if(base != null) - { - completed.add(new Object[]{base, unlocked, artefactCount}); - } - } - username = ByteBufUtils.readUTF8String(packet); - if(username != null && player.getCommandSenderName().equals(username)) - { - Iterator researches = completed.iterator(); - while(researches.hasNext()) - { - Object[] entry = (Object[])researches.next(); - InformationBase base = (InformationBase) entry[0]; - ResearchLogic.setArtefactCount(base.getUnlocalisedName(), player, (Integer)entry[2]); - if((Boolean) entry[1]) - { - ResearchLogic.forceUnlock(player, base); - } - } + InformationBase base = InformationList.knowledgeList.get(a); + if (base != null) { + completed.add(new Object[]{base, unlocked, artefactCount}); + } + } + username = ByteBufUtils.readUTF8String(packet); + if (username != null && player.getCommandSenderName().equals(username)) { + Iterator researches = completed.iterator(); + while (researches.hasNext()) { + Object[] entry = (Object[]) researches.next(); + InformationBase base = (InformationBase) entry[0]; + ResearchLogic.setArtefactCount(base.getUnlocalisedName(), player, (Integer) entry[2]); + if ((Boolean) entry[1]) { + ResearchLogic.forceUnlock(player, base); + } + } } packet.clear(); completed = null; - } + } + + @Override + public String getChannel() { + return packetName; + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public void write(ByteBuf packet) { + int size = InformationList.knowledgeList.size(); - @Override - public void write(ByteBuf packet) - { - int size = InformationList.knowledgeList.size(); - - for(int a = 0; a < size; a++) - { - InformationBase base = InformationList.knowledgeList.get(a); - packet.writeBoolean(ResearchLogic.hasInfoUnlocked(user, base)); - packet.writeInt(ResearchLogic.getArtefactCount(base.getUnlocalisedName(), user)); - } + for (int a = 0; a < size; a++) { + InformationBase base = InformationList.knowledgeList.get(a); + packet.writeBoolean(ResearchLogic.hasInfoUnlocked(user, base)); + packet.writeInt(ResearchLogic.getArtefactCount(base.getUnlocalisedName(), user)); + } ByteBufUtils.writeUTF8String(packet, username); - } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/LevelupPacket.java b/src/main/java/minefantasy/mf2/network/packet/LevelupPacket.java index 6726090a..f83579a3 100644 --- a/src/main/java/minefantasy/mf2/network/packet/LevelupPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/LevelupPacket.java @@ -1,69 +1,56 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; - -import java.util.ArrayList; -import java.util.Iterator; - -import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.api.rpg.Skill; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import net.minecraft.util.StatCollector; -import cpw.mods.fml.common.network.ByteBufUtils; - -public class LevelupPacket extends PacketMF -{ - public static final String packetName = "MF2_levelup"; - private EntityPlayer user; - private String username; - private int level; - private String skillName; - - public LevelupPacket(EntityPlayer user, Skill skill, int level) - { - this.username = user.getCommandSenderName(); - this.user = user; - this.skillName = skill.skillName; - this.level = level; - } - - public LevelupPacket() { - } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { - String name = ByteBufUtils.readUTF8String(packet); - int skillLvl = packet.readInt(); - - username = ByteBufUtils.readUTF8String(packet); - if (username != null && player.getCommandSenderName().equalsIgnoreCase(username)) - { - Skill skill = RPGElements.getSkillByName(name); - - if(skill != null) - { - player.playSound("random.levelup", 1.0F, 0.5F); - player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("rpg.levelup", skill.getDisplayName().toLowerCase(), skillLvl))); - } +public class LevelupPacket extends PacketMF { + public static final String packetName = "MF2_levelup"; + private EntityPlayer user; + private String username; + private int level; + private String skillName; + + public LevelupPacket(EntityPlayer user, Skill skill, int level) { + this.username = user.getCommandSenderName(); + this.user = user; + this.skillName = skill.skillName; + this.level = level; + } + + public LevelupPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { + String name = ByteBufUtils.readUTF8String(packet); + int skillLvl = packet.readInt(); + + username = ByteBufUtils.readUTF8String(packet); + if (username != null && player.getCommandSenderName().equalsIgnoreCase(username)) { + Skill skill = RPGElements.getSkillByName(name); + + if (skill != null) { + player.playSound("random.levelup", 1.0F, 0.5F); + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("rpg.levelup", + skill.getDisplayName().toLowerCase(), skillLvl))); + } } - } + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public String getChannel() { + return packetName; + } - @Override - public void write(ByteBuf packet) - { - ByteBufUtils.writeUTF8String(packet, skillName); - packet.writeInt(level); + @Override + public void write(ByteBuf packet) { + ByteBufUtils.writeUTF8String(packet, skillName); + packet.writeInt(level); ByteBufUtils.writeUTF8String(packet, username); - } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/PacketHandlerMF.java b/src/main/java/minefantasy/mf2/network/packet/PacketHandlerMF.java index 1e2fe5d1..d2d3229d 100644 --- a/src/main/java/minefantasy/mf2/network/packet/PacketHandlerMF.java +++ b/src/main/java/minefantasy/mf2/network/packet/PacketHandlerMF.java @@ -1,8 +1,5 @@ package minefantasy.mf2.network.packet; -import java.util.Hashtable; -import java.util.Map; - import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.FMLEventChannel; import cpw.mods.fml.common.network.FMLNetworkEvent; @@ -13,13 +10,14 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.NetHandlerPlayServer; -public class PacketHandlerMF -{ +import java.util.Hashtable; +import java.util.Map; + +public class PacketHandlerMF { public Map packetList = new Hashtable(); public Map channels = new Hashtable(); - public PacketHandlerMF() - { + public PacketHandlerMF() { packetList.put(StaminaPacket.packetName, new StaminaPacket()); packetList.put(ParryPacket.packetName, new ParryPacket()); packetList.put(HitSoundPacket.packetName, new HitSoundPacket()); @@ -38,7 +36,6 @@ public PacketHandlerMF() packetList.put(RoadPacket.packetName, new RoadPacket()); packetList.put(BloomeryPacket.packetName, new BloomeryPacket()); packetList.put(CrossbowBenchPacket.packetName, new CrossbowBenchPacket()); - packetList.put(FirepitPacket.packetName, new FirepitPacket()); packetList.put(TileInventoryPacket.packetName, new TileInventoryPacket()); packetList.put(BigFurnacePacket.packetName, new BigFurnacePacket()); packetList.put(DodgeCommand.packetName, new DodgeCommand()); @@ -50,34 +47,30 @@ public PacketHandlerMF() } @SubscribeEvent - public void onServerPacket(FMLNetworkEvent.ServerCustomPacketEvent event) - { - packetList.get(event.packet.channel()).process(event.packet.payload(), ((NetHandlerPlayServer)event.handler).playerEntity); + public void onServerPacket(FMLNetworkEvent.ServerCustomPacketEvent event) { + packetList.get(event.packet.channel()).process(event.packet.payload(), + ((NetHandlerPlayServer) event.handler).playerEntity); } @SubscribeEvent - public void onClientPacket(FMLNetworkEvent.ClientCustomPacketEvent event) - { + public void onClientPacket(FMLNetworkEvent.ClientCustomPacketEvent event) { packetList.get(event.packet.channel()).process(event.packet.payload(), MineFantasyII.proxy.getClientPlayer()); } - public void sendPacketToPlayer(FMLProxyPacket packet, EntityPlayerMP player) - { + public void sendPacketToPlayer(FMLProxyPacket packet, EntityPlayerMP player) { channels.get(packet.channel()).sendTo(packet, player); } - public void sendPacketToServer(FMLProxyPacket packet) - { + public void sendPacketToServer(FMLProxyPacket packet) { channels.get(packet.channel()).sendToServer(packet); } - public void sendPacketAround(Entity entity, double range, FMLProxyPacket packet) - { - channels.get(packet.channel()).sendToAllAround(packet, new NetworkRegistry.TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, range)); + public void sendPacketAround(Entity entity, double range, FMLProxyPacket packet) { + channels.get(packet.channel()).sendToAllAround(packet, + new NetworkRegistry.TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, range)); } - public void sendPacketToAll(FMLProxyPacket packet) - { + public void sendPacketToAll(FMLProxyPacket packet) { channels.get(packet.channel()).sendToAll(packet); } } diff --git a/src/main/java/minefantasy/mf2/network/packet/PacketMF.java b/src/main/java/minefantasy/mf2/network/packet/PacketMF.java index cb40075d..5f4e7192 100644 --- a/src/main/java/minefantasy/mf2/network/packet/PacketMF.java +++ b/src/main/java/minefantasy/mf2/network/packet/PacketMF.java @@ -1,21 +1,21 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import net.minecraft.entity.player.EntityPlayer; -import cpw.mods.fml.common.network.internal.FMLProxyPacket; -public abstract class PacketMF -{ +public abstract class PacketMF { - public final FMLProxyPacket generatePacket() - { - ByteBuf buf = Unpooled.buffer(); + public final FMLProxyPacket generatePacket() { + ByteBuf buf = Unpooled.buffer(16); write(buf); return new FMLProxyPacket(buf, getChannel()); } - - public abstract String getChannel(); - public abstract void write(ByteBuf out); - public abstract void process(ByteBuf in, EntityPlayer user); + + public abstract String getChannel(); + + public abstract void write(ByteBuf out); + + public abstract void process(ByteBuf in, EntityPlayer user); } diff --git a/src/main/java/minefantasy/mf2/network/packet/ParryPacket.java b/src/main/java/minefantasy/mf2/network/packet/ParryPacket.java index a3c02c11..fa4fed75 100644 --- a/src/main/java/minefantasy/mf2/network/packet/ParryPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/ParryPacket.java @@ -1,49 +1,43 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; import minefantasy.mf2.mechanics.CombatMechanics; import net.minecraft.entity.player.EntityPlayer; -import cpw.mods.fml.common.network.ByteBufUtils; -public class ParryPacket extends PacketMF -{ - public static final String packetName = "MF2_ParryPacket"; - private int value; - private String username; +public class ParryPacket extends PacketMF { + public static final String packetName = "MF2_ParryPacket"; + private int value; + private String username; - public ParryPacket(int value, EntityPlayer user) - { - this.value = value; - this.username = user.getCommandSenderName(); - } + public ParryPacket(int value, EntityPlayer user) { + this.value = value; + this.username = user.getCommandSenderName(); + } - public ParryPacket() { - } + public ParryPacket() { + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + @Override + public void process(ByteBuf packet, EntityPlayer player) { value = packet.readInt(); username = ByteBufUtils.readUTF8String(packet); - - if (username != null) - { - EntityPlayer entity = player.worldObj .getPlayerEntityByName(username); - if(entity != null) - CombatMechanics.setParryCooldown(entity, value); + + if (username != null) { + EntityPlayer entity = player.worldObj.getPlayerEntityByName(username); + if (entity != null) + CombatMechanics.setParryCooldown(entity, value); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - packet.writeInt(value); + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + packet.writeInt(value); ByteBufUtils.writeUTF8String(packet, username); - } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/RackCommand.java b/src/main/java/minefantasy/mf2/network/packet/RackCommand.java index 256250ea..8b1bf040 100644 --- a/src/main/java/minefantasy/mf2/network/packet/RackCommand.java +++ b/src/main/java/minefantasy/mf2/network/packet/RackCommand.java @@ -7,57 +7,51 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -public class RackCommand extends PacketMF -{ - public static final String packetName = "MF2_Command_Rack"; - private EntityPlayer user; - private TileEntityRack rack; - private int slot; - private String username; - - public RackCommand(int slot, EntityPlayer user, TileEntityRack rack) - { - this.username = user.getCommandSenderName(); - this.slot = slot; - this.rack = rack; - this.user = user; - } - - public RackCommand() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { - int x = packet.readInt(); - int y = packet.readInt(); - int z = packet.readInt(); - - slot = packet.readInt(); - username = ByteBufUtils.readUTF8String(packet); - EntityPlayer user = player.worldObj.getPlayerEntityByName(username); - TileEntity tile = player.worldObj.getTileEntity(x, y, z); - - if (user != null && tile != null && tile instanceof TileEntityRack) - { - rack = (TileEntityRack)tile; - BlockRack.interact(slot, user.worldObj, rack, user); +public class RackCommand extends PacketMF { + public static final String packetName = "MF2_Command_Rack"; + private EntityPlayer user; + private TileEntityRack rack; + private int slot; + private String username; + + public RackCommand(int slot, EntityPlayer user, TileEntityRack rack) { + this.username = user.getCommandSenderName(); + this.slot = slot; + this.rack = rack; + this.user = user; + } + + public RackCommand() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { + int x = packet.readInt(); + int y = packet.readInt(); + int z = packet.readInt(); + + slot = packet.readInt(); + username = ByteBufUtils.readUTF8String(packet); + EntityPlayer user = player.worldObj.getPlayerEntityByName(username); + TileEntity tile = player.worldObj.getTileEntity(x, y, z); + + if (user != null && tile != null && tile instanceof TileEntityRack) { + rack = (TileEntityRack) tile; + BlockRack.interact(slot, user.worldObj, rack, user); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - packet.writeInt(rack.xCoord); - packet.writeInt(rack.yCoord); - packet.writeInt(rack.zCoord); - packet.writeInt(slot); + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + packet.writeInt(rack.xCoord); + packet.writeInt(rack.yCoord); + packet.writeInt(rack.zCoord); + packet.writeInt(slot); ByteBufUtils.writeUTF8String(packet, username); - } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/ResearchRequest.java b/src/main/java/minefantasy/mf2/network/packet/ResearchRequest.java index e6e90009..e9390c4e 100644 --- a/src/main/java/minefantasy/mf2/network/packet/ResearchRequest.java +++ b/src/main/java/minefantasy/mf2/network/packet/ResearchRequest.java @@ -1,62 +1,52 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; -import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.knowledge.InformationBase; import minefantasy.mf2.api.knowledge.InformationList; import minefantasy.mf2.api.knowledge.ResearchLogic; import net.minecraft.entity.player.EntityPlayer; -import cpw.mods.fml.common.network.ByteBufUtils; -public class ResearchRequest extends PacketMF -{ - public static final String packetName = "MF2_RequestResearch"; - private EntityPlayer user; - private int researchID; - private String username; - - public ResearchRequest(EntityPlayer user, int id) - { - this.researchID = id; - this.username = user.getCommandSenderName(); - this.user = user; - } - - public ResearchRequest() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { - researchID = packet.readInt(); - username = ByteBufUtils.readUTF8String(packet); - - if (username != null && player.getCommandSenderName().equals(username)) - { +public class ResearchRequest extends PacketMF { + public static final String packetName = "MF2_RequestResearch"; + private EntityPlayer user; + private int researchID; + private String username; + + public ResearchRequest(EntityPlayer user, int id) { + this.researchID = id; + this.username = user.getCommandSenderName(); + this.user = user; + } + + public ResearchRequest() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { + researchID = packet.readInt(); + username = ByteBufUtils.readUTF8String(packet); + + if (username != null && player.getCommandSenderName().equals(username)) { InformationBase research = InformationList.knowledgeList.get(researchID); - if(player != null && research != null && research.isEasy()) - { - if(!player.worldObj.isRemote) - { - if(research.onPurchase(player)) - { - ResearchLogic.syncData(player); - } - } + if (player != null && research != null && research.isEasy()) { + if (!player.worldObj.isRemote) { + if (research.onPurchase(player)) { + ResearchLogic.syncData(player); + } + } } } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - packet.writeInt(researchID); + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + packet.writeInt(researchID); ByteBufUtils.writeUTF8String(packet, username); - } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/ResearchTablePacket.java b/src/main/java/minefantasy/mf2/network/packet/ResearchTablePacket.java index ffb9d50a..f30bec46 100644 --- a/src/main/java/minefantasy/mf2/network/packet/ResearchTablePacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/ResearchTablePacket.java @@ -4,66 +4,57 @@ import minefantasy.mf2.block.tileentity.TileEntityResearch; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; -public class ResearchTablePacket extends PacketMF -{ - public static final String packetName = "MF2_ResearchTblPkt"; - private int[] coords = new int[3]; - private int id; - private float[] progress = new float[2]; +public class ResearchTablePacket extends PacketMF { + public static final String packetName = "MF2_ResearchTblPkt"; + private int[] coords = new int[3]; + private int id; + private float[] progress = new float[2]; - public ResearchTablePacket(TileEntityResearch tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - id = tile.researchID; - progress = new float[]{tile.progress, tile.maxProgress}; - if(progress[1] <= 0) - { - progress[1] = 0; - } - } + public ResearchTablePacket(TileEntityResearch tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + id = tile.researchID; + progress = new float[]{tile.progress, tile.maxProgress}; + if (progress[1] <= 0) { + progress[1] = 0; + } + } - public ResearchTablePacket() { - } + public ResearchTablePacket() { + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); float prog1 = packet.readFloat(); float prog2 = packet.readFloat(); int ID = packet.readInt(); - - if(entity != null && entity instanceof TileEntityResearch) - { - progress[0] = prog1; - progress[1] = prog2; - id = ID; - - TileEntityResearch carpenter = (TileEntityResearch)entity; - carpenter.researchID = id; - carpenter.progress = progress[0]; - carpenter.maxProgress = (int)progress[1]; + + if (entity != null && entity instanceof TileEntityResearch) { + progress[0] = prog1; + progress[1] = prog2; + id = ID; + + TileEntityResearch carpenter = (TileEntityResearch) entity; + carpenter.researchID = id; + carpenter.progress = progress[0]; + carpenter.maxProgress = (int) progress[1]; } - } + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public String getChannel() { + return packetName; + } - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeFloat(progress[0]); - packet.writeFloat(progress[1]); - packet.writeInt(id); - } + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); + } + packet.writeFloat(progress[0]); + packet.writeFloat(progress[1]); + packet.writeInt(id); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/RoadPacket.java b/src/main/java/minefantasy/mf2/network/packet/RoadPacket.java index 5cd5039a..dcefce1e 100644 --- a/src/main/java/minefantasy/mf2/network/packet/RoadPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/RoadPacket.java @@ -4,81 +4,69 @@ import minefantasy.mf2.block.tileentity.TileEntityRoad; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; -public class RoadPacket extends PacketMF -{ - public static final String packetName = "MF2_RoadPacket"; - private int[] coords = new int[3]; - private int[] surface; - private boolean isLocked; - private boolean isRequest = false; +public class RoadPacket extends PacketMF { + public static final String packetName = "MF2_RoadPacket"; + private int[] coords = new int[3]; + private int[] surface; + private boolean isLocked; + private boolean isRequest = false; - public RoadPacket(TileEntityRoad tile) - { - this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - this.surface = tile.surface; - this.isLocked = tile.isLocked; - } - public RoadPacket request() - { - isRequest = true; - return this; - } + public RoadPacket(TileEntityRoad tile) { + this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + this.surface = tile.surface; + this.isLocked = tile.isLocked; + } - public RoadPacket() { - } + public RoadPacket() { + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { - this.coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; + public RoadPacket request() { + isRequest = true; + return this; + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { + this.coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; isRequest = packet.readBoolean(); - - TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); - - if(entity != null && entity instanceof TileEntityRoad) - { - TileEntityRoad tile = (TileEntityRoad)entity; - if(isRequest) - { - tile.sendPacketToClients(); - } - else - { - int s0 = packet.readInt(); - int s1 = packet.readInt(); - this.isLocked = packet.readBoolean(); - - tile.surface = new int[]{s0, s1}; - tile.isLocked = this.isLocked; - - tile.refreshSurface(); - } + + TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); + + if (entity != null && entity instanceof TileEntityRoad) { + TileEntityRoad tile = (TileEntityRoad) entity; + if (isRequest) { + tile.sendPacketToClients(); + } else { + int s0 = packet.readInt(); + int s1 = packet.readInt(); + this.isLocked = packet.readBoolean(); + + tile.surface = new int[]{s0, s1}; + tile.isLocked = this.isLocked; + + tile.refreshSurface(); + } } packet.clear(); - } + } + + @Override + public String getChannel() { + return packetName; + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); + } + packet.writeBoolean(isRequest); - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeBoolean(isRequest); - - if(!isRequest) - { - packet.writeInt(surface[0]); - packet.writeInt(surface[1]); - packet.writeBoolean(this.isLocked); - } - } + if (!isRequest) { + packet.writeInt(surface[0]); + packet.writeInt(surface[1]); + packet.writeBoolean(this.isLocked); + } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/SkillPacket.java b/src/main/java/minefantasy/mf2/network/packet/SkillPacket.java index 7bd36f07..7a7f0f26 100644 --- a/src/main/java/minefantasy/mf2/network/packet/SkillPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/SkillPacket.java @@ -1,71 +1,59 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; - -import java.util.ArrayList; -import java.util.Iterator; - -import minefantasy.mf2.MineFantasyII; import minefantasy.mf2.api.rpg.RPGElements; import minefantasy.mf2.api.rpg.Skill; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import cpw.mods.fml.common.network.ByteBufUtils; - -public class SkillPacket extends PacketMF -{ - public static final String packetName = "MF2_SkillSync"; - private EntityPlayer user; - private String username; - private int level, xp, xpMax; - private String skillName; - public SkillPacket(EntityPlayer user, Skill skill) - { - this.username = user.getCommandSenderName(); - this.user = user; - NBTTagCompound skilltag = RPGElements.getSkill(user, skill.skillName); - skillName = skill.skillName; - level = skilltag.getInteger("level"); - xp = skilltag.getInteger("xp"); - xpMax = skilltag.getInteger("xpMax"); - } - - public SkillPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { - String name = ByteBufUtils.readUTF8String(packet); - int skillLvl = packet.readInt(); - int skillXp = packet.readInt(); - int skillMaxXp = packet.readInt(); - - username = ByteBufUtils.readUTF8String(packet); - if (username != null && player.getCommandSenderName().equalsIgnoreCase(username)) - { - NBTTagCompound tag = RPGElements.getSkill(player, name); - tag.setInteger("level", skillLvl); - tag.setInteger("xp", skillXp); - tag.setInteger("xpMax", skillMaxXp); +public class SkillPacket extends PacketMF { + public static final String packetName = "MF2_SkillSync"; + private EntityPlayer user; + private String username; + private int level, xp, xpMax; + private String skillName; + + public SkillPacket(EntityPlayer user, Skill skill) { + this.username = user.getCommandSenderName(); + this.user = user; + NBTTagCompound skilltag = RPGElements.getSkill(user, skill.skillName); + skillName = skill.skillName; + level = skilltag.getInteger("level"); + xp = skilltag.getInteger("xp"); + xpMax = skilltag.getInteger("xpMax"); + } + + public SkillPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { + String name = ByteBufUtils.readUTF8String(packet); + int skillLvl = packet.readInt(); + int skillXp = packet.readInt(); + int skillMaxXp = packet.readInt(); + + username = ByteBufUtils.readUTF8String(packet); + if (username != null && player.getCommandSenderName().equalsIgnoreCase(username)) { + NBTTagCompound tag = RPGElements.getSkill(player, name); + tag.setInteger("level", skillLvl); + tag.setInteger("xp", skillXp); + tag.setInteger("xpMax", skillMaxXp); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - ByteBufUtils.writeUTF8String(packet, skillName); - packet.writeInt(level); - packet.writeInt(xp); - packet.writeInt(xpMax); + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + ByteBufUtils.writeUTF8String(packet, skillName); + packet.writeInt(level); + packet.writeInt(xp); + packet.writeInt(xpMax); ByteBufUtils.writeUTF8String(packet, username); - } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/StaminaPacket.java b/src/main/java/minefantasy/mf2/network/packet/StaminaPacket.java index 0d4b2588..9d2271ac 100644 --- a/src/main/java/minefantasy/mf2/network/packet/StaminaPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/StaminaPacket.java @@ -1,57 +1,50 @@ package minefantasy.mf2.network.packet; +import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; import minefantasy.mf2.api.stamina.StaminaBar; import net.minecraft.entity.player.EntityPlayer; -import cpw.mods.fml.common.network.ByteBufUtils; -public class StaminaPacket extends PacketMF -{ - public static final String packetName = "MF2_Staminabar"; - private float[] value; - private String username; +public class StaminaPacket extends PacketMF { + public static final String packetName = "MF2_Staminabar"; + private float[] value; + private String username; - public StaminaPacket(float[]value, EntityPlayer user) - { - this.value = value; - this.username = user.getCommandSenderName(); - } + public StaminaPacket(float[] value, EntityPlayer user) { + this.value = value; + this.username = user.getCommandSenderName(); + } - public StaminaPacket() { - } + public StaminaPacket() { + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + @Override + public void process(ByteBuf packet, EntityPlayer player) { value = new float[]{StaminaBar.getDefaultMax(player), StaminaBar.getDefaultMax(player), 0, 0F}; value[0] = packet.readFloat(); value[1] = packet.readFloat(); value[2] = packet.readFloat(); value[3] = packet.readFloat(); username = ByteBufUtils.readUTF8String(packet); - - if (username != null && player.getCommandSenderName().equalsIgnoreCase(username)) - { + + if (username != null && player.getCommandSenderName().equalsIgnoreCase(username)) { StaminaBar.setStaminaValue(player, value[0]); StaminaBar.setMaxStamina(player, value[1]); StaminaBar.setFlashTime(player, value[2]); StaminaBar.setBonusStamina(player, value[3]); - } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(float variable : value) - { - packet.writeFloat(variable); - } + } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + for (float variable : value) { + packet.writeFloat(variable); + } ByteBufUtils.writeUTF8String(packet, username); - } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/StorageBlockPacket.java b/src/main/java/minefantasy/mf2/network/packet/StorageBlockPacket.java index 5e61d23f..12e12b52 100644 --- a/src/main/java/minefantasy/mf2/network/packet/StorageBlockPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/StorageBlockPacket.java @@ -8,30 +8,28 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -public class StorageBlockPacket extends PacketMF -{ - public static final String packetName = "MF2_StoragePkt"; - private int[] coords = new int[3]; - private ItemStack component; - private String type, tex, materialName; - private int stackSize, max; +public class StorageBlockPacket extends PacketMF { + public static final String packetName = "MF2_StoragePkt"; + private int[] coords = new int[3]; + private ItemStack component; + private String type, tex, materialName; + private int stackSize, max; - public StorageBlockPacket(TileEntityComponent tile) - { - this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - this.type = tile.type; - this.tex = tile.tex; - this.materialName = tile.material != null ? tile.material.name : "steel"; - this.component = tile.item; - this.stackSize = tile.stackSize; - this.max = tile.max; - } - public StorageBlockPacket() { - } + public StorageBlockPacket(TileEntityComponent tile) { + this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + this.type = tile.type; + this.tex = tile.tex; + this.materialName = tile.material != null ? tile.material.name : "steel"; + this.component = tile.item; + this.stackSize = tile.stackSize; + this.max = tile.max; + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + public StorageBlockPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); type = ByteBufUtils.readUTF8String(packet); @@ -40,37 +38,33 @@ public void process(ByteBuf packet, EntityPlayer player) component = ByteBufUtils.readItemStack(packet); stackSize = packet.readInt(); max = packet.readInt(); - - if(entity != null && entity instanceof TileEntityComponent) - { - TileEntityComponent tile = (TileEntityComponent)entity; - tile.type = this.type; - tile.tex = this.tex; - tile.material = CustomMaterial.getMaterial(materialName); - tile.item = this.component; - tile.stackSize = this.stackSize; - tile.max = this.max; + + if (entity != null && entity instanceof TileEntityComponent) { + TileEntityComponent tile = (TileEntityComponent) entity; + tile.type = this.type; + tile.tex = this.tex; + tile.material = CustomMaterial.getMaterial(materialName); + tile.item = this.component; + tile.stackSize = this.stackSize; + tile.max = this.max; } - } + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public String getChannel() { + return packetName; + } - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - ByteBufUtils.writeUTF8String(packet, type); - ByteBufUtils.writeUTF8String(packet, tex); - ByteBufUtils.writeUTF8String(packet, materialName); - ByteBufUtils.writeItemStack(packet, component); - packet.writeInt(stackSize); - packet.writeInt(max); - } + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); + } + ByteBufUtils.writeUTF8String(packet, type); + ByteBufUtils.writeUTF8String(packet, tex); + ByteBufUtils.writeUTF8String(packet, materialName); + ByteBufUtils.writeItemStack(packet, component); + packet.writeInt(stackSize); + packet.writeInt(max); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/TannerPacket.java b/src/main/java/minefantasy/mf2/network/packet/TannerPacket.java index 3b9da1a4..b63e6949 100644 --- a/src/main/java/minefantasy/mf2/network/packet/TannerPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/TannerPacket.java @@ -4,50 +4,42 @@ import minefantasy.mf2.block.tileentity.TileEntityTanningRack; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; - -public class TannerPacket extends PacketMF -{ - public static final String packetName = "MF2_TannerPacket"; - private int[] coords = new int[3]; - private float animation; - - public TannerPacket(TileEntityTanningRack tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - animation = tile.acTime; - } - - public TannerPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + +public class TannerPacket extends PacketMF { + public static final String packetName = "MF2_TannerPacket"; + private int[] coords = new int[3]; + private float animation; + + public TannerPacket(TileEntityTanningRack tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + animation = tile.acTime; + } + + public TannerPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); float newAnim = packet.readFloat(); - - if(entity != null && entity instanceof TileEntityTanningRack) - { - TileEntityTanningRack tile = (TileEntityTanningRack)entity; - tile.acTime = newAnim; + + if (entity != null && entity instanceof TileEntityTanningRack) { + TileEntityTanningRack tile = (TileEntityTanningRack) entity; + tile.acTime = newAnim; + } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeFloat(animation); - } + packet.writeFloat(animation); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/TileInventoryPacket.java b/src/main/java/minefantasy/mf2/network/packet/TileInventoryPacket.java index 7905c549..833844b0 100644 --- a/src/main/java/minefantasy/mf2/network/packet/TileInventoryPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/TileInventoryPacket.java @@ -2,76 +2,64 @@ import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; -import minefantasy.mf2.api.helpers.CustomToolHelper; import minefantasy.mf2.util.MFLogUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -public class TileInventoryPacket extends PacketMF -{ - public static final String packetName = "MF2_TileInvPacket"; - private int[] coords = new int[3]; - private int invSize; - private IInventory inventory; +public class TileInventoryPacket extends PacketMF { + public static final String packetName = "MF2_TileInvPacket"; + private int[] coords = new int[3]; + private int invSize; + private IInventory inventory; - public TileInventoryPacket(IInventory inv, TileEntity tile) - { - this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - this.inventory = inv; - this.invSize = inv.getSizeInventory(); - } + public TileInventoryPacket(IInventory inv, TileEntity tile) { + this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + this.inventory = inv; + this.invSize = inv.getSizeInventory(); + } - public TileInventoryPacket() { - } + public TileInventoryPacket() { + } - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + @Override + public void process(ByteBuf packet, EntityPlayer player) { int x = packet.readInt(); int y = packet.readInt(); int z = packet.readInt(); int size = packet.readInt(); - + TileEntity entity = player.worldObj.getTileEntity(x, y, z); - - if(entity != null && entity instanceof IInventory) - { - IInventory inv = (IInventory)entity; - for(int s = 0; s < size; s++) - { - ItemStack item = ByteBufUtils.readItemStack(packet); - if(s < inv.getSizeInventory()) - { - inv.setInventorySlotContents(s, item); - } - else - { - item = null; - MFLogUtil.logDebug("Dropped Packet Item " + s); - } - } + + if (entity != null && entity instanceof IInventory) { + IInventory inv = (IInventory) entity; + for (int s = 0; s < size; s++) { + ItemStack item = ByteBufUtils.readItemStack(packet); + if (s < inv.getSizeInventory()) { + inv.setInventorySlotContents(s, item); + } else { + item = null; + MFLogUtil.logDebug("Dropped Packet Item " + s); + } + } } - packet.clear(); - } + packet.clear(); + } - @Override - public String getChannel() - { - return packetName; - } + @Override + public String getChannel() { + return packetName; + } - @Override - public void write(ByteBuf packet) - { - packet.writeInt(coords[0]); - packet.writeInt(coords[1]); - packet.writeInt(coords[2]); - packet.writeInt(invSize); - for(int s = 0; s < invSize; s++) - { - ByteBufUtils.writeItemStack(packet, inventory.getStackInSlot(s)); - } - } + @Override + public void write(ByteBuf packet) { + packet.writeInt(coords[0]); + packet.writeInt(coords[1]); + packet.writeInt(coords[2]); + packet.writeInt(invSize); + for (int s = 0; s < invSize; s++) { + ByteBufUtils.writeItemStack(packet, inventory.getStackInSlot(s)); + } + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/TroughPacket.java b/src/main/java/minefantasy/mf2/network/packet/TroughPacket.java index 18c56ea2..8fd4cd05 100644 --- a/src/main/java/minefantasy/mf2/network/packet/TroughPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/TroughPacket.java @@ -4,50 +4,42 @@ import minefantasy.mf2.block.tileentity.decor.TileEntityTrough; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.network.ByteBufUtils; - -public class TroughPacket extends PacketMF -{ - public static final String packetName = "MF2_TroughPacket"; - private int[] coords = new int[3]; - private int fill; - - public TroughPacket(TileEntityTrough tile) - { - coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - fill = tile.fill; - } - - public TroughPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { + +public class TroughPacket extends PacketMF { + public static final String packetName = "MF2_TroughPacket"; + private int[] coords = new int[3]; + private int fill; + + public TroughPacket(TileEntityTrough tile) { + coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + fill = tile.fill; + } + + public TroughPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); int newFill = packet.readInt(); - - if(entity != null && entity instanceof TileEntityTrough) - { - TileEntityTrough tile = (TileEntityTrough)entity; - tile.fill = newFill; + + if (entity != null && entity instanceof TileEntityTrough) { + TileEntityTrough tile = (TileEntityTrough) entity; + tile.fill = newFill; + } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - packet.writeInt(fill); - } + packet.writeInt(fill); + } } diff --git a/src/main/java/minefantasy/mf2/network/packet/WoodDecorPacket.java b/src/main/java/minefantasy/mf2/network/packet/WoodDecorPacket.java index f3e195a9..566b4ec7 100644 --- a/src/main/java/minefantasy/mf2/network/packet/WoodDecorPacket.java +++ b/src/main/java/minefantasy/mf2/network/packet/WoodDecorPacket.java @@ -6,47 +6,41 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -public class WoodDecorPacket extends PacketMF -{ - public static final String packetName = "MF2_WdDecorPkt"; - private int[] coords = new int[3]; - private String materialName; - - public WoodDecorPacket(TileEntityWoodDecor tile) - { - this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; - this.materialName = tile.getMaterialName(); - } - public WoodDecorPacket() { - } - - @Override - public void process(ByteBuf packet, EntityPlayer player) - { +public class WoodDecorPacket extends PacketMF { + public static final String packetName = "MF2_WdDecorPkt"; + private int[] coords = new int[3]; + private String materialName; + + public WoodDecorPacket(TileEntityWoodDecor tile) { + this.coords = new int[]{tile.xCoord, tile.yCoord, tile.zCoord}; + this.materialName = tile.getMaterialName(); + } + + public WoodDecorPacket() { + } + + @Override + public void process(ByteBuf packet, EntityPlayer player) { coords = new int[]{packet.readInt(), packet.readInt(), packet.readInt()}; TileEntity entity = player.worldObj.getTileEntity(coords[0], coords[1], coords[2]); materialName = ByteBufUtils.readUTF8String(packet); - - if(entity != null && entity instanceof TileEntityWoodDecor) - { - TileEntityWoodDecor tile = (TileEntityWoodDecor)entity; - tile.trySetMaterial(materialName); + + if (entity != null && entity instanceof TileEntityWoodDecor) { + TileEntityWoodDecor tile = (TileEntityWoodDecor) entity; + tile.trySetMaterial(materialName); + } + } + + @Override + public String getChannel() { + return packetName; + } + + @Override + public void write(ByteBuf packet) { + for (int a = 0; a < coords.length; a++) { + packet.writeInt(coords[a]); } - } - - @Override - public String getChannel() - { - return packetName; - } - - @Override - public void write(ByteBuf packet) - { - for(int a = 0; a < coords.length; a++) - { - packet.writeInt(coords[a]); - } - ByteBufUtils.writeUTF8String(packet, materialName); - } + ByteBufUtils.writeUTF8String(packet, materialName); + } } diff --git a/src/main/java/minefantasy/mf2/recipe/BasicRecipesMF.java b/src/main/java/minefantasy/mf2/recipe/BasicRecipesMF.java index 46ef7579..211c69fe 100644 --- a/src/main/java/minefantasy/mf2/recipe/BasicRecipesMF.java +++ b/src/main/java/minefantasy/mf2/recipe/BasicRecipesMF.java @@ -1,456 +1,230 @@ package minefantasy.mf2.recipe; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.api.MineFantasyAPI; -import minefantasy.mf2.api.crafting.Salvage; import minefantasy.mf2.api.crafting.tanning.TanningRecipe; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.basic.ConstructionBlockMF; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigHardcore; -import minefantasy.mf2.item.ItemComponentMF; -import minefantasy.mf2.item.armour.ItemArmourMF; import minefantasy.mf2.item.food.FoodListMF; -import minefantasy.mf2.item.list.ArmourListMF; import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.item.list.CustomArmourListMF; import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.item.list.styles.DragonforgedStyle; import minefantasy.mf2.item.list.styles.OrnateStyle; import minefantasy.mf2.knowledge.KnowledgeListMF; import minefantasy.mf2.material.BaseMaterialMF; -import minefantasy.mf2.util.MFLogUtil; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; -import cpw.mods.fml.common.registry.GameRegistry; -public class BasicRecipesMF -{ - public static void init() - { - addFoodOutput(); - TempRecipesMF.init();//TODO remove temp recipes - ForgingRecipes.init(); - CarpenterRecipes.init(); - SmeltingRecipesMF.init(); - SalvageRecipes.init(); - CookingRecipes.init(); - DragonforgedStyle.loadCrafting(); - OrnateStyle.loadCrafting(); - GameRegistry.addRecipe(new RecipeArmourDyeMF()); - - ArrayList wood = CustomMaterial.getList("wood"); - Iterator iteratorWood = wood.iterator(); - - KnowledgeListMF.stickRecipe = - GameRegistry.addShapedRecipe(new ItemStack(Items.stick, 2), new Object[] - { - "S", - 'S', ComponentListMF.plank - }); - GameRegistry.addShapedRecipe(new ItemStack(Items.stick, 2), new Object[] - { - "S", - 'S', ComponentListMF.plank_cut - }); - - KnowledgeListMF.firepitRecipe = - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.firepit), new Object[] - { - " P ", - "S S", - 'S', Items.stick, - 'P', ComponentListMF.plank - }); - KnowledgeListMF.cooktopRecipe = - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.roast), new Object[] - { - "PSP", - 'S', Blocks.cobblestone, - 'P', ComponentListMF.plank - }); - - GameRegistry.addShapelessRecipe(new ItemStack(BlockListMF.yew_planks, 4), new Object[] - { - BlockListMF.log_yew - }); - GameRegistry.addShapelessRecipe(new ItemStack(BlockListMF.ironbark_planks, 4), new Object[] - { - BlockListMF.log_ironbark - }); - GameRegistry.addShapelessRecipe(new ItemStack(BlockListMF.ebony_planks, 4), new Object[] - { - BlockListMF.log_ebony - }); - - while(iteratorWood.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); - assembleWoodVariations(customMat); - } - - KnowledgeListMF.plantOilR = - GameRegistry.addShapedRecipe(new ItemStack(ComponentListMF.plant_oil, 4), new Object[] - { - " B ", - "BFB", - " B ", - 'F', Items.wheat_seeds, - 'B', FoodListMF.jug_empty - }); - KnowledgeListMF.waterJugR = - GameRegistry.addShapedRecipe(new ItemStack(FoodListMF.jug_water, 4), new Object[] - { - " B ", - "BWB", - " B ", - 'W', Items.water_bucket, - 'B', FoodListMF.jug_empty - }); - KnowledgeListMF.sugarRecipe = - GameRegistry.addShapedRecipe(new ItemStack(FoodListMF.sugarpot), new Object[] - { - "S", - "S", - "B", - 'S', Items.sugar, - 'B', ComponentListMF.clay_pot, - }); - GameRegistry.addShapelessRecipe(new ItemStack(Items.sugar, 2), new Object[] - { - FoodListMF.sugarpot, - }); - KnowledgeListMF.milkJugR = - GameRegistry.addShapedRecipe(new ItemStack(FoodListMF.jug_milk, 4), new Object[] - { - " B ", - "BMB", - " B ", - 'M', Items.milk_bucket, - 'B', FoodListMF.jug_empty - }); - GameRegistry.addShapedRecipe(new ItemStack(Items.milk_bucket), new Object[] - { - " B ", - "BMB", - " B ", - 'M', Items.bucket, - 'B', FoodListMF.jug_milk - }); - GameRegistry.addShapedRecipe(new ItemStack(Items.water_bucket), new Object[] - { - " B ", - "BMB", - " B ", - 'M', Items.bucket, - 'B', FoodListMF.jug_water - }); - - - GameRegistry.addRecipe(new RecipeSyringe()); - //Just a way on making the overpowered gunpowder from black powder - GameRegistry.addShapelessRecipe(new ItemStack(Items.gunpowder), new Object[] - { - new ItemStack(ComponentListMF.blackpowder), - new ItemStack(ComponentListMF.blackpowder), - new ItemStack(ComponentListMF.nitre), - }); - - - - for(int id = 0; id < BlockListMF.metalBlocks.length; id ++) - { - BaseMaterialMF material = BaseMaterialMF.getMaterial(BlockListMF.metalBlocks[id]); - - for(ItemStack ingot: OreDictionary.getOres("ingot"+material.name)) - { - GameRegistry.addRecipe(new ItemStack(BlockListMF.storage[id]), new Object[] - { - "III", - "III", - "III", - 'I', ingot - }); - GameRegistry.addShapelessRecipe(new ItemStack(ingot.getItem(), 9), new Object[] - { - BlockListMF.storage[id] - }); - } - } - - KnowledgeListMF.fireclayR = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ComponentListMF.fireclay, 4), new Object[] - { - " C ", - "CDC", - " C ", - - 'D', ComponentListMF.kaolinite_dust, - 'C', Items.clay_ball - }); - KnowledgeListMF.fireBrickR = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ComponentListMF.fireclay_brick) , new Object[] - { - "C", - - 'C', ComponentListMF.fireclay - }); - KnowledgeListMF.fireBricksR = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(BlockListMF.firebricks) , new Object[] - { - "BB", - "BB", - - 'B', ComponentListMF.strong_brick - }); - KnowledgeListMF.fireBrickStairR= - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(BlockListMF.firebrick_stair) , new Object[] - { - "B ", - "BB", - - 'B', ComponentListMF.strong_brick - }); - BaseMaterialMF mat = BaseMaterialMF.iron; - - GameRegistry.addShapelessRecipe(new ItemStack(ComponentListMF.hideSmall), new Object[]{ - ComponentListMF.rawhideSmall, ComponentListMF.flux - }); - GameRegistry.addShapelessRecipe(new ItemStack(ComponentListMF.hideMedium), new Object[]{ - ComponentListMF.rawhideMedium, ComponentListMF.flux - }); - GameRegistry.addShapelessRecipe(new ItemStack(ComponentListMF.hideLarge), new Object[]{ - ComponentListMF.rawhideLarge, ComponentListMF.flux - }); - - TanningRecipe.addRecipe(ComponentListMF.hideSmall, mat.craftTimeModifier*2F, -1, new ItemStack(Items.leather)); - TanningRecipe.addRecipe(ComponentListMF.hideMedium, mat.craftTimeModifier*3F, -1, new ItemStack(Items.leather, 3)); - TanningRecipe.addRecipe(ComponentListMF.hideLarge, mat.craftTimeModifier*4F, -1, new ItemStack(Items.leather, 5)); - TanningRecipe.addRecipe(Items.leather, mat.craftTimeModifier*2F, -1, "shears", new ItemStack(ComponentListMF.leather_strip, 4)); - - KnowledgeListMF.artBookR = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_artisanry), new Object[] - { - "T", - "D", - "B", - 'T', ComponentListMF.talisman_lesser, - 'D', new ItemStack(Items.dye, 1, 1), - 'B', Items.book, - }); - KnowledgeListMF.conBookR = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_construction), new Object[] - { - "T", - "D", - "B", - 'T', ComponentListMF.talisman_lesser, - 'D', new ItemStack(Items.dye, 1, 14), - 'B', Items.book, - }); - KnowledgeListMF.proBookR = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_provisioning), new Object[] - { - "T", - "D", - "B", - 'T', ComponentListMF.talisman_lesser, - 'D', new ItemStack(Items.dye, 1, 2), - 'B', Items.book, - }); - KnowledgeListMF.engBookR = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_engineering), new Object[] - { - "T", - "D", - "B", - 'T', ComponentListMF.talisman_lesser, - 'D', new ItemStack(Items.dye, 1, 12), - 'B', Items.book, - }); - KnowledgeListMF.comBookR = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_combat), new Object[] - { - "T", - "D", - "B", - 'T', ComponentListMF.talisman_lesser, - 'D', new ItemStack(Items.dye, 1, 5), - 'B', Items.book, - }); - - - KnowledgeListMF.artBook2R = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_artisanry2), new Object[] - { - "T", - "B", - 'T', ComponentListMF.talisman_greater, - 'B', ToolListMF.skillbook_artisanry, - }); - KnowledgeListMF.conBook2R = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_construction2), new Object[] - { - "T", - "B", - 'T', ComponentListMF.talisman_greater, - 'B', ToolListMF.skillbook_construction, - }); - KnowledgeListMF.proBook2R = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_provisioning2), new Object[] - { - "T", - "B", - 'T', ComponentListMF.talisman_greater, - 'B', ToolListMF.skillbook_provisioning, - }); - KnowledgeListMF.engBook2R = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_engineering2), new Object[] - { - "T", - "B", - 'T', ComponentListMF.talisman_greater, - 'B', ToolListMF.skillbook_engineering, - }); - KnowledgeListMF.comBook2R = - MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_combat2), new Object[] - { - "T", - "B", - 'T', ComponentListMF.talisman_greater, - 'B', ToolListMF.skillbook_combat, - }); - GameRegistry.addShapedRecipe(((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood"), new Object[] - { - "S", - "S", - 'S', Items.stick, - }); - - Object rock = ConfigHardcore.HCCallowRocks ? ComponentListMF.sharp_rock : Blocks.cobblestone; - KnowledgeListMF.dryrocksR = - GameRegistry.addShapedRecipe(new ItemStack(ToolListMF.dryrocks), new Object[]{ - "R ", - " R", - 'R', rock - }); - - ((ConstructionBlockMF.StairsConstBlock)BlockListMF.mud_brick_stair).addRecipe(); - ((ConstructionBlockMF.StairsConstBlock)BlockListMF.mud_pavement_stair).addRecipe(); - ((ConstructionBlockMF.StairsConstBlock)BlockListMF.cobble_brick_stair).addRecipe(); - ((ConstructionBlockMF.StairsConstBlock)BlockListMF.cobble_pavement_stair).addRecipe(); - ((ConstructionBlockMF.StairsConstBlock)BlockListMF.reinforced_stone_brick_stair).addRecipe(); - ((ConstructionBlockMF.StairsConstBlock)BlockListMF.reinforced_stone_stair).addRecipe(); - - ((ConstructionBlockMF.StairsConstBlock)BlockListMF.yew_stair).addRecipe(); - ((ConstructionBlockMF.StairsConstBlock)BlockListMF.ironbark_stair).addRecipe(); - ((ConstructionBlockMF.StairsConstBlock)BlockListMF.ebony_stair).addRecipe(); - } - +import java.util.ArrayList; +import java.util.Iterator; + +public class BasicRecipesMF { + public static void init() { + addFoodOutput(); + TempRecipesMF.init();// TODO remove temp recipes + ForgingRecipes.init(); + CarpenterRecipes.init(); + SmeltingRecipesMF.init(); + SalvageRecipes.init(); + CookingRecipes.init(); + DragonforgedStyle.loadCrafting(); + OrnateStyle.loadCrafting(); + GameRegistry.addRecipe(new RecipeArmourDyeMF()); + + ArrayList wood = CustomMaterial.getList("wood"); + Iterator iteratorWood = wood.iterator(); + + KnowledgeListMF.stickRecipe = GameRegistry.addShapedRecipe(new ItemStack(Items.stick, 2), + new Object[]{"S", 'S', ComponentListMF.plank}); + GameRegistry.addShapedRecipe(new ItemStack(Items.stick, 2), + new Object[]{"S", 'S', ComponentListMF.plank_cut}); + + KnowledgeListMF.firepitRecipe = GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.firepit), + new Object[]{" P ", "S S", 'S', Items.stick, 'P', ComponentListMF.plank}); + KnowledgeListMF.cooktopRecipe = GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.roast), + new Object[]{"PSP", 'S', Blocks.cobblestone, 'P', ComponentListMF.plank}); + + GameRegistry.addShapelessRecipe(new ItemStack(BlockListMF.yew_planks, 4), new Object[]{BlockListMF.log_yew}); + GameRegistry.addShapelessRecipe(new ItemStack(BlockListMF.ironbark_planks, 4), + new Object[]{BlockListMF.log_ironbark}); + GameRegistry.addShapelessRecipe(new ItemStack(BlockListMF.ebony_planks, 4), + new Object[]{BlockListMF.log_ebony}); + + while (iteratorWood.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); + assembleWoodVariations(customMat); + } + + KnowledgeListMF.plantOilR = GameRegistry.addShapedRecipe(new ItemStack(ComponentListMF.plant_oil, 4), + new Object[]{" B ", "BFB", " B ", 'F', Items.wheat_seeds, 'B', FoodListMF.jug_empty}); + KnowledgeListMF.waterJugR = GameRegistry.addShapedRecipe(new ItemStack(FoodListMF.jug_water, 4), + new Object[]{" B ", "BWB", " B ", 'W', Items.water_bucket, 'B', FoodListMF.jug_empty}); + KnowledgeListMF.sugarRecipe = GameRegistry.addShapedRecipe(new ItemStack(FoodListMF.sugarpot), + new Object[]{"S", "S", "B", 'S', Items.sugar, 'B', ComponentListMF.clay_pot,}); + GameRegistry.addShapelessRecipe(new ItemStack(Items.sugar, 2), new Object[]{FoodListMF.sugarpot,}); + KnowledgeListMF.milkJugR = GameRegistry.addShapedRecipe(new ItemStack(FoodListMF.jug_milk, 4), + new Object[]{" B ", "BMB", " B ", 'M', Items.milk_bucket, 'B', FoodListMF.jug_empty}); + GameRegistry.addShapedRecipe(new ItemStack(Items.milk_bucket), + new Object[]{" B ", "BMB", " B ", 'M', Items.bucket, 'B', FoodListMF.jug_milk}); + GameRegistry.addShapedRecipe(new ItemStack(Items.water_bucket), + new Object[]{" B ", "BMB", " B ", 'M', Items.bucket, 'B', FoodListMF.jug_water}); + + GameRegistry.addRecipe(new RecipeSyringe()); + // Just a way on making the overpowered gunpowder from black powder + GameRegistry.addShapelessRecipe(new ItemStack(Items.gunpowder), + new Object[]{new ItemStack(ComponentListMF.blackpowder), new ItemStack(ComponentListMF.blackpowder), + new ItemStack(ComponentListMF.nitre),}); + + for (int id = 0; id < BlockListMF.metalBlocks.length; id++) { + BaseMaterialMF material = BaseMaterialMF.getMaterial(BlockListMF.metalBlocks[id]); + + for (ItemStack ingot : OreDictionary.getOres("ingot" + material.name)) { + GameRegistry.addRecipe(new ItemStack(BlockListMF.storage[id]), + new Object[]{"III", "III", "III", 'I', ingot}); + GameRegistry.addShapelessRecipe(new ItemStack(ingot.getItem(), 9), + new Object[]{BlockListMF.storage[id]}); + } + } + + KnowledgeListMF.fireclayR = MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(ComponentListMF.fireclay, 4), + new Object[]{" C ", "CDC", " C ", + + 'D', ComponentListMF.kaolinite_dust, 'C', Items.clay_ball}); + KnowledgeListMF.fireBrickR = MineFantasyAPI + .addBasicCarpenterRecipe(new ItemStack(ComponentListMF.fireclay_brick), new Object[]{"C", + + 'C', ComponentListMF.fireclay}); + KnowledgeListMF.fireBricksR = MineFantasyAPI.addBasicCarpenterRecipe(new ItemStack(BlockListMF.firebricks), + new Object[]{"BB", "BB", + + 'B', ComponentListMF.strong_brick}); + KnowledgeListMF.fireBrickStairR = MineFantasyAPI + .addBasicCarpenterRecipe(new ItemStack(BlockListMF.firebrick_stair), new Object[]{"B ", "BB", + + 'B', ComponentListMF.strong_brick}); + BaseMaterialMF mat = BaseMaterialMF.iron; + + GameRegistry.addShapelessRecipe(new ItemStack(ComponentListMF.hideSmall), + new Object[]{ComponentListMF.rawhideSmall, ComponentListMF.flux}); + GameRegistry.addShapelessRecipe(new ItemStack(ComponentListMF.hideMedium), + new Object[]{ComponentListMF.rawhideMedium, ComponentListMF.flux}); + GameRegistry.addShapelessRecipe(new ItemStack(ComponentListMF.hideLarge), + new Object[]{ComponentListMF.rawhideLarge, ComponentListMF.flux}); + + TanningRecipe.addRecipe(ComponentListMF.hideSmall, mat.craftTimeModifier * 2F, -1, + new ItemStack(Items.leather)); + TanningRecipe.addRecipe(ComponentListMF.hideMedium, mat.craftTimeModifier * 3F, -1, + new ItemStack(Items.leather, 3)); + TanningRecipe.addRecipe(ComponentListMF.hideLarge, mat.craftTimeModifier * 4F, -1, + new ItemStack(Items.leather, 5)); + TanningRecipe.addRecipe(Items.leather, mat.craftTimeModifier * 2F, -1, "shears", + new ItemStack(ComponentListMF.leather_strip, 4)); + + if (!ConfigHardcore.HCCRemoveBooksCraft) { + KnowledgeListMF.artBookR = MineFantasyAPI.addBasicCarpenterRecipe( + new ItemStack(ToolListMF.skillbook_artisanry), new Object[]{"T", "D", "B", 'T', + ComponentListMF.talisman_lesser, 'D', new ItemStack(Items.dye, 1, 1), 'B', Items.book,}); + KnowledgeListMF.conBookR = MineFantasyAPI.addBasicCarpenterRecipe( + new ItemStack(ToolListMF.skillbook_construction), new Object[]{"T", "D", "B", 'T', + ComponentListMF.talisman_lesser, 'D', new ItemStack(Items.dye, 1, 14), 'B', Items.book,}); + KnowledgeListMF.proBookR = MineFantasyAPI.addBasicCarpenterRecipe( + new ItemStack(ToolListMF.skillbook_provisioning), new Object[]{"T", "D", "B", 'T', + ComponentListMF.talisman_lesser, 'D', new ItemStack(Items.dye, 1, 2), 'B', Items.book,}); + KnowledgeListMF.engBookR = MineFantasyAPI.addBasicCarpenterRecipe( + new ItemStack(ToolListMF.skillbook_engineering), new Object[]{"T", "D", "B", 'T', + ComponentListMF.talisman_lesser, 'D', new ItemStack(Items.dye, 1, 12), 'B', Items.book,}); + KnowledgeListMF.comBookR = MineFantasyAPI.addBasicCarpenterRecipe( + new ItemStack(ToolListMF.skillbook_combat), new Object[]{"T", "D", "B", 'T', + ComponentListMF.talisman_lesser, 'D', new ItemStack(Items.dye, 1, 5), 'B', Items.book,}); + + KnowledgeListMF.artBook2R = MineFantasyAPI + .addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_artisanry2), new Object[]{"T", "B", + 'T', ComponentListMF.talisman_greater, 'B', ToolListMF.skillbook_artisanry,}); + KnowledgeListMF.conBook2R = MineFantasyAPI + .addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_construction2), new Object[]{"T", "B", + 'T', ComponentListMF.talisman_greater, 'B', ToolListMF.skillbook_construction,}); + KnowledgeListMF.proBook2R = MineFantasyAPI + .addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_provisioning2), new Object[]{"T", "B", + 'T', ComponentListMF.talisman_greater, 'B', ToolListMF.skillbook_provisioning,}); + KnowledgeListMF.engBook2R = MineFantasyAPI + .addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_engineering2), new Object[]{"T", "B", + 'T', ComponentListMF.talisman_greater, 'B', ToolListMF.skillbook_engineering,}); + KnowledgeListMF.comBook2R = MineFantasyAPI + .addBasicCarpenterRecipe(new ItemStack(ToolListMF.skillbook_combat2), new Object[]{"T", "B", 'T', + ComponentListMF.talisman_greater, 'B', ToolListMF.skillbook_combat,}); + } + + GameRegistry.addShapedRecipe(ComponentListMF.plank.construct("ScrapWood"), + new Object[]{"S", "S", 'S', Items.stick,}); + + Object rock = ConfigHardcore.HCCallowRocks ? ComponentListMF.sharp_rock : Blocks.cobblestone; + KnowledgeListMF.dryrocksR = GameRegistry.addShapedRecipe(new ItemStack(ToolListMF.dryrocks), + new Object[]{"R ", " R", 'R', rock}); + + ((ConstructionBlockMF.StairsConstBlock) BlockListMF.mud_brick_stair).addRecipe(); + ((ConstructionBlockMF.StairsConstBlock) BlockListMF.mud_pavement_stair).addRecipe(); + ((ConstructionBlockMF.StairsConstBlock) BlockListMF.cobble_brick_stair).addRecipe(); + ((ConstructionBlockMF.StairsConstBlock) BlockListMF.cobble_pavement_stair).addRecipe(); + ((ConstructionBlockMF.StairsConstBlock) BlockListMF.reinforced_stone_brick_stair).addRecipe(); + ((ConstructionBlockMF.StairsConstBlock) BlockListMF.reinforced_stone_stair).addRecipe(); + + ((ConstructionBlockMF.StairsConstBlock) BlockListMF.yew_stair).addRecipe(); + ((ConstructionBlockMF.StairsConstBlock) BlockListMF.ironbark_stair).addRecipe(); + ((ConstructionBlockMF.StairsConstBlock) BlockListMF.ebony_stair).addRecipe(); + } + + private static void assembleWoodVariations(CustomMaterial material) { + // TODO + if (material.name != "RefinedWood") { + ArrayList list = OreDictionary.getOres("planks" + material.name); + if (list.isEmpty()) { + for (ItemStack planks : OreDictionary.getOres("plankWood")) { + if (planks.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + ItemStack item = planks.copy(); + for (int i = 0; i < 16; i++) { + item.setItemDamage(i); + tryAddWoodPlanks(item, material); + CarpenterRecipes.tryAddSawPlanks(item, material); + } + } else { + tryAddWoodPlanks(planks, material); + CarpenterRecipes.tryAddSawPlanks(planks, material); + } + } + } else + for (ItemStack block : list) { + KnowledgeListMF.plankRecipe.add(GameRegistry.addShapedRecipe( + ComponentListMF.plank.construct(material.name, 4), new Object[]{"P", "P", 'P', block})); + CarpenterRecipes.addSawPlanks(block, material); + } + } + } + + private static void tryAddWoodPlanks(ItemStack planks, CustomMaterial material) { + String sub = material.name.substring(0, material.name.length() - 4).toLowerCase(); + + if (planks.getUnlocalizedName().toLowerCase().contains(sub)) { + KnowledgeListMF.plankRecipe.add(GameRegistry.addShapedRecipe( + ComponentListMF.plank.construct(material.name, 4), new Object[]{"P", "P", 'P', planks.copy()})); + } + } - private static void assembleWoodVariations(CustomMaterial material) - { - // TODO - if(material.name != "RefinedWood") - { - ArrayList list = OreDictionary.getOres("planks"+material.name); - if(list.isEmpty()) - { - for(ItemStack planks: OreDictionary.getOres("plankWood")) - { - if(planks.getItemDamage() == OreDictionary.WILDCARD_VALUE) - { - ItemStack item = planks.copy(); - for(int i = 0; i < 16; i++) - { - item.setItemDamage(i); - tryAddWoodPlanks(item, material); - CarpenterRecipes.tryAddSawPlanks(item, material); - } - } - else - { - tryAddWoodPlanks(planks, material); - CarpenterRecipes.tryAddSawPlanks(planks, material); - } - } - } - else - for(ItemStack block : list) - { - KnowledgeListMF.plankRecipe.add( - GameRegistry.addShapedRecipe(((ItemComponentMF)ComponentListMF.plank).construct(material.name, 4), new Object[]{ - "P", - "P", - 'P', block - })); - CarpenterRecipes.addSawPlanks(block, material); - } - } - } - - private static void tryAddWoodPlanks(ItemStack planks, CustomMaterial material) - { - String sub = material.name.substring(0, material.name.length()-4).toLowerCase(); - - if(planks.getUnlocalizedName().toLowerCase().contains(sub)) - { - KnowledgeListMF.plankRecipe.add( - GameRegistry.addShapedRecipe(((ItemComponentMF)ComponentListMF.plank).construct(material.name, 4), new Object[]{ - "P", - "P", - 'P', planks.copy() - })); - } - } - - private static void addFoodOutput() - { - KnowledgeListMF.cheeseOut = - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.cheese_wheel), new Object[] - { - "F", - 'F', FoodListMF.cheese_pot, - }); - KnowledgeListMF.meatpieOut = - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.pie_meat), new Object[] - { - "F", - 'F', FoodListMF.pie_meat_cooked - }); - KnowledgeListMF.shepardOut = - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.pie_shepards), new Object[] - { - "F", - 'F', FoodListMF.pie_shepard_cooked - }); - KnowledgeListMF.appleOut = - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.pie_apple), new Object[] - { - "F", - 'F', FoodListMF.pie_apple_cooked - }); - KnowledgeListMF.berryOut = - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.pie_berry), new Object[] - { - "F", - 'F', FoodListMF.pie_berry_cooked - }); - KnowledgeListMF.pumpPieOut = - GameRegistry.addShapedRecipe(new ItemStack(Items.pumpkin_pie), new Object[] - { - "F", - 'F', FoodListMF.pie_pumpkin_cooked - }); - } + private static void addFoodOutput() { + KnowledgeListMF.cheeseOut = GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.cheese_wheel), + new Object[]{"F", 'F', FoodListMF.cheese_pot,}); + KnowledgeListMF.meatpieOut = GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.pie_meat), + new Object[]{"F", 'F', FoodListMF.pie_meat_cooked}); + KnowledgeListMF.shepardOut = GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.pie_shepards), + new Object[]{"F", 'F', FoodListMF.pie_shepard_cooked}); + KnowledgeListMF.appleOut = GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.pie_apple), + new Object[]{"F", 'F', FoodListMF.pie_apple_cooked}); + KnowledgeListMF.berryOut = GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.pie_berry), + new Object[]{"F", 'F', FoodListMF.pie_berry_cooked}); + KnowledgeListMF.pumpPieOut = GameRegistry.addShapedRecipe(new ItemStack(Items.pumpkin_pie), + new Object[]{"F", 'F', FoodListMF.pie_pumpkin_cooked}); + } } diff --git a/src/main/java/minefantasy/mf2/recipe/CarpenterRecipes.java b/src/main/java/minefantasy/mf2/recipe/CarpenterRecipes.java index b19075fb..b2224513 100644 --- a/src/main/java/minefantasy/mf2/recipe/CarpenterRecipes.java +++ b/src/main/java/minefantasy/mf2/recipe/CarpenterRecipes.java @@ -11,7 +11,6 @@ import minefantasy.mf2.block.decor.BlockWoodDecor; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigHardcore; -import minefantasy.mf2.item.ItemComponentMF; import minefantasy.mf2.item.food.FoodListMF; import minefantasy.mf2.item.list.ArmourListMF; import minefantasy.mf2.item.list.ComponentListMF; @@ -25,1801 +24,965 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class CarpenterRecipes -{ - public static final String basic = "step.wood"; - public static final String chopping = "dig.wood"; - public static final String primitive = "minefantasy2:block.craftprimitive"; - public static final String sewing = "step.cloth"; - public static final String stonemason = "minefantasy2:block.hammercarpenter"; - public static final String snipping = "mob.sheep.shear"; - public static final String sawing = "minefantasy2:block.sawcarpenter"; - public static final String grinding = "dig.gravel"; - public static final String nailHammer = "minefantasy2:block.hammercarpenter"; - public static final String woodHammer = "minefantasy2:block.carpentermallet"; - public static final String mixing = "step.wood"; - public static final String spanner = "minefantasy2:block.twistbolt"; - - private static final Skill artisanry = SkillList.artisanry; - private static final Skill engineering = SkillList.engineering; - private static final Skill construction = SkillList.construction; - private static final Skill provisioning = SkillList.provisioning; - - public static void init() - { - /* - ArrayList wood = CustomMaterial.getList("wood"); - Iterator iteratorWood = wood.iterator(); - while(iteratorWood.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); - - } - */ - assembleWoodBasic(); - CustomWoodRecipes.init(); - addDusts(); - addWoodworks(); - addStonemason(); - addCooking(); - addMisc(); - addEngineering(); - if(ConfigHardcore.HCCallowRocks) - { - addPrimitive(); - } - else - { - addNonPrimitiveStone(); - } - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.researchBook), "", sewing, "hands", -1, 1 , new Object[] - { - "B", - 'B', Items.book, - }); - - - if(ConfigHardcore.HCCallowRocks) - { - KnowledgeListMF.sharpRocksR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.sharp_rock, 8), "", stonemason, "hammer", -1, 10 , new Object[] - { - "S", - 'S', Blocks.cobblestone, - }); - - } - else - { - - } - Salvage.addSalvage(ToolListMF.dryrocks, Blocks.cobblestone); - - - - KnowledgeListMF.threadR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.thread, 4), "commodities", sewing, "hands", -1, 5 , new Object[] - { - "W", - "S", - 'W', Blocks.wool, - 'S', Items.stick, - }); - KnowledgeListMF.stringR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(Items.string), "commodities", sewing, "hands", -1, 10 , new Object[] - { - "T", - "T", - "T", - "T", - 'T', ComponentListMF.thread - }); - - KnowledgeListMF.lStripsR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.leather_strip, 4), "commodities", snipping, "shears", -1, 10 , new Object[] - { - "L", - 'L', Items.leather, - }); - - - - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ToolListMF.swordTraining), nailHammer, "knife", 1, 40 , new Object[] - { - "NI ", - "SIII", - "NI ", - 'N', ComponentListMF.nail, - 'S', ComponentListMF.plank, - 'I', Blocks.planks, - }); - - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ToolListMF.waraxeTraining), nailHammer, "knife", 1, 30 , new Object[] - { - " II ", - "SSIN", - " I ", - 'N', ComponentListMF.nail, - 'S', ComponentListMF.plank, - 'I', Blocks.planks, - }); - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ToolListMF.maceTraining), nailHammer, "knife", 1, 35 , new Object[] - { - " II ", - "SSIIN", - 'N', ComponentListMF.nail, - 'S', ComponentListMF.plank, - 'I', Blocks.planks, - }); - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ToolListMF.spearTraining), nailHammer, "knife", 1, 20 , new Object[] - { - " N ", - "SSSI", - " N ", - 'N', ComponentListMF.nail, - 'S', ComponentListMF.plank, - 'I', Blocks.planks, - }); - ItemStack scrapWood = ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood"); - Salvage.addSalvage(ToolListMF.swordTraining, new ItemStack(Blocks.planks, 5), new ItemStack(ComponentListMF.nail, 2), scrapWood); - Salvage.addSalvage(ToolListMF.waraxeTraining, new ItemStack(Blocks.planks, 4), ComponentListMF.nail, scrapWood, scrapWood); - Salvage.addSalvage(ToolListMF.maceTraining, new ItemStack(Blocks.planks, 4), ComponentListMF.nail, scrapWood, scrapWood); - Salvage.addSalvage(ToolListMF.waraxeTraining, Blocks.planks, new ItemStack(ComponentListMF.nail, 2), scrapWood, scrapWood, scrapWood); - - KnowledgeListMF.badBandageR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(ToolListMF.bandage_crude, 2), "bandage", sewing, "needle", -1, 10 , new Object[] - { - "LLL", - 'L', ComponentListMF.rawhideSmall, - }); - - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(ToolListMF.bandage_crude, 4), "bandage", sewing, "needle", -1, 20 , new Object[] - { - "LLL", - 'L', ComponentListMF.rawhideMedium, - }); - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(ToolListMF.bandage_crude, 6), "bandage", sewing, "needle", -1, 30 , new Object[] - { - "LLL", - 'L', ComponentListMF.rawhideLarge, - }); - KnowledgeListMF.bandageR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(ToolListMF.bandage_wool, 4), "bandage", sewing, "needle", 1, 10 , new Object[] - { - "CTC", - 'T', ComponentListMF.thread, - 'C', Blocks.wool, - }); - - KnowledgeListMF.goodBandageR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(ToolListMF.bandage_tough), "bandageadv", sewing, "needle", 2, 20 , new Object[] - { - "T", - "L", - "B", - 'T', ComponentListMF.thread, - 'L', ComponentListMF.leather_strip, - 'B', ToolListMF.bandage_wool - }); - - - - KnowledgeListMF.roughHelmetR = - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 1, 0),"craftArmourBasic", sewing, "needle", -1, 25 , new Object[] - { - "TLT", - "S S", - 'T', ComponentListMF.thread, - 'S', ComponentListMF.leather_strip, - 'L', Items.leather - }); - KnowledgeListMF.roughChestR = - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 1, 1),"craftArmourBasic", sewing, "needle", -1, 40 , new Object[] - { - "S S", - "LLL", - "TLT", - 'T', ComponentListMF.thread, - 'S', ComponentListMF.leather_strip, - 'L', Items.leather - }); - KnowledgeListMF.roughLegsR = - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 1, 2),"craftArmourBasic", sewing, "needle", -1, 35 , new Object[] - { - "TLT", - "L L", - "S S", - 'T', ComponentListMF.thread, - 'S', ComponentListMF.leather_strip, - 'L', Items.leather - }); - KnowledgeListMF.roughBootsR = - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 1, 3),"craftArmourBasic", sewing, "needle", -1, 20 , new Object[] - { - "T T", - "S S", - 'T', ComponentListMF.thread, - 'S', ComponentListMF.leather_strip, - }); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 1, 0), new ItemStack(ComponentListMF.thread, 2), new ItemStack(ComponentListMF.leather_strip, 2), Items.leather); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 1, 1), new ItemStack(ComponentListMF.thread, 4), new ItemStack(ComponentListMF.leather_strip, 2), new ItemStack(Items.leather, 4)); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 1, 2), new ItemStack(ComponentListMF.thread, 4), new ItemStack(ComponentListMF.leather_strip, 2), new ItemStack(Items.leather, 3)); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 1, 3), new ItemStack(ComponentListMF.thread, 4), new ItemStack(ComponentListMF.leather_strip, 2)); - - - KnowledgeListMF.reHelmetR = - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 2, 0),"craftArmourLight", sewing, "needle", 1, 50 , new Object[] - { - "TTT", - "UPU", - 'T', ComponentListMF.thread, - 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 0), - 'U', Items.leather - }); - KnowledgeListMF.reChestR = - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 2, 1),"craftArmourLight", sewing, "needle", 1, 80 , new Object[] - { - "TTT", - "UPU", - 'T', ComponentListMF.thread, - 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 1), - 'U', Items.leather - }); - KnowledgeListMF.reLegsR = - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 2, 2),"craftArmourLight", sewing, "needle", 1, 70 , new Object[] - { - "TTT", - "UPU", - 'T', ComponentListMF.thread, - 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 2), - 'U', Items.leather - }); - KnowledgeListMF.reBootsR = - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 2, 3),"craftArmourLight", sewing, "needle", 1, 40 , new Object[] - { - "TTT", - "UPU", - 'T', ComponentListMF.thread, - 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 3), - 'U', Items.leather - }); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 2, 0), ArmourListMF.armourItem(ArmourListMF.leather, 1, 0), new ItemStack(ComponentListMF.thread, 3), new ItemStack(Items.leather, 2)); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 2, 1), ArmourListMF.armourItem(ArmourListMF.leather, 1, 1), new ItemStack(ComponentListMF.thread, 3), new ItemStack(Items.leather, 2)); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 2, 2), ArmourListMF.armourItem(ArmourListMF.leather, 1, 2), new ItemStack(ComponentListMF.thread, 3), new ItemStack(Items.leather, 2)); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 2, 3), ArmourListMF.armourItem(ArmourListMF.leather, 1, 3), new ItemStack(ComponentListMF.thread, 3), new ItemStack(Items.leather, 2)); - - //PADDING - KnowledgeListMF.padding[0]= - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 4, 0),"craftArmourLight", sewing, "needle", 1, 50 , new Object[] - { - " W ", - "SPS", - " S ", - 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 0), - 'W', Blocks.wool, - 'S', ComponentListMF.thread, - }); - KnowledgeListMF.padding[1]= - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 4, 1),"craftArmourLight", sewing, "needle", 1, 80 , new Object[] - { - " W ", - "SPS", - " S ", - 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 1), - 'W', Blocks.wool, - 'S', ComponentListMF.thread, - }); - KnowledgeListMF.padding[2]= - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 4, 2),"craftArmourLight", sewing, "needle", 1, 70 , new Object[] - { - " W ", - "SPS", - " S ", - 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 2), - 'W', Blocks.wool, - 'S', ComponentListMF.thread, - }); - KnowledgeListMF.padding[3]= - MineFantasyAPI.addCarpenterRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 4, 3),"craftArmourLight", sewing, "needle", 1, 40 , new Object[] - { - " W ", - "SPS", - " S ", - 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 3), - 'W', Blocks.wool, - 'S', ComponentListMF.thread, - }); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 4, 0), ArmourListMF.armourItem(ArmourListMF.leather, 1, 0), new ItemStack(ComponentListMF.thread, 3), Blocks.wool); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 4, 1), ArmourListMF.armourItem(ArmourListMF.leather, 1, 1), new ItemStack(ComponentListMF.thread, 3), Blocks.wool); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 4, 2), ArmourListMF.armourItem(ArmourListMF.leather, 1, 2), new ItemStack(ComponentListMF.thread, 3), Blocks.wool); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 4, 3), ArmourListMF.armourItem(ArmourListMF.leather, 1, 3), new ItemStack(ComponentListMF.thread, 3), Blocks.wool); - - KnowledgeListMF.repairBasicR = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.repair_basic), "repair_basic", sewing, "needle", 1, 20 , new Object[] - { - "TTT", - "FNH", - "SLS", - 'T', ComponentListMF.thread, - 'S', ComponentListMF.leather_strip, - 'L', Items.leather, - 'F', Items.flint, - 'H', CustomToolListMF.standard_hammer, - 'N', ComponentListMF.nail, - }); - ItemStack bronzePlate = ComponentListMF.plate.createComm("bronze"); - KnowledgeListMF.repairAdvancedR = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.repair_advanced), "repair_advanced", sewing, "needle", 2, 50 , new Object[] - { - "SCS", - "PKH", - "CSC", - 'K', BlockListMF.repair_basic, - 'P', bronzePlate, - 'H', CustomToolListMF.standard_hammer, - 'C', Items.slime_ball, - 'S', Items.string, - }); - KnowledgeListMF.repairOrnateR = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.repair_ornate), "repair_ornate", sewing, "needle", 3, 100 , new Object[] - { - "GDG", - "LKL", - "GLG", - 'K', BlockListMF.repair_advanced, - 'G', Items.gold_ingot, - 'L', new ItemStack(Items.dye, 1, 4), - 'D', Items.diamond, - }); - - Salvage.addSalvage(BlockListMF.repair_basic, new ItemStack(ComponentListMF.thread, 3), ComponentListMF.nail, Items.flint, Items.leather, new ItemStack(ComponentListMF.leather_strip, 2)); - Salvage.addSalvage(BlockListMF.repair_advanced, BlockListMF.repair_basic, bronzePlate, new ItemStack(Items.slime_ball, 3), new ItemStack(Items.string, 3)); - Salvage.addSalvage(BlockListMF.repair_ornate, BlockListMF.repair_advanced, new ItemStack(Items.gold_ingot, 4), Items.diamond, new ItemStack(Items.dye, 3, 4)); - - KnowledgeListMF.trilogyRecipe = - MineFantasyAPI.addShapelessCarpenterRecipe(artisanry, new ItemStack(ComponentListMF.artefacts, 1, 3), "smeltMaster", basic, "hands", -1, 1 , new Object[] - { - new ItemStack(ComponentListMF.artefacts, 1, 0), - new ItemStack(ComponentListMF.artefacts, 1, 1), - new ItemStack(ComponentListMF.artefacts, 1, 2) - }); - } - public static void assembleWoodBasic() - { - KnowledgeListMF.carpenterRecipe = - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.carpenter), new Object[]{ - "PBP", - "P P", - 'B', Blocks.crafting_table, - 'P', ComponentListMF.plank - }); - Salvage.addSalvage(BlockListMF.carpenter, ((ItemComponentMF) ComponentListMF.plank).construct("ScrapWood", 4), Blocks.crafting_table); - - KnowledgeListMF.nailPlanksR= - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.nailed_planks), "refined_planks", nailHammer, "hammer", 1, 5 , new Object[] - { - "N ", - "PP", - "PP", - 'N', ComponentListMF.nail, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("OakWood"), - }); - KnowledgeListMF.nailStairR= - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.nailed_planks_stair), "refined_planks", nailHammer, "hammer", 1, 5 , new Object[] - { - "N ", - "P ", - "PP", - 'N', ComponentListMF.nail, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("OakWood"), - }); - KnowledgeListMF.tannerRecipe = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.tanner), "", nailHammer, "hammer", -1, 10 , new Object[] - { - "PPP", - "P P", - "PPP", - 'P', ComponentListMF.plank, - }); - - KnowledgeListMF.clayWallR = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.clayWall, 4), "clay_wall", nailHammer, "hammer", 1, 2 , new Object[] - { - "NPN", - "PCP", - "NPN", - 'N', ComponentListMF.nail, - 'P', ComponentListMF.plank, - 'C', Blocks.clay - }); - - KnowledgeListMF.researchTableRecipe = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.research), "", nailHammer, "hammer", -1, 10 , new Object[] - { - "B", - "C", - 'B', ToolListMF.researchBook, - 'C', BlockListMF.carpenter, - }); - KnowledgeListMF.bSalvageR = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.salvage_basic), "", nailHammer, "hammer", -1, 10 , new Object[] - { - "SFS", - "PWP", - 'W', Blocks.crafting_table, - 'S', Blocks.stone, - 'F', Items.flint, - 'P', ComponentListMF.plank - }); - - KnowledgeListMF.framedGlassR = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.framed_glass), "", nailHammer, "hammer", -1, 10 , new Object[] - { - "PGP", - 'P', ComponentListMF.plank, - 'G', Blocks.glass - }); - KnowledgeListMF.windowR = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.window), "", nailHammer, "hammer", -1, 10 , new Object[] - { - " P ", - "PGP", - " P ", - 'P', ComponentListMF.plank, - 'G', Blocks.glass - }); - - Salvage.addSalvage(BlockListMF.framed_glass, ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood", 2), Blocks.glass); - Salvage.addSalvage(BlockListMF.window, ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood", 4), Blocks.glass); - Salvage.addSalvage(BlockListMF.clayWall, ComponentListMF.nail, ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood"), Items.clay_ball); - Salvage.addSalvage(BlockListMF.tanner, ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood", 8)); - Salvage.addSalvage(BlockListMF.research, BlockListMF.carpenter); - Salvage.addSalvage(BlockListMF.salvage_basic, Items.flint, new ItemStack(Blocks.stone, 2), ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood", 2), Blocks.crafting_table); - } - private static void addDusts() - { - QuernRecipes.addRecipe(new ItemStack(Items.dye, 1, 3), new ItemStack(FoodListMF.coca_powder), 0);//ItemDye - QuernRecipes.addRecipe(Items.wheat, new ItemStack(FoodListMF.flour), 0); - QuernRecipes.addRecipe(Items.reeds, new ItemStack(FoodListMF.sugarpot), 0); - QuernRecipes.addRecipe(FoodListMF.breadroll, new ItemStack(FoodListMF.breadcrumbs), 0); - - QuernRecipes.addRecipe(FoodListMF.generic_meat_uncooked, new ItemStack(FoodListMF.generic_meat_mince_uncooked), 0); - QuernRecipes.addRecipe(FoodListMF.generic_meat_strip_uncooked, new ItemStack(FoodListMF.generic_meat_mince_uncooked), 0); - QuernRecipes.addRecipe(FoodListMF.generic_meat_chunk_uncooked, new ItemStack(FoodListMF.generic_meat_mince_uncooked), 0); - QuernRecipes.addRecipe(FoodListMF.generic_meat_cooked, new ItemStack(FoodListMF.generic_meat_mince_cooked), 0); - QuernRecipes.addRecipe(FoodListMF.generic_meat_strip_cooked, new ItemStack(FoodListMF.generic_meat_mince_cooked), 0); - QuernRecipes.addRecipe(FoodListMF.generic_meat_chunk_cooked, new ItemStack(FoodListMF.generic_meat_mince_cooked), 0); - - QuernRecipes.addRecipe(Items.coal, new ItemStack(ComponentListMF.coalDust), 0); - QuernRecipes.addRecipe(new ItemStack(Items.coal, 1, 1), new ItemStack(ComponentListMF.coalDust), 0); - QuernRecipes.addRecipe(ComponentListMF.kaolinite, new ItemStack(ComponentListMF.kaolinite_dust), 0); - QuernRecipes.addRecipe(Items.flint, new ItemStack(ComponentListMF.shrapnel), 0); - - QuernRecipes.addRecipe(ComponentListMF.flux, new ItemStack(ComponentListMF.flux_pot), 0); - - KnowledgeListMF.pieTrayRecipe = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.pie_tray_uncooked), "", basic, "hands", -1, 10 , new Object[] - { - "CC", - 'C', Items.clay_ball, - }); - - KnowledgeListMF.potRecipe = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.clay_pot_uncooked, 8), "", basic, "hands", -1, 5 , new Object[] - { - "C C", - " CC ", - 'C', Items.clay_ball, - }); - KnowledgeListMF.mouldRecipe = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.ingot_mould_uncooked), "crucible", basic, "hands", -1, 10 , new Object[] - { - "CCC", - " C ", - 'C', Items.clay_ball, - }); - KnowledgeListMF.jugRecipe = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(FoodListMF.jug_uncooked, 4), "", basic, "hands", -1, 8 , new Object[] - { - "C ", - "C C", - " C ", - 'C', Items.clay_ball, - }); - KnowledgeListMF.blackpowderRec = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.blackpowder, 2), "blackpowder", basic, "hands", -1, 2 , new Object[] - { - "NS", - "CC", - "PP", - 'C', ComponentListMF.coalDust, - 'N', ComponentListMF.nitre, - 'S', ComponentListMF.sulfur, - 'P', ComponentListMF.clay_pot, - }); - KnowledgeListMF.crudeBombR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ToolListMF.bomb_crude), "blackpowder", primitive, "hands", -1, 5 , new Object[] - { - "T", - "B", - "P", - - 'B', ComponentListMF.blackpowder, - 'T', ComponentListMF.thread, - 'P', Items.paper, - }); - KnowledgeListMF.advblackpowderRec = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.blackpowder_advanced), "advblackpowder", basic, "hands", -1, 10 , new Object[] - { - " B ", - "RGR", - " P ", - 'B', ComponentListMF.blackpowder, - 'G', Items.glowstone_dust, - 'R', Items.redstone, - 'P', ComponentListMF.clay_pot, - }); - KnowledgeListMF.magmaRefinedR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.magma_cream_refined), "firebomb", grinding, "pestle", -1, 10 , new Object[] - { - "B", - "H", - "C", - "P", - 'H', ComponentListMF.dragon_heart, - 'B', Items.blaze_powder, - 'C', Items.magma_cream, - 'P', ComponentListMF.clay_pot, - }); - Salvage.addSalvage(ComponentListMF.magma_cream_refined, ComponentListMF.dragon_heart, Items.blaze_powder, Items.magma_cream, ComponentListMF.clay_pot); - } - - private static void addWoodworks() - { - KnowledgeListMF.refinedPlankBlockR= - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.refined_planks), "refined_planks", nailHammer, "hammer", 1, 10 , new Object[] - { - "N ", - "PP", - "PP", - 'N', ComponentListMF.nail, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - }); - - KnowledgeListMF.refinedStairR= - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.refined_planks_stair), "refined_planks", nailHammer, "hammer", 1, 10 , new Object[] - { - "N ", - "P ", - "PP", - 'N', ComponentListMF.nail, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - }); - Salvage.addSalvage(BlockListMF.nailed_planks, ComponentListMF.nail, ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood", 4)); - Salvage.addSalvage(BlockListMF.refined_planks, ComponentListMF.nail, ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 4)); - Salvage.addSalvage(BlockListMF.nailed_planks_stair, ComponentListMF.nail, ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood", 3)); - Salvage.addSalvage(BlockListMF.refined_planks_stair, ComponentListMF.nail, ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 3)); - - KnowledgeListMF.bellowsRecipe = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.bellows), "", nailHammer, "hammer", 1, 50 , new Object[] - { - "NNN", - "PPP", - "LL ", - "PP ", - 'N', ComponentListMF.nail, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'L', Items.leather, - }); - Salvage.addSalvage(BlockListMF.bellows, new ItemStack(ComponentListMF.nail, 3), ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 5), new ItemStack(Items.leather, 2)); - - KnowledgeListMF.woodTroughRecipe = - MineFantasyAPI.addCarpenterRecipe(construction, ((BlockWoodDecor) BlockListMF.trough_wood).construct("ScrapWood"), "", nailHammer, "hammer", -1, 20 , new Object[] - { - "P P", - "PPP", - - 'P', ComponentListMF.plank, - }); - - KnowledgeListMF.strongRackR = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.advTanner), "", nailHammer, "hammer", 1, 80 , new Object[] - { - "NNN", - "PPP", - "P P", - "PPP", - 'N', ComponentListMF.nail, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - }); - Salvage.addSalvage(BlockListMF.advTanner, ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 8), new ItemStack(ComponentListMF.nail, 3)); - - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.refined_planks), "paint_brush", sewing, "brush", -1, 3 , new Object[] - { - "O", - "P", - 'O', ComponentListMF.plant_oil, - 'P', BlockListMF.nailed_planks, - }); - - PaintOilRecipe.addRecipe(BlockListMF.nailed_planks, BlockListMF.refined_planks); - PaintOilRecipe.addRecipe(BlockListMF.nailed_planks_stair, BlockListMF.refined_planks_stair); - - - } - - private static void addStonemason() - { - KnowledgeListMF.quernR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(BlockListMF.quern), "", stonemason, "hammer", -1, 10, new Object[] - { - "FSF", - "SSS", - 'F', Items.flint, - 'S', Blocks.stone, - }); - KnowledgeListMF.stoneovenRecipe = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(BlockListMF.oven_stone), "", stonemason, "hammer", -1, 10, new Object[] - { - "S", - "C", - 'C', BlockListMF.roast, - 'S', Blocks.stone, - }); - - KnowledgeListMF.bloomeryR = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.bloomery), "bloomery", stonemason, "hammer", -1, 10 , new Object[]{ - " S ", - "S S", - "SCS", - 'C', Blocks.coal_block, - 'S', Blocks.stone, - }); - KnowledgeListMF.crucibleRecipe = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.crucible), "crucible", stonemason, "hammer", -1, 20 , new Object[]{ - "SSS", - "S S", - "SSS", - 'S', Blocks.stone, - }); - KnowledgeListMF.advCrucibleRecipe = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.crucibleadv), "crucible2", basic, 40 , new Object[]{ - "SSS", - "SCS", - "SSS", - 'S', ComponentListMF.fireclay, - 'C', BlockListMF.crucible - }); - Salvage.addSalvage(BlockListMF.crucible, new ItemStack(Blocks.stone, 8)); - Salvage.addSalvage(BlockListMF.crucibleadv, new ItemStack(ComponentListMF.fireclay, 8), BlockListMF.crucible); - - KnowledgeListMF.chimneyRecipe = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.chimney_stone, 8), "", stonemason, "hammer", -1, 30 , new Object[]{ - "S S", - "S S", - "S S", - 'S', Blocks.stone, - }); - KnowledgeListMF.wideChimneyRecipe = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.chimney_stone_wide), "", stonemason, "hammer", -1, 10 , new Object[]{ - "S", - "C", - 'C', BlockListMF.chimney_stone, - 'S', Blocks.stone, - }); - KnowledgeListMF.extractChimneyRecipe = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.chimney_stone_extractor), "", stonemason, "hammer", -1, 15 , new Object[]{ - "C", - 'C', BlockListMF.chimney_stone_wide, - }); - - KnowledgeListMF.stoneAnvilRecipe = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(BlockListMF.anvilStone), "", stonemason, "hammer", -1, 10, new Object[] - { - "SS ", - "SSS", - " S ", - 'S', Blocks.stone - }); - KnowledgeListMF.forgeRecipe = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(BlockListMF.forge), "", stonemason, "hammer", -1, 10, new Object[] - { - "S S", - "SCS", - 'C', Items.coal, - 'S', Blocks.stone - }); - Salvage.addSalvage(BlockListMF.forge, new ItemStack(Blocks.stone, 4), Items.coal); - Salvage.addSalvage(BlockListMF.anvilStone, new ItemStack(Blocks.stone, 6)); - - Salvage.addSalvage(BlockListMF.chimney_stone, Blocks.stone); - Salvage.addSalvage(BlockListMF.chimney_stone_wide, BlockListMF.chimney_stone, Blocks.stone); - Salvage.addSalvage(BlockListMF.chimney_stone_extractor, BlockListMF.chimney_stone_wide); - Salvage.addSalvage(BlockListMF.quern, new ItemStack(Items.flint, 2), new ItemStack(Blocks.stone, 4)); - } - - private static void addCooking() - { - String meatRaw = "rawMeat"; - String cookedMeat = "cookedMeat"; - OreDictionary.registerOre(cookedMeat, Items.cooked_beef); - OreDictionary.registerOre(cookedMeat, Items.cooked_chicken); - OreDictionary.registerOre(cookedMeat, Items.cooked_porkchop); - OreDictionary.registerOre(cookedMeat, FoodListMF.wolf_cooked); - OreDictionary.registerOre(cookedMeat, FoodListMF.horse_cooked); - OreDictionary.registerOre(cookedMeat, Items.cooked_fished); - OreDictionary.registerOre(cookedMeat, new ItemStack(Items.cooked_fished, 1, 1)); - addOreD("listAllporkcooked", cookedMeat); - addOreD("listAllmuttoncooked", cookedMeat); - addOreD("listAllbeefcooked", cookedMeat); - addOreD("listAllchickencooked", cookedMeat); - addOreD("listAllfishcooked", cookedMeat); - - OreDictionary.registerOre(meatRaw, FoodListMF.guts); - OreDictionary.registerOre(meatRaw, Items.beef); - OreDictionary.registerOre(meatRaw, Items.chicken); - OreDictionary.registerOre(meatRaw, Items.porkchop); - OreDictionary.registerOre(meatRaw, FoodListMF.wolf_raw); - OreDictionary.registerOre(meatRaw, FoodListMF.horse_raw); - OreDictionary.registerOre(meatRaw, Items.fish); - OreDictionary.registerOre(meatRaw, new ItemStack(Items.fish, 1, 1)); - addOreD("listAllporkraw", meatRaw); - addOreD("listAllmuttonraw", meatRaw); - addOreD("listAllbeefraw", meatRaw); - addOreD("listAllchickenraw", meatRaw); - addOreD("listAllfishraw", meatRaw); - - KnowledgeListMF.curdRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.curds), "", basic, "hands", -1, 10, new Object[]{ - "T", - "S", - "M", - "P", - 'P', ComponentListMF.clay_pot, - 'T', FoodListMF.salt, - 'S', FoodListMF.sugarpot, - 'M', FoodListMF.jug_milk, - }); - - KnowledgeListMF.oatsRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.oats), "", chopping, "knife", -1, 20, new Object[]{ - "M", - "W", - "S", - "B", - 'S', Items.wheat_seeds, - 'W', Items.wheat, - 'M', FoodListMF.jug_milk, - 'B', Items.bowl - }); - KnowledgeListMF.doughRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.dough), "", basic, "hands", -1, 10, new Object[]{ - "W", - "F", - 'W', FoodListMF.jug_water, - 'F', FoodListMF.flour, - }); - KnowledgeListMF.pastryRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.pastry), "", basic, "hands", -1, 10, new Object[]{ - " S ", - "FEF", - 'F', FoodListMF.flour, - 'E', Items.egg, - 'S', FoodListMF.salt, - }); - KnowledgeListMF.breadRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.raw_bread), "", basic, "hands", -1, 15, new Object[]{ - "DDD", - 'D', FoodListMF.dough, - }); - KnowledgeListMF.sweetrollRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.sweetroll_raw), "sweetroll", basic, 5, new Object[]{ - " M ", - "FES", - "BBB", - 'M', FoodListMF.jug_milk, - 'S', FoodListMF.sugarpot, - 'B', FoodListMF.berries, - 'E', Items.egg, - 'F', FoodListMF.flour, - }); - KnowledgeListMF.icingRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.icing), "", mixing, "spoon", -1, 10, new Object[]{ - "W", - "S", - "B", - 'W', FoodListMF.jug_water, - 'S', FoodListMF.sugarpot, - 'B', ComponentListMF.clay_pot, - }); - KnowledgeListMF.chocoRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.chocolate), "icing", mixing, "spoon", -1, 10, new Object[]{ - " M ", - "SCS", - " B ", - 'C', FoodListMF.coca_powder, - 'M', FoodListMF.jug_milk, - 'S', FoodListMF.sugarpot, - 'B', ComponentListMF.clay_pot, - }); - KnowledgeListMF.custardRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.custard), "icing", mixing, "spoon", -1, 10, new Object[]{ - " M ", - "SES", - " B ", - 'E', Items.egg, - 'M', FoodListMF.jug_milk, - 'S', FoodListMF.sugarpot, - 'B', ComponentListMF.clay_pot, - }); - KnowledgeListMF.iceSR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.sweetroll), "sweetroll", basic, "knife", -1, 15, new Object[]{ - "I", - "R", - 'I', FoodListMF.icing, - 'R', FoodListMF.sweetroll_uniced, - }); - KnowledgeListMF.eclairDoughR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.eclair_raw), "eclair", basic, 8, new Object[]{ - "SSS", - "PPP", - 'P', FoodListMF.pastry, - 'S', FoodListMF.sugarpot, - }); - KnowledgeListMF.eclairIceR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.eclair_empty), "eclair", basic, "knife", 2, 20, new Object[]{ - "C", - "E", - 'C', FoodListMF.chocolate, - 'E', FoodListMF.eclair_uniced, - }); - KnowledgeListMF.eclairFillR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.eclair), "eclair", basic, "knife", 2, 20, new Object[]{ - "C", - "E", - 'C', FoodListMF.custard, - 'E', FoodListMF.eclair_empty, - }); - for(ItemStack food: OreDictionary.getOres(meatRaw)) - { - int size = getSize(food); - KnowledgeListMF.meatRecipes.add( - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.generic_meat_uncooked, size), "", chopping, "knife", -1, 15, new Object[]{ - "M", - 'M', food, - })); - } - for(ItemStack food: OreDictionary.getOres(cookedMeat)) - { - int size = 1; - KnowledgeListMF.meatRecipes.add( - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.generic_meat_cooked, size), "", chopping, "knife", -1, 15, new Object[]{ - "M", - 'M', food, - })); - } - KnowledgeListMF.meatStripR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.generic_meat_strip_uncooked), "", chopping, "knife", -1, 5, new Object[]{ - "M", - 'M', FoodListMF.generic_meat_uncooked, - }); - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.generic_meat_strip_cooked), "", chopping, "knife", -1, 5, new Object[]{ - "M", - 'M', FoodListMF.generic_meat_cooked, - }); - KnowledgeListMF.meatHunkR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.generic_meat_chunk_uncooked), "", chopping, "knife", -1, 5, new Object[]{ - "M", - 'M', FoodListMF.generic_meat_strip_uncooked, - }); - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.generic_meat_chunk_cooked), "", chopping, "knife", -1, 5, new Object[]{ - "M", - 'M', FoodListMF.generic_meat_strip_cooked, - }); - KnowledgeListMF.gutsRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.guts), "", chopping, "knife", 1, 8, new Object[]{ - "MMMM", - 'M', Items.rotten_flesh, - }); - - KnowledgeListMF.stewRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.stew), "", chopping, "knife", -1, 15, new Object[]{ - "M", - "B", - 'M', FoodListMF.generic_meat_chunk_cooked, - 'B', Items.bowl - }); - KnowledgeListMF.jerkyRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.jerky, 1), "jerky", chopping, "knife", 2, 20, new Object[]{ - "S", - "M", - 'S', FoodListMF.salt, - 'M', FoodListMF.generic_meat_strip_cooked, - }); - KnowledgeListMF.saussageR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.saussage_raw, 4), "saussage", chopping, "knife", 2, 30, new Object[]{ - " G ", - "MMM", - "BES", - 'G', FoodListMF.guts, - 'E', Items.egg, - 'S', FoodListMF.salt, - 'B', FoodListMF.breadcrumbs, - 'M', FoodListMF.generic_meat_mince_uncooked, - }); - KnowledgeListMF.meatPieRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.pie_meat_uncooked), "meatpie", chopping, "knife", 2, 150, new Object[]{ - " P ", - "MMM", - " P ", - " T ", - 'P', FoodListMF.pastry, - 'M', FoodListMF.generic_meat_mince_cooked, - 'T', FoodListMF.pie_tray, - }); - KnowledgeListMF.breadSliceR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.breadSlice, 12), "", "step.cloth", "knife", -1, 10, new Object[]{ - "B", - 'B', Items.bread, - }); - KnowledgeListMF.sandwitchRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.sandwitch_meat), "sandwitch", chopping, "hands", -1, 4, new Object[]{ - "B", - "C", - "M", - "B", - 'C', FoodListMF.cheese_slice, - 'M', FoodListMF.generic_meat_cooked, - 'B', FoodListMF.breadSlice - }); - KnowledgeListMF.sandwitchBigRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.sandwitch_big), "sandwitchBig", chopping, "knife", 1, 10, new Object[]{ - "CSC", - "MBM", - 'S', FoodListMF.salt, - 'C', FoodListMF.cheese_slice, - 'M', FoodListMF.generic_meat_cooked, - 'B', Items.bread - }); - KnowledgeListMF.shepardRecipe = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.pie_shepard_uncooked), "shepardpie", chopping, "knife", 3, 200, new Object[]{ - "PFP", - "MMM", - "CFC", - " T ", - 'C', Items.carrot, - 'P', Items.potato, - 'F', FoodListMF.pastry, - 'M', FoodListMF.generic_meat_mince_cooked, - 'T', FoodListMF.pie_tray, - }); - - KnowledgeListMF.appleR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.pie_apple_uncooked), "applepie", chopping, "knife", 2, 120, new Object[]{ - "SPS", - "MMM", - "SPS", - " T ", - 'S', FoodListMF.sugarpot, - 'P', FoodListMF.pastry, - 'M', Items.apple, - 'T', FoodListMF.pie_tray, - }); - KnowledgeListMF.pumpPieR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.pie_pumpkin_uncooked), "bread", chopping, "knife", 1, 50, new Object[]{ - "SMS", - "SPS", - " T ", - 'S', FoodListMF.sugarpot, - 'P', FoodListMF.pastry, - 'M', Blocks.pumpkin, - 'T', FoodListMF.pie_tray, - }); - KnowledgeListMF.berryR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.pie_berry_uncooked), "berrypie", chopping, "knife", 2, 100, new Object[]{ - "SPS", - "MMM", - "SPS", - " T ", - 'S', FoodListMF.sugarpot, - 'P', FoodListMF.pastry, - 'M', FoodListMF.berries, - 'T', FoodListMF.pie_tray, - }); - - KnowledgeListMF.simpCakeR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.cake_simple_raw), "bread", mixing, "spoon", -1, 15, new Object[]{ - "MMM", - "SES", - "FFF", - " T ", - 'F', FoodListMF.flour, - 'E', Items.egg, - 'M', FoodListMF.jug_milk, - 'S', FoodListMF.sugarpot, - 'T', FoodListMF.cake_tin, - }); - - KnowledgeListMF.cakeR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.cake_raw), "cake", mixing, "spoon", -1, 20, new Object[]{ - "SMS", - "SES", - "FFF", - " T ", - 'F', FoodListMF.flour, - 'E', Items.egg, - 'M', FoodListMF.jug_milk, - 'S', FoodListMF.sugarpot, - 'T', FoodListMF.cake_tin, - }); - KnowledgeListMF.carrotCakeR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.cake_carrot_raw), "carrotcake", mixing, "spoon", -1, 25, new Object[]{ - "SMS", - "SES", - "CCC", - "FTF", - 'C', Items.carrot, - 'F', FoodListMF.flour, - 'E', Items.egg, - 'M', FoodListMF.jug_milk, - 'S', FoodListMF.sugarpot, - 'T', FoodListMF.cake_tin, - }); - KnowledgeListMF.chocoCakeR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.cake_choc_raw), "chococake", mixing, "spoon", -1, 25, new Object[]{ - "SMS", - "SES", - "CCC", - "FTF", - 'C', FoodListMF.chocolate, - 'F', FoodListMF.flour, - 'E', Items.egg, - 'M', FoodListMF.jug_milk, - 'S', FoodListMF.sugarpot, - 'T', FoodListMF.cake_tin, - }); - KnowledgeListMF.bfCakeR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.cake_bf_raw), "bfcake", mixing, "spoon", -1, 30, new Object[]{ - "SMMS", - "SEES", - "CBBC", - "FTFF", - 'B', FoodListMF.berriesJuicy, - 'C', FoodListMF.chocolate, - 'F', FoodListMF.flour, - 'E', Items.egg, - 'M', FoodListMF.jug_milk, - 'S', FoodListMF.sugarpot, - 'T', FoodListMF.cake_tin, - }); - KnowledgeListMF.simpCakeOut = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(Items.cake), "bread", basic, "knife", -1, 10, new Object[]{ - "I", - "R", - 'I', FoodListMF.icing, - 'R', FoodListMF.cake_simple_uniced, - }); - - KnowledgeListMF.cakeI = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(BlockListMF.cake_vanilla), "cake", basic, "knife", -1, 60, new Object[]{ - "III", - " R ", - 'I', FoodListMF.icing, - 'R', FoodListMF.cake_uniced, - }); - KnowledgeListMF.carrotCakeI = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(BlockListMF.cake_carrot), "carrotcake", basic, "knife", -1, 60, new Object[]{ - "III", - " R ", - 'I', FoodListMF.icing, - 'R', FoodListMF.cake_carrot_uniced, - }); - KnowledgeListMF.chocoCakeI = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(BlockListMF.cake_chocolate), "chococake", basic, "knife", -1, 60, new Object[]{ - "ICI", - " R ", - 'C', FoodListMF.chocolate, - 'I', FoodListMF.icing, - 'R', FoodListMF.cake_choc_uniced, - }); - KnowledgeListMF.bfCakeI = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(BlockListMF.cake_bf), "bfcake", basic, "knife", -1, 100, new Object[]{ - "BBB", - "III", - "CRC", - 'C', FoodListMF.chocolate, - 'B', FoodListMF.berries, - 'I', FoodListMF.icing, - 'R', FoodListMF.cake_bf_uniced, - }); - - KnowledgeListMF.cheeserollR = - MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.cheese_roll), "cheeseroll", chopping, "knife", 1, 30, new Object[]{ - "C", - "R", - 'C', FoodListMF.cheese_slice, - 'R', FoodListMF.breadroll, - }); - } - - private static void addOreD(String list, String mfList) - { - for(ItemStack stack: OreDictionary.getOres(list)) - { - OreDictionary.registerOre(mfList, stack); - } - } - - private static int getSize(ItemStack food) - { - if(food != null && food.getItem() instanceof ItemFood) - { - int feed = ((ItemFood)food.getItem()).func_150905_g(food); - return Math.max(1, feed-1); - } - return 1; - } - - private static void addMisc() - { - //Fletching - KnowledgeListMF.fletchingR = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ComponentListMF.fletching, 16), "arrows", chopping, 4, new Object[] - { - "T", - "F", - - 'F', Items.feather, - 'T', ComponentListMF.plank, - }); - KnowledgeListMF.fletchingR2 = - MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ComponentListMF.fletching, 4), "arrows", chopping, 4, new Object[] - { - " T ", - "PPP", - - 'P', Items.paper, - 'T', ComponentListMF.plank, - }); - - //BOMBS - KnowledgeListMF.bombCaseCeramicR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.bomb_casing_uncooked, 2), "bombCeramic", basic, 2, new Object[] - { - " C ", - "C C", - " C ", - 'C', Items.clay_ball, - }); - KnowledgeListMF.mineCaseCeramicR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.mine_casing_uncooked), "mineCeramic", basic, 2, new Object[] - { - " P ", - "C C", - " C ", - - 'P', Blocks.stone_pressure_plate, - 'C', Items.clay_ball, - }); - KnowledgeListMF.bombCaseCrystalR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.bomb_casing_crystal), "bombCrystal", basic, 10, new Object[] - { - " D ", - "R R", - " B ", - 'B', Items.glass_bottle, - 'D', ComponentListMF.diamond_shards, - 'R', Items.redstone - }); - KnowledgeListMF.mineCaseCrystalR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.mine_casing_crystal), "mineCrystal", basic, 10, new Object[] - { - " P ", - "RDR", - " B ", - 'P', Blocks.heavy_weighted_pressure_plate, - 'B', Items.glass_bottle, - 'D', ComponentListMF.diamond_shards, - 'R', Items.redstone - }); - Salvage.addSalvage(ComponentListMF.bomb_casing_uncooked, new ItemStack(Items.clay_ball, 2)); - Salvage.addSalvage(ComponentListMF.mine_casing_uncooked, new ItemStack(Items.clay_ball, 3), Blocks.stone_pressure_plate); - - Salvage.addSalvage(ComponentListMF.bomb_casing_crystal, Items.glass_bottle, ComponentListMF.diamond_shards, new ItemStack(Items.redstone, 2)); - Salvage.addSalvage(ComponentListMF.mine_casing_crystal, Blocks.heavy_weighted_pressure_plate, Items.glass_bottle, ComponentListMF.diamond_shards, new ItemStack(Items.redstone, 2)); - - KnowledgeListMF.bombFuseR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.bomb_fuse, 8), "bombs", basic, 4, new Object[] - { - "R", - "C", - "S", - 'S', ComponentListMF.thread, - 'C', ComponentListMF.coalDust, - 'R', Items.redstone, - }); - KnowledgeListMF.longFuseR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.bomb_fuse_long), "bombs", basic, 1, new Object[] - { - "F", - "R", - "F", - 'F', ComponentListMF.bomb_fuse, - 'R', Items.redstone, - }); - Salvage.addSalvage(ComponentListMF.bomb_fuse_long, new ItemStack(ComponentListMF.bomb_fuse, 2), Items.redstone); - - KnowledgeListMF.thatchR = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.thatch), "", "dig.grass", "hands", -1, 1 , new Object[] - { - "HH", - "HH", - 'H', new ItemStack(Blocks.tallgrass, 1, 1) - }); - KnowledgeListMF.thatchStairR = - MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.thatch_stair), "", "dig.grass", "hands", -1, 1 , new Object[] - { - "H ", - "HH", - 'H', new ItemStack(Blocks.tallgrass, 1, 1) - }); - Salvage.addSalvage(BlockListMF.thatch_stair, new ItemStack(Blocks.tallgrass, 3, 1)); - Salvage.addSalvage(BlockListMF.thatch, new ItemStack(Blocks.tallgrass, 4, 1)); - - KnowledgeListMF.apronRecipe = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ArmourListMF.leatherapron), "", sewing, "hands", -1, 1, new Object[] - { - "LCL", - " L ", - 'L', Items.leather, - 'C', Items.coal, - }); - Salvage.addSalvage(ArmourListMF.leatherapron, new ItemStack(Items.leather, 3), Items.coal); - - KnowledgeListMF.hideHelmR = - MineFantasyAPI.addCarpenterRecipe(null, ArmourListMF.armour(ArmourListMF.leather, 0, 0), "", sewing, "hands", -1, 1, new Object[] - { - "H", - "C", - "H", - 'H', ComponentListMF.hideSmall, - 'C', Blocks.wool, - }); - KnowledgeListMF.hideChestR = - MineFantasyAPI.addCarpenterRecipe(null, ArmourListMF.armour(ArmourListMF.leather, 0, 1), "", sewing, "hands", -1, 1, new Object[] - { - "H", - "C", - 'H', ComponentListMF.hideLarge, - 'C', Blocks.wool, - }); - KnowledgeListMF.hideLegsR = - MineFantasyAPI.addCarpenterRecipe(null, ArmourListMF.armour(ArmourListMF.leather, 0, 2), "", sewing, "hands", -1, 1, new Object[] - { - "H", - "C", - 'H', ComponentListMF.hideMedium, - 'C', Blocks.wool, - }); - KnowledgeListMF.hideBootsR = - MineFantasyAPI.addCarpenterRecipe(null, ArmourListMF.armour(ArmourListMF.leather, 0, 3), "", sewing, "hands", -1, 1, new Object[] - { - "H", - "C", - 'H', ComponentListMF.hideSmall, - 'C', Blocks.wool, - }); - - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 0, 0), new ItemStack(ComponentListMF.hideSmall, 2), Blocks.wool); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 0, 1), ComponentListMF.hideLarge, Blocks.wool); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 0, 2), ComponentListMF.hideMedium, Blocks.wool); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 0, 3), ComponentListMF.hideSmall, Blocks.wool); - - KnowledgeListMF.bedrollR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.bedroll), "", sewing, "needle", -1, 50, new Object[] - { - "TLT", - "CCC", - 'C', Blocks.wool, - 'T', ComponentListMF.thread, - 'L', Items.leather - }); - Salvage.addSalvage(ToolListMF.bedroll, new ItemStack(Blocks.wool, 3), Items.leather, new ItemStack(ComponentListMF.thread, 3)); - } - public static void addCrossbows() - { - //CROSSBOWS - KnowledgeListMF.crossHandleWoodR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.crossbow_handle_wood), "crossShafts", nailHammer, "hammer", 2, 150, new Object[] - { - "N N", - "PP ", - " P ", - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'N', ComponentListMF.nail - }); - KnowledgeListMF.crossStockWoodR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.crossbow_stock_wood), "crossShafts", nailHammer, "hammer", 2, 300, new Object[] - { - "NN N", - "PPPP", - " PPP", - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'N', ComponentListMF.nail - }); - KnowledgeListMF.crossStockIronR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.crossbow_stock_iron), "crossShaftAdvanced", spanner, "spanner", 2, 300, new Object[] - { - " BBB", - "BOGG", - "SWSS", - " ", - 'O', Blocks.obsidian, - 'G', ComponentListMF.tungsten_gears, - 'W', ComponentListMF.crossbow_stock_wood, - 'S', ComponentListMF.iron_strut, - 'B', ComponentListMF.bolt, - }); - - KnowledgeListMF.crossHeadLightR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.cross_arms_light), "crossHeads", nailHammer, "hammer", 2, 200, new Object[] - { - "PPP", - "NSN", - " P ", - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'N', ComponentListMF.nail, - 'S', Items.string, - }); - KnowledgeListMF.crossHeadMediumR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.cross_arms_basic), "crossHeads", nailHammer, "hammer", 2, 250, new Object[] - { - "NNN", - "PAP", - 'N', ComponentListMF.nail, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'A', ComponentListMF.cross_arms_light, - }); - KnowledgeListMF.crossHeadHeavyR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.cross_arms_heavy), "crossHeads", nailHammer, "hammer", 2, 350, new Object[] - { - "NNN", - "PAP", - 'N', ComponentListMF.nail, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'A', ComponentListMF.cross_arms_basic, - }); - KnowledgeListMF.crossHeadAdvancedR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.cross_arms_advanced), "crossHeadAdvanced", nailHammer, "hammer", 2, 350, new Object[] - { - "NRN", - "RGR", - " A ", - 'G', ComponentListMF.tungsten_gears, - 'N', ComponentListMF.nail, - 'R', ComponentListMF.steel_tube, - 'A', ComponentListMF.cross_arms_basic, - }); - - KnowledgeListMF.crossAmmoR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.cross_ammo), "crossAmmo", nailHammer, "hammer", 2, 200, new Object[] - { - "NNN", - "P P", - "PGP", - "PPP", - 'G', ComponentListMF.tungsten_gears, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'N', ComponentListMF.nail, - }); - KnowledgeListMF.crossScopeR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.cross_scope), "crossScope", spanner, "spanner", 2, 150, new Object[] - { - "BSB", - "GP ", - 'G', ComponentListMF.tungsten_gears, - 'S', ToolListMF.spyglass, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'B', ComponentListMF.bolt, - }); - Salvage.addSalvage(ComponentListMF.cross_arms_light, new ItemStack(ComponentListMF.nail, 2), Items.string, ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 4)); - Salvage.addSalvage(ComponentListMF.cross_arms_basic, new ItemStack(ComponentListMF.nail, 3), ComponentListMF.cross_arms_light, ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 2)); - Salvage.addSalvage(ComponentListMF.cross_arms_heavy, new ItemStack(ComponentListMF.nail, 3), ComponentListMF.cross_arms_basic, ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 2)); - Salvage.addSalvage(ComponentListMF.cross_arms_advanced, ComponentListMF.tungsten_gears, new ItemStack(ComponentListMF.nail, 2), ComponentListMF.cross_arms_basic, new ItemStack(ComponentListMF.steel_tube, 3)); - - Salvage.addSalvage(ComponentListMF.cross_scope, ComponentListMF.tungsten_gears, ToolListMF.spyglass, new ItemStack(ComponentListMF.bolt, 2), ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood")); - Salvage.addSalvage(ComponentListMF.cross_ammo, ComponentListMF.tungsten_gears, new ItemStack(ComponentListMF.nail, 3), ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 7)); - Salvage.addSalvage(ComponentListMF.crossbow_handle_wood, new ItemStack(ComponentListMF.nail, 2),((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 3)); - Salvage.addSalvage(ComponentListMF.crossbow_stock_wood, new ItemStack(ComponentListMF.nail, 3), ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 7)); - Salvage.addSalvage(ComponentListMF.crossbow_stock_iron, new ItemStack(ComponentListMF.tungsten_gears, 2), Blocks.obsidian, new ItemStack(ComponentListMF.bolt, 4), new ItemStack(ComponentListMF.iron_strut, 3), ComponentListMF.crossbow_stock_wood); - } - - private static void addEngineering() - { - addCrossbows(); - KnowledgeListMF.bombBenchCraft = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(BlockListMF.bombBench), "bombs", spanner, "spanner", 0, 150, new Object[] - { - "BFB", - "BCB", - 'B', ComponentListMF.bolt, - 'F', ComponentListMF.iron_frame, - 'C', BlockListMF.carpenter, - }); - KnowledgeListMF.bombPressCraft = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(BlockListMF.bombPress), "bpress", spanner, "spanner", 3, 200, new Object[] - { - "BFB", - "GGL", - "SPS", - 'S', ComponentListMF.iron_strut, - 'B', ComponentListMF.bolt, - 'F', ComponentListMF.iron_frame, - 'L', Blocks.lever, - 'P', new ItemStack(CustomToolListMF.standard_spanner, 1, 0), - 'G', ComponentListMF.bronze_gears, - }); - - KnowledgeListMF.crossBenchCraft = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(BlockListMF.crossbowBench), "crossbows", spanner, "spanner", 0, 200, new Object[] - { - " F ", - "PSP", - "NCN", - 'F', ComponentListMF.iron_frame, - 'P', ComponentListMF.plank, - 'N', ComponentListMF.bolt, - 'S', Items.string, - 'C', BlockListMF.carpenter, - }); - - - KnowledgeListMF.engTannerR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(BlockListMF.engTanner), "engTanner", spanner, "spanner", 3, 300, new Object[] - { - "BLB", - "SPS", - "GGG", - "SFS", - 'S', ComponentListMF.iron_strut, - 'B', ComponentListMF.bolt, - 'F', ComponentListMF.iron_frame, - 'L', Blocks.lever, - 'P', new ItemStack(CustomToolListMF.standard_knife, 1, 0), - 'G', ComponentListMF.bronze_gears, - }); - ItemStack blackPlate = ComponentListMF.plate.createComm("blackSteel"); - KnowledgeListMF.advancedForgeR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(BlockListMF.forge_metal), "advforge", spanner, "spanner", 4, 400, new Object[] - { - " T ", - "FRRF", - "PPPP", - "BBBB", - 'B', ComponentListMF.bolt, - 'F', ComponentListMF.iron_frame, - 'T', ToolListMF.engin_anvil_tools, - 'P', blackPlate, - 'R', Blocks.redstone_block, - }); - ItemStack steelPlate = ComponentListMF.plate.createComm("steel"); - KnowledgeListMF.autoCrucibleR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(BlockListMF.crucibleauto), "advcrucible", spanner, "spanner", 4, 200, new Object[] - { - " T ", - "PCP", - "PGP", - "BBB", - 'B', ComponentListMF.bolt, - 'C', BlockListMF.crucibleadv, - 'G', ComponentListMF.tungsten_gears, - 'T', ToolListMF.engin_anvil_tools, - 'P', steelPlate - }); - KnowledgeListMF.spyglassR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ToolListMF.spyglass), "spyglass", spanner, "spanner", 1, 300, new Object[] - { - " T ", - "BCB", - "GPG", - 'C', ComponentListMF.bronze_gears, - 'G', Blocks.glass, - 'B', ComponentListMF.bolt, - 'T', ToolListMF.engin_anvil_tools, - 'P', ComponentListMF.steel_tube, - }); - - - KnowledgeListMF.syringeR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ToolListMF.syringe_empty), "syringe", spanner, "spanner", 1, 200, new Object[] - { - "E", - "T", - "B", - "N", - 'E', ToolListMF.engin_anvil_tools, - 'T', ComponentListMF.steel_tube, - 'B', Items.glass_bottle, - 'N', new ItemStack(CustomToolListMF.standard_needle), - }); - - KnowledgeListMF.parachuteR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ToolListMF.parachute), "parachute", sewing, "needle", 1, 350, new Object[] - { - "TTT", - "CCC", - "BEB", - "BLB", - 'E', ToolListMF.engin_anvil_tools, - 'T', ComponentListMF.thread, - 'B', ComponentListMF.leather_strip, - 'L', Items.leather, - 'C', Blocks.wool, - }); - KnowledgeListMF.cogShaftR = - MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ComponentListMF.cogwork_shaft), "cogArmour", spanner, "spanner", 4, 150, new Object[] - { - "BPB", - "SGS", - "BFB", - - 'P', Blocks.piston, - 'G', ComponentListMF.tungsten_gears, - 'B', ComponentListMF.bolt, - 'F', ComponentListMF.iron_frame, - 'S', ComponentListMF.iron_strut, - }); - Salvage.addSalvage(ComponentListMF.cogwork_shaft, new ItemStack(ComponentListMF.iron_strut, 2), new ItemStack(ComponentListMF.bolt, 4), ComponentListMF.iron_frame, Blocks.piston, ComponentListMF.tungsten_gears); - - Salvage.addSalvage(BlockListMF.crucibleauto, new ItemStack(ComponentListMF.bolt, 3), ComponentListMF.tungsten_gears, BlockListMF.crucibleadv, steelPlate, steelPlate, steelPlate, steelPlate); - Salvage.addSalvage(BlockListMF.bombBench, new ItemStack(ComponentListMF.bolt, 4), ComponentListMF.iron_frame, BlockListMF.carpenter); - Salvage.addSalvage(BlockListMF.crossbowBench, new ItemStack(ComponentListMF.nail, 2), ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood", 2), Items.string, BlockListMF.carpenter); - Salvage.addSalvage(BlockListMF.bombPress, new ItemStack(ComponentListMF.iron_strut, 2), new ItemStack(ComponentListMF.bolt, 2), new ItemStack(ComponentListMF.bronze_gears, 2), Blocks.lever, ComponentListMF.iron_frame); - Salvage.addSalvage(BlockListMF.engTanner, new ItemStack(ComponentListMF.iron_strut, 4), new ItemStack(ComponentListMF.bolt, 2), new ItemStack(ComponentListMF.bronze_gears, 3), CustomToolListMF.standard_needle, Blocks.lever, ComponentListMF.iron_frame); - Salvage.addSalvage(BlockListMF.forge_metal, new ItemStack(ComponentListMF.bolt, 4), blackPlate, blackPlate, blackPlate, blackPlate, new ItemStack(ComponentListMF.iron_frame, 2), new ItemStack(Blocks.redstone_block, 2)); - Salvage.addSalvage(ToolListMF.spyglass, new ItemStack(ComponentListMF.bolt, 2), new ItemStack(Blocks.glass, 2), ComponentListMF.steel_tube, ComponentListMF.bronze_gears); - Salvage.addSalvage(ToolListMF.syringe_empty, Items.glass_bottle, CustomToolListMF.standard_needle, ComponentListMF.steel_tube); - Salvage.addSalvage(ToolListMF.parachute, new ItemStack(ComponentListMF.thread, 3), new ItemStack(Blocks.wool, 3), new ItemStack(ComponentListMF.leather_strip, 4), Items.leather); - } - - private static void addNonPrimitiveStone() - { - KnowledgeListMF.stoneKnifeR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.knifeStone), "", primitive, "hands", -1, 4, new Object[] - { - "R", - "R", - "S", - 'R', Blocks.cobblestone, - 'S', ComponentListMF.plank, - }); - KnowledgeListMF.stoneHammerR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.hammerStone), "", primitive, "hands", -1, 4, new Object[] - { - "R", - "S", - 'R', Blocks.cobblestone, - 'S', ComponentListMF.plank, - }); - - KnowledgeListMF.stoneTongsR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.tongsStone), "", primitive, "hands", -1, 4, new Object[] - { - "R ", - "SR", - 'R', Blocks.cobblestone, - 'S', ComponentListMF.plank, - }); - KnowledgeListMF.boneNeedleR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.needleBone), "", primitive, "hands", -1, 4, new Object[] - { - "B", - 'B', Items.bone, - }); - - Salvage.addSalvage(ToolListMF.knifeStone, new ItemStack(Blocks.cobblestone, 2), ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood")); - Salvage.addSalvage(ToolListMF.hammerStone, Blocks.cobblestone, ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood")); - Salvage.addSalvage(ToolListMF.tongsStone, new ItemStack(Blocks.cobblestone, 2), ((ItemComponentMF)ComponentListMF.plank).construct("ScrapWood")); - Salvage.addSalvage(ToolListMF.needleBone, Items.bone); - } - private static void addPrimitive() - { - KnowledgeListMF.dirtRockR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.sharp_rock), "", "minecraft:dig.gravel", "hands", -1, 1, new Object[] - { - "D", - 'D', Blocks.dirt, - }); - - KnowledgeListMF.stonePickR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.pickStone), "", primitive, "hands", -1, 5, new Object[] - { - "RVR", - " S ", - " S ", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.stoneAxeR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.axeStone), "", primitive, "hands", -1, 5, new Object[] - { - "RV", - "RS", - " S", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.stoneSpadeR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.spadeStone), "", primitive, "hands", -1, 5, new Object[] - { - "VR", - " S", - " S", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.stoneHoeR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.hoeStone), "", primitive, "hands", -1, 5, new Object[] - { - "RV", - " S", - " S", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.stoneSwordR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.swordStone), "", primitive, "hands", -1, 8, new Object[] - { - "R ", - "R ", - "SV", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.stoneWarR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.waraxeStone), "", primitive, "hands", -1, 8, new Object[] - { - "VRV", - "RS", - " S", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.stoneMaceR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.maceStone), "", primitive, "hands", -1, 8, new Object[] - { - " V ", - "RSR", - " S ", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.stoneSpearR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.spearStone), "", primitive, "hands", -1, 8, new Object[] - { - "R", - "V", - "S", - "S", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.stoneKnifeR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.knifeStone), "", primitive, "hands", -1, 4, new Object[] - { - "R ", - "SV", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.stoneHammerR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.hammerStone), "", primitive, "hands", -1, 4, new Object[] - { - "R", - "V", - "S", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - - KnowledgeListMF.stoneTongsR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.tongsStone), "", primitive, "hands", -1, 4, new Object[] - { - " R", - "SV", - 'R', ComponentListMF.sharp_rock, - 'V', ComponentListMF.vine, - 'S', Items.stick - }); - KnowledgeListMF.boneNeedleR = - MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.needleBone), "", primitive, "hands", -1, 4, new Object[] - { - "B", - 'B', Items.bone, - }); - - Salvage.addSalvage(ToolListMF.pickStone, new ItemStack(ComponentListMF.sharp_rock, 2), new ItemStack(Items.stick, 2), ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.axeStone, new ItemStack(ComponentListMF.sharp_rock, 2), new ItemStack(Items.stick, 2), ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.spadeStone, ComponentListMF.sharp_rock, new ItemStack(Items.stick, 2), ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.hoeStone, ComponentListMF.sharp_rock, new ItemStack(Items.stick, 2), ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.swordStone, Items.stick, new ItemStack(ComponentListMF.sharp_rock, 2), ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.waraxeStone, new ItemStack(ComponentListMF.sharp_rock, 2), new ItemStack(Items.stick, 2), new ItemStack(ComponentListMF.vine, 2)); - Salvage.addSalvage(ToolListMF.maceStone, new ItemStack(ComponentListMF.sharp_rock, 2), new ItemStack(Items.stick, 2), ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.spearStone, ComponentListMF.sharp_rock, new ItemStack(Items.stick, 2), ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.knifeStone, ComponentListMF.sharp_rock, Items.stick, ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.hammerStone, ComponentListMF.sharp_rock, Items.stick, ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.tongsStone, ComponentListMF.sharp_rock, Items.stick, ComponentListMF.vine); - Salvage.addSalvage(ToolListMF.needleBone, Items.bone); - } - public static void initTierWood() - { - String basic = CarpenterRecipes.basic; - - float time = 4; - Item plank = ComponentListMF.plank; - - KnowledgeListMF.spoonR = - MineFantasyAPI.addCarpenterToolRecipe(artisanry, CustomToolListMF.standard_spoon, "", basic, "hands", -1, 1+(int)(1*time), new Object[]{ - "W", - "S", - 'W', plank, - 'S', Items.stick - }); - Salvage.addSalvage(CustomToolListMF.standard_spoon, plank, Items.stick); - KnowledgeListMF.malletR = - MineFantasyAPI.addCarpenterToolRecipe(artisanry, CustomToolListMF.standard_mallet, "", basic, "hands", -1, 1+(int)(2*time), new Object[]{ - "WW", - " S", - 'W', plank, - 'S', Items.stick - }); - Salvage.addSalvage(CustomToolListMF.standard_mallet, plank, plank, Items.stick); - Salvage.addSalvage(CustomToolListMF.standard_spoon, plank, Items.stick); - - KnowledgeListMF.refinedPlankR.add( - MineFantasyAPI.addCarpenterRecipe(construction, ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), "", basic, "hands", -1, 1 , new Object[] - { - "O", - "P", - 'O', ComponentListMF.plant_oil, - 'P', ((ItemComponentMF)ComponentListMF.plank) - })); - KnowledgeListMF.easyPaintPlank.add( - MineFantasyAPI.addCarpenterRecipe(construction, ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood", 4), "paint_brush", sewing, "brush", -1, 2 , new Object[] - { - " O ", - "PPPP", - 'O', ComponentListMF.plant_oil, - 'P', ((ItemComponentMF)ComponentListMF.plank) - })); - } - - static void tryAddSawPlanks(ItemStack planks, CustomMaterial material) - { - String sub = material.name.substring(0, material.name.length()-4).toLowerCase(); - - if(planks.getUnlocalizedName().toLowerCase().contains(sub)) - { - addSawPlanks(planks, material); - } - } - - static void addSawPlanks(ItemStack planks, CustomMaterial material) - { - MineFantasyAPI.addCarpenterRecipe(construction, ((ItemComponentMF)(ComponentListMF.plank)).construct(material.name, 4), "commodities", sawing, "saw", -1, 10 , new Object[] - { - "P", - 'P', planks.copy() - }); - } +public class CarpenterRecipes { + public static final String basic = "step.wood"; + public static final String chopping = "dig.wood"; + public static final String primitive = "minefantasy2:block.craftprimitive"; + public static final String sewing = "step.cloth"; + public static final String stonemason = "minefantasy2:block.hammercarpenter"; + public static final String snipping = "mob.sheep.shear"; + public static final String sawing = "minefantasy2:block.sawcarpenter"; + public static final String grinding = "dig.gravel"; + public static final String nailHammer = "minefantasy2:block.hammercarpenter"; + public static final String woodHammer = "minefantasy2:block.carpentermallet"; + public static final String mixing = "step.wood"; + public static final String spanner = "minefantasy2:block.twistbolt"; + + private static final Skill artisanry = SkillList.artisanry; + private static final Skill engineering = SkillList.engineering; + private static final Skill construction = SkillList.construction; + private static final Skill provisioning = SkillList.provisioning; + + public static void init() { + /* + * ArrayList wood = CustomMaterial.getList("wood"); Iterator + * iteratorWood = wood.iterator(); while(iteratorWood.hasNext()) { + * CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); + * + * } + */ + assembleWoodBasic(); + CustomWoodRecipes.init(); + addDusts(); + addWoodworks(); + addStonemason(); + addCooking(); + addMisc(); + addEngineering(); + if (ConfigHardcore.HCCallowRocks) { + addPrimitive(); + } else { + addNonPrimitiveStone(); + } + MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.researchBook), "", sewing, "hands", -1, 1, + new Object[]{"B", 'B', Items.book,}); + + if (ConfigHardcore.HCCallowRocks) { + KnowledgeListMF.sharpRocksR = MineFantasyAPI.addCarpenterRecipe(null, + new ItemStack(ComponentListMF.sharp_rock, 8), "", stonemason, "hammer", -1, 10, + new Object[]{"S", 'S', Blocks.cobblestone,}); + + } else { + + } + Salvage.addSalvage(ToolListMF.dryrocks, Blocks.cobblestone); + + KnowledgeListMF.threadR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.thread, 4), + "commodities", sewing, "hands", -1, 5, new Object[]{"W", "S", 'W', Blocks.wool, 'S', Items.stick,}); + KnowledgeListMF.stringR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(Items.string), "commodities", + sewing, "hands", -1, 10, new Object[]{"T", "T", "T", "T", 'T', ComponentListMF.thread}); + + KnowledgeListMF.lStripsR = MineFantasyAPI.addCarpenterRecipe(null, + new ItemStack(ComponentListMF.leather_strip, 4), "commodities", snipping, "shears", -1, 10, + new Object[]{"L", 'L', Items.leather,}); + + MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ToolListMF.swordTraining), nailHammer, "knife", 1, + 40, new Object[]{"NI ", "SIII", "NI ", 'N', ComponentListMF.nail, 'S', ComponentListMF.plank, 'I', + Blocks.planks,}); + + MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ToolListMF.waraxeTraining), nailHammer, "knife", 1, + 30, new Object[]{" II ", "SSIN", " I ", 'N', ComponentListMF.nail, 'S', ComponentListMF.plank, 'I', + Blocks.planks,}); + MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ToolListMF.maceTraining), nailHammer, "knife", 1, 35, + new Object[]{" II", "SSII", " N ", 'N', ComponentListMF.nail, 'S', ComponentListMF.plank, 'I', + Blocks.planks,}); + MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(ToolListMF.spearTraining), nailHammer, "knife", 1, + 20, new Object[]{" N ", "SSSI", " N ", 'N', ComponentListMF.nail, 'S', ComponentListMF.plank, 'I', + Blocks.planks,}); + ItemStack scrapWood = ComponentListMF.plank.construct("ScrapWood"); + Salvage.addSalvage(ToolListMF.swordTraining, new ItemStack(Blocks.planks, 5), + new ItemStack(ComponentListMF.nail, 2), scrapWood); + Salvage.addSalvage(ToolListMF.waraxeTraining, new ItemStack(Blocks.planks, 4), ComponentListMF.nail, scrapWood, + scrapWood); + Salvage.addSalvage(ToolListMF.maceTraining, new ItemStack(Blocks.planks, 4), ComponentListMF.nail, scrapWood, + scrapWood); + Salvage.addSalvage(ToolListMF.waraxeTraining, Blocks.planks, new ItemStack(ComponentListMF.nail, 2), scrapWood, + scrapWood, scrapWood); + + KnowledgeListMF.badBandageR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(ToolListMF.bandage_crude, 2), "bandage", sewing, "needle", -1, 10, + new Object[]{"LLL", 'L', ComponentListMF.rawhideSmall,}); + + MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(ToolListMF.bandage_crude, 4), "bandage", sewing, + "needle", -1, 20, new Object[]{"LLL", 'L', ComponentListMF.rawhideMedium,}); + MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(ToolListMF.bandage_crude, 6), "bandage", sewing, + "needle", -1, 30, new Object[]{"LLL", 'L', ComponentListMF.rawhideLarge,}); + KnowledgeListMF.bandageR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(ToolListMF.bandage_wool, 4), "bandage", sewing, "needle", 1, 10, + new Object[]{"CTC", 'T', ComponentListMF.thread, 'C', Blocks.wool,}); + + KnowledgeListMF.goodBandageR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(ToolListMF.bandage_tough), "bandageadv", sewing, "needle", 2, 20, + new Object[]{"T", "L", "B", 'T', ComponentListMF.thread, 'L', ComponentListMF.leather_strip, 'B', + ToolListMF.bandage_wool}); + + KnowledgeListMF.roughHelmetR = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 1, 0), "craftArmourBasic", sewing, "needle", -1, 25, + new Object[]{"TLT", "S S", 'T', ComponentListMF.thread, 'S', ComponentListMF.leather_strip, 'L', + Items.leather}); + KnowledgeListMF.roughChestR = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 1, 1), "craftArmourBasic", sewing, "needle", -1, 40, + new Object[]{"S S", "LLL", "TLT", 'T', ComponentListMF.thread, 'S', ComponentListMF.leather_strip, + 'L', Items.leather}); + KnowledgeListMF.roughLegsR = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 1, 2), "craftArmourBasic", sewing, "needle", -1, 35, + new Object[]{"TLT", "L L", "S S", 'T', ComponentListMF.thread, 'S', ComponentListMF.leather_strip, + 'L', Items.leather}); + KnowledgeListMF.roughBootsR = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 1, 3), "craftArmourBasic", sewing, "needle", -1, 20, + new Object[]{"T T", "S S", 'T', ComponentListMF.thread, 'S', ComponentListMF.leather_strip,}); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 1, 0), + new ItemStack(ComponentListMF.thread, 2), new ItemStack(ComponentListMF.leather_strip, 2), + Items.leather); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 1, 1), + new ItemStack(ComponentListMF.thread, 4), new ItemStack(ComponentListMF.leather_strip, 2), + new ItemStack(Items.leather, 4)); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 1, 2), + new ItemStack(ComponentListMF.thread, 4), new ItemStack(ComponentListMF.leather_strip, 2), + new ItemStack(Items.leather, 3)); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 1, 3), + new ItemStack(ComponentListMF.thread, 4), new ItemStack(ComponentListMF.leather_strip, 2)); + + KnowledgeListMF.reHelmetR = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 2, 0), "craftArmourLight", sewing, "needle", 1, 50, + new Object[]{"TTT", "UPU", 'T', ComponentListMF.thread, 'P', + ArmourListMF.armour(ArmourListMF.leather, 1, 0), 'U', Items.leather}); + KnowledgeListMF.reChestR = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 2, 1), "craftArmourLight", sewing, "needle", 1, 80, + new Object[]{"TTT", "UPU", 'T', ComponentListMF.thread, 'P', + ArmourListMF.armour(ArmourListMF.leather, 1, 1), 'U', Items.leather}); + KnowledgeListMF.reLegsR = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 2, 2), "craftArmourLight", sewing, "needle", 1, 70, + new Object[]{"TTT", "UPU", 'T', ComponentListMF.thread, 'P', + ArmourListMF.armour(ArmourListMF.leather, 1, 2), 'U', Items.leather}); + KnowledgeListMF.reBootsR = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 2, 3), "craftArmourLight", sewing, "needle", 1, 40, + new Object[]{"TTT", "UPU", 'T', ComponentListMF.thread, 'P', + ArmourListMF.armour(ArmourListMF.leather, 1, 3), 'U', Items.leather}); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 2, 0), + ArmourListMF.armourItem(ArmourListMF.leather, 1, 0), new ItemStack(ComponentListMF.thread, 3), + new ItemStack(Items.leather, 2)); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 2, 1), + ArmourListMF.armourItem(ArmourListMF.leather, 1, 1), new ItemStack(ComponentListMF.thread, 3), + new ItemStack(Items.leather, 2)); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 2, 2), + ArmourListMF.armourItem(ArmourListMF.leather, 1, 2), new ItemStack(ComponentListMF.thread, 3), + new ItemStack(Items.leather, 2)); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 2, 3), + ArmourListMF.armourItem(ArmourListMF.leather, 1, 3), new ItemStack(ComponentListMF.thread, 3), + new ItemStack(Items.leather, 2)); + + // PADDING + KnowledgeListMF.padding[0] = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 4, 0), "craftArmourLight", sewing, "needle", 1, 50, + new Object[]{" W ", "SPS", " S ", 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 0), 'W', + Blocks.wool, 'S', ComponentListMF.thread,}); + KnowledgeListMF.padding[1] = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 4, 1), "craftArmourLight", sewing, "needle", 1, 80, + new Object[]{" W ", "SPS", " S ", 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 1), 'W', + Blocks.wool, 'S', ComponentListMF.thread,}); + KnowledgeListMF.padding[2] = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 4, 2), "craftArmourLight", sewing, "needle", 1, 70, + new Object[]{" W ", "SPS", " S ", 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 2), 'W', + Blocks.wool, 'S', ComponentListMF.thread,}); + KnowledgeListMF.padding[3] = MineFantasyAPI.addCarpenterRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 4, 3), "craftArmourLight", sewing, "needle", 1, 40, + new Object[]{" W ", "SPS", " S ", 'P', ArmourListMF.armour(ArmourListMF.leather, 1, 3), 'W', + Blocks.wool, 'S', ComponentListMF.thread,}); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 4, 0), + ArmourListMF.armourItem(ArmourListMF.leather, 1, 0), new ItemStack(ComponentListMF.thread, 3), + Blocks.wool); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 4, 1), + ArmourListMF.armourItem(ArmourListMF.leather, 1, 1), new ItemStack(ComponentListMF.thread, 3), + Blocks.wool); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 4, 2), + ArmourListMF.armourItem(ArmourListMF.leather, 1, 2), new ItemStack(ComponentListMF.thread, 3), + Blocks.wool); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 4, 3), + ArmourListMF.armourItem(ArmourListMF.leather, 1, 3), new ItemStack(ComponentListMF.thread, 3), + Blocks.wool); + + KnowledgeListMF.repairBasicR = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(BlockListMF.repair_basic), "repair_basic", sewing, "needle", 1, 20, + new Object[]{"TTT", "FNH", "SLS", 'T', ComponentListMF.thread, 'S', ComponentListMF.leather_strip, + 'L', Items.leather, 'F', Items.flint, 'H', CustomToolListMF.standard_hammer, 'N', + ComponentListMF.nail,}); + ItemStack bronzePlate = ComponentListMF.plate.createComm("bronze"); + KnowledgeListMF.repairAdvancedR = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(BlockListMF.repair_advanced), "repair_advanced", sewing, "needle", 2, 50, + new Object[]{"SCS", "PKH", "CSC", 'K', BlockListMF.repair_basic, 'P', bronzePlate, 'H', + CustomToolListMF.standard_hammer, 'C', Items.slime_ball, 'S', Items.string,}); + KnowledgeListMF.repairOrnateR = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(BlockListMF.repair_ornate), "repair_ornate", sewing, "needle", 3, 100, + new Object[]{"GDG", "LKL", "GLG", 'K', BlockListMF.repair_advanced, 'G', Items.gold_ingot, 'L', + new ItemStack(Items.dye, 1, 4), 'D', Items.diamond,}); + + Salvage.addSalvage(BlockListMF.repair_basic, new ItemStack(ComponentListMF.thread, 3), ComponentListMF.nail, + Items.flint, Items.leather, new ItemStack(ComponentListMF.leather_strip, 2)); + Salvage.addSalvage(BlockListMF.repair_advanced, BlockListMF.repair_basic, bronzePlate, + new ItemStack(Items.slime_ball, 3), new ItemStack(Items.string, 3)); + Salvage.addSalvage(BlockListMF.repair_ornate, BlockListMF.repair_advanced, new ItemStack(Items.gold_ingot, 4), + Items.diamond, new ItemStack(Items.dye, 3, 4)); + + KnowledgeListMF.trilogyRecipe = MineFantasyAPI.addShapelessCarpenterRecipe(artisanry, + new ItemStack(ComponentListMF.artefacts, 1, 3), "smeltMaster", basic, "hands", -1, 1, + new Object[]{new ItemStack(ComponentListMF.artefacts, 1, 0), + new ItemStack(ComponentListMF.artefacts, 1, 1), + new ItemStack(ComponentListMF.artefacts, 1, 2)}); + } + + public static void assembleWoodBasic() { + KnowledgeListMF.carpenterRecipe = GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.carpenter), + new Object[]{"PBP", "P P", 'B', Blocks.crafting_table, 'P', ComponentListMF.plank}); + Salvage.addSalvage(BlockListMF.carpenter, ComponentListMF.plank.construct("ScrapWood", 4), + Blocks.crafting_table); + + KnowledgeListMF.nailPlanksR = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.nailed_planks), "refined_planks", nailHammer, "hammer", 1, 5, + new Object[]{"N ", "PP", "PP", 'N', ComponentListMF.nail, 'P', + ComponentListMF.plank.construct("OakWood"),}); + KnowledgeListMF.nailStairR = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.nailed_planks_stair), "refined_planks", nailHammer, "hammer", 1, 5, + new Object[]{"N ", "P ", "PP", 'N', ComponentListMF.nail, 'P', + ComponentListMF.plank.construct("OakWood"),}); + KnowledgeListMF.tannerRecipe = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.tanner), "", nailHammer, "hammer", -1, 10, + new Object[]{"PPP", "P P", "PPP", 'P', ComponentListMF.plank,}); + + KnowledgeListMF.clayWallR = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.clayWall, 4), "clay_wall", nailHammer, "hammer", 1, 2, new Object[]{"NPN", + "PCP", "NPN", 'N', ComponentListMF.nail, 'P', ComponentListMF.plank, 'C', Blocks.clay}); + + KnowledgeListMF.researchTableRecipe = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.research), "", nailHammer, "hammer", -1, 10, + new Object[]{"B", "C", 'B', ToolListMF.researchBook, 'C', BlockListMF.carpenter,}); + KnowledgeListMF.bSalvageR = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.salvage_basic), "", nailHammer, "hammer", -1, 10, new Object[]{"SFS", "PWP", + 'W', Blocks.crafting_table, 'S', Blocks.stone, 'F', Items.flint, 'P', ComponentListMF.plank}); + + KnowledgeListMF.framedGlassR = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.framed_glass), "", nailHammer, "hammer", -1, 10, + new Object[]{"PGP", 'P', ComponentListMF.plank, 'G', Blocks.glass}); + KnowledgeListMF.windowR = MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.window), "", + nailHammer, "hammer", -1, 10, + new Object[]{" P ", "PGP", " P ", 'P', ComponentListMF.plank, 'G', Blocks.glass}); + + Salvage.addSalvage(BlockListMF.framed_glass, ComponentListMF.plank.construct("ScrapWood", 2), Blocks.glass); + Salvage.addSalvage(BlockListMF.window, ComponentListMF.plank.construct("ScrapWood", 4), Blocks.glass); + Salvage.addSalvage(BlockListMF.clayWall, ComponentListMF.nail, ComponentListMF.plank.construct("ScrapWood"), + Items.clay_ball); + Salvage.addSalvage(BlockListMF.tanner, ComponentListMF.plank.construct("ScrapWood", 8)); + Salvage.addSalvage(BlockListMF.research, BlockListMF.carpenter); + Salvage.addSalvage(BlockListMF.salvage_basic, Items.flint, new ItemStack(Blocks.stone, 2), + ComponentListMF.plank.construct("ScrapWood", 2), Blocks.crafting_table); + } + + private static void addDusts() { + QuernRecipes.addRecipe(new ItemStack(Items.dye, 1, 3), new ItemStack(FoodListMF.coca_powder), 0, true);// ItemDye + QuernRecipes.addRecipe(Items.wheat, new ItemStack(FoodListMF.flour), 0, true); + QuernRecipes.addRecipe(Items.reeds, new ItemStack(FoodListMF.sugarpot), 0, true); + QuernRecipes.addRecipe(FoodListMF.breadroll, new ItemStack(FoodListMF.breadcrumbs), 0, true); + + QuernRecipes.addRecipe(FoodListMF.generic_meat_uncooked, new ItemStack(FoodListMF.generic_meat_mince_uncooked), + 0, true); + QuernRecipes.addRecipe(FoodListMF.generic_meat_strip_uncooked, + new ItemStack(FoodListMF.generic_meat_mince_uncooked), 0, true); + QuernRecipes.addRecipe(FoodListMF.generic_meat_chunk_uncooked, + new ItemStack(FoodListMF.generic_meat_mince_uncooked), 0, true); + QuernRecipes.addRecipe(FoodListMF.generic_meat_cooked, new ItemStack(FoodListMF.generic_meat_mince_cooked), 0, true); + QuernRecipes.addRecipe(FoodListMF.generic_meat_strip_cooked, + new ItemStack(FoodListMF.generic_meat_mince_cooked), 0, true); + QuernRecipes.addRecipe(FoodListMF.generic_meat_chunk_cooked, + new ItemStack(FoodListMF.generic_meat_mince_cooked), 0, true); + + QuernRecipes.addRecipe(Items.coal, new ItemStack(ComponentListMF.coalDust), 0, true); + QuernRecipes.addRecipe(new ItemStack(Items.coal, 1, 1), new ItemStack(ComponentListMF.coalDust), 0, true); + QuernRecipes.addRecipe(ComponentListMF.kaolinite, new ItemStack(ComponentListMF.kaolinite_dust), 0, true); + QuernRecipes.addRecipe(Items.flint, new ItemStack(ComponentListMF.shrapnel), 0, true); + + QuernRecipes.addRecipe(ComponentListMF.flux, new ItemStack(ComponentListMF.flux_pot), 0, true); + + KnowledgeListMF.pieTrayRecipe = MineFantasyAPI.addCarpenterRecipe(null, + new ItemStack(ComponentListMF.pie_tray_uncooked), "", basic, "hands", -1, 10, + new Object[]{"CC", 'C', Items.clay_ball,}); + + KnowledgeListMF.potRecipe = MineFantasyAPI.addCarpenterRecipe(null, + new ItemStack(ComponentListMF.clay_pot_uncooked, 8), "", basic, "hands", -1, 5, + new Object[]{"C C", " CC ", 'C', Items.clay_ball,}); + KnowledgeListMF.mouldRecipe = MineFantasyAPI.addCarpenterRecipe(null, + new ItemStack(ComponentListMF.ingot_mould_uncooked), "crucible", basic, "hands", -1, 10, + new Object[]{"CCC", " C ", 'C', Items.clay_ball,}); + KnowledgeListMF.jugRecipe = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(FoodListMF.jug_uncooked, 4), + "", basic, "hands", -1, 8, new Object[]{"C ", "C C", " C ", 'C', Items.clay_ball,}); + KnowledgeListMF.blackpowderRec = MineFantasyAPI.addCarpenterRecipe(null, + new ItemStack(ComponentListMF.blackpowder, 2), "blackpowder", basic, "hands", -1, 2, + new Object[]{"NS", "CC", "PP", 'C', ComponentListMF.coalDust, 'N', ComponentListMF.nitre, 'S', + ComponentListMF.sulfur, 'P', ComponentListMF.clay_pot,}); + KnowledgeListMF.crudeBombR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ToolListMF.bomb_crude), "blackpowder", primitive, "hands", -1, 5, + new Object[]{"T", "B", "P", + + 'B', ComponentListMF.blackpowder, 'T', ComponentListMF.thread, 'P', Items.paper,}); + KnowledgeListMF.advblackpowderRec = MineFantasyAPI.addCarpenterRecipe(null, + new ItemStack(ComponentListMF.blackpowder_advanced), "advblackpowder", basic, "hands", -1, 10, + new Object[]{" B ", "RGR", " P ", 'B', ComponentListMF.blackpowder, 'G', Items.glowstone_dust, 'R', + Items.redstone, 'P', ComponentListMF.clay_pot,}); + KnowledgeListMF.magmaRefinedR = MineFantasyAPI.addCarpenterRecipe(null, + new ItemStack(ComponentListMF.magma_cream_refined), "firebomb", grinding, "pestle", -1, 10, + new Object[]{"B", "H", "C", "P", 'H', ComponentListMF.dragon_heart, 'B', Items.blaze_powder, 'C', + Items.magma_cream, 'P', ComponentListMF.clay_pot,}); + Salvage.addSalvage(ComponentListMF.magma_cream_refined, ComponentListMF.dragon_heart, Items.blaze_powder, + Items.magma_cream, ComponentListMF.clay_pot); + } + + private static void addWoodworks() { + KnowledgeListMF.refinedPlankBlockR = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.refined_planks), "refined_planks", nailHammer, "hammer", 1, 10, + new Object[]{"N ", "PP", "PP", 'N', ComponentListMF.nail, 'P', + ComponentListMF.plank.construct("RefinedWood"),}); + + KnowledgeListMF.refinedStairR = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.refined_planks_stair), "refined_planks", nailHammer, "hammer", 1, 10, + new Object[]{"N ", "P ", "PP", 'N', ComponentListMF.nail, 'P', + ComponentListMF.plank.construct("RefinedWood"),}); + Salvage.addSalvage(BlockListMF.nailed_planks, ComponentListMF.nail, + ComponentListMF.plank.construct("ScrapWood", 4)); + Salvage.addSalvage(BlockListMF.refined_planks, ComponentListMF.nail, + ComponentListMF.plank.construct("RefinedWood", 4)); + Salvage.addSalvage(BlockListMF.nailed_planks_stair, ComponentListMF.nail, + ComponentListMF.plank.construct("ScrapWood", 3)); + Salvage.addSalvage(BlockListMF.refined_planks_stair, ComponentListMF.nail, + ComponentListMF.plank.construct("RefinedWood", 3)); + + KnowledgeListMF.bellowsRecipe = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.bellows), "", nailHammer, "hammer", 1, 50, + new Object[]{"NNN", "PPP", "LL ", "PP ", 'N', ComponentListMF.nail, 'P', + ComponentListMF.plank.construct("RefinedWood"), 'L', Items.leather,}); + Salvage.addSalvage(BlockListMF.bellows, new ItemStack(ComponentListMF.nail, 3), + ComponentListMF.plank.construct("RefinedWood", 5), new ItemStack(Items.leather, 2)); + + KnowledgeListMF.woodTroughRecipe = MineFantasyAPI.addCarpenterRecipe(construction, + ((BlockWoodDecor) BlockListMF.trough_wood).construct("ScrapWood"), "", nailHammer, "hammer", -1, 20, + new Object[]{"P P", "PPP", + + 'P', ComponentListMF.plank,}); + + KnowledgeListMF.strongRackR = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.advTanner), "", nailHammer, "hammer", 1, 80, + new Object[]{"NNN", "PPP", "P P", "PPP", 'N', ComponentListMF.nail, 'P', + ComponentListMF.plank.construct("RefinedWood"),}); + Salvage.addSalvage(BlockListMF.advTanner, ComponentListMF.plank.construct("RefinedWood", 8), + new ItemStack(ComponentListMF.nail, 3)); + + MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.refined_planks), "paint_brush", + sewing, "brush", -1, 3, + new Object[]{"O", "P", 'O', ComponentListMF.plant_oil, 'P', BlockListMF.nailed_planks,}); + + PaintOilRecipe.addRecipe(BlockListMF.nailed_planks, BlockListMF.refined_planks); + PaintOilRecipe.addRecipe(BlockListMF.nailed_planks_stair, BlockListMF.refined_planks_stair); + + } + + private static void addStonemason() { + KnowledgeListMF.quernR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(BlockListMF.quern), "", + stonemason, "hammer", -1, 10, new Object[]{"FSF", "SSS", 'F', Items.flint, 'S', Blocks.stone,}); + KnowledgeListMF.stoneovenRecipe = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(BlockListMF.oven_stone), + "", stonemason, "hammer", -1, 10, + new Object[]{"S", "C", 'C', BlockListMF.roast, 'S', Blocks.stone,}); + + KnowledgeListMF.bloomeryR = MineFantasyAPI.addCarpenterRecipe(artisanry, new ItemStack(BlockListMF.bloomery), + "bloomery", stonemason, "hammer", -1, 10, + new Object[]{" S ", "S S", "SCS", 'C', Blocks.coal_block, 'S', Blocks.stone,}); + KnowledgeListMF.crucibleRecipe = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(BlockListMF.crucible), "crucible", stonemason, "hammer", -1, 20, + new Object[]{"SSS", "S S", "SSS", 'S', Blocks.stone,}); + KnowledgeListMF.advCrucibleRecipe = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(BlockListMF.crucibleadv), "crucible2", basic, 40, + new Object[]{"SSS", "SCS", "SSS", 'S', ComponentListMF.fireclay, 'C', BlockListMF.crucible}); + Salvage.addSalvage(BlockListMF.crucible, new ItemStack(Blocks.stone, 8)); + Salvage.addSalvage(BlockListMF.crucibleadv, new ItemStack(ComponentListMF.fireclay, 8), BlockListMF.crucible); + + KnowledgeListMF.chimneyRecipe = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(BlockListMF.chimney_stone, 8), "", stonemason, "hammer", -1, 30, + new Object[]{"S S", "S S", "S S", 'S', Blocks.stone,}); + KnowledgeListMF.wideChimneyRecipe = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(BlockListMF.chimney_stone_wide), "", stonemason, "hammer", -1, 10, + new Object[]{"S", "C", 'C', BlockListMF.chimney_stone, 'S', Blocks.stone,}); + KnowledgeListMF.extractChimneyRecipe = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(BlockListMF.chimney_stone_extractor), "", stonemason, "hammer", -1, 15, + new Object[]{"C", 'C', BlockListMF.chimney_stone_wide,}); + + KnowledgeListMF.stoneAnvilRecipe = MineFantasyAPI.addCarpenterRecipe(null, + new ItemStack(BlockListMF.anvilStone), "", stonemason, "hammer", -1, 10, + new Object[]{"SS ", "SSS", " S ", 'S', Blocks.stone}); + KnowledgeListMF.forgeRecipe = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(BlockListMF.forge), "", + stonemason, "hammer", -1, 10, new Object[]{"S S", "SCS", 'C', Items.coal, 'S', Blocks.stone}); + Salvage.addSalvage(BlockListMF.forge, new ItemStack(Blocks.stone, 4), Items.coal); + Salvage.addSalvage(BlockListMF.anvilStone, new ItemStack(Blocks.stone, 6)); + + Salvage.addSalvage(BlockListMF.chimney_stone, Blocks.stone); + Salvage.addSalvage(BlockListMF.chimney_stone_wide, BlockListMF.chimney_stone, Blocks.stone); + Salvage.addSalvage(BlockListMF.chimney_stone_extractor, BlockListMF.chimney_stone_wide); + Salvage.addSalvage(BlockListMF.quern, new ItemStack(Items.flint, 2), new ItemStack(Blocks.stone, 4)); + } + + private static void addCooking() { + String meatRaw = "rawMeat"; + String cookedMeat = "cookedMeat"; + OreDictionary.registerOre(cookedMeat, Items.cooked_beef); + OreDictionary.registerOre(cookedMeat, Items.cooked_chicken); + OreDictionary.registerOre(cookedMeat, Items.cooked_porkchop); + OreDictionary.registerOre(cookedMeat, FoodListMF.wolf_cooked); + OreDictionary.registerOre(cookedMeat, FoodListMF.horse_cooked); + OreDictionary.registerOre(cookedMeat, Items.cooked_fished); + OreDictionary.registerOre(cookedMeat, new ItemStack(Items.cooked_fished, 1, 1)); + addOreD("listAllporkcooked", cookedMeat); + addOreD("listAllmuttoncooked", cookedMeat); + addOreD("listAllbeefcooked", cookedMeat); + addOreD("listAllchickencooked", cookedMeat); + addOreD("listAllfishcooked", cookedMeat); + + OreDictionary.registerOre(meatRaw, FoodListMF.guts); + OreDictionary.registerOre(meatRaw, Items.beef); + OreDictionary.registerOre(meatRaw, Items.chicken); + OreDictionary.registerOre(meatRaw, Items.porkchop); + OreDictionary.registerOre(meatRaw, FoodListMF.wolf_raw); + OreDictionary.registerOre(meatRaw, FoodListMF.horse_raw); + OreDictionary.registerOre(meatRaw, Items.fish); + OreDictionary.registerOre(meatRaw, new ItemStack(Items.fish, 1, 1)); + addOreD("listAllporkraw", meatRaw); + addOreD("listAllmuttonraw", meatRaw); + addOreD("listAllbeefraw", meatRaw); + addOreD("listAllchickenraw", meatRaw); + addOreD("listAllfishraw", meatRaw); + + KnowledgeListMF.curdRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.curds), + "", basic, "hands", -1, 10, new Object[]{"T", "S", "M", "P", 'P', ComponentListMF.clay_pot, 'T', + FoodListMF.salt, 'S', FoodListMF.sugarpot, 'M', FoodListMF.jug_milk,}); + + KnowledgeListMF.oatsRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.oats), "", + chopping, "knife", -1, 20, new Object[]{"M", "W", "S", "B", 'S', Items.wheat_seeds, 'W', Items.wheat, + 'M', FoodListMF.jug_milk, 'B', Items.bowl}); + KnowledgeListMF.doughRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.dough), + "", basic, "hands", -1, 10, + new Object[]{"W", "F", 'W', FoodListMF.jug_water, 'F', FoodListMF.flour,}); + KnowledgeListMF.pastryRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.pastry), + "", basic, "hands", -1, 10, + new Object[]{" S ", "FEF", 'F', FoodListMF.flour, 'E', Items.egg, 'S', FoodListMF.salt,}); + KnowledgeListMF.breadRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.raw_bread), "", basic, "hands", -1, 15, + new Object[]{"DDD", 'D', FoodListMF.dough,}); + KnowledgeListMF.sweetrollRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.sweetroll_raw), "sweetroll", basic, 5, + new Object[]{" M ", "FES", "BBB", 'M', FoodListMF.jug_milk, 'S', FoodListMF.sugarpot, 'B', + FoodListMF.berries, 'E', Items.egg, 'F', FoodListMF.flour,}); + KnowledgeListMF.icingRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.icing), + "", mixing, "spoon", -1, 10, new Object[]{"W", "S", "B", 'W', FoodListMF.jug_water, 'S', + FoodListMF.sugarpot, 'B', ComponentListMF.clay_pot,}); + KnowledgeListMF.chocoRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.chocolate), "icing", mixing, "spoon", -1, 10, + new Object[]{" M ", "SCS", " B ", 'C', FoodListMF.coca_powder, 'M', FoodListMF.jug_milk, 'S', + FoodListMF.sugarpot, 'B', ComponentListMF.clay_pot,}); + KnowledgeListMF.custardRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.custard), "icing", mixing, "spoon", -1, 10, + new Object[]{" M ", "SES", " B ", 'E', Items.egg, 'M', FoodListMF.jug_milk, 'S', FoodListMF.sugarpot, + 'B', ComponentListMF.clay_pot,}); + KnowledgeListMF.iceSR = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.sweetroll), + "sweetroll", basic, "knife", -1, 15, + new Object[]{"I", "R", 'I', FoodListMF.icing, 'R', FoodListMF.sweetroll_uniced,}); + KnowledgeListMF.eclairDoughR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.eclair_raw), "eclair", basic, 8, + new Object[]{"SSS", "PPP", 'P', FoodListMF.pastry, 'S', FoodListMF.sugarpot,}); + KnowledgeListMF.eclairIceR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.eclair_empty), "eclair", basic, "knife", 2, 20, + new Object[]{"C", "E", 'C', FoodListMF.chocolate, 'E', FoodListMF.eclair_uniced,}); + KnowledgeListMF.eclairFillR = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.eclair), + "eclair", basic, "knife", 2, 20, + new Object[]{"C", "E", 'C', FoodListMF.custard, 'E', FoodListMF.eclair_empty,}); + for (ItemStack food : OreDictionary.getOres(meatRaw)) { + int size = getSize(food); + KnowledgeListMF.meatRecipes.add(MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.generic_meat_uncooked, size), "", chopping, "knife", -1, 15, + new Object[]{"M", 'M', food,})); + } + for (ItemStack food : OreDictionary.getOres(cookedMeat)) { + int size = 1; + KnowledgeListMF.meatRecipes.add( + MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.generic_meat_cooked, size), + "", chopping, "knife", -1, 15, new Object[]{"M", 'M', food,})); + } + KnowledgeListMF.meatStripR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.generic_meat_strip_uncooked), "", chopping, "knife", -1, 5, + new Object[]{"M", 'M', FoodListMF.generic_meat_uncooked,}); + MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.generic_meat_strip_cooked), "", + chopping, "knife", -1, 5, new Object[]{"M", 'M', FoodListMF.generic_meat_cooked,}); + KnowledgeListMF.meatHunkR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.generic_meat_chunk_uncooked), "", chopping, "knife", -1, 5, + new Object[]{"M", 'M', FoodListMF.generic_meat_strip_uncooked,}); + MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.generic_meat_chunk_cooked), "", + chopping, "knife", -1, 5, new Object[]{"M", 'M', FoodListMF.generic_meat_strip_cooked,}); + KnowledgeListMF.gutsRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.guts), "", + chopping, "knife", 1, 8, new Object[]{"MMMM", 'M', Items.rotten_flesh,}); + + KnowledgeListMF.stewRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.stew), "", + chopping, "knife", -1, 15, + new Object[]{"M", "B", 'M', FoodListMF.generic_meat_chunk_cooked, 'B', Items.bowl}); + KnowledgeListMF.jerkyRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.jerky, 1), "jerky", chopping, "knife", 2, 20, + new Object[]{"S", "M", 'S', FoodListMF.salt, 'M', FoodListMF.generic_meat_strip_cooked,}); + KnowledgeListMF.saussageR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.saussage_raw, 4), "saussage", chopping, "knife", 2, 30, + new Object[]{" G ", "MMM", "BES", 'G', FoodListMF.guts, 'E', Items.egg, 'S', FoodListMF.salt, 'B', + FoodListMF.breadcrumbs, 'M', FoodListMF.generic_meat_mince_uncooked,}); + KnowledgeListMF.meatPieRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.pie_meat_uncooked), "meatpie", chopping, "knife", 2, 150, + new Object[]{" P ", "MMM", " P ", " T ", 'P', FoodListMF.pastry, 'M', + FoodListMF.generic_meat_mince_cooked, 'T', FoodListMF.pie_tray,}); + KnowledgeListMF.breadSliceR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.breadSlice, 12), "", "step.cloth", "knife", -1, 10, + new Object[]{"B", 'B', Items.bread,}); + KnowledgeListMF.sandwitchRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.sandwitch_meat), "sandwitch", chopping, "hands", -1, 4, + new Object[]{"B", "C", "M", "B", 'C', FoodListMF.cheese_slice, 'M', FoodListMF.generic_meat_cooked, + 'B', FoodListMF.breadSlice}); + KnowledgeListMF.sandwitchBigRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.sandwitch_big), "sandwitchBig", chopping, "knife", 1, 10, + new Object[]{"CSC", "MBM", 'S', FoodListMF.salt, 'C', FoodListMF.cheese_slice, 'M', + FoodListMF.generic_meat_cooked, 'B', Items.bread}); + KnowledgeListMF.shepardRecipe = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.pie_shepard_uncooked), "shepardpie", chopping, "knife", 3, 200, + new Object[]{"PFP", "MMM", "CFC", " T ", 'C', Items.carrot, 'P', Items.potato, 'F', FoodListMF.pastry, + 'M', FoodListMF.generic_meat_mince_cooked, 'T', FoodListMF.pie_tray,}); + + KnowledgeListMF.appleR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.pie_apple_uncooked), "applepie", chopping, "knife", 2, 120, + new Object[]{"SPS", "MMM", "SPS", " T ", 'S', FoodListMF.sugarpot, 'P', FoodListMF.pastry, 'M', + Items.apple, 'T', FoodListMF.pie_tray,}); + KnowledgeListMF.pumpPieR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.pie_pumpkin_uncooked), "bread", chopping, "knife", 1, 50, + new Object[]{"SMS", "SPS", " T ", 'S', FoodListMF.sugarpot, 'P', FoodListMF.pastry, 'M', + Blocks.pumpkin, 'T', FoodListMF.pie_tray,}); + KnowledgeListMF.berryR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.pie_berry_uncooked), "berrypie", chopping, "knife", 2, 100, + new Object[]{"SPS", "MMM", "SPS", " T ", 'S', FoodListMF.sugarpot, 'P', FoodListMF.pastry, 'M', + FoodListMF.berries, 'T', FoodListMF.pie_tray,}); + + KnowledgeListMF.simpCakeR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.cake_simple_raw), "bread", mixing, "spoon", -1, 15, + new Object[]{"MMM", "SES", "FFF", " T ", 'F', FoodListMF.flour, 'E', Items.egg, 'M', + FoodListMF.jug_milk, 'S', FoodListMF.sugarpot, 'T', FoodListMF.cake_tin,}); + + KnowledgeListMF.cakeR = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.cake_raw), + "cake", mixing, "spoon", -1, 20, new Object[]{"SMS", "SES", "FFF", " T ", 'F', FoodListMF.flour, 'E', + Items.egg, 'M', FoodListMF.jug_milk, 'S', FoodListMF.sugarpot, 'T', FoodListMF.cake_tin,}); + KnowledgeListMF.carrotCakeR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.cake_carrot_raw), "carrotcake", mixing, "spoon", -1, 25, + new Object[]{"SMS", "SES", "CCC", "FTF", 'C', Items.carrot, 'F', FoodListMF.flour, 'E', Items.egg, + 'M', FoodListMF.jug_milk, 'S', FoodListMF.sugarpot, 'T', FoodListMF.cake_tin,}); + KnowledgeListMF.chocoCakeR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.cake_choc_raw), "chococake", mixing, "spoon", -1, 25, + new Object[]{"SMS", "SES", "CCC", "FTF", 'C', FoodListMF.chocolate, 'F', FoodListMF.flour, 'E', + Items.egg, 'M', FoodListMF.jug_milk, 'S', FoodListMF.sugarpot, 'T', FoodListMF.cake_tin,}); + KnowledgeListMF.bfCakeR = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(FoodListMF.cake_bf_raw), + "bfcake", mixing, "spoon", -1, 30, + new Object[]{"SMMS", "SEES", "CBBC", "FTFF", 'B', FoodListMF.berriesJuicy, 'C', FoodListMF.chocolate, + 'F', FoodListMF.flour, 'E', Items.egg, 'M', FoodListMF.jug_milk, 'S', FoodListMF.sugarpot, 'T', + FoodListMF.cake_tin,}); + KnowledgeListMF.simpCakeOut = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(Items.cake), + "bread", basic, "knife", -1, 10, + new Object[]{"I", "R", 'I', FoodListMF.icing, 'R', FoodListMF.cake_simple_uniced,}); + + KnowledgeListMF.cakeI = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(BlockListMF.cake_vanilla), + "cake", basic, "knife", -1, 60, + new Object[]{"III", " R ", 'I', FoodListMF.icing, 'R', FoodListMF.cake_uniced,}); + KnowledgeListMF.carrotCakeI = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(BlockListMF.cake_carrot), "carrotcake", basic, "knife", -1, 60, + new Object[]{"III", " R ", 'I', FoodListMF.icing, 'R', FoodListMF.cake_carrot_uniced,}); + KnowledgeListMF.chocoCakeI = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(BlockListMF.cake_chocolate), "chococake", basic, "knife", -1, 60, new Object[]{"ICI", + " R ", 'C', FoodListMF.chocolate, 'I', FoodListMF.icing, 'R', FoodListMF.cake_choc_uniced,}); + KnowledgeListMF.bfCakeI = MineFantasyAPI.addCarpenterRecipe(provisioning, new ItemStack(BlockListMF.cake_bf), + "bfcake", basic, "knife", -1, 100, new Object[]{"BBB", "III", "CRC", 'C', FoodListMF.chocolate, 'B', + FoodListMF.berries, 'I', FoodListMF.icing, 'R', FoodListMF.cake_bf_uniced,}); + + KnowledgeListMF.cheeserollR = MineFantasyAPI.addCarpenterRecipe(provisioning, + new ItemStack(FoodListMF.cheese_roll), "cheeseroll", chopping, "knife", 1, 30, + new Object[]{"C", "R", 'C', FoodListMF.cheese_slice, 'R', FoodListMF.breadroll,}); + } + + private static void addOreD(String list, String mfList) { + for (ItemStack stack : OreDictionary.getOres(list)) { + OreDictionary.registerOre(mfList, stack); + } + } + + private static int getSize(ItemStack food) { + if (food != null && food.getItem() instanceof ItemFood) { + int feed = ((ItemFood) food.getItem()).func_150905_g(food); + return Math.max(1, feed - 1); + } + return 1; + } + + private static void addMisc() { + // Fletching + KnowledgeListMF.fletchingR = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(ComponentListMF.fletching, 16), "arrows", chopping, 4, new Object[]{"T", "F", + + 'F', Items.feather, 'T', ComponentListMF.plank,}); + KnowledgeListMF.fletchingR2 = MineFantasyAPI.addCarpenterRecipe(artisanry, + new ItemStack(ComponentListMF.fletching, 4), "arrows", chopping, 4, new Object[]{" T ", "PPP", + + 'P', Items.paper, 'T', ComponentListMF.plank,}); + + // BOMBS + KnowledgeListMF.bombCaseCeramicR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.bomb_casing_uncooked, 2), "bombCeramic", basic, 2, + new Object[]{" C ", "C C", " C ", 'C', Items.clay_ball,}); + KnowledgeListMF.mineCaseCeramicR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.mine_casing_uncooked), "mineCeramic", basic, 2, + new Object[]{" P ", "C C", " C ", + + 'P', Blocks.stone_pressure_plate, 'C', Items.clay_ball,}); + KnowledgeListMF.bombCaseCrystalR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.bomb_casing_crystal), "bombCrystal", basic, 10, + new Object[]{" D ", "R R", " B ", 'B', Items.glass_bottle, 'D', ComponentListMF.diamond_shards, 'R', + Items.redstone}); + KnowledgeListMF.mineCaseCrystalR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.mine_casing_crystal), "mineCrystal", basic, 10, + new Object[]{" P ", "RDR", " B ", 'P', Blocks.heavy_weighted_pressure_plate, 'B', Items.glass_bottle, + 'D', ComponentListMF.diamond_shards, 'R', Items.redstone}); + Salvage.addSalvage(ComponentListMF.bomb_casing_uncooked, new ItemStack(Items.clay_ball, 2)); + Salvage.addSalvage(ComponentListMF.mine_casing_uncooked, new ItemStack(Items.clay_ball, 3), + Blocks.stone_pressure_plate); + + Salvage.addSalvage(ComponentListMF.bomb_casing_crystal, Items.glass_bottle, ComponentListMF.diamond_shards, + new ItemStack(Items.redstone, 2)); + Salvage.addSalvage(ComponentListMF.mine_casing_crystal, Blocks.heavy_weighted_pressure_plate, + Items.glass_bottle, ComponentListMF.diamond_shards, new ItemStack(Items.redstone, 2)); + + KnowledgeListMF.bombFuseR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.bomb_fuse, 8), "bombs", basic, 4, new Object[]{"R", "C", "S", 'S', + ComponentListMF.thread, 'C', ComponentListMF.coalDust, 'R', Items.redstone,}); + KnowledgeListMF.longFuseR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.bomb_fuse_long), "bombs", basic, 1, + new Object[]{"F", "R", "F", 'F', ComponentListMF.bomb_fuse, 'R', Items.redstone,}); + Salvage.addSalvage(ComponentListMF.bomb_fuse_long, new ItemStack(ComponentListMF.bomb_fuse, 2), Items.redstone); + + KnowledgeListMF.thatchR = MineFantasyAPI.addCarpenterRecipe(construction, new ItemStack(BlockListMF.thatch), "", + "dig.grass", "hands", -1, 1, new Object[]{"HH", "HH", 'H', new ItemStack(Blocks.tallgrass, 1, 1)}); + KnowledgeListMF.thatchStairR = MineFantasyAPI.addCarpenterRecipe(construction, + new ItemStack(BlockListMF.thatch_stair), "", "dig.grass", "hands", -1, 1, + new Object[]{"H ", "HH", 'H', new ItemStack(Blocks.tallgrass, 1, 1)}); + Salvage.addSalvage(BlockListMF.thatch_stair, new ItemStack(Blocks.tallgrass, 3, 1)); + Salvage.addSalvage(BlockListMF.thatch, new ItemStack(Blocks.tallgrass, 4, 1)); + + KnowledgeListMF.apronRecipe = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ArmourListMF.leatherapron), + "", sewing, "hands", -1, 1, new Object[]{"LCL", " L ", 'L', Items.leather, 'C', Items.coal,}); + Salvage.addSalvage(ArmourListMF.leatherapron, new ItemStack(Items.leather, 3), Items.coal); + + KnowledgeListMF.hideHelmR = MineFantasyAPI.addCarpenterRecipe(null, + ArmourListMF.armour(ArmourListMF.leather, 0, 0), "", sewing, "hands", -1, 1, + new Object[]{"H", "C", "H", 'H', ComponentListMF.hideSmall, 'C', Blocks.wool,}); + KnowledgeListMF.hideChestR = MineFantasyAPI.addCarpenterRecipe(null, + ArmourListMF.armour(ArmourListMF.leather, 0, 1), "", sewing, "hands", -1, 1, + new Object[]{"H", "C", 'H', ComponentListMF.hideLarge, 'C', Blocks.wool,}); + KnowledgeListMF.hideLegsR = MineFantasyAPI.addCarpenterRecipe(null, + ArmourListMF.armour(ArmourListMF.leather, 0, 2), "", sewing, "hands", -1, 1, + new Object[]{"H", "C", 'H', ComponentListMF.hideMedium, 'C', Blocks.wool,}); + KnowledgeListMF.hideBootsR = MineFantasyAPI.addCarpenterRecipe(null, + ArmourListMF.armour(ArmourListMF.leather, 0, 3), "", sewing, "hands", -1, 1, + new Object[]{"H", "C", 'H', ComponentListMF.hideSmall, 'C', Blocks.wool,}); + + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 0, 0), + new ItemStack(ComponentListMF.hideSmall, 2), Blocks.wool); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 0, 1), ComponentListMF.hideLarge, Blocks.wool); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 0, 2), ComponentListMF.hideMedium, + Blocks.wool); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 0, 3), ComponentListMF.hideSmall, Blocks.wool); + + KnowledgeListMF.bedrollR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.bedroll), "", + sewing, "needle", -1, 50, + new Object[]{"TLT", "CCC", 'C', Blocks.wool, 'T', ComponentListMF.thread, 'L', Items.leather}); + Salvage.addSalvage(ToolListMF.bedroll, new ItemStack(Blocks.wool, 3), Items.leather, + new ItemStack(ComponentListMF.thread, 3)); + } + + public static void addCrossbows() { + // CROSSBOWS + KnowledgeListMF.crossHandleWoodR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.crossbow_handle_wood), "crossShafts", nailHammer, "hammer", 2, 150, + new Object[]{"N N", "PP ", " P ", 'P', ComponentListMF.plank.construct("RefinedWood"), 'N', + ComponentListMF.nail}); + KnowledgeListMF.crossStockWoodR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.crossbow_stock_wood), "crossShafts", nailHammer, "hammer", 2, 300, + new Object[]{"NN N", "PPPP", " PPP", 'P', ComponentListMF.plank.construct("RefinedWood"), 'N', + ComponentListMF.nail}); + KnowledgeListMF.crossStockIronR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.crossbow_stock_iron), "crossShaftAdvanced", spanner, "spanner", 2, 300, + new Object[]{" BBB", "BOGG", "SWSS", " ", 'O', Blocks.obsidian, 'G', + ComponentListMF.tungsten_gears, 'W', ComponentListMF.crossbow_stock_wood, 'S', + ComponentListMF.iron_strut, 'B', ComponentListMF.bolt,}); + + KnowledgeListMF.crossHeadLightR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.cross_arms_light), "crossHeads", nailHammer, "hammer", 2, 200, + new Object[]{"PPP", "NSN", " P ", 'P', ComponentListMF.plank.construct("RefinedWood"), 'N', + ComponentListMF.nail, 'S', Items.string,}); + KnowledgeListMF.crossHeadMediumR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.cross_arms_basic), "crossHeads", nailHammer, "hammer", 2, 250, + new Object[]{"NNN", "PAP", 'N', ComponentListMF.nail, 'P', + ComponentListMF.plank.construct("RefinedWood"), 'A', ComponentListMF.cross_arms_light,}); + KnowledgeListMF.crossHeadHeavyR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.cross_arms_heavy), "crossHeads", nailHammer, "hammer", 2, 350, + new Object[]{"NNN", "PAP", 'N', ComponentListMF.nail, 'P', + ComponentListMF.plank.construct("RefinedWood"), 'A', ComponentListMF.cross_arms_basic,}); + KnowledgeListMF.crossHeadAdvancedR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.cross_arms_advanced), "crossHeadAdvanced", nailHammer, "hammer", 2, 350, + new Object[]{"NRN", "RGR", " A ", 'G', ComponentListMF.tungsten_gears, 'N', ComponentListMF.nail, 'R', + ComponentListMF.steel_tube, 'A', ComponentListMF.cross_arms_basic,}); + + KnowledgeListMF.crossAmmoR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.cross_ammo), "crossAmmo", nailHammer, "hammer", 2, 200, + new Object[]{"NNN", "P P", "PGP", "PPP", 'G', ComponentListMF.tungsten_gears, 'P', + ComponentListMF.plank.construct("RefinedWood"), 'N', ComponentListMF.nail,}); + KnowledgeListMF.crossScopeR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.cross_scope), "crossScope", spanner, "spanner", 2, 150, + new Object[]{"BSB", "GP ", 'G', ComponentListMF.tungsten_gears, 'S', ToolListMF.spyglass, 'P', + ComponentListMF.plank.construct("RefinedWood"), 'B', ComponentListMF.bolt,}); + Salvage.addSalvage(ComponentListMF.cross_arms_light, new ItemStack(ComponentListMF.nail, 2), Items.string, + ComponentListMF.plank.construct("RefinedWood", 4)); + Salvage.addSalvage(ComponentListMF.cross_arms_basic, new ItemStack(ComponentListMF.nail, 3), + ComponentListMF.cross_arms_light, ComponentListMF.plank.construct("RefinedWood", 2)); + Salvage.addSalvage(ComponentListMF.cross_arms_heavy, new ItemStack(ComponentListMF.nail, 3), + ComponentListMF.cross_arms_basic, ComponentListMF.plank.construct("RefinedWood", 2)); + Salvage.addSalvage(ComponentListMF.cross_arms_advanced, ComponentListMF.tungsten_gears, + new ItemStack(ComponentListMF.nail, 2), ComponentListMF.cross_arms_basic, + new ItemStack(ComponentListMF.steel_tube, 3)); + + Salvage.addSalvage(ComponentListMF.cross_scope, ComponentListMF.tungsten_gears, ToolListMF.spyglass, + new ItemStack(ComponentListMF.bolt, 2), ComponentListMF.plank.construct("RefinedWood")); + Salvage.addSalvage(ComponentListMF.cross_ammo, ComponentListMF.tungsten_gears, + new ItemStack(ComponentListMF.nail, 3), ComponentListMF.plank.construct("RefinedWood", 7)); + Salvage.addSalvage(ComponentListMF.crossbow_handle_wood, new ItemStack(ComponentListMF.nail, 2), + ComponentListMF.plank.construct("RefinedWood", 3)); + Salvage.addSalvage(ComponentListMF.crossbow_stock_wood, new ItemStack(ComponentListMF.nail, 3), + ComponentListMF.plank.construct("RefinedWood", 7)); + Salvage.addSalvage(ComponentListMF.crossbow_stock_iron, new ItemStack(ComponentListMF.tungsten_gears, 2), + Blocks.obsidian, new ItemStack(ComponentListMF.bolt, 4), new ItemStack(ComponentListMF.iron_strut, 3), + ComponentListMF.crossbow_stock_wood); + } + + private static void addEngineering() { + addCrossbows(); + KnowledgeListMF.bombBenchCraft = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(BlockListMF.bombBench), "bombs", spanner, "spanner", 0, 150, new Object[]{"BFB", "BCB", + 'B', ComponentListMF.bolt, 'F', ComponentListMF.iron_frame, 'C', BlockListMF.carpenter,}); + KnowledgeListMF.bombPressCraft = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(BlockListMF.bombPress), "bpress", spanner, "spanner", 3, 200, + new Object[]{"BFB", "GGL", "SPS", 'S', ComponentListMF.iron_strut, 'B', ComponentListMF.bolt, 'F', + ComponentListMF.iron_frame, 'L', Blocks.lever, 'P', + new ItemStack(CustomToolListMF.standard_spanner, 1, 0), 'G', ComponentListMF.bronze_gears,}); + + KnowledgeListMF.crossBenchCraft = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(BlockListMF.crossbowBench), "crossbows", spanner, "spanner", 0, 200, + new Object[]{" F ", "PSP", "NCN", 'F', ComponentListMF.iron_frame, 'P', ComponentListMF.plank, 'N', + ComponentListMF.bolt, 'S', Items.string, 'C', BlockListMF.carpenter,}); + + KnowledgeListMF.engTannerR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(BlockListMF.engTanner), "engTanner", spanner, "spanner", 3, 300, + new Object[]{"BLB", "SPS", "GGG", "SFS", 'S', ComponentListMF.iron_strut, 'B', ComponentListMF.bolt, + 'F', ComponentListMF.iron_frame, 'L', Blocks.lever, 'P', + new ItemStack(CustomToolListMF.standard_knife, 1, 0), 'G', ComponentListMF.bronze_gears,}); + ItemStack blackPlate = ComponentListMF.plate.createComm("blackSteel"); + KnowledgeListMF.advancedForgeR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(BlockListMF.forge_metal), "advforge", spanner, "spanner", 4, 400, + new Object[]{" T ", "FRRF", "PPPP", "BBBB", 'B', ComponentListMF.bolt, 'F', + ComponentListMF.iron_frame, 'T', ToolListMF.engin_anvil_tools, 'P', blackPlate, 'R', + Blocks.redstone_block,}); + ItemStack steelPlate = ComponentListMF.plate.createComm("steel"); + KnowledgeListMF.autoCrucibleR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(BlockListMF.crucibleauto), "advcrucible", spanner, "spanner", 4, 200, + new Object[]{" T ", "PCP", "PGP", "BBB", 'B', ComponentListMF.bolt, 'C', BlockListMF.crucibleadv, 'G', + ComponentListMF.tungsten_gears, 'T', ToolListMF.engin_anvil_tools, 'P', steelPlate}); + KnowledgeListMF.spyglassR = MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ToolListMF.spyglass), + "spyglass", spanner, "spanner", 1, 300, + new Object[]{" T ", "BCB", "GPG", 'C', ComponentListMF.bronze_gears, 'G', Blocks.glass, 'B', + ComponentListMF.bolt, 'T', ToolListMF.engin_anvil_tools, 'P', ComponentListMF.steel_tube,}); + + KnowledgeListMF.syringeR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ToolListMF.syringe_empty), "syringe", spanner, "spanner", 1, 200, + new Object[]{"E", "T", "B", "N", 'E', ToolListMF.engin_anvil_tools, 'T', ComponentListMF.steel_tube, + 'B', Items.glass_bottle, 'N', new ItemStack(CustomToolListMF.standard_needle),}); + + KnowledgeListMF.parachuteR = MineFantasyAPI.addCarpenterRecipe(engineering, new ItemStack(ToolListMF.parachute), + "parachute", sewing, "needle", 1, 350, + new Object[]{"TTT", "CCC", "BEB", "BLB", 'E', ToolListMF.engin_anvil_tools, 'T', + ComponentListMF.thread, 'B', ComponentListMF.leather_strip, 'L', Items.leather, 'C', + Blocks.wool,}); + KnowledgeListMF.cogShaftR = MineFantasyAPI.addCarpenterRecipe(engineering, + new ItemStack(ComponentListMF.cogwork_shaft), "cogArmour", spanner, "spanner", 4, 150, + new Object[]{"BPB", "SGS", "BFB", + + 'P', Blocks.piston, 'G', ComponentListMF.tungsten_gears, 'B', ComponentListMF.bolt, 'F', + ComponentListMF.iron_frame, 'S', ComponentListMF.iron_strut,}); + Salvage.addSalvage(ComponentListMF.cogwork_shaft, new ItemStack(ComponentListMF.iron_strut, 2), + new ItemStack(ComponentListMF.bolt, 4), ComponentListMF.iron_frame, Blocks.piston, + ComponentListMF.tungsten_gears); + + Salvage.addSalvage(BlockListMF.crucibleauto, new ItemStack(ComponentListMF.bolt, 3), + ComponentListMF.tungsten_gears, BlockListMF.crucibleadv, steelPlate, steelPlate, steelPlate, + steelPlate); + Salvage.addSalvage(BlockListMF.bombBench, new ItemStack(ComponentListMF.bolt, 4), ComponentListMF.iron_frame, + BlockListMF.carpenter); + Salvage.addSalvage(BlockListMF.crossbowBench, new ItemStack(ComponentListMF.nail, 2), + ComponentListMF.plank.construct("ScrapWood", 2), Items.string, BlockListMF.carpenter); + Salvage.addSalvage(BlockListMF.bombPress, new ItemStack(ComponentListMF.iron_strut, 2), + new ItemStack(ComponentListMF.bolt, 2), new ItemStack(ComponentListMF.bronze_gears, 2), Blocks.lever, + ComponentListMF.iron_frame); + Salvage.addSalvage(BlockListMF.engTanner, new ItemStack(ComponentListMF.iron_strut, 4), + new ItemStack(ComponentListMF.bolt, 2), new ItemStack(ComponentListMF.bronze_gears, 3), + CustomToolListMF.standard_needle, Blocks.lever, ComponentListMF.iron_frame); + Salvage.addSalvage(BlockListMF.forge_metal, new ItemStack(ComponentListMF.bolt, 4), blackPlate, blackPlate, + blackPlate, blackPlate, new ItemStack(ComponentListMF.iron_frame, 2), + new ItemStack(Blocks.redstone_block, 2)); + Salvage.addSalvage(ToolListMF.spyglass, new ItemStack(ComponentListMF.bolt, 2), new ItemStack(Blocks.glass, 2), + ComponentListMF.steel_tube, ComponentListMF.bronze_gears); + Salvage.addSalvage(ToolListMF.syringe_empty, Items.glass_bottle, CustomToolListMF.standard_needle, + ComponentListMF.steel_tube); + Salvage.addSalvage(ToolListMF.parachute, new ItemStack(ComponentListMF.thread, 3), + new ItemStack(Blocks.wool, 3), new ItemStack(ComponentListMF.leather_strip, 4), Items.leather); + } + + private static void addNonPrimitiveStone() { + KnowledgeListMF.stoneKnifeR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.knifeStone), "", + primitive, "hands", -1, 4, + new Object[]{"R", "R", "S", 'R', Blocks.cobblestone, 'S', ComponentListMF.plank,}); + KnowledgeListMF.stoneHammerR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.hammerStone), + "", primitive, "hands", -1, 4, + new Object[]{"R", "S", 'R', Blocks.cobblestone, 'S', ComponentListMF.plank,}); + + KnowledgeListMF.stoneTongsR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.tongsStone), "", + primitive, "hands", -1, 4, + new Object[]{"R ", "SR", 'R', Blocks.cobblestone, 'S', ComponentListMF.plank,}); + KnowledgeListMF.boneNeedleR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.needleBone), "", + primitive, "hands", -1, 4, new Object[]{"B", 'B', Items.bone,}); + + Salvage.addSalvage(ToolListMF.knifeStone, new ItemStack(Blocks.cobblestone, 2), + ComponentListMF.plank.construct("ScrapWood")); + Salvage.addSalvage(ToolListMF.hammerStone, Blocks.cobblestone, ComponentListMF.plank.construct("ScrapWood")); + Salvage.addSalvage(ToolListMF.tongsStone, new ItemStack(Blocks.cobblestone, 2), + ComponentListMF.plank.construct("ScrapWood")); + Salvage.addSalvage(ToolListMF.needleBone, Items.bone); + } + + private static void addPrimitive() { + KnowledgeListMF.dirtRockR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ComponentListMF.sharp_rock), + "", "minecraft:dig.gravel", "hands", -1, 1, new Object[]{"D", 'D', Blocks.dirt,}); + + KnowledgeListMF.stonePickR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.pickStone), "", + primitive, "hands", -1, 5, new Object[]{"RVR", " S ", " S ", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.stoneAxeR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.axeStone), "", + primitive, "hands", -1, 5, new Object[]{"RV", "RS", " S", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.stoneSpadeR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.spadeStone), "", + primitive, "hands", -1, 5, new Object[]{"VR", " S", " S", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.stoneHoeR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.hoeStone), "", + primitive, "hands", -1, 5, new Object[]{"RV", " S", " S", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.stoneSwordR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.swordStone), "", + primitive, "hands", -1, 8, new Object[]{"R ", "R ", "SV", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.stoneWarR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.waraxeStone), "", + primitive, "hands", -1, 8, new Object[]{"VRV", "RS", " S", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.stoneMaceR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.maceStone), "", + primitive, "hands", -1, 8, new Object[]{" V ", "RSR", " S ", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.stoneSpearR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.spearStone), "", + primitive, "hands", -1, 8, new Object[]{"R", "V", "S", "S", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.stoneKnifeR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.knifeStone), "", + primitive, "hands", -1, 4, new Object[]{"R ", "SV", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.stoneHammerR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.hammerStone), + "", primitive, "hands", -1, 4, new Object[]{"R", "V", "S", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + + KnowledgeListMF.stoneTongsR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.tongsStone), "", + primitive, "hands", -1, 4, new Object[]{" R", "SV", 'R', ComponentListMF.sharp_rock, 'V', + ComponentListMF.vine, 'S', Items.stick}); + KnowledgeListMF.boneNeedleR = MineFantasyAPI.addCarpenterRecipe(null, new ItemStack(ToolListMF.needleBone), "", + primitive, "hands", -1, 4, new Object[]{"B", 'B', Items.bone,}); + + Salvage.addSalvage(ToolListMF.pickStone, new ItemStack(ComponentListMF.sharp_rock, 2), + new ItemStack(Items.stick, 2), ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.axeStone, new ItemStack(ComponentListMF.sharp_rock, 2), + new ItemStack(Items.stick, 2), ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.spadeStone, ComponentListMF.sharp_rock, new ItemStack(Items.stick, 2), + ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.hoeStone, ComponentListMF.sharp_rock, new ItemStack(Items.stick, 2), + ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.swordStone, Items.stick, new ItemStack(ComponentListMF.sharp_rock, 2), + ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.waraxeStone, new ItemStack(ComponentListMF.sharp_rock, 2), + new ItemStack(Items.stick, 2), new ItemStack(ComponentListMF.vine, 2)); + Salvage.addSalvage(ToolListMF.maceStone, new ItemStack(ComponentListMF.sharp_rock, 2), + new ItemStack(Items.stick, 2), ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.spearStone, ComponentListMF.sharp_rock, new ItemStack(Items.stick, 2), + ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.knifeStone, ComponentListMF.sharp_rock, Items.stick, ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.hammerStone, ComponentListMF.sharp_rock, Items.stick, ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.tongsStone, ComponentListMF.sharp_rock, Items.stick, ComponentListMF.vine); + Salvage.addSalvage(ToolListMF.needleBone, Items.bone); + } + + public static void initTierWood() { + String basic = CarpenterRecipes.basic; + + float time = 4; + Item plank = ComponentListMF.plank; + + KnowledgeListMF.spoonR = MineFantasyAPI.addCarpenterToolRecipe(artisanry, CustomToolListMF.standard_spoon, "", + basic, "hands", -1, 1 + (int) (1 * time), new Object[]{"W", "S", 'W', plank, 'S', Items.stick}); + Salvage.addSalvage(CustomToolListMF.standard_spoon, plank, Items.stick); + KnowledgeListMF.malletR = MineFantasyAPI.addCarpenterToolRecipe(artisanry, CustomToolListMF.standard_mallet, "", + basic, "hands", -1, 1 + (int) (2 * time), new Object[]{"WW", " S", 'W', plank, 'S', Items.stick}); + Salvage.addSalvage(CustomToolListMF.standard_mallet, plank, plank, Items.stick); + Salvage.addSalvage(CustomToolListMF.standard_spoon, plank, Items.stick); + + KnowledgeListMF.refinedPlankR.add(MineFantasyAPI.addCarpenterRecipe(construction, + ComponentListMF.plank.construct("RefinedWood"), "", basic, "hands", -1, 1, + new Object[]{"O", "P", 'O', ComponentListMF.plant_oil, 'P', (ComponentListMF.plank)})); + KnowledgeListMF.easyPaintPlank.add(MineFantasyAPI.addCarpenterRecipe(construction, + ComponentListMF.plank.construct("RefinedWood", 4), "paint_brush", sewing, "brush", -1, 2, + new Object[]{" O ", "PPPP", 'O', ComponentListMF.plant_oil, 'P', (ComponentListMF.plank)})); + } + + static void tryAddSawPlanks(ItemStack planks, CustomMaterial material) { + String sub = material.name.substring(0, material.name.length() - 4).toLowerCase(); + + if (planks.getUnlocalizedName().toLowerCase().contains(sub)) { + addSawPlanks(planks, material); + } + } + + static void addSawPlanks(ItemStack planks, CustomMaterial material) { + MineFantasyAPI.addCarpenterRecipe(construction, (ComponentListMF.plank).construct(material.name, 4), + "commodities", sawing, "saw", -1, 10, new Object[]{"P", 'P', planks.copy()}); + + //NEW + + } } diff --git a/src/main/java/minefantasy/mf2/recipe/ComponentAnvilRecipe.java b/src/main/java/minefantasy/mf2/recipe/ComponentAnvilRecipe.java index 04f70c0d..4b69ebec 100644 --- a/src/main/java/minefantasy/mf2/recipe/ComponentAnvilRecipe.java +++ b/src/main/java/minefantasy/mf2/recipe/ComponentAnvilRecipe.java @@ -1,91 +1,72 @@ package minefantasy.mf2.recipe; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; import minefantasy.mf2.api.crafting.anvil.ShapedAnvilRecipes; import minefantasy.mf2.api.crafting.anvil.ShapelessAnvilRecipes; import minefantasy.mf2.api.heating.Heatable; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.rpg.Skill; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class ComponentAnvilRecipe extends ShapedAnvilRecipes { + public ComponentAnvilRecipe(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, int time, + int hammer, int anvi, float exp, boolean hot, String research, Skill skill) { + super(wdth, heit, inputs, output, toolType, time, hammer, anvi, exp, hot, research, skill); + } -public class ComponentAnvilRecipe extends ShapedAnvilRecipes -{ - public ComponentAnvilRecipe(int wdth, int heit, ItemStack[] inputs, ItemStack output, String toolType, int time, int hammer, int anvi, float exp, boolean hot, String research, Skill skill) - { - super(wdth, heit, inputs, output, toolType, time, hammer, anvi, exp, hot, research, skill); - } - - protected boolean checkMatch(InventoryCrafting matrix, int x, int y, boolean b) - { - String baseMaterial = null; - for (int var5 = 0; var5 < ShapelessAnvilRecipes.globalWidth; ++var5) - { - for (int var6 = 0; var6 < ShapelessAnvilRecipes.globalHeight; ++var6) - { + protected boolean checkMatch(InventoryCrafting matrix, int x, int y, boolean b) { + String baseMaterial = null; + for (int var5 = 0; var5 < ShapelessAnvilRecipes.globalWidth; ++var5) { + for (int var6 = 0; var6 < ShapelessAnvilRecipes.globalHeight; ++var6) { int var7 = var5 - x; int var8 = var6 - y; ItemStack recipeItem = null; - if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) - { - if (b) - { + if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) { + if (b) { recipeItem = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth]; - } - else - { + } else { recipeItem = this.recipeItems[var7 + var8 * this.recipeWidth]; } } ItemStack inputItem = matrix.getStackInRowAndColumn(var5, var6); - if (inputItem != null || recipeItem != null) - { - CustomMaterial material = CustomMaterial.getMaterialFor(inputItem, "base"); - if(material != null) - { - if(baseMaterial == null) - { - baseMaterial = material.name; - } - else - { - if(material.name != baseMaterial) - { - return false; - } - } - } - //HEATING - if (Heatable.requiresHeating && Heatable.canHeatItem(inputItem)) - { - return false; - } - if(!Heatable.isWorkable(inputItem)) - { - return false; - } - inputItem = getHotItem(inputItem); - - if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) - { + if (inputItem != null || recipeItem != null) { + CustomMaterial material = CustomMaterial.getMaterialFor(inputItem, "base"); + if (material != null) { + if (baseMaterial == null) { + baseMaterial = material.name; + } else { + if (material.name != baseMaterial) { + return false; + } + } + } + // HEATING + if (Heatable.requiresHeating && Heatable.canHeatItem(inputItem)) { + return false; + } + if (!Heatable.isWorkable(inputItem)) { + return false; + } + inputItem = getHotItem(inputItem); + + if (inputItem == null && recipeItem != null || inputItem != null && recipeItem == null) { return false; } - - if(inputItem == null) - { - return false; + + if (inputItem == null) { + return false; } - if (recipeItem.getItem() != inputItem.getItem()) - { + if (recipeItem.getItem() != inputItem.getItem()) { return false; } - if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE && recipeItem.getItemDamage() != inputItem.getItemDamage()) - { + if (recipeItem.getItemDamage() != OreDictionary.WILDCARD_VALUE + && recipeItem.getItemDamage() != inputItem.getItemDamage()) { return false; } } diff --git a/src/main/java/minefantasy/mf2/recipe/CookingRecipes.java b/src/main/java/minefantasy/mf2/recipe/CookingRecipes.java index edcf7125..c16904bd 100644 --- a/src/main/java/minefantasy/mf2/recipe/CookingRecipes.java +++ b/src/main/java/minefantasy/mf2/recipe/CookingRecipes.java @@ -3,7 +3,6 @@ import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.cooking.CookRecipe; -import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigHardcore; import minefantasy.mf2.item.food.FoodListMF; import minefantasy.mf2.item.list.ComponentListMF; @@ -11,114 +10,108 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class CookingRecipes -{ - public static void init() - { - cookMeat(FoodListMF.horse_raw, FoodListMF.horse_cooked); - cookMeat(FoodListMF.wolf_raw, FoodListMF.wolf_cooked); - cookMeat(FoodListMF.saussage_raw, FoodListMF.saussage_cooked); - cookMeat(FoodListMF.generic_meat_uncooked, FoodListMF.generic_meat_cooked); - cookMeat(FoodListMF.generic_meat_strip_uncooked, FoodListMF.generic_meat_strip_cooked); - cookMeat(FoodListMF.generic_meat_chunk_uncooked, FoodListMF.generic_meat_chunk_cooked); - - bake(FoodListMF.dough, FoodListMF.breadroll, 150, 300, 10, 20, true); - bake(FoodListMF.raw_bread, Items.bread, 150, 300, 20, 40, true); - bake(FoodListMF.curds, FoodListMF.cheese_pot, 100, 300, 60, 20, false); - bake(FoodListMF.sweetroll_raw, FoodListMF.sweetroll_uniced, 180, 250, 20, 10, true); - - bake(FoodListMF.pie_pumpkin_uncooked, FoodListMF.pie_pumpkin_cooked,150, 300, 20, 20, FoodListMF.burnt_pie); - bake(FoodListMF.pie_apple_uncooked, FoodListMF.pie_apple_cooked, 150, 300, 25, 20, FoodListMF.burnt_pie); - bake(FoodListMF.pie_berry_uncooked, FoodListMF.pie_berry_cooked, 150, 300, 25, 20, FoodListMF.burnt_pie); - bake(FoodListMF.pie_meat_uncooked, FoodListMF.pie_meat_cooked, 150, 300, 30, 20, FoodListMF.burnt_pie); - bake(FoodListMF.pie_shepard_uncooked, FoodListMF.pie_shepard_cooked,150, 300, 30, 20, FoodListMF.burnt_pie); - - bake(FoodListMF.cake_simple_raw, FoodListMF.cake_simple_raw, 180, 250, 30, 30, FoodListMF.burnt_cake); - bake(FoodListMF.cake_raw, FoodListMF.cake_raw, 180, 250, 40, 20, FoodListMF.burnt_cake); - bake(FoodListMF.cake_choc_raw, FoodListMF.cake_choc_raw, 180, 250, 40, 20, FoodListMF.burnt_cake); - bake(FoodListMF.cake_carrot_raw, FoodListMF.cake_carrot_raw, 180, 250, 40, 20, FoodListMF.burnt_cake); - bake(FoodListMF.cake_bf_raw, FoodListMF.cake_bf_raw, 180, 250, 50, 10 , FoodListMF.burnt_cake); - bake(FoodListMF.eclair_raw, FoodListMF.eclair_uniced, 180, 250, 60, 5 , true); - - addCeramics(); - MineFantasyAPI.addCookingRecipe(new ItemStack(FoodListMF.generic_meat_mince_uncooked), - new ItemStack(FoodListMF.generic_meat_mince_cooked), new ItemStack(FoodListMF.burnt_pot), - 100, 200, 10, false); - - MineFantasyAPI.addCookingRecipe(new ItemStack(FoodListMF.bowl_water_salt), - new ItemStack(FoodListMF.salt), - 100, 200, 2, false, false); - - if(!ConfigHardcore.preventCook) - { - smeltFood(); - } - } - /** - * Cook in for out on anything (100C-200C, for ~15s) - */ - private static CookRecipe cookMeat(Item in, Item out) - { - return MineFantasyAPI.addCookingRecipe(new ItemStack(in), - new ItemStack(out), - 100, 200, 15, false); - } - /** - * Cook in for out enclosed in ovens - * @param temp how hot the oven is - * @param offset the room for error +/- - * @param time how much time roughly - */ - private static CookRecipe bake(Item in, Item out, int mint, int maxt, int time, int burn_time, boolean burn) - { - return MineFantasyAPI.addCookingRecipe(new ItemStack(in), - new ItemStack(out), new ItemStack(FoodListMF.burnt_food), - mint, maxt, time, burn_time, true, burn); - } - /** - * Cook in for out enclosed in ovens - * @param temp how hot the oven is - * @param offset the room for error +/- - * @param time how much time roughly - */ - private static CookRecipe bake(Item in, Item out, int mint, int maxt, int time, int burn_time, Item burn) - { - return MineFantasyAPI.addCookingRecipe(new ItemStack(in), - new ItemStack(out), new ItemStack(burn), - mint, maxt, time, burn_time, true); - } - - private static void smeltFood() - { - GameRegistry.addSmelting(FoodListMF.horse_raw, new ItemStack(FoodListMF.horse_cooked), 0.2F); - GameRegistry.addSmelting(FoodListMF.wolf_raw, new ItemStack(FoodListMF.wolf_cooked), 0.2F); - GameRegistry.addSmelting(FoodListMF.generic_meat_uncooked, new ItemStack(FoodListMF.generic_meat_cooked), 0); - GameRegistry.addSmelting(FoodListMF.generic_meat_strip_uncooked, new ItemStack(FoodListMF.generic_meat_strip_cooked), 0); - GameRegistry.addSmelting(FoodListMF.generic_meat_chunk_uncooked, new ItemStack(FoodListMF.generic_meat_chunk_cooked), 0); - GameRegistry.addSmelting(FoodListMF.generic_meat_mince_uncooked, new ItemStack(FoodListMF.generic_meat_mince_cooked), 0); - GameRegistry.addSmelting(FoodListMF.bowl_water_salt, new ItemStack(FoodListMF.salt), 0); - GameRegistry.addSmelting(FoodListMF.saussage_raw, new ItemStack(FoodListMF.saussage_cooked), 0); - - } - - - private static void addCeramics() - { - bakeCeramic(ComponentListMF.clay_pot_uncooked, ComponentListMF.clay_pot, 1000, 5); - bakeCeramic(FoodListMF.jug_uncooked, FoodListMF.jug_empty, 1000, 5); - bakeCeramic(ComponentListMF.pie_tray_uncooked, FoodListMF.pie_tray, 1000, 10); - bakeCeramic(ComponentListMF.ingot_mould_uncooked, ComponentListMF.ingot_mould, 1000, 5); - bakeCeramic(ComponentListMF.mine_casing_uncooked, ComponentListMF.mine_casing, 1000, 10); - bakeCeramic(ComponentListMF.bomb_casing_uncooked, ComponentListMF.bomb_casing, 1000, 10); - - bakeCeramic(ComponentListMF.fireclay_brick, ComponentListMF.strong_brick, 1500, 5); - } - private static CookRecipe bakeCeramic(Item clay, Item ceramic, int temp, int time) - { - GameRegistry.addSmelting(clay, new ItemStack(ceramic), 0F); - return MineFantasyAPI.addCookingRecipe(new ItemStack(clay), - new ItemStack(ceramic), null, - temp, 1000, time, 0, true, false); - - } +public class CookingRecipes { + public static void init() { + cookMeat(FoodListMF.horse_raw, FoodListMF.horse_cooked); + cookMeat(FoodListMF.wolf_raw, FoodListMF.wolf_cooked); + cookMeat(FoodListMF.saussage_raw, FoodListMF.saussage_cooked); + cookMeat(FoodListMF.generic_meat_uncooked, FoodListMF.generic_meat_cooked); + cookMeat(FoodListMF.generic_meat_strip_uncooked, FoodListMF.generic_meat_strip_cooked); + cookMeat(FoodListMF.generic_meat_chunk_uncooked, FoodListMF.generic_meat_chunk_cooked); + + bake(FoodListMF.dough, FoodListMF.breadroll, 150, 300, 10, 20, true); + bake(FoodListMF.raw_bread, Items.bread, 150, 300, 20, 40, true); + bake(FoodListMF.curds, FoodListMF.cheese_pot, 100, 300, 60, 20, false); + bake(FoodListMF.sweetroll_raw, FoodListMF.sweetroll_uniced, 150, 250, 20, 10, true); + + bake(FoodListMF.pie_pumpkin_uncooked, FoodListMF.pie_pumpkin_cooked, 150, 300, 20, 20, FoodListMF.burnt_pie); + bake(FoodListMF.pie_apple_uncooked, FoodListMF.pie_apple_cooked, 150, 300, 25, 20, FoodListMF.burnt_pie); + bake(FoodListMF.pie_berry_uncooked, FoodListMF.pie_berry_cooked, 150, 300, 25, 20, FoodListMF.burnt_pie); + bake(FoodListMF.pie_meat_uncooked, FoodListMF.pie_meat_cooked, 150, 300, 30, 20, FoodListMF.burnt_pie); + bake(FoodListMF.pie_shepard_uncooked, FoodListMF.pie_shepard_cooked, 150, 300, 30, 20, FoodListMF.burnt_pie); + + bake(FoodListMF.cake_simple_raw, FoodListMF.cake_simple_uniced, 150, 250, 30, 30, FoodListMF.burnt_cake); + bake(FoodListMF.cake_raw, FoodListMF.cake_uniced, 150, 250, 40, 20, FoodListMF.burnt_cake); + bake(FoodListMF.cake_choc_raw, FoodListMF.cake_choc_uniced, 150, 250, 40, 20, FoodListMF.burnt_cake); + bake(FoodListMF.cake_carrot_raw, FoodListMF.cake_carrot_uniced, 150, 250, 40, 20, FoodListMF.burnt_cake); + bake(FoodListMF.cake_bf_raw, FoodListMF.cake_bf_uniced, 150, 250, 50, 10, FoodListMF.burnt_cake); + bake(FoodListMF.eclair_raw, FoodListMF.eclair_uniced, 150, 250, 60, 5, true); + + addCeramics(); + MineFantasyAPI.addCookingRecipe(new ItemStack(FoodListMF.generic_meat_mince_uncooked), + new ItemStack(FoodListMF.generic_meat_mince_cooked), new ItemStack(FoodListMF.burnt_pot), 100, 200, 10, + false); + + MineFantasyAPI.addCookingRecipe(new ItemStack(FoodListMF.bowl_water_salt), new ItemStack(FoodListMF.salt), 100, + 200, 2, false, false); + + if (!ConfigHardcore.preventCook) { + smeltFood(); + } + } + + /** + * Cook in for out on anything (100C-200C, for ~15s) + */ + private static CookRecipe cookMeat(Item in, Item out) { + return MineFantasyAPI.addCookingRecipe(new ItemStack(in), new ItemStack(out), 100, 200, 15, false); + } + + /** + * Cook in for out enclosed in ovens + * + * @param temp how hot the oven is + * @param offset the room for error +/- + * @param time how much time roughly + */ + private static CookRecipe bake(Item in, Item out, int mint, int maxt, int time, int burn_time, boolean burn) { + return MineFantasyAPI.addCookingRecipe(new ItemStack(in), new ItemStack(out), + new ItemStack(FoodListMF.burnt_food), mint, maxt, time, burn_time, true, burn); + } + + /** + * Cook in for out enclosed in ovens + * + * @param temp how hot the oven is + * @param offset the room for error +/- + * @param time how much time roughly + */ + private static CookRecipe bake(Item in, Item out, int mint, int maxt, int time, int burn_time, Item burn) { + return MineFantasyAPI.addCookingRecipe(new ItemStack(in), new ItemStack(out), new ItemStack(burn), mint, maxt, + time, burn_time, true); + } + + private static void smeltFood() { + GameRegistry.addSmelting(FoodListMF.horse_raw, new ItemStack(FoodListMF.horse_cooked), 0.2F); + GameRegistry.addSmelting(FoodListMF.wolf_raw, new ItemStack(FoodListMF.wolf_cooked), 0.2F); + GameRegistry.addSmelting(FoodListMF.generic_meat_uncooked, new ItemStack(FoodListMF.generic_meat_cooked), 0); + GameRegistry.addSmelting(FoodListMF.generic_meat_strip_uncooked, + new ItemStack(FoodListMF.generic_meat_strip_cooked), 0); + GameRegistry.addSmelting(FoodListMF.generic_meat_chunk_uncooked, + new ItemStack(FoodListMF.generic_meat_chunk_cooked), 0); + GameRegistry.addSmelting(FoodListMF.generic_meat_mince_uncooked, + new ItemStack(FoodListMF.generic_meat_mince_cooked), 0); + GameRegistry.addSmelting(FoodListMF.bowl_water_salt, new ItemStack(FoodListMF.salt), 0); + GameRegistry.addSmelting(FoodListMF.saussage_raw, new ItemStack(FoodListMF.saussage_cooked), 0); + } + + private static void addCeramics() { + bakeCeramic(ComponentListMF.clay_pot_uncooked, ComponentListMF.clay_pot, 1000, 5); + bakeCeramic(FoodListMF.jug_uncooked, FoodListMF.jug_empty, 1000, 5); + bakeCeramic(ComponentListMF.pie_tray_uncooked, FoodListMF.pie_tray, 1000, 10); + bakeCeramic(ComponentListMF.ingot_mould_uncooked, ComponentListMF.ingot_mould, 1000, 5); + bakeCeramic(ComponentListMF.mine_casing_uncooked, ComponentListMF.mine_casing, 1000, 10); + bakeCeramic(ComponentListMF.bomb_casing_uncooked, ComponentListMF.bomb_casing, 1000, 10); + + bakeCeramic(ComponentListMF.fireclay_brick, ComponentListMF.strong_brick, 1500, 5); + } + + private static CookRecipe bakeCeramic(Item clay, Item ceramic, int temp, int time) { + if (!ConfigHardcore.preventCook) { + GameRegistry.addSmelting(clay, new ItemStack(ceramic), 0F); + } + return MineFantasyAPI.addCookingRecipe(new ItemStack(clay), new ItemStack(ceramic), null, temp, 1000, time, 0, + true, false); + + } } diff --git a/src/main/java/minefantasy/mf2/recipe/CustomWoodRecipes.java b/src/main/java/minefantasy/mf2/recipe/CustomWoodRecipes.java index 6175d454..69ffb549 100644 --- a/src/main/java/minefantasy/mf2/recipe/CustomWoodRecipes.java +++ b/src/main/java/minefantasy/mf2/recipe/CustomWoodRecipes.java @@ -1,8 +1,5 @@ package minefantasy.mf2.recipe; -import java.util.ArrayList; -import java.util.Iterator; - import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.crafting.Salvage; import minefantasy.mf2.api.material.CustomMaterial; @@ -15,129 +12,85 @@ import minefantasy.mf2.knowledge.KnowledgeListMF; import net.minecraft.item.ItemStack; -public class CustomWoodRecipes -{ - public static final String basic = "step.wood"; - public static final String chopping = "dig.wood"; - public static final String sawing = "minefantasy2:block.sawcarpenter"; - public static final String nailHammer = "minefantasy2:block.hammercarpenter"; - public static final String woodHammer = "minefantasy2:block.carpentermallet"; - private static final Skill construction = SkillList.construction; - - public static void init() - { - ArrayList wood = CustomMaterial.getList("wood"); - Iterator iterator = wood.iterator(); - while(iterator.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iterator.next(); - addRecipes(customMat); - } - } - private static void addRecipes(CustomMaterial material) - { - ItemStack timber = ((ItemComponentMF)ComponentListMF.plank).construct(material.name); - ItemStack cutPlank = ((ItemComponentMF)ComponentListMF.plank_cut).construct(material.name); - ItemStack woodpane = ((ItemComponentMF)ComponentListMF.plank_pane).construct(material.name); - - ItemStack result; - int time; - - time = 5; - KnowledgeListMF.sawnPlankR.add( - MineFantasyAPI.addCarpenterRecipe(construction, cutPlank, "", sawing, "saw", material.tier, (int)(material.durability * time) , new Object[] - { - "T", - 'T', timber, - })); - - time = 20; - KnowledgeListMF.plankPaneR.add( - MineFantasyAPI.addCarpenterRecipe(construction, woodpane, "", nailHammer, "hammer", material.tier, (int)(material.durability * time) , new Object[] - { - "NNN", - "CTC", - "CTC", - 'T', timber, - 'C', cutPlank, - 'N', ComponentListMF.nail, - })); - Salvage.addSalvage(woodpane, cutPlank, cutPlank, cutPlank, cutPlank, timber, timber, new ItemStack(ComponentListMF.nail, 3)); - - time = 10; - result = ((BlockWoodDecor)BlockListMF.rack_wood).construct(material.name); - KnowledgeListMF.rackRecipe.add( - MineFantasyAPI.addCarpenterRecipe(construction, result, "", nailHammer, "hammer", material.tier, (int)(material.durability * time) , new Object[] - { - "N N", - "T T", - "CCC", - "T T", - 'N', ComponentListMF.nail, - 'T', timber, - 'C', cutPlank, - })); - Salvage.addSalvage(result, cutPlank, cutPlank, cutPlank, timber, timber, timber, timber, new ItemStack(ComponentListMF.nail, 2)); - - time = 20; - result = ((BlockWoodDecor)BlockListMF.food_box_basic).construct(material.name); - KnowledgeListMF.foodboxR.add( - MineFantasyAPI.addCarpenterRecipe(construction, result, "food_box", nailHammer, "hammer", material.tier, (int)(material.durability * time) , new Object[] - { - "HC ", - "C C", - "NCN", - 'N', ComponentListMF.nail, - 'H', ComponentListMF.hinge, - 'C', cutPlank, - })); - Salvage.addSalvage(result, cutPlank, cutPlank, cutPlank, cutPlank, new ItemStack(ComponentListMF.nail, 2), ComponentListMF.hinge); - - time = 30; - result = ((BlockWoodDecor)BlockListMF.ammo_box_basic).construct(material.name); - KnowledgeListMF.ammoboxR.add( - MineFantasyAPI.addCarpenterRecipe(construction, result, "ammo_box", nailHammer, "hammer", material.tier, (int)(material.durability * time) , new Object[] - { - "HPH", - "C C", - "NPN", - 'N', ComponentListMF.nail, - 'H', ComponentListMF.hinge, - 'P', woodpane, - 'C', cutPlank, - })); - Salvage.addSalvage(result, cutPlank, cutPlank, woodpane, woodpane, new ItemStack(ComponentListMF.nail, 2), new ItemStack(ComponentListMF.hinge, 2)); - - time = 50; - result = ((BlockWoodDecor)BlockListMF.crate_basic).construct(material.name); - KnowledgeListMF.bigboxR.add( - MineFantasyAPI.addCarpenterRecipe(construction, result, "big_box", nailHammer, "hammer", material.tier, (int)(material.durability * time) , new Object[] - { - "NNNN", - "HPPH", - "P P", - " PP ", - 'N', ComponentListMF.nail, - 'H', ComponentListMF.hinge, - 'P', woodpane, - 'C', cutPlank, - })); - Salvage.addSalvage(result, woodpane, woodpane, woodpane, woodpane, woodpane, woodpane, new ItemStack(ComponentListMF.nail, 4), new ItemStack(ComponentListMF.hinge, 2)); - - - time = 15; - result = ((BlockWoodDecor)BlockListMF.trough_wood).construct(material.name); - KnowledgeListMF.nailTroughR.add( - MineFantasyAPI.addCarpenterRecipe(construction, result, "", nailHammer, "hammer", material.tier, (int)(material.durability * time) , new Object[] - { - "P P", - "PPP", - "NNN", - 'N', ComponentListMF.nail, - 'P', timber, - })); - Salvage.addSalvage(result, timber, timber, timber, timber, timber, new ItemStack(ComponentListMF.nail, 3)); - - } +import java.util.ArrayList; +import java.util.Iterator; + +public class CustomWoodRecipes { + public static final String basic = "step.wood"; + public static final String chopping = "dig.wood"; + public static final String sawing = "minefantasy2:block.sawcarpenter"; + public static final String nailHammer = "minefantasy2:block.hammercarpenter"; + public static final String woodHammer = "minefantasy2:block.carpentermallet"; + private static final Skill construction = SkillList.construction; + + public static void init() { + ArrayList wood = CustomMaterial.getList("wood"); + Iterator iterator = wood.iterator(); + while (iterator.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iterator.next(); + addRecipes(customMat); + } + } + + private static void addRecipes(CustomMaterial material) { + ItemStack timber = ComponentListMF.plank.construct(material.name); + ItemStack cutPlank = ((ItemComponentMF) ComponentListMF.plank_cut).construct(material.name); + ItemStack woodpane = ((ItemComponentMF) ComponentListMF.plank_pane).construct(material.name); + + ItemStack result; + int time; + + time = 5; + KnowledgeListMF.sawnPlankR.add(MineFantasyAPI.addCarpenterRecipe(construction, cutPlank, "", sawing, "saw", + material.tier, (int) (material.durability * time), new Object[]{"T", 'T', timber,})); + + time = 20; + KnowledgeListMF.plankPaneR.add(MineFantasyAPI.addCarpenterRecipe(construction, woodpane, "", nailHammer, + "hammer", material.tier, (int) (material.durability * time), + new Object[]{"NNN", "CTC", "CTC", 'T', timber, 'C', cutPlank, 'N', ComponentListMF.nail,})); + Salvage.addSalvage(woodpane, cutPlank, cutPlank, cutPlank, cutPlank, timber, timber, + new ItemStack(ComponentListMF.nail, 3)); + + time = 10; + result = ((BlockWoodDecor) BlockListMF.rack_wood).construct(material.name); + KnowledgeListMF.rackRecipe.add(MineFantasyAPI.addCarpenterRecipe(construction, result, "", nailHammer, "hammer", + material.tier, (int) (material.durability * time), + new Object[]{"N N", "T T", "CCC", "T T", 'N', ComponentListMF.nail, 'T', timber, 'C', cutPlank,})); + Salvage.addSalvage(result, cutPlank, cutPlank, cutPlank, timber, timber, timber, timber, + new ItemStack(ComponentListMF.nail, 2)); + + time = 20; + result = ((BlockWoodDecor) BlockListMF.food_box_basic).construct(material.name); + KnowledgeListMF.foodboxR.add(MineFantasyAPI.addCarpenterRecipe(construction, result, "food_box", nailHammer, + "hammer", material.tier, (int) (material.durability * time), new Object[]{"HC ", "C C", "NCN", 'N', + ComponentListMF.nail, 'H', ComponentListMF.hinge, 'C', cutPlank,})); + Salvage.addSalvage(result, cutPlank, cutPlank, cutPlank, cutPlank, new ItemStack(ComponentListMF.nail, 2), + ComponentListMF.hinge); + + time = 30; + result = ((BlockWoodDecor) BlockListMF.ammo_box_basic).construct(material.name); + KnowledgeListMF.ammoboxR.add(MineFantasyAPI.addCarpenterRecipe(construction, result, "ammo_box", nailHammer, + "hammer", material.tier, (int) (material.durability * time), new Object[]{"HPH", "C C", "NPN", 'N', + ComponentListMF.nail, 'H', ComponentListMF.hinge, 'P', woodpane, 'C', cutPlank,})); + Salvage.addSalvage(result, cutPlank, cutPlank, woodpane, woodpane, new ItemStack(ComponentListMF.nail, 2), + new ItemStack(ComponentListMF.hinge, 2)); + + time = 50; + result = ((BlockWoodDecor) BlockListMF.crate_basic).construct(material.name); + KnowledgeListMF.bigboxR.add( + MineFantasyAPI.addCarpenterRecipe(construction, result, "big_box", nailHammer, "hammer", material.tier, + (int) (material.durability * time), new Object[]{"NNNN", "HPPH", "P P", " PP ", 'N', + ComponentListMF.nail, 'H', ComponentListMF.hinge, 'P', woodpane, 'C', cutPlank,})); + Salvage.addSalvage(result, woodpane, woodpane, woodpane, woodpane, woodpane, woodpane, + new ItemStack(ComponentListMF.nail, 4), new ItemStack(ComponentListMF.hinge, 2)); + + time = 15; + result = ((BlockWoodDecor) BlockListMF.trough_wood).construct(material.name); + KnowledgeListMF.nailTroughR.add(MineFantasyAPI.addCarpenterRecipe(construction, result, "", nailHammer, + "hammer", material.tier, (int) (material.durability * time), + new Object[]{"P P", "PPP", "NNN", 'N', ComponentListMF.nail, 'P', timber,})); + Salvage.addSalvage(result, timber, timber, timber, timber, timber, new ItemStack(ComponentListMF.nail, 3)); + + } } diff --git a/src/main/java/minefantasy/mf2/recipe/ForgedArmourRecipes.java b/src/main/java/minefantasy/mf2/recipe/ForgedArmourRecipes.java index 38164b29..d631b8e0 100644 --- a/src/main/java/minefantasy/mf2/recipe/ForgedArmourRecipes.java +++ b/src/main/java/minefantasy/mf2/recipe/ForgedArmourRecipes.java @@ -1,412 +1,256 @@ package minefantasy.mf2.recipe; -import java.util.ArrayList; -import java.util.Iterator; - import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.crafting.Salvage; -import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.rpg.Skill; import minefantasy.mf2.api.rpg.SkillList; import minefantasy.mf2.item.list.ArmourListMF; import minefantasy.mf2.item.list.ComponentListMF; import minefantasy.mf2.item.list.CustomArmourListMF; import minefantasy.mf2.knowledge.KnowledgeListMF; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class ForgedArmourRecipes -{ - private static final Skill artisanry = SkillList.artisanry; - private static final Skill engineering = SkillList.engineering; - private static final Skill construction = SkillList.construction; - public static void init() - { - addMetalComponents(); - assembleChainmail(); - assembleScalemail(); - assembleSplintmail(); - assembleFieldplate(); - assembleCogPlating(); - } - - private static void assembleChainmail() - { - Item helm = ArmourListMF.armourItem(ArmourListMF.leather, 2, 0); - Item chest = ArmourListMF.armourItem(ArmourListMF.leather, 2, 1); - Item legs = ArmourListMF.armourItem(ArmourListMF.leather, 2, 2); - Item boots = ArmourListMF.armourItem(ArmourListMF.leather, 2, 3); - - Item mail = ComponentListMF.chainmesh; - Item rivet = ComponentListMF.rivet; - - int time = 20; - KnowledgeListMF.mailHelmetR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_chain_helmet), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "RMR", - "MPM", - "RMR", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(helm, 1, 0) - })); - time = 30; - KnowledgeListMF.mailChestR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_chain_chest), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "RM MR", - "RMPMR", - "RM MR", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(chest, 1, 0) - })); - time = 20; - KnowledgeListMF.mailLegsR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_chain_legs), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "RMPMR", - "RM MR", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(legs, 1, 0) - })); - time = 10; - KnowledgeListMF.mailBootsR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_chain_boots), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "R R", - "MPM", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(boots, 1, 0) - })); - Salvage.addSalvage(CustomArmourListMF.standard_chain_helmet,helm, - mail, mail, mail, mail,//4 Mail - rivet, rivet, rivet, rivet);//4 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_chain_chest,chest, - mail, mail, mail, mail, mail, mail,//6 Mail - rivet, rivet, rivet, rivet, rivet, rivet);// 6 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_chain_legs,legs, - mail, mail, mail, mail,//4 Mail - rivet, rivet, rivet, rivet);//4 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_chain_boots,boots, - mail, mail,//2 Mail - rivet, rivet);//2 Rivet - } - - private static void assembleScalemail() - { - Item helm = ArmourListMF.armourItem(ArmourListMF.leather, 2, 0); - Item chest = ArmourListMF.armourItem(ArmourListMF.leather, 2, 1); - Item legs = ArmourListMF.armourItem(ArmourListMF.leather, 2, 2); - Item boots = ArmourListMF.armourItem(ArmourListMF.leather, 2, 3); - - ItemStack mail = new ItemStack(ComponentListMF.scalemesh); - Item rivet = ComponentListMF.rivet; - - int time = 20; - KnowledgeListMF.scaleHelmetR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_scale_helmet), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "RMR", - "MPM", - "RMR", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(helm, 1, 0) - })); - time = 30; - KnowledgeListMF.scaleChestR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_scale_chest), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "RM MR", - "RMPMR", - "RM MR", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(chest, 1, 0) - })); - time = 20; - KnowledgeListMF.scaleLegsR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_scale_legs), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "RMPMR", - "RM MR", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(legs, 1, 0) - })); - time = 10; - KnowledgeListMF.scaleBootsR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_scale_boots), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "R R", - "MPM", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(boots, 1, 0) - })); - Salvage.addSalvage(CustomArmourListMF.standard_scale_helmet,helm, - mail, mail, mail, mail,//4 Mail - rivet, rivet, rivet, rivet);//4 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_scale_chest,chest, - mail, mail, mail, mail, mail, mail,//6 Mail - rivet, rivet, rivet, rivet, rivet, rivet);// 6 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_scale_legs,legs, - mail, mail, mail, mail,//4 Mail - rivet, rivet, rivet, rivet);//4 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_scale_boots,boots, - mail, mail,//2 Mail - rivet, rivet);//2 Rivet - } - - private static void assembleSplintmail() - { - Item helm = ArmourListMF.armourItem(ArmourListMF.leather, 4, 0); - Item chest = ArmourListMF.armourItem(ArmourListMF.leather, 4, 1); - Item legs = ArmourListMF.armourItem(ArmourListMF.leather, 4, 2); - Item boots = ArmourListMF.armourItem(ArmourListMF.leather, 4, 3); - - ItemStack mail = new ItemStack(ComponentListMF.splintmesh); - Item rivet = ComponentListMF.rivet; - - int time = 20; - KnowledgeListMF.splintHelmetR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_splint_helmet), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "RMR", - "MPM", - "RMR", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(helm, 1, 0) - })); - time = 30; - KnowledgeListMF.splintChestR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_splint_chest), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "RM MR", - "RMPMR", - "RM MR", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(chest, 1, 0) - })); - time = 20; - KnowledgeListMF.splintLegsR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_splint_legs), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "RMPMR", - "RM MR", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(legs, 1, 0) - })); - time = 10; - KnowledgeListMF.splintBootsR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_splint_boots), "craftArmourMedium", true, "hammer", -1, -1, time, new Object[] - { - "R R", - "MPM", - - 'R', rivet, - 'M', mail, - 'P', new ItemStack(boots, 1, 0) - })); - Salvage.addSalvage(CustomArmourListMF.standard_splint_helmet,helm, - mail, mail, mail, mail,//4 Mail - rivet, rivet, rivet, rivet);//4 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_splint_chest,chest, - mail, mail, mail, mail, mail, mail,//6 Mail - rivet, rivet, rivet, rivet, rivet, rivet);// 6 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_splint_legs,legs, - mail, mail, mail, mail,//4 Mail - rivet, rivet, rivet, rivet);//4 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_splint_boots,boots, - mail, mail,//2 Mail - rivet, rivet);//2 Rivet - } - - private static void assembleFieldplate() - { - Item helm = ArmourListMF.armourItem(ArmourListMF.leather, 4, 0); - Item chest = ArmourListMF.armourItem(ArmourListMF.leather, 4, 1); - Item legs = ArmourListMF.armourItem(ArmourListMF.leather, 4, 2); - Item boots = ArmourListMF.armourItem(ArmourListMF.leather, 4, 3); - - ItemStack plate = new ItemStack(ComponentListMF.plate); - Item rivet = ComponentListMF.rivet; - - int time = 40; - KnowledgeListMF.plateHelmetR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_plate_helmet), "craftArmourHeavy", false, "hammer", -1, -1, time, new Object[] - { - " R ", - "PHP", - " R ", - - 'R', rivet, - 'P', plate, - 'H', new ItemStack(helm, 1, 0), - })); - time = 60; - KnowledgeListMF.plateChestR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_plate_chest), "craftArmourHeavy", false, "hammer", -1, -1, time, new Object[] - { - "RP PR", - "RPCPR", - - 'R', rivet, - 'P', plate, - 'C', new ItemStack(chest, 1, 0), - })); - time = 40; - KnowledgeListMF.plateLegsR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_plate_legs), "craftArmourHeavy", false, "hammer", -1, -1, time, new Object[] - { - "RPLPR", - "RP PR", - - 'R', rivet, - 'P', plate, - 'L', new ItemStack(legs, 1, 0), - })); - time = 20; - KnowledgeListMF.plateBootsR.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_plate_boots), "craftArmourHeavy", false, "hammer", -1, -1, time, new Object[] - { - "R R", - "PBP", - - 'R', rivet, - 'P', plate, - 'B', new ItemStack(boots, 1, 0), - })); - - - Salvage.addSalvage(CustomArmourListMF.standard_plate_helmet,helm, - plate, plate,//2 Plate - rivet, rivet);// Rivet - Salvage.addSalvage(CustomArmourListMF.standard_plate_chest,chest, - plate, plate, plate, plate,//4 Plate - rivet, rivet, rivet, rivet);// 4 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_plate_legs,legs, - plate, plate, plate, plate,//4 Plate - rivet, rivet, rivet, rivet);//4 Rivet - Salvage.addSalvage(CustomArmourListMF.standard_plate_boots ,boots, - plate, plate,//2 Plate - rivet, rivet);//2 Rivet - - } - - - private static void assembleCogPlating() - { - - ItemStack minorPiece = new ItemStack(ComponentListMF.plate); - ItemStack majorPiece = new ItemStack(ComponentListMF.plate_huge); - - int time = 4; - KnowledgeListMF.hugePlateR.add( - MineFantasyAPI.addAnvilToolRecipe(engineering, majorPiece, "cogArmour", true, "hvyhammer", -1, -1, time, new Object[] - { - " RR ", - "RIIR", - 'R', ComponentListMF.rivet, - 'I', minorPiece - })); - - Salvage.addSalvage(majorPiece, - minorPiece, minorPiece, - new ItemStack(ComponentListMF.rivet, 4) - ); - - - time = 25; - KnowledgeListMF.cogPlateR.add( - MineFantasyAPI.addAnvilToolRecipe(engineering, new ItemStack(ComponentListMF.cogwork_armour), "cogArmour", true, "hvyhammer", -1, -1, time, new Object[] - { - " P ", - "pPPPp", - "p P p", - " pPp ", - - 'p', minorPiece, - 'P', majorPiece, - })); - - Salvage.addSalvage(ComponentListMF.cogwork_armour, - minorPiece, minorPiece, minorPiece, minorPiece, minorPiece, minorPiece, - majorPiece, majorPiece, majorPiece, majorPiece, majorPiece, majorPiece - ); - } - - private static void addMetalComponents() - { - Item hunk = ComponentListMF.metalHunk; - Item bar = ComponentListMF.bar; - - int time = 3; - KnowledgeListMF.mailRecipes.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(ComponentListMF.chainmesh), "", true, "hammer", -1, -1, time, new Object[] - { - " H ", - "H H", - " H ", - - 'H', hunk - })); - time = 3; - KnowledgeListMF.scaleRecipes.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(ComponentListMF.scalemesh), "", true, "hammer", -1, -1, time, new Object[] - { - "HHH", - " H ", - - 'H', hunk - })); - time = 4; - KnowledgeListMF.splintRecipes.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(ComponentListMF.splintmesh), "", true, "hammer", -1, -1, time, new Object[] - { - "RHR", - " H ", - " H ", - " H ", - - 'H', hunk, - 'R', ComponentListMF.rivet, - })); - time = 4; - KnowledgeListMF.plateRecipes.add( - MineFantasyAPI.addAnvilToolRecipe(artisanry, ComponentListMF.plate, "", true, "hvyhammer", -1, -1, time, new Object[] - { - "FF", - "II", - 'F', ComponentListMF.flux, - 'I', bar - })); - - Salvage.addSalvage(ComponentListMF.chainmesh, hunk); - Salvage.addSalvage(ComponentListMF.scalemesh, hunk); - Salvage.addSalvage(ComponentListMF.splintmesh, hunk, ComponentListMF.rivet, ComponentListMF.rivet); - Salvage.addSalvage(ComponentListMF.plate, bar, bar); - } + +public class ForgedArmourRecipes { + private static final Skill artisanry = SkillList.artisanry; + private static final Skill engineering = SkillList.engineering; + private static final Skill construction = SkillList.construction; + + public static void init() { + addMetalComponents(); + assembleChainmail(); + assembleScalemail(); + assembleSplintmail(); + assembleFieldplate(); + assembleCogPlating(); + } + + private static void assembleChainmail() { + Item helm = ArmourListMF.armourItem(ArmourListMF.leather, 2, 0); + Item chest = ArmourListMF.armourItem(ArmourListMF.leather, 2, 1); + Item legs = ArmourListMF.armourItem(ArmourListMF.leather, 2, 2); + Item boots = ArmourListMF.armourItem(ArmourListMF.leather, 2, 3); + + Item mail = ComponentListMF.chainmesh; + Item rivet = ComponentListMF.rivet; + + int time = 20; + KnowledgeListMF.mailHelmetR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_chain_helmet), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"RMR", "MPM", "RMR", + + 'R', rivet, 'M', mail, 'P', new ItemStack(helm, 1, 0)})); + time = 30; + KnowledgeListMF.mailChestR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_chain_chest), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"RM MR", "RMPMR", "RM MR", + + 'R', rivet, 'M', mail, 'P', new ItemStack(chest, 1, 0)})); + time = 20; + KnowledgeListMF.mailLegsR + .add(MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_chain_legs), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"RMPMR", "RM MR", + + 'R', rivet, 'M', mail, 'P', new ItemStack(legs, 1, 0)})); + time = 10; + KnowledgeListMF.mailBootsR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_chain_boots), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"R R", "MPM", + + 'R', rivet, 'M', mail, 'P', new ItemStack(boots, 1, 0)})); + Salvage.addSalvage(CustomArmourListMF.standard_chain_helmet, helm, mail, mail, mail, mail, // 4 Mail + rivet, rivet, rivet, rivet);// 4 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_chain_chest, chest, mail, mail, mail, mail, mail, mail, // 6 Mail + rivet, rivet, rivet, rivet, rivet, rivet);// 6 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_chain_legs, legs, mail, mail, mail, mail, // 4 Mail + rivet, rivet, rivet, rivet);// 4 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_chain_boots, boots, mail, mail, // 2 Mail + rivet, rivet);// 2 Rivet + } + + private static void assembleScalemail() { + Item helm = ArmourListMF.armourItem(ArmourListMF.leather, 2, 0); + Item chest = ArmourListMF.armourItem(ArmourListMF.leather, 2, 1); + Item legs = ArmourListMF.armourItem(ArmourListMF.leather, 2, 2); + Item boots = ArmourListMF.armourItem(ArmourListMF.leather, 2, 3); + + ItemStack mail = new ItemStack(ComponentListMF.scalemesh); + Item rivet = ComponentListMF.rivet; + + int time = 20; + KnowledgeListMF.scaleHelmetR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_scale_helmet), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"RMR", "MPM", "RMR", + + 'R', rivet, 'M', mail, 'P', new ItemStack(helm, 1, 0)})); + time = 30; + KnowledgeListMF.scaleChestR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_scale_chest), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"RM MR", "RMPMR", "RM MR", + + 'R', rivet, 'M', mail, 'P', new ItemStack(chest, 1, 0)})); + time = 20; + KnowledgeListMF.scaleLegsR + .add(MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_scale_legs), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"RMPMR", "RM MR", + + 'R', rivet, 'M', mail, 'P', new ItemStack(legs, 1, 0)})); + time = 10; + KnowledgeListMF.scaleBootsR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_scale_boots), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"R R", "MPM", + + 'R', rivet, 'M', mail, 'P', new ItemStack(boots, 1, 0)})); + Salvage.addSalvage(CustomArmourListMF.standard_scale_helmet, helm, mail, mail, mail, mail, // 4 Mail + rivet, rivet, rivet, rivet);// 4 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_scale_chest, chest, mail, mail, mail, mail, mail, mail, // 6 Mail + rivet, rivet, rivet, rivet, rivet, rivet);// 6 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_scale_legs, legs, mail, mail, mail, mail, // 4 Mail + rivet, rivet, rivet, rivet);// 4 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_scale_boots, boots, mail, mail, // 2 Mail + rivet, rivet);// 2 Rivet + } + + private static void assembleSplintmail() { + Item helm = ArmourListMF.armourItem(ArmourListMF.leather, 4, 0); + Item chest = ArmourListMF.armourItem(ArmourListMF.leather, 4, 1); + Item legs = ArmourListMF.armourItem(ArmourListMF.leather, 4, 2); + Item boots = ArmourListMF.armourItem(ArmourListMF.leather, 4, 3); + + ItemStack mail = new ItemStack(ComponentListMF.splintmesh); + Item rivet = ComponentListMF.rivet; + + int time = 20; + KnowledgeListMF.splintHelmetR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_splint_helmet), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"RMR", "MPM", "RMR", + + 'R', rivet, 'M', mail, 'P', new ItemStack(helm, 1, 0)})); + time = 30; + KnowledgeListMF.splintChestR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_splint_chest), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"RM MR", "RMPMR", "RM MR", + + 'R', rivet, 'M', mail, 'P', new ItemStack(chest, 1, 0)})); + time = 20; + KnowledgeListMF.splintLegsR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_splint_legs), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"RMPMR", "RM MR", + + 'R', rivet, 'M', mail, 'P', new ItemStack(legs, 1, 0)})); + time = 10; + KnowledgeListMF.splintBootsR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_splint_boots), + "craftArmourMedium", true, "hammer", -1, -1, time, new Object[]{"R R", "MPM", + + 'R', rivet, 'M', mail, 'P', new ItemStack(boots, 1, 0)})); + Salvage.addSalvage(CustomArmourListMF.standard_splint_helmet, helm, mail, mail, mail, mail, // 4 Mail + rivet, rivet, rivet, rivet);// 4 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_splint_chest, chest, mail, mail, mail, mail, mail, mail, // 6 + // Mail + rivet, rivet, rivet, rivet, rivet, rivet);// 6 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_splint_legs, legs, mail, mail, mail, mail, // 4 Mail + rivet, rivet, rivet, rivet);// 4 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_splint_boots, boots, mail, mail, // 2 Mail + rivet, rivet);// 2 Rivet + } + + private static void assembleFieldplate() { + Item helm = ArmourListMF.armourItem(ArmourListMF.leather, 4, 0); + Item chest = ArmourListMF.armourItem(ArmourListMF.leather, 4, 1); + Item legs = ArmourListMF.armourItem(ArmourListMF.leather, 4, 2); + Item boots = ArmourListMF.armourItem(ArmourListMF.leather, 4, 3); + + ItemStack plate = new ItemStack(ComponentListMF.plate); + Item rivet = ComponentListMF.rivet; + + int time = 40; + KnowledgeListMF.plateHelmetR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_plate_helmet), + "craftArmourHeavy", false, "hammer", -1, -1, time, new Object[]{" R ", "PHP", " R ", + + 'R', rivet, 'P', plate, 'H', new ItemStack(helm, 1, 0),})); + time = 60; + KnowledgeListMF.plateChestR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_plate_chest), + "craftArmourHeavy", false, "hammer", -1, -1, time, new Object[]{"RP PR", "RPCPR", + + 'R', rivet, 'P', plate, 'C', new ItemStack(chest, 1, 0),})); + time = 40; + KnowledgeListMF.plateLegsR + .add(MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_plate_legs), + "craftArmourHeavy", false, "hammer", -1, -1, time, new Object[]{"RPLPR", "RP PR", + + 'R', rivet, 'P', plate, 'L', new ItemStack(legs, 1, 0),})); + time = 20; + KnowledgeListMF.plateBootsR.add( + MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(CustomArmourListMF.standard_plate_boots), + "craftArmourHeavy", false, "hammer", -1, -1, time, new Object[]{"R R", "PBP", + + 'R', rivet, 'P', plate, 'B', new ItemStack(boots, 1, 0),})); + + Salvage.addSalvage(CustomArmourListMF.standard_plate_helmet, helm, plate, plate, // 2 Plate + rivet, rivet);// Rivet + Salvage.addSalvage(CustomArmourListMF.standard_plate_chest, chest, plate, plate, plate, plate, // 4 Plate + rivet, rivet, rivet, rivet);// 4 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_plate_legs, legs, plate, plate, plate, plate, // 4 Plate + rivet, rivet, rivet, rivet);// 4 Rivet + Salvage.addSalvage(CustomArmourListMF.standard_plate_boots, boots, plate, plate, // 2 Plate + rivet, rivet);// 2 Rivet + + } + + private static void assembleCogPlating() { + + ItemStack minorPiece = new ItemStack(ComponentListMF.plate); + ItemStack majorPiece = new ItemStack(ComponentListMF.plate_huge); + + int time = 4; + KnowledgeListMF.hugePlateR + .add(MineFantasyAPI.addAnvilToolRecipe(engineering, majorPiece, "cogArmour", true, "hvyhammer", -1, -1, + time, new Object[]{" RR ", "RIIR", 'R', ComponentListMF.rivet, 'I', minorPiece})); + + Salvage.addSalvage(majorPiece, minorPiece, minorPiece, new ItemStack(ComponentListMF.rivet, 4)); + + time = 25; + KnowledgeListMF.cogPlateR + .add(MineFantasyAPI.addAnvilToolRecipe(engineering, new ItemStack(ComponentListMF.cogwork_armour), + "cogArmour", true, "hvyhammer", -1, -1, time, new Object[]{" P ", "pPPPp", "p P p", " pPp ", + + 'p', minorPiece, 'P', majorPiece,})); + + Salvage.addSalvage(ComponentListMF.cogwork_armour, minorPiece, minorPiece, minorPiece, minorPiece, minorPiece, + minorPiece, majorPiece, majorPiece, majorPiece, majorPiece, majorPiece, majorPiece); + } + + private static void addMetalComponents() { + Item hunk = ComponentListMF.metalHunk; + Item bar = ComponentListMF.bar; + + int time = 3; + KnowledgeListMF.mailRecipes + .add(MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(ComponentListMF.chainmesh), "", true, + "hammer", -1, -1, time, new Object[]{" H ", "H H", " H ", + + 'H', hunk})); + time = 3; + KnowledgeListMF.scaleRecipes.add(MineFantasyAPI.addAnvilToolRecipe(artisanry, + new ItemStack(ComponentListMF.scalemesh), "", true, "hammer", -1, -1, time, new Object[]{"HHH", " H ", + + 'H', hunk})); + time = 4; + KnowledgeListMF.splintRecipes + .add(MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(ComponentListMF.splintmesh), "", true, + "hammer", -1, -1, time, new Object[]{"RHR", " H ", " H ", " H ", + + 'H', hunk, 'R', ComponentListMF.rivet,})); + time = 4; + KnowledgeListMF.plateRecipes.add(MineFantasyAPI.addAnvilToolRecipe(artisanry, ComponentListMF.plate, "", true, + "hvyhammer", -1, -1, time, new Object[]{"FF", "II", 'F', ComponentListMF.flux, 'I', bar})); + + Salvage.addSalvage(ComponentListMF.chainmesh, hunk); + Salvage.addSalvage(ComponentListMF.scalemesh, hunk); + Salvage.addSalvage(ComponentListMF.splintmesh, hunk, ComponentListMF.rivet, ComponentListMF.rivet); + Salvage.addSalvage(ComponentListMF.plate, bar, bar); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/recipe/ForgedToolRecipes.java b/src/main/java/minefantasy/mf2/recipe/ForgedToolRecipes.java index b27c8a65..20efcee2 100644 --- a/src/main/java/minefantasy/mf2/recipe/ForgedToolRecipes.java +++ b/src/main/java/minefantasy/mf2/recipe/ForgedToolRecipes.java @@ -1,11 +1,6 @@ package minefantasy.mf2.recipe; -import java.util.ArrayList; -import java.util.Iterator; - -import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.api.MineFantasyAPI; -import minefantasy.mf2.api.crafting.BasicTierRecipe; import minefantasy.mf2.api.crafting.Salvage; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.api.rpg.Skill; @@ -20,775 +15,430 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class ForgedToolRecipes -{ - private static final Skill artisanry = SkillList.artisanry; - private static final Skill engineering = SkillList.engineering; - private static final Skill construction = SkillList.construction; - public static void init() - { - CarpenterRecipes.initTierWood(); - addStandardTools(); - addStandardCrafters(); - addStandardWeapons(); - addComponentTools(); - addMetalComponents(); - - ArrayList metal = CustomMaterial.getList("metal"); - ArrayList wood = CustomMaterial.getList("wood"); - - Iterator iteratorMetal = metal.iterator(); - - while(iteratorMetal.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); - ItemStack bar = ComponentListMF.bar.createComm(customMat.name); - for(ItemStack ingot: OreDictionary.getOres("ingot"+customMat.name)) - { - KnowledgeListMF.barR.add( - MineFantasyAPI.addAnvilRecipe(artisanry, bar, "", true, "hammer", -1, -1, (int)(customMat.craftTimeModifier/2F), new Object[] - { - "I", - 'I', ingot, - })); - } - - ItemStack defaultIngot = customMat.getItem(); - if(defaultIngot != null) - { - KnowledgeListMF.baringotR.add( - MineFantasyAPI.addAnvilRecipe(artisanry, defaultIngot, "", true, "hammer", -1, -1, (int)(customMat.craftTimeModifier/2F), new Object[] - { - "I", - 'I', bar, - })); - } - } - - KnowledgeListMF.tinderboxR = - MineFantasyAPI.addAnvilRecipe(null, new ItemStack(ToolListMF.tinderbox), "", true, "hammer", 0, 0, 10, new Object[]{ - " F ", - "SWS", - " I ", - 'F', Items.flint, - 'S', Items.stick, - 'W', Blocks.wool, - 'I', ComponentListMF.bar("Iron"), - }); - KnowledgeListMF.flintAndSteelR = - MineFantasyAPI.addAnvilRecipe(null, new ItemStack(Items.flint_and_steel), "", true, "hammer", 0, 0, 10, new Object[]{ - " F", - "IC ", - " I ", - 'F', Items.flint, - 'C', Items.coal, - 'I', ComponentListMF.bar("Steel"), - }); - Salvage.addSalvage(ToolListMF.tinderbox, Items.flint, Items.stick, Blocks.wool, ComponentListMF.bar("Iron")); - Salvage.addSalvage(Items.flint_and_steel, Items.flint, ComponentListMF.bar("Steel")); - } - - private static void addMetalComponents() - { - int time = 2; - Item bar = ComponentListMF.bar; - Item hunk = ComponentListMF.metalHunk; - - KnowledgeListMF.hunkR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(hunk, 4), "", true, "hammer", 0, 0, time, new Object[] - { - "F", - "I", - 'F', ComponentListMF.flux, - 'I', bar, - }); - - KnowledgeListMF.ingotR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, bar, "", true, "hammer", 0, 0, time, new Object[] - { - "II", - "II", - 'I', hunk - }); - - time = 8; - int count = 1; - KnowledgeListMF.bucketR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(Items.bucket, count), "", true, "hammer", 0, 0, time, new Object[] - { - "I I", - " I ", - 'I', bar, - }); - } - - private static void addComponentTools() - { - Item bar = ComponentListMF.bar; - Item plank = ComponentListMF.plank; - Item strip = ComponentListMF.leather_strip; - Item rivet = ComponentListMF.rivet; - Item hunk = ComponentListMF.metalHunk; - - int time = 10; - - KnowledgeListMF.nailR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.nail, 16), "", true, "hammer", -1, -1, time, new Object[] - { - "HH", - " H", - " H", - - 'H', hunk - }); - KnowledgeListMF.rivetR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.rivet, 8), "", true, "hammer", -1, -1, time, new Object[] - { - "H H", - " H ", - " H ", - - 'H', hunk - }); - - KnowledgeListMF.needleR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_needle, "tier", true, "hammer", -1, -1, time, new Object[] - { - "H", - "H", - "H", - "H", - - 'H', hunk - }); - Salvage.addSalvage(CustomToolListMF.standard_needle, bar); - - time = 3; - KnowledgeListMF.crossBoltR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_bolt, "tier", true, "hammer", -1, -1, time, new Object[] - { - "H", - "F", - - 'F', ComponentListMF.fletching, - 'H', hunk - }); - time = 2; - KnowledgeListMF.arrowheadR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(ComponentListMF.arrowhead, 4), "tier", true, "hammer", -1, -1, time, new Object[] - { - "H ", - "HH", - "H ", - - 'H', hunk - }); - time = 5; - KnowledgeListMF.bodkinheadR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(ComponentListMF.bodkinhead, 4), "tier", true, "hammer", -1, -1, time, new Object[] - { - "H ", - " HH", - "H ", - - 'H', hunk - }); - time = 5; - KnowledgeListMF.broadheadR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(ComponentListMF.broadhead, 4), "tier", true, "hammer", -1, -1, time, new Object[] - { - "H ", - " H", - " H", - "H ", - - 'H', hunk - }); - Salvage.addSalvage(CustomToolListMF.standard_bolt, ComponentListMF.fletching, hunk); - Salvage.addSalvage(ComponentListMF.arrowhead, hunk); - Salvage.addSalvage(ComponentListMF.bodkinhead, hunk); - Salvage.addSalvage(ComponentListMF.broadhead, hunk); - - - time = 1; - KnowledgeListMF.arrowR.add( - MineFantasyAPI.addCarpenterToolRecipe(artisanry, CustomToolListMF.standard_arrow, "arrows", "dig.wood", 1, new Object[] - { - "H", - "F", - - 'F', ComponentListMF.fletching, - 'H', ComponentListMF.arrowhead - })); - KnowledgeListMF.arrowR.add( - MineFantasyAPI.addCarpenterToolRecipe(artisanry, CustomToolListMF.standard_arrow_bodkin, "arrowsBodkin", "dig.wood", 1, new Object[] - { - "H", - "F", - - 'F', ComponentListMF.fletching, - 'H', ComponentListMF.bodkinhead - })); - KnowledgeListMF.arrowR.add( - MineFantasyAPI.addCarpenterToolRecipe(artisanry, CustomToolListMF.standard_arrow_broad, "arrowsBroad", "dig.wood", 1, new Object[] - { - "H", - "F", - - 'F', ComponentListMF.fletching, - 'H', ComponentListMF.broadhead - })); - Salvage.addSalvage(CustomToolListMF.standard_arrow, ComponentListMF.arrowhead, ComponentListMF.fletching); - Salvage.addSalvage(CustomToolListMF.standard_arrow_bodkin, ComponentListMF.bodkinhead, ComponentListMF.fletching); - Salvage.addSalvage(CustomToolListMF.standard_arrow_broad, ComponentListMF.broadhead, ComponentListMF.fletching); - - } - - private static void addStandardTools() - { - Item bar = ComponentListMF.bar; - Item plank = ComponentListMF.plank; - Item strip = ComponentListMF.leather_strip; - Item rivet = ComponentListMF.rivet; - - int time = 15; - KnowledgeListMF.pickR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_pick, "tier", true, "hammer", -1, -1, time, new Object[] - { - "L I", - "PPI", - "L I", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_pick, - bar, bar, bar, - plank, plank, - strip, strip); - - time = 15; - KnowledgeListMF.axeR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_axe, "tier", true, "hammer", -1, -1, time, new Object[] - { - "LII", - "PPI", - "L ", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_axe, - bar, bar, bar, - plank, plank, - strip, strip); - - time = 12; - KnowledgeListMF.hoeR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hoe, "tier", true, "hammer", -1, -1, time, new Object[] - { - "L I", - "PPI", - "L ", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_hoe, - bar, bar, - plank, plank, - strip, strip); - - time = 10; - KnowledgeListMF.spadeR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_spade, "tier", true, "hammer", -1, -1, time, new Object[] - { - "L ", - "PPI", - "L ", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_spade, - bar, - plank, plank, - strip, strip); - - //ADVANCED - time = 25; - KnowledgeListMF.hvyPickR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hvypick, "tier", true, "hvyhammer", -1, -1, time, new Object[] - { - "LR I", - "PPII", - "LRII", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_hvypick, - bar, bar, bar, bar, bar, - plank, plank, - strip, strip, - rivet, rivet); - - time = 15; - KnowledgeListMF.handpickR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_handpick, "tier", true, "hammer", -1, -1, time, new Object[] - { - "LI ", - "PIR", - "L ", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_handpick, - bar, bar, - plank, - strip, strip, - rivet); - - time = 25; - KnowledgeListMF.hvyShovelR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hvyshovel, "tier", true, "hvyhammer", -1, -1, time, new Object[] - { - "LRII", - "PPII", - "LRII", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_hvyshovel, - bar, bar, bar, bar, bar, bar, - plank, plank, - strip, strip, - rivet, rivet); - - time = 15; - KnowledgeListMF.trowR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_trow, "tier", true, "hammer", -1, -1, time, new Object[] - { - "L ", - "PIR", - "L ", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_trow, - bar, - plank, - strip, strip, - rivet); - - time = 30; - KnowledgeListMF.scytheR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_scythe, "tier", true, "hvyhammer", -1, -1, time, new Object[] - { - " I ", - "L PIR", - "PPPIR", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_scythe, - bar, bar, bar, - plank, plank, plank, plank, - strip, - rivet, rivet); - - time = 14; - KnowledgeListMF.mattockR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_mattock, "tier", true, "hammer", -1, -1, time, new Object[] - { - "L I", - "PPI", - "LIR", - - 'I', bar, - 'P', plank, - 'L', strip, - 'R', rivet - }); - Salvage.addSalvage(CustomToolListMF.standard_mattock, - bar, bar, bar, rivet, - plank, plank, - strip, strip); - - time = 15; - KnowledgeListMF.lumberR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_lumber, "tier", true, "hvyHammer", -1, -1, time, new Object[] - { - "L IIR", - "PPPIR", - "L R", - - 'I', bar, - 'P', plank, - 'L', strip, - 'R', rivet - }); - Salvage.addSalvage(CustomToolListMF.standard_lumber, - bar, bar, bar, rivet, rivet, rivet, - plank, plank, plank, - strip, strip); - } - - - private static void addStandardCrafters() - { - Item bar = ComponentListMF.bar; - Item plank = ComponentListMF.plank; - Item strip = ComponentListMF.leather_strip; - Item rivet = ComponentListMF.rivet; - - int time = 10; - KnowledgeListMF.hammerR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hammer, "tier", true, "hammer", 0, 0, time, new Object[] - { - "I", - "L", - "P", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_hammer, - bar, - plank, - strip); - - time = 15; - KnowledgeListMF.hvyHammerR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hvyhammer, "tier", true, "hammer", -1, -1, time, new Object[] - { - " II", - "RLI", - " P ", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_hvyhammer, - bar, bar, bar, - plank, - strip, - rivet); - - time = 10; - KnowledgeListMF.tongsR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_tongs, "tier", true, "hammer", -1, -1, time, new Object[] - { - "I ", - " I", - - 'I', bar, - }); - Salvage.addSalvage(CustomToolListMF.standard_tongs, - bar, bar); - - time = 10; - KnowledgeListMF.knifeR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_knife, "tier", true, "hammer", -1, -1, time, new Object[] - { - "I ", - "PL", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_knife, - bar, bar, - plank, - strip); - - time = 12; - KnowledgeListMF.shearsR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_shears, "tier", true, "hammer", -1, -1, time, new Object[] - { - " I ", - "PLI", - " P ", - - 'I', bar, - 'P', plank, - 'L', Items.leather, - }); - Salvage.addSalvage(CustomToolListMF.standard_shears, - bar, bar, - plank, plank, - Items.leather); - - time = 20; - KnowledgeListMF.sawsR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_saw, "tier", true, "hammer", -1, -1, time, new Object[] - { - "PIII", - "LI ", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_saw, - bar, bar, bar, bar, - plank, - strip); - - time = 15; - KnowledgeListMF.spannerR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_spanner, "tier", true, "hammer", -1, -1, time, new Object[] - { - " I ", - " II", - "LP ", - " L ", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_spanner, - bar, bar, bar, - plank, - strip, strip); - } - private static void addStandardWeapons() - { - Item bar = ComponentListMF.bar; - Item plank = ComponentListMF.plank; - Item strip = ComponentListMF.leather_strip; - Item rivet = ComponentListMF.rivet; - - int time = 15; - KnowledgeListMF.daggerR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_dagger, "tier", true, "hammer", -1, -1, time, new Object[] - { - "L ", - "PII", - "L ", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_dagger, - bar, bar, - plank, - strip, strip); - - time = 25; - KnowledgeListMF.swordR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_sword, "tier", true, "hammer", -1, -1, time, new Object[] - { - "LI ", - "PIII", - "LI ", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_sword, - bar, bar, bar, bar, bar, - plank, - strip, strip); - - time = 20; - KnowledgeListMF.waraxeR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_waraxe, "tier", true, "hammer", -1, -1, time, new Object[] - { - "LII", - "PPI", - "L I", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_waraxe, - bar, bar, bar, bar, - plank, plank, - strip, strip); - - KnowledgeListMF.maceR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_mace, "tier", true, "hammer", -1, -1, time, new Object[] - { - "L II", - "PPII", - "L ", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_mace, - bar, bar, bar, bar, - plank, plank, - strip, strip); - - KnowledgeListMF.spearR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_spear, "tier", true, "hammer", -1, -1, time, new Object[] - { - " LLI ", - "PPPPI", - " LLI ", - - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_spear, - bar, bar, bar, - plank, plank, plank, plank, - strip, strip, strip, strip); - - //HEAVY - time = 30; - KnowledgeListMF.katanaR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_katana, "tier", true, "hvyhammer", -1, -1, time, new Object[] - { - "LR I", - "PIIII ", - "LI ", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_katana, - bar, bar, bar, bar, bar, bar, - plank, - strip, strip, - rivet); - - time = 40; - KnowledgeListMF.gswordR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_greatsword, "tier", true, "hvyhammer", -1, -1, time, new Object[] - { - "LIR ", - "PIIIII", - "LIR ", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_greatsword, - bar, bar, bar, bar, bar, bar, bar, - plank, - strip, strip, - rivet, rivet); - - time = 30; - KnowledgeListMF.battleaxeR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_battleaxe, "tier", true, "hvyhammer", -1, -1, time, new Object[] - { - "LLIIR", - "PPPIR", - "LLIIR", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_battleaxe, - bar, bar, bar, bar, bar, - plank, plank, plank, - strip, strip, strip, strip, - rivet, rivet, rivet); - - KnowledgeListMF.whammerR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_warhammer, "tier", true, "hvyhammer", -1, -1, time, new Object[] - { - "LL IIR", - "PPPIIR", - "LL IR", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_warhammer, - bar, bar, bar, bar, bar, - plank, plank, plank, - strip, strip, strip, strip, - rivet, rivet, rivet); - - KnowledgeListMF.halbeardR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_halbeard, "tier", true, "hvyhammer", -1, -1, time, new Object[] - { - "LLRII", - "PPPPI", - "LLRI ", - - 'R', rivet, - 'I', bar, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_halbeard, - bar, bar, bar, bar, - plank, plank, plank, plank, - strip, strip, strip, strip, - rivet, rivet); - - time = 25; - KnowledgeListMF.bowR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_bow, "tier", true, "hammer", -1, -1, time, new Object[] - { - "PSSSP", - " PLP ", - - 'I', bar, - 'S', Items.string, - 'P', plank, - 'L', strip, - }); - Salvage.addSalvage(CustomToolListMF.standard_bow, - plank, plank, plank, plank, - strip, - Items.string, Items.string, Items.string); - - time = 60; - KnowledgeListMF.lanceR = - MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_lance, "tier", true, "hvyhammer", -1, -1, time, new Object[] - { - "IR ", - "IIIIII", - "IR ", - - 'R', rivet, - 'I', bar, - }); - Salvage.addSalvage(CustomToolListMF.standard_lance, - bar, bar, bar, bar, bar, bar, bar, bar, - rivet, rivet); - } +import java.util.ArrayList; +import java.util.Iterator; + +public class ForgedToolRecipes { + private static final Skill artisanry = SkillList.artisanry; + private static final Skill engineering = SkillList.engineering; + private static final Skill construction = SkillList.construction; + + public static void init() { + CarpenterRecipes.initTierWood(); + addStandardTools(); + addStandardCrafters(); + addStandardWeapons(); + addComponentTools(); + addMetalComponents(); + + ArrayList metal = CustomMaterial.getList("metal"); + ArrayList wood = CustomMaterial.getList("wood"); + + Iterator iteratorMetal = metal.iterator(); + + while (iteratorMetal.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorMetal.next(); + ItemStack bar = ComponentListMF.bar.createComm(customMat.name); + for (ItemStack ingot : OreDictionary.getOres("ingot" + customMat.name)) { + KnowledgeListMF.barR.add(MineFantasyAPI.addAnvilRecipe(artisanry, bar, "", true, "hammer", -1, -1, + (int) (customMat.craftTimeModifier / 2F), new Object[]{"I", 'I', ingot,})); + } + + ItemStack defaultIngot = customMat.getItem(); + if (defaultIngot != null) { + KnowledgeListMF.baringotR.add(MineFantasyAPI.addAnvilRecipe(artisanry, defaultIngot, "", true, "hammer", + -1, -1, (int) (customMat.craftTimeModifier / 2F), new Object[]{"I", 'I', bar,})); + } + } + + KnowledgeListMF.tinderboxR = MineFantasyAPI.addAnvilRecipe(null, new ItemStack(ToolListMF.tinderbox), "", true, + "hammer", 0, 0, 10, new Object[]{" F ", "SWS", " I ", 'F', Items.flint, 'S', Items.stick, 'W', + Blocks.wool, 'I', ComponentListMF.bar("Iron"),}); + KnowledgeListMF.flintAndSteelR = MineFantasyAPI.addAnvilRecipe(null, new ItemStack(Items.flint_and_steel), "", + true, "hammer", 0, 0, 10, new Object[]{" F", "IC ", " I ", 'F', Items.flint, 'C', Items.coal, 'I', + ComponentListMF.bar("Steel"),}); + Salvage.addSalvage(ToolListMF.tinderbox, Items.flint, Items.stick, Blocks.wool, ComponentListMF.bar("Iron")); + Salvage.addSalvage(Items.flint_and_steel, Items.flint, ComponentListMF.bar("Steel")); + } + + private static void addMetalComponents() { + int time = 2; + Item bar = ComponentListMF.bar; + Item hunk = ComponentListMF.metalHunk; + + KnowledgeListMF.hunkR = MineFantasyAPI.addAnvilToolRecipe(artisanry, new ItemStack(hunk, 4), "", true, "hammer", + 0, 0, time, new Object[]{"F", "I", 'F', ComponentListMF.flux, 'I', bar,}); + + KnowledgeListMF.ingotR = MineFantasyAPI.addAnvilToolRecipe(artisanry, bar, "", true, "hammer", 0, 0, time, + new Object[]{"II", "II", 'I', hunk}); + + time = 8; + int count = 1; + KnowledgeListMF.bucketR = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(Items.bucket, count), "", true, + "hammer", 0, 0, time, new Object[]{"I I", " I ", 'I', bar,}); + } + + private static void addComponentTools() { + Item bar = ComponentListMF.bar; + Item plank = ComponentListMF.plank; + Item strip = ComponentListMF.leather_strip; + Item rivet = ComponentListMF.rivet; + Item hunk = ComponentListMF.metalHunk; + + int time = 10; + + KnowledgeListMF.nailR = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.nail, 16), "", + true, "hammer", -1, -1, time, new Object[]{"HH", " H", " H", + + 'H', hunk}); + KnowledgeListMF.rivetR = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.rivet, 8), "", + true, "hammer", -1, -1, time, new Object[]{"H H", " H ", " H ", + + 'H', hunk}); + + KnowledgeListMF.needleR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_needle, "tier", + true, "hammer", -1, -1, time, new Object[]{"H", "H", "H", "H", + + 'H', hunk}); + Salvage.addSalvage(CustomToolListMF.standard_needle, bar); + + time = 3; + KnowledgeListMF.crossBoltR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_bolt, + "tier", true, "hammer", -1, -1, time, new Object[]{"H", "F", + + 'F', ComponentListMF.fletching, 'H', hunk}); + time = 2; + KnowledgeListMF.arrowheadR = MineFantasyAPI.addAnvilToolRecipe(artisanry, + new ItemStack(ComponentListMF.arrowhead, 4), "tier", true, "hammer", -1, -1, time, + new Object[]{"H ", "HH", "H ", + + 'H', hunk}); + time = 5; + KnowledgeListMF.bodkinheadR = MineFantasyAPI.addAnvilToolRecipe(artisanry, + new ItemStack(ComponentListMF.bodkinhead, 4), "tier", true, "hammer", -1, -1, time, + new Object[]{"H ", " HH", "H ", + + 'H', hunk}); + time = 5; + KnowledgeListMF.broadheadR = MineFantasyAPI.addAnvilToolRecipe(artisanry, + new ItemStack(ComponentListMF.broadhead, 4), "tier", true, "hammer", -1, -1, time, + new Object[]{"H ", " H", " H", "H ", + + 'H', hunk}); + Salvage.addSalvage(CustomToolListMF.standard_bolt, ComponentListMF.fletching, hunk); + Salvage.addSalvage(ComponentListMF.arrowhead, hunk); + Salvage.addSalvage(ComponentListMF.bodkinhead, hunk); + Salvage.addSalvage(ComponentListMF.broadhead, hunk); + + time = 1; + KnowledgeListMF.arrowR.add(MineFantasyAPI.addCarpenterToolRecipe(artisanry, CustomToolListMF.standard_arrow, + "arrows", "dig.wood", 1, new Object[]{"H", "F", + + 'F', ComponentListMF.fletching, 'H', ComponentListMF.arrowhead})); + KnowledgeListMF.arrowR.add(MineFantasyAPI.addCarpenterToolRecipe(artisanry, + CustomToolListMF.standard_arrow_bodkin, "arrowsBodkin", "dig.wood", 1, new Object[]{"H", "F", + + 'F', ComponentListMF.fletching, 'H', ComponentListMF.bodkinhead})); + KnowledgeListMF.arrowR.add(MineFantasyAPI.addCarpenterToolRecipe(artisanry, + CustomToolListMF.standard_arrow_broad, "arrowsBroad", "dig.wood", 1, new Object[]{"H", "F", + + 'F', ComponentListMF.fletching, 'H', ComponentListMF.broadhead})); + Salvage.addSalvage(CustomToolListMF.standard_arrow, ComponentListMF.arrowhead, ComponentListMF.fletching); + Salvage.addSalvage(CustomToolListMF.standard_arrow_bodkin, ComponentListMF.bodkinhead, + ComponentListMF.fletching); + Salvage.addSalvage(CustomToolListMF.standard_arrow_broad, ComponentListMF.broadhead, ComponentListMF.fletching); + + } + + private static void addStandardTools() { + Item bar = ComponentListMF.bar; + Item plank = ComponentListMF.plank; + Item strip = ComponentListMF.leather_strip; + Item rivet = ComponentListMF.rivet; + + int time = 15; + KnowledgeListMF.pickR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_pick, "tier", + true, "hammer", -1, -1, time, new Object[]{"L I", "PPI", "L I", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_pick, bar, bar, bar, plank, plank, strip, strip); + + time = 15; + KnowledgeListMF.axeR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_axe, "tier", true, + "hammer", -1, -1, time, new Object[]{"LII", "PPI", "L ", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_axe, bar, bar, bar, plank, plank, strip, strip); + + time = 12; + KnowledgeListMF.hoeR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hoe, "tier", true, + "hammer", -1, -1, time, new Object[]{"L I", "PPI", "L ", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_hoe, bar, bar, plank, plank, strip, strip); + + time = 10; + KnowledgeListMF.spadeR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_spade, "tier", + true, "hammer", -1, -1, time, new Object[]{"L ", "PPI", "L ", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_spade, bar, plank, plank, strip, strip); + + // ADVANCED + time = 25; + KnowledgeListMF.hvyPickR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hvypick, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LR I", "PPII", "LRII", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_hvypick, bar, bar, bar, bar, bar, plank, plank, strip, strip, + rivet, rivet); + + time = 15; + KnowledgeListMF.handpickR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_handpick, + "tier", true, "hammer", -1, -1, time, new Object[]{"LI ", "PIR", "L ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_handpick, bar, bar, plank, strip, strip, rivet); + + time = 25; + KnowledgeListMF.hvyShovelR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hvyshovel, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LRII", "PPII", "LRII", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_hvyshovel, bar, bar, bar, bar, bar, bar, plank, plank, strip, + strip, rivet, rivet); + + time = 15; + KnowledgeListMF.trowR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_trow, "tier", + true, "hammer", -1, -1, time, new Object[]{"L ", "PIR", "L ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_trow, bar, plank, strip, strip, rivet); + + time = 30; + KnowledgeListMF.scytheR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_scythe, "tier", + true, "hvyhammer", -1, -1, time, new Object[]{" I ", "L PIR", "PPPIR", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_scythe, bar, bar, bar, plank, plank, plank, plank, strip, rivet, + rivet); + + time = 14; + KnowledgeListMF.mattockR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_mattock, + "tier", true, "hammer", -1, -1, time, new Object[]{"L I", "PPI", "LIR", + + 'I', bar, 'P', plank, 'L', strip, 'R', rivet}); + Salvage.addSalvage(CustomToolListMF.standard_mattock, bar, bar, bar, rivet, plank, plank, strip, strip); + + time = 15; + KnowledgeListMF.lumberR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_lumber, "tier", + true, "hvyHammer", -1, -1, time, new Object[]{"L IIR", "PPPIR", "L R", + + 'I', bar, 'P', plank, 'L', strip, 'R', rivet}); + Salvage.addSalvage(CustomToolListMF.standard_lumber, bar, bar, bar, rivet, rivet, rivet, plank, plank, plank, + strip, strip); + } + + private static void addStandardCrafters() { + Item bar = ComponentListMF.bar; + Item plank = ComponentListMF.plank; + Item strip = ComponentListMF.leather_strip; + Item rivet = ComponentListMF.rivet; + + int time = 10; + KnowledgeListMF.hammerR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hammer, "tier", + true, "hammer", 0, 0, time, new Object[]{"I", "L", "P", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_hammer, bar, plank, strip); + + time = 15; + KnowledgeListMF.hvyHammerR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_hvyhammer, + "tier", true, "hammer", -1, -1, time, new Object[]{" II", "RLI", " P ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_hvyhammer, bar, bar, bar, plank, strip, rivet); + + time = 10; + KnowledgeListMF.tongsR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_tongs, "tier", + true, "hammer", -1, -1, time, new Object[]{"I ", " I", + + 'I', bar,}); + Salvage.addSalvage(CustomToolListMF.standard_tongs, bar, bar); + + time = 10; + KnowledgeListMF.knifeR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_knife, "tier", + true, "hammer", -1, -1, time, new Object[]{"I ", "PL", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_knife, bar, plank, strip); + + time = 12; + KnowledgeListMF.shearsR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_shears, "tier", + true, "hammer", -1, -1, time, new Object[]{" I ", "PLI", " P ", + + 'I', bar, 'P', plank, 'L', Items.leather,}); + Salvage.addSalvage(CustomToolListMF.standard_shears, bar, bar, plank, plank, Items.leather); + + time = 20; + KnowledgeListMF.sawsR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_saw, "tier", + true, "hammer", -1, -1, time, new Object[]{"PIII", "LI ", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_saw, bar, bar, bar, bar, plank, strip); + + time = 15; + KnowledgeListMF.spannerR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_spanner, + "tier", true, "hammer", -1, -1, time, new Object[]{" I ", " II", "LP ", " L ", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_spanner, bar, bar, bar, plank, strip, strip); + } + + private static void addStandardWeapons() { + Item bar = ComponentListMF.bar; + Item plank = ComponentListMF.plank; + Item strip = ComponentListMF.leather_strip; + Item rivet = ComponentListMF.rivet; + + int time = 15; + KnowledgeListMF.daggerR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_dagger, "tier", + true, "hammer", -1, -1, time, new Object[]{"L ", "PII", "L ", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_dagger, bar, bar, plank, strip, strip); + + time = 25; + KnowledgeListMF.swordR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_sword, "tier", + true, "hammer", -1, -1, time, new Object[]{"LI ", "PIII", "LI ", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_sword, bar, bar, bar, bar, bar, plank, strip, strip); + + time = 20; + KnowledgeListMF.waraxeR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_waraxe, "tier", + true, "hammer", -1, -1, time, new Object[]{"LII", "PPI", "L I", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_waraxe, bar, bar, bar, bar, plank, plank, strip, strip); + + KnowledgeListMF.maceR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_mace, "tier", + true, "hammer", -1, -1, time, new Object[]{"L II", "PPII", "L ", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_mace, bar, bar, bar, bar, plank, plank, strip, strip); + + KnowledgeListMF.spearR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_spear, "tier", + true, "hammer", -1, -1, time, new Object[]{" LLI ", "PPPPI", " LLI ", + + 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_spear, bar, bar, bar, plank, plank, plank, plank, strip, strip, + strip, strip); + + // HEAVY + time = 30; + KnowledgeListMF.katanaR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_katana, "tier", + true, "hvyhammer", -1, -1, time, new Object[]{"LR I", "PIIII ", "LI ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_katana, bar, bar, bar, bar, bar, bar, plank, strip, strip, rivet); + + time = 40; + KnowledgeListMF.gswordR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_greatsword, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LIR ", "PIIIII", "LIR ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_greatsword, bar, bar, bar, bar, bar, bar, bar, plank, strip, strip, + rivet, rivet); + + time = 30; + KnowledgeListMF.battleaxeR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_battleaxe, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LLIIR", "PPPIR", "LLIIR", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_battleaxe, bar, bar, bar, bar, bar, plank, plank, plank, strip, + strip, strip, strip, rivet, rivet, rivet); + + KnowledgeListMF.whammerR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_warhammer, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LL IIR", "PPPIIR", "LL IR", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_warhammer, bar, bar, bar, bar, bar, plank, plank, plank, strip, + strip, strip, strip, rivet, rivet, rivet); + + KnowledgeListMF.halbeardR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_halbeard, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LLRII", "PPPPI", "LLRI ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_halbeard, bar, bar, bar, bar, plank, plank, plank, plank, strip, + strip, strip, strip, rivet, rivet); + + time = 25; + KnowledgeListMF.bowR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_bow, "tier", true, + "hammer", -1, -1, time, new Object[]{"PSSSP", " PLP ", + + 'I', bar, 'S', Items.string, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_bow, plank, plank, plank, plank, strip, Items.string, Items.string, + Items.string); + + time = 60; + KnowledgeListMF.lanceR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_lance, "tier", + true, "hvyhammer", -1, -1, time, new Object[]{"IR ", "IIIIII", "IR ", + + 'R', rivet, 'I', bar,}); + Salvage.addSalvage(CustomToolListMF.standard_lance, bar, bar, bar, bar, bar, bar, bar, bar, rivet, rivet); + + //Longsword + time = 25; + KnowledgeListMF.longswordR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_longsword, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LI ", "PIIII ", "LI ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_longsword, bar, bar, bar, bar, bar, bar, plank, strip, strip); + //Saber + time = 20; + KnowledgeListMF.saberR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_saber, + "tier", true, "hammer", -1, -1, time, new Object[]{"LI I", "PIII ", "LI ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_saber, bar, bar, bar, bar, bar, bar, plank, strip, strip); + //Gladius + time = 15; + KnowledgeListMF.gladiusR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_gladius, + "tier", true, "hammer", -1, -1, time, new Object[]{"L ", "PIII", "L ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_gladius, bar, bar, bar, plank, strip, strip); + + //Shortsword + time = 15; + KnowledgeListMF.shortswordR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_shortsword, + "tier", true, "hammer", -1, -1, time, new Object[]{"LI ", "PII ", "LI ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_shortsword, bar, bar, bar, plank, strip, strip); + + //Trident + time = 30; + KnowledgeListMF.tridentR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_trident, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LLR I", "PPPII", "LLR I", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_trident, rivet, rivet, bar, bar, plank, strip, strip); + + //Nodachi + time = 20; + KnowledgeListMF.nodachiR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_nodachi, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LIR I", "PIIII ", "LIR ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_saber, bar, bar, bar, bar, bar, bar, plank, strip, strip, rivet, rivet); + //Claymore + time = 45; + KnowledgeListMF.claymoreR = MineFantasyAPI.addAnvilToolRecipe(artisanry, CustomToolListMF.standard_claymore, + "tier", true, "hvyhammer", -1, -1, time, new Object[]{"LIRR ", "PIIIII", "LIRR ", + + 'R', rivet, 'I', bar, 'P', plank, 'L', strip,}); + Salvage.addSalvage(CustomToolListMF.standard_claymore, bar, bar, bar, bar, bar, bar, bar, plank, strip, strip, rivet, rivet); + } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/recipe/ForgingRecipes.java b/src/main/java/minefantasy/mf2/recipe/ForgingRecipes.java index 26931bd1..32adb381 100644 --- a/src/main/java/minefantasy/mf2/recipe/ForgingRecipes.java +++ b/src/main/java/minefantasy/mf2/recipe/ForgingRecipes.java @@ -1,20 +1,15 @@ package minefantasy.mf2.recipe; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - import cpw.mods.fml.common.registry.GameRegistry; - import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.crafting.Salvage; import minefantasy.mf2.api.crafting.anvil.IAnvilRecipe; -import minefantasy.mf2.api.crafting.exotic.SpecialForging; -import minefantasy.mf2.api.material.CustomMaterial; +import minefantasy.mf2.api.knowledge.InformationBase; import minefantasy.mf2.api.rpg.Skill; import minefantasy.mf2.api.rpg.SkillList; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigCrafting; +import minefantasy.mf2.config.ConfigHardcore; import minefantasy.mf2.item.ItemComponentMF; import minefantasy.mf2.item.food.FoodListMF; import minefantasy.mf2.item.list.ArmourListMF; @@ -26,794 +21,488 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class ForgingRecipes -{ - private static final Skill artisanry = SkillList.artisanry; - private static final Skill engineering = SkillList.engineering; - private static final Skill construction = SkillList.construction; - public static void init() - { - ForgedToolRecipes.init(); - ForgedArmourRecipes.init(); - addCogworkParts(); - - ItemStack ironbar = ComponentListMF.bar("Iron"); - ItemStack steelbar = ComponentListMF.bar("Steel"); - ItemStack goldbar = ComponentListMF.bar("Gold"); - ItemStack silverbar = ComponentListMF.bar("Silver"); - - //MISC - BaseMaterialMF material; - int time; - time = 1; - material = BaseMaterialMF.encrusted; - - KnowledgeListMF.obsidianHunkR = - MineFantasyAPI.addAnvilRecipe(null, new ItemStack(ComponentListMF.obsidian_rock, 4), "", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "D", - 'D', Blocks.obsidian, - }); - KnowledgeListMF.diamondR = - MineFantasyAPI.addAnvilRecipe(null, new ItemStack(ComponentListMF.diamond_shards), "", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "D", - 'D', Items.diamond, - }); - - time = 3; - KnowledgeListMF.encrustedR = - MineFantasyAPI.addAnvilRecipe(artisanry, ComponentListMF.bar("Encrusted"), "smeltEncrusted", true, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "D", - "I", - 'D', ComponentListMF.diamond_shards, - 'I', ComponentListMF.bar("Steel"), - }); - Salvage.addSalvage(ComponentListMF.ingots[5], ComponentListMF.ingots[4], ComponentListMF.diamond_shards); - Salvage.addSalvage(ComponentListMF.bar("Encrusted"), ComponentListMF.bar("Steel"), ComponentListMF.diamond_shards); - - material = BaseMaterialMF.pigiron; - KnowledgeListMF.steelR = - MineFantasyAPI.addAnvilRecipe(artisanry, ComponentListMF.bar("Steel"), "smeltSteel", true, 1, 1, 5, new Object[] - { - "H", - 'H', ComponentListMF.bar("RefinedIron") - }); - KnowledgeListMF.fluxR = - MineFantasyAPI.addAnvilRecipe(null, new ItemStack(ComponentListMF.flux, 4), "", false, -1, -1, 2, new Object[] - { - "H", - 'H',BlockListMF.limestone - }); - - //STUDDED - material = BaseMaterialMF.iron; - //HELMET - time = 10; - KnowledgeListMF.studHelmetR = - MineFantasyAPI.addAnvilRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 3, 0), "craftArmourLight", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " I ", - "IAI", - " I ", - 'I', ComponentListMF.rivet, - 'A', ArmourListMF.armourItem(ArmourListMF.leather, 2, 0), - }); - //CHEST - time = 20; - KnowledgeListMF.studChestR = - MineFantasyAPI.addAnvilRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 3, 1), "craftArmourLight", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " I ", - "IAI", - " I ", - 'I', ComponentListMF.rivet, - 'A', ArmourListMF.armourItem(ArmourListMF.leather, 2, 1), - }); - //LEGS - time = 15; - KnowledgeListMF.studLegsR = - MineFantasyAPI.addAnvilRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 3, 2), "craftArmourLight", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " I ", - "IAI", - " I ", - 'I', ComponentListMF.rivet, - 'A', ArmourListMF.armourItem(ArmourListMF.leather, 2, 2), - }); - //BOOTS - time = 6; - KnowledgeListMF.studBootsR = - MineFantasyAPI.addAnvilRecipe(artisanry, ArmourListMF.armour(ArmourListMF.leather, 3, 3), "craftArmourLight", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " I ", - "IAI", - " I ", - 'I', ComponentListMF.rivet, - 'A', ArmourListMF.armourItem(ArmourListMF.leather, 2, 3), - }); - - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 3, 0), ArmourListMF.armour(ArmourListMF.leather, 2, 0), new ItemStack(ComponentListMF.rivet, 4)); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 3, 1), ArmourListMF.armour(ArmourListMF.leather, 2, 1), new ItemStack(ComponentListMF.rivet, 4)); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 3, 2), ArmourListMF.armour(ArmourListMF.leather, 2, 2), new ItemStack(ComponentListMF.rivet, 4)); - Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 3, 3), ArmourListMF.armour(ArmourListMF.leather, 2, 3), new ItemStack(ComponentListMF.rivet, 4)); - - time = 2; - material = BaseMaterialMF.iron; - if(ConfigCrafting.allowIronResmelt) - { - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep), "blastfurn", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "IFI", - 'I', ComponentListMF.bar("iron"), - 'F', ComponentListMF.flux, - }); - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep, 2), "blastfurn", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "IFI", - 'I', ComponentListMF.bar("iron"), - 'F', ComponentListMF.flux_strong, - }); - } - KnowledgeListMF.coalPrepR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.coal_prep), "coke", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "RCR", - "CFC", - "RCR", - 'R', Items.redstone, - 'C', new ItemStack(Items.coal, 1, 1), - 'F', ComponentListMF.flux_strong, - }); - GameRegistry.addSmelting(ComponentListMF.coal_prep, new ItemStack(ComponentListMF.coke), 1F); - - KnowledgeListMF.ironPrepR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep), "blastfurn", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "IFI", - 'I', Blocks.iron_ore, - 'F', ComponentListMF.flux, - }); - KnowledgeListMF.ironPrepR2 = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep, 2), "blastfurn", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "IFI", - 'I', Blocks.iron_ore, - 'F', ComponentListMF.flux_strong, - }); - - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep), "blastfurn", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "IFI", - 'I', ComponentListMF.oreIron, - 'F', ComponentListMF.flux, - }); - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep, 2), "blastfurn", false, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "IFI", - 'I', ComponentListMF.oreIron, - 'F', ComponentListMF.flux_strong, - }); - ItemStack plate = ComponentListMF.plate.createComm("iron"); - time=10; - KnowledgeListMF.blastChamR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.blast_chamber), "blastfurn", false, "hvyHammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "RP PR", - "RP PR", - "RP PR", - "RP PR", - 'R', ComponentListMF.rivet, - 'P', plate, - }); - - time=15; - KnowledgeListMF.blastHeatR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.blast_heater), "blastfurn", false, "hvyHammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "RP PR", - "RP PR", - "RP PR", - "RPFPR", - 'R', ComponentListMF.rivet, - 'P', plate, - 'F', Blocks.furnace, - }); - - Salvage.addSalvage(BlockListMF.blast_heater, new ItemStack(ComponentListMF.rivet, 8), - plate, plate, plate, plate, plate, plate, plate, plate, - Blocks.furnace); - Salvage.addSalvage(BlockListMF.blast_chamber, new ItemStack(ComponentListMF.rivet, 8), - plate, plate, plate, plate, plate, plate, plate, plate); - - - time=10; - KnowledgeListMF.bigFurnR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.furnace_stone), "bigfurn", false, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "PRP", - "RCR", - "PFP", - 'F', Blocks.furnace, - 'R', ComponentListMF.rivet, - 'P', plate, - 'C', BlockListMF.firebricks - }); - time=10; - KnowledgeListMF.bigHeatR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.furnace_heater), "bigfurn", false, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[]{ - "RCR", - "PFP", - 'R', ComponentListMF.rivet, - 'P', plate, - 'C', BlockListMF.firebricks, - 'F', BlockListMF.forge, - }); - - Salvage.addSalvage(BlockListMF.furnace_heater, new ItemStack(ComponentListMF.rivet, 2), - plate, plate, - BlockListMF.firebricks, - BlockListMF.forge); - Salvage.addSalvage(BlockListMF.furnace_stone, new ItemStack(ComponentListMF.rivet, 3), - plate, plate, plate, plate, - BlockListMF.firebricks, - Blocks.furnace); - - - IAnvilRecipe[] anvilRecs = new IAnvilRecipe[BlockListMF.anvils.length]; - for(int id = 0; id < BlockListMF.anvils.length; id ++) - { - time = 8; - material = BaseMaterialMF.getMaterial(BlockListMF.anvils[id]); - ItemStack bar = ComponentListMF.bar(material.name); - - anvilRecs[id] = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.anvil[id]), "smelt"+material.name, false, "hammer", -1, -1, (int)(time*material.craftTimeModifier), new Object[] - { - " II", - "III", - " I ", - 'I', bar, - }); - - Salvage.addSalvage(BlockListMF.anvil[id], ComponentListMF.bar(material.name, 6)); - } - recipeMap.put("anvilCrafting", anvilRecs); - - ItemStack bronzeHunk = ComponentListMF.metalHunk.createComm("bronze"); - ItemStack ironHunk = ComponentListMF.metalHunk.createComm("iron"); - - time = 2; - material = BaseMaterialMF.bronze; - KnowledgeListMF.framedStoneR = - MineFantasyAPI.addAnvilRecipe(construction, new ItemStack(BlockListMF.reinforced_stone_framed), "decorated_stone", false, "hammer", material.hammerTier-1, material.anvilTier-1, (int)(time*material.craftTimeModifier), new Object[] - { - " N ", - "NSN", - " N ", - 'N', bronzeHunk, - 'S', BlockListMF.reinforced_stone, - }); - Salvage.addSalvage(BlockListMF.reinforced_stone_framed, - bronzeHunk, bronzeHunk, bronzeHunk, bronzeHunk, - BlockListMF.reinforced_stone); - time = 2; - material = BaseMaterialMF.iron; - KnowledgeListMF.iframedStoneR = - MineFantasyAPI.addAnvilRecipe(construction, new ItemStack(BlockListMF.reinforced_stone_framediron), "decorated_stone", false, "hammer", material.hammerTier-1, material.anvilTier-1, (int)(time*material.craftTimeModifier), new Object[] - { - " N ", - "NSN", - " N ", - 'N', ironHunk, - 'S', BlockListMF.reinforced_stone, - }); - Salvage.addSalvage(BlockListMF.reinforced_stone_framediron, - ironHunk, ironHunk,ironHunk, ironHunk - , BlockListMF.reinforced_stone); - - time = 2; - material = BaseMaterialMF.bronze; - KnowledgeListMF.smokePipeR = - MineFantasyAPI.addAnvilRecipe(construction, new ItemStack(BlockListMF.chimney_pipe, 4), "", false, "hammer", material.hammerTier-1, material.anvilTier-1, (int)(time*material.craftTimeModifier), new Object[] - { - "N N", - "PPPP", - "N N", - 'N', bronzeHunk, - 'P', BlockListMF.chimney_stone, - }); - Salvage.addSalvage(BlockListMF.chimney_pipe, - BlockListMF.chimney_stone, bronzeHunk); - - for(int id = 0; id < BlockListMF.specialMetalBlocks.length; id ++) - { - time = 2; - material = BaseMaterialMF.getMaterial(BlockListMF.specialMetalBlocks[id]); - ItemStack hunk = ComponentListMF.metalHunk.createComm(material.name); - if(hunk != null) - { - KnowledgeListMF.barsR.add( - MineFantasyAPI.addAnvilRecipe(construction, new ItemStack(BlockListMF.bars[id]), "smelt"+material.name, false, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "I I", - "I I", - 'I', hunk, - })); - if(hunk.getItem() instanceof ItemComponentMF) - { - Salvage.addSalvage(BlockListMF.bars[id],hunk, hunk, hunk, hunk); - } - } - } - KnowledgeListMF.talismanRecipe.add( - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.talisman_lesser), "", true, "hammer", -1, -1, 20, new Object[] - { - "LGL", - "GIG", - " G ", - 'L', new ItemStack(Items.dye, 1, 4), - 'I', ironbar, - 'G', goldbar, - })); - KnowledgeListMF.talismanRecipe.add( - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.talisman_lesser), "", true, "hammer", -1, -1, 20, new Object[] - { - "LSL", - "SIS", - " S ", - 'L', new ItemStack(Items.dye, 1, 4), - 'I', ironbar, - 'S', silverbar, - })); - KnowledgeListMF.greatTalismanRecipe = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.talisman_greater), "", true, "hammer", 1, 1, 50, new Object[] - { - "GSG", - "DTD", - "GDG", - 'G', goldbar, - 'D', Items.diamond, - 'T', ComponentListMF.talisman_lesser, - 'S', Items.nether_star, - }); - - addEngineering(); - addConstruction(); - - time = 10; - material = BaseMaterialMF.iron; - KnowledgeListMF.caketinRecipe = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(FoodListMF.cake_tin), "", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " R ", - "I I", - " I ", - 'I', ironbar, - 'R', ComponentListMF.rivet, - }); - Salvage.addSalvage(FoodListMF.cake_tin, - ComponentListMF.bar("Iron", 3) - , ComponentListMF.rivet); - - KnowledgeListMF.coalfluxR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.coal_flux, 2), "coalflux", false, material.hammerTier, material.anvilTier, 2, new Object[] - { - "F", - "C", - 'C', Items.coal, - 'F', ComponentListMF.flux_pot, - }); - - time = 4; - material = BaseMaterialMF.iron; - KnowledgeListMF.hingeRecipe = - MineFantasyAPI.addAnvilRecipe(construction, new ItemStack(ComponentListMF.hinge), "", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "LR", - 'L', ComponentListMF.leather_strip, - 'R', ComponentListMF.rivet, - }); - Salvage.addSalvage(ComponentListMF.hinge, - ComponentListMF.leather_strip - , ComponentListMF.rivet); - - time = 10; - KnowledgeListMF.crestR = - MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.ornate_items), "craftOrnate", false, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " G ", - "SLS", - " G ", - 'G', goldbar, - 'S', silverbar, - 'L', new ItemStack(Items.dye, 1, 4) - - }); - } - - private static Item getStrips(BaseMaterialMF material) - { - return ComponentListMF.leather_strip; - } - private static Item getLeather(BaseMaterialMF material) - { - return Items.leather; - } - - private static void addEngineering() - { - ItemStack copper = ComponentListMF.bar("Copper"); - ItemStack bronze = ComponentListMF.bar("Bronze"); - ItemStack iron = ComponentListMF.bar("Iron"); - ItemStack steel = ComponentListMF.bar("Steel"); - ItemStack tungsten = ComponentListMF.bar("Tungsten"); - ItemStack blacksteel = ComponentListMF.bar("BlackSteel"); - - - ItemStack bronzeHunk = ComponentListMF.metalHunk.createComm("bronze"); - ItemStack ironHunk = ComponentListMF.metalHunk.createComm("iron"); - ItemStack steelHunk = ComponentListMF.metalHunk.createComm("steel"); - ItemStack tungstenHunk = ComponentListMF.metalHunk.createComm("tungsten"); - ItemStack obsidianHunk = ComponentListMF.metalHunk.createComm("obsidian"); - - BaseMaterialMF material = BaseMaterialMF.steel; - int time = 15; - KnowledgeListMF.eatoolsR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ToolListMF.engin_anvil_tools), "etools", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "SSLL", - "LLSS", - 'S', steelHunk, - 'L', getStrips(material), - }); - time = 5; - KnowledgeListMF.iframeR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.iron_frame), "ecomponents", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "RRR", - "ISI", - "STS", - "ISI", - 'T', ToolListMF.engin_anvil_tools, - 'R', ComponentListMF.rivet, - 'I', ironHunk, - 'S', steelHunk, - }); - time = 8; - KnowledgeListMF.istrutR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.iron_strut), "ecomponents", true, "hvyhammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "RTR", - "SIS", - "SIS", - 'T', ToolListMF.engin_anvil_tools, - 'R', ComponentListMF.rivet, - 'I', iron, - 'S', steelHunk, - }); - time = 8; - KnowledgeListMF.stubeR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.steel_tube), "ecomponents", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "TR R", - "SSSS", - 'T', ToolListMF.engin_anvil_tools, - 'R', ComponentListMF.rivet, - 'S', steelHunk, - }); - time = 2; - KnowledgeListMF.boltR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.bolt, 2), "etools", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " T ", - "SIS", - " S ", - " S ", - 'T', ToolListMF.engin_anvil_tools, - 'I', iron, - 'S', steelHunk, - }); - time = 35; - KnowledgeListMF.climbPickbR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ToolListMF.climbing_pick_basic), "climber", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "L SR", - "IISR", - "L T ", - 'R', ComponentListMF.rivet, - 'T', ToolListMF.engin_anvil_tools, - 'I', iron, - 'S', steel, - 'L', getStrips(material), - }); - time = 5; - KnowledgeListMF.bgearR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.bronze_gears), "ecomponents", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " T ", - " B ", - "BIB", - " B ", - 'T', ToolListMF.engin_anvil_tools, - 'I', iron, - 'B', bronzeHunk, - }); - time = 8; - material = BaseMaterialMF.tungsten; - KnowledgeListMF.tgearR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.tungsten_gears), "tungsten", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " T ", - " W ", - "WGW", - " W ", - 'T', ToolListMF.engin_anvil_tools, - 'W', tungstenHunk, - 'G', ComponentListMF.bronze_gears, - }); - time = 5; - material = BaseMaterialMF.compositeAlloy; - KnowledgeListMF.compPlateR = - MineFantasyAPI.addAnvilRecipe(engineering, ComponentListMF.bar("CompositeAlloy"), "cogArmour", true, "hvyhammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " T ", - " S ", - "RWR", - " C ", - - 'R', ComponentListMF.rivet, - 'T', ToolListMF.engin_anvil_tools, - 'C', copper, - 'W', tungstenHunk, - 'S', steel, - }); - material = BaseMaterialMF.iron; - - time = 5; - KnowledgeListMF.bombCaseIronR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.bomb_casing_iron, 2), "bombIron", true, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " T ", - " I ", - "IRI", - " I ", - 'T', ToolListMF.engin_anvil_tools, - 'I', ironHunk, - 'R', ComponentListMF.rivet, - }); - KnowledgeListMF.mineCaseIronR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.mine_casing_iron, 2), "bombIron", true, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " T ", - " P ", - " IRI ", - "IR RI", - 'T', ToolListMF.engin_anvil_tools, - 'P', Blocks.heavy_weighted_pressure_plate, - 'I', ironHunk, - 'R', ComponentListMF.rivet, - }); - - time = 5; - KnowledgeListMF.bombarrowR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.bomb_casing_arrow), "bombarrow", true, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " IR", - "FPITI", - " IR", - 'T', ToolListMF.engin_anvil_tools, - 'I', ironHunk, - 'R', Items.redstone, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'F', ComponentListMF.fletching, - }); - KnowledgeListMF.bombBoltR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.bomb_casing_bolt), "bombarrow", true, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " IR", - "FITI", - " IR", - 'T', ToolListMF.engin_anvil_tools, - 'I', ironHunk, - 'R', Items.redstone, - 'F', ComponentListMF.fletching, - }); - - material = BaseMaterialMF.blacksteel; - - time = 5; - KnowledgeListMF.bombCaseObsidianR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.bomb_casing_obsidian, 2), "bombObsidian", true, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " T ", - "RIR", - "IOI", - "RIR", - 'T', ToolListMF.engin_anvil_tools, - 'O', Blocks.obsidian, - 'I', obsidianHunk, - 'R', ComponentListMF.rivet, - }); - KnowledgeListMF.mineCaseObsidianR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.mine_casing_obsidian, 2), "mineObsidian", true, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " T ", - " P ", - " IRI ", - "IRORI", - 'T', ToolListMF.engin_anvil_tools, - 'O', Blocks.obsidian, - 'P', Blocks.heavy_weighted_pressure_plate, - 'I', obsidianHunk, - 'R', ComponentListMF.rivet, - }); - time = 15; - material = BaseMaterialMF.steel; - KnowledgeListMF.crossBayonetR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.cross_bayonet), "crossBayonet", true, material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "R R I", - "PIII ", - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - 'I', ironHunk, - 'R', ComponentListMF.rivet, - }); - - Salvage.addSalvage(ToolListMF.engin_anvil_tools, - steelHunk, steelHunk, steelHunk, steelHunk, - new ItemStack(ComponentListMF.leather_strip, 4)); - - Salvage.addSalvage(ComponentListMF.iron_frame, - steelHunk, steelHunk, steelHunk, steelHunk, - ironHunk, ironHunk, ironHunk, ironHunk - ,new ItemStack(ComponentListMF.rivet, 3)); - - Salvage.addSalvage(ComponentListMF.iron_strut, - steelHunk, steelHunk, steelHunk, steelHunk, - ComponentListMF.bar("Iron", 2), new ItemStack(ComponentListMF.rivet, 2)); - - Salvage.addSalvage(ComponentListMF.steel_tube, - steelHunk, steelHunk, steelHunk, steelHunk, - new ItemStack(ComponentListMF.rivet, 2)); - - Salvage.addSalvage(ToolListMF.climbing_pick_basic, ComponentListMF.bar("Iron", 2), ComponentListMF.bar("Steel", 2), new ItemStack(ComponentListMF.rivet, 2), new ItemStack(ComponentListMF.leather_strip, 2)); - - Salvage.addSalvage(ComponentListMF.bronze_gears, - bronzeHunk, bronzeHunk, bronzeHunk, bronzeHunk - ,iron); - - Salvage.addSalvage(ComponentListMF.tungsten_gears, - tungstenHunk, tungstenHunk, tungstenHunk, tungstenHunk, - ComponentListMF.bronze_gears); - - Salvage.addSalvage(ComponentListMF.bar("CompositeAlloy"), copper, steel, tungstenHunk, new ItemStack(ComponentListMF.rivet, 2)); - Salvage.addSalvage(ComponentListMF.ingotCompositeAlloy, copper, steel, tungstenHunk, new ItemStack(ComponentListMF.rivet, 2)); - - Salvage.addSalvage(ComponentListMF.bomb_casing_iron, ironHunk, ironHunk); - Salvage.addSalvage(ComponentListMF.mine_casing_iron, ironHunk, ironHunk, ComponentListMF.rivet, iron); - Salvage.addSalvage(ComponentListMF.bomb_casing_arrow, - ironHunk, ironHunk, ironHunk, ironHunk, - new ItemStack(Items.redstone, 2), ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), ComponentListMF.fletching); - - Salvage.addSalvage(ComponentListMF.bomb_casing_bolt, - ironHunk, ironHunk, ironHunk, ironHunk, - new ItemStack(Items.redstone, 2), ComponentListMF.fletching); - - Salvage.addSalvage(ComponentListMF.bomb_casing_obsidian, obsidianHunk, obsidianHunk, new ItemStack(ComponentListMF.rivet, 2)); - Salvage.addSalvage(ComponentListMF.mine_casing_obsidian, obsidianHunk, obsidianHunk, iron, ComponentListMF.rivet); - - Salvage.addSalvage(ComponentListMF.cross_bayonet, - ironHunk, ironHunk, ironHunk, ironHunk, - ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), new ItemStack(ComponentListMF.rivet, 2)); - } - private static void addConstruction() - { - BaseMaterialMF material = BaseMaterialMF.tin; - ItemStack tin = ComponentListMF.bar("Tin"); - int time = 10; - KnowledgeListMF.brushRecipe = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ToolListMF.paint_brush), "paint_brush", true, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "W", - "I", - "P", - - 'W', Blocks.wool, - 'I', tin, - 'P', ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood"), - }); - - Salvage.addSalvage(ToolListMF.paint_brush, Blocks.wool, tin, ((ItemComponentMF)ComponentListMF.plank).construct("RefinedWood")); - } - - private static void addCogworkParts() - { - BaseMaterialMF material = BaseMaterialMF.steel; - int time = 1; - KnowledgeListMF.frameBlockR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(BlockListMF.frame_block), "cogArmour", false, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "R", - "I", - - 'I', ComponentListMF.iron_frame, - 'R', ComponentListMF.rivet, - }); - - Salvage.addSalvage(BlockListMF.frame_block, ComponentListMF.iron_frame, ComponentListMF.rivet); - - time = 10; - KnowledgeListMF.cogPulleyR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.cogwork_pulley), "cogArmour", false, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "RFR", - "GBG", - "RFR", - - 'B', Blocks.redstone_block, - 'F', ComponentListMF.iron_frame, - 'R', ComponentListMF.rivet, - 'G', ComponentListMF.tungsten_gears, - }); - Salvage.addSalvage(ComponentListMF.cogwork_pulley, Blocks.redstone_block, - new ItemStack(ComponentListMF.iron_frame, 2), - new ItemStack(ComponentListMF.rivet, 2), - new ItemStack(ComponentListMF.tungsten_gears, 2) - ); - Salvage.addSalvage(BlockListMF.frame_block, ComponentListMF.iron_frame, ComponentListMF.rivet); - - time = 10; - KnowledgeListMF.cogHelmR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(BlockListMF.cogwork_helm), "cogArmour", false, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "RFFR", - "SEES", - " RR ", - - 'E', Items.ender_eye, - 'F', ComponentListMF.iron_frame, - 'R', ComponentListMF.rivet, - 'S', ComponentListMF.cogwork_shaft, - }); - Salvage.addSalvage(BlockListMF.cogwork_helm, - new ItemStack(Items.ender_eye, 2), - new ItemStack(ComponentListMF.iron_frame, 2), - new ItemStack(ComponentListMF.cogwork_shaft, 2), - new ItemStack(ComponentListMF.rivet, 4)); - time = 15; - KnowledgeListMF.cogChestR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(BlockListMF.cogwork_chest), "cogArmour", false, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - " RFR ", - "RSFSR", - "RFBFR", - " SFS ", - - 'F', ComponentListMF.iron_frame, - 'R', ComponentListMF.rivet, - 'S', ComponentListMF.cogwork_shaft, - 'B', Blocks.furnace, - }); - Salvage.addSalvage(BlockListMF.cogwork_chest, - Blocks.furnace, - new ItemStack(ComponentListMF.iron_frame, 5), - new ItemStack(ComponentListMF.cogwork_shaft, 4), - new ItemStack(ComponentListMF.rivet, 6)); - - time = 10; - KnowledgeListMF.cogLegsR = - MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(BlockListMF.cogwork_legs), "cogArmour", false, "hammer", material.hammerTier, material.anvilTier, (int)(time*material.craftTimeModifier), new Object[] - { - "RFFFR", - "RS SR", - " S S ", - " F F ", - - 'F', ComponentListMF.iron_frame, - 'R', ComponentListMF.rivet, - 'S', ComponentListMF.cogwork_shaft, - }); - Salvage.addSalvage(BlockListMF.cogwork_legs, - new ItemStack(ComponentListMF.iron_frame, 5), - new ItemStack(ComponentListMF.cogwork_shaft, 4), - new ItemStack(ComponentListMF.rivet, 4)); - - } - - - public static final HashMaprecipeMap = new HashMap(); -} + +import java.util.HashMap; + +public class ForgingRecipes { + public static final HashMap recipeMap = new HashMap(); + private static final Skill artisanry = SkillList.artisanry; + private static final Skill engineering = SkillList.engineering; + private static final Skill construction = SkillList.construction; + + public static void init() { + ForgedToolRecipes.init(); + ForgedArmourRecipes.init(); + + + ItemStack ironbar = ComponentListMF.bar("Iron"); + ItemStack steelbar = ComponentListMF.bar("Steel"); + ItemStack goldbar = ComponentListMF.bar("Gold"); + ItemStack silverbar = ComponentListMF.bar("Silver"); + ItemStack dwarvenbar = ComponentListMF.bar("dwarfsteel"); + ItemStack emeraldbar = ComponentListMF.bar("emerald"); + + // MISC + BaseMaterialMF material; + int time; + time = 1; + material = BaseMaterialMF.encrusted; + + KnowledgeListMF.obsidianHunkR = MineFantasyAPI.addAnvilRecipe(null, + new ItemStack(ComponentListMF.obsidian_rock, 4), "", false, material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"D", 'D', Blocks.obsidian,}); + KnowledgeListMF.diamondR = MineFantasyAPI.addAnvilRecipe(null, new ItemStack(ComponentListMF.diamond_shards), + "", false, material.hammerTier, material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"D", 'D', Items.diamond,}); + + time = 3; + KnowledgeListMF.encrustedR = MineFantasyAPI.addAnvilRecipe(artisanry, ComponentListMF.bar("Encrusted"), + "smeltEncrusted", true, material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), + new Object[]{"D", "I", 'D', ComponentListMF.diamond_shards, 'I', ComponentListMF.bar("Steel"),}); + Salvage.addSalvage(ComponentListMF.ingots[5], ComponentListMF.ingots[4], ComponentListMF.diamond_shards); + Salvage.addSalvage(ComponentListMF.bar("Encrusted"), ComponentListMF.ingots[4], + ComponentListMF.diamond_shards); + + material = BaseMaterialMF.pigiron; + KnowledgeListMF.steelR = MineFantasyAPI.addAnvilRecipe(artisanry, ComponentListMF.bar("Steel"), "smeltSteel", + true, 1, 1, 5, + new Object[]{"C", "H", 'C', ComponentListMF.coalDust, 'H', ComponentListMF.bar("PigIron")}); + KnowledgeListMF.fluxR = MineFantasyAPI.addAnvilRecipe(null, new ItemStack(ComponentListMF.flux, 4), "", false, + -1, -1, 2, new Object[]{"H", 'H', BlockListMF.limestone}); + + // STUDDED + material = BaseMaterialMF.iron; + // HELMET + time = 10; + KnowledgeListMF.studHelmetR = MineFantasyAPI.addAnvilRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 3, 0), "craftArmourLight", false, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), new Object[]{" I ", "IAI", " I ", 'I', + ComponentListMF.rivet, 'A', ArmourListMF.armourItem(ArmourListMF.leather, 2, 0),}); + // CHEST + time = 20; + KnowledgeListMF.studChestR = MineFantasyAPI.addAnvilRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 3, 1), "craftArmourLight", false, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), new Object[]{" I ", "IAI", " I ", 'I', + ComponentListMF.rivet, 'A', ArmourListMF.armourItem(ArmourListMF.leather, 2, 1),}); + // LEGS + time = 15; + KnowledgeListMF.studLegsR = MineFantasyAPI.addAnvilRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 3, 2), "craftArmourLight", false, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), new Object[]{" I ", "IAI", " I ", 'I', + ComponentListMF.rivet, 'A', ArmourListMF.armourItem(ArmourListMF.leather, 2, 2),}); + // BOOTS + time = 6; + KnowledgeListMF.studBootsR = MineFantasyAPI.addAnvilRecipe(artisanry, + ArmourListMF.armour(ArmourListMF.leather, 3, 3), "craftArmourLight", false, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), new Object[]{" I ", "IAI", " I ", 'I', + ComponentListMF.rivet, 'A', ArmourListMF.armourItem(ArmourListMF.leather, 2, 3),}); + + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 3, 0), + ArmourListMF.armour(ArmourListMF.leather, 2, 0), new ItemStack(ComponentListMF.rivet, 4)); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 3, 1), + ArmourListMF.armour(ArmourListMF.leather, 2, 1), new ItemStack(ComponentListMF.rivet, 4)); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 3, 2), + ArmourListMF.armour(ArmourListMF.leather, 2, 2), new ItemStack(ComponentListMF.rivet, 4)); + Salvage.addSalvage(ArmourListMF.armourItem(ArmourListMF.leather, 3, 3), + ArmourListMF.armour(ArmourListMF.leather, 2, 3), new ItemStack(ComponentListMF.rivet, 4)); + + time = 2; + material = BaseMaterialMF.iron; + if (ConfigCrafting.allowIronResmelt) { + MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep), "blastfurn", false, + material.hammerTier, material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"IFI", 'I', ComponentListMF.bar("iron"), 'F', ComponentListMF.flux,}); + MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep, 2), "blastfurn", false, + material.hammerTier, material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"IFI", 'I', ComponentListMF.bar("iron"), 'F', ComponentListMF.flux_strong,}); + } + KnowledgeListMF.coalPrepR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.coal_prep), + "coke", false, material.hammerTier, material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"RCR", "CFC", "RCR", 'R', Items.redstone, 'C', new ItemStack(Items.coal, 1, 1), 'F', + ComponentListMF.flux_strong,}); + GameRegistry.addSmelting(ComponentListMF.coal_prep, new ItemStack(ComponentListMF.coke), 1F); + + KnowledgeListMF.ironPrepR = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep), + "blastfurn", false, material.hammerTier, material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"IFI", 'I', Blocks.iron_ore, 'F', ComponentListMF.flux,}); + KnowledgeListMF.ironPrepR2 = MineFantasyAPI.addAnvilRecipe(artisanry, + new ItemStack(ComponentListMF.iron_prep, 2), "blastfurn", false, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"IFI", 'I', Blocks.iron_ore, 'F', ComponentListMF.flux_strong,}); + + MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep), "blastfurn", false, + material.hammerTier, material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"IFI", 'I', ComponentListMF.oreIron, 'F', ComponentListMF.flux,}); + MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.iron_prep, 2), "blastfurn", false, + material.hammerTier, material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"IFI", 'I', ComponentListMF.oreIron, 'F', ComponentListMF.flux_strong,}); + ItemStack plate = ComponentListMF.plate.createComm("iron"); + time = 10; + KnowledgeListMF.blastChamR = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.blast_chamber), + "blastfurn", false, "hvyHammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), + new Object[]{"RP PR", "RP PR", "RP PR", "RP PR", 'R', ComponentListMF.rivet, 'P', plate,}); + + time = 15; + KnowledgeListMF.blastHeatR = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.blast_heater), + "blastfurn", false, "hvyHammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"RP PR", "RP PR", "RP PR", "RPFPR", 'R', + ComponentListMF.rivet, 'P', plate, 'F', Blocks.furnace,}); + + Salvage.addSalvage(BlockListMF.blast_heater, new ItemStack(ComponentListMF.rivet, 8), plate, plate, plate, + plate, plate, plate, plate, plate, Blocks.furnace); + Salvage.addSalvage(BlockListMF.blast_chamber, new ItemStack(ComponentListMF.rivet, 8), plate, plate, plate, + plate, plate, plate, plate, plate); + + time = 10; + KnowledgeListMF.bigFurnR = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.furnace_stone), + "bigfurn", false, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"PRP", "RCR", "PFP", 'F', Blocks.furnace, 'R', + ComponentListMF.rivet, 'P', plate, 'C', BlockListMF.firebricks}); + time = 10; + KnowledgeListMF.bigHeatR = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.furnace_heater), + "bigfurn", false, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"RCR", "PFP", 'R', ComponentListMF.rivet, 'P', + plate, 'C', BlockListMF.firebricks, 'F', BlockListMF.forge,}); + + Salvage.addSalvage(BlockListMF.furnace_heater, new ItemStack(ComponentListMF.rivet, 2), plate, plate, + BlockListMF.firebricks, BlockListMF.forge); + Salvage.addSalvage(BlockListMF.furnace_stone, new ItemStack(ComponentListMF.rivet, 3), plate, plate, plate, + plate, BlockListMF.firebricks, Blocks.furnace); + + IAnvilRecipe[] anvilRecs = new IAnvilRecipe[BlockListMF.anvils.length]; + for (int id = 0; id < BlockListMF.anvils.length; id++) { + time = 8; + material = BaseMaterialMF.getMaterial(BlockListMF.anvils[id]); + ItemStack bar = ComponentListMF.bar(material.name); + + anvilRecs[id] = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(BlockListMF.anvil[id]), + "smelt" + material.name, false, "hammer", -1, -1, (int) (time * material.craftTimeModifier), + new Object[]{" II", "III", " I ", 'I', bar,}); + + Salvage.addSalvage(BlockListMF.anvil[id], ComponentListMF.bar(material.name, 6)); + } + recipeMap.put("anvilCrafting", anvilRecs); + + ItemStack bronzeHunk = ComponentListMF.metalHunk.createComm("bronze"); + ItemStack ironHunk = ComponentListMF.metalHunk.createComm("iron"); + + time = 2; + material = BaseMaterialMF.bronze; + KnowledgeListMF.framedStoneR = MineFantasyAPI.addAnvilRecipe(construction, + new ItemStack(BlockListMF.reinforced_stone_framed), "decorated_stone", false, "hammer", + material.hammerTier - 1, material.anvilTier - 1, (int) (time * material.craftTimeModifier), + new Object[]{" N ", "NSN", " N ", 'N', bronzeHunk, 'S', BlockListMF.reinforced_stone,}); + Salvage.addSalvage(BlockListMF.reinforced_stone_framed, bronzeHunk, bronzeHunk, bronzeHunk, bronzeHunk, + BlockListMF.reinforced_stone); + time = 2; + material = BaseMaterialMF.iron; + KnowledgeListMF.iframedStoneR = MineFantasyAPI.addAnvilRecipe(construction, + new ItemStack(BlockListMF.reinforced_stone_framediron), "decorated_stone", false, "hammer", + material.hammerTier - 1, material.anvilTier - 1, (int) (time * material.craftTimeModifier), + new Object[]{" N ", "NSN", " N ", 'N', ironHunk, 'S', BlockListMF.reinforced_stone,}); + Salvage.addSalvage(BlockListMF.reinforced_stone_framediron, ironHunk, ironHunk, ironHunk, ironHunk, + BlockListMF.reinforced_stone); + + time = 2; + material = BaseMaterialMF.bronze; + KnowledgeListMF.smokePipeR = MineFantasyAPI.addAnvilRecipe(construction, + new ItemStack(BlockListMF.chimney_pipe, 4), "", false, "hammer", material.hammerTier - 1, + material.anvilTier - 1, (int) (time * material.craftTimeModifier), + new Object[]{"N N", "PPPP", "N N", 'N', bronzeHunk, 'P', BlockListMF.chimney_stone,}); + Salvage.addSalvage(BlockListMF.chimney_pipe, BlockListMF.chimney_stone, bronzeHunk); + + for (int id = 0; id < BlockListMF.specialMetalBlocks.length; id++) { + time = 2; + material = BaseMaterialMF.getMaterial(BlockListMF.specialMetalBlocks[id]); + ItemStack hunk = ComponentListMF.metalHunk.createComm(material.name); + if (hunk != null) { + KnowledgeListMF.barsR + .add(MineFantasyAPI.addAnvilRecipe(construction, new ItemStack(BlockListMF.bars[id]), + "smelt" + material.name, false, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"I I", "I I", 'I', hunk,})); + if (hunk.getItem() instanceof ItemComponentMF) { + Salvage.addSalvage(BlockListMF.bars[id], hunk, hunk, hunk, hunk); + } + } + } + if (!ConfigHardcore.HCCRemoveTalismansCraft) { + KnowledgeListMF.talismanRecipe.add(MineFantasyAPI.addAnvilRecipe(artisanry, + new ItemStack(ComponentListMF.talisman_lesser), "", true, "hammer", -1, -1, 20, new Object[]{ + "LGL", "GIG", " G ", 'L', new ItemStack(Items.dye, 1, 4), 'I', ironbar, 'G', goldbar,})); + KnowledgeListMF.talismanRecipe.add(MineFantasyAPI.addAnvilRecipe(artisanry, + new ItemStack(ComponentListMF.talisman_lesser), "", true, "hammer", -1, -1, 20, new Object[]{ + "LSL", "SIS", " S ", 'L', new ItemStack(Items.dye, 1, 4), 'I', ironbar, 'S', silverbar,})); + KnowledgeListMF.greatTalismanRecipe = MineFantasyAPI.addAnvilRecipe(artisanry, + new ItemStack(ComponentListMF.talisman_greater), "", true, "hammer", 1, 1, 50, + new Object[]{"GSG", "DTD", "GDG", 'G', goldbar, 'D', Items.diamond, 'T', + ComponentListMF.talisman_lesser, 'S', Items.nether_star,}); + } + + addEngineering(); + addConstruction(); + + time = 10; + material = BaseMaterialMF.iron; + KnowledgeListMF.caketinRecipe = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(FoodListMF.cake_tin), "", + true, "hammer", material.hammerTier, material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{" R ", "I I", " I ", 'I', ironbar, 'R', ComponentListMF.rivet,}); + Salvage.addSalvage(FoodListMF.cake_tin, ComponentListMF.bar("Iron", 3), ComponentListMF.rivet); + + KnowledgeListMF.coalfluxR = MineFantasyAPI.addAnvilRecipe(artisanry, + new ItemStack(ComponentListMF.coal_flux, 2), "coalflux", false, material.hammerTier, material.anvilTier, + 2, new Object[]{"F", "C", 'C', Items.coal, 'F', ComponentListMF.flux_pot,}); + + time = 4; + material = BaseMaterialMF.iron; + KnowledgeListMF.hingeRecipe = MineFantasyAPI.addAnvilRecipe(construction, new ItemStack(ComponentListMF.hinge), + "", true, "hammer", material.hammerTier, material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"LR", 'L', ComponentListMF.leather_strip, 'R', ComponentListMF.rivet,}); + Salvage.addSalvage(ComponentListMF.hinge, ComponentListMF.leather_strip, ComponentListMF.rivet); + + time = 10; + KnowledgeListMF.crestR = MineFantasyAPI.addAnvilRecipe(artisanry, new ItemStack(ComponentListMF.ornate_items), + "craftOrnate", false, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), + new Object[]{" G ", "SLS", " G ", 'G', goldbar, 'S', silverbar, 'L', new ItemStack(Items.dye, 1, 4) + + }); + } + + private static Item getStrips(BaseMaterialMF material) { + return ComponentListMF.leather_strip; + } + + private static Item getLeather(BaseMaterialMF material) { + return Items.leather; + } + + private static void addEngineering() { + ItemStack copper = ComponentListMF.bar("Copper"); + ItemStack bronze = ComponentListMF.bar("Bronze"); + ItemStack iron = ComponentListMF.bar("Iron"); + ItemStack steel = ComponentListMF.bar("Steel"); + ItemStack tungsten = ComponentListMF.bar("Tungsten"); + ItemStack blacksteel = ComponentListMF.bar("BlackSteel"); + + ItemStack bronzeHunk = ComponentListMF.metalHunk.createComm("bronze"); + ItemStack ironHunk = ComponentListMF.metalHunk.createComm("iron"); + ItemStack steelHunk = ComponentListMF.metalHunk.createComm("steel"); + ItemStack tungstenHunk = ComponentListMF.metalHunk.createComm("tungsten"); + ItemStack obsidianHunk = ComponentListMF.metalHunk.createComm("obsidian"); + + BaseMaterialMF material = BaseMaterialMF.steel; + int time = 15; + KnowledgeListMF.eatoolsR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ToolListMF.engin_anvil_tools), "etools", true, "hammer", material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"SSLL", "LLSS", 'S', steelHunk, 'L', getStrips(material),}); + time = 5; + KnowledgeListMF.iframeR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.iron_frame), + "ecomponents", true, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"RRR", "ISI", "STS", "ISI", 'T', + ToolListMF.engin_anvil_tools, 'R', ComponentListMF.rivet, 'I', ironHunk, 'S', steelHunk,}); + time = 8; + KnowledgeListMF.istrutR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.iron_strut), + "ecomponents", true, "hvyhammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"RTR", "SIS", "SIS", 'T', + ToolListMF.engin_anvil_tools, 'R', ComponentListMF.rivet, 'I', iron, 'S', steelHunk,}); + time = 8; + KnowledgeListMF.stubeR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.steel_tube), + "ecomponents", true, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"TR R", "SSSS", 'T', + ToolListMF.engin_anvil_tools, 'R', ComponentListMF.rivet, 'S', steelHunk,}); + time = 2; + KnowledgeListMF.boltR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.bolt, 2), + "etools", true, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{" T ", "SIS", " S ", " S ", 'T', + ToolListMF.engin_anvil_tools, 'I', iron, 'S', steelHunk,}); + time = 35; + KnowledgeListMF.climbPickbR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ToolListMF.climbing_pick_basic), "climber", true, "hammer", material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{"L SR", "IISR", "L T ", 'R', ComponentListMF.rivet, 'T', ToolListMF.engin_anvil_tools, + 'I', iron, 'S', steel, 'L', getStrips(material),}); + time = 5; + KnowledgeListMF.bgearR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ComponentListMF.bronze_gears), + "ecomponents", true, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{" T ", " B ", "BIB", " B ", 'T', + ToolListMF.engin_anvil_tools, 'I', iron, 'B', bronzeHunk,}); + time = 8; + material = BaseMaterialMF.tungsten; + KnowledgeListMF.tgearR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ComponentListMF.tungsten_gears), "tungsten", true, "hammer", material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{" T ", " W ", "WGW", " W ", 'T', ToolListMF.engin_anvil_tools, 'W', tungstenHunk, 'G', + ComponentListMF.bronze_gears,}); + time = 5; + material = BaseMaterialMF.compositeAlloy; + KnowledgeListMF.compPlateR = MineFantasyAPI.addAnvilRecipe(engineering, ComponentListMF.bar("CompositeAlloy"), + "cogArmour", true, "hvyhammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{" T ", " S ", "RWR", " C ", + + 'R', ComponentListMF.rivet, 'T', ToolListMF.engin_anvil_tools, 'C', copper, 'W', tungstenHunk, + 'S', steel,}); + material = BaseMaterialMF.iron; + + time = 5; + KnowledgeListMF.bombCaseIronR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ComponentListMF.bomb_casing_iron, 2), "bombIron", true, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), new Object[]{" T ", " I ", "IRI", + " I ", 'T', ToolListMF.engin_anvil_tools, 'I', ironHunk, 'R', ComponentListMF.rivet,}); + KnowledgeListMF.mineCaseIronR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ComponentListMF.mine_casing_iron, 2), "bombIron", true, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{" T ", " P ", " IRI ", "IR RI", 'T', ToolListMF.engin_anvil_tools, 'P', + Blocks.heavy_weighted_pressure_plate, 'I', ironHunk, 'R', ComponentListMF.rivet,}); + + time = 5; + KnowledgeListMF.bombarrowR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ComponentListMF.bomb_casing_arrow), "bombarrow", true, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{" IR", "FPITI", " IR", 'T', ToolListMF.engin_anvil_tools, 'I', ironHunk, 'R', + Items.redstone, 'P', ComponentListMF.plank.construct("RefinedWood"), 'F', + ComponentListMF.fletching,}); + KnowledgeListMF.bombBoltR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ComponentListMF.bomb_casing_bolt), "bombarrow", true, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{" IR", "FITI", " IR", 'T', ToolListMF.engin_anvil_tools, 'I', ironHunk, 'R', + Items.redstone, 'F', ComponentListMF.fletching,}); + + material = BaseMaterialMF.blacksteel; + + time = 5; + KnowledgeListMF.bombCaseObsidianR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ComponentListMF.bomb_casing_obsidian, 2), "bombObsidian", true, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{" T ", "RIR", "IOI", "RIR", 'T', ToolListMF.engin_anvil_tools, 'O', Blocks.obsidian, 'I', + obsidianHunk, 'R', ComponentListMF.rivet,}); + KnowledgeListMF.mineCaseObsidianR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ComponentListMF.mine_casing_obsidian, 2), "mineObsidian", true, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), + new Object[]{" T ", " P ", " IRI ", "IRORI", 'T', ToolListMF.engin_anvil_tools, 'O', + Blocks.obsidian, 'P', Blocks.heavy_weighted_pressure_plate, 'I', obsidianHunk, 'R', + ComponentListMF.rivet,}); + time = 15; + material = BaseMaterialMF.steel; + KnowledgeListMF.crossBayonetR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ComponentListMF.cross_bayonet), "crossBayonet", true, material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), new Object[]{"R R I", "PIII ", 'P', + ComponentListMF.plank.construct("RefinedWood"), 'I', ironHunk, 'R', ComponentListMF.rivet,}); + + Salvage.addSalvage(ToolListMF.engin_anvil_tools, steelHunk, steelHunk, steelHunk, steelHunk, + new ItemStack(ComponentListMF.leather_strip, 4)); + + Salvage.addSalvage(ComponentListMF.iron_frame, steelHunk, steelHunk, steelHunk, steelHunk, ironHunk, ironHunk, + ironHunk, ironHunk, new ItemStack(ComponentListMF.rivet, 3)); + + Salvage.addSalvage(ComponentListMF.iron_strut, steelHunk, steelHunk, steelHunk, steelHunk, + ComponentListMF.bar("Iron", 2), new ItemStack(ComponentListMF.rivet, 2)); + + Salvage.addSalvage(ComponentListMF.steel_tube, steelHunk, steelHunk, steelHunk, steelHunk, + new ItemStack(ComponentListMF.rivet, 2)); + + Salvage.addSalvage(ToolListMF.climbing_pick_basic, ComponentListMF.bar("Iron", 2), + ComponentListMF.bar("Steel", 2), new ItemStack(ComponentListMF.rivet, 2), + new ItemStack(ComponentListMF.leather_strip, 2)); + + Salvage.addSalvage(ComponentListMF.bronze_gears, bronzeHunk, bronzeHunk, bronzeHunk, bronzeHunk, iron); + + Salvage.addSalvage(ComponentListMF.tungsten_gears, tungstenHunk, tungstenHunk, tungstenHunk, tungstenHunk, + ComponentListMF.bronze_gears); + + Salvage.addSalvage(ComponentListMF.bar("CompositeAlloy"), copper, steel, tungstenHunk, + new ItemStack(ComponentListMF.rivet, 2)); + Salvage.addSalvage(ComponentListMF.ingotCompositeAlloy, copper, steel, tungstenHunk, + new ItemStack(ComponentListMF.rivet, 2)); + + Salvage.addSalvage(ComponentListMF.bomb_casing_iron, ironHunk, ironHunk); + Salvage.addSalvage(ComponentListMF.mine_casing_iron, ironHunk, ironHunk, ComponentListMF.rivet, iron); + Salvage.addSalvage(ComponentListMF.bomb_casing_arrow, ironHunk, ironHunk, ironHunk, ironHunk, + new ItemStack(Items.redstone, 2), ComponentListMF.plank.construct("RefinedWood"), + ComponentListMF.fletching); + + Salvage.addSalvage(ComponentListMF.bomb_casing_bolt, ironHunk, ironHunk, ironHunk, ironHunk, + new ItemStack(Items.redstone, 2), ComponentListMF.fletching); + + Salvage.addSalvage(ComponentListMF.bomb_casing_obsidian, obsidianHunk, obsidianHunk, + new ItemStack(ComponentListMF.rivet, 2)); + Salvage.addSalvage(ComponentListMF.mine_casing_obsidian, obsidianHunk, obsidianHunk, iron, + ComponentListMF.rivet); + + Salvage.addSalvage(ComponentListMF.cross_bayonet, ironHunk, ironHunk, ironHunk, ironHunk, + ComponentListMF.plank.construct("RefinedWood"), new ItemStack(ComponentListMF.rivet, 2)); + } + + private static void addConstruction() { + BaseMaterialMF material = BaseMaterialMF.tin; + ItemStack tin = ComponentListMF.bar("Tin"); + int time = 10; + KnowledgeListMF.brushRecipe = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(ToolListMF.paint_brush), + "paint_brush", true, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"W", "I", "P", + + 'W', Blocks.wool, 'I', tin, 'P', ComponentListMF.plank.construct("RefinedWood"),}); + + Salvage.addSalvage(ToolListMF.paint_brush, Blocks.wool, tin, ComponentListMF.plank.construct("RefinedWood")); + } + + private static void addCogworkParts() { + BaseMaterialMF material = BaseMaterialMF.steel; + int time = 1; + KnowledgeListMF.frameBlockR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(BlockListMF.frame_block), + "cogArmour", false, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"R", "I", + + 'I', ComponentListMF.iron_frame, 'R', ComponentListMF.rivet,}); + + Salvage.addSalvage(BlockListMF.frame_block, ComponentListMF.iron_frame, ComponentListMF.rivet); + + time = 10; + KnowledgeListMF.cogPulleyR = MineFantasyAPI.addAnvilRecipe(engineering, + new ItemStack(ComponentListMF.cogwork_pulley), "cogArmour", false, "hammer", material.hammerTier, + material.anvilTier, (int) (time * material.craftTimeModifier), new Object[]{"RFR", "GBG", "RFR", + + 'B', Blocks.redstone_block, 'F', ComponentListMF.iron_frame, 'R', ComponentListMF.rivet, 'G', + ComponentListMF.tungsten_gears,}); + Salvage.addSalvage(ComponentListMF.cogwork_pulley, Blocks.redstone_block, + new ItemStack(ComponentListMF.iron_frame, 2), new ItemStack(ComponentListMF.rivet, 2), + new ItemStack(ComponentListMF.tungsten_gears, 2)); + Salvage.addSalvage(BlockListMF.frame_block, ComponentListMF.iron_frame, ComponentListMF.rivet); + + time = 10; + KnowledgeListMF.cogHelmR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(BlockListMF.cogwork_helm), + "cogArmour", false, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"RFFR", "SEES", " RR ", + + 'E', Items.ender_eye, 'F', ComponentListMF.iron_frame, 'R', ComponentListMF.rivet, 'S', + ComponentListMF.cogwork_shaft,}); + Salvage.addSalvage(BlockListMF.cogwork_helm, new ItemStack(Items.ender_eye, 2), + new ItemStack(ComponentListMF.iron_frame, 2), new ItemStack(ComponentListMF.cogwork_shaft, 2), + new ItemStack(ComponentListMF.rivet, 4)); + time = 15; + KnowledgeListMF.cogChestR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(BlockListMF.cogwork_chest), + "cogArmour", false, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{" RFR ", "RSFSR", "RFBFR", " SFS ", + + 'F', ComponentListMF.iron_frame, 'R', ComponentListMF.rivet, 'S', ComponentListMF.cogwork_shaft, + 'B', Blocks.furnace,}); + Salvage.addSalvage(BlockListMF.cogwork_chest, Blocks.furnace, new ItemStack(ComponentListMF.iron_frame, 5), + new ItemStack(ComponentListMF.cogwork_shaft, 4), new ItemStack(ComponentListMF.rivet, 6)); + + time = 10; + KnowledgeListMF.cogLegsR = MineFantasyAPI.addAnvilRecipe(engineering, new ItemStack(BlockListMF.cogwork_legs), + "cogArmour", false, "hammer", material.hammerTier, material.anvilTier, + (int) (time * material.craftTimeModifier), new Object[]{"RFFFR", "RS SR", " S S ", " F F ", + + 'F', ComponentListMF.iron_frame, 'R', ComponentListMF.rivet, 'S', + ComponentListMF.cogwork_shaft,}); + Salvage.addSalvage(BlockListMF.cogwork_legs, new ItemStack(ComponentListMF.iron_frame, 5), + new ItemStack(ComponentListMF.cogwork_shaft, 4), new ItemStack(ComponentListMF.rivet, 4)); + + + //NEW + + } +} \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/recipe/RecipeArmourDyeMF.java b/src/main/java/minefantasy/mf2/recipe/RecipeArmourDyeMF.java index 0a308e3d..ed9214f7 100644 --- a/src/main/java/minefantasy/mf2/recipe/RecipeArmourDyeMF.java +++ b/src/main/java/minefantasy/mf2/recipe/RecipeArmourDyeMF.java @@ -1,7 +1,5 @@ package minefantasy.mf2.recipe; -import java.util.ArrayList; - import minefantasy.mf2.item.armour.ItemArmourMF; import net.minecraft.block.BlockColored; import net.minecraft.entity.passive.EntitySheep; @@ -11,38 +9,31 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; -public class RecipeArmourDyeMF implements IRecipe -{ +import java.util.ArrayList; + +public class RecipeArmourDyeMF implements IRecipe { /** * Used to check if a recipe matches current crafting inventory */ @Override - public boolean matches(InventoryCrafting matrix, World world) - { + public boolean matches(InventoryCrafting matrix, World world) { ItemStack itemstack = null; ArrayList arraylist = new ArrayList(); - for (int i = 0; i < matrix.getSizeInventory(); ++i) - { + for (int i = 0; i < matrix.getSizeInventory(); ++i) { ItemStack itemstack1 = matrix.getStackInSlot(i); - if (itemstack1 != null) - { - if (itemstack1.getItem() instanceof ItemArmourMF) - { - ItemArmourMF itemarmor = (ItemArmourMF)itemstack1.getItem(); + if (itemstack1 != null) { + if (itemstack1.getItem() instanceof ItemArmourMF) { + ItemArmourMF itemarmor = (ItemArmourMF) itemstack1.getItem(); - if (!itemarmor.canColour() || itemstack != null) - { + if (!itemarmor.canColour() || itemstack != null) { return false; } itemstack = itemstack1; - } - else - { - if (itemstack1.getItem() != Items.dye) - { + } else { + if (itemstack1.getItem() != Items.dye) { return false; } @@ -58,8 +49,7 @@ public boolean matches(InventoryCrafting matrix, World world) * Returns an Item that is the result of this recipe */ @Override - public ItemStack getCraftingResult(InventoryCrafting matrix) - { + public ItemStack getCraftingResult(InventoryCrafting matrix) { ItemStack itemstack = null; int[] aint = new int[3]; int i = 0; @@ -71,48 +61,41 @@ public ItemStack getCraftingResult(InventoryCrafting matrix) float f1; int l1; - for (k = 0; k < matrix.getSizeInventory(); ++k) - { + for (k = 0; k < matrix.getSizeInventory(); ++k) { ItemStack itemstack1 = matrix.getStackInSlot(k); - if (itemstack1 != null) - { - if (itemstack1.getItem() instanceof ItemArmourMF) - { - itemarmor = (ItemArmourMF)itemstack1.getItem(); + if (itemstack1 != null) { + if (itemstack1.getItem() instanceof ItemArmourMF) { + itemarmor = (ItemArmourMF) itemstack1.getItem(); - if (!itemarmor.canColour() || itemstack != null) - { + if (!itemarmor.canColour() || itemstack != null) { return null; } itemstack = itemstack1.copy(); itemstack.stackSize = 1; - if (itemarmor.hasColor(itemstack1)) - { + if (itemarmor.hasColor(itemstack1)) { l = itemarmor.getColor(itemstack); f = (l >> 16 & 255) / 255.0F; f1 = (l >> 8 & 255) / 255.0F; float f2 = (l & 255) / 255.0F; - i = (int)(i + Math.max(f, Math.max(f1, f2)) * 255.0F); - aint[0] = (int)(aint[0] + f * 255.0F); - aint[1] = (int)(aint[1] + f1 * 255.0F); - aint[2] = (int)(aint[2] + f2 * 255.0F); + i = (int) (i + Math.max(f, Math.max(f1, f2)) * 255.0F); + aint[0] = (int) (aint[0] + f * 255.0F); + aint[1] = (int) (aint[1] + f1 * 255.0F); + aint[2] = (int) (aint[2] + f2 * 255.0F); ++j; } - } - else - { - if (itemstack1.getItem() != Items.dye) - { + } 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); + 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; @@ -122,20 +105,17 @@ public ItemStack getCraftingResult(InventoryCrafting matrix) } } - if (itemarmor == null) - { + if (itemarmor == null) { return null; - } - else - { + } else { k = aint[0] / j; int i1 = aint[1] / j; l = aint[2] / j; - f = (float)i / (float)j; + f = (float) i / (float) j; f1 = Math.max(k, Math.max(i1, l)); - k = (int)(k * f / f1); - i1 = (int)(i1 * f / f1); - l = (int)(l * f / f1); + k = (int) (k * f / f1); + i1 = (int) (i1 * f / f1); + l = (int) (l * f / f1); l1 = (k << 8) + i1; l1 = (l1 << 8) + l; itemarmor.func_82813_b(itemstack, l1); @@ -147,14 +127,12 @@ public ItemStack getCraftingResult(InventoryCrafting matrix) * Returns the size of the recipe area */ @Override - public int getRecipeSize() - { + public int getRecipeSize() { return 10; } @Override - public ItemStack getRecipeOutput() - { + public ItemStack getRecipeOutput() { return null; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/recipe/RecipeRemover.java b/src/main/java/minefantasy/mf2/recipe/RecipeRemover.java index 98c9a63f..67b7d873 100644 --- a/src/main/java/minefantasy/mf2/recipe/RecipeRemover.java +++ b/src/main/java/minefantasy/mf2/recipe/RecipeRemover.java @@ -6,35 +6,26 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -public class RecipeRemover -{ - public static void removeRecipes() - { - MFLogUtil.log("MineFantasy: Removing replaced recipes..."); - for(int a = 0; a < CraftingManager.getInstance().getRecipeList().size(); a ++) - { - IRecipe rec = (IRecipe) CraftingManager.getInstance().getRecipeList().get(a); - if(rec.getRecipeOutput() != null && willRemoveItem(rec.getRecipeOutput(), ConfigHardcore.HCCRemoveCraft)) - { - CraftingManager.getInstance().getRecipeList().remove(a); - } - } - } - - private static boolean willRemoveItem(ItemStack item, boolean HCC) - { - if(item.getItem() == Items.stick)return true; - - if(HCC) - { - return item.getItem() == Items.bread - || item.getItem() == Items.pumpkin_pie - || item.getItem() == Items.cake - || item.getItem() == Items.flint_and_steel - || item.getItem() == Items.bucket - ;} - return false; - } +public class RecipeRemover { + public static void removeRecipes() { + MFLogUtil.log("MineFantasy: Removing replaced recipes..."); + for (int a = 0; a < CraftingManager.getInstance().getRecipeList().size(); a++) { + IRecipe rec = (IRecipe) CraftingManager.getInstance().getRecipeList().get(a); + if (rec.getRecipeOutput() != null && willRemoveItem(rec.getRecipeOutput(), ConfigHardcore.HCCRemoveCraft)) { + CraftingManager.getInstance().getRecipeList().remove(a); + } + } + } + + private static boolean willRemoveItem(ItemStack item, boolean HCC) { + if (item.getItem() == Items.stick) + return true; + + if (HCC) { + return item.getItem() == Items.bread || item.getItem() == Items.pumpkin_pie || item.getItem() == Items.cake + || item.getItem() == Items.flint_and_steel || item.getItem() == Items.bucket; + } + return false; + } } diff --git a/src/main/java/minefantasy/mf2/recipe/RecipeSyringe.java b/src/main/java/minefantasy/mf2/recipe/RecipeSyringe.java index 9a99a118..ea423cd9 100644 --- a/src/main/java/minefantasy/mf2/recipe/RecipeSyringe.java +++ b/src/main/java/minefantasy/mf2/recipe/RecipeSyringe.java @@ -1,47 +1,32 @@ package minefantasy.mf2.recipe; -import java.util.ArrayList; - -import minefantasy.mf2.item.armour.ItemArmourMF; -import minefantasy.mf2.item.gadget.ItemSyringe; import minefantasy.mf2.item.list.ToolListMF; -import net.minecraft.block.BlockColored; -import net.minecraft.entity.passive.EntitySheep; -import net.minecraft.init.Items; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; -public class RecipeSyringe implements IRecipe -{ +public class RecipeSyringe implements IRecipe { /** * Used to check if a recipe matches current crafting inventory */ @Override - public boolean matches(InventoryCrafting matrix, World world) - { + public boolean matches(InventoryCrafting matrix, World world) { ItemStack syringe = null; ItemStack filler = null; - for (int i = 0; i < matrix.getSizeInventory(); ++i) - { + for (int i = 0; i < matrix.getSizeInventory(); ++i) { ItemStack itemstack1 = matrix.getStackInSlot(i); - if (itemstack1 != null) - { - if (itemstack1.getItem() == ToolListMF.syringe_empty) - { + if (itemstack1 != null) { + if (itemstack1.getItem() == ToolListMF.syringe_empty) { syringe = itemstack1; - } - else if (itemstack1.getItem() instanceof ItemPotion) - { - ItemPotion potion = (ItemPotion)itemstack1.getItem(); + } else if (itemstack1.getItem() instanceof ItemPotion) { + ItemPotion potion = (ItemPotion) itemstack1.getItem(); - if(potion.isSplash(itemstack1.getItemDamage())) - { - return false; + if (potion.isSplash(itemstack1.getItemDamage())) { + return false; } filler = itemstack1; @@ -56,37 +41,29 @@ else if (itemstack1.getItem() instanceof ItemPotion) * Returns an Item that is the result of this recipe */ @Override - public ItemStack getCraftingResult(InventoryCrafting matrix) - { - ItemStack syringe = null; + public ItemStack getCraftingResult(InventoryCrafting matrix) { + ItemStack syringe = null; ItemStack filler = null; - for (int i = 0; i < matrix.getSizeInventory(); ++i) - { + for (int i = 0; i < matrix.getSizeInventory(); ++i) { ItemStack itemstack1 = matrix.getStackInSlot(i); - if (itemstack1 != null) - { - if (itemstack1.getItem() == ToolListMF.syringe_empty) - { + if (itemstack1 != null) { + if (itemstack1.getItem() == ToolListMF.syringe_empty) { syringe = itemstack1; - } - else if (itemstack1.getItem() instanceof ItemPotion) - { - ItemPotion potion = (ItemPotion)itemstack1.getItem(); + } else if (itemstack1.getItem() instanceof ItemPotion) { + ItemPotion potion = (ItemPotion) itemstack1.getItem(); - if(potion.isSplash(itemstack1.getItemDamage())) - { - return null; + if (potion.isSplash(itemstack1.getItemDamage())) { + return null; } filler = itemstack1; } } } - if(syringe != null && filler != null) - { - return new ItemStack(ToolListMF.syringe, 1, filler.getItemDamage()); + if (syringe != null && filler != null) { + return new ItemStack(ToolListMF.syringe, 1, filler.getItemDamage()); } return null; } @@ -95,14 +72,12 @@ else if (itemstack1.getItem() instanceof ItemPotion) * Returns the size of the recipe area */ @Override - public int getRecipeSize() - { + public int getRecipeSize() { return 10; } @Override - public ItemStack getRecipeOutput() - { + public ItemStack getRecipeOutput() { return null; } } \ No newline at end of file diff --git a/src/main/java/minefantasy/mf2/recipe/SalvageRecipes.java b/src/main/java/minefantasy/mf2/recipe/SalvageRecipes.java index 4b6bf92a..c3872229 100644 --- a/src/main/java/minefantasy/mf2/recipe/SalvageRecipes.java +++ b/src/main/java/minefantasy/mf2/recipe/SalvageRecipes.java @@ -1,139 +1,140 @@ package minefantasy.mf2.recipe; -import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.api.crafting.Salvage; -import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.item.list.ComponentListMF; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class SalvageRecipes -{ - public static void init() - { - ItemStack ironHunk = ComponentListMF.metalHunk.createComm("iron"); - Salvage.addSalvage(Items.wooden_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.planks, 3)); - Salvage.addSalvage(Items.wooden_axe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.planks, 3)); - Salvage.addSalvage(Items.wooden_shovel, new ItemStack(Items.stick, 2), new ItemStack(Blocks.planks, 1)); - Salvage.addSalvage(Items.wooden_hoe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.planks, 2)); - Salvage.addSalvage(Items.wooden_sword, new ItemStack(Items.stick, 1), new ItemStack(Blocks.planks, 2)); - - Salvage.addSalvage(Items.stone_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.cobblestone, 3)); - Salvage.addSalvage(Items.stone_axe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.cobblestone, 3)); - Salvage.addSalvage(Items.stone_shovel, new ItemStack(Items.stick, 2), new ItemStack(Blocks.cobblestone, 1)); - Salvage.addSalvage(Items.stone_hoe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.cobblestone, 2)); - Salvage.addSalvage(Items.stone_sword, new ItemStack(Items.stick, 1), new ItemStack(Blocks.cobblestone, 2)); - - Salvage.addSalvage(Items.leather_helmet, new ItemStack(Items.leather, 5)); - Salvage.addSalvage(Items.leather_chestplate, new ItemStack(Items.leather, 8)); - Salvage.addSalvage(Items.leather_leggings, new ItemStack(Items.leather, 7)); - Salvage.addSalvage(Items.leather_boots, new ItemStack(Items.leather, 4)); - - Salvage.addSalvage(Items.iron_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Items.iron_ingot, 3)); - Salvage.addSalvage(Items.iron_axe, new ItemStack(Items.stick, 2), new ItemStack(Items.iron_ingot, 3)); - Salvage.addSalvage(Items.iron_shovel, new ItemStack(Items.stick, 2), new ItemStack(Items.iron_ingot, 1)); - Salvage.addSalvage(Items.iron_hoe, new ItemStack(Items.stick, 2), new ItemStack(Items.iron_ingot, 2)); - Salvage.addSalvage(Items.iron_sword, new ItemStack(Items.stick, 1), new ItemStack(Items.iron_ingot, 2)); - Salvage.addSalvage(Items.chainmail_helmet, new ItemStack(Items.iron_ingot, 2)); - Salvage.addSalvage(Items.chainmail_chestplate, new ItemStack(Items.iron_ingot, 4)); - Salvage.addSalvage(Items.chainmail_leggings, new ItemStack(Items.iron_ingot, 4)); - Salvage.addSalvage(Items.chainmail_boots, new ItemStack(Items.iron_ingot, 2)); - Salvage.addSalvage(Items.iron_helmet, new ItemStack(Items.iron_ingot, 5)); - Salvage.addSalvage(Items.iron_chestplate, new ItemStack(Items.iron_ingot, 8)); - Salvage.addSalvage(Items.iron_leggings, new ItemStack(Items.iron_ingot, 7)); - Salvage.addSalvage(Items.iron_boots, new ItemStack(Items.iron_ingot, 4)); - Salvage.addSalvage(Items.iron_horse_armor, Items.leather, new ItemStack(Items.iron_ingot, 8)); - - Salvage.addSalvage(Items.golden_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Items.gold_ingot, 3)); - Salvage.addSalvage(Items.golden_axe, new ItemStack(Items.stick, 2), new ItemStack(Items.gold_ingot, 3)); - Salvage.addSalvage(Items.golden_shovel, new ItemStack(Items.stick, 2), new ItemStack(Items.gold_ingot, 1)); - Salvage.addSalvage(Items.golden_hoe, new ItemStack(Items.stick, 2), new ItemStack(Items.gold_ingot, 2)); - Salvage.addSalvage(Items.golden_sword, new ItemStack(Items.stick, 1), new ItemStack(Items.gold_ingot, 2)); - Salvage.addSalvage(Items.golden_helmet, new ItemStack(Items.gold_ingot, 5)); - Salvage.addSalvage(Items.golden_chestplate, new ItemStack(Items.gold_ingot, 8)); - Salvage.addSalvage(Items.golden_leggings, new ItemStack(Items.gold_ingot, 7)); - Salvage.addSalvage(Items.golden_boots, new ItemStack(Items.gold_ingot, 4)); - Salvage.addSalvage(Items.golden_horse_armor, Items.leather, new ItemStack(Items.gold_ingot, 8)); - - Salvage.addSalvage(Items.diamond_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Items.diamond, 3)); - Salvage.addSalvage(Items.diamond_axe, new ItemStack(Items.stick, 2), new ItemStack(Items.diamond, 3)); - Salvage.addSalvage(Items.diamond_shovel, new ItemStack(Items.stick, 2), new ItemStack(Items.diamond, 1)); - Salvage.addSalvage(Items.diamond_hoe, new ItemStack(Items.stick, 2), new ItemStack(Items.diamond, 2)); - Salvage.addSalvage(Items.diamond_sword, new ItemStack(Items.stick, 1), new ItemStack(Items.diamond, 2)); - Salvage.addSalvage(Items.diamond_helmet, new ItemStack(Items.diamond, 5)); - Salvage.addSalvage(Items.diamond_chestplate, new ItemStack(Items.diamond, 8)); - Salvage.addSalvage(Items.diamond_leggings, new ItemStack(Items.diamond, 7)); - Salvage.addSalvage(Items.diamond_boots, new ItemStack(Items.diamond, 4)); - Salvage.addSalvage(Items.diamond_horse_armor, Items.leather, new ItemStack(Items.diamond, 8)); - - Salvage.addSalvage(Items.flint_and_steel, Items.flint, Items.iron_ingot); - Salvage.addSalvage(Items.compass, Items.redstone, new ItemStack(Items.iron_ingot, 4)); - Salvage.addSalvage(Items.clock, Items.redstone, new ItemStack(Items.gold_ingot, 4)); - Salvage.addSalvage(Items.bow, new ItemStack(Items.stick, 3), new ItemStack(Items.string, 3)); - Salvage.addSalvage(Items.fishing_rod, new ItemStack(Items.stick, 3), new ItemStack(Items.string, 2)); - Salvage.addSalvage(Items.shears, new ItemStack(Items.iron_ingot, 2)); - Salvage.addSalvage(Items.minecart, new ItemStack(Items.iron_ingot, 5)); - Salvage.addSalvage(Items.boat, new ItemStack(Blocks.planks, 5)); - - Salvage.addSalvage(Blocks.furnace, new ItemStack(Blocks.cobblestone, 8)); - Salvage.addSalvage(Blocks.dispenser, Items.bow, Items.redstone, new ItemStack(Blocks.cobblestone, 7)); - Salvage.addSalvage(Blocks.dropper, Items.redstone, new ItemStack(Blocks.cobblestone, 7)); - Salvage.addSalvage(Blocks.chest, new ItemStack(Blocks.planks, 8)); - Salvage.addSalvage(Blocks.piston, Items.redstone, Items.iron_ingot, new ItemStack(Blocks.cobblestone, 4), new ItemStack(Blocks.planks, 3)); - Salvage.addSalvage(Blocks.sticky_piston, Items.slime_ball, Blocks.piston); - Salvage.addSalvage(Items.wooden_door, new ItemStack(Blocks.planks, 6)); - Salvage.addSalvage(Items.iron_door, new ItemStack(Items.iron_ingot, 6)); - Salvage.addSalvage(Blocks.trapdoor, new ItemStack(Blocks.planks, 3)); - Salvage.addSalvage(Blocks.hopper, Blocks.chest, new ItemStack(Items.iron_ingot, 5)); - Salvage.addSalvage(Items.cauldron, new ItemStack(Items.iron_ingot, 7)); - Salvage.addSalvage(Items.bed, new ItemStack(Blocks.planks, 3), new ItemStack(Blocks.wool, 3)); - Salvage.addSalvage(Items.book, new ItemStack(Items.paper, 3), Items.leather); - Salvage.addSalvage(Items.brewing_stand, new ItemStack(Blocks.cobblestone, 3), Items.blaze_rod); - Salvage.addSalvage(Items.carrot_on_a_stick, Items.carrot, Items.fishing_rod); - Salvage.addSalvage(Items.comparator, new ItemStack(Blocks.redstone_torch, 3), new ItemStack(Blocks.stone, 3), Items.quartz); - Salvage.addSalvage(Items.ender_eye, Items.ender_pearl, Items.blaze_powder); - Salvage.addSalvage(Items.magma_cream, Items.blaze_powder, Items.slime_ball); - Salvage.addSalvage(Items.painting, new ItemStack(Items.stick, 8), Blocks.wool); - Salvage.addSalvage(Items.repeater, new ItemStack(Blocks.stone, 3), new ItemStack(Blocks.redstone_torch, 2), Items.redstone); - Salvage.addSalvage(Items.saddle, Items.leather, 5); - Salvage.addSalvage(Items.sign, new ItemStack(Blocks.planks, 2)); - Salvage.addSalvage(Items.speckled_melon, new ItemStack(Items.gold_nugget, 8), Items.melon); - Salvage.addSalvage(Blocks.activator_rail, Items.iron_ingot, Items.redstone); - Salvage.addSalvage(Blocks.anvil, new ItemStack(Items.iron_ingot, 31)); - Salvage.addSalvage(Blocks.beacon, Items.nether_star, new ItemStack(Blocks.glass, 5), new ItemStack(Blocks.obsidian, 3)); - Salvage.addSalvage(Blocks.bookshelf, new ItemStack(Blocks.planks, 6), new ItemStack(Items.book, 3)); - Salvage.addSalvage(Blocks.crafting_table, new ItemStack(Blocks.planks, 4)); - Salvage.addSalvage(Blocks.daylight_detector, new ItemStack(Blocks.glass, 3), new ItemStack(Blocks.wooden_slab, 3), new ItemStack(Items.quartz, 3)); - Salvage.addSalvage(Blocks.deadbush, new ItemStack(Items.stick, 4)); - Salvage.addSalvage(Blocks.detector_rail, Blocks.rail, Blocks.stone_pressure_plate); - Salvage.addSalvage(Blocks.enchanting_table, new ItemStack(Blocks.obsidian, 4), new ItemStack(Items.diamond, 2), Items.book); - Salvage.addSalvage(Blocks.ender_chest, new ItemStack(Blocks.obsidian, 8), Items.ender_eye); - Salvage.addSalvage(Blocks.fence, new ItemStack(Items.stick, 3)); - Salvage.addSalvage(Blocks.fence_gate, new ItemStack(Blocks.planks, 2), new ItemStack(Items.stick, 4)); - Salvage.addSalvage(Blocks.golden_rail, Items.gold_ingot); - Salvage.addSalvage(Blocks.heavy_weighted_pressure_plate, new ItemStack(Items.iron_ingot, 2)); - Salvage.addSalvage(Blocks.light_weighted_pressure_plate, new ItemStack(Items.gold_ingot, 2)); - Salvage.addSalvage(Blocks.jukebox, new ItemStack(Blocks.planks, 8), Items.diamond); - Salvage.addSalvage(Blocks.ladder, new ItemStack(Items.stick, 2)); - Salvage.addSalvage(Blocks.lever, Items.stick, Blocks.cobblestone); - Salvage.addSalvage(Blocks.lit_pumpkin, Blocks.pumpkin, Blocks.torch); - Salvage.addSalvage(Blocks.noteblock, new ItemStack(Blocks.planks, 8), Items.redstone); - Salvage.addSalvage(Blocks.rail, ironHunk); - Salvage.addSalvage(Blocks.redstone_lamp, new ItemStack(Items.redstone, 4), Blocks.glowstone); - Salvage.addSalvage(Blocks.redstone_torch, Items.stick, Items.redstone); - Salvage.addSalvage(Blocks.sandstone, new ItemStack(Blocks.sand, 4)); - Salvage.addSalvage(Blocks.stonebrick, Blocks.stone); - Salvage.addSalvage(Blocks.stone_button, Blocks.stone); - Salvage.addSalvage(Blocks.stone_pressure_plate, new ItemStack(Blocks.stone, 2)); - Salvage.addSalvage(Blocks.tnt, new ItemStack(Blocks.sand, 4), Items.gunpowder, 5); - Salvage.addSalvage(Blocks.trapped_chest, Blocks.chest, Blocks.tripwire_hook); - Salvage.addSalvage(Blocks.tripwire_hook, ironHunk, ironHunk); - Salvage.addSalvage(Blocks.wooden_button, Blocks.planks); - Salvage.addSalvage(Blocks.wooden_pressure_plate, new ItemStack(Blocks.planks, 2)); - Salvage.addSalvage(Blocks.cobblestone_wall, Blocks.cobblestone); - Salvage.addSalvage(Blocks.iron_bars, ironHunk, ironHunk); - Salvage.addSalvage(Items.item_frame, new ItemStack(Items.stick, 8), Items.leather); - } +public class SalvageRecipes { + public static void init() { + ItemStack ironHunk = ComponentListMF.metalHunk.createComm("iron"); + Salvage.addSalvage(Items.wooden_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.planks, 3)); + Salvage.addSalvage(Items.wooden_axe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.planks, 3)); + Salvage.addSalvage(Items.wooden_shovel, new ItemStack(Items.stick, 2), new ItemStack(Blocks.planks, 1)); + Salvage.addSalvage(Items.wooden_hoe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.planks, 2)); + Salvage.addSalvage(Items.wooden_sword, new ItemStack(Items.stick, 1), new ItemStack(Blocks.planks, 2)); + + Salvage.addSalvage(Items.stone_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.cobblestone, 3)); + Salvage.addSalvage(Items.stone_axe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.cobblestone, 3)); + Salvage.addSalvage(Items.stone_shovel, new ItemStack(Items.stick, 2), new ItemStack(Blocks.cobblestone, 1)); + Salvage.addSalvage(Items.stone_hoe, new ItemStack(Items.stick, 2), new ItemStack(Blocks.cobblestone, 2)); + Salvage.addSalvage(Items.stone_sword, new ItemStack(Items.stick, 1), new ItemStack(Blocks.cobblestone, 2)); + + Salvage.addSalvage(Items.leather_helmet, new ItemStack(Items.leather, 5)); + Salvage.addSalvage(Items.leather_chestplate, new ItemStack(Items.leather, 8)); + Salvage.addSalvage(Items.leather_leggings, new ItemStack(Items.leather, 7)); + Salvage.addSalvage(Items.leather_boots, new ItemStack(Items.leather, 4)); + + Salvage.addSalvage(Items.iron_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Items.iron_ingot, 3)); + Salvage.addSalvage(Items.iron_axe, new ItemStack(Items.stick, 2), new ItemStack(Items.iron_ingot, 3)); + Salvage.addSalvage(Items.iron_shovel, new ItemStack(Items.stick, 2), new ItemStack(Items.iron_ingot, 1)); + Salvage.addSalvage(Items.iron_hoe, new ItemStack(Items.stick, 2), new ItemStack(Items.iron_ingot, 2)); + Salvage.addSalvage(Items.iron_sword, new ItemStack(Items.stick, 1), new ItemStack(Items.iron_ingot, 2)); + Salvage.addSalvage(Items.chainmail_helmet, new ItemStack(Items.iron_ingot, 2)); + Salvage.addSalvage(Items.chainmail_chestplate, new ItemStack(Items.iron_ingot, 4)); + Salvage.addSalvage(Items.chainmail_leggings, new ItemStack(Items.iron_ingot, 4)); + Salvage.addSalvage(Items.chainmail_boots, new ItemStack(Items.iron_ingot, 2)); + Salvage.addSalvage(Items.iron_helmet, new ItemStack(Items.iron_ingot, 5)); + Salvage.addSalvage(Items.iron_chestplate, new ItemStack(Items.iron_ingot, 8)); + Salvage.addSalvage(Items.iron_leggings, new ItemStack(Items.iron_ingot, 7)); + Salvage.addSalvage(Items.iron_boots, new ItemStack(Items.iron_ingot, 4)); + Salvage.addSalvage(Items.iron_horse_armor, Items.leather, new ItemStack(Items.iron_ingot, 8)); + + Salvage.addSalvage(Items.golden_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Items.gold_ingot, 3)); + Salvage.addSalvage(Items.golden_axe, new ItemStack(Items.stick, 2), new ItemStack(Items.gold_ingot, 3)); + Salvage.addSalvage(Items.golden_shovel, new ItemStack(Items.stick, 2), new ItemStack(Items.gold_ingot, 1)); + Salvage.addSalvage(Items.golden_hoe, new ItemStack(Items.stick, 2), new ItemStack(Items.gold_ingot, 2)); + Salvage.addSalvage(Items.golden_sword, new ItemStack(Items.stick, 1), new ItemStack(Items.gold_ingot, 2)); + Salvage.addSalvage(Items.golden_helmet, new ItemStack(Items.gold_ingot, 5)); + Salvage.addSalvage(Items.golden_chestplate, new ItemStack(Items.gold_ingot, 8)); + Salvage.addSalvage(Items.golden_leggings, new ItemStack(Items.gold_ingot, 7)); + Salvage.addSalvage(Items.golden_boots, new ItemStack(Items.gold_ingot, 4)); + Salvage.addSalvage(Items.golden_horse_armor, Items.leather, new ItemStack(Items.gold_ingot, 8)); + + Salvage.addSalvage(Items.diamond_pickaxe, new ItemStack(Items.stick, 2), new ItemStack(Items.diamond, 3)); + Salvage.addSalvage(Items.diamond_axe, new ItemStack(Items.stick, 2), new ItemStack(Items.diamond, 3)); + Salvage.addSalvage(Items.diamond_shovel, new ItemStack(Items.stick, 2), new ItemStack(Items.diamond, 1)); + Salvage.addSalvage(Items.diamond_hoe, new ItemStack(Items.stick, 2), new ItemStack(Items.diamond, 2)); + Salvage.addSalvage(Items.diamond_sword, new ItemStack(Items.stick, 1), new ItemStack(Items.diamond, 2)); + Salvage.addSalvage(Items.diamond_helmet, new ItemStack(Items.diamond, 5)); + Salvage.addSalvage(Items.diamond_chestplate, new ItemStack(Items.diamond, 8)); + Salvage.addSalvage(Items.diamond_leggings, new ItemStack(Items.diamond, 7)); + Salvage.addSalvage(Items.diamond_boots, new ItemStack(Items.diamond, 4)); + Salvage.addSalvage(Items.diamond_horse_armor, Items.leather, new ItemStack(Items.diamond, 8)); + + Salvage.addSalvage(Items.flint_and_steel, Items.flint, Items.iron_ingot); + Salvage.addSalvage(Items.compass, Items.redstone, new ItemStack(Items.iron_ingot, 4)); + Salvage.addSalvage(Items.clock, Items.redstone, new ItemStack(Items.gold_ingot, 4)); + Salvage.addSalvage(Items.bow, new ItemStack(Items.stick, 3), new ItemStack(Items.string, 3)); + Salvage.addSalvage(Items.fishing_rod, new ItemStack(Items.stick, 3), new ItemStack(Items.string, 2)); + Salvage.addSalvage(Items.shears, new ItemStack(Items.iron_ingot, 2)); + Salvage.addSalvage(Items.minecart, new ItemStack(Items.iron_ingot, 5)); + Salvage.addSalvage(Items.boat, new ItemStack(Blocks.planks, 5)); + + Salvage.addSalvage(Blocks.furnace, new ItemStack(Blocks.cobblestone, 8)); + Salvage.addSalvage(Blocks.dispenser, Items.bow, Items.redstone, new ItemStack(Blocks.cobblestone, 7)); + Salvage.addSalvage(Blocks.dropper, Items.redstone, new ItemStack(Blocks.cobblestone, 7)); + Salvage.addSalvage(Blocks.chest, new ItemStack(Blocks.planks, 8)); + Salvage.addSalvage(Blocks.piston, Items.redstone, Items.iron_ingot, new ItemStack(Blocks.cobblestone, 4), + new ItemStack(Blocks.planks, 3)); + Salvage.addSalvage(Blocks.sticky_piston, Items.slime_ball, Blocks.piston); + Salvage.addSalvage(Items.wooden_door, new ItemStack(Blocks.planks, 6)); + Salvage.addSalvage(Items.iron_door, new ItemStack(Items.iron_ingot, 6)); + Salvage.addSalvage(Blocks.trapdoor, new ItemStack(Blocks.planks, 3)); + Salvage.addSalvage(Blocks.hopper, Blocks.chest, new ItemStack(Items.iron_ingot, 5)); + Salvage.addSalvage(Items.cauldron, new ItemStack(Items.iron_ingot, 7)); + Salvage.addSalvage(Items.bed, new ItemStack(Blocks.planks, 3), new ItemStack(Blocks.wool, 3)); + Salvage.addSalvage(Items.book, new ItemStack(Items.paper, 3), Items.leather); + Salvage.addSalvage(Items.brewing_stand, new ItemStack(Blocks.cobblestone, 3), Items.blaze_rod); + Salvage.addSalvage(Items.carrot_on_a_stick, Items.carrot, Items.fishing_rod); + Salvage.addSalvage(Items.comparator, new ItemStack(Blocks.redstone_torch, 3), new ItemStack(Blocks.stone, 3), + Items.quartz); + Salvage.addSalvage(Items.ender_eye, Items.ender_pearl, Items.blaze_powder); + Salvage.addSalvage(Items.magma_cream, Items.blaze_powder, Items.slime_ball); + Salvage.addSalvage(Items.painting, new ItemStack(Items.stick, 8), Blocks.wool); + Salvage.addSalvage(Items.repeater, new ItemStack(Blocks.stone, 3), new ItemStack(Blocks.redstone_torch, 2), + Items.redstone); + Salvage.addSalvage(Items.saddle, Items.leather, 5); + Salvage.addSalvage(Items.sign, new ItemStack(Blocks.planks, 2)); + Salvage.addSalvage(Items.speckled_melon, new ItemStack(Items.gold_nugget, 8), Items.melon); + Salvage.addSalvage(Blocks.activator_rail, Items.iron_ingot, Items.redstone); + Salvage.addSalvage(Blocks.anvil, new ItemStack(Items.iron_ingot, 31)); + Salvage.addSalvage(Blocks.beacon, Items.nether_star, new ItemStack(Blocks.glass, 5), + new ItemStack(Blocks.obsidian, 3)); + Salvage.addSalvage(Blocks.bookshelf, new ItemStack(Blocks.planks, 6), new ItemStack(Items.book, 3)); + Salvage.addSalvage(Blocks.crafting_table, new ItemStack(Blocks.planks, 4)); + Salvage.addSalvage(Blocks.daylight_detector, new ItemStack(Blocks.glass, 3), + new ItemStack(Blocks.wooden_slab, 3), new ItemStack(Items.quartz, 3)); + Salvage.addSalvage(Blocks.deadbush, new ItemStack(Items.stick, 4)); + Salvage.addSalvage(Blocks.detector_rail, Blocks.rail, Blocks.stone_pressure_plate); + Salvage.addSalvage(Blocks.enchanting_table, new ItemStack(Blocks.obsidian, 4), new ItemStack(Items.diamond, 2), + Items.book); + Salvage.addSalvage(Blocks.ender_chest, new ItemStack(Blocks.obsidian, 8), Items.ender_eye); + Salvage.addSalvage(Blocks.fence, new ItemStack(Items.stick, 3)); + Salvage.addSalvage(Blocks.fence_gate, new ItemStack(Blocks.planks, 2), new ItemStack(Items.stick, 4)); + Salvage.addSalvage(Blocks.golden_rail, Items.gold_ingot); + Salvage.addSalvage(Blocks.heavy_weighted_pressure_plate, new ItemStack(Items.iron_ingot, 2)); + Salvage.addSalvage(Blocks.light_weighted_pressure_plate, new ItemStack(Items.gold_ingot, 2)); + Salvage.addSalvage(Blocks.jukebox, new ItemStack(Blocks.planks, 8), Items.diamond); + Salvage.addSalvage(Blocks.ladder, new ItemStack(Items.stick, 2)); + Salvage.addSalvage(Blocks.lever, Items.stick, Blocks.cobblestone); + Salvage.addSalvage(Blocks.lit_pumpkin, Blocks.pumpkin, Blocks.torch); + Salvage.addSalvage(Blocks.noteblock, new ItemStack(Blocks.planks, 8), Items.redstone); + Salvage.addSalvage(Blocks.rail, ironHunk); + Salvage.addSalvage(Blocks.redstone_lamp, new ItemStack(Items.redstone, 4), Blocks.glowstone); + Salvage.addSalvage(Blocks.redstone_torch, Items.stick, Items.redstone); + Salvage.addSalvage(Blocks.sandstone, new ItemStack(Blocks.sand, 4)); + Salvage.addSalvage(Blocks.stonebrick, Blocks.stone); + Salvage.addSalvage(Blocks.stone_button, Blocks.stone); + Salvage.addSalvage(Blocks.stone_pressure_plate, new ItemStack(Blocks.stone, 2)); + Salvage.addSalvage(Blocks.tnt, new ItemStack(Blocks.sand, 4), Items.gunpowder, 5); + Salvage.addSalvage(Blocks.trapped_chest, Blocks.chest, Blocks.tripwire_hook); + Salvage.addSalvage(Blocks.tripwire_hook, ironHunk, ironHunk); + Salvage.addSalvage(Blocks.wooden_button, Blocks.planks); + Salvage.addSalvage(Blocks.wooden_pressure_plate, new ItemStack(Blocks.planks, 2)); + Salvage.addSalvage(Blocks.cobblestone_wall, Blocks.cobblestone); + Salvage.addSalvage(Blocks.iron_bars, ironHunk, ironHunk); + Salvage.addSalvage(Items.item_frame, new ItemStack(Items.stick, 8), Items.leather); + } } diff --git a/src/main/java/minefantasy/mf2/recipe/SmeltingRecipesMF.java b/src/main/java/minefantasy/mf2/recipe/SmeltingRecipesMF.java index 34e0af83..8450f6b0 100644 --- a/src/main/java/minefantasy/mf2/recipe/SmeltingRecipesMF.java +++ b/src/main/java/minefantasy/mf2/recipe/SmeltingRecipesMF.java @@ -1,11 +1,8 @@ package minefantasy.mf2.recipe; -import java.util.ArrayList; - import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.api.MineFantasyAPI; import minefantasy.mf2.api.crafting.refine.BloomRecipe; -import minefantasy.mf2.api.refine.Alloy; import minefantasy.mf2.api.refine.BigFurnaceRecipes; import minefantasy.mf2.block.list.BlockListMF; import minefantasy.mf2.config.ConfigHardcore; @@ -17,176 +14,147 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class SmeltingRecipesMF -{ - public static void init() - { - ItemStack copper = ComponentListMF.bar("Copper"); - ItemStack tin = ComponentListMF.bar("Tin"); - ItemStack bronze = ComponentListMF.bar("Bronze"); - ItemStack iron = ComponentListMF.bar("Iron"); - ItemStack pigiron = ComponentListMF.bar("RefinedIron"); - ItemStack steel = ComponentListMF.bar("Steel"); - ItemStack diamond = ComponentListMF.bar("Encrusted"); - ItemStack tungsten = ComponentListMF.bar("Tungsten"); - ItemStack obsidian = ComponentListMF.bar("Obsidian"); - ItemStack black = ComponentListMF.bar("BlackSteel"); - ItemStack red = ComponentListMF.bar("RedSteel"); - ItemStack blue = ComponentListMF.bar("BlueSteel"); - ItemStack gold = ComponentListMF.bar("Gold"); - ItemStack silver = ComponentListMF.bar("Silver"); - ItemStack mithril = ComponentListMF.bar("Mithril"); - ItemStack adamant = ComponentListMF.bar("Adamantium"); - ItemStack mithium = ComponentListMF.bar("Mithium"); - ItemStack ignotumite = ComponentListMF.bar("Ignotumite"); - ItemStack enderforge = ComponentListMF.bar("Ender"); - - KnowledgeListMF.reStone = - MineFantasyAPI.addRatioAlloy(1, new ItemStack(BlockListMF.reinforced_stone, 4), 1, new Object[] - { - Blocks.stone,Blocks.stone,Blocks.stone,Blocks.stone, ComponentListMF.fireclay, iron, ComponentListMF.obsidian_rock - }); - if(ConfigHardcore.HCCreduceIngots) - { - if(MineFantasyAPI.removeSmelting(Blocks.iron_ore) && MineFantasyAPI.removeSmelting(Blocks.gold_ore)) - { - MFLogUtil.logDebug("Removed Ore Smelting (Hardcore Ingots"); - } - else - { - MFLogUtil.logWarn("Failed to remove Ore smelting!"); - } - BloomRecipe.addRecipe(new ItemStack(Blocks.iron_ore), iron); - BloomRecipe.addRecipe(new ItemStack(Blocks.gold_ore), gold); - - MineFantasyAPI.addFurnaceRecipe(new ItemStack(Blocks.iron_ore), iron, 0); - MineFantasyAPI.addFurnaceRecipe(new ItemStack(Blocks.gold_ore), gold, 0); - } - - refineRawOre(ComponentListMF.oreCopper, copper); - refineRawOre(ComponentListMF.oreTin, tin); - refineRawOre(ComponentListMF.oreIron, iron); - refineRawOre(ComponentListMF.oreSilver, silver); - refineRawOre(ComponentListMF.oreGold, gold); - - refineRawOre(BlockListMF.oreCopper, copper, 0.4F); - refineRawOre(BlockListMF.oreTin, tin, 0.5F); - refineRawOre(BlockListMF.oreSilver, silver, 0.9F); - - GameRegistry.addSmelting(BlockListMF.oreBorax, new ItemStack(ComponentListMF.flux_strong, 4), 0.25F); - GameRegistry.addSmelting(BlockListMF.oreTungsten, new ItemStack(ComponentListMF.oreTungsten, 1), 0.25F); - GameRegistry.addSmelting(BlockListMF.oreKaolinite, new ItemStack(ComponentListMF.kaolinite), 0.25F); - GameRegistry.addSmelting(BlockListMF.oreNitre, new ItemStack(ComponentListMF.nitre, 4), 0.25F); - GameRegistry.addSmelting(BlockListMF.oreSulfur, new ItemStack(ComponentListMF.sulfur, 4), 0.25F); - GameRegistry.addSmelting(BlockListMF.oreClay, new ItemStack(Items.clay_ball, 4), 0.25F); - - //ALLOY - KnowledgeListMF.bronze = - MineFantasyAPI.addRatioAlloy(3, ComponentListMF.bar("bronze", 3), new Object[]{ - copper, copper, tin - }); - - KnowledgeListMF.obsidalloy = - MineFantasyAPI.addRatioAlloy(1, obsidian, 1, new Object[]{ - steel, - ComponentListMF.obsidian_rock, ComponentListMF.obsidian_rock, ComponentListMF.obsidian_rock, ComponentListMF.obsidian_rock, - ComponentListMF.flux_strong - }); - KnowledgeListMF.black = - MineFantasyAPI.addRatioAlloy(1, new ItemStack(ComponentListMF.ingots[6], 2), 1, new Object[] - { - steel, steel, bronze, bronze, ComponentListMF.obsidian_rock - }); - - KnowledgeListMF.wolframiteR = - MineFantasyAPI.addRatioAlloy(1, tungsten, 1, new Object[]{ - Items.coal, Items.coal, Items.coal, Items.coal, ComponentListMF.oreTungsten, ComponentListMF.flux_strong, ComponentListMF.flux_strong, ComponentListMF.flux_strong, ComponentListMF.flux_strong - }); - MineFantasyAPI.addRatioAlloy(1, tungsten, 1, new Object[]{ - Items.coal, Items.coal, Items.coal, Items.coal, BlockListMF.oreTungsten, ComponentListMF.flux_strong, ComponentListMF.flux_strong, ComponentListMF.flux_strong, ComponentListMF.flux_strong - }); - - if(!ConfigHardcore.HCCreduceIngots) - { - KnowledgeListMF.steel = - MineFantasyAPI.addRatioAlloy(9, steel, 1, new Object[] - { - pigiron - }); - } - KnowledgeListMF.red = - MineFantasyAPI.addRatioAlloy(1, new ItemStack(ComponentListMF.ingots[9]), 1, new Object[] - { - steel, gold, Items.redstone, ComponentListMF.flux_strong, Items.blaze_powder - }); - - KnowledgeListMF.blue = - MineFantasyAPI.addRatioAlloy(1, new ItemStack(ComponentListMF.ingots[11]), 1, new Object[] - { - steel, silver, new ItemStack(Items.dye, 1, 4), ComponentListMF.flux_strong, Items.blaze_powder - }); - - KnowledgeListMF.adamantium = - MineFantasyAPI.addRatioAlloy(2, ComponentListMF.bar("adamantium", 2), 2, new Object[] - { - BlockListMF.oreMythic, gold, gold - }); - - KnowledgeListMF.mithril = - MineFantasyAPI.addRatioAlloy(2, ComponentListMF.bar("mithril", 2), new Object[] - { - BlockListMF.oreMythic, silver, silver - }); - - KnowledgeListMF.ignotumite = - MineFantasyAPI.addRatioAlloy(2, ignotumite, 3, new Object[] - { - adamant, adamant, Items.emerald, Items.blaze_powder - }); - - KnowledgeListMF.mithium = - MineFantasyAPI.addRatioAlloy(2, mithium, 3, new Object[] - { - mithril, mithril, ComponentListMF.diamond_shards, Items.ghast_tear - }); - - KnowledgeListMF.enderforge = - MineFantasyAPI.addRatioAlloy(2, enderforge, 3, new Object[] - { - adamant, mithril, Items.ender_pearl, Items.ender_pearl - }); - - MineFantasyAPI.addBlastFurnaceRecipe(ComponentListMF.iron_prep, ComponentListMF.bar("RefinedIron")); - MineFantasyAPI.addBlastFurnaceRecipe(ComponentListMF.ingots[6], black); - MineFantasyAPI.addBlastFurnaceRecipe(ComponentListMF.ingots[9], red); - MineFantasyAPI.addBlastFurnaceRecipe(ComponentListMF.ingots[11], blue); - } - - private static void refineRawOre(Item ore, ItemStack bar) - { - refineRawOre(ore, bar, 0F); - } - private static void refineRawOre(Block ore, ItemStack bar) - { - refineRawOre(ore, bar, 0F); - } - private static void refineRawOre(Block ore, ItemStack bar, float xp) - { - refineRawOre(Item.getItemFromBlock(ore), bar, xp); - } - private static void refineRawOre(Item ore, ItemStack bar, float xp) - { - if(ConfigHardcore.HCCreduceIngots) - { - BloomRecipe.addRecipe(ore, bar); - } - else - { - GameRegistry.addSmelting(ore, bar, xp); - } - BigFurnaceRecipes.addRecipe(new ItemStack(ore), bar, 0); - } + +public class SmeltingRecipesMF { + public static void init() { + ItemStack copper = ComponentListMF.bar("Copper"); + ItemStack tin = ComponentListMF.bar("Tin"); + ItemStack bronze = ComponentListMF.bar("Bronze"); + ItemStack iron = ComponentListMF.bar("Iron"); + ItemStack pigiron = ComponentListMF.bar("PigIron"); + ItemStack steel = ComponentListMF.bar("Steel"); + ItemStack diamond = ComponentListMF.bar("Encrusted"); + ItemStack tungsten = ComponentListMF.bar("Tungsten"); + ItemStack obsidian = ComponentListMF.bar("Obsidian"); + ItemStack black = ComponentListMF.bar("BlackSteel"); + ItemStack red = ComponentListMF.bar("RedSteel"); + ItemStack blue = ComponentListMF.bar("BlueSteel"); + ItemStack gold = ComponentListMF.bar("Gold"); + ItemStack silver = ComponentListMF.bar("Silver"); + ItemStack mithril = ComponentListMF.bar("Mithril"); + ItemStack adamant = ComponentListMF.bar("Adamantium"); + ItemStack mithium = ComponentListMF.bar("Mithium"); + ItemStack ignotumite = ComponentListMF.bar("Ignotumite"); + ItemStack enderforge = ComponentListMF.bar("Ender"); + ItemStack dwarfsteel = ComponentListMF.bar("Dwarfsteel"); + + KnowledgeListMF.reStone = MineFantasyAPI.addRatioAlloy(1, new ItemStack(BlockListMF.reinforced_stone, 4), 1, + new Object[]{Blocks.stone, Blocks.stone, Blocks.stone, Blocks.stone, ComponentListMF.fireclay, iron, + ComponentListMF.obsidian_rock}); + if (ConfigHardcore.HCCreduceIngots) { + if (MineFantasyAPI.removeSmelting(Blocks.iron_ore) && MineFantasyAPI.removeSmelting(Blocks.gold_ore)) { + MFLogUtil.logDebug("Removed Ore Smelting (Hardcore Ingots"); + } else { + MFLogUtil.logWarn("Failed to remove Ore smelting!"); + } + BloomRecipe.addRecipe(new ItemStack(Blocks.iron_ore), iron); + BloomRecipe.addRecipe(new ItemStack(Blocks.gold_ore), gold); + + MineFantasyAPI.addFurnaceRecipe(new ItemStack(Blocks.iron_ore), iron, 0); + MineFantasyAPI.addFurnaceRecipe(new ItemStack(Blocks.gold_ore), gold, 0); + } + + refineRawOre(ComponentListMF.oreCopper, copper); + refineRawOre(ComponentListMF.oreTin, tin); + refineRawOre(ComponentListMF.oreIron, iron); + refineRawOre(ComponentListMF.oreSilver, silver); + refineRawOre(ComponentListMF.oreGold, gold); + + refineRawOre(BlockListMF.oreCopper, copper, 0.4F); + refineRawOre(BlockListMF.oreTin, tin, 0.5F); + refineRawOre(BlockListMF.oreSilver, silver, 0.9F); + + GameRegistry.addSmelting(BlockListMF.oreBorax, new ItemStack(ComponentListMF.flux_strong, 4), 0.25F); + GameRegistry.addSmelting(BlockListMF.oreTungsten, new ItemStack(ComponentListMF.oreTungsten, 1), 0.25F); + GameRegistry.addSmelting(BlockListMF.oreKaolinite, new ItemStack(ComponentListMF.kaolinite), 0.25F); + GameRegistry.addSmelting(BlockListMF.oreNitre, new ItemStack(ComponentListMF.nitre, 4), 0.25F); + GameRegistry.addSmelting(BlockListMF.oreSulfur, new ItemStack(ComponentListMF.sulfur, 4), 0.25F); + GameRegistry.addSmelting(BlockListMF.oreClay, new ItemStack(Items.clay_ball, 4), 0.25F); + + BigFurnaceRecipes.addRecipe(BlockListMF.oreMithril, ComponentListMF.bar("Mithril"), 2); + GameRegistry.addSmelting(BlockListMF.oreMithril, ComponentListMF.bar("Mithril"), 2); + + // ALLOY + KnowledgeListMF.bronze = MineFantasyAPI.addRatioAlloy(3, ComponentListMF.bar("bronze", 3), + new Object[]{copper, copper, tin}); + + KnowledgeListMF.obsidalloy = MineFantasyAPI.addRatioAlloy(1, obsidian, 1, + new Object[]{steel, ComponentListMF.obsidian_rock, ComponentListMF.obsidian_rock, + ComponentListMF.obsidian_rock, ComponentListMF.obsidian_rock, ComponentListMF.flux_strong}); + KnowledgeListMF.black = MineFantasyAPI.addRatioAlloy(1, new ItemStack(ComponentListMF.ingots[6], 2), 1, + new Object[]{steel, steel, bronze, bronze, ComponentListMF.obsidian_rock}); + + KnowledgeListMF.wolframiteR = MineFantasyAPI.addRatioAlloy(1, tungsten, 1, + new Object[]{Items.coal, Items.coal, Items.coal, Items.coal, ComponentListMF.oreTungsten, + ComponentListMF.flux_strong, ComponentListMF.flux_strong, ComponentListMF.flux_strong, + ComponentListMF.flux_strong}); + MineFantasyAPI.addRatioAlloy(1, tungsten, 1, + new Object[]{Items.coal, Items.coal, Items.coal, Items.coal, BlockListMF.oreTungsten, + ComponentListMF.flux_strong, ComponentListMF.flux_strong, ComponentListMF.flux_strong, + ComponentListMF.flux_strong}); + + if (!ConfigHardcore.HCCreduceIngots) { + KnowledgeListMF.steel = MineFantasyAPI.addRatioAlloy(9, steel, 1, new Object[]{pigiron}); + } + KnowledgeListMF.red = MineFantasyAPI.addRatioAlloy(1, new ItemStack(ComponentListMF.ingots[9]), 1, + new Object[]{steel, gold, Items.redstone, ComponentListMF.flux_strong, Items.blaze_powder}); + + KnowledgeListMF.blue = MineFantasyAPI.addRatioAlloy(1, new ItemStack(ComponentListMF.ingots[11]), 1, + new Object[]{steel, silver, new ItemStack(Items.dye, 1, 4), ComponentListMF.flux_strong, + Items.blaze_powder}); + + KnowledgeListMF.adamantium = MineFantasyAPI.addRatioAlloy(2, ComponentListMF.bar("adamantium", 2), 2, + new Object[]{BlockListMF.oreMythic, gold, gold}); + + KnowledgeListMF.mithril = MineFantasyAPI.addRatioAlloy(2, ComponentListMF.bar("mithril", 2), + new Object[]{BlockListMF.oreMythic, silver, silver}); + + KnowledgeListMF.ignotumite = MineFantasyAPI.addRatioAlloy(2, ignotumite, 3, + new Object[]{adamant, adamant, Items.emerald, Items.blaze_powder}); + + KnowledgeListMF.mithium = MineFantasyAPI.addRatioAlloy(2, mithium, 3, + new Object[]{mithril, mithril, ComponentListMF.diamond_shards, Items.ghast_tear}); + + KnowledgeListMF.enderforge = MineFantasyAPI.addRatioAlloy(2, enderforge, 3, + new Object[]{adamant, mithril, Items.ender_pearl, Items.ender_pearl}); + + + //NEW + + //Dwarf + ItemStack lapisDye = new ItemStack(Items.dye, 1, 4); + KnowledgeListMF.dwarfsteel = MineFantasyAPI.addRatioAlloy(6, ComponentListMF.bar("dwarfsteel", 5), 1, + new Object[]{steel, steel, ComponentListMF.obsidian_rock, Items.coal, Items.coal, (new ItemStack(Items.dye, 1, 4))}); + //Emerald + KnowledgeListMF.emerald = MineFantasyAPI.addRatioAlloy(6, ComponentListMF.bar("emerald", 4), 1, + new Object[]{steel, steel, Items.emerald}); + + + MineFantasyAPI.addBlastFurnaceRecipe(ComponentListMF.iron_prep, ComponentListMF.bar("PigIron")); + MineFantasyAPI.addBlastFurnaceRecipe(ComponentListMF.ingots[6], black); + MineFantasyAPI.addBlastFurnaceRecipe(ComponentListMF.ingots[9], red); + MineFantasyAPI.addBlastFurnaceRecipe(ComponentListMF.ingots[11], blue); + } + + private static void refineRawOre(Item ore, ItemStack bar) { + refineRawOre(ore, bar, 0F); + } + + private static void refineRawOre(Block ore, ItemStack bar) { + refineRawOre(ore, bar, 0F); + } + + private static void refineRawOre(Block ore, ItemStack bar, float xp) { + refineRawOre(Item.getItemFromBlock(ore), bar, xp); + } + + private static void refineRawOre(Item ore, ItemStack bar, float xp) { + if (ConfigHardcore.HCCreduceIngots) { + BloomRecipe.addRecipe(ore, bar); + } else { + GameRegistry.addSmelting(ore, bar, xp); + } + BigFurnaceRecipes.addRecipe(new ItemStack(ore), bar, 0); + } } diff --git a/src/main/java/minefantasy/mf2/recipe/TempRecipesMF.java b/src/main/java/minefantasy/mf2/recipe/TempRecipesMF.java index 245296ae..a48ef580 100644 --- a/src/main/java/minefantasy/mf2/recipe/TempRecipesMF.java +++ b/src/main/java/minefantasy/mf2/recipe/TempRecipesMF.java @@ -1,131 +1,62 @@ package minefantasy.mf2.recipe; -import java.util.ArrayList; -import java.util.Iterator; - -import minefantasy.mf2.api.crafting.Salvage; -import minefantasy.mf2.api.crafting.tanning.TanningRecipe; +import cpw.mods.fml.common.registry.GameRegistry; import minefantasy.mf2.api.material.CustomMaterial; import minefantasy.mf2.block.list.BlockListMF; -import minefantasy.mf2.item.ItemComponentMF; -import minefantasy.mf2.item.food.FoodListMF; import minefantasy.mf2.item.list.ComponentListMF; -import minefantasy.mf2.item.list.ToolListMF; import minefantasy.mf2.knowledge.KnowledgeListMF; -import minefantasy.mf2.material.BaseMaterialMF; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.common.registry.GameRegistry; -public class TempRecipesMF -{ - public static void init() - { - ArrayList wood = CustomMaterial.getList("wood"); - Iterator iteratorWood = wood.iterator(); - while(iteratorWood.hasNext()) - { - CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); - assembleWoodVariations(customMat); - } - - //RESOURCES - - ItemStack steel = ComponentListMF.bar("Steel"); - - GameRegistry.addRecipe(new ItemStack(Blocks.rail, 64), new Object[] - { - "I I", - "ISI", - "I I", - 'I', steel, - 'S', Items.stick, - }); - - GameRegistry.addShapedRecipe(new ItemStack(Blocks.cobblestone), new Object[] - { - "C", - 'C', BlockListMF.cobble_brick - }); - GameRegistry.addShapedRecipe(new ItemStack(Blocks.cobblestone), new Object[] - { - "C", - 'C', BlockListMF.cobble_pavement - }); - KnowledgeListMF.stoneBricksR.add( - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.cobble_brick, 4), new Object[] - { - "C C", - " ", - "C C", - 'C', Blocks.cobblestone - })); - KnowledgeListMF.stoneBricksR.add( - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.cobble_pavement, 4), new Object[] - { - "CC", - "CC", - 'C', Blocks.cobblestone - })); - - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.reinforced_stone), new Object[] - { - "C", - 'C', BlockListMF.reinforced_stone_bricks - }); - KnowledgeListMF.stoneBricksR.add( - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.reinforced_stone_bricks, 4), new Object[] - { - "CC", - "CC", - 'C', BlockListMF.reinforced_stone - })); - - GameRegistry.addShapedRecipe(new ItemStack(Blocks.dirt), new Object[] - { - "C", - 'C', BlockListMF.mud_brick - }); - GameRegistry.addShapedRecipe(new ItemStack(Blocks.dirt), new Object[] - { - "C", - 'C', BlockListMF.mud_pavement - }); - KnowledgeListMF.stoneBricksR.add( - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.mud_brick, 4), new Object[] - { - "C C", - " ", - "C C", - 'C', Blocks.dirt - })); - KnowledgeListMF.stoneBricksR.add( - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.mud_pavement, 4), new Object[] - { - "CC", - "CC", - 'C', Blocks.dirt - })); - - - - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.framed_pane, 16), new Object[] - { - "GGG", - "GGG", - 'G', BlockListMF.framed_glass - }); - GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.window_pane, 16), new Object[] - { - "GGG", - "GGG", - 'G', BlockListMF.window - }); - - } - private static void assembleWoodVariations(CustomMaterial material) { - - } +import java.util.ArrayList; +import java.util.Iterator; + +public class TempRecipesMF { + public static void init() { + ArrayList wood = CustomMaterial.getList("wood"); + Iterator iteratorWood = wood.iterator(); + while (iteratorWood.hasNext()) { + CustomMaterial customMat = (CustomMaterial) iteratorWood.next(); + assembleWoodVariations(customMat); + } + + // RESOURCES + + ItemStack steel = ComponentListMF.bar("Steel"); + + GameRegistry.addRecipe(new ItemStack(Blocks.rail, 64), + new Object[]{"I I", "ISI", "I I", 'I', steel, 'S', Items.stick,}); + + GameRegistry.addShapedRecipe(new ItemStack(Blocks.cobblestone), + new Object[]{"C", 'C', BlockListMF.cobble_brick}); + GameRegistry.addShapedRecipe(new ItemStack(Blocks.cobblestone), + new Object[]{"C", 'C', BlockListMF.cobble_pavement}); + KnowledgeListMF.stoneBricksR.add(GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.cobble_brick, 4), + new Object[]{"C C", " ", "C C", 'C', Blocks.cobblestone})); + KnowledgeListMF.stoneBricksR.add(GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.cobble_pavement, 4), + new Object[]{"CC", "CC", 'C', Blocks.cobblestone})); + + GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.reinforced_stone), + new Object[]{"C", 'C', BlockListMF.reinforced_stone_bricks}); + KnowledgeListMF.stoneBricksR + .add(GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.reinforced_stone_bricks, 4), + new Object[]{"CC", "CC", 'C', BlockListMF.reinforced_stone})); + + GameRegistry.addShapedRecipe(new ItemStack(Blocks.dirt), new Object[]{"C", 'C', BlockListMF.mud_brick}); + GameRegistry.addShapedRecipe(new ItemStack(Blocks.dirt), new Object[]{"C", 'C', BlockListMF.mud_pavement}); + KnowledgeListMF.stoneBricksR.add(GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.mud_brick, 4), + new Object[]{"C C", " ", "C C", 'C', Blocks.dirt})); + KnowledgeListMF.stoneBricksR.add(GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.mud_pavement, 4), + new Object[]{"CC", "CC", 'C', Blocks.dirt})); + + GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.framed_pane, 16), + new Object[]{"GGG", "GGG", 'G', BlockListMF.framed_glass}); + GameRegistry.addShapedRecipe(new ItemStack(BlockListMF.window_pane, 16), + new Object[]{"GGG", "GGG", 'G', BlockListMF.window}); + } + + private static void assembleWoodVariations(CustomMaterial material) { + + } } diff --git a/src/main/java/minefantasy/mf2/util/BukkitUtils.java b/src/main/java/minefantasy/mf2/util/BukkitUtils.java new file mode 100644 index 00000000..8d0d6a7e --- /dev/null +++ b/src/main/java/minefantasy/mf2/util/BukkitUtils.java @@ -0,0 +1,89 @@ +package minefantasy.mf2.util; + +import com.google.common.collect.Lists; +import minefantasy.mf2.MineFantasyII; +import minefantasy.mf2.config.ConfigIntegration; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.RegisteredListener; + +import java.lang.reflect.Method; +import java.util.List; + +public final class BukkitUtils { + + private static final Method getBukkitEntity; + private static final List listeners = Lists.newArrayList(); + + static { + try { + getBukkitEntity = Entity.class.getDeclaredMethod("getBukkitEntity"); + getBukkitEntity.setAccessible(true); + } catch (Throwable throwable) { + throw new RuntimeException("Failed to hook CraftBukkit method!", throwable); + } + } + + public static final boolean cantBreakBlock(EntityPlayer player, int x, int y, int z) { + try { + Player bukkitPlayer = toBukkitEntity(player); + BlockBreakEvent event = new BlockBreakEvent(bukkitPlayer.getWorld().getBlockAt(x, y, z), bukkitPlayer); + callEvent(event); + return event.isCancelled(); + } catch (Throwable throwable) { + MFLogUtil.logWarn(String.format("Failed call BlockBreakEvent: [Player: %s, X:%d, Y:%d, Z:%d]", + String.valueOf(player), x, y, z)); + if (MineFantasyII.isDebug()) + throwable.printStackTrace(); + } + return true; + } + + public static final boolean cantDamage(Entity damager, Entity damagee) { + try { + @SuppressWarnings("deprecation") + EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(toBukkitEntity(damager), + toBukkitEntity(damagee), DamageCause.ENTITY_ATTACK, 0D); + callEvent(event); + return event.isCancelled(); + } catch (Throwable throwable) { + MFLogUtil.logWarn(String.format("Failed call EntityDamageByEntityEvent: [Damager: %s, Damagee: %s]", + String.valueOf(damager), String.valueOf(damagee))); + if (MineFantasyII.isDebug()) + throwable.printStackTrace(); + } + return true; + } + + private static final org.bukkit.entity.Entity toBukkitEntity(Entity entity) throws Exception { + return (org.bukkit.entity.Entity) getBukkitEntity.invoke(entity); + } + + private static final Player toBukkitEntity(EntityPlayer player) throws Exception { + return (Player) getBukkitEntity.invoke(player); + } + + public static final void onServerStarted() { + PluginManager plManager = Bukkit.getPluginManager(); + for (String plName : ConfigIntegration.pluginsList) + listeners.addAll(HandlerList.getRegisteredListeners(plManager.getPlugin(plName))); + } + + private static final void callEvent(Event event) { + for (RegisteredListener listener : listeners) + try { + listener.callEvent(event); + } catch (Throwable throwable) { + if (MineFantasyII.isDebug()) + throwable.printStackTrace(); + } + } +} diff --git a/src/main/java/minefantasy/mf2/util/MFLogUtil.java b/src/main/java/minefantasy/mf2/util/MFLogUtil.java index af966043..8eb18487 100644 --- a/src/main/java/minefantasy/mf2/util/MFLogUtil.java +++ b/src/main/java/minefantasy/mf2/util/MFLogUtil.java @@ -1,37 +1,30 @@ package minefantasy.mf2.util; +import cpw.mods.fml.common.FMLLog; import minefantasy.mf2.MineFantasyII; - -import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; -import cpw.mods.fml.common.FMLLog; - public class MFLogUtil { - public static final Logger MF_LOGGER = FMLLog.getLogger(); - - public static final String PREFIX = "[MineFantasyII]: "; - - public static void log(String mes) - { - FMLLog.info(PREFIX + mes); - // MF_LOGGER.log(Level.INFO, PREFIX + mes); - } - - public static void logWarn(String mes) - { - FMLLog.warning(PREFIX + "(warning) " + mes); - // MF_LOGGER.log(Level.WARN, PREFIX + mes); - } - - public static void logDebug(String mes) - { - if(MineFantasyII.isDebug()) - { - FMLLog.info(PREFIX + "(debug) " + mes); - // MF_LOGGER.debug(PREFIX + mes); - } - } - + public static final Logger MF_LOGGER = FMLLog.getLogger(); + + public static final String PREFIX = "[MineFantasyII]: "; + + public static void log(String mes) { + FMLLog.info(PREFIX + mes); + // MF_LOGGER.log(Level.INFO, PREFIX + mes); + } + + public static void logWarn(String mes) { + FMLLog.warning(PREFIX + "(warning) " + mes); + // MF_LOGGER.log(Level.WARN, PREFIX + mes); + } + + public static void logDebug(String mes) { + if (MineFantasyII.isDebug()) { + FMLLog.info(PREFIX + "(debug) " + mes); + // MF_LOGGER.debug(PREFIX + mes); + } + } + } diff --git a/src/main/java/minefantasy/mf2/util/Utils.java b/src/main/java/minefantasy/mf2/util/Utils.java new file mode 100644 index 00000000..3c4dcdf0 --- /dev/null +++ b/src/main/java/minefantasy/mf2/util/Utils.java @@ -0,0 +1,42 @@ +package minefantasy.mf2.util; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraftforge.oredict.OreDictionary; + +public class Utils { + + public static boolean doesMatch(ItemStack item1, ItemStack item2) { + return item2.getItem() == item1.getItem() && (item2.getItemDamage() == OreDictionary.WILDCARD_VALUE + || item2.getItemDamage() == item1.getItemDamage()); + } + + public static TileEntityChest getOtherDoubleChest(TileEntity inv) { + if (inv instanceof TileEntityChest) { + TileEntityChest chest = (TileEntityChest) inv; + + TileEntityChest adjacent = null; + + if (chest.adjacentChestXNeg != null) { + adjacent = chest.adjacentChestXNeg; + } + + if (chest.adjacentChestXPos != null) { + adjacent = chest.adjacentChestXPos; + } + + if (chest.adjacentChestZNeg != null) { + adjacent = chest.adjacentChestZNeg; + } + + if (chest.adjacentChestZPos != null) { + adjacent = chest.adjacentChestZPos; + } + + return adjacent; + } + return null; + } + +} diff --git a/src/main/java/minefantasy/mf2/util/XSTRandom.java b/src/main/java/minefantasy/mf2/util/XSTRandom.java new file mode 100644 index 00000000..5883dfcf --- /dev/null +++ b/src/main/java/minefantasy/mf2/util/XSTRandom.java @@ -0,0 +1,242 @@ +package minefantasy.mf2.util; +/** + * A subclass of java.util.random that implements the Xorshift random number + * generator + *

+ * - it is 30% faster than the generator from Java's library - it produces + * random sequences of higher quality than java.util.Random - this class also + * provides a clone() function + *

+ * Usage: XSRandom rand = new XSRandom(); //Instantiation x = rand.nextInt(); + * //pull a random number + *

+ * To use the class in legacy code, you may also instantiate an XSRandom object + * and assign it to a java.util.Random object: java.util.Random rand = new + * XSRandom(); + *

+ * for an explanation of the algorithm, see + * http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html + * + * @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs + * http://www.elmenreich.tk + *

+ * This code is released under the GNU Lesser General Public License Version 3 + * http://www.gnu.org/licenses/lgpl-3.0.txt + */ + +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; + +/** + * XSTR - Xorshift ThermiteRandom + * Modified by Bogdan-G + * 03.06.2016 + * version 0.0.4 + */ + +public class XSTRandom extends Random { + + private static final long serialVersionUID = 6208727693524452904L; + private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) + private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) + private static final AtomicLong seedUniquifier + = new AtomicLong(8682522807148012L); + boolean haveNextNextGaussian = false; + + /* + MODIFIED BY: Robotia + Modification: Implemented Random class seed generator + */ + double nextNextGaussian = 0; + private long seed; + private long last; + + /** + * Creates a new pseudo random number generator. The seed is initialized to + * the current time, as if by + * setSeed(System.currentTimeMillis());. + */ + public XSTRandom() { + this(seedUniquifier() ^ System.nanoTime()); + } + + /** + * Creates a new pseudo random number generator, starting with the specified + * seed, using setSeed(seed);. + * + * @param seed the initial seed + */ + public XSTRandom(long seed) { + this.seed = seed; + } + + private static long seedUniquifier() { + // L'Ecuyer, "Tables of Linear Congruential Generators of + // Different Sizes and Good Lattice Structure", 1999 + for (; ; ) { + long current = seedUniquifier.get(); + long next = current * 181783497276652981L; + if (seedUniquifier.compareAndSet(current, next)) { + return next; + } + } + } + + public boolean nextBoolean() { + return next(1) != 0; + } + + public double nextDouble() { + return (((long) (next(26)) << 27) + next(27)) * DOUBLE_UNIT; + } + + /** + * Returns the current state of the seed, can be used to clone the object + * + * @return the current seed + */ + public synchronized long getSeed() { + return seed; + } + + /** + * Sets the seed for this pseudo random number generator. As described + * above, two instances of the same random class, starting with the same + * seed, produce the same results, if the same methods are called. + * + * @param seed the new seed + */ + public synchronized void setSeed(long seed) { + this.seed = seed; + } + + /** + * @return Returns an XSRandom object with the same state as the original + */ + @Override + public XSTRandom clone() { + return new XSTRandom(getSeed()); + } + + /** + * Implementation of George Marsaglia's elegant Xorshift random generator + * 30% faster and better quality than the built-in java.util.random see also + * see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml + * + * @param nbits + * @return + */ + public int next(int nbits) { + long x = seed; + x ^= (x << 21); + x ^= (x >>> 35); + x ^= (x << 4); + seed = x; + x &= ((1L << nbits) - 1); + return (int) x; + } + + synchronized public double nextGaussian() { + // See Knuth, ACP, Section 3.4.1 Algorithm C. + if (haveNextNextGaussian) { + haveNextNextGaussian = false; + return nextNextGaussian; + } else { + double v1, v2, s; + do { + v1 = 2 * nextDouble() - 1; // between -1 and 1 + v2 = 2 * nextDouble() - 1; // between -1 and 1 + s = v1 * v1 + v2 * v2; + } while (s >= 1 || s == 0); + double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s) / s); + nextNextGaussian = v2 * multiplier; + haveNextNextGaussian = true; + return v1 * multiplier; + } + } + + /** + * Returns a pseudorandom, uniformly distributed {@code int} value between 0 + * (inclusive) and the specified value (exclusive), drawn from this random + * number generator's sequence. The general contract of {@code nextInt} is + * that one {@code int} value in the specified range is pseudorandomly + * generated and returned. All {@code bound} possible {@code int} values are + * produced with (approximately) equal probability. The method + * {@code nextInt(int bound)} is implemented by class {@code Random} as if + * by: + *

 {@code
+     * public int nextInt(int bound) {
+     *   if (bound <= 0)
+     *     throw new IllegalArgumentException("bound must be positive");
+     *
+     *   if ((bound & -bound) == bound)  // i.e., bound is a power of 2
+     *     return (int)((bound * (long)next(31)) >> 31);
+     *
+     *   int bits, val;
+     *   do {
+     *       bits = next(31);
+     *       val = bits % bound;
+     *   } while (bits - val + (bound-1) < 0);
+     *   return val;
+     * }}
+ *

+ *

The hedge "approx + * imately" is used in the foregoing description only because the next + * method is only approximately an unbiased source of independently chosen + * bits. If it were a perfect source of randomly chosen bits, then the + * algorithm shown would choose {@code int} values from the stated range + * with perfect uniformity. + *

+ * The algorithm is slightly tricky. It rejects values that would result in + * an uneven distribution (due to the fact that 2^31 is not divisible by n). + * The probability of a value being rejected depends on n. The worst case is + * n=2^30+1, for which the probability of a reject is 1/2, and the expected + * number of iterations before the loop terminates is 2. + *

+ * The algorithm treats the case where n is a power of two specially: it + * returns the correct number of high-order bits from the underlying + * pseudo-random number generator. In the absence of special treatment, the + * correct number of low-order bits would be returned. Linear + * congruential pseudo-random number generators such as the one implemented + * by this class are known to have short periods in the sequence of values + * of their low-order bits. Thus, this special case greatly increases the + * length of the sequence of values returned by successive calls to this + * method if n is a small power of two. + * + * @param bound the upper bound (exclusive). Must be positive. + * @return the next pseudorandom, uniformly distributed {@code int} value + * between zero (inclusive) and {@code bound} (exclusive) from this random + * number generator's sequence + * @throws IllegalArgumentException if bound is not positive + * @since 1.2 + */ + public int nextInt(int bound) { + last = seed ^ (seed << 21); + last ^= (last >>> 35); + last ^= (last << 4); + seed = last; + int out = (int) last % bound; + return (out < 0) ? -out : out; + } + + public int nextInt() { + return next(32); + } + + public float nextFloat() { + return next(24) * FLOAT_UNIT; + } + + public long nextLong() { + // it's okay that the bottom word remains signed. + return ((long) (next(32)) << 32) + next(32); + } + + public void nextBytes(byte[] bytes_arr) { + for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) + for (int rndba = nextInt(), + nba = Math.min(lenba - iba, Integer.SIZE / Byte.SIZE); + nba-- > 0; rndba >>= Byte.SIZE) + bytes_arr[iba++] = (byte) rndba; + } +} \ No newline at end of file diff --git a/src/main/java/mods/battlegear2/api/IAllowItem.java b/src/main/java/mods/battlegear2/api/IAllowItem.java index 78e9ffa1..8276a178 100644 --- a/src/main/java/mods/battlegear2/api/IAllowItem.java +++ b/src/main/java/mods/battlegear2/api/IAllowItem.java @@ -4,8 +4,9 @@ public interface IAllowItem { - /** - * Returns true if the mainhand {@link ItemStack} allows the offhand {@link ItemStack} to be placed in the partner offhand slot + /** + * Returns true if the mainhand {@link ItemStack} allows the offhand + * {@link ItemStack} to be placed in the partner offhand slot */ - public boolean allowOffhand(ItemStack mainhand, ItemStack offhand); + public boolean allowOffhand(ItemStack mainhand, ItemStack offhand); } diff --git a/src/main/java/mods/battlegear2/api/IDefaultRender.java b/src/main/java/mods/battlegear2/api/IDefaultRender.java index ce0d707c..f48af459 100644 --- a/src/main/java/mods/battlegear2/api/IDefaultRender.java +++ b/src/main/java/mods/battlegear2/api/IDefaultRender.java @@ -3,38 +3,37 @@ import net.minecraftforge.client.IItemRenderer; /** - * Soon: - * Utility to use one of the default Battlegear2 renderer - * Implement in an item to get its renderer automatically registered - * This is obviously client-side only + * Soon: Utility to use one of the default Battlegear2 renderer Implement in an + * item to get its renderer automatically registered This is obviously + * client-side only */ public interface IDefaultRender { - public enum RenderType{ - Bow, - FlagPole, - Quiver, - Shield, - Spear, - HeraldryCrest,//Work in progress, not recommended for use - HeraldryItem//Work in progress, not recommended for use - } - /** * Called before anything else + * * @return false to disable all features of this interface */ public boolean useDefaultRenderer(); /** * Called when registering the {@link IItemRenderer} for this item + * * @return the type of renderer to use */ public RenderType getRenderer(); /** * Called by Battlegear2 configuration GUI when the rendering option is toggled - * Use this to react, using another renderer when this one is disabled for example - * @param isEnabled the new rendering state: on true, the renderer is going to be used, on false, it is disabled + * Use this to react, using another renderer when this one is disabled for + * example + * + * @param isEnabled the new rendering state: on true, the renderer is going to be + * used, on false, it is disabled */ public void setRenderState(boolean isEnabled); + + public enum RenderType { + Bow, FlagPole, Quiver, Shield, Spear, HeraldryCrest, // Work in progress, not recommended for use + HeraldryItem// Work in progress, not recommended for use + } } diff --git a/src/main/java/mods/battlegear2/api/IDyable.java b/src/main/java/mods/battlegear2/api/IDyable.java index 17b3b466..a971baaf 100644 --- a/src/main/java/mods/battlegear2/api/IDyable.java +++ b/src/main/java/mods/battlegear2/api/IDyable.java @@ -1,6 +1,5 @@ package mods.battlegear2.api; - import net.minecraft.item.ItemStack; //This is a tempory fix until we get the heraldry system up and running @@ -11,7 +10,6 @@ public interface IDyable { */ public boolean hasColor(ItemStack par1ItemStack); - /** * Return the color for the specified ItemStack. */ @@ -26,5 +24,4 @@ public interface IDyable { public int getDefaultColor(ItemStack par1ItemStack); - } diff --git a/src/main/java/mods/battlegear2/api/IEnchantable.java b/src/main/java/mods/battlegear2/api/IEnchantable.java index ea1e3c8a..f63e0f82 100644 --- a/src/main/java/mods/battlegear2/api/IEnchantable.java +++ b/src/main/java/mods/battlegear2/api/IEnchantable.java @@ -5,11 +5,13 @@ public interface IEnchantable { - /** - * If a Battlegear {@link BaseEnchantment} can be applied to this item, given the {@link ItemStack} - * @param baseEnchantment - * @param stack - * @return - */ - public boolean isEnchantable(Enchantment baseEnchantment, ItemStack stack); + /** + * If a Battlegear {@link BaseEnchantment} can be applied to this item, given + * the {@link ItemStack} + * + * @param baseEnchantment + * @param stack + * @return + */ + public boolean isEnchantable(Enchantment baseEnchantment, ItemStack stack); } diff --git a/src/main/java/mods/battlegear2/api/IOffhandDual.java b/src/main/java/mods/battlegear2/api/IOffhandDual.java index 1b21afd4..08ece8eb 100644 --- a/src/main/java/mods/battlegear2/api/IOffhandDual.java +++ b/src/main/java/mods/battlegear2/api/IOffhandDual.java @@ -1,29 +1,32 @@ package mods.battlegear2.api; +import cpw.mods.fml.relauncher.Side; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import cpw.mods.fml.relauncher.Side; public interface IOffhandDual { - /** + /** * Returns true if the item can be dual wielded in the offhand slot */ public boolean isOffhandHandDual(ItemStack off); - + /** - * Perform any function when the item is held in the offhand and the user right clicks an entity. - * This is generally used to attack an entity with the offhand item. If this is the case the event should - * be canceled to prevent any default right clicking events (Eg Villager Trading) + * Perform any function when the item is held in the offhand and the user right + * clicks an entity. This is generally used to attack an entity with the offhand + * item. If this is the case the event should be canceled to prevent any default + * right clicking events (Eg Villager Trading) * * @param event the OffhandAttackEvent that was generated * @param mainhandItem the ItemStack currently being held in the right hand * @param offhandItem the ItemStack currently being held in the left hand * @return true if the off hand swing animation should be performed */ - public boolean offhandAttackEntity(PlayerEventChild.OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem); + public boolean offhandAttackEntity(PlayerEventChild.OffhandAttackEvent event, ItemStack mainhandItem, + ItemStack offhandItem); /** - * Perform any function when the item is held in the offhand and the user right clicks "Air". + * Perform any function when the item is held in the offhand and the user right + * clicks "Air". * * @param event the PlayerInteractEvent that was generated * @param mainhandItem the ItemStack currently being held in the right hand @@ -33,8 +36,9 @@ public interface IOffhandDual { public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); /** - * Perform any function when the item is held in the offhand and the user right clicks a block. - * Note that this will happen prior to the activation of any activation functions of blocks + * Perform any function when the item is held in the offhand and the user right + * clicks a block. Note that this will happen prior to the activation of any + * activation functions of blocks * * @param event the PlayerInteractEvent that was generated * @param mainhandItem the ItemStack currently being held in the right hand @@ -44,7 +48,8 @@ public interface IOffhandDual { public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); /** - * Perform any passive effects on each game tick when the item is held in the offhand + * Perform any passive effects on each game tick when the item is held in the + * offhand * * @param effectiveSide the effective side the method was called from * @param mainhandItem the ItemStack currently being held in the right hand diff --git a/src/main/java/mods/battlegear2/api/ISheathed.java b/src/main/java/mods/battlegear2/api/ISheathed.java index 441e7a98..810f7b14 100644 --- a/src/main/java/mods/battlegear2/api/ISheathed.java +++ b/src/main/java/mods/battlegear2/api/ISheathed.java @@ -5,7 +5,9 @@ public interface ISheathed { /** - * Returns true if the item should always be sheathed on the back, false if it should be sheathed on the hip + * Returns true if the item should always be sheathed on the back, false if it + * should be sheathed on the hip + * * @param item the {@link ItemStack} to be sheathed */ public boolean sheatheOnBack(ItemStack item); diff --git a/src/main/java/mods/battlegear2/api/PlayerEventChild.java b/src/main/java/mods/battlegear2/api/PlayerEventChild.java index 4a838f76..52f74be2 100644 --- a/src/main/java/mods/battlegear2/api/PlayerEventChild.java +++ b/src/main/java/mods/battlegear2/api/PlayerEventChild.java @@ -1,5 +1,6 @@ package mods.battlegear2.api; +import cpw.mods.fml.common.eventhandler.Cancelable; import mods.battlegear2.api.quiver.IArrowContainer2; import mods.battlegear2.api.shield.IShield; import net.minecraft.entity.Entity; @@ -12,19 +13,18 @@ import net.minecraftforge.event.entity.player.EntityInteractEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import cpw.mods.fml.common.eventhandler.Cancelable; -public abstract class PlayerEventChild extends PlayerEvent{ +public abstract class PlayerEventChild extends PlayerEvent { /** * The event that this event is a child of */ - public final PlayerEvent parent; + public final PlayerEvent parent; - public PlayerEventChild(PlayerEvent parent) { - super(parent.entityPlayer); - this.parent = parent; - } + public PlayerEventChild(PlayerEvent parent) { + super(parent.entityPlayer); + this.parent = parent; + } public void setCancelParentEvent(boolean cancel) { parent.setCanceled(cancel); @@ -41,41 +41,45 @@ public void setResult(Result value) { super.setResult(value); parent.setResult(value); } - - /** - * Event fired when a shield successfully blocks an attack (in @link LivingHurtEvent) - */ - public static class ShieldBlockEvent extends PlayerEventChild { - public final ItemStack shield; - public final DamageSource source; - public final float ammount; // use same name as other Forge events + + /** + * Event fired when a shield successfully blocks an attack (in @link + * LivingHurtEvent) + */ + public static class ShieldBlockEvent extends PlayerEventChild { + public final ItemStack shield; + public final DamageSource source; + public final float ammount; // use same name as other Forge events /** * If the {@link IShield#blockAnimation(EntityPlayer, float)} should be called */ public boolean performAnimation = true; /** - * If the shield should be damaged based on the ammount and the result of {@link IShield#getDamageReduction(ItemStack, DamageSource)} + * If the shield should be damaged based on the ammount and the result of + * {@link IShield#getDamageReduction(ItemStack, DamageSource)} */ public boolean damageShield = true; - public ShieldBlockEvent(PlayerEvent parent, ItemStack shield, DamageSource source, float ammount) { - super(parent); - this.shield = shield; - this.source = source; - this.ammount = ammount; - } - } + + public ShieldBlockEvent(PlayerEvent parent, ItemStack shield, DamageSource source, float ammount) { + super(parent); + this.shield = shield; + this.source = source; + this.ammount = ammount; + } + } /** - * Called when a player right clicks in battlemode - * The parent event can be either {@link PlayerInteractEvent} or {@link EntityInteractEvent} if the OffhandAttackEvent allowed swinging - * Both ItemStack can be null - * If cancelled, no offhand swinging will be performed + * Called when a player right clicks in battlemode The parent event can be + * either {@link PlayerInteractEvent} or {@link EntityInteractEvent} if the + * OffhandAttackEvent allowed swinging Both ItemStack can be null If cancelled, + * no offhand swinging will be performed */ @Cancelable public static class OffhandSwingEvent extends PlayerEventChild { public final ItemStack mainHand; public final ItemStack offHand; - public OffhandSwingEvent(PlayerEvent parent, ItemStack mainHand, ItemStack offHand){ + + public OffhandSwingEvent(PlayerEvent parent, ItemStack mainHand, ItemStack offHand) { super(parent); this.mainHand = mainHand; this.offHand = offHand; @@ -83,13 +87,16 @@ public OffhandSwingEvent(PlayerEvent parent, ItemStack mainHand, ItemStack offHa } /** - * Called when a player right clicks an entity in battlemode - * Both ItemStack can be null - * Cancelling will prevent any further processing and prevails over the boolean fields + * Called when a player right clicks an entity in battlemode Both ItemStack can + * be null Cancelling will prevent any further processing and prevails over the + * boolean fields */ @Cancelable public static class OffhandAttackEvent extends PlayerEventChild { + public final EntityInteractEvent event; + public final ItemStack mainHand; + public final ItemStack offHand; /** * If we should call the OffhandSwingEvent and perform swinging */ @@ -102,9 +109,6 @@ public static class OffhandAttackEvent extends PlayerEventChild { * If we should cancel the base entity interaction event */ public boolean cancelParent = true; - public final EntityInteractEvent event; - public final ItemStack mainHand; - public final ItemStack offHand; public OffhandAttackEvent(EntityInteractEvent parent, ItemStack mainHand, ItemStack offHand) { super(parent); @@ -118,12 +122,13 @@ public Entity getTarget() { } } - public static class QuiverArrowEvent extends PlayerEventChild{ + public static class QuiverArrowEvent extends PlayerEventChild { /** * The event from which this occurred */ protected final ArrowLooseEvent event; - public QuiverArrowEvent(ArrowLooseEvent event){ + + public QuiverArrowEvent(ArrowLooseEvent event) { super(event); this.event = event; } @@ -131,31 +136,38 @@ public QuiverArrowEvent(ArrowLooseEvent event){ /** * @return the player using the bow */ - public EntityPlayer getArcher(){ + public EntityPlayer getArcher() { return event.entityPlayer; } /** * @return the bow trying to fire */ - public ItemStack getBow() - { + public ItemStack getBow() { return event.bow; } /** * @return the amount of charge in the bow */ - public float getCharge() - { + public float getCharge() { return event.charge; } /** - * Event fired after an arrow has been selected and taken from a {@link IArrowContainer2}, before it is actually spawned + * Event fired after an arrow has been selected and taken from a + * {@link IArrowContainer2}, before it is actually spawned */ @Cancelable public static class Firing extends QuiverArrowEvent { + /** + * The quiver from which the arrow was pulled from + */ + public final ItemStack quiver; + /** + * The arrow to be fired, can't be null + */ + public final EntityArrow arrow; /** * Damage done to the bow after arrow is fired */ @@ -172,14 +184,6 @@ public static class Firing extends QuiverArrowEvent { * Decides if critical state should be forced into the arrow */ public boolean isCritical = false; - /** - * The quiver from which the arrow was pulled from - */ - public final ItemStack quiver; - /** - * The arrow to be fired, can't be null - */ - public final EntityArrow arrow; public Firing(ArrowLooseEvent parent, ItemStack quiver, EntityArrow arrow) { super(parent); @@ -190,9 +194,9 @@ public Firing(ArrowLooseEvent parent, ItemStack quiver, EntityArrow arrow) { } /** - * The DEFAULT result for this event is the vanilla charge calculated value - * Use setNewCharge to override the value with the one provided - * Change the event result to DENY to prevent further processing + * The DEFAULT result for this event is the vanilla charge calculated value Use + * setNewCharge to override the value with the one provided Change the event + * result to DENY to prevent further processing */ @HasResult public static class ChargeCalculations extends QuiverArrowEvent { @@ -200,33 +204,32 @@ public static class ChargeCalculations extends QuiverArrowEvent { * Returned value if the result is set to allow */ protected float charge; - public ChargeCalculations(ArrowLooseEvent event){ + + public ChargeCalculations(ArrowLooseEvent event) { super(event); } @Override - public float getCharge(){ + public float getCharge() { MinecraftForge.EVENT_BUS.post(this); - switch (this.getResult()){ + switch (this.getResult()) { case ALLOW: return charge; case DENY: return 0; } - float f = super.getCharge()/20.0F; + float f = super.getCharge() / 20.0F; f = (f * f + f * 2.0F) / 3.0F; - if (f < 0.1D) - { + if (f < 0.1D) { return 0; } - if (f > 1.0F) - { + if (f > 1.0F) { f = 1.0F; } return f; } - public void setNewCharge(float charge){ + public void setNewCharge(float charge) { this.setResult(Result.ALLOW); this.charge = charge; } diff --git a/src/main/java/mods/battlegear2/api/RenderItemBarEvent.java b/src/main/java/mods/battlegear2/api/RenderItemBarEvent.java index d2632da4..3a07c0eb 100644 --- a/src/main/java/mods/battlegear2/api/RenderItemBarEvent.java +++ b/src/main/java/mods/battlegear2/api/RenderItemBarEvent.java @@ -1,18 +1,18 @@ package mods.battlegear2.api; +import cpw.mods.fml.common.eventhandler.Cancelable; import mods.battlegear2.api.quiver.IArrowContainer2; import mods.battlegear2.api.quiver.QuiverArrowRegistry; import mods.battlegear2.api.shield.IShield; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.common.MinecraftForge; -import cpw.mods.fml.common.eventhandler.Cancelable; /** * Events from {@link BattlegearInGameGUI} to {@link MinecraftForge.EVENT_BUS} * helping display HUD elements added to the in-game screen */ -public abstract class RenderItemBarEvent extends RenderGameOverlayEvent{ +public abstract class RenderItemBarEvent extends RenderGameOverlayEvent { /** * Horizontal offset from the default position */ @@ -27,51 +27,58 @@ public RenderItemBarEvent(RenderGameOverlayEvent parent) { } /** - * Event posted when the player uses the shield in the offhand, display a sort of "stamina bar" + * Event posted when the player uses the shield in the offhand, display a sort + * of "stamina bar" */ - @Cancelable - public static class ShieldBar extends RenderItemBarEvent { + @Cancelable + public static class ShieldBar extends RenderItemBarEvent { /** - * The stack containing the {@link IShield} item held by the player in his offhand + * The stack containing the {@link IShield} item held by the player in his + * offhand */ public final ItemStack shield; - public ShieldBar(RenderGameOverlayEvent parent, ItemStack item) { - super(parent); + + public ShieldBar(RenderGameOverlayEvent parent, ItemStack item) { + super(parent); this.shield = item; - } - } + } + } /** - * Event posted when the player uses an item compatible with {@link QuiverArrowRegistry} - * that is, a bow and its valid {@link IArrowContainer2}, displaying all slots in it + * Event posted when the player uses an item compatible with + * {@link QuiverArrowRegistry} that is, a bow and its valid + * {@link IArrowContainer2}, displaying all slots in it */ - @Cancelable - public static class QuiverSlots extends RenderItemBarEvent{ + @Cancelable + public static class QuiverSlots extends RenderItemBarEvent { /** * The stack containing the compatible bow held by the player in his mainhand */ - public final ItemStack mainhand; + public final ItemStack mainhand; /** * The stack containing the valid {@link IArrowContainer2} item */ public final ItemStack quiver; - public QuiverSlots(RenderGameOverlayEvent parent, ItemStack mainhand, ItemStack item) { - super(parent); - this.mainhand = mainhand; + + public QuiverSlots(RenderGameOverlayEvent parent, ItemStack mainhand, ItemStack item) { + super(parent); + this.mainhand = mainhand; this.quiver = item; - } - } + } + } /** * Event corresponding to the display of each additional hand slots */ @Cancelable - public static class BattleSlots extends RenderItemBarEvent{ + public static class BattleSlots extends RenderItemBarEvent { /** - * True if the slots are for the mainhand (on the "right"), false for the offhand (on the "left") + * True if the slots are for the mainhand (on the "right"), false for the + * offhand (on the "left") */ public final boolean isMainHand; - public BattleSlots(RenderGameOverlayEvent parent, boolean isMainHand){ + + public BattleSlots(RenderGameOverlayEvent parent, boolean isMainHand) { super(parent); this.isMainHand = isMainHand; } diff --git a/src/main/java/mods/battlegear2/api/core/IBattlePlayer.java b/src/main/java/mods/battlegear2/api/core/IBattlePlayer.java index 5521c10d..9ed44eca 100644 --- a/src/main/java/mods/battlegear2/api/core/IBattlePlayer.java +++ b/src/main/java/mods/battlegear2/api/core/IBattlePlayer.java @@ -5,9 +5,10 @@ /** * Interface added to {@link EntityPlayer} to support offhand management + * * @author GotoLink */ -public interface IBattlePlayer{ +public interface IBattlePlayer { public void swingOffItem(); diff --git a/src/main/java/mods/battlegear2/api/core/IOffhandRender.java b/src/main/java/mods/battlegear2/api/core/IOffhandRender.java index 037724fb..bb1954a2 100644 --- a/src/main/java/mods/battlegear2/api/core/IOffhandRender.java +++ b/src/main/java/mods/battlegear2/api/core/IOffhandRender.java @@ -4,8 +4,10 @@ import net.minecraft.item.ItemStack; /** - * Interface added to {@link ItemRenderer} to support offhand rendering - * Note that, they only provide access to added fields for the offhand, NOT the fields for the mainhand + * Interface added to {@link ItemRenderer} to support offhand rendering Note + * that, they only provide access to added fields for the offhand, NOT the + * fields for the mainhand + * * @author GotoLink */ public interface IOffhandRender { diff --git a/src/main/java/mods/battlegear2/api/core/InventoryPlayerBattle.java b/src/main/java/mods/battlegear2/api/core/InventoryPlayerBattle.java index 9a1a1660..9713016e 100644 --- a/src/main/java/mods/battlegear2/api/core/InventoryPlayerBattle.java +++ b/src/main/java/mods/battlegear2/api/core/InventoryPlayerBattle.java @@ -1,5 +1,7 @@ package mods.battlegear2.api.core; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -7,72 +9,67 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; /** - * User: nerd-boy - * Date: 15/07/13 - * Time: 3:08 PM - * Replacement for the player inventory + * User: nerd-boy Date: 15/07/13 Time: 3:08 PM Replacement for the player + * inventory */ public class InventoryPlayerBattle extends InventoryPlayer { - public boolean hasChanged = true; public static int ARMOR_OFFSET = 100; public static int OFFSET = 150; public static int WEAPON_SETS = 3; - public static int EXTRA_ITEMS = WEAPON_SETS * 2; public static int EXTRA_INV_SIZE = EXTRA_ITEMS + 6 + 6; - + public boolean hasChanged = true; public ItemStack[] extraItems; - public InventoryPlayerBattle(EntityPlayer entityPlayer) { super(entityPlayer); extraItems = new ItemStack[EXTRA_INV_SIZE]; } + public static boolean isValidSwitch(int id) { + return (id >= 0 && id < getHotbarSize()) || (id >= OFFSET && id < OFFSET + EXTRA_ITEMS); + } + public boolean isBattlemode() { return this.currentItem >= OFFSET && this.currentItem < OFFSET + EXTRA_ITEMS; } /** * Returns a new slot index according to the type + * * @param type determines which inventory array to expand - * @return the new slot index, or Integer.MIN_VALUE if it is not possible to expand further + * @return the new slot index, or Integer.MIN_VALUE if it is not possible to + * expand further */ - public int requestNewSlot(InventorySlotType type){ + public int requestNewSlot(InventorySlotType type) { ItemStack[] temp; - switch(type){ + switch (type) { case MAIN: - if(mainInventory.length+1= 0 && id < getHotbarSize()) || (id >= OFFSET && id < OFFSET + EXTRA_ITEMS); + return Integer.MIN_VALUE;// Impossible because of byte cast in inventory NBT } /** @@ -90,7 +87,8 @@ private int getInventorySlotContainItem(Item par1) { @SideOnly(Side.CLIENT) private int getInventorySlotContainItemAndDamage(Item par1, int par2) { for (int k = 0; k < this.extraItems.length; ++k) { - if (this.extraItems[k] != null && this.extraItems[k].getItem() == par1 && this.extraItems[k].getItemDamage() == par2) { + if (this.extraItems[k] != null && this.extraItems[k].getItem() == par1 + && this.extraItems[k].getItemDamage() == par2) { return k; } } @@ -116,13 +114,13 @@ public void changeCurrentItem(int direction) { if (isBattlemode()) { - if (direction > 0){ - direction = 1; - }else if (direction != 0){ - direction = -1; + if (direction > 0) { + direction = 1; + } else if (direction != 0) { + direction = -1; } - //noinspection StatementWithEmptyBody + // noinspection StatementWithEmptyBody for (currentItem -= direction; currentItem < OFFSET; currentItem += WEAPON_SETS) { } @@ -142,9 +140,8 @@ public int clearInventory(Item targetId, int targetDamage) { int stacks = super.clearInventory(targetId, targetDamage); for (int i = 0; i < extraItems.length; i++) { - if (extraItems[i] != null && - (targetId == null || extraItems[i].getItem() == targetId) && - (targetDamage <= -1 || extraItems[i].getItemDamage() == targetDamage)) { + if (extraItems[i] != null && (targetId == null || extraItems[i].getItem() == targetId) + && (targetDamage <= -1 || extraItems[i].getItemDamage() == targetDamage)) { stacks += extraItems[i].stackSize; extraItems[i] = null; @@ -155,22 +152,23 @@ public int clearInventory(Item targetId, int targetDamage) { } /** - * Decrement the number of animations remaining. Only called on client side. This is used to handle the animation of - * receiving a block. + * Decrement the number of animations remaining. Only called on client side. + * This is used to handle the animation of receiving a block. */ @Override public void decrementAnimations() { - super.decrementAnimations(); + super.decrementAnimations(); for (int i = 0; i < this.extraItems.length; ++i) { if (this.extraItems[i] != null) { - this.extraItems[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem + OFFSET == i); + this.extraItems[i].updateAnimation(this.player.worldObj, this.player, i, + this.currentItem + OFFSET == i); } } } - /** - * removed one item of specified itemID from inventory (if it is in a stack, the stack size will reduce with 1) + * removed one item of specified itemID from inventory (if it is in a stack, the + * stack size will reduce with 1) */ @Override public boolean consumeInventoryItem(Item par1) { @@ -188,7 +186,6 @@ public boolean consumeInventoryItem(Item par1) { } } - /** * Get if a specifiied item id is inside the inventory. */ @@ -251,7 +248,6 @@ public ItemStack getStackInSlotOnClosing(int slot) { } } - @Override public void setInventorySlotContents(int slot, ItemStack itemStack) { setInventorySlotContents(slot, itemStack, true); @@ -285,7 +281,7 @@ public NBTTagList writeToNBT(NBTTagList par1nbtTagList) { for (int i = 0; i < extraItems.length; ++i) { if (extraItems[i] != null) { nbttagcompound = new NBTTagCompound(); - //This will be -ve, but meh still works + // This will be -ve, but meh still works nbttagcompound.setByte("Slot", (byte) (i + OFFSET)); this.extraItems[i].writeToNBT(nbttagcompound); nbtList.appendTag(nbttagcompound); @@ -329,14 +325,13 @@ public ItemStack getStackInSlot(int slot) { } @Override - public int getSizeInventory() - { + public int getSizeInventory() { return this.mainInventory.length + this.armorInventory.length; } @Override public void dropAllItems() { - super.dropAllItems(); + super.dropAllItems(); for (int i = 0; i < this.extraItems.length; ++i) { if (this.extraItems[i] != null) { this.player.func_146097_a(this.extraItems[i], true, false); @@ -362,10 +357,10 @@ public void copyInventory(InventoryPlayer par1InventoryPlayer) { } } - public ItemStack getCurrentOffhandWeapon(){ - if(isBattlemode()){ - return getStackInSlot(currentItem+WEAPON_SETS); - }else{ + public ItemStack getCurrentOffhandWeapon() { + if (isBattlemode()) { + return getStackInSlot(currentItem + WEAPON_SETS); + } else { return null; } } diff --git a/src/main/java/mods/battlegear2/api/core/package-info.java b/src/main/java/mods/battlegear2/api/core/package-info.java index e799723c..aaf85e72 100644 --- a/src/main/java/mods/battlegear2/api/core/package-info.java +++ b/src/main/java/mods/battlegear2/api/core/package-info.java @@ -2,4 +2,3 @@ package mods.battlegear2.api.core; import cpw.mods.fml.common.API; - diff --git a/src/main/java/mods/battlegear2/api/heraldry/Crest.java b/src/main/java/mods/battlegear2/api/heraldry/Crest.java index 03f8c8a7..8d2d7032 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/Crest.java +++ b/src/main/java/mods/battlegear2/api/heraldry/Crest.java @@ -1,10 +1,6 @@ package mods.battlegear2.api.heraldry; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; +import java.io.*; public class Crest { @@ -16,7 +12,6 @@ public class Crest { private byte y; private byte[] byteArray; - public Crest(int[] crestColours, int imageIndex, byte size, byte x, byte y) { this.crestColours = crestColours; this.imageIndex = (short) imageIndex; @@ -25,10 +20,10 @@ public Crest(int[] crestColours, int imageIndex, byte size, byte x, byte y) { this.y = y; } - public Crest(byte[] crestData){ + public Crest(byte[] crestData) { DataInputStream input = null; - try{ + try { input = new DataInputStream(new ByteArrayInputStream(crestData)); crestColours = new int[]{input.readInt(), input.readInt()}; @@ -37,12 +32,11 @@ public Crest(byte[] crestData){ x = input.readByte(); y = input.readByte(); - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); - }finally { - try{ - if(input != null){ + } finally { + try { + if (input != null) { input.close(); } } catch (IOException e) { @@ -51,13 +45,13 @@ public Crest(byte[] crestData){ } } - public byte[] getByteArray(){ - if(byteArray != null){ + public byte[] getByteArray() { + if (byteArray != null) { return byteArray; - }else{ + } else { DataOutputStream output = null; - try{ + try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); output = new DataOutputStream(bos); @@ -72,11 +66,11 @@ public byte[] getByteArray(){ byteArray = bos.toByteArray(); return byteArray; - } catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } finally { - try{ - if(output != null){ + try { + if (output != null) { output.close(); } } catch (IOException e) { diff --git a/src/main/java/mods/battlegear2/api/heraldry/HeraldryData.java b/src/main/java/mods/battlegear2/api/heraldry/HeraldryData.java index de0f8c9f..359edcf9 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/HeraldryData.java +++ b/src/main/java/mods/battlegear2/api/heraldry/HeraldryData.java @@ -1,11 +1,7 @@ package mods.battlegear2.api.heraldry; -import java.awt.Color; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; +import java.awt.*; +import java.io.*; import java.util.ArrayList; import java.util.List; @@ -15,21 +11,18 @@ public class HeraldryData { public static final int GREEN = 2; public static final int BLUE = 3; public static final int MAX_CRESTS = 6; - + private static final int extraDataSize = 6; + public static final HeraldryData defaultData = new HeraldryData(0, (byte) 0, Color.YELLOW.getRGB(), + Color.BLUE.getRGB(), Color.BLACK.getRGB(), new ArrayList(), new byte[extraDataSize]); private int storageIndex; private byte pattern; private int[] patternColours; private byte[] extraData; - - private static final int extraDataSize = 6; - public static final HeraldryData defaultData = - new HeraldryData(0, (byte)0, Color.YELLOW.getRGB(), Color.BLUE.getRGB(), Color.BLACK.getRGB(), new ArrayList(), new byte[extraDataSize]); - - private byte[] byteArray = null; private List crests; - public HeraldryData(int patternStoreIndex, byte pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3, List crests, byte[] extraData) { + public HeraldryData(int patternStoreIndex, byte pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3, + List crests, byte[] extraData) { this.storageIndex = patternStoreIndex; this.pattern = pattern; this.patternColours = new int[]{pattern_col_1, pattern_col_2, pattern_col_3}; @@ -37,10 +30,10 @@ public HeraldryData(int patternStoreIndex, byte pattern, int pattern_col_1, int this.extraData = extraData; } - public HeraldryData(byte[] crestData){ + public HeraldryData(byte[] crestData) { DataInputStream input = null; - try{ + try { input = new DataInputStream(new ByteArrayInputStream(crestData)); storageIndex = input.readInt(); @@ -48,20 +41,20 @@ public HeraldryData(byte[] crestData){ patternColours = new int[]{input.readInt(), input.readInt(), input.readInt()}; byte crestCount = input.readByte(); crests = new ArrayList(crestCount); - for(int i = 0; i < crestCount; i++){ + for (int i = 0; i < crestCount; i++) { byte[] bytes = new byte[Crest.dataSize]; input.read(bytes); crests.add(new Crest(bytes)); } extraData = new byte[extraDataSize]; - for(int i = 0; i < extraDataSize; i++){ + for (int i = 0; i < extraDataSize; i++) { extraData[i] = input.readByte(); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); - }finally { - try{ - if(input != null){ + } finally { + try { + if (input != null) { input.close(); } } catch (IOException e) { @@ -74,14 +67,20 @@ public static HeraldryData getDefault() { return defaultData; } + public static String byteArrayToHex(byte[] a) { + StringBuilder sb = new StringBuilder(); + for (byte b : a) + sb.append(String.format("%02x", b & 0xff)); + return sb.toString(); + } - public byte[] getByteArray(){ - if(byteArray != null){ + public byte[] getByteArray() { + if (byteArray != null) { return byteArray; - }else{ + } else { DataOutputStream output = null; - try{ + try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); output = new DataOutputStream(bos); @@ -91,7 +90,7 @@ public byte[] getByteArray(){ output.writeInt(patternColours[1]); output.writeInt(patternColours[2]); output.writeByte(crests.size()); - for(Crest c: crests){ + for (Crest c : crests) { output.write(c.getByteArray()); } output.write(extraData); @@ -99,11 +98,11 @@ public byte[] getByteArray(){ byteArray = bos.toByteArray(); return byteArray; - } catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } finally { - try{ - if(output != null){ + try { + if (output != null) { output.close(); } } catch (IOException e) { @@ -123,42 +122,36 @@ public byte[] getExtraData() { return extraData; } - public int getPatternIndex(){ + public int getPatternIndex() { return storageIndex; } + public void setPatternIndex(int index) { + this.storageIndex = index; + byteArray = null; + } + public byte getPattern() { return pattern; } - public int getColour(int index) { - return patternColours[index]; + public void setPattern(int pattern) { + this.pattern = (byte) pattern; + byteArray = null; } - public static String byteArrayToHex(byte[] a) { - StringBuilder sb = new StringBuilder(); - for(byte b: a) - sb.append(String.format("%02x", b&0xff)); - return sb.toString(); + public int getColour(int index) { + return patternColours[index]; } - public void setColour(int i, int rgb) { - patternColours[i] = rgb; - byteArray = null; - } - - public void setPatternIndex(int index){ - this.storageIndex = index; + public void setColour(int i, int rgb) { + patternColours[i] = rgb; byteArray = null; } - public void setPattern(int pattern) { - this.pattern = (byte)pattern; - byteArray = null; - } - - @Override - public HeraldryData clone(){ - return new HeraldryData(storageIndex, pattern, patternColours[0], patternColours[1], patternColours[2], crests, extraData); - } + @Override + public HeraldryData clone() { + return new HeraldryData(storageIndex, pattern, patternColours[0], patternColours[1], patternColours[2], crests, + extraData); + } } diff --git a/src/main/java/mods/battlegear2/api/heraldry/HeraldryDataBackup.java b/src/main/java/mods/battlegear2/api/heraldry/HeraldryDataBackup.java index 286b13f3..7fbe0e70 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/HeraldryDataBackup.java +++ b/src/main/java/mods/battlegear2/api/heraldry/HeraldryDataBackup.java @@ -1,16 +1,11 @@ package mods.battlegear2.api.heraldry; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; +import java.io.*; import java.util.Arrays; @SuppressWarnings("unused") public class HeraldryDataBackup { - public static final int RED = 1; public static final int GREEN = 2; public static final int BLUE = 3; @@ -25,7 +20,8 @@ public class HeraldryDataBackup { private byte[] byteArray = null; - public HeraldryDataBackup(int pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3, int crest, int crest_col_1, int crest_col_2, int crest_position, int helm, int banner) { + public HeraldryDataBackup(int pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3, int crest, + int crest_col_1, int crest_col_2, int crest_position, int helm, int banner) { this.pattern = (byte) pattern; this.crest = (short) crest; colours = new int[]{pattern_col_1, pattern_col_2, pattern_col_3, crest_col_1, crest_col_2}; @@ -34,21 +30,21 @@ public HeraldryDataBackup(int pattern, int pattern_col_1, int pattern_col_2, int this.banner = (byte) banner; } - public HeraldryDataBackup(byte pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3){ - this(pattern, pattern_col_1, pattern_col_2, pattern_col_3, 0, 0, 0,0, 0, 0); + public HeraldryDataBackup(byte pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3) { + this(pattern, pattern_col_1, pattern_col_2, pattern_col_3, 0, 0, 0, 0, 0, 0); } - public HeraldryDataBackup(byte[] data){ + public HeraldryDataBackup(byte[] data) { DataInputStream input = null; - try{ + try { input = new DataInputStream(new ByteArrayInputStream(data)); pattern = input.readByte(); crest = input.readShort(); crestPosition = input.readByte(); - colours= new int[5]; - for(int i = 0; i < colours.length; i++){ + colours = new int[5]; + for (int i = 0; i < colours.length; i++) { colours[i] = input.readInt(); } @@ -57,11 +53,11 @@ public HeraldryDataBackup(byte[] data){ byteArray = Arrays.copyOf(data, data.length); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); - }finally { - try{ - if(input != null){ + } finally { + try { + if (input != null) { input.close(); } } catch (IOException e) { @@ -74,22 +70,29 @@ public static HeraldryDataBackup getDefault() { return new HeraldryDataBackup(10, 0xFF000000, 0xFFFFFFFF, 0xFFFFFF00, 0, 0xFF000000, 0xFF000000, 0, 0, 0); } - public byte[] getByteArray(){ + public static String byteArrayToHex(byte[] a) { + StringBuilder sb = new StringBuilder(); + for (byte b : a) + sb.append(String.format("%02x", b & 0xff)); + return sb.toString(); + } + + public byte[] getByteArray() { - if(byteArray != null){ + if (byteArray != null) { return byteArray; } DataOutputStream output = null; - try{ + try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); output = new DataOutputStream(bos); output.writeByte(pattern); output.writeShort(crest); output.writeByte(crestPosition); - for(int i = 0; i < 5; i++){ + for (int i = 0; i < 5; i++) { output.writeInt(colours[i]); } @@ -97,11 +100,11 @@ public byte[] getByteArray(){ output.writeByte(banner); return bos.toByteArray(); - } catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } finally { - try{ - if(output != null){ + try { + if (output != null) { output.close(); } } catch (IOException e) { @@ -112,8 +115,8 @@ public byte[] getByteArray(){ return null; } - public int getColourChanel(int colour, int chanelNo){ - switch (chanelNo){ + public int getColourChanel(int colour, int chanelNo) { + switch (chanelNo) { case RED: return (colours[colour] >> 16) & 0xFF; case GREEN: @@ -138,13 +141,6 @@ public String toString() { return byteArrayToHex(getByteArray()); } - public static String byteArrayToHex(byte[] a) { - StringBuilder sb = new StringBuilder(); - for(byte b: a) - sb.append(String.format("%02x", b&0xff)); - return sb.toString(); - } - public short getCrest() { return crest; } diff --git a/src/main/java/mods/battlegear2/api/heraldry/HeraldryPattern.java b/src/main/java/mods/battlegear2/api/heraldry/HeraldryPattern.java index 772a9214..41909190 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/HeraldryPattern.java +++ b/src/main/java/mods/battlegear2/api/heraldry/HeraldryPattern.java @@ -1,51 +1,50 @@ package mods.battlegear2.api.heraldry; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.IIcon; +import java.util.ArrayList; +import java.util.List; + @Deprecated public class HeraldryPattern { + public static final HeraldryPattern VERTICAL_BLOCK = new HeraldryPattern("battlegear2", "patterns/pattern-0"); + public static final HeraldryPattern HORIZONTAL_BLOCK = new HeraldryPattern("battlegear2", "patterns/pattern-1"); + public static final HeraldryPattern QUARTERD = new HeraldryPattern("battlegear2", "patterns/pattern-2"); + public static final HeraldryPattern HORIZONTAL_MID = new HeraldryPattern("battlegear2", "patterns/pattern-3"); + public static final HeraldryPattern VERTICAL_MID = new HeraldryPattern("battlegear2", "patterns/pattern-4"); + public static final HeraldryPattern HORIZONTAL_BAR = new HeraldryPattern("battlegear2", "patterns/pattern-5"); + public static final HeraldryPattern VERTICAL_BAR = new HeraldryPattern("battlegear2", "patterns/pattern-6"); + public static final HeraldryPattern SMALL_CHECKERED = new HeraldryPattern("battlegear2", "patterns/pattern-7"); + public static final HeraldryPattern DIAG_DOWN = new HeraldryPattern("battlegear2", "patterns/pattern-8"); + public static final HeraldryPattern DIAG_UP = new HeraldryPattern("battlegear2", "patterns/pattern-9"); + public static final HeraldryPattern LOWER_TRIANGLE = new HeraldryPattern("battlegear2", "patterns/pattern-10"); + public static final HeraldryPattern UPPER_TRIANGLE = new HeraldryPattern("battlegear2", "patterns/pattern-11"); + public static final HeraldryPattern VERTICAL_TRIANGLES = new HeraldryPattern("battlegear2", "patterns/pattern-12"); + public static final HeraldryPattern UP_ARROW = new HeraldryPattern("battlegear2", "patterns/pattern-13"); + public static final HeraldryPattern CROSS = new HeraldryPattern("battlegear2", "patterns/pattern-14"); + public static final HeraldryPattern DIAG_CROSS = new HeraldryPattern("battlegear2", "patterns/pattern-15"); public static List patterns = new ArrayList(); - public static final HeraldryPattern VERTICAL_BLOCK = new HeraldryPattern("battlegear2","patterns/pattern-0"); - public static final HeraldryPattern HORIZONTAL_BLOCK= new HeraldryPattern("battlegear2","patterns/pattern-1"); - public static final HeraldryPattern QUARTERD= new HeraldryPattern("battlegear2","patterns/pattern-2"); - public static final HeraldryPattern HORIZONTAL_MID= new HeraldryPattern("battlegear2","patterns/pattern-3"); - public static final HeraldryPattern VERTICAL_MID= new HeraldryPattern("battlegear2","patterns/pattern-4"); - public static final HeraldryPattern HORIZONTAL_BAR= new HeraldryPattern("battlegear2","patterns/pattern-5"); - public static final HeraldryPattern VERTICAL_BAR= new HeraldryPattern("battlegear2","patterns/pattern-6"); - public static final HeraldryPattern SMALL_CHECKERED= new HeraldryPattern("battlegear2","patterns/pattern-7"); - public static final HeraldryPattern DIAG_DOWN= new HeraldryPattern("battlegear2","patterns/pattern-8"); - public static final HeraldryPattern DIAG_UP= new HeraldryPattern("battlegear2","patterns/pattern-9"); - public static final HeraldryPattern LOWER_TRIANGLE= new HeraldryPattern("battlegear2","patterns/pattern-10"); - public static final HeraldryPattern UPPER_TRIANGLE= new HeraldryPattern("battlegear2","patterns/pattern-11"); - public static final HeraldryPattern VERTICAL_TRIANGLES= new HeraldryPattern("battlegear2","patterns/pattern-12"); - public static final HeraldryPattern UP_ARROW= new HeraldryPattern("battlegear2","patterns/pattern-13"); - public static final HeraldryPattern CROSS= new HeraldryPattern("battlegear2","patterns/pattern-14"); - public static final HeraldryPattern DIAG_CROSS= new HeraldryPattern("battlegear2","patterns/pattern-15"); - - private IIcon icon; - public final String name; + public final String name; public final String mod; - - public HeraldryPattern(String modid, String name){ + private IIcon icon; + + public HeraldryPattern(String modid, String name) { this.mod = modid; - this.name = name; + this.name = name; patterns.add(this); - } - - public String getPath(){ - return "assets/"+mod+"/textures/items/heraldry/"+name+".png"; - } - - public IIcon getIcon() { - return icon; - } - - public void registerIcon(TextureMap map){ - this.icon = map.registerIcon(mod+":heraldry/"+name); - } + } + + public String getPath() { + return "assets/" + mod + "/textures/items/heraldry/" + name + ".png"; + } + + public IIcon getIcon() { + return icon; + } + + public void registerIcon(TextureMap map) { + this.icon = map.registerIcon(mod + ":heraldry/" + name); + } } diff --git a/src/main/java/mods/battlegear2/api/heraldry/HeraldryTextureSmall.java b/src/main/java/mods/battlegear2/api/heraldry/HeraldryTextureSmall.java index d603e749..73bbb348 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/HeraldryTextureSmall.java +++ b/src/main/java/mods/battlegear2/api/heraldry/HeraldryTextureSmall.java @@ -1,11 +1,11 @@ package mods.battlegear2.api.heraldry; -import java.awt.image.BufferedImage; - import net.minecraft.client.renderer.texture.AbstractTexture; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.client.resources.IResourceManager; +import java.awt.image.BufferedImage; + public class HeraldryTextureSmall extends AbstractTexture { private HeraldryData heraldryData; @@ -16,16 +16,16 @@ public HeraldryTextureSmall(HeraldryData crest) { @Override public void loadTexture(IResourceManager resourcemanager) { - int [][][][] patt = PatternStore.DEFAULT.patterns.get(heraldryData.getPatternIndex()); - BufferedImage image = new BufferedImage(patt[heraldryData.getPattern()][0].length, patt[heraldryData.getPattern()][0][0].length,BufferedImage.TYPE_4BYTE_ABGR); - - for(int x = 0; x < image.getWidth(); x++){ - for(int y = 0; y < image.getHeight(); y++){ - image.setRGB(x, y, PatternStore.getBlendedSmallPixel(patt, heraldryData.getPattern(), x, y, heraldryData.getColour(0), heraldryData.getColour(1), heraldryData.getColour(2))); + int[][][][] patt = PatternStore.DEFAULT.patterns.get(heraldryData.getPatternIndex()); + BufferedImage image = new BufferedImage(patt[heraldryData.getPattern()][0].length, + patt[heraldryData.getPattern()][0][0].length, BufferedImage.TYPE_4BYTE_ABGR); + + for (int x = 0; x < image.getWidth(); x++) { + for (int y = 0; y < image.getHeight(); y++) { + image.setRGB(x, y, PatternStore.getBlendedSmallPixel(patt, heraldryData.getPattern(), x, y, + heraldryData.getColour(0), heraldryData.getColour(1), heraldryData.getColour(2))); } } - TextureUtil.uploadTextureImage(this.getGlTextureId(), image); + TextureUtil.uploadTextureImage(this.getGlTextureId(), image); } } - - diff --git a/src/main/java/mods/battlegear2/api/heraldry/IFlagHolder.java b/src/main/java/mods/battlegear2/api/heraldry/IFlagHolder.java index 6f2bc935..017b262d 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/IFlagHolder.java +++ b/src/main/java/mods/battlegear2/api/heraldry/IFlagHolder.java @@ -1,9 +1,9 @@ package mods.battlegear2.api.heraldry; -import java.util.List; - import net.minecraft.item.ItemStack; +import java.util.List; + /** * Defines a {@link #TileEntity} holding flags {@link #ItemStack} */ @@ -16,19 +16,19 @@ public interface IFlagHolder { /** * Add given flag to the TileEntity - * @param flag The flag to add - * return true if flag could be added + * + * @param flag The flag to add return true if flag could be added */ public boolean addFlag(ItemStack flag); /** - * * @return All flags currently contained, empty list if none */ public List getFlags(); /** * Called by the default {@link FlagPoleTileRenderer} + * * @param metadata * @param section * @return the value to interpolate on the flagpole icon, to render the flagpole @@ -37,6 +37,7 @@ public interface IFlagHolder { /** * Called by the default {@link FlagPoleTileRenderer} + * * @param metadata * @return the rendered orientation value for the flagpole and thus the flags */ diff --git a/src/main/java/mods/battlegear2/api/heraldry/IHeraldryItem.java b/src/main/java/mods/battlegear2/api/heraldry/IHeraldryItem.java index 353a8d06..8dd38044 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/IHeraldryItem.java +++ b/src/main/java/mods/battlegear2/api/heraldry/IHeraldryItem.java @@ -7,37 +7,36 @@ public interface IHeraldryItem { public static final String heraldryTag = "hc1"; - public enum HeraldyRenderPassess{ - Pattern, - SecondaryColourTrim, - PostRenderIcon - } - /** * Returns the "base" icon. This icon will be coloured the primary colour */ public IIcon getBaseIcon(ItemStack stack); + /** * Returns the trim icon, This will be coloured the secondary colour */ public IIcon getTrimIcon(ItemStack stack); + /** - * Returns the post render icon, this Icon will render after all other rendering passess in it's default colour + * Returns the post render icon, this Icon will render after all other rendering + * passess in it's default colour */ public IIcon getPostRenderIcon(ItemStack stack); - /** * Returns true if the given itemstack has heraldy attached */ public boolean hasHeraldry(ItemStack stack); + /** - * Returns the current heraldy code, this will only be called on ItemStacks that have been found to have heraldry using the hasHeraldryMethod + * Returns the current heraldy code, this will only be called on ItemStacks that + * have been found to have heraldry using the hasHeraldryMethod */ public byte[] getHeraldry(ItemStack stack); /** - * Saves the given heraldry code in the given stack. It is recommended to save the Byte array representation of the crest in the NBT + * Saves the given heraldry code in the given stack. It is recommended to save + * the Byte array representation of the crest in the NBT */ public void setHeraldry(ItemStack stack, byte[] data); @@ -52,10 +51,14 @@ public enum HeraldyRenderPassess{ public boolean shouldDoPass(HeraldyRenderPassess pass); /** - * Returns true if the default renderer should be used. - * If the method returns true, the default renderer will be attached. - * If this method returns false it is the modders responsibility to attach an appropriate renderer + * Returns true if the default renderer should be used. If the method returns + * true, the default renderer will be attached. If this method returns false it + * is the modders responsibility to attach an appropriate renderer */ public boolean useDefaultRenderer(); + public enum HeraldyRenderPassess { + Pattern, SecondaryColourTrim, PostRenderIcon + } + } diff --git a/src/main/java/mods/battlegear2/api/heraldry/IHeraldyArmour.java b/src/main/java/mods/battlegear2/api/heraldry/IHeraldyArmour.java index 16beb695..3279d2be 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/IHeraldyArmour.java +++ b/src/main/java/mods/battlegear2/api/heraldry/IHeraldyArmour.java @@ -1,8 +1,8 @@ package mods.battlegear2.api.heraldry; -public interface IHeraldyArmour extends IHeraldryItem{ - - public String getBaseArmourPath(int armourSlot); +public interface IHeraldyArmour extends IHeraldryItem { + + public String getBaseArmourPath(int armourSlot); public String getPatternArmourPath(PatternStore pattern, int index, int armourSlot); } diff --git a/src/main/java/mods/battlegear2/api/heraldry/PatternStore.java b/src/main/java/mods/battlegear2/api/heraldry/PatternStore.java index 7c7c1a32..9d3cb826 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/PatternStore.java +++ b/src/main/java/mods/battlegear2/api/heraldry/PatternStore.java @@ -1,48 +1,67 @@ package mods.battlegear2.api.heraldry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; + +import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; -import javax.imageio.ImageIO; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.util.ResourceLocation; - public class PatternStore { public static final IResourceManager rm = Minecraft.getMinecraft().getResourceManager(); - public static final PatternStore DEFAULT = new PatternStore(8,4); + public static final PatternStore DEFAULT = new PatternStore(8, 4); private final int IMAGES_X; private final int IMAGES_Y; public List patterns = new ArrayList(); - public PatternStore(int xSections,int ySections){ + public PatternStore(int xSections, int ySections) { this.IMAGES_X = xSections; this.IMAGES_Y = ySections; } + + public static int getBlendedSmallPixel(int[][][][] rgbs, byte imageNo, int x, int y, int col1, int col2, int col3) { + return getBlendedSmallPixel(rgbs[imageNo][0][x][y], rgbs[imageNo][1][x][y], rgbs[imageNo][2][x][y], col1, col2, + col3); + } + + public static int getBlendedSmallPixel(int a, int b, int c, int col1, int col2, int col3) { + int red = ((((col1 >> 16) & 0xFF) * a) / 255) + ((((col2 >> 16) & 0xFF) * b) / 255) + + ((((col3 >> 16) & 0xFF) * c) / 255); + + int green = (((col1 >> 8) & 0xFF) * a / 255) + (((col2 >> 8) & 0xFF) * b / 255) + + (((col3 >> 8) & 0xFF) * c / 255); + + int blue = (((col1) & 0xFF) * a / 255) + (((col2) & 0xFF) * b / 255) + (((col3) & 0xFF) * c / 255); + + return 0xFF000000 | ((red << 16) & 0x00FF0000) | ((green << 8) & 0x0000FF00) | ((blue) & 0x000000FF); + } + /** * Deconstruct an image and store its data for later use + * * @param image * @return the index used to get the data back */ - public int buildPatternAndStore(ResourceLocation image){ - try{ - if(patterns.add(buildPatternFrom(image))){ - return patterns.size()-1; - }else{ + public int buildPatternAndStore(ResourceLocation image) { + try { + if (patterns.add(buildPatternFrom(image))) { + return patterns.size() - 1; + } else { return -1; } - }catch (IOException io){ + } catch (IOException io) { return -1; } } /** * See {@link #buildPatternFrom(java.awt.image.BufferedImage)} + * * @throws IOException if the image can't be read */ public int[][][][] buildPatternFrom(ResourceLocation image) throws IOException { @@ -51,6 +70,7 @@ public int[][][][] buildPatternFrom(ResourceLocation image) throws IOException { /** * See {@link #buildPatternFrom(java.awt.image.BufferedImage)} + * * @throws IOException if the image can't be read */ public int[][][][] buildPatternFrom(InputStream resourceStream) throws IOException { @@ -59,143 +79,100 @@ public int[][][][] buildPatternFrom(InputStream resourceStream) throws IOExcepti /** * Analyse the given image by cutting it into subimages + * * @param image * @return the subimages rgb values into arrays */ - public int[][][][] buildPatternFrom(BufferedImage image){ - int[][][][] rgbs = new int[IMAGES_X * IMAGES_Y][3][(image.getWidth() / IMAGES_X)][(image.getHeight() / IMAGES_Y)]; + public int[][][][] buildPatternFrom(BufferedImage image) { + int[][][][] rgbs = new int[IMAGES_X + * IMAGES_Y][3][(image.getWidth() / IMAGES_X)][(image.getHeight() / IMAGES_Y)]; int imageRes = image.getWidth() / IMAGES_X; - for(int x = 0; x < image.getWidth(); x++){ - for(int y = 0; y < image.getHeight(); y++){ + for (int x = 0; x < image.getWidth(); x++) { + for (int y = 0; y < image.getHeight(); y++) { int imageNo = (x / imageRes) + IMAGES_X * (y / imageRes); - int rgb = image.getRGB(x,y); + int rgb = image.getRGB(x, y); int red = (rgb >> 16) & 0x000000FF; int green = (rgb >> 8) & 0x000000FF; int blue = (rgb) & 0x000000FF; - int total = red+green+blue; + int total = red + green + blue; - if(total == 0){ - rgbs[imageNo][0][x%imageRes][y%imageRes] = 255; - rgbs[imageNo][1][x%imageRes][y%imageRes] = 0; - rgbs[imageNo][2][x%imageRes][y%imageRes] = 0; - }else{ - rgbs[imageNo][0][x%imageRes][y%imageRes] = (255 * red) / total; - rgbs[imageNo][1][x%imageRes][y%imageRes] = (255 * green) / total; - rgbs[imageNo][2][x%imageRes][y%imageRes] = (255 * blue) / total; + if (total == 0) { + rgbs[imageNo][0][x % imageRes][y % imageRes] = 255; + rgbs[imageNo][1][x % imageRes][y % imageRes] = 0; + rgbs[imageNo][2][x % imageRes][y % imageRes] = 0; + } else { + rgbs[imageNo][0][x % imageRes][y % imageRes] = (255 * red) / total; + rgbs[imageNo][1][x % imageRes][y % imageRes] = (255 * green) / total; + rgbs[imageNo][2][x % imageRes][y % imageRes] = (255 * blue) / total; } } } return rgbs; } - public int getBlendedSmallPixel(int index, byte imageNo, int x, int y, int col1, int col2, int col3){ - return getBlendedSmallPixel(patterns.get(index)[imageNo][0][x][y], patterns.get(index)[imageNo][1][x][y], patterns.get(index)[imageNo][2][x][y], col1, col2, col3); - } - - public static int getBlendedSmallPixel(int[][][][] rgbs, byte imageNo, int x, int y, int col1, int col2, int col3){ - return getBlendedSmallPixel(rgbs[imageNo][0][x][y], rgbs[imageNo][1][x][y], rgbs[imageNo][2][x][y], col1, col2, col3); - } - - public static int getBlendedSmallPixel(int a, int b, int c, int col1, int col2, int col3){ - int red = ((((col1 >> 16) & 0xFF) * a) / 255) + - ((((col2 >> 16) & 0xFF) * b) / 255) + - ((((col3 >> 16) & 0xFF) * c)/ 255); - - int green = (((col1 >> 8) & 0xFF) * a / 255) + - (((col2 >> 8) & 0xFF) * b / 255) + - (((col3 >> 8) & 0xFF) * c / 255); - - int blue = (((col1) & 0xFF) * a / 255) + - (((col2) & 0xFF) * b / 255) + - (((col3) & 0xFF) * c / 255); - - return 0xFF000000 | - ((red << 16) & 0x00FF0000) | - ((green << 8) & 0x0000FF00) | - ((blue) & 0x000000FF); - } - - - - - - - /* - public static void initialise(ResourceManager rm){ - - try{ - InputStream inputstream = rm.func_110536_a(small_image).func_110527_b(); - BufferedImage image = ImageIO.read(inputstream); - - if(image != null){ - - small_col1 = new byte[IMAGES_X * IMAGES_Y][(image.getWidth() / IMAGES_X)][(image.getHeight() / IMAGES_Y)]; - small_col2 = new byte[IMAGES_X * IMAGES_Y][(image.getWidth() / IMAGES_X)][(image.getHeight() / IMAGES_Y)]; - small_col3 = new byte[IMAGES_X * IMAGES_Y][(image.getWidth() / IMAGES_X)][(image.getHeight() / IMAGES_Y)]; - - for(int x = 0; x < image.getWidth(); x++){ - for(int y = 0; y < image.getHeight() / 2; y++){ - - int imageNo = (x / IMAGES_X) + IMAGES_X * (y / IMAGES_Y); - - int rgb = image.getRGB(x,y); - small_col1[imageNo][x][y] = (byte) ((rgb >> 16) & 0x000000FF); - small_col2[imageNo][x][y] = (byte) ((rgb >>8 ) & 0x000000FF); - small_col3[imageNo][x][y] = (byte) ((rgb) & 0x000000FF); - - if(small_col1[imageNo][x][y] == 0 && - small_col2[imageNo][x][y] == 0 && - small_col3[imageNo][x][y] == 0){ - small_col1[imageNo][x][y] = (byte)255; - - } - } - } - } - }catch (Exception e){ - e.printStackTrace();; - } - /* - try{ - InputStream inputstream = rm.func_110536_a(large_image).func_110527_b(); - BufferedImage image = ImageIO.read(inputstream); - - if(image != null){ - - large_col1 = new float[IMAGES_X * IMAGES_Y][(image.getWidth() / IMAGES_X)][(image.getHeight() / (IMAGES_Y * 2))]; - large_col2 = new float[IMAGES_X * IMAGES_Y][(image.getWidth() / IMAGES_X)][(image.getHeight() / (IMAGES_Y * 2))]; - large_col3 = new float[IMAGES_X * IMAGES_Y][(image.getWidth() / IMAGES_X)][(image.getHeight() / (IMAGES_Y * 2))]; - - - for(int x = 0; x < image.getWidth(); x++){ - for(int y = 0; y < image.getHeight() / 2; y++){ - - int imageNo = (x / IMAGES_X) + IMAGES_X * (y / (2*IMAGES_Y)); - - int rgb = image.getRGB(x,y); - int red = (rgb >> 16) & 0x000000FF; - int green = (rgb >>8 ) & 0x000000FF; - int blue = (rgb) & 0x000000FF; - - if(red == 0 && green == 0 && blue == 0){ - large_col1[imageNo][x][y] = 0F; - }else{ - large_col1[imageNo][x][y] = (float)red / (float)(red + green + blue); - large_col2[imageNo][x][y] = (float)red / (float)(red + green + blue); - large_col3[imageNo][x][y] = (float)red / (float)(red + green + blue); - } - } - } - } - }catch (Exception e){ - e.printStackTrace();; - } - - + public int getBlendedSmallPixel(int index, byte imageNo, int x, int y, int col1, int col2, int col3) { + return getBlendedSmallPixel(patterns.get(index)[imageNo][0][x][y], patterns.get(index)[imageNo][1][x][y], + patterns.get(index)[imageNo][2][x][y], col1, col2, col3); } - */ + /* + * public static void initialise(ResourceManager rm){ + * + * try{ InputStream inputstream = rm.func_110536_a(small_image).func_110527_b(); + * BufferedImage image = ImageIO.read(inputstream); + * + * if(image != null){ + * + * small_col1 = new byte[IMAGES_X * IMAGES_Y][(image.getWidth() / + * IMAGES_X)][(image.getHeight() / IMAGES_Y)]; small_col2 = new byte[IMAGES_X * + * IMAGES_Y][(image.getWidth() / IMAGES_X)][(image.getHeight() / IMAGES_Y)]; + * small_col3 = new byte[IMAGES_X * IMAGES_Y][(image.getWidth() / + * IMAGES_X)][(image.getHeight() / IMAGES_Y)]; + * + * for(int x = 0; x < image.getWidth(); x++){ for(int y = 0; y < + * image.getHeight() / 2; y++){ + * + * int imageNo = (x / IMAGES_X) + IMAGES_X * (y / IMAGES_Y); + * + * int rgb = image.getRGB(x,y); small_col1[imageNo][x][y] = (byte) ((rgb >> 16) + * & 0x000000FF); small_col2[imageNo][x][y] = (byte) ((rgb >>8 ) & 0x000000FF); + * small_col3[imageNo][x][y] = (byte) ((rgb) & 0x000000FF); + * + * if(small_col1[imageNo][x][y] == 0 && small_col2[imageNo][x][y] == 0 && + * small_col3[imageNo][x][y] == 0){ small_col1[imageNo][x][y] = (byte)255; + * + * } } } } }catch (Exception e){ e.printStackTrace();; } /* try{ InputStream + * inputstream = rm.func_110536_a(large_image).func_110527_b(); BufferedImage + * image = ImageIO.read(inputstream); + * + * if(image != null){ + * + * large_col1 = new float[IMAGES_X * IMAGES_Y][(image.getWidth() / + * IMAGES_X)][(image.getHeight() / (IMAGES_Y * 2))]; large_col2 = new + * float[IMAGES_X * IMAGES_Y][(image.getWidth() / IMAGES_X)][(image.getHeight() + * / (IMAGES_Y * 2))]; large_col3 = new float[IMAGES_X * + * IMAGES_Y][(image.getWidth() / IMAGES_X)][(image.getHeight() / (IMAGES_Y * + * 2))]; + * + * + * for(int x = 0; x < image.getWidth(); x++){ for(int y = 0; y < + * image.getHeight() / 2; y++){ + * + * int imageNo = (x / IMAGES_X) + IMAGES_X * (y / (2*IMAGES_Y)); + * + * int rgb = image.getRGB(x,y); int red = (rgb >> 16) & 0x000000FF; int green = + * (rgb >>8 ) & 0x000000FF; int blue = (rgb) & 0x000000FF; + * + * if(red == 0 && green == 0 && blue == 0){ large_col1[imageNo][x][y] = 0F; + * }else{ large_col1[imageNo][x][y] = (float)red / (float)(red + green + blue); + * large_col2[imageNo][x][y] = (float)red / (float)(red + green + blue); + * large_col3[imageNo][x][y] = (float)red / (float)(red + green + blue); } } } } + * }catch (Exception e){ e.printStackTrace();; } + * + * + * } + */ } diff --git a/src/main/java/mods/battlegear2/api/heraldry/RefreshableTexture.java b/src/main/java/mods/battlegear2/api/heraldry/RefreshableTexture.java index 1726c2b7..d7ec2d2d 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/RefreshableTexture.java +++ b/src/main/java/mods/battlegear2/api/heraldry/RefreshableTexture.java @@ -1,14 +1,15 @@ package mods.battlegear2.api.heraldry; -import java.awt.Image; -import java.awt.image.BufferedImage; - import net.minecraft.client.renderer.texture.DynamicTexture; -public class RefreshableTexture extends DynamicTexture{ +import java.awt.*; +import java.awt.image.BufferedImage; + +public class RefreshableTexture extends DynamicTexture { private int width; private int height; + public RefreshableTexture(BufferedImage par1BufferedImage) { super(par1BufferedImage); this.width = par1BufferedImage.getWidth(); @@ -21,30 +22,32 @@ public RefreshableTexture(int par1, int par2) { this.height = par2; } - public void refreshWith(HeraldryData data, boolean scale){ + public void refreshWith(HeraldryData data, boolean scale) { refreshWith(data.getPatternIndex(), data, scale); } - public void refreshWith(int patternIndex, HeraldryData data, boolean scale){ - if(patternIndex>=0 && patternIndex= 0 && patternIndex < PatternStore.DEFAULT.patterns.size()) { refreshWith(PatternStore.DEFAULT.patterns.get(patternIndex), data, scale); } } - public void refreshWith(int[][][][] pattern, HeraldryData data, boolean scale){ - BufferedImage image = new BufferedImage(pattern[data.getPattern()][0].length, pattern[data.getPattern()][0][0].length,BufferedImage.TYPE_4BYTE_ABGR); - for(int x = 0; x < image.getWidth(); x++){ - for(int y = 0; y < image.getHeight(); y++){ - image.setRGB(x, y, PatternStore.getBlendedSmallPixel(pattern, data.getPattern(), x, y, data.getColour(0), data.getColour(1), data.getColour(2))); + public void refreshWith(int[][][][] pattern, HeraldryData data, boolean scale) { + BufferedImage image = new BufferedImage(pattern[data.getPattern()][0].length, + pattern[data.getPattern()][0][0].length, BufferedImage.TYPE_4BYTE_ABGR); + for (int x = 0; x < image.getWidth(); x++) { + for (int y = 0; y < image.getHeight(); y++) { + image.setRGB(x, y, PatternStore.getBlendedSmallPixel(pattern, data.getPattern(), x, y, + data.getColour(0), data.getColour(1), data.getColour(2))); } } - if(scale && (image.getHeight() != height || image.getWidth() != width)){ - image = (BufferedImage)image.getScaledInstance(width, height, Image.SCALE_SMOOTH); + if (scale && (image.getHeight() != height || image.getWidth() != width)) { + image = (BufferedImage) image.getScaledInstance(width, height, Image.SCALE_SMOOTH); } int[] pixels = getTextureData(); - for(int x = 0; x < image.getWidth(); x++){ - for(int y = 0; y < image.getHeight(); y++){ - pixels[x+y*image.getWidth()] = image.getRGB(x,y); + for (int x = 0; x < image.getWidth(); x++) { + for (int y = 0; y < image.getHeight(); y++) { + pixels[x + y * image.getWidth()] = image.getRGB(x, y); } } } diff --git a/src/main/java/mods/battlegear2/api/heraldry/package-info.java b/src/main/java/mods/battlegear2/api/heraldry/package-info.java index 9cc5cec3..e426b5ac 100644 --- a/src/main/java/mods/battlegear2/api/heraldry/package-info.java +++ b/src/main/java/mods/battlegear2/api/heraldry/package-info.java @@ -2,4 +2,3 @@ package mods.battlegear2.api.heraldry; import cpw.mods.fml.common.API; - diff --git a/src/main/java/mods/battlegear2/api/package-info.java b/src/main/java/mods/battlegear2/api/package-info.java index 81dbfe86..210e18ed 100644 --- a/src/main/java/mods/battlegear2/api/package-info.java +++ b/src/main/java/mods/battlegear2/api/package-info.java @@ -2,4 +2,3 @@ package mods.battlegear2.api; import cpw.mods.fml.common.API; - diff --git a/src/main/java/mods/battlegear2/api/quiver/IArrowContainer2.java b/src/main/java/mods/battlegear2/api/quiver/IArrowContainer2.java index 4e6d86ed..e07ccb2d 100644 --- a/src/main/java/mods/battlegear2/api/quiver/IArrowContainer2.java +++ b/src/main/java/mods/battlegear2/api/quiver/IArrowContainer2.java @@ -10,6 +10,7 @@ public interface IArrowContainer2 { /** * Returns the maximum amount of slots in the arrow container + * * @param container {@link ItemStack} representing this item * @return the amount of slots */ @@ -17,6 +18,7 @@ public interface IArrowContainer2 { /** * Returns the currently selected slot in the arrow container + * * @param container {@link ItemStack} representing this item * @return the currently selected slot */ @@ -24,81 +26,90 @@ public interface IArrowContainer2 { /** * Sets the currently selected slot to the given value + * * @param container {@link ItemStack} representing this item - * @param newSlot the new slot index + * @param newSlot the new slot index */ public void setSelectedSlot(ItemStack container, int newSlot); /** * Returns the itemStack in the currently selected slot + * * @param container The {@link ItemStack} representing this item - * @param slot the slot index + * @param slot the slot index * @return The {@link #ItemStack} in the given slot. */ public ItemStack getStackInSlot(ItemStack container, int slot); /** * Sets places the given item stack in the given slot + * * @param container {@link ItemStack} representing this item - * @param slot the slot index - * @param stack {@link ItemStack} representing the new stack + * @param slot the slot index + * @param stack {@link ItemStack} representing the new stack */ public void setStackInSlot(ItemStack container, int slot, ItemStack stack); /** - * * @param container The {@link ItemStack} representing this item - * @param bow The bow trying to use this container - * @param player The {@link EntityPlayer} using the bow + * @param bow The bow trying to use this container + * @param player The {@link EntityPlayer} using the bow * @return true if the item contains at least one arrow in the selected slot */ public boolean hasArrowFor(ItemStack container, ItemStack bow, EntityPlayer player, int slot); /** * The arrow spawned when bow is used with this non empty container equipped + * * @param container The {@link ItemStack} representing this item - * @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F - * @param player The {@link EntityPlayer} using the bow + * @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F + * @param player The {@link EntityPlayer} using the bow * @param world * @return the arrow entity to spawn when bow is used */ public EntityArrow getArrowType(ItemStack container, World world, EntityPlayer player, float charge); /** - * Action to take after an arrow has been fired - * Usually equal to removing an arrow from the container - * @param player The {@link EntityPlayer} using the bow + * Action to take after an arrow has been fired Usually equal to removing an + * arrow from the container + * + * @param player The {@link EntityPlayer} using the bow * @param world * @param container The {@link ItemStack} representing this item - * @param bow The bow which fired - * @param arrow the arrow fired + * @param bow The bow which fired + * @param arrow the arrow fired */ public void onArrowFired(World world, EntityPlayer player, ItemStack container, ItemStack bow, EntityArrow arrow); /** * Called before the arrow is fired from this container + * * @param arrowEvent Used to decide bow damage, bow sound and arrow enchantment */ public void onPreArrowFired(PlayerEventChild.QuiverArrowEvent.Firing arrowEvent); /** * Called when the container is put on a crafting bench with other items - * @param container The {@link ItemStack} representing this item + * + * @param container The {@link ItemStack} representing this item * @param arrowStack The {@link ItemStack} representing other items * @return True to receive {@link #addArrows(ItemStack, ItemStack)} */ public boolean isCraftableWithArrows(ItemStack container, ItemStack arrowStack); /** - * Crafts the item with the items from {@link #isCraftableWithArrows(ItemStack, ItemStack)} + * Crafts the item with the items from + * {@link #isCraftableWithArrows(ItemStack, ItemStack)} + * * @param container The {@link ItemStack} representing this item - * @param newStack Another valid item on the crafting bench + * @param newStack Another valid item on the crafting bench * @return Arrows that couldn't fit in */ public ItemStack addArrows(ItemStack container, ItemStack newStack); /** * Called through post rendering event on the player + * * @param container * @return true if the default quiver model can be rendered */ diff --git a/src/main/java/mods/battlegear2/api/quiver/IArrowFireHandler.java b/src/main/java/mods/battlegear2/api/quiver/IArrowFireHandler.java index 8d413d43..6ee1561c 100644 --- a/src/main/java/mods/battlegear2/api/quiver/IArrowFireHandler.java +++ b/src/main/java/mods/battlegear2/api/quiver/IArrowFireHandler.java @@ -7,9 +7,11 @@ public interface IArrowFireHandler { - /**Called from QuiverArrowRegistry.getArrowType, - * to decide if it is worth trying to build an EntityArrow - * @param arrow the stack which should define the arrow as item + /** + * Called from QuiverArrowRegistry.getArrowType, to decide if it is worth trying + * to build an EntityArrow + * + * @param arrow the stack which should define the arrow as item * @param world * @param player player using a bow to fire an arrow * @param charge amount of charge in the bow @@ -17,10 +19,11 @@ public interface IArrowFireHandler { */ public boolean canFireArrow(ItemStack arrow, World world, EntityPlayer player, float charge); - /**Called from QuiverArrowRegistry.getArrowType, - * return null if the EntityArrow couldn't be built, - * let pass to another IArrowFireHandler - * @param arrow the stack which should define the arrow as item + /** + * Called from QuiverArrowRegistry.getArrowType, return null if the EntityArrow + * couldn't be built, let pass to another IArrowFireHandler + * + * @param arrow the stack which should define the arrow as item * @param world * @param player player using a bow to fire an arrow * @param charge amount of charge in the bow diff --git a/src/main/java/mods/battlegear2/api/quiver/IQuiverSelection.java b/src/main/java/mods/battlegear2/api/quiver/IQuiverSelection.java index 5b905af5..69f4ec87 100644 --- a/src/main/java/mods/battlegear2/api/quiver/IQuiverSelection.java +++ b/src/main/java/mods/battlegear2/api/quiver/IQuiverSelection.java @@ -6,10 +6,13 @@ public interface IQuiverSelection { /** - * Defines a quiver selection algorithm, to be added with {@link QuiverArrowRegistry#addQuiverSelection} + * Defines a quiver selection algorithm, to be added with + * {@link QuiverArrowRegistry#addQuiverSelection} + * * @param bow * @param player - * @return a stack holding a {@link IArrowContainer2} item or null if none is found + * @return a stack holding a {@link IArrowContainer2} item or null if none is + * found */ public ItemStack getQuiverFor(ItemStack bow, EntityPlayer player); } diff --git a/src/main/java/mods/battlegear2/api/quiver/QuiverArrowRegistry.java b/src/main/java/mods/battlegear2/api/quiver/QuiverArrowRegistry.java index ad8d6d39..6a87c9ee 100644 --- a/src/main/java/mods/battlegear2/api/quiver/QuiverArrowRegistry.java +++ b/src/main/java/mods/battlegear2/api/quiver/QuiverArrowRegistry.java @@ -1,12 +1,5 @@ package mods.battlegear2.api.quiver; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; @@ -15,23 +8,28 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import java.util.*; + public class QuiverArrowRegistry { - private static Map> itemToClasses = new TreeMap>(new StackComparator()); + private static Map> itemToClasses = new TreeMap>( + new StackComparator()); private static Map, ItemStack> classToItems = new HashMap, ItemStack>(); private static List quiverSelectors = new ArrayList(); private static List fireHandlers = new ArrayList(); - static{ + + static { fireHandlers.add(new DefaultArrowFire()); } /** * Adds an item to the known arrow lists - * @param itemId the item id + * + * @param itemId the item id * @param itemMetadata the item damage value, as metadata - * @param entityArrow the class from which the arrow entity will be constructed + * @param entityArrow the class from which the arrow entity will be constructed */ - public static void addArrowToRegistry(Item itemId, int itemMetadata, Class entityArrow){ + public static void addArrowToRegistry(Item itemId, int itemMetadata, Class entityArrow) { ItemStack stack = new ItemStack(itemId, 1, itemMetadata); addArrowToRegistry(stack, entityArrow); } @@ -40,10 +38,11 @@ public static void addArrowToRegistry(Item itemId, int itemMetadata, Class entityArrow){ + public static void addArrowToRegistry(ItemStack stack, Class entityArrow) { ItemStack st = stack.copy(); st.stackSize = 1; itemToClasses.put(st, entityArrow); @@ -51,40 +50,44 @@ public static void addArrowToRegistry(ItemStack stack, Class getArrowClass(ItemStack stack){ + public static Class getArrowClass(ItemStack stack) { return itemToClasses.get(stack); } @@ -124,51 +128,51 @@ public static Class getArrowClass(ItemStack stack){ * @param clazz * @return the ItemStack attached to the given EntityArrow class */ - public static ItemStack getItem(Class clazz){ - ItemStack temp = classToItems.get(clazz); - if(temp == null){ - return new ItemStack(Items.arrow); - }else{ - return temp.copy(); - } + public static ItemStack getItem(Class clazz) { + ItemStack temp = classToItems.get(clazz); + if (temp == null) { + return new ItemStack(Items.arrow); + } else { + return temp.copy(); + } } /** - * * @param test the ItemStack to check * @return true if that ItemStack is attached to an EntityArrow class */ - public static boolean isKnownArrow(ItemStack test){ - return itemToClasses.containsKey(test); + public static boolean isKnownArrow(ItemStack test) { + return itemToClasses.containsKey(test); } /** - * Tool class to compare ItemStack, since this class is final but doesn't implement the necessary method + * Tool class to compare ItemStack, since this class is final but doesn't + * implement the necessary method */ static class StackComparator implements Comparator { @Override public int compare(ItemStack stack, ItemStack stack2) { - if(stack == stack2){ + if (stack == stack2) { return 0; - }else{ + } else { int idDiff = stack.getItemDamage() - stack2.getItemDamage(); - if(idDiff != 0){ + if (idDiff != 0) { return idDiff; - }else{ - idDiff = Item.getIdFromItem(stack.getItem())-Item.getIdFromItem(stack2.getItem()); - if(idDiff != 0){ + } else { + idDiff = Item.getIdFromItem(stack.getItem()) - Item.getIdFromItem(stack2.getItem()); + if (idDiff != 0) { return idDiff; - }else{ - int tag = 0; - if(stack.hasTagCompound()){ - tag = stack.getTagCompound().hashCode(); - } - int tag2 = 0; - if(stack2.hasTagCompound()){ - tag2 = stack2.getTagCompound().hashCode(); - } - return tag-tag2; + } else { + int tag = 0; + if (stack.hasTagCompound()) { + tag = stack.getTagCompound().hashCode(); + } + int tag2 = 0; + if (stack2.hasTagCompound()) { + tag2 = stack2.getTagCompound().hashCode(); + } + return tag - tag2; } } } @@ -176,11 +180,11 @@ public int compare(ItemStack stack, ItemStack stack2) { } /** - * Default implementation of a arrow firing handler, which uses this registry of arrows to build an EntityArrow - * with a constructor - * If the arrow is unknown, or the constructor isn't valid, defers to other firing handlers silently + * Default implementation of a arrow firing handler, which uses this registry of + * arrows to build an EntityArrow with a constructor If the arrow is unknown, or + * the constructor isn't valid, defers to other firing handlers silently */ - static class DefaultArrowFire implements IArrowFireHandler{ + static class DefaultArrowFire implements IArrowFireHandler { @Override public boolean canFireArrow(ItemStack arrow, World world, EntityPlayer player, float charge) { @@ -190,9 +194,9 @@ public boolean canFireArrow(ItemStack arrow, World world, EntityPlayer player, f @Override public EntityArrow getFiredArrow(ItemStack arrow, World world, EntityPlayer player, float charge) { Class clazz = getArrowClass(arrow); - if(clazz != null){ + if (clazz != null) { try { - return (EntityArrow)clazz.getConstructor(World.class, EntityLivingBase.class, Float.TYPE) + return (EntityArrow) clazz.getConstructor(World.class, EntityLivingBase.class, Float.TYPE) .newInstance(player.worldObj, player, charge); } catch (Exception ignored) { } diff --git a/src/main/java/mods/battlegear2/api/quiver/package-info.java b/src/main/java/mods/battlegear2/api/quiver/package-info.java index dad64d91..ef2bbb57 100644 --- a/src/main/java/mods/battlegear2/api/quiver/package-info.java +++ b/src/main/java/mods/battlegear2/api/quiver/package-info.java @@ -2,4 +2,3 @@ package mods.battlegear2.api.quiver; import cpw.mods.fml.common.API; - diff --git a/src/main/java/mods/battlegear2/api/shield/IArrowCatcher.java b/src/main/java/mods/battlegear2/api/shield/IArrowCatcher.java index f668c8e1..26933adb 100644 --- a/src/main/java/mods/battlegear2/api/shield/IArrowCatcher.java +++ b/src/main/java/mods/battlegear2/api/shield/IArrowCatcher.java @@ -3,19 +3,18 @@ import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; + /** - * Defines an item that can catch IProjectile - * Used by ItemShield to block arrows - * @author GotoLink + * Defines an item that can catch IProjectile Used by ItemShield to block arrows * + * @author GotoLink */ public interface IArrowCatcher { /** - * - * @param shield the {@link ItemStack} corresponding to the shield in use - * @param player the {@link EntityPlayer} holding the shield + * @param shield the {@link ItemStack} corresponding to the shield in use + * @param player the {@link EntityPlayer} holding the shield * @param projectile heading towards the shield * @return true if the projectile has been caught */ - public boolean catchArrow(ItemStack shield, EntityPlayer player, IProjectile projectile); + public boolean catchArrow(ItemStack shield, EntityPlayer player, IProjectile projectile); } diff --git a/src/main/java/mods/battlegear2/api/shield/IArrowDisplay.java b/src/main/java/mods/battlegear2/api/shield/IArrowDisplay.java index a92d195b..685e5189 100644 --- a/src/main/java/mods/battlegear2/api/shield/IArrowDisplay.java +++ b/src/main/java/mods/battlegear2/api/shield/IArrowDisplay.java @@ -3,12 +3,13 @@ import net.minecraft.item.ItemStack; /** - * Defines an item that can hold arrows as an internal variable - * Used by ItemShield to display blocked arrows - * @author GotoLink + * Defines an item that can hold arrows as an internal variable Used by + * ItemShield to display blocked arrows * + * @author GotoLink */ public interface IArrowDisplay { public void setArrowCount(ItemStack stack, int count); + public int getArrowCount(ItemStack stack); } diff --git a/src/main/java/mods/battlegear2/api/shield/IShield.java b/src/main/java/mods/battlegear2/api/shield/IShield.java index 1451f3a2..d4da2705 100644 --- a/src/main/java/mods/battlegear2/api/shield/IShield.java +++ b/src/main/java/mods/battlegear2/api/shield/IShield.java @@ -7,18 +7,18 @@ public interface IShield { /** - * Gets the decay rate for the stamina bar when the shield is in use. - * The value should be between 0 and 1. The duration of maximum blocking can be calculated + * Gets the decay rate for the stamina bar when the shield is in use. The value + * should be between 0 and 1. The duration of maximum blocking can be calculated * by 1/decayRate/20. * * @param shield The {@link ItemStack} representing the shield * @return a value between 0 & 1 representing the decay rate per tick */ public float getDecayRate(ItemStack shield); - + /** - * Gets the recovery rate for the stamina bar when the shield is not in use. - * The value should be between 0 and 1. + * Gets the recovery rate for the stamina bar when the shield is not in use. The + * value should be between 0 and 1. * * @param shield The {@link ItemStack} representing the shield * @return a value between 0 & 1 representing the recovery rate per tick @@ -26,7 +26,8 @@ public interface IShield { public float getRecoveryRate(ItemStack shield); /** - * Returns true if the current shield can and should block the given damage source + * Returns true if the current shield can and should block the given damage + * source * * @param shield The {@link ItemStack} representing the shield * @param source The {@link DamageSource} representing the current damage @@ -44,36 +45,44 @@ public interface IShield { public float getDamageDecayRate(ItemStack shield, float amount); /** - * Returns the block angle in degrees that the shield can block. - * This angle is taken as 0 degrees being directly in front of the player. The shield - * will block between -blockAngle to blockangle + * Returns the block angle in degrees that the shield can block. This angle is + * taken as 0 degrees being directly in front of the player. The shield will + * block between -blockAngle to blockangle + * * @param shield The {@link ItemStack} representing the shield * @return The maximum angle the shield should be able to block at */ public float getBlockAngle(ItemStack shield); /** - * Returns the time a shield bash should take to be performed. A shield bash will disallow actions - * for the number of ticks given and will knockback an opponent at time/2 + * Returns the time a shield bash should take to be performed. A shield bash + * will disallow actions for the number of ticks given and will knockback an + * opponent at time/2 * * @return The amount of ticks the shield bash animation will play */ public int getBashTimer(ItemStack shield); /** - * Called after a successful block, if {@link PlayerEventShield.ShieldBlockEvent] allowed additional blocking animation - * A common additional animation might include a sound, particle effects, etc. + * Called after a successful block, if + * {@link PlayerEventShield.ShieldBlockEvent] allowed additional blocking + * animation A common additional animation might include a sound, particle + * effects, etc. + * * @param player * @param amount */ public void blockAnimation(EntityPlayer player, float amount); /** - * Called after a successful block, if {@link PlayerEventShield.ShieldBlockEvent] allowed damage to be done - * and the player isn't in creative mode + * Called after a successful block, if + * {@link PlayerEventShield.ShieldBlockEvent] allowed damage to be done and the + * player isn't in creative mode + * * @param shield The {@link ItemStack} representing the shield * @param source The {@link DamageSource} representing the current damage - * @return The amount of damage from the source that won't be dealt to the shield + * @return The amount of damage from the source that won't be dealt to the + * shield */ public float getDamageReduction(ItemStack shield, DamageSource source); } diff --git a/src/main/java/mods/battlegear2/api/shield/ShieldType.java b/src/main/java/mods/battlegear2/api/shield/ShieldType.java index 8e723b0a..a53a3202 100644 --- a/src/main/java/mods/battlegear2/api/shield/ShieldType.java +++ b/src/main/java/mods/battlegear2/api/shield/ShieldType.java @@ -2,11 +2,21 @@ public class ShieldType { - public static final ShieldType WOOD = new ShieldType("wood", 1F/1F/20F, 1F/20F, 40, 15, 0xFFbc9862); // 1 second block - public static final ShieldType HIDE = new ShieldType("hide", 1F/1.5F/20F, 1F/20F, 40, 12, 0xFF9b482b); //1.5 second block - public static final ShieldType IRON = new ShieldType("iron", 1F/3F/20F, 1F/20F, 120, 9, 0xFFacacac); //3 second block - public static final ShieldType DIAMOND = new ShieldType("diamond", 1F/5F/20F, 1F/20F, 263, 10, 0xFF23bfbf); //5 second block - public static final ShieldType GOLD = new ShieldType("gold", 1F/2F/20F, 1F/20F, 56, 25, 0xFFa8a400); //2 second block + public static final ShieldType WOOD = new ShieldType("wood", 1F / 1F / 20F, 1F / 20F, 40, 15, 0xFFbc9862); // 1 + // second + // block + public static final ShieldType HIDE = new ShieldType("hide", 1F / 1.5F / 20F, 1F / 20F, 40, 12, 0xFF9b482b); // 1.5 + // second + // block + public static final ShieldType IRON = new ShieldType("iron", 1F / 3F / 20F, 1F / 20F, 120, 9, 0xFFacacac); // 3 + // second + // block + public static final ShieldType DIAMOND = new ShieldType("diamond", 1F / 5F / 20F, 1F / 20F, 263, 10, 0xFF23bfbf); // 5 + // second + // block + public static final ShieldType GOLD = new ShieldType("gold", 1F / 2F / 20F, 1F / 20F, 56, 25, 0xFFa8a400); // 2 + // second + // block private final float decayRate; private final float damageDecay; @@ -15,7 +25,8 @@ public class ShieldType { private final int maxDamage; private final int defaultRGB; - public ShieldType(String name, float decayRate, float damageDecay, int maxDamage, int enchantability, int defaultColour){ + public ShieldType(String name, float decayRate, float damageDecay, int maxDamage, int enchantability, + int defaultColour) { this.name = name; this.decayRate = decayRate; this.damageDecay = damageDecay; diff --git a/src/main/java/mods/battlegear2/api/shield/package-info.java b/src/main/java/mods/battlegear2/api/shield/package-info.java index bb146ecf..b51c8c29 100644 --- a/src/main/java/mods/battlegear2/api/shield/package-info.java +++ b/src/main/java/mods/battlegear2/api/shield/package-info.java @@ -2,4 +2,3 @@ package mods.battlegear2.api.shield; import cpw.mods.fml.common.API; - diff --git a/src/main/java/mods/battlegear2/api/weapons/IBackStabbable.java b/src/main/java/mods/battlegear2/api/weapons/IBackStabbable.java index 36025eca..a45456f8 100644 --- a/src/main/java/mods/battlegear2/api/weapons/IBackStabbable.java +++ b/src/main/java/mods/battlegear2/api/weapons/IBackStabbable.java @@ -4,11 +4,12 @@ public interface IBackStabbable { - /** - * Action to perform on back stabbing - * @param entityHit - * @param entityHitting + /** + * Action to perform on back stabbing + * + * @param entityHit + * @param entityHitting * @return true if it adds an hitting action - */ - public boolean onBackStab(EntityLivingBase entityHit, EntityLivingBase entityHitting); + */ + public boolean onBackStab(EntityLivingBase entityHit, EntityLivingBase entityHitting); } diff --git a/src/main/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java b/src/main/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java index 7fca81e5..e1adf622 100644 --- a/src/main/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java +++ b/src/main/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java @@ -4,6 +4,6 @@ import mods.battlegear2.api.IOffhandDual; import mods.battlegear2.api.ISheathed; -public interface IBattlegearWeapon extends ISheathed,IOffhandDual,IAllowItem{ +public interface IBattlegearWeapon extends ISheathed, IOffhandDual, IAllowItem { } \ No newline at end of file diff --git a/src/main/java/mods/battlegear2/api/weapons/IExtendedReachWeapon.java b/src/main/java/mods/battlegear2/api/weapons/IExtendedReachWeapon.java index fce70604..5e28b734 100644 --- a/src/main/java/mods/battlegear2/api/weapons/IExtendedReachWeapon.java +++ b/src/main/java/mods/battlegear2/api/weapons/IExtendedReachWeapon.java @@ -3,10 +3,12 @@ import net.minecraft.item.ItemStack; public interface IExtendedReachWeapon { - /** - * The distance the weapon will hit (note this will ONLY work for main hand weapons) - * @param stack - * @return - */ - public float getReachModifierInBlocks(ItemStack stack); + /** + * The distance the weapon will hit (note this will ONLY work for main hand + * weapons) + * + * @param stack + * @return + */ + public float getReachModifierInBlocks(ItemStack stack); } diff --git a/src/main/java/mods/battlegear2/api/weapons/IHitTimeModifier.java b/src/main/java/mods/battlegear2/api/weapons/IHitTimeModifier.java index c9014e23..a457fdf0 100644 --- a/src/main/java/mods/battlegear2/api/weapons/IHitTimeModifier.java +++ b/src/main/java/mods/battlegear2/api/weapons/IHitTimeModifier.java @@ -4,11 +4,10 @@ import net.minecraft.item.ItemStack; public interface IHitTimeModifier { - /** - * - * @param entityHit - * @return The amount to modify the hit shield - */ - public int getHitTime(ItemStack stack, EntityLivingBase entityHit); + /** + * @param entityHit + * @return The amount to modify the hit shield + */ + public int getHitTime(ItemStack stack, EntityLivingBase entityHit); } diff --git a/src/main/java/mods/battlegear2/api/weapons/IPenetrateWeapon.java b/src/main/java/mods/battlegear2/api/weapons/IPenetrateWeapon.java index 9d5c804d..ab27caab 100644 --- a/src/main/java/mods/battlegear2/api/weapons/IPenetrateWeapon.java +++ b/src/main/java/mods/battlegear2/api/weapons/IPenetrateWeapon.java @@ -3,10 +3,12 @@ import net.minecraft.item.ItemStack; public interface IPenetrateWeapon { - /** - * The amount of damage bypassing armor - * @param stack The {@link net.minecraft.item.ItemStack} representative of the item dealing the hit. - * @return the amount of damage that bypasses armour - */ - public float getPenetratingPower(ItemStack stack); + /** + * The amount of damage bypassing armor + * + * @param stack The {@link net.minecraft.item.ItemStack} representative of the + * item dealing the hit. + * @return the amount of damage that bypasses armour + */ + public float getPenetratingPower(ItemStack stack); } diff --git a/src/main/java/mods/battlegear2/api/weapons/IPotionEffect.java b/src/main/java/mods/battlegear2/api/weapons/IPotionEffect.java index 4c7eb775..8a9a1786 100644 --- a/src/main/java/mods/battlegear2/api/weapons/IPotionEffect.java +++ b/src/main/java/mods/battlegear2/api/weapons/IPotionEffect.java @@ -1,22 +1,23 @@ package mods.battlegear2.api.weapons; -import java.util.Map; - import net.minecraft.entity.EntityLivingBase; import net.minecraft.potion.PotionEffect; -public interface IPotionEffect { +import java.util.Map; +public interface IPotionEffect { /** - * Returns a map containing the potion effects to apply to an entity hit by the weapon. Each effect - * has a float value associated with the chance of applying the effect. Note that the "dice roll" only - * occurs once so any value under this roll will be applied. + * Returns a map containing the potion effects to apply to an entity hit by the + * weapon. Each effect has a float value associated with the chance of applying + * the effect. Note that the "dice roll" only occurs once so any value under + * this roll will be applied. * - * @param entityHit The entity the effect will be applied to. + * @param entityHit The entity the effect will be applied to. * @param entityHitting - * @return A Map of {@link PotionEffect} with chance value ranging from 0 to 1, to be dealt to the entityHit + * @return A Map of {@link PotionEffect} with chance value ranging from 0 to 1, + * to be dealt to the entityHit */ - public Map getEffectsOnHit(EntityLivingBase entityHit, EntityLivingBase entityHitting); + public Map getEffectsOnHit(EntityLivingBase entityHit, EntityLivingBase entityHitting); } diff --git a/src/main/java/mods/battlegear2/api/weapons/ISpecialEffect.java b/src/main/java/mods/battlegear2/api/weapons/ISpecialEffect.java index e32995ce..17d7081f 100644 --- a/src/main/java/mods/battlegear2/api/weapons/ISpecialEffect.java +++ b/src/main/java/mods/battlegear2/api/weapons/ISpecialEffect.java @@ -3,11 +3,10 @@ import net.minecraft.entity.EntityLivingBase; public interface ISpecialEffect { - /** - * - * @param entityHit The entity the effect will be applied to. - * @param entityHitting - * @return true if it adds an hitting action - */ + /** + * @param entityHit The entity the effect will be applied to. + * @param entityHitting + * @return true if it adds an hitting action + */ public boolean performEffects(EntityLivingBase entityHit, EntityLivingBase entityHitting); } diff --git a/src/main/java/mods/battlegear2/api/weapons/WeaponRegistry.java b/src/main/java/mods/battlegear2/api/weapons/WeaponRegistry.java index f15eeaf4..734b967d 100644 --- a/src/main/java/mods/battlegear2/api/weapons/WeaponRegistry.java +++ b/src/main/java/mods/battlegear2/api/weapons/WeaponRegistry.java @@ -1,99 +1,104 @@ package mods.battlegear2.api.weapons; -import java.util.HashSet; -import java.util.Set; - +import cpw.mods.fml.common.event.FMLInterModComms; +import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; - import org.apache.commons.lang3.builder.HashCodeBuilder; -import cpw.mods.fml.common.event.FMLInterModComms; -import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; +import java.util.HashSet; +import java.util.Set; /** - * Registry for stacks which will be allowed in battle inventory, - * accessible through {@link FMLInterModComms} messages. - * Use only if your item is not recognized by default. - * Use of {@link IBattlegearWeapon} is preferred over this method. - * {@link NBTTagCompound} are supported. - * @author GotoLink + * Registry for stacks which will be allowed in battle inventory, accessible + * through {@link FMLInterModComms} messages. Use only if your item is not + * recognized by default. Use of {@link IBattlegearWeapon} is preferred over + * this method. {@link NBTTagCompound} are supported. * + * @author GotoLink */ public class WeaponRegistry { - private static Set weapons = new HashSet(); - private static Set mainHand = new HashSet(); - private static Set offHand = new HashSet(); - /** - * Called by a {@link IMCMessage} with "Dual" as key, and the {@link ItemStack} as value - * @param stack registered as dual wieldable - */ - public static void addDualWeapon(ItemStack stack) { + private static Set weapons = new HashSet(); + private static Set mainHand = new HashSet(); + private static Set offHand = new HashSet(); + + /** + * Called by a {@link IMCMessage} with "Dual" as key, and the {@link ItemStack} + * as value + * + * @param stack registered as dual wieldable + */ + public static void addDualWeapon(ItemStack stack) { weapons.add(new StackHolder(stack)); mainHand.add(new StackHolder(stack)); offHand.add(new StackHolder(stack)); - } - - /** - * Called by a {@link IMCMessage} with "MainHand" as key, and the {@link ItemStack} as value - * @param stack registered as wieldable only in main hand - */ - public static void addTwoHanded(ItemStack stack) { + } + + /** + * Called by a {@link IMCMessage} with "MainHand" as key, and the + * {@link ItemStack} as value + * + * @param stack registered as wieldable only in main hand + */ + public static void addTwoHanded(ItemStack stack) { weapons.add(new StackHolder(stack)); mainHand.add(new StackHolder(stack)); - } + } - /** - * Called by a {@link IMCMessage} with "OffHand" as key, and the {@link ItemStack} as value - * @param stack registered as wieldable only in offhand - */ - public static void addOffhandWeapon(ItemStack stack) { + /** + * Called by a {@link IMCMessage} with "OffHand" as key, and the + * {@link ItemStack} as value + * + * @param stack registered as wieldable only in offhand + */ + public static void addOffhandWeapon(ItemStack stack) { weapons.add(new StackHolder(stack)); offHand.add(new StackHolder(stack)); - } - - public static boolean isWeapon(ItemStack stack) { - return weapons.contains(new StackHolder(stack)); - } - - public static boolean isMainHand(ItemStack stack) { - return mainHand.contains(new StackHolder(stack)); - } - - public static boolean isOffHand(ItemStack stack) { - return offHand.contains(new StackHolder(stack)); - } - - static class StackHolder{ - private final ItemStack stack; + } + + public static boolean isWeapon(ItemStack stack) { + return weapons.contains(new StackHolder(stack)); + } + + public static boolean isMainHand(ItemStack stack) { + return mainHand.contains(new StackHolder(stack)); + } + + public static boolean isOffHand(ItemStack stack) { + return offHand.contains(new StackHolder(stack)); + } + + static class StackHolder { + private final ItemStack stack; private int hash; - public StackHolder(ItemStack stack){ - this.stack = stack; - } - - @Override - public int hashCode() { + public StackHolder(ItemStack stack) { + this.stack = stack; + } + + @Override + public int hashCode() { int init = 17, mult = 37; - if(hash==0) { - if(stack==null) + if (hash == 0) { + if (stack == null) hash = new HashCodeBuilder(init, mult).toHashCode(); else - hash = new HashCodeBuilder(init, mult).append(Item.getIdFromItem(stack.getItem())).append(stack.getItemDamage()).append(stack.getTagCompound()).toHashCode(); + hash = new HashCodeBuilder(init, mult).append(Item.getIdFromItem(stack.getItem())) + .append(stack.getItemDamage()).append(stack.getTagCompound()).toHashCode(); } return hash; - } + } - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - return obj instanceof StackHolder && ItemStack.areItemStacksEqual(stack, ((StackHolder) obj).stack); - } - } + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + return obj instanceof StackHolder && ItemStack.areItemStacksEqual(stack, ((StackHolder) obj).stack); + } + } } diff --git a/src/main/java/mods/battlegear2/api/weapons/package-info.java b/src/main/java/mods/battlegear2/api/weapons/package-info.java index 152cc472..9e7f1011 100644 --- a/src/main/java/mods/battlegear2/api/weapons/package-info.java +++ b/src/main/java/mods/battlegear2/api/weapons/package-info.java @@ -2,4 +2,3 @@ package mods.battlegear2.api.weapons; import cpw.mods.fml.common.API; - diff --git a/src/main/java/mods/mud/ModUpdateDetector.java b/src/main/java/mods/mud/ModUpdateDetector.java deleted file mode 100644 index 8ac538bc..00000000 --- a/src/main/java/mods/mud/ModUpdateDetector.java +++ /dev/null @@ -1,171 +0,0 @@ -package mods.mud; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.client.Minecraft; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; - -/** - * MUD is a client side only utility for mods to send automated report for updates and changelog - */ -public class ModUpdateDetector { - public static Logger logger = LogManager.getLogger("M.U.D"); - private static boolean hasInitialised = false; - private static Map updateMap; - public static boolean hasChecked = false; - private static Configuration config; - private static Property check; - public static boolean enabled = true; - private static ICommandSender sender = null; - - /** - * The main registration method for a mod - * @param mc The FML wrapper for a mod, you can get it with {@link FMLCommonHandler#findContainerFor(Object)} - * @param updateXML An expected url for an xml file, listing mod versions and download links by Minecraft releases - * @param changelog An expected url for a file containing text to describe any changes, can be null - */ - public static void registerMod(ModContainer mc, URL updateXML, URL changelog){ - if(!hasInitialised){ - initialise(); - hasInitialised = true; - } - updateMap.put(mc.getModId(), new UpdateEntry(mc, updateXML, changelog)); - } - - /** - * Helper registration method for a mod - * @param mc The FML wrapper for a mod, you can get it with {@link FMLCommonHandler#findContainerFor(Object)} - * @param updateXML String that can be converted as an url for an xml file, listing mod versions and download links by Minecraft releases - * @param changelog String that can be converted as an url for a file containing text to describe any changes, can be null - * @throws MalformedURLException If no known protocol is found, or updateXML is null. - */ - public static void registerMod(ModContainer mc, String updateXML, String changelog) throws MalformedURLException { - registerMod(mc, new URL(updateXML), changelog!=null?new URL(changelog):null); - } - - /** - * Helper registration method for a mod - * @param mod A modid or mod instance - * @param updateXML String that can be converted as an url for an xml file, listing mod versions and download links by Minecraft releases - * @param changelog String that can be converted as an url for a file containing text to describe any changes, can be null - * @throws MalformedURLException If no known protocol is found, or updateXML is null. - */ - public static void registerMod(Object mod, String updateXML, String changelog) throws MalformedURLException { - registerMod(FMLCommonHandler.instance().findContainerFor(mod), updateXML, changelog); - } - - public static void runUpdateChecker(){ - - if(enabled){ - ICommandSender sender = getSender(); - sender.addChatMessage(new ChatComponentText( - EnumChatFormatting.YELLOW + StatCollector.translateToLocal("mud.name") + - EnumChatFormatting.WHITE + ": "+StatCollector.translateToLocal("message.checking") - )); - - Thread t = new Thread(new UpdateChecker(updateMap.values())); - t.run(); - } - - } - - public static Collection getAllUpdateEntries(){ - return updateMap.values(); - } - - private static void initialise() { - updateMap = new HashMap(); - /* - * The time between update checks in minutes. - * A value <=0 will only run the updater when a player joins the world. - */ - int Timer = 60*60*20; - try{ - config = new Configuration(new File(Loader.instance().getConfigDir(), "MUD.cfg")); - Timer = config.get(Configuration.CATEGORY_GENERAL, "Update Time", 60, "The time in minutes between update checks").getInt() * 60 * 20; - check = config.get(Configuration.CATEGORY_GENERAL, "Update Check Enabled", true, "Should MUD automatically check for updates"); - enabled = check.getBoolean(true); - if(config.hasChanged()){ - config.save(); - } - }catch(Exception handled){ - handled.printStackTrace(); - } - - FMLCommonHandler.instance().bus().register(new ModUpdateDetectorTickHandeler(Timer)); - ClientCommandHandler.instance.registerCommand(new MudCommands()); - } - - public static void toggleState(){ - enabled = !enabled; - check.set(enabled); - config.save(); - } - - public static ICommandSender getSender() { - if(sender == null){ - sender = Minecraft.getMinecraft().thePlayer; - } - return sender; - } - - - public static void notifyUpdateDone(){ - ICommandSender sender = getSender(); - if(sender != null){ - sender.addChatMessage(new ChatComponentText( - EnumChatFormatting.YELLOW + StatCollector.translateToLocal("mud.name") + - EnumChatFormatting.WHITE + ": "+StatCollector.translateToLocal("message.check.done") - )); - } - - int outOfDateCount = 0; - int failedCount = 0; - for(UpdateEntry e : updateMap.values()){ - try { - if(!e.isUpToDate()){ - outOfDateCount ++; - } - } catch (Exception e1) { - failedCount++; - } - } - ChatComponentTranslation chat; - if(outOfDateCount > 0){ - if(sender != null){ - chat = new ChatComponentTranslation("message.you.have.outdated", outOfDateCount); - chat.getChatStyle().setColor(EnumChatFormatting.RED); - sender.addChatMessage(chat); - chat = new ChatComponentTranslation("message.type.to.view"); - chat.getChatStyle().setColor(EnumChatFormatting.RED); - sender.addChatMessage(chat); - } - }else{ - if(sender != null){ - chat = new ChatComponentTranslation("message.up.to.date"); - chat.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); - sender.addChatMessage(chat); - } - } - hasChecked = true; - } -} diff --git a/src/main/java/mods/mud/ModUpdateDetectorTickHandeler.java b/src/main/java/mods/mud/ModUpdateDetectorTickHandeler.java deleted file mode 100644 index c4380727..00000000 --- a/src/main/java/mods/mud/ModUpdateDetectorTickHandeler.java +++ /dev/null @@ -1,84 +0,0 @@ -package mods.mud; - -import java.util.List; - -import mods.mud.gui.GuiModUpdateButton; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiIngameMenu; -import net.minecraft.client.gui.GuiScreen; -import cpw.mods.fml.client.GuiModList; -import cpw.mods.fml.common.ObfuscationReflectionHelper; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; - -/** - * Created with IntelliJ IDEA. - * User: Aaron - * Date: 24/08/13 - * Time: 4:20 PM - * To change this template use File | Settings | File Templates. - */ -public class ModUpdateDetectorTickHandeler { - - private final int timer_interval; - private int timer; - private GuiScreen lastScreen; - - public ModUpdateDetectorTickHandeler(int timer) { - this.timer_interval = timer; - } - - @SubscribeEvent - public void onPlayerTick(TickEvent.PlayerTickEvent event){ - if(event.phase == TickEvent.Phase.START){ - if(timer == 0){ - ModUpdateDetector.runUpdateChecker(); - } - - if(timer_interval > 0){ - timer = (timer+1) % timer_interval; - }else{ - timer = -1; - } - } - } - - @SubscribeEvent - public void onRenderTick(TickEvent.RenderTickEvent event) { - if(event.phase == TickEvent.Phase.START){ - if(Minecraft.getMinecraft().currentScreen != null && - //Minecraft.getMinecraft().currentScreen != lastScreen && - Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu || - Minecraft.getMinecraft().currentScreen instanceof GuiModList){ - lastScreen = Minecraft.getMinecraft().currentScreen; - List buttonList = getButtonList(lastScreen); - if(buttonList!=null){ - boolean hasMumButton = false; - for(Object o : buttonList){ - if(o instanceof GuiModUpdateButton){ - hasMumButton = true; - break; - } - } - if(!hasMumButton){ - int x = lastScreen.width / 2 + 105; - int y = lastScreen.height / 4 + 8; - if(lastScreen instanceof GuiModList){ - x = lastScreen.width - 110; - y = 10; - } - buttonList.add(new GuiModUpdateButton(99, x, y, lastScreen)); - } - } - } - } - } - - private List getButtonList(GuiScreen currentScreen) { - try{ - return ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, currentScreen, "buttonList", "field_146292_n"); - }catch (Exception e){ - return null; - } - } -} diff --git a/src/main/java/mods/mud/MudCommands.java b/src/main/java/mods/mud/MudCommands.java deleted file mode 100644 index e1c5b556..00000000 --- a/src/main/java/mods/mud/MudCommands.java +++ /dev/null @@ -1,42 +0,0 @@ -package mods.mud; - -import java.util.List; - -import mods.mud.gui.GuiChangelogDownload; -import net.minecraft.client.Minecraft; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; - -public class MudCommands extends CommandBase{ - - @Override - public String getCommandName() { - return "mud"; - } - - @Override - public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) { - return getListOfStringsMatchingLastWord(par2ArrayOfStr, getCommandName()); - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender){ - return true; - } - - @Override - public String getCommandUsage(ICommandSender icommandsender) { - return null; - } - - @Override - public void processCommand(ICommandSender icommandsender, String[] astring) { - Minecraft.getMinecraft().displayGuiScreen(new GuiChangelogDownload(Minecraft.getMinecraft().currentScreen)); - } - - @Override - public int compareTo(Object o) { - return this.compareTo((ICommand)o); - } -} diff --git a/src/main/java/mods/mud/Release.java b/src/main/java/mods/mud/Release.java deleted file mode 100644 index e17e8455..00000000 --- a/src/main/java/mods/mud/Release.java +++ /dev/null @@ -1,69 +0,0 @@ -package mods.mud; - -import java.util.Arrays; - -public class Release implements Comparable{ - public int[] version; - public EnumReleaseType type; - public String url; - public String download; - public String md5; - - public Release(EnumReleaseType type, String url, int[] version, String download) { - this(type, url, version, download, null); - } - - public Release(EnumReleaseType type, String url, int[] version, String download, String md5) { - this.type = type; - this.url = url; - this.version = version; - this.download = download; - this.md5 = md5; - } - - @Override - public int compareTo(Release other) { - - for(int i = 0; i < version.length && i < other.version.length; i++){ - if(version[i] > other.version[i]){ - return 1; - }else if (version[i] < other.version[i]){ - return -1; - } - } - - return version.length - other.version.length; - } - - public String getVersionString(){ - StringBuffer newVersionString = new StringBuffer(); - for(int i = 0; i < version.length; i++){ - newVersionString.append(version[i]); - newVersionString.append("."); - } - newVersionString.deleteCharAt(newVersionString.lastIndexOf(".")); - return newVersionString.toString(); - } - - @Override - public String toString() { - return "Release{" + - "type=" + type + - ", version=" + Arrays.toString(version) + - ", url='" + url + '\'' + - '}'; - } - - - public static enum EnumReleaseType{ - Normal(1), - Beta(2), - Dev(3); - - public int level; - - private EnumReleaseType(int level){ - this.level = level; - } - } -} diff --git a/src/main/java/mods/mud/UpdateChecker.java b/src/main/java/mods/mud/UpdateChecker.java deleted file mode 100644 index 1f845a3d..00000000 --- a/src/main/java/mods/mud/UpdateChecker.java +++ /dev/null @@ -1,145 +0,0 @@ -package mods.mud; - -import java.net.URL; -import java.util.Collection; -import java.util.TreeSet; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import cpw.mods.fml.common.Loader; - -public class UpdateChecker implements Runnable{ - private Collection updateEntries; - - public UpdateChecker(Collection entries){ - updateEntries = entries; - } - - - @Override - public void run() { - //Map latestReleases = new HashMap(); - - for(UpdateEntry entry:updateEntries){ - Release latest = getUpToDateRelease( - entry.getMc().getModId(), - Loader.instance().getMCVersionString().replaceAll("Minecraft ", ""), - Release.EnumReleaseType.Normal, - entry.getUpdateXML() - ); - - entry.setLatest(latest); - } - - ModUpdateDetector.notifyUpdateDone(); - - } - - public Release getUpToDateRelease(String modId, String targetMcVersion, Release.EnumReleaseType versionLevel, URL updateURL){ - try{ - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document doc = db.parse(updateURL.openStream()); - - NodeList mods = doc.getElementsByTagName("mod"); - - TreeSet releases = new TreeSet(); - - for(int i = 0; i < mods.getLength(); i++){ - Node mod = mods.item(i); - if(mod.hasAttributes() && - mod.getAttributes().getNamedItem("modid") != null && - mod.getAttributes().getNamedItem("modid").getNodeValue().equals(modId)){ - - NodeList mcVersions = mod.getChildNodes(); - for(int j = 0; j < mcVersions.getLength(); j++){ - Node mcVersion = mcVersions.item(j); - - if(mcVersion.hasAttributes() && - mcVersion.getAttributes().getNamedItem("version") != null && - mcVersion.getAttributes().getNamedItem("version").getNodeValue().equals(targetMcVersion)){ - - NodeList releasNodes = mcVersion.getChildNodes(); - for(int k = 0; k < releasNodes.getLength(); k++){ - Release release = parseNode(releasNodes.item(k), versionLevel); - if(release != null){ - releases.add(release); - } - } - - } - - } - - } - } - - if(!releases.isEmpty()){ - return releases.last(); - } - - }catch (Exception e){ - e.printStackTrace(); - } - - return null; - - } - - - - private Release parseNode(Node item, Release.EnumReleaseType versionLevel) { - if(item.hasAttributes()){ - - Node versionNode = item.getAttributes().getNamedItem("version"); - Node typeNode = item.getAttributes().getNamedItem("type"); - String url = null; - String download = null; - String md5 = null; - if(item.getAttributes().getNamedItem("url") != null){ - url = item.getAttributes().getNamedItem("url").getNodeValue(); - } - if(item.getAttributes().getNamedItem("md5") != null){ - md5 = item.getAttributes().getNamedItem("md5").getNodeValue(); - } - if(item.getAttributes().getNamedItem("download") != null){ - download = item.getAttributes().getNamedItem("download").getNodeValue(); - } - Release.EnumReleaseType releaseType = Release.EnumReleaseType.Normal; - if(typeNode != null){ - if(typeNode.getNodeValue().equalsIgnoreCase("beta")){ - releaseType = Release.EnumReleaseType.Beta; - } - if(typeNode.getNodeValue().equalsIgnoreCase("dev")){ - releaseType = Release.EnumReleaseType.Dev; - } - } - - if(versionNode != null && releaseType.level <= versionLevel.level){ - String[] split = versionNode.getNodeValue().toLowerCase().split("\\."); - int[] version = new int[split.length]; - for(int i = 0; i < split.length; i++){ - try{ - version[i] = Integer.parseInt(split[i]); - }catch (NumberFormatException e){ - return null; - } - } - - return new Release(releaseType, url, version, download, md5); - }else{ - return null; - } - - - }else{ - return null; - } - } -} diff --git a/src/main/java/mods/mud/UpdateEntry.java b/src/main/java/mods/mud/UpdateEntry.java deleted file mode 100644 index 859243ac..00000000 --- a/src/main/java/mods/mud/UpdateEntry.java +++ /dev/null @@ -1,58 +0,0 @@ -package mods.mud; - -import java.net.URL; - -import mods.mud.exceptions.UnknownVersionFormatException; -import cpw.mods.fml.common.ModContainer; - -public class UpdateEntry{ - - private ModContainer mc; - private URL updateXML; - private URL changelogURL; - private Release latest = null; - - public UpdateEntry(ModContainer mc, URL updateXML, URL changelogURL) { - this.mc = mc; - this.updateXML = updateXML; - this.changelogURL = changelogURL; - } - - public ModContainer getMc() { - return mc; - } - - public URL getUpdateXML() { - return updateXML; - } - - public URL getChangelogURL() { - return changelogURL; - } - - public Release getLatest() { - return latest; - } - - public void setLatest(Release latest) { - this.latest = latest; - } - - public boolean isUpToDate() throws UnknownVersionFormatException, NullPointerException { - - String[] version_split = mc.getVersion().split("\\."); - int[] version = new int[version_split.length]; - - try{ - for(int i = 0; i < version.length; i++){ - version[i] = Integer.parseInt(version_split[i]); - } - Release thisVersion = new Release(Release.EnumReleaseType.Normal, null, version, null); - - return (thisVersion.compareTo(latest) >= 0); - } - catch(NumberFormatException e){ - throw new UnknownVersionFormatException(); - } - } -} diff --git a/src/main/java/mods/mud/exceptions/UnknownVersionFormatException.java b/src/main/java/mods/mud/exceptions/UnknownVersionFormatException.java deleted file mode 100644 index c91e0c78..00000000 --- a/src/main/java/mods/mud/exceptions/UnknownVersionFormatException.java +++ /dev/null @@ -1,4 +0,0 @@ -package mods.mud.exceptions; - -public class UnknownVersionFormatException extends Exception { -} diff --git a/src/main/java/mods/mud/gui/GuiChangelogDownload.java b/src/main/java/mods/mud/gui/GuiChangelogDownload.java deleted file mode 100644 index 3ffdee3d..00000000 --- a/src/main/java/mods/mud/gui/GuiChangelogDownload.java +++ /dev/null @@ -1,512 +0,0 @@ -package mods.mud.gui; - -import java.awt.Desktop; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.security.MessageDigest; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.DatatypeConverter; - -import mods.mud.ModUpdateDetector; -import mods.mud.UpdateChecker; -import mods.mud.UpdateEntry; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.StatCollector; - -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; - -public class GuiChangelogDownload extends GuiScreen -{ - private GuiSlotModList modList; - private int selected = -1; - private UpdateEntry selectedMod; - private ArrayList entries; - - private String[] changelog; - - int lineStart = 0; - private GuiButton disable; - private GuiButton download; - private GuiButton close1; - private GuiButton ok; - private GuiButton urlButton; - - private boolean isDownloading = false; - private boolean downloadComplete = false; - private boolean downloadFailed = false; - private float downloadPercent; - private String message; - - private GuiScreen parent; - private char[] bullets = new char[]{0x2219, 0x25E6, 0x2023}; - private int[] bulletWidth = new int[3]; - - private Thread getChangeLogThread; - - public GuiChangelogDownload(GuiScreen parent){ - this.parent = parent; - changelog = new String[]{StatCollector.translateToLocal("log.message.loading")}; - if(!ModUpdateDetector.hasChecked){ - new UpdateChecker(ModUpdateDetector.getAllUpdateEntries()).run(); - } - - this.entries=new ArrayList(ModUpdateDetector.getAllUpdateEntries()); - } - - public GuiChangelogDownload(){ - this(null); - } - - @Override - public void initGui() - { - this.buttonList.clear(); - this.modList=new GuiSlotModList(this, entries, 100); - this.modList.registerScrollButtons(this.buttonList, 1, 2); - - for(int i= 0; i < bullets.length; i++){ - bulletWidth[i] = fontRendererObj.getStringWidth(bullets[i]+" "); - } - disable = new GuiButton(3, 15, 10, 125, 20, StatCollector.translateToLocal("mud.disable")+": "+Boolean.toString(!ModUpdateDetector.enabled)); - download = new GuiButton(4, 15, height-35, 125, 20, StatCollector.translateToLocal("button.download.latest")); - download.enabled = false; - close1 = new GuiButton(5, width-140, height-35, 125, 20, StatCollector.translateToLocal("gui.done")); - ok = new GuiButton(6, (width - 200)/2 + 5, (height - 150)/2+115, 190, 20, StatCollector.translateToLocal("button.ok")); - urlButton = new GuiButton(7, (width - 125)/2, height-35, 125, 20, StatCollector.translateToLocal("button.url")); - urlButton.enabled = false; - ok.visible = isDownloading; - ok.enabled = downloadComplete || downloadFailed; - - buttonList.add(disable); - buttonList.add(download); - buttonList.add(close1); - buttonList.add(ok); - buttonList.add(urlButton); - } - - @Override - protected void keyTyped(char par1, int par2) - { - if(!isDownloading){ - if (par2 == 1) - { - this.mc.displayGuiScreen(parent); - this.mc.setIngameFocus(); - } - } - } - - @Override - protected void actionPerformed(GuiButton button) { - if (button.enabled) - { - if(!isDownloading || (downloadFailed || downloadComplete) ){ - switch (button.id) - { - case 3: - isDownloading = false; - close1.enabled = true; - ModUpdateDetector.toggleState(); - disable.displayString = StatCollector.translateToLocal("mud.disable")+":"+Boolean.toString(!ModUpdateDetector.enabled); - return; - case 4: - ModContainer mc = selectedMod.getMc(); - String filename = String.format("[%s] %s - %s.jar", - Loader.instance().getMCVersionString().replaceAll("Minecraft", "").trim(), - mc.getName(), - selectedMod.getLatest().getVersionString()); - File newFile = new File(mc.getSource().getParent(), filename); - Thread t = new Thread(new Downloader(selectedMod.getLatest().download, - newFile, mc.getSource(), selectedMod.getLatest().md5 - )); - t.start(); - isDownloading = true; - ok.visible = true; - close1.enabled = false; - download.enabled = false; - urlButton.enabled = false; - return; - case 5: - this.mc.displayGuiScreen(parent); - return; - case 6: - isDownloading = false; - downloadComplete = false; - downloadFailed = false; - ok.visible = false; - close1.enabled = true; - urlButton.enabled=true; - return; - case 7: - if(selectedMod != null && selectedMod.getLatest() != null && selectedMod.getLatest().url != null){ - try { - Desktop.getDesktop().browse(new URI(selectedMod.getLatest().url)); - } catch (IOException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - }catch (URISyntaxException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - return; - } - } - } - super.actionPerformed(button); - } - - @Override - public void drawDefaultBackground() { - super.drawBackground(0); - } - - @Override - public void drawScreen(int p_571_1_, int p_571_2_, float p_571_3_) - { - if(modList != null) - this.modList.drawScreen(p_571_1_, p_571_2_, p_571_3_); - - if(selectedMod != null){ - - int start = 32; - for(int i = lineStart; i < changelog.length && start < height-52; i++){ - start = drawText(changelog[i], start); - } - - } - - int mouse_x = Mouse.getEventX() * this.width / this.mc.displayWidth; - int mouse_y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; - - if(mouse_x > 125 && mouse_y > 35 && mouse_y < height-50){ - int scroll = Mouse.getDWheel(); - if(scroll < 0 && lineStart < changelog.length-15){ - lineStart++; - } - if(scroll > 0 && lineStart > 0){ - lineStart--; - } - } - - if(isDownloading){ - ok.visible = true; - int x = (width - 200)/2; - int y = (height - 150)/2; - - drawRect(x-1,y-1,x+201, y+151, 0xFFFFFFFF); - drawRect(x,y,x+200, y+150, 0xFF000000); - - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.downloading"), width/2, y + 15, 0xFFFFFF00); - - drawRect(x + 24, y + 39, x+176, y+56, 0xFFFFFFFF); - drawRect(x + 25, y + 40, (x+25 + 150), y+55, 0xFF000000); - - - drawRect(x + 25, y + 40, (int)(x+25 + 150*downloadPercent), y+55, 0xFFc0c0c0); - drawVerticalLine((int)(x+25 + 150*downloadPercent)-1, y + 39, y+55, 0xFF808080); - drawHorizontalLine(x + 25, (int)(x+25 + 150*downloadPercent)-1, y + 54, 0xFF808080); - - if(downloadComplete){ - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.download.complete"), width/2, y + 70, 0xFF44FF44); - } - - if(downloadFailed){ - drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.download.failed"), width/2, y + 70, 0xFFFF0000); - } - - if(message != null){ - drawCenteredString(fontRendererObj, message, width/2, y + 85, 0xFFFFFFFF); - } - - ok.drawButton(mc, p_571_1_, p_571_2_); - - } - - super.drawScreen(p_571_1_, p_571_2_, p_571_3_); - } - - private int drawText(String line, int start) { - int startX = 125; - - if(line == null){ - return 5; - } else if(line.startsWith("==") && line.substring(2).contains("==")){ - - String main = line.substring(2, line.lastIndexOf("==")).trim(); - - float scale = 1F; - GL11.glScalef(1/scale, 1/scale, 1/scale); - this.drawString(fontRendererObj, main.replaceAll("=", "").trim(), (int)((startX)*scale), (int)(start*scale), 0xFFFFFF00); - GL11.glScalef(scale, scale, scale); - - if(line.lastIndexOf("==")+2 <= line.length()){ - String sub = line.substring(line.lastIndexOf("==")+2, line.length()).trim(); - GL11.glScalef(1/scale, 1/scale, 1/scale); - this.drawString(fontRendererObj, sub.replaceAll("=", "").trim(), (int)((startX+fontRendererObj.getStringWidth(main+" "))*scale), (int)(start*scale), 0xFF2222FF); - GL11.glScalef(scale, scale, scale); - } - - return (int)(1F/scale * 10)+start; - }else if(line.trim().startsWith("**") && line.trim().endsWith("**")){ - float scale = 1.1F; - GL11.glScalef(1/scale, 1/scale, 1/scale); - this.drawString(fontRendererObj, line.replaceAll("\\*\\*", "").trim(), (int)((startX)*scale), (int)(start*scale), 0xFFFFFFFF); - GL11.glScalef(scale, scale, scale); - return (int)(1F/scale * 10)+start; - }else{ - float scale = 1.2F; - GL11.glScalef(1/scale, 1/scale, 1/scale); - - int bullet = -1; - while(line.startsWith("*")){ - startX+=10; - line = line.substring(1).trim(); - bullet++; - } - - if(bullet > 3){ - bullet = 3; - } - - List lineList = fontRendererObj.listFormattedStringToWidth(line, width - 10 - startX); - Iterator it = lineList.iterator(); - for(int i = 0; it.hasNext(); i++){ - String subline = it.next().trim(); - - if(i == 0 && bullet > -1){ - subline = bullets[bullet]+" "+subline; - }else if (bullet > -1){ - startX+=bulletWidth[bullet]; - } - this.drawString(fontRendererObj, subline, (int) ((startX) * scale), (int) (start * scale), 0xFFFFFFFF); - start += (int)(1F/scale * 10); - } - - - GL11.glScalef(scale, scale, scale); - return start; - } - } - - Minecraft getMinecraftInstance() { - return mc; - } - - FontRenderer getFontRenderer() { - return fontRendererObj; - } - - /** - * @param var1 - */ - public void selectModIndex(int var1) - { - if(getChangeLogThread == null || !getChangeLogThread.isAlive()){ - this.selected=var1; - if (var1>=0 && var1<=entries.size()) { - this.selectedMod=entries.get(selected); - } else { - this.selectedMod=null; - } - - urlButton.enabled = selectedMod!=null && selectedMod.getLatest()!=null && selectedMod.getLatest().url!=null; - if(selectedMod!=null) { - if (selectedMod.getChangelogURL() == null) { - changelog = new String[]{StatCollector.translateToLocal("log.message.none")}; - } else { - getChangeLogThread = new Thread(new ChangelogLoader(selectedMod.getChangelogURL())); - getChangeLogThread.start(); - changelog = new String[]{StatCollector.translateToLocal("log.message.loading")}; - } - - try { - if (!selectedMod.isUpToDate()) { - download.enabled = true; - download.displayString = StatCollector.translateToLocal("button.download.latest"); - } - } catch (Exception e) { - - } - } - } - } - - public boolean modIndexSelected(int var1) - { - return var1==selected; - } - - private class ChangelogLoader implements Runnable{ - - URL changelogURL; - - private ChangelogLoader(URL changelogURL) { - this.changelogURL = changelogURL; - } - - @Override - public void run() { - try { - BufferedReader br = new BufferedReader(new InputStreamReader(changelogURL.openStream())); - String line = br.readLine(); - ArrayList lines = new ArrayList(100); - if(line != null) - lines.add(line); - while(line != null){ - line = br.readLine(); - lines.add(line); - } - - changelog = lines.toArray(new String[0]); - } catch (IOException e) { - e.printStackTrace(); - changelog = new String[]{StatCollector.translateToLocal("log.message.fail")}; - } - } - } - - private class Downloader implements Runnable{ - - private String downloadUrl = ""; - private File file = null; - private File orginial; - private byte[] expectedMd5; - - public Downloader(String url, File location, File originalFile, String md5){ - this.downloadUrl = url; - this.file = location; - this.orginial = originalFile; - if(md5 != null){ - try{ - this.expectedMd5 = DatatypeConverter.parseHexBinary(md5.toUpperCase()); - }catch (Exception e){ - e.printStackTrace(); - this.expectedMd5 = null; - } - } - - } - - @Override - public void run() { - try { - isDownloading = true; - - if(file.exists()) - file.delete(); - file.createNewFile(); - - URL url=new URL(downloadUrl); - HttpURLConnection connection = - (HttpURLConnection) url.openConnection(); - int filesize = connection.getContentLength(); - float totalDataRead=0; - java.io.BufferedInputStream in = new java.io.BufferedInputStream(connection.getInputStream()); - java.io.FileOutputStream fos = new java.io.FileOutputStream(file); - java.io.BufferedOutputStream bout = new BufferedOutputStream(fos,1024); - byte[] data = new byte[1024]; - int i; - while((i=in.read(data,0,1024))>=0) - { - totalDataRead=totalDataRead+i; - bout.write(data,0,i); - downloadPercent=(totalDataRead)/filesize; - } - bout.close(); - in.close(); - - if(expectedMd5 != null){ - DataInputStream dis = null; - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - byte [] fileData = new byte[(int)file.length()]; - dis = new DataInputStream((new FileInputStream(file))); - dis.readFully(fileData); - dis.close(); - byte[] md5 = md.digest(fileData); - - ModUpdateDetector.logger.trace("Expected MD5: "+bytArrayToHex(expectedMd5)); - ModUpdateDetector.logger.trace("File MD5: "+bytArrayToHex(md5)); - - if(Arrays.equals(md5, expectedMd5)){ - downloadComplete = true; - ok.enabled = true; - message = StatCollector.translateToLocal("gui.restart"); - }else{ - downloadComplete = false; - downloadFailed = true; - ok.enabled = true; - message = StatCollector.translateToLocal("gui.md5.fail"); - - //file.delete(); - - } - - } catch (Exception e) { - e.printStackTrace(); - if(dis != null){ - try{ - dis.close(); - }catch (Exception ex){} - } - - downloadFailed = true; - ok.enabled = true; - - } - }else{ - downloadComplete = true; - ok.enabled = true; - message = StatCollector.translateToLocal("gui.restart"); - } - - if(downloadComplete && - orginial.exists() && - !orginial.getName().equals(file.getName()) && - !orginial.isDirectory() - ){ - ModUpdateDetector.logger.trace("Deleting: "+orginial.getAbsolutePath()); - if(!orginial.delete()){ - ModUpdateDetector.logger.trace("Deleting failed, spawning new process to delete"); - String cmd = "java -classpath \""+file.getAbsolutePath()+"\" mods.mud.utils.FileDeleter \""+orginial.getAbsolutePath()+"\""; - Runtime.getRuntime().exec(cmd); - } - } - - } catch (IOException e) { - e.printStackTrace(); - message = StatCollector.translateToLocal(e.getLocalizedMessage()); - downloadFailed = true; - ok.enabled = true; - } - } - - - } - - String bytArrayToHex(byte[] a) { - StringBuilder sb = new StringBuilder(); - for(byte b: a) - sb.append(String.format("%02x", b&0xff)); - return sb.toString(); - } -} diff --git a/src/main/java/mods/mud/gui/GuiModUpdateButton.java b/src/main/java/mods/mud/gui/GuiModUpdateButton.java deleted file mode 100644 index 2cde805f..00000000 --- a/src/main/java/mods/mud/gui/GuiModUpdateButton.java +++ /dev/null @@ -1,61 +0,0 @@ -package mods.mud.gui; - -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -import org.lwjgl.opengl.GL11; - -public class GuiModUpdateButton extends GuiButton{ - - - RenderItem renderItem = new RenderItem(); - ItemStack icon = new ItemStack(Blocks.farmland); - List text = null; - private GuiScreen parent; - public GuiModUpdateButton(int id, int x, int y, GuiScreen parent) { - super(id, x, y, 100, 20, ""); - this.parent = parent; - } - - @Override - public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - super.drawButton(par1Minecraft, par2, par3); - - if(text == null){ - text = par1Minecraft.fontRenderer.listFormattedStringToWidth(StatCollector.translateToLocal("mud.name"), 80); - } - - renderItem.renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.getTextureManager(), icon, xPosition+2, yPosition+2); - - int l = 14737632; - - if (!this.enabled) - l = -6250336; - else if (this.field_146123_n) - l = 16777120; - - float scale = 1.25F; - GL11.glScalef(1F/scale, 1F/scale, 1F/scale); - - for(int i = 0; i < text.size() && i < 2; i++){ - drawCenteredString(par1Minecraft.fontRenderer, text.get(i), (int)(scale*(xPosition+20+40)), (int)(scale*((yPosition+3)+par1Minecraft.fontRenderer.FONT_HEIGHT*i)), l); - } - GL11.glScalef(scale, scale, scale); - } - - @Override - public boolean mousePressed(Minecraft par1Minecraft, int par2, int par3) { - boolean press = super.mousePressed(par1Minecraft, par2, par3); - if(press){ - Minecraft.getMinecraft().displayGuiScreen(new GuiChangelogDownload(parent)); - } - return press; - } -} diff --git a/src/main/java/mods/mud/gui/GuiSlotModList.java b/src/main/java/mods/mud/gui/GuiSlotModList.java deleted file mode 100644 index 1e922240..00000000 --- a/src/main/java/mods/mud/gui/GuiSlotModList.java +++ /dev/null @@ -1,84 +0,0 @@ -package mods.mud.gui; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import mods.mud.UpdateEntry; -import mods.mud.exceptions.UnknownVersionFormatException; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.resources.I18n; -import cpw.mods.fml.client.GuiScrollingList; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.LoaderState; -import cpw.mods.fml.common.ModContainer; - -public class GuiSlotModList extends GuiScrollingList -{ - private GuiChangelogDownload parent; - private List entries; - - public GuiSlotModList(GuiChangelogDownload parent, Collection entries, int listWidth) - { - super(parent.getMinecraftInstance(), listWidth, parent.height, 32, parent.height - 65 + 4, 10, 25); - this.parent=parent; - this.entries = new ArrayList(entries); - } - - @Override - protected int getSize() - { - return entries.size(); - } - - @Override - protected void elementClicked(int var1, boolean var2) - { - this.parent.selectModIndex(var1); - } - - @Override - protected boolean isSelected(int var1) - { - return this.parent.modIndexSelected(var1); - } - - @Override - protected void drawBackground() - { - this.parent.drawDefaultBackground(); - } - - @Override - protected int getContentHeight() - { - return (this.getSize()) * 25 + 1; - } - - @Override - protected void drawSlot(int listIndex, int var2, int var3, int var4, Tessellator var5) - { - ModContainer mc=entries.get(listIndex).getMc(); - if (Loader.instance().getModState(mc)== LoaderState.ModState.DISABLED) - { - this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222); - this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222); - } - else - { - this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF); - try{ - if(entries.get(listIndex).isUpToDate()){ - this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(I18n.format("mud.version.latest"), listWidth - 10), this.left + 3 , var3 + 12, 0xFF00FF00); - }else{ - this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(I18n.format("mud.version.out"), listWidth - 10), this.left + 3 , var3 + 12, 0xFFFF0000); - } - }catch (UnknownVersionFormatException e){ - - }catch (NullPointerException e){ - - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/mods/mud/utils/FileDeleter.java b/src/main/java/mods/mud/utils/FileDeleter.java deleted file mode 100644 index 65246212..00000000 --- a/src/main/java/mods/mud/utils/FileDeleter.java +++ /dev/null @@ -1,26 +0,0 @@ -package mods.mud.utils; - -import java.io.File; - -import mods.mud.ModUpdateDetector; - -public class FileDeleter { - public static void main(String[] args){ - if(args.length > 0){ - File f = new File(args[0]); - if(f.exists()){ - while(f.exists()){ - f.delete(); - ModUpdateDetector.logger.trace("File in use, try again in 1 second"); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - - } - } - -} diff --git a/src/main/resources/assets/minefantasy2/LogoMF2EdK.png b/src/main/resources/assets/minefantasy2/LogoMF2EdK.png new file mode 100644 index 00000000..2388aa27 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/LogoMF2EdK.png differ diff --git a/src/main/resources/assets/minefantasy2/lang/en_US.lang b/src/main/resources/assets/minefantasy2/lang/en_US.lang index f940873c..c488afde 100644 --- a/src/main/resources/assets/minefantasy2/lang/en_US.lang +++ b/src/main/resources/assets/minefantasy2/lang/en_US.lang @@ -5,6 +5,7 @@ forge.fuel.name=~Fuel~ vehicle.fuel.name=Fuel: %1$s info.bow.reload=Right-Click while sneaking to open firearm. info.firearm.ammo=%1$s/%2$s +info.tooltip.moreinfo=Hold [%1$s] for more information. attribute.kit.salvage.name=Salvage Modifier @@ -206,7 +207,7 @@ material.tin.name=Tin material.bronze.name=Bronze material.iron.name=Iron -material.refinediron.name=Pig Iron +material.pigiron.name=Pig Iron material.steel.name=Steel material.tungsten.name=Wolframite material.obsidian.name=Obsidian @@ -241,6 +242,49 @@ material.void.name=Void material.manasteel.name=Manasteel material.elvenelementium.name=Elementium material.terrasteel.name=Terrasteel + +NEW +material.damascussteel.name=Damascus Steel +material.atlarus.name=Atlarus +material.platinum.name=Platinum +material.angmallen.name=Angmallen +material.vulcanite.name=Vulcanite +material.orichalcum.name=Orichalcum +material.haderoth.name=Haderoth +material.tartarite.name=Tartarite +material.shadowiron.name=Shadow Iron +material.dwarfsteel.name=Dwarven Steel +material.emerald.name=Emerald +item.dwarvenforged_longsword.name=Dwarvenforged %1$s Longsword + +//NEW INGOTS +item.ingotDwarfSteel.name=Dwarven Steel Ingot +item.ingotEmerald.name=Emerald Ingot + + +NEW BLOCKS +tile.oreMithril.name=Mithril Ore + +NEW FUELS +item.dwarven_fuel.name=Dwarven Fuel + +TABS +itemGroup.MFdwarvenforged=[MF] DwarvenForged Style + +DESC +knownledge.claymore.info=Claymores are great for defense and counter attacks. + +NEW WEAPONS +item.standard_longsword.name=%1$s Longsword +item.standard_saber.name=%1$s Saber +item.standard_shortsword.name=%1$s Shortsword +item.standard_gladius.name=%1$s Gladius +item.standard_trident.name=%1$s Trident +item.standard_nodachi.name=%1$s Nodachi +item.standard_claymore.name=%1$s Claymore + + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /ITEM STATS/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/main/resources/assets/minefantasy2/lang/ru_RU.lang b/src/main/resources/assets/minefantasy2/lang/ru_RU.lang new file mode 100644 index 00000000..d58405e7 --- /dev/null +++ b/src/main/resources/assets/minefantasy2/lang/ru_RU.lang @@ -0,0 +1,2254 @@ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +//Русификация подготовлена: Ardghal, Sirse, SkySwifty (Alter) +//Специально для проекта ZonaSumraka.RU +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/INFORMATION/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +forge.fuel.name=~Топливо~ +vehicle.fuel.name=Топливо: %1$s +info.bow.reload="Присесть" + ПКМ для перезарядки +info.firearm.ammo=%1$s/%2$s +info.tooltip.moreinfo=Удерживайте [%1$s] для доп. информации + +attribute.kit.salvage.name=Эффективность разбора + +attribute.kit.repairRate.name=Шанс починки +attribute.kit.repairRate_enchant.name=Шанс починки (Зачарованные вещи) +attribute.kit.repairRate_normal.name=Шанс починки (Не зачарованные вещи) + +attribute.kit.repairChance.name=Шанс успешной починки +attribute.kit.breakChance.name=Шанс поломки набора + +attribute.inferior.name=Плохого качества +attribute.superior.name=Отличного качества + +item.infobook.name=Книга исследований +item.research_scroll.name=Свиток исследований +item.research_scroll_complete.name=Завершённое исследование + +item.talisman_lesser.name=Малый талисман знания +item.talisman_greater.name=Большой талисман знания + +prospect.canmine=Вы можете добыть это! (Инструмент: %1$s | Блок: %2$s) +prospect.cannotmine=Вы не можете добыть это! (Инструмент: %1$s | Блок: %2$s) +gui.information=Исследование +information.discovered=Исследовано +information.buy=Нажмите для исследования +knowledge.unknownUse=Вы не знаете, как использовать это! +knowledge.known=Вы уже знаете это. + +infoPage.basic=Основы +infoPage.artisanry=Кузнечное дело +infoPage.construction=Строительное дело +infoPage.provisioning=Ремесло снабжения +infoPage.engineering=Инженерное дело +infoPage.mastery=Мастерство +infoPage.dwarvern=Знания гномов +infoPage.gnomish=Гномские секреты + +knowledge.unlocked=Исследование завершено + +vehicle.noArmour=Вы не можете использовать этот костюм, когда носите что-либо. +vehicle.tooBigArmour=Ваша броня слишком объёмна и вы не влезаете в костюм. + +research.noskill=Вы сможете изучить что-то из этого, пока не достигнете более высокого уровня. +research.null=Больше нечего изучать + +research.addArtefact=Добавлено знание: %1$s (%2$s/%3$s) +research.finishResearch=Исследовано: "%1$s" +research.cluecount= (%1$s/%2$s) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/MOBS/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +entity.MF_Minotaur.name=Минотавр +entity.MF_Dragon.name=Дракон +death.attack.dragonstomp=%1$s был растоптан драконом. +death.attack.humanstomp=%1$s был растоптан %2$s +death.attack.fireblast=%1$s был испепелён %2$s +death.attack.fireblastBase=%1$s обратился в пепел +death.attack.blastfurn=%1$s сгорел в доменной печи +death.attack.frostblast=%1$s был заморожен %2$s +death.attack.frostblastBase=%1$s замёрз насмерть +death.attack.acidblast=%1$s был испарён %2$s +death.attack.acidblastBase=%1$s испарился +death.attack.ashblast=%1$s задохнулся от пепла %2$s +death.attack.ashblastBase=%1$s задохнулся от пепла + +death.attack.mob.pound=%1$s был растоптан %2$s +death.attack.mob.gore=%1$s был поднят на рога%2$s +death.attack.mob.beserk=%1$s был разорван %2$s + +entity.minotaur.name=Минотавр +entity.minotaur_guard.name=Минотавр-защитник +entity.minotaur_elite.name=Элитный минотавр +entity.minotaur_boss.name=Минотавр-воевода + +entity.frostminotaur.name=Ледяной минотавр +entity.frostminotaur_guard.name=Ледяной минотавр-защитник +entity.frostminotaur_elite.name=Элитный ледяной минотавр +entity.frostminotaur_boss.name=Ледяной минотавр-воевода + +entity.dredminotaur.name=Ужасный минотавр +entity.dreadminotaur_guard.name=Ужасный минотавр-защитник +entity.dreadminotaur_elite.name=Ужасный минотавр-палач +entity.dreadminotaur_boss.name=Ужасный минотавр-воевода + +entity.dragonbreed.red.name=Красный +entity.dragonbreed.white.name=Ледяной +entity.dragonbreed.black.name=Чёрный +entity.dragonbreed.green.name=Зелёный +entity.dragonbreed.ash.name=Пепельный + +entity.dragon_young.name=Молодой %1$s дракон +entity.dragon.name=%1$s дракон +entity.dragon_mature.name=Взрослый %1$s дракон +entity.dragon_elder.name=Старейший %1$s дракон +entity.dragon_ancient.name=Древний %1$s дракон + +event.dragonnear.name=Дракон в небе! Ищите укрытие, или приготовьтесь к бою! +event.dragonnear.forge.name=Это ремесло нанесло оскорбление всей расе драконов! +event.dragonaway.name=Дракон улетел... Пока что... + +entity.hound.name=Гончая + +item.spawn_dragon.name=Дракон +item.spawn_dragon.desc=Смертоносные летающие рептилии +item.spawn_minotaur.name=Минотавр +item.spawn_minotaur.desc=Жестокий и беспощадный. +item.spawn_hound.name=Гончая +item.spawn_hound.desc=Умная собака с острыми клыками +item.spawn_cogwork.name=Механическая броня +item.spawn_cogwork.desc=Максимум защиты + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/TOOL LIST/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.tool_pick.name=%1$s кирка +item.commodity_plank.name=%1$s брусок +item.haft.name=Рукоять +item.commodity_hunk.name=%1$s кусок +item.commodity_scrap.name=%1$s лом +item.commodity_plate.name=%1$s пластина +item.commodity_bar.name=Чушка "%1$s" +item.commodity_plate_huge.name=Большая %1$s пластина +item.commodity_chainmesh.name=%1$s кольчужная сетка +item.commodity_scalemesh.name=%1$s чешуйчатая сетка +item.commodity_splintmesh.name=%1$s пластинчатая сетка +item.commodity_plateheavy.name=Тяжёлая пластина из "%1$s" +item.commodity_arrowhead.name=%1$s наконечник +item.commodity_bodkinhead.name=Конусовидный наконечник "%1$s" +item.commodity_broadhead.name=Широкий наконечник "%1$s" +item.commodity_cogwork_armour.name=Механическая броня "%1$s" + +item.mod_plating.name=%1$s панцирная +item.mod_head.name=%1$s Голова +item.mod_haft.name=Рукоять "%1$s" +item.mod_joint.name=Плечи "%1$s" + +component.head.name=%1$s Head +component.shaft.name=%1$s Shaft +component.grip.name=%1$s Grip +component.brace.name=%1$s Brace +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/MATERIAL LIST/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +materialtype.wood.name=Дерево (lvl %1$s) +materialtype.leather.name=Кожа (lvl %1$s) +materialtype.metal.name=Металл (lvl %1$s) +materialtype.workable.name=Темп. ковки: %1$s°C - %2$s°C + +materialtype.resist.name=Сопротивление %1$s +materialtype.fireresist.name=Сопротивление огню %1$s +materialtype.maxtemp.name=Темп. плавления: %1$s°C +material.any.name=Any + +WOOD +material.scrapwood.name=Древесные отходы +material.oakwood.name=Дуб +material.birchwood.name=Берёза +material.sprucewood.name=Ель +material.acaciawood.name=Акация +material.junglewood.name=Тропическое дерево +material.refinedwood.name=Очищенная древесина +material.ironbarkwood.name=Эвкалипт +material.ebonywood.name=Эбеновое дерево +material.darkoakwood.name=Тёмный дуб +material.pinewood.name=Сосна +material.cherrywood.name=Вишня +material.poplarwood.name=Тополь +material.maplewood.name=Maple +material.mahoewood.name=Махо +material.greenheartwood.name=Зеленосердечное дерево +material.palmwood.name=Пальма +material.limewood.name=Липа +material.balsawood.name=Бальза +material.walnutwood.name=Ореховое дерево +material.chestnutwood.name=Каштан +material.larchwood.name=Лиственница +material.willowwood.name=Ива +material.teakwood.name=Тик +material.sequoiawood.name=Секвойя +material.mahoganywood.name=Красное дерево +material.wengewood.name=Венге +material.redwoodwood.name=Красное дерево +material.firwood.name=Ель +material.purpleheartwood.name=Пурпурносердечное дерево +material.silverwoodwood.name=Серебряное дерево +material.greatwoodwood.name=Великое дерево +material.yewwood.name=Тис + + + +LEATHER +material.leather.name=Кожа +material.hardleather.name=Грубая кожа +material.minotaurskin.name=Кожа минотавра +material.dragonskin.name=Драконья кожа + +METAL +material.copper.name=Медь +material.tin.name=Олово + +material.bronze.name=Бронза +material.iron.name=Железо +material.pigiron.name=Чугун +material.steel.name=Сталь +material.tungsten.name=Вольфрам +material.obsidian.name=Обсидиан +material.encrusted.name=Алмаз +material.blacksteel.name=Чёрная сталь +material.redsteel.name=Красная сталь +material.bluesteel.name=Голубая сталь + +material.adamantium.name=Адамантий +material.mithril.name=Мифрил +material.ignotumite.name=Игнотумит +material.mithium.name=Мифий +material.ender.name=Сталь Края + +PRECIOUS +material.gold.name=Золото +material.silver.name=Серебро + +NON-MF +material.bismuth.name=Висмут +material.bismuthbronze.name=Висмутовая бронза +material.nickel.name=Никель +material.titanium.name=Титан +material.stainlesssteel.name=Нержавеющая сталь + +ALLOY +material.compositealloy.name=Композитный слиток + +MOD +material.thaumium.name=Таум металл +material.void.name=Пустотный металл +material.manasteel.name=Манафрам +material.elvenelementium.name=Элементиум +material.terrasteel.name=Терразий +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/ITEM STATS/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +prefix.hotitem.name=Горячий %1$s +state.workable=Готовый к работе +state.unstable=Перегретый +attribute.weightt.name=Вес: %1$sт +attribute.weightKg.name=Вес: %1$sкг +attribute.weightg.name=Вес: %1$sг +attribute.nomfcrafttier.name=Другой разряд +attribute.mfcrafttier.name=Уровень +attribute.mfcrafttool.name=Ремесл. инструмент: +attribute.mfcrafteff.name=Эффективность крафта +attribute.mfcraftedbyname.name=Ремесленник +tooltype.hammer=Молот +tooltype.hvyHammer=Тяжёлый молот +tooltype.saw=Пила +tooltype.knife=Нож +tooltype.needle=Игла +tooltype.mallet=Киянка +tooltype.spoon=Ложка +tooltype.hands=Кулак +tooltype.spanner=Гаечный ключ +tooltype.shears=Ножницы +tooltype.brush=Кисть + +tooltype.anvil=Наковальня +tooltype.carpenter=Плотницкий верстак + +attribute.weapon.penetrateArmor=Проникновение +attribute.weapon.daze=Дробящий урон +attribute.weapon.extendedReach=Радиус +attribute.weapon.attackSpeed=Скорость атаки +attribute.weapon.backstab=Удар в спину +attribute.weapon.mountedBonus=Удар в седле +attribute.weapon.joustDam=Удар на скаку +attribute.shield.block.time=s блокирование +attribute.shield.arrow.count=Стрелы +attribute.quiver.arrow.empty=Пусто +attribute.quiver.arrow.count=Стрелы + +attribute.armour.protection=Уровень защиты +attribute.armour.light=Лёгкая броня +attribute.armour.medium=Средняя броня +attribute.armour.heavy=Тяжёлая броня +attribute.weight.name=Масса + +attribute.bowPower.name=Модификатор урона x%1$s +attribute.arrowPower.name=Урон + +attribute.armour.rating.0=Режущий урон: +attribute.armour.rating.1=Дробящий урон: +attribute.armour.rating.2=Колющий урон: + +attribute.armour.cuttingresistance=Сопротивление режущему оружию +attribute.armour.bluntresistance=Сопротивление дробящему оружию +attribute.armour.piercingresistance=Сопротивление колющему оружию + +attribute.weapon.cutting=Режущий урон +attribute.weapon.blunt=Дробящий урон +attribute.weapon.piercing=Колющий урон + +attribute.armour.dtcutting=Максимальный режущий урон +attribute.armour.dtblunt=Максимальный дробящий урон +attribute.armour.dtpiercing=Максимальный колющий урон + +arrow.head.normal.name=Обычный наконечник +arrow.head.bodkin.name=Конусовидный наконечник +arrow.head.broad.name=Широкий наконечник + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/COMMODITY/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.plank.name=Брусок +item.plant_oil.name=Растительное масло +item.plankRefined.name=Пропитанный брусок +item.rivet.name=Заклёпки +item.nail.name=Гвозди +item.thread.name=Волокно +item.lime_rock.name=Известняковый камень +item.borax_rock.name=Залежи боракса +item.flux.name=Флюс +item.flux_strong.name=Крепкий флюс +item.coal_prep.name=Подготовленный уголь +item.coke.name=Кокс +item.blackpowder.name=Чёрный порох +item.blackpowder_advanced.name=Продвинутый чёрный порох +item.bolt.name=Болты +item.flux_pot.name=Горшочек флюса +item.coal_flux.name=Угольный флюс + +item.ingotCopper.name=Медный слиток +item.ingotTin.name=Оловянный слиток +item.ingotBronze.name=Бронзовый слиток +item.ingotPigIron.name=Чугунный слиток +item.ingotSteel.name=Стальной слиток +item.ingotEncrusted.name=Драгоценный слиток +item.ingotObsidian.name=Обсидиановый слиток +item.ingotSilver.name=Серебряный слиток +item.ingotPureGold.name=Слиток чистого золота +item.ingotCompositeAlloy.name=Слиток композитного сплава +item.ingotBlackSteelWeak.name=Необработанная чёрная сталь +item.ingotBlueSteelWeak.name=Необработанная голубая сталь +item.ingotRedSteelWeak.name=Необработанная красная сталь + +item.ingotRedSteel.name=Слиток красной стали +item.ingotBlackSteel.name=Слиток чёрной стали +item.ingotBlueSteel.name=Слиток голубой стали + +item.ingotAdamantium.name=Адамантиевый слиток +item.ingotMithril.name=Мифриловый слиток + +item.ingotIgnotumite.name=Игнотумитовый слиток +item.ingotMithium.name=Мифиевый слиток + +item.ingotEnder.name=Слиток стали Края + +item.ingotTungsten.name=Вольфрамовый слиток + +item.loot_sack.name=Добыча +item.loot_sack_uc.name=Ценная добыча +item.loot_sack_rare.name=Драгоценная добыча + +item.copper_coin.name=Медная монета +item.silver_coin.name=Серебряная монета +item.gold_coin.name=Золотая монета + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/COMPONENT/ +item.ingot_mould.name=Литейная форма +item.ingot_mould_uncooked.name=Необожжённая литейная форма + +item.clay_pot.name=Горшок +item.clay_pot_uncooked.name=Необожжённый горшок + +item.jug_empty.name=Пустой кувшин +item.jug_uncooked.name=Необожжённый кувшин +item.jug_water.name=Кувшин с водой +item.jug_milk.name=Кувшин с молоком + +tile.salvage_basic.name=Простой разборочный верстак +tile.salvage_advanced.name=Продвинутый разборочный верстак + +tile.repair_basic.name=Базовый рем. набор +tile.repair_advanced.name=Продвинутый рем. набор +tile.repair_ornate.name=Украшенный рем. набор + +item.rawhideSmall.name=Малая шкура +item.rawhideMedium.name=Средняя шкура +item.rawhideLarge.name=Большая шкура + +item.leather_strip.name=Полоска кожи +item.hideSmall.name=Чистая малая шкура +item.hideMedium.name=Чистая средняя шкура +item.hideLarge.name=Чистая большая шкура + +item.vine.name=Лоза +item.sharp_rock.name=Острый камень + +item.iron_prep.name=Обработанное железо +item.diamond_shards.name=Алмазные осколки +item.diamond_dust.name=Алмазная пыль +item.obsidian_rock.name=Обсидиановый осколок +item.fletching.name=Оперение + +item.coalDust.name=Угольная пыль +item.nitre.name=Селитра +item.sulfur.name=Сера +item.bomb_casing_uncooked.name=Необожжённый глиняный корпус бомбы +item.bomb_casing.name=Глиняный корпус бомбы +item.mine_casing_uncooked.name=Необожжённый глиняный корпус мины +item.mine_casing.name=Глиняный корпус мины +item.shrapnel.name=Шрапнель +item.magma_cream_refined.name=Очищенная магма +item.bomb_fuse.name=Фитиль +item.bomb_fuse_long.name=Длинный фитиль +item.bomb_casing_iron.name=Железный корпус бомбы +item.mine_casing_iron.name=Железный корпус мины +item.bomb_casing_obsidian.name=Обсидиановый корпус бомбы +item.mine_casing_obsidian.name=Обсидиановый корпус мины +item.bomb_casing_crystal.name=Кристальный корпус бомбы +item.mine_casing_crystal.name=Кристальный корпус мины +item.bomb_casing_arrow.name=Корпус бомбы со стрелами +item.bomb_casing_bolt.name=Корпус бомбы с болтами + +item.clay_brick.name=Глиняный кирпич +item.kaolinite.name=Каолинит +item.kaolinite_dust.name=Каолинитовая пыль +item.fireclay.name=Огнеупорная глина +item.fireclay_brick.name=Огнеупорный глиняный кирпич +item.strong_brick.name=Огнеупорный кирпич + +item.oreCopper.name=Необработанная медная руда +item.oreTin.name=Необработанная оловянная руда +item.oreIron.name=Необработанная железная руда +item.oreSilver.name=Необработанная серебряная руда +item.oreGold.name=Необработанная золотая руда +item.oreTungsten.name=Необработанный вольфрам + +item.dragon_heart.name=Сердце дракона +item.ornate_items.name=Декоративный герб + +item.iron_frame.name=Железная рама +item.iron_strut.name=Железная распорка +item.bronze_gears.name=Бронзовые шестерёнки +item.tungsten_gears.name=Вольфрамовые шестерёнки +item.steel_tube.name=Стальная трубка +item.cogwork_shaft.name=Вал механической брони +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/GADGET/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.spyglass.name=Подзорная труба +item.climbing_pick_basic.name=Альпеншток +item.parachute.name=Парашют +item.syringe_empty.name=Пустой шприц + +tile.cogwork_helm.name=Механический шлем +tile.cogwork_chest.name=Механический нагрудник +tile.cogwork_legs.name=Механические поножи +tile.frame_block.name=Остов +tile.cogwork_builder.name=Крюк + +item.cogwork_pulley.name=Шкив механической брони + +bomb.component.name=Компонент бомбы +bomb.component.filling=Наполнение +bomb.component.bombcase=Корпус бомбы +bomb.component.minecase=Корпус мины +bomb.component.arrow=Корпус стрелы +bomb.component.bolt=Корпус болтами +bomb.component.fuse=Фитиль +bomb.component.powder=Порох + +crossbow.component.name=Деталь арбалета +crossbow.component.stock=Ложе +crossbow.component.mechanism=Механизм +crossbow.component.mod=Модификация +crossbow.component.muzzle=Дуло + +item.bomb_crude.name=Грубая бомба +item.bomb_basic.name=Обычная бомба +item.bomb_shrapnel.name=Осколочная бомба +item.bomb_fire.name=Зажигательная бомба +item.exploding_arrow.name=Взрывная стрела +item.exploding_bolt.name=Взрывной болт + +item.mine_basic.name=Обычная мина +item.mine_shrapnel.name=Осколочная мина +item.mine_fire.name=Зажигательная мина + +death.attack.mine=%1$s подорвался на мине +death.attack.bomb.thrown=%1$s был взорван %2$s +death.attack.bomb=%1$s был взорван бомбой +death.attack.bomb.suicide=%1$s подорвал себя... Мда. + +bomb.powder.blackpowder.name=Пороховой заряд +bomb.powder.advBlackpowder.name=Продвинутый пороховой заряд +bomb.fuse.basic.name=Обычный фитиль +bomb.fuse.long.name=Длинный фитиль +bomb.case.crude.name=Бумажный корпус +bomb.case.ceramic.name=Керамический корпус +bomb.case.iron.name=Железный корпус +bomb.case.obsidian.name=Обсидиановый корпус +bomb.case.crystal.name=Кристальный корпус +bomb.damage.name=Урон взрывом +bomb.range.metric.name=Радиус поражения: %1$s м +bomb.fusetime.name=Время детонации: %1$s сек +bomb.case.sticky=Липкий корпус + +gui.bombcraftmf.name=Изготовление бомбы +gui.crossbowcraftmf.name=Изготовление арбалета + +attribute.crossbow.power.name=Урон: x%1$s +attribute.crossbow.speed.name=Перезарядка: %1$s сек. +attribute.crossbow.spread.name=Дальность: x%1$s +attribute.crossbow.recoil.name=Отдача: x%1$s +attribute.crossbow.capacity.name=Боезапас: %1$s +attribute.crossbow.bash.name=Урон вблизи: %1$s + +crosspart.stock.cross_stock_wood=Деревянный +crosspart.stock.cross_stock_iron=Железный +crosspart.stock.cross_handle_wood=Ручной +crosspart.mechanism.cross_arms_light=Лёгкий арбалет +crosspart.mechanism.cross_arms_heavy=Тяжёлый арбалет +crosspart.mechanism.cross_arms_advanced=Улучшенный арбалет +crosspart.mod.cross_ammo=Магазин +crosspart.mod.cross_scope=Прицел + +item.cross_stock_wood.name=Ложа +item.cross_handle_wood.name=Малая ложа +item.cross_stock_iron.name=Железная ложа +item.cross_arms_light.name=Лёгкие плечи арбалета +item.cross_arms_basic.name=Плечи арбалета +item.cross_arms_heavy.name=Тяжёлые плечи арбалета +item.cross_arms_advanced.name=Продвинутые плечи арбалета +item.cross_ammo.name=Магазинный механизм арбалета +item.cross_scope.name=Прицел арбалета +item.cross_bayonet.name=Арбалетный штык + +item.cross_stock_wood.desc=Без улучшений +item.cross_handle_wood.desc=Быстрая перезарядка, большая отдача и дальность +item.cross_stock_iron.desc=Гасит отдачу +item.cross_arms_light.desc=Меньше мощность и отдача, почти не влияет на вес +item.cross_arms_basic.desc=Без улучшений +item.cross_arms_heavy.desc=Больше мощность и отдача. Достаточно большой вес +item.cross_arms_advanced.desc=Большая мощность и точность, но высокая отдача и большой вес +item.cross_ammo.desc=Шестизарядный магазин, увеличенная дальность +item.cross_scope.desc=Даёт возможность вести прицельный огонь +item.cross_bayonet.desc=Повышенный урон в ближнем бою, снижает отдачу, медленная перезарядка +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/ORES/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +tile.oreCopper.name=Медная руда +tile.oreTin.name=Оловянная руда +tile.oreSilver.name=Серебряная руда +tile.oreTungsten.name=Вольфрамовая руда +tile.oreMythic.name=Мифиевая руда +tile.oreMythicPure.name=Чистая мифиевая руда + +tile.oreClay.name=Глиняные залежи +tile.oreBorax.name=Залежи боракса +tile.oreKaolinite.name=Залежи каолинита +tile.oreNitre.name=Залежи селитры +tile.oreSulfur.name=Залежи серы +tile.oreCoalRich.name=Богатые углём залежи + +tile.window.name=Окно +tile.window_pane.name=Оконное стекло +tile.mud_pavement.name=Грубые грязевые кирпичи +tile.mud_pavement_stair.name=Ступеньки из грубых грязевых кирпичей +tile.mud_brick.name=Грязевые кирпичи +tile.mud_brick_stair.name=Ступеньки из грязевых кирпичей +tile.thatch.name=Соломенная крыша +tile.thatch_stair.name=Скат соломенной крыши + +tile.limestone.name=Известняк +tile.limestone_cobblestone.name=Известняковый булыжник +tile.limestone_brick.name=Известняковые кирпичи +tile.limestone_pavement.name=Известняковая мозаика +tile.limestone_stair.name=Известняковые ступеньки +tile.limestone_cobblestone_stair.name=Ступеньки из известнякового булыжника +tile.limestone_brick_stair.name=Ступеньки из известнякового кирпича +tile.limestone_pavement_stair.name=Ступеньки из известняковой мозаики + +tile.slate.name=Сланец +tile.slate_cobblestone.name=Сланцевый булыжник +tile.slate_brick.name=Сланцевые кирпичи +tile.slate_pavement.name=Сланцевая мозаика +tile.slate_stair.name=Сланцевые ступеньки +tile.slate_cobblestone_stair.name=Ступеньки из сланцевого булыжника +tile.slate_brick_stair.name=Ступеньки из сланцевого кирпича +tile.slate_pavement_stair.name=Ступеньки из сланцевой мозаики + +tile.framed_glass.name=Обрамлённое стекло +tile.framed_pane.name=Обрамлённое оконное стекло +tile.firebricks.name=Огнеупорные кирпичи +tile.firebrick_stair.name=Ступеньки из огнеупорного кирпича +tile.cobble_pavement.name=Булыжниковая мозаика +tile.cobble_pavement_stair.name=Ступеньки из булыжниковой мозаики +tile.cobble_brick.name=Булыжниковые кирпичи +tile.cobble_brick_stair.name=Ступеньки из булыжникового кирпича +tile.clayWall.name=Глиняная стена +tile.ironbark_log.name=Эвкалиптовая древесина +tile.ebony_log.name=Эбеновая древесина +tile.yew_log.name=Тисовая древесина +tile.ironbark_leaves.name=Эвкалиптовая листва +tile.ebony_leaves.name=Листва эбенового дерева +tile.yew_leaves.name=Тисовая листва +tile.ironbark_sapling.name=Саженец эвкалипта +tile.ebony_sapling.name=Саженец эбенового дерева +tile.yew_sapling.name=Тисовый саженец +tile.ironbark_planks.name=Эвкалиптовые доски +tile.ebony_planks.name=Эбеновые доски +tile.yew_planks.name=Тисовые доски +tile.ironbark_stair.name=Эвкалиптовые ступеньки +tile.ebony_stair.name=Ступеньки из эбони +tile.yew_stair.name=Ступеньки из тиса + +tile.nailed_planks.name=Оббитые доски +tile.refined_planks.name=Очищенные доски +tile.nailed_planks_stair.name=Оббитые ступеньки +tile.refined_planks_stair.name=Очищенные ступеньки +tile.reinforced_stone.name=Укреплённый камень +tile.reinforced_stone_bricks.name=Кирпичи из укреплённого камня +tile.reinforced_stone_framed.name=Обрамлённый укреплённый камень + +tile.reinforced_stone_base.name=Укреплённый камень +tile.reinforced_stone_engraved.name=Резной укреплённый камень +tile.reinforced_stone_bricks_base.name=Кирпичи из укреплённого камня +tile.reinforced_stone_bricks_cracked.name=Потресканные кирпичи из укреплённого камня +tile.reinforced_stone_bricks_mossy.name=Замшелые кирпичи из укреплённого камня + +tile.reinforced_stone_stair.name=Ступеньки из укреплённого камня +tile.reinforced_stone_brick_stair.name=Ступеньки из укреплённых каменных кирпичей + +tile.bronze_bars.name=Бронзовые прутья +tile.iron_bars.name=Железные прутья +tile.steel_bars.name=Стальные прутья +tile.dragonforge_bars.name=Прутья из драконьей стали +tile.redsteel_bars.name=Прутья из красной стали +tile.blacksteel_bars.name=Прутья из чёрной стали +tile.bluesteel_bars.name=Прутья из голубой стали + +tile.copper_block.name=Медный блок +tile.tin_block.name=Оловянный блок +tile.silver_block.name=Серебряный блок +tile.pigiron_block.name=Чугунный блок + +tile.bronze_block.name=Бронзовый блок +tile.steel_block.name=Стальной блок +tile.dragonforge_block.name=Блок драконьей стали +tile.redsteel_block.name=Блок красной стали +tile.blacksteel_block.name=Блок чёрной стали +tile.bluesteel_block.name=Блок голубой стали + +ttile.adamantium_block.name=Адамантиевый блок +tile.mithril_block.name=Мифриловый блок +tile.ignotumite_block.name=Игнотумитовый блок +tile.mithium_block.name=Мифиевый блок + +tile.ender_block.name=Блок стали Края + +tile.forge.stone.name=Каменный горн +tile.forge.metal.name=Продвинутый горн +tile.bloomery.name=Домница +tile.crucible.stone.name=Каменный тигель +tile.crucible.fireclay.name=Огнеупорный тигель +tile.crucible.auto.name=Продвинутый тигель +tile.crucible.mythic.name=Древний тигель +tile.crucible.master.name=Мастерский древний тигель + +tile.chimney.stone.name=Каменная дымовая труба +tile.chimney.stone.wide.name=Широкая каменная дымовая труба +tile.chimney.stone_extractor.wide.name=Каменная вытяжка +tile.chimney.pipe.name=Дымовая труба +tile.bellows.name=Меха +tile.tanner.name=Ветхий дубильный станок +tile.tannerStrong.name=Дубильный станок +tile.tannerMetal.name=Продвинутый дубильный станок +tile.bombBench.name=Стол изготовления бомб +tile.crossbowBench.name=Стол изготовления арбалетов +tile.bombPress.name=Бомбовый пресс +tile.carpenterBench.name=Плотницкий верстак +tile.researchStation.name=Исследовательская станция +tile.quern.name=Ручная мельница +tile.anvilStone.name=Каменная наковальня +tile.anvilBronze.name=Бронзовая наковальня +tile.anvilIron.name=Железная наковальня +tile.anvilSteel.name=Стальная наковальня +tile.anvilBlackSteel.name=Наковальня из чёрной стали +tile.anvilRedSteel.name=Наковальня из красной стали +tile.anvilBlueSteel.name=Наковальня из голубой стали +tile.furnace_stone.name=Печь +tile.furnace_heater.name=Топка +tile.blastfurnchamber.name=Камера доменной печи +tile.blastfurnheater.name=Топка доменной печи + +tile.firepit.name=Костёр +tile.food_roast_basic.name=Плита +tile.food_oven_basic.name=Каменная печь + +tile.rack_wood.name=%1$s стойка для инструментов +tile.food_box_basic.name=%1$s ящик для провианта +tile.ammo_box_basic.name=%1$s ящик для боеприпасов +tile.crate_basic.name=%1$s ящик +tile.trough_wood.name=%1$s корыто +attribute.box.capacity.name=Вместимость: %1$s стаков +attribute.fill.capacity.name=Вместимость: %1$s +attribute.fill=Заполнено x%1$s + +item.bedroll.name=Лежанка +tile.bedroll.name=Лежанка + +tile.framed_end.name=Обрамлённый мифический камень +tile.decorated_end.name=Декоративный мифический камень +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/TABS/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +itemGroup.forgedtool=[MF] Кованые инструменты +itemGroup.forgedweapon=[MF] Кованое оружие +itemGroup.forgedarmour=[MF] Кованая броня +itemGroup.MFGadgets=[MF] Изобретения +itemGroup.MFUtil=[MF] Полезные блоки +itemGroup.MFBows=[MF] Луки +itemGroup.MFMaterials=[MF] Материалы +itemGroup.MFadvancedtool=[MF] Продвинутые инструменты +itemGroup.MFcrafttool=[MF] Инструменты крафта +itemGroup.MFore=[MF] Руды +itemGroup.MFfood=[MF] Еда +itemGroup.MFOld=[MF] Примитивные инструменты +itemGroup.MFdragonforged=[MF] Оружие из драконьей стали +itemGroup.MFornate=[MF] Украшенная амуниция + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/FIRESTARTER/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.dryrocks.name=Сухие камни +item.tinderbox.name=Трутница + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/BANDAGE/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.bandage_crude.name=Грубая перевязка +item.bandage_wool.name=Шерстяная перевязка +item.bandage_tough.name=Отличная перевязка + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/TRAINING/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.training_sword.name=Тренировочный меч +item.training_waraxe.name=Тренировочный боевой топор +item.training_mace.name=Тренировочная булава +item.training_spear.name=Тренировочное копьё + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/LEATHER STUFF/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.hide_helmet.name=Сыромятный шлем +item.hide_chest.name=Сыромятный нагрудник +item.hide_legs.name=Сыромятные поножи +item.hide_boots.name=Сыромятные сапоги + +item.roughleather_helmet.name=Грубый кожаный шлем +item.roughleather_chest.name=Грубый кожаный нагрудник +item.roughleather_legs.name=Грубые кожаные поножи +item.roughleather_boots.name=Грубые кожаные сапоги + +item.strongleather_helmet.name=Укреплённый кожаный шлем +item.strongleather_chest.name=Укреплённый кожаный нагрудник +item.strongleather_legs.name=Укреплённые кожаные поножи +item.strongleather_boots.name=Укреплённые кожаные сапоги + +item.studleather_helmet.name=Клёпаный шлем +item.studleather_chest.name=Клёпаный нагрудник +item.studleather_legs.name=Клёпаные поножи +item.studleather_boots.name=Клёпаные сапоги + +item.scaleleather_helmet.name=Чешуйчатый шлем +item.scaleleather_chest.name=Чешуйчатый нагрудник +item.scaleleather_legs.name=Чешуйчатые поножи +item.scaleleather_boots.name=Чешуйчатые сапоги + +item.padded_helmet.name=Подбитый шлем +item.padded_chest.name=Подбитый нагрудник +item.padded_legs.name=Подбитые поножи +item.padded_boots.name=Подбитые сапоги + +item.leatherapron.name=Фартук кузнеца + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/WOOD STUFF/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.malletWood.name=Деревянная киянка +item.spoonWood.name=Деревянная ложка +item.paint_brush.name=Кисть + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/STONE STUFF/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.stone_pick.name=Каменная кирка +item.stone_axe.name=Каменный топор +item.stone_hoe.name=Каменная мотыга +item.stone_spade.name=Каменная лопата + +item.stone_knife.name=Каменный нож +item.stone_hammer.name=Каменный молот +item.stone_tongs.name=Каменные клещи +item.bone_needle.name=Костяная игла + +item.stone_sword.name=Каменный меч +item.stone_waraxe.name=Каменный боевой топор +item.stone_mace.name=Каменная булава +item.stone_spear.name=Каменное копьё + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/STANDARD/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +languagecfg.tooltiptier=true +//You can move the main tier to the tooltip if this is true, make sure to remove "%1$s " instnaces if you do this + +item.standard_pick.name=Кирка +item.standard_axe.name=Топор +item.standard_spade.name=Лопата +item.standard_hoe.name=Мотыга + +item.standard_shears.name=Ножницы +item.standard_knife.name=Нож +item.standard_needle.name=Игла +item.standard_hammer.name=Молот +item.standard_hvyhammer.name=Тяжёлый молот +item.standard_tongs.name=Клещи +item.standard_saw.name=Пила +item.standard_spanner.name=Гаечный ключ + + +item.standard_dagger.name=Кинжал +item.standard_sword.name=Меч +item.standard_mace.name=Булава +item.standard_waraxe.name=Боевой топор +item.standard_spear.name=Копьё + +item.standard_katana.name=Катана +item.standard_greatsword.name=Двуручный меч +item.standard_warhammer.name=Боевой молот +item.standard_battleaxe.name=Секира +item.standard_halbeard.name=Алебарда +item.standard_lance.name=Рыцарское копьё + +item.standard_handpick.name=Малая кирка +item.standard_hvypick.name=Тяжёлая кирка +item.standard_trow.name=Малая лопата +item.standard_hvyshovel.name=Тяжёлая лопата +item.standard_scythe.name=Коса +item.standard_mattock.name=Киркомотыга +item.standard_lumber.name=Топор дровосека + +item.standard_scale_helmet.name=Чешуйчатый шлем +item.standard_scale_chest.name=Чешуйчатый нагрудник +item.standard_scale_legs.name=Чешуйчатые поножи +item.standard_scale_boots.name=Чешуйчатые сапоги + +item.standard_chain_helmet.name=Кольчужный шлем +item.standard_chain_chest.name=Кольчужный нагрудник +item.standard_chain_legs.name=Кольчужные поножи +item.standard_chain_boots.name=Кольчужные сапоги + +item.standard_splint_helmet.name=Шинный шлем +item.standard_splint_chest.name=Шинный нагрудник +item.standard_splint_legs.name=Шинные поножи +item.standard_splint_boots.name=Шинные сапоги + +item.standard_plate_helmet.name=Латный шлем +item.standard_plate_chest.name=Латная кираса +item.standard_plate_legs.name=Латные поножи +item.standard_plate_boots.name=Латные сапоги + +item.standard_bow.name=Лук +item.standard_arrow.name=Стрела +item.standard_bolt.name=Болт + +item.standard_mallet.name=Киянка +item.standard_spoon.name=Ложка + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/DRAGONFORGE/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.dragonforged_pick.name=Драконокованая кирка +item.dragonforged_axe.name=Драконокованый топор +item.dragonforged_spade.name=Драконокованая лопата +item.dragonforged_hoe.name=Драконокованая мотыга + +item.dragonforged_shears.name=Драконокованые ножницы +item.dragonforged_knife.name=Драконокованый нож +item.dragonforged_needle.name=Драконокованая игла +item.dragonforged_hammer.name=Драконокованый молот +item.dragonforged_hvyhammer.name=Тяжёлый драконокованый молот +item.dragonforged_tongs.name=Драконокованые клещи +item.dragonforged_saw.name=Драконокованая пила +item.dragonforged_spanner.name=Драконокованый гаечный ключ + + +item.dragonforged_dagger.name=Драконокованый кинжал +item.dragonforged_sword.name=Драконокованый меч +item.dragonforged_mace.name=Драконокованая булава +item.dragonforged_waraxe.name=Драконокованый боевой топор +item.dragonforged_spear.name=Драконокованое копьё + +item.dragonforged_katana.name=Драконокованая катана +item.dragonforged_greatsword.name=Драконокованый двуручный меч +item.dragonforged_warhammer.name=Драконокованый боевой молот +item.dragonforged_battleaxe.name=Драконокованая секира +item.dragonforged_halbeard.name=Драконокованая алебарда +item.dragonforged_lance.name=Драконокованое рыцарское копьё + +item.dragonforged_handpick.name=Драконокованая малая кирка +item.dragonforged_hvypick.name=Тяжёлая драконокованая кирка +item.dragonforged_trow.name=Лёгкая драконокованая лопата +item.dragonforged_hvyshovel.name=Тяжёлая драконокованая лопата +item.dragonforged_scythe.name=Драконокованая коса +item.dragonforged_mattock.name=Драконокованая киркомотыга +item.dragonforged_lumber.name=Драконокованый топор дровосека + +item.dragonforged_scale_helmet.name=Драконокованый чешуйчатый шлем +item.dragonforged_scale_chest.name=Драконокованый чешуйчатый нагрудник +item.dragonforged_scale_legs.name=Драконокованые чешуйчатые поножи +item.dragonforged_scale_boots.name=Драконокованые чешуйчатые сапоги + +item.dragonforged_chain_helmet.name=Драконокованый кольчужный шлем +item.dragonforged_chain_chest.name=Драконокованый кольчужный нагрудник +item.dragonforged_chain_legs.name=Драконокованые кольчужные поножи +item.dragonforged_chain_boots.name=Драконокованые кольчужные сапоги + +item.dragonforged_splint_helmet.name=Драконокованый шинный шлем +item.dragonforged_splint_chest.name=Драконокованый шинный нагрудник +item.dragonforged_splint_legs.name=Драконокованые шинные поножи +item.dragonforged_splint_boots.name=Драконокованые шинные сапоги + +item.dragonforged_plate_helmet.name=Драконокованый бацинет +item.dragonforged_plate_chest.name=Драконокованый кираса +item.dragonforged_plate_legs.name=Драконокованые ножные латы +item.dragonforged_plate_boots.name=Драконокованые латные сапоги + +item.dragonforged_bow.name=Драконокованый лук + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/ORNATE/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.ornate_pick.name=Украшенная кирка +item.ornate_axe.name=Украшенный топор +item.ornate_spade.name=Украшенная лопата +item.ornate_hoe.name=Украшенная мотыга + +item.ornate_shears.name=Украшенные ножницы +item.ornate_knife.name=Украшенный нож +item.ornate_needle.name=Украшенная игла +item.ornate_hammer.name=Украшенный молот +item.ornate_hvyhammer.name=Тяжёлый украшенный молот +item.ornate_tongs.name=Украшенные клещи +item.ornate_saw.name=Украшенная пила +item.ornate_spanner.name=Украшенный гаечный ключ + +item.ornate_dagger.name=Украшенный кинжал +item.ornate_sword.name=Украшенный меч +item.ornate_mace.name=Украшенная булава +item.ornate_waraxe.name=Украшенный боевой топор +item.ornate_spear.name=Украшенное копьё + +item.ornate_katana.name=Украшенная катана +item.ornate_greatsword.name=Украшенный двуручный меч +item.ornate_warhammer.name=Украшенный боевой молот +item.ornate_battleaxe.name=Украшенная секира +item.ornate_halbeard.name=Украшенная алебарда +item.ornate_lance.name=Украшенное рыцарское копьё + +item.ornate_handpick.name=Украшенная малая кирка +item.ornate_hvypick.name=Украшенная тяжёлая кирка +item.ornate_trow.name=Украшенная лопата +item.ornate_hvyshovel.name=Украшенная тяжёлая лопата +item.ornate_scythe.name=Украшенная коса +item.ornate_mattock.name=Украшенная киркомотыга +item.ornate_lumber.name=Украшенный топор дровосека + +item.ornate_scale_helmet.name=Украшенный чешуйчатый шлем +item.ornate_scale_chest.name=Украшенный чешуйчатый нагрудник +item.ornate_scale_legs.name=Украшенные чешуйчатые поножи +item.ornate_scale_boots.name=Украшенные чешуйчатые сапоги + +item.ornate_chain_helmet.name=Украшенный кольчужный шлем +item.ornate_chain_chest.name=Украшенный кольчужный нагрудник +item.ornate_chain_legs.name=Украшенные кольчужные поножи +item.ornate_chain_boots.name=Украшенные кольчужные сапоги + +item.ornate_splint_helmet.name=Украшенный шинный шлем +item.ornate_splint_chest.name=Украшенный шинный нагрудник +item.ornate_splint_legs.name=Украшенные шинные поножи +item.ornate_splint_boots.name=Украшенные шинные сапоги + +#Нет перевода слова Armet, оставил шлем. +item.ornate_plate_helmet.name=Украшенный латный шлем +item.ornate_plate_chest.name=Украшенная кираса +item.ornate_plate_legs.name=Украшенные ножные латы +item.ornate_plate_boots.name=Украшенные латные сапоги + +item.ornate_bow.name=Украшенный лук + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/ARTEFACT/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +stat.artefact.name=Артефакт +item.ancient_jewel.name=Древнее сокровище +item.trilogy_jewel.name=Тройное сокровище + +item.schem_gears.name=Чертежи механизмов механической брони +item.schem_forge.name=Чертежи продвинутого горна +item.schem_cogwork.name=Чертежи корпуса механической брони +item.schem_bomb.name=Чертежи гномьей бомбы +item.schem_crossbow.name=Чертежи гномьего арбалета +item.schem_alloy.name=Чертежи композитного металла +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/FOOD/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.berries.name=Ягоды +item.berriesJuicy.name=Сочные ягоды +item.generic_meat_uncooked.name=Сырое обычное мясо +item.generic_meat_cooked.name=Приготовленное обычное мясо +item.generic_meat_strip_uncooked.name=Сырые мясные полоски +item.generic_meat_strip_cooked.name=Приготовленные мясные полоски +item.generic_meat_chunk_uncooked.name=Сырые мясные кусочки +item.generic_meat_chunk_cooked.name=Приготовленные мясные кусочки +item.generic_meat_mince_uncooked.name=Сырой фарш +item.generic_meat_mince_cooked.name=Приготовленный фарш +item.burnt_food.name=Сгоревшая еда +item.burnt_pot.name=Сгоревшая еда +item.burnt_cake.name=Сгоревший торт +item.burnt_pie.name=Сгоревший пирог + +tile.berries.name=Ягодный куст +item.breadcrumbs.name=Хлебные крошки +item.breadroll.name=Рулет +item.breadslice.name=Кусочек хлеба +item.horse_raw.name=Сырая конина +item.horse_cooked.name=Приготовленная конина +item.wolf_raw.name=Сырая волчатина +item.wolf_cooked.name=Приготовленная волчатина +item.mutton_raw.name=Сырая баранина +item.mutton_cooked.name=Приготовленная баранина +item.spider_raw.name=Сырое паучье мясо +item.spider_cooked.name=Приготовленное паучье мясо + +item.bowl_water_salt.name=Солёная вода +item.salt.name=Соль +item.cake_tin.name=Форма для торта +item.pie_tin.name=Форма для пирога +item.pie_tray_uncooked.name=Необожжённая форма для пирога +item.flour.name=Мука +item.sugarpot.name=Сахарница +item.bread_uncooked.name=Хлебная заготовка +item.guts.name=Кишки + +item.raw_bread.name=Сырой хлеба +item.dough.name=Тесто +item.pastry.name=Тесто для торта +item.stew.name=Тушёнка +item.oats.name=Овёс + +item.curds.name=Творог +item.cheese_pot.name=Горшок сыра + +item.jerky.name=Вяленое мясо +item.cheese_roll.name=Сырный рулет +item.sweetroll.name=Сладкий рулет +item.sandwitch.name=Бутерброд + +tile.pie_meat.name=Мясной пирог +tile.pie_apple.name=Яблочный пирог +tile.pie_berry.name=Ягодный пирог +tile.pie_shepards.name=Пастуший пирог + +item.meatpie_slice.name=Кусок мясного пирога +item.pieslice_apple.name=Кусок яблочного пирога +item.pieslice_berry.name=Кусок ягодного пирога +item.pieslice_shepards.name=Кусок пастушьего пирога + +item.chicken_roast.name=Жаркое с курицей +item.pork_roast.name=Жаркое со свининой +item.beef_roast.name=Жаркое с говядиной +item.mutton_roast.name=Жаркое с бараниной + +tile.cake_vanilla.name=Торт +tile.cake_carrot.name=Морковный торт +tile.cake_chocolate.name=Шоколадный торт +tile.cake_bf.name=Торт "Чернолесье" + +item.cake_slice.name=Кусок торта +item.carrotcake_slice.name=Кусок морковного торта +item.choccake_slice.name=Кусок шоколадного торта +item.bfcake_slice.name=Кусок "Чернолесья" + +item.coca_powder.name=Какао-порошок +item.chocolate.name=Шоколадный +item.chocchips.name=Шоколадные кусочки +item.eclair.name=Эклер +item.eclair_raw.name=Эклерное тесто +item.eclair_uniced.name=Свежеиспечённый эклер +item.eclair_empty.name=Пустой эклер +item.saussage_cooked.name=Приготовленная сосиска +item.saussage_raw.name=Сырая сосиска +tile.cheese.name=Сырная голова +item.cheese_slice.name=Кусок сыра +item.sushi.name=Суши +item.curry.name=Карри +item.pizza_basic.name=Пицца +item.sweetroll_raw.name=Тесто для сладкого рулета +item.sweetroll_uniced.name=Свежеиспечённый сладкий рулет +item.icing.name=Сахарная глазурь +item.custard.name=Заварной крем + +item.cake_raw.name=Жидкое тесто для торта +item.cake_simple_raw.name=Жидкое тесто простого торта +item.cake_carrot_raw.name=Жидкое тесто морковного торта +item.cake_choc_raw.name=Жидкое тесто шоколадного торта +item.cake_bf_raw.name=Жидкое тесто торта "Чернолесье" + +item.cake_uniced.name=Свежеиспечённый торт +item.cake_simple_uniced.name=Свежеиспечённый простой торт +item.cake_carrot_uniced.name=Свежеиспечённый морковный торт +item.cake_choc_uniced.name=Свежеиспечённый шоколадный торт +item.cake_bf_uniced.name=Свежеиспечённое "Чернолесье" + +item.pie_meat_uncooked.name=Тесто мясного пирога +item.pie_apple_uncooked.name=Тесто яблочного пирога +item.pie_berry_uncooked.name=Тесто ягодного пирога +item.pie_shepard_uncooked.name=Тесто пастушьего пирога +item.pie_pumpkin_uncooked.name=Тесто тыквенного пирога + +item.pie_meat_cooked.name=Приготовленный мясной пирог +item.pie_apple_cooked.name=Приготовленный яблочный пирог +item.pie_berry_cooked.name=Приготовленный ягодный пирог +item.pie_shepard_cooked.name=Приготовленный пастуший пирог +item.pie_pumpkin_cooked.name=Приготовленный тыквенный пирог + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/FOOD STATS/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +food.stat.list.name=При поедании: +food.stat.hunger.name=+%1$s сытости +food.stat.staminaPlus.name=Восстанавливает %1$s выносливости +food.stat.staminabuffHours.name=Бонус %1$s выносливости на %2$s ч. +food.stat.staminabuffMinutes.name=Бонус %1$s выносливости на %2$s мин. +food.stat.staminabuffSeconds.name=Бонус %1$s выносливости на %2$s сек. +food.stat.saturationMinutes.name=Насыщение на %1$s мин. +food.stat.saturationSeconds.name=Насыщение на %1$s сек. +food.stat.saturation.name=Насыщение: %1$s pts +food.stat.staminabuffRegenMinutes.name=Восстанавливает %1$s выносливости/сек на %2$s мин. +food.stat.staminabuffRegenSeconds.name=Восстанавливает %1$s выносливости/сек на %2$s сек. +food.stat.cure.poison=Лечит отравление + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/CONSTRUCTION/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.hinge.name=Петля +item.commodity_plank_cut.name=Распиленный %1$s брусок +item.commodity_plank_pane.name=%1$s брусчатая панель + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/RPG/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +rpg.levelup=Ваш навык %1$s повысился до %2$s уровня. +rpg.required=Требует "%2$s" ур. %1$s +rpg.skillmod=Модификатор умения: + + +skill.lowskill=Ваш навык недостаточно высок! +skill.value=Уровень %1$s + +skill.list.basic=Основные навыки +skill.list.craft=Навыки крафта +skill.list.combat=Боевые навыки + +skill.artisanry.name=Кузнечное дело +skill.construction.name=Строительное дело +skill.provisioning.name=Ремесло снабжения +skill.engineering.name=Инженерное дело +skill.combat.name=Мастерство + +item.skillbook_artisanry.name=Искусство кузнечного дела +item.skillbook_artisanry.desc=+%1$s к кузнечному делу +item.skillbook_construction.name=Секреты строительства +item.skillbook_construction.desc=+%1$s к строительному делу +item.skillbook_provisioning.name=Накорми деревню +item.skillbook_provisioning.desc=+%1$s к ремеслу снабжения +item.skillbook_engineering.name=Продвинутые механизмы +item.skillbook_engineering.desc=+%1$s к инженерному делу +item.skillbook_combat.name=Смешанные боевые тактики +item.skillbook_combat.desc=+%1$s к мастерству + +item.skillbook_artisanry2.name=Кузнецы спустя века +item.skillbook_artisanry2.desc=Максимальный уровень кузнечного дела +item.skillbook_construction2.name=Секреты инженера +item.skillbook_construction2.desc=Максимальный уровень строительного дела +item.skillbook_provisioning2.name=История Торговли +item.skillbook_provisioning2.desc=Максимальный уровень ремесла снабжения +item.skillbook_engineering2.name=Лексикон инженера +item.skillbook_engineering2.desc=Максимальный уровень инженерного дела +item.skillbook_combat2.name=Повесть о великой войне +item.skillbook_combat2.desc=Максимальный уровень мастерства +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/KNOWLEDGE INFORMATION/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +method.workbench=Базовый верстак +method.furnace=Выплавка +method.bloomery=Домница +method.blastfurnace=Доменная печь +method.anvil=Наковальня +method.carpenter=Плотницкий верстак +method.crucible=Тигель +method.crucibleT2=Огнеупорный тигель +method.crucibleT3=Мифический тигель +method.crucibleT4=Мастерский тигель +method.quern=Ручная мельница +info.hasKnowledge=Можно изучить + +gui.purchase=Покупка +knowledge.guiSubtitle=Это GUI +knowledge.basicstructure=Базовая структура +knowledge.example=Пример +knowledge.rightclickspanner=ПКМ гаечным ключом +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/KNOWLEDGE TEXT/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +knowledge.title= +knowledge.title.desc= +knowledge.title.1= + +knowledge.minotaurs=Минотавр +knowledge.minotaurs.desc=Ужасные монстры + +knowledge.minotaurs.1=Немногие существа могут тягаться с минотаврами силой и яростью. Легенда гласит, что эти существа были людьми и коровами, пока не стали тем, чем являются сейчас. Минотавры всеядные и достаточно вспыльчивые существа.^Минотавры чрезвычайно сильны и быстры - они способны мгновенно убить зазевавшуюся жертву, так же они удивительно быстро восстанавливаются после ранений. Минотавры не обладают высоким интеллектом, однако, некоторые из них собираются в группы и живут согласно строгой иерархии. +knowledge.minotaurs.2=$hLesser Minotaur-$r^It may be common sight to see lesser minotaurs in the wild proving a threat to those unfortunate enough to come close.^These creatures are little more than beasts yet provide a misconception of actual minotaur behavior. Lesser minotaurs either have no home or are set out to scavenge for their greater counterparts. +knowledge.minotaurs.3=$hGreater Minotaur-$r^Greater minotaurs are found dwelling in dwarven complexes underground providing a challenge to explorers.^The minotaurs that are housed within these ruins are more organised and deadly. Standard minotaur warriors are brutal and armed while the elite and warlords that can be found deeper within ruins are powerful foes. It shall be made clear that ruins should be explored only by the prepared. One warrior may prove a challenge, but a group? few have survived. +knowledge.minotaurs.4=$hSpecies-$r^There are three known species of minotaur found in both wild and ruin. There is no difference to the behavior or living patterns of minotaurs of different species but physical properties do vary. +knowledge.minotaurs.combat=$hCombat-$r^The best advice that could be given to fighting off a minotaur would be range. Don't let them get close enough to hit you, even the strongest armour buckles under the force of their fury. Many minotaurs are heavily armoured as well but both hide and plate are vulnerable to piercing attacks a spear would be capable of exploiting both these weaknesses. Spears, explosives, distance and heavy armour give the best chances of survival. + +knowledge.mob.minotaur.name=Коричневый минотавр + +knowledge.minotaur.1=В основном, в нашем мире обитает именно этот вид минотавров. Они чрезвычайно сильны, быстры, выносливы. Обычным минотаврам недостаёт интеллекта, и они бесцельно бродят по миру. +knowledge.minotaur.1=Brown-fur minotaurs are the more common species in the overworld. They are found to have excessive strength and prove to be a powerful foe. Standard minotaurs have no natural armour but are still hard to kill. + +knowledge.mob.minotaur_frost.name=Снежный минотавр + +knowledge.minotaur_frost.1=Обитает в холодных регионах. Эти минотавры считаются более опасными, чем коричневые. Минотавра-альбиноса очень трудно заметить в снежной местности, что создаёт проблему для всех путешественников. +knowledge.minotaur_frost.1=Found in colder regions, these Minotaurs appear to have thicker hide than the brown minotaurs, resulting in natural armour. The Albino minotaur is difficult to see in the snow and can unleash a devistating rage on the unsuspecting traveller. + +knowledge.mob.minotaur_dread.name=Яростный минотавр + +knowledge.minotaur_dread.1=Доподлинно неизвестно, кто начал их так называть. Жители Нижнего Мира вооружённые железным оружием, яростно патрулирующие пустоши. Удивительно, но когда их несколько, они действуют сообща. +knowledge.minotaur_dread.1=Not as much is known about what some call the Dread Minotaur. Denizens of the nether, dark-grey or black fur, powerfully thick skin, and immunity to fire. This species are far hardier than their overworld cousins. + +knowledge.dragons=Драконы +knowledge.dragons.desc=Смерть с небес + +knowledge.dragons.1=Драконы гордые, но разрушительные рептилии, высматривающие свою добычу сверху. В мире есть достаточно много видов драконов, сильно различающися своими способностями. Поглядывайте в небо и будьте внимательны в своих путешествиях во избежание фатальных столкновений.^Каждый дракон, несомненно, опасен способностью изрыгать смертоносные вещества. + +knowledge.dragons.2=Чем старше дракон, тем он опаснее. Кожа этих рептилий неимоверно прочная, поэтому многое оружие может быть бесполезно в борьбе с ними. Оружие из драконьей стали наоборот, очень даже эффективно против драконов.^ Драконы охотятся за сердцами павших сородичей, которые могут быть использованы специально обученными кузнецами. Сердца молодых драконов не подходят для создания чего-либо, поэтому следует охотиться на взрослых особей, если Вы встали на путь драконоборца. + +knowledge.mob.red_dragon.name=Красный дракон +knowledge.red_dragon.1=Самый распространённый вид, имеет способность изрыгать пламя. Не один человек пал жертвой таких драконов, и не одна деревня исчезла в их огне. + +knowledge.mob.blue_dragon.name=Ледяной дракон +knowledge.blue_dragon.1=Обитающие в очень холодных регионах, эти драконы научились изрыгать ледяные ветры, замораживающие врагов. Ледяные драконы не несут особых разрушений как красные драконы, но считаются более опасными. + +knowledge.mob.green_dragon.name=Зелёный дракон +knowledge.green_dragon.1=Зелёные драконы так же известны как "Ядовитые драконы". Они обитают в наиболее влажных местностях типа болот, озёр и морей. Способны изрыгать кислоту, разъедающую броню и отравляющую жертву. + +knowledge.mob.ash_dragon.name=Ash Dragon +knowledge.ash_dragon.1=Ash dragons are found in the hot and dry such as deserts and can be easily identified by their two legs (rather than four). Ash dragons are blind, and require the use of sound and smell to track their target. keep your distance and remain quiet to avoid attack. + +knowledge.dragons.combat=$hCombat-$r^Dragons may be fast and have the sky advantage, but they have a few weaknesses to exploit. Firstly is the ability to leave and return the battlefield, you are best to pay attention and avoid losing sight of your foe. As the dragon swoops, make your strike. A proerly lined ranged attack will grant an advantage when it takes off again. As well as that: specialised dragonforged items may be crafted to give an edge to the battle. + +knowledge.gettingStarted=Начало развития +knowledge.gettingStarted.desc=С нуля + +knowledge.gettingStarted.1=Отсюда и пойдёт Ваше изучение мода MineFantasy. Для начала, рекомендуется создать хотя бы простенькое убежище, а так же запастись деревом, углём, медью, шкурами и камнем. Для жизни в этом мире придётся научиться трём действиям. +knowledge.gettingStarted.2=Изготовление блоков требует особых взаимодействий. Сначала выстройте рецепт так, как это требуется (для наковален придётся нагревать некоторые ресурсы). Затем выберите соответствующий инструмент с нужным уровнем(такой как ваши руки, ножи, молоты и т.д.). Затем нужно щёлкнуть по блоку этим инструментом, удерживая нажатой клавишу как минимум секунду до готовности продукта Вашей деятельности. + +knowledge.gettingStarted.hcc=$hКаменный век-$r^ Ванильные инструменты выключены, инструменты делаются из камня по специальным рецептам, а также куются. Рецепты кованых инструментов находятся в разделе кузнечного дела.^Для получения острых камней необходимо разбить рукой блок камня (не держа в руке никаких предметов) Используйте острый камень в руке чтобы добыть лозу из блоков листвы, а также для получения палок. + +knowledge.gettingStarted.fire=$hКостёр$r^Перед тем, как начать работать, вам потребуется костёр, который обеспечит вас огнём и позволит пожарить немного мяса.^Подкиньте дров (любых пиломатериалов) ПКМ, затем разожгите огонь сухими камнями или трутницей. +knowledge.gettingStarted.food=Для готовки разместите плиту или каменную печь над костром. Размещать еду (в основном, сырое мясо) можно при помощи ПКМ.^Приятного аппетита! + +knowledge.gettingStarted.carpenter=$hСтол плотника$r^ Это базовый стол для создания ваших поделок. Для его использования потребуется множество инструментов, включая ваши голые руки. + +knowledge.gettingStarted.tanning=$hДубление$r^Это способ переработки шкур в кожу. ^Для начала соберите непрочный станок для обработки кожи и каменный нож. Это не самые лучшие инструменты и их стоило бы улучшать в дальнейшем. + +knowledge.gettingStarted.forging=$hКовка$r^Это основной вид крафта. Для начала стоит сделать каменный горн, наковальню и необходимые инструменты. Располагайте наковальню возле воды и горна. Вкладка кузнечного ремесла содержит исчерпывающую информацию по ковке. Убедитесь в наличии базовых инструментов для добычи огня (Сухие камни), и кузнечного фартука! + +knowledge.gettingStarted.forgingbars=Большинство рецептов требует использование чушек, а не слитков. Чушка - это простой компонент, изготавливаемый из металла. Нужно лишь положить слиток на наковальню и немного поработать молотком. Таким же способом вы сможете изготовить слиток из чушки. +knowledge.gettingStarted.flux=Флюс - важный реактив для очистки металлов. В первую очередь он используется для обработки металлов в процессе ковки, так же он потребуется для некоторых сплавов. Так же он пригодится при крафте кусков и пластин металлов, для некоторых инструментов и брони.^Лучший источник флюса - известняк. Старайтесь запасаться им! +knowledge.gettingStarted.3=Для изготовления инструментов понадобятся кожаные полосы. Для этого изготовьте медные ножницы. +knowledge.gettingStarted.4=Благодаря им, Вы можете разрезать кожу на полосы на плотницком верстаке или прямо на дубильном станке. + +knowledge.gettingStarted.5=Теперь у вас есть доступ ко всему необходимому, чтобы наконец улучшить свой каменный молот. + +knowledge.gettingStarted.6=С установленным горном можно выковать медные инструменты. Проверьте секцию кованых инструментов для просмотра альтернатив медному инструментарию. + +knowledge.gettingStarted.upgrade=$hUpgrading-$r^ Книга и стол исследований помогут вам постичь новые рецепты и умения, но перед этим нужно создать стол исследований. + +knowledge.gettingStarted.7=Этот стол позволяет превратить свитки исследований в завершённые исследования. Однако для этого Вам надо где-то достать свиток. ^Откройте свою книгу - в ней находится большое количество доступных исследований, подсвеченных зелёным цветом. Попробуйте к примеру технологию изготовления лёгкой брони на вкладке кузнечного ремесла. + + +knowledge.gettingStarted.10=Во множестве ремёсел вам придётся столкнуться с порошками, которые вы будете делать при помощи ручной мельницы. + +knowledge.gettingStarted.11=Попробуйте работать с бронзой, тигли, как Вы видите, уже доступны Вам. Для этого Вам необходим 5 уровень кузнечного дела. ^Как только вы изучили основы работы с бронзой, улучшите свои инструменты и приготовьтесь к последующему прогрессу! + +knowledge.gettingStarted.12=$hРазборка$r^Вы можете создать верстак для разборки предметов.^С его помощью можно разобрать большинство предметов (Vanilla и MineFantasy), но с некоторыми потерями. +knowledge.gettingStarted.13=Для использования просто бросьте предмет на разборочный верстак и нажмите ПКМ по нему. + +knowledge.dust=Мельница +knowledge.dust.desc=Изготовление порошков +knowledge.dust.1=Вы можете держать в руках сыпучие вещества, но как предотвратить их просыпание? Глиняные горшки подойдут для хранения порошков, большинство из которых изготавливается с помощью ручной мельницы, в то время как некоторые рецепты могут потребовать иных орудий. Например: +knowledge.dust.quern=Как использовать мельницу: всё что Вам нужно, это поместить горшочек в середину, подходящий ресурс сверху, и нажимать ЛКМ-ПКМ по мельнице. +knowledge.dust.icing=Некоторые рецепты для еды требуют ложки, а не пестика. + +knowledge.research=Книга исследований +knowledge.research.desc=Следим за продвижением + +knowledge.research.1=В этой книге содержится большинство знаний, начиная с кулинарных рецептов, и заканчивая сложными типами брони. Исследование есть способ найти нечто скрытое в мире и использовать в своих работах. Большинство того ,что Вы могли бы сделать, должно быть изучено, и при надлежащем уровне ремесла секрет будет раскрыт.^Для начала, стоит сделать исследовательскую станцию. Ваш навык и предметы исследований откроют Вам новые знания. + +//Table recipe + +knowledge.research.2=При наличии стола исследований, у Вас появится возможность изучать Mine Fantasy раздел за разделом. С версией 2.8 поменялась система изучений с привычных свитков на изучение предметов. Чтобы изучить что-то, положите в стол предмет с пометкой "Можно изучить", и нажимайте ЛКМ-ПКМ. Помните - для того, чтобы изучить что-то, возможно, нужен более высокий уровень определённого ремесла. + +knowledge.carpenter=Стол плотника +knowledge.carpenter.desc=Простой крафт +knowledge.carpenter.1=В основном тут происходит крафт, связанный с деревом. Для крафта на этом столе используется множество различных инструментов. Для его использования сложите рецепт и медленно кликайте по столу нужным инструментом. + +knowledge.salvage=Верстак для разборки предметов +knowledge.salvage.desc=Всегда перерабатывайте! +knowledge.salvage.1=Если у вас есть ненужные вещи, которые вы не используете, да и выбросить жалко, Вы можете разобрать их на составные части. ^Вы можете разобрать только ванильные предметы и предметы из MF. +knowledge.salvage.2=Для разбора просто бросьте предмет наверх столика и нажмите ПКМ по нему. Помните, что есть шанс порчи и пропажи некоторых компонентов! +knowledge.salvage.3=Использование молота или пилы при разборке увеличивает шанс получения составных компонентов. + +knowledge.talisman=Талисманы знаний +knowledge.talisman.desc=Читаем легко! +knowledge.talisman.1=Обычно для получения знаний используется стол исследований, но это занимает много времени и требует много усилий. Талисманы ускоряют этот процесс при помощи клика ПКМ по столу с талисманом в руке. +knowledge.talisman.2=Большие талисманы очень редки, но имеют бесконечное количество использований. + +knowledge.commodities=Повседневные вещи +knowledge.commodities.desc=Разные полезности +knowledge.commodities.1=Это базовые вещи, не являющиеся мусором.^^Иными словами, они часто используются в рецептах, поэтому их стоит хранить в достаточных количествах. + +knowledge.commodities.plank=Бруски - это прекрасные, крупные куски древесины, которые используются практически везде. + +knowledge.commodities.refinedplank=Древесина может быть обработана, что повышает её качество. Она используется для более продвинутых вещей. + +knowledge.commodities.flux=Флюс часто используется для обработки металлов. Стандартный флюс используется в очистных печах, в то время как насыщенный флюс используют для получения продвинутых сплавов. + +knowledge.commodities.hunks=Куски металла используются для небольших вещей. Они делаются из слитков и могут быть превращены обратно в слитки. + +knowledge.commodities.nail=Гвозди - базовая вещь для работы с деревом. Для их создания необязательно изучать технологию изготовления железных вещей. + +knowledge.commodities.rivet=Заклёпки сходны с гвоздями, но применяются в работе с металлом. + +knowledge.commodities.leatherstrip=Полоски кожи используются при изготовлении инструментов. + +knowledge.commodities.thread=Волокно используется в швейных рецептах и может быть превращено в нить. + +knowledge.commodities.bucket=Вёдра делаются из металла. Чем выше уровень металла, тем больше вёдер. + +knowledge.plants=Фитоценоз +knowledge.plants.desc=Органические ресурсы +knowledge.plants.1=Бросьте взгляд на поверхность! Здесь, в растениях, скрыто множество полезных ресурсов!^Здесь вы можете найти список растений, которые не дадут вам погибнуть от голода и обеспечат полезными ресурсами. +knowledge.plants.2=Деревья дают вам различные виды древесины, причём каждый из них лучше для определённых целей. Здесь приведён список деревьев, которые вы встретите в мире. +knowledge.yew.1=Тис очень распространён в лесах, чаще всего вы встретите одиночные деревья. Свойства тиса лучше, чем у любого другого дерева, но ещё из него получаются превосходные луки. + +knowledge.ironbark.1=Этот вид эвкалипта - узнаваемое дерево, которое редко можно встретить в лесах, его грубая серая кора с оранжеватой древесиной сильно выделяется. Его древесина достаточно прочна и подходит для создания крепких предметов. + +knowledge.ebony.1=Эбеновое дерево - огромное и редкое. Они встречаются в умеренном климате и дают крепчайшую древесину, узнать их можно по размеру и специфическому цвету коры. + +knowledge.berry=Ягоды +knowledge.berry.desc=Здоровый перекус +knowledge.berry.1=Ягоды растут во всём мире, но только при условии наличия подходящих влажности и температуры. Чаще всего вы можете найти их в лесах.^Сочные (фиолетовые) ягоды менее распространены и ядовиты. + +knowledge.ores=Руды и минералы +knowledge.ores.desc=Полезные ресурсы +knowledge.ores.1=Есть некое количество генерируемых руд. Все можно так или иначе переплавить в слитки. +knowledge.ores.copper=Медная руда встречается между уровнями 48-96. Её можно легко переплавить в слитки и перековать их в инструменты.^Также медь используется для получения бронзы. +knowledge.ores.tin=Олово встречается в два раза реже меди и в том же ареале высот.^Переплавляется в слитки для дальнейшего получения бронзы. +knowledge.ores.silver=Серебро находится в том же ареале высот, что и золото. Вначале оно не очень полезно, но впоследствии оно может стать очень нужным материалом. +knowledge.ores.wolframite=Вольфрамит - редкий металл, используемый для высокотехнологичных инженерных изысканий. Может быть найден в слоях <16 Y, в одиночных жилах. +knowledge.ores.mythic=Мало кто знает о "мифиевой руде", что находится в слоях коренной породы. Эта руда издаёт странные звуки, но неизвестно по какой причине. + +knowledge.ores.2=Минералы также генерируются в мире, но в отличие от руд они не могут быть переплавлены в слитки. +knowledge.minerals.clay=Также как и песок, глина может быть найдена возле земли. Также можно найти глиносодержащие почвы. +knowledge.minerals.kaolinite=Колинит имеет специфическое использование - в смеси с глиной он увеличивает прочность кирпичей. +knowledge.minerals.limestone=Известняк - хороший источник флюса, генерирующийся крупными залежами. +knowledge.minerals.borax=Являющийся относительно редким минералом, боракс превосходный источник обогащённого флюса. +knowledge.minerals.nitre=Селитра часто встречается в пещерах и используется для изготовления взрывчатки. +knowledge.minerals.sulfur=Сера встречается глубого под землёй рядом со скоплениями лавы и используется для изготовления взрывчатки. + +knowledge.chimney=Дым и трубы +knowledge.chimney.desc=Я... задыхаюсь? + +knowledge.chimney.1=Неоспоримым фактом является то, что сжигание топлива производит газ. А ещё то, что дышать им не очень-то и полезно для Ваших лёгких. В любом случае, трубы помогут + +knowledge.chimney.2=убрать дым от вас и направить его высоко в небо! Оставьте его для тех, кто будет погибать от парникового эффекта парой сотен лет позже. + +knowledge.chimney.3=Вытяжные трубы таже могут быть использованы для непрямого поглощения газа. ^Это значит, что они смогут отводить дым в пределах одного блока над его источником. + +knowledge.chimney.pipe=Дымовые трубы могут транспортировать газ по всей системе. Труба должна быть присоединена к дымоходу, иначе она вытягивать дым не будет. + +knowledge.chimney.pipe.2=Лучше всего ставить трубы поверх устройства(пр. домница), чтобы ремесленнику они не мешали в работе. + +knowledge.tanning=Выделка шкур +knowledge.tanning.desc=И мёртвые животные могут послужить + +knowledge.tanning.1=Кожа является очень ценным ресурсом, потому что она нужна практически для всего. ^Выделка кожи - это простой метод очистки сырой шкуры до состояния, в котором она становится пригодной для использования.^ Для этого понадобятся дубильный станок и нож. + +knowledge.tanning.2=Для выделки кожи её необходимо сначала очистить. Кликните со шкурой в руках ПКМ по воде или же соедените её с флюсом в сетке крафта. После очистки поместите шкуру на дубильный станок и обработайте её ножом. + +knowledge.stamina=Механика выносливости +knowledge.stamina.desc=Держи себя в форме! + +knowledge.stamina.1=Не так уж просто бегать целый день или махать киркой в шахте, и механика выносливости проследит за этим.^Выносливость отображается зелёной шкалой внизу экрана и уменьшается при определённых действиях. Восстанавливается она сама собой, но скорость её восстановления зависит от экипированных вещей, а также от еды из мода. + +knowledge.combat=Боевая механика +knowledge.combat.desc=Чуть больше возможностей убить ближнего своего + +knowledge.combat.1=Вы могли заметить, что простое махание мечом перестало быть эффективным. Сражения теперь были модифицированы и используют более сложные техники боя.^Между прочим, эти техники могут использовать не только люди, но и вооружённые монстры, а значит, что зомби с мечом теперь куда опаснее. + +knowledge.parry.info=$hПарирование и блокирование$r^Удерживая ПКМ с большей частью оружия в руках, вы блокируете. Однако теперь блок стал куда эффективнее. Когда вы блокируете прямую атаку, Вы снижаете урон от атак, и иногда вовсе можете свести его к нулю. Клинковые виды оружия лучше всего справляются с этой задачей. ^Рекомендуется блокировать удары, а не принимать их открытой грудью, это может спасти Вам жизнь.^ Однако атака после парирования имеет уменьшенный урон. + + +knowledge.advparry.info=$hУмение парирования$r^Если парирование удалось, а Вы держите shift, Вы продвинетесь вперёд, и возможно даже за спину оппонента, что позволит Вам нанести свой удар. Это потребляет выносливость, но может дать Вам шанс перехватить инициативу в бою. Это возможно также и в прыжке. + +knowledge.poweratt.info=$hСиловые атаки$r^Удерживая shift в падении, Вы можете нанести силовую атаку, увеличивающую урон и пробивающую блок, но потребляющую выносливость. Также попытка силового удара может быть прервана получением урона. + +knowledge.dodge.info=$hУклонение$r^В некоторых случаях, лучше избежать удар противника. Если Вы маневрируете из стороны в сторону или отступаете в защите, Вы выполните быстрый отскок. Это умение расходует выносливость и невыполнимо в тяжёлой броне. + +knowledge.armour.info=$hВыбор брони$r^Есть три основных типа брони - лёгкая, средняя, тяжёлая. Если Вы хотите быстро передвигаться и маневрировать в бою, используйте лёгкую броню. Если нужна максимальная защита, подойдёт тяжёлая броня. Средняя броня сочетает хорошую защиту и подвижность. + +knowledge.blade.info= +knowledge.fastblade.info= +knowledge.axe.info= +knowledge.blunt.info= +knowledge.polearms.info= + +knowledge.bar=Чушки +knowledge.bar.desc=Стандартизированная форма +knowledge.bar.1=Слитки могут использоваться для грубых поделок и торговли, но они слишком крупные для ковки. Решение - чушки. Они просты в обработке, их легко переплавить, можно поставить производство на поток!.^Чушки могут быть переделаны в слитки таким же способом. + +knowledge.smeltCopper=Работа с медью +knowledge.smeltCopper.desc=Уровень %1$s, обычный материал +knowledge.smeltCopper.1=Это Ваш первый материал на тернистом пути постижения премудростей кузнечного ремесла.^Да, Вы делаете мусор, но зато он Ваш! + +knowledge.smeltBronze=Работа с бронзой +knowledge.smeltBronze.desc=Уровень %1$s, обычный материал +knowledge.smeltBronze.1=Смешивая медь с оловом, Вы получаете бронзу. Этот сплав намного лучше меди. + +knowledge.smeltIron=Работа с железом +knowledge.smeltIron.desc=Уровень %1$s, обычный материал +knowledge.smeltIron.1=Железо очень распространённая руда, что делает её очень полезной. Железные орудия не очень хороши, но лучше бронзовых. +knowledge.smeltIron.2=Выплавка железа в слитки готовые к ковке не такая уж и сложная задача, но определённый уровень ремесла используется для нормальной работы. Вы усвоили пару уроков кузнечного дела, чтобы делать железные инструменты. + +knowledge.smeltPig=Чугун +knowledge.smeltPig.desc=Переработка железа +knowledge.smeltPig.1=Железо имеет много недостатков, но очистная печь позволяет устранить их.^Чугун используется для создания стали. + +knowledge.smeltSteel=Работа со сталью +knowledge.smeltSteel.desc=Уровень %1$s, обычный материал +knowledge.smeltSteel.1=Наконец-то Вы получили очень хороший, но вместе с тем дорогой материал.^Сталь делается путём перековки на наковальне или выплавки в огнеупорном тигле. Она - Ваш лучший друг!. + +knowledge.smeltEncrusted=Инкрустирование +knowledge.smeltEncrusted.desc=Уровень %1$s, экзотический материал +knowledge.smeltEncrusted.1=Почему бы не использовать эффективнось стали совместно с крепостью алмаза? Инкрустированные инструменты куда лучше стальных.^А теперь покажите миру свои прекрасные новые инструменты (в надежде, что их не отберут). + +knowledge.smeltObsidian=Работа с обсидианом +knowledge.smeltObsidian.desc=Уровень %1$s, экзотический материал +knowledge.smeltObsidian.1=Обсидиан в своей природной форме экстримально устойчив к температуре, что делает его непригодным к обработке. Однако, его смесь с сталью по определённой технологии может отличный материал + +knowledge.smeltBlackSteel=Работа с чёрной сталью +knowledge.smeltBlackSteel.desc=Уровень %1$s, обычный материал +knowledge.smeltBlackSteel.1=Теперь можно очистить сталь до более хорошего материала. Этот материал впитал в себя весь Ваш предыдущий опыт, и теперь Вы можете создавать ещё более хорошие вещи. + +knowledge.craftOrnate=Украшение +knowledge.craftOrnate.desc=Заслуживает ухода + +knowledge.craftOrnate.1=С подходящими материалами и наличием времени можно создавать более изысканные варианты оружия, брони и инструментов. Инкрустированные вещи более эффективны против нечисти (например, зомби).^Декоративный герб используется для создания таких предметов. Поместите украшение в выходящий слот наковальни и начинайте ковать. В итоге, у Вас получится украшенный предмет. + +knowledge.smeltDragonforge=Драконокованый +knowledge.smeltDragonforge.desc=Грубо и мощно + +knowledge.smeltDragonforge.1=Драконы - жестокие создания, битва с ними требует подготовки и опыта. Благодаря вашим стараниям, вы можете обратить их оружие против них самих! Драконокованые предметы куда сильнее поражает драконов.^Начните создавать любое оружие. В старых сказаниях говорится, что сердце дракона наделяет металл мощью, когда те объяты пламенем. +knowledge.smeltDragonforge.2=Драконокованые предметы, в отличие от других видов, требуют проведения этого ритуала на открытом воздухе. + +knowledge.smeltBlueSteel=Работа с голубой сталью +knowledge.smeltBlueSteel.desc=Уровень %1$s, обычный материал + +knowledge.smeltBlueSteel.1=Вы научились изготавливать голубую сталь, крайне лёгкий металл. + +knowledge.smeltRedSteel=Работа с красной сталью +knowledge.smeltRedSteel.desc=Уровень %1$s, обычный материал + +knowledge.smeltRedSteel.1= Красная сталь - очень тяжёлый материал, быстро потребляющий Вашу выносливость, но в то же время крайне прочный. + +knowledge.smeltMithril=Работа с мифрилом +knowledge.smeltMithril.desc=Уровень %1$s, экзотический материал + +knowledge.smeltMithril.1=Мифиевая руда крайне странная: в зависимости от метода её обработки результат разный. При смешивании лёгких элементов, серебра и мифиевой руды, Вы можете создать Мифрил. ^Мифрил отличается завидной лёгкостью. + +knowledge.smeltMithril.2=Из строк "Схематического Талисмана" стало известно, что серебро можно применять с мифием для создания более лёгкого материала.^Кажется, такое знание бесполезно, но это далеко не так. + + +knowledge.smeltAdamantium=Работа с адамантием +knowledge.smeltAdamantium.desc=Уровень %1$s, экзотический материал + +knowledge.smeltAdamantium.1=Мифиевая руда крайне странная: в зависимости от метода её обработки результат разный. Смешивая тяжёлые металлы с золотом и мифием, вы получаете крайне тяжёлый и крепкий металл. + +knowledge.smeltAdamantium.2=Из строк "Схематического Талисмана" стало известно, что золото можно применять с мифием для создания более прочного и тяжёлого материала. Золото играет важную роль в трансформации мифиевой руды в другой металл. ^Кажется, такое знание бесполезно, но это далеко не так. + +knowledge.smeltMaster=Мастерская обработка мифиевой руды +knowledge.smeltMaster.desc=Новые горизонты + +knowledge.smeltMaster.1=Производство материалов из мифия одно дело. А вот правильное - совсем другое. Вы можете создать мифрил и адамантий, но эти материалы - мусор в сравнении со всем потенциалом мифиевой руды. + +knowledge.smeltMaster.2=Мастерство позволяет Вам создавать новые, могущественные материалы, раскрывающие всю мощь, заключённую в мифиевой руде. ^Мастерства не так уж и легко добиться. Теперь станет намного сложнее удерживать качество продукта ковки. + +knowledge.smeltMaster.3=Но не только: хотя бы лёгкая тень несовершенства омрачит результат. А истинное совершенство станет практически неуничтожимым! + +knowledge.smeltIgnotumite=Работа с игнотумитом +knowledge.smeltIgnotumite.desc=Уровень %1$s, материал мастеров своего дела + +knowledge.smeltIgnotumite.1=Адамантий крайне мощен, но он не достигает своих истинных высот. Мифий содержит в себе множество элементов, и их разделение позволяет превратить адамантиум в игнотумит. + +knowledge.smeltMithium=Работа с мифием +knowledge.smeltMithium.desc=Уровень %1$s, материал мастеров своего дела + +knowledge.smeltMithium.1=Мифрил - крайне лёгкий и достаточно прочный материал, но, видимо, у него гораздо более большой потенциал. Вам предстоит попробовать выплавить чистый мифий... + +knowledge.smeltEnder=Работа со сталью Края +knowledge.smeltEnderforge.desc=Уровень %1$s, материал мастеров своего дела + +knowledge.smeltEnderforge.1=В существах из Края всегда было что-то странное... Сталь края сочетает в себе мифрил и адамантиум и концентрирует их силы через потусторонний жемчуг... + +knowledge.coalflux=Угольный флюс +knowledge.coalflux.desc=Лучше значит дешевле. +knowledge.coalflux.1=Угольный флюс ничем не уступает обычному углю, это было доказано кузнецами давным давно. Он выдаёт больше жара, медленнее сгорает, и создаётся проще простого!^Чтобы сделать угольный флюс, нужно смешать обычный уголь и флюс. Это вещество может быть использовано в домницах и любых других устройствах Mine Fantasy, но не как топливо(не как ванильный уголь). + +knowledge.bigfurn=Большая печь +knowledge.bigfurn.desc=Массовое производство + +knowledge.bigfurn.1=Процесс очистки базовых металлов и материалов сейчас достиг небывалых высот. Домницы - прошлый век, ведь они медленные, и дают на выходе металл не очищенный.^Большую печь рекомендуется обложить огнеупорной глиной в целях пожарной безопасности. + +knowledge.bigfurn.2=Эта печь переплавляет сразу 4 предмета за короткий срок времени. Печь имеет простой дизайн, но этого достаточно, чтобы работать с ней, нужно лишь положить уголь и металлы. + +knowledge.bigfurn.heater=Чтобы начать работу, отправьте уголь в топку. Печь заработает, и чем выше будет температура в топке, тем быстрее печь будет плавить металл. Для безопасности, следует обложить топку огнеупорной глиной. + +knowledge.bigfurn.top=Разместите саму печь над топкой. Если Вы будете регулировать температуру, печь будет работать наиболее эффективно.В целях пожарной безопасности обложите печь огнеупорной глиной. + +knowledge.bigfurn.structure=Когда Вы сделали печь, обложили её огнеупорным материалом, можете создавать впритык к ней другие печи, они будут работать как одна. + +knowledge.blastfurn=Очистка металла +knowledge.blastfurn.desc=Больше, чем переплавка + +knowledge.blastfurn.1=Иногда выплавка металла из руды попросту не может дать Вам необходимый эффект, и тогда Вам потребуется очистная печь.^ Каждая такая печь может быть построена практически с любой высотой и обрабатывать сразу несколько ресурсов одновременно. + +knowledge.blastfurn.2=Перед строительством печи нужно позаботиться о достойном каркасе.^ Огнеупорный кирпич должен выдерживать эти огромные температуры и используются для облицовки печи. +#Firebrick Recipes +knowledge.blastfurn.3=Печь состоит из двух типов блоков - топок и камер. Одна топка может обслуживать до 16 камер печи. +#Furnace Recipes +knowledge.blastfurn.4=Имея огнеупорный кирпич, топку и камеру, Вы может построить очистную печь.^Для начала, поставьте топку на землю.^Если под топкой находится тигель, он будет собирать в себя отходы топки. ^ Также оставьте достаточно места (около четырёх блоков) со всех сторон. +knowledge.blastfurn.5=Топка должна иметь как минимум по одному блоку огнеупорного кирпича у каждого из своих четырёх углов. Желательно не закрывать боговые стороны топки. ^Теперь можно построить саму шахту очистной печи над топкой, прикрывая её со всех четырёх сторон огнеупорным кирпичом. Верх должен быть открыт для свободного выхода дыма. +#Structure +knowledge.blastfurn.6=Использование очистной печи очень простое, но потребляет огромное количество топлива.^Сначала положите материал (такой как подготовленное железо) в нижний слот и уголь в верхний слот в самую верхнюю камеру. +knowledge.blastfurn.7=Если всё сделано верно, ресурсы провалятся в шахту и распределятся среди камер по одной штуке. Только после этого стоит положить топливо в топку, оно сгорает вне зависимости от того, есть ли что печи очищать! По окончанию процесса каждая из камер произведёт по одной единице вещей, а изменение давления в топке вызовет выброс пламени.^Главное - не закрывать путь этим выбросам, иначе печь может взорваться. А также желательно не держать возле печи возгораемых объектов! + +knowledge.blastfurn.hcc=$hHardcore Crafting-$r^ Крайне желательно ставить тигель под топкой, иначе можно потерять часть ресурсов! + +#Prepared Iron + +knowledge.blastfurn.9=Подготовленная железная руда используется для производства чугуна.^Чугун можно переделать в сталь.^Можно использовать обогащённый флюс для того, чтобы удвоить выход продукта, но он - редкость, и должен использоваться мудро. + +knowledge.bloomery=Домница +knowledge.bloomery.desc=Ранняя работа с металлами + +knowledge.bloomery.1=Домница поможет переплавить руду в слитки. + +knowledge.bloomery.2=Для использования домницы положите в неё уголь и руду в пропорции 1:1 и подожгите её. Домница должна быть под открытым небом! Также можно вывести от домницы трубу к небу. Чем больше материала - тем дольше она плавит. + +knowledge.bloomery.3=Когда переплавка окончена, отобразится масса переплавленного металла. Ударяйте по ней молотом, пока не получите все слитки. + +knowledge.crucible=Легирование +knowledge.crucible.desc=Смешивая металлы + +knowledge.crucible.1=Не так долго Вы можете полагаться на один металл. Для дальнейшего прогресса потребуется тигель.^Он создан для плавки металлов и последующего создания сплавов. + +knowledge.crucible.2=Для функционирования, тигель должен иметь источник тепла под собой (Такой как $hForge$r). Так же можно использовать лаву, но процесс пойдёт куда медленнее.^ Рецепты для сплавов не имеют чёткой формы, главное - пропорции. Например: 3 бронзы = 2 меди + 1 олово. Это значит, что Вы кладёте олово в один слот, а медь - в два и на выходе Вы получаете бронзу. Но Вы можете положить 4 меди и 2 олова и получить 6 бронзы и так далее... + +knowledge.crucible.hcc=$hHardcore Crafting-$r^Для того, чтобы достать слиток из тигля, используйте ПКМ литейную форму, которую после нужно остудить в воде.^Внимание! Если вы сломаете тигель, то вся продукция будет утеряна! + +knowledge.crucible2=Продвинутое легирование +knowledge.crucible2.desc=Больше сплавов для Бога сплавов! +knowledge.crucible2.1=Огнеупорные блоки доказали свою полезность.Создание тигля из такого материала означает, что он сможет выдерживать куда большие температуры и производить новые сплавы.^Тигли из огнеупорной глины намного лучше простых. + +knowledge.crucible2.blocks=Чтобы обезопасить работу, рекомендуется обложить тигель с четырёх сторон огнеупорными кирпичами. + +knowledge.apron=Кузнечный фартук +knowledge.apron.desc=Защитная одежда + +knowledge.apron.1=Что-то подсказывает Вам, что горн и слитки нагреваются. Возможно это "что-то" - Ваш горький опыт и прожжённая плоть на Вашем пузе. Тогда специально для вас - кузнечный фартук. Одеяние кузнеца состоит из рубахи, фартука и перчаток. Без этого предметы в Вашем инвентаре могут сгореть. + +knowledge.anvil=Ковка +knowledge.anvil.desc=Основы работы с металлами + +knowledge.anvil.1=Ковка - самый распространённый способ для крафта чго-либо.^Этот процесс включает в себя горн для нагрева металлов и ковку на наковальне с помощью молотов. Внимание! Остужение продукта ковки без щипцов и в открытой воде ведёт к поломке предмета! Используйте корыта и клещи. + +#Recipe + +knowledge.anvil.2=Наковальни крайне просты для крафта и также могут быть разсплавлены в печах.^Расположите наковальню неподалёку от воды и горна. Нажатие ПКМ без молота в руке или по боковой стороне накованьни откроет её интерфейс. + +#Gui + +knowledge.anvil.3=Изготовление вещей может показаться сложным, оно имеет две стадии. ^Сперва некоторые вещи должны быть разогреты в $hгорне$r. Если предмет нагреваемый, его нужно разогреть.^Во-вторых, нужно выложить сам рецепт. Начните выкладывать его + +knowledge.anvil.4=в сетке$h[3]$r затем: возьмите подходящий молот (тяжёлый или обычный, в зависимости от рецепта). Каждый рецепт имеет рекомендации по уровню молота и наковальни. Молоты низкого уровня непредсказуемы по качеству результата, а низкоуровневые наковальни усложняют крафт качественных вещей. Уровни будут отображаться над заголовком$h[1]$r.^Бейте молотком по наковальне. Шкала програсса$h[2]$r будет заполняться, а по завершению результат крафта появится в слоте$h[4]$r.^Некоторые вещи будут горячими, поэтому их надо остудить в воде нажатием ПКМ или в котле (удерживая shift). +knowledge.anvil.5=Для того, чтобы взять с наковальни разогретую вещь, используйте клещи. Горячие предметы могут нанести вам увечья, используйте клещи, чтобы взять что-либо из горна и перенести на наковальню! + +knowledge.anvil.6=При ковке следите за уровнем качества. Задача состоит в том, чтобы держать маркер подальше от краёв. Если он достигнет одного из них, это разрушит рецепт. При изготовлении повреждаемых вещей уровень срока службы также зависит от уровня качества, а именно от того, вышел ли маркер за края обозначенных отметок.^Как Вы видите, на шкале качества есть 2 зелёные отметки, которые повреждают объект в случае, если маркер находится за их пределами. Разделяйте удары на удары молотом ЛКМ и ПКМ. Также заметьте, что маркер медленнее движется вправо, чем влево. + +#Quality +knowledge.anvil.7=Если ударить с зажатой клавишей SHIFT, то маркер отбросится назад (что даст вам немного времени), однако, не достигайте 0, иначе это разрушит предмет. + +knowledge.forge=Горн +knowledge.forge.desc=Становится жарковато + +knowledge.forge.1=Горн крайне простое устройство, всего лишь положите в него топливо ПКМ, и зажгите его сухими камнями или зажигалкой. .^Теперь положите в него слитки и держитесь от огня подальше! + +knowledge.forge.2=Горн разогревается до разных температур в зависимости от вида топлива температура зависит от последнего добавленного предмета. $hКузнечные меха$r могут быть использованы для временного повышения температуры.^Поместите нагреваемые предметы в горн и их температура начнёт медленно подниматься. + +knowledge.forge.3=$y"Готовые к использованию"$r вещи можно использовать на наковальне, $d"Перегретые"$r же слишком горячи для этого.^Используйте различные виды топлива и кузнечные меха для получения нужной температурой и следите за разогреваемыми предметами.^Внимание: если над горном расположен тигель или что-то вроде него, горн использоваться для разогрева не может! + +knowledge.bellows=Кузнечные меха +knowledge.bellows.desc=Раздувая огонь + +knowledge.bellows.1=Иногда температуры недостаточно, или разогрев происходит слишком долго. Использование более качественных видов топлива же может быть дорогим.^Кузнечные меха же могут временно поднять температуру до 50%. Для использования поставьте их рядом с горном, направив их на него, и нажимайте ПКМ. + +knowledge.trough=Корыто +knowledge.trough.desc=Готовы к полосканию! + +knowledge.trough.1=Ходить далеко за водой не очень удобно, да и обычные источники воды разрушаются при полоскании предметов. Корыто - лучший способ остудить горячие предметы, достаточно лишь нажать ПКМ клещами или горячими предметами по корыту с водой. Чтобы наполнить корыто, нажмите ПКМ по нему держа в руке ведро с водой. Только не переполните его!.^После полоскания, предмет потеряет некоторый запас прочности.^Корыто так же может быть наполнено, если нажать ПКМ по блоку с водой. + +knowledge.trough.2=С кучкой гвоздей и набольшими усилиями можно собрать корыто, которое практически не будет протекать. В этом случае стоит уделить внимание и качеству древесины, чтобы создать идеальное изделие. + +knowledge.repair_basic=Ремонтные наборы +knowledge.repair_basic.desc=Держим инструменты в хорошем состоянии + +knowledge.repair_basic.1=Инструменты и многие другие вещи имеют свойство ломаться. Имея немного кожи и гвоздей, Вы найдёте способ исправить это.^Простые ремонтные наборы чинят любые вещи, но с некоторым шансом. Так же есть вероятность поломки, но это лучше, чем ничего. Конечно, более продвинутые наборы чинят вещи эффективнее...^Для использования нажимайте ПКМ по рем.набору держа в руке поломанный предмет.^P.S: Глупо чинить чернильницу с пером, как это делает Alter. + +knowledge.repair_advanced=Продвинутая починка +knowledge.repair_advanced.desc=Уже куда лучше + +knowledge.repair_advanced.1=Эти новые ремонтные наборы, хотя и дороже, но могут починить большее количество вещей до поломки. ^Также они восстанавливают больше прочности. + +knowledge.repair_ornate=Украшенный ремонтный набор +knowledge.repair_ornate.desc=Починка зачарованных инструментов + +knowledge.repair_ornate.1=Как известно, зачарованный предмет плохо поддаётся починке.^Однако этот ремонтный набор может всё исправить, может, потому что он крайне дорогой?^Ох уж эти жадные чары... + +knowledge.craftArmourBasic=Базовая броня +knowledge.craftArmourBasic.desc=Да я это никогда не одену! +knowledge.craftArmourBasic.1=Неплохо бы во что-то одеться, начиная исследовать этот мир. Эта броня ненадёжна, но лучше, чем ничего. + +knowledge.craftArmourLight=Лёгкая броня +knowledge.craftArmourLight.desc=Дешёвая и удобная + +knowledge.craftArmourLight.1=Лёгкая броня имеет небольшой вес, и делается из небольшого количества материалов. Пусть она не даст отличной защиты, но в ней Вы без затруднений можете применять особые боевые навыки.^Лёгкая броня - лучший выбор для боя, где нужна скорость и маневренность. +knowledge.craftArmourLight.2=Грубая кожаная броня является самой простой лёгкой бронёй. Может она и плохо защищает, но из неё делаются более сложные типы брони. +knowledge.craftArmourLight.3=Подбитая броня хорошо подходит для защиты от дробящего оружия. Так же, она является неободимым компонентом для создания тяжёлой брони. +knowledge.craftArmourLight.4=Укреплённая и клёпаная броня являются улучшенными версиями грубой кожаной брони. Укреплённая кожаная броня необходима для создания средней брони. +knowledge.craftArmourMedium=Средняя броня +knowledge.craftArmourMedium.desc=Сбалансированная защита + +knowledge.craftArmourMedium.1=Защита уже лучше, но и восстановление выносливости уменьшено вдвое. Не самая хорошая защита от колющего удара. + +knowledge.craftArmourMedium.scale=Чешуйчатая броня может быть сделана как альтернатива кольчуге. Такая броня сбалансированно защищает от всех видов урона, но не очень эффективна против колющего и режущего урона. + +knowledge.craftArmourHeavy=Тяжёлая броня +knowledge.craftArmourHeavy.desc=Мощная, но неподвижная. + +knowledge.craftArmourHeavy.1=Вы получили защиту превосходящую среднюю броню, но она сковывает Ваши движения. Средняя броня имеет ряд преимуществ, но это может быть способом для дальнейшего улучшения.^Через изучение анатомии некоторых диких животных, Вы пришли к выводу: Выглядит очевидным использование шерсти и перьев для большей эффективности, а части подбитой брони могут дать своеобразные преимущества.^Теперь Вы знаете, как создать тяжёлую броню, которую не каждый сможет носить без затруднений. +knowledge.craftArmourHeavy.2=Тяжёлая броня создаётся с уже готовой подбитой брони. Подбитая броня обеспечивает мягкий защитный слой под основными элементами брони. + +knowledge.craftArmourHeavy.splint=Шинная броня не кажется тяжёлой, как латные доспехи. Но, разумеется, шинная броня в разы превосходит среднюю броню, и защищает от всех типов урона. +knowledge.craftArmourHeavy.plate=Латная броня превосходно защищает воина, но она сильно сковывает движения. Да и чтобы сделать её придётся попотеть. +knowledge.craftHCCTools=Примитивные инструменты +knowledge.craftHCCTools.desc=Каменный век + +knowledge.craftHCCTools.1=До того, как получить металл, нужно использовать примитивные инструменты из камня, которые делаются на плотницком верстаке.^Каждое примитивное орудие требует 3 компонента:^Острые камни добываются разбиванием голыми руками блоков камня.^Лоза получается при разбивании блоков листвы острым камнем. + +knowledge.craftHCCTools.2=Палки добываются тем же способом, что и лоза.^Острые камни также добываются из булыжника, но для этого нужен молот. + +knowledge.craftHCCTools.3=С этими материалами Вы можете изготовить свои первые инструменты. Рекомендуем сначала изготовить кирку, так как с её помощью можно получать камень. + +knowledge.craftTools=Кованые инструменты +knowledge.craftTools.desc=Крафт для жизни +knowledge.craftTools.1=Вы всю жизнь будете бегать с палкой и примотанным к ней камнем? ^Кованые инструменты годятся на большее, да и прочность у них выше. + +knowledge.craftAdvTools=Продвинутые инструменты +knowledge.craftAdvTools.desc=Подходят для своих задач + +knowledge.craftAdvTools.1=Помимо стандартных существуют и другие полезные инструменты. Так, например, малая кирка имеет шанс выпадения различных полезных ресурсов при разрушении обычного или адского камня. + +knowledge.hvypick.info=Тяжёлая кирка - для настоящих мужчин! Она копает область 3x3x3 блока, но с меньшим дропом. Подходит для копания крупных подземных тоннелей. + +knowledge.trow.info=Эта маленькая лопата работает почти также, как и малая кирка, но с другим лутом и другими блоками, такими как земля или трава. + +knowledge.hvyshovel.info=Несмотря, что она больше похожа на дверь на ручке, вещь это довольно полезная.^Действует тяжёлая лопата почти также, как и тяжёлая кирка, но по отношению к земле. + +knowledge.scythe.info=Косы позволяют скашивать траву, урожай и листву. + +knowledge.mattock.info=$hКиркомотыга$r^В основном используемая для ландшафтного дизайна, киркомотыга поможет вам создавать дороги на основе блоков травы и земли. Вы можете разместить любой блок на дороге, чтобы изменить её внешний вид. +knowledge.mattock.use=ПКМ с киркомотыгой по блоку создаст дорогу. Так же вы можете кликнуть ПКМ любым блоком, чтобы изменить текстуру дороги. Более того, дорога может стать полублоком, если кликнуть по ней ПКМ с лопатой.^С киркомотыгой в руке мы можете заблокировать дорогу от случайных изменений лопатой или блоком: переключение режимов осуществляется ПКМ, красная иконка означает, что блок не может быть изменён, зелёная - наоборот. + +knowledge.lumber.info=$hТопор дровосека$r^Этот тяжёлый топор создан для быстрой и простой вырубки лесов, с его помощью вы можете срубить всё дерево целиком, разрушив всего один блок. Большие деревья рубить сложно, поэтому топор будет поврежаться быстрее. + +knowledge.craftWeapons=Кованое оружие +knowledge.craftWeapons.desc=Для "обороны" + +knowledge.craftWeapons.1=Что это? Деревянный меч? Ты им и ребёнка не напугаешь. Но потренироваться можно.^Разные стили боя подходят к разному оружию. Попробуйте всё! + +knowledge.sword.info=Старый добрый меч, который крайне хорошо блокирует удар. К нему подходит стиль блокирования и быстрых контратак. + +knowledge.mace.info=Металлический шар на ручке, которым является булава, не очень подходит для блокирования, а вот для пробивания черепов и тяжёлой брони он в самый раз! + +knowledge.waraxe.info=Боевой топор - это брутальный способ убить ближнего своего, к тому же имеющий бонус при разбеге и при ударе в прыжке. + +knowledge.spear.info=А вот если вам не хочется сходиться в ближнем бою, то копьё поможет Вам удержать Вашего противника на приличной дистанции. ^Копья наносят хороший урон при разбеге. + +knowledge.bow.info=Стандартный лук, но почему-то сделанный из металла. Он достаточно прочен и силён для ведения дистанционного боя. + +knowledge.craftAdvWeapons=Тяжёлое оружие +knowledge.craftAdvWeapons.desc=Размер имеет значение + +knowledge.craftAdvWeapons.1=Конечно же мы верим в то, что Вы никого не хотите убивать, поэтому вот Вам ещё больше оружия чтобы расправиться с ближним с ещё большей жестокостью. + +knowledge.greatsword.info=Тяжёлый и плоский клинок. Это лучшее оружие для самозащиты. + +knowledge.warhammer.info=Если пробитые черепа - это Ваш конёк, то боевой молот Вам более чем подходит! + +knowledge.battleaxe.info=Секиры ещё лучше боевых топоров. Больше ярости берсерка! + +knowledge.halbeard.info=Что если прикрепить топор к копью? Выйдет алебарда. Ей можно рубить вблизи и колоть при разбеге. + +knowledge.lance.info=Копьё всадника практически бесполезно для пеших атак, но при достаточной скорости перемещения верхом наносят огромный урон.^ Прекрасный выбор для рыцарского турнира или штурмовой кавалерии. + +knowledge.firemaker=Разведение огня +knowledge.firemaker.desc=СОЖГИ ИХ ВСЕХ! +knowledge.dryrocks.info=Сухие камни это базовый инструмент для разведения огня, они не создают блоков огня, но ими можно разжечь горн. +knowledge.tinderbox.info=Трутница является хорошим средством для разведения огня, к тому же она более долговечная чем сухие камни. It still may take a few tries to get a flame, but the extra uses pays off. +knowledge.flintsteel.info=Разумеется, огниво лучшее средство для разведения огня. Имеет самую большую прочность. + +knowledge.craftCrafters=Изготовление инструменов +knowledge.craftCrafters.desc=крафт для крафта + +knowledge.craftCrafters.1=Это инструменты для крафта. Многие рецепты требуют взаимодействия этих инструментов с блоками. +knowledge.hvyhammer.info=Тяжёлые молоты сходны с молотами, но используются для ковки каких-либо больших предметов. + +knowledge.tongs.info=Клещи нужны для переноски горячих предметов с места на место. + +knowledge.knife.info=Ножи могут быть использованы как в выделке шкур, так и в приготовлении пищи. + +knowledge.saw.info=Пилы распиливают дерево куда эффективнее. Положите доски на стол плотника и пилите. + +knowledge.needle.info=Иглы нужны для рецептов, связанных с пошивом. + +knowledge.mallet.info=Киянки используются там, где использовать молоты - это уж слишком. + +knowledge.spoon.info=Ложки... Серьёзно, вам ещё и про ложку рассказывать? Используется для перемешивания и готовки. Всё. + +knowledge.arrows=Изготовление стрел +knowledge.arrows.desc=Чтобы лук не валялся без дела + +knowledge.arrows.1=Создание стрел занимает время, но при этом достаточно дешевое. Вы можете создать множество вариаций стрел, используя разные металлы. Оперение стрел можно создавать из бумаги или перьев, но последние куда эффективней. Собрать стрелы можно на плотницком верстаке. + +knowledge.arrowsBodkin=Конические стрелы +knowledge.arrowsBodkin.desc=Лёгкие и быстрые + +knowledge.arrowsBodkin.1=Эти стрелы наносят меньше урона, но летят они дальше и точнее. + +knowledge.arrowsBroad=Широкоглавые стрелы +knowledge.arrowsBroad.desc=Тяжёлые и мощные + +knowledge.arrowsBroad.1=Куда более низкая дальность и скорость полёта, не мешает их широким и тяжёлым наконечникам перемалывать металлическую броню, кости и плоть. + +knowledge.etools=Инженерные инструменты +knowledge.etools.desc=Инструменты для изобретательных +knowledge.etools.1=Для попыток освоить инженерное дело, Вам понадобятся специальные инструменты. + +knowledge.ecomponents=Компоненты и основные материалы +knowledge.ecomponents.desc=Для создания сложных вещей + +knowledge.ecomponents.1=Для инженерного дела требуется новый способ соединения частей предметов. И эти компоненты стоят того! + +knowledge.ecomponents.2=Большинство объектов в этом ремесле не выковываются целиком, а составляются путём соединения заранее выкованных деталей. + +knowledge.coke=Кокс +knowledge.coke.desc=Очищенное топливо + +knowledge.coke.1=Обычный уголь полон всяческих примесей, которые не дают огню хорошо разгореться. После небольшой обработки и добавления красной пыли, древесный уголь будет гореть эффективнее, ведь теперь он будет чистейшим. Этот процесс доступен только для древесного угля. + +knowledge.tungsten=Вольфрам +knowledge.tungsten.desc=Для сложных конструкций + +knowledge.tungsten.1=У всех когда-то наступает момент, когда железо становится недостаточно пригодным для создания чего-либо; Это весьма трудно - найти хорошую замену. И не важно, будет это железо или носки(забудем). Вольфрам - редкий металл, находящийся в нижних слоях каменной породы. Вольфрамовая руда может быть обнаружена в виде жилки в 1 блок, но так же может быть случайно добыта с помощью малой кирки. + +knowledge.tungsten.2=Если у Вас высокоуровневые инструменты(как минимум инкрустированные), Вы можете добыть вольфрам ниже 16 блоков. Вольфрам может быть расплавлен(оно и понятно), но потребуется много топлива. + +knowledge.tungsten.3=Несмотря на то, что этот материал предназначен только для инженерии, необходимо иметь должный уровень кузнечного дела чтобы обработать вольфрам, что создаёт дополнительные трудности. + +knowledge.engTanner=Улучшенный дубильный станок +knowledge.engTanner.desc=Лёгкая обработка кожи + +knowledge.engTanner.1=Выделка кож довольно монотонное занятие, но Вы нашли способ упростить его.^Этот станок может как обрабатывать кожу, так и резать её. Всё, что нужно - поместить материал на станок и щёлкнуть ПКМ по станку. + +knowledge.advcrucible=Продвинутый тигель +knowledge.advcrucible.desc=Делаем сплавы легко! + +knowledge.advcrucible.1=Чертежи этого тигеля, в основном, содержат интересные секреты гномов по обработке металлов. Через исследование технологий выплавки, можно организовать автоматическую переплавку металлов. Если тигель установлен в систему, можно начинать работу. + +knowledge.advforge=Улучшенный горн +knowledge.advforge.desc=Полный контроль + +knowledge.advforge.1=Чертежи гномов позволяют создать горн, контролируемый сигналом красного факела!^Приспособьте к нему рычаг и зажгите (или погасите) его! + +knowledge.blackpowder=Взрывчатка +knowledge.blackpowder.desc=Бум! + +knowledge.blackpowder.1=Теперь Вы можете создавать устройства, позволяющие доставить взрывчатку под ноги Вашим друзьям и недругам издалека. ^Оружейный порох - крайне нестабильная субстанция, производящая взрыв и повреждения, изготавливающаяся из различных материалов. + +knowledge.advblackpowder=Очищенный оружейный порох +knowledge.advblackpowder.desc=Кабум! + +knowledge.advblackpowder.1=Нужно больше веселья?^С помощью использования редстоуна и светопыли Вы можете усилить качества пороха. + +knowledge.climber=Альпеншток +knowledge.climber.desc=Поднимайся! +knowledge.climber.1=Становится невыносимым блуждать в горах, ища путь наверх? Не нравится беспомощно падать в пропасть? Альпеншток позволит Вам цеплиться за цельные блоки. +knowledge.climber.2=Для того, чтобы зацепиться за блок, нажмите ПКМ и удерживайте его. После этого, не отпуская ПКМ, удерживайте shift и ЛКМ, чтобы спускаться, или просто зажмите ЛКМ для того, чтобы подниматься вверх. Следите за выносливостью! + +knowledge.spyglass=Подзорная труба +knowledge.spyglass.desc=Что это там вдали? +knowledge.spyglass.1=Подзорная труба позволяет взглянуть на мир по-другому. Shift + ПКМ меняет приближение. + +knowledge.parachute=Парашют +knowledge.parachute.desc=Если падать высоко +knowledge.parachute.1= Он позволяет Вам безопасно спуститься с высоты. + +knowledge.syringe=Шприц +knowledge.syringe.desc=Вколол и пошёл +knowledge.syringe.1=Вколоть зелье себе в руку куда быстрее, чем его пить, и выигранное время может оказаться бесценным. Также Shift + ПКМ позволяет использовать шприц на других. + +knowledge.bombs=Изготовление бомб +knowledge.bombs.desc=Пальцы себе не оторвите! + +knowledge.bombs.1=Какой смысл во взрывчатке, если её некуда положить? Эти небольшие приспособления нанесут хороший урон в небольшом радиусе.^Это более эксперементальное ремесло, чем другие. Сперва Вам нужно оборудовать рабочее место. + +knowledge.bombs.2=С этим столом Вы сможете изготавливать как бомбы, так и мины. Бомбы можно бросить, удерживая ПКМ, и они взорвутся через некоторое время. ПКМ с миной в руках устанавливает её на землю, и она взрывается, когда кто-то наступает на неё. + +knowledge.bombs.3=Бомбы и мины требуют 3-4 компонента при создании.^Оболочка$h[1]$r определяет урон и зону поражения. Взрывчатка$h[2]$r увеличивает урон. Наполнение$h[3]$r может быть пустым и используется для придания бомбе дополнительного поражающего эффекта. Фитиль $h[4]$r определяет время до детонации. + +knowledge.bombs.4=Для крафта бомбы положите компоненты в соответствующие слоты, после чего щёлкните по столу. + +knowledge.crossbows=Изготовление арбалетов +knowledge.crossbows.desc=Смертельные снаряды +knowledge.crossbows.1=Арбалеты - отличная замена лукам. Конечно, арбалет более медленный, чем лук, на него можно нацепить различные обвесы, дающие различные преимущества. +knowledge.crossbows.2=Чтобы сделать арбалет, Вам понадобится соответствующий верстак.^На нём Вы должны комбинировать детали, чтобы собрать полноценное оружие. Арбалет состоит из четырёх частей(Ложа, Дуги, Мод и Дуло). +knowledge.crossbows.3=Поставьте где-нибудь верстак для изготовления арбалетов. Теперь Вам нужно создать детали для него(смотрим рецепты).Ложа и дуги используются во всех арбалетах. Ложа влияет на отдачу, скорость перезарядки, а короткая рукоять повышает скорость перезарядки и снижает точность. +knowledge.crossbows.4=Вы можете улучшить арбалет. Достаточно добавить обвес в слот "Мод" или "Дуло". В "Мод" цепляется прицел, а в "Дуло" штык-нож. Лучше не устанавливать обвес, если в том нет нужды. +knowledge.crossbows.5=Для сборки арбалета разместите детали в соответствующие слоты верстака (похоже на создание бомбы) и используйте гаечный ключ. +knowledge.crossbows.6=По окончанию: теперь у Вас есть арбалет. Арбалеты работают почти как луки и выпускают болт тогда, когда заряжены. Shift+ПКМ чтобы открыть инвентарь арбалета. Сюда помещаются болты для арбалета, и когда Вы нажмёте ПКМ, арбалет зарядится. + +knowledge.crossShafts=Ложа арбалета +knowledge.crossShafts.desc=Основной компонент +knowledge.crossShafts.handle=Рукояти подходят для создания миниатюрных арбалетов. Малые размеры повышают скорость перезарядки, понижая точность и повышая отдачу. +knowledge.crossShafts.stock=Ложа является полномасштабной рукоятью арбалета, с высокой отдачей, в отличии от миниатюрной рукояти. Из-за большого размера скорость перезарядки достаточно низкая. + +knowledge.crossHeads=Дуги арбалета +knowledge.crossHeads.desc=Основной компонент +knowledge.crossHeads.light=Лёгкие дуги ускоряют перезарядку, снижая урон. +knowledge.crossHeads.medium=Арбалетные дуги стандартного размера. Сбалансированный урон и скорость перезарядки. +knowledge.crossHeads.heavy=Тяжёлые, укреплённые дуги арбалета. Огромная отдача и низкая скорость перезарядки компенсируется высоким уроном. + +knowledge.crossHeadAdvanced=Продвинутые дуги арбалета +knowledge.crossHeadAdvanced.desc=Лучше, значит... лучше. + +knowledge.crossHeads.advanced=Эти гномьи чертежи арбалетных дуг способны дать оружию огромную силу. С нужными материалами и инструментами становится возможным создать для себя эту деталь.^Очень низкая скорость перезарядки компенсируется колоссально высоким уроном и точностью. + +knowledge.crossShaftAdvanced=Продвинутая ложа арбалета +knowledge.crossShaftAdvanced.desc=Контролируем отдачу. + +knowledge.crossShafts.advanced=На основе обычного ложа: эта деталь гномами сделана из металла. Конечно, она тяжёлая, но всё же, подпружиненная система позволяет гасить отдачу. + +knowledge.crossAmmo=Магазин арбалета +knowledge.crossAmmo.desc=Многозарядное устройство +knowledge.crossAmmo.1=Арбалеты долго перезаряжаются после каждого выстрела, и чтобы закончить своё (грязное) дело, Вам может понадобиться ещё несколько выстрелов. Магазин, помещённый в слот "модификации", даст возможность сделать больше выстрелов перед перезарядкой, снижая, конечно, точность. + +knowledge.crossScope=Прицел арбалета +knowledge.crossScope.desc=Примитивный снайпер +knowledge.crossScope.1=Порой, бывает так, что цель слишком далеко, и расчитать траекторию полёта стрелы бывает трудно. В этом Вам поможет прицел для арбалета. Подзорная труба станетт полноценным прицелом, если поместить её в слот "модификации". + +knowledge.crossBayonet=Штык-нож арбалета +knowledge.crossBayonet.desc=Ближний бой +knowledge.crossBayonet.1=Во время перезарядки арбалета, уходит драгоценное время. А если нужно вступить в ближний бой? . Штык-нож помещается в слот "дула", и повышает урон в ближнем бою. + +knowledge.bpress=Бомбовый пресс +knowledge.bpress.desc=Массовое производство +knowledge.bpress.1=Производство бомб может быть очень долгим и нудным. Это устройство может выполнять работу за вас. Поместите пресс над столом для крафта бомб и нажмите на рычаг, и бомба будет собрана. + +knowledge.bombarrow=Наконечники со взрывчаткой +knowledge.bombarrow.desc=Летучая смерть +knowledge.bombarrow.1=Эти маленькие оболочки могут быть начинены взрывчаткой и прикреплены к стреле. К тому же, фитиль тут не нужен. + +knowledge.shrapnel=Бомбы со шрапнелью +knowledge.shrapnel.desc=Простая начинка +knowledge.shrapnel.1=Бомбы хороши, но их можно улучшить.^Шрапнель можно добавить в соответствующий слот, чтобы увеличить урон. + +knowledge.firebomb=Огненный взрыв +knowledge.firebomb.desc=Смертельное пламя + +knowledge.firebomb.1=Шрапнель эффективна для уничтожения врагов по одному, но смесь сгустка магмы может вызвать выброс высокотемпературного огня при детонации. + +knowledge.firebomb.2=Сгусток магмы - горючее и жидкое вещество, а драконье сердце может магически увеличить силу взрыва. +knowledge.firebomb.3=Такие бомбы дороги, но крайне эффективны против брони, которая гарантирует хорошую прожарку плоти. + +knowledge.bombCeramic=Керамическая оболочка для бомбы +knowledge.bombCeramic.desc=Простейшие бомбы +knowledge.bombCeramic.1=Керамическая оболочка хрупка и даёт не слишком сильный поражающий эффект, но средний радиус действия. + +knowledge.mineCeramic=Керамическая оболочка для мины +knowledge.mineCeramic.desc=Простейшие мины +knowledge.mineCeramic.1=Керамическая оболочка хрупка и даёт не слишком сильный поражающий эффект, но средний радиус действия. + +knowledge.bombIron=Железная оболочка для бомбы +knowledge.bombIron.desc=Компактный взрыв +knowledge.bombIron.1=Железная оболочка более прочная и радиус взрыва меньше, но зато силы во взрыв вложено куда больше. + +knowledge.mineIron=Железная оболочка для мины +knowledge.mineIron.desc=Компактный взрыв +knowledge.mineIron.1=Железная оболочка более прочная и радиус взрыва меньше, но зато силы во взрыв вложено куда больше. Также эта оболочка не так чувствительна, как керамическая. + +knowledge.bombObsidian=Обсидиановая оболочка для бомбы +knowledge.bombObsidian.desc=Превращаем ближнего в кровавое мессиво + +knowledge.bombObsidian.1=Высокая прочность обсидиана даёт мощнейший взрыв, но с очень маленьким радиусом. + +knowledge.mineObsidian=Обсидиановая оболочка для мины +knowledge.mineObsidian.desc=Превращаем ближнего в кровавое мессиво + +knowledge.mineObsidian.1=Высокая прочность обсидиана даёт мощнейший взрыв, но с очень маленьким радиусом. Чувствительность уменьшена и мины взрываются тогда, когда кто-то стоит на них. Что практически всегда приводит к летальному исходу. + +knowledge.bombCrystal=Кристаллическая оболочка для бомбы +knowledge.bombCrystal.desc=Стильно! + +knowledge.bombCrystal.1=Хрупкая стеклянная оболочка не даёт большой силы взрыву, но радиус поражения огромен! Не забудьте добавить алмазной пыли для того, чтобы осколки были крепче и наносили больше урона. + +knowledge.mineCrystal=Кристаллическая оболочка для мины +knowledge.mineCrystal.desc=Дорого-богато! +knowledge.mineCrystal.1=Хрупкая стеклянная оболочка не даёт большой силы взрыву и очень чувствительна к приближению, но радиус поражения огромен! Не забудьте добавить алмазной пыли для того, чтобы осколки были крепче и наносили больше урона. + +knowledge.bombFuse=Фитили для бомб +knowledge.bombFuse.desc=Отложенный взрыв +knowledge.bombFuse.1=Что такое бомба без фитиля? Скорее всего, после этого эксперимента Вы не сможете ответить на этот вопрос. Фитиль отвечает за то, сколько времени пройдёт от активации до детонации. +knowledge.bombFuse.2=Также можно сделать длинный фитиль, что означает, что бомбу можно кинуть дальше! А вот перспективы его применения в сборке мин так себе... + +knowledge.stickybomb=Клейкие бомбы +knowledge.stickybomb.desc=Лови! +knowledge.stickybomb.1=Эти бомбы прилипают к цели и разносят её в кровавые ошмётки. +knowledge.stickybomb.2=Для изготовления оставьте бомбу в слоте готовой продукции и щёлкните по столу со сгустком слизи в руке. Один сгусток слизи может быть использован на целый стак! + +$hUse of Cogworks$r^ + +knowledge.cogArmour=Механическая броня +knowledge.cogArmour.desc=Растоптай их! + +knowledge.cogArmour.1=Данное открытие объясняет, почему гномьи руины состоят из больших коридоров! Это чертежи приспособления с кучей механизмов, которые повторяют действия человека, подобно огромному экзоскелету. Выглядит как большой бронированный костюм, способный сделать носителя неуязвимым ко всем типам урона.^Механическая броня является венцом творения гномов, и способна переносить огромный вес. Единственный минус механической брони в том, что для работы она требует много чистого топлива. + +knowledge.cogArmour.2=Ни одного экземпляра механической брони не было найдено, но системы, обнаруженные в гномьих крепостях, теоретически, могут облачить в механическую броню кого-нибудь, ростом не выше человека. + +knowledge.cogArmour.station=$hМеханическая станция$r^Механическая станция необходима для экипирования или улучшения механической брони. Механическая станция состоит из остова и шкива, представляет из себя 3 остова высотой в 4 блока, со скрепляющим остовом по середине. +//Example +knowledge.cogwork_station=Механическая станция +knowledge.cogArmour.station.2=Когда станция готова, Вам нужно сделать шкив, затем нажать ПКМ по центральному остову для его установки. Убедитесь, что шкив расположен в нужном месте, ведь после установки его нельзя будет снять. +//Pulley Recipe +knowledge.cogArmour.crafting=Для создания механической брони: Вам нужно три блока - шлем, нагрудник и поножи. Разместите их на механической станции. Затем, нажмите ПКМ гаечным ключом по нагруднику. +//Piece Recipes +knowledge.cogArmour.armour=$hБроневые элементы$r^Для того, чтобы разместить броню на каркас, Вам нужно сделать её. Для этого потребуется много металла, поэтому рекомендуется использовать что-то вроде стали. Броня устанавливается через нажатие ПКМ по каркасу костюма. Так же Вам понадобится 16 болтов которые расходуются перед установкой брони. Броню можно легко снять с помощью гаечного ключа. +//Armour Recipe +knowledge.cogArmour.fuel=$hЗаправка$r^Механическая броня потребляет только чистое топливо(кокс или магму). ПКМ по костюму, чтобы заправить его топливом.^Чем тяжелее защита на механической броне, тем больше топлива она потребляет. +knowledge.cogArmour.advantage=$hПреимущества$r^Небронированная механическая броня защищает носителя от дыма, урона от падений, увеличивает наносимый урон и снижает затраты выносливости. +knowledge.cogArmour.advantage.2=Бронированный костюм даёт почти стопроцентную защиту, возможность дышать под водой. Также, защищает от отравления/иссушения и делает носителя неуязвимым к огню. +knowledge.cogArmour.advantage.3=Броня по-прежнему может получать урон от огня, в зависимости от температуры плавления материала, более высокий уровень прочности делает броню долговечной, но всё же, временами придётся снимать её для починки. +knowledge.cogArmour.disadvantage=Носитель не может прыгать, но может подняться на 1 блок выше, движения более скованные, и нет возможности красться.(да ладно?) +knowledge.cogArmour.disadvantage.2=Взрывы так же наносят урон броне, и могут ошеломить носителя на секунду. +knowledge.cogArmour.removal=Защитное покрытие снимается, когда костюм сломан. Каркас механической брони можно сломать с помощью гаечного ключа(ЛКМ), так же, он может быть разрушен в огне или лаве. + +knowledge.compPlate=Композитный металл +knowledge.compPlate.desc=Универсал + +knowledge.compPlate.1=Пока, многие сплавы получаются путём простого плавления и смешивания. Технологии гномов, связанные со сплавами, кардинально отличаются от тех, которыми пользуются люди. Материалы просто смешиваются и собираются в одну пластину. Конечно, для инструментов композитные сплавы не подойдут, но показывают максимальную эффективность при создании брони, особенно тяжёлой.^Помимо этого, композитные сплавы используются в создании механической брони. + +knowledge.refined_planks=Пропитанные бруски +knowledge.refined_planks.desc=Структурно стабильны +knowledge.refined_planks.1=Пропитанные бруски более прочные, и лучше подходят для строительства. Достаточно лишь скрепить их гвоздями(см. Оббитые доски). Этот блок не может быть демонтирован.^Вы можете пропитать маслом обычные бруски. + +knowledge.constructionPts=Строительные материалы +knowledge.constructionPts.desc=Деревянные заготовки +knowledge.constructionPts.1=Дерево должно быть напилено и заготовлено другими способами, чтобы начать работу с ним. Материалы имеют разные формы и размер, необходимые для строительства.^Бруски отлично подойдут для мебели и т.п., когда из металла следует делать гвозди. + +knowledge.reinforced_stone=Укреплённый камень +knowledge.reinforced_stone.desc=Выдерживая удары судьбы +knowledge.reinforced_stone.1=Характеристики камня могут быть улучшены с помощью его споавки с обсидианом и каолинитом. + +knowledge.clay_wall=Глиняная панель +knowledge.clay_wall.desc=Декоративные стены +knowledge.clay_wall.1=Декоративная стена, и этим всё сказано. + +knowledge.glass=Стеклянные блоки +knowledge.glass.desc=Декоративные окна +knowledge.glass.1=Стекло красиво, но хрупко. Но если поместить его в деревянную раму, его можно изъять без его разрушения. + +knowledge.brickworks=Основы каменной кладки +knowledge.brickworks.desc=Больше камня +knowledge.brickworks.1=Есть больше возможностей строить из камня. Из него и грязи можно сделать ещё и мостовую. + +knowledge.bars=Металлические прутья +knowledge.bars.desc=Прочное ограждение +knowledge.bars.1=Решётки из различных металлов. А решётка из драконьей стали ещё и будет нестерпимо жечь всех, кто прикоснулся к ней. + +knowledge.thatch=Солома +knowledge.thatch.desc=Мягкая крыша +knowledge.thatch.1=Простая крыша из соломы. + +knowledge.paint_brush=Кисть +knowledge.paint_brush.desc=Тут не докрасили... +knowledge.paint_brush.1=Порой не хочется сидеть за плотницким верстаком и маслом обрабатывать бруски. Вам на помощь придёт кисть.^Кистью с маслом можно пропитывать как бруски, так и целые блоки. +knowledge.paint_brush.2=$hКистью по миру$r^Долго и нудно пропитывать доски на верстаке, Вы можете делать это прямо в игре, одним взмахом волшебной... кисточки. Имея в инвентаре масло, жмите ПКМ по блокам навроде оббитых досок, чтобы превратить их в пропитанные доски. + +knowledge.decorated_stone=Декоративный камень +knowledge.decorated_stone.desc=Отделываем металлом +knowledge.decorated_stone.1=Камень в больших количествах выглядит пресно, и Вы изучили способы укрепления его металлом, что добавляет немного стиля Вашим стенам. + +knowledge.tool_rack=Стеллаж для инструментов +knowledge.tool_rack.desc=Храним оборудование +knowledge.tool_rack.1=Многие инструменты могут понадобиться, но их не окажется под рукой. На стеллажи можно вешать инструменты для быстрого доступа.^ПКМ инструментом по стеллажу, чтобы поместить его, и ПКМ рукой, чтобы взять.^Тяжёлое оружие требует второй стеллаж снизу, и древковое сверху. +knowledge.tool_rack.rules=*Тяжёлое оружие требует ещё один стеллаж снизу.^*Древковое оружие требует стеллажи сверху и снизу.^*Полноразмерные арбалеты считаются тяжёлым оружием.^*Арбалет нельзя повесить на крайний крючок. + +knowledge.bed_roll=Лежанка +knowledge.bed_roll.desc=Выбор путешественника +knowledge.bed_roll.1=Когда Вы в путешествии, Вам обязательно захочется поспать. Лежанка решает эту проблему и, к тому же, не переносит точку дома. + +knowledge.food_box=Продовольственный ящик +knowledge.food_box.desc=Еда в безопасности +knowledge.food_box.1=Еда и медикаменты должны быть всегда под рукой. Продовольственные ящики позволяют хранить еду и перевязки в количестве до стака. Нажмите ПКМ, чтобы убрать в ящик предмет, и ПКМ с голыми руками, чтобы его достать. + +knowledge.ammo_box=Ящик для боеприпасов +knowledge.ammo_box.desc=Всегда под рукой +knowledge.ammo_box.1=Боеприпасы всегда должны быть под рукой, особенно когда враг у ворот, и Вам прострелили колено. Такие ящики вмещают до 8 стаков стрел/болтов/бомб/мин. Нажмите ПКМ, чтобы убрать в ящик предмет, и ПКМ с голыми руками, чтобы его достать. +knowledge.ammo_box.2=Если сломать заполненный ящик, его содержимое не выпадет, и не пропадёт. Так что можно смело переносить ящики с боеприпасами. + +knowledge.big_box=Ящик для хранения +knowledge.big_box.desc=Некуда девать. +knowledge.big_box.1=Действует точно по тому же принципу, что и продовольственный ящик, только в ящик для хранения можно поместить любой предмет. Нажмите ПКМ, чтобы убрать в ящик предмет, и ПКМ с голыми руками, чтобы его достать. + +knowledge.generic_meat=Обычное мясо +knowledge.generic_meat.desc=Хорошо для всех рецептов +knowledge.generic_meat.1=Приготавливается из многих видов мяса для более удобного хранения и использования в рецептах. + +knowledge.stew=Фарш +knowledge.stew.desc=Вкусная смесь +knowledge.stew.1= Это еда для новичка, смесь измельчённого мяса. + +knowledge.jerky=Вяленое мясо +knowledge.jerky.desc=Специально для путешественника +knowledge.jerky.1=Эта еда хорошо восстанавливает выносливость, а также достаточно компактна в хранении. Идеально для долгих путешествий. + +knowledge.saussage=Сосиска +knowledge.saussage.desc=Мясо! +knowledge.saussage.1=Сосиски лучше вяленого и копчёного мяса! Только свежее, вкусное, упакованное... умм... Да, в кишки животных. + +knowledge.sandwitch=Бутерброды +knowledge.sandwitch.desc=Просто и вкусно +knowledge.sandwitch.1=Несмотря на то, что будерброды не стакаются, они могут быть использованы дважды. + +knowledge.sandwitchBig=Большой бутерброд +knowledge.sandwitchBig.desc=Для хороших работников +knowledge.sandwitchBig.1=Зачем резать хлеб на ломтики, когда можно положить много начинки между больших кусков хлеба? 4 использования. Папа может! + +knowledge.meatpie=Мясной пирог +knowledge.meatpie.desc=Сытно и прекрасно +knowledge.meatpie.1=Это сытная еда, дающая бонус к выносливости. Просто поставьте пирог куда-нибудь, и используйте на нём нож, чтобы получить его кусок! + +knowledge.shepardpie=Пастуший пирог +knowledge.shepardpie.desc=Впрочем, остальные его тоже едят +knowledge.shepardpie.1=Даже лучше мясного, ещё и с картошкой! Даёт большой бонус к выносливости. Просто поставьте пирог куда-нибудь, и используйте на нём нож, чтобы получить его кусок! + +knowledge.salt=Соль +knowledge.salt.desc=Добавить по вкусу +knowledge.salt.1=Для получения соли сначала добудьте немного солёной воды. ^Зачерпните её глиняным горшком. Солёная вода находится над блоками песка. Затем выпарьте воду! +knowledge.salt.2=Горшки позволяют носить соль и не рассыпать её. + +knowledge.jug=Кувшин +knowledge.jug.desc=Хранилище для жидкостей +knowledge.jug.1=Для переноски жидкостей вполне подойдёт глиняный кувшин. В нём можно хранить молоко, воду и масло. +knowledge.jug.2=Молоко не может быть получено напрямую от коров, его необходимо переливать из вёдер. + +knowledge.bread=Хлеб и тесто +knowledge.bread.desc=Вкусные зёрна +knowledge.bread.1=Хлеб - скудная пища сам по себе, но теперь его можно использовать и с другой едой. Мука используется для производства различных видов теста. +knowledge.bread.other=Некоторые продукты (как, например, хлеб) имеют альтернативные рецепты, но будут хуже, чем еда MineFantasy + +knowledge.oats=Каша +knowledge.oats.desc=Просто, но полезно +knowledge.oats.1=Смесь натуральных зерновых + +knowledge.icing=Сахар +knowledge.icing.desc=Не слипнется! +knowledge.icing.1=Для хранения сахара лучше использовать глиняные горшки, а не носить его в кармане вместе с грязью и слизью. +knowledge.icing.2=Некоторую еду невозможно представить без глазури, и сахар просто необходим! + +knowledge.sweetroll=Сладкий рулет +knowledge.sweetroll.desc=Не отдавай его Бучу! +knowledge.sweetroll.1=Вкусный рулетик, дающий бонусы к выносливости, да ещё и используемый дважды. + +knowledge.eclair=Эклер +knowledge.eclair.desc=Шикуем! +knowledge.eclair.1=Теперь можно и повыделываться.^К тому же, это пироженое может быть использовано 4 раза. + +knowledge.cake=Торт +knowledge.cake.desc=Сделанный правильно! +knowledge.cake.1=Большой торт, положительно влияющий на выносливость. Просто поставьте его куда-нибудь, и используйте на нём нож, чтобы получить его кусок! + +knowledge.carrotcake=Морковный пирог +knowledge.carrotcake.desc=Невкусно, но полезно +knowledge.carrotcake.1=Стандартный пирог, но с морковью. Просто поставьте пирог куда-нибудь, и используйте на нём нож, чтобы получить его кусок! + +knowledge.chococake=Шоколадный торт +knowledge.chococake.desc=Привет, жирок! +knowledge.chococake.1=Торт, покрытый шоколадом. Просто поставьте его куда-нибудь, и используйте на нём нож, чтобы получить его кусок! + +knowledge.bfcake=Торт "Чернолесье" +knowledge.bfcake.desc=Красиво и празднично +knowledge.bfcake.1=Покрыт шоколадом и ягодами, очень хорошо влияет на выносливость. Просто поставьте его куда-нибудь, и используйте на нём нож, чтобы получить его кусок! + +knowledge.berrypie=Ягодный пирог +knowledge.berrypie.desc=Простой десерт +knowledge.berrypie.1=Ягодный пирог, то - что надо! Просто поставьте пирог куда-нибудь, и используйте на нём нож, чтобы получить его кусок! + +knowledge.applepie=Яблочный пирог +knowledge.applepie.desc=Простой десерт +knowledge.applepie.1=Похож на ягодный, но чуть лучше. Просто поставьте пирог куда-нибудь, и используйте на нём нож, чтобы получить его кусок! + +knowledge.cheese=Сыр +knowledge.cheese.desc=Вкусномолочный продукт +knowledge.cheese.1=Сыр - продукт обработки молока и используется во многих рецептах. Просто поместите его куда-нибудь, и используйте на нём нож, чтобы получить кусок сыра. + +knowledge.cheeseroll=Сырный рулет +knowledge.cheeseroll.desc=Лёгкая закуска +knowledge.cheeseroll.1=Сыр хорошо идёт с хлебом. Поместите его в рулет, чтобы придать немного вкуса. + +knowledge.firepit=Костёр и плита +knowledge.firepit.desc=Основы приготовления пищи +knowledge.firepit.1=Костёр - самое простое средство для приготовления пищи.^Чтобы разжечь костёр, поставьте где-нибудь костровище, наложите туда брусков(ПКМ) и зажгите, к примеру, сухими камнями(ПКМ). +knowledge.firepit.2=Плиты хорошо подходят для приготовления пищи, их следует разместить над костром или горном.^Укладывайте сырую еду на плиту и приглядывайте за ней, иначе сгорит. Некоторые рецепты (например, тортов) требуют требуют низкой температуры, для достижения которой отлично подойдёт угольная пыль. +knowledge.firepit.3=Печи позволяют готовить как обычную еду, так и что-то более изысканное (например, хлеб).^Так же в печах можно обжаривать ваши глиняные поделки, просто повысив температуру (более горючим топливом). +knowledge.firepit.4=Используйте костёр для простых рецептов, а для более сложных - горн, растопленный на угольной пыли. Для обжига керамики потребуется обычное топливо, например, уголь. + +knowledge.cookingutensil=Инструменты для готовки +knowledge.cookingutensil.desc=Повару - хороший инструмент! +knowledge.cookingutensil.1=Для готовки нужны особые вещи, такие как формы для выпекания тортов и пирогов. Для инструментов смотрите вкладку базовых инструментов. + +knowledge.bandage=Повязки +knowledge.bandage.desc=Первая помощь +knowledge.bandage.1=Иногда недостаточно прикрикнуть на тяжелораненого и сказать ему заткнуться и сжевать четырёх жареных кур. Используйте повязку ПКМ. Врочем, она не поможет, если Вы истощены, горите, тонете или вообще умерли. Такие вещи надо и самим понимать. + +knowledge.bandageadv=Крепкие повязки +knowledge.bandageadv.desc=Качественная медпомощь +knowledge.bandageadv.1=Эти дорогие, но качественные повязки могут залатать серьёзные повреждения. + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/MASTERY TEXT/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +knowledge.title= +knowledge.title.desc= +knowledge.title.1= + +knowledge.fitness=Выносливость +knowledge.fitness.desc=Оставайтесь в форме +knowledge.fitness.1=Ваш самый главный враг в бою - ваше же тщедушное тело. Однако теперь после долгих и частых нагрузок Вы устаёте на 25% медленнее. + +knowledge.toughness=Сила +knowledge.toughness.desc=Выкуси! +knowledge.toughness.1=Ваше постоянное участие в битвах научило вас не подставлять под удар жизненно важные органы.^Урон уменьшен на 25%. + +knowledge.armourpro=Мастерство ношения брони +knowledge.armourpro.desc=Почувствуй разницу +knowledge.armourpro.1=С прошествием времени Вы научились так двигаться в броне, чтобы меньше уставать.^Влияние брони на Вашу выносливость снижено. + +knowledge.parrypro=Тактика парирования +knowledge.parrypro.desc=Следите за движениями +knowledge.parrypro.1=Позиция на поле боя - важное преимущество.^Удерживание shift при парировании позволяет Вам прыгнуть вперёд, парируя удар, и переместиться за спину к оппоненту. + +knowledge.counteratt=Контратака +knowledge.counteratt.desc=Ответный удар +knowledge.counteratt.1=Парирование защищает вас, но нарушает Ваше рановесие, но теперь Вы достаточно опытны, чтобы обратить недостаток в преимущество.^Сразу после парирования Вы можете атаковать, нанеся чуть меньший урон, чем обычно. +knowledge.counteratt.2=Мечи, кинжалы и катаны могут выполнить коющий удар.^Боевые топоры выполняют дробящий удар.^Тяжёлое оружие наносит сильный удар.^Дробящее оружие и шестовое оружие не даёт эффекта. + +knowledge.autoparry=Парирование на рефлексах +knowledge.autoparry.desc=Всегда готов! +knowledge.autoparry.1=Ваша постоянная практика привела к выработке рефлексов.^Вы можете парировать атаки без нажатия ПКМ, но под меньшим углом. + +knowledge.scrapper=Мусорщик +knowledge.scrapper.desc=Возьми всё это! +knowledge.scrapper.1=Ваши начинания в ремесленном деле не прошли даром, теперь вы понимаете, что некоторые вещи можно использовать дважды. ^Теперь вы возвращаете больше сырья при разборке. + +knowledge.firstaid=Первая помощь +knowledge.firstaid.desc=Склонен к ранениям +knowledge.firstaid.1=Вы должны быть предельно быстры и аккуратны во время перевязки, чтобы вы или ваш пациент не истекли кровью. ^Повязки теперь накладываются значительно быстрее. + +knowledge.doctor=Доктор +knowledge.doctor.desc=Спасая жизни +knowledge.doctor.1=Постоянная врачебная практика помогла Вам увеличить эффективность использования повязок. Теперь вы излечиваете ими на 50% лучше. + diff --git a/src/main/resources/assets/minefantasy2/lang/zh_CN.lang b/src/main/resources/assets/minefantasy2/lang/zh_CN.lang new file mode 100644 index 00000000..3a917241 --- /dev/null +++ b/src/main/resources/assets/minefantasy2/lang/zh_CN.lang @@ -0,0 +1,2245 @@ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/INFORMATION/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +forge.fuel.name=~燃料~ +vehicle.fuel.name=燃料:%1$s +info.bow.reload=潜行状态下右键打开火器。 +info.firearm.ammo=%1$s/%2$s + +attribute.kit.salvage.name=回收调节 + +attribute.kit.repairRate.name=修复值 +attribute.kit.repairRate_enchant.name=修复值 (附魔物品) +attribute.kit.repairRate_normal.name=修复值 (普通物品) + +attribute.kit.repairChance.name=修复成功率 +attribute.kit.breakChance.name=修复失败率 + +attribute.inferior.name=次品 +attribute.superior.name=精品 + +item.infobook.name=研究手册 +item.research_scroll.name=研究卷轴 +item.research_scroll_complete.name=研究完成 + +item.talisman_lesser.name=小型知识护符 +item.talisman_greater.name=大型知识护符 + +prospect.canmine=你可以采集它!(工具:%1$s | 方块:%2$s) +prospect.cannotmine=你无法采集它!(工具:%1$s | 方块:%2$s) +gui.information=研究 +information.discovered=已研究 +information.buy=点击研究 +knowledge.unknownUse=你不知道如何使用它! +knowledge.known=你已经知道这个了 + +infoPage.basic=基本信息 +infoPage.artisanry=手艺 +infoPage.construction=建造 +infoPage.provisioning=食物 +infoPage.engineering=工程 +infoPage.mastery=精通 +infoPage.dwarvern=矮人 +infoPage.gnomish=侏儒 + +knowledge.unlocked=研究完毕 + +vehicle.noArmour=你的衣服磨损的太厉害了,不能再穿这个。 +vehicle.tooBigArmour=你穿的衣服太厚了,挤不进这套装甲。 + +research.noskill=你也许能从中学到什么,如果你更精于此道的话。 +research.null=这里面已经没有可学的了。 + +research.addArtefact=习得 %1$s 的知识 (%2$s/%3$s) +research.finishResearch=完成 %1$s 研究 +research.cluecount=(%1$s/%2$s) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/MOBS/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +entity.MF_Minotaur.name=牛头人 +entity.MF_Dragon.name=龙 +death.attack.dragonstomp=%1$s 被 龙 踩死了 +death.attack.humanstomp=%1$s 被 %2$s 踩死了 +death.attack.fireblast=%1$s 被 %2$s 烤熟了 +death.attack.fireblastBase=%1$s 被烤熟了 +death.attack.blastfurn=%1$s 被高炉焚烧 +death.attack.frostblast=%1$s 被 %2$s 冻结了 +death.attack.frostblastBase=%1$s 被冻结了 +death.attack.acidblast=%1$s 被 %2$s 蒸发了 +death.attack.acidblastBase=%1$s 蒸发了 +death.attack.ashblast=%1$s 被 %2$s 活埋了 +death.attack.ashblastBase=%1$s 被活埋 + +death.attack.mob.pound=%1$s 被 %2$s 袭击了 +death.attack.mob.gore=%1$s 被 %2$s 刺伤了 +death.attack.mob.beserk=%1$s 被 %2$s 撕裂了 + +entity.minotaur.name=小牛头人 +entity.minotaur_guard.name=牛头人战士 +entity.minotaur_elite.name=牛头人精英 +entity.minotaur_boss.name=牛头人领主 + +entity.frostminotaur.name=小冰霜牛头人 +entity.frostminotaur_guard.name=冰霜牛头战士 +entity.frostminotaur_elite.name=冰霜牛头精英 +entity.frostminotaur_boss.name=冰霜牛头领主 + +entity.dredminotaur.name=小恐怖牛头人 +entity.dreadminotaur_guard.name=恐怖牛头拳击手 +entity.dreadminotaur_elite.name=恐怖牛头惩罚者 +entity.dreadminotaur_boss.name=恐怖牛头死亡霸主 + +entity.dragonbreed.red.name=赤炎 +entity.dragonbreed.white.name=冰霜 +entity.dragonbreed.black.name=梦魇 +entity.dragonbreed.green.name=绿沼 +entity.dragonbreed.ash.name=灰烬 + +entity.dragon_young.name=幼年%1$s巨龙 +entity.dragon.name=青年%1$s巨龙 +entity.dragon_mature.name=壮年%1$s巨龙 +entity.dragon_elder.name=老年%1$s巨龙 +entity.dragon_ancient.name=远古%1$s巨龙 + +event.dragonnear.name=一只巨龙在附近徘徊,寻找掩护或者准备战斗! +event.dragonnear.forge.name=你的手艺侮辱了龙类! +event.dragonaway.name=巨龙已经离开……眼下…… + +entity.hound.name=猎犬 + +item.spawn_dragon.name=生成 龙 +item.spawn_dragon.desc=无情的有翼蜥蜴。 +item.spawn_minotaur.name=生成 牛头人 +item.spawn_minotaur.desc=残忍且冲动的物种。 +item.spawn_hound.name=生成 猎犬 +item.spawn_hound.desc=各具特点的精干猎犬。 +item.spawn_cogwork.name=生成 机甲 +item.spawn_cogwork.desc=超高强度的机械化装备。 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/TOOL LIST/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.tool_pick.name=%1$s镐 +item.commodity_plank.name=%1$s木材 +item.haft.name=柄 +item.commodity_hunk.name=%1$s片 +item.commodity_scrap.name=%1$s废料 +item.commodity_plate.name=%1$s板 +item.commodity_bar.name=%1$s条 +item.commodity_plate_huge.name=大型%1$s板 +item.commodity_chainmesh.name=%1$s链网 +item.commodity_scalemesh.name=%1$s鳞网 +item.commodity_splintmesh.name=%1$s板网 +item.commodity_plateheavy.name=重型%1$s板 +item.commodity_arrowhead.name=%1$s箭头 +item.commodity_bodkinhead.name=%1$s穿甲箭头 +item.commodity_broadhead.name=%1$s宽型箭头 +item.commodity_cogwork_armour.name=%1$s外骨骼装甲 + +item.mod_plating.name=%1$s镀层 +item.mod_head.name=%1$s头 +item.mod_haft.name=%1$s柄 +item.mod_joint.name=%1$s关节 + +component.head.name=%1$s头 +component.shaft.name=%1$s轴 +component.grip.name=%1$s握把 +component.brace.name=%1$s支架 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/MATERIAL LIST/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +materialtype.wood.name=木材等级:%1$s +materialtype.leather.name=皮革等级:%1$s +materialtype.metal.name=金属等级:%1$s +materialtype.workable.name=锻造温度:%1$s*C - %2$s*C + +materialtype.resist.name=%1$s 抗性 +materialtype.fireresist.name=%1$s 火焰抗性 +materialtype.maxtemp.name=%1$s*C 熔点 +material.any.name=任何 + +WOOD +material.scrapwood.name=废木 +material.oakwood.name=橡木 +material.birchwood.name=桦木 +material.sprucewood.name=云杉木 +material.acaciawood.name=金合欢木 +material.junglewood.name=丛林木 +material.refinedwood.name=精制木 +material.ironbarkwood.name=桉木 +material.ebonywood.name=黑檀木 +material.darkoakwood.name=深色橡木 +material.pinewood.name=松木 +material.cherrywood.name=樱桃木 +material.poplarwood.name=白杨木 +material.maplewood.name=枫木 +material.mahoewood.name=沉香木 +material.greenheartwood.name=青心木 +material.palmwood.name=棕榈木 +material.limewood.name=椴木 +material.balsawood.name=巴沙木 +material.walnutwood.name=胡桃木 +material.chestnutwood.name=栗木 +material.larchwood.name=落叶松木 +material.willowwood.name=柳木 +material.teakwood.name=柚木 +material.sequoiawood.name=红杉木 +material.mahoganywood.name=桃花心木 +material.wengewood.name=鸡翅木 +material.redwoodwood.name=红木 +material.firwood.name=冷杉木 +material.purpleheartwood.name=紫心木 +material.silverwoodwood.name=银木 +material.greatwoodwood.name=宏伟之木 +material.yewwood.name=紫杉木 + + + +LEATHER +material.leather.name=皮革 +material.hardleather.name=硬化皮革 +material.minotaurskin.name=牛头人皮革 +material.dragonskin.name=龙皮 + +METAL +material.copper.name=铜 +material.tin.name=锡 + +material.bronze.name=青铜 +material.iron.name=铁 +material.pigiron.name=精铁 +material.steel.name=钢 +material.tungsten.name=黑钨 +material.obsidian.name=黑曜石钢 +material.encrusted.name=镶钻钢 +material.blacksteel.name=黑钢 +material.redsteel.name=赤钢 +material.bluesteel.name=蓝钢 + +material.adamantium.name=艾德曼合金 +material.mithril.name=秘银 +material.ignotumite.name=依格洛特 +material.mithium.name=传说 +material.ender.name=末影 + +PRECIOUS +material.gold.name=金 +material.silver.name=银 + +NON-MF +material.bismuth.name=铋 +material.bismuthbronze.name=铋青铜 +material.nickel.name=镍 +material.titanium.name=钛 +material.stainlesssteel.name=不锈钢 + +ALLOY +material.compositealloy.name=复合合金 + +MOD +material.thaumium.name=神秘 +material.void.name=虚空 +material.manasteel.name=魔力钢 +material.elvenelementium.name=源质 +material.terrasteel.name=泰拉钢 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/ITEM STATS/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +prefix.hotitem.name=加热的%1$s +state.workable=可锻造 +state.unstable=不可锻造 +attribute.weightt.name=重量:%1$st +attribute.weightKg.name=重量:%1$sKg +attribute.weightg.name=重量:%1$sg +attribute.nomfcrafttier.name=任何等级 +attribute.mfcrafttier.name=工具等级 +attribute.mfcrafttool.name=工具类别 +attribute.mfcrafteff.name=工具效率 +attribute.mfcraftedbyname.name=制作者 +tooltype.hammer=锤 +tooltype.hvyHammer=重锤 +tooltype.saw=锯 +tooltype.knife=匕首 +tooltype.needle=针 +tooltype.mallet=槌 +tooltype.spoon=勺 +tooltype.hands=徒手 +tooltype.spanner=扳手 +tooltype.shears=剪刀 +tooltype.brush=油漆刷 + +tooltype.anvil=砧 +tooltype.carpenter=木匠工作台 + +attribute.weapon.penetrateArmor=破甲 +attribute.weapon.daze=眩晕 +attribute.weapon.extendedReach=攻击距离 +attribute.weapon.attackSpeed=攻击速度 +attribute.weapon.backstab=背刺 +attribute.weapon.mountedBonus=骑乘加成 +attribute.weapon.joustDam=骑乘伤害 +attribute.shield.block.time=s 格挡 +attribute.shield.arrow.count=箭 +attribute.quiver.arrow.empty=空 +attribute.quiver.arrow.count=箭 + +attribute.armour.protection=护甲值 +attribute.armour.light=轻型盔甲 +attribute.armour.medium=中型盔甲 +attribute.armour.heavy=重型盔甲 +attribute.weight.name=重量 + +attribute.bowPower.name=伤害倍数 x%1$s +attribute.arrowPower.name=伤害 + +attribute.armour.rating.0=斩击防护: +attribute.armour.rating.1=打击防护: +attribute.armour.rating.2=突刺防护: + +attribute.armour.cuttingresistance=斩击抗性 +attribute.armour.bluntresistance=打击抗性 +attribute.armour.piercingresistance=突刺抗性 + +attribute.weapon.cutting=斩击伤害 +attribute.weapon.blunt=打击伤害 +attribute.weapon.piercing=突刺伤害 + +attribute.armour.dtcutting=斩击阈值 +attribute.armour.dtblunt=打击阈值 +attribute.armour.dtpiercing=突刺阈值 + +arrow.head.normal.name=常规箭头 +arrow.head.bodkin.name=穿甲箭头 +arrow.head.broad.name=宽箭头 + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/COMMODITY/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.plank.name=木材 +item.plant_oil.name=植物油 +item.plankRefined.name=精制木材 +item.rivet.name=铆钉 +item.nail.name=钉子 +item.thread.name=丝线 +item.lime_rock.name=石灰岩 +item.borax_rock.name=硼砂 +item.flux.name=熔剂 +item.flux_strong.name=强力熔剂 +item.coal_prep.name=精煤 +item.coke.name=焦炭 +item.blackpowder.name=黑火药 +item.blackpowder_advanced.name=高级黑火药 +item.bolt.name=螺栓 +item.flux_pot.name=优良熔剂 +item.coal_flux.name=含煤熔剂 + +item.ingotCopper.name=铜锭 +item.ingotTin.name=锡锭 +item.ingotBronze.name=青铜锭 +item.ingotPigIron.name=生铁锭 +item.ingotSteel.name=钢锭 +item.ingotEncrusted.name=镶钻钢锭 +item.ingotObsidian.name=黑曜石钢锭 +item.ingotSilver.name=银锭 +item.ingotPureGold.name=纯金锭 +item.ingotCompositeAlloy.name=复合合金锭 +item.ingotBlackSteelWeak.name=未精炼的黑钢 +item.ingotBlueSteelWeak.name=未精炼的蓝钢 +item.ingotRedSteelWeak.name=未精炼的赤钢 + +item.ingotRedSteel.name=赤钢锭 +item.ingotBlackSteel.name=黑钢锭 +item.ingotBlueSteel.name=蓝钢锭 + +item.ingotAdamantium.name=艾德曼锭 +item.ingotMithril.name=秘银锭 + +item.ingotIgnotumite.name=依格洛特锭 +item.ingotMithium.name=传说锭 + +item.ingotEnder.name=末影锭 + +item.ingotTungsten.name=黑钨锭 + +item.loot_sack.name=战利品 +item.loot_sack_uc.name=贵重的战利品 +item.loot_sack_rare.name=精致的战利品 + +item.copper_coin.name=铜币 +item.silver_coin.name=银币 +item.gold_coin.name=金币 + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/COMPONENT/ +item.ingot_mould.name=锭模 +item.ingot_mould_uncooked.name=未加工的锭模 + +item.clay_pot.name=陶壶 +item.clay_pot_uncooked.name=未加工的陶壶 + +item.jug_empty.name=空罐子 +item.jug_uncooked.name=未加工的罐子 +item.jug_water.name=水罐 +item.jug_milk.name=牛奶罐 + +tile.salvage_basic.name=基础回收站 +tile.salvage_advanced.name=高级回收站 + +tile.repair_basic.name=基础维修工具 +tile.repair_advanced.name=高级维修工具 +tile.repair_ornate.name=华丽维修工具 + +item.rawhideSmall.name=小型兽皮 +item.rawhideMedium.name=中型兽皮 +item.rawhideLarge.name=大型兽皮 + +item.leather_strip.name=皮革条 +item.hideSmall.name=干净的小型兽皮 +item.hideMedium.name=干净的中型兽皮 +item.hideLarge.name=干净的大型兽皮 + +item.vine.name=藤蔓 +item.sharp_rock.name=锋利的岩石 + +item.iron_prep.name=处理好的铁矿石 +item.diamond_shards.name=钻石碎片 +item.diamond_dust.name=钻石粉 +item.obsidian_rock.name=黑曜岩 +item.fletching.name=箭羽 + +item.coalDust.name=煤粉 +item.nitre.name=硝石 +item.sulfur.name=硫黄 +item.bomb_casing_uncooked.name=粘土炸弹壳 +item.bomb_casing.name=炸弹壳 +item.mine_casing_uncooked.name=粘土地雷壳 +item.mine_casing.name=地雷壳 +item.shrapnel.name=弹片 +item.magma_cream_refined.name=精制岩浆膏 +item.bomb_fuse.name=导火索 +item.bomb_fuse_long.name=加长导火索 +item.bomb_casing_iron.name=铁炸弹壳 +item.mine_casing_iron.name=铁地雷壳 +item.bomb_casing_obsidian.name=黑曜石炸弹壳 +item.mine_casing_obsidian.name=黑曜石地雷壳 +item.bomb_casing_crystal.name=水晶炸弹壳 +item.mine_casing_crystal.name=水晶地雷壳 +item.bomb_casing_arrow.name=箭头弹壳 +item.bomb_casing_bolt.name=螺栓弹壳 + +item.clay_brick.name=粘土砖 +item.kaolinite.name=高岭石 +item.kaolinite_dust.name=高岭石粉 +item.fireclay.name=耐火粘土 +item.fireclay_brick.name=耐火粘土砖 +item.strong_brick.name=耐火砖 + +item.oreCopper.name=原铜矿 +item.oreTin.name=原锡矿 +item.oreIron.name=原铁矿 +item.oreSilver.name=原银矿 +item.oreGold.name=原金矿 +item.oreTungsten.name=原黑钨矿 + +item.dragon_heart.name=龙心 +item.ornate_items.name=华丽纹章 + +item.iron_frame.name=铁框架 +item.iron_strut.name=铁压杆 +item.bronze_gears.name=青铜齿轮组 +item.tungsten_gears.name=复杂的齿轮组 +item.steel_tube.name=钢管 +item.cogwork_shaft.name=齿轮轴 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/GADGET/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.spyglass.name=望远镜 +item.climbing_pick_basic.name=登山镐 +item.parachute.name=降落伞 +item.syringe_empty.name=空的注射器 + +tile.cogwork_helm.name=外骨骼头盔座 +tile.cogwork_chest.name=外骨骼胸甲座 +tile.cogwork_legs.name=外骨骼胫甲座 +tile.frame_block.name=框架座 +tile.cogwork_builder.name=机甲钩 + +item.cogwork_pulley.name=机甲滑轮 + +bomb.component.name=炸弹组件 +bomb.component.filling=填充 +bomb.component.bombcase=炸弹外壳 +bomb.component.minecase=地雷外壳 +bomb.component.arrow=弓箭外壳 +bomb.component.bolt=弩箭外壳 +bomb.component.fuse=导火索 +bomb.component.powder=粉末 + +crossbow.component.name=弩弓组件 +crossbow.component.stock=弩臂 +crossbow.component.mechanism=弩弓 +crossbow.component.mod=配件 +crossbow.component.muzzle=弩头 + +item.bomb_crude.name=粗制炸弹 +item.bomb_basic.name=炸弹 +item.bomb_shrapnel.name=弹片炸弹 +item.bomb_fire.name=燃烧弹 +item.exploding_arrow.name=爆炸箭 +item.exploding_bolt.name=爆炸弩箭 + +item.mine_basic.name=地雷 +item.mine_shrapnel.name=弹片地雷 +item.mine_fire.name=燃烧地雷 + +death.attack.mine=%1$s 踩到了地雷 +death.attack.bomb.thrown=%1$s被%2$s炸死了 +death.attack.bomb=%1$s被一个炸弹炸死了 +death.attack.bomb.suicide=%1$s炸死了自己…… + +bomb.powder.blackpowder.name=装填黑火药 +bomb.powder.advBlackpowder.name=装填高级黑火药 +bomb.fuse.basic.name=导火索 +bomb.fuse.long.name=加长导火索 +bomb.case.crude.name=纸壳 +bomb.case.ceramic.name=陶瓷壳 +bomb.case.iron.name=铁壳 +bomb.case.obsidian.name=黑曜石壳 +bomb.case.crystal.name=水晶壳 +bomb.damage.name=爆炸伤害 +bomb.range.metric.name=爆炸范围:%1$s 米 +bomb.fusetime.name=点燃时间:%1$s 秒 +bomb.case.sticky=粘性 + +gui.bombcraftmf.name=制作炸弹 +gui.crossbowcraftmf.name=制作弩弓 + +attribute.crossbow.power.name=伤害系数 x%1$s +attribute.crossbow.speed.name= %1$ss +attribute.crossbow.spread.name=射击范围 x%1$s +attribute.crossbow.recoil.name=后坐力 x%1$s +attribute.crossbow.capacity.name= %1$s +attribute.crossbow.bash.name= %1$s + +crosspart.stock.cross_stock_wood=木弩 +crosspart.stock.cross_stock_iron=铁弩 +crosspart.stock.cross_handle_wood=手弩 +crosspart.mechanism.cross_arms_light=轻型 +crosspart.mechanism.cross_arms_heavy=重型 +crosspart.mechanism.cross_arms_advanced=高级 +crosspart.mod.cross_ammo=换弹 +crosspart.mod.cross_scope=瞄准 + +item.cross_stock_wood.name=基础弩臂 +item.cross_handle_wood.name=手弩把手 +item.cross_stock_iron.name=高级弩臂 +item.cross_arms_light.name=轻型弩弓 +item.cross_arms_basic.name=弩弓 +item.cross_arms_heavy.name=重型弩弓 +item.cross_arms_advanced.name=高级弩弓 +item.cross_ammo.name=连弩弩机 +item.cross_scope.name=弓弩瞄准镜 +item.cross_bayonet.name=弓弩刺刀 + +item.cross_stock_wood.desc=标准。 +item.cross_handle_wood.desc=快速换弹,更多的后坐力和扩散。 +item.cross_stock_iron.desc=降低后坐力。 +item.cross_arms_light.desc=更低的伤害和后坐力,射速快。 +item.cross_arms_basic.desc=标准。 +item.cross_arms_heavy.desc=更高的伤害和后坐力,射速慢。 +item.cross_arms_advanced.desc=更高的精度和伤害,但射速慢,后坐力大。 +item.cross_ammo.desc=6x 弹药容量,增加扩散。 +item.cross_scope.desc=增加缩放功能。 +item.cross_bayonet.desc=增加近战伤害,减少后坐力,换弹变慢。 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/ORES/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +tile.oreCopper.name=铜矿石 +tile.oreTin.name=锡矿石 +tile.oreSilver.name=银矿石 +tile.oreTungsten.name=黑钨矿石 +tile.oreMythic.name=传说矿石 +tile.oreMythicPure.name=纯净传说矿石 + +tile.oreClay.name=含粘土的泥土 +tile.oreBorax.name=硼砂矿石 +tile.oreKaolinite.name=高岭石矿石 +tile.oreNitre.name=硝石矿石 +tile.oreSulfur.name=硫磺矿石 +tile.oreCoalRich.name=富煤矿石 + +tile.window.name=窗户 +tile.window_pane.name=窗板 +tile.mud_pavement.name=粗泥砖 +tile.mud_pavement_stair.name=粗泥砖台阶 +tile.mud_brick.name=泥砖 +tile.mud_brick_stair.name=泥砖台阶 +tile.thatch.name=茅草 +tile.thatch_stair.name=茅草楼梯 + +tile.limestone.name=石灰岩 +tile.limestone_cobblestone.name=石灰圆石 +tile.limestone_brick.name=石灰岩砖 +tile.limestone_pavement.name=石灰岩铺路石 +tile.limestone_stair.name=石灰岩楼梯 +tile.limestone_cobblestone_stair.name=石灰圆石楼梯 +tile.limestone_brick_stair.name=石灰岩砖楼梯 +tile.limestone_pavement_stair.name=石灰岩铺路石楼梯 + +tile.slate.name=板岩 +tile.slate_cobblestone.name=板岩圆石 +tile.slate_brick.name=板岩石砖 +tile.slate_pavement.name=板岩铺路石 +tile.slate_stair.name=板岩楼梯 +tile.slate_cobblestone_stair.name=板岩圆石楼梯 +tile.slate_brick_stair.name=板岩石砖楼梯 +tile.slate_pavement_stair.name=板岩铺路石楼梯 + +tile.framed_glass.name=带框架的玻璃 +tile.framed_pane.name=带框架的玻璃板 +tile.firebricks.name=耐火石砖 +tile.firebrick_stair.name=耐火石砖台阶 +tile.cobble_pavement.name=圆石铺路石 +tile.cobble_pavement_stair.name=圆石铺路石台阶 +tile.cobble_brick.name=圆石砖 +tile.cobble_brick_stair.name=圆石砖台阶 +tile.clayWall.name=粘土墙板 +tile.ironbark_log.name=桉木 +tile.ebony_log.name=黑檀木 +tile.yew_log.name=紫衫木 +tile.ironbark_leaves.name=桉树树叶 +tile.ebony_leaves.name=黑檀树树叶 +tile.yew_leaves.name=紫衫树树叶 +tile.ironbark_sapling.name=桉树苗 +tile.ebony_sapling.name=黑檀树树苗 +tile.yew_sapling.name=紫衫树苗 +tile.ironbark_planks.name=桉木板 +tile.ebony_planks.name=乌木木板 +tile.yew_planks.name=紫衫木板 +tile.ironbark_stair.name=桉木楼梯 +tile.ebony_stair.name=黑檀木楼梯 +tile.yew_stair.name=紫衫木楼梯 + +tile.nailed_planks.name=钉制木板 +tile.refined_planks.name=精致钉制木板 +tile.nailed_planks_stair.name=钉制木板台阶 +tile.refined_planks_stair.name=精致钉制木板台阶 + +tile.reinforced_stone_base.name=强化石头 +tile.reinforced_stone_engraved.name=錾制强化石头 + +tile.reinforced_stone_bricks_base.name=强化石砖 +tile.reinforced_stone_bricks_cracked.name=强化裂石砖 +tile.reinforced_stone_bricks_mossy.name=强化苔石砖 + +tile.reinforced_stone_framed.name=加固强化石头 +tile.reinforced_stone_stair.name=强化石头台阶 +tile.reinforced_stone_brick_stair.name=强化石砖台阶 + +tile.bronze_bars.name=青铜栅栏 +tile.iron_bars.name=铁栅栏 +tile.steel_bars.name=钢栅栏 +tile.dragonforge_bars.name=龙铸栅栏 +tile.redsteel_bars.name=赤钢栅栏 +tile.blacksteel_bars.name=黑钢栅栏 +tile.bluesteel_bars.name=蓝钢栅栏 + +tile.copper_block.name=铜块 +tile.tin_block.name=锡块 +tile.silver_block.name=银块 +tile.pigiron_block.name=生铁块 + +tile.bronze_block.name=青铜块 +tile.steel_block.name=钢块 +tile.dragonforge_block.name=龙铸块 +tile.redsteel_block.name=红钢块 +tile.blacksteel_block.name=黑钢块 +tile.bluesteel_block.name=蓝钢块 + +tile.adamantium_block.name=艾德曼合金块 +tile.mithril_block.name=秘银块 +tile.ignotumite_block.name=依格洛特块 +tile.mithium_block.name=传说块 + +tile.ender_block.name=末影块 + +tile.forge.stone.name=石头锻造炉 +tile.forge.metal.name=高级锻造炉 +tile.bloomery.name=冶炼炉 +tile.crucible.stone.name=石坩埚 +tile.crucible.fireclay.name=耐火坩埚 +tile.crucible.auto.name=高级坩埚 +tile.crucible.mythic.name=古法坩埚 +tile.crucible.master.name=大师级古法坩埚 + +tile.chimney.stone.name=石头烟囱 +tile.chimney.stone.wide.name=加宽石头烟囱 +tile.chimney.stone_extractor.wide.name=石头排烟器 +tile.chimney.pipe.name=排烟管道 +tile.bellows.name=风箱 +tile.tanner.name=简陋的制革架 +tile.tannerStrong.name=制革架 +tile.tannerMetal.name=高级制革架 +tile.bombBench.name=炸弹组装台 +tile.crossbowBench.name=弓弩组装台 +tile.bombPress.name=炸弹组装机 +tile.carpenterBench.name=木匠工作台 +tile.researchStation.name=研究台 +tile.quern.name=手推磨 +tile.anvilStone.name=石砧 +tile.anvilBronze.name=青铜砧 +tile.anvilIron.name=铁砧 +tile.anvilSteel.name=钢砧 +tile.anvilBlackSteel.name=黑钢砧 +tile.anvilRedSteel.name=赤钢砧 +tile.anvilBlueSteel.name=蓝钢砧 +tile.furnace_stone.name=火炉 +tile.furnace_heater.name=火炉加热器 +tile.blastfurnchamber.name=高炉炉室 +tile.blastfurnheater.name=高炉加热器 + +tile.firepit.name=火塘 +tile.food_roast_basic.name=烤盘 +tile.food_oven_basic.name=石烤箱 + +tile.rack_wood.name=%1$s工具架 +tile.food_box_basic.name=%1$s食物箱 +tile.ammo_box_basic.name=%1$s弹药箱 +tile.crate_basic.name=%1$s箱 +tile.trough_wood.name=%1$s槽 +attribute.box.capacity.name=容量:%1$s组 +attribute.fill.capacity.name=容量:%1$s +attribute.fill=填充 x%1$s + +item.bedroll.name=床铺 +tile.bedroll.name=床铺 + +tile.framed_end.name=带框末地石 +tile.decorated_end.name=装饰用末地石 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/TABS/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +itemGroup.forgedtool=[MF] 锻制工具 +itemGroup.forgedweapon=[MF] 锻制武器 +itemGroup.forgedarmour=[MF] 锻制盔甲 +itemGroup.MFGadgets=[MF] 小工具 +itemGroup.MFUtil=[MF] 实用方块 +itemGroup.MFBows=[MF] 弓箭用具 +itemGroup.MFMaterials=[MF] 材料 +itemGroup.MFadvancedtool=[MF] 高级工具 +itemGroup.MFcrafttool=[MF] 合成工具 +itemGroup.MFore=[MF] 矿物 +itemGroup.MFfood=[MF] 食物 +itemGroup.MFOld=[MF] 原始物品 +itemGroup.MFdragonforged=[MF] 龙铸风格 +itemGroup.MFornate=[MF] 华丽风格 + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/FIRESTARTER/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.dryrocks.name=干燥岩石 +item.tinderbox.name=火绒箱 + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/BANDAGE/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.bandage_crude.name=粗糙的绷带 +item.bandage_wool.name=羊毛绷带 +item.bandage_tough.name=精良的绷带 + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/TRAINING/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.training_sword.name=训练用剑 +item.training_waraxe.name=训练用战斧 +item.training_mace.name=训练用权杖 +item.training_spear.name=训练用长矛 + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/LEATHER STUFF/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.hide_helmet.name=生皮头盔 +item.hide_chest.name=生皮胸甲 +item.hide_legs.name=生皮护腿 +item.hide_boots.name=生皮靴子 + +item.roughleather_helmet.name=粗糙的皮革头盔 +item.roughleather_chest.name=粗糙的皮革胸甲 +item.roughleather_legs.name=粗糙的皮革护腿 +item.roughleather_boots.name=粗糙的皮革靴子 + +item.strongleather_helmet.name=强化的皮革头盔 +item.strongleather_chest.name=强化的皮革胸甲 +item.strongleather_legs.name=强化的皮革护腿 +item.strongleather_boots.name=强化的皮革靴子 + +item.studleather_helmet.name=镶钉头盔 +item.studleather_chest.name=镶钉胸甲 +item.studleather_legs.name=镶钉护腿 +item.studleather_boots.name=镶钉靴子 + +item.scaleleather_helmet.name=棉甲头盔 +item.scaleleather_chest.name=棉甲胸甲 +item.scaleleather_legs.name=棉甲护腿 +item.scaleleather_boots.name=棉甲靴子 + +item.padded_helmet.name=带衬帽子 +item.padded_chest.name=带衬软铠 +item.padded_legs.name=带衬护腿 +item.padded_boots.name=带衬靴子 + +item.leatherapron.name=皮革铁匠服装 + + + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/WOOD STUFF/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.malletWood.name=木槌 +item.spoonWood.name=木勺 +item.paint_brush.name=油漆刷 + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/STONE STUFF/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.stone_pick.name=石镐 +item.stone_axe.name=石斧 +item.stone_hoe.name=石锄 +item.stone_spade.name=石锹 + +item.stone_knife.name=石匕首 +item.stone_hammer.name=石锤 +item.stone_tongs.name=石钳 +item.bone_needle.name=骨针 + +item.stone_sword.name=石剑 +item.stone_waraxe.name=石战斧 +item.stone_mace.name=石棍棒 +item.stone_spear.name=石矛 + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/STANDARD/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +languagecfg.tooltiptier=false +//You can move the main tier to the tooltip if this is true,make sure to remove "%1$s " instnaces if you do this + +item.standard_pick.name=%1$s镐 +item.standard_axe.name=%1$s斧 +item.standard_spade.name=%1$s锹 +item.standard_hoe.name=%1$s锄 + +item.standard_shears.name=%1$s剪刀 +item.standard_knife.name=%1$s匕首 +item.standard_needle.name=%1$s针 +item.standard_hammer.name=%1$s锤 +item.standard_hvyhammer.name=%1$s重锤 +item.standard_tongs.name=%1$s钳 +item.standard_saw.name=%1$s锯 +item.standard_spanner.name=%1$s扳手 + + +item.standard_dagger.name=%1$s短剑 +item.standard_sword.name=%1$s剑 +item.standard_mace.name=%1$s权杖 +item.standard_waraxe.name=%1$s战斧 +item.standard_spear.name=%1$s矛 + +item.standard_katana.name=%1$s太刀 +item.standard_greatsword.name=%1$s巨剑 +item.standard_warhammer.name=%1$s战锤 +item.standard_battleaxe.name=%1$s双刃斧 +item.standard_halbeard.name=%1$s戟 +item.standard_lance.name=%1$s骑士枪 + +item.standard_handpick.name=%1$s手镐 +item.standard_hvypick.name=%1$s重镐 +item.standard_trow.name=%1$s手锹 +item.standard_hvyshovel.name=%1$s重锹 +item.standard_scythe.name=%1$s镰刀 +item.standard_mattock.name=%1$s鹤嘴锄 +item.standard_lumber.name=%1$s伐木斧 + +item.standard_scale_helmet.name=%1$s鳞盔 +item.standard_scale_chest.name=%1$s鳞甲 +item.standard_scale_legs.name=%1$s鳞护腿 +item.standard_scale_boots.name=%1$s鳞靴 + +item.standard_chain_helmet.name=%1$s链盔 +item.standard_chain_chest.name=%1$s链甲 +item.standard_chain_legs.name=%1$s链护腿 +item.standard_chain_boots.name=%1$s链靴 + +item.standard_splint_helmet.name=%1$s藤盔 +item.standard_splint_chest.name=%1$s藤甲 +item.standard_splint_legs.name=%1$s藤护腿 +item.standard_splint_boots.name=%1$s藤靴 + +item.standard_plate_helmet.name=%1$s头盔 +item.standard_plate_chest.name=%1$s护甲 +item.standard_plate_legs.name=%1$s板护腿 +item.standard_plate_boots.name=%1$s护靴 + +item.standard_bow.name=%1$s弓 +item.standard_arrow.name=%1$s箭 +item.standard_bolt.name=%1$s弩箭 + +item.standard_mallet.name=%1$s槌 +item.standard_spoon.name=%1$s勺 + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/DRAGONFORGE/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.dragonforged_pick.name=龙铸%1$s镐 +item.dragonforged_axe.name=龙铸%1$s斧 +item.dragonforged_spade.name=龙铸%1$s锹 +item.dragonforged_hoe.name=龙铸%1$s锄 + +item.dragonforged_shears.name=龙铸%1$s剪刀 +item.dragonforged_knife.name=龙铸%1$s匕首 +item.dragonforged_needle.name=龙铸%1$s针 +item.dragonforged_hammer.name=龙铸%1$s锤 +item.dragonforged_hvyhammer.name=龙铸%1$s重锤 +item.dragonforged_tongs.name=龙铸%1$s钳 +item.dragonforged_saw.name=龙铸%1$s锯 +item.dragonforged_spanner.name=龙铸%1$s扳手 + + +item.dragonforged_dagger.name=龙铸%1$s短剑 +item.dragonforged_sword.name=龙铸%1$s剑 +item.dragonforged_mace.name=龙铸%1$s权杖 +item.dragonforged_waraxe.name=龙铸%1$s战斧 +item.dragonforged_spear.name=龙铸%1$s矛 + +item.dragonforged_katana.name=龙铸%1$s太刀 +item.dragonforged_greatsword.name=龙铸%1$s巨剑 +item.dragonforged_warhammer.name=龙铸%1$s战锤 +item.dragonforged_battleaxe.name=龙铸%1$s双刃斧 +item.dragonforged_halbeard.name=龙铸%1$s戟 +item.dragonforged_lance.name=龙铸%1$s骑士枪 + +item.dragonforged_handpick.name=龙铸%1$s手镐 +item.dragonforged_hvypick.name=龙铸%1$s重镐 +item.dragonforged_trow.name=龙铸%1$s手锹 +item.dragonforged_hvyshovel.name=龙铸%1$s重锹 +item.dragonforged_scythe.name=龙铸%1$s镰刀 +item.dragonforged_mattock.name=龙铸%1$s鹤嘴锄 +item.dragonforged_lumber.name=龙铸%1$s伐木斧 + +item.dragonforged_scale_helmet.name=龙铸%1$s鳞盔 +item.dragonforged_scale_chest.name=龙铸%1$s鳞甲 +item.dragonforged_scale_legs.name=龙铸%1$s鳞护腿 +item.dragonforged_scale_boots.name=龙铸%1$s鳞靴 + +item.dragonforged_chain_helmet.name=龙铸%1$s链盔 +item.dragonforged_chain_chest.name=龙铸%1$s链甲 +item.dragonforged_chain_legs.name=龙铸%1$s链护腿 +item.dragonforged_chain_boots.name=龙铸%1$s链靴 + +item.dragonforged_splint_helmet.name=龙铸%1$s藤盔 +item.dragonforged_splint_chest.name=龙铸%1$s藤甲 +item.dragonforged_splint_legs.name=龙铸%1$s藤护腿 +item.dragonforged_splint_boots.name=龙铸%1$s藤靴 + +item.dragonforged_plate_helmet.name=龙铸%1$s头盔 +item.dragonforged_plate_chest.name=龙铸%1$s护甲 +item.dragonforged_plate_legs.name=龙铸%1$s板护腿 +item.dragonforged_plate_boots.name=龙铸%1$s护靴 + +item.dragonforged_bow.name=龙铸%1$s弓 + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/ORNATE/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.ornate_pick.name=华丽%1$s镐 +item.ornate_axe.name=华丽%1$s斧 +item.ornate_spade.name=华丽%1$s锹 +item.ornate_hoe.name=华丽%1$s锄 + +item.ornate_shears.name=华丽%1$s剪刀 +item.ornate_knife.name=华丽%1$s匕首 +item.ornate_needle.name=华丽%1$s针 +item.ornate_hammer.name=华丽%1$s锤 +item.ornate_hvyhammer.name=华丽%1$s重锤 +item.ornate_tongs.name=华丽%1$s钳 +item.ornate_saw.name=华丽%1$s锯 +item.ornate_spanner.name=华丽%1$s扳手 + + +item.ornate_dagger.name=华丽%1$s短刀 +item.ornate_sword.name=华丽%1$s剑 +item.ornate_mace.name=华丽%1$s权杖 +item.ornate_waraxe.name=华丽%1$s战斧 +item.ornate_spear.name=华丽%1$s矛 + +item.ornate_katana.name=华丽%1$s太刀 +item.ornate_greatsword.name=华丽%1$s巨剑 +item.ornate_warhammer.name=华丽%1$s战锤 +item.ornate_battleaxe.name=华丽%1$s双刃斧 +item.ornate_halbeard.name=华丽%1$s戟 +item.ornate_lance.name=华丽%1$s骑士枪 + +item.ornate_handpick.name=华丽%1$s手镐 +item.ornate_hvypick.name=华丽%1$s重镐 +item.ornate_trow.name=华丽%1$s Spade +item.ornate_hvyshovel.name=华丽%1$s重锹 +item.ornate_scythe.name=华丽%1$s镰刀 +item.ornate_mattock.name=华丽%1$s鹤嘴锄 +item.ornate_lumber.name=华丽%1$s伐木斧 + +item.ornate_scale_helmet.name=华丽%1$s鳞盔 +item.ornate_scale_chest.name=华丽%1$s鳞甲 +item.ornate_scale_legs.name=华丽%1$s鳞护腿 +item.ornate_scale_boots.name=华丽%1$s鳞靴 + +item.ornate_chain_helmet.name=华丽%1$s链盔 +item.ornate_chain_chest.name=华丽%1$s链甲 +item.ornate_chain_legs.name=华丽%1$s链护腿 +item.ornate_chain_boots.name=华丽%1$s链靴 + +item.ornate_splint_helmet.name=华丽%1$s藤盔 +item.ornate_splint_chest.name=华丽%1$s藤甲 +item.ornate_splint_legs.name=华丽%1$s藤护腿 +item.ornate_splint_boots.name=华丽%1$s藤靴 + +item.ornate_plate_helmet.name=华丽%1$s头盔 +item.ornate_plate_chest.name=华丽%1$s护甲 +item.ornate_plate_legs.name=华丽%1$s板护腿 +item.ornate_plate_boots.name=华丽%1$s护靴 + +item.ornate_bow.name=华丽%1$s弓 + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/ARTEFACT/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +stat.artefact.name=工艺品 +item.ancient_jewel.name=古代珠宝 +item.trilogy_jewel.name=古代三重珠宝 + +item.schem_gears.name=机甲机械图纸 +item.schem_forge.name=高级锻造炉图纸 +item.schem_cogwork.name=机甲框架图纸 +item.schem_bomb.name=矮人炸弹图纸 +item.schem_crossbow.name=矮人弩图纸 +item.schem_alloy.name=复合合金图纸 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/FOOD/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.berries.name=浆果 +item.berriesJuicy.name=多汁的浆果 +item.generic_meat_uncooked.name=生肉 +item.generic_meat_cooked.name=熟肉 +item.generic_meat_strip_uncooked.name=生肉片 +item.generic_meat_strip_cooked.name=熟肉片 +item.generic_meat_chunk_uncooked.name=生肉块 +item.generic_meat_chunk_cooked.name=熟肉块 +item.generic_meat_mince_uncooked.name=生肉末 +item.generic_meat_mince_cooked.name=熟肉末 +item.burnt_food.name=烧焦的食物 +item.burnt_pot.name=烧焦的食物 +item.burnt_cake.name=烧焦的食物 +item.burnt_pie.name=烧焦的食物 + +tile.berries.name=浆果丛 +item.breadcrumbs.name=面包屑 +item.breadroll.name=面包卷 +item.breadslice.name=面包片 +item.horse_raw.name=生马肉 +item.horse_cooked.name=熟马肉 +item.wolf_raw.name=生狼排 +item.wolf_cooked.name=熟狼排 +item.mutton_raw.name=生羊肉 +item.mutton_cooked.name=熟羊肉 +item.spider_raw.name=生蜘蛛肉 +item.spider_cooked.name=熟蜘蛛肉 + +item.bowl_water_salt.name=盐水 +item.salt.name=盐 +item.cake_tin.name=饼模 +item.pie_tin.name=馅饼盘 +item.pie_tray_uncooked.name=粘土馅饼盘 +item.flour.name=面粉 +item.sugarpot.name=糖罐 +item.bread_uncooked.name=未烤过的面包 +item.guts.name=内脏 + +item.raw_bread.name=面包面团 +item.dough.name=面团 +item.pastry.name=糕点 +item.stew.name=炖菜 +item.oats.name=燕麦 + +item.curds.name=奶酪 +item.cheese_pot.name=奶酪罐 + +item.jerky.name=牛肉干 +item.cheese_roll.name=卷酪卷 +item.sweetroll.name=甜面包 +item.sandwitch.name=三明治 + +tile.pie_meat.name=肉馅派 +tile.pie_apple.name=苹果派 +tile.pie_berry.name=浆果派 +tile.pie_shepards.name=马铃薯派 + +item.meatpie_slice.name=切片肉馅派 +item.pieslice_apple.name=切片苹果派 +item.pieslice_berry.name=切片浆果派 +item.pieslice_shepards.name=切片马铃薯派 + +item.chicken_roast.name=烤鸡肉 +item.pork_roast.name=烤猪肉 +item.beef_roast.name=烤牛肉 +item.mutton_roast.name=烤羊肉 + +tile.cake_vanilla.name=蛋糕 +tile.cake_carrot.name=胡萝卜蛋糕 +tile.cake_chocolate.name=巧克力蛋糕 +tile.cake_bf.name=黑森林蛋糕 + +item.cake_slice.name=切片蛋糕 +item.carrotcake_slice.name=切片胡萝卜蛋糕 +item.choccake_slice.name=切片巧克力蛋糕 +item.bfcake_slice.name=切片黑森林蛋糕 + +item.coca_powder.name=可可粉 +item.chocolate.name=巧克力 +item.chocchips.name=巧克力豆 +item.eclair.name=泡芙 +item.eclair_raw.name=泡芙面团 +item.eclair_uniced.name=未加糖霜的泡芙 +item.eclair_empty.name=未填充的泡芙 +item.saussage_cooked.name=腊肠 +item.saussage_raw.name=生腊肠 +tile.cheese.name=奶酪圈 +item.cheese_slice.name=奶酪 +item.sushi.name=寿司 +item.curry.name=咖喱 +item.pizza_basic.name=披萨 +item.sweetroll_raw.name=甜面包面团 +item.sweetroll_uniced.name=未加糖霜的甜面包 +item.icing.name=糖霜 +item.custard.name=蛋奶冻 + +item.cake_raw.name=蛋糕面糊 +item.cake_simple_raw.name=简易蛋糕面糊 +item.cake_carrot_raw.name=胡萝卜蛋糕面糊 +item.cake_choc_raw.name=巧克力蛋糕面糊 +item.cake_bf_raw.name=黑森林蛋糕面糊 + +item.cake_uniced.name=未加糖霜的蛋糕 +item.cake_simple_uniced.name=未加糖霜的简易蛋糕 +item.cake_carrot_uniced.name=未加糖霜的胡萝卜蛋糕 +item.cake_choc_uniced.name=未加糖霜的巧克力蛋糕 +item.cake_bf_uniced.name=未加糖霜的黑森林蛋糕 + +item.pie_meat_uncooked.name=未煮过的肉馅派 +item.pie_apple_uncooked.name=未煮过的苹果派 +item.pie_berry_uncooked.name=未煮过的浆果派 +item.pie_shepard_uncooked.name=未煮过的马铃薯派 +item.pie_pumpkin_uncooked.name=未煮过的南瓜派 + +item.pie_meat_cooked.name=熟肉馅派 +item.pie_apple_cooked.name=熟苹果派 +item.pie_berry_cooked.name=熟浆果派 +item.pie_shepard_cooked.name=熟马铃薯派 +item.pie_pumpkin_cooked.name=熟南瓜派 + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/FOOD STATS/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +food.stat.list.name=进食时: +food.stat.hunger.name=+%1$s 饱食度 +food.stat.staminaPlus.name=恢复%1$耐力 +food.stat.staminabuffHours.name=%2$s小时内增加%1$s耐力 +food.stat.staminabuffMinutes.name=%2$s分钟内增加%1$s耐力 +food.stat.staminabuffSeconds.name=%2$s秒内增加%1$s耐力 +food.stat.saturationMinutes.name=%1$s分钟内饱和 +food.stat.saturationSeconds.name=%1$s秒内饱和 +food.stat.saturation.name=饱和度:%1$s +food.stat.staminabuffRegenMinutes.name=%2$s分钟内每秒恢复%1$s耐力 +food.stat.staminabuffRegenSeconds.name=%2$s秒内每秒恢复%1$s耐力 +food.stat.cure.poison=解毒 + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/CONSTRUCTION/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +item.hinge.name=铰链 +item.commodity_plank_cut.name=切好的%1$s木材 +item.commodity_plank_pane.name=%1$s木嵌板 + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/RPG/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +rpg.levelup=你的%1$s技能已经升到了%2$s级 +rpg.required=需要 %1$s %2$s +rpg.skillmod=技能修正:+ + +skill.lowskill=你没有足够的技能! +skill.value=等级:%1$s + +skill.list.basic=基本技能 +skill.list.craft=合成技能 +skill.list.combat=战斗技能 + +skill.artisanry.name=手艺 +skill.construction.name=建造 +skill.provisioning.name=烹饪 +skill.engineering.name=机械 +skill.combat.name=锻铸 + +item.skillbook_artisanry.name=锻造的艺术 +item.skillbook_artisanry.desc=+%1$s手艺 +item.skillbook_construction.name=木工技术 +item.skillbook_construction.desc=+%1$s工程 +item.skillbook_provisioning.name=养活一个村庄 +item.skillbook_provisioning.desc=+%1$s烹饪 +item.skillbook_engineering.name=高级机械 +item.skillbook_engineering.desc=+%1$s制造 +item.skillbook_combat.name=御敌兵法 +item.skillbook_combat.desc=+%1$s锻铸 + +item.skillbook_artisanry2.name=上古工匠史 +item.skillbook_artisanry2.desc=手艺-MAX +item.skillbook_construction2.name=建筑档案库 +item.skillbook_construction2.desc=建造-MAX +item.skillbook_provisioning2.name=贸易史 +item.skillbook_provisioning2.desc=烹饪-MAX +item.skillbook_engineering2.name=工程师词典 +item.skillbook_engineering2.desc=机械-MAX +item.skillbook_combat2.name=作战制胜日志 +item.skillbook_combat2.desc=锻铸-MAX +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/KNOWLEDGE INFORMATION/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +method.workbench=基础工作台 +method.furnace=熔炉 +method.bloomery=锻铁炉 +method.blastfurnace=高炉 +method.anvil=砧 +method.carpenter=木匠工作台 +method.crucible=坩埚 +method.crucibleT2=耐火坩埚 +method.crucibleT3=传说坩埚 +method.crucibleT4=大师级坩埚 +method.quern=磨盘 +info.hasKnowledge=可研究 + +gui.purchase=购买 +knowledge.guiSubtitle=这是GUI +knowledge.basicstructure=基本结构 +knowledge.example=范例 +knowledge.rightclickspanner=手持扳手右键 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/KNOWLEDGE TEXT/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +knowledge.title= +knowledge.title.desc= +knowledge.title.1= + +knowledge.minotaurs=牛头人 +knowledge.minotaurs.desc=可憎之物 + +knowledge.minotaurs.1=罕有生物可以与牛头人的力量和狂暴匹敌。据传说,可怖的牛头人是人和牛的结合体。牛头人是杂食动物、暴脾气。因此牛头人是杂食生物,同时有着极为暴躁的脾气。^不像它们的祖先,牛头人非常强壮,如果它们动手,足以在数秒之内将人撕成碎片。它们可以在敌人的鲜血中快速恢复自己的伤势。在某些时候,它们也显示出集群活动的迹象。 +knowledge.minotaurs.2=$h小牛头人-$r^在野外,那些小型牛头人欺凌不幸接近它们的生物的事情数见不鲜。^不要被这些家伙的体型欺骗,它们依旧是正经的牛头人。如果你在野外见到它们,要么是流浪者,要么是外出为它们更壮的同伴开路的。 +knowledge.minotaurs.3=$h大牛头人-$r^大牛头人被发现居住在地下的矮人遗迹中,这给探险者增添了不小的挑战。^这些牛头人更加团结和危险。最普通的牛头人战士已经相当凶猛,而且手持武器,而那些在遗迹深处的精英和领主更不必说。所以在探索遗迹之前请务必多做准备。一只牛头人战士也许只是一个挑战,但是要是一群的话……无人幸存。 +knowledge.minotaurs.4=$h物种-$r^在野外和遗迹中已有三种牛头人亚种被发现。尽管不同种类的牛头人在生存和行动模式上大同小异,但是它们的身体属性有所不同。 +knowledge.minotaurs.combat=$h战斗-$r^要对付一只牛头人?有用的建议有一大堆。别让它们离你太近,即使是最强的护甲也会在它们狂怒的打击下变形失效。虽然很多牛头人都身着优良的护甲,但是不管是皮甲还是板甲都弱突刺攻击,一只矛就对其造成大量伤害。除此之外炸弹,地雷,弓箭还有重甲都会大大提高你的生存几率。 + +knowledge.mob.minotaur.name=棕毛牛头人 + +knowledge.minotaur.1=棕毛牛头人是一种很常见的生物,他们拥有极大的力气,是强大的对手。尽管普通的牛头人除了自己的皮毛外没有多余的防护,但是依旧难以杀死。 + +knowledge.mob.minotaur_frost.name=冰霜牛头人 + +knowledge.minotaur_frost.1=冰霜牛头人生活在寒冷的地区,因此比起那些棕毛的近亲有着更厚的皮毛。白化的牛头人在雪地里难以分辨,它们会借助伪装对那些粗心的旅人发动致命的袭击。 + +knowledge.mob.minotaur_dread.name=噩梦牛头人 + +knowledge.minotaur_dread.1=人们对被部分人称为噩梦牛头人的生物所知甚少。它们是地狱的住民,长着暗灰色或者黑色的毛,还有强韧的皮肤以及对火焰的完全免疫力。这种怪物远比主世界里的表亲要难对付得多。 + +knowledge.dragons=龙 +knowledge.dragons.desc=死从天降 + +knowledge.dragons.1=龙是高傲与破坏性兼具的爬行动物,在天空中追踪猎物。全世界已发现多种龙类,在攻击力上差别巨大。在旅行时你要留意天空,避免龙的偷袭。^每条龙都有着喷出致命吐息的独特能力,尽管这一能力的背后机制仍然不明,做好准备应对危险总是没错的。 + +knowledge.dragons.2=虽然它们中的年幼个体也许稍微容易杀死,但那些更年长的龙是强大的怪物。这些爬行动物的外皮是如此坚韧,以至于大多数武器无法造成有效杀伤。只有那些特别的龙铸武器可以穿透他们坚硬的龙鳞来重创它们。^龙之心对于老练的工匠来说非常珍贵,所以它们才会被人捕猎。但是要注意,年轻的龙的心脏一文不值,只有那些上了年纪的龙才会因上述原因而遭到猎杀。 + +knowledge.mob.red_dragon.name=赤炎龙 +knowledge.red_dragon.1=最常见的龙类,赤炎龙拥有喷火的能力,很多人都因为它们不幸殒命,有时甚至连整个村落都在龙息中化为灰烬。比起它们的同类,它们并不经常使用吐息,即便如此,它们在近战撕咬上仍极具攻击性。 + +knowledge.mob.blue_dragon.name=冰霜龙 +knowledge.blue_dragon.1=生活在更为寒冷的地区,冰霜龙因它们吐出刺骨的寒风冻结敌人的能力而得名。冰霜龙看上去并没有它们的表亲那般可怕,但是它们的攻击依旧是致命的。 + +knowledge.mob.green_dragon.name=绿沼龙 +knowledge.green_dragon.1=绿沼龙--亦被称为“毒龙”--有着肮脏而可怕的天性。它们主要栖息于沼泽中,但是在雨天也可以外出捕食。^绿沼龙可以发出致命的酸液吐息,足以腐蚀铠甲,并让不幸的受害者中毒。 + +knowledge.mob.ash_dragon.name=灰烬龙 +knowledge.ash_dragon.1=灰烬龙可在那些炎热干燥的地方,譬如沙漠中被发现,它们可以经由独有的两足特征 (一般的龙是四足) 来轻易判别。灰烬龙是瞎子,它们依靠声音和气味来追踪猎物。所以见到它们时,保持距离,悄悄通过来躲开它们。 + +knowledge.dragons.combat=$h战斗策略-$r^龙族速度很快并具备制空优势,但是这并不是说它们是无敌的。首先它们会反复离开并返回战场,你最好一直拉住其仇恨以免让它溜走。其次在龙俯冲下来的时候开始攻击,此时使用远程武器会较为安全。除此之外,特制的龙铸武器也会给你在与龙的战斗中提供一点优势。 + +knowledge.gettingStarted=新手指南 +knowledge.gettingStarted.desc=初识世界 + +knowledge.gettingStarted.1=这里是你探索本模组的起点。我们提醒您在开始之前至少应该有一个山洞可以避雨,还有一块能发展的地方,同时您也应该有一点木材、煤、铜、石头和皮革的储备。准备万全时您就可以开工了,要在这个世界里有所作为,你需要完成三个主要环节。 +knowledge.gettingStarted.2=合成物品不再像原版那样简单了,你也需要参与其中。首先,按照说明的内容处理材料 (比如给要在砧上锻造的材料进行加热) ,之后根据加工的物品使用正确的工具 (比如空手、匕首、锤子等) 持续处理物品填满进度条来完成加工。 + +knowledge.gettingStarted.hcc=$h困难合成-$r^困难合成默认是开启的。在此模式下,原版工具的效果会被削弱,我们建议你制作原始工具。在研究手册的“工艺”一栏可以查看所有这些工具的合成方式。^准备开荒:在不用工具的情况下破坏石头会掉落锋利岩石。^用这些石头来采集藤蔓、树枝、还有原木。 + +knowledge.gettingStarted.fire=$h火塘-$r^在你开始工作之前,你需要两个火塘,一个用来提供火源,另一个用来烹饪 (如果你有肉) 。^拿着本模组的木材右键火塘来添加燃料,然后使用引火器具点火。 +knowledge.gettingStarted.food=你可以在其中一个火塘上放一个烤盘.然后你需要拿着生的食物 (主要是肉) 右键烤盘来把它放上去. + +knowledge.gettingStarted.carpenter=$h木匠工作台-$r^木匠工作台是用于合成一系列物品的基础合成台,不同的合成需要不同的工具,有些则要求空手制作。阅读“制作工具”一节来获取关于工具的更多信息。 + +knowledge.gettingStarted.tanning=$h制革-$r^目前为止你可能收集了一些兽皮但却无法使用,刮兽皮是一种简单的制作皮革的方法。^首先,找到水源把你的兽皮冲洗干净,然后做一个简陋的制革架和一把石头小刀。这些原始工具的质量非常差,但你可以在发展起来后换用更好的工具。 + +knowledge.gettingStarted.forging=$h锻造-$r^锻造是制作物品的主要方法。几乎每一个工具和金属物件都是通过这一工序制作的。首先你需要做一个石头锻造炉、砧和一些工具,然后将砧放在靠近石头锻造炉和水的地方。“工艺”一栏包含了完整的关于如何进行锻造工作的信息,在这之前你得先做一个最基础的引火器 (干燥岩石) ,别忘了穿上围裙!(参考“工艺”一栏的“锻铁炉”一节来了解如何把那些金属原矿处理成能用的金属条) + +knowledge.gettingStarted.forgingbars=大多数配方需要的是金属条而不是金属锭。金属条是从金属锭加工出的易于加工的材料,把加热后的金属锭放在砧中然后用锤子砸之即可获得金属条 (右键砧的顶部或者直接左键砸) 。 +knowledge.gettingStarted.flux=熔剂在锻造金属时扮演着重要的净化剂角色。原则上来说这个物品是处理锻造过程中的金属以及制作合金用的。但是制作某些金属片和金属板时同样需要熔剂,一些工具和护甲也是。^熔剂的最好来源是石灰岩。在你云游四方的时候最好留意一下。 +knowledge.gettingStarted.3=现在你需要一些皮革条来做工具。收集2个铜 (把它们处理成铜条) ,2个木材和1个皮革然后做把铜剪刀。 +knowledge.gettingStarted.4=拿起你的剪刀,然后把皮革放在木匠工作台或制革架上右键切割制成皮革条。 + +knowledge.gettingStarted.5=到了这步,你应该有一些皮革,铜锭,木材和皮革条了吧。是时候升级下你的石锤子了。 + +knowledge.gettingStarted.6=随着锻造设备的建立,你现在可以打造铜制工具了。查看“工艺”一栏的“锻造工具”一节可以找到些铜制工具的替代品。^务必使用钳子来取出和移动滚烫的金属,拿着钳子靠近锻铁炉夹起金属,再右键砧即可。(目前直接从锻造炉里拿出加热后的金属似乎是没有惩罚的,不知道是不是bug) + +knowledge.gettingStarted.upgrade=$h升级-$r^渐渐地,基础的铜已经满足不了你了。研究手册和研究台可以让你获悉目前可以做什么以及怎么做。^首先你需要一个研究台。研究台可以研究各种物品来解锁合成配方和科技树以帮助你更好的生存。打开研究手册来阅览你当前的研究进度,将物品放进研究台以开始研究。 + +knowledge.gettingStarted.7=我们从熔炼一块铜锭和锡锭开始 (把金属条放进砧中捶打即可得到) 。把它们放进研究台。确定你的"工艺"技能足够高 (至少5级) 并且提示你:你现在能够从中学到点什么了。试试研究青铜锻造 (备注:制作各种物品来提升工艺等级) 。你也可以尝试研究皮革来学习如何制作更好的护甲。 + + +knowledge.gettingStarted.10=很快你会需要和各种粉打交道,无论是在烹饪,工程或者工艺上。大多数粉需要使用手推磨和陶罐来获得。(左键打一下手推磨或者右键手推磨的顶部) (使用原版熔炉来获得烧制好的陶罐) + +knowledge.gettingStarted.11=现在尝试下“锻造青铜”吧,你需要“工艺”等级达到5才可以解锁“锻造青铜”研究,合成工具,武器,护甲和一些材料能提升你的手艺等级。^研究完"锻造青铜"后,升级你的工具然后向着下一个目标前进吧. + +knowledge.gettingStarted.12=$h回收站-$r^当你发现自己的仓库里缺乏有用的资源或者挤满了垃圾,甚至是两者兼具的时候,做个回收站吧。^这东西能检测物品的构成,并从中回收一部分东西。 +knowledge.gettingStarted.13=使用方式:在地上放一个回收站然后往它上面丢东西,之后再右键下回收站即可 (只有原版和本模组的物品可以回收) 。^到这里,基本的东西已经教给你了。剩下的就看你的造化了233…… + +knowledge.dust=磨碎粉末 +knowledge.dust.desc=粉末制作技术 +knowledge.dust.1=你能用手抓起一把粉末,但你没法控制抓起的量,以及如何保持它不从你的指缝里溜出去。陶罐能用于装填矿粉和其他用途的粉末,大多数粉末需要用手推磨制作,只有极少的配方需要其他工具参与。这里有一些例子: +knowledge.dust.quern=使用手推磨:你需要做的就是打开它的界面,在中间放进陶罐,顶格需要放入所要磨的物品,顶部放上要磨成粉的物品,然后再左击或者右击手推磨的顶部,就可以制作出你想要的污粉了 (误) +knowledge.dust.icing=一些食物相关的配方 (比如糖霜) 需要把各种材料放进陶罐里用勺子混合。 + +knowledge.research=研究手册 +knowledge.research.desc=记录足迹 + +knowledge.research.1=在世界上有非常非常多的东西可以探索,你需要的只是去找到它们。为了揭开世界中隐藏的知识并用它们改善你的生活,你需要研究它们。大多数你能干的事情和你能做的东西都需要研究解锁,而完全揭开它们的秘密不止要求你去研究它们,你还要具备足够的技能等级。^在你研究一样物品时,你对研究的结果是一无所知的。研究台对于研究物品来说是必不可少的。你的技能等级和你研究的物品决定了你是否能解锁有关新知识的线索。 + +//Table recipe + +knowledge.research.2=当你放下研究台后,你就可以通过研究物品来解锁新的知识了。你需要一定的技能来解锁信息,如果你的技能够高而你又积累了足够的研究经验 (在研究台上完成物品的研究) ,你就可以得到一条关于你的研究的线索。当你得到全部线索时对应的研究就会解锁,你可以在研究手册里浏览你的进度。^如果你缺乏足够的技能来研究新的物品,那么等你学到更多的时候再回来研究它。 + +knowledge.carpenter=木匠工作台 +knowledge.carpenter.desc=简单合成 +knowledge.carpenter.1=木匠工作台主要用来制作各种有关木头的物品,最好尽早把它做出来。此工作台可以使用各种工具进行物品加工,如空手 (不拿任何物品) 、锤子、匕首等。合成需要按照合成表放好物品,再用指定的工具缓慢地单击工作台 (或者右击工作台顶部) 。^工作台进度条左边显示了需要的工具,工具是分等级的,使用了等级不符的工具,或者是不顾节奏乱挥一气的话,会损耗更多的工具耐久,这一点也适用于砧和其他一些设备的使用。 + +knowledge.salvage=回收站 +knowledge.salvage.desc=重复利用 +knowledge.salvage.1=在恶劣的环境中作为一个囤积者也许会为你提供些许优势,但那些用不着的设备和劣质的工具真心没什么卵用。^回收站能从这些物品中回收原料。(仅限原版和MF2中的物品) +knowledge.salvage.2=使用方式:放好回收站然后把要回收的东西扔在上面,再右键回收站,一定几率回收全部合成材料。低耐久的物品回收率更低。 +knowledge.salvage.3=如果你用锤子,回收材料的几率更大。而用锯子几率比用锤子更大。 + +knowledge.talisman=知识护符 +knowledge.talisman.desc=轻松阅读 +knowledge.talisman.1=指出一样东西工作的关键机理有时并非易事。通俗的说法就是使用研究台需要花费大量的时间和精力才能解锁你想了解的那些东西。不过如果你有了这个护符,手持它右击研究台的顶部可以立刻完成物品研究 (如果你能研究此物品) 。小型知识护符也可以用来制作让某一技能等级+1的书。 +knowledge.talisman.2=大型知识护符十分罕见,所以也很少被使用.它和小型知识护符作用相同,不过能无限使用。它可以用来制作让某一项技能达到满级的技能书。 + +knowledge.commodities=常用品 +knowledge.commodities.desc=实用物品 +knowledge.commodities.1=这些常用品是合成的命脉,每一样东西都非常寻常却又因其作用众多而极具价值,所以建议你多制作些以备不时之需。 + +knowledge.commodities.plank=木材是原木中上好的那一部分,一种常见的建筑用品。^多种原木都可以制作木材,每一种木料都有自己不同的特性。 + +knowledge.commodities.refinedplank=一些木材可以用植物油进行精制,使其硬化。精制木材将被用于更高级的合成。只有1级木材可以进行精制。 + +knowledge.commodities.flux=熔剂通常用于精炼金属。基础熔剂可以用于设备--比如高炉--来制作精炼金属锭。强力熔剂则用于高级合金合成。 + +knowledge.commodities.hunks=对于那些较小的制品,要使用金属片。你可以在熔剂的辅助下把金属条做成片,也可以把用剩的金属片做回条。 + +knowledge.commodities.nail=钉子是木工用的基本物品。它们可以由铜、锡、铜、铁或钢制成。(这不影响成品的质量,只影响产量) + +knowledge.commodities.rivet=铆钉和钉子相似,只不过是用于金工。可以用铜、锡、铜、铁或钢制成。(这不影响成品的质量,只影响产量) + +knowledge.commodities.leatherstrip=皮革条主要用在工具制作上。 + +knowledge.commodities.thread=丝线主要用于有关缝纫的合成上。丝线可以合成原版的线。 + +knowledge.commodities.bucket=桶可以由金属锡在砧上制成,金属等级越高,获得的桶的数量越多。 + +knowledge.plants=植物生成 +knowledge.plants.desc=有机资源 +knowledge.plants.1=地表上最常见的是各种各样的树和植物,它们在一些事情上被证明是大有用途的。^这些是可在地表上发现的植物,可以为你提供食物和材料。 +knowledge.plants.2=不同的树木提供不同的木材,有些木材在特定用途上要比其他的更好。这是你能发现的树木列表: +knowledge.yew.1=紫杉树一般生长在森林里,但是它们分布稀疏,形单影只。紫杉木的属性要比一般的木头要好,而用这种木材制成的弓尤为强力。 + +knowledge.ironbark.1=桉树是一种偶尔能在森林里发现的树,因其粗糙的灰色树皮和橙色树心使得其在其他树木中显得特别显眼。砍伐桉树得到的铁皮木质地坚韧,制作出的工具都具备很高的耐久。 + +knowledge.ebony.1=黑檀树是巨大而罕见的树木。可以在温和地区找到,它提供格外坚固的木材。^黑檀树可以根据它们的体型和暗棕色的木质来分辨。黑檀木是最强的可用木材。 + +knowledge.berry=浆果 +knowledge.berry.desc=绿色无农药 +knowledge.berry.1=浆果生成在温度和降雨量适当的地区,在森林里尤为常见。^多汁的 (紫色) 浆果虽然罕见,但具有解毒的效果。 + +knowledge.ores=矿物生成 +knowledge.ores.desc=地下资源 +knowledge.ores.1=在这个世界矿石的生成范围比较小。你可以把矿石熔炼成锭或用作他用。 +knowledge.ores.copper=铜矿是48-96层生成的常见矿物。它可以很轻松的熔炼成锭,并制成工具。^铜矿可以和锡制成青铜。 +knowledge.ores.tin=锡有铜的一半生成率并都在同一层生成 (48-96) 。^锡可以冶炼成锭并和铜制成青铜。 +knowledge.ores.silver=锡的生成率只有铜的一半,它的生成高度与铜相同 (48-96) 。^锡可以熔炼成锭并与铜混合制成青铜。 +knowledge.ores.wolframite=黑钨是一种罕见的矿石,主要用于高级工程。它在低于16层的高度以单块矿脉形式生成。 +knowledge.ores.mythic=有关“传说矿石”的已知信息很少,除了它十分罕见并且只能在基岩附近找到。这种奇怪的矿石似乎会发出鸣叫声。原因未知…… + +knowledge.ores.2=非金属矿石也会在主世界生成,有别于金属矿:它们不能熔炼成锭,但有其他用途。 +knowledge.minerals.clay=和沙子一样,粘土可以在泥土中找到。含粘土的泥土可以在草方块下面找到,草不能在它上面生长,所以它可以很容易在山上找到。 +knowledge.minerals.kaolinite=高岭石有一个相当特殊的用途。与粘土混合的话,这种材料可以增强砖块的强度。^它可以在接近地表,48至72层的高度发现。尽管有些罕见,不过它的矿脉很大,发现一个基本上就不愁用了。 +knowledge.minerals.limestone=石灰岩大片大片的在全世界生成,它是熔剂的常规来源。 +knowledge.minerals.borax=硼砂是比较罕见的矿物——也是强力熔剂的最佳来源,后者被用于制造高级合金。^它一般在48-96层生成但很难被发现。 +knowledge.minerals.nitre=硝石矿生成在16-64层的一些洞穴墙壁上。采集得到的硝石可用来制造炸药。 +knowledge.minerals.sulfur=硫在地下深处低于16层的岩浆附近生成。它可以用来制造炸药。 + +knowledge.chimney=烟与烟囱 +knowledge.chimney.desc=什么是温室气体? + +knowledge.chimney.1=傻子都知道燃料燃烧时会产生烟雾。你还得明白,呼吸烟雾是不明智的。^但是你现在要是在读这个,你很可能已经开始盘算着要用烟囱一类的东西排烟了。^不管怎样:烟囱可以把烟雾排到天空从而远离你宝贵的空气!留给几个世纪后的人抱怨吧。 + +knowledge.chimney.2=烟囱可以使用石头来加宽,这样可以增加烟囱的容量和强度,同时可以封住地板上和天花板上因为细烟囱而产生的空隙。 + +knowledge.chimney.3=石头排烟器也可以用在其他设备上 (主要是熔炉和坩埚) 间接吸取烟雾.^“间接”是指将烟雾从它原本冒出来的地方向相邻位置移动一格。 + +knowledge.chimney.pipe=排烟管道允许烟气在烟囱系统里进行传输。管道本身不能排放烟雾,必须要连到一节普通的烟囱 (石头烟囱,加宽石头烟囱,石头排烟器均可) 上,这些管道只能接受来自其正下方烟囱排出的烟雾。 + +knowledge.chimney.pipe.2=最大化的利用排烟设备:在烟囱顶部链接管道,管道顶部连接另一节烟囱作为设备的排烟系统。(图中展示了一个以排烟器开始的排烟系统) + +knowledge.tanning=制革 +knowledge.tanning.desc=动物尸体加工 + +knowledge.tanning.1=皮革是非常有用的资源。几乎所有的工具、武器或盔甲都用到了皮革。^制革是清理生皮并把它们制成有用物品的简单方法。^首先你需要制革架。 + +knowledge.tanning.2=然后你需要清理兽皮。拿着兽皮右键水或者把熔剂和兽皮放在合成格子里处理均可完成这一过程。清理完成后,右键制革架将其挂上去。然后再用小刀有节奏的右键之来进行处理。注意:使用破旧的制革架时有十分之一的几率制革架会坏掉。^但是一个制作更精良的制革架不会损坏,建议当你负担得起造价的时候就制作它们。 + +knowledge.stamina=耐力机制 +knowledge.stamina.desc=保持健康 + +knowledge.stamina.1=要知道,成天跑来跑去或者专心挖地在体力上并非易事。本模组加入的耐力机制让你在这样的事情上保持一定的节奏。^耐力值 (屏幕右下角的绿条) 会在你做各种事情的时候降低。但是它会自动恢复,恢复的速度依你装备的物品而定。^食用本模组的食品也可恢复一定量的耐力,而甜食可以加快耐力恢复速度。^因为耐力机制的存在,一味的换用更重更厚的护甲已经不再是最佳选择了,考虑自己的游戏风格,穿合适的护甲才是最明智的选择。 + +knowledge.combat=战斗机制 +knowledge.combat.desc=杀死骷髅的方法不止一种 + +knowledge.combat.1=世道变了,你再不能在外面浪了,战斗系统已经有了很多变化,加入了一些新的战斗技巧。^这不止是说你的攻击方式有了变化,怪物们也同样如此!一只手持武器的僵尸要比其他同类更具威胁,因为它们也会这些即将被提到的战斗技巧。 + +knowledge.parry.info=$h招架和格挡$r^你拿着武器时,按住右键即可格挡,简单吧?现在格挡变得更加有效了。挡下来自正面的一击会减少 (甚至完全抵消) 这次攻击所造成的伤害,用剑效果最好,而那些长柄武器 (比如斧子和钝击武器) 会视受到攻击的类型来减少伤害。^平时多使用格挡,这个技巧有时会救你一命。但是注意在挡下敌人的一击后马上进行反击的话,你的攻击力会降低。 + + +knowledge.advparry.info=$h招架能力$r^当你招架成功后,如果你按着shift键,你会前冲一步,有时会把敌人甩在后面。虽说很费耐力,但善于运用此道的人,会用它来改变战场的局势。此外,跳跃时也可发动此技能。 + +knowledge.poweratt.info=$h重击$r^当你在你潜行状态,来一次信仰之跃,期间进行攻击的话,你会尝试发动一次重击。这会消耗耐力,但一旦成功就会对敌人造成双倍伤害并且无视格挡。但是如果你攻击的太早,那么重击可能会被打断。 + +knowledge.dodge.info=$h闪避$r^在很多情况下,完全躲开攻击是更好的战术。当你在格挡时往两边或后面跳跃,会快速飞跃。这会消耗耐力并且无法在装备重甲时使用。 + +knowledge.armour.info=$h盔甲选择$r^有三种主要类型的盔甲:轻型、中型和重型。如果你比较依靠回避和技巧,使用轻甲;如果你想要更多的保护,使用重型;轻重混搭,使用中型。 + +knowledge.blade.info= +knowledge.fastblade.info= +knowledge.axe.info= +knowledge.blunt.info= +knowledge.polearms.info= + +knowledge.bar=金属条 +knowledge.bar.desc=标准化塑形 +knowledge.bar.1=金属锭通常用于基础合成以及贸易目的,但是它们对于锻造工作来说实在是太厚了。于是为了制作一种通用的,易于熔炼的材料,人们把金属锭加工成了金属条。^一块金属条可以用很简单的办法重新制成金属锭。 + +knowledge.smeltCopper=冶炼铜 +knowledge.smeltCopper.desc=等级 %1$s,常用材料 +knowledge.smeltCopper.1=金工之路道阻且长。铜是一种易加工且无风险的材料。^然而,某种意义上它是一块垃圾,因为它无法用来制造高级工具,重型武器或重型盔甲! + +knowledge.smeltBronze=冶炼青铜 +knowledge.smeltBronze.desc=等级 %1$s,常用材料 +knowledge.smeltBronze.1=让我们前进一步,把一点锡和铜按照正确比例混合,就能得到一种强过二者简单相加得到的合金——青铜。^这种材料大有用途,以后你会发现这一点的。 + +knowledge.smeltIron=冶炼铁 +knowledge.smeltIron.desc=等级 %1$s,常用材料 +knowledge.smeltIron.1=在对这个世界里的矿石进行一定的研究之后,你发现铁矿石生成量很大。而在适当的精炼后,你就能从矿石中提取出金属熔铸成锭。^铁要比青铜强韧而且更加常见,是一种实用而低成本的材料。 +knowledge.smeltIron.2=铸铁易,锻铁难。不过你已经小有所成,知道如何制作铁制工具。 + +knowledge.smeltPig=生铁 +knowledge.smeltPig.desc=铁矿处理 +knowledge.smeltPig.1=天然铁矿里满是杂质,性能极差,为了制造高级合金,就得把它们进行精炼。而高炉就是为此而生的。^你可以使用一种特制熔剂对铁矿进行预处理。接下来高炉可以非常有效的去除矿石中的杂质,从而得到更加纯净的铁。^生铁就是这一过程的产物,其脆性稍高,所以你在把它投入使用前还需要进一步的精炼。 + +knowledge.smeltSteel=锻造钢 +knowledge.smeltSteel.desc=等级 %1$s,常用材料 +knowledge.smeltSteel.1=稍作观察,你发现生铁作为材料太脆了,这可麻烦了。不过没关系!只需要加热和一点小操作,就可以提高它的塑性和韧性了。 + +knowledge.smeltEncrusted=镶钻工艺 +knowledge.smeltEncrusted.desc=等级 %1$s特殊材料 +knowledge.smeltEncrusted.1=某些想法可能听着很蠢,但实际上却非常实用。把钻石碎片锻打进钢中可以提升材料的抗性和尖锐性。^镶钻锭的性能远远好于普通的钢锭,完全对得起它的花费。 + +knowledge.smeltObsidian=锻造黑曜石钢 +knowledge.smeltObsidian.desc=等级 %1$s,特殊材料 +knowledge.smeltObsidian.1=对黑曜石内部晶体结构的研究给了你有关冶金方面的灵感。黑曜石的抗爆能力无物可比,你可以取之为己所用。^把钢与熔融黑曜石混合,你创造出一种强韧的合金,可以用来锻造拥有诸多优点的工具。 + +knowledge.smeltBlackSteel=锻造黑钢 +knowledge.smeltBlackSteel.desc=等级 %1$s,常用材料 +knowledge.smeltBlackSteel.1=每种材料都有其极限,你已发现一种极赞的合金,只需要把青铜和铁按照正确比例组合就可以炼得黑钢。黑钢性能极佳,远超目前已知的任何材料。但是它难以生产和加工,所以也许它并不能完全取代铁的地位。^熔炼过程包含两个阶段:在更好的坩埚中混合,在高炉中成型。然后你就能得到这暗色的,强力的材料了。 + +knowledge.craftOrnate=华丽风格 +knowledge.craftOrnate.desc=净化的代价 + +knowledge.craftOrnate.1=只要使用正确的材料,制造更具观赏性的武器、工具和护甲是可能的。华丽风格的物品对不洁生物,比如不死族的怪物非常非常有效。^要制作这些物品需要华丽纹章。在打造适当的物品时把一块纹章放在砧的成品格,在打造成功后,一件华丽风格物品就完成了,不过这时的物品还不能使用,需要在水中完成淬火才行。 + +knowledge.smeltDragonforge=龙铸风格 +knowledge.smeltDragonforge.desc=天然而强力 + +knowledge.smeltDragonforge.1=龙是棘手的生物,猎杀它们需要准备与经验。通过你的努力,就有可能用它们自己的力量对抗它们,龙铸武器将打击并破坏龙鳞从而更有效的给予他巨大的打击。要制作龙铸武器:先做普通的近战武器。就在完成前:扔 (右击) 一颗龙心到附近的熔炉 (温度要够,才能放下去) ,然后迅速完成合成。如果一切顺利你会得到龙铸物品 (龙心不易获得。) +knowledge.smeltDragonforge.2=这之后得到的物品同样需要淬火才能使用,这一仪式会召来龙族袭击,务必小心! + +knowledge.smeltBlueSteel=锻造蓝钢 +knowledge.smeltBlueSteel.desc=等级 %1$s,常用材料 + +knowledge.smeltBlueSteel.1=随着在复杂合金上的进一步探索,你发现黑钢在性能上已经接近极限,不过在此基础上稍微降低些材料重量还是可行的。通过把青金石和银加入熔炼,可以除去黑钢里的某些物质,使其变成一种更轻的材料,虽然其中的具体机制仍然不明,但这应该是一种不错的升级。 + +knowledge.smeltRedSteel=锻造赤钢 +knowledge.smeltRedSteel.desc=等级 %1$s,常用材料 + +knowledge.smeltRedSteel.1=黑钢在性能上已经接近金属类材料的极限,而且几乎没有什么可以提升的地方了。^不过在你研究红石和金子后,你发现了一些不寻常的事情。在熔炼时把红石和金子融入其中,可以让钢这样的材料结合的更加紧密,从而提高其强度,与此同时重量也随之提升。(注意目前只有钢能完成赤钢的制造) + +knowledge.smeltMithril=锻造秘银 +knowledge.smeltMithril.desc=等级 %1$s,特殊材料 + +knowledge.smeltMithril.1=你发现的这种矿物事实上非常神秘。任何形式的加工都会显著改变其物理特性。例如向其中混入银会改变它的质量和硬度,尽管你并不知道这是如何发生的。^你发现的古代珠宝中似乎包含了某种冶炼说明,它似乎正是古代匠人为了保存这门冶炼技术而留给后人的。至少目前公认的说法如此。 + +knowledge.smeltMithril.2=阅读珠宝中的图纸,你了解到向传说矿中加入银可以制造一种特别轻的材料,也许银在传说矿转化为秘银的过程中起了很大作用。^除此之外,珠宝本身没有其他特别的地方了。 + + +knowledge.smeltAdamantium=锻造艾德曼合金 +knowledge.smeltAdamantium.desc=等级 %1$s,特殊材料 + +knowledge.smeltAdamantium.1=传说矿物的性质非常特殊,将其与黄金一起熔炼的实验产生了一些特别的结果,产物的密度极大地提升了,变得又硬又重,让你有点为难。^你发现的古代珠宝中似乎包含了某种冶炼说明,它似乎正是古代匠人为了保存这门冶炼技术而留给后人的。至少目前公认的说法如此。 + +knowledge.smeltAdamantium.2=阅读珠宝中的图纸,你了解到向传说矿中加入金可以将其转化为一种更重的绿色金属。这个特别的化学反应中金子一定起了重要的转化作用。^除此之外,珠宝本身没有其他特别的地方了。 + +knowledge.smeltMaster=大师级传说 +knowledge.smeltMaster.desc=渐入化境 + +knowledge.smeltMaster.1=你从珠宝中看到了一些图案。无论它是哪个古代文明留下的,都说明当时的人们利用这种珠宝来保存信息。尽管一本书可能做得更好,但是谁知道呢。^你发现了一种和其他珠宝类似的,有着铁砧一般的边缘和刺盾般的造型,这和之前你发现的遗物是一样的。但是你发现了三种这样的珠宝,它们可以很神奇的拼在一起。 + +knowledge.smeltMaster.2=想必当年大师级珠宝是由冶炼大师保管的,而两块稍小的则由两位学徒收藏。在最大的珠宝背后描绘了将合并的珠宝放进工作中的古代坩埚。这也许可以提升坩埚的性能。^最有意思的事情是关于你发现这些遗物的地方。尽管大师级的珠宝随处可见,但是那些稍小的珠宝出现的地点则视地理方位而定,在遥远的南方有着秘银工匠,北方则是艾达曼合金匠人。 + +knowledge.smeltMaster.3=这无疑证实了传说矿加工广泛存在于世界各地的多种文化中。但是这一点对矿物冶炼没有造成影响,所以这些珠宝的结构应该是相同的。^不管怎样,这种三重珠宝拥有强大的力量,并且很可能来自南北两方的大师匠人。把它用在工作中的坩埚里也许可以强化坩埚。 + +knowledge.smeltIgnotumite=锻造依格洛特 +knowledge.smeltIgnotumite.desc=等级 %1$s,大师级材料 + +knowledge.smeltIgnotumite.1=这种被称为依格洛特的材料是艾达曼合金的纯化升级版。它在冶炼过程中使用了比其他传说矿物锻造时还要多的黄金,结果就是创造出了目前为止在所有材料中最重,也是最强力的材料。^这一材料只能在大师级坩埚里锻造。 + +knowledge.smeltMithium=锻造传说锭 +knowledge.smeltMithium.desc=等级 %1$s,大师级材料 + +knowledge.smeltMithium.1=这种材料是使用古代技术锻造出的比秘银更加纯净的材料。传说锭非常之轻,摸起来恍若无物。^这一材料只能在大师级坩埚里锻造。 + +knowledge.smeltEnder=锻造末影锭 +knowledge.smeltEnderforge.desc=等级 %1$s,大师级材料 + +knowledge.smeltEnderforge.1=总有一些东西比那些末地来的生命还要奇怪……而这个发现也许会引导你到它们的起源,也许是它们造出了这种制品,尽管无从解释,因为末影生命并没有高度的文明。^末影锭被视为秘银和艾达曼两种材料的折中产物,兼具二者的优点。在将两种材料融为一体的过程中,末影珍珠起了催化作用。^这一材料只能在大师级坩埚里锻造。 + +knowledge.coalflux=含煤熔剂 +knowledge.coalflux.desc=勤俭持家 +knowledge.coalflux.1=在冶炼过程中,要引发正确的化学反应需要的煤炭量实在是太巨大了。这个问题现在越发严重,以至于如果没有充足的煤炭储备,要熔炼大量金属是非常困难的。^你相信在熔剂中混入煤炭可以减少这些反应中的燃料消耗,每一份熔剂都可以将冶炼过程需要的燃料用量减半,使得等量的燃料可以烧出双份成品。^这个过程并非毫无代价,虽然制作熔剂时用到了煤,但是熔剂本身已不再能作为燃料使用了。 + +knowledge.bigfurn=冶炼炉 +knowledge.bigfurn.desc=大量生产 + +knowledge.bigfurn.1=如今冶炼基础矿物和材料的技术已经接近完美。而炼铁炉已经成了次等、低效又不经济的设备,只能用来做零星工作。^你已开发出一种用耐火粘土制成的大型冶炼炉。 + +knowledge.bigfurn.2=这种冶炼炉可以一次熔炼四种物品,而且效率还不错。它自身的设计很简单,易于操作,只不过它属于多方块结构,在使用前需要正确搭建起来。 + +knowledge.bigfurn.heater=一个冶炼炉要想发挥作用,就得有个放燃料的地方。冶炼炉加热器能够持续的加热炉子,加热器烧的越旺,冶炼炉冶炼物品的速度越快。只不过加热器需要保持稳定,你得在其周围围上耐火石砖。 + +knowledge.bigfurn.top=在加热器顶上摆上冶炼炉。冶炼炉本身与锻铁炉原理类似,只不过能更有效的调节温度。和它下面那个烧燃料的伙计差不多,冶炼炉也需要在周围和顶部摆上耐火石砖。 + +knowledge.bigfurn.structure=此结构同样适用于多重冶炼炉结构。两堵侧墙和一堵背墙即可支持起一排相连的冶炼炉,参考单个冶炼炉的情况。 + +knowledge.blastfurn=精炼 +knowledge.blastfurn.desc=不只是熔炼 + +knowledge.blastfurn.1=一般来说,熔炼矿物 (比如铁矿) 的过程会残留大量杂质,限制了材料性能的发挥。而使用高炉也许为此提供了一条解决之道。^高炉造价高昂,但能创造出其他冶炼设备远不能及的高温,这使得其拥有高得多的提纯率。这为高级材料——钢的制造提供了可能。 + +knowledge.blastfurn.2=当然了,在搭建高炉之前,你得给它搭起一个合适的外壳。能堪此大任者唯有耐火石砖。^高炉方块的合成表中也利用到了耐火石砖,它可以承受住高炉工作中的极端高温。 +#Firebrick Recipes +knowledge.blastfurn.3=高炉本体由两部分组成:高炉加热器和高炉炉室。一个加热器上方最多可以放置16个炉室。放置的炉室越多,能同时熔炼的物品越多。 +#Furnace Recipes +knowledge.blastfurn.4=现在你拥有了耐火砖、一个加热器和一些炉室:你现在可以搭建高炉了。^如何开始:将一个加热器放置在地上。^如果你放置一个坩埚在加热器下面,那么高炉会自动输出产物到坩埚里 (注:坩埚工作需要在下方摆一个铁匠炉) 。^确保在加热器四周留下足够的空间 (大约4个方块) 。^然后在同一高度的加热器四角位置摆放耐火砖块,为了你的安全考虑,不要把加热器四周堵上。 +knowledge.blastfurn.5=准备好这些后,在加热器上方摆放炉室,然后在它四周堆起耐火砖块。记得要让顶部保持露天 (或放置一个烟囱) 。 +#Structure +knowledge.blastfurn.6=使用高炉是相当简单的事情,但是它会消耗大量的燃料。^在最顶部的炉室中的下层格子里放进矿石 (比如处理好的铁矿石) ,上层格子里放进燃料 (煤炭、木炭或者含煤熔剂) (建议在最顶部炉室上放置一个烟囱以控制烟雾排放)。 +knowledge.blastfurn.7=这一步完成后矿石会慢慢向下方的炉室转移,最终变成每个炉室都有一块矿石 (也许最上面的不是) 。这之后在底部的加热器里放一些燃料,注意燃料会一直消耗 (无视有无需要熔炼的材料) 所以最好提前算好需要的燃料。在熔炼完成后:所有的炉室会产出一块金属,然后加热器会释放其中的压力,喷出一串火焰。^确保在火焰释放的路径上没有障碍物,否则会留下火焰甚至爆炸。另外让它远离易燃品! + +knowledge.blastfurn.hcc=$h困难合成模式-$r^此模式开启时,高炉加热器下方必须放置一坩埚以接收高炉生产的熔锭,你需要使用锭模来取出它。 + +#Prepared Iron + +knowledge.blastfurn.9=处理好的铁矿石可用于制造生铁。^生铁可以精炼成钢。^你可以用强力熔剂来使产量加倍,但是由于制作强力熔剂的原料——硼砂很稀有,所以你应该明智的使用它。 + +knowledge.bloomery=锻铁炉 +knowledge.bloomery.desc=初级金属熔炉 + +knowledge.bloomery.1==从包裹着岩石的资源中获取珍贵材料并非易事。锻铁炉可以将矿石冶炼成金属锭。 + +knowledge.bloomery.2=使用方法:在锻铁炉中放入等量的煤和原矿,然后用一个点火器右键。如果一切顺利熔炼就开始了,要熔炼的矿物越多,工作速度越慢。^冶炼炉必须被放置在户外,无遮拦的环境下工作(其实只要顶部无障碍露天即可),如果没有符合条件,它就不会工作,另外烟囱不会对其发挥作用。^整堆物品将在熔炼过程中全部融化,在熔炼过程完成时,炉子顶部会打开。这时使用一把锤子反复敲击炉子,直到所有的金属条全部弹出来。 + +knowledge.bloomery.3=当你准备拿起金属锭时,确保你拿着的是一把空钳子。钳子可以一次夹起一组物品。 + +knowledge.crucible=合金化 +knowledge.crucible.desc=混合金属 + +knowledge.crucible.1=只依赖一种或者另一种单一纯金属来满足需求对你的帮助已经非常有限了。正因如此,才有了坩埚。^坩埚是专为制造合金而设计的设备,你在这里将得到的多种材料混合来熔炼更好的材料。 + +knowledge.crucible.2=为了使其工作,坩埚需要一个在下方的热源 (比如$h锻造炉$r) ,岩浆虽然也可以但是加热速度非常慢。^坩埚内的合成表是无序的,而且遵循着一定的“比例”。^例如:3块青铜需要2块铜和一块锡。这是说你可以在放进两块铜和一块锡,然后熔炼得到三块青铜。但是你也可以放进四块铜和两块锡以得到六块青铜,同理……^另外关于材料的摆法,虽然这些合成是无序的,但是还是有一些规则。格子里的材料比例要符合合成表情况。直接放进2铜1锡坩埚是不会工作的,得放成1铜1铜1锡这样的比例合成3青铜,同理也可以2铜2铜2锡出6青铜等,务必注意。 + +knowledge.crucible.hcc=$h困难合成模式$r^但是在困难合成模式中,熔炼得到的产品无法直接从gui中取出。你需要先制作一个锭模,用其右键坩埚取出金属锭,一次一块,然后右键水源进行冷却。^此外,如果你破坏了坩埚,成品也会消失! + +knowledge.crucible2=高级合金 +knowledge.crucible2.desc=更多混合…… +knowledge.crucible2.1=耐火粘土和耐火砖块的应用范围还可以再被拓宽一些。目前为止你制作的坩埚在温度调节方面还有困难,也不能有效的冶炼原料。不过在制造坩埚的材料中加入耐火粘土应该可以解决这个问题。 + +knowledge.crucible2.blocks=但是即便这样,坩埚的外壁也还不足以完全承受工作时的高温。为了使坩埚正常工作,必须在耐火坩埚四周放置四块耐火砖块。 + +knowledge.apron=铁匠的围裙 +knowledge.apron.desc=护身服 + +knowledge.apron.1=锻造炉在熔炼金属的时候会变得滚烫,在你准备使用它时建议穿上一件围裙,这围裙包含了衬衫,下摆和套袖(三合一)。它适用于锻造金属和转移金属锭。如果不穿着这件衣服的话,物品栏内那些过热的物品就会把你点燃。^译者注:此版本下,即便你穿了这围裙,滚烫的金属条也会让你处于燃烧状态,而围裙的耐久实在太低,所以正确的转移加热金属条的方式依旧是使用钳子右键锻造炉或者别的设备,为了安全最好再在边上放一格水。 + +knowledge.anvil=锻造 +knowledge.anvil.desc=金工基础 + +knowledge.anvil.1=这并不是说工作台已经过时或者怎样,但物品制造方面还有很多更好的方法。锻造是合成各种金属制品的最常用方法。^这一过程包括用锻造炉加热金属,然后在砧上加工它们两步。 + +#Recipe + +knowledge.anvil.2=砧易于制作并且可在火炉内回收。^将砧放置在地上,一个接近水和锻造炉的地方。右击砧的侧边或者不使用锤子右击顶部来打开gui。 + +#Gui + +knowledge.anvil.3=制作物品可能会很复杂,需要两步。^首先一些物品(大部分是金属锭或者金属片)需要在$h锻造炉$r中加热。如果一个物品可以被加热,那么它就需要被加热。^下一步是合成表本身: + +knowledge.anvil.4=从把各种部件放进合成格子开始$h[3]$r 然后使用一把合适的锤子(根据合成表选择使用普通的或沉重的)。每种合成表都有着对锤子和砧的建议等级,等级会在标题处显现$h[1]$r.^拿着锤子敲击砧板。进度条$h[2]$r会开始填充,当完成时:结果会出现在输出栏$h[4]$r。^有些打造出的成品会很烫,你可以拿着它们右击水方块或者水槽(按住shift)来冷却它们。 + +knowledge.anvil.5=要拿起成品:使用钳子右键砧,钳子只会取走最终输出栏的物品。直接拿起滚烫的物品会把你点燃,所以当你要从锻造炉里拿出什么的时候,使用钳子右击锻造炉,然后再右击砧来将其放入。 + +knowledge.anvil.6=在制作时,保持质量条的轨迹。使其中的游标尽量远离两侧边界。要是游标碰到了任一边界,合成材料就会毁掉。此外当你打造具有耐久的物品时,如果在打造完成时游标落在了标记外面,打造出的物品的耐久值会降低。^如你所见,右图中有两个绿色标记,如果蓝色游标落在它们外面,打造出的物品就会受损。而指示栏的两侧边界则是绝对不能碰的禁区。务必交替使用左击和右击来打造物品,并且想好再下锤。另外要注意游标向右移动的距离要小于向左移动。 + +#Quality +knowledge.anvil.7=如果你按住Shift键左击砧的话,会把进度条敲回去 (以给你更多时间用于打造) ,但是不要让进度条回零,否则也会毁掉物品。 + +knowledge.forge=锻造炉 +knowledge.forge.desc=这里越来越热了 + +knowledge.forge.1=锻造炉是一种简易设备,只需要放进燃料 (拿着燃料右键) ,然后用点火器 (比如打火石) 点火。^太简单了!只需要把要加热的物品丢进去然后生火就是。(建议流程是这样,或者你想点燃自己) + +knowledge.forge.2=锻造炉的炉温取决于燃料种类,其上限则取决于最后添加的那种燃料。$h风箱$r可以用来暂时性的提升温度。^你可以把可加热的物品 (比如金属锭和金属块) 放进锻造炉,之后它们就会被慢慢的加热。 + +knowledge.forge.3=$y"可锻造"$r 的物品需要在砧上进行加工,$d"不可锻造"$r 则意味着物品太烫了。^使用不同的燃料还有风箱来取得想要的温度,并务必监视加热材料的状况。^备注:如果把一个坩埚 (或者类似的设备) 放在锻造炉上方,会使锻造炉的gui无法打开 (仍然可以加入燃料和材料,只是没法把加热后的物品取出,另外此情况下坩埚与锻造炉之间不会有输入输出关系) 。 + +knowledge.bellows=风箱 +knowledge.bellows.desc=注入热量 + +knowledge.bellows.1=有时候炉火并不够热,或者可能需要很久才能热上来。使用更高燃烧温度的燃料对你的帮助有限,在不需要的时候还会徒增浪费。^风箱可以将锻造炉的温度暂时提高50%。使用方法:把它放在你想提升温度的炉子旁边 (喷嘴对准炉子) ,然后持续右击风箱。风箱也可以穿墙发挥作用。 + +knowledge.trough=水槽 +knowledge.trough.desc=准备淬火 + +knowledge.trough.1=为了进行淬火,你不得不前往水源地或者干脆选择在水源边建家,这有时会很麻烦,而常规的水源会损害打造出的物品。怎么办呢?使用水槽吧!水槽是可用于物品淬火的简易容器,只需要拿着夹着物品的钳子或者加热后的金属右击水槽即可。加水方法:拿着水桶或者水罐右键水槽,但是切记不要过量。^建议你在水槽中对物品淬火,不然物品有可能会损坏。^你同样可以手持水槽右键水方块来完成加水 (一次即可注满) ,以及在不损失里面储存的水的情况下把它从地上拿起来。 + +knowledge.trough.2=用一些钉子再稍微加工下,你就能以更合适的方式组装起水槽,漏水情况也会降到最低,同时木材的品质也开始影响水槽的质量 (储水量) 。 + +knowledge.repair_basic=工具维修 +knowledge.repair_basic.desc=保持工具状态 + +knowledge.repair_basic.1=工具一坏再坏,而另做新的又实在过于浪费。不过你已研究过各种皮革和钉子,找到了它们新的用途。^简单的材料加上一些工具应该足以修复某些物品,算不上完美但总好过什么都不做。也许进一步的研究会开发出更高效的工具。^使用方法:手持损坏的工具右击放在地面的维修工具即可,注意维修工具有一定几率会损坏。 + +knowledge.repair_advanced=高级维修 +knowledge.repair_advanced.desc=更佳维护 + +knowledge.repair_advanced.1=你已检查过那些从黏胶状方块身上掉落的奇怪的粘液球。不管它是由什么构成的,反正就是很黏的东西。而那些来自本地的巨型蜘蛛身上的丝线同样极为强韧而黏滑。^它们结合在一起应该能升级现有的维修工具,让它使用起来更有效率。 + +knowledge.repair_ornate=华丽维修工具 +knowledge.repair_ornate.desc=附魔工具维修 + +knowledge.repair_ornate.1=魔法道具似乎遵循着它们自身的规则,那些以常规方法补上去的东西很难留在上面。但是黄金和钻石可以抵消这一效果。如果以特定的方式将维修工具与这些材料搭配使用,也许就可以修复附魔道具。^这么做也使得其相对于高级维修工具效率有所提升。 + +knowledge.craftArmourBasic=基础护甲 +knowledge.craftArmourBasic.desc=平淡无奇 +knowledge.craftArmourBasic.1=当你初至这个世界上时,你也许会想给自己找点穿的。这些盔甲虽说并不会给你提供多少防护,但总比没有要好。 + +knowledge.craftArmourLight=轻甲 +knowledge.craftArmourLight.desc=廉价而实用 + +knowledge.craftArmourLight.1=轻甲被设计成尽可能易于穿戴并且只使用少数几种材料制成,因而你无法指望它给你提供多少防护,不过它不会影响战斗中的闪避和招架。^此类护甲在你依靠战术和闪避来进行战斗时效果良好。 +knowledge.craftArmourLight.2=粗制皮甲不过是一层用几片皮革片缝制起来的能勉强蔽体的衣物。这只提供了极小的保护作用,但是产物可以作为合成其他护甲的基础材料。 +knowledge.craftArmourLight.3=带衬护甲在抵挡轻攻击时效果显著,尤其是打击类攻击,而且还可用于合成重甲。 +knowledge.craftArmourLight.4=强化皮甲和镶钉皮甲是粗糙皮甲的升级版,其中强化皮甲可用于合成中型护甲。 +knowledge.craftArmourMedium=中甲 +knowledge.craftArmourMedium.desc=平均防护 + +knowledge.craftArmourMedium.1=对皮革的研究很明显地表明其在强度和对外来攻击的抵抗力上有着很多局限。^类似于动物的皮毛,鳞片和骨架也在保护身体上起了协助作用,你一定可以找到什么可以用来提高皮甲防护能力的东西。^链甲由强化皮甲进一步加工制成,只是在原有护甲的基础上添加了一些金属链网以提供额外的抗性,尽管这会稍微影响走动而且穿久了会很累。 + +knowledge.craftArmourMedium.scale=作为替代,你可以制作鳞甲。鳞甲在抵挡全部种类的攻击上表现较为平衡,只是在抵挡突刺和斩击攻击上效果稍弱,但是在抵挡打击攻击上有所提升。 + +knowledge.craftArmourHeavy=重甲 +knowledge.craftArmourHeavy.desc=坚固而笨重 + +knowledge.craftArmourHeavy.1=中甲虽然给你提供了很好的防护,但这似乎还是有所局限。中等盔甲虽然具有很多优点,但是也许还有某些办法可以进一步改进它。^通过对某些野生动物的解剖表明:羊毛和羽毛做的垫子可以有效地提高装甲强度,护甲内的一层内衬能提供良好的优势。^但这会使得以此种方法制成的护甲非常沉重而难以穿着。 +knowledge.craftArmourHeavy.2=重甲在制作时已经包含了带衬护甲,这层护甲在重甲之下提供了柔软的保护层。 + +knowledge.craftArmourHeavy.splint=条板甲并没有一整套板甲那么重,相对的防护能力也降低了。不过较之于中甲,条板甲的防护性能依旧是十分优异的,对各种攻击都能提供同等的防护。 +knowledge.craftArmourHeavy.plate=板甲是最强的,但是造价也是最昂贵的,打造难度也很高。 +knowledge.craftHCCTools=原始工具 +knowledge.craftHCCTools.desc=(困难模式合成) + +knowledge.craftHCCTools.1=在困难合成模式开启时:原版的工具已经不再像以前那般有效。你在获取到金属前得先合成一些原始的石头工具。^原始工具在木匠工作台上合成。^ 每种石器都需要三种材料制成:^尖锐岩石:通过空手 (不拿任何物品) 破坏石头得到。^藤蔓:使用尖锐岩石破坏树叶获得。 + +knowledge.craftHCCTools.2=木棍的取得方式与藤蔓相同。^圆石同样可以制作尖锐岩石,只不过需要使用锤子在木匠工作台上制作。 + +knowledge.craftHCCTools.3=在你得到了这些材料后,接下来就要做一张木匠工作台以合成工具,强烈建议先做一把稿子,因为它可以用于开采石头 (然后可用锤子将其打碎成尖锐岩石) 。 + +knowledge.craftTools=锻制工具 +knowledge.craftTools.desc=精心打造 +knowledge.craftTools.1=这算哪门子工具?石头和树枝组合一下就能称之为工具了?得了吧!这才是正确的工具制造方式!^所有的常规工具只要以正确的方式打造,工具的耐久值就会加倍,逼格也会翻倍...^镐也可以显示方块的采掘等级以及现在是否可以采掘,只需要手持镐子右击方块即可。(原始工具也具备此功能) + +knowledge.craftAdvTools=高级工具 +knowledge.craftAdvTools.desc=适于用途 + +knowledge.craftAdvTools.1=你现在不止可以打造出各具用途的工具,这里还有一些同样用途的替代品,或者说升级版。绝大多数此类工具只是现有工具的替代,只不过某些地方有所不同。^$h手镐$r^手镐在挖掘像是石头或者末地石一类的方块时有几率掉落随机物品 (比如矿石和其他材料) 。^同时它在开采矿石时也有几率掉落诸如煤炭或者钻石一类的副产物。 + +knowledge.hvypick.info=$h重镐$r^重镐是用来开洞的!在破坏方块时,重镐也会以较低的方块掉落率,将方块周围3x2x3范围内的方块也一并破坏 (英文文本有误,与实际测试不符) 。在挖掘大型洞穴或者矿道时表现完美。 + +knowledge.trow.info=$h手锹$r^这可爱的小铲子和手镐效果类似。在它挖掘泥土时有几率额外掉落随机物品,挖掘草方块时有几率额外掉落各种种子。 + +knowledge.hvyshovel.info=$h重锹$r^虽说看上去像是装了一根长柄的门板,重锹在挖掘工作上是相当实用的工具。^使用时,这种锹可以挖出一片圆盘形的大洞,但是它会无视山丘状地貌 (如果你面前有一座小山,那么这个工具就不会,或者只挖掉一小部分山丘,所以说只是对同一高度的方块起效) 。非常适合用于平整地形。 + +knowledge.scythe.info=$h镰刀$r^手持镰刀右键可以清理大范围的杂草和树叶,在农活和清理工作方面,镰刀表现出色。另外要是你穿了身黑袍子,你可以吓一吓那些老头! + +knowledge.mattock.info=$h鹤嘴锄$r^改造地形的常用工具,鹤嘴锄可用于建设道路。泥土、草方块、沙子都可以被转化为道路。之后可以在其中放入方块以改变其外观。 +knowledge.mattock.use=使用鹤嘴锄右键泥土或者草方块可以将其转化为道路 (并非耕地) 。之后你可以使用其他实心方块 (例如石头) 右键道路以改变其材质 (注意此过程可以无限重复,小心额外的材料消耗) 。你还用锹右击改方块将其变成台阶。^用鹤嘴锄右击路面,可防止路面被改动。屏幕上出现的红色图标表示方块不可修改,而绿色图标则意味着可以。当你制造路面时会开启此功能。 + +knowledge.lumber.info=$h伐木斧$r^伐木斧可以方便地砍伐树木。伐木斧可通过砍掉一块木头从而伐倒整棵树木。高大的树木消耗更多耐久,同时也能获得次工具的更多力量值。 + +knowledge.craftWeapons=锻造武器 +knowledge.craftWeapons.desc=用于“防御” + +knowledge.craftWeapons.1=这是什么?木剑……你可以做个更好的……^每种武器都有不同的风格,总有一款适合你。^$h短剑$r^短剑的攻击力……真的很弱。^但行动和快攻时十分便捷!很适合补刀。 + +knowledge.sword.info=$h剑$r^一把完美而古老的剑。若使用得当,可以抵挡很多伤害。 + +knowledge.mace.info=$h权杖$r^适合敲打脑袋!权杖没那么特别,在格挡伤害时会损坏更多。但它们具有良好的耐久和较高的伤害。 + +knowledge.waraxe.info=$h战斧$r^一把沉重手斧可给敌人凶残的一击。战斧可造成不小的伤害,并且在突刺或跳跃攻击时有加成。适合野蛮的战斗类型。它们也能格挡更多的伤害。 + +knowledge.spear.info=$h矛$r^如果你害怕近身肉搏,可以试着用矛从远距离戳他们……你知道这就像你用一根长棍子将他们推走!^矛突刺时可造成更多伤害。 + +knowledge.bow.info=$h弓$r^标准木制弓与金属关节。^注,像一些脆性金属 (如生铁) 会减弱弓造成的伤害。^潜行时右击可打开物品槽。箭矢必须在使用前装载。 + +knowledge.craftAdvWeapons=重型武器 +knowledge.craftAdvWeapons.desc=大不大? + +knowledge.craftAdvWeapons.1=我不知道你打算杀死什么,但这里有一些……你可能会满意的东西。 + +knowledge.greatsword.info=$h巨剑$r^沉重,平刃的巨剑是最好的防御型重型武器。像剑一样,巨剑有不错的格挡性能。 + +knowledge.warhammer.info=$h战锤$r^如果你想打烂敌人的头骨,你可以考虑下战锤。 + +knowledge.battleaxe.info=$h双刃斧$r^双刃斧比战斧伤害更高但重量更重,是更疯狂的野蛮武器。^就是用着累了点! + +knowledge.halbeard.info=$h戟$r^如果觉得矛太弱,你可以在上面加个斧头。戟比矛的伤害更高但也跟重。^奔跑时戟可以刺击。 + +knowledge.lance.info=$h骑士枪$r^骑士枪没什么卵用。但它们可以基于你的速度提高伤害。^不懂的话可以拿来比武。 + +knowledge.firemaker=生火 +knowledge.firemaker.desc=燃烧一切 +knowledge.dryrocks.info=干燥岩石是最基本和最低效的生火方式。两个敲打在一起一段时间会产生火焰。 +knowledge.tinderbox.info=通过火绒盒生火效率高,且生出的火焰能持续较长一段时间。也许你需要多试几次,但这是值得的。 +knowledge.flintsteel.info=这是最有效的生火方式,可以立即生火。然而打火石相比火绒盒耐久更低。 + +knowledge.craftCrafters=制作工具 +knowledge.craftCrafters.desc=制作各式各样的工具 + +knowledge.craftCrafters.1=有各种用于不同合成的工具。许多合成表需要你用到它们。 +knowledge.hvyhammer.info=$h重锤$r^锤子更重的版本,用于锻造大型金属物品。 + +knowledge.tongs.info=$h钳$r^钳用于从砧中拾取加热的物品,然后把物品置于水源中。用钳夹取加热的物品不会向随机位置掉落,而是掉落在方块之上。 + +knowledge.knife.info=$h匕首$r^匕首可用于烹饪和鞣制。匕首很有用。^^就是别带着它们瞎浪。 + +knowledge.saw.info=$h锯$r^锯可将木头有效地切成木板。将木板方块置于木匠工作台上,然后用锯切割获得木板。^锯也能更有效地回收物品。 + +knowledge.needle.info=$h针$r^针被用来缝纫基础配方,针被用在任何线被用到地方。 + +knowledge.mallet.info=$h槌$r^槌真不常见……它几乎仅被用在锤子或许会太过的地方。所以基本上:只有一些木制品用这个。 + +knowledge.spoon.info=$h勺$r^勺子。用于烹饪,通常搅拌……还有什么可说……这是勺子…… + +knowledge.arrows=箭羽 +knowledge.arrows.desc=制作箭 + +knowledge.arrows.1=制作箭得花点时间,但成本较低。一支箭有三个部件:金属的箭头。箭羽由纸和羽毛来引导方向。箭轴仅由一根木棍构成! + +knowledge.arrowsBodkin=穿甲箭 +knowledge.arrowsBodkin.desc=轻便快捷 + +knowledge.arrowsBodkin.1=箭头的物理特性需要时间掌握,但还有另一种改良方式。你得相信轻型、平滑、匀称的箭头能改善箭的速度和精度。这会减小一点伤害,但这是值得的。 + +knowledge.arrowsBroad=宽型箭 +knowledge.arrowsBroad.desc=沉重强力 + +knowledge.arrowsBroad.1=研究一块燧石后,你发现了一种特别的箭型。尽管制作轻快精准的箭头是不错的选择,沉重的宽型箭可产生可观的伤害。^宽型箭比锥形的设计更重、更慢、误差更大,但产生的伤害是很值得的。 + +knowledge.etools=工程工具 +knowledge.etools.desc=专门工具 +knowledge.etools.1=在某些方面,机械可能是一项精巧的行业。因此,你需要专门的工具来胜任这些工作。 + +knowledge.ecomponents=部件和用品 +knowledge.ecomponents.desc=用于工程 + +knowledge.ecomponents.1=对于工程, 组件可以用一些巧妙的方法加入。然而, 你可能需要找到一些替代品来做这样的事。当需要的时候制作一些是值得的。 + +knowledge.ecomponents.2=大多数机械用品不只是铸造那么简单。一些结构需要预铸造,然后将它们组装在一起。部件一般有明确的用途,最好是即用即产 (除非你想要大量生产) 。 + +knowledge.coke=焦炭 +knowledge.coke.desc=精致燃料 + +knowledge.coke.1=一般来说,充满杂质的煤所能提供的燃烧能力极其微弱。通过精炼、使用红石,木炭可以被烧到完全去除杂质的程度,形成最纯净的煤炭,提供最佳的燃料。然而这一工序只能用于木炭。 + +knowledge.tungsten=黑钨冶炼 +knowledge.tungsten.desc=高性能机械金属 + +knowledge.tungsten.1=工程上使用铁基材料总有些限制;如无法承受某些机器所需的压力。黑钨是低海拔发现的稀有金属,也可以通过使用手镐发现。 + +knowledge.tungsten.2=如果你在16层以下使用足够高级的工具 (如镶钻钢) :可能开采出黑钨原矿。^这之后,需要的只是精炼。黑钨需要大量煤和溶剂才能熔化分解。 + +knowledge.tungsten.3=虽然这种材料对工程师极为重要,但冶炼矿石却需要掌握深度锻造技能,使它更难获得。 + +knowledge.engTanner=高级制革架 +knowledge.engTanner.desc=简易制革 + +knowledge.engTanner.1=制革可能是最累人的生产方式之一,现在你可以用机器使生产更简易。^制革架可为你将干净的兽皮切片切条,只需右键将物品放在制革架上面。 + +knowledge.advcrucible=自动化坩埚 +knowledge.advcrucible.desc=简化合金 + +knowledge.advcrucible.1=坩埚的科技水平较低,而你可以很容易了解到使用此法冶炼金属十分繁琐。^自动化坩埚能够一条龙式的分离并冷却金属。 + +knowledge.advforge=高级锻造 +knowledge.advforge.desc=自动化锻造 + +knowledge.advforge.1=这种矮人的设计可以通过红石信号,更精准地控制燃料燃烧。^这种炉子可以轻易开关,并保留燃料进度。 + +knowledge.blackpowder=黑火药 +knowledge.blackpowder.desc=轰隆! + +knowledge.blackpowder.1=使用普通火药或TNT或许足够了,但这很容易搞得一团糟。其实还可以制作对环境破坏小的爆炸物。^黑火药能对生物造成巨大伤害,但对方块破坏不大。^黑火药由多种矿物制成。 + +knowledge.advblackpowder=精致黑火药 +knowledge.advblackpowder.desc=咔轰! + +knowledge.advblackpowder.1=黑火药已经足够制作爆炸物,但有时你需要更大的爆炸。^通过红石和萤石:你可以增强黑火药的能力,增大爆炸。 + +knowledge.climber=登山镐 +knowledge.climber.desc=从这上去! +knowledge.climber.1=爬山时不得不找到一条斜坡的情况很尴尬,特别是当你掉入50米深的洞穴时。登山镐可使你抓住固体方块,只有完整的方块 (如石头和草方块) 可被抓住。 +knowledge.climber.2=这个物品比较难操作。首先,按住右键点击你正对的方块 (也可以选择选择更上面的方块) 。然后,左键将方块往自己这里拉,按住Shift然后用左键点击往下爬。可以往左右爬 ,也可以向上和向侧面突出 ,但是很困难。 + +knowledge.spyglass=望远镜 +knowledge.spyglass.desc=在远处! +knowledge.spyglass.1=这里有太多要看的东西了,但是限制了我们的眼睛还需要一直走到那里才能看到……不需要了。^当你使用望远镜的时候能让你看到更远的地方,Shift+右键可以切换望远镜模式。 + +knowledge.parachute=降落伞 +knowledge.parachute.desc=刚才什么飞上去了…… +knowledge.parachute.1=你可能知道怎么到达更高的地方,但是如果你待在地面上的话,还可以确定降落伞可以帮助你安全的从很高的地方,缓慢下降。 + +knowledge.syringe=注射器 +knowledge.syringe.desc=简单的管理 +knowledge.syringe.1=在紧急状况的时候喝药水会使人缓慢笨拙。注射器可以直接注射药水进入你的系统,在有用地时刻你在你需要它。你也可以Shift下蹲点击来注射药水。^如何将药水加入注射器:在工作台内放置一个空的注射器和一个普通的药水进行合成。 + +knowledge.bombs=制作炸弹 +knowledge.bombs.desc=扩大爆炸范围 + +knowledge.bombs.1=当使用黑火药的时候没有什么东西能让它在这些小物品可以让小范围内有恐怖的伤害。^炸弹需要多个物品制作……比起其他物品制作。首先: 你需要制作一个工作站。 + +knowledge.bombs.2=然后把工作站放置……随便哪里都行。^这个工作站可以制作炸弹和地雷。可以通过点击右键来投掷炸弹,炸弹会在很短地时间内爆炸。而地雷可以长按右键放置,当有东西接近就会引爆。 + +knowledge.bombs.3=炸弹和地雷需要3-4个物品才能制作。^壳体$h[1]$r确定了装置所造成的的伤害和距离。粉末r$h[2]$r会改变伤害。填充$h[3]$r可以在炸弹上添加效果。最后需要保险丝$h[4]$r确定了爆炸之前时间。 + +knowledge.bombs.4=制作一个炸弹:只用将部件放入相应的地方,比如黑火药和很短的保险丝。然后需要不停的点击扳手来制作物品。然后点击方块制作一个炸弹。 + +knowledge.crossbows=制作弩弓 +knowledge.crossbows.desc=致命一箭 +knowledge.crossbows.1=弩是一种定制的武器,能够以较可靠的命中率造成大量伤害。尽弩弩的射速通常要比弓慢,但是弩可以使用多种部件制成,使它们能发挥更广泛的作用。 +knowledge.crossbows.2=要制造一张弩的话,你需要一个装配台。^装配台允许你组装各式配件以合成最终成品。弩的特性取决于四种部件(弩臂、弩弓、配件和弩头) +knowledge.crossbows.3=将这个台子放在一个想要的位置。现在你需要制作组装弩的零件(请继续阅读)。^每一张弩都需要弩臂和弩弓。弩臂影响弩的后坐力和装弹速度,“手弩”专用的把手速度很快但是准头不高。 +knowledge.crossbows.4=你也许还会给一张弩添加一个配件和弩头。配件可以让弩弓获得更多的功能(需要付出代价),放置在弩弓的顶部。弩头是专门为弩弓的头部而设计的配件(比如一把刺刀)。但是不需要配件的时候就不添加配件准没错。 +knowledge.crossbows.5=要制作一把弩:只用将所有部件放入相应的地方。(类似于制造炸弹)然后你只需要不停的拿着扳手右击合成台来制作物品。 +knowledge.crossbows.6=完成以后,你就得到了一张弩。弩与弓在功能上有所不同,它可以在装弹完毕后立即开火。潜行状态下拿着弩右键会打开其装备栏。这是必须的。你可以添加各种弩箭到弩的装备栏中,这样当你使用弩的时候它会装载弩箭。 + +knowledge.crossShafts=弩臂 +knowledge.crossShafts.desc=重要组成部分 +knowledge.crossShafts.handle=手柄是迷你型的弩臂,用于合成手弩。这种设计提高了换弹速度,以牺牲精度和后坐力的代价。 +knowledge.crossShafts.stock=弩臂是完整体型版的手柄,可以以更小的后坐力发射弩箭。因其尺寸较大,换弹的时间减少了。 + +knowledge.crossHeads=弩弓 +knowledge.crossHeads.desc=重要组成部分 +knowledge.crossHeads.light=一个轻量的弩弓可以以牺牲弩箭力量的代价换取更快的换弹速度。此种弩弓可以被多次调整以增加其重量和力量。 +knowledge.crossHeads.medium=一种标准尺寸的弩弓。有着均衡的力量和速度。 +knowledge.crossHeads.heavy=一种重型、强化后的弩弓。有着恐怖的伤害,也具备更大的后坐力和更慢的换弹速度。 + +knowledge.crossHeadAdvanced=高级弩弓 +knowledge.crossHeadAdvanced.desc=精度高于速度 + +knowledge.crossHeads.advanced=这套矮人弩设计图包含了一种能够释放强力攻击的钢弩。使用合适的材料与工具,你也可以自己做一把。^尽管速度缓慢,这种弩弓能够发射具有致命力量和精度的弩箭。 + +knowledge.crossShaftAdvanced=高级弩臂 +knowledge.crossShaftAdvanced.desc=后坐力控制 + +knowledge.crossShafts.advanced=对于那些基于普通木质弩臂的弩来说,这种矮人弩的弩臂采用了金属设计。尽管沉重,其包含了一个弹簧装弹系统以吸收后坐力。 + +knowledge.crossAmmo=连弩 +knowledge.crossAmmo.desc=扩展能力 +knowledge.crossAmmo.1=弓弩装弹需要时间,而你也许需要发射不止一发弩箭才能解决问题。连弩弩机可以放置于“配件”栏,并允许弓弩在重新装弹之前发射多发弩箭(以牺牲精度的代价)。 + +knowledge.crossScope=弓弩瞄准镜 +knowledge.crossScope.desc=原始的狙击手 +knowledge.crossScope.1=一把精准的弩在你看不见射击目标时又有何用途呢?你现在可以对望远镜进行一些调整以使其适用于弩弓,将其装在“配件”栏。 + +knowledge.crossBayonet=弓弩刺刀 +knowledge.crossBayonet.desc=近战伤害 +knowledge.crossBayonet.1=在一些人给他们的弩重新装弹时,常有一些渣滓会乘机偷袭,你需要以另一种方式进行反击。装在“弩头”栏的刺刀可以增加弩的近战伤害。 + +knowledge.bpress=炸弹组装机 +knowledge.bpress.desc=大规模生产 +knowledge.bpress.1=手工组装每个炸弹会很繁琐……非常繁琐。此设备可替你完成这项工作,你只需把材料放入合成机,拉动拉杆炸弹就做好了。 + +knowledge.bombarrow=爆炸箭 +knowledge.bombarrow.desc=成吨伤害 +knowledge.bombarrow.1=你制作炸弹的经验是值得的。这种微型爆炸物能像炸弹一样组装并释放致命的爆炸。制作爆炸箭的方式和炸弹一样,需要把箭放在炸弹壳的物品槽里。爆炸箭不需要导火索。 + +knowledge.shrapnel=弹片炸弹 +knowledge.shrapnel.desc=简单的装填 +knowledge.shrapnel.1=炸弹目前似乎已足够好了,但仍有提升的空间。每个炸弹都可以加上这种装置,从而改进引爆效果。^在合成中加入炸弹弹片可以提高其爆炸伤害。 + +knowledge.firebomb=燃烧弹 +knowledge.firebomb.desc=烈火焚身 + +knowledge.firebomb.1=弹片炸弹对打击地面上的单个敌人很有效。但有时场面会更加疯狂。^岩浆膏的混合物可使炸弹在爆炸时释放出大团火球。精制岩浆膏则更是能释放出难以抵挡的热度。 + +knowledge.firebomb.2=它的工作原理是岩浆膏 (岩浆怪灰烬的混合物) 能提供源源不断的火焰。额外加入烈焰粉,接着加入龙心,将会产生魔法般的催化效果,提高火焰的温度。 +knowledge.firebomb.3=燃烧弹可能会使你觉得昂贵,但这对攻破敌人防具极为有效。 + +knowledge.bombCeramic=陶瓷炸弹壳 +knowledge.bombCeramic.desc=基础炸弹 +knowledge.bombCeramic.1=炸弹是最简单的爆炸形式之一:只需掷出就会引爆。^但陶瓷壳易碎,不容易控制爆炸。此种炸弹的爆炸范围一般。 + +knowledge.mineCeramic=陶瓷地雷壳 +knowledge.mineCeramic.desc=基础地雷 +knowledge.mineCeramic.1=地雷不像常规的炸弹那么有用,但仍有它们发挥的一席之地。当有物品靠近时,地雷将会爆炸。^陶瓷壳易碎且不稳定,这意味着它很敏感,同时也不容易控制。此种地雷的爆炸范围一般。 + +knowledge.bombIron=铁制炸弹壳 +knowledge.bombIron.desc=可靠的引爆 +knowledge.bombIron.1=一般来说制作更易引爆的炸弹是更明智的做法……为什么不加点压力呢?^铁壳使炸弹引爆(尽管范围变小)需要更大的冲击。 + +knowledge.mineIron=铁制地雷壳 +knowledge.mineIron.desc=可靠的引爆 +knowledge.mineIron.1=陶瓷壳或许过于敏感了。铁炸弹壳不仅能使炸弹积聚更多压力,而且它们的固态结构使它们更难触发,减小爆炸半径提高伤害。 + +knowledge.bombObsidian=黑曜石炸弹壳 +knowledge.bombObsidian.desc=保持新鲜 + +knowledge.bombObsidian.1=这个炸弹示意图呈现出用黑曜石制成的外壳。这种坚硬的外壳更容易控制,适合定点爆破。产生的爆炸范围更小,伤害巨大。 + +knowledge.mineObsidian=黑曜石地雷壳 +knowledge.mineObsidian.desc=保持新鲜 + +knowledge.mineObsidian.1=这是矮人研制的地雷壳。黑曜石地雷壳的设计可实现具体位置的定点爆破。产生的爆炸范围更小,伤害巨大。 + +knowledge.bombCrystal=水晶炸弹壳 +knowledge.bombCrystal.desc=时髦物件 + +knowledge.bombCrystal.1=减小爆炸半径来提高伤害的做法很普遍,但为什么不试着增大爆炸半径呢?^玻璃壳可使爆炸物飞溅得尽量远。^并且,在其中加入钻石,碎片可造成更多伤害! + +knowledge.mineCrystal=水晶地雷壳 +knowledge.mineCrystal.desc=时髦物件 +knowledge.mineCrystal.1=一个精致的玻璃地雷,可轻易造成一场大爆炸。^并且,在其中加入钻石,碎片可造成更多伤害! + +knowledge.bombFuse=导火索 +knowledge.bombFuse.desc=定时爆炸 +knowledge.bombFuse.1=没有导火索的炸弹算什么?只能是烫手的山芋!导火索是任何爆炸装置的重要部件,地雷有时也会用到它。^导火索决定了你的装置何时爆炸。 +knowledge.bombFuse.2=你还可以制作加长导火索。这样你就可以离爆炸物更远了。但对地雷用处不大…… + +knowledge.stickybomb=粘性炸弹 +knowledge.stickybomb.desc=抓住它! +knowledge.stickybomb.1=正如它名字那样,它可以粘在任何与之接触的可怜家伙身上。^所以这是一种能粘住某人,造成巨大伤害的炸弹。其乐无穷! +knowledge.stickybomb.2=制造方法:在输出槽中放入炸弹后,用粘液球右击。一个粘液球就可以黏住整组任何尺寸的炸弹。 + +$hUse of Cogworks$r^ + +knowledge.cogArmour=机甲 +knowledge.cogArmour.desc=动力装甲 + +knowledge.cogArmour.1=这似乎算得上是一项真正意义上的发现,可能解释了为什么矮人废墟里包含特别高大的大厅和走廊结构。这里有一份记载了一整套先进装甲的图纸,这种装甲将人类的动作复刻到了一套沉重的外骨骼上。图纸表明这是一套庞大结实的护甲,能够使穿戴者几乎免疫一切伤害。^机甲是矮人工程学的巅峰产物,能够承载大量的重物。不过美中不足的是它的耗能,需要使用纯净的燃料————很多。 + +knowledge.cogArmour.2=尽管在遗迹中并未发现任何装甲实体,但是组装系统却被完整的保留下来了,这种系统似乎可以容纳下某种装甲,其体积比人类体型还要巨大。 + +knowledge.cogArmour.station=$$h合成站$r^为了组装和调整机甲,你有必要建造一个合成站。机甲合成站由框架和滑轮系统组成。首先,使用框架座搭起三根四格高的柱子,再在顶部中央单独放置一个框架座(参考图示)。 +//Example +knowledge.cogwork_station=合成站 +knowledge.cogArmour.station.2=框架组装完毕后,你需要制作一个滑轮,之后使用扳手右击顶部中央的框架方块将其安装上去。务必保证你是在正确的位置上放置了框架,因为在滑轮安装完毕之后,是没有办法再将其拆卸下来的。 +//Pulley Recipe +knowledge.cogArmour.crafting=组装机甲:你需要三种外骨骼方块(头盔、胸甲和胫甲),在框架中按顺序放置它们,之后使用扳手右击胸甲方块。 +//Piece Recipes +knowledge.cogArmour.armour=$h外骨骼装甲$r^为了给外骨骼添加额外的保护,你需要打造一套外骨骼装甲,制造一套外骨骼装甲需要消耗大量的金属锭,所以建议你使用常见材料,比如钢来制造。外骨骼装甲可以通过右击在框架中吊置的外骨骼来安装上去。不过你还需要16个螺栓,在装甲安装到外骨骼上之前使用(拿着外骨骼装甲右击安装,不是拿着螺栓)。外骨骼装甲可以用一把扳手轻松的卸下。 +//Armour Recipe +knowledge.cogArmour.fuel=$h填充燃料$r^机甲只能使用精炼燃料(焦炭或者岩浆膏)来供能。拿着燃料右击机甲进行填充。^外骨骼套上的装甲越重,燃料消耗的就越快。 +knowledge.cogArmour.advantage=$h优势$r^一套没有装备外骨骼装甲的机甲可以提供对烟雾的免疫力,抵消摔落伤害,增加攻击伤害同时消除精力消耗。 +knowledge.cogArmour.advantage.2=装备上装甲后:此时机甲被密封,你会得到巨额的护甲值奖励并且可以在水下呼吸。此时机甲也可以消除中毒/凋零伤害,并使穿戴者对火焰免疫。 +knowledge.cogArmour.advantage.3=装甲依旧会根据其熔点高低承受火焰伤害,同理更高的耐久等级会使装甲坚持更久。在这之后外骨骼装甲必须在合成站卸下并进行维修。 +knowledge.cogArmour.disadvantage=穿着机甲的时候,你无法跳跃,但是能够直接走上一格高的方块,你的移动速度也会变得很慢,并且不能潜行。 +knowledge.cogArmour.disadvantage.2=爆炸同样会对装甲造成损伤,不仅比其他类型的伤害更高,还会造成一秒钟的眩晕。 +knowledge.cogArmour.removal=尽管外骨骼装甲会在外骨骼损坏的时候被移除,但是外骨骼框架会完好的保留下来,而一套未载人的,没有安装装甲的外骨骼可以通过使用一把扳手左击的方式来拆掉,如果在装甲损坏的情况下被留在火焰或岩浆中,外骨骼也会损毁。 + +knowledge.compPlate=复合合金 +knowledge.compPlate.desc=用途广泛 + +knowledge.compPlate.1=目前,大多数合金都是通过将物质简单地在锅中混合制成的。这种由矮人设计的金属则不同,是由多种材料压制而成的。虽然用于制作工具不高效,但用于制造装甲非常有效,尽管有些重。^显然这种特别的合金是为机甲而生的。 + +knowledge.refined_planks=精制木板 +knowledge.refined_planks.desc=结构稳定 +knowledge.refined_planks.1=精制木板坚韧、耐风雨,是体面的建材。将它们钉入钉子就可以制作出适合建筑的方块。此方块不可被拆分。^你也可以用普通的木板制作。 + +knowledge.constructionPts=建筑部件 +knowledge.constructionPts.desc=制作完备的木头 +knowledge.constructionPts.1=很多情况木头必须被切割为不同的形状,来适应不同的建筑需要。^就像金属用于制作配件和钉子,制作合适的家具需要大量木材。 + +knowledge.reinforced_stone=强化石头 +knowledge.reinforced_stone.desc=负重 +knowledge.reinforced_stone.1=石头是有用的坚固材料,不可燃且具有高爆炸抗性。而你还可以通过熔化黑曜石和高岭石来提高它的性能。^你从坩埚中制得石材不需要模具。 + +knowledge.clay_wall=粘土面板 +knowledge.clay_wall.desc=装饰墙壁 +knowledge.clay_wall.1=这种墙主要用于装饰。很适合用于双层建筑和屋顶内衬。 + +knowledge.glass=玻璃块 +knowledge.glass.desc=装饰窗户 +knowledge.glass.1=玻璃用于装饰,但是非常脆弱。在玻璃周围放置框架,不仅能提高其强度,而且可以安全地采集它。 + +knowledge.brickworks=基础制砖 +knowledge.brickworks.desc=强化石材 +knowledge.brickworks.1=石材用处多多。泥土和石头可以制成铺路石和砖。 + +knowledge.bars=金属栅栏 +knowledge.bars.desc=结实的栅栏 +knowledge.bars.1=这种栅栏不但可使光线穿过,而且还十分坚固。栅栏可由普通材料 (而不是罕见的或传奇的) 制成。^但仍可以制作龙铸的栅栏来释放它的潜能。 + +knowledge.thatch=茅草 +knowledge.thatch.desc=柔软的屋顶 +knowledge.thatch.1=由茅草制作简单的屋顶。这些可以和泥土很好的搭配起来,而且很容易制作。 + +knowledge.paint_brush=油漆刷 +knowledge.paint_brush.desc=粉刷一切 +knowledge.paint_brush.1=你会明显注意到,用手涂抹颜料会把一切搞糟。你需要一把油漆刷。^油漆刷可以更改木板的外表,而且可以覆盖已有的颜色。 +knowledge.paint_brush.2=$h轻松粉刷$r^为了解决频繁使用工作台的麻烦,你还可以粉刷一些游戏中的方块,只要你的物品栏中有颜料,右击方块诸如钉板,可以把它们涂上颜色。 + +knowledge.decorated_stone=石材装饰 +knowledge.decorated_stone.desc=金属装饰 +knowledge.decorated_stone.1=石材可能看上去很沉闷,所以你学会了用金属装饰结实的石头,为你的墙壁增色几分。 + +knowledge.tool_rack=工具架 +knowledge.tool_rack.desc=存储你的工具 +knowledge.tool_rack.1=如果你有很多工具,可能需要一些空间来容纳它们。工具架可以快速存取物品。^右击方块放置或空手取下工具。^重型武器需要两格高的架子放置,长柄武器则需要三格。 +knowledge.tool_rack.rules=*重型武器需要上下两个架子。^*长柄武器需要上下三个架子。^*全套的弩视为重型武器。^*弩不可以被放置在边缘的钩上。 + +knowledge.bed_roll=床铺 +knowledge.bed_roll.desc=四海为家 +knowledge.bed_roll.1=在野外时,有时需要立即睡觉。床铺允许你睡觉但并不重置重生点。 + +knowledge.food_box=专用箱子 +knowledge.food_box.desc=食品储存 +knowledge.food_box.1=食品和医疗用品在需要时能被很容易地获取。箱子允许你存储食品和绷带几倍于它们的最大堆叠数。点击右键可放入物品或空手将物品取回。 + +knowledge.ammo_box=弹药箱 +knowledge.ammo_box.desc=弹药储存 +knowledge.ammo_box.1=弹药应该也必须在使用时能被很容易地获取。弹药箱允许你存储箭、弩箭、炸弹或地雷八倍于它们的最大堆叠数。点击右键可放入物品或空手将整组物品取回,手持远程武器 (弓/弩) 可装载弹药。 +knowledge.ammo_box.2=被破坏时,所存储的物品仍然存储,并可在二次放置后存取物品。 + +knowledge.big_box=存储箱 +knowledge.big_box.desc=存储各种物品 +knowledge.big_box.1=不管是为了贮存还是装运,这些箱子里允许放置任何物品,无论其最大堆叠数是多少。 + +knowledge.generic_meat=普通的肉 +knowledge.generic_meat.desc=制成各种食物 +knowledge.generic_meat.1=有许多种肉类。但有时不会如此。普通的肉可由各种生或熟肉制成,如此能占据更少的存储空间。^你最好准备一些生肉,有些可以提供额外效果。 + +knowledge.stew=炖肉 +knowledge.stew.desc=有点平淡 +knowledge.stew.1=你不是厨师……至少现在还不是。就将一些肉粒放入碗中然后当做餐饮!炖肉可由牛排、鸡肉、猪肉、狼肉、马肉甚至鱼肉制作。 + +knowledge.jerky=肉干 +knowledge.jerky.desc=旅行者必备 +knowledge.jerky.1=肉干不可能是最好吃的食物,但它有自己的用场。这是为数不多的可堆叠食品,且有一个像样的耐力加成。适合挖掘和探索时食用。 + +knowledge.saussage=香肠 +knowledge.saussage.desc=密封的肉 +knowledge.saussage.1=当用肉制作肉干时,你倾向于为了实用性牺牲食用时的快感。嘎嘣脆!把肉包进……嗯……内脏由制成的外壳中可以保持新鲜。 + +knowledge.sandwitch=三明治 +knowledge.sandwitch.desc=简单的 +knowledge.sandwitch.1=一块肉和一些面包的混合物,你怎么会不知道?!三明治虽然不可堆叠但是可以食用两次。 + +knowledge.sandwitchBig=超大三明治 +knowledge.sandwitchBig.desc=加长 +knowledge.sandwitchBig.1=你现在可以把更多馅料加入面包里制作三明治,它们可被食用4次。 + +knowledge.meatpie=肉馅饼 +knowledge.meatpie.desc=丰富的馅料 +knowledge.meatpie.1=有什么比把肉放在馅饼里更好?没有!肉馅饼可以提供高耐力buff。可将馅饼放到地上并用刀右击将其切片。 + +knowledge.shepardpie=马铃薯派 +knowledge.shepardpie.desc=大众小吃 +knowledge.shepardpie.1=加入了马铃薯,比肉馅饼更棒!提供更强的耐力buff。可将派放到地上并用刀右击将其切片。 + +knowledge.salt=盐 +knowledge.salt.desc=多一点点 +knowledge.salt.1=盐有时会作为烹饪中使用的添加剂。制作盐,先要准备一些盐水。盐水可用粘土罐右击沙子上的水源 (例如沙滩) 取得。然后烹煮出盐。 +knowledge.salt.2=陶壶能够长期储存盐渍食物而不腐坏。这些被用来收集盐水。^盐水可直接在沙子上方的水源“或”在沙滩 / 海洋群系中采集到。 + +knowledge.jug=罐子 +knowledge.jug.desc=储存液体 +knowledge.jug.1=携带大量食物会很麻烦,并且你不能携带液体,基于此,罐子派上了用场。罐子能储存牛奶、水和油。 +knowledge.jug.2=和桶相似,可以用右键收集水,但也可以通过合成与桶中的液体转换。牛奶不能直接从牛获取。 + +knowledge.bread=面包和糕点 +knowledge.bread.desc=颗粒状 +knowledge.bread.1=面包也许是乏味的一餐,加入其他食品会更有趣。^而面粉可以用来制作各种糕点。 +knowledge.bread.other=一些合成表 (例如之前已提到的面包) 可使用替代合成表,但仅限 MF 食品。 + +knowledge.oats=燕麦 +knowledge.oats.desc=健康的基础要求 +knowledge.oats.1=并不是所有的食物都是混合物。你可以选择食用这种天然谷物混合物保持健康。 + +knowledge.icing=糖 +knowledge.icing.desc=含糖即是正义 +knowledge.icing.1=加一点糖没有什么问题,除非它保存在某人的口袋里三天…… 你可以直接将甘蔗在陶罐中研磨为糖,并把糖储存在罐中。放些口袋里的糖也没问题。 +knowledge.icing.2=一些食物没有了糖就显得不完美了。糖用于制作很多甜食。 + +knowledge.sweetroll=甜甜圈 +knowledge.sweetroll.desc=让我猜猜看…… +knowledge.sweetroll.1=甜甜圈能使很多人满足。吃点它,即使它不回复耐力或给予耐力提升效果。甜甜圈可以食用两次。 + +knowledge.eclair=泡芙 +knowledge.eclair.desc=花式小吃 +knowledge.eclair.1=现在你在张扬……但是这些还是无法与那些华丽的甜食比较……^这些小点心可以食用四次。 + +knowledge.cake=蛋糕 +knowledge.cake.desc=用**正确**的方式制作! +knowledge.cake.1=一个大蛋糕。恢复一些耐力并附有一个短时间的耐力提升buff。将派放到地上并用刀右击将其切片。可将蛋糕放到地上并用刀右击将其切片。 + +knowledge.carrotcake=胡萝卜蛋糕 +knowledge.carrotcake.desc=有点健康…… +knowledge.carrotcake.1=蛋糕里加入了胡萝卜 。可以恢复一些耐力并附有一个短时间的耐力提升buff。可将派放到地上并用刀右击将其切片。 + +knowledge.chococake=巧克力蛋糕 +knowledge.chococake.desc=好吃得要死 +knowledge.chococake.1=巧克力蛋糕可以恢复一些耐力并附有一个短时间的耐力提升buff。可将蛋糕放到地上并用刀右击将其切片。 + +knowledge.bfcake=黑森林蛋糕 +knowledge.bfcake.desc=美味 +knowledge.bfcake.1=黑森林蛋糕可以恢复耐力并且可以让耐力消耗减小。可将蛋糕放到地上并用刀右击将其切片。 + +knowledge.berrypie=浆果派 +knowledge.berrypie.desc=简易的甜点 +knowledge.berrypie.1=浆果美味多汁,但你也许需要加工。浆果派可以恢复一些耐力并附有一个短时间的耐力提升buff。可将派放到地上并用刀右击将其切片。 + +knowledge.applepie=苹果派 +knowledge.applepie.desc=简易的甜点 +knowledge.applepie.1=浆果馅饼类似,具有更好一点的效果。苹果派可以恢复一些耐力并附有一个短时间的耐力提升buff。可将派放到地上并用刀右击将其切片。 + +knowledge.cheese=奶酪 +knowledge.cheese.desc=固体奶酪 +knowledge.cheese.1=奶酪由炼牛奶制成。它可以合成其他的食物。可将奶酪块放到地上并用刀右击将其切片。 + +knowledge.cheeseroll=奶酪卷 +knowledge.cheeseroll.desc=简易的小吃 +knowledge.cheeseroll.1=奶酪和面包是很好的混合物。把一点奶酪放在卷子里,给它增加一些味道。 + +knowledge.firepit=火塘和煎锅 +knowledge.firepit.desc=基础烹饪 +knowledge.firepit.1=火塘是为烹饪和照明提供火焰的稳定方式,且制作成本低。要生火,先放置火塘并右击木材加入燃料,然后再用点火物右击火塘生火。 +knowledge.firepit.2=烤盘用于烹饪,必须放置在热源 (火塘或炉子) 上。^右键单击烤盘将生食放置上面,并一直等到它烹饪完成,注意不要熟过了。烹饪某些配方 (如蛋糕) 需要更稳定的温度。这时使用锻造炉和煤粉会更合适。 +knowledge.firepit.3=烤箱能够像普通的炉灶一样烘焙面包等物品。^烤箱还可以将粘土制成陶瓷,使它们可用于烹饪以及制作其他工艺品,承受很高的温度 (如锻造炉中的煤)。 +knowledge.firepit.4=当烹饪时:使用一个火塘进行基础烹饪,一个烧煤粉的锻造炉用来进行高级烹饪,一个烧基础燃料(比如煤)的锻造炉用来烧制陶器。 + +knowledge.cookingutensil=炊具 +knowledge.cookingutensil.desc=用于烹饪的工具 +knowledge.cookingutensil.1=在烹饪中,需要许多不可或缺的工具,比如盘子和饼模。工具介绍见基础部分。 + +knowledge.bandage=绷带 +knowledge.bandage.desc=急救 +knowledge.bandage.1=残血时右键使用绑带能快速回复生命值。^然而对饥饿、溺水、灼烧、中毒等状态没什么用。 + +knowledge.bandageadv=精良的绷带 +knowledge.bandageadv.desc=稀有物品 +knowledge.bandageadv.1=这种增强的绷带可以回复更多生命值,然而花销也更大。 + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/MASTERY TEXT/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +knowledge.title= +knowledge.title.desc= +knowledge.title.1= + +knowledge.fitness=健康值 +knowledge.fitness.desc=保持健康 +knowledge.fitness.1=你战场上的 (除了真实的外) 最大敌人是能量。^耐力消耗减少25%。 + +knowledge.toughness=韧性 +knowledge.toughness.desc=坚持住! +knowledge.toughness.1=你对战斗的熟知已经证明你有了对各种攻击的抗性。^所有伤害降低25%。 + +knowledge.armourpro=精通兵器 +knowledge.armourpro.desc=举重若轻 +knowledge.armourpro.1=从今往后,你的内心变得强大。^武器对耐力的消耗减半。 + +knowledge.parrypro=闪避策略 +knowledge.parrypro.desc=控制动作 +knowledge.parrypro.1=战场上的位置是一种重要武器,也能发挥更多优势。^闪避时按住shift可以使你跃到敌人身后。这对突破敌方防御很有效。 + +knowledge.counteratt=反击 +knowledge.counteratt.desc=反弹伤害 +knowledge.counteratt.1=闪避也许能保护你,但也会带来一些副作用,不过只要你有足够的经验,反击将给你带来优势。^闪避后可进行攻击,但效果减弱。 +knowledge.counteratt.2=对剑、短剑和太刀采取刺击。^对战斧采取背部刺击。^对重武器采取连续碾压。^对钝的武器和长柄武器没有任何效果。 + +knowledge.autoparry=自动格挡 +knowledge.autoparry.desc=洞察攻击 +knowledge.autoparry.1=招架的技巧已经深深的记在你的肌肉当中。^在非格挡状态下你也能招架攻击 (但防御范围降低)。 + +knowledge.scrapper=拾荒者 +knowledge.scrapper.desc=收集一切 +knowledge.scrapper.1=你学会了更多将物品合成和分解的技巧。^增加分解物品掉落几率。 + +knowledge.firstaid=急救 +knowledge.firstaid.desc=照顾伤员 +knowledge.firstaid.1=你需要时刻准备治疗伤口。^绷带使用速度显著加快。 + +knowledge.doctor=医生 +knowledge.doctor.desc=救死扶伤 +knowledge.doctor.1=你不断救助你的同伴,因此获得了医学上的经验。^绑带治疗加成50%。 diff --git a/src/main/resources/assets/minefantasy2/sounds.json b/src/main/resources/assets/minefantasy2/sounds.json index 2699aa27..a8d9ded6 100644 --- a/src/main/resources/assets/minefantasy2/sounds.json +++ b/src/main/resources/assets/minefantasy2/sounds.json @@ -1,280 +1,245 @@ { - "weapon.bombBounce": { + "weapon.bombBounce": { "category": "neutral", "sounds": [ - "weapon/bomb_bounce" - ] - }, - - "weapon.bowFire": { + "weapon/bomb_bounce" + ] + }, + "weapon.bowFire": { "category": "neutral", "sounds": [ - "weapon/bow_fire" - ] - }, - - "weapon.arrowHit": { + "weapon/bow_fire" + ] + }, + "weapon.arrowHit": { "category": "neutral", "sounds": [ - "weapon/arrow_hit" - ] - }, - - "weapon.crossbowload": { + "weapon/arrow_hit" + ] + }, + "weapon.crossbowload": { "category": "neutral", "sounds": [ - "weapon/crossbow_load" - ] - }, - - "weapon.crossbow_fire": { + "weapon/crossbow_load" + ] + }, + "weapon.crossbow_fire": { "category": "neutral", "sounds": [ - "weapon/crossbow_fire" - ] - }, - - "weapon.critical": { + "weapon/crossbow_fire" + ] + }, + "weapon.critical": { "category": "neutral", "sounds": [ - "weapon/critical" - ] - }, - - "weapon.wood_parry": { + "weapon/critical" + ] + }, + "weapon.wood_parry": { "category": "neutral", "sounds": [ - "weapon/wood_parry" - ] - }, - - "weapon.hit.blunt.wood": { + "weapon/wood_parry" + ] + }, + "weapon.hit.blunt.wood": { "category": "neutral", "sounds": [ - "weapon/hit/blunt/wood1" - ] - }, - - "weapon.hit.blunt.stone": { + "weapon/hit/blunt/wood1" + ] + }, + "weapon.hit.blunt.stone": { "category": "neutral", "sounds": [ - "weapon/hit/blunt/stone1" - ] - }, - "weapon.hit.blunt.metal": { + "weapon/hit/blunt/stone1" + ] + }, + "weapon.hit.blunt.metal": { "category": "neutral", "sounds": [ - "weapon/hit/blunt/metal1" - ] - }, - - "weapon.hit.blade.wood": { + "weapon/hit/blunt/metal1" + ] + }, + "weapon.hit.blade.wood": { "category": "neutral", "sounds": [ - "weapon/hit/blade/wood1" - ] - }, - - "weapon.hit.blade.stone": { + "weapon/hit/blade/wood1" + ] + }, + "weapon.hit.blade.stone": { "category": "neutral", "sounds": [ - "weapon/hit/blade/stone1" - ] - }, - - "weapon.hit.blade.metal": { + "weapon/hit/blade/stone1" + ] + }, + "weapon.hit.blade.metal": { "category": "neutral", "sounds": [ - "weapon/hit/blade/metal1" - ] - }, - - "block.mythicore": { + "weapon/hit/blade/metal1" + ] + }, + "block.mythicore": { "category": "neutral", "sounds": [ - "blocks/MythicOre" - ] - }, - - "block.carpentermallet": { + "blocks/MythicOre" + ] + }, + "block.carpentermallet": { "category": "neutral", "sounds": [ - "blocks/CarpenterMallet" - ] - }, - - "block.anvilfail": { + "blocks/CarpenterMallet" + ] + }, + "block.anvilfail": { "category": "neutral", "sounds": [ - "process/anvil/AnvilFail1", - "process/anvil/AnvilFail2", - "process/anvil/AnvilFail3" - ] - }, - - "block.anvilsucceed": { + "process/anvil/AnvilFail1", + "process/anvil/AnvilFail2", + "process/anvil/AnvilFail3" + ] + }, + "block.anvilsucceed": { "category": "neutral", "sounds": [ - "process/anvil/AnvilSucceed1", - "process/anvil/AnvilSucceed2", - "process/anvil/AnvilSucceed3" - ] - }, - - "block.hammercarpenter": { + "process/anvil/AnvilSucceed1", + "process/anvil/AnvilSucceed2", + "process/anvil/AnvilSucceed3" + ] + }, + "block.hammercarpenter": { "category": "neutral", "sounds": [ - "process/carpenter/HammerCarpenter1", - "process/carpenter/HammerCarpenter2", - "process/carpenter/HammerCarpenter3" - ] - }, - - "block.quern": { + "process/carpenter/HammerCarpenter1", + "process/carpenter/HammerCarpenter2", + "process/carpenter/HammerCarpenter3" + ] + }, + "block.quern": { "category": "neutral", "sounds": [ - "process/carpenter/Quern1", - "process/carpenter/Quern2", - "process/carpenter/Quern3" - ] - }, - - "block.craftprimitive": { + "process/carpenter/Quern1", + "process/carpenter/Quern2", + "process/carpenter/Quern3" + ] + }, + "block.craftprimitive": { "category": "neutral", "sounds": [ - "process/carpenter/CraftPrimitive1", - "process/carpenter/CraftPrimitive2", - "process/carpenter/CraftPrimitive3" - ] - }, - - "block.sawcarpenter": { + "process/carpenter/CraftPrimitive1", + "process/carpenter/CraftPrimitive2", + "process/carpenter/CraftPrimitive3" + ] + }, + "block.sawcarpenter": { "category": "neutral", "sounds": [ - "process/carpenter/SawCarpenter1", - "process/carpenter/SawCarpenter2", - "process/carpenter/SawCarpenter3" - ] - }, - - "block.twistbolt": { + "process/carpenter/SawCarpenter1", + "process/carpenter/SawCarpenter2", + "process/carpenter/SawCarpenter3" + ] + }, + "block.twistbolt": { "category": "neutral", "sounds": [ - "process/carpenter/TwistBolt1" - ] - }, - - "updateResearch": { + "process/carpenter/TwistBolt1" + ] + }, + "updateResearch": { "category": "player", "sounds": [ - "updateResearch" - ] - }, - - "block.flipPage": { + "updateResearch" + ] + }, + "block.flipPage": { "category": "neutral", "sounds": [ - "process/research/FlipPage1", - "process/research/FlipPage2", - "process/research/FlipPage3", - "process/research/FlipPage4" - ] - }, - - "block.bellows": { + "process/research/FlipPage1", + "process/research/FlipPage2", + "process/research/FlipPage3", + "process/research/FlipPage4" + ] + }, + "block.bellows": { "category": "neutral", "sounds": [ - "blocks/Bellows" - ] - }, - - "mob.dragon.say": { + "blocks/Bellows" + ] + }, + "mob.dragon.say": { "category": "neutral", "sounds": [ - "monster/dragon/dragon_say1", - "monster/dragon/dragon_say2", - "monster/dragon/dragon_say3" - ] - }, - - "mob.dragon.bite": { + "monster/dragon/dragon_say1", + "monster/dragon/dragon_say2", + "monster/dragon/dragon_say3" + ] + }, + "mob.dragon.bite": { "category": "neutral", "sounds": [ - "monster/dragon/dragon_bite1", - "monster/dragon/dragon_bite2", - "monster/dragon/dragon_bite3" - ] - }, - - "mob.dragon.hurt": { + "monster/dragon/dragon_bite1", + "monster/dragon/dragon_bite2", + "monster/dragon/dragon_bite3" + ] + }, + "mob.dragon.hurt": { "category": "neutral", "sounds": [ - "monster/dragon/dragon_hurt1" - ] - }, - - "mob.dragon.fire": { + "monster/dragon/dragon_hurt1" + ] + }, + "mob.dragon.fire": { "category": "neutral", "sounds": [ - "monster/dragon/dragon_fire1" - ] - }, - - "mob.dragon.step": { + "monster/dragon/dragon_fire1" + ] + }, + "mob.dragon.step": { "category": "neutral", "sounds": [ - "monster/dragon/dragon_step1" - ] - }, - - "mob.minotaur.say": { + "monster/dragon/dragon_step1" + ] + }, + "mob.minotaur.say": { "category": "neutral", "sounds": [ - "monster/minotaur/minotaur_say1" - ] - }, - - "mob.minotaur.hurt": { + "monster/minotaur/minotaur_say1" + ] + }, + "mob.minotaur.hurt": { "category": "neutral", "sounds": [ - "monster/minotaur/minotaur_hurt1" - ] - }, - - "mob.minotaur.death": { + "monster/minotaur/minotaur_hurt1" + ] + }, + "mob.minotaur.death": { "category": "neutral", "sounds": [ - "monster/minotaur/minotaur_death1" - ] - }, - - "block.furnace_open": { + "monster/minotaur/minotaur_death1" + ] + }, + "block.furnace_open": { "category": "block", "sounds": [ - "blocks/furnace_open" - ] - }, - - "block.furnace_close": { + "blocks/furnace_open" + ] + }, + "block.furnace_close": { "category": "block", "sounds": [ - "blocks/furnace_close" - ] - }, - - "entity.cogwork.idle": { + "blocks/furnace_close" + ] + }, + "entity.cogwork.idle": { "category": "neutral", "sounds": [ - "entity/cogwork_idle0", - "entity/cogwork_idle1", - "entity/cogwork_idle2" - ] - }, - - "entity.cogwork.toot": { + "entity/cogwork_idle0", + "entity/cogwork_idle1", + "entity/cogwork_idle2" + ] + }, + "entity.cogwork.toot": { "category": "neutral", "sounds": [ - "entity/cogwork_toot" - ] - } + "entity/cogwork_toot" + ] + } } \ No newline at end of file diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/critical.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/critical.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/critical.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/critical.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/crossbow_fire.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/crossbow_fire.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/crossbow_fire.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/crossbow_fire.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/crossbow_load.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/crossbow_load.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/crossbow_load.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/crossbow_load.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/crossbow_load_s1.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/crossbow_load_s1.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/crossbow_load_s1.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/crossbow_load_s1.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/crossbow_load_s2.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/crossbow_load_s2.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/crossbow_load_s2.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/crossbow_load_s2.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blade/metal1.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/hit/blade/metal1.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blade/metal1.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/hit/blade/metal1.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blade/stone1.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/hit/blade/stone1.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blade/stone1.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/hit/blade/stone1.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blade/wood1.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/hit/blade/wood1.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blade/wood1.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/hit/blade/wood1.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blunt/metal1.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/hit/blunt/metal1.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blunt/metal1.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/hit/blunt/metal1.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blunt/stone1.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/hit/blunt/stone1.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blunt/stone1.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/hit/blunt/stone1.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blunt/wood1.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/hit/blunt/wood1.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/hit/blunt/wood1.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/hit/blunt/wood1.ogg diff --git a/src/main/resources/assets/minefantasy2/sounds/Weapon/wood_parry.ogg b/src/main/resources/assets/minefantasy2/sounds/weapon/wood_parry.ogg similarity index 100% rename from src/main/resources/assets/minefantasy2/sounds/Weapon/wood_parry.ogg rename to src/main/resources/assets/minefantasy2/sounds/weapon/wood_parry.ogg diff --git a/src/main/resources/assets/minefantasy2/textures/blocks/ores/desktop.ini b/src/main/resources/assets/minefantasy2/textures/blocks/ores/desktop.ini new file mode 100644 index 00000000..292ef1cd --- /dev/null +++ b/src/main/resources/assets/minefantasy2/textures/blocks/ores/desktop.ini @@ -0,0 +1,2 @@ +[LocalizedFileNames] +mithril_ore.png=@mithril_ore.png,0 diff --git a/src/main/resources/assets/minefantasy2/textures/blocks/ores/oreMithril.png b/src/main/resources/assets/minefantasy2/textures/blocks/ores/oreMithril.png new file mode 100644 index 00000000..bb2553c0 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/blocks/ores/oreMithril.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/Weapon/standard_longsword.png b/src/main/resources/assets/minefantasy2/textures/items/Weapon/standard_longsword.png new file mode 100644 index 00000000..7f1786a5 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/Weapon/standard_longsword.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Clothing/leatherapron.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/clothing/leatherapron.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Clothing/leatherapron.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/clothing/leatherapron.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Clothing/leatherapron_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/clothing/leatherapron_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Clothing/leatherapron_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/clothing/leatherapron_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_boots.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_boots.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_boots.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_boots.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_boots_detail.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_boots_detail.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_boots_detail.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_boots_detail.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_chest.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_chest.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_chest.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_chest.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_chest_detail.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_chest_detail.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_chest_detail.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_chest_detail.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_helmet.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_helmet.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_helmet.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_helmet.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_helmet_detail.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_helmet_detail.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_helmet_detail.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_helmet_detail.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_legs.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_legs.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_legs.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_legs.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_legs_detail.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_legs_detail.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_armour_legs_detail.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_armour_legs_detail.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_boots.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_boots.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_boots.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_boots.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_boots_detail.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_boots_detail.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_boots_detail.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_boots_detail.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_chest.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_chest.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_chest.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_chest.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_chest_detail.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_chest_detail.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_chest_detail.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_chest_detail.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_helmet.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_helmet.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_helmet.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_helmet.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_helmet_detail.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_helmet_detail.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_helmet_detail.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_helmet_detail.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_legs.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_legs.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_legs.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_legs.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_legs_detail.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_legs_detail.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/cogwork/cogwork_frame_legs_detail.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/cogwork/cogwork_frame_legs_detail.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_boots.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_boots.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_boots.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_boots.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_boots_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_boots_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_boots_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_boots_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_chest.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_chest.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_chest.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_chest.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_chest_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_chest_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_chest_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_chest_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_helmet.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_helmet.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_helmet.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_helmet.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_helmet_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_helmet_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_helmet_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_helmet_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_legs.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_legs.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_legs.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_legs.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_legs_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_legs_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/hide_legs_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/hide_legs_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_boots.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_boots.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_boots.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_boots.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_boots_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_boots_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_boots_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_boots_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_chest.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_chest.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_chest.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_chest.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_chest_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_chest_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_chest_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_chest_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_helmet.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_helmet.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_helmet.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_helmet.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_helmet_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_helmet_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_helmet_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_helmet_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_legs.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_legs.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_legs.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_legs.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_legs_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_legs_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/roughleather_legs_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/roughleather_legs_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_boots.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_boots.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_boots.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_boots.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_boots_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_boots_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_boots_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_boots_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_chest.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_chest.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_chest.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_chest.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_chest_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_chest_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_chest_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_chest_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_helmet.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_helmet.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_helmet.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_helmet.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_helmet_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_helmet_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_helmet_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_helmet_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_legs.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_legs.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_legs.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_legs.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_legs_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_legs_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/scaleleather_legs_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/scaleleather_legs_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_boots.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_boots.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_boots.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_boots.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_boots_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_boots_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_boots_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_boots_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_chest.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_chest.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_chest.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_chest.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_chest_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_chest_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_chest_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_chest_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_helmet.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_helmet.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_helmet.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_helmet.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_helmet_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_helmet_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_helmet_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_helmet_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_legs.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_legs.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_legs.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_legs.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_legs_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_legs_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/strongleather_legs_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/strongleather_legs_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_boots.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_boots.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_boots.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_boots.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_boots_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_boots_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_boots_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_boots_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_chest.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_chest.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_chest.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_chest.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_chest_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_chest_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_chest_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_chest_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_helmet.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_helmet.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_helmet.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_helmet.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_helmet_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_helmet_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_helmet_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_helmet_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_legs.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_legs.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_legs.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_legs.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_legs_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_legs_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Leather/studleather_legs_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/leather/studleather_legs_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_boots.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_boots.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_boots.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_boots.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_boots_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_boots_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_boots_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_boots_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_chest.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_chest.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_chest.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_chest.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_chest_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_chest_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_chest_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_chest_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_helmet.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_helmet.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_helmet.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_helmet.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_helmet_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_helmet_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_helmet_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_helmet_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_legs.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_legs.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_legs.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_legs.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_legs_overlay.png b/src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_legs_overlay.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/items/Apparel/Padding/padded_legs_overlay.png rename to src/main/resources/assets/minefantasy2/textures/items/apparel/padding/padded_legs_overlay.png diff --git a/src/main/resources/assets/minefantasy2/textures/items/component/dwarven_fuel.png b/src/main/resources/assets/minefantasy2/textures/items/component/dwarven_fuel.png new file mode 100644 index 00000000..4653e64e Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/component/dwarven_fuel.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/component/ingotDwarfSteel.png b/src/main/resources/assets/minefantasy2/textures/items/component/ingotDwarfSteel.png new file mode 100644 index 00000000..de6d0dc7 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/component/ingotDwarfSteel.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/component/ingotEmerald.png b/src/main/resources/assets/minefantasy2/textures/items/component/ingotEmerald.png new file mode 100644 index 00000000..1ea74c09 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/component/ingotEmerald.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/component/ingotMithril.png b/src/main/resources/assets/minefantasy2/textures/items/component/ingotMithril.png index 8ed39f68..a6777189 100644 Binary files a/src/main/resources/assets/minefantasy2/textures/items/component/ingotMithril.png and b/src/main/resources/assets/minefantasy2/textures/items/component/ingotMithril.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/component/ingotMithril21312.png b/src/main/resources/assets/minefantasy2/textures/items/component/ingotMithril21312.png new file mode 100644 index 00000000..8ed39f68 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/component/ingotMithril21312.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/dwarvenforged/dwarvenforged_longsword.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/dwarvenforged/dwarvenforged_longsword.png new file mode 100644 index 00000000..2f18f2d6 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/dwarvenforged/dwarvenforged_longsword.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/dwarvenforged/dwarvenforged_longsword_detail.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/dwarvenforged/dwarvenforged_longsword_detail.png new file mode 100644 index 00000000..3fd29cdc Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/dwarvenforged/dwarvenforged_longsword_detail.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/dwarvenforged/dwarvenforged_longsword_haft.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/dwarvenforged/dwarvenforged_longsword_haft.png new file mode 100644 index 00000000..06c5d4e6 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/dwarvenforged/dwarvenforged_longsword_haft.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/gladius.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/gladius.png new file mode 100644 index 00000000..2cc4d7f3 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/gladius.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_claymore.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_claymore.png new file mode 100644 index 00000000..39cf1a99 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_claymore.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_claymore_detail.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_claymore_detail.png new file mode 100644 index 00000000..6c51258e Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_claymore_detail.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_claymore_haft.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_claymore_haft.png new file mode 100644 index 00000000..06c5d4e6 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_claymore_haft.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_gladius.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_gladius.png new file mode 100644 index 00000000..096ee526 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_gladius.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_gladius_detail.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_gladius_detail.png new file mode 100644 index 00000000..df69932b Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_gladius_detail.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_gladius_haft.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_gladius_haft.png new file mode 100644 index 00000000..f7d74fd9 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_gladius_haft.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_longsword.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_longsword.png new file mode 100644 index 00000000..abf34b32 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_longsword.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_longsword_detail.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_longsword_detail.png new file mode 100644 index 00000000..cf0d4a7c Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_longsword_detail.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_longsword_haft.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_longsword_haft.png new file mode 100644 index 00000000..06c5d4e6 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_longsword_haft.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_nodachi.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_nodachi.png new file mode 100644 index 00000000..e1d816aa Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_nodachi.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_nodachi_detail.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_nodachi_detail.png new file mode 100644 index 00000000..dab62a82 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_nodachi_detail.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_nodachi_haft.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_nodachi_haft.png new file mode 100644 index 00000000..7b1653d2 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_nodachi_haft.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_saber.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_saber.png new file mode 100644 index 00000000..95a9f723 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_saber.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_saber_detail.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_saber_detail.png new file mode 100644 index 00000000..3fd29cdc Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_saber_detail.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_saber_haft.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_saber_haft.png new file mode 100644 index 00000000..06c5d4e6 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_saber_haft.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_shortsword.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_shortsword.png index 52ae98c4..a47e39b5 100644 Binary files a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_shortsword.png and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_shortsword.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_sword.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_sword.png index aabd6917..2a6287ac 100644 Binary files a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_sword.png and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_sword.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_trident.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_trident.png new file mode 100644 index 00000000..36ede6e1 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_trident.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_trident_detail.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_trident_detail.png new file mode 100644 index 00000000..7bf206e5 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_trident_detail.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_trident_haft.png b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_trident_haft.png new file mode 100644 index 00000000..7b1653d2 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/items/custom/weapon/standard/standard_trident_haft.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/models/animal/horse/armor/standard_plate_layer_1.png b/src/main/resources/assets/minefantasy2/textures/models/animal/horse/armor/standard_plate_layer_1.png new file mode 100644 index 00000000..3bcefb88 Binary files /dev/null and b/src/main/resources/assets/minefantasy2/textures/models/animal/horse/armor/standard_plate_layer_1.png differ diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Clothing/leatherapron_layer_1.png b/src/main/resources/assets/minefantasy2/textures/models/armour/clothing/leatherapron_layer_1.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Clothing/leatherapron_layer_1.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/clothing/leatherapron_layer_1.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Clothing/leatherapron_layer_1_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/clothing/leatherapron_layer_1_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Clothing/leatherapron_layer_1_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/clothing/leatherapron_layer_1_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/hide_layer_1.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/hide_layer_1.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/hide_layer_1.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/hide_layer_1.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/hide_layer_1_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/hide_layer_1_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/hide_layer_1_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/hide_layer_1_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/hide_layer_2.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/hide_layer_2.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/hide_layer_2.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/hide_layer_2.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/hide_layer_2_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/hide_layer_2_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/hide_layer_2_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/hide_layer_2_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/roughleather_layer_1.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/roughleather_layer_1.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/roughleather_layer_1.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/roughleather_layer_1.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/roughleather_layer_1_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/roughleather_layer_1_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/roughleather_layer_1_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/roughleather_layer_1_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/roughleather_layer_2.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/roughleather_layer_2.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/roughleather_layer_2.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/roughleather_layer_2.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/roughleather_layer_2_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/roughleather_layer_2_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/roughleather_layer_2_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/roughleather_layer_2_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/scaleleather_layer_1.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/scaleleather_layer_1.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/scaleleather_layer_1.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/scaleleather_layer_1.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/scaleleather_layer_1_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/scaleleather_layer_1_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/scaleleather_layer_1_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/scaleleather_layer_1_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/scaleleather_layer_2.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/scaleleather_layer_2.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/scaleleather_layer_2.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/scaleleather_layer_2.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/scaleleather_layer_2_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/scaleleather_layer_2_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/scaleleather_layer_2_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/scaleleather_layer_2_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/strongleather_layer_1.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/strongleather_layer_1.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/strongleather_layer_1.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/strongleather_layer_1.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/strongleather_layer_1_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/strongleather_layer_1_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/strongleather_layer_1_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/strongleather_layer_1_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/strongleather_layer_2.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/strongleather_layer_2.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/strongleather_layer_2.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/strongleather_layer_2.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/strongleather_layer_2_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/strongleather_layer_2_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/strongleather_layer_2_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/strongleather_layer_2_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/studleather_layer_1.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/studleather_layer_1.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/studleather_layer_1.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/studleather_layer_1.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/studleather_layer_1_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/studleather_layer_1_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/studleather_layer_1_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/studleather_layer_1_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/studleather_layer_2.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/studleather_layer_2.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/studleather_layer_2.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/studleather_layer_2.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Leather/studleather_layer_2_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/leather/studleather_layer_2_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Leather/studleather_layer_2_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/leather/studleather_layer_2_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Padding/padded_layer_1.png b/src/main/resources/assets/minefantasy2/textures/models/armour/padding/padded_layer_1.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Padding/padded_layer_1.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/padding/padded_layer_1.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Padding/padded_layer_1_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/padding/padded_layer_1_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Padding/padded_layer_1_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/padding/padded_layer_1_cloth.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Padding/padded_layer_2.png b/src/main/resources/assets/minefantasy2/textures/models/armour/padding/padded_layer_2.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Padding/padded_layer_2.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/padding/padded_layer_2.png diff --git a/src/main/resources/assets/minefantasy2/textures/models/armour/Padding/padded_layer_2_cloth.png b/src/main/resources/assets/minefantasy2/textures/models/armour/padding/padded_layer_2_cloth.png similarity index 100% rename from src/main/resources/assets/minefantasy2/textures/models/armour/Padding/padded_layer_2_cloth.png rename to src/main/resources/assets/minefantasy2/textures/models/armour/padding/padded_layer_2_cloth.png diff --git a/src/main/resources/desktop.ini b/src/main/resources/desktop.ini new file mode 100644 index 00000000..98c8a004 --- /dev/null +++ b/src/main/resources/desktop.ini @@ -0,0 +1,2 @@ +[LocalizedFileNames] +LogoMF2EdK.png=@LogoMF2EdK.png,0 diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 0ca7c137..e69aa025 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,16 +1,24 @@ [ -{ - "modid": "MineFantasy2", - "name": "Mine FantasyII", - "description": "NOTE: This is an incomplete mod, crafting has not been implemented. Make sure to have a recipe guide installed. Not all items are obtainable or balanced", - "version": "${version}", - "mcversion": "${mcversion}", - "url": "", - "updateUrl": "", - "authors": ["Anonymous"], - "credits": "-", - "logoFile": "", - "screenshots": [], - "dependencies": [] -} -] + { + "modid":"minefantasy2", + "name":"FantasyCraft II EbK", + "description":"GET READY FOR GREATEST ADVENTURE OF ALL THE TIME", + "version":"", + "mcversion":"${mcversion}", + "url":"", + "updateUrl":"", + "authors":["Kacpros"] + ], + "credits":"Kacpros", + "logoFile":"", + "screenshots":[ + + ], + "dependencies":[ + "MineTweaker3", + "NotEnoughItems", + "BuildCraft|Core", + "CoFHCore" + ] + } +] \ No newline at end of file