Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51a2ff0976 | |||
| 1b298ff18b | |||
| 86d13d3a6e | |||
| 5421372754 | |||
| 53b29939f1 | |||
| 7bda8db86f | |||
| a7a48cd32b | |||
| b8e0836a6d | |||
| a7e6b2892c | |||
| f886ebfd75 | |||
| 98b334e6d7 | |||
| 83edb8007e | |||
| 67dda448f3 | |||
| 09953c0299 | |||
| 38b0fa65bc | |||
| 7200182c82 | |||
| e73e998de2 | |||
| a69da2eb2a | |||
| a00c594d83 | |||
| 3df99552e1 | |||
| e2bc2824f6 | |||
| 36f4728f3a | |||
| 6ca72e7965 | |||
| 151dcc06da | |||
| 5737109dec | |||
| 4bd3a46f32 | |||
| 73e2d64fcd | |||
| 1f008b405d | |||
| 00e1e2602f | |||
| 98445da971 | |||
| dbc1490e10 | |||
| f33a0aceb2 | |||
| 7141ae9544 | |||
| af638ab2f7 | |||
| a75a6c6114 | |||
| 9c1042f686 | |||
| cad3fee1b9 | |||
| 5947b2ee62 | |||
| 177a39bad1 | |||
| cdf8f6e32d | |||
| f88aac11e9 | |||
| 05b905b988 | |||
| 669cd2892d | |||
| dd07d08ff0 | |||
| 54bb327fdf | |||
| 2cd8b46c1f | |||
| b61413f7f1 | |||
| 4e7765a7e7 | |||
| 49a6dc43c1 | |||
| b82bc6698f | |||
| 1e43c67660 | |||
| c129571167 | |||
| b23a643c0e | |||
| 194bff3e6a | |||
| 426ca78288 | |||
| f15919fdce | |||
| 2124842136 | |||
| 70e697876b | |||
| 9b5e5a871c | |||
| 5ba92e5de5 | |||
| 4e6780a3cf | |||
| 00584ad635 | |||
| f72ed33515 | |||
| c2366ed1ba | |||
| 46df8d7311 | |||
| d4579b9184 | |||
| ee6f0cfe70 | |||
| 6155fd9c68 | |||
| 32c0608b51 | |||
| 404df6af23 | |||
| 764e10538b | |||
| 6b1b590e30 | |||
| 8360e520cd | |||
| 005a17d750 | |||
| 28abe036a0 | |||
| ca96112b67 | |||
| b8e847c6a6 | |||
| 35cb2c31fc | |||
| 30dd587d34 | |||
| 4644814582 | |||
| 7db3151d8a | |||
| c8ca73cca9 | |||
| d5a0479ebe | |||
| 339ec69a72 | |||
| b2cb717aa3 | |||
| cf4a02f37f | |||
| 84304dd7ce | |||
| e3b44eb194 | |||
| 2cbb0a590f | |||
| 6b9c864890 | |||
| c15a0763d5 | |||
| 4a23d88f30 | |||
| 286705c79b | |||
| 3895f5c531 | |||
| c51e0bd218 | |||
| 766570aeb2 | |||
| 4e91b0d19d | |||
| 65f7630546 | |||
| 8cf7572041 | |||
| db057a5ca9 | |||
| 267fb2daf4 | |||
| b96526b284 | |||
| e01b5c728c | |||
| 0cf1d74fd5 | |||
| 8316dcad70 | |||
| df1eb68f35 | |||
| 416868bafb | |||
| 0424e409fc | |||
| a5b38e8f83 | |||
| 1e0613c949 | |||
| d33290d890 | |||
| e22d428016 | |||
| baa407ce61 | |||
| ea11910af2 | |||
| 873b5a4f4d | |||
| 6890ae765a | |||
| b9d240799d | |||
| 612bbdb64d | |||
| 62c2a9e9b8 | |||
| bc3051fcf0 | |||
| 489fb82fbd | |||
| edff82acca |
@@ -21,4 +21,5 @@ build
|
||||
eclipse
|
||||
run
|
||||
misc
|
||||
libs
|
||||
Thumbs.db
|
||||
+6
-2
@@ -1,8 +1,8 @@
|
||||
# Credits
|
||||
|
||||
Electroblob's Wizardry
|
||||
Version 3.1.0
|
||||
For Minecraft 1.11.2
|
||||
Version 4.1.3
|
||||
For Minecraft 1.12.2
|
||||
|
||||
Designed, coded and textured by Electroblob
|
||||
|
||||
@@ -15,10 +15,14 @@ In addition, I'd like to thank the following individuals for their contributions
|
||||
#### Code
|
||||
|
||||
- Corail31
|
||||
- 12foo
|
||||
- Shadows-of-Fire
|
||||
- HellFirePvP
|
||||
|
||||
#### Translations
|
||||
|
||||
- Russian: VilagVil
|
||||
- Spanish and Mexican Spanish: MadWrist
|
||||
- Chinese: ZHENGLOC and dragon-evol
|
||||
|
||||
Lightning ray sound effect from OhhWowProductions
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
Minecraft version: 1.10.2 [change as necessary]
|
||||
Wizardry version: 2.1.0 [change as necessary]
|
||||
Please read the [guide for contributing](https://github.com/Electroblob77/Wizardry/blob/1.12.2/guide_for_contributing.md) before posting.
|
||||
|
||||
Minecraft version: 1.12.2 [change as necessary]
|
||||
Wizardry version: 4.1.3 [change as necessary]
|
||||
Environment: Singleplayer/LAN game/Server [delete as necessary]
|
||||
|
||||
Issue details: [describe what you were doing when the issue occurred, what went wrong, what you expected to happen, etc.]
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
# License
|
||||
This repository is copyright © Electroblob 2018. The following license is provided to allow you to creatively contribute to and improve the repository.
|
||||
|
||||
This license applies only to the source code and assets present in this repository. The compiled mod (available at https://minecraft.curseforge.com/projects/electroblobs-wizardry) comes under its own separate license, see the aforementioned webpage for details.
|
||||
This license applies only to the source code, assets and wiki pages present in this repository. The compiled mod (available at https://minecraft.curseforge.com/projects/electroblobs-wizardry) comes under its own separate license, see the aforementioned webpage for details.
|
||||
|
||||
TL;DR: Do what you want with this repo on Github, but ask me first if you want to put it anywhere else or publish your version. Don't try and make money off the repo or anything in it. I'm not responsible if the code breaks things, and if you help me out by submitting a PR, I can use and modify the contents of that PR as long as I give you credit. (This brief summary is non-binding and does not override or replace the full license below.)
|
||||
|
||||
@@ -17,7 +17,7 @@ TL;DR: Do what you want with this repo on Github, but ask me first if you want t
|
||||
|
||||
'Electroblob's Wizardry', 'Wizardry', 'the mod' - The Minecraft modification Electroblob's Wizardry
|
||||
|
||||
'Repository' - This repository on Github, containing this license, other informational files, configurations, code and assets which are part of Electroblob's Wizardry
|
||||
'Repository' - This repository on Github, containing this license, the wiki, other informational files, configurations, code and assets which are part of Electroblob's Wizardry
|
||||
|
||||
'Curseforge' - The webpage https://minecraft.curseforge.com/projects/electroblobs-wizardry
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||

|
||||
|
||||
Source code for Electroblob's Wizardry, a Minecraft mod currently for versions 1.7.10 and 1.10.2. Wizardry adds an RPG-style system of magic spells to Minecraft with the aim of being as playable as possible. No crazy constructs, no perk trees, no complex recipes - simply find spell books, cast spells, and master the arcane!
|
||||
Source code for Electroblob's Wizardry, a Minecraft mod currently for versions 1.7.10, 1.10.2, 1.11.2, and 1.12.2. Wizardry adds an RPG-style system of magic spells to Minecraft with the aim of being as playable as possible. No crazy constructs, no perk trees, no complex recipes - simply find spell books, cast spells, and master the arcane!
|
||||
|
||||
Please read the [guide for contributing](guide_for_contributing.md) before submitting an issue or a PR.
|
||||
|
||||
|
||||
+4
-4
@@ -4,14 +4,14 @@ buildscript {
|
||||
maven { url = "http://files.minecraftforge.net/maven" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
|
||||
|
||||
|
||||
version = " 3.1.0 - MC 1.11.2"
|
||||
version = " 4.1.3 - MC 1.12.2"
|
||||
group= "electroblob.wizardry"// http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "Electroblob's Wizardry "
|
||||
|
||||
@@ -21,7 +21,7 @@ compileJava {
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.11.2-13.20.1.2588"
|
||||
version = "1.12.2-14.23.2.2611"
|
||||
runDir = "run"
|
||||
|
||||
// the mappings can be changed at any time, and must be in the following format.
|
||||
@@ -29,7 +29,7 @@ minecraft {
|
||||
// stable_# stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings = "stable_32"
|
||||
mappings = "stable_39"
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,20 @@
|
||||
|
||||
## Submitting an issue
|
||||
|
||||
When submitting an issue, please stick to the issue template. Please give me as much information about the issue as you can, but keep it relevant. "This is really annoying me and my friend" does not help me fix the problem! Most importantly, use gist or pastebin to post crash reports.
|
||||
When submitting an issue, I would be grateful if you could follow these few guidelines:
|
||||
|
||||
- First and foremost, please check your issue hasn't already been posted. The issue tracker is searchable, so try typing in a few keywords and see if anything comes up.
|
||||
|
||||
- Please stick to the issue template, it's there to help you provide the right information so I can fix the problem more easily. If you're not sure what to put for anything, that's ok, just leave it as it is.
|
||||
|
||||
- Please give me as much information about the issue as you can, but keep it relevant. "This is really annoying me and my friend" does not help me fix the problem!
|
||||
|
||||
- There's no need to put 'tags' in square brackets in the issue title, I'll put proper github issue tags on it which will also help organise it. You can use them to search for issues too!
|
||||
|
||||
- Don't close an issue unless it has actually been fixed or is no longer relevant - otherwise I might not end up fixing it at all! Usually I'll take care of closing issues anyway, so you don't have to worry about it.
|
||||
|
||||
- Most importantly, use gist or pastebin to post crash reports. Do not paste the entire crash report inline, not even in a code block!
|
||||
> If you've got a git account (which you do, if you're posting an issue) you can access gist, and pastebin doesn't require an account at all, so there's no excuse!
|
||||
|
||||
## Submitting a PR
|
||||
|
||||
|
||||
@@ -143,14 +143,15 @@ public class CommonProxy {
|
||||
|
||||
// I have now learnt that the server side I18n always translates to the default en_US, so I could just return
|
||||
// a hardcoded name in English instead.
|
||||
Wizardry.logger.info("A mod has called ItemScroll#getItemStackDisplayName from the server side. Using the"
|
||||
+ "deprecated server-side translation methods as a fallback.");
|
||||
// Commented because it's just really annoying.
|
||||
//Wizardry.logger.info("A mod has called ItemScroll#getItemStackDisplayName from the server side. Using the"
|
||||
// + "deprecated server-side translation methods as a fallback.");
|
||||
|
||||
// Displays [Empty slot] if spell is continuous.
|
||||
Spell spell = Spell.get(scroll.getItemDamage());
|
||||
if(spell.isContinuous) spell = Spells.none;
|
||||
|
||||
return I18n.translateToLocalFormatted("item.wizardry:wizardry:scroll.name",
|
||||
return I18n.translateToLocalFormatted("item." + Wizardry.MODID + ":scroll.name",
|
||||
I18n.translateToLocal("spell." + spell.getUnlocalisedName())).trim();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package electroblob.wizardry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -45,9 +46,8 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
* @since Wizardry 1.2
|
||||
* @author Electroblob
|
||||
*/
|
||||
// NOTE: We could convert over to the @Config system IF it is sufficiently complete in this Forge version for my
|
||||
// purposes.
|
||||
// (For one, I know that the LangKey annotation is not applicable to type declarations in 1.10.2, unlike in 1.11.2)
|
||||
// TODO: New plan: convert to the @Config system BUT separate the spells config out so it doesn't break stuff. (Maybe even
|
||||
// make it a JSON instead? Either way, there's scope for then adding more options for adjusting the base attributes etc.)
|
||||
// @Config(modid = Wizardry.MODID)
|
||||
@SuppressWarnings("deprecation") // Used server I18n deliberately; we want to write the comments in english.
|
||||
public final class Settings {
|
||||
@@ -63,8 +63,8 @@ public final class Settings {
|
||||
public static final String COMMANDS_CATEGORY = "commands";
|
||||
/** The unlocalised name of the worldgen config category. */
|
||||
public static final String WORLDGEN_CATEGORY = "worldgen";
|
||||
/** The unlocalised name of the global config category. */
|
||||
public static final String GLOBAL_CATEGORY = "global";
|
||||
/** The unlocalised name of the gameplay config category. */
|
||||
public static final String GAMEPLAY_CATEGORY = "gameplay";
|
||||
|
||||
/** The wizardry config file. */
|
||||
private Configuration config;
|
||||
@@ -102,19 +102,26 @@ public final class Settings {
|
||||
/** <b>[Server-only]</b> Whether summoned creatures can revenge attack their caster if their caster attacks them. */
|
||||
public boolean minionRevengeTargeting = true;
|
||||
/**
|
||||
* <b>[Server-only]</b> List of names of entities which summoned creatures are allowed to attack, in addition to the
|
||||
* defaults.
|
||||
* <b>[Server-only]</b> List of registry names of entities which summoned creatures are allowed to attack, in addition
|
||||
* to the defaults.
|
||||
*/
|
||||
public String[] summonedCreatureTargetsWhitelist = {};
|
||||
public ResourceLocation[] summonedCreatureTargetsWhitelist = {};
|
||||
/**
|
||||
* <b>[Server-only]</b> List of names of entities which summoned creatures are specifically not allowed to attack,
|
||||
* overriding the defaults and the whitelist.
|
||||
* <b>[Server-only]</b> List of registry names of entities which summoned creatures are specifically not allowed to
|
||||
* attack, overriding the defaults and the whitelist.
|
||||
*/
|
||||
public String[] summonedCreatureTargetsBlacklist = {"creeper"};
|
||||
public ResourceLocation[] summonedCreatureTargetsBlacklist = {new ResourceLocation("creeper")};
|
||||
/**
|
||||
* <b>[Server-only]</b> List of registry names of entities which are immune to the mind control spell, in addition to
|
||||
* the defaults.
|
||||
*/
|
||||
public ResourceLocation[] mindControlTargetsBlacklist = {};
|
||||
/** <b>[Server-only]</b> Global damage scaling factor for all player magic damage. */
|
||||
public double playerDamageScale = 1.0f;
|
||||
/** <b>[Server-only]</b> Global damage scaling factor for all npc magic damage. */
|
||||
public double npcDamageScale = 1.0f;
|
||||
/** <b>[Server-only]</b> List of dimension ids in which evil wizards can spawn. */
|
||||
public int[] evilWizardDimensions = {0};
|
||||
|
||||
// Commands (these don't need synchronising since typing a command always queries the server).
|
||||
/**
|
||||
@@ -134,19 +141,6 @@ public final class Settings {
|
||||
// Synchronised settings. These settings affect both client-side AND server-side code. Changing these locally
|
||||
// only has an effect if the local game is the host, i.e. a dedicated server, a LAN host or a singleplayer world.
|
||||
|
||||
// Recipes (only need syncing for display in the wizard's handbook)
|
||||
/** <b>[Synchronised]</b> Whether or not firebombs should be craftable. */
|
||||
public boolean firebombIsCraftable = true;
|
||||
/** <b>[Synchronised]</b> Whether or not poison bombs should be craftable. */
|
||||
public boolean poisonBombIsCraftable = true;
|
||||
/** <b>[Synchronised]</b> Whether or not poison bombs should be craftable. */
|
||||
public boolean smokeBombIsCraftable = true;
|
||||
/**
|
||||
* <b>[Synchronised]</b> Whether to require a magic crystal in the blank scroll crafting recipe (in case it
|
||||
* conflicts with another mod).
|
||||
*/
|
||||
public boolean useAlternateScrollRecipe = false;
|
||||
|
||||
// Gamemodes
|
||||
/**
|
||||
* <b>[Synchronised]</b> When set to true, spells a player hasn't cast yet will be unreadable until they are cast
|
||||
@@ -218,7 +212,7 @@ public final class Settings {
|
||||
/**
|
||||
* Called from preInit to initialise the config file. The first part of the config file has to be done here (as is
|
||||
* conventional) so that the various registries can change what they do accordingly. The spell part of the config
|
||||
* has to be done in the init method.
|
||||
* and the resistance part of the config have to be done in the init method since they depend on the registry events.
|
||||
*/
|
||||
void initConfig(FMLPreInitializationEvent event){
|
||||
|
||||
@@ -228,20 +222,27 @@ public final class Settings {
|
||||
Wizardry.logger.info("Setting up main config");
|
||||
|
||||
setupGeneralConfig();
|
||||
setupWorldgenConfig();
|
||||
setupClientConfig();
|
||||
setupCommandsConfig();
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from init to initialise the parts of the config file that depend on other mods. For example, the spell
|
||||
* config is done here and not in preInit because all spells must be registered before it is added, including those
|
||||
* in other mods.
|
||||
* Called from init to initialise the parts of the config file that have to be done after registry events are fired.
|
||||
* For example, the spell config is done here and not in preInit because all spells must be registered before it is
|
||||
* added, including those in other mods.
|
||||
*/
|
||||
void initConfigExtras(){
|
||||
|
||||
Wizardry.logger.info("Setting up spells config for " + Spell.getTotalSpellCount() + " spells");
|
||||
|
||||
setupSpellsConfig();
|
||||
|
||||
Wizardry.logger.info("Setting up resistances config");
|
||||
|
||||
setupResistancesConfig();
|
||||
|
||||
config.save();
|
||||
}
|
||||
@@ -252,7 +253,11 @@ public final class Settings {
|
||||
Wizardry.logger.info("Saving in-game config changes");
|
||||
|
||||
setupGeneralConfig();
|
||||
setupWorldgenConfig();
|
||||
setupClientConfig();
|
||||
setupCommandsConfig();
|
||||
setupSpellsConfig();
|
||||
setupResistancesConfig();
|
||||
|
||||
config.save();
|
||||
}
|
||||
@@ -292,223 +297,232 @@ public final class Settings {
|
||||
|
||||
Property property;
|
||||
|
||||
config.addCustomCategoryComment(Configuration.CATEGORY_GENERAL,
|
||||
"Please note that changing some of these settings may make the mod very difficult to play.");
|
||||
config.addCustomCategoryComment(GAMEPLAY_CATEGORY, "Global settings that affect game mechanics. In multiplayer, the server/LAN host settings will apply. Please note that changing some of these settings may make the mod very difficult to play.");
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "towerRarity", 8,
|
||||
"Rarity of wizard towers. Higher numbers are rarer. Set to 0 to disable wizard towers completely.", 0,
|
||||
50);
|
||||
property.setLanguageKey("config.wizardry.tower_rarity");
|
||||
property = config.get(GAMEPLAY_CATEGORY, "discoveryMode", true,
|
||||
"For those who like a sense of mystery! When set to true, spells you haven't cast yet will be unreadable until you cast them (on a per-world basis). Has no effect when in creative mode. Spells of identification will be unobtainable in survival mode if this is false.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".discovery_mode");
|
||||
property.setRequiresWorldRestart(true);
|
||||
discoveryMode = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "friendlyFire", true,
|
||||
"Whether to allow players to damage their designated allies using magic.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".friendly_fire");
|
||||
friendlyFire = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "spellBookDropChance", 3,
|
||||
"The chance for mobs to drop a spell book when killed. The greater this number, the more often they will drop. Set to 0 to disable spell book drops. Set to 200 for guaranteed drops.",
|
||||
0, 200);
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".spell_book_drop_chance");
|
||||
Wizardry.proxy.setToNumberSliderEntry(property);
|
||||
spellBookDropChance = property.getInt();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "evilWizardDimensions", new int[]{0},
|
||||
"List of dimension ids in which evil wizards can spawn.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".evil_wizard_dimensions");
|
||||
property.setRequiresMcRestart(true);
|
||||
evilWizardDimensions = property.getIntList();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
// These two aren't sliders because using a slider makes it difficult to fine-tune the numbers; the nature of a
|
||||
// scaling factor means that 0.5 is as big a change as 2.0, so whilst a slider is fine for increasing the
|
||||
// damage, it doesn't give fine enough control for values less than 1.
|
||||
property = config.get(GAMEPLAY_CATEGORY, "playerDamageScaling", 1.0,
|
||||
"Global damage scaling factor for the damage dealt by players casting spells, relative to 1.", 0, 20);
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".player_damage_scaling");
|
||||
playerDamageScale = property.getDouble();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "npcDamageScaling", 1.0,
|
||||
"Global damage scaling factor for the damage dealt by NPCs casting spells, relative to 1.", 0, 20);
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".npc_damage_scaling");
|
||||
npcDamageScale = property.getDouble();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "minionRevengeTargeting", true,
|
||||
"Whether summoned creatures can revenge attack their owner if their owner attacks them.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".minion_revenge_targeting");
|
||||
property.setRequiresWorldRestart(false);
|
||||
minionRevengeTargeting = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "summonedCreatureTargetsWhitelist", new String[0],
|
||||
"List of names of entities which summoned creatures and wizards are allowed to attack, in addition to the defaults. Add mod creatures to this list if you want summoned creatures to attack them and they aren't already doing so. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard).");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".summoned_creature_targets_whitelist");
|
||||
property.setRequiresWorldRestart(true);
|
||||
// Converts all strings in the list to a ResourceLocation.
|
||||
summonedCreatureTargetsWhitelist = Arrays.stream(property.getStringList()).map(s -> new ResourceLocation(s.toLowerCase(Locale.ROOT).trim())).toArray(ResourceLocation[]::new);
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "summonedCreatureTargetsBlacklist",
|
||||
new String[]{"creeper"},
|
||||
"List of names of entities which summoned creatures and wizards are specifically not allowed to attack, overriding the defaults and the whitelist. Add creatures to this list if allowing them to be attacked causes problems or is too destructive (removing creepers from this list is done at your own risk!). Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard).");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".summoned_creature_targets_blacklist");
|
||||
property.setRequiresWorldRestart(true);
|
||||
// Converts all strings in the list to a ResourceLocation.
|
||||
summonedCreatureTargetsBlacklist = Arrays.stream(property.getStringList()).map(s -> new ResourceLocation(s.toLowerCase(Locale.ROOT).trim())).toArray(ResourceLocation[]::new);
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "telekineticDisarmament", true,
|
||||
"Whether to allow players to disarm other players using the telekinesis spell. Set to false to prevent stealing of items.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".telekinetic_disarmament");
|
||||
telekineticDisarmament = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "teleportThroughUnbreakableBlocks", false,
|
||||
"Whether players are allowed to teleport through unbreakable blocks (e.g. bedrock) using the phase step spell.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".teleport_through_unbreakable_blocks");
|
||||
teleportThroughUnbreakableBlocks = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(GAMEPLAY_CATEGORY, "mindControlTargetsBlacklist", new String[]{},
|
||||
"List of names of entities which cannot be mind controlled, in addition to the defaults. Add creatures to this list if allowing them to be mind-controlled causes problems or could be exploited. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard).");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".mind_control_targets_blacklist");
|
||||
property.setRequiresWorldRestart(true);
|
||||
// Converts all strings in the list to a ResourceLocation.
|
||||
mindControlTargetsBlacklist = Arrays.stream(property.getStringList()).map(s -> new ResourceLocation(s.toLowerCase(Locale.ROOT).trim())).toArray(ResourceLocation[]::new);
|
||||
propOrder.add(property.getName());
|
||||
|
||||
config.setCategoryPropertyOrder(GAMEPLAY_CATEGORY, propOrder);
|
||||
|
||||
}
|
||||
|
||||
private void setupWorldgenConfig(){
|
||||
|
||||
// This trick is borrowed from forge; it sorts the config options into the order you want them.
|
||||
List<String> propOrder = new ArrayList<String>();
|
||||
|
||||
Property property;
|
||||
|
||||
config.addCustomCategoryComment(WORLDGEN_CATEGORY, "Settings that affect world generation. In multiplayer, the server/LAN host settings will apply.");
|
||||
|
||||
property = config.get(WORLDGEN_CATEGORY, "towerRarity", 8, "Rarity of wizard towers. Higher numbers are rarer. Set to 0 to disable wizard towers completely.", 0, 50);
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".tower_rarity");
|
||||
property.setRequiresWorldRestart(true);
|
||||
Wizardry.proxy.setToNumberSliderEntry(property);
|
||||
towerRarity = property.getInt();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "spellBookDropChance", 3,
|
||||
"The chance for mobs to drop a spell book when killed. The greater this number, the more often they will drop. Set to 0 to disable spell book drops. Set to 200 for guaranteed drops.",
|
||||
0, 200);
|
||||
property.setLanguageKey("config.wizardry.spell_book_drop_chance");
|
||||
Wizardry.proxy.setToNumberSliderEntry(property);
|
||||
spellBookDropChance = property.getInt();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "oreDimensions", new int[]{0},
|
||||
"List of dimension ids in which crystal ore will generate. Note that removing the overworld (id 0) from this list will make the mod VERY difficult to play!");
|
||||
property.setLanguageKey("config.wizardry.ore_dimensions");
|
||||
property.setRequiresWorldRestart(true);
|
||||
oreDimensions = property.getIntList();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "flowerDimensions", new int[]{0},
|
||||
"List of dimension ids in which crystal flowers will generate.");
|
||||
property.setLanguageKey("config.wizardry.flower_dimensions");
|
||||
property.setRequiresWorldRestart(true);
|
||||
flowerDimensions = property.getIntList();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "towerDimensions", new int[]{0},
|
||||
"List of dimension ids in which wizard towers will generate.");
|
||||
property.setLanguageKey("config.wizardry.tower_dimensions");
|
||||
property = config.get(WORLDGEN_CATEGORY, "towerDimensions", new int[]{0}, "List of dimension ids in which wizard towers will generate.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".tower_dimensions");
|
||||
property.setRequiresWorldRestart(true);
|
||||
towerDimensions = property.getIntList();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "generateLoot", true,
|
||||
"Whether to generate wizardry loot in dungeon chests.");
|
||||
property.setLanguageKey("config.wizardry.generate_loot");
|
||||
property = config.get(WORLDGEN_CATEGORY, "oreDimensions", new int[]{0}, "List of dimension ids in which crystal ore will generate. Note that removing the overworld (id 0) from this list will make the mod VERY difficult to play!");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".ore_dimensions");
|
||||
property.setRequiresWorldRestart(true);
|
||||
oreDimensions = property.getIntList();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(WORLDGEN_CATEGORY, "flowerDimensions", new int[]{0}, "List of dimension ids in which crystal flowers will generate.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".flower_dimensions");
|
||||
property.setRequiresWorldRestart(true);
|
||||
flowerDimensions = property.getIntList();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(WORLDGEN_CATEGORY, "generateLoot", true, "Whether to inject wizardry loot (as specified in loot_tables/chests/dungeon_additions.json) into the loot tables for vanilla dungeon chests.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".generate_loot");
|
||||
property.setRequiresWorldRestart(true);
|
||||
generateLoot = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
config.setCategoryPropertyOrder(WORLDGEN_CATEGORY, propOrder);
|
||||
}
|
||||
|
||||
private void setupClientConfig(){
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "firebombIsCraftable", true,
|
||||
"Whether firebombs can be crafted or not.");
|
||||
property.setLanguageKey("config.wizardry.firebomb_is_craftable");
|
||||
property.setRequiresMcRestart(true);
|
||||
firebombIsCraftable = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
// This trick is borrowed from forge; it sorts the config options into the order you want them.
|
||||
List<String> propOrder = new ArrayList<String>();
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "poisonBombIsCraftable", true,
|
||||
"Whether poison bombs can be crafted or not.");
|
||||
property.setLanguageKey("config.wizardry.poison_bomb_is_craftable");
|
||||
property.setRequiresMcRestart(true);
|
||||
poisonBombIsCraftable = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
Property property;
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "smokeBombIsCraftable", true,
|
||||
"Whether smoke bombs can be crafted or not.");
|
||||
property.setLanguageKey("config.wizardry.smoke_bomb_is_craftable");
|
||||
property.setRequiresMcRestart(true);
|
||||
smokeBombIsCraftable = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
config.addCustomCategoryComment(CLIENT_CATEGORY, "Client-side settings that only affect the local minecraft game. If this file is on a dedicated server, these settings will have no effect; in multiplayer, each player obeys their own settings.");
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "useAlternateScrollRecipe", false,
|
||||
"Whether to require a magic crystal in the shapeless crafting recipe for blank scrolls. Set to true if another mod adds a conflicting recipe.");
|
||||
property.setLanguageKey("config.wizardry.use_alternate_scroll_recipe");
|
||||
property.setRequiresMcRestart(true);
|
||||
useAlternateScrollRecipe = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "teleportThroughUnbreakableBlocks", false,
|
||||
"Whether players are allowed to teleport through unbreakable blocks (e.g. bedrock) using the phase step spell.");
|
||||
property.setLanguageKey("config.wizardry.teleport_through_unbreakable_blocks");
|
||||
teleportThroughUnbreakableBlocks = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "showSummonedCreatureNames", true,
|
||||
"Whether to show summoned creatures' names and owners above their heads.");
|
||||
property.setLanguageKey("config.wizardry.show_summoned_creature_names");
|
||||
showSummonedCreatureNames = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "friendlyFire", true,
|
||||
"Whether to allow players to damage their designated allies using magic.");
|
||||
property.setLanguageKey("config.wizardry.friendly_fire");
|
||||
friendlyFire = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "telekineticDisarmament", true,
|
||||
"Whether to allow players to disarm other players using the telekinesis spell. Set to false to prevent stealing of items.");
|
||||
property.setLanguageKey("config.wizardry.telekinetic_disarmament");
|
||||
telekineticDisarmament = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "discoveryMode", true,
|
||||
"For those who like a sense of mystery! When set to true, spells you haven't cast yet will be unreadable until you cast them (on a per-world basis). Has no effect when in creative mode. Spells of identification will be unobtainable in survival mode if this is false.");
|
||||
property.setLanguageKey("config.wizardry.discovery_mode");
|
||||
property.setRequiresWorldRestart(true);
|
||||
discoveryMode = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "enableShiftScrolling", true,
|
||||
property = config.get(CLIENT_CATEGORY, "enableShiftScrolling", true,
|
||||
"Whether you can switch between spells on a wand by scrolling with the mouse wheel while sneaking. Note that this will only affect you; other players connected to the same server obey their own settings.");
|
||||
property.setLanguageKey("config.wizardry.enable_shift_scrolling");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".enable_shift_scrolling");
|
||||
property.setRequiresWorldRestart(false);
|
||||
enableShiftScrolling = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "minionRevengeTargeting", true,
|
||||
"Whether summoned creatures can revenge attack their owner if their owner attacks them.");
|
||||
property.setLanguageKey("config.wizardry.minion_revenge_targeting");
|
||||
property.setRequiresWorldRestart(false);
|
||||
minionRevengeTargeting = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
// These two aren't sliders because using a slider makes it difficult to fine-tune the numbers; the nature of a
|
||||
// scaling factor means that 0.5 is as big a change as 2.0, so whilst a slider is fine for increasing the
|
||||
// damage,
|
||||
// it doesn't give fine enough control for values less than 1.
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "playerDamageScaling", 1.0,
|
||||
"Global damage scaling factor for the damage dealt by players casting spells, relative to 1.", 0, 20);
|
||||
property.setLanguageKey("config.wizardry.player_damage_scaling");
|
||||
playerDamageScale = property.getDouble();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "npcDamageScaling", 1.0,
|
||||
"Global damage scaling factor for the damage dealt by NPCs casting spells, relative to 1.", 0, 20);
|
||||
property.setLanguageKey("config.wizardry.npc_damage_scaling");
|
||||
npcDamageScale = property.getDouble();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
// This one isn't a slider either because people are likely to want exact values ("it must be at most 50.3" is a
|
||||
// bit strange!).
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "castCommandMultiplierLimit", 20.0,
|
||||
"Upper limit for the multipliers passed into the /cast command. This is here to stop players from accidentally breaking a world/server. Large blast mutipliers can cause extreme lag - you have been warned!",
|
||||
1, 255);
|
||||
property.setLanguageKey("config.wizardry.cast_command_multiplier_limit");
|
||||
maxSpellCommandMultiplier = property.getDouble();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "summonedCreatureTargetsWhitelist", new String[0],
|
||||
"List of names of entities which summoned creatures and wizards are allowed to attack, in addition to the defaults. Add mod creatures to this list if you want summoned creatures to attack them and they aren't already doing so. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. wizardry:Wizard).");
|
||||
property.setLanguageKey("config.wizardry.summoned_creature_targets_whitelist");
|
||||
property.setRequiresWorldRestart(true);
|
||||
// Wizardry.proxy.setToEntityNameEntry(property);
|
||||
summonedCreatureTargetsWhitelist = property.getStringList();
|
||||
// Converts all strings in the list to lower case, to ignore case sensitivity, and trims them.
|
||||
for(int i = 0; i < summonedCreatureTargetsWhitelist.length; i++){
|
||||
summonedCreatureTargetsWhitelist[i] = summonedCreatureTargetsWhitelist[i].toLowerCase(Locale.ROOT).trim();
|
||||
}
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "summonedCreatureTargetsBlacklist",
|
||||
new String[]{"creeper"},
|
||||
"List of names of entities which summoned creatures and wizards are specifically not allowed to attack, overriding the defaults and the whitelist. Add creatures to this list if allowing them to be attacked causes problems or is too destructive (removing creepers from this list is done at your own risk!). Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. wizardry:Wizard).");
|
||||
property.setLanguageKey("config.wizardry.summoned_creature_targets_blacklist");
|
||||
property.setRequiresWorldRestart(true);
|
||||
// Wizardry.proxy.setToEntityNameEntry(property);
|
||||
summonedCreatureTargetsBlacklist = property.getStringList();
|
||||
// Converts all strings in the list to lower case, to ignore case sensitivity, and trims them.
|
||||
for(int i = 0; i < summonedCreatureTargetsBlacklist.length; i++){
|
||||
summonedCreatureTargetsBlacklist[i] = summonedCreatureTargetsBlacklist[i].toLowerCase(Locale.ROOT).trim();
|
||||
}
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "spellHUDPosition", GuiPosition.BOTTOM_LEFT.name,
|
||||
"The position of the spell HUD.", GuiPosition.names);
|
||||
property.setLanguageKey("config.wizardry.spell_hud_position");
|
||||
property = config.get(CLIENT_CATEGORY, "spellHUDPosition", GuiPosition.BOTTOM_LEFT.name, "The position of the spell HUD.", GuiPosition.names);
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".spell_hud_position");
|
||||
spellHUDPosition = GuiPosition.fromName(property.getString());
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "castCommandName", "cast",
|
||||
property = config.get(CLIENT_CATEGORY, "showSummonedCreatureNames", true, "Whether to show summoned creatures' names and owners above their heads.");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".show_summoned_creature_names");
|
||||
showSummonedCreatureNames = property.getBoolean();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
config.setCategoryPropertyOrder(CLIENT_CATEGORY, propOrder);
|
||||
}
|
||||
|
||||
private void setupCommandsConfig(){
|
||||
|
||||
// This trick is borrowed from forge; it sorts the config options into the order you want them.
|
||||
List<String> propOrder = new ArrayList<String>();
|
||||
|
||||
Property property;
|
||||
|
||||
config.addCustomCategoryComment(COMMANDS_CATEGORY, "Settings for the commands added by Wizardry. In multiplayer, the server/LAN host settings will apply.");
|
||||
|
||||
// This one isn't a slider either because people are likely to want exact values ("it must be at most 50.3" is a
|
||||
// bit strange!).
|
||||
property = config.get(COMMANDS_CATEGORY, "castCommandMultiplierLimit", 20.0,
|
||||
"Upper limit for the multipliers passed into the /cast command. This is here to stop players from accidentally breaking a world/server. Large blast mutipliers can cause extreme lag - you have been warned!",
|
||||
1, 255);
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".cast_command_multiplier_limit");
|
||||
maxSpellCommandMultiplier = property.getDouble();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(COMMANDS_CATEGORY, "castCommandName", "cast",
|
||||
"The name of the /cast command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /cast you would type /magic instead.");
|
||||
property.setLanguageKey("config.wizardry.cast_command_name");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".cast_command_name");
|
||||
property.setRequiresWorldRestart(true);
|
||||
castCommandName = property.getString();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "discoverspellCommandName", "discoverspell",
|
||||
property = config.get(COMMANDS_CATEGORY, "discoverspellCommandName", "discoverspell",
|
||||
"The name of the /discoverspell command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /discoverspell you would type /magic instead.");
|
||||
property.setLanguageKey("config.wizardry.discoverspell_command_name");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".discoverspell_command_name");
|
||||
property.setRequiresWorldRestart(true);
|
||||
discoverspellCommandName = property.getString();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "allyCommandName", "ally",
|
||||
property = config.get(COMMANDS_CATEGORY, "allyCommandName", "ally",
|
||||
"The name of the /ally command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /ally you would type /magic instead.");
|
||||
property.setLanguageKey("config.wizardry.ally_command_name");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".ally_command_name");
|
||||
property.setRequiresWorldRestart(true);
|
||||
allyCommandName = property.getString();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "alliesCommandName", "allies",
|
||||
property = config.get(COMMANDS_CATEGORY, "alliesCommandName", "allies",
|
||||
"The name of the /allies command. This is what you type directly after the /; for example if this was set to 'magic' then instead of typing /allies you would type /magic instead.");
|
||||
property.setLanguageKey("config.wizardry.allies_command_name");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".allies_command_name");
|
||||
property.setRequiresWorldRestart(true);
|
||||
alliesCommandName = property.getString();
|
||||
propOrder.add(property.getName());
|
||||
|
||||
config.setCategoryPropertyOrder(COMMANDS_CATEGORY, propOrder);
|
||||
}
|
||||
|
||||
config.setCategoryPropertyOrder(Configuration.CATEGORY_GENERAL, propOrder);
|
||||
private void setupResistancesConfig(){
|
||||
|
||||
// Resistances
|
||||
Property property;
|
||||
|
||||
List<String> propOrder1 = new ArrayList<String>();
|
||||
List<String> propOrder = new ArrayList<String>();
|
||||
|
||||
config.addCustomCategoryComment(RESISTANCES_CATEGORY,
|
||||
"Settings which allow entities to be made immune to certain types of magic. In multiplayer, the server/LAN host settings will apply.");
|
||||
|
||||
property = config.get(RESISTANCES_CATEGORY, "mobsImmuneToFire", new String[]{},
|
||||
"List of names of entities that are immune to fire, in addition to the defaults. Add mod creatures to this list if you want them to be immune to fire magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. wizardry:Wizard).");
|
||||
property.setLanguageKey("config.wizardry.mobs_immune_to_fire");
|
||||
"List of names of entities that are immune to fire, in addition to the defaults. Add mod creatures to this list if you want them to be immune to fire magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard).");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".mobs_immune_to_fire");
|
||||
property.setRequiresMcRestart(true);
|
||||
// Wizardry.proxy.setToEntityNameEntry(property);
|
||||
// Converts all strings in the list to lower case, to ignore case sensitivity, and trims them.
|
||||
@@ -517,11 +531,11 @@ public final class Settings {
|
||||
MagicDamage.addEntityImmunity(EntityList.getClass(new ResourceLocation(property.getStringList()[i])),
|
||||
DamageType.FIRE);
|
||||
}
|
||||
propOrder1.add(property.getName());
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(RESISTANCES_CATEGORY, "mobsImmuneToIce", new String[]{},
|
||||
"List of names of entities that are immune to ice, in addition to the defaults. Add mod creatures to this list if you want them to be immune to ice magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. wizardry:Wizard).");
|
||||
property.setLanguageKey("config.wizardry.mobs_immune_to_ice");
|
||||
"List of names of entities that are immune to ice, in addition to the defaults. Add mod creatures to this list if you want them to be immune to ice magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard).");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".mobs_immune_to_ice");
|
||||
property.setRequiresMcRestart(true);
|
||||
// Wizardry.proxy.setToEntityNameEntry(property);
|
||||
// Converts all strings in the list to lower case, to ignore case sensitivity, and trims them.
|
||||
@@ -530,11 +544,11 @@ public final class Settings {
|
||||
MagicDamage.addEntityImmunity(EntityList.getClass(new ResourceLocation(property.getStringList()[i])),
|
||||
DamageType.FROST);
|
||||
}
|
||||
propOrder1.add(property.getName());
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(RESISTANCES_CATEGORY, "mobsImmuneToLightning", new String[]{},
|
||||
"List of names of entities that are immune to lightning, in addition to the defaults. Add mod creatures to this list if you want them to be immune to lightning magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. wizardry:Wizard).");
|
||||
property.setLanguageKey("config.wizardry.mobs_immune_to_lightning");
|
||||
"List of names of entities that are immune to lightning, in addition to the defaults. Add mod creatures to this list if you want them to be immune to lightning magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard).");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".mobs_immune_to_lightning");
|
||||
property.setRequiresMcRestart(true);
|
||||
// Wizardry.proxy.setToEntityNameEntry(property);
|
||||
// Converts all strings in the list to lower case, to ignore case sensitivity, and trims them.
|
||||
@@ -543,11 +557,11 @@ public final class Settings {
|
||||
MagicDamage.addEntityImmunity(EntityList.getClass(new ResourceLocation(property.getStringList()[i])),
|
||||
DamageType.SHOCK);
|
||||
}
|
||||
propOrder1.add(property.getName());
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(RESISTANCES_CATEGORY, "mobsImmuneToWither", new String[]{},
|
||||
"List of names of entities that are immune to wither effects, in addition to the defaults. Add mod creatures to this list if you want them to be immune to withering magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. wizardry:Wizard).");
|
||||
property.setLanguageKey("config.wizardry.mobs_immune_to_wither");
|
||||
"List of names of entities that are immune to wither effects, in addition to the defaults. Add mod creatures to this list if you want them to be immune to withering magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard).");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".mobs_immune_to_wither");
|
||||
property.setRequiresMcRestart(true);
|
||||
// Wizardry.proxy.setToEntityNameEntry(property);
|
||||
// Converts all strings in the list to lower case, to ignore case sensitivity, and trims them.
|
||||
@@ -556,11 +570,11 @@ public final class Settings {
|
||||
MagicDamage.addEntityImmunity(EntityList.getClass(new ResourceLocation(property.getStringList()[i])),
|
||||
DamageType.WITHER);
|
||||
}
|
||||
propOrder1.add(property.getName());
|
||||
propOrder.add(property.getName());
|
||||
|
||||
property = config.get(RESISTANCES_CATEGORY, "mobsImmuneToPoison", new String[]{},
|
||||
"List of names of entities that are immune to poison, in addition to the defaults. Add mod creatures to this list if you want them to be immune to poison magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. wizardry:Wizard).");
|
||||
property.setLanguageKey("config.wizardry.mobs_immune_to_poison");
|
||||
"List of names of entities that are immune to poison, in addition to the defaults. Add mod creatures to this list if you want them to be immune to poison magic and they aren't already. Entity names are not case sensitive. For mod entities, prefix with the mod ID (e.g. " + Wizardry.MODID + ":wizard).");
|
||||
property.setLanguageKey("config." + Wizardry.MODID + ".mobs_immune_to_poison");
|
||||
property.setRequiresMcRestart(true);
|
||||
// Wizardry.proxy.setToEntityNameEntry(property);
|
||||
// Converts all strings in the list to lower case, to ignore case sensitivity, and trims them.
|
||||
@@ -569,19 +583,9 @@ public final class Settings {
|
||||
MagicDamage.addEntityImmunity(EntityList.getClass(new ResourceLocation(property.getStringList()[i])),
|
||||
DamageType.POISON);
|
||||
}
|
||||
propOrder1.add(property.getName());
|
||||
|
||||
config.setCategoryPropertyOrder(RESISTANCES_CATEGORY, propOrder1);
|
||||
|
||||
// config.addCustomCategoryComment(CLIENT_CATEGORY, "Client-side settings that only affect the local minecraft
|
||||
// game. They have no effect on a server; each player obeys their own settings.");
|
||||
// config.addCustomCategoryComment(COMMANDS_CATEGORY, "Settings for the commands added by Wizardry. In
|
||||
// multiplayer, the server/LAN host settings will apply.");
|
||||
// config.addCustomCategoryComment(WORLDGEN_CATEGORY, "Settings that affect world generation. In multiplayer,
|
||||
// the server/LAN host settings will apply.");
|
||||
// config.addCustomCategoryComment(GLOBAL_CATEGORY, "Global settings that affect game mechanics. In multiplayer,
|
||||
// the server/LAN host settings will apply.");
|
||||
propOrder.add(property.getName());
|
||||
|
||||
config.setCategoryPropertyOrder(RESISTANCES_CATEGORY, propOrder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
import net.minecraft.world.storage.WorldSavedData;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@@ -20,7 +20,7 @@ import electroblob.wizardry.packet.PacketPlayerSync;
|
||||
import electroblob.wizardry.packet.PacketTransportation;
|
||||
import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryAchievements;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.spell.None;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
@@ -33,12 +33,12 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemEnchantedBook;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@@ -67,7 +67,7 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
* capability, but in my opinion there are already too many classes to deal with, so I'm not adding any more than are
|
||||
* necessary, meaning those constants and values are kept here instead.
|
||||
*
|
||||
* @since Wizardry 1.2
|
||||
* @since Wizardry 2.1
|
||||
* @author Electroblob
|
||||
*/
|
||||
// On the plus side, having to rethink this class allowed me to clean it up a lot.
|
||||
@@ -134,6 +134,10 @@ public class WizardData implements INBTSerializable<NBTTagCompound> {
|
||||
public Set<String> allyNames;
|
||||
|
||||
private Set<UUID> soulboundCreatures;
|
||||
|
||||
public WizardData(){
|
||||
this(null); // Nullary constructor for the registration method factory parameter
|
||||
}
|
||||
|
||||
public WizardData(EntityPlayer player){
|
||||
this.player = player;
|
||||
@@ -178,13 +182,13 @@ public class WizardData implements INBTSerializable<NBTTagCompound> {
|
||||
if(!spellsDiscovered.add(spell)) return false;
|
||||
// If the spell had not already been discovered, achievements can be triggered and the method returns true
|
||||
if(spellsDiscovered.containsAll(Spell.getSpells(Spell::isEnabled))){
|
||||
this.player.addStat(WizardryAchievements.all_spells);
|
||||
WizardryAdvancementTriggers.all_spells.triggerFor(this.player);
|
||||
}
|
||||
|
||||
for(Element element : Element.values()){
|
||||
if(element != Element.MAGIC
|
||||
&& spellsDiscovered.containsAll(Spell.getSpells(new Spell.TierElementFilter(null, element)))){
|
||||
this.player.addStat(WizardryAchievements.element_master);
|
||||
WizardryAdvancementTriggers.element_master.triggerFor(this.player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,12 +278,14 @@ public class WizardData implements INBTSerializable<NBTTagCompound> {
|
||||
for(ItemStack stack : player.inventory.mainInventory){
|
||||
if(stack.isItemEnchanted()){
|
||||
|
||||
Map<Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(stack);
|
||||
NBTTagList enchantmentList = stack.getItem() == Items.ENCHANTED_BOOK ?
|
||||
ItemEnchantedBook.getEnchantments(stack) : stack.getEnchantmentTagList();
|
||||
|
||||
Iterator<Entry<Enchantment, Integer>> iterator = enchantments.entrySet().iterator();
|
||||
Iterator<NBTBase> iterator =enchantmentList.iterator();
|
||||
// For each of the item's enchantments
|
||||
while(iterator.hasNext()){
|
||||
Enchantment enchantment = iterator.next().getKey();
|
||||
NBTTagCompound enchantmentTag = (NBTTagCompound) iterator.next();
|
||||
Enchantment enchantment = Enchantment.getEnchantmentByID(enchantmentTag.getShort("id"));
|
||||
// Ignores the enchantment unless it is an imbuement
|
||||
if(enchantment instanceof Imbuement){
|
||||
int duration = this.getImbuementDuration(enchantment);
|
||||
@@ -291,10 +297,8 @@ public class WizardData implements INBTSerializable<NBTTagCompound> {
|
||||
activeImbuements.add((Imbuement)enchantment);
|
||||
// Otherwise:
|
||||
}else{
|
||||
// Removes the enchantment from the enchantment map
|
||||
// Removes the enchantment from the item
|
||||
iterator.remove();
|
||||
// Applies the new enchantment map to the item
|
||||
EnchantmentHelper.setEnchantments(enchantments, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,39 +7,35 @@ import electroblob.wizardry.command.CommandDiscoverSpell;
|
||||
import electroblob.wizardry.command.CommandSetAlly;
|
||||
import electroblob.wizardry.command.CommandViewAllies;
|
||||
import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import electroblob.wizardry.registry.WizardryAchievements;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryRegistry;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.Capability.IStorage;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.Type;
|
||||
|
||||
@Mod(modid = Wizardry.MODID, name = Wizardry.NAME, version = Wizardry.VERSION, guiFactory = "electroblob." + Wizardry.MODID + ".WizardryGuiFactory")
|
||||
@Mod(modid = Wizardry.MODID, name = Wizardry.NAME, version = Wizardry.VERSION, guiFactory = "electroblob.wizardry.WizardryGuiFactory")
|
||||
public class Wizardry {
|
||||
|
||||
/** Wizardry's mod ID. */
|
||||
// This is going to have to change for 1.12 or it'll conflict with the other wizardry mod.
|
||||
// They were there first, it's only fair... although I wonder if that will have unintended side-effects?
|
||||
public static final String MODID = "wizardry"; // How about 'ebwizardry', to keep it short?
|
||||
public static final String MODID = "ebwizardry";
|
||||
/** Wizardry's mod name, in readable form. */
|
||||
public static final String NAME = "Electroblob's Wizardry";
|
||||
/**
|
||||
@@ -52,7 +48,7 @@ public class Wizardry {
|
||||
* 1.x.x represents Minecraft 1.7.x versions, 2.x.x represents Minecraft 1.10.x versions, 3.x.x represents Minecraft
|
||||
* 1.11.x versions, and so on.
|
||||
*/
|
||||
public static final String VERSION = "3.1.0";
|
||||
public static final String VERSION = "4.1.3";
|
||||
|
||||
// IDEA: Improve the algorithm that finds a place to summon creatures to take walls into account.
|
||||
// IDEA: Replace all uses of Math.cos and Math.sin with MathHelper versions
|
||||
@@ -70,19 +66,6 @@ public class Wizardry {
|
||||
// I can make the healing spells use damage multipliers - hurrah!
|
||||
|
||||
// TODO: Switch from IInventory to IItemHandler (Or don't. It's only useful for automation really.)
|
||||
// TODO: Rearrange the config gui and file
|
||||
|
||||
// Updating:
|
||||
// TODO: Make sure all obf reflection names are still correct
|
||||
// TODO: Go through each of the summoned creatures and check there are no extra vanilla methods to override
|
||||
// TODO: Check whether Minecraft has added some methods that do the same job as my utilities, particularly in
|
||||
// relation to itemstacks, hotbar, armour slots and inventory slots.
|
||||
// TODO: Add wizard towers to the /locate command
|
||||
// TODO: Fix cascading worldgen lag and backport (offset area into loaded chunks, possibly use WorldGenMinable)
|
||||
// TODO: Change evil wizard sounds again to use illager sounds?
|
||||
// TODO: Chnage all instanceof checks on split entity variant classes (zombie, skeleton, etc.) to their abstract
|
||||
// base classes where appropriate
|
||||
|
||||
// TODO: Have particles obey Minecraft's particle setting where appropriate
|
||||
// (see https://github.com/RootsTeam/Embers/blob/master/src/main/java/teamroots/embers/particle/ParticleUtil.java)
|
||||
|
||||
@@ -112,9 +95,6 @@ public class Wizardry {
|
||||
|
||||
logger = event.getModLog();
|
||||
|
||||
// The array in question no longer exists, so I'm pretty sure this isn't necessary any more.
|
||||
// expandPotionTypesArray();
|
||||
|
||||
settings.initConfig(event);
|
||||
|
||||
// Yes - by the looks of it, having an interface is completely unnecessary in this case.
|
||||
@@ -132,7 +112,7 @@ public class Wizardry {
|
||||
@Override
|
||||
public void readNBT(Capability<WizardData> capability, WizardData instance, EnumFacing side, NBTBase nbt){
|
||||
}
|
||||
}, WizardData.class);
|
||||
}, WizardData::new);
|
||||
|
||||
WizardryRegistry.registerTileEntities();
|
||||
|
||||
@@ -140,8 +120,7 @@ public class Wizardry {
|
||||
// The check for the generateLoot setting is now done within this method.
|
||||
WizardryRegistry.registerLoot();
|
||||
|
||||
// NOTE: Will need to be moved to init for 1.12, as will anything that needs to be after the registry events.
|
||||
WizardryTabs.sort();
|
||||
WizardryAdvancementTriggers.register();
|
||||
|
||||
// Moved to preInit, because apparently it has to be here now.
|
||||
proxy.registerRenderers();
|
||||
@@ -163,12 +142,6 @@ public class Wizardry {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new WizardryGuiHandler());
|
||||
WizardryPacketHandler.initPackets();
|
||||
|
||||
// Achievements
|
||||
AchievementPage.registerAchievementPage(WizardryAchievements.WIZARDRY_ACHIEVEMENT_PAGE);
|
||||
|
||||
// Recipes
|
||||
WizardryRegistry.registerRecipes();
|
||||
|
||||
proxy.initGuiBits();
|
||||
}
|
||||
|
||||
@@ -181,6 +154,7 @@ public class Wizardry {
|
||||
* '|'; } } // Cuts off the last '|' entityNames = entityNames.substring(0, entityNames.length()-1);
|
||||
* entityNamePattern = Pattern.compile(entityNames); */
|
||||
proxy.initialiseLayers();
|
||||
WizardryTabs.sort();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -200,17 +174,16 @@ public class Wizardry {
|
||||
}
|
||||
|
||||
// 2.1 changed some item ids, so this fixes them for existing worlds
|
||||
// NOTE: Needs changing to RegistryEvent.MissingMapping in 1.12, or just removing since nobody updates minecraft
|
||||
// versions when using mods.
|
||||
@EventHandler
|
||||
public static void onMissingMappingEvent(FMLMissingMappingsEvent event){
|
||||
// Nobody updates minecraft versions when using mods, but I may as well leave this here just in case.
|
||||
@SubscribeEvent
|
||||
public static void onMissingMappingEvent(RegistryEvent.MissingMappings<Item> event){
|
||||
// Just get, not getAll, since the mod id didn't change!
|
||||
for(FMLMissingMappingsEvent.MissingMapping mapping : event.get()){
|
||||
if(mapping.type == Type.ITEM && mapping.resourceLocation.getResourceDomain().equals(Wizardry.MODID)){
|
||||
for(RegistryEvent.MissingMappings.Mapping<Item> mapping : event.getAllMappings()){
|
||||
if(mapping.key.getNamespace().equals(Wizardry.MODID)){
|
||||
|
||||
Item replacement = null;
|
||||
|
||||
switch(mapping.resourceLocation.getResourcePath()){
|
||||
switch(mapping.key.getPath()){
|
||||
|
||||
case "wand_basic": replacement = WizardryItems.magic_wand; break;
|
||||
case "wand_basic_fire": replacement = WizardryItems.basic_fire_wand; break;
|
||||
|
||||
@@ -10,7 +10,7 @@ import electroblob.wizardry.event.SpellCastEvent;
|
||||
import electroblob.wizardry.item.ItemWand;
|
||||
import electroblob.wizardry.item.ItemWizardArmour;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryAchievements;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryEnchantments;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
@@ -50,13 +50,13 @@ import net.minecraft.world.storage.loot.LootPool;
|
||||
import net.minecraft.world.storage.loot.RandomValueRange;
|
||||
import net.minecraft.world.storage.loot.conditions.LootCondition;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.LootTableLoadEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
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.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
@@ -84,7 +84,7 @@ public final class WizardryEventHandler {
|
||||
if(Wizardry.settings.generateLoot){
|
||||
for(String location : LOOT_INJECTION_LOCATIONS){
|
||||
if(event.getName().toString().matches(location)){
|
||||
event.getTable().addPool(getAdditive("wizardry:chests/dungeon_additions"));
|
||||
event.getTable().addPool(getAdditive(Wizardry.MODID + ":chests/dungeon_additions"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,8 @@ public final class WizardryEventHandler {
|
||||
|
||||
// Ice Shroud
|
||||
if(event.getEntityLiving().isPotionActive(WizardryPotions.ice_shroud)
|
||||
&& !MagicDamage.isEntityImmune(DamageType.FROST, event.getEntityLiving()))
|
||||
&& !MagicDamage.isEntityImmune(DamageType.FROST, event.getEntityLiving())
|
||||
&& !(event.getEntityLiving() instanceof FakePlayer))
|
||||
attacker.addPotionEffect(new PotionEffect(WizardryPotions.frost, 100, 0));
|
||||
|
||||
// Static Aura
|
||||
@@ -353,7 +354,7 @@ public final class WizardryEventHandler {
|
||||
}
|
||||
|
||||
if(event.getEntityLiving() == player && event.getSource() instanceof IElementalDamage){
|
||||
player.addStat(WizardryAchievements.self_destruct);
|
||||
WizardryAdvancementTriggers.self_destruct.triggerFor(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,13 +384,6 @@ public final class WizardryEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onItemPickupEvent(EntityItemPickupEvent event){
|
||||
if(event.getItem().getItem().getItem() == WizardryItems.magic_crystal){
|
||||
event.getEntityPlayer().addStat(WizardryAchievements.crystal, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Private helper methods
|
||||
// ================================================================================================================
|
||||
|
||||
|
||||
@@ -13,22 +13,11 @@ public class WizardryGuiFactory implements IModGuiFactory {
|
||||
public void initialize(Minecraft minecraftInstance){
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass(){
|
||||
return GuiConfigWizardry.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // It's a bit of Forge that hasn't been tidied up, but we have to implement it.
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConfigGui(){
|
||||
return true;
|
||||
|
||||
@@ -1,67 +1,64 @@
|
||||
package electroblob.wizardry;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import electroblob.wizardry.client.ClientProxy;
|
||||
import electroblob.wizardry.item.ItemWand;
|
||||
import electroblob.wizardry.packet.PacketControlInput;
|
||||
import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
|
||||
public class WizardryKeyHandler {
|
||||
|
||||
boolean NkeyPressed = false;
|
||||
boolean BkeyPressed = false;
|
||||
boolean NkeyAlreadyPressed = false;
|
||||
boolean BkeyAlreadyPressed = false;
|
||||
|
||||
// Changed to a tick event to allow mouse button keybinds
|
||||
// The 'lag' that happened previously was actually because the code only fired when a keyboard key was pressed!
|
||||
@SubscribeEvent
|
||||
public void onKeyInput(InputEvent.KeyInputEvent event){
|
||||
public void onTickEvent(TickEvent.ClientTickEvent event){
|
||||
|
||||
// Key pressed
|
||||
if(Keyboard.getEventKeyState()){
|
||||
if(event.phase == TickEvent.Phase.END) return; // Only really needs to be once per tick
|
||||
|
||||
if(Wizardry.proxy instanceof ClientProxy){
|
||||
if(Wizardry.proxy instanceof ClientProxy){
|
||||
|
||||
if(ClientProxy.NEXT_SPELL.isPressed() && Minecraft.getMinecraft().inGameHasFocus){
|
||||
if(!NkeyPressed){
|
||||
NkeyPressed = true;
|
||||
}else{
|
||||
NkeyAlreadyPressed = true;
|
||||
}
|
||||
if(!NkeyAlreadyPressed){
|
||||
// Packet building
|
||||
IMessage msg = new PacketControlInput.Message(PacketControlInput.ControlType.NEXT_SPELL_KEY);
|
||||
WizardryPacketHandler.net.sendToServer(msg);
|
||||
}
|
||||
}
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
|
||||
if(ClientProxy.PREVIOUS_SPELL.isPressed() && Minecraft.getMinecraft().inGameHasFocus){
|
||||
if(!BkeyPressed){
|
||||
BkeyPressed = true;
|
||||
}else{
|
||||
BkeyAlreadyPressed = true;
|
||||
}
|
||||
if(!BkeyAlreadyPressed){
|
||||
// Packet building
|
||||
IMessage msg = new PacketControlInput.Message(
|
||||
PacketControlInput.ControlType.PREVIOUS_SPELL_KEY);
|
||||
WizardryPacketHandler.net.sendToServer(msg);
|
||||
}
|
||||
if(player != null){
|
||||
|
||||
ItemStack wand = player.getHeldItemMainhand();
|
||||
|
||||
if(!(wand.getItem() instanceof ItemWand)){
|
||||
wand = player.getHeldItemOffhand();
|
||||
// If the player isn't holding a wand, then nothing else needs to be done.
|
||||
if(!(wand.getItem() instanceof ItemWand)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Key released
|
||||
else{
|
||||
if(NkeyPressed){
|
||||
if(ClientProxy.NEXT_SPELL.isKeyDown() && Minecraft.getMinecraft().inGameHasFocus){
|
||||
if(!NkeyPressed){
|
||||
NkeyPressed = true;
|
||||
// Packet building
|
||||
IMessage msg = new PacketControlInput.Message(PacketControlInput.ControlType.NEXT_SPELL_KEY);
|
||||
WizardryPacketHandler.net.sendToServer(msg);
|
||||
}
|
||||
}else{
|
||||
NkeyPressed = false;
|
||||
NkeyAlreadyPressed = false;
|
||||
}else if(BkeyPressed){
|
||||
}
|
||||
|
||||
if(ClientProxy.PREVIOUS_SPELL.isKeyDown() && Minecraft.getMinecraft().inGameHasFocus){
|
||||
if(!BkeyPressed){
|
||||
BkeyPressed = true;
|
||||
// Packet building
|
||||
IMessage msg = new PacketControlInput.Message(
|
||||
PacketControlInput.ControlType.PREVIOUS_SPELL_KEY);
|
||||
WizardryPacketHandler.net.sendToServer(msg);
|
||||
}
|
||||
}else{
|
||||
BkeyPressed = false;
|
||||
BkeyAlreadyPressed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
import net.minecraft.world.storage.loot.LootContext;
|
||||
import net.minecraft.world.storage.loot.LootTable;
|
||||
@@ -175,7 +175,7 @@ public class WizardryWorldGenerator implements IWorldGenerator {
|
||||
}
|
||||
|
||||
// 0 = West, 1 = North, 2 = East, 3 = South (The way you would face when walking out of the door)
|
||||
EnumFacing orientation = EnumFacing.getHorizontal(random.nextInt(4));
|
||||
EnumFacing orientation = EnumFacing.byHorizontalIndex(random.nextInt(4));
|
||||
boolean flip = random.nextBoolean();
|
||||
|
||||
if(checkSpaceForTower(world, origin, towerBlueprint, orientation, flip)){
|
||||
@@ -237,7 +237,8 @@ public class WizardryWorldGenerator implements IWorldGenerator {
|
||||
// BlockPos is immutable, so I'm not sure if simply saying pos1 = pos will be sufficient.
|
||||
BlockPos layerCentre = new BlockPos(origin);
|
||||
|
||||
while(flag){
|
||||
// Stop when the bottom of the world is reached
|
||||
while(flag && layerCentre.getY() > 0){
|
||||
|
||||
flag = false;
|
||||
|
||||
@@ -299,7 +300,7 @@ public class WizardryWorldGenerator implements IWorldGenerator {
|
||||
// Rotates the door depending on whether flip is true.
|
||||
ItemDoor.placeDoor(
|
||||
world, pos, flip
|
||||
? EnumFacing.getHorizontal(3 - orientation.getHorizontalIndex())
|
||||
? EnumFacing.byHorizontalIndex(3 - orientation.getHorizontalIndex())
|
||||
.getOpposite()
|
||||
: orientation.rotateYCCW(),
|
||||
Blocks.OAK_DOOR, false);
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package electroblob.wizardry.advancement;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementManager;
|
||||
import net.minecraft.advancements.AdvancementProgress;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* This is a provisory class for the transition to 1.12
|
||||
* It contains an enum with all the advancements of this mod
|
||||
* and an helper to grant advancements on the server side only (like the command)
|
||||
* @author Corail31
|
||||
* @since Wizardry 4.1
|
||||
*/
|
||||
public class AdvancementHelper {
|
||||
public enum EnumAdvancement {
|
||||
crystal,
|
||||
arcane_initiate,
|
||||
apprentice,
|
||||
master,
|
||||
all_spells,
|
||||
wizard_trade,
|
||||
buy_master_spell,
|
||||
freeze_blaze,
|
||||
charge_creeper,
|
||||
frankenstein,
|
||||
special_upgrade,
|
||||
craft_flask,
|
||||
elemental,
|
||||
armour_set,
|
||||
legendary,
|
||||
self_destruct,
|
||||
pig_tornado,
|
||||
jam_wizard,
|
||||
slime_skeleton,
|
||||
anger_wizard,
|
||||
defeat_evil_wizard,
|
||||
max_out_wand,
|
||||
element_master,
|
||||
identify_spell;
|
||||
}
|
||||
|
||||
public static boolean grantAdvancement(EntityPlayer player, EnumAdvancement advancementName) {
|
||||
if (player == null) { return false; }
|
||||
if (player.world.isRemote) { return true; }
|
||||
EntityPlayerMP player_mp = player.getServer().getPlayerList().getPlayerByUUID(player.getUniqueID());
|
||||
AdvancementManager am = player_mp.getServerWorld().getAdvancementManager();
|
||||
Advancement advancement = am.getAdvancement(new ResourceLocation(Wizardry.MODID, advancementName.name()));
|
||||
if (advancement == null) { return false; }
|
||||
AdvancementProgress advancementprogress = player_mp.getAdvancements().getProgress(advancement);
|
||||
if (!advancementprogress.isDone()) {
|
||||
for (String criteria : advancementprogress.getRemaningCriteria()) {
|
||||
player_mp.getAdvancements().grantCriterion(advancement, criteria);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,13 @@
|
||||
package electroblob.wizardry.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.WizardryGuiHandler;
|
||||
import electroblob.wizardry.tileentity.TileEntityArcaneWorkbench;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -65,59 +61,20 @@ public class BlockArcaneWorkbench extends BlockContainer {
|
||||
return false;
|
||||
}
|
||||
|
||||
player.openGui(Wizardry.instance, WizardryGuiHandler.ARCANE_WORKBENCH, world, pos.getX(), pos.getY(),
|
||||
pos.getZ());
|
||||
player.openGui(Wizardry.instance, WizardryGuiHandler.ARCANE_WORKBENCH, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState block){
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
Random random = new Random();
|
||||
TileEntityArcaneWorkbench tileentityarcaneworkbench = (TileEntityArcaneWorkbench)world.getTileEntity(pos);
|
||||
if(tileentity instanceof TileEntityArcaneWorkbench){
|
||||
InventoryHelper.dropInventoryItems(world, pos, (TileEntityArcaneWorkbench)tileentity);
|
||||
}
|
||||
|
||||
if(tileentityarcaneworkbench != null){
|
||||
|
||||
for(int j1 = 0; j1 < tileentityarcaneworkbench.getSizeInventory(); ++j1){
|
||||
|
||||
ItemStack itemstack = tileentityarcaneworkbench.getStackInSlot(j1);
|
||||
|
||||
if(!itemstack.isEmpty()){
|
||||
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for(float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.getCount() > 0; world
|
||||
.spawnEntity(entityitem)){
|
||||
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if(k1 > itemstack.getCount()){
|
||||
k1 = itemstack.getCount();
|
||||
}
|
||||
|
||||
itemstack.shrink(k1);
|
||||
|
||||
entityitem = new EntityItem(world, (double)((float)pos.getX() + f),
|
||||
(double)((float)pos.getY() + f1), (double)((float)pos.getZ() + f2),
|
||||
new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double)((float)random.nextGaussian() * f3);
|
||||
entityitem.motionY = (double)((float)random.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double)((float)random.nextGaussian() * f3);
|
||||
|
||||
if(itemstack.hasTagCompound()){
|
||||
entityitem.getItem().setTagCompound(((NBTTagCompound)itemstack.getTagCompound().copy()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// par1World.func_96440_m(par2, par3, par4, block);
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, block);
|
||||
super.breakBlock(world, pos, block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCrystalOre extends Block {
|
||||
|
||||
@@ -20,10 +24,17 @@ public class BlockCrystalOre extends Block {
|
||||
|
||||
@Override
|
||||
public int quantityDropped(IBlockState state, int fortune, Random random){
|
||||
// This now works the same way as vanilla ores
|
||||
if(fortune > 0){
|
||||
return random.nextInt(2) + 1 + random.nextInt(fortune);
|
||||
|
||||
int i = random.nextInt(fortune + 2) - 1;
|
||||
|
||||
if(i < 0) i = 0;
|
||||
|
||||
return (random.nextInt(3) + 1) * (i + 1);
|
||||
|
||||
}else{
|
||||
return random.nextInt(2) + 1;
|
||||
return random.nextInt(3) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,4 +42,16 @@ public class BlockCrystalOre extends Block {
|
||||
public Item getItemDropped(IBlockState state, Random random, int fortune){
|
||||
return WizardryItems.magic_crystal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune){
|
||||
|
||||
Random rand = world instanceof World ? ((World)world).rand : RANDOM;
|
||||
|
||||
if(this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)){
|
||||
return MathHelper.getInt(rand, 1, 4);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class BlockSnare extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity){
|
||||
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity entity){
|
||||
|
||||
if(!world.isRemote && entity instanceof EntityLivingBase){
|
||||
if(world.getTileEntity(pos) instanceof TileEntityPlayerSave){
|
||||
@@ -80,7 +80,7 @@ public class BlockSnare extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer(){
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BlockSpectral extends BlockContainer {
|
||||
|
||||
// Replaces getRenderBlockPass
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer(){
|
||||
public BlockRenderLayer getRenderLayer(){
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class BlockStatue extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer(){
|
||||
public BlockRenderLayer getRenderLayer(){
|
||||
return this.isIce ? BlockRenderLayer.TRANSLUCENT : BlockRenderLayer.SOLID;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package electroblob.wizardry.block;
|
||||
import java.util.Random;
|
||||
|
||||
import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.ItemWand;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryBlocks;
|
||||
@@ -65,14 +66,15 @@ public class BlockTransportationStone extends Block {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos){
|
||||
|
||||
super.onNeighborChange(world, pos, neighbor);
|
||||
super.neighborChanged(state, world, pos, block, fromPos);
|
||||
|
||||
if(!world.isSideSolid(pos.down(), EnumFacing.UP, false) && world instanceof World){
|
||||
this.dropBlockAsItem((World)world, pos, world.getBlockState(pos), 0);
|
||||
((World)world).setBlockToAir(pos);
|
||||
if(!world.isSideSolid(pos.down(), EnumFacing.UP, false)){
|
||||
this.dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +109,7 @@ public class BlockTransportationStone extends Block {
|
||||
if(testForCircle(world, pos1)){
|
||||
data.setStoneCircleLocation(pos1, world.provider.getDimension());
|
||||
if(!world.isRemote) player.sendMessage(
|
||||
new TextComponentTranslation("tile.wizardry:transportation_stone.confirm",
|
||||
new TextComponentTranslation("tile." + Wizardry.MODID + ":transportation_stone.confirm",
|
||||
Spells.transportation.getNameForTranslationFormatted()));
|
||||
return true;
|
||||
}
|
||||
@@ -115,7 +117,7 @@ public class BlockTransportationStone extends Block {
|
||||
}
|
||||
|
||||
if(!world.isRemote)
|
||||
player.sendMessage(new TextComponentTranslation("tile.wizardry:transportation_stone.invalid"));
|
||||
player.sendMessage(new TextComponentTranslation("tile." + Wizardry.MODID + ":transportation_stone.invalid"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class BlockVanishingCobweb extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity){
|
||||
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity entity){
|
||||
entity.setInWeb();
|
||||
}
|
||||
|
||||
|
||||
@@ -155,8 +155,8 @@ public class ClientProxy extends CommonProxy {
|
||||
public static MixedFontRenderer mixedFontRenderer;
|
||||
|
||||
// Key Bindings
|
||||
public static final KeyBinding NEXT_SPELL = new KeyBinding("key.wizardry.next_spell", Keyboard.KEY_N, "key.categories.wizardry");
|
||||
public static final KeyBinding PREVIOUS_SPELL = new KeyBinding("key.wizardry.previous_spell", Keyboard.KEY_B, "key.categories.wizardry");
|
||||
public static final KeyBinding NEXT_SPELL = new KeyBinding("key." + Wizardry.MODID + ".next_spell", Keyboard.KEY_N, "key.categories." + Wizardry.MODID);
|
||||
public static final KeyBinding PREVIOUS_SPELL = new KeyBinding("key." + Wizardry.MODID + ".previous_spell", Keyboard.KEY_B, "key.categories." + Wizardry.MODID);
|
||||
|
||||
// Armour Model
|
||||
public static final ModelBiped WIZARD_ARMOUR_MODEL = new ModelWizardArmour(0.75f);
|
||||
@@ -246,9 +246,9 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
if(discovered){
|
||||
return I18n.format("item.wizardry:scroll.name", spell.getDisplayName()).trim();
|
||||
return I18n.format("item." + Wizardry.MODID + ":scroll.name", spell.getDisplayName()).trim();
|
||||
}else{
|
||||
return I18n.format("item.wizardry:scroll.undiscovered.name", "#" + SpellGlyphData.getGlyphName(spell, player.world) + "#").trim();
|
||||
return I18n.format("item." + Wizardry.MODID + ":scroll.undiscovered.name", "#" + SpellGlyphData.getGlyphName(spell, player.world) + "#").trim();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ public class EntityNameEntry extends StringEntry {
|
||||
|
||||
@Override
|
||||
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY,
|
||||
boolean isSelected){
|
||||
// super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected);
|
||||
boolean isSelected, float partialTicks){
|
||||
//super.drawEntry(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected, partial);
|
||||
this.btnValue.x = listWidth / 4;
|
||||
this.btnValue.y = y;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class EntityNameEntry extends StringEntry {
|
||||
this.btnValue.displayString = this.textFieldValue.getText();
|
||||
// btnValue.packedFGColour = value ? GuiUtils.getColorCode('2', true) : GuiUtils.getColorCode('4', true);
|
||||
|
||||
this.btnValue.drawButton(owningEntryList.getMC(), mouseX, mouseY);
|
||||
this.btnValue.drawButton(owningEntryList.getMC(), mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,23 +38,31 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
|
||||
private final int tooltipWidth = 164;
|
||||
|
||||
// We report the actual size of the GUI to Minecraft when a wand is in so JEI doesn't overdraw it.
|
||||
// For calculations, we use the size without the tooltip.
|
||||
private final int xSizeNoTip = 176;
|
||||
|
||||
public GuiArcaneWorkbench(InventoryPlayer invPlayer, TileEntityArcaneWorkbench entity){
|
||||
super(new ContainerArcaneWorkbench(invPlayer, entity));
|
||||
this.playerInventory = invPlayer;
|
||||
this.arcaneWorkbenchInventory = entity;
|
||||
xSize = 176;
|
||||
xSize = xSizeNoTip;
|
||||
ySize = 220;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_){
|
||||
|
||||
this.drawDefaultBackground();
|
||||
|
||||
// Tests if there is a wand in the workbench and edits the positioning accordingly
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots
|
||||
.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
guiLeft = (this.width - this.xSize - tooltipWidth) / 2;
|
||||
xSize = xSizeNoTip + tooltipWidth;
|
||||
guiLeft = (this.width - this.xSize) / 2;
|
||||
this.applyBtn.x = (this.width - tooltipWidth) / 2 + 48;
|
||||
}else{
|
||||
xSize = xSizeNoTip;
|
||||
guiLeft = (this.width - this.xSize) / 2;
|
||||
this.applyBtn.x = this.width / 2 + 48;
|
||||
}
|
||||
@@ -66,18 +74,19 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
}
|
||||
|
||||
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
|
||||
|
||||
// Required now, or item mouseover tooltips won't render.
|
||||
this.renderHoveredToolTip(p_73863_1_, p_73863_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY){
|
||||
|
||||
GlStateManager.pushAttrib();
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
// Main inventory
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSizeNoTip, ySize);
|
||||
|
||||
// Changing slots
|
||||
for(int i = 0; i < ContainerArcaneWorkbench.CRYSTAL_SLOT; i++){
|
||||
@@ -91,10 +100,10 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
|
||||
// Tooltip box
|
||||
drawTexturedModalRect(guiLeft + xSize, guiTop, xSize, 0, 256 - xSize - 4, ySize);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, xSize + 4, 0, tooltipWidth - 2 * (256 - xSize - 4), ySize);
|
||||
drawTexturedModalRect(guiLeft + xSize + tooltipWidth - (256 - xSize - 4), guiTop, xSize + 4, 0,
|
||||
256 - xSize - 4, ySize);
|
||||
drawTexturedModalRect(guiLeft + xSizeNoTip, guiTop, xSizeNoTip, 0, 256 - xSizeNoTip - 4, ySize);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, xSizeNoTip + 4, 0, tooltipWidth - 2 * (256 - xSizeNoTip - 4), ySize);
|
||||
drawTexturedModalRect(guiLeft + xSize - (256 - xSizeNoTip - 4), guiTop, xSizeNoTip + 4, 0,
|
||||
256 - xSizeNoTip - 4, ySize);
|
||||
|
||||
ItemStack wand = this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack();
|
||||
|
||||
@@ -115,7 +124,7 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
.bindTexture(discovered ? spell.element.getIcon() : Element.MAGIC.getIcon());
|
||||
|
||||
// Renders the little element icon
|
||||
WizardryUtilities.drawTexturedRect(guiLeft + xSize + 5, guiTop + 34 + 10 * i++, 8, 8);
|
||||
WizardryUtilities.drawTexturedRect(guiLeft + xSizeNoTip + 5, guiTop + 34 + 10 * i++, 8, 8);
|
||||
}
|
||||
|
||||
int x = 0;
|
||||
@@ -129,8 +138,8 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
if(level > 0){
|
||||
ItemStack stack = new ItemStack(item, level);
|
||||
GlStateManager.enableDepth();
|
||||
this.itemRender.renderItemAndEffectIntoGUI(stack, guiLeft + xSize + 6 + x, y);
|
||||
this.itemRender.renderItemOverlayIntoGUI(this.fontRenderer, stack, guiLeft + xSize + 6 + x, y,
|
||||
this.itemRender.renderItemAndEffectIntoGUI(stack, guiLeft + xSizeNoTip + 6 + x, y);
|
||||
this.itemRender.renderItemOverlayIntoGUI(this.fontRenderer, stack, guiLeft + xSizeNoTip + 6 + x, y,
|
||||
null);
|
||||
x += 18;
|
||||
GlStateManager.disableDepth();
|
||||
@@ -143,8 +152,6 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
// Fixes the bug that caused the slot hightlight to render opaque. I don't know why it works, it just works!
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
|
||||
GlStateManager.popAttrib();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,11 +168,11 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
|
||||
ItemStack wand = this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack();
|
||||
|
||||
this.fontRenderer.drawStringWithShadow("\u00A7f" + wand.getDisplayName(), xSize + 6, 6, 0);
|
||||
this.fontRenderer.drawStringWithShadow("\u00A7f" + wand.getDisplayName(), xSizeNoTip + 6, 6, 0);
|
||||
this.fontRenderer.drawStringWithShadow(
|
||||
"\u00A77" + I18n.format("container.wizardry:arcane_workbench.mana") + " "
|
||||
"\u00A77" + I18n.format("container." + Wizardry.MODID + ":arcane_workbench.mana") + " "
|
||||
+ (wand.getMaxDamage() - wand.getItemDamage()) + "/" + wand.getMaxDamage(),
|
||||
xSize + 6, 20, 0);
|
||||
xSizeNoTip + 6, 20, 0);
|
||||
|
||||
Spell[] spells = WandHelper.getSpells(wand);
|
||||
|
||||
@@ -180,10 +187,10 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
}
|
||||
|
||||
if(discovered){
|
||||
this.fontRenderer.drawStringWithShadow(spell.getDisplayNameWithFormatting(), xSize + 16, y, 0);
|
||||
this.fontRenderer.drawStringWithShadow(spell.getDisplayNameWithFormatting(), xSizeNoTip + 16, y, 0);
|
||||
}else{
|
||||
this.mc.standardGalacticFontRenderer.drawStringWithShadow(
|
||||
"\u00A79" + SpellGlyphData.getGlyphName(spell, this.mc.world), xSize + 16, y, 0);
|
||||
"\u00A79" + SpellGlyphData.getGlyphName(spell, this.mc.world), xSizeNoTip + 16, y, 0);
|
||||
}
|
||||
y += 10;
|
||||
}
|
||||
@@ -191,7 +198,7 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
if(WandHelper.getTotalUpgrades(wand) > 0){
|
||||
|
||||
this.fontRenderer.drawStringWithShadow(
|
||||
"\u00A7f" + I18n.format("container.wizardry:arcane_workbench.upgrades"), xSize + 6, y + 6, 0);
|
||||
"\u00A7f" + I18n.format("container." + Wizardry.MODID + ":arcane_workbench.upgrades"), xSizeNoTip + 6, y + 6, 0);
|
||||
|
||||
int x = 0;
|
||||
y = 50 + spells.length * 10;
|
||||
@@ -203,7 +210,7 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
if(level > 0){
|
||||
// The javadoc for isPointInRegion is ambiguous; what it means is that the REGION is
|
||||
// relative to the GUI but the POINT isn't.
|
||||
if(isPointInRegion(xSize + 6 + x, y, 16, 16, mouseX, mouseY)){
|
||||
if(isPointInRegion(xSizeNoTip + 6 + x, y, 16, 16, mouseX, mouseY)){
|
||||
ItemStack stack = new ItemStack(item, level);
|
||||
this.renderToolTip(stack, mouseX - guiLeft, mouseY - guiTop);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package electroblob.wizardry.client;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -11,16 +12,14 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
class GuiButtonApply extends GuiButton {
|
||||
|
||||
public GuiButtonApply(int id, int x, int y){
|
||||
|
||||
super(id, x, y, 32, 16, I18n.format("container.wizardry:arcane_workbench.apply"));
|
||||
super(id, x, y, 32, 16, I18n.format("container." + Wizardry.MODID + ":arcane_workbench.apply"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY){
|
||||
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float partialTicks){
|
||||
|
||||
// Whether the button is highlighted
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width
|
||||
&& mouseY < this.y + this.height;
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
|
||||
int k = 36;
|
||||
int l = 220;
|
||||
|
||||
@@ -9,16 +9,12 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
class GuiButtonInvisible extends GuiButton {
|
||||
|
||||
public GuiButtonInvisible(int id, int x, int y, int width, int height){
|
||||
|
||||
super(id, x, y, width, height, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws this button to the screen.
|
||||
*/
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3){
|
||||
this.hovered = par2 >= this.x && par3 >= this.y && par2 < this.x + this.width
|
||||
&& par3 < this.y + this.height;
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float partialTicks){
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,15 +22,14 @@ class GuiButtonTurnPage extends GuiButton {
|
||||
this.nextPage = isNextPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws this button to the screen.
|
||||
*/
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3){
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float partialTicks){
|
||||
|
||||
if(this.visible){
|
||||
boolean flag = par2 >= this.x && par3 >= this.y && par2 < this.x + this.width
|
||||
&& par3 < this.y + this.height;
|
||||
|
||||
boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
par1Minecraft.getTextureManager().bindTexture(texture);
|
||||
minecraft.getTextureManager().bindTexture(texture);
|
||||
int k = 0;
|
||||
int l = 192;
|
||||
|
||||
|
||||
@@ -19,62 +19,112 @@ public class GuiConfigWizardry extends GuiConfig {
|
||||
|
||||
public GuiConfigWizardry(GuiScreen parent){
|
||||
super(parent, getConfigEntries(), Wizardry.MODID, false, false,
|
||||
Wizardry.NAME + " - " + I18n.format("config.wizardry.title.general"));
|
||||
Wizardry.NAME + " - " + I18n.format("config." + Wizardry.MODID + ".title.general"));
|
||||
// this.titleLine2 = "File location: " + Wizardry.config.getConfigFile().getAbsolutePath();
|
||||
}
|
||||
|
||||
private static List<IConfigElement> getConfigEntries(){
|
||||
|
||||
List<IConfigElement> configList = new ArrayList<IConfigElement>(1);
|
||||
configList.add(new DummyCategoryElement("spellsConfig", "config.wizardry.category." + Settings.SPELLS_CATEGORY,
|
||||
SpellsCategory.class));
|
||||
configList.add(new DummyCategoryElement("resistancesConfig",
|
||||
"config.wizardry.category." + Settings.RESISTANCES_CATEGORY, ResistancesCategory.class));
|
||||
configList.addAll(new ConfigElement(Wizardry.settings.getConfigCategory(Configuration.CATEGORY_GENERAL))
|
||||
.getChildElements());
|
||||
|
||||
configList.add(new DummyCategoryElement("gameplayConfig", "config." + Wizardry.MODID + ".category." + Settings.GAMEPLAY_CATEGORY, GameplayCategory.class));
|
||||
configList.add(new DummyCategoryElement("worldgenConfig", "config." + Wizardry.MODID + ".category." + Settings.WORLDGEN_CATEGORY, WorldgenCategory.class));
|
||||
configList.add(new DummyCategoryElement("commandsConfig", "config." + Wizardry.MODID + ".category." + Settings.COMMANDS_CATEGORY, CommandsCategory.class));
|
||||
configList.add(new DummyCategoryElement("clientConfig", "config." + Wizardry.MODID + ".category." + Settings.CLIENT_CATEGORY, ClientCategory.class));
|
||||
configList.add(new DummyCategoryElement("spellsConfig", "config." + Wizardry.MODID + ".category." + Settings.SPELLS_CATEGORY, SpellsCategory.class));
|
||||
configList.add(new DummyCategoryElement("resistancesConfig", "config." + Wizardry.MODID + ".category." + Settings.RESISTANCES_CATEGORY, ResistancesCategory.class));
|
||||
|
||||
configList.addAll(new ConfigElement(Wizardry.settings.getConfigCategory(Configuration.CATEGORY_GENERAL)).getChildElements());
|
||||
|
||||
return configList;
|
||||
}
|
||||
|
||||
// The reason this system is so convoluted is that it's designed for use with the @Config annotation. The problem is,
|
||||
// I'm not sure whether that will play well with the load phases. Hmmm...
|
||||
|
||||
public static abstract class CategoryBase extends CategoryEntry {
|
||||
|
||||
public CategoryBase(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
/** Spells category of the config gui. This adds a button which opens up the spells category config. */
|
||||
public static class SpellsCategory extends CategoryEntry {
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen(){
|
||||
|
||||
String category = this.getCategory();
|
||||
|
||||
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed.
|
||||
// The parent GuiConfig object's entryList will also be refreshed to reflect the changes.
|
||||
GuiConfig childScreen = new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(Wizardry.settings.getConfigCategory(category))).getChildElements(),
|
||||
this.owningScreen.modID, category, false, false,
|
||||
Wizardry.NAME + " - " + I18n.format("config." + Wizardry.MODID + ".title." + category));
|
||||
|
||||
childScreen.titleLine2 = I18n.format("config." + Wizardry.MODID + ".subtitle." + category);
|
||||
|
||||
return childScreen;
|
||||
}
|
||||
|
||||
protected abstract String getCategory();
|
||||
}
|
||||
|
||||
/** Gameplay category of the config gui. */
|
||||
public static class GameplayCategory extends CategoryBase {
|
||||
|
||||
public GameplayCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.GAMEPLAY_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Spells category of the config gui. */
|
||||
public static class SpellsCategory extends CategoryBase {
|
||||
|
||||
public SpellsCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen(){
|
||||
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed.
|
||||
// The parent GuiConfig object's entryList will also be refreshed to reflect the changes.
|
||||
GuiConfig spellsMenu = new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(Wizardry.settings.getConfigCategory(Settings.SPELLS_CATEGORY)))
|
||||
.getChildElements(),
|
||||
this.owningScreen.modID, Settings.SPELLS_CATEGORY, false, false,
|
||||
Wizardry.NAME + " - " + I18n.format("config.wizardry.title." + Settings.SPELLS_CATEGORY));
|
||||
|
||||
spellsMenu.titleLine2 = I18n.format("config.wizardry.subtitle." + Settings.SPELLS_CATEGORY);
|
||||
|
||||
return spellsMenu;
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.SPELLS_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Resistances category of the config gui. */
|
||||
public static class ResistancesCategory extends CategoryEntry {
|
||||
public static class ResistancesCategory extends CategoryBase {
|
||||
|
||||
public ResistancesCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen(){
|
||||
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed.
|
||||
// The parent GuiConfig object's entryList will also be refreshed to reflect the changes.
|
||||
GuiConfig idsMenu = new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(Wizardry.settings.getConfigCategory(Settings.RESISTANCES_CATEGORY)))
|
||||
.getChildElements(),
|
||||
this.owningScreen.modID, Settings.RESISTANCES_CATEGORY, false, false,
|
||||
Wizardry.NAME + " - " + I18n.format("config.wizardry.title." + Settings.RESISTANCES_CATEGORY));
|
||||
|
||||
idsMenu.titleLine2 = I18n.format("config.wizardry.subtitle." + Settings.RESISTANCES_CATEGORY);
|
||||
|
||||
return idsMenu;
|
||||
|
||||
@Override protected String getCategory() { return Settings.RESISTANCES_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Worldgen category of the config gui. */
|
||||
public static class WorldgenCategory extends CategoryBase {
|
||||
|
||||
public WorldgenCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.WORLDGEN_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Client category of the config gui. */
|
||||
public static class ClientCategory extends CategoryBase {
|
||||
|
||||
public ClientCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.CLIENT_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Commands category of the config gui. */
|
||||
public static class CommandsCategory extends CategoryBase {
|
||||
|
||||
public CommandsCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.COMMANDS_CATEGORY; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,8 +122,6 @@ public class GuiSpellDisplay extends Gui {
|
||||
|
||||
}else if(event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR){
|
||||
|
||||
GlStateManager.pushAttrib();
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color(1, 1, 1);
|
||||
@@ -135,19 +133,19 @@ public class GuiSpellDisplay extends Gui {
|
||||
|
||||
// Cooldown bar
|
||||
if(cooldown > 0){
|
||||
this.drawTexturedModalRect(mirror ? left + 5 : left + 41, height - 8, 128, 6, 82, 6);
|
||||
this.drawTexturedModalRect(mirror ? left + 5 : left + 41, top + 28, 128, 6, 82, 6);
|
||||
|
||||
int l = (int)(((double)(spell.cooldown * cooldownMultiplier - cooldown) / (double)(spell.cooldown * cooldownMultiplier)) * 82);
|
||||
|
||||
this.drawTexturedModalRect(mirror ? left + 5 : left + 41, height - 8, 128, 0, l, 6);
|
||||
this.drawTexturedModalRect(mirror ? left + 5 : left + 41, top + 28, 128, 0, l, 6);
|
||||
}
|
||||
|
||||
// Spell illustration
|
||||
this.mc.renderEngine.bindTexture(discovered ? spell.getIcon() : Spells.none.getIcon());
|
||||
|
||||
WizardryUtilities.drawTexturedRect(mirror ? left + 94 : left + 2, top + 2, 0, 0, 32, 32, 32, 32);
|
||||
|
||||
GlStateManager.popAttrib();
|
||||
|
||||
// Blend needs to be left enabled here because otherwise the hotbar becomes opaque
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ package electroblob.wizardry.client;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.Charsets;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -22,10 +22,10 @@ import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -46,15 +46,11 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
// I think this is actually ever-so-slightly lighter than pure black, but the difference is unnoticeable.
|
||||
private static final int BLACK = 1;
|
||||
|
||||
public static final ResourceLocation regularHandbook = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/handbook.png");
|
||||
public static final ResourceLocation regularHandbook = new ResourceLocation(Wizardry.MODID, "textures/gui/handbook.png");
|
||||
public static final ResourceLocation ore = new ResourceLocation(Wizardry.MODID, "textures/gui/ore_picture.png");
|
||||
public static final ResourceLocation crystal = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/items/magic_crystal.png");
|
||||
public static final ResourceLocation workbenchGui = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/arcane_workbench.png");
|
||||
public static final ResourceLocation craftingGrids = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/handbook_recipes.png");
|
||||
public static final ResourceLocation crystal = new ResourceLocation(Wizardry.MODID, "textures/items/magic_crystal.png");
|
||||
public static final ResourceLocation workbenchGui = new ResourceLocation(Wizardry.MODID, "textures/gui/arcane_workbench.png");
|
||||
public static final ResourceLocation craftingGrids = new ResourceLocation(Wizardry.MODID, "textures/gui/handbook_recipes.png");
|
||||
|
||||
private List<ArrayList<String>> text;
|
||||
private List<Section> sections;
|
||||
@@ -186,7 +182,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GlStateManager.enableColorMaterial();
|
||||
GlStateManager.enableLighting();
|
||||
itemRender.zLevel = 100.0F;
|
||||
|
||||
@@ -208,7 +204,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableLighting();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.enableDepth();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
}
|
||||
@@ -223,7 +219,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GlStateManager.enableColorMaterial();
|
||||
itemRender.zLevel = 0.0F;
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
@@ -243,7 +239,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableLighting();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.enableDepth();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
}
|
||||
@@ -267,30 +263,30 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
BufferedReader bufferedreader = null;
|
||||
|
||||
String textFilepath = "wizardry:texts/handbook_"
|
||||
String textFilepath = Wizardry.MODID + ":texts/handbook_"
|
||||
+ Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode() + ".txt";
|
||||
|
||||
try{
|
||||
|
||||
bufferedreader = new BufferedReader(new InputStreamReader(
|
||||
this.mc.getResourceManager().getResource(new ResourceLocation(textFilepath)).getInputStream(),
|
||||
Charsets.UTF_8));
|
||||
StandardCharsets.UTF_8));
|
||||
|
||||
}catch (IOException e){
|
||||
|
||||
Wizardry.logger.info(
|
||||
"Wizard handbook text file missing for the current language. Using default (English - US) instead.");
|
||||
|
||||
textFilepath = "wizardry:texts/handbook_en_US.txt";
|
||||
textFilepath = Wizardry.MODID + ":texts/handbook_en_us.txt";
|
||||
|
||||
try {
|
||||
|
||||
bufferedreader = new BufferedReader(new InputStreamReader(
|
||||
this.mc.getResourceManager().getResource(new ResourceLocation(textFilepath)).getInputStream(),
|
||||
Charsets.UTF_8));
|
||||
StandardCharsets.UTF_8));
|
||||
|
||||
} catch (IOException x){
|
||||
Wizardry.logger.error("Couldn't find file: wizardry:assets/texts/handbook_en_US.txt. The file may be"
|
||||
Wizardry.logger.error("Couldn't find file: " + Wizardry.MODID + "/assets/texts/handbook_en_us.txt. The file may be"
|
||||
+ "missing; please try re-downloading and reinstalling Wizardry.", x);
|
||||
}
|
||||
}
|
||||
@@ -349,8 +345,8 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
}else{
|
||||
|
||||
paragraph = paragraph.replaceAll("NEXT_SPELL_KEY", Keyboard.getKeyName(ClientProxy.NEXT_SPELL.getKeyCode()));
|
||||
paragraph = paragraph.replaceAll("PREVIOUS_SPELL_KEY", Keyboard.getKeyName(ClientProxy.PREVIOUS_SPELL.getKeyCode()));
|
||||
paragraph = paragraph.replaceAll("NEXT_SPELL_KEY", ClientProxy.NEXT_SPELL.getDisplayName());
|
||||
paragraph = paragraph.replaceAll("PREVIOUS_SPELL_KEY", ClientProxy.PREVIOUS_SPELL.getDisplayName());
|
||||
paragraph = paragraph.replaceAll("MANA_PER_CRYSTAL_MINUS_30", "" + (Constants.MANA_PER_CRYSTAL - 30));
|
||||
paragraph = paragraph.replaceAll("MANA_PER_CRYSTAL", "" + Constants.MANA_PER_CRYSTAL);
|
||||
paragraph = paragraph.replaceAll("BASIC_MAX_CHARGE", "" + Tier.BASIC.maxCharge);
|
||||
@@ -369,7 +365,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
paragraph = paragraph.replaceAll("SORCERY_COLOUR", Element.SORCERY.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("HEALING_COLOUR", Element.HEALING.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("RESET_COLOUR", "\u00A70");
|
||||
paragraph = paragraph.replaceAll("MCVERSION", "1.11.2");
|
||||
paragraph = paragraph.replaceAll("MCVERSION", "1.12.2");
|
||||
paragraph = paragraph.replaceAll("VERSION", Wizardry.VERSION);
|
||||
|
||||
int linesInParagraph = this.fontRenderer
|
||||
@@ -427,7 +423,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
}catch (IOException e){
|
||||
Wizardry.logger.error("Something went wrong reading file: " + textFilepath
|
||||
+ ". The file may be damaged;" + "please try re-downloading and reinstalling wizardry.", e);
|
||||
+ ". The file may be damaged; please try re-downloading and reinstalling wizardry.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -530,7 +526,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
int height){
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos((x), y + finalHeight, 0).tex(u, v + height).endVertex();
|
||||
buffer.pos(x + finalWidth, y + finalHeight, 0).tex(u + width, v + height).endVertex();
|
||||
@@ -663,51 +659,36 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingGrid.get(2).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_boots);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
if(Wizardry.settings.useAlternateScrollRecipe){
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.PAPER));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.STRING));
|
||||
craftingGrid.get(2).set(0, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingResult = new ItemStack(WizardryItems.blank_scroll);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
}else{
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.PAPER));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.STRING));
|
||||
craftingResult = new ItemStack(WizardryItems.blank_scroll);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
}
|
||||
|
||||
if(Wizardry.settings.firebombIsCraftable){
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.BLAZE_POWDER));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.BLAZE_POWDER));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GUNPOWDER));
|
||||
craftingResult = new ItemStack(WizardryItems.firebomb, 3);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
}
|
||||
|
||||
if(Wizardry.settings.poisonBombIsCraftable){
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.SPIDER_EYE));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.SPIDER_EYE));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GUNPOWDER));
|
||||
craftingResult = new ItemStack(WizardryItems.poison_bomb, 3);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
}
|
||||
|
||||
if(Wizardry.settings.smokeBombIsCraftable){
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.COAL));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.COAL));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GUNPOWDER));
|
||||
craftingResult = new ItemStack(WizardryItems.smoke_bomb, 3);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
}
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.PAPER));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.STRING));
|
||||
craftingResult = new ItemStack(WizardryItems.blank_scroll);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.BLAZE_POWDER));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.BLAZE_POWDER));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GUNPOWDER));
|
||||
craftingResult = new ItemStack(WizardryItems.firebomb, 3);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.SPIDER_EYE));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.SPIDER_EYE));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GUNPOWDER));
|
||||
craftingResult = new ItemStack(WizardryItems.poison_bomb, 3);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.COAL));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.COAL));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GUNPOWDER));
|
||||
craftingResult = new ItemStack(WizardryItems.smoke_bomb, 3);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import electroblob.wizardry.item.ItemSpectralBow;
|
||||
import electroblob.wizardry.item.ItemWand;
|
||||
import electroblob.wizardry.packet.PacketControlInput;
|
||||
import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.spell.Flight;
|
||||
import electroblob.wizardry.spell.ShadowWard;
|
||||
@@ -17,19 +18,26 @@ import electroblob.wizardry.tileentity.ContainerArcaneWorkbench;
|
||||
import electroblob.wizardry.util.WandHelper;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiMerchant;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.village.MerchantRecipe;
|
||||
import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
import net.minecraftforge.client.event.GuiContainerEvent;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderLivingEvent;
|
||||
@@ -40,6 +48,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Event handler responsible for all client-side only events, mostly rendering.
|
||||
@@ -47,6 +56,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
* @author Electroblob
|
||||
* @since Wizardry 1.0
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Mod.EventBusSubscriber(Side.CLIENT)
|
||||
public final class WizardryClientEventHandler {
|
||||
|
||||
@@ -115,6 +125,60 @@ public final class WizardryClientEventHandler {
|
||||
event.setNewfov(event.getFov() * 1.0F - maxUseSeconds * 0.15F);
|
||||
}
|
||||
}
|
||||
|
||||
// Brute-force fix for crystals not showing up when a wizard is given a spell book in the trade GUI.
|
||||
@SubscribeEvent
|
||||
public static void onGuiDrawForegroundEvent(GuiContainerEvent.DrawForeground event){
|
||||
|
||||
if(event.getGuiContainer() instanceof GuiMerchant){
|
||||
|
||||
GuiMerchant gui = (GuiMerchant)event.getGuiContainer();
|
||||
// Note that gui.getMerchant() returns an NpcMerchant, not an EntityWizard.
|
||||
|
||||
// Using == the specific item rather than instanceof because that's how trades do it.
|
||||
if(gui.inventorySlots.getSlot(0).getStack().getItem() == WizardryItems.spell_book
|
||||
|| gui.inventorySlots.getSlot(1).getStack().getItem() == WizardryItems.spell_book){
|
||||
|
||||
for(MerchantRecipe trade : gui.getMerchant().getRecipes(Minecraft.getMinecraft().player)){
|
||||
if(trade.getItemToBuy().getItem() == WizardryItems.spell_book && trade.getSecondItemToBuy().isEmpty()){
|
||||
Slot slot = gui.inventorySlots.getSlot(2);
|
||||
// Uses reflection to draw the itemstack
|
||||
// It still doesn't look quite right because the slot highlight is behind the item, but it'll do
|
||||
// until/unless I find a better solution.
|
||||
renderItemAndTooltip(gui, trade.getItemToSell(), slot.xPos, slot.yPos, event.getMouseX(), event.getMouseY(),
|
||||
gui.getSlotUnderMouse() == slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderItemAndTooltip(GuiContainer gui, ItemStack stack, int x, int y, int mouseX, int mouseY, boolean tooltip){
|
||||
|
||||
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableColorMaterial();
|
||||
GlStateManager.enableLighting();
|
||||
renderItem.zLevel = 100.0F;
|
||||
|
||||
if(!stack.isEmpty()){
|
||||
renderItem.renderItemAndEffectIntoGUI(stack, x, y);
|
||||
renderItem.renderItemOverlays(Minecraft.getMinecraft().fontRenderer, stack, x, y);
|
||||
|
||||
if(tooltip){
|
||||
gui.drawHoveringText(gui.getItemToolTip(stack), mouseX + gui.getXSize()/2 - gui.width/2,
|
||||
mouseY + gui.getYSize()/2 - gui.height/2);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
// Third person
|
||||
@SubscribeEvent
|
||||
@@ -153,7 +217,7 @@ public final class WizardryClientEventHandler {
|
||||
&& rayTrace.entityHit == event.getEntity() && properties != null && properties.selectedMinion != null){
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -161,7 +225,7 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
// Disabling depth test allows it to be seen through everything.
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
|
||||
GlStateManager.translate(event.getX(), event.getY() + event.getEntity().height + 0.5, event.getZ());
|
||||
@@ -185,7 +249,7 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.enableLighting();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.enableDepth();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
@@ -194,7 +258,7 @@ public final class WizardryClientEventHandler {
|
||||
if(properties != null && properties.selectedMinion != null && properties.selectedMinion.get() == event.getEntity()){
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -202,7 +266,7 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
// Disabling depth test allows it to be seen through everything.
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
|
||||
GlStateManager.translate(event.getX(), event.getY() + event.getEntity().height + 0.5, event.getZ());
|
||||
@@ -226,18 +290,18 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.enableLighting();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.enableDepth();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
// Sixth sense
|
||||
if(mc.player.isPotionActive(WizardryPotions.sixth_sense) && !(event.getEntity() instanceof EntityArmorStand) && event.getEntity() != mc.player
|
||||
&& mc.player.getActivePotionEffect(WizardryPotions.sixth_sense) != null && event.getEntity().getDistanceToEntity(mc.player) < 20
|
||||
&& mc.player.getActivePotionEffect(WizardryPotions.sixth_sense) != null && event.getEntity().getDistance(mc.player) < 20
|
||||
* (1 + mc.player.getActivePotionEffect(WizardryPotions.sixth_sense).getAmplifier() * Constants.RANGE_INCREASE_PER_LEVEL)){
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -247,7 +311,7 @@ public final class WizardryClientEventHandler {
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
// Disabling depth test allows it to be seen through everything.
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
GlStateManager.translate(event.getX(), event.getY() + event.getEntity().height * 0.6, event.getZ());
|
||||
|
||||
@@ -271,7 +335,7 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.enableDepth();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
@@ -285,15 +349,15 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.depthMask(false);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableAlpha();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(sixthSenseOverlayTexture);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos(0.0D, (double)event.getResolution().getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex();
|
||||
@@ -303,8 +367,8 @@ public final class WizardryClientEventHandler {
|
||||
buffer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@@ -315,15 +379,15 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.depthMask(false);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableAlpha();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(frostOverlayTexture);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos(0.0D, (double)event.getResolution().getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex();
|
||||
@@ -333,8 +397,8 @@ public final class WizardryClientEventHandler {
|
||||
buffer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@@ -371,7 +435,7 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.scale(1.1, 1.1, 1.1);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
|
||||
@@ -421,7 +485,7 @@ public final class WizardryClientEventHandler {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(shadowWardTexture);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.translate(0, 1.2, 0);
|
||||
GlStateManager.rotate(entityplayer.world.getWorldTime() * -2, 0, 0, 1);
|
||||
@@ -472,7 +536,7 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(wingTexture);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -615,7 +679,7 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
private static void renderShield(Tessellator tessellator){
|
||||
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
double widthOuter = 0.6d;
|
||||
double heightOuter = 0.7d;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package electroblob.wizardry.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelWizardArmour extends ModelBiped {
|
||||
public class ModelWizardArmour extends ModelWtfMojang {
|
||||
ModelRenderer Shape1;
|
||||
ModelRenderer Shape2;
|
||||
ModelRenderer Shape3;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package electroblob.wizardry.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
|
||||
public class ModelWtfMojang extends ModelBiped {
|
||||
|
||||
public ModelWtfMojang(float modelSize, float rotationYOffset, int textureWidth, int textureHeight) {
|
||||
super(modelSize, rotationYOffset, textureWidth, textureHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
|
||||
// [VanillaCopy] ModelArmorStandArmor
|
||||
// this prevents helmets from always facing south, and the armor "breathing" on the stand
|
||||
if (entityIn instanceof EntityArmorStand) {
|
||||
EntityArmorStand entityarmorstand = (EntityArmorStand) entityIn;
|
||||
this.bipedHead.rotateAngleX = 0.017453292F * entityarmorstand.getHeadRotation().getX();
|
||||
this.bipedHead.rotateAngleY = 0.017453292F * entityarmorstand.getHeadRotation().getY();
|
||||
this.bipedHead.rotateAngleZ = 0.017453292F * entityarmorstand.getHeadRotation().getZ();
|
||||
this.bipedHead.setRotationPoint(0.0F, 1.0F, 0.0F);
|
||||
this.bipedBody.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
|
||||
this.bipedBody.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
|
||||
this.bipedBody.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
|
||||
this.bipedLeftArm.rotateAngleX = 0.017453292F * entityarmorstand.getLeftArmRotation().getX();
|
||||
this.bipedLeftArm.rotateAngleY = 0.017453292F * entityarmorstand.getLeftArmRotation().getY();
|
||||
this.bipedLeftArm.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftArmRotation().getZ();
|
||||
this.bipedRightArm.rotateAngleX = 0.017453292F * entityarmorstand.getRightArmRotation().getX();
|
||||
this.bipedRightArm.rotateAngleY = 0.017453292F * entityarmorstand.getRightArmRotation().getY();
|
||||
this.bipedRightArm.rotateAngleZ = 0.017453292F * entityarmorstand.getRightArmRotation().getZ();
|
||||
this.bipedLeftLeg.rotateAngleX = 0.017453292F * entityarmorstand.getLeftLegRotation().getX();
|
||||
this.bipedLeftLeg.rotateAngleY = 0.017453292F * entityarmorstand.getLeftLegRotation().getY();
|
||||
this.bipedLeftLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftLegRotation().getZ();
|
||||
this.bipedLeftLeg.setRotationPoint(1.9F, 11.0F, 0.0F);
|
||||
this.bipedRightLeg.rotateAngleX = 0.017453292F * entityarmorstand.getRightLegRotation().getX();
|
||||
this.bipedRightLeg.rotateAngleY = 0.017453292F * entityarmorstand.getRightLegRotation().getY();
|
||||
this.bipedRightLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getRightLegRotation().getZ();
|
||||
this.bipedRightLeg.setRotationPoint(-1.9F, 11.0F, 0.0F);
|
||||
copyModelAngles(this.bipedHead, this.bipedHeadwear);
|
||||
} else super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public final class WizardryItemModels {
|
||||
|
||||
if(item.getHasSubtypes()){
|
||||
NonNullList<ItemStack> items = NonNullList.create();
|
||||
item.getSubItems(item, null, items); // Client-only method, but we're client-side so this is OK.
|
||||
item.getSubItems(item.getCreativeTab(), items); // Client-only method, but we're client-side so this is OK.
|
||||
for(ItemStack stack : items){
|
||||
ModelLoader.setCustomModelResourceLocation(item, stack.getMetadata(),
|
||||
new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
|
||||
@@ -4,11 +4,11 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -139,11 +139,10 @@ public abstract class ParticleCustomTexture extends Particle {
|
||||
// Overridden to bind the new texture. I think this can be done with TextureAtlasSprite, but this works as it is
|
||||
// so I'm not changing it for the time being.
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer buffer, Entity viewer, float partialTicks, float rotationX, float rotationZ,
|
||||
public void renderParticle(BufferBuilder buffer, Entity viewer, float partialTicks, float rotationX, float rotationZ,
|
||||
float rotationYZ, float rotationXY, float rotationXZ){
|
||||
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.pushAttrib();
|
||||
|
||||
this.applyGLStateChanges();
|
||||
|
||||
@@ -193,7 +192,6 @@ public abstract class ParticleCustomTexture extends Particle {
|
||||
|
||||
this.undoGLStateChanges();
|
||||
|
||||
GlStateManager.popAttrib();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package electroblob.wizardry.client.particle;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -28,7 +28,7 @@ public class ParticleDarkMagic extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer buffer, Entity entity, float partialTicks, float rotationX, float rotationZ,
|
||||
public void renderParticle(BufferBuilder buffer, Entity entity, float partialTicks, float rotationX, float rotationZ,
|
||||
float rotationYZ, float rotationXY, float rotationXZ){
|
||||
float f6 = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package electroblob.wizardry.client.particle;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -32,7 +32,7 @@ public class ParticleMagicFlame extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer buffer, Entity entity, float partialTicks, float rotationX, float rotationZ,
|
||||
public void renderParticle(BufferBuilder buffer, Entity entity, float partialTicks, float rotationX, float rotationZ,
|
||||
float rotationYZ, float rotationXY, float rotationXZ){
|
||||
float f6 = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
|
||||
this.particleScale = this.flameScale * (1.0F - f6 * f6 * 0.5F);
|
||||
|
||||
@@ -4,10 +4,10 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.entity.EntityArc;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -38,7 +38,7 @@ public class RenderArc extends Render<EntityArc> {
|
||||
// System.out.println("doRender parameters: " + d0 + ", " + d1 + ", " + d2 + ", " + fa + ", " + fb);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
bindTexture(textures[arc.textureIndex]); // This MUST be after the tessellator declaration and the gl stuff
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.tileentity.ContainerArcaneWorkbench;
|
||||
import electroblob.wizardry.tileentity.TileEntityArcaneWorkbench;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -18,16 +18,13 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderArcaneWorkbench extends TileEntitySpecialRenderer<TileEntityArcaneWorkbench> {
|
||||
|
||||
private static final ResourceLocation runeTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/rune.png");
|
||||
private static final ResourceLocation runeTexture = new ResourceLocation(Wizardry.MODID, "textures/entity/rune.png");
|
||||
|
||||
public RenderArcaneWorkbench(){
|
||||
}
|
||||
public RenderArcaneWorkbench(){}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityArcaneWorkbench tileentity, double x, double y, double z,
|
||||
float partialTicks, int destroyStage){
|
||||
|
||||
public void render(TileEntityArcaneWorkbench tileentity, double x, double y, double z, float partialTicks, int destroyStage, float alpha){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
// This line makes stuff render in the same place relative to the world wherever the player is.
|
||||
GlStateManager.translate((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
|
||||
@@ -54,12 +51,11 @@ public class RenderArcaneWorkbench extends TileEntitySpecialRenderer<TileEntityA
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // This line fixes the weird
|
||||
// brightness bug.
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // This line fixes the weird brightness bug.
|
||||
GlStateManager.rotate(tileentity.timer, 0.0f, 1.0f, 0.0f);
|
||||
GlStateManager.translate(0.0f, 0.65f, 0.0f);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
bindTexture(runeTexture);
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
@@ -86,14 +82,13 @@ public class RenderArcaneWorkbench extends TileEntitySpecialRenderer<TileEntityA
|
||||
if(!stack.isEmpty()){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
//GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
GlStateManager.rotate(180, 0, 1, 0);
|
||||
// View angle is negated because of the 180 flip.
|
||||
GlStateManager.rotate((float)(-viewAngle - 90f), 0, 0, 1);
|
||||
GlStateManager.rotate((float)(viewAngle - 90f), 0, 0, 1);
|
||||
// Does the floaty thing
|
||||
GlStateManager.translate(0.0F, 0.0F, (float)tileentity.yOffset / 5000.0F - 0.55f);
|
||||
GlStateManager.translate(0.0F, 0.0F, (float)tileentity.yOffset / 5000.0F + 0.55f);
|
||||
GlStateManager.scale(0.75F, 0.75F, 0.75F);
|
||||
// This is what the item frame uses so it's definitely what we want.
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(stack, TransformType.FIXED);
|
||||
|
||||
@@ -8,11 +8,11 @@ import org.lwjgl.opengl.GL11;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.entity.construct.EntityBlackHole;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -48,7 +48,7 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
// float yaw = (float) Math.toDegrees(Math.atan(x/z));
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.entity.construct.EntityBubble;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -49,7 +49,7 @@ public class RenderBubble extends Render<EntityBubble> {
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
}else{
|
||||
int j = entity.getBrightnessForRender(par9);
|
||||
int j = entity.getBrightnessForRender();
|
||||
int k = j % 65536;
|
||||
int l = j / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
|
||||
@@ -70,7 +70,7 @@ public class RenderBubble extends Render<EntityBubble> {
|
||||
double pixelwidth = (1.0d / 128);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
// tessellator.setColorRGBA_I(k1, 128);
|
||||
// buffer.normal(0.0F, 1.0F, 0.0F);
|
||||
|
||||
@@ -4,10 +4,10 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.entity.construct.EntityDecay;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -49,7 +49,7 @@ public class RenderDecay extends Render<EntityDecay> {
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
// tessellator.setColorRGBA_I(k1, 128);
|
||||
// buffer.normal(0.0F, 1.0F, 0.0F);
|
||||
|
||||
@@ -4,10 +4,10 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.entity.construct.EntityFireRing;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -50,7 +50,7 @@ public class RenderFireRing extends Render<EntityFireRing> {
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.01).tex(0, 1).endVertex();
|
||||
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.01).tex(1, 1).endVertex();
|
||||
|
||||
@@ -4,10 +4,10 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.entity.projectile.EntityForceArrow;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -44,7 +44,7 @@ public class RenderForceArrow extends Render<EntityForceArrow> {
|
||||
0.0F, 1.0F);
|
||||
GlStateManager.rotate(180, 0, 1, 0);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
float pixel = 1.0f / 32.0f;
|
||||
float u1 = 0.0f;
|
||||
float u2 = pixel * 14;
|
||||
|
||||
@@ -4,10 +4,10 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.entity.construct.EntityIceSpike;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -32,7 +32,7 @@ public class RenderIceSpike extends Render<EntityIceSpike> {
|
||||
// with setLightmapTextureCoords.
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
int j = entity.getBrightnessForRender(partialTickTime);
|
||||
int j = entity.getBrightnessForRender();
|
||||
int k = j % 65536;
|
||||
int l = j / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
|
||||
@@ -40,7 +40,7 @@ public class RenderIceSpike extends Render<EntityIceSpike> {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
bindTexture(texture);
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ package electroblob.wizardry.client.renderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.entity.projectile.EntityLightningDisc;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -48,7 +48,7 @@ public class RenderLightningDisc extends Render<EntityLightningDisc> {
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
// tessellator.setColorRGBA_I(k1, 128);
|
||||
// buffer.normal(0.0F, 1.0F, 0.0F);
|
||||
|
||||
@@ -4,10 +4,10 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.entity.construct.EntityLightningPulse;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -49,7 +49,7 @@ public class RenderLightningPulse extends Render<EntityLightningPulse> {
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.01).tex(0, 1).endVertex();
|
||||
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.01).tex(1, 1).endVertex();
|
||||
|
||||
@@ -3,10 +3,10 @@ package electroblob.wizardry.client.renderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.entity.projectile.EntityMagicArrow;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -55,7 +55,7 @@ public class RenderMagicArrow extends Render<EntityMagicArrow> {
|
||||
GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, 0.0F,
|
||||
0.0F, 1.0F);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
float f2 = 0.0F;
|
||||
float f3 = pixelsLong / 32.0F;
|
||||
float f4 = 0.0F;
|
||||
|
||||
@@ -5,11 +5,11 @@ import org.lwjgl.opengl.GL11;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.tileentity.TileEntityMagicLight;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -22,8 +22,8 @@ public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicL
|
||||
"textures/entity/light_aura.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityMagicLight tileentity, double x, double y, double z, float f,
|
||||
int destroyStage){
|
||||
public void render(TileEntityMagicLight tileentity, double x, double y, double z, float f,
|
||||
int destroyStage, float alpha){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicL
|
||||
GlStateManager.scale((float)tileentity.timer / 10, (float)tileentity.timer / 10,
|
||||
(float)tileentity.timer / 10);
|
||||
}
|
||||
if(tileentity.timer > tileentity.maxTimer - 10){
|
||||
if(tileentity.timer > tileentity.maxTimer - 10 && tileentity.timer <= tileentity.maxTimer){
|
||||
GlStateManager.scale((float)(tileentity.maxTimer - tileentity.timer) / 10,
|
||||
(float)(tileentity.maxTimer - tileentity.timer) / 10,
|
||||
(float)(tileentity.maxTimer - tileentity.timer) / 10);
|
||||
@@ -49,7 +49,7 @@ public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicL
|
||||
// Renders the aura effect
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.entity.projectile.EntityMagicProjectile;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -48,7 +48,7 @@ public class RenderProjectile extends Render<EntityMagicProjectile> {
|
||||
GlStateManager.scale(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
|
||||
float f3 = 0.0f;
|
||||
float f4 = 1.0f;
|
||||
|
||||
@@ -6,10 +6,10 @@ import electroblob.wizardry.entity.construct.EntityHealAura;
|
||||
import electroblob.wizardry.entity.construct.EntityMagicConstruct;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -64,7 +64,7 @@ public class RenderSigil extends Render<EntityMagicConstruct> {
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
// tessellator.setColorRGBA_I(k1, 128);
|
||||
// buffer.normal(0.0F, 1.0F, 0.0F);
|
||||
|
||||
@@ -13,8 +13,8 @@ public class RenderStatue extends TileEntitySpecialRenderer<TileEntityStatue> {
|
||||
private int destroyStage = 0; // Gets set each time a statue is rendered to allow access from the layer renderer
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityStatue statue, double x, double y, double z, float partialTicks,
|
||||
int destroyStage){
|
||||
public void render(TileEntityStatue statue, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, float alpha){
|
||||
|
||||
// Multiblock support for the breaking animation. The chest has its own way of doing this in
|
||||
// TileEntityRendererDispatcher, but I don't have access to that.
|
||||
@@ -24,8 +24,8 @@ public class RenderStatue extends TileEntitySpecialRenderer<TileEntityStatue> {
|
||||
if(tileentity instanceof TileEntityStatue){
|
||||
// If this is the block breaking animation pass and this isn't the bottom block, divert the call to
|
||||
// the bottom block.
|
||||
this.renderTileEntityAt((TileEntityStatue)tileentity, x, y - (statue.position - 1), z, partialTicks,
|
||||
destroyStage);
|
||||
this.render((TileEntityStatue)tileentity, x, y - (statue.position - 1), z, partialTicks,
|
||||
destroyStage, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RenderStatue extends TileEntitySpecialRenderer<TileEntityStatue> {
|
||||
GlStateManager.enableLighting();
|
||||
|
||||
float yaw = statue.creature.prevRotationYaw;
|
||||
int i = statue.creature.getBrightnessForRender(0);
|
||||
int i = statue.creature.getBrightnessForRender();
|
||||
|
||||
int j = i % 65536;
|
||||
int k = i / 65536;
|
||||
@@ -51,7 +51,7 @@ public class RenderStatue extends TileEntitySpecialRenderer<TileEntityStatue> {
|
||||
if(!statue.isIce) statue.creature.setInvisible(true);
|
||||
// Setting the last parameter to true prevents the debug bounding box from rendering.
|
||||
// For some reason, passing in the partialTicks causes the entity to spin round really fast
|
||||
Minecraft.getMinecraft().getRenderManager().doRenderEntity(statue.creature, 0, 0, 0, 0, 0, true);
|
||||
Minecraft.getMinecraft().getRenderManager().renderEntity(statue.creature, 0, 0, 0, 0, 0, true);
|
||||
if(!statue.isIce) statue.creature.setInvisible(false);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
@@ -46,8 +46,8 @@ public class CommandCastSpell extends CommandBase {
|
||||
public String getUsage(ICommandSender sender){
|
||||
// Not ideal, but the way this is implemented means I have no choice. Only used in the help command, so in there
|
||||
// the custom command name will not display.
|
||||
return "commands.wizardry:cast.usage";
|
||||
// return I18n.format("commands.wizardry:cast.usage", Wizardry.settings.castCommandName);
|
||||
return "commands." + Wizardry.MODID + ":cast.usage";
|
||||
// return I18n.format("commands." + Wizardry.MODID + ":cast.usage", Wizardry.settings.castCommandName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +66,7 @@ public class CommandCastSpell extends CommandBase {
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] arguments) throws CommandException{
|
||||
|
||||
if(arguments.length < 1){
|
||||
throw new WrongUsageException("commands.wizardry:cast.usage", Wizardry.settings.castCommandName);
|
||||
throw new WrongUsageException("commands." + Wizardry.MODID + ":cast.usage", Wizardry.settings.castCommandName);
|
||||
}else{
|
||||
|
||||
// ===== Parameter retrieval =====
|
||||
@@ -85,7 +85,7 @@ public class CommandCastSpell extends CommandBase {
|
||||
Spell spell = Spell.get(arguments[i++]);
|
||||
|
||||
if(spell == null){
|
||||
throw new NumberInvalidException("commands.wizardry:cast.not_found", new Object[]{arguments[i - 1]});
|
||||
throw new NumberInvalidException("commands." + Wizardry.MODID + ":cast.not_found", new Object[]{arguments[i - 1]});
|
||||
}
|
||||
|
||||
boolean castAsOtherPlayer = false;
|
||||
@@ -120,7 +120,7 @@ public class CommandCastSpell extends CommandBase {
|
||||
try{
|
||||
modifiers = SpellModifiers.fromNBT(JsonToNBT.getTagFromJson(nbt));
|
||||
}catch (NBTException nbtexception){
|
||||
throw new CommandException("commands.wizardry:cast.tag_error", nbtexception.getMessage());
|
||||
throw new CommandException("commands." + Wizardry.MODID + ":cast.tag_error", nbtexception.getMessage());
|
||||
}
|
||||
|
||||
for(float multiplier : modifiers.getModifiers().values()){
|
||||
@@ -157,10 +157,10 @@ public class CommandCastSpell extends CommandBase {
|
||||
|
||||
if(castAsOtherPlayer){
|
||||
sender.sendMessage(
|
||||
new TextComponentTranslation("commands.wizardry:cast.success_remote_continuous",
|
||||
new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.success_remote_continuous",
|
||||
spell.getNameForTranslationFormatted(), caster.getName()));
|
||||
}else{
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:cast.success_continuous",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.success_continuous",
|
||||
spell.getNameForTranslationFormatted()));
|
||||
}
|
||||
}
|
||||
@@ -183,10 +183,10 @@ public class CommandCastSpell extends CommandBase {
|
||||
}
|
||||
|
||||
if(castAsOtherPlayer){
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:cast.success_remote",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.success_remote",
|
||||
spell.getNameForTranslationFormatted(), caster.getName()));
|
||||
}else{
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:cast.success",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.success",
|
||||
spell.getNameForTranslationFormatted()));
|
||||
}
|
||||
return;
|
||||
@@ -199,7 +199,7 @@ public class CommandCastSpell extends CommandBase {
|
||||
|
||||
/** Displays the "Unable to cast [spell]" message in the chat. */
|
||||
private void displayFailMessage(ICommandSender sender, Spell spell){
|
||||
ITextComponent message = new TextComponentTranslation("commands.wizardry:cast.fail",
|
||||
ITextComponent message = new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.fail",
|
||||
spell.getNameForTranslationFormatted());
|
||||
message.getStyle().setColor(TextFormatting.RED);
|
||||
sender.sendMessage(message);
|
||||
|
||||
@@ -41,8 +41,8 @@ public class CommandDiscoverSpell extends CommandBase {
|
||||
public String getUsage(ICommandSender sender){
|
||||
// Not ideal, but the way this is implemented means I have no choice. Only used in the help command, so in there
|
||||
// the custom command name will not display.
|
||||
return "commands.wizardry:discoverspell.usage";
|
||||
// return I18n.format("commands.wizardry:discoverspell.usage", Wizardry.settings.discoverspellCommandName);
|
||||
return "commands." + Wizardry.MODID + ":discoverspell.usage";
|
||||
// return I18n.format("commands." + Wizardry.MODID + ":discoverspell.usage", Wizardry.settings.discoverspellCommandName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +61,7 @@ public class CommandDiscoverSpell extends CommandBase {
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] arguments) throws CommandException{
|
||||
|
||||
if(arguments.length < 1){
|
||||
throw new WrongUsageException("commands.wizardry:discoverspell.usage",
|
||||
throw new WrongUsageException("commands." + Wizardry.MODID + ":discoverspell.usage",
|
||||
Wizardry.settings.discoverspellCommandName);
|
||||
}else{
|
||||
|
||||
@@ -91,7 +91,7 @@ public class CommandDiscoverSpell extends CommandBase {
|
||||
spell = Spell.get(arguments[i++]);
|
||||
|
||||
if(spell == null){
|
||||
throw new NumberInvalidException("commands.wizardry:discoverspell.not_found",
|
||||
throw new NumberInvalidException("commands." + Wizardry.MODID + ":discoverspell.not_found",
|
||||
new Object[]{arguments[i - 1]});
|
||||
}
|
||||
}
|
||||
@@ -116,21 +116,21 @@ public class CommandDiscoverSpell extends CommandBase {
|
||||
if(clear){
|
||||
properties.spellsDiscovered.clear();
|
||||
sender.sendMessage(
|
||||
new TextComponentTranslation("commands.wizardry:discoverspell.clear", player.getName()));
|
||||
new TextComponentTranslation("commands." + Wizardry.MODID + ":discoverspell.clear", player.getName()));
|
||||
}else if(all){
|
||||
properties.spellsDiscovered.addAll(Spell.getSpells(Spell.allSpells));
|
||||
sender.sendMessage(
|
||||
new TextComponentTranslation("commands.wizardry:discoverspell.all", player.getName()));
|
||||
new TextComponentTranslation("commands." + Wizardry.MODID + ":discoverspell.all", player.getName()));
|
||||
}else{
|
||||
if(properties.hasSpellBeenDiscovered(spell)){
|
||||
properties.spellsDiscovered.remove(spell);
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:discoverspell.removespell",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":discoverspell.removespell",
|
||||
spell.getNameForTranslationFormatted(), player.getName()));
|
||||
}else{
|
||||
if(!MinecraftForge.EVENT_BUS
|
||||
.post(new DiscoverSpellEvent(player, spell, DiscoverSpellEvent.Source.COMMAND))){
|
||||
properties.discoverSpell(spell);
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:discoverspell.addspell",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":discoverspell.addspell",
|
||||
spell.getNameForTranslationFormatted(), player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ public class CommandSetAlly extends CommandBase {
|
||||
public String getUsage(ICommandSender p_71518_1_){
|
||||
// Not ideal, but the way this is implemented means I have no choice. Only used in the help command, so in there
|
||||
// the custom command name will not display.
|
||||
return "commands.wizardry:ally.usage";
|
||||
// return I18n.format("commands.wizardry:ally.usage", Wizardry.settings.allyCommandName);
|
||||
return "commands." + Wizardry.MODID + ":ally.usage";
|
||||
// return I18n.format("commands." + Wizardry.MODID + ":ally.usage", Wizardry.settings.allyCommandName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,7 +60,7 @@ public class CommandSetAlly extends CommandBase {
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] arguments) throws CommandException{
|
||||
|
||||
if(arguments.length < 1){
|
||||
throw new WrongUsageException("commands.wizardry:ally.usage", Wizardry.settings.allyCommandName);
|
||||
throw new WrongUsageException("commands." + Wizardry.MODID + ":ally.usage", Wizardry.settings.allyCommandName);
|
||||
}else{
|
||||
|
||||
EntityPlayerMP allyOf = null;
|
||||
@@ -86,7 +86,7 @@ public class CommandSetAlly extends CommandBase {
|
||||
&& !WizardryUtilities.isPlayerOp((EntityPlayer)sender, server)){
|
||||
// Displays a chat message if a non-op tries to modify another player's allies.
|
||||
TextComponentTranslation TextComponentTranslation2 = new TextComponentTranslation(
|
||||
"commands.wizardry:ally.permission");
|
||||
"commands." + Wizardry.MODID + ":ally.permission");
|
||||
TextComponentTranslation2.getStyle().setColor(TextFormatting.RED);
|
||||
allyOf.sendMessage(TextComponentTranslation2);
|
||||
return;
|
||||
@@ -100,12 +100,12 @@ public class CommandSetAlly extends CommandBase {
|
||||
if(allyOf == null)
|
||||
throw new PlayerNotFoundException("You must specify which player you wish to perform this action on.");
|
||||
|
||||
if(allyOf == ally) throw new NumberInvalidException("commands.wizardry:ally.self");
|
||||
if(allyOf == ally) throw new NumberInvalidException("commands." + Wizardry.MODID + ":ally.self");
|
||||
|
||||
if(WizardData.get(allyOf) != null){
|
||||
String string = WizardData.get(allyOf).toggleAlly(ally) ? "add" : "remove";
|
||||
if(executeAsOtherPlayer){
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:ally." + string + "ally",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":ally." + string + "ally",
|
||||
ally.getName(), allyOf.getName()));
|
||||
// In this case, the player whose allies have been modified is also notified.
|
||||
allyOf.sendMessage(new TextComponentTranslation("item.wand." + string + "ally", ally.getName()));
|
||||
|
||||
@@ -40,8 +40,8 @@ public class CommandViewAllies extends CommandBase {
|
||||
public String getUsage(ICommandSender p_71518_1_){
|
||||
// Not ideal, but the way this is implemented means I have no choice. Only used in the help command, so in there
|
||||
// the custom command name will not display.
|
||||
return "commands.wizardry:allies.usage";
|
||||
// return I18n.format("commands.wizardry:allies.usage", Wizardry.settings.alliesCommandName);
|
||||
return "commands." + Wizardry.MODID + ":allies.usage";
|
||||
// return I18n.format("commands." + Wizardry.MODID + ":allies.usage", Wizardry.settings.alliesCommandName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,7 +76,7 @@ public class CommandViewAllies extends CommandBase {
|
||||
&& !WizardryUtilities.isPlayerOp((EntityPlayer)sender, server)){
|
||||
// Displays a chat message if a non-op tries to view another player's allies.
|
||||
TextComponentTranslation TextComponentTranslation2 = new TextComponentTranslation(
|
||||
"commands.wizardry:allies.permission");
|
||||
"commands." + Wizardry.MODID + ":allies.permission");
|
||||
TextComponentTranslation2.getStyle().setColor(TextFormatting.RED);
|
||||
player.sendMessage(TextComponentTranslation2);
|
||||
return;
|
||||
@@ -92,24 +92,20 @@ public class CommandViewAllies extends CommandBase {
|
||||
|
||||
if(WizardData.get(player) != null){
|
||||
|
||||
String string = "";
|
||||
Object playerList = null;
|
||||
Set<String> names = WizardData.get(player).allyNames;
|
||||
|
||||
if(!names.isEmpty()){
|
||||
for(String name : names){
|
||||
string = string + name + ", ";
|
||||
}
|
||||
// Cuts the last " ," off of the string.
|
||||
string = string.substring(0, string.length() - 2);
|
||||
playerList = joinNiceStringFromCollection(names);
|
||||
}else{
|
||||
string = I18n.format("commands.wizardry:allies.none");
|
||||
playerList = new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.none");
|
||||
}
|
||||
|
||||
if(executeAsOtherPlayer){
|
||||
sender.sendMessage(
|
||||
new TextComponentTranslation("commands.wizardry:allies.list_other", player.getName(), string));
|
||||
new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list_other", player.getName(), playerList));
|
||||
}else{
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:allies.list", string));
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list", playerList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package electroblob.wizardry.constants;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.Style;
|
||||
@@ -39,7 +40,7 @@ public enum Element {
|
||||
/** Returns the translated display name of this element, without formatting. */
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getDisplayName(){
|
||||
return net.minecraft.client.resources.I18n.format("element." + getUnlocalisedName());
|
||||
return I18n.format("element." + getUnlocalisedName());
|
||||
}
|
||||
|
||||
/** Returns the {@link Style} object representing the colour of this element. */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package electroblob.wizardry.constants;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -15,6 +16,6 @@ public enum SpellType {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getDisplayName(){
|
||||
return net.minecraft.client.resources.I18n.format("spelltype." + unlocalisedName);
|
||||
return I18n.format("spelltype." + unlocalisedName);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package electroblob.wizardry.constants;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -39,12 +40,12 @@ public enum Tier {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getDisplayName(){
|
||||
return net.minecraft.client.resources.I18n.format("tier." + unlocalisedName);
|
||||
return I18n.format("tier." + unlocalisedName);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getDisplayNameWithFormatting(){
|
||||
return this.getFormattingCode() + net.minecraft.client.resources.I18n.format("tier." + unlocalisedName);
|
||||
return this.getFormattingCode() + I18n.format("tier." + unlocalisedName);
|
||||
}
|
||||
|
||||
public String getUnlocalisedName(){
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package electroblob.wizardry.enchantment;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.WizardryEnchantments;
|
||||
import electroblob.wizardry.spell.FreezingWeapon;
|
||||
@@ -10,11 +12,15 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ContainerChest;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemBow;
|
||||
import net.minecraft.item.ItemEnchantedBook;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
@@ -55,11 +61,18 @@ public interface Imbuement {
|
||||
if(stack.isItemEnchanted()){
|
||||
// No need to check what enchantments the item has, since remove() does nothing if the element does not
|
||||
// exist.
|
||||
Map<Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(stack);
|
||||
// Removes the magic weapon enchantments from the enchantment map
|
||||
enchantments.entrySet().removeIf(entry -> entry.getKey() instanceof Imbuement);
|
||||
// Applies the new enchantment map to the item
|
||||
EnchantmentHelper.setEnchantments(enchantments, stack);
|
||||
NBTTagList enchantmentList = stack.getItem() == Items.ENCHANTED_BOOK ?
|
||||
ItemEnchantedBook.getEnchantments(stack) : stack.getEnchantmentTagList();
|
||||
// Check all enchantments of the item
|
||||
Iterator<NBTBase> enchantmentIt = enchantmentList.iterator();
|
||||
while(enchantmentIt.hasNext()){
|
||||
NBTTagCompound enchantmentTag = (NBTTagCompound) enchantmentIt.next();
|
||||
Enchantment enchantment = Enchantment.getEnchantmentByID(enchantmentTag.getShort("id"));
|
||||
// If the item contains a magic weapon enchantment, remove it from the item
|
||||
if(enchantment instanceof Imbuement){
|
||||
enchantmentIt.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,18 +83,23 @@ public interface Imbuement {
|
||||
// Still not sure if it's better to set stacks in slots or modify the itemstack list directly, but I would
|
||||
// imagine it's the former.
|
||||
for(Slot slot : event.getContainer().inventorySlots){
|
||||
if(slot.getStack().getItem() instanceof ItemEnchantedBook){
|
||||
ItemStack slotStack = slot.getStack();
|
||||
if(slotStack.getItem() instanceof ItemEnchantedBook){
|
||||
// We don't care about the level of the enchantments
|
||||
Map<Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(slot.getStack());
|
||||
NBTTagList enchantmentList = ItemEnchantedBook.getEnchantments(slotStack);
|
||||
// Removes all imbuements
|
||||
if(enchantments.keySet().removeIf(e -> e instanceof Imbuement)){
|
||||
// If any imbuements were removed, replaces the enchantments on the book with the new ones, or
|
||||
// deletes the book entirely if there are none left.
|
||||
if(enchantments.isEmpty()){
|
||||
if(Iterables.removeIf(enchantmentList, tag -> {
|
||||
NBTTagCompound enchantmentTag = (NBTTagCompound) tag;
|
||||
return Enchantment.getEnchantmentByID(enchantmentTag.getShort("id"))
|
||||
instanceof Imbuement;
|
||||
})){
|
||||
// If any imbuements were removed, inform about the removal of the enchantment(s), or
|
||||
// delete the book entirely if there are none left.
|
||||
if(enchantmentList.isEmpty()){
|
||||
slot.putStack(ItemStack.EMPTY); // NOTE: Will need changing in 1.11
|
||||
Wizardry.logger.info("Deleted enchanted book with illegal enchantments");
|
||||
}else{
|
||||
EnchantmentHelper.setEnchantments(enchantments, slot.getStack());
|
||||
// Inform about enchantment removal
|
||||
Wizardry.logger.info("Removed illegal enchantments from enchanted book");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,12 +106,12 @@ public class EntityMeteor extends EntityFallingBlock {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getBrightnessForRender(float partialTicks){
|
||||
public int getBrightnessForRender(){
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBrightness(float partialTicks){
|
||||
public float getBrightness(){
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
((EntityPlayerMP)target).connection.sendPacket(new SPacketEntityVelocity(target));
|
||||
}
|
||||
|
||||
if(this.getDistanceToEntity(target) <= 2){
|
||||
if(this.getDistance(target) <= 2){
|
||||
// Damages the target if it is close enough
|
||||
if(this.getCaster() != null){
|
||||
target.attackEntityFrom(
|
||||
|
||||
@@ -74,7 +74,7 @@ public class EntityEarthquake extends EntityMagicConstruct {
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
// Searches in a 1 wide ring.
|
||||
if(this.getDistanceToEntity(target) > (this.ticksExisted * speed) + 0.5 && target.posY < this.posY + 1
|
||||
if(this.getDistance(target) > (this.ticksExisted * speed) + 0.5 && target.posY < this.posY + 1
|
||||
&& target.posY > this.posY - 1){
|
||||
|
||||
// Knockback must be removed in this instance, or the target will fall into the floor.
|
||||
|
||||
@@ -3,7 +3,7 @@ package electroblob.wizardry.entity.construct;
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.WizardryAchievements;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
@@ -103,7 +103,7 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
|
||||
// The 'Not Again...' achievement
|
||||
if(target instanceof EntityPig && WizardryUtilities.getRider(target) instanceof EntityPlayer){
|
||||
((EntityPlayer)WizardryUtilities.getRider(target)).addStat(WizardryAchievements.pig_tornado);
|
||||
WizardryAdvancementTriggers.pig_tornado.triggerFor((EntityPlayer)WizardryUtilities.getRider(target));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public class EntityAIAttackSpell extends EntityAIBase {
|
||||
}
|
||||
|
||||
if(distanceSq <= (double)this.maxAttackDistance && this.seeTime >= 20){
|
||||
this.attacker.getNavigator().clearPathEntity();
|
||||
this.attacker.getNavigator().clearPath();
|
||||
}else{
|
||||
this.attacker.getNavigator().tryMoveToEntityLiving(this.target, this.speed);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package electroblob.wizardry.entity.living;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
@@ -12,7 +11,6 @@ import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.item.ItemSpellBook;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryAchievements;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
@@ -119,10 +117,10 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
|
||||
|| (entity instanceof ISummonedCreature || entity instanceof EntityWizard
|
||||
// ... or in the whitelist ...
|
||||
|| Arrays.asList(Wizardry.settings.summonedCreatureTargetsWhitelist)
|
||||
.contains(EntityList.getEntityString(entity).toLowerCase(Locale.ROOT)))
|
||||
.contains(EntityList.getKey(entity.getClass())))
|
||||
// ... and isn't in the blacklist ...
|
||||
&& !Arrays.asList(Wizardry.settings.summonedCreatureTargetsBlacklist)
|
||||
.contains(EntityList.getEntityString(entity).toLowerCase(Locale.ROOT))){
|
||||
.contains(EntityList.getKey(entity.getClass()))){
|
||||
// ... it can be attacked.
|
||||
return true;
|
||||
}
|
||||
@@ -267,6 +265,21 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
|
||||
(NBTTagInt tag) -> Spell.get(tag.getInt()));
|
||||
this.hasTower = nbt.getBoolean("hasTower");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSpawnedInChunk(){
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCanSpawnHere(){
|
||||
// Evil wizards can only spawn in the specified dimensions
|
||||
for(int id : Wizardry.settings.evilWizardDimensions){
|
||||
if(this.dimension == id) return super.getCanSpawnHere();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn(){
|
||||
@@ -285,7 +298,7 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(){
|
||||
protected SoundEvent getHurtSound(DamageSource source){
|
||||
return SoundEvents.ENTITY_WITCH_HURT;
|
||||
}
|
||||
|
||||
@@ -318,15 +331,6 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
|
||||
return LOOT_TABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource source){
|
||||
|
||||
super.onDeath(source);
|
||||
if(source.getTrueSource() instanceof EntityPlayer){
|
||||
((EntityPlayer)source.getTrueSource()).addStat(WizardryAchievements.defeat_evil_wizard);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData data){
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public class EntityIceWraith extends EntityBlazeMinion {
|
||||
this.moveStrafing *= 0.98F;
|
||||
this.moveForward *= 0.98F;
|
||||
this.randomYawVelocity *= 0.9F;
|
||||
this.moveEntityWithHeading(this.moveStrafing, this.moveForward);
|
||||
this.travel(this.moveStrafing, this.moveVertical, this.moveForward);
|
||||
this.world.profiler.endSection();
|
||||
this.world.profiler.startSection("push");
|
||||
this.collideWithNearbyEntities();
|
||||
@@ -229,7 +229,7 @@ public class EntityIceWraith extends EntityBlazeMinion {
|
||||
public void updateTask(){
|
||||
--this.attackTime;
|
||||
EntityLivingBase entitylivingbase = this.blaze.getAttackTarget();
|
||||
double d0 = this.blaze.getDistanceSqToEntity(entitylivingbase);
|
||||
double d0 = this.blaze.getDistanceSq(entitylivingbase);
|
||||
|
||||
if(d0 < 4.0D){
|
||||
if(this.attackTime <= 0){
|
||||
@@ -264,7 +264,7 @@ public class EntityIceWraith extends EntityBlazeMinion {
|
||||
|
||||
this.blaze.getLookHelper().setLookPositionWithEntity(entitylivingbase, 10.0F, 10.0F);
|
||||
}else{
|
||||
this.blaze.getNavigator().clearPathEntity();
|
||||
this.blaze.getNavigator().clearPath();
|
||||
this.blaze.getMoveHelper().setMoveTo(entitylivingbase.posX, entitylivingbase.posY,
|
||||
entitylivingbase.posZ, 1.0D);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class EntityLightningWraith extends EntityBlazeMinion {
|
||||
public void updateTask(){
|
||||
--this.attackTime;
|
||||
EntityLivingBase entitylivingbase = this.blaze.getAttackTarget();
|
||||
double d0 = this.blaze.getDistanceSqToEntity(entitylivingbase);
|
||||
double d0 = this.blaze.getDistanceSq(entitylivingbase);
|
||||
|
||||
if(d0 < 4.0D){
|
||||
if(this.attackTime <= 0){
|
||||
@@ -162,7 +162,7 @@ public class EntityLightningWraith extends EntityBlazeMinion {
|
||||
|
||||
this.blaze.getLookHelper().setLookPositionWithEntity(entitylivingbase, 10.0F, 10.0F);
|
||||
}else{
|
||||
this.blaze.getNavigator().clearPathEntity();
|
||||
this.blaze.getNavigator().clearPath();
|
||||
this.blaze.getMoveHelper().setMoveTo(entitylivingbase.posX, entitylivingbase.posY,
|
||||
entitylivingbase.posZ, 1.0D);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -103,7 +104,7 @@ public class EntityPhoenix extends EntitySummonedCreature implements ISpellCaste
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(){
|
||||
protected SoundEvent getHurtSound(DamageSource source){
|
||||
return SoundEvents.ENTITY_BLAZE_HURT;
|
||||
}
|
||||
|
||||
@@ -114,12 +115,12 @@ public class EntityPhoenix extends EntitySummonedCreature implements ISpellCaste
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBrightnessForRender(float par1){
|
||||
public int getBrightnessForRender(){
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBrightness(float par1){
|
||||
public float getBrightness(){
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.world.World;
|
||||
@@ -102,7 +103,7 @@ public class EntityShadowWraith extends EntitySummonedCreature implements ISpell
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(){
|
||||
protected SoundEvent getHurtSound(DamageSource source){
|
||||
return SoundEvents.ENTITY_BLAZE_HURT;
|
||||
}
|
||||
|
||||
@@ -113,12 +114,12 @@ public class EntityShadowWraith extends EntitySummonedCreature implements ISpell
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBrightnessForRender(float partialTicks){
|
||||
public int getBrightnessForRender(){
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBrightness(float partialTicks){
|
||||
public float getBrightness(){
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
@@ -51,13 +52,22 @@ public class EntitySpiritHorse extends EntityHorse {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getExperiencePoints(EntityPlayer p_70693_1_){
|
||||
protected int getExperiencePoints(EntityPlayer player){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDropItem(){
|
||||
protected boolean canDropLoot(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDropItem(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getLootTable(){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.DifficultyInstance;
|
||||
@@ -70,11 +71,6 @@ public class EntitySpiritWolf extends EntityWolf {
|
||||
super.onDeath(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getExperiencePoints(EntityPlayer p_70693_1_){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata){
|
||||
|
||||
@@ -147,11 +143,26 @@ public class EntitySpiritWolf extends EntityWolf {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getExperiencePoints(EntityPlayer player){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDropLoot(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDropItem(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getLootTable(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(){
|
||||
if(getOwner() != null){
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.world.World;
|
||||
@@ -95,7 +96,7 @@ public class EntityStormElemental extends EntitySummonedCreature implements ISpe
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(){
|
||||
protected SoundEvent getHurtSound(DamageSource source){
|
||||
return SoundEvents.ENTITY_BLAZE_HURT;
|
||||
}
|
||||
|
||||
@@ -106,12 +107,12 @@ public class EntityStormElemental extends EntitySummonedCreature implements ISpe
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBrightnessForRender(float partialTicks){
|
||||
public int getBrightnessForRender(){
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBrightness(float partialTicks){
|
||||
public float getBrightness(){
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
@@ -16,36 +17,36 @@ import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.item.ItemSpellBook;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryAchievements;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WandHelper;
|
||||
import electroblob.wizardry.util.WildcardTradeList;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.IMerchant;
|
||||
import net.minecraft.entity.INpc;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILookAtTradePlayer;
|
||||
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAIOpenDoor;
|
||||
import net.minecraft.entity.ai.EntityAIRestrictOpenDoor;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.entity.ai.EntityAITradePlayer;
|
||||
import net.minecraft.entity.ai.EntityAIWander;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest2;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -75,22 +76,12 @@ import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class EntityWizard extends EntityVillager implements ISpellCaster, IEntityAdditionalSpawnData {
|
||||
|
||||
/* After much debugging, the error in the compiled mod (outside of eclipse) was traced back to this class,
|
||||
* specifically the methods copied in from EntityVillager when I changed this class to extend it. This figures,
|
||||
* since I had 1.2.1 working just fine before I did that, and it was the only thing I changed. Apparently, methods
|
||||
* and fields with obfuscated names like func_129090_a can cause problems when compiled. One of the ones here was
|
||||
* renamed and the other deleted since it was never called. Watch out for this in future (unless, of course, they
|
||||
* are overriding something, in which case it should be fine). */
|
||||
|
||||
// Extending EntityVillager turned out to be a pretty neat thing to do, since now zombies will attack wizards
|
||||
public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISpellCaster, IEntityAdditionalSpawnData {
|
||||
|
||||
private EntityAIAttackSpell spellCastingAI = new EntityAIAttackSpell(this, 0.5D, 14.0F, 30, 50);
|
||||
|
||||
@@ -99,19 +90,21 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
/** The entity selector passed into the new AI methods. */
|
||||
protected Predicate<Entity> targetSelector;
|
||||
|
||||
/** Copy of EntityVillager's buyingList, renamed to avoid confusion. */
|
||||
/** The wizard's trades. */
|
||||
private MerchantRecipeList trades;
|
||||
/** The wizard's current customer. */
|
||||
@Nullable
|
||||
private EntityPlayer customer;
|
||||
|
||||
private int timeUntilReset;
|
||||
|
||||
/** addDefaultEquipmentAndRecipies is called if this is true */
|
||||
private boolean updateRecipes;
|
||||
|
||||
/** Data parameter for the cooldown time for wizards healing themselves. */
|
||||
private static final DataParameter<Integer> HEAL_COOLDOWN = EntityDataManager.createKey(EntityWizard.class,
|
||||
DataSerializers.VARINT);
|
||||
private static final DataParameter<Integer> HEAL_COOLDOWN = EntityDataManager.createKey(EntityWizard.class, DataSerializers.VARINT);
|
||||
/** Data parameter for the wizard's element. */
|
||||
private static final DataParameter<Integer> ELEMENT = EntityDataManager.createKey(EntityWizard.class,
|
||||
DataSerializers.VARINT);
|
||||
private static final DataParameter<Integer> ELEMENT = EntityDataManager.createKey(EntityWizard.class, DataSerializers.VARINT);
|
||||
|
||||
// Field implementations
|
||||
private List<Spell> spells = new ArrayList<Spell>(4);
|
||||
@@ -138,6 +131,8 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
protected void initEntityAI(){
|
||||
|
||||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
// Why would you go to the effort of making the IMerchant interface and then have the AI classes only accept
|
||||
// EntityVillager? N
|
||||
this.tasks.addTask(1, new EntityAITradePlayer(this));
|
||||
this.tasks.addTask(1, new EntityAILookAtTradePlayer(this));
|
||||
this.tasks.addTask(4, new EntityAIRestrictOpenDoor(this));
|
||||
@@ -160,10 +155,10 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
if((entity instanceof IMob || entity instanceof ISummonedCreature
|
||||
// ... or in the whitelist ...
|
||||
|| Arrays.asList(Wizardry.settings.summonedCreatureTargetsWhitelist)
|
||||
.contains(EntityList.getEntityString(entity).toLowerCase(Locale.ROOT)))
|
||||
.contains(EntityList.getKey(entity.getClass())))
|
||||
// ... and isn't in the blacklist ...
|
||||
&& !Arrays.asList(Wizardry.settings.summonedCreatureTargetsBlacklist)
|
||||
.contains(EntityList.getEntityString(entity).toLowerCase(Locale.ROOT))){
|
||||
.contains(EntityList.getKey(entity.getClass()))){
|
||||
// ... it can be attacked.
|
||||
return true;
|
||||
}
|
||||
@@ -221,6 +216,55 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
return this.continuousSpell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomer(EntityPlayer player){
|
||||
this.customer = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getCustomer(){
|
||||
return this.customer;
|
||||
}
|
||||
|
||||
public boolean isTrading(){
|
||||
return this.getCustomer() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verifySellingItem(ItemStack stack){
|
||||
// Copied from EntityVillager
|
||||
if(!this.world.isRemote && this.livingSoundTime > -this.getTalkInterval() + 20){
|
||||
this.livingSoundTime = -this.getTalkInterval();
|
||||
this.playSound(stack.isEmpty() ? SoundEvents.ENTITY_VILLAGER_NO : SoundEvents.ENTITY_VILLAGER_YES, this.getSoundVolume(), this.getSoundPitch());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld(){
|
||||
return this.world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getPos(){
|
||||
return new BlockPos(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setRecipes(MerchantRecipeList recipeList){
|
||||
// Apparently nothing goes here, and nothing's here in EntityVillager either...
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(){
|
||||
return this.getElement().getWizardName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLivingUpdate(){
|
||||
|
||||
@@ -301,8 +345,7 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
}
|
||||
}
|
||||
|
||||
// Super call removed because EntityVillager's version does things I don't want and the next one up is
|
||||
// in EntityLivingBase and does nothing.
|
||||
super.updateAITasks(); // This actually does nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -338,11 +381,6 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(){
|
||||
return this.getElement().getWizardName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt){
|
||||
|
||||
@@ -369,7 +407,7 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
|
||||
if(nbt.hasKey("trades")){
|
||||
NBTTagCompound nbttagcompound1 = nbt.getCompoundTag("trades");
|
||||
this.trades = new MerchantRecipeList(nbttagcompound1);
|
||||
this.trades = new WildcardTradeList(nbttagcompound1);
|
||||
}
|
||||
|
||||
this.setElement(Element.values()[nbt.getInteger("element")]);
|
||||
@@ -381,16 +419,6 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
nbt.getTagList("towerBlocks", NBT.TAG_LONG), (NBTTagLong tag) -> BlockPos.fromLong(tag.getLong())));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrading(){
|
||||
return this.getCustomer() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useRecipe(MerchantRecipe merchantrecipe){
|
||||
|
||||
@@ -400,11 +428,11 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
|
||||
// Achievements
|
||||
if(this.getCustomer() != null){
|
||||
this.getCustomer().addStat(WizardryAchievements.wizard_trade);
|
||||
WizardryAdvancementTriggers.wizard_trade.triggerFor(this.getCustomer());
|
||||
|
||||
if(merchantrecipe.getItemToSell().getItem() instanceof ItemSpellBook
|
||||
&& Spell.get(merchantrecipe.getItemToSell().getItemDamage()).tier == Tier.MASTER){
|
||||
this.getCustomer().addStat(WizardryAchievements.buy_master_spell);
|
||||
WizardryAdvancementTriggers.buy_master_spell.triggerFor(this.getCustomer());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +456,7 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
|
||||
if(this.trades == null){
|
||||
|
||||
this.trades = new MerchantRecipeList();
|
||||
this.trades = new WildcardTradeList();
|
||||
|
||||
// All wizards will buy spell books
|
||||
ItemStack anySpellBook = new ItemStack(WizardryItems.spell_book, 1, OreDictionary.WILDCARD_VALUE);
|
||||
@@ -509,7 +537,7 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
Collections.shuffle(merchantrecipelist);
|
||||
|
||||
if(this.trades == null){
|
||||
this.trades = new MerchantRecipeList();
|
||||
this.trades = new WildcardTradeList();
|
||||
}
|
||||
|
||||
for(int j1 = 0; j1 < merchantrecipelist.size(); ++j1){
|
||||
@@ -659,11 +687,6 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
return new ItemStack(Blocks.STONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfession(VillagerProfession prof){
|
||||
// Disables Forge's stuff.
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata){
|
||||
|
||||
@@ -775,7 +798,7 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
public boolean attackEntityFrom(DamageSource source, float damage){
|
||||
|
||||
if(source.getTrueSource() instanceof EntityPlayer){
|
||||
((EntityPlayer)source.getTrueSource()).addStat(WizardryAchievements.anger_wizard);
|
||||
WizardryAdvancementTriggers.anger_wizard.triggerFor((EntityPlayer)source.getTrueSource());
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(source, damage);
|
||||
@@ -794,9 +817,7 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
/**
|
||||
* Tests whether the block at the given coordinates is part of this wizard's tower.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param pos
|
||||
* @return
|
||||
*/
|
||||
public boolean isBlockPartOfTower(BlockPos pos){
|
||||
@@ -817,55 +838,78 @@ public class EntityWizard extends EntityVillager implements ISpellCaster, IEntit
|
||||
for(EntityWizard wizard : wizards){
|
||||
if(wizard.isBlockPartOfTower(event.getPos())){
|
||||
wizard.setRevengeTarget(event.getPlayer());
|
||||
event.getPlayer().addStat(WizardryAchievements.anger_wizard);
|
||||
WizardryAdvancementTriggers.anger_wizard.triggerFor(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from their respective AI classes
|
||||
|
||||
public static class EntityAILookAtTradePlayer extends EntityAIWatchClosest {
|
||||
|
||||
private final EntityWizard wizard;
|
||||
|
||||
// EntityVillager overrides (that don't add features)
|
||||
public EntityAILookAtTradePlayer(EntityWizard wizard){
|
||||
super(wizard, EntityPlayer.class, 8.0F);
|
||||
this.wizard = wizard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMating(){
|
||||
return false;
|
||||
@Override
|
||||
public boolean shouldExecute(){
|
||||
if(this.wizard.isTrading()){
|
||||
this.closestEntity = this.wizard.getCustomer();
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityAITradePlayer extends EntityAIBase {
|
||||
|
||||
private final EntityWizard wizard;
|
||||
|
||||
@Override
|
||||
public void setMating(boolean p_70947_1_){
|
||||
}
|
||||
public EntityAITradePlayer(EntityWizard wizard){
|
||||
this.wizard = wizard;
|
||||
this.setMutexBits(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlaying(boolean p_70939_1_){
|
||||
}
|
||||
@Override
|
||||
public boolean shouldExecute(){
|
||||
|
||||
if(!this.wizard.isEntityAlive()){
|
||||
return false;
|
||||
}else if(this.wizard.isInWater()){
|
||||
return false;
|
||||
}else if(!this.wizard.onGround){
|
||||
return false;
|
||||
}else if(this.wizard.velocityChanged){
|
||||
return false;
|
||||
}else{
|
||||
|
||||
EntityPlayer entityplayer = this.wizard.getCustomer();
|
||||
|
||||
@Override
|
||||
public boolean isPlaying(){
|
||||
return false;
|
||||
}
|
||||
if(entityplayer == null){
|
||||
return false;
|
||||
}else if(this.wizard.getDistanceSq(entityplayer) > 16.0D){
|
||||
return false;
|
||||
}else{
|
||||
return entityplayer.openContainer != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLookingForHome(){
|
||||
}
|
||||
@Override
|
||||
public void startExecuting(){
|
||||
this.wizard.getNavigator().clearPath();
|
||||
}
|
||||
|
||||
// Doesn't say it, but this is in fact nullable.
|
||||
@Override
|
||||
public EntityVillager createChild(EntityAgeable par1EntityAgeable){
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void setRecipes(MerchantRecipeList par1MerchantRecipeList){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStruckByLightning(EntityLightningBolt lightningBolt){
|
||||
// Restores the normal behaviour, replacing EntityVillager's witch conversion.
|
||||
this.attackEntityFrom(DamageSource.LIGHTNING_BOLT, 5.0F);
|
||||
// Entity's version does something strange with the private fire variable, but since I don't have access this
|
||||
// will probably be fine.
|
||||
this.setFire(8);
|
||||
@Override
|
||||
public void resetTask(){
|
||||
this.wizard.setCustomer((EntityPlayer)null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package electroblob.wizardry.entity.living;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -85,7 +84,7 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
public interface ISummonedCreature extends IEntityAdditionalSpawnData {
|
||||
|
||||
// Remember that ALL fields are static and final in interfaces, even if they don't explicitly state that.
|
||||
String NAMEPLATE_TRANSLATION_KEY = "entity.wizardry:summonedcreature.nameplate";
|
||||
String NAMEPLATE_TRANSLATION_KEY = "entity." + Wizardry.MODID + ":summonedcreature.nameplate";
|
||||
|
||||
// Setters and getters. The subclass fields that these access should be private.
|
||||
|
||||
@@ -182,18 +181,28 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData {
|
||||
if(!entity.isInvisible() && isValidTarget(entity)){
|
||||
|
||||
// ... and is a player, they can be attacked, since players can't be in the whitelist or the
|
||||
// blacklist.
|
||||
if(entity instanceof EntityPlayer) return true;
|
||||
// blacklist ...
|
||||
if(entity instanceof EntityPlayer){
|
||||
// ... unless the creature was summoned by a good wizard who the player has not angered.
|
||||
if(getCaster() instanceof EntityWizard){
|
||||
if(((EntityWizard)getCaster()).getRevengeTarget() != entity
|
||||
&& ((EntityWizard)getCaster()).getAttackTarget() != entity) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ... and is a mob, a summoned creature, a wizard ...
|
||||
if((entity instanceof IMob || entity instanceof ISummonedCreature
|
||||
|| (entity instanceof EntityWizard && !(getCaster() instanceof EntityWizard))
|
||||
// ... or in the whitelist ...
|
||||
|| Arrays.asList(Wizardry.settings.summonedCreatureTargetsWhitelist)
|
||||
.contains(EntityList.getEntityString(entity).toLowerCase(Locale.ROOT)))
|
||||
.contains(EntityList.getKey(entity.getClass())))
|
||||
// ... and isn't in the blacklist ...
|
||||
&& !Arrays.asList(Wizardry.settings.summonedCreatureTargetsBlacklist)
|
||||
.contains(EntityList.getEntityString(entity).toLowerCase(Locale.ROOT))){
|
||||
.contains(EntityList.getKey(entity.getClass()))){
|
||||
// ... it can be attacked.
|
||||
return true;
|
||||
}
|
||||
@@ -362,11 +371,18 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData {
|
||||
if(event.getSource().isFireDamage()) newSource.setFireDamage();
|
||||
if(event.getSource().isProjectile()) newSource.setProjectile();
|
||||
|
||||
// For some reason Minecraft calculates knockback relative to DamageSource#getEntity. In vanilla this
|
||||
// For some reason Minecraft calculates knockback relative to DamageSource#getTrueSource. In vanilla this
|
||||
// is unnoticeable, but it looks a bit weird with summoned creatures involved - so this fixes that.
|
||||
if(WizardryUtilities.attackEntityWithoutKnockback(event.getEntity(), newSource, event.getAmount())){
|
||||
// Using event.getSource().getTrueSource() as this means the target is knocked back from the minion
|
||||
WizardryUtilities.applyStandardKnockback(event.getSource().getTrueSource(), event.getEntityLiving());
|
||||
((ISummonedCreature)event.getSource().getTrueSource()).onSuccessfulAttack(event.getEntityLiving());
|
||||
// If the target revenge-targeted the summoner, make it revenge-target the minion instead
|
||||
// (if it didn't revenge-target, do nothing)
|
||||
if(event.getEntityLiving().getRevengeTarget() == summoner
|
||||
&& event.getSource().getTrueSource() instanceof EntityLivingBase){
|
||||
event.getEntityLiving().setRevengeTarget((EntityLivingBase)event.getSource().getTrueSource());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
||||
/**
|
||||
* Same as {@link EntityMagicProjectile}, but with an additional blast multiplier field which is synced and saved to
|
||||
@@ -13,7 +12,7 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
* @author Electroblob
|
||||
* @since Wizardry 1.2
|
||||
*/
|
||||
public abstract class EntityBomb extends EntityMagicProjectile implements IEntityAdditionalSpawnData {
|
||||
public abstract class EntityBomb extends EntityMagicProjectile {
|
||||
|
||||
/** The entity blast multiplier. This is now synced and saved centrally from {@link EntityBomb}. */
|
||||
public float blastMultiplier = 1.0f;
|
||||
@@ -38,11 +37,13 @@ public abstract class EntityBomb extends EntityMagicProjectile implements IEntit
|
||||
@Override
|
||||
public void writeSpawnData(ByteBuf buffer){
|
||||
buffer.writeFloat(blastMultiplier);
|
||||
super.writeSpawnData(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(ByteBuf buffer){
|
||||
blastMultiplier = buffer.readFloat();
|
||||
super.readSpawnData(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -83,7 +83,7 @@ public class EntityForceArrow extends EntityMagicArrow {
|
||||
|
||||
@Override
|
||||
protected void entityInit(){
|
||||
|
||||
// auto generated
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class EntityLightningDisc extends EntityMagicProjectile {
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.isCollided && !world.isRemote){
|
||||
if(!this.collided && !world.isRemote){
|
||||
|
||||
double seekingRange = 5.0d;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class EntityLightningDisc extends EntityMagicProjectile {
|
||||
|
||||
for(Entity possibleTarget : entities){
|
||||
// Decides if current entity should be replaced.
|
||||
if(target == null || this.getDistanceToEntity(target) > this.getDistanceToEntity(possibleTarget)){
|
||||
if(target == null || this.getDistance(target) > this.getDistance(possibleTarget)){
|
||||
// Decides if new entity is a valid target.
|
||||
if(WizardryUtilities.isValidTarget(this.getThrower(), possibleTarget)){
|
||||
target = possibleTarget;
|
||||
|
||||
@@ -122,7 +122,7 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
|
||||
// f4 depends on the horizontal distance between the two entities and accounts for bullet drop,
|
||||
// but of course if gravity is ignored this should be 0.
|
||||
float bulletDropCompensation = this.doGravity() ? (float)d3 * 0.2F : 0;
|
||||
this.setThrowableHeading(d0, d1 + (double)bulletDropCompensation, d2, speed, aimingError);
|
||||
this.shoot(d0, d1 + (double)bulletDropCompensation, d2, speed, aimingError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
|
||||
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI)
|
||||
* MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, speed * 1.5F, 1.0F);
|
||||
this.shoot(this.motionX, this.motionY, this.motionZ, speed * 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
/** Subclasses must override this to set their own base damage. */
|
||||
@@ -183,7 +183,8 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
|
||||
/**
|
||||
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
|
||||
*/
|
||||
public void setThrowableHeading(double x, double y, double z, float speed, float randomness){
|
||||
@Override
|
||||
public void shoot(double x, double y, double z, float speed, float randomness){
|
||||
float f2 = MathHelper.sqrt(x * x + y * y + z * z);
|
||||
x /= (double)f2;
|
||||
y /= (double)f2;
|
||||
@@ -433,7 +434,7 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
|
||||
this.onBlockHit();
|
||||
|
||||
if(this.stuckInBlock.getMaterial() != Material.AIR){
|
||||
this.stuckInBlock.getBlock().onEntityCollidedWithBlock(this.world, raytraceresult.getBlockPos(),
|
||||
this.stuckInBlock.getBlock().onEntityCollision(this.world, raytraceresult.getBlockPos(),
|
||||
this.stuckInBlock, this);
|
||||
}
|
||||
}
|
||||
@@ -579,4 +580,9 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
|
||||
public void setShootingEntity(EntityLivingBase entity){
|
||||
shootingEntity = new WeakReference<EntityLivingBase>(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package electroblob.wizardry.entity.projectile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
@@ -25,7 +24,7 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
* @author Electroblob
|
||||
* @see EntityBomb
|
||||
*/
|
||||
public abstract class EntityMagicProjectile extends EntityThrowable {
|
||||
public abstract class EntityMagicProjectile extends EntityThrowable implements IEntityAdditionalSpawnData {
|
||||
|
||||
public float damageMultiplier = 1.0f;
|
||||
|
||||
@@ -40,8 +39,10 @@ public abstract class EntityMagicProjectile extends EntityThrowable {
|
||||
public EntityMagicProjectile(World world, EntityLivingBase thrower, float damageMultiplier){
|
||||
super(world, thrower);
|
||||
// This is the standard set of parameters for this method, used by snowballs and ender pearls amongst others.
|
||||
this.setHeadingFromThrower(thrower, thrower.rotationPitch, thrower.rotationYaw, 0.0f, this.getSpeed(), 1.0f);
|
||||
this.shoot(thrower, thrower.rotationPitch, thrower.rotationYaw, 0.0f, this.getSpeed(), 1.0f);
|
||||
this.damageMultiplier = damageMultiplier;
|
||||
// Mojang's 'fix' for the projectile-hitting-thrower bug actually made the problem worse, hence the following line.
|
||||
this.ignoreEntity = thrower;
|
||||
}
|
||||
|
||||
public EntityMagicProjectile(World world, double x, double y, double z){
|
||||
@@ -61,9 +62,9 @@ public abstract class EntityMagicProjectile extends EntityThrowable {
|
||||
- (this.posY + (double)(this.height / 2.0F));
|
||||
double dz = target.posZ - this.posZ;
|
||||
|
||||
this.motionX = dx / this.getDistanceToEntity(target) * velocity;
|
||||
this.motionY = dy / this.getDistanceToEntity(target) * velocity;
|
||||
this.motionZ = dz / this.getDistanceToEntity(target) * velocity;
|
||||
this.motionX = dx / this.getDistance(target) * velocity;
|
||||
this.motionY = dy / this.getDistance(target) * velocity;
|
||||
this.motionZ = dz / this.getDistance(target) * velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,17 +79,17 @@ public abstract class EntityMagicProjectile extends EntityThrowable {
|
||||
// inside a mob using commands, it wouldn't hit that mob. This is so minor that it's not worth sending a packet
|
||||
// for, though it may become more noticeable if spells firing from blocks are added.
|
||||
// TODO: Investigate whether this is still necessary in 1.12
|
||||
if(this.world.isRemote){
|
||||
|
||||
List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(this.motionX, this.motionY, this.motionZ).grow(1.0D));
|
||||
|
||||
for(Entity entity : list){ // Why does vanilla still not use a for-each loop?
|
||||
if(entity.canBeCollidedWith() && this.ticksExisted < 2 && this.ignoreEntity == null){
|
||||
this.ignoreEntity = entity;
|
||||
}
|
||||
}
|
||||
// Pretty sure EntityThrowable handles the rest.
|
||||
}
|
||||
// if(this.world.isRemote){
|
||||
//
|
||||
// List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(this.motionX, this.motionY, this.motionZ).grow(1.0D));
|
||||
//
|
||||
// for(Entity entity : list){ // Why does vanilla still not use a for-each loop?
|
||||
// if(entity.canBeCollidedWith() && this.ticksExisted < 2 && this.ignoreEntity == null){
|
||||
// this.ignoreEntity = entity;
|
||||
// }
|
||||
// }
|
||||
// // Pretty sure EntityThrowable handles the rest.
|
||||
// }
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
@@ -105,4 +106,21 @@ public abstract class EntityMagicProjectile extends EntityThrowable {
|
||||
nbttagcompound.setFloat("damageMultiplier", damageMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
// For now, we're only writing when the thrower exists, so subclasses MUST CALL SUPER LAST.
|
||||
// TODO: Figure out whether there's a default value we can write that is never used as an entity id (0? -1? +/-MAX_VALUE?)
|
||||
public void writeSpawnData(ByteBuf data){
|
||||
if(this.getThrower() != null) data.writeInt(this.getThrower().getEntityId());
|
||||
}
|
||||
|
||||
@Override
|
||||
// For now, we're only writing when the thrower exists, so subclasses MUST CALL SUPER LAST.
|
||||
public void readSpawnData(ByteBuf data){
|
||||
if(data.isReadable()){
|
||||
Entity entity = this.world.getEntityByID(data.readInt());
|
||||
if(entity instanceof EntityLivingBase) this.thrower = (EntityLivingBase)entity;
|
||||
this.ignoreEntity = this.thrower;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class EntitySpark extends EntityMagicProjectile {
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.isCollided && !world.isRemote){
|
||||
if(!this.collided && !world.isRemote){
|
||||
|
||||
double seekingRange = 5.0d;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class EntitySpark extends EntityMagicProjectile {
|
||||
|
||||
for(Entity possibleTarget : entities){
|
||||
// Decides if current entity should be replaced.
|
||||
if(target == null || this.getDistanceToEntity(target) > this.getDistanceToEntity(possibleTarget)){
|
||||
if(target == null || this.getDistance(target) > this.getDistance(possibleTarget)){
|
||||
// Decides if new entity is a valid target.
|
||||
if(WizardryUtilities.isValidTarget(this.getThrower(), possibleTarget)){
|
||||
target = possibleTarget;
|
||||
|
||||
@@ -9,7 +9,6 @@ import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryParticleType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -20,9 +19,6 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntitySparkBomb extends EntityBomb {
|
||||
|
||||
/** For client use, because thrower field is not visible. */
|
||||
private int casterID;
|
||||
|
||||
public EntitySparkBomb(World par1World){
|
||||
super(par1World);
|
||||
}
|
||||
@@ -84,7 +80,7 @@ public class EntitySparkBomb extends EntityBomb {
|
||||
&& ((EntityPlayer)targets.get(i)).capabilities.isCreativeMode);
|
||||
|
||||
// Detects (client side) if target is the thrower, to stop particles being spawned around them.
|
||||
if(flag && world.isRemote && targets.get(i).getEntityId() == this.casterID) flag = false;
|
||||
//if(flag && world.isRemote && targets.get(i).getEntityId() == this.casterID) flag = false;
|
||||
|
||||
if(flag){
|
||||
|
||||
@@ -120,16 +116,4 @@ public class EntitySparkBomb extends EntityBomb {
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(ByteBuf data){
|
||||
super.writeSpawnData(data);
|
||||
data.writeInt(this.getThrower().getEntityId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(ByteBuf data){
|
||||
super.readSpawnData(data);
|
||||
this.casterID = data.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,16 @@ package electroblob.wizardry.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
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.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -17,16 +19,17 @@ public class ItemArcaneTome extends Item {
|
||||
|
||||
public ItemArcaneTome(){
|
||||
super();
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
setHasSubtypes(true);
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
for(int i = 1; i < Tier.values().length; i++){
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if (isInCreativeTab(tab)) {
|
||||
for(int i = 1; i < Tier.values().length; i++){
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,13 +54,13 @@ public class ItemArcaneTome extends Item {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean showAdvanced){
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag showAdvanced){
|
||||
Tier tier = Tier.values()[stack.getItemDamage()];
|
||||
Tier tier2 = Tier.values()[stack.getItemDamage() - 1];
|
||||
tooltip.add(tier.getDisplayNameWithFormatting());
|
||||
tooltip.add("\u00A77" + net.minecraft.client.resources.I18n.format("item.wizardry:arcane_tome.desc1",
|
||||
tooltip.add("\u00A77" + net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":arcane_tome.desc1",
|
||||
tier2.getDisplayNameWithFormatting()));
|
||||
tooltip.add("\u00A77" + net.minecraft.client.resources.I18n.format("item.wizardry:arcane_tome.desc2",
|
||||
tooltip.add("\u00A77" + net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":arcane_tome.desc2",
|
||||
tier.getDisplayNameWithFormatting() + "\u00A77"));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,15 @@ package electroblob.wizardry.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -16,8 +18,8 @@ public class ItemArmourUpgrade extends Item {
|
||||
|
||||
public ItemArmourUpgrade(){
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,16 +35,10 @@ public class ItemArmourUpgrade extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced){
|
||||
tooltip.add(net.minecraft.client.resources.I18n.format("item.wizardry:armour_upgrade.desc1", "\u00A77"));
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
tooltip.add(net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":armour_upgrade.desc1", "\u00A77"));
|
||||
tooltip.add(
|
||||
net.minecraft.client.resources.I18n.format("item.wizardry:armour_upgrade.desc2", "\u00A77", "\u00A7d"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems){
|
||||
subItems.add(new ItemStack(this, 1));
|
||||
net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":armour_upgrade.desc2", "\u00A77", "\u00A7d"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package electroblob.wizardry.item;
|
||||
|
||||
import electroblob.wizardry.entity.projectile.EntityFirebomb;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -10,16 +9,13 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFirebomb extends Item {
|
||||
|
||||
public ItemFirebomb(){
|
||||
this.maxStackSize = 16;
|
||||
this.setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
setMaxStackSize(16);
|
||||
setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,16 +32,11 @@ public class ItemFirebomb extends Item {
|
||||
if(!world.isRemote){
|
||||
EntityFirebomb firebomb = new EntityFirebomb(world, player);
|
||||
// This is the standard set of parameters for this method, used by snowballs and ender pearls.
|
||||
firebomb.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0f, 1.5f, 1.0f);
|
||||
firebomb.shoot(player, player.rotationPitch, player.rotationYaw, 0.0f, 1.5f, 1.0f);
|
||||
world.spawnEntity(firebomb);
|
||||
}
|
||||
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item parItem, CreativeTabs parTab, NonNullList<ItemStack> parListSubItems){
|
||||
parListSubItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,14 +2,11 @@ package electroblob.wizardry.item;
|
||||
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
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.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -18,9 +15,9 @@ public class ItemFlamingAxe extends ItemAxe implements IConjuredItem {
|
||||
|
||||
public ItemFlamingAxe(ToolMaterial material){
|
||||
super(material, 8, -3);
|
||||
this.setMaxDamage(getBaseDuration());
|
||||
this.setNoRepair();
|
||||
this.setCreativeTab(null);
|
||||
setMaxDamage(getBaseDuration());
|
||||
setNoRepair();
|
||||
setCreativeTab(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,11 +78,4 @@ public class ItemFlamingAxe extends ItemAxe implements IConjuredItem {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
// Why does this method pass in an item as an argument? It is always the same item the method is invoked on.
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> items){
|
||||
items.add(new ItemStack(this, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,15 +3,12 @@ package electroblob.wizardry.item;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
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.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -20,9 +17,9 @@ public class ItemFrostAxe extends ItemAxe implements IConjuredItem {
|
||||
|
||||
public ItemFrostAxe(ToolMaterial material){
|
||||
super(material, 8, -3);
|
||||
this.setMaxDamage(getBaseDuration());
|
||||
this.setNoRepair();
|
||||
this.setCreativeTab(null);
|
||||
setMaxDamage(getBaseDuration());
|
||||
setNoRepair();
|
||||
setCreativeTab(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,10 +81,4 @@ public class ItemFrostAxe extends ItemAxe implements IConjuredItem {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item parItem, CreativeTabs parTab, NonNullList<ItemStack> parListSubItems){
|
||||
parListSubItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,13 +2,16 @@ package electroblob.wizardry.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.event.DiscoverSpellEvent;
|
||||
import electroblob.wizardry.registry.WizardryAchievements;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -16,7 +19,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -27,7 +29,7 @@ public class ItemIdentificationScroll extends Item {
|
||||
|
||||
public ItemIdentificationScroll(){
|
||||
super();
|
||||
this.setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,9 +40,9 @@ public class ItemIdentificationScroll extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean par4){
|
||||
tooltip.add(net.minecraft.client.resources.I18n.format("item.wizardry:identification_scroll.desc1", "\u00A77"));
|
||||
tooltip.add(net.minecraft.client.resources.I18n.format("item.wizardry:identification_scroll.desc2", "\u00A77"));
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
tooltip.add(net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":identification_scroll.desc1", "\u00A77"));
|
||||
tooltip.add(net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":identification_scroll.desc2", "\u00A77"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,7 +66,7 @@ public class ItemIdentificationScroll extends Item {
|
||||
// Identification scrolls give the chat readout in creative mode, otherwise it looks like
|
||||
// nothing happens!
|
||||
properties.discoverSpell(spell);
|
||||
player.addStat(WizardryAchievements.identify_spell);
|
||||
WizardryAdvancementTriggers.identify_spell.triggerFor(player);
|
||||
player.playSound(SoundEvents.ENTITY_PLAYER_LEVELUP, 1.25f, 1);
|
||||
if(!player.capabilities.isCreativeMode) stack.shrink(1);
|
||||
if(!world.isRemote) player.sendMessage(new TextComponentTranslation("spell.discover",
|
||||
@@ -77,15 +79,10 @@ public class ItemIdentificationScroll extends Item {
|
||||
}
|
||||
// If it found nothing to identify, it says so!
|
||||
if(!world.isRemote) player.sendMessage(
|
||||
new TextComponentTranslation("item.wizardry:identification_scroll.nothing_to_identify"));
|
||||
new TextComponentTranslation("item." + Wizardry.MODID + ":identification_scroll.nothing_to_identify"));
|
||||
}
|
||||
|
||||
return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item parItem, CreativeTabs parTab, NonNullList<ItemStack> parListSubItems){
|
||||
parListSubItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package electroblob.wizardry.item;
|
||||
|
||||
import electroblob.wizardry.entity.projectile.EntityPoisonBomb;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -10,16 +9,13 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPoisonBomb extends Item {
|
||||
|
||||
public ItemPoisonBomb(){
|
||||
this.maxStackSize = 16;
|
||||
this.setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
setMaxStackSize(16);
|
||||
setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,17 +32,11 @@ public class ItemPoisonBomb extends Item {
|
||||
if(!world.isRemote){
|
||||
EntityPoisonBomb poisonbomb = new EntityPoisonBomb(world, player);
|
||||
// This is the standard set of parameters for this method, used by snowballs and ender pearls.
|
||||
poisonbomb.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0f, 1.5f, 1.0f);
|
||||
poisonbomb.shoot(player, player.rotationPitch, player.rotationYaw, 0.0f, 1.5f, 1.0f);
|
||||
world.spawnEntity(poisonbomb);
|
||||
}
|
||||
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems){
|
||||
subItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -26,16 +27,17 @@ public class ItemScroll extends Item {
|
||||
|
||||
public ItemScroll(){
|
||||
super();
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(WizardryTabs.SPELLS);
|
||||
setHasSubtypes(true);
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(WizardryTabs.SPELLS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, NonNullList<ItemStack> list){
|
||||
for(Spell spell : Spell.getSpells(Spell.nonContinuousSpells)){
|
||||
list.add(new ItemStack(item, 1, spell.id()));
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if (isInCreativeTab(tab)) {
|
||||
for(Spell spell : Spell.getSpells(Spell.nonContinuousSpells)){
|
||||
list.add(new ItemStack(this, 1, spell.id()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +116,7 @@ public class ItemScroll extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack){
|
||||
public FontRenderer getFontRenderer(ItemStack stack){
|
||||
return Wizardry.proxy.getFontRenderer(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package electroblob.wizardry.item;
|
||||
|
||||
import electroblob.wizardry.entity.projectile.EntitySmokeBomb;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -10,16 +9,13 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemSmokeBomb extends Item {
|
||||
|
||||
public ItemSmokeBomb(){
|
||||
this.maxStackSize = 16;
|
||||
this.setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
setMaxStackSize(16);
|
||||
setCreativeTab(WizardryTabs.WIZARDRY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,16 +32,11 @@ public class ItemSmokeBomb extends Item {
|
||||
if(!world.isRemote){
|
||||
EntitySmokeBomb smokebomb = new EntitySmokeBomb(world, player);
|
||||
// This is the standard set of parameters for this method, used by snowballs and ender pearls.
|
||||
smokebomb.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, 0.0f, 1.5f, 1.0f);
|
||||
smokebomb.shoot(player, player.rotationPitch, player.rotationYaw, 0.0f, 1.5f, 1.0f);
|
||||
world.spawnEntity(smokebomb);
|
||||
}
|
||||
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems){
|
||||
subItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
package electroblob.wizardry.item;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -17,11 +16,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
public class ItemSpectralArmour extends ItemArmor implements IConjuredItem {
|
||||
|
||||
public ItemSpectralArmour(ArmorMaterial material, int renderIndex, EntityEquipmentSlot armourType){
|
||||
|
||||
super(material, renderIndex, armourType);
|
||||
|
||||
this.setCreativeTab(null);
|
||||
this.setMaxDamage(getBaseDuration());
|
||||
setCreativeTab(null);
|
||||
setMaxDamage(getBaseDuration());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,28 +82,23 @@ public class ItemSpectralArmour extends ItemArmor implements IConjuredItem {
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type){
|
||||
|
||||
if(slot == EntityEquipmentSlot.LEGS) return "wizardry:textures/armour/spectral_armour_legs.png";
|
||||
if(slot == EntityEquipmentSlot.LEGS) return "ebwizardry:textures/armour/spectral_armour_legs.png";
|
||||
|
||||
return "wizardry:textures/armour/spectral_armour.png";
|
||||
return "ebwizardry:textures/armour/spectral_armour.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack,
|
||||
EntityEquipmentSlot armorSlot, net.minecraft.client.model.ModelBiped _default){
|
||||
net.minecraft.client.renderer.GlStateManager.enableBlend();
|
||||
net.minecraft.client.renderer.GlStateManager.tryBlendFuncSeparate(
|
||||
net.minecraft.client.renderer.GlStateManager.SourceFactor.SRC_ALPHA,
|
||||
net.minecraft.client.renderer.GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
|
||||
net.minecraft.client.renderer.GlStateManager.SourceFactor.ONE,
|
||||
net.minecraft.client.renderer.GlStateManager.DestFactor.ZERO);
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack,
|
||||
EntityEquipmentSlot armorSlot, ModelBiped _default){
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(
|
||||
GlStateManager.SourceFactor.SRC_ALPHA,
|
||||
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
|
||||
GlStateManager.SourceFactor.ONE,
|
||||
GlStateManager.DestFactor.ZERO
|
||||
);
|
||||
return super.getArmorModel(entityLiving, itemStack, armorSlot, _default);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item parItem, CreativeTabs parTab, NonNullList<ItemStack> parListSubItems){
|
||||
parListSubItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import javax.annotation.Nullable;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -14,7 +13,6 @@ import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArrow;
|
||||
import net.minecraft.item.ItemBow;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,7 +20,6 @@ import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.world.World;
|
||||
@@ -33,9 +30,9 @@ public class ItemSpectralBow extends ItemBow implements IConjuredItem {
|
||||
|
||||
public ItemSpectralBow(){
|
||||
super();
|
||||
this.setMaxDamage(getBaseDuration());
|
||||
this.setNoRepair();
|
||||
this.setCreativeTab(null);
|
||||
setMaxDamage(getBaseDuration());
|
||||
setNoRepair();
|
||||
setCreativeTab(null);
|
||||
this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter(){
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn){
|
||||
@@ -183,7 +180,7 @@ public class ItemSpectralBow extends ItemBow implements IConjuredItem {
|
||||
|
||||
ItemArrow itemarrow = (ItemArrow)Items.ARROW;
|
||||
EntityArrow entityarrow = itemarrow.createArrow(world, new ItemStack(itemarrow), entityplayer);
|
||||
entityarrow.setAim(entityplayer, entityplayer.rotationPitch, entityplayer.rotationYaw, 0.0F,
|
||||
entityarrow.shoot(entityplayer, entityplayer.rotationPitch, entityplayer.rotationYaw, 0.0F,
|
||||
f * 3.0F, 1.0F);
|
||||
|
||||
if(f == 1.0F){
|
||||
@@ -220,10 +217,4 @@ public class ItemSpectralBow extends ItemBow implements IConjuredItem {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems){
|
||||
subItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package electroblob.wizardry.item;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -15,9 +12,9 @@ public class ItemSpectralPickaxe extends ItemPickaxe implements IConjuredItem {
|
||||
|
||||
public ItemSpectralPickaxe(ToolMaterial material){
|
||||
super(material);
|
||||
this.setMaxDamage(getBaseDuration());
|
||||
this.setNoRepair();
|
||||
this.setCreativeTab(null);
|
||||
setMaxDamage(getBaseDuration());
|
||||
setNoRepair();
|
||||
setCreativeTab(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,10 +69,4 @@ public class ItemSpectralPickaxe extends ItemPickaxe implements IConjuredItem {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems){
|
||||
subItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package electroblob.wizardry.item;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -15,9 +12,9 @@ public class ItemSpectralSword extends ItemSword implements IConjuredItem {
|
||||
|
||||
public ItemSpectralSword(ToolMaterial material){
|
||||
super(material);
|
||||
this.setMaxDamage(getBaseDuration());
|
||||
this.setNoRepair();
|
||||
this.setCreativeTab(null);
|
||||
setMaxDamage(getBaseDuration());
|
||||
setNoRepair();
|
||||
setCreativeTab(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,10 +69,4 @@ public class ItemSpectralSword extends ItemSword implements IConjuredItem {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems){
|
||||
subItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.WizardryGuiHandler;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -25,19 +29,21 @@ public class ItemSpellBook extends Item {
|
||||
|
||||
public ItemSpellBook(){
|
||||
super();
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(WizardryTabs.SPELLS);
|
||||
setHasSubtypes(true);
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(WizardryTabs.SPELLS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
// In this particular case, getTotalSpellCount() is a more efficient way of doing this since the spell instance
|
||||
// is not required, only the id.
|
||||
for(int i = 0; i < Spell.getTotalSpellCount(); i++){
|
||||
// i+1 is used so that the metadata ties up with the id() method. In other words, the none spell has id
|
||||
// 0 and since this is not used as a spell book the metadata starts at 1.
|
||||
list.add(new ItemStack(item, 1, i + 1));
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if (isInCreativeTab(tab)) {
|
||||
// In this particular case, getTotalSpellCount() is a more efficient way of doing this since the spell instance
|
||||
// is not required, only the id.
|
||||
for(int i = 0; i < Spell.getTotalSpellCount(); i++){
|
||||
// i+1 is used so that the metadata ties up with the id() method. In other words, the none spell has id
|
||||
// 0 and since this is not used as a spell book the metadata starts at 1.
|
||||
list.add(new ItemStack(this, 1, i + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,14 +56,15 @@ public class ItemSpellBook extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip, boolean advanced){
|
||||
public void addInformation(ItemStack itemstack, World world, List<String> tooltip, ITooltipFlag advanced){
|
||||
// Tooltip is left blank for wizards buying generic spell books.
|
||||
if(itemstack.getItemDamage() != OreDictionary.WILDCARD_VALUE){
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().player;
|
||||
|
||||
Spell spell = Spell.get(itemstack.getItemDamage());
|
||||
|
||||
boolean discovered = true;
|
||||
if(Wizardry.settings.discoveryMode && !player.capabilities.isCreativeMode && WizardData.get(player) != null
|
||||
if(player != null && Wizardry.settings.discoveryMode && !player.capabilities.isCreativeMode && WizardData.get(player) != null
|
||||
&& !WizardData.get(player).hasSpellBeenDiscovered(spell)){
|
||||
discovered = false;
|
||||
}
|
||||
@@ -74,7 +81,7 @@ public class ItemSpellBook extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack){
|
||||
public FontRenderer getFontRenderer(ItemStack stack){
|
||||
return Wizardry.proxy.getFontRenderer(stack);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import electroblob.wizardry.event.SpellCastEvent;
|
||||
import electroblob.wizardry.event.SpellCastEvent.Source;
|
||||
import electroblob.wizardry.packet.PacketCastSpell;
|
||||
import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import electroblob.wizardry.registry.WizardryAchievements;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
@@ -21,7 +21,10 @@ import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WandHelper;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -33,7 +36,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
@@ -70,7 +72,7 @@ public class ItemWand extends Item {
|
||||
}
|
||||
this.tier = tier;
|
||||
this.element = element;
|
||||
this.setMaxDamage(this.tier.maxCharge);
|
||||
setMaxDamage(this.tier.maxCharge);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,16 +83,10 @@ public class ItemWand extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack){
|
||||
public FontRenderer getFontRenderer(ItemStack stack){
|
||||
return Wizardry.proxy.getFontRenderer(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item parItem, CreativeTabs parTab, NonNullList<ItemStack> parListSubItems){
|
||||
parListSubItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
|
||||
// Max damage is modifiable with upgrades.
|
||||
@Override
|
||||
public int getMaxDamage(ItemStack itemstack){
|
||||
@@ -99,11 +95,6 @@ public class ItemWand extends Item {
|
||||
* WandHelper.getUpgradeLevel(itemstack, WizardryItems.storage_upgrade)) + 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer){
|
||||
par3EntityPlayer.addStat(WizardryAchievements.arcane_initiate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemstack, World world, Entity entity, int slot, boolean isHeld){
|
||||
|
||||
@@ -120,10 +111,8 @@ public class ItemWand extends Item {
|
||||
if(entity instanceof EntityPlayer && this.element != null && this.element != Element.MAGIC){
|
||||
// As it stands, this will trigger every tick. Not ideal, but I can't find a way to detect if a player
|
||||
// has a certain achievement.
|
||||
// EDIT: There is a way to check, using StatFileWriter#hasAchievementUnlocked, but this ends up calling the
|
||||
// same
|
||||
// thing as addStat anyway, meaning there's no point and it's probably not much of a problem anyway.
|
||||
((EntityPlayer)entity).addStat(WizardryAchievements.elemental);
|
||||
// TODO: check if this is somehow triggerable via JSON conditions.
|
||||
WizardryAdvancementTriggers.element_master.triggerFor((EntityPlayer)entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,10 +144,11 @@ public class ItemWand extends Item {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> text, boolean advanced){
|
||||
|
||||
public void addInformation(ItemStack itemstack, World world, List<String> text, ITooltipFlag advanced){
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().player;
|
||||
if (player == null) { return; }
|
||||
// +0.5f is necessary due to the error in the way floats are calculated.
|
||||
if(element != null) text.add("\u00A78" + net.minecraft.client.resources.I18n.format("item.wizardry:wand.buff",
|
||||
if(element != null) text.add("\u00A78" + net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":wand.buff",
|
||||
(int)((tier.level + 1) * Constants.DAMAGE_INCREASE_PER_TIER * 100 + 0.5f) + "%",
|
||||
element.getDisplayName()));
|
||||
|
||||
@@ -170,11 +160,11 @@ public class ItemWand extends Item {
|
||||
discovered = false;
|
||||
}
|
||||
|
||||
text.add("\u00A77" + net.minecraft.client.resources.I18n.format("item.wizardry:wand.spell",
|
||||
text.add("\u00A77" + net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":wand.spell",
|
||||
discovered ? "\u00A77" + spell.getDisplayNameWithFormatting()
|
||||
: "#\u00A79" + SpellGlyphData.getGlyphName(spell, player.world)));
|
||||
|
||||
text.add("\u00A79" + net.minecraft.client.resources.I18n.format("item.wizardry:wand.mana",
|
||||
text.add("\u00A79" + net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":wand.mana",
|
||||
(this.getMaxDamage(itemstack) - this.getDamage(itemstack)), this.getMaxDamage(itemstack)));
|
||||
}
|
||||
|
||||
@@ -353,8 +343,8 @@ public class ItemWand extends Item {
|
||||
if(player.isSneaking() && entity instanceof EntityPlayer && WizardData.get(player) != null){
|
||||
// This is one of those "the method doing the work looks as if it's just returning a value" situations.
|
||||
// ... I know, right?! I feel very programmer-y. But it's not too confusing here, and it looks neat.
|
||||
String string = WizardData.get(player).toggleAlly((EntityPlayer)entity) ? "item.wizardry:wand.addally"
|
||||
: "item.wizardry:wand.removeally";
|
||||
String string = WizardData.get(player).toggleAlly((EntityPlayer)entity) ? "item." + Wizardry.MODID + ":wand.addally"
|
||||
: "item." + Wizardry.MODID + ":wand.removeally";
|
||||
if(!player.world.isRemote) player.sendMessage(new TextComponentTranslation(string, entity.getName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user