mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-24 05:44:32 +00:00
Spring Cleaning (#127)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
1544c1bf0d
commit
3b2b31f733
413 files changed
+9272
-17658
No files matched your search
@@ -65,7 +65,6 @@ import WayofTime.alchemicalWizardry.common.CommonProxy;
|
||||
import WayofTime.alchemicalWizardry.common.LifeBucketHandler;
|
||||
import WayofTime.alchemicalWizardry.common.LifeEssence;
|
||||
import WayofTime.alchemicalWizardry.common.ModLivingDropsEvent;
|
||||
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
|
||||
import WayofTime.alchemicalWizardry.common.achievements.ModAchievements;
|
||||
import WayofTime.alchemicalWizardry.common.alchemy.CombinedPotionRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.block.ArmourForge;
|
||||
@@ -627,8 +626,6 @@ public class AlchemicalWizardry {
|
||||
serverSide = "WayofTime.alchemicalWizardry.common.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static final HoldingPacketHandler packetPipeline = new HoldingPacketHandler();
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
@@ -662,8 +659,8 @@ public class AlchemicalWizardry {
|
||||
f.set(null, newPotionTypes);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("Severe error, please report this to the mod author:");
|
||||
System.err.println(e);
|
||||
AlchemicalWizardry.logger.error("Severe error, please report this to the mod author:");
|
||||
AlchemicalWizardry.logger.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -689,7 +686,6 @@ public class AlchemicalWizardry {
|
||||
Object eventHook = new AlchemicalWizardryEventHooks();
|
||||
FMLCommonHandler.instance().bus().register(eventHook);
|
||||
MinecraftForge.EVENT_BUS.register(eventHook);
|
||||
NewPacketHandler.INSTANCE.ordinal();
|
||||
HoldingPacketHandler.init();
|
||||
ClientToServerPacketHandler.init();
|
||||
ModAchievements.init();
|
||||
@@ -727,7 +723,7 @@ public class AlchemicalWizardry {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1967,43 +1963,43 @@ public class AlchemicalWizardry {
|
||||
new ItemStack(ModItems.standardBindingAgent),
|
||||
1,
|
||||
3,
|
||||
this.standardBindingAgentDungeonChance / 5));
|
||||
standardBindingAgentDungeonChance / 5));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(ModItems.mundanePowerCatalyst),
|
||||
1,
|
||||
1,
|
||||
this.mundanePowerCatalystDungeonChance / 5));
|
||||
mundanePowerCatalystDungeonChance / 5));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(ModItems.mundaneLengtheningCatalyst),
|
||||
1,
|
||||
1,
|
||||
this.mundaneLengtheningCatalystDungeonChance / 5));
|
||||
mundaneLengtheningCatalystDungeonChance / 5));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(ModItems.averagePowerCatalyst),
|
||||
1,
|
||||
1,
|
||||
this.averagePowerCatalystDungeonChance / 5));
|
||||
averagePowerCatalystDungeonChance / 5));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(ModItems.averageLengtheningCatalyst),
|
||||
1,
|
||||
1,
|
||||
this.averageLengtheningCatalystDungeonChance / 5));
|
||||
averageLengtheningCatalystDungeonChance / 5));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(ModItems.greaterPowerCatalyst),
|
||||
1,
|
||||
1,
|
||||
this.greaterPowerCatalystDungeonChance / 5));
|
||||
greaterPowerCatalystDungeonChance / 5));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(ModItems.greaterLengtheningCatalyst),
|
||||
1,
|
||||
1,
|
||||
this.greaterLengtheningCatalystDungeonChance / 5));
|
||||
greaterLengtheningCatalystDungeonChance / 5));
|
||||
|
||||
// Ore Dictionary Registration
|
||||
OreDictionary.registerOre("oreCoal", Blocks.coal_ore);
|
||||
@@ -3310,7 +3306,7 @@ public class AlchemicalWizardry {
|
||||
RecipeHolder.init();
|
||||
long finalTime = System.nanoTime();
|
||||
AlchemicalWizardry.logger
|
||||
.info("Recipe Holder initialized: took " + (finalTime - initialTime) / 1000000f + "ms.");
|
||||
.info("Recipe Holder initialized: took {}ms.", (finalTime - initialTime) / 1000000f);
|
||||
|
||||
ModItems.itemMailCatalogue = new ItemMailOrderCatalogue().setUnlocalizedName("itemMailCatalogue");
|
||||
GameRegistry.registerItem(ModItems.itemMailCatalogue, "itemMailCatalogue");
|
||||
@@ -3424,7 +3420,7 @@ public class AlchemicalWizardry {
|
||||
.newInstance("registerGrinderBlacklist", mobClasses[i]);
|
||||
method.invoke(null, bloodMagic, "MineFactoryReloaded", message);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.ERROR, "Failed to blacklist Grinder for " + mobs[i]);
|
||||
logger.log(Level.ERROR, "Failed to blacklist Grinder for {}", mobs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3737,7 +3733,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectWater(),
|
||||
"Ritual of the Full Spring",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/AlchemyArrays/WaterArray.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/AlchemyArrays/WaterArray.png"),
|
||||
0,
|
||||
30,
|
||||
255,
|
||||
@@ -3755,7 +3751,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectLava(),
|
||||
"Serenade of the Nether",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/AlchemyArrays/LavaArray.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/AlchemyArrays/LavaArray.png"),
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
@@ -3773,7 +3769,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectGrowth(),
|
||||
"Ritual of the Green Grove",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/AlchemyArrays/GreenGroveArray.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/AlchemyArrays/GreenGroveArray.png"),
|
||||
244,
|
||||
164,
|
||||
96,
|
||||
@@ -3791,7 +3787,9 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectInterdiction(),
|
||||
"Interdiction Ritual",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/AlchemyArrays/InterdictionArray.png"),
|
||||
new ResourceLocation(
|
||||
"alchemicalwizardry",
|
||||
"textures/models/AlchemyArrays/InterdictionArray.png"),
|
||||
27,
|
||||
227,
|
||||
206,
|
||||
@@ -3809,7 +3807,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectContainment(),
|
||||
"Ritual of Containment",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
186,
|
||||
21,
|
||||
21,
|
||||
@@ -3827,7 +3825,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectBinding(),
|
||||
"Ritual of Binding",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/TransCircleBinding.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/TransCircleBinding.png"),
|
||||
193,
|
||||
7,
|
||||
7,
|
||||
@@ -3845,7 +3843,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectUnbinding(),
|
||||
"Ritual of Unbinding",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
193,
|
||||
7,
|
||||
7,
|
||||
@@ -3863,7 +3861,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectJumping(),
|
||||
"Ritual of the High Jump",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
10,
|
||||
183,
|
||||
173,
|
||||
@@ -3881,7 +3879,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectMagnetic(),
|
||||
"Ritual of Magnetism",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/AlchemyArrays/MagnetismArray.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/AlchemyArrays/MagnetismArray.png"),
|
||||
126,
|
||||
39,
|
||||
0,
|
||||
@@ -3899,7 +3897,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectCrushing(),
|
||||
"Ritual of the Crusher",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -3917,7 +3915,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectLeap(),
|
||||
"Ritual of Speed",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -3935,7 +3933,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectAnimalGrowth(),
|
||||
"Ritual of the Shepherd",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -3954,7 +3952,8 @@ public class AlchemicalWizardry {
|
||||
"Well of Suffering",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation(
|
||||
"alchemicalwizardry:textures/models/AlchemyArrays/WellOfSufferingArray.png"),
|
||||
"alchemicalwizardry",
|
||||
"textures/models/AlchemyArrays/WellOfSufferingArray.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -3972,7 +3971,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectHealing(),
|
||||
"Ritual of Regeneration",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -3990,7 +3989,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectFeatheredKnife(),
|
||||
"Ritual of the Feathered Knife",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4008,7 +4007,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectFeatheredEarth(),
|
||||
"Ritual of the Feathered Earth",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4026,7 +4025,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectBiomeChanger(),
|
||||
"Ritual of Gaia's Transformation",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4044,7 +4043,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectFlight(),
|
||||
"Reverence of the Condor",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4062,7 +4061,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectSummonMeteor(),
|
||||
"Mark of the Falling Tower",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4080,7 +4079,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectAutoAlchemy(),
|
||||
"Ballad of Alchemy",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4098,7 +4097,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectExpulsion(),
|
||||
"Aura of Expulsion",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4116,7 +4115,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectSupression(),
|
||||
"Dome of Supression",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4134,7 +4133,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectItemSuction(),
|
||||
"Call of the Zephyr",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4152,7 +4151,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectHarvest(),
|
||||
"Reap of the Harvest Moon",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4170,7 +4169,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectLifeConduit(),
|
||||
"Cry of the Eternal Soul",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4188,7 +4187,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectEllipsoid(),
|
||||
"Focus of the Ellipsoid",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4206,7 +4205,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectEvaporation(),
|
||||
"Song of Evaporation",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4224,7 +4223,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectSpawnWard(),
|
||||
"Ward of Sacrosanctity",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4242,7 +4241,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectVeilOfEvil(),
|
||||
"Veil of Evil",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4260,7 +4259,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectFullStomach(),
|
||||
"Requiem of the Satiated Stomach",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/SimpleTransCircle.png"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -4278,7 +4277,7 @@ public class AlchemicalWizardry {
|
||||
new RitualEffectDemonPortal(),
|
||||
"Convocation of the Damned",
|
||||
new AlchemyCircleRenderer(
|
||||
new ResourceLocation("alchemicalwizardry:textures/models/TransCircleDemon.png"),
|
||||
new ResourceLocation("alchemicalwizardry", "textures/models/TransCircleDemon.png"),
|
||||
220,
|
||||
22,
|
||||
22,
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
@@ -49,7 +50,7 @@ public class BloodMagicConfiguration {
|
||||
public static void init(File configFile) {
|
||||
for (String s : DEFAULT_COLOR_LIST.split(";")) {
|
||||
String[] ct = s.split(",");
|
||||
colorList.add(new ColourThreshold(Integer.valueOf(ct[0].trim()), ct[1].trim()));
|
||||
colorList.add(new ColourThreshold(Integer.parseInt(ct[0].trim()), ct[1].trim()));
|
||||
}
|
||||
|
||||
config = new Configuration(configFile);
|
||||
@@ -109,15 +110,12 @@ public class BloodMagicConfiguration {
|
||||
0,
|
||||
Integer.MAX_VALUE,
|
||||
"The default LP cost to use for meteors if the \"cost\" property is not present in its config file.\n");
|
||||
AlchemicalWizardry.defaultMeteorBlock = config.getString(
|
||||
"defaultMeteorBlock",
|
||||
"meteor",
|
||||
"",
|
||||
"The block to use for filler in meteors if none is provided in the meteor's config file and "
|
||||
+ "that\nmeteor's fillerChance is greater than 0. Also used as a fallback for empty ore "
|
||||
+ "lists in meteor configs.\nSpecify the block with the "
|
||||
+ "format:\n\"modId:itemName:meta\"\nDefaults to minecraft:stone:0 if no block is provided or "
|
||||
+ "the provided block cannot be found.");
|
||||
AlchemicalWizardry.defaultMeteorBlock = config.getString("defaultMeteorBlock", "meteor", "", """
|
||||
The block to use for filler in meteors if none is provided in the meteor's config file and that
|
||||
meteor's fillerChance is greater than 0. Also used as a fallback for empty ore lists in meteor configs.
|
||||
Specify the block with the format:
|
||||
"modId:itemName:meta"
|
||||
Defaults to minecraft:stone:0 if no block is provided or the provided block cannot be found.""");
|
||||
MeteorComponent.setDefaultMeteorBlock();
|
||||
AlchemicalWizardry.allowedCrushedOresArray = config.get(
|
||||
"oreCrushing",
|
||||
@@ -639,10 +637,11 @@ public class BloodMagicConfiguration {
|
||||
"altar blocks",
|
||||
"fifthTierBeacons",
|
||||
new String[] { "minecraft:beacon", "etfuturum:beacon", "chisel:beacon:*" },
|
||||
"Valid blocks for the Blood Altar's tier 5 beacons:\n"
|
||||
+ "Use the following format for all of these entries: mod:block(:meta). Meta * or 32767 allows for any meta.\n"
|
||||
+ "An empty entry allows for any non-air block to be used for that part of the structure.\n"
|
||||
+ "Invalid or missing blocks are skipped. If all entries are invalid, any block can be used as a fallback.");
|
||||
"""
|
||||
Valid blocks for the Blood Altar's tier 5 beacons:
|
||||
Use the following format for all of these entries: mod:block(:meta). Meta * or 32767 allows for any meta.
|
||||
An empty entry allows for any non-air block to be used for that part of the structure.
|
||||
Invalid or missing blocks are skipped. If all entries are invalid, any block can be used as a fallback.""");
|
||||
AlchemicalWizardry.thirdTierCaps = readBlockConfig(
|
||||
"altar blocks",
|
||||
"thirdTierCaps",
|
||||
@@ -680,10 +679,9 @@ public class BloodMagicConfiguration {
|
||||
|
||||
public static void loadCustomLPValues() {
|
||||
AlchemicalWizardry.lpPerSactificeCustom = new HashMap<>();
|
||||
for (Object object : EntityList.stringToClassMapping.entrySet()) {
|
||||
Entry entry = (Entry) object;
|
||||
String entityName = (String) entry.getKey();
|
||||
Class entityClass = (Class) entry.getValue();
|
||||
for (Entry<String, Class<? extends Entity>> entry : EntityList.stringToClassMapping.entrySet()) {
|
||||
String entityName = entry.getKey();
|
||||
Class<? extends Entity> entityClass = entry.getValue();
|
||||
if (EntityLivingBase.class.isAssignableFrom(entityClass)
|
||||
&& !Modifier.isAbstract(entityClass.getModifiers())) {
|
||||
int lpAmount = 500;
|
||||
@@ -717,15 +715,13 @@ public class BloodMagicConfiguration {
|
||||
}
|
||||
|
||||
public static void loadBlacklist() {
|
||||
AlchemicalWizardry.wellBlacklist = new ArrayList<Class>();
|
||||
for (Object o : stringToClassMapping.entrySet()) {
|
||||
Entry entry = (Entry) o;
|
||||
Class curClass = (Class) entry.getValue();
|
||||
AlchemicalWizardry.wellBlacklist = new ArrayList<>();
|
||||
for (Entry<String, Class<? extends Entity>> entry : stringToClassMapping.entrySet()) {
|
||||
Class<? extends Entity> curClass = entry.getValue();
|
||||
boolean valid = EntityLivingBase.class.isAssignableFrom(curClass)
|
||||
&& !Modifier.isAbstract(curClass.getModifiers());
|
||||
if (valid) {
|
||||
boolean blacklisted = config.get("wellOfSufferingBlackList", entry.getKey().toString(), false)
|
||||
.getBoolean();
|
||||
boolean blacklisted = config.get("wellOfSufferingBlackList", entry.getKey(), false).getBoolean();
|
||||
if (blacklisted) AlchemicalWizardry.wellBlacklist.add(curClass);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
@@ -7,42 +9,11 @@ import cpw.mods.fml.common.registry.GameData;
|
||||
/**
|
||||
* A Block with a set metadata. Similar to an ItemStack.
|
||||
*/
|
||||
public class BlockStack {
|
||||
|
||||
private final Block block;
|
||||
private final int meta;
|
||||
|
||||
public BlockStack(Block block, int meta) {
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public BlockStack(Block block) {
|
||||
this(block, 0);
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
public record BlockStack(Block block, int meta) {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String toString() {
|
||||
return GameData.getBlockRegistry().getNameForObject(block) + ":" + meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
BlockStack blockStack = (BlockStack) obj;
|
||||
|
||||
return blockStack.block == this.getBlock() && blockStack.meta == this.getMeta();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
}
|
||||
@@ -2,27 +2,7 @@ package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ColourAndCoords {
|
||||
|
||||
public int colourRed;
|
||||
public int colourGreen;
|
||||
public int colourBlue;
|
||||
public int colourIntensity;
|
||||
|
||||
public int xCoord;
|
||||
public int yCoord;
|
||||
public int zCoord;
|
||||
|
||||
public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z) {
|
||||
this.colourRed = red;
|
||||
this.colourGreen = green;
|
||||
this.colourBlue = blue;
|
||||
this.colourIntensity = intensity;
|
||||
|
||||
this.xCoord = x;
|
||||
this.yCoord = y;
|
||||
this.zCoord = z;
|
||||
}
|
||||
public record ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z) {
|
||||
|
||||
public static ColourAndCoords readFromNBT(NBTTagCompound tag) {
|
||||
return new ColourAndCoords(
|
||||
@@ -36,13 +16,13 @@ public class ColourAndCoords {
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("colourRed", colourRed);
|
||||
tag.setInteger("colourGreen", colourGreen);
|
||||
tag.setInteger("colourBlue", colourBlue);
|
||||
tag.setInteger("colourIntensity", colourIntensity);
|
||||
tag.setInteger("xCoord", xCoord);
|
||||
tag.setInteger("yCoord", yCoord);
|
||||
tag.setInteger("zCoord", zCoord);
|
||||
tag.setInteger("colourRed", red);
|
||||
tag.setInteger("colourGreen", green);
|
||||
tag.setInteger("colourBlue", blue);
|
||||
tag.setInteger("colourIntensity", intensity);
|
||||
tag.setInteger("xCoord", x);
|
||||
tag.setInteger("yCoord", y);
|
||||
tag.setInteger("zCoord", z);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@@ -2,40 +2,17 @@ package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class Int3 {
|
||||
|
||||
public int xCoord;
|
||||
public int yCoord;
|
||||
public int zCoord;
|
||||
|
||||
public Int3(int xCoord, int yCoord, int zCoord) {
|
||||
this.xCoord = xCoord;
|
||||
this.yCoord = yCoord;
|
||||
this.zCoord = zCoord;
|
||||
}
|
||||
public record Int3(int x, int y, int z) {
|
||||
|
||||
public static Int3 readFromNBT(NBTTagCompound tag) {
|
||||
return new Int3(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord"));
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("xCoord", xCoord);
|
||||
tag.setInteger("yCoord", yCoord);
|
||||
tag.setInteger("zCoord", zCoord);
|
||||
tag.setInteger("xCoord", x);
|
||||
tag.setInteger("yCoord", y);
|
||||
tag.setInteger("zCoord", z);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof Int3
|
||||
? ((Int3) o).xCoord == this.xCoord && ((Int3) o).yCoord == this.yCoord
|
||||
&& ((Int3) o).zCoord == this.zCoord
|
||||
: false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.xCoord + this.yCoord << 8 + this.zCoord << 16;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +1,17 @@
|
||||
package WayofTime.alchemicalWizardry.api;
|
||||
|
||||
/*
|
||||
* Created in Scala by Alex-Hawks Translated and implemented by Arcaratus
|
||||
*/
|
||||
public class Vector3 {
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public int x, y, z;
|
||||
public record Vector3(int x, int y, int z) {
|
||||
|
||||
public Vector3(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Vector3 add(Vector3 vec1) {
|
||||
return new Vector3(this.x + vec1.x, this.y + vec1.y, this.z + vec1.z);
|
||||
public Vector3 add(Vector3 vec) {
|
||||
return new Vector3(this.x + vec.x, this.y + vec.y, this.z + vec.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public String toString() {
|
||||
return "V3(" + x + "}, " + y + "}," + z + "})";
|
||||
return "V3({" + x + "}, {" + y + "}, {" + z + "})";
|
||||
}
|
||||
|
||||
private boolean canEqual(Object object) {
|
||||
return object instanceof Vector3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
return object == this || object instanceof Vector3 && canEqual(this)
|
||||
&& this.x == ((Vector3) object).x
|
||||
&& this.y == ((Vector3) object).y
|
||||
&& this.z == ((Vector3) object).z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 48131 * x - 95021 * y + z;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AlchemicalPotionCreationHandler {
|
||||
|
||||
public static ArrayList<AlchemyPotionHandlerComponent> registeredPotionEffects = new ArrayList();
|
||||
public static ArrayList<AlchemyPotionHandlerComponent> registeredPotionEffects = new ArrayList<>();
|
||||
|
||||
public static void addPotion(ItemStack itemStack, int potionID, int tickDuration) {
|
||||
registeredPotionEffects.add(new AlchemyPotionHandlerComponent(itemStack, potionID, tickDuration));
|
||||
@@ -15,7 +15,7 @@ public class AlchemicalPotionCreationHandler {
|
||||
public static int getPotionIDForStack(ItemStack itemStack) {
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) {
|
||||
if (aphc.compareItemStack(itemStack)) {
|
||||
return aphc.getPotionID();
|
||||
return aphc.potionID();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class AlchemicalPotionCreationHandler {
|
||||
{
|
||||
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) {
|
||||
if (aphc.compareItemStack(itemStack)) {
|
||||
return aphc.getTickDuration();
|
||||
return aphc.tickDuration();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-23
@@ -3,17 +3,7 @@ package WayofTime.alchemicalWizardry.api.alchemy;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AlchemyPotionHandlerComponent {
|
||||
|
||||
private ItemStack itemStack;
|
||||
private int potionID;
|
||||
private int tickDuration;
|
||||
|
||||
public AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration) {
|
||||
this.itemStack = itemStack;
|
||||
this.potionID = potionID;
|
||||
this.tickDuration = tickDuration;
|
||||
}
|
||||
public record AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration) {
|
||||
|
||||
public boolean compareItemStack(ItemStack comparedStack) {
|
||||
if (comparedStack != null && itemStack != null) {
|
||||
@@ -30,16 +20,4 @@ public class AlchemyPotionHandlerComponent {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public int getPotionID() {
|
||||
return this.potionID;
|
||||
}
|
||||
|
||||
public int getTickDuration() {
|
||||
return this.tickDuration;
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class AlchemyPotionHelper {
|
||||
|
||||
private int potionID;
|
||||
private int tickDuration;
|
||||
private final int potionID;
|
||||
private final int tickDuration;
|
||||
private int concentration;
|
||||
private int durationFactor;
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class AlchemyRecipe {
|
||||
|
||||
private ItemStack output;
|
||||
private ItemStack[] recipe;
|
||||
private int bloodOrbLevel;
|
||||
private int amountNeeded;
|
||||
private final ItemStack output;
|
||||
private final ItemStack[] recipe;
|
||||
private final int bloodOrbLevel;
|
||||
private final int amountNeeded;
|
||||
|
||||
public AlchemyRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) {
|
||||
this.output = output;
|
||||
|
||||
@@ -9,7 +9,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
|
||||
public class AlchemyRecipeRegistry {
|
||||
|
||||
public static List<AlchemyRecipe> recipes = new ArrayList();
|
||||
public static List<AlchemyRecipe> recipes = new ArrayList<>();
|
||||
|
||||
public static void registerRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) {
|
||||
recipes.add(new AlchemyRecipe(output, amountNeeded, recipe, bloodOrbLevel));
|
||||
|
||||
@@ -1,41 +1,7 @@
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
public class Reagent {
|
||||
|
||||
public final String name;
|
||||
public record Reagent(String name, int red, int green, int blue, int intensity) {
|
||||
|
||||
public static final int REAGENT_SIZE = 1000;
|
||||
|
||||
private int colourRed = 0;
|
||||
private int colourGreen = 0;
|
||||
private int colourBlue = 0;
|
||||
private int colourIntensity = 255;
|
||||
|
||||
public Reagent(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setColour(int red, int green, int blue, int intensity) {
|
||||
this.colourRed = red;
|
||||
this.colourGreen = green;
|
||||
this.colourBlue = blue;
|
||||
this.colourIntensity = intensity;
|
||||
}
|
||||
|
||||
public int getColourRed() {
|
||||
return colourRed;
|
||||
}
|
||||
|
||||
public int getColourGreen() {
|
||||
return colourGreen;
|
||||
}
|
||||
|
||||
public int getColourBlue() {
|
||||
return colourBlue;
|
||||
}
|
||||
|
||||
public int getColourIntensity() {
|
||||
return colourIntensity;
|
||||
}
|
||||
|
||||
}
|
||||
+38
-59
@@ -1,6 +1,7 @@
|
||||
package WayofTime.alchemicalWizardry.api.alchemy.energy;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
@@ -9,8 +10,8 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ReagentRegistry {
|
||||
|
||||
public static Map<String, Reagent> reagentList = new HashMap();
|
||||
public static Map<ItemStack, ReagentStack> itemToReagentMap = new HashMap();
|
||||
public static Map<String, Reagent> reagentList = new LinkedHashMap<>();
|
||||
public static Map<ItemStack, ReagentStack> itemToReagentMap = new HashMap<>();
|
||||
|
||||
public static Reagent sanctusReagent;
|
||||
public static Reagent incendiumReagent;
|
||||
@@ -21,7 +22,6 @@ public class ReagentRegistry {
|
||||
public static Reagent crystallosReagent;
|
||||
public static Reagent terraeReagent;
|
||||
public static Reagent tenebraeReagent;
|
||||
|
||||
public static Reagent offensaReagent;
|
||||
public static Reagent praesidiumReagent;
|
||||
public static Reagent orbisTerraeReagent;
|
||||
@@ -30,71 +30,51 @@ public class ReagentRegistry {
|
||||
public static Reagent potentiaReagent;
|
||||
|
||||
public static void initReagents() {
|
||||
sanctusReagent = new Reagent("sanctus");
|
||||
incendiumReagent = new Reagent("incendium");
|
||||
aquasalusReagent = new Reagent("aquasalus");
|
||||
magicalesReagent = new Reagent("magicales");
|
||||
aetherReagent = new Reagent("aether");
|
||||
crepitousReagent = new Reagent("crepitous");
|
||||
crystallosReagent = new Reagent("crystallos");
|
||||
terraeReagent = new Reagent("terrae");
|
||||
tenebraeReagent = new Reagent("tenebrae");
|
||||
offensaReagent = new Reagent("offensa");
|
||||
praesidiumReagent = new Reagent("praesidium");
|
||||
orbisTerraeReagent = new Reagent("orbisTerrae");
|
||||
virtusReagent = new Reagent("virtus");
|
||||
reductusReagent = new Reagent("reductus");
|
||||
potentiaReagent = new Reagent("potentia");
|
||||
sanctusReagent = new Reagent("sanctus", 255, 255, 0, 255);
|
||||
incendiumReagent = new Reagent("incendium", 255, 0, 0, 255);
|
||||
aquasalusReagent = new Reagent("aquasalus", 0, 0, 255, 255);
|
||||
magicalesReagent = new Reagent("magicales", 150, 0, 146, 255);
|
||||
aetherReagent = new Reagent("aether", 105, 223, 86, 255);
|
||||
crepitousReagent = new Reagent("crepitous", 145, 145, 145, 255);
|
||||
crystallosReagent = new Reagent("crystallos", 135, 255, 231, 255);
|
||||
terraeReagent = new Reagent("terrae", 147, 48, 13, 255);
|
||||
tenebraeReagent = new Reagent("tenebrae", 86, 86, 86, 255);
|
||||
offensaReagent = new Reagent("offensa", 126, 0, 0, 255);
|
||||
praesidiumReagent = new Reagent("praesidium", 135, 135, 135, 255);
|
||||
orbisTerraeReagent = new Reagent("orbisTerrae", 32, 94, 14, 255);
|
||||
virtusReagent = new Reagent("virtus", 180, 0, 0, 255);
|
||||
reductusReagent = new Reagent("reductus", 20, 93, 2, 255);
|
||||
potentiaReagent = new Reagent("potentia", 64, 81, 208, 255);
|
||||
|
||||
sanctusReagent.setColour(255, 255, 0, 255);
|
||||
incendiumReagent.setColour(255, 0, 0, 255);
|
||||
aquasalusReagent.setColour(0, 0, 255, 255);
|
||||
magicalesReagent.setColour(150, 0, 146, 255);
|
||||
aetherReagent.setColour(105, 223, 86, 255);
|
||||
crepitousReagent.setColour(145, 145, 145, 255);
|
||||
crystallosReagent.setColour(135, 255, 231, 255);
|
||||
terraeReagent.setColour(147, 48, 13, 255);
|
||||
tenebraeReagent.setColour(86, 86, 86, 255);
|
||||
offensaReagent.setColour(126, 0, 0, 255);
|
||||
praesidiumReagent.setColour(135, 135, 135, 255);
|
||||
orbisTerraeReagent.setColour(32, 94, 14, 255);
|
||||
virtusReagent.setColour(180, 0, 0, 255);
|
||||
reductusReagent.setColour(20, 93, 2, 255);
|
||||
potentiaReagent.setColour(64, 81, 208, 255);
|
||||
|
||||
registerReagent("sanctus", sanctusReagent);
|
||||
registerReagent("incendium", incendiumReagent);
|
||||
registerReagent("aquasalus", aquasalusReagent);
|
||||
registerReagent("magicales", magicalesReagent);
|
||||
registerReagent("aether", aetherReagent);
|
||||
registerReagent("crepitous", crepitousReagent);
|
||||
registerReagent("crystallos", crystallosReagent);
|
||||
registerReagent("terrae", terraeReagent);
|
||||
registerReagent("tenebrae", tenebraeReagent);
|
||||
registerReagent("offensa", offensaReagent);
|
||||
registerReagent("praesidium", praesidiumReagent);
|
||||
registerReagent("orbisTerrae", orbisTerraeReagent);
|
||||
registerReagent("virtus", virtusReagent);
|
||||
registerReagent("reductus", reductusReagent);
|
||||
registerReagent("potentia", potentiaReagent);
|
||||
registerReagent(sanctusReagent);
|
||||
registerReagent(incendiumReagent);
|
||||
registerReagent(aquasalusReagent);
|
||||
registerReagent(magicalesReagent);
|
||||
registerReagent(aetherReagent);
|
||||
registerReagent(crepitousReagent);
|
||||
registerReagent(crystallosReagent);
|
||||
registerReagent(terraeReagent);
|
||||
registerReagent(tenebraeReagent);
|
||||
registerReagent(offensaReagent);
|
||||
registerReagent(praesidiumReagent);
|
||||
registerReagent(orbisTerraeReagent);
|
||||
registerReagent(virtusReagent);
|
||||
registerReagent(reductusReagent);
|
||||
registerReagent(potentiaReagent);
|
||||
}
|
||||
|
||||
public static boolean registerReagent(String key, Reagent reagent) {
|
||||
if (reagentList.containsKey(key) || reagent == null) {
|
||||
public static boolean registerReagent(Reagent reagent) {
|
||||
if (reagent == null || reagentList.containsKey(reagent.name())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
reagentList.put(key, reagent);
|
||||
reagentList.put(reagent.name(), reagent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Reagent getReagentForKey(String key) {
|
||||
if (reagentList.containsKey(key)) {
|
||||
return reagentList.get(key);
|
||||
}
|
||||
|
||||
return null;
|
||||
return reagentList.get(key);
|
||||
}
|
||||
|
||||
public static String getKeyForReagent(Reagent reagent) {
|
||||
@@ -141,9 +121,8 @@ public class ReagentRegistry {
|
||||
if (entry.getValue() != null && entry.getValue().reagent == reagent) {
|
||||
if (entry.getKey() == null) {
|
||||
return null;
|
||||
} else {
|
||||
return entry.getKey().copy();
|
||||
}
|
||||
return entry.getKey().copy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,8 @@ public class ReagentStack {
|
||||
}
|
||||
|
||||
int amount = tag.getInteger("amount");
|
||||
ReagentStack stack = new ReagentStack(reagent, amount);
|
||||
|
||||
return stack;
|
||||
return new ReagentStack(reagent, amount);
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
@@ -36,15 +35,6 @@ public class ReagentStack {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public ReagentStack splitStack(int amount) {
|
||||
ReagentStack copyStack = this.copy();
|
||||
int splitAmount = Math.min(amount, this.amount);
|
||||
copyStack.amount = splitAmount;
|
||||
this.amount -= splitAmount;
|
||||
|
||||
return copyStack;
|
||||
}
|
||||
|
||||
public ReagentStack copy() {
|
||||
return new ReagentStack(this.reagent, this.amount);
|
||||
}
|
||||
|
||||
+11
-21
@@ -26,7 +26,7 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
public TileSegmentedReagentHandler(int numberOfTanks, int tankSize) {
|
||||
super();
|
||||
|
||||
this.attunedTankMap = new HashMap();
|
||||
this.attunedTankMap = new HashMap<>();
|
||||
this.tanks = new ReagentContainer[numberOfTanks];
|
||||
for (int i = 0; i < numberOfTanks; i++) {
|
||||
this.tanks[i] = new ReagentContainer(tankSize);
|
||||
@@ -62,10 +62,10 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.tanks.length; i++) {
|
||||
for (ReagentContainer tank : this.tanks) {
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
if (this.tanks[i] != null) {
|
||||
this.tanks[i].writeToNBT(savedTag);
|
||||
if (tank != null) {
|
||||
tank.writeToNBT(savedTag);
|
||||
}
|
||||
tagList.appendTag(savedTag);
|
||||
}
|
||||
@@ -101,8 +101,8 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
ReagentStack remainingStack = resource.copy();
|
||||
remainingStack.amount = maxFill - totalFill;
|
||||
|
||||
boolean doesReagentMatch = tanks[i].getReagent() == null ? false
|
||||
: tanks[i].getReagent().isReagentEqual(remainingStack);
|
||||
boolean doesReagentMatch = tanks[i].getReagent() != null
|
||||
&& tanks[i].getReagent().isReagentEqual(remainingStack);
|
||||
|
||||
if (doesReagentMatch) {
|
||||
totalFill += tanks[i].fill(remainingStack, doFill);
|
||||
@@ -151,13 +151,13 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
Reagent reagent = resource.reagent;
|
||||
int drained = 0;
|
||||
|
||||
for (int i = 0; i < tanks.length; i++) {
|
||||
for (ReagentContainer tank : tanks) {
|
||||
if (drained >= maxDrain) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (resource.isReagentEqual(tanks[i].getReagent())) {
|
||||
ReagentStack drainStack = tanks[i].drain(maxDrain - drained, doDrain);
|
||||
if (resource.isReagentEqual(tank.getReagent())) {
|
||||
ReagentStack drainStack = tank.drain(maxDrain - drained, doDrain);
|
||||
if (drainStack != null) {
|
||||
drained += drainStack.amount;
|
||||
}
|
||||
@@ -170,8 +170,8 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
/* Only returns the amount from the first available tank */
|
||||
@Override
|
||||
public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
for (int i = 0; i < tanks.length; i++) {
|
||||
ReagentStack stack = tanks[i].drain(maxDrain, doDrain);
|
||||
for (ReagentContainer tank : tanks) {
|
||||
ReagentStack stack = tank.drain(maxDrain, doDrain);
|
||||
if (stack != null) {
|
||||
return stack;
|
||||
}
|
||||
@@ -226,14 +226,4 @@ public class TileSegmentedReagentHandler extends TileEntity implements ISegmente
|
||||
public Map<Reagent, Integer> getAttunedTankMap() {
|
||||
return this.attunedTankMap;
|
||||
}
|
||||
|
||||
public boolean areTanksEmpty() {
|
||||
for (int i = 0; i < this.tanks.length; i++) {
|
||||
if (tanks[i] != null && tanks[i].reagentStack != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class AltarRecipe {
|
||||
}
|
||||
|
||||
return tierCheck >= minTier && this.requiredItem.isItemEqual(comparedStack)
|
||||
&& (this.useTag ? this.areRequiredTagsEqual(comparedStack) : true);
|
||||
&& (!this.useTag || this.areRequiredTagsEqual(comparedStack));
|
||||
}
|
||||
|
||||
public boolean areRequiredTagsEqual(ItemStack comparedStack) {
|
||||
@@ -69,11 +69,10 @@ public class AltarRecipe {
|
||||
}
|
||||
|
||||
protected boolean areTagsEqual(NBTTagCompound tag, NBTTagCompound comparedTag) {
|
||||
Set set = tag.func_150296_c();
|
||||
Set<String> set = tag.func_150296_c();
|
||||
|
||||
for (Object obj : set) {
|
||||
if (obj instanceof String) {
|
||||
String str = (String) obj;
|
||||
if (obj instanceof String str) {
|
||||
|
||||
NBTBase baseTag = comparedTag.getTag(str);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BindingRegistry {
|
||||
|
||||
public static List<BindingRecipe> bindingRecipes = new LinkedList();
|
||||
public static List<BindingRecipe> bindingRecipes = new LinkedList<>();
|
||||
|
||||
public static void registerRecipe(ItemStack output, ItemStack input) {
|
||||
bindingRecipes.add(new BindingRecipe(output, input));
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.minecraft.util.StatCollector;
|
||||
|
||||
public abstract class SubCommandBase implements ISubCommand {
|
||||
|
||||
private ICommand parent;
|
||||
private String name;
|
||||
private final ICommand parent;
|
||||
private final String name;
|
||||
|
||||
public SubCommandBase(ICommand parent, String name) {
|
||||
this.parent = parent;
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public class CompressionRegistry {
|
||||
|
||||
public static List<CompressionHandler> compressionRegistry = new ArrayList();
|
||||
public static Map<ItemStack, Integer> thresholdMap = new HashMap();
|
||||
public static List<CompressionHandler> compressionRegistry = new ArrayList<>();
|
||||
public static Map<ItemStack, Integer> thresholdMap = new HashMap<>();
|
||||
|
||||
public static void registerHandler(CompressionHandler handler) {
|
||||
compressionRegistry.add(handler);
|
||||
|
||||
@@ -43,8 +43,7 @@ public class OrbRecipeRenderer implements IRecipeRenderer {
|
||||
guiLeft + guiBase.xSize / 2,
|
||||
guiTop + 12,
|
||||
0);
|
||||
if (recipe instanceof ShapelessBloodOrbRecipe) {
|
||||
ShapelessBloodOrbRecipe shapelessBloodOrbRecipe = (ShapelessBloodOrbRecipe) recipe;
|
||||
if (recipe instanceof ShapelessBloodOrbRecipe shapelessBloodOrbRecipe) {
|
||||
List<Object> list = shapelessBloodOrbRecipe.getInput();
|
||||
|
||||
int width = 3;
|
||||
@@ -60,24 +59,23 @@ public class OrbRecipeRenderer implements IRecipeRenderer {
|
||||
|
||||
Object component = list.get(y * width + x);
|
||||
if (component != null) {
|
||||
if (component instanceof ItemStack) {
|
||||
GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
if (component instanceof ItemStack item) {
|
||||
GuiHelper.drawItemStack(item, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip((ItemStack) component, stackX, stackY);
|
||||
guiBase.renderToolTip(item, stackX, stackY);
|
||||
}
|
||||
} else if (component instanceof Integer) {
|
||||
GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
} else if (component instanceof Integer integer) {
|
||||
GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel(integer), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(
|
||||
APISpellHelper.getOrbForLevel((Integer) component),
|
||||
stackX,
|
||||
stackY);
|
||||
guiBase.renderToolTip(APISpellHelper.getOrbForLevel(integer), stackX, stackY);
|
||||
}
|
||||
} else {
|
||||
if (((ArrayList<ItemStack>) component).isEmpty()) return;
|
||||
GuiHelper.drawItemStack(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<ItemStack> items = (ArrayList<ItemStack>) component;
|
||||
if (items.isEmpty()) return;
|
||||
GuiHelper.drawItemStack(items.get(0), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
guiBase.renderToolTip(items.get(0), stackX, stackY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,24 +97,23 @@ public class OrbRecipeRenderer implements IRecipeRenderer {
|
||||
int stackY = (y + 1) * 18 + (guiTop + guiBase.ySize / 5);
|
||||
Object component = shapedBloodOrbRecipe.getInput()[y * width + x];
|
||||
if (component != null) {
|
||||
if (component instanceof ItemStack) {
|
||||
GuiHelper.drawItemStack((ItemStack) component, stackX, stackY);
|
||||
if (component instanceof ItemStack item) {
|
||||
GuiHelper.drawItemStack(item, stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip((ItemStack) component, stackX, stackY);
|
||||
guiBase.renderToolTip(item, stackX, stackY);
|
||||
}
|
||||
} else if (component instanceof Integer) {
|
||||
GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel((Integer) component), stackX, stackY);
|
||||
} else if (component instanceof Integer integer) {
|
||||
GuiHelper.drawItemStack(APISpellHelper.getOrbForLevel(integer), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(
|
||||
APISpellHelper.getOrbForLevel((Integer) component),
|
||||
stackX,
|
||||
stackY);
|
||||
guiBase.renderToolTip(APISpellHelper.getOrbForLevel(integer), stackX, stackY);
|
||||
}
|
||||
} else {
|
||||
if (((ArrayList<ItemStack>) component).isEmpty()) return;
|
||||
GuiHelper.drawItemStack(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<ItemStack> items = (ArrayList<ItemStack>) component;
|
||||
if (items.isEmpty()) return;
|
||||
GuiHelper.drawItemStack(items.get(0), stackX, stackY);
|
||||
if (GuiHelper.isMouseBetween(mouseX, mouseY, stackX, stackY, 15, 15)) {
|
||||
guiBase.renderToolTip(((ArrayList<ItemStack>) component).get(0), stackX, stackY);
|
||||
guiBase.renderToolTip(items.get(0), stackX, stackY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.api.guide;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
|
||||
public class PageRitualMultiBlock extends PageMultiBlock {
|
||||
|
||||
private static ItemStack blankStone;
|
||||
private static ItemStack waterStone;
|
||||
private static ItemStack fireStone;
|
||||
private static ItemStack earthStone;
|
||||
private static ItemStack airStone;
|
||||
private static ItemStack duskStone;
|
||||
private static ItemStack dawnStone;
|
||||
|
||||
static {
|
||||
// blankStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.BLANK);
|
||||
// waterStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.WATER);
|
||||
// fireStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.FIRE);
|
||||
// earthStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.EARTH);
|
||||
// airStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.AIR);
|
||||
// duskStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DUSK);
|
||||
// dawnStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DAWN);
|
||||
}
|
||||
|
||||
private PageRitualMultiBlock(ItemStack[][][] structure) {
|
||||
super(structure);
|
||||
}
|
||||
|
||||
public static PageRitualMultiBlock getPageForRitual(String ritualID) {
|
||||
return getPageForRitual(Rituals.getRitualList(ritualID));
|
||||
}
|
||||
|
||||
public static PageRitualMultiBlock getPageForRitual(List<RitualComponent> ritualComponents) {
|
||||
int minX = 0;
|
||||
int minY = 0;
|
||||
int minZ = 0;
|
||||
|
||||
int maxX = 0;
|
||||
int maxY = 0;
|
||||
int maxZ = 0;
|
||||
|
||||
for (RitualComponent comp : ritualComponents) {
|
||||
minX = Math.min(comp.getX(), minX);
|
||||
minY = Math.min(comp.getY(), minY);
|
||||
minZ = Math.min(comp.getZ(), minZ);
|
||||
|
||||
maxX = Math.max(comp.getX(), maxX);
|
||||
maxY = Math.max(comp.getY(), maxY);
|
||||
maxZ = Math.max(comp.getZ(), maxZ);
|
||||
}
|
||||
|
||||
System.out.println(
|
||||
"Min: (" + minX + ", " + minY + ", " + minZ + "), Max: (" + maxX + ", " + maxY + ", " + maxZ + ")");
|
||||
|
||||
ItemStack[][][] tempStructure = new ItemStack[maxY - minY + 1][maxX - minX + 1][maxZ - minZ + 1]; // First value
|
||||
// is
|
||||
// vertical,
|
||||
// second is
|
||||
// down to the
|
||||
// left, third
|
||||
// is down to
|
||||
// the right
|
||||
|
||||
for (RitualComponent comp : ritualComponents) {
|
||||
tempStructure[comp.getY() - minY][comp.getX() - minX][comp.getZ() - minZ] = getStackForRitualStone(
|
||||
comp.getStoneType());
|
||||
}
|
||||
|
||||
// tempStructure[-minY][-minX][-minZ] = new ItemStack(ModBlocks.blockMasterStone);
|
||||
|
||||
return new PageRitualMultiBlock(tempStructure);
|
||||
}
|
||||
|
||||
private static ItemStack getStackForRitualStone(int type) {
|
||||
switch (type) {
|
||||
case RitualComponent.BLANK:
|
||||
return blankStone;
|
||||
case RitualComponent.WATER:
|
||||
return waterStone;
|
||||
case RitualComponent.FIRE:
|
||||
return fireStone;
|
||||
case RitualComponent.EARTH:
|
||||
return earthStone;
|
||||
case RitualComponent.AIR:
|
||||
return airStone;
|
||||
case RitualComponent.DUSK:
|
||||
return duskStone;
|
||||
case RitualComponent.DAWN:
|
||||
return dawnStone;
|
||||
}
|
||||
return blankStone;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.world.World;
|
||||
|
||||
public class HarvestRegistry {
|
||||
|
||||
public static List<IHarvestHandler> handlerList = new ArrayList();
|
||||
public static List<IHarvestHandler> handlerList = new ArrayList<>();
|
||||
|
||||
public static void registerHarvestHandler(IHarvestHandler handler) {
|
||||
handlerList.add(handler);
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
@@ -35,7 +36,7 @@ public class ItemSpellMultiTool extends Item {
|
||||
private static final String harvestLevelSuffix = "harvestLvl";
|
||||
private static final String digLevelSuffix = "digLvl";
|
||||
private static final String tagName = "BloodMagicTool";
|
||||
private Random rand = new Random();
|
||||
private final Random rand = new Random();
|
||||
|
||||
public ItemSpellMultiTool() {
|
||||
super();
|
||||
@@ -50,32 +51,26 @@ public class ItemSpellMultiTool extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
|
||||
EntityLivingBase par3EntityLivingBase) {
|
||||
float damage = this.getCustomItemAttack(par1ItemStack);
|
||||
public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase attacker) {
|
||||
float damage = this.getCustomItemAttack(item);
|
||||
|
||||
float f = (float) par3EntityLivingBase.getEntityAttribute(SharedMonsterAttributes.attackDamage)
|
||||
.getAttributeValue();
|
||||
|
||||
SpellParadigmTool parad = this.loadParadigmFromStack(par1ItemStack);
|
||||
SpellParadigmTool parad = this.loadParadigmFromStack(item);
|
||||
|
||||
if (parad != null) {
|
||||
parad.onLeftClickEntity(par1ItemStack, par2EntityLivingBase, par3EntityLivingBase);
|
||||
parad.onLeftClickEntity(item, target, attacker);
|
||||
damage += parad.getAddedDamageForEntity(target);
|
||||
}
|
||||
|
||||
damage += parad.getAddedDamageForEntity(par2EntityLivingBase);
|
||||
|
||||
if (rand.nextFloat() < this.getCritChance(par1ItemStack)) {
|
||||
if (rand.nextFloat() < this.getCritChance(item)) {
|
||||
damage *= 1.75f;
|
||||
}
|
||||
|
||||
damage *= f;
|
||||
damage *= (float) attacker.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
|
||||
|
||||
if (par3EntityLivingBase instanceof EntityPlayer) {
|
||||
par2EntityLivingBase
|
||||
.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) par3EntityLivingBase), damage);
|
||||
if (attacker instanceof EntityPlayer player) {
|
||||
target.attackEntityFrom(DamageSource.causePlayerDamage(player), damage);
|
||||
} else {
|
||||
par2EntityLivingBase.attackEntityFrom(DamageSource.causeMobDamage(par3EntityLivingBase), damage);
|
||||
target.attackEntityFrom(DamageSource.causeMobDamage(attacker), damage);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -223,24 +218,24 @@ public class ItemSpellMultiTool extends Item {
|
||||
String testString = "pickaxe";
|
||||
|
||||
Material[] matList = this.getMaterialsForToolclass(testString);
|
||||
for (int i = 0; i < matList.length; i++) {
|
||||
if (matList[i] == mat) {
|
||||
for (Material material : matList) {
|
||||
if (material == mat) {
|
||||
return testString;
|
||||
}
|
||||
}
|
||||
|
||||
testString = "shovel";
|
||||
matList = this.getMaterialsForToolclass(testString);
|
||||
for (int i = 0; i < matList.length; i++) {
|
||||
if (matList[i] == mat) {
|
||||
for (Material material : matList) {
|
||||
if (material == mat) {
|
||||
return testString;
|
||||
}
|
||||
}
|
||||
|
||||
testString = "axe";
|
||||
matList = this.getMaterialsForToolclass(testString);
|
||||
for (int i = 0; i < matList.length; i++) {
|
||||
if (matList[i] == mat) {
|
||||
for (Material material : matList) {
|
||||
if (material == mat) {
|
||||
return testString;
|
||||
}
|
||||
}
|
||||
@@ -248,8 +243,9 @@ public class ItemSpellMultiTool extends Item {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getToolClasses(ItemStack stack) {
|
||||
Set<String> set = new HashSet();
|
||||
Set<String> set = new HashSet<>();
|
||||
|
||||
if (this.getHarvestLevel(stack, "pickaxe") > -1) {
|
||||
set.add("pickaxe");
|
||||
@@ -270,10 +266,10 @@ public class ItemSpellMultiTool extends Item {
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta) {
|
||||
String toolClass = block.getHarvestTool(meta);
|
||||
|
||||
if (toolClass == null || toolClass.equals("")) {
|
||||
if (toolClass == null || toolClass.isEmpty()) {
|
||||
toolClass = getToolClassOfMaterial(block.getMaterial());
|
||||
|
||||
if (toolClass == "") {
|
||||
if (toolClass.isEmpty()) {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
@@ -329,11 +325,6 @@ public class ItemSpellMultiTool extends Item {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack toolStack, World world, Entity par3Entity, int par4, boolean par5) {
|
||||
if (world.isRemote) {
|
||||
@@ -371,7 +362,7 @@ public class ItemSpellMultiTool extends Item {
|
||||
if (mop != null && mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) {
|
||||
cost = parad.onRightClickBlock(par1ItemStack, par3EntityPlayer, par2World, mop);
|
||||
} else {
|
||||
cost = parad.onRightClickAir(par1ItemStack, par2World, par3EntityPlayer);
|
||||
cost = parad.onRightClickAir(par1ItemStack, par3EntityPlayer);
|
||||
}
|
||||
|
||||
if (cost > 0) {
|
||||
@@ -382,23 +373,21 @@ public class ItemSpellMultiTool extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
par3List.add("A mace filled with ancient alchemy");
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean adv) {
|
||||
tooltip.add("A mace filled with ancient alchemy");
|
||||
|
||||
if (!(par1ItemStack.getTagCompound() == null)) {
|
||||
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
|
||||
par3List.add("Current owner: " + par1ItemStack.getTagCompound().getString("ownerName"));
|
||||
if (!(item.getTagCompound() == null)) {
|
||||
if (!item.getTagCompound().getString("ownerName").isEmpty()) {
|
||||
tooltip.add("Current owner: " + item.getTagCompound().getString("ownerName"));
|
||||
}
|
||||
|
||||
for (String str : this.getToolListString(par1ItemStack)) {
|
||||
par3List.add(str);
|
||||
}
|
||||
tooltip.addAll(this.getToolListString(item));
|
||||
|
||||
par3List.add("");
|
||||
float damage = this.getCustomItemAttack(par1ItemStack);
|
||||
par3List.add("\u00A79+" + ((int) (damage * 10)) / 10.0f + " " + "Attack Damage");
|
||||
float critChance = ((int) (this.getCritChance(par1ItemStack) * 1000)) / 10.0f;
|
||||
par3List.add("\u00A79+" + critChance + "% " + "Crit Chance");
|
||||
tooltip.add("");
|
||||
float damage = this.getCustomItemAttack(item);
|
||||
tooltip.add(EnumChatFormatting.BLUE + "+" + ((int) (damage * 10)) / 10.0f + " " + "Attack Damage");
|
||||
float critChance = ((int) (this.getCritChance(item) * 1000)) / 10.0f;
|
||||
tooltip.add(EnumChatFormatting.BLUE + "+" + critChance + "% " + "Crit Chance");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,25 +508,24 @@ public class ItemSpellMultiTool extends Item {
|
||||
public void setDuration(ItemStack container, World world, int duration) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
World overWorld = DimensionManager.getWorld(0);
|
||||
long worldtime = overWorld.getTotalWorldTime();
|
||||
|
||||
if (container.hasTagCompound()) {
|
||||
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
|
||||
|
||||
tag.setLong("duration", Math.max(duration + worldtime, worldtime));
|
||||
|
||||
container.getTagCompound().setTag(tagName, tag);
|
||||
} else {
|
||||
World overWorld = DimensionManager.getWorld(0);
|
||||
long worldtime = overWorld.getTotalWorldTime();
|
||||
container.setTagCompound(new NBTTagCompound());
|
||||
|
||||
if (container.hasTagCompound()) {
|
||||
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
|
||||
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
|
||||
|
||||
tag.setLong("duration", Math.max(duration + worldtime, worldtime));
|
||||
tag.setLong("duration", Math.max(duration + worldtime, worldtime));
|
||||
|
||||
container.getTagCompound().setTag(tagName, tag);
|
||||
} else {
|
||||
container.setTagCompound(new NBTTagCompound());
|
||||
|
||||
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
|
||||
|
||||
tag.setLong("duration", Math.max(duration + worldtime, worldtime));
|
||||
|
||||
container.getTagCompound().setTag(tagName, tag);
|
||||
}
|
||||
container.getTagCompound().setTag(tagName, tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,9 +574,9 @@ public class ItemSpellMultiTool extends Item {
|
||||
|
||||
NBTTagList tagList = tagiest.getTagList("Effects", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
List<SpellEffect> spellEffectList = new LinkedList();
|
||||
List<SpellEffect> spellEffectList = new LinkedList<>();
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
|
||||
SpellEffect eff = SpellEffect.getEffectFromTag(tag);
|
||||
if (eff != null) {
|
||||
@@ -667,9 +655,9 @@ public class ItemSpellMultiTool extends Item {
|
||||
|
||||
NBTTagList tagList = tagiest.getTagList("ToolTips", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
List<String> toolTipList = new LinkedList();
|
||||
List<String> toolTipList = new LinkedList<>();
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
|
||||
String str = tag.getString("tip");
|
||||
if (str != null) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package WayofTime.alchemicalWizardry.api.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -25,8 +24,8 @@ public class ShapedBloodOrbRecipe implements IRecipe {
|
||||
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
||||
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
||||
|
||||
private ItemStack output = null;
|
||||
private Object[] input = null;
|
||||
private final ItemStack output;
|
||||
private final Object[] input;
|
||||
public int width = 0;
|
||||
public int height = 0;
|
||||
private boolean mirrored = true;
|
||||
@@ -42,7 +41,7 @@ public class ShapedBloodOrbRecipe implements IRecipe {
|
||||
public ShapedBloodOrbRecipe(ItemStack result, Object... recipe) {
|
||||
output = result.copy();
|
||||
|
||||
String shape = "";
|
||||
StringBuilder shape = new StringBuilder();
|
||||
int idx = 0;
|
||||
|
||||
if (recipe[idx] instanceof Boolean) {
|
||||
@@ -59,26 +58,26 @@ public class ShapedBloodOrbRecipe implements IRecipe {
|
||||
|
||||
for (String s : parts) {
|
||||
width = s.length();
|
||||
shape += s;
|
||||
shape.append(s);
|
||||
}
|
||||
|
||||
height = parts.length;
|
||||
} else {
|
||||
while (recipe[idx] instanceof String) {
|
||||
String s = (String) recipe[idx++];
|
||||
shape += s;
|
||||
shape.append(s);
|
||||
width = s.length();
|
||||
height++;
|
||||
}
|
||||
}
|
||||
|
||||
if (width * height != shape.length()) {
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
StringBuilder ret = new StringBuilder("Invalid shaped ore recipe: ");
|
||||
for (Object tmp : recipe) {
|
||||
ret += tmp + ", ";
|
||||
ret.append(tmp).append(", ");
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
ret.append(output);
|
||||
throw new RuntimeException(ret.toString());
|
||||
}
|
||||
|
||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||
@@ -87,36 +86,31 @@ public class ShapedBloodOrbRecipe implements IRecipe {
|
||||
Character chr = (Character) recipe[idx];
|
||||
Object in = recipe[idx + 1];
|
||||
|
||||
if (in instanceof IBloodOrb
|
||||
|| (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb)) { // If the item is
|
||||
// an instanceof
|
||||
// IBloodOrb then
|
||||
// save the level
|
||||
// of the
|
||||
// orb
|
||||
if (in instanceof ItemStack) itemMap.put(chr, ((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel());
|
||||
else itemMap.put(chr, ((IBloodOrb) in).getOrbLevel());
|
||||
} else if (in instanceof ItemStack) {
|
||||
itemMap.put(chr, ((ItemStack) in).copy());
|
||||
} else if (in instanceof Item) {
|
||||
itemMap.put(chr, new ItemStack((Item) in));
|
||||
} else if (in instanceof Block) {
|
||||
itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
|
||||
} else if (in instanceof String) {
|
||||
itemMap.put(chr, OreDictionary.getOres((String) in));
|
||||
if (in instanceof IBloodOrb orb) {
|
||||
itemMap.put(chr, orb.getOrbLevel());
|
||||
} else if (in instanceof ItemStack stack && stack.getItem() instanceof IBloodOrb orb) {
|
||||
itemMap.put(chr, orb.getOrbLevel());
|
||||
} else if (in instanceof ItemStack stack) {
|
||||
itemMap.put(chr, stack.copy());
|
||||
} else if (in instanceof Item item) {
|
||||
itemMap.put(chr, new ItemStack(item));
|
||||
} else if (in instanceof Block block) {
|
||||
itemMap.put(chr, new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE));
|
||||
} else if (in instanceof String string) {
|
||||
itemMap.put(chr, OreDictionary.getOres(string));
|
||||
} else {
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
StringBuilder ret = new StringBuilder("Invalid shaped ore recipe: ");
|
||||
for (Object tmp : recipe) {
|
||||
ret += tmp + ", ";
|
||||
ret.append(tmp).append(", ");
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
ret.append(output);
|
||||
throw new RuntimeException(ret.toString());
|
||||
}
|
||||
}
|
||||
|
||||
input = new Object[width * height];
|
||||
int x = 0;
|
||||
for (char chr : shape.toCharArray()) {
|
||||
for (char chr : shape.toString().toCharArray()) {
|
||||
input[x++] = itemMap.get(chr);
|
||||
}
|
||||
}
|
||||
@@ -193,29 +187,27 @@ public class ShapedBloodOrbRecipe implements IRecipe {
|
||||
}
|
||||
|
||||
ItemStack slot = inv.getStackInRowAndColumn(x, y);
|
||||
// If target is integer, then we should be check the blood orb value of the item instead
|
||||
if (target instanceof Integer) {
|
||||
if (slot != null && slot.getItem() instanceof IBloodOrb) {
|
||||
IBloodOrb orb = (IBloodOrb) slot.getItem();
|
||||
if (orb.getOrbLevel() < (Integer) target) {
|
||||
return false;
|
||||
}
|
||||
} else return false;
|
||||
} else if (target instanceof ItemStack) {
|
||||
if (!OreDictionary.itemMatches((ItemStack) target, slot, false)) {
|
||||
// If target is integer, then we should check the blood orb value of the item instead
|
||||
if (target instanceof Integer orbLevel) {
|
||||
if (slot == null || !(slot.getItem() instanceof IBloodOrb orb)) {
|
||||
return false;
|
||||
}
|
||||
if (orb.getOrbLevel() < orbLevel) {
|
||||
return false;
|
||||
}
|
||||
} else if (target instanceof ItemStack stack) {
|
||||
if (!OreDictionary.itemMatches(stack, slot, false)) {
|
||||
return false;
|
||||
}
|
||||
} else if (target instanceof ArrayList) {
|
||||
boolean matched = false;
|
||||
|
||||
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
|
||||
while (itr.hasNext() && !matched) {
|
||||
matched = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||
}
|
||||
|
||||
if (!matched) {
|
||||
return false;
|
||||
for (ItemStack item : ((ArrayList<ItemStack>) target)) {
|
||||
if (OreDictionary.itemMatches(item, slot, false)) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!matched) return false;
|
||||
} else if (target == null && slot != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.api.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -22,8 +20,8 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
*/
|
||||
public class ShapelessBloodOrbRecipe implements IRecipe {
|
||||
|
||||
private ItemStack output = null;
|
||||
private ArrayList<Object> input = new ArrayList<Object>();
|
||||
private final ItemStack output;
|
||||
private final ArrayList<Object> input = new ArrayList<>();
|
||||
|
||||
public ShapelessBloodOrbRecipe(Block result, Object... recipe) {
|
||||
this(new ItemStack(result), recipe);
|
||||
@@ -36,34 +34,33 @@ public class ShapelessBloodOrbRecipe implements IRecipe {
|
||||
public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe) {
|
||||
output = result.copy();
|
||||
for (Object in : recipe) {
|
||||
if (in instanceof IBloodOrb) { // If the item is an instanceof IBloodOrb then save the level of the orb
|
||||
input.add(((IBloodOrb) in).getOrbLevel());
|
||||
} else if (in instanceof ItemStack) {
|
||||
if (((ItemStack) in).getItem() instanceof IBloodOrb) {
|
||||
input.add(((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel());
|
||||
} else input.add(((ItemStack) in).copy());
|
||||
} else if (in instanceof Item) {
|
||||
input.add(new ItemStack((Item) in));
|
||||
} else if (in instanceof Block) {
|
||||
input.add(new ItemStack((Block) in));
|
||||
} else if (in instanceof String) {
|
||||
input.add(OreDictionary.getOres((String) in));
|
||||
if (in instanceof IBloodOrb orb) {
|
||||
input.add(orb.getOrbLevel());
|
||||
} else if (in instanceof ItemStack stack && stack.getItem() instanceof IBloodOrb orb) {
|
||||
input.add(orb.getOrbLevel());
|
||||
} else if (in instanceof ItemStack stack) {
|
||||
input.add(stack.copy());
|
||||
} else if (in instanceof Item item) {
|
||||
input.add(new ItemStack(item));
|
||||
} else if (in instanceof Block block) {
|
||||
input.add(new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE));
|
||||
} else if (in instanceof String string) {
|
||||
input.add(OreDictionary.getOres(string));
|
||||
} else {
|
||||
String ret = "Invalid shapeless ore recipe: ";
|
||||
StringBuilder ret = new StringBuilder("Invalid shapeless ore recipe: ");
|
||||
for (Object tmp : recipe) {
|
||||
ret += tmp + ", ";
|
||||
ret.append(tmp).append(", ");
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
ret.append(output);
|
||||
throw new RuntimeException(ret.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements) {
|
||||
output = recipe.getRecipeOutput();
|
||||
|
||||
for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems)) {
|
||||
for (ItemStack ingred : recipe.recipeItems) {
|
||||
Object finalObj = ingred;
|
||||
for (Entry<ItemStack, String> replace : replacements.entrySet()) {
|
||||
if (OreDictionary.itemMatches(replace.getKey(), ingred, false)) {
|
||||
@@ -92,36 +89,35 @@ public class ShapelessBloodOrbRecipe implements IRecipe {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting var1, World world) {
|
||||
ArrayList<Object> required = new ArrayList<Object>(input);
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
ArrayList<Object> required = new ArrayList<>(input);
|
||||
|
||||
for (int x = 0; x < var1.getSizeInventory(); x++) {
|
||||
ItemStack slot = var1.getStackInSlot(x);
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++) {
|
||||
ItemStack slot = inv.getStackInSlot(x);
|
||||
|
||||
if (slot != null) {
|
||||
boolean inRecipe = false;
|
||||
Iterator<Object> req = required.iterator();
|
||||
|
||||
while (req.hasNext()) {
|
||||
for (Object next : required) {
|
||||
boolean match = false;
|
||||
|
||||
Object next = req.next();
|
||||
|
||||
// If target is integer, then we should be check the blood orb value of the item instead
|
||||
if (next instanceof Integer) {
|
||||
if (slot != null && slot.getItem() instanceof IBloodOrb) {
|
||||
IBloodOrb orb = (IBloodOrb) slot.getItem();
|
||||
if (orb.getOrbLevel() < (Integer) next) {
|
||||
return false;
|
||||
}
|
||||
} else return false;
|
||||
// If target is integer, then we should check the blood orb value of the item instead
|
||||
if (next instanceof Integer orbLevel) {
|
||||
if (!(slot.getItem() instanceof IBloodOrb orb)) {
|
||||
return false;
|
||||
}
|
||||
if (orb.getOrbLevel() < orbLevel) {
|
||||
return false;
|
||||
}
|
||||
match = true;
|
||||
} else if (next instanceof ItemStack) {
|
||||
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
|
||||
} else if (next instanceof ItemStack item) {
|
||||
match = OreDictionary.itemMatches(item, slot, false);
|
||||
} else if (next instanceof ArrayList) {
|
||||
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) next).iterator();
|
||||
while (itr.hasNext() && !match) {
|
||||
match = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||
for (ItemStack item : ((ArrayList<ItemStack>) next)) {
|
||||
if (OreDictionary.itemMatches(item, slot, false)) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,16 +19,16 @@ public interface IBindable {
|
||||
* Used by bound tools and the energy blaster/bazooka to check if they should skip their right click function.
|
||||
* Drains the soul network by the amount returned by rightClickCost.
|
||||
*/
|
||||
default boolean checkRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (toggle(par1ItemStack, par2World, par3EntityPlayer)) {
|
||||
default boolean checkRightClick(ItemStack item, World world, EntityPlayer player) {
|
||||
if (toggle(item, world, player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (par2World.isRemote) {
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isActive(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
|
||||
if (!isActive(item) || SpellHelper.isFakePlayer(world, player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,12 +36,11 @@ public interface IBindable {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
|
||||
if (player.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(par3EntityPlayer.capabilities.isCreativeMode
|
||||
|| EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, rightClickCost()))) {
|
||||
if (!(player.capabilities.isCreativeMode || EnergyItems.syphonBatteries(item, player, rightClickCost()))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,45 +50,45 @@ public interface IBindable {
|
||||
/**
|
||||
* Adds the active state and owner information to an item if it has the relevant tags.
|
||||
*/
|
||||
default void addBindingInformation(ItemStack par1ItemStack, List par3List) {
|
||||
NBTTagCompound itemTag = getTag(par1ItemStack);
|
||||
default void addBindingInformation(ItemStack item, List<String> tooltip) {
|
||||
NBTTagCompound itemTag = getTag(item);
|
||||
if (itemTag.getBoolean("isActive")) {
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
|
||||
tooltip.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
|
||||
} else if (itemTag.hasKey("isActive")) { // Only if present and set to false rather than not present at all
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
|
||||
tooltip.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
|
||||
}
|
||||
|
||||
if (!itemTag.getString("ownerName").equals("")) {
|
||||
par3List.add(
|
||||
if (!itemTag.getString("ownerName").isEmpty()) {
|
||||
tooltip.add(
|
||||
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
|
||||
+ itemTag.getString("ownerName"));
|
||||
}
|
||||
}
|
||||
|
||||
static void setActive(ItemStack par1ItemStack, boolean state) {
|
||||
NBTTagCompound itemTag = getTag(par1ItemStack);
|
||||
static void setActive(ItemStack item, boolean state) {
|
||||
NBTTagCompound itemTag = getTag(item);
|
||||
itemTag.setBoolean("isActive", state);
|
||||
}
|
||||
|
||||
static boolean isActive(ItemStack par1ItemStack) {
|
||||
NBTTagCompound itemTag = getTag(par1ItemStack);
|
||||
static boolean isActive(ItemStack item) {
|
||||
NBTTagCompound itemTag = getTag(item);
|
||||
return itemTag.getBoolean("isActive");
|
||||
}
|
||||
|
||||
static NBTTagCompound getTag(ItemStack par1ItemStack) {
|
||||
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
|
||||
static NBTTagCompound getTag(ItemStack item) {
|
||||
NBTTagCompound itemTag = item.getTagCompound();
|
||||
|
||||
if (itemTag == null) {
|
||||
par1ItemStack.setTagCompound(new NBTTagCompound());
|
||||
itemTag = par1ItemStack.getTagCompound();
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
itemTag = item.getTagCompound();
|
||||
}
|
||||
return itemTag;
|
||||
}
|
||||
|
||||
default boolean toggle(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if (!checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
|
||||
setActive(par1ItemStack, !isActive(par1ItemStack));
|
||||
setDrainTick(par1ItemStack, par2World);
|
||||
default boolean toggle(ItemStack item, World world, EntityPlayer player) {
|
||||
if (!checkAndSetItemOwner(item, player) || player.isSneaking()) {
|
||||
setActive(item, !isActive(item));
|
||||
setDrainTick(item, world);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -99,11 +98,11 @@ public interface IBindable {
|
||||
* Checks if the current tick is the proper tick to do a passive drain based on getDrainTicks. If it is, it runs
|
||||
* doPassiveDrain and returns true. Otherwise, returns false.
|
||||
*/
|
||||
default boolean checkPassiveDrain(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
NBTTagCompound itemTag = getTag(par1ItemStack);
|
||||
if (par2World.getTotalWorldTime() % this.drainTicks() == itemTag.getInteger("worldTimeDelay")
|
||||
default boolean checkPassiveDrain(ItemStack item, World world, EntityPlayer player) {
|
||||
NBTTagCompound itemTag = getTag(item);
|
||||
if (world.getTotalWorldTime() % this.drainTicks() == itemTag.getInteger("worldTimeDelay")
|
||||
&& itemTag.getBoolean("isActive")) {
|
||||
this.doPassiveDrain(par1ItemStack, par3EntityPlayer);
|
||||
this.doPassiveDrain(item, player);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -112,10 +111,10 @@ public interface IBindable {
|
||||
/**
|
||||
* The action to take when checkPassiveDrain is run on the proper tick based on getDrainTicks.
|
||||
*/
|
||||
default void doPassiveDrain(ItemStack par1ItemStack, EntityPlayer par3EntityPlayer) {
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, drainCost())) {
|
||||
setActive(par1ItemStack, false);
|
||||
default void doPassiveDrain(ItemStack item, EntityPlayer player) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
if (!EnergyItems.syphonBatteries(item, player, drainCost())) {
|
||||
setActive(item, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,9 +122,8 @@ public interface IBindable {
|
||||
/**
|
||||
* Sets the drain tick delay based on the current world age and getDrainTicks().
|
||||
*/
|
||||
default void setDrainTick(ItemStack par1ItemStack, World par2World) {
|
||||
getTag(par1ItemStack)
|
||||
.setInteger("worldTimeDelay", (int) (par2World.getTotalWorldTime() - 1) % this.drainTicks());
|
||||
default void setDrainTick(ItemStack item, World world) {
|
||||
getTag(item).setInteger("worldTimeDelay", (int) (world.getTotalWorldTime() - 1) % this.drainTicks());
|
||||
}
|
||||
|
||||
static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) {
|
||||
|
||||
@@ -12,20 +12,19 @@ public interface ISigil extends IBindable {
|
||||
* Toggles the state of the sigil. Returns true if the sigil is active after the toggle or false if it is inactive
|
||||
* after the toggle.
|
||||
*/
|
||||
default boolean toggleSigil(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
IBindable.setActive(par1ItemStack, !IBindable.isActive(par1ItemStack));
|
||||
default boolean toggleSigil(ItemStack item, World world, EntityPlayer player) {
|
||||
IBindable.setActive(item, !IBindable.isActive(item));
|
||||
|
||||
if (!par3EntityPlayer.capabilities.isCreativeMode
|
||||
&& !EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, this.drainCost())) {
|
||||
IBindable.setActive(par1ItemStack, false);
|
||||
if (!player.capabilities.isCreativeMode && !EnergyItems.syphonBatteries(item, player, this.drainCost())) {
|
||||
IBindable.setActive(item, false);
|
||||
}
|
||||
|
||||
if (IBindable.isActive(par1ItemStack)) {
|
||||
par1ItemStack.setItemDamage(1);
|
||||
this.setDrainTick(par1ItemStack, par2World);
|
||||
if (IBindable.isActive(item)) {
|
||||
item.setItemDamage(1);
|
||||
this.setDrainTick(item, world);
|
||||
return true;
|
||||
} else {
|
||||
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
|
||||
item.setItemDamage(item.getMaxDamage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ public class LocalRitualStorage {
|
||||
}
|
||||
|
||||
public void setLocation(Int3 location) {
|
||||
this.xCoord = location.xCoord;
|
||||
this.yCoord = location.yCoord;
|
||||
this.zCoord = location.zCoord;
|
||||
this.xCoord = location.x();
|
||||
this.yCoord = location.y();
|
||||
this.zCoord = location.z();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
package WayofTime.alchemicalWizardry.api.rituals;
|
||||
|
||||
public class RitualComponent {
|
||||
public record RitualComponent(int x, int y, int z, int stoneType) {
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private int stoneType;
|
||||
public static final int BLANK = 0;
|
||||
public static final int WATER = 1;
|
||||
public static final int FIRE = 2;
|
||||
@@ -14,52 +10,21 @@ public class RitualComponent {
|
||||
public static final int DUSK = 5;
|
||||
public static final int DAWN = 6;
|
||||
|
||||
public RitualComponent(int x, int y, int z, int stoneType) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.stoneType = stoneType;
|
||||
public int x(int direction) {
|
||||
return switch (direction) {
|
||||
case 2 -> -this.z();
|
||||
case 3 -> -this.x();
|
||||
case 4 -> this.z();
|
||||
default -> this.x();
|
||||
};
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public int getX(int direction) {
|
||||
switch (direction) {
|
||||
case 2:
|
||||
return -this.getZ();
|
||||
case 3:
|
||||
return -this.getX();
|
||||
case 4:
|
||||
return this.getZ();
|
||||
default:
|
||||
return this.getX();
|
||||
}
|
||||
}
|
||||
|
||||
public int getZ(int direction) {
|
||||
switch (direction) {
|
||||
case 2:
|
||||
return this.getX();
|
||||
case 3:
|
||||
return -this.getZ();
|
||||
case 4:
|
||||
return -this.getX();
|
||||
default:
|
||||
return this.getZ();
|
||||
}
|
||||
}
|
||||
|
||||
public int getStoneType() {
|
||||
return this.stoneType;
|
||||
public int z(int direction) {
|
||||
return switch (direction) {
|
||||
case 2 -> this.x();
|
||||
case 3 -> -this.z();
|
||||
case 4 -> -this.x();
|
||||
default -> this.z();
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,8 @@ public class Rituals {
|
||||
|
||||
public final MRSRenderer customRenderer;
|
||||
|
||||
public static Map<String, Rituals> ritualMap = new HashMap();
|
||||
public static List<String> keyList = new LinkedList();
|
||||
public static Map<String, Rituals> ritualMap = new HashMap<>();
|
||||
public static List<String> keyList = new LinkedList<>();
|
||||
|
||||
public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) {
|
||||
this.crystalLevel = crystalLevel;
|
||||
@@ -83,11 +83,9 @@ public class Rituals {
|
||||
|
||||
public void removeRitualFromList() {
|
||||
if (ritualMap.containsValue(this)) {
|
||||
ritualMap.remove(ritualMap.remove(this.name));
|
||||
}
|
||||
if (keyList.contains(this.name)) {
|
||||
keyList.remove(this.name);
|
||||
ritualMap.remove(this.name);
|
||||
}
|
||||
keyList.remove(this.name);
|
||||
}
|
||||
|
||||
public static String checkValidRitual(World world, int x, int y, int z) {
|
||||
@@ -132,17 +130,17 @@ public class Rituals {
|
||||
TileEntity te;
|
||||
|
||||
for (RitualComponent rc : ritual) {
|
||||
test = world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction));
|
||||
te = world.getTileEntity(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction));
|
||||
test = world.getBlock(x + rc.x(direction), y + rc.y(), z + rc.z(direction));
|
||||
te = world.getTileEntity(x + rc.x(direction), y + rc.y(), z + rc.z(direction));
|
||||
|
||||
if (!(test instanceof IRitualStone && ((IRitualStone) test).isRuneType(
|
||||
world,
|
||||
x + rc.getX(direction),
|
||||
x + rc.x(direction),
|
||||
y,
|
||||
z + rc.getZ(direction),
|
||||
world.getBlockMetadata(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)),
|
||||
rc.getStoneType()))
|
||||
&& !(te instanceof ITileRitualStone && ((ITileRitualStone) te).isRuneType(rc.getStoneType()))) {
|
||||
z + rc.z(direction),
|
||||
world.getBlockMetadata(x + rc.x(direction), y + rc.y(), z + rc.z(direction)),
|
||||
rc.stoneType()))
|
||||
&& !(te instanceof ITileRitualStone && ((ITileRitualStone) te).isRuneType(rc.stoneType()))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -287,7 +285,7 @@ public class Rituals {
|
||||
String firstKey = "";
|
||||
|
||||
for (String str : keyList) {
|
||||
if (firstKey.equals("")) {
|
||||
if (firstKey.isEmpty()) {
|
||||
firstKey = str;
|
||||
}
|
||||
if (hasSpotted) {
|
||||
|
||||
+3
-4
@@ -24,7 +24,7 @@ import com.mojang.authlib.GameProfile;
|
||||
public class ComplexNetworkHandler {
|
||||
|
||||
public static String fileName = "config/BloodMagic/soulnetworkKeys";
|
||||
static HashMap<UUID, String> keyMap = new HashMap();
|
||||
static HashMap<UUID, String> keyMap = new HashMap<>();
|
||||
|
||||
public static UUID getUUIDFromPlayer(EntityPlayer player) {
|
||||
return player.getPersistentID();
|
||||
@@ -90,13 +90,12 @@ public class ComplexNetworkHandler {
|
||||
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(save));
|
||||
HashMap schema = gson.fromJson(br, keyMap.getClass());
|
||||
|
||||
keyMap = schema;
|
||||
keyMap = gson.fromJson(br, keyMap.getClass());
|
||||
|
||||
if (keyMap != null) {
|
||||
for (Entry<UUID, String> entry : keyMap.entrySet()) {
|
||||
System.out.println("" + entry.getValue() + " gave: " + entry.getKey());
|
||||
System.out.println(entry.getValue() + " gave: " + entry.getKey());
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
|
||||
+23
-35
@@ -24,7 +24,7 @@ public class SoulNetworkHandler {
|
||||
|
||||
public static boolean syphonFromNetworkWhileInContainer(ItemStack ist, int damageToBeDone) {
|
||||
String ownerName = "";
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) {
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").isEmpty())) {
|
||||
ownerName = ist.getTagCompound().getString("ownerName");
|
||||
}
|
||||
|
||||
@@ -121,26 +121,19 @@ public class SoulNetworkHandler {
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getMaximumForOrbTier(int maxOrb) {
|
||||
switch (maxOrb) {
|
||||
case 1:
|
||||
return 5000;
|
||||
case 2:
|
||||
return 25000;
|
||||
case 3:
|
||||
return 150000;
|
||||
case 4:
|
||||
return 1000000;
|
||||
case 5:
|
||||
return 10000000;
|
||||
case 6:
|
||||
return 30000000;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return switch (maxOrb) {
|
||||
case 1 -> 5000;
|
||||
case 2 -> 25000;
|
||||
case 3 -> 150000;
|
||||
case 4 -> 1000000;
|
||||
case 5 -> 10000000;
|
||||
case 6 -> 30000000;
|
||||
default -> 1;
|
||||
};
|
||||
}
|
||||
|
||||
public static int syphonFromNetwork(ItemStack ist, int damageToBeDone) {
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) {
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").isEmpty())) {
|
||||
String ownerName = ist.getTagCompound().getString("ownerName");
|
||||
|
||||
return syphonFromNetwork(ownerName, damageToBeDone);
|
||||
@@ -177,7 +170,7 @@ public class SoulNetworkHandler {
|
||||
*
|
||||
* @param ist Owned itemStack
|
||||
* @param player Player using the item
|
||||
* @param drain
|
||||
* @param drain The amount of LP to drain
|
||||
* @return True if the action should be executed and false if it should not. Always returns false if client-sided.
|
||||
*/
|
||||
public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int drain) {
|
||||
@@ -185,7 +178,7 @@ public class SoulNetworkHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) {
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").isEmpty())) {
|
||||
String ownerName = ist.getTagCompound().getString("ownerName");
|
||||
|
||||
ItemDrainNetworkEvent event = new ItemDrainNetworkEvent(player, ownerName, ist, drain);
|
||||
@@ -217,15 +210,13 @@ public class SoulNetworkHandler {
|
||||
}
|
||||
|
||||
World world = player.worldObj;
|
||||
if (world != null) {
|
||||
world.playSoundEffect(
|
||||
(double) ((float) player.posX + 0.5F),
|
||||
(double) ((float) player.posY + 0.5F),
|
||||
(double) ((float) player.posZ + 0.5F),
|
||||
"random.fizz",
|
||||
0.5F,
|
||||
2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
}
|
||||
world.playSoundEffect(
|
||||
(float) player.posX + 0.5F,
|
||||
(float) player.posY + 0.5F,
|
||||
(float) player.posZ + 0.5F,
|
||||
"random.fizz",
|
||||
0.5F,
|
||||
2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
|
||||
int amount = SoulNetworkHandler.syphonFromNetwork(ownerName, damageToBeDone);
|
||||
|
||||
@@ -235,7 +226,7 @@ public class SoulNetworkHandler {
|
||||
}
|
||||
|
||||
public static boolean canSyphonFromOnlyNetwork(ItemStack ist, int damageToBeDone) {
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) {
|
||||
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").isEmpty())) {
|
||||
String ownerName = ist.getTagCompound().getString("ownerName");
|
||||
|
||||
return canSyphonFromOnlyNetwork(ownerName, damageToBeDone);
|
||||
@@ -299,9 +290,6 @@ public class SoulNetworkHandler {
|
||||
/**
|
||||
* A method to add to an owner's network up to a maximum value.
|
||||
*
|
||||
* @param ownerName
|
||||
* @param addedEssence
|
||||
* @param maximum
|
||||
* @return amount added to the network
|
||||
*/
|
||||
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum) {
|
||||
@@ -384,7 +372,7 @@ public class SoulNetworkHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (item.hasTagCompound() && !item.getTagCompound().getString("ownerName").equals("")) return true;
|
||||
if (item.hasTagCompound() && !item.getTagCompound().getString("ownerName").isEmpty()) return true;
|
||||
|
||||
ItemBindEvent event = new ItemBindEvent(player, SoulNetworkHandler.getUsername(player), item);
|
||||
|
||||
@@ -416,7 +404,7 @@ public class SoulNetworkHandler {
|
||||
}
|
||||
|
||||
public static void causeNauseaToPlayer(ItemStack stack) {
|
||||
if (stack.getTagCompound() != null && !(stack.getTagCompound().getString("ownerName").equals(""))) {
|
||||
if (stack.getTagCompound() != null && !(stack.getTagCompound().getString("ownerName").isEmpty())) {
|
||||
String ownerName = stack.getTagCompound().getString("ownerName");
|
||||
|
||||
SoulNetworkHandler.causeNauseaToPlayer(ownerName);
|
||||
|
||||
@@ -10,8 +10,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@@ -21,14 +19,12 @@ import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class APISpellHelper {
|
||||
|
||||
/**
|
||||
* Thanks Kihira! <3
|
||||
*
|
||||
* @param player
|
||||
* @return persistent data tag
|
||||
*/
|
||||
private static NBTTagCompound getPersistentDataTag(EntityPlayer player) {
|
||||
@@ -174,22 +170,15 @@ public class APISpellHelper {
|
||||
}
|
||||
|
||||
public static ItemStack getOrbForLevel(int level) {
|
||||
switch (level) {
|
||||
case 1:
|
||||
return new ItemStack(ModItems.weakBloodOrb);
|
||||
case 2:
|
||||
return new ItemStack(ModItems.apprenticeBloodOrb);
|
||||
case 3:
|
||||
return new ItemStack(ModItems.magicianBloodOrb);
|
||||
case 4:
|
||||
return new ItemStack(ModItems.masterBloodOrb);
|
||||
case 5:
|
||||
return new ItemStack(ModItems.archmageBloodOrb);
|
||||
case 6:
|
||||
return new ItemStack(ModItems.transcendentBloodOrb);
|
||||
default:
|
||||
return new ItemStack(Blocks.fire);
|
||||
}
|
||||
return switch (level) {
|
||||
case 1 -> new ItemStack(ModItems.weakBloodOrb);
|
||||
case 2 -> new ItemStack(ModItems.apprenticeBloodOrb);
|
||||
case 3 -> new ItemStack(ModItems.magicianBloodOrb);
|
||||
case 4 -> new ItemStack(ModItems.masterBloodOrb);
|
||||
case 5 -> new ItemStack(ModItems.archmageBloodOrb);
|
||||
case 6 -> new ItemStack(ModItems.transcendentBloodOrb);
|
||||
default -> new ItemStack(Blocks.fire);
|
||||
};
|
||||
}
|
||||
|
||||
public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) {
|
||||
@@ -207,10 +196,6 @@ public class APISpellHelper {
|
||||
float f6 = MathHelper.sin(-f1 * 0.017453292F);
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f3 * f5;
|
||||
// if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
// d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
|
||||
}
|
||||
Vec3 vec31 = vec3.addVector((double) f7 * range, (double) f6 * range, (double) f8 * range);
|
||||
return world.func_147447_a(vec3, vec31, par3, !par3, par3);
|
||||
}
|
||||
@@ -259,90 +244,18 @@ public class APISpellHelper {
|
||||
}
|
||||
|
||||
public static String getNumeralForInt(int num) {
|
||||
switch (num) {
|
||||
case 1:
|
||||
return "I";
|
||||
case 2:
|
||||
return "II";
|
||||
case 3:
|
||||
return "III";
|
||||
case 4:
|
||||
return "IV";
|
||||
case 5:
|
||||
return "V";
|
||||
case 6:
|
||||
return "VI";
|
||||
case 7:
|
||||
return "VII";
|
||||
case 8:
|
||||
return "VIII";
|
||||
case 9:
|
||||
return "IX";
|
||||
case 10:
|
||||
return "X";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static Block getBlockForString(String str) {
|
||||
String[] parts = str.split(":");
|
||||
String modId = parts[0];
|
||||
String name = parts[1];
|
||||
return GameRegistry.findBlock(modId, name);
|
||||
}
|
||||
|
||||
public static Item getItemForString(String str) {
|
||||
String[] parts = str.split(":");
|
||||
String modId = parts[0];
|
||||
String name = parts[1];
|
||||
return GameRegistry.findItem(modId, name);
|
||||
}
|
||||
|
||||
public static ItemStack getItemStackForString(String str) {
|
||||
String[] parts = str.split(":");
|
||||
int meta = 0;
|
||||
if (parts.length >= 3) {
|
||||
meta = Integer.decode(parts[2]);
|
||||
} else if (parts.length < 2) {
|
||||
return null;
|
||||
}
|
||||
String modId = parts[0];
|
||||
String name = parts[1];
|
||||
|
||||
String itemString = modId + ":" + name;
|
||||
Item item = APISpellHelper.getItemForString(itemString);
|
||||
if (item != null) {
|
||||
return new ItemStack(item, 1, meta);
|
||||
}
|
||||
|
||||
Block block = APISpellHelper.getBlockForString(itemString);
|
||||
if (block != null) {
|
||||
return new ItemStack(block, 1, meta);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IRecipe getRecipeForItemStack(ItemStack reqStack) // Does not match NBT. Durrr! -smack-
|
||||
{
|
||||
if (reqStack == null) {
|
||||
return null; // Why are you even doing this to yourself!? You know this can't be healthy!
|
||||
}
|
||||
List craftingList = CraftingManager.getInstance().getRecipeList();
|
||||
for (Object posRecipe : craftingList) {
|
||||
if (posRecipe instanceof IRecipe) {
|
||||
ItemStack outputStack = ((IRecipe) posRecipe).getRecipeOutput();
|
||||
if (outputStack != null) {
|
||||
if (outputStack.getItem() == reqStack.getItem() && (outputStack.getItem().getHasSubtypes()
|
||||
? outputStack.getItemDamage() == reqStack.getItemDamage()
|
||||
: true)) {
|
||||
return (IRecipe) posRecipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return switch (num) {
|
||||
case 1 -> "I";
|
||||
case 2 -> "II";
|
||||
case 3 -> "III";
|
||||
case 4 -> "IV";
|
||||
case 5 -> "V";
|
||||
case 6 -> "VI";
|
||||
case 7 -> "VII";
|
||||
case 8 -> "VIII";
|
||||
case 9 -> "IX";
|
||||
case 10 -> "X";
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.api.spell;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -43,35 +42,27 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
// Custom variables
|
||||
private int maxRicochet = 0;
|
||||
private float damage = 1;
|
||||
public List<IProjectileImpactEffect> impactList = new ArrayList();
|
||||
public List<IProjectileImpactEffect> impactList = new ArrayList<>();
|
||||
private boolean penetration = false;
|
||||
public List<IProjectileUpdateEffect> updateEffectList = new ArrayList();
|
||||
public List<SpellEffect> spellEffectList = new LinkedList();
|
||||
public List<IProjectileUpdateEffect> updateEffectList = new ArrayList<>();
|
||||
public List<SpellEffect> spellEffectList = new LinkedList<>();
|
||||
private int blocksBroken = 0;
|
||||
|
||||
public EntitySpellProjectile(World par1World) {
|
||||
super(par1World);
|
||||
public EntitySpellProjectile(World world) {
|
||||
super(world);
|
||||
this.setSize(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public EntitySpellProjectile(World par1World, double par2, double par4, double par6) {
|
||||
super(par1World);
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setPosition(par2, par4, par6);
|
||||
yOffset = 0.0F;
|
||||
}
|
||||
|
||||
public EntitySpellProjectile(World par1World, EntityPlayer par2EntityPlayer) {
|
||||
super(par1World);
|
||||
shootingEntity = par2EntityPlayer;
|
||||
float par3 = 0.8F;
|
||||
public EntitySpellProjectile(World world, EntityPlayer player) {
|
||||
super(world);
|
||||
shootingEntity = player;
|
||||
this.setSize(0.1F, 0.1F);
|
||||
this.setLocationAndAngles(
|
||||
par2EntityPlayer.posX,
|
||||
par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(),
|
||||
par2EntityPlayer.posZ,
|
||||
par2EntityPlayer.rotationYaw,
|
||||
par2EntityPlayer.rotationPitch);
|
||||
player.posX,
|
||||
player.posY + player.getEyeHeight(),
|
||||
player.posZ,
|
||||
player.rotationYaw,
|
||||
player.rotationPitch);
|
||||
posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
|
||||
posY -= 0.2D;
|
||||
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
|
||||
@@ -82,7 +73,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI)
|
||||
* MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI);
|
||||
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI);
|
||||
this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
|
||||
this.setThrowableHeading(motionX, motionY, motionZ, 1.2f, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,62 +81,48 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
dataWatcher.addObject(16, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
|
||||
*/
|
||||
@Override
|
||||
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) {
|
||||
float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5);
|
||||
var1 /= var9;
|
||||
var3 /= var9;
|
||||
var5 /= var9;
|
||||
var1 += rand.nextGaussian() * 0.007499999832361937D * var8;
|
||||
var3 += rand.nextGaussian() * 0.007499999832361937D * var8;
|
||||
var5 += rand.nextGaussian() * 0.007499999832361937D * var8;
|
||||
var1 *= var7;
|
||||
var3 *= var7;
|
||||
var5 *= var7;
|
||||
motionX = var1;
|
||||
motionY = var3;
|
||||
motionZ = var5;
|
||||
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5);
|
||||
prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI);
|
||||
public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) {
|
||||
float distance = MathHelper.sqrt_double(x * x + y * y + z * z);
|
||||
x /= distance;
|
||||
y /= distance;
|
||||
z /= distance;
|
||||
x += rand.nextGaussian() * 0.0075D * inaccuracy;
|
||||
y += rand.nextGaussian() * 0.0075D * inaccuracy;
|
||||
z += rand.nextGaussian() * 0.0075D * inaccuracy;
|
||||
x *= velocity;
|
||||
y *= velocity;
|
||||
z *= velocity;
|
||||
motionX = x;
|
||||
motionY = y;
|
||||
motionZ = z;
|
||||
float horizontalDistance = MathHelper.sqrt_double(x * x + z * z);
|
||||
prevRotationYaw = rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch = (float) (Math.atan2(y, horizontalDistance) * 180.0D / Math.PI);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
|
||||
* posY, posZ, yaw, pitch
|
||||
*/
|
||||
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) {
|
||||
this.setPosition(par1, par3, par5);
|
||||
this.setRotation(par7, par8);
|
||||
public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int rotationIncrements) {
|
||||
this.setPosition(x, y, z);
|
||||
this.setRotation(yaw, pitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Sets the velocity to the args. Args: x, y, z
|
||||
*/
|
||||
public void setVelocity(double par1, double par3, double par5) {
|
||||
motionX = par1;
|
||||
motionY = par3;
|
||||
motionZ = par5;
|
||||
public void setVelocity(double x, double y, double z) {
|
||||
motionX = x;
|
||||
motionY = y;
|
||||
motionZ = z;
|
||||
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) {
|
||||
float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
|
||||
prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch;
|
||||
float horizontalDistance = MathHelper.sqrt_double(x * x + z * z);
|
||||
prevRotationYaw = rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch = (float) (Math.atan2(y, horizontalDistance) * 180.0D / Math.PI);
|
||||
prevRotationYaw = rotationYaw;
|
||||
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
@@ -154,17 +131,16 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
this.setDead();
|
||||
}
|
||||
if (shootingEntity == null) {
|
||||
List players = worldObj.getEntitiesWithinAABB(
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(
|
||||
EntityPlayer.class,
|
||||
AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1));
|
||||
Iterator i = players.iterator();
|
||||
|
||||
double closestDistance = Double.MAX_VALUE;
|
||||
EntityPlayer closestPlayer = null;
|
||||
while (i.hasNext()) {
|
||||
EntityPlayer e = (EntityPlayer) i.next();
|
||||
double distance = e.getDistanceToEntity(this);
|
||||
for (EntityPlayer player : players) {
|
||||
double distance = player.getDistanceToEntity(this);
|
||||
if (distance < closestDistance) {
|
||||
closestPlayer = e;
|
||||
closestPlayer = player;
|
||||
}
|
||||
}
|
||||
if (closestPlayer != null) {
|
||||
@@ -172,84 +148,69 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
}
|
||||
}
|
||||
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) {
|
||||
float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
|
||||
float horizontalDistance = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
|
||||
prevRotationYaw = rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI);
|
||||
prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, horizontalDistance) * 180.0D / Math.PI);
|
||||
}
|
||||
Block var16 = worldObj.getBlock(xTile, yTile, zTile);
|
||||
Block block = worldObj.getBlock(xTile, yTile, zTile);
|
||||
|
||||
if (var16 != null) {
|
||||
var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
|
||||
AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
|
||||
if (block != null) {
|
||||
block.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
|
||||
AxisAlignedBB collision = block.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
|
||||
|
||||
if (var2 != null && var2.isVecInside(APISpellHelper.createVec3(posX, posY, posZ))) {
|
||||
if (collision != null && collision.isVecInside(APISpellHelper.createVec3(posX, posY, posZ))) {
|
||||
inGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (inGround) {
|
||||
Block var18 = worldObj.getBlock(xTile, yTile, zTile);
|
||||
int var19 = worldObj.getBlockMetadata(xTile, yTile, zTile);
|
||||
|
||||
// if (var18.equals(Block.getBlockById(inTile)) && var19 == inData)
|
||||
{
|
||||
// this.groundImpact();
|
||||
// this.setDead();
|
||||
}
|
||||
} else {
|
||||
if (!inGround) {
|
||||
++ticksInAir;
|
||||
|
||||
if (ticksInAir > 1 && ticksInAir < 3) {
|
||||
// worldObj.spawnParticle("flame", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ +
|
||||
// smallGauss(0.1D), 0D, 0D, 0D);
|
||||
if (ticksInAir == 2) {
|
||||
for (int particles = 0; particles < 3; particles++) {
|
||||
this.doFiringParticles();
|
||||
}
|
||||
}
|
||||
|
||||
Vec3 var17 = APISpellHelper.createVec3(posX, posY, posZ);
|
||||
Vec3 var3 = APISpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false);
|
||||
var17 = APISpellHelper.createVec3(posX, posY, posZ);
|
||||
var3 = APISpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
Vec3 start = APISpellHelper.createVec3(posX, posY, posZ);
|
||||
Vec3 end = APISpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
MovingObjectPosition movement = worldObj.func_147447_a(start, end, true, false, false);
|
||||
start = APISpellHelper.createVec3(posX, posY, posZ);
|
||||
end = APISpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
|
||||
if (var4 != null) {
|
||||
var3 = APISpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord);
|
||||
if (movement != null) {
|
||||
end = APISpellHelper.createVec3(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity var5 = null;
|
||||
List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(
|
||||
Entity closestEntity = null;
|
||||
List<Entity> entitiesInRange = worldObj.getEntitiesWithinAABBExcludingEntity(
|
||||
this,
|
||||
boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double var7 = 0.0D;
|
||||
Iterator var9 = var6.iterator();
|
||||
float var11;
|
||||
double closestDistance = 0.0D;
|
||||
|
||||
while (var9.hasNext()) {
|
||||
Entity var10 = (Entity) var9.next();
|
||||
for (Entity entity : entitiesInRange) {
|
||||
|
||||
if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) {
|
||||
var11 = 0.3F;
|
||||
AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11);
|
||||
MovingObjectPosition var13 = var12.calculateIntercept(var17, var3);
|
||||
if (entity.canBeCollidedWith() && (entity != shootingEntity || ticksInAir >= 5)) {
|
||||
AxisAlignedBB box = entity.boundingBox.expand(0.3F, 0.3F, 0.3F);
|
||||
MovingObjectPosition intercept = box.calculateIntercept(start, end);
|
||||
|
||||
if (var13 != null) {
|
||||
double var14 = var17.distanceTo(var13.hitVec);
|
||||
if (intercept != null) {
|
||||
double distance = start.distanceTo(intercept.hitVec);
|
||||
|
||||
if (var14 < var7 || var7 == 0.0D) {
|
||||
var5 = var10;
|
||||
var7 = var14;
|
||||
if (distance < closestDistance || closestDistance == 0.0D) {
|
||||
closestEntity = entity;
|
||||
closestDistance = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (var5 != null) {
|
||||
var4 = new MovingObjectPosition(var5);
|
||||
if (closestEntity != null) {
|
||||
movement = new MovingObjectPosition(closestEntity);
|
||||
}
|
||||
|
||||
if (var4 != null) {
|
||||
this.onImpact(var4);
|
||||
if (movement != null) {
|
||||
this.onImpact(movement);
|
||||
|
||||
if (scheduledForDeath) {
|
||||
this.setDead();
|
||||
@@ -259,16 +220,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
posX += motionX;
|
||||
posY += motionY;
|
||||
posZ += motionZ;
|
||||
MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
|
||||
this.setPosition(posX, posY, posZ);
|
||||
// this.doBlockCollisions();
|
||||
}
|
||||
}
|
||||
|
||||
private void doFlightParticles() {
|
||||
if (ticksInAir % 3 == 0) {
|
||||
double gauss = gaussian(1.0F);
|
||||
worldObj.spawnParticle("mobSpell", posX, posY, posZ, gauss, gauss, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,17 +236,14 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
worldObj.spawnParticle("flame", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setShort("xTile", (short) xTile);
|
||||
par1NBTTagCompound.setShort("yTile", (short) yTile);
|
||||
par1NBTTagCompound.setShort("zTile", (short) zTile);
|
||||
par1NBTTagCompound.setByte("inTile", (byte) inTile);
|
||||
par1NBTTagCompound.setByte("inData", (byte) inData);
|
||||
par1NBTTagCompound.setByte("inGround", (byte) (inGround ? 1 : 0));
|
||||
public void writeEntityToNBT(NBTTagCompound tag) {
|
||||
tag.setShort("xTile", (short) xTile);
|
||||
tag.setShort("yTile", (short) yTile);
|
||||
tag.setShort("zTile", (short) zTile);
|
||||
tag.setByte("inTile", (byte) inTile);
|
||||
tag.setByte("inData", (byte) inData);
|
||||
tag.setByte("inGround", (byte) (inGround ? 1 : 0));
|
||||
|
||||
NBTTagList effectList = new NBTTagList();
|
||||
|
||||
@@ -302,50 +251,34 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
effectList.appendTag(eff.getTag());
|
||||
}
|
||||
|
||||
// for (String str : this.effectList)
|
||||
// {
|
||||
// if (str != null)
|
||||
// {
|
||||
// NBTTagCompound tag = new NBTTagCompound();
|
||||
//
|
||||
// tag.setString("Class", str);
|
||||
// effectList.appendTag(tag);
|
||||
// }
|
||||
// }
|
||||
|
||||
par1NBTTagCompound.setTag("Effects", effectList);
|
||||
par1NBTTagCompound.setInteger("blocksBroken", blocksBroken);
|
||||
par1NBTTagCompound.setBoolean("isSilkTouch", isSilkTouch);
|
||||
tag.setTag("Effects", effectList);
|
||||
tag.setInteger("blocksBroken", blocksBroken);
|
||||
tag.setBoolean("isSilkTouch", isSilkTouch);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
xTile = par1NBTTagCompound.getShort("xTile");
|
||||
yTile = par1NBTTagCompound.getShort("yTile");
|
||||
zTile = par1NBTTagCompound.getShort("zTile");
|
||||
inTile = par1NBTTagCompound.getByte("inTile") & 255;
|
||||
inData = par1NBTTagCompound.getByte("inData") & 255;
|
||||
inGround = par1NBTTagCompound.getByte("inGround") == 1;
|
||||
blocksBroken = par1NBTTagCompound.getInteger("blocksBroken");
|
||||
isSilkTouch = par1NBTTagCompound.getBoolean("isSilkTouch");
|
||||
public void readEntityFromNBT(NBTTagCompound tag) {
|
||||
xTile = tag.getShort("xTile");
|
||||
yTile = tag.getShort("yTile");
|
||||
zTile = tag.getShort("zTile");
|
||||
inTile = tag.getByte("inTile") & 255;
|
||||
inData = tag.getByte("inData") & 255;
|
||||
inGround = tag.getByte("inGround") == 1;
|
||||
blocksBroken = tag.getInteger("blocksBroken");
|
||||
isSilkTouch = tag.getBoolean("isSilkTouch");
|
||||
|
||||
NBTTagList tagList = par1NBTTagCompound.getTagList("Effects", Constants.NBT.TAG_COMPOUND);
|
||||
NBTTagList tagList = tag.getTagList("Effects", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
List<SpellEffect> spellEffectList = new LinkedList();
|
||||
List<SpellEffect> spellEffectList = new LinkedList<>();
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
NBTTagCompound tag = tagList.getCompoundTagAt(i);
|
||||
|
||||
SpellEffect eff = SpellEffect.getEffectFromTag(tag);
|
||||
SpellEffect eff = SpellEffect.getEffectFromTag(tagList.getCompoundTagAt(i));
|
||||
if (eff != null) {
|
||||
spellEffectList.add(eff);
|
||||
}
|
||||
}
|
||||
this.spellEffectList = spellEffectList;
|
||||
|
||||
// this.effectList = new LinkedList();
|
||||
// this.effectList = new LinkedList<>();
|
||||
// for (int i = 0; i < tagList.tagCount(); i++)
|
||||
// {
|
||||
// NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i);
|
||||
@@ -374,39 +307,11 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount of knockback the arrow applies when it hits a mob.
|
||||
*/
|
||||
public void setKnockbackStrength(int par1) {}
|
||||
|
||||
/**
|
||||
* If returns false, the item will not inflict any damage against entities.
|
||||
*/
|
||||
@Override
|
||||
public boolean canAttackWithItem() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the arrow has a stream of critical hit particles flying behind it.
|
||||
*/
|
||||
public void setIsCritical(boolean par1) {
|
||||
byte var2 = dataWatcher.getWatchableObjectByte(16);
|
||||
if (par1) {
|
||||
dataWatcher.updateObject(16, var2 | 1);
|
||||
} else {
|
||||
dataWatcher.updateObject(16, var2 & -2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the arrow has a stream of critical hit particles flying behind it.
|
||||
*/
|
||||
public boolean getIsCritical() {
|
||||
byte var1 = dataWatcher.getWatchableObjectByte(16);
|
||||
return (var1 & 1) != 0;
|
||||
}
|
||||
|
||||
private void onImpact(MovingObjectPosition mop) {
|
||||
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) {
|
||||
if (mop.entityHit == shootingEntity) return;
|
||||
@@ -471,87 +376,23 @@ public class EntitySpellProjectile extends Entity implements IProjectile {
|
||||
|
||||
private void ricochet(int sideHit) {
|
||||
switch (sideHit) {
|
||||
case 0:
|
||||
case 1:
|
||||
// topHit, bottomHit, reflect Y
|
||||
motionY = motionY * -1;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
// westHit, eastHit, reflect Z
|
||||
motionZ = motionZ * -1;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
// southHit, northHit, reflect X
|
||||
motionX = motionX * -1;
|
||||
break;
|
||||
case 0, 1 -> motionY = motionY * -1; // topHit, bottomHit, reflect Y
|
||||
case 2, 3 -> motionZ = motionZ * -1; // westHit, eastHit, reflect Z
|
||||
case 4, 5 -> motionX = motionX * -1; // southHit, northHit, reflect X
|
||||
}
|
||||
ricochetCounter++;
|
||||
if (ricochetCounter > this.getRicochetMax()) {
|
||||
scheduledForDeath = true;
|
||||
for (int particles = 0; particles < 4; particles++) {
|
||||
switch (sideHit) {
|
||||
case 0:
|
||||
worldObj.spawnParticle(
|
||||
"smoke",
|
||||
posX,
|
||||
posY,
|
||||
posZ,
|
||||
gaussian(0.1D),
|
||||
-gaussian(0.1D),
|
||||
gaussian(0.1D));
|
||||
break;
|
||||
case 1:
|
||||
worldObj.spawnParticle(
|
||||
"smoke",
|
||||
posX,
|
||||
posY,
|
||||
posZ,
|
||||
gaussian(0.1D),
|
||||
gaussian(0.1D),
|
||||
gaussian(0.1D));
|
||||
break;
|
||||
case 2:
|
||||
worldObj.spawnParticle(
|
||||
"smoke",
|
||||
posX,
|
||||
posY,
|
||||
posZ,
|
||||
gaussian(0.1D),
|
||||
gaussian(0.1D),
|
||||
-gaussian(0.1D));
|
||||
break;
|
||||
case 3:
|
||||
worldObj.spawnParticle(
|
||||
"smoke",
|
||||
posX,
|
||||
posY,
|
||||
posZ,
|
||||
gaussian(0.1D),
|
||||
gaussian(0.1D),
|
||||
gaussian(0.1D));
|
||||
break;
|
||||
case 4:
|
||||
worldObj.spawnParticle(
|
||||
"smoke",
|
||||
posX,
|
||||
posY,
|
||||
posZ,
|
||||
-gaussian(0.1D),
|
||||
gaussian(0.1D),
|
||||
gaussian(0.1D));
|
||||
break;
|
||||
case 5:
|
||||
worldObj.spawnParticle(
|
||||
"smoke",
|
||||
posX,
|
||||
posY,
|
||||
posZ,
|
||||
gaussian(0.1D),
|
||||
gaussian(0.1D),
|
||||
gaussian(0.1D));
|
||||
break;
|
||||
case 0 -> worldObj
|
||||
.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D));
|
||||
case 1, 3, 5 -> worldObj
|
||||
.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
case 2 -> worldObj
|
||||
.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D));
|
||||
case 4 -> worldObj
|
||||
.spawnParticle("smoke", posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ import net.minecraft.world.World;
|
||||
|
||||
public interface IToolUpdateEffect {
|
||||
|
||||
int onUpdate(ItemStack toolStack, World world, Entity par3Entity, int invSlot, boolean inHand);
|
||||
int onUpdate(ItemStack toolStack, World world, Entity entity, int invSlot, boolean inHand);
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package WayofTime.alchemicalWizardry.api.spell;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
|
||||
/**
|
||||
* New wrapper class to enclose the ComplexSpellEffect
|
||||
*/
|
||||
@@ -34,15 +36,9 @@ public class SpellEffect {
|
||||
public void enhanceEffect(SpellEnhancement enh) {
|
||||
if (enh != null) {
|
||||
switch (enh.getState()) {
|
||||
case SpellEnhancement.POWER:
|
||||
this.powerEnhancement++;
|
||||
break;
|
||||
case SpellEnhancement.EFFICIENCY:
|
||||
this.costEnhancement++;
|
||||
break;
|
||||
case SpellEnhancement.POTENCY:
|
||||
this.potencyEnhancement++;
|
||||
break;
|
||||
case SpellEnhancement.POWER -> this.powerEnhancement++;
|
||||
case SpellEnhancement.EFFICIENCY -> this.costEnhancement++;
|
||||
case SpellEnhancement.POTENCY -> this.potencyEnhancement++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,7 +56,7 @@ public class SpellEffect {
|
||||
return;
|
||||
}
|
||||
|
||||
Class paraClass = parad.getClass();
|
||||
Class<? extends SpellParadigm> paraClass = parad.getClass();
|
||||
|
||||
ComplexSpellEffect effect = SpellEffectRegistry
|
||||
.getSpellEffect(paraClass, type, modifier, powerEnhancement, potencyEnhancement, costEnhancement);
|
||||
@@ -75,7 +71,7 @@ public class SpellEffect {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Class paraClass = parad.getClass();
|
||||
Class<? extends SpellParadigm> paraClass = parad.getClass();
|
||||
|
||||
ComplexSpellEffect effect = SpellEffectRegistry
|
||||
.getSpellEffect(paraClass, type, modifier, powerEnhancement, potencyEnhancement, costEnhancement);
|
||||
@@ -102,29 +98,23 @@ public class SpellEffect {
|
||||
|
||||
public static SpellEffect getEffectFromTag(NBTTagCompound tag) {
|
||||
try {
|
||||
Class clazz = Class.forName(tag.getString("Class"));
|
||||
if (clazz != null) {
|
||||
try {
|
||||
Object obj = clazz.newInstance();
|
||||
if (obj instanceof SpellEffect) {
|
||||
SpellEffect eff = (SpellEffect) obj;
|
||||
Class<?> clazz = Class.forName(tag.getString("Class"));
|
||||
try {
|
||||
Object obj = clazz.newInstance();
|
||||
if (obj instanceof SpellEffect eff) {
|
||||
eff.type = SpellEffectRegistry.getTypeForKey(tag.getString("type"));
|
||||
eff.modifier = SpellEffectRegistry.getModifierForKey(tag.getString("modifier"));
|
||||
eff.powerEnhancement = tag.getInteger("power");
|
||||
eff.costEnhancement = tag.getInteger("cost");
|
||||
eff.potencyEnhancement = tag.getInteger("potency");
|
||||
|
||||
eff.type = SpellEffectRegistry.getTypeForKey(tag.getString("type"));
|
||||
eff.modifier = SpellEffectRegistry.getModifierForKey(tag.getString("modifier"));
|
||||
eff.powerEnhancement = tag.getInteger("power");
|
||||
eff.costEnhancement = tag.getInteger("cost");
|
||||
eff.potencyEnhancement = tag.getInteger("potency");
|
||||
|
||||
return eff;
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return eff;
|
||||
}
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
AlchemicalWizardry.logger.error(e);
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
AlchemicalWizardry.logger.error(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -141,339 +131,3 @@ public class SpellEffect {
|
||||
return this.costEnhancement;
|
||||
}
|
||||
}
|
||||
|
||||
// package WayofTime.alchemicalWizardry.common.spell.complex.effect;
|
||||
//
|
||||
// import WayofTime.alchemicalWizardry.common.spell.complex.*;
|
||||
// import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
|
||||
// import net.minecraft.nbt.NBTTagCompound;
|
||||
//
|
||||
// public abstract class SpellEffect
|
||||
// {
|
||||
// protected int modifierState;
|
||||
// protected int powerEnhancement;
|
||||
// protected int costEnhancement;
|
||||
// protected int potencyEnhancement;
|
||||
//
|
||||
// public SpellEffect()
|
||||
// {
|
||||
// this.modifierState = SpellModifier.DEFAULT;
|
||||
// this.powerEnhancement = 0;
|
||||
// this.costEnhancement = 0;
|
||||
// this.potencyEnhancement = 0;
|
||||
// }
|
||||
//
|
||||
// public void enhanceEffect(SpellEnhancement enh)
|
||||
// {
|
||||
// if (enh != null)
|
||||
// {
|
||||
// switch (enh.getState())
|
||||
// {
|
||||
// case SpellEnhancement.POWER:
|
||||
// this.powerEnhancement++;
|
||||
// break;
|
||||
// case SpellEnhancement.EFFICIENCY:
|
||||
// this.costEnhancement++;
|
||||
// break;
|
||||
// case SpellEnhancement.POTENCY:
|
||||
// this.potencyEnhancement++;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void modifyEffect(SpellModifier mod)
|
||||
// {
|
||||
// if (mod != null)
|
||||
// modifierState = mod.getModifier();
|
||||
// }
|
||||
//
|
||||
// public void modifyParadigm(SpellParadigm parad) //When modifying the paradigm it will instead get the class name
|
||||
// and ask the registry
|
||||
// {
|
||||
// if (parad instanceof SpellParadigmProjectile)
|
||||
// {
|
||||
// this.modifyProjectileParadigm((SpellParadigmProjectile) parad);
|
||||
// }
|
||||
// if (parad instanceof SpellParadigmSelf)
|
||||
// {
|
||||
// this.modifySelfParadigm((SpellParadigmSelf) parad);
|
||||
// }
|
||||
// if (parad instanceof SpellParadigmMelee)
|
||||
// {
|
||||
// this.modifyMeleeParadigm((SpellParadigmMelee) parad);
|
||||
// }
|
||||
// if (parad instanceof SpellParadigmTool)
|
||||
// {
|
||||
// this.modifyToolParadigm((SpellParadigmTool) parad);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void modifyProjectileParadigm(SpellParadigmProjectile parad)
|
||||
// {
|
||||
// switch (modifierState)
|
||||
// {
|
||||
// case SpellModifier.DEFAULT:
|
||||
// this.defaultModificationProjectile(parad);
|
||||
// break;
|
||||
// case SpellModifier.OFFENSIVE:
|
||||
// this.offensiveModificationProjectile(parad);
|
||||
// break;
|
||||
// case SpellModifier.DEFENSIVE:
|
||||
// this.defensiveModificationProjectile(parad);
|
||||
// break;
|
||||
// case SpellModifier.ENVIRONMENTAL:
|
||||
// this.environmentalModificationProjectile(parad);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public abstract void defaultModificationProjectile(SpellParadigmProjectile parad);
|
||||
//
|
||||
// public abstract void offensiveModificationProjectile(SpellParadigmProjectile parad);
|
||||
//
|
||||
// public abstract void defensiveModificationProjectile(SpellParadigmProjectile parad);
|
||||
//
|
||||
// public abstract void environmentalModificationProjectile(SpellParadigmProjectile parad);
|
||||
//
|
||||
// public void modifySelfParadigm(SpellParadigmSelf parad)
|
||||
// {
|
||||
// switch (modifierState)
|
||||
// {
|
||||
// case SpellModifier.DEFAULT:
|
||||
// this.defaultModificationSelf(parad);
|
||||
// break;
|
||||
// case SpellModifier.OFFENSIVE:
|
||||
// this.offensiveModificationSelf(parad);
|
||||
// break;
|
||||
// case SpellModifier.DEFENSIVE:
|
||||
// this.defensiveModificationSelf(parad);
|
||||
// break;
|
||||
// case SpellModifier.ENVIRONMENTAL:
|
||||
// this.environmentalModificationSelf(parad);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public abstract void defaultModificationSelf(SpellParadigmSelf parad);
|
||||
//
|
||||
// public abstract void offensiveModificationSelf(SpellParadigmSelf parad);
|
||||
//
|
||||
// public abstract void defensiveModificationSelf(SpellParadigmSelf parad);
|
||||
//
|
||||
// public abstract void environmentalModificationSelf(SpellParadigmSelf parad);
|
||||
//
|
||||
// public void modifyMeleeParadigm(SpellParadigmMelee parad)
|
||||
// {
|
||||
// switch (modifierState)
|
||||
// {
|
||||
// case SpellModifier.DEFAULT:
|
||||
// this.defaultModificationMelee(parad);
|
||||
// break;
|
||||
// case SpellModifier.OFFENSIVE:
|
||||
// this.offensiveModificationMelee(parad);
|
||||
// break;
|
||||
// case SpellModifier.DEFENSIVE:
|
||||
// this.defensiveModificationMelee(parad);
|
||||
// break;
|
||||
// case SpellModifier.ENVIRONMENTAL:
|
||||
// this.environmentalModificationMelee(parad);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public abstract void defaultModificationMelee(SpellParadigmMelee parad);
|
||||
//
|
||||
// public abstract void offensiveModificationMelee(SpellParadigmMelee parad);
|
||||
//
|
||||
// public abstract void defensiveModificationMelee(SpellParadigmMelee parad);
|
||||
//
|
||||
// public abstract void environmentalModificationMelee(SpellParadigmMelee parad);
|
||||
//
|
||||
// public void modifyToolParadigm(SpellParadigmTool parad)
|
||||
// {
|
||||
// switch (modifierState)
|
||||
// {
|
||||
// case SpellModifier.DEFAULT:
|
||||
// this.defaultModificationTool(parad);
|
||||
// break;
|
||||
// case SpellModifier.OFFENSIVE:
|
||||
// this.offensiveModificationTool(parad);
|
||||
// break;
|
||||
// case SpellModifier.DEFENSIVE:
|
||||
// this.defensiveModificationTool(parad);
|
||||
// break;
|
||||
// case SpellModifier.ENVIRONMENTAL:
|
||||
// this.environmentalModificationTool(parad);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public abstract void defaultModificationTool(SpellParadigmTool parad);
|
||||
//
|
||||
// public abstract void offensiveModificationTool(SpellParadigmTool parad);
|
||||
//
|
||||
// public abstract void defensiveModificationTool(SpellParadigmTool parad);
|
||||
//
|
||||
// public abstract void environmentalModificationTool(SpellParadigmTool parad);
|
||||
//
|
||||
// public int getCostForProjectile()
|
||||
// {
|
||||
// switch (this.modifierState)
|
||||
// {
|
||||
// case SpellModifier.DEFAULT:
|
||||
// return this.getCostForDefaultProjectile();
|
||||
// case SpellModifier.OFFENSIVE:
|
||||
// return this.getCostForOffenseProjectile();
|
||||
// case SpellModifier.DEFENSIVE:
|
||||
// return this.getCostForDefenseProjectile();
|
||||
// case SpellModifier.ENVIRONMENTAL:
|
||||
// return this.getCostForEnvironmentProjectile();
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// protected abstract int getCostForDefaultProjectile();
|
||||
//
|
||||
// protected abstract int getCostForOffenseProjectile();
|
||||
//
|
||||
// protected abstract int getCostForDefenseProjectile();
|
||||
//
|
||||
// protected abstract int getCostForEnvironmentProjectile();
|
||||
//
|
||||
// public int getCostForSelf()
|
||||
// {
|
||||
// switch (this.modifierState)
|
||||
// {
|
||||
// case SpellModifier.DEFAULT:
|
||||
// return this.getCostForDefaultSelf();
|
||||
// case SpellModifier.OFFENSIVE:
|
||||
// return this.getCostForOffenseSelf();
|
||||
// case SpellModifier.DEFENSIVE:
|
||||
// return this.getCostForDefenseSelf();
|
||||
// case SpellModifier.ENVIRONMENTAL:
|
||||
// return this.getCostForEnvironmentSelf();
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// protected abstract int getCostForDefaultSelf();
|
||||
//
|
||||
// protected abstract int getCostForOffenseSelf();
|
||||
//
|
||||
// protected abstract int getCostForDefenseSelf();
|
||||
//
|
||||
// protected abstract int getCostForEnvironmentSelf();
|
||||
//
|
||||
// public int getCostForMelee()
|
||||
// {
|
||||
// switch (this.modifierState)
|
||||
// {
|
||||
// case SpellModifier.DEFAULT:
|
||||
// return this.getCostForDefaultMelee();
|
||||
// case SpellModifier.OFFENSIVE:
|
||||
// return this.getCostForOffenseMelee();
|
||||
// case SpellModifier.DEFENSIVE:
|
||||
// return this.getCostForDefenseMelee();
|
||||
// case SpellModifier.ENVIRONMENTAL:
|
||||
// return this.getCostForEnvironmentMelee();
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// protected abstract int getCostForDefaultMelee();
|
||||
//
|
||||
// protected abstract int getCostForOffenseMelee();
|
||||
//
|
||||
// protected abstract int getCostForDefenseMelee();
|
||||
//
|
||||
// protected abstract int getCostForEnvironmentMelee();
|
||||
//
|
||||
// public int getCostForTool()
|
||||
// {
|
||||
// switch (this.modifierState)
|
||||
// {
|
||||
// case SpellModifier.DEFAULT:
|
||||
// return this.getCostForDefaultTool();
|
||||
// case SpellModifier.OFFENSIVE:
|
||||
// return this.getCostForOffenseTool();
|
||||
// case SpellModifier.DEFENSIVE:
|
||||
// return this.getCostForDefenseTool();
|
||||
// case SpellModifier.ENVIRONMENTAL:
|
||||
// return this.getCostForEnvironmentTool();
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// protected abstract int getCostForDefaultTool();
|
||||
//
|
||||
// protected abstract int getCostForOffenseTool();
|
||||
//
|
||||
// protected abstract int getCostForDefenseTool();
|
||||
//
|
||||
// protected abstract int getCostForEnvironmentTool();
|
||||
//
|
||||
// public int getPowerEnhancements()
|
||||
// {
|
||||
// return this.powerEnhancement;
|
||||
// }
|
||||
//
|
||||
// public int getCostEnhancements()
|
||||
// {
|
||||
// return this.costEnhancement;
|
||||
// }
|
||||
//
|
||||
// public int getPotencyEnhancements()
|
||||
// {
|
||||
// return this.potencyEnhancement;
|
||||
// }
|
||||
//
|
||||
// public NBTTagCompound getTag()
|
||||
// {
|
||||
// NBTTagCompound tag = new NBTTagCompound();
|
||||
//
|
||||
// tag.setString("Class", this.getClass().getName());
|
||||
// tag.setInteger("modifier", modifierState);
|
||||
// tag.setInteger("power", powerEnhancement);
|
||||
// tag.setInteger("cost", costEnhancement);
|
||||
// tag.setInteger("potency", potencyEnhancement);
|
||||
//
|
||||
// return tag;
|
||||
// }
|
||||
//
|
||||
// public static SpellEffect getEffectFromTag(NBTTagCompound tag)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Class clazz = Class.forName(tag.getString("Class"));
|
||||
// if (clazz != null)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Object obj = clazz.newInstance();
|
||||
// if (obj instanceof SpellEffect)
|
||||
// {
|
||||
// SpellEffect eff = (SpellEffect) obj;
|
||||
//
|
||||
// eff.modifierState = tag.getInteger("modifier");
|
||||
// eff.powerEnhancement = tag.getInteger("power");
|
||||
// eff.costEnhancement = tag.getInteger("cost");
|
||||
// eff.potencyEnhancement = tag.getInteger("potency");
|
||||
//
|
||||
// return eff;
|
||||
// }
|
||||
// } catch (InstantiationException e)
|
||||
// {
|
||||
// e.printStackTrace();
|
||||
// } catch (IllegalAccessException e)
|
||||
// {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// } catch (ClassNotFoundException e)
|
||||
// {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
@@ -8,9 +8,9 @@ import java.util.Map.Entry;
|
||||
|
||||
public class SpellEffectRegistry {
|
||||
|
||||
public static Map<Class<? extends SpellParadigm>, List<ComplexSpellEffect>> effectRegistry = new HashMap();
|
||||
public static Map<String, ComplexSpellType> typeRegistry = new HashMap();
|
||||
public static Map<String, ComplexSpellModifier> modifierRegistry = new HashMap();
|
||||
public static Map<Class<? extends SpellParadigm>, List<ComplexSpellEffect>> effectRegistry = new HashMap<>();
|
||||
public static Map<String, ComplexSpellType> typeRegistry = new HashMap<>();
|
||||
public static Map<String, ComplexSpellModifier> modifierRegistry = new HashMap<>();
|
||||
|
||||
public static void registerSpellEffect(Class<? extends SpellParadigm> paraClass, ComplexSpellEffect effect) {
|
||||
if (paraClass == null || effect == null) {
|
||||
@@ -36,24 +36,12 @@ public class SpellEffectRegistry {
|
||||
|
||||
effectList.add(effect);
|
||||
} else {
|
||||
List<ComplexSpellEffect> effectList = new LinkedList();
|
||||
List<ComplexSpellEffect> effectList = new LinkedList<>();
|
||||
effectList.add(effect);
|
||||
effectRegistry.put(paraClass, effectList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param paraClass
|
||||
* @param type
|
||||
* @param mod
|
||||
* @return A copy of the spell effect
|
||||
*/
|
||||
public static ComplexSpellEffect getSpellEffect(Class<? extends SpellParadigm> paraClass, ComplexSpellType type,
|
||||
ComplexSpellModifier mod) {
|
||||
return SpellEffectRegistry.getSpellEffect(paraClass, type, mod, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static ComplexSpellEffect getSpellEffect(Class<? extends SpellParadigm> paraClass, ComplexSpellType type,
|
||||
ComplexSpellModifier mod, int power, int potency, int cost) {
|
||||
if (paraClass == null || type == null || mod == null) {
|
||||
|
||||
@@ -6,7 +6,7 @@ public class SpellEnhancement {
|
||||
public static final int EFFICIENCY = 1;
|
||||
public static final int POTENCY = 2;
|
||||
|
||||
private int state = POWER;
|
||||
private final int state;
|
||||
|
||||
protected SpellEnhancement(int state) {
|
||||
this.state = state;
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.world.World;
|
||||
|
||||
public abstract class SpellParadigm {
|
||||
|
||||
protected List<SpellEffect> bufferedEffectList = new LinkedList();
|
||||
protected List<SpellEffect> bufferedEffectList = new LinkedList<>();
|
||||
|
||||
public void addBufferedEffect(SpellEffect effect) {
|
||||
if (effect != null) {
|
||||
@@ -55,7 +55,7 @@ public abstract class SpellParadigm {
|
||||
if (bufferedEffectList.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return bufferedEffectList.get(bufferedEffectList.size() - 1);
|
||||
return bufferedEffectList.getLast();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
|
||||
public class SpellParadigmMelee extends SpellParadigm {
|
||||
|
||||
private List<IMeleeSpellEntityEffect> entityEffectList;
|
||||
private List<IMeleeSpellWorldEffect> worldEffectList;
|
||||
private final List<IMeleeSpellEntityEffect> entityEffectList;
|
||||
private final List<IMeleeSpellWorldEffect> worldEffectList;
|
||||
|
||||
public SpellParadigmMelee() {
|
||||
this.entityEffectList = new ArrayList();
|
||||
this.worldEffectList = new ArrayList();
|
||||
this.entityEffectList = new ArrayList<>();
|
||||
this.worldEffectList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,8 +25,8 @@ public class SpellParadigmProjectile extends SpellParadigm {
|
||||
this.damageSource = DamageSource.generic;
|
||||
this.damage = 1;
|
||||
this.cost = 0;
|
||||
this.impactList = new ArrayList();
|
||||
this.updateEffectList = new ArrayList();
|
||||
this.impactList = new ArrayList<>();
|
||||
this.updateEffectList = new ArrayList<>();
|
||||
this.penetration = false;
|
||||
this.ricochetMax = 0;
|
||||
this.isSilkTouch = false;
|
||||
|
||||
@@ -14,7 +14,7 @@ public class SpellParadigmSelf extends SpellParadigm {
|
||||
public List<ISelfSpellEffect> selfSpellEffectList;
|
||||
|
||||
public SpellParadigmSelf() {
|
||||
selfSpellEffectList = new ArrayList();
|
||||
selfSpellEffectList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,23 +22,23 @@ import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
|
||||
public class SpellParadigmTool extends SpellParadigm {
|
||||
|
||||
private List<ILeftClickEffect> leftClickEffectList;
|
||||
private List<IRightClickEffect> rightClickEffectList;
|
||||
private List<IToolUpdateEffect> toolUpdateEffectList;
|
||||
private List<IOnSummonTool> toolSummonEffectList;
|
||||
private List<IOnBanishTool> toolBanishEffectList;
|
||||
private List<IOnBreakBlock> breakBlockEffectList;
|
||||
private List<IItemManipulator> itemManipulatorEffectList;
|
||||
private List<IDigAreaEffect> digAreaEffectList;
|
||||
private List<ISpecialDamageEffect> specialDamageEffectList;
|
||||
private final List<ILeftClickEffect> leftClickEffectList;
|
||||
private final List<IRightClickEffect> rightClickEffectList;
|
||||
private final List<IToolUpdateEffect> toolUpdateEffectList;
|
||||
private final List<IOnSummonTool> toolSummonEffectList;
|
||||
private final List<IOnBanishTool> toolBanishEffectList;
|
||||
private final List<IOnBreakBlock> breakBlockEffectList;
|
||||
private final List<IItemManipulator> itemManipulatorEffectList;
|
||||
private final List<IDigAreaEffect> digAreaEffectList;
|
||||
private final List<ISpecialDamageEffect> specialDamageEffectList;
|
||||
|
||||
private HashMap<String, Integer> harvestLevel;
|
||||
private HashMap<String, Float> digSpeed;
|
||||
private HashMap<String, Float> maxDamageHash;
|
||||
private HashMap<String, Float> critChanceHash;
|
||||
private HashMap<String, Integer> durationHash;
|
||||
private final HashMap<String, Integer> harvestLevel;
|
||||
private final HashMap<String, Float> digSpeed;
|
||||
private final HashMap<String, Float> maxDamageHash;
|
||||
private final HashMap<String, Float> critChanceHash;
|
||||
private final HashMap<String, Integer> durationHash;
|
||||
|
||||
private HashMap<String, String> toolInfoString;
|
||||
private final HashMap<String, String> toolInfoString;
|
||||
|
||||
private int fortuneLevel;
|
||||
private boolean silkTouch;
|
||||
@@ -48,31 +48,31 @@ public class SpellParadigmTool extends SpellParadigm {
|
||||
public static Item customTool;
|
||||
|
||||
public SpellParadigmTool() {
|
||||
this.leftClickEffectList = new LinkedList();
|
||||
this.rightClickEffectList = new LinkedList();
|
||||
this.toolUpdateEffectList = new LinkedList();
|
||||
this.toolSummonEffectList = new LinkedList();
|
||||
this.toolBanishEffectList = new LinkedList();
|
||||
this.breakBlockEffectList = new LinkedList();
|
||||
this.itemManipulatorEffectList = new LinkedList();
|
||||
this.digAreaEffectList = new LinkedList();
|
||||
this.specialDamageEffectList = new LinkedList();
|
||||
this.durationHash = new HashMap();
|
||||
this.leftClickEffectList = new LinkedList<>();
|
||||
this.rightClickEffectList = new LinkedList<>();
|
||||
this.toolUpdateEffectList = new LinkedList<>();
|
||||
this.toolSummonEffectList = new LinkedList<>();
|
||||
this.toolBanishEffectList = new LinkedList<>();
|
||||
this.breakBlockEffectList = new LinkedList<>();
|
||||
this.itemManipulatorEffectList = new LinkedList<>();
|
||||
this.digAreaEffectList = new LinkedList<>();
|
||||
this.specialDamageEffectList = new LinkedList<>();
|
||||
this.durationHash = new HashMap<>();
|
||||
|
||||
this.toolInfoString = new HashMap();
|
||||
this.critChanceHash = new HashMap();
|
||||
this.toolInfoString = new HashMap<>();
|
||||
this.critChanceHash = new HashMap<>();
|
||||
|
||||
this.harvestLevel = new HashMap();
|
||||
this.harvestLevel = new HashMap<>();
|
||||
this.harvestLevel.put("pickaxe", -1);
|
||||
this.harvestLevel.put("shovel", -1);
|
||||
this.harvestLevel.put("axe", -1);
|
||||
|
||||
this.digSpeed = new HashMap();
|
||||
this.digSpeed = new HashMap<>();
|
||||
this.digSpeed.put("pickaxe", 1.0f);
|
||||
this.digSpeed.put("shovel", 1.0f);
|
||||
this.digSpeed.put("axe", 1.0f);
|
||||
|
||||
this.maxDamageHash = new HashMap();
|
||||
this.maxDamageHash = new HashMap<>();
|
||||
this.maxDamageHash.put("default", 5.0f);
|
||||
|
||||
this.fortuneLevel = 0;
|
||||
@@ -104,7 +104,6 @@ public class SpellParadigmTool extends SpellParadigm {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param crystalStack
|
||||
* @return stack containing the new multitool
|
||||
*/
|
||||
public ItemStack prepareTool(ItemStack crystalStack, World world) {
|
||||
@@ -145,11 +144,7 @@ public class SpellParadigmTool extends SpellParadigm {
|
||||
|
||||
itemTool.setCritChance(toolStack, this.getCritChance() / 100f);
|
||||
|
||||
List<String> toolStringList = new LinkedList();
|
||||
|
||||
for (String str : this.toolInfoString.values()) {
|
||||
toolStringList.add(str);
|
||||
}
|
||||
List<String> toolStringList = new LinkedList<>(this.toolInfoString.values());
|
||||
|
||||
itemTool.setToolListString(toolStack, toolStringList);
|
||||
|
||||
@@ -256,7 +251,7 @@ public class SpellParadigmTool extends SpellParadigm {
|
||||
return total;
|
||||
}
|
||||
|
||||
public int onRightClickAir(ItemStack toolStack, World world, EntityPlayer player) {
|
||||
public int onRightClickAir(ItemStack toolStack, EntityPlayer player) {
|
||||
int total = 0;
|
||||
for (IRightClickEffect effect : this.rightClickEffectList) {
|
||||
total += effect.onRightClickAir(toolStack, player);
|
||||
@@ -265,10 +260,10 @@ public class SpellParadigmTool extends SpellParadigm {
|
||||
return total;
|
||||
}
|
||||
|
||||
public int onUpdate(ItemStack toolStack, World world, Entity par3Entity, int invSlot, boolean inHand) {
|
||||
public int onUpdate(ItemStack toolStack, World world, Entity entity, int invSlot, boolean inHand) {
|
||||
int total = 0;
|
||||
for (IToolUpdateEffect effect : this.toolUpdateEffectList) {
|
||||
total += effect.onUpdate(toolStack, world, par3Entity, invSlot, inHand);
|
||||
total += effect.onUpdate(toolStack, world, entity, invSlot, inHand);
|
||||
}
|
||||
|
||||
return total;
|
||||
@@ -306,8 +301,7 @@ public class SpellParadigmTool extends SpellParadigm {
|
||||
List<ItemStack> heldList = items;
|
||||
|
||||
for (IItemManipulator eff : this.itemManipulatorEffectList) {
|
||||
List<ItemStack> newHeldList = eff.handleItemsOnBlockBroken(toolStack, heldList);
|
||||
heldList = newHeldList;
|
||||
heldList = eff.handleItemsOnBlockBroken(toolStack, heldList);
|
||||
}
|
||||
|
||||
return heldList;
|
||||
@@ -404,7 +398,7 @@ public class SpellParadigmTool extends SpellParadigm {
|
||||
}
|
||||
|
||||
public float getAddedDamageForEntity(Entity entity) {
|
||||
HashMap<String, Float> hash = new HashMap();
|
||||
HashMap<String, Float> hash = new HashMap<>();
|
||||
|
||||
for (ISpecialDamageEffect effect : this.specialDamageEffectList) {
|
||||
hash.put(effect.getKey(), effect.getDamageForEntity(entity));
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import net.minecraft.world.World;
|
||||
|
||||
public class SummoningRegistry {
|
||||
|
||||
public static List<SummoningRegistryComponent> summoningList = new ArrayList();
|
||||
public static List<SummoningRegistryComponent> summoningList = new ArrayList<>();
|
||||
|
||||
public static void registerSummon(SummoningHelper s, ItemStack[] ring1, ItemStack[] ring2, ItemStack[] ring3,
|
||||
int amountUsed, int bloodOrbLevel) {
|
||||
|
||||
+11
-29
@@ -74,22 +74,11 @@ public class SummoningRegistryComponent {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (ring) {
|
||||
case 1:
|
||||
recipe = ring1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
recipe = ring2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
recipe = ring3;
|
||||
break;
|
||||
|
||||
default:
|
||||
recipe = ring1;
|
||||
}
|
||||
recipe = switch (ring) {
|
||||
case 2 -> ring2;
|
||||
case 3 -> ring3;
|
||||
default -> ring1;
|
||||
};
|
||||
|
||||
if (recipe.length != 6) {
|
||||
ItemStack[] newRecipe = new ItemStack[6];
|
||||
@@ -175,19 +164,12 @@ public class SummoningRegistryComponent {
|
||||
}
|
||||
|
||||
public ItemStack[] getRingRecipeForRing(int ring) {
|
||||
switch (ring) {
|
||||
case 1:
|
||||
return ring1;
|
||||
|
||||
case 2:
|
||||
return ring2;
|
||||
|
||||
case 3:
|
||||
return ring3;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return switch (ring) {
|
||||
case 1 -> ring1;
|
||||
case 2 -> ring2;
|
||||
case 3 -> ring3;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
public String getSummoningHelperID() {
|
||||
|
||||
@@ -12,56 +12,14 @@ import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
public class ClientEventHandler {
|
||||
|
||||
private Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
private final Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
public static ResourceLocation currentPlayerTexture = null;
|
||||
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// @SubscribeEvent
|
||||
// public void renderPOVArmour(RenderHandEvent event)
|
||||
// {
|
||||
// if (this.mc.thePlayer.worldObj.isRemote && this.mc.gameSettings.thirdPersonView == 0 &&
|
||||
// !this.mc.renderViewEntity.isPlayerSleeping() && !this.mc.gameSettings.hideGUI &&
|
||||
// !this.mc.playerController.enableEverythingIsScrewedUpMode())
|
||||
// {
|
||||
// currentPlayerTexture = ((AbstractClientPlayer) mc.thePlayer).getLocationSkin();
|
||||
//
|
||||
// ClientUtils.renderPlayerArmourInPOV(mc.thePlayer, event.partialTicks);
|
||||
// event.setCanceled(true);
|
||||
// }
|
||||
// }
|
||||
|
||||
// @SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
// public void onPlayerRenderTick(RenderPlayerEvent.Pre event)
|
||||
// {
|
||||
// ModelBiped model = ((BoundArmour)ModItems.boundPlate).getArmorModel(event.entityPlayer, new
|
||||
// ItemStack(ModItems.boundPlate), 2);
|
||||
// String texture = ((BoundArmour)ModItems.boundPlate).getArmorTexture(new ItemStack(ModItems.boundPlate),
|
||||
// event.entityPlayer, 2, "");
|
||||
//
|
||||
// ResourceLocation resourcelocation = new ResourceLocation(texture);
|
||||
// event.renderer.modelBipedMain.bipedBody.addChild(model.bipedBody);
|
||||
// Minecraft.getMinecraft().renderEngine.bindTexture(resourcelocation);
|
||||
//
|
||||
// }
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyInput(InputEvent.KeyInputEvent event) {
|
||||
// if(KeyBindings.omegaTest.isPressed())
|
||||
// {
|
||||
// System.out.println("ping");
|
||||
//// NewPacketHandler.INSTANCE.sendToServer(NewPacketHandler.getKeyboardPressPacket((byte)2));
|
||||
// ClientToServerPacketHandler.INSTANCE.sendToServer(new
|
||||
// MessageKeyPressed(MessageKeyPressed.Key.OMEGA_ACTIVE));
|
||||
// }
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerSoundEvent(SoundEvent event) {
|
||||
if (Minecraft.getMinecraft() != null) {
|
||||
@@ -89,21 +47,9 @@ public class ClientEventHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(RenderTickEvent event) {
|
||||
if (event.phase.equals(Phase.START)) return;
|
||||
public void onTick(TickEvent.RenderTickEvent event) {
|
||||
if (event.phase.equals(TickEvent.Phase.START)) return;
|
||||
|
||||
if (!RenderHelper.onTickInGame(mc)) {}
|
||||
RenderHelper.onTickInGame(mc);
|
||||
}
|
||||
|
||||
// @SubscribeEvent
|
||||
// public void onRenderLivingPlayerPre(RenderPlayerEvent.Pre event)
|
||||
// {
|
||||
// GL11.glDisable(2929);
|
||||
// }
|
||||
//
|
||||
// @SubscribeEvent
|
||||
// public void onRenderLivingPlayerPost(RenderPlayerEvent.Post event)
|
||||
// {
|
||||
// GL11.glEnable(2929);
|
||||
// }
|
||||
}
|
||||
@@ -1,344 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.client;
|
||||
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.FIRST_PERSON_MAP;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemCloth;
|
||||
import net.minecraft.item.ItemMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.storage.MapData;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class ClientUtils {
|
||||
|
||||
public static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png");
|
||||
|
||||
public static void renderPlayerArmourInPOV(EntityPlayer player, float partialTickTime) {
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
float f1 = 1.0f; // this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) *
|
||||
// partialTickTime;
|
||||
EntityClientPlayerMP entityclientplayermp = mc.thePlayer;
|
||||
float f2 = entityclientplayermp.prevRotationPitch
|
||||
+ (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialTickTime;
|
||||
// GL11.glPushMatrix();
|
||||
GL11.glRotatef(
|
||||
180 - (entityclientplayermp.prevRotationYaw
|
||||
+ (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * partialTickTime),
|
||||
0.0F,
|
||||
1.0F,
|
||||
0.0F);
|
||||
GL11.glRotatef(-f2, 1.0F, 0.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
// GL11.glPopMatrix();
|
||||
EntityPlayerSP entityplayersp = (EntityPlayerSP) entityclientplayermp;
|
||||
float f3 = entityplayersp.prevRenderArmPitch
|
||||
+ (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialTickTime;
|
||||
float f4 = entityplayersp.prevRenderArmYaw
|
||||
+ (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialTickTime;
|
||||
GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
|
||||
ItemStack itemstack = player.getCurrentEquippedItem();
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemCloth) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
}
|
||||
|
||||
int i = mc.theWorld.getLightBrightnessForSkyBlocks(
|
||||
MathHelper.floor_double(entityclientplayermp.posX),
|
||||
MathHelper.floor_double(entityclientplayermp.posY),
|
||||
MathHelper.floor_double(entityclientplayermp.posZ),
|
||||
0);
|
||||
int j = i % 65536;
|
||||
int k = i / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float f5;
|
||||
float f6;
|
||||
float f7;
|
||||
|
||||
if (itemstack != null) {
|
||||
int l = itemstack.getItem().getColorFromItemStack(itemstack, 0);
|
||||
f5 = (float) (l >> 16 & 255) / 255.0F;
|
||||
f6 = (float) (l >> 8 & 255) / 255.0F;
|
||||
f7 = (float) (l & 255) / 255.0F;
|
||||
GL11.glColor4f(f5, f6, f7, 1.0F);
|
||||
} else {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
float f8;
|
||||
float f9;
|
||||
float f10;
|
||||
float f13;
|
||||
Render render;
|
||||
RenderPlayer renderplayer;
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemMap) {
|
||||
GL11.glPushMatrix();
|
||||
f13 = 0.8F;
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * (float) Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
|
||||
GL11.glTranslatef(
|
||||
-f7 * 0.4F,
|
||||
MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.2F,
|
||||
-f6 * 0.2F);
|
||||
f5 = 1.0F - f2 / 45.0F + 0.1F;
|
||||
|
||||
if (f5 < 0.0F) {
|
||||
f5 = 0.0F;
|
||||
}
|
||||
|
||||
if (f5 > 1.0F) {
|
||||
f5 = 1.0F;
|
||||
}
|
||||
|
||||
f5 = -MathHelper.cos(f5 * (float) Math.PI) * 0.5F + 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.0F * f13 - (1.0F - f1) * 1.2F - f5 * 0.5F + 0.04F, -0.9F * f13);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(f5 * -85.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
|
||||
|
||||
for (int i1 = 0; i1 < 2; ++i1) {
|
||||
int j1 = i1 * 2 - 1;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float) j1);
|
||||
GL11.glRotatef((float) (-45 * j1), 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef((float) (-65 * j1), 0.0F, 1.0F, 0.0F);
|
||||
render = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
|
||||
renderplayer = (RenderPlayer) render;
|
||||
f10 = 1.0F;
|
||||
GL11.glScalef(f10, f10, f10);
|
||||
renderFirstPersonArm(renderplayer, mc.thePlayer);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
f6 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f7 = MathHelper.sin(f6 * f6 * (float) Math.PI);
|
||||
f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float) Math.PI);
|
||||
GL11.glRotatef(-f7 * 20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F);
|
||||
f9 = 0.38F;
|
||||
GL11.glScalef(f9, f9, f9);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
|
||||
f10 = 0.015625F;
|
||||
GL11.glScalef(f10, f10, f10);
|
||||
mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glNormal3f(0.0F, 0.0F, -1.0F);
|
||||
tessellator.startDrawingQuads();
|
||||
byte b0 = 7;
|
||||
tessellator.addVertexWithUV((double) (0 - b0), (double) (128 + b0), 0.0D, 0.0D, 1.0D);
|
||||
tessellator.addVertexWithUV((double) (128 + b0), (double) (128 + b0), 0.0D, 1.0D, 1.0D);
|
||||
tessellator.addVertexWithUV((double) (128 + b0), (double) (0 - b0), 0.0D, 1.0D, 0.0D);
|
||||
tessellator.addVertexWithUV((double) (0 - b0), (double) (0 - b0), 0.0D, 0.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
|
||||
IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
|
||||
MapData mapdata = ((ItemMap) itemstack.getItem()).getMapData(itemstack, mc.theWorld);
|
||||
|
||||
if (custom == null) {
|
||||
if (mapdata != null) {
|
||||
mc.entityRenderer.getMapItemRenderer().func_148250_a(mapdata, false);
|
||||
}
|
||||
} else {
|
||||
custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.getTextureManager(), mapdata);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
} else if (itemstack != null) {
|
||||
GL11.glPushMatrix();
|
||||
f13 = 0.8F;
|
||||
|
||||
if (entityclientplayermp.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.eat || enumaction == EnumAction.drink) {
|
||||
f6 = (float) entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F;
|
||||
f7 = 1.0F - f6 / (float) itemstack.getMaxItemUseDuration();
|
||||
f8 = 1.0F - f7;
|
||||
f8 = f8 * f8 * f8;
|
||||
f8 = f8 * f8 * f8;
|
||||
f8 = f8 * f8 * f8;
|
||||
f9 = 1.0F - f8;
|
||||
GL11.glTranslatef(
|
||||
0.0F,
|
||||
MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float) Math.PI) * 0.1F)
|
||||
* (float) ((double) f7 > 0.2D ? 1 : 0),
|
||||
0.0F);
|
||||
GL11.glTranslatef(f9 * 0.6F, -f9 * 0.5F, 0.0F);
|
||||
GL11.glRotatef(f9 * 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
} else {
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * (float) Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
|
||||
GL11.glTranslatef(
|
||||
-f7 * 0.4F,
|
||||
MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.2F,
|
||||
-f6 * 0.2F);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(0.7F * f13, -0.65F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * f5 * (float) Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
|
||||
GL11.glRotatef(-f6 * 20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-f7 * 20.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-f7 * 80.0F, 1.0F, 0.0F, 0.0F);
|
||||
f8 = 0.4F;
|
||||
GL11.glScalef(f8, f8, f8);
|
||||
float f11;
|
||||
float f12;
|
||||
|
||||
if (entityclientplayermp.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction1 = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.block) {
|
||||
GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
|
||||
GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
|
||||
} else if (enumaction1 == EnumAction.bow) {
|
||||
GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.9F, 0.2F, 0.0F);
|
||||
f10 = (float) itemstack.getMaxItemUseDuration()
|
||||
- ((float) entityclientplayermp.getItemInUseCount() - partialTickTime + 1.0F);
|
||||
f11 = f10 / 20.0F;
|
||||
f11 = (f11 * f11 + f11 * 2.0F) / 3.0F;
|
||||
|
||||
if (f11 > 1.0F) {
|
||||
f11 = 1.0F;
|
||||
}
|
||||
|
||||
if (f11 > 0.1F) {
|
||||
GL11.glTranslatef(0.0F, MathHelper.sin((f10 - 0.1F) * 1.3F) * 0.01F * (f11 - 0.1F), 0.0F);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(0.0F, 0.0F, f11 * 0.1F);
|
||||
GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
|
||||
f12 = 1.0F + f11 * 0.2F;
|
||||
GL11.glScalef(1.0F, 1.0F, f12);
|
||||
GL11.glTranslatef(0.0F, -0.5F, 0.0F);
|
||||
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack.getItem().shouldRotateAroundWhenRendering()) {
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (itemstack.getItem().requiresMultipleRenderPasses()) {
|
||||
RenderManager.instance.itemRenderer
|
||||
.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
|
||||
for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) {
|
||||
int k1 = itemstack.getItem().getColorFromItemStack(itemstack, x);
|
||||
f10 = (float) (k1 >> 16 & 255) / 255.0F;
|
||||
f11 = (float) (k1 >> 8 & 255) / 255.0F;
|
||||
f12 = (float) (k1 & 255) / 255.0F;
|
||||
GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F);
|
||||
RenderManager.instance.itemRenderer
|
||||
.renderItem(entityclientplayermp, itemstack, x, EQUIPPED_FIRST_PERSON);
|
||||
}
|
||||
} else {
|
||||
RenderManager.instance.itemRenderer
|
||||
.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
} else if (!entityclientplayermp.isInvisible()) {
|
||||
GL11.glPushMatrix();
|
||||
f13 = 0.8F;
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * (float) Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
|
||||
GL11.glTranslatef(
|
||||
-f7 * 0.3F,
|
||||
MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI * 2.0F) * 0.4F,
|
||||
-f6 * 0.4F);
|
||||
GL11.glTranslatef(0.8F * f13, -0.75F * f13 - (1.0F - f1) * 0.6F, -0.9F * f13);
|
||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
f5 = entityclientplayermp.getSwingProgress(partialTickTime);
|
||||
f6 = MathHelper.sin(f5 * f5 * (float) Math.PI);
|
||||
f7 = MathHelper.sin(MathHelper.sqrt_float(f5) * (float) Math.PI);
|
||||
GL11.glRotatef(f7 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-f6 * 20.0F, 0.0F, 0.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
|
||||
GL11.glTranslatef(-1.0F, 3.6F, 3.5F);
|
||||
GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
GL11.glTranslatef(5.6F, 0.0F, 0.0F);
|
||||
render = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
|
||||
renderplayer = (RenderPlayer) render;
|
||||
f10 = 1.0F;
|
||||
GL11.glScalef(f10, f10, f10);
|
||||
renderFirstPersonArm(renderplayer, mc.thePlayer);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemCloth) {
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
public static void renderFirstPersonArm(RenderPlayer renderer, EntityPlayer player) {
|
||||
float f = 1.0F;
|
||||
GL11.glColor3f(f, f, f);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
ModelRenderer mRenderer = new POVArmourModelWrapper(renderer.modelBipedMain);
|
||||
renderer.modelBipedMain.onGround = 0.0F;
|
||||
renderer.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, player);
|
||||
renderer.modelBipedMain.bipedRightArm.render(0.0625F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
mRenderer.rotateAngleX = renderer.modelBipedMain.bipedRightArm.rotateAngleX;
|
||||
mRenderer.rotateAngleY = renderer.modelBipedMain.bipedRightArm.rotateAngleY;
|
||||
mRenderer.rotateAngleZ = renderer.modelBipedMain.bipedRightArm.rotateAngleZ;
|
||||
mRenderer.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -23,12 +22,11 @@ public class POVArmourModelWrapper extends ModelRenderer {
|
||||
public POVArmourModelWrapper(ModelBase model) {
|
||||
super(model);
|
||||
ItemStack plateStack = new ItemStack(ModItems.boundPlateFire);
|
||||
ModelBiped bipedModel = ((BoundArmour) ModItems.boundPlateFire)
|
||||
ModelBiped bipedModel = ModItems.boundPlateFire
|
||||
.getArmorModel(Minecraft.getMinecraft().thePlayer, plateStack, 1);
|
||||
armModel = bipedModel.bipedRightArm;
|
||||
resource = new ResourceLocation(
|
||||
((BoundArmour) ModItems.boundPlateFire)
|
||||
.getArmorTexture(plateStack, Minecraft.getMinecraft().thePlayer, 1, "POV"));
|
||||
ModItems.boundPlateFire.getArmorTexture(plateStack, Minecraft.getMinecraft().thePlayer, 1, "POV"));
|
||||
addBox(0, 0, 0, 0, 0, 0); // Adds in a blank box as it's required in certain cases such as rendering arrows in
|
||||
// entities
|
||||
}
|
||||
@@ -36,7 +34,6 @@ public class POVArmourModelWrapper extends ModelRenderer {
|
||||
@Override
|
||||
public void render(float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
// GL11.glTranslated(0.3, -.1, 0);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(resource);
|
||||
armModel.rotateAngleX = this.rotateAngleX;
|
||||
armModel.rotateAngleY = this.rotateAngleY;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs;
|
||||
import static WayofTime.alchemicalWizardry.client.renderer.RenderHelper.mc;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.ARROW_TEXTURE;
|
||||
import static WayofTime.alchemicalWizardry.client.renderer.RenderHelper.mc;
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
@@ -59,7 +59,7 @@ public class NEICalcinatorHandler extends TemplateRecipeHandler {
|
||||
.translateToLocalFormatted("text.recipe.alchemicCalcinator.reagent", formattedAmount);
|
||||
this.amountTextWidth = fontRenderer.getStringWidth(amountText);
|
||||
|
||||
this.nameText = this.reagent.name;
|
||||
this.nameText = this.reagent.name();
|
||||
this.nameTextWidth = fontRenderer.getStringWidth(nameText);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class NEICalcinatorHandler extends TemplateRecipeHandler {
|
||||
|
||||
textX = x + 84 - (nameTextWidth / 2);
|
||||
textY += 10;
|
||||
int color = reagent.getColourRed() << 16 | reagent.getColourGreen() << 8 | reagent.getColourBlue();
|
||||
int color = reagent.red() << 16 | reagent.green() << 8 | reagent.blue();
|
||||
fontRenderer.drawString(nameText, textX, textY, color);
|
||||
}
|
||||
|
||||
@@ -116,10 +116,10 @@ public class NEICalcinatorHandler extends TemplateRecipeHandler {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glColor4ub(
|
||||
(byte) reagent.getColourRed(),
|
||||
(byte) reagent.getColourGreen(),
|
||||
(byte) reagent.getColourBlue(),
|
||||
(byte) 255);
|
||||
(byte) reagent.red(),
|
||||
(byte) reagent.green(),
|
||||
(byte) reagent.blue(),
|
||||
(byte) reagent.intensity());
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(arrowX, arrowY + ARROW_HEIGHT, 0, 0, 1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
import static WayofTime.alchemicalWizardry.client.renderer.RenderHelper.mc;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
@@ -142,7 +142,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
ArrayList<Reagent> reagents = component.getRequiredReagents();
|
||||
ArrayList<String> reagentNames = new ArrayList<>();
|
||||
for (Reagent r : reagents) {
|
||||
reagentNames.add(r.name);
|
||||
reagentNames.add(r.name());
|
||||
}
|
||||
return Joiner.on(", ").join(reagentNames);
|
||||
}
|
||||
@@ -369,7 +369,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
|
||||
if (!l.isEmpty()) {
|
||||
list.add(r.name + ":");
|
||||
list.add(r.name() + ":");
|
||||
list.addAll(l);
|
||||
}
|
||||
}
|
||||
@@ -404,6 +404,6 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
private String requiredReagentsForFiller(MeteorComponent mc) {
|
||||
List<Reagent> reagents = mc.getRequiredReagents();
|
||||
if (reagents.isEmpty()) return "";
|
||||
return " (" + reagents.stream().map(r -> r.name).collect(Collectors.joining(", ")) + ")";
|
||||
return " (" + reagents.stream().map(r -> r.name()).collect(Collectors.joining(", ")) + ")";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei.widgets;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
import static WayofTime.alchemicalWizardry.client.renderer.RenderHelper.mc;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei.widgets;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
import static WayofTime.alchemicalWizardry.client.renderer.RenderHelper.mc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei.widgets;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
import static WayofTime.alchemicalWizardry.client.renderer.RenderHelper.mc;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei.widgets;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
import static WayofTime.alchemicalWizardry.client.renderer.RenderHelper.mc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei.widgets;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
import static WayofTime.alchemicalWizardry.client.renderer.RenderHelper.mc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -22,7 +23,7 @@ public class HUDElement {
|
||||
private int itemNameW;
|
||||
private String itemDamage = "";
|
||||
private int itemDamageW;
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static final int offset = 5;
|
||||
|
||||
@@ -63,26 +64,9 @@ public class HUDElement {
|
||||
maxDamage = itemStack.getMaxDamage() + 1;
|
||||
damage = maxDamage - itemStack.getItemDamageForDisplay();
|
||||
|
||||
boolean showSpecialValue = true;
|
||||
boolean showValue = false;
|
||||
boolean showPercent = false;
|
||||
|
||||
boolean showMaxDamage = true;
|
||||
boolean thresholdPercent = true;
|
||||
|
||||
if (showSpecialValue) {
|
||||
itemDamage = "\247" + ColourThreshold.getColorCode(
|
||||
BloodMagicConfiguration.colorList,
|
||||
(thresholdPercent ? damage * 100 / maxDamage : damage)) + this.value;
|
||||
} else if (showValue) itemDamage = "\247"
|
||||
+ ColourThreshold.getColorCode(
|
||||
BloodMagicConfiguration.colorList,
|
||||
(thresholdPercent ? damage * 100 / maxDamage : damage))
|
||||
+ damage
|
||||
+ (showMaxDamage ? "/" + maxDamage : "");
|
||||
else if (showPercent) itemDamage = "\247" + ColourThreshold.getColorCode(
|
||||
BloodMagicConfiguration.colorList,
|
||||
(thresholdPercent ? damage * 100 / maxDamage : damage)) + (damage * 100 / maxDamage) + "%";
|
||||
itemDamage = "§"
|
||||
+ ColourThreshold.getColorCode(BloodMagicConfiguration.colorList, damage * 100 / maxDamage)
|
||||
+ this.value;
|
||||
}
|
||||
|
||||
itemDamageW = mc.fontRenderer.getStringWidth(HUDUtils.stripCtrl(itemDamage));
|
||||
@@ -106,49 +90,30 @@ public class HUDElement {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRenderer.zLevel = 200.0F;
|
||||
|
||||
// if (ArmorStatusHUD.alignMode.toLowerCase().contains("right"))
|
||||
boolean toRight = true;
|
||||
if (toRight) {
|
||||
itemRenderer.renderItemAndEffectIntoGUI(
|
||||
mc.fontRenderer,
|
||||
mc.getTextureManager(),
|
||||
itemStack,
|
||||
x - (iconW + padW),
|
||||
y);
|
||||
HUDUtils.renderItemOverlayIntoGUI(
|
||||
mc.fontRenderer,
|
||||
itemStack,
|
||||
x - (iconW + padW),
|
||||
y,
|
||||
showDamageOverlay,
|
||||
showItemCount);
|
||||
itemRenderer
|
||||
.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x - (iconW + padW), y);
|
||||
HUDUtils.renderItemOverlayIntoGUI(
|
||||
mc.fontRenderer,
|
||||
itemStack,
|
||||
x - (iconW + padW),
|
||||
y,
|
||||
showDamageOverlay,
|
||||
showItemCount);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
mc.fontRenderer
|
||||
.drawStringWithShadow(itemName + "\247r", x - (padW + iconW + padW) - itemNameW, y, 0xffffff);
|
||||
mc.fontRenderer.drawStringWithShadow(
|
||||
itemDamage + "\247r",
|
||||
x - (padW + iconW + padW) - itemDamageW,
|
||||
y + (enableItemName ? elementH / 2 : elementH / 4),
|
||||
0xffffff);
|
||||
} else {
|
||||
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, x, y);
|
||||
HUDUtils.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, showDamageOverlay, showItemCount);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(itemName + "\247r", x + iconW + padW, y, 0xffffff);
|
||||
mc.fontRenderer.drawStringWithShadow(
|
||||
itemDamage + "\247r",
|
||||
x + iconW + padW,
|
||||
y + (enableItemName ? elementH / 2 : elementH / 4),
|
||||
0xffffff);
|
||||
}
|
||||
mc.fontRenderer.drawStringWithShadow(
|
||||
itemName + EnumChatFormatting.RESET,
|
||||
x - (padW + iconW + padW) - itemNameW,
|
||||
y,
|
||||
0xffffff);
|
||||
mc.fontRenderer.drawStringWithShadow(
|
||||
itemDamage + EnumChatFormatting.RESET,
|
||||
x - (padW + iconW + padW) - itemDamageW,
|
||||
y + (enableItemName ? elementH / 2 : elementH / 4),
|
||||
0xffffff);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@@ -2,280 +2,20 @@ package WayofTime.alchemicalWizardry.client.renderer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* This class is a utility class that was created by bspkrs.
|
||||
* https://github.com/bspkrs/bspkrsCore/blob/master/src/main/java/bspkrs/client/util/HUDUtils.java
|
||||
* <a href="https://github.com/bspkrs/bspkrsCore/blob/master/src/main/java/bspkrs/client/util/HUDUtils.java">Source</a>
|
||||
*/
|
||||
public final class HUDUtils {
|
||||
|
||||
private static int[] colorCodes = new int[] { 0, 170, 43520, 43690, 11141120, 11141290, 16755200, 11184810, 5592405,
|
||||
5592575, 5635925, 5636095, 16733525, 16733695, 16777045, 16777215, 0, 42, 10752, 10794, 2752512, 2752554,
|
||||
2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959 };
|
||||
|
||||
public static int getColorCode(char c, boolean isLighter) {
|
||||
return colorCodes[isLighter ? "0123456789abcdef".indexOf(c) : "0123456789abcdef".indexOf(c) + 16];
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with
|
||||
* continuous borders and filler. It is assumed that the desired texture ResourceLocation object has been bound
|
||||
* using Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth,
|
||||
int textureHeight, int borderSize, float zLevel) {
|
||||
drawContinuousTexturedBox(
|
||||
x,
|
||||
y,
|
||||
u,
|
||||
v,
|
||||
width,
|
||||
height,
|
||||
textureWidth,
|
||||
textureHeight,
|
||||
borderSize,
|
||||
borderSize,
|
||||
borderSize,
|
||||
borderSize,
|
||||
zLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with
|
||||
* continuous borders and filler. The provided ResourceLocation object will be bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width,
|
||||
int height, int textureWidth, int textureHeight, int borderSize, float zLevel) {
|
||||
drawContinuousTexturedBox(
|
||||
res,
|
||||
x,
|
||||
y,
|
||||
u,
|
||||
v,
|
||||
width,
|
||||
height,
|
||||
textureWidth,
|
||||
textureHeight,
|
||||
borderSize,
|
||||
borderSize,
|
||||
borderSize,
|
||||
borderSize,
|
||||
zLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with
|
||||
* continuous borders and filler. The provided ResourceLocation object will be bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param topBorder the size of the box's top border
|
||||
* @param bottomBorder the size of the box's bottom border
|
||||
* @param leftBorder the size of the box's left border
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width,
|
||||
int height, int textureWidth, int textureHeight, int topBorder, int bottomBorder, int leftBorder,
|
||||
int rightBorder, float zLevel) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(res);
|
||||
drawContinuousTexturedBox(
|
||||
x,
|
||||
y,
|
||||
u,
|
||||
v,
|
||||
width,
|
||||
height,
|
||||
textureWidth,
|
||||
textureHeight,
|
||||
topBorder,
|
||||
bottomBorder,
|
||||
leftBorder,
|
||||
rightBorder,
|
||||
zLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with
|
||||
* continuous borders and filler. It is assumed that the desired texture ResourceLocation object has been bound
|
||||
* using Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param topBorder the size of the box's top border
|
||||
* @param bottomBorder the size of the box's bottom border
|
||||
* @param leftBorder the size of the box's left border
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth,
|
||||
int textureHeight, int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
int fillerWidth = textureWidth - leftBorder - rightBorder;
|
||||
int fillerHeight = textureHeight - topBorder - bottomBorder;
|
||||
int canvasWidth = width - leftBorder - rightBorder;
|
||||
int canvasHeight = height - topBorder - bottomBorder;
|
||||
int xPasses = canvasWidth / fillerWidth;
|
||||
int remainderWidth = canvasWidth % fillerWidth;
|
||||
int yPasses = canvasHeight / fillerHeight;
|
||||
int remainderHeight = canvasHeight % fillerHeight;
|
||||
|
||||
// Draw Border
|
||||
// Top Left
|
||||
drawTexturedModalRect(x, y, u, v, leftBorder, topBorder, zLevel);
|
||||
// Top Right
|
||||
drawTexturedModalRect(
|
||||
x + leftBorder + canvasWidth,
|
||||
y,
|
||||
u + leftBorder + fillerWidth,
|
||||
v,
|
||||
rightBorder,
|
||||
topBorder,
|
||||
zLevel);
|
||||
// Bottom Left
|
||||
drawTexturedModalRect(
|
||||
x,
|
||||
y + topBorder + canvasHeight,
|
||||
u,
|
||||
v + topBorder + fillerHeight,
|
||||
leftBorder,
|
||||
bottomBorder,
|
||||
zLevel);
|
||||
// Bottom Right
|
||||
drawTexturedModalRect(
|
||||
x + leftBorder + canvasWidth,
|
||||
y + topBorder + canvasHeight,
|
||||
u + leftBorder + fillerWidth,
|
||||
v + topBorder + fillerHeight,
|
||||
rightBorder,
|
||||
bottomBorder,
|
||||
zLevel);
|
||||
|
||||
for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++) {
|
||||
// Top Border
|
||||
drawTexturedModalRect(
|
||||
x + leftBorder + (i * fillerWidth),
|
||||
y,
|
||||
u + leftBorder,
|
||||
v,
|
||||
(i == xPasses ? remainderWidth : fillerWidth),
|
||||
topBorder,
|
||||
zLevel);
|
||||
// Bottom Border
|
||||
drawTexturedModalRect(
|
||||
x + leftBorder + (i * fillerWidth),
|
||||
y + topBorder + canvasHeight,
|
||||
u + leftBorder,
|
||||
v + topBorder + fillerHeight,
|
||||
(i == xPasses ? remainderWidth : fillerWidth),
|
||||
bottomBorder,
|
||||
zLevel);
|
||||
|
||||
// Throw in some filler for good measure
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) drawTexturedModalRect(
|
||||
x + leftBorder + (i * fillerWidth),
|
||||
y + topBorder + (j * fillerHeight),
|
||||
u + leftBorder,
|
||||
v + topBorder,
|
||||
(i == xPasses ? remainderWidth : fillerWidth),
|
||||
(j == yPasses ? remainderHeight : fillerHeight),
|
||||
zLevel);
|
||||
}
|
||||
|
||||
// Side Borders
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) {
|
||||
// Left Border
|
||||
drawTexturedModalRect(
|
||||
x,
|
||||
y + topBorder + (j * fillerHeight),
|
||||
u,
|
||||
v + topBorder,
|
||||
leftBorder,
|
||||
(j == yPasses ? remainderHeight : fillerHeight),
|
||||
zLevel);
|
||||
// Right Border
|
||||
drawTexturedModalRect(
|
||||
x + leftBorder + canvasWidth,
|
||||
y + topBorder + (j * fillerHeight),
|
||||
u + leftBorder + fillerWidth,
|
||||
v + topBorder,
|
||||
rightBorder,
|
||||
(j == yPasses ? remainderHeight : fillerHeight),
|
||||
zLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel) {
|
||||
float var7 = 0.00390625F;
|
||||
float var8 = 0.00390625F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8));
|
||||
tessellator.addVertexWithUV((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8));
|
||||
tessellator.addVertexWithUV((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8));
|
||||
tessellator.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
|
||||
* specified position.
|
||||
*/
|
||||
public static void renderItemOverlayIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y) {
|
||||
renderItemOverlayIntoGUI(fontRenderer, itemStack, x, y, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
|
||||
* specified position.
|
||||
@@ -310,7 +50,7 @@ public final class HUDUtils {
|
||||
Minecraft.getMinecraft().thePlayer,
|
||||
itemStack.getItem(),
|
||||
itemStack.getItemDamage());
|
||||
else if (itemStack.getItem().equals(Items.bow))
|
||||
else if (itemStack.getItem() != null && itemStack.getItem().equals(Items.bow))
|
||||
count = HUDUtils.countInInventory(Minecraft.getMinecraft().thePlayer, Items.arrow);
|
||||
|
||||
if (count > 1) {
|
||||
@@ -336,10 +76,10 @@ public final class HUDUtils {
|
||||
public static void renderQuad(Tessellator tessellator, int x, int y, int width, int height, int color) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I(color);
|
||||
tessellator.addVertex((x + 0), (y + 0), 0.0D);
|
||||
tessellator.addVertex((x + 0), (y + height), 0.0D);
|
||||
tessellator.addVertex((x + width), (y + height), 0.0D);
|
||||
tessellator.addVertex((x + width), (y + 0), 0.0D);
|
||||
tessellator.addVertex(x, y, 0.0D);
|
||||
tessellator.addVertex(x, y + height, 0.0D);
|
||||
tessellator.addVertex(x + width, y + height, 0.0D);
|
||||
tessellator.addVertex(x + width, y, 0.0D);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@@ -357,6 +97,6 @@ public final class HUDUtils {
|
||||
}
|
||||
|
||||
public static String stripCtrl(String s) {
|
||||
return s.replaceAll("(?i)\247[0-9a-fklmnor]", "");
|
||||
return s.replaceAll("(?i)§[0-9a-fklmnor]", "");
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
@@ -29,77 +28,67 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
|
||||
public class RenderHelper {
|
||||
|
||||
public static boolean enableItemName = false;
|
||||
public static boolean enabled = true;
|
||||
public static boolean showInChat = true;
|
||||
|
||||
public static int lpBarX = 12;
|
||||
public static int lpBarY = 75;
|
||||
|
||||
public static int zLevel = 0;
|
||||
|
||||
private static int xOffsetDefault = +50;
|
||||
private static final int xOffsetDefault = 50;
|
||||
public static int xOffset = xOffsetDefault;
|
||||
private static int yOffsetDefault = 2;
|
||||
private static final int yOffsetDefault = 2;
|
||||
public static int yOffset = yOffsetDefault;
|
||||
private static int yOffsetBottomCenterDefault = 41;
|
||||
private static final int yOffsetBottomCenterDefault = 41;
|
||||
public static int yOffsetBottomCenter = yOffsetBottomCenterDefault;
|
||||
private static boolean applyXOffsetToCenterDefault = true;
|
||||
private static final boolean applyXOffsetToCenterDefault = true;
|
||||
public static boolean applyXOffsetToCenter = applyXOffsetToCenterDefault;
|
||||
private static boolean applyYOffsetToMiddleDefault = false;
|
||||
private static final boolean applyYOffsetToMiddleDefault = false;
|
||||
public static boolean applyYOffsetToMiddle = applyYOffsetToMiddleDefault;
|
||||
|
||||
public static String listMode = "horizontal";
|
||||
public static String alignMode = "bottomcenter";
|
||||
public static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static ScaledResolution scaledResolution;
|
||||
|
||||
public static boolean onTickInGame(Minecraft mc) {
|
||||
if (enabled
|
||||
&& (mc.inGameHasFocus || mc.currentScreen == null
|
||||
|| (mc.currentScreen instanceof GuiChat && showInChat))
|
||||
&& !mc.gameSettings.showDebugInfo) {
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
player.getEntityData();
|
||||
if (SpellHelper.canPlayerSeeAlchemy(player)) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
displayArmorStatus(mc);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
public static void onTickInGame(Minecraft mc) {
|
||||
if (!(mc.inGameHasFocus || mc.currentScreen == null || mc.currentScreen instanceof GuiChat)
|
||||
|| mc.gameSettings.showDebugInfo) {
|
||||
return;
|
||||
}
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
if (SpellHelper.canPlayerSeeAlchemy(player)) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
displayArmorStatus(mc);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
ItemStack stack = player.inventory.armorItemInSlot(2);
|
||||
if (stack != null && stack.getItem() instanceof OmegaArmour) {
|
||||
int maxAmount = (int) APISpellHelper.getPlayerMaxReagentAmount(player);
|
||||
ItemStack stack = player.inventory.armorItemInSlot(2);
|
||||
if (stack != null && stack.getItem() instanceof OmegaArmour) {
|
||||
int maxAmount = (int) APISpellHelper.getPlayerMaxReagentAmount(player);
|
||||
|
||||
if (maxAmount > 0) {
|
||||
float val = APISpellHelper.getPlayerCurrentReagentAmount(player);
|
||||
ReagentStack reagentStack = new ReagentStack(
|
||||
APISpellHelper.getPlayerReagentType(player),
|
||||
(int) val);
|
||||
if (maxAmount > 0) {
|
||||
float val = APISpellHelper.getPlayerCurrentReagentAmount(player);
|
||||
ReagentStack reagentStack = new ReagentStack(APISpellHelper.getPlayerReagentType(player), (int) val);
|
||||
|
||||
if (reagentStack != null && reagentStack.amount > 0) {
|
||||
renderTestHUD(mc, reagentStack, maxAmount);
|
||||
}
|
||||
if (reagentStack.amount > 0) {
|
||||
renderOmegaReagentHUD(mc, reagentStack, maxAmount);
|
||||
}
|
||||
}
|
||||
|
||||
if (SpellHelper.canPlayerSeeLPBar(player)) {
|
||||
int max = APISpellHelper.getPlayerMaxLPTag(player);
|
||||
|
||||
if (max > 1) {
|
||||
renderLPHUD(mc, APISpellHelper.getPlayerLPTag(player), max);
|
||||
}
|
||||
}
|
||||
|
||||
float maxHP = APISpellHelper.getCurrentAdditionalMaxHP(player);
|
||||
// System.out.println("MaxHP: " + maxHP);
|
||||
if (maxHP > 0) {
|
||||
renderHPHUD(mc, APISpellHelper.getCurrentAdditionalHP(player), maxHP);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
if (SpellHelper.canPlayerSeeLPBar(player)) {
|
||||
int max = APISpellHelper.getPlayerMaxLPTag(player);
|
||||
|
||||
if (max > 1) {
|
||||
renderLPHUD(mc, APISpellHelper.getPlayerLPTag(player), max);
|
||||
}
|
||||
}
|
||||
|
||||
float maxHP = APISpellHelper.getCurrentAdditionalMaxHP(player);
|
||||
if (maxHP > 0) {
|
||||
renderHPHUD(mc, APISpellHelper.getCurrentAdditionalHP(player), maxHP);
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderLPHUD(Minecraft mc, int lpAmount, int maxAmount) {
|
||||
@@ -155,42 +144,41 @@ public class RenderHelper {
|
||||
}
|
||||
|
||||
private static List<HUDElement> getHUDElements(Minecraft mc) {
|
||||
List<HUDElement> elements = new ArrayList();
|
||||
List<HUDElement> elements = new ArrayList<>();
|
||||
|
||||
MovingObjectPosition movingobjectposition = mc.objectMouseOver;
|
||||
World world = mc.theWorld;
|
||||
|
||||
if (movingobjectposition == null) {
|
||||
return elements;
|
||||
} else {
|
||||
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
}
|
||||
if (movingobjectposition.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
return elements;
|
||||
}
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tile instanceof IReagentHandler)) {
|
||||
return elements;
|
||||
}
|
||||
if (!(tile instanceof IReagentHandler relay)) {
|
||||
return elements;
|
||||
}
|
||||
|
||||
IReagentHandler relay = (IReagentHandler) tile;
|
||||
ReagentContainerInfo[] infos = relay
|
||||
.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit));
|
||||
|
||||
ReagentContainerInfo[] infos = relay
|
||||
.getContainerInfo(ForgeDirection.getOrientation(movingobjectposition.sideHit));
|
||||
|
||||
if (infos != null) {
|
||||
for (ReagentContainerInfo info : infos) {
|
||||
if (info == null || info.reagent == null || info.reagent.reagent == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
|
||||
|
||||
if (itemStack != null) elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount));
|
||||
}
|
||||
}
|
||||
if (infos == null) {
|
||||
return elements;
|
||||
}
|
||||
for (ReagentContainerInfo info : infos) {
|
||||
if (info == null || info.reagent == null || info.reagent.reagent == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack itemStack = ReagentRegistry.getItemForReagent(info.reagent.reagent);
|
||||
|
||||
if (itemStack != null) elements.add(new HUDElement(itemStack, 16, 16, 2, info.reagent.amount));
|
||||
}
|
||||
|
||||
return elements;
|
||||
@@ -221,40 +209,23 @@ public class RenderHelper {
|
||||
return r;
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(int p_73729_1_, int p_73729_2_, int p_73729_3_, int p_73729_4_,
|
||||
double p_73729_5_, double p_73729_6_) {
|
||||
public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) {
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(x, y + height, zLevel, (float) (textureX) * f, (float) (textureY + height) * f);
|
||||
tessellator.addVertexWithUV(
|
||||
(double) p_73729_1_,
|
||||
p_73729_2_ + p_73729_6_,
|
||||
(double) zLevel,
|
||||
(p_73729_3_ * f),
|
||||
(p_73729_4_ + p_73729_6_) * f1);
|
||||
tessellator.addVertexWithUV(
|
||||
p_73729_1_ + p_73729_5_,
|
||||
p_73729_2_ + p_73729_6_,
|
||||
(double) zLevel,
|
||||
(p_73729_3_ + p_73729_5_) * f,
|
||||
(p_73729_4_ + p_73729_6_) * f1);
|
||||
tessellator.addVertexWithUV(
|
||||
p_73729_1_ + p_73729_5_,
|
||||
(double) p_73729_2_,
|
||||
(double) zLevel,
|
||||
(p_73729_3_ + p_73729_5_) * f,
|
||||
p_73729_4_ * f1);
|
||||
tessellator.addVertexWithUV(
|
||||
(double) p_73729_1_,
|
||||
(double) p_73729_2_,
|
||||
(double) zLevel,
|
||||
(double) (p_73729_3_ * f),
|
||||
p_73729_4_ * f1);
|
||||
x + width,
|
||||
y + height,
|
||||
zLevel,
|
||||
(float) (textureX + width) * f,
|
||||
(float) (textureY + height) * f);
|
||||
tessellator.addVertexWithUV(x + width, y, zLevel, (float) (textureX + width) * f, (float) (textureY) * f);
|
||||
tessellator.addVertexWithUV(x, y, zLevel, (float) (textureX) * f, (float) (textureY) * f);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private static void renderTestHUD(Minecraft mc, ReagentStack reagentStack, int maxAmount) {
|
||||
private static void renderOmegaReagentHUD(Minecraft mc, ReagentStack reagentStack, int maxAmount) {
|
||||
GL11.glPushMatrix();
|
||||
Reagent reagent = reagentStack.reagent;
|
||||
int xSize = 32;
|
||||
@@ -268,11 +239,7 @@ public class RenderHelper {
|
||||
GL11.glScalef(1f / 8f, 1f / 8f, 1f / 8f);
|
||||
|
||||
ResourceLocation test2 = new ResourceLocation("alchemicalwizardry", "textures/gui/container1.png");
|
||||
GL11.glColor4f(
|
||||
reagent.getColourRed() / 255f,
|
||||
reagent.getColourGreen() / 255f,
|
||||
reagent.getColourBlue() / 255f,
|
||||
1.0F);
|
||||
GL11.glColor4ub((byte) reagent.red(), (byte) reagent.green(), (byte) reagent.blue(), (byte) 255);
|
||||
mc.getTextureManager().bindTexture(test2);
|
||||
|
||||
drawTexturedModalRect(x, y + amount, 0, amount, 256, 256 - amount);
|
||||
@@ -286,63 +253,34 @@ public class RenderHelper {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void renderIcon(int p_94149_1_, int p_94149_2_, IIcon p_94149_3_, int p_94149_4_, int p_94149_5_) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(
|
||||
(double) p_94149_1_,
|
||||
(double) (p_94149_2_ + p_94149_5_),
|
||||
(double) zLevel,
|
||||
(double) p_94149_3_.getMinU(),
|
||||
(double) p_94149_3_.getMaxV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (p_94149_1_ + p_94149_4_),
|
||||
(double) (p_94149_2_ + p_94149_5_),
|
||||
(double) zLevel,
|
||||
(double) p_94149_3_.getMaxU(),
|
||||
(double) p_94149_3_.getMaxV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (p_94149_1_ + p_94149_4_),
|
||||
(double) p_94149_2_,
|
||||
(double) zLevel,
|
||||
(double) p_94149_3_.getMaxU(),
|
||||
(double) p_94149_3_.getMinV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) p_94149_1_,
|
||||
(double) p_94149_2_,
|
||||
(double) zLevel,
|
||||
(double) p_94149_3_.getMinU(),
|
||||
(double) p_94149_3_.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private static void displayArmorStatus(Minecraft mc) {
|
||||
List<HUDElement> elements = getHUDElements(mc);
|
||||
|
||||
if (elements.size() > 0) {
|
||||
int yOffset = enableItemName ? 18 : 16;
|
||||
if (elements.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
int yOffset = 16;
|
||||
|
||||
if (listMode.equalsIgnoreCase("vertical")) {
|
||||
int yBase = getY(elements.size(), yOffset);
|
||||
if (listMode.equalsIgnoreCase("vertical")) {
|
||||
int yBase = getY(elements.size(), yOffset);
|
||||
|
||||
for (HUDElement e : elements) {
|
||||
e.renderToHud((alignMode.toLowerCase().contains("right") ? getX(0) : getX(e.width())), yBase);
|
||||
yBase += yOffset;
|
||||
}
|
||||
} else if (listMode.equalsIgnoreCase("horizontal")) {
|
||||
int totalWidth = getElementsWidth(elements);
|
||||
int yBase = getY(1, yOffset);
|
||||
int xBase = getX(totalWidth);
|
||||
int prevX = 0;
|
||||
|
||||
for (HUDElement e : elements) {
|
||||
e.renderToHud(xBase + prevX + (alignMode.toLowerCase().contains("right") ? e.width() : 0), yBase);
|
||||
prevX += (e.width());
|
||||
}
|
||||
} // else if (listMode.equalsIgnoreCase("compound"))
|
||||
{
|
||||
// TODO
|
||||
for (HUDElement e : elements) {
|
||||
e.renderToHud((alignMode.toLowerCase().contains("right") ? getX(0) : getX(e.width())), yBase);
|
||||
yBase += yOffset;
|
||||
}
|
||||
} else if (listMode.equalsIgnoreCase("horizontal")) {
|
||||
int totalWidth = getElementsWidth(elements);
|
||||
int yBase = getY(1, yOffset);
|
||||
int xBase = getX(totalWidth);
|
||||
int prevX = 0;
|
||||
|
||||
for (HUDElement e : elements) {
|
||||
e.renderToHud(xBase + prevX + (alignMode.toLowerCase().contains("right") ? e.width() : 0), yBase);
|
||||
prevX += (e.width());
|
||||
}
|
||||
} // else if (listMode.equalsIgnoreCase("compound"))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-11
@@ -55,8 +55,7 @@ public class RitualDivinerRender {
|
||||
double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.partialTicks;
|
||||
|
||||
if (player.inventory.getCurrentItem() != null
|
||||
&& player.inventory.getCurrentItem().getItem() instanceof ItemRitualDiviner) {
|
||||
ItemRitualDiviner ritualDiviner = (ItemRitualDiviner) player.inventory.getCurrentItem().getItem();
|
||||
&& player.inventory.getCurrentItem().getItem() instanceof ItemRitualDiviner ritualDiviner) {
|
||||
int direction = ritualDiviner.getDirection(player.inventory.getCurrentItem());
|
||||
RitualEffect ritualEffect = getEffectFromString(
|
||||
ritualDiviner.getCurrentRitual(player.inventory.getCurrentItem()));
|
||||
@@ -70,19 +69,16 @@ public class RitualDivinerRender {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
for (RitualComponent ritualComponent : ritualEffect.getRitualComponentList()) {
|
||||
Vector3 vX = vec3.add(
|
||||
new Vector3(
|
||||
ritualComponent.getX(direction),
|
||||
ritualComponent.getY(),
|
||||
ritualComponent.getZ(direction)));
|
||||
double minX = vX.x - posX;
|
||||
double minY = vX.y - posY;
|
||||
double minZ = vX.z - posZ;
|
||||
new Vector3(ritualComponent.x(direction), ritualComponent.y(), ritualComponent.z(direction)));
|
||||
double minX = vX.x() - posX;
|
||||
double minY = vX.y() - posY;
|
||||
double minZ = vX.z() - posZ;
|
||||
|
||||
if (!world.getBlock(vX.x, vX.y, vX.z).isOpaqueCube()) {
|
||||
if (!world.getBlock(vX.x(), vX.y(), vX.z()).isOpaqueCube()) {
|
||||
RenderFakeBlocks.drawFakeBlock(
|
||||
vX,
|
||||
ModBlocks.ritualStone,
|
||||
ritualComponent.getStoneType(),
|
||||
ritualComponent.stoneType(),
|
||||
minX,
|
||||
minY,
|
||||
minZ,
|
||||
|
||||
+83
-215
@@ -2,7 +2,6 @@ package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@@ -62,12 +61,12 @@ import vazkii.botania.api.internal.IManaBurst;
|
||||
|
||||
public class AlchemicalWizardryEventHooks {
|
||||
|
||||
public static Map<String, Boolean> playerFlightBuff = new HashMap();
|
||||
public static List<String> playersWith1Step = new ArrayList();
|
||||
public static Map<String, Boolean> playerFlightBuff = new HashMap<>();
|
||||
public static List<String> playersWith1Step = new ArrayList<>();
|
||||
|
||||
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap();
|
||||
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap();
|
||||
public static ArrayList<BlockStack> teleposerBlacklist = new ArrayList<BlockStack>();
|
||||
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap<>();
|
||||
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap<>();
|
||||
public static ArrayList<BlockStack> teleposerBlacklist = new ArrayList<>();
|
||||
|
||||
public static Random rand = new Random();
|
||||
|
||||
@@ -81,10 +80,8 @@ public class AlchemicalWizardryEventHooks {
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
if (heldItem == null) {
|
||||
parad.onEmptyHandEntityInteract(player, event.target);
|
||||
} else {
|
||||
if (heldItem.getItem() instanceof EnergySword) {
|
||||
parad.onBoundSwordInteractWithEntity(player, event.target);
|
||||
}
|
||||
} else if (heldItem.getItem() instanceof EnergySword) {
|
||||
parad.onBoundSwordInteractWithEntity(player, event.target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,15 +96,14 @@ public class AlchemicalWizardryEventHooks {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onLivingHurtEvent(LivingHurtEvent event) {
|
||||
if (!event.isCanceled() && event.entityLiving instanceof EntityPlayer
|
||||
if (!event.isCanceled() && event.entityLiving instanceof EntityPlayerMP player
|
||||
&& !event.entityLiving.worldObj.isRemote) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
if (APISpellHelper.getCurrentAdditionalMaxHP(player) > 0) {
|
||||
APISpellHelper.setPlayerReagentRegenCooldownTag(player, 20 * 20);
|
||||
}
|
||||
|
||||
float prevHp = APISpellHelper.getCurrentAdditionalHP((EntityPlayer) event.entityLiving);
|
||||
float prevHp = APISpellHelper.getCurrentAdditionalHP(player);
|
||||
if (prevHp > 0) {
|
||||
float recalculatedAmount = ArmorProperties
|
||||
.ApplyArmor(player, player.inventory.armorInventory, event.source, event.ammount);
|
||||
@@ -141,17 +137,12 @@ public class AlchemicalWizardryEventHooks {
|
||||
APISpellHelper.setCurrentAdditionalHP(player, hp);
|
||||
NewPacketHandler.INSTANCE.sendTo(
|
||||
NewPacketHandler.getAddedHPPacket(hp, APISpellHelper.getCurrentAdditionalMaxHP(player)),
|
||||
(EntityPlayerMP) player);
|
||||
|
||||
// if(event.ammount <= 0.3)
|
||||
// {
|
||||
// event.ammount++;
|
||||
// }
|
||||
player);
|
||||
} else {
|
||||
APISpellHelper.setCurrentAdditionalHP(player, 0);
|
||||
NewPacketHandler.INSTANCE.sendTo(
|
||||
NewPacketHandler.getAddedHPPacket(0, APISpellHelper.getCurrentAdditionalMaxHP(player)),
|
||||
(EntityPlayerMP) player);
|
||||
player);
|
||||
|
||||
event.ammount -= prevHp / ratio;
|
||||
if (event.ammount < 0) {
|
||||
@@ -164,8 +155,7 @@ public class AlchemicalWizardryEventHooks {
|
||||
|
||||
@SubscribeEvent
|
||||
public void omegaUpdateReagentAndHpEvent(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer && !event.entityLiving.worldObj.isRemote) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
if (event.entityLiving instanceof EntityPlayer player && !event.entityLiving.worldObj.isRemote) {
|
||||
Reagent reagent = APISpellHelper.getPlayerReagentType(player);
|
||||
float reagentAmount = APISpellHelper.getPlayerCurrentReagentAmount(player);
|
||||
|
||||
@@ -222,10 +212,7 @@ public class AlchemicalWizardryEventHooks {
|
||||
float drain = addedAmount * config.costPerPoint;
|
||||
|
||||
reagentAmount -= drain;
|
||||
hasReagentChanged = true;
|
||||
|
||||
health += addedAmount;
|
||||
|
||||
hasHealthChanged = true;
|
||||
}
|
||||
|
||||
@@ -239,7 +226,6 @@ public class AlchemicalWizardryEventHooks {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
reagentAmount = 0;
|
||||
APISpellHelper.setPlayerMaxReagentAmount(player, 0);
|
||||
@@ -252,10 +238,8 @@ public class AlchemicalWizardryEventHooks {
|
||||
float costPerTick = parad.getCostPerTickOfUse(player);
|
||||
if (parad.doDrainReagent(player)) {
|
||||
if (reagentAmount > costPerTick) {
|
||||
hasReagentChanged = true;
|
||||
reagentAmount = Math.max(0, reagentAmount - costPerTick);
|
||||
} else {
|
||||
hasReagentChanged = true;
|
||||
reagentAmount = 0;
|
||||
}
|
||||
}
|
||||
@@ -279,7 +263,7 @@ public class AlchemicalWizardryEventHooks {
|
||||
}
|
||||
}
|
||||
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
if (player instanceof EntityPlayerMP p) {
|
||||
if (hasReagentChanged) {
|
||||
APISpellHelper.setPlayerCurrentReagentAmount(player, reagentAmount);
|
||||
NewPacketHandler.INSTANCE.sendTo(
|
||||
@@ -287,7 +271,7 @@ public class AlchemicalWizardryEventHooks {
|
||||
reagent,
|
||||
reagentAmount,
|
||||
APISpellHelper.getPlayerMaxReagentAmount(player)),
|
||||
(EntityPlayerMP) player);
|
||||
p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,10 +279,9 @@ public class AlchemicalWizardryEventHooks {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerDamageEvent(LivingAttackEvent event) {
|
||||
if (event.source.isProjectile()) {
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt) && event.isCancelable()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
if (event.source.isProjectile() && event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt)
|
||||
&& event.isCancelable()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,30 +301,23 @@ public class AlchemicalWizardryEventHooks {
|
||||
for (CoordAndRange coords : list) {
|
||||
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
|
||||
if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning
|
||||
&& ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual)) {
|
||||
if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius
|
||||
&& event.z > coords.zCoord - coords.horizRadius
|
||||
&& event.z < coords.zCoord + coords.horizRadius
|
||||
&& event.y > coords.yCoord - coords.vertRadius
|
||||
&& event.y < coords.yCoord + coords.vertRadius) {
|
||||
switch (event.getResult()) {
|
||||
case ALLOW:
|
||||
event.setResult(Result.DEFAULT);
|
||||
break;
|
||||
case DEFAULT:
|
||||
event.setResult(Result.DENY);
|
||||
break;
|
||||
case DENY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!(tile instanceof TEMasterStone masterStone) || !masterStone.isRunning
|
||||
|| !masterStone.getCurrentRitual().equals(respawnRitual)) {
|
||||
list.remove(coords);
|
||||
continue;
|
||||
}
|
||||
if (event.x <= coords.xCoord - coords.horizRadius || !(event.x < coords.xCoord + coords.horizRadius)
|
||||
|| !(event.z > coords.zCoord - coords.horizRadius)
|
||||
|| !(event.z < coords.zCoord + coords.horizRadius)
|
||||
|| !(event.y > coords.yCoord - coords.vertRadius)
|
||||
|| !(event.y < coords.yCoord + coords.vertRadius)) {
|
||||
continue;
|
||||
}
|
||||
switch (event.getResult()) {
|
||||
case ALLOW -> event.setResult(Result.DEFAULT);
|
||||
case DEFAULT -> event.setResult(Result.DENY);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -359,30 +335,23 @@ public class AlchemicalWizardryEventHooks {
|
||||
for (CoordAndRange coords : list) {
|
||||
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
|
||||
if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning
|
||||
&& ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual)) {
|
||||
if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius
|
||||
&& event.z > coords.zCoord - coords.horizRadius
|
||||
&& event.z < coords.zCoord + coords.horizRadius
|
||||
&& event.y > coords.yCoord - coords.vertRadius
|
||||
&& event.y < coords.yCoord + coords.vertRadius) {
|
||||
switch (event.getResult()) {
|
||||
case ALLOW:
|
||||
break;
|
||||
case DEFAULT:
|
||||
event.setResult(Result.ALLOW);
|
||||
break;
|
||||
case DENY:
|
||||
event.setResult(Result.DEFAULT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!(tile instanceof TEMasterStone stone) || !stone.isRunning
|
||||
|| !stone.getCurrentRitual().equals(forceSpawnRitual)) {
|
||||
list.remove(coords);
|
||||
continue;
|
||||
}
|
||||
if (event.x <= coords.xCoord - coords.horizRadius || !(event.x < coords.xCoord + coords.horizRadius)
|
||||
|| !(event.z > coords.zCoord - coords.horizRadius)
|
||||
|| !(event.z < coords.zCoord + coords.horizRadius)
|
||||
|| !(event.y > coords.yCoord - coords.vertRadius)
|
||||
|| !(event.y < coords.yCoord + coords.vertRadius)) {
|
||||
continue;
|
||||
}
|
||||
switch (event.getResult()) {
|
||||
case DEFAULT -> event.setResult(Result.ALLOW);
|
||||
case DENY -> event.setResult(Result.DEFAULT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -397,11 +366,6 @@ public class AlchemicalWizardryEventHooks {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingJumpEvent(LivingJumpEvent event) {
|
||||
// event.entityLiving.getEntityAttribute(SharedMonsterAttributes.maxHealth).removeModifier(new
|
||||
// AttributeModifier(new UUID(493295, 1), "HealthModifier", 2, 0));
|
||||
// event.entityLiving.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new
|
||||
// AttributeModifier(new UUID(493295, 1), "HealthModifier", 2, 0));
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost)) {
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier();
|
||||
event.entityLiving.motionY += (0.1f) * (2 + i);
|
||||
@@ -426,7 +390,7 @@ public class AlchemicalWizardryEventHooks {
|
||||
if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionReciprocation)) {
|
||||
Entity entityAttacking = event.source.getSourceOfDamage();
|
||||
|
||||
if (entityAttacking != null && entityAttacking instanceof EntityLivingBase) {
|
||||
if (entityAttacking instanceof EntityLivingBase) {
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionReciprocation)
|
||||
.getAmplifier();
|
||||
float damageRecieve = event.ammount / 2 * (i + 1);
|
||||
@@ -439,30 +403,14 @@ public class AlchemicalWizardryEventHooks {
|
||||
|
||||
Entity entityAttacking = event.source.getSourceOfDamage();
|
||||
|
||||
if (entityAttacking != null && entityAttacking instanceof EntityLivingBase
|
||||
&& !entityAttacking.isImmuneToFire()
|
||||
&& !((EntityLivingBase) entityAttacking).isPotionActive(Potion.fireResistance)) {
|
||||
if (entityAttacking instanceof EntityLivingBase entity && !entityAttacking.isImmuneToFire()
|
||||
&& !entity.isPotionActive(Potion.fireResistance)) {
|
||||
entityAttacking.attackEntityFrom(DamageSource.inFire, 2 * i + 2);
|
||||
entityAttacking.setFire(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @SubscribeEvent
|
||||
// public void onFOVUpdate(FOVUpdateEvent event)
|
||||
// {
|
||||
// event.setResult(Result.DENY);
|
||||
// }
|
||||
// @SubscribeEvent
|
||||
// public void onPlayerTickEnd(PlayerTickEvent event)
|
||||
// {
|
||||
// if(event.type.equals(Type.PLAYER) && event.phase.equals(TickEvent.Phase.END))
|
||||
// {
|
||||
// ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, event.player.capabilities,
|
||||
// Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
|
||||
// }
|
||||
// }
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(LivingUpdateEvent event) {
|
||||
EntityLivingBase entityLiving = event.entityLiving;
|
||||
@@ -475,23 +423,18 @@ public class AlchemicalWizardryEventHooks {
|
||||
int yPos = (int) (blockVector.yCoord);
|
||||
int zPos = (int) (blockVector.zCoord);
|
||||
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
if (entityLiving instanceof EntityPlayerMP player) {
|
||||
if (!entityLiving.worldObj.isRemote && entityLiving.worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
if (entityLiving instanceof EntityPlayerMP) {
|
||||
String ownerName = SoulNetworkHandler.getUsername((EntityPlayer) entityLiving);
|
||||
NewPacketHandler.INSTANCE.sendTo(
|
||||
NewPacketHandler.getLPPacket(
|
||||
SoulNetworkHandler.getCurrentEssence(ownerName),
|
||||
SoulNetworkHandler.getMaxEssence(ownerName)),
|
||||
(EntityPlayerMP) entityLiving);
|
||||
}
|
||||
String ownerName = SoulNetworkHandler.getUsername(player);
|
||||
NewPacketHandler.INSTANCE.sendTo(
|
||||
NewPacketHandler.getLPPacket(
|
||||
SoulNetworkHandler.getCurrentEssence(ownerName),
|
||||
SoulNetworkHandler.getMaxEssence(ownerName)),
|
||||
player);
|
||||
}
|
||||
// ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, ((EntityPlayer)
|
||||
// event.entityLiving).capabilities, 0.1F, "walkSpeed", "g", "field_75097_g");
|
||||
}
|
||||
|
||||
if (entityLiving instanceof EntityPlayer && entityLiving.worldObj.isRemote) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer) entityLiving;
|
||||
if (entityLiving instanceof EntityPlayer entityPlayer && entityLiving.worldObj.isRemote) {
|
||||
boolean highStepListed = playersWith1Step.contains(entityPlayer.getDisplayName());
|
||||
boolean hasHighStep = entityPlayer.isPotionActive(AlchemicalWizardry.customPotionBoost);
|
||||
|
||||
@@ -523,26 +466,15 @@ public class AlchemicalWizardryEventHooks {
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost)) {
|
||||
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier();
|
||||
// if(!entity.isSneaking())
|
||||
{
|
||||
if (!event.entityLiving.isSneaking() && event.entityLiving instanceof EntityPlayer entityPlayer) {
|
||||
float percentIncrease = (i + 1) * 0.05f;
|
||||
entityPlayer.stepHeight = 1.0f;
|
||||
|
||||
// AttributeModifier speedModifier = new AttributeModifier(new UUID(213241, 3), "Potion Boost",
|
||||
// percentIncrease, 0);
|
||||
//
|
||||
//
|
||||
// event.entityLiving.getEntityAttribute(SharedMonsterAttributes.movementSpeed).applyModifier(speedModifier);
|
||||
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
|
||||
entityPlayer.stepHeight = 1.0f;
|
||||
|
||||
if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
|
||||
entityPlayer.moveFlying(
|
||||
0F,
|
||||
1F,
|
||||
entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
|
||||
}
|
||||
if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
|
||||
entityPlayer.moveFlying(
|
||||
0F,
|
||||
1F,
|
||||
entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,30 +488,20 @@ public class AlchemicalWizardryEventHooks {
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB
|
||||
.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5)
|
||||
.expand(d0, d0, d0);
|
||||
List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity projectile = (Entity) iterator.next();
|
||||
|
||||
if (projectile == null) {
|
||||
continue;
|
||||
}
|
||||
List<Entity> list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
|
||||
|
||||
for (Entity projectile : list) {
|
||||
if (!(projectile instanceof IProjectile)
|
||||
|| (AlchemicalWizardry.isBotaniaLoaded && isManaBurst(projectile))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Entity throwingEntity = null;
|
||||
|
||||
if (projectile instanceof EntityArrow) {
|
||||
throwingEntity = ((EntityArrow) projectile).shootingEntity;
|
||||
} else if (projectile instanceof EnergyBlastProjectile) {
|
||||
throwingEntity = ((EnergyBlastProjectile) projectile).shootingEntity;
|
||||
} else if (projectile instanceof EntityThrowable) {
|
||||
throwingEntity = ((EntityThrowable) projectile).getThrower();
|
||||
}
|
||||
Entity throwingEntity = switch (projectile) {
|
||||
case EntityArrow entityArrow -> entityArrow.shootingEntity;
|
||||
case EnergyBlastProjectile energyBlastProjectile -> energyBlastProjectile.shootingEntity;
|
||||
case EntityThrowable entityThrowable -> entityThrowable.getThrower();
|
||||
default -> null;
|
||||
};
|
||||
|
||||
if (throwingEntity != null && throwingEntity.equals(entity)) {
|
||||
continue;
|
||||
@@ -621,15 +543,13 @@ public class AlchemicalWizardryEventHooks {
|
||||
}
|
||||
|
||||
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlight)) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
|
||||
if (event.entityLiving instanceof EntityPlayer entityPlayer) {
|
||||
String ownerName = SpellHelper.getUsername(entityPlayer);
|
||||
playerFlightBuff.put(ownerName, true);
|
||||
entityPlayer.capabilities.allowFlying = true;
|
||||
}
|
||||
} else {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
|
||||
if (event.entityLiving instanceof EntityPlayer entityPlayer) {
|
||||
String ownerName = SpellHelper.getUsername(entityPlayer);
|
||||
|
||||
if (!playerFlightBuff.containsKey(ownerName)) {
|
||||
@@ -685,12 +605,11 @@ public class AlchemicalWizardryEventHooks {
|
||||
|
||||
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionIceCloak).getAmplifier();
|
||||
int horizRange = r + 1;
|
||||
int vertRange = 1;
|
||||
|
||||
if (!entityLiving.worldObj.isRemote) {
|
||||
for (int i = -horizRange; i <= horizRange; i++) {
|
||||
for (int k = -horizRange; k <= horizRange; k++) {
|
||||
for (int j = -vertRange - 1; j <= vertRange - 1; j++) {
|
||||
for (int j = -2; j <= 0; j++) {
|
||||
SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos + i, yPos + j, zPos + k);
|
||||
}
|
||||
}
|
||||
@@ -743,56 +662,6 @@ public class AlchemicalWizardryEventHooks {
|
||||
}
|
||||
}
|
||||
|
||||
// @SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
// public void onTelepose(TeleposeEvent event) {
|
||||
//
|
||||
// AlchemicalWizardry.logger.info(event.initialBlock + ":" + event.initialMetadata);
|
||||
// AlchemicalWizardry.logger.info(event.finalBlock + ":" + event.finalMetadata);
|
||||
//
|
||||
// for (int i = 0; i < BloodMagicConfiguration.teleposerBlacklist.length; i++) {
|
||||
// String[] blockData = BloodMagicConfiguration.teleposerBlacklist[i].split(":");
|
||||
//
|
||||
// // If the block follows full syntax: modid:blockname:meta
|
||||
// if (blockData.length == 3) {
|
||||
//
|
||||
// Block block = GameRegistry.findBlock(blockData[0], blockData[1]);
|
||||
// int meta;
|
||||
//
|
||||
// // Check if it's an int, if so, parse it. If not, set meta to 0 to avoid crashing.
|
||||
// if (isInteger(blockData[2]))
|
||||
// meta = Integer.parseInt(blockData[2]);
|
||||
// else if (blockData[2].equals("*"))
|
||||
// meta = OreDictionary.WILDCARD_VALUE;
|
||||
// else
|
||||
// meta = 0;
|
||||
//
|
||||
// AlchemicalWizardry.logger.info(block + ":" + meta);
|
||||
//
|
||||
// if (block != null) {
|
||||
// if ((block == event.initialBlock || block == event.finalBlock) && (meta == event.initialMetadata || meta ==
|
||||
// event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE)) {
|
||||
// event.setCanceled(true);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // If the block uses shorthand syntax: modid:blockname
|
||||
// } else if (blockData.length == 2) {
|
||||
//
|
||||
// Block block = GameRegistry.findBlock(blockData[0], blockData[1]);
|
||||
// int meta = 0;
|
||||
//
|
||||
// if (block != null) {
|
||||
// if ((block == event.initialBlock && (meta == event.initialMetadata || meta == OreDictionary.WILDCARD_VALUE))
|
||||
// || (block == event.finalBlock && (meta == event.finalMetadata || meta == OreDictionary.WILDCARD_VALUE))) {
|
||||
// event.setCanceled(true);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTelepose(TeleposeEvent event) {
|
||||
BlockStack initialBlock = new BlockStack(event.initialBlock, event.initialMetadata);
|
||||
@@ -806,13 +675,11 @@ public class AlchemicalWizardryEventHooks {
|
||||
public void onEntityDeath(LivingDeathEvent event) {
|
||||
EntityLivingBase entityLiving = event.entityLiving;
|
||||
|
||||
if (entityLiving instanceof IDemon && event.source.getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
if (entityLiving instanceof IDemon && event.source.getEntity() instanceof EntityPlayer player) {
|
||||
|
||||
player.addStat(ModAchievements.demonSpawn, 1);
|
||||
}
|
||||
if (entityLiving instanceof IHoardDemon && event.source.getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
if (entityLiving instanceof IHoardDemon && event.source.getEntity() instanceof EntityPlayer player) {
|
||||
|
||||
player.addStat(ModAchievements.demons, 1);
|
||||
}
|
||||
@@ -828,9 +695,10 @@ public class AlchemicalWizardryEventHooks {
|
||||
|
||||
@Optional.Method(modid = "Botania")
|
||||
private boolean isManaBurst(Entity entity) {
|
||||
if (entity instanceof IManaBurst) {
|
||||
ItemStack lens = ((IManaBurst) entity).getSourceLens();
|
||||
return !(lens.getItemDamage() != 8 && lens.getItemDamage() != 11);
|
||||
} else return false;
|
||||
if (entity instanceof IManaBurst burst) {
|
||||
ItemStack lens = burst.getSourceLens();
|
||||
return lens.getItemDamage() == 8 || lens.getItemDamage() == 11;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,3 @@
|
||||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
public class ArmourComponent {
|
||||
|
||||
private int xOff;
|
||||
private int zOff;
|
||||
|
||||
public ArmourComponent(int xOff, int zOff) {
|
||||
this.xOff = xOff;
|
||||
this.zOff = zOff;
|
||||
}
|
||||
|
||||
public int getXOff() {
|
||||
return xOff;
|
||||
}
|
||||
|
||||
public int getZOff() {
|
||||
return zOff;
|
||||
}
|
||||
}
|
||||
public record ArmourComponent(int xOff, int zOff) {}
|
||||
@@ -1,16 +1,17 @@
|
||||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
|
||||
|
||||
public class EntityAITargetAggro extends EntityAINearestAttackableTarget {
|
||||
|
||||
private EntityDemon theCreature;
|
||||
private final EntityDemon theCreature;
|
||||
|
||||
public EntityAITargetAggro(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4) {
|
||||
super(par1EntityDemon, par2Class, par3, par4);
|
||||
this.theCreature = par1EntityDemon;
|
||||
public EntityAITargetAggro(EntityDemon entityDemon, Class<? extends Entity> entityClass, int par3, boolean par4) {
|
||||
super(entityDemon, entityClass, par3, par4);
|
||||
this.theCreature = entityDemon;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package WayofTime.alchemicalWizardry.common;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
@@ -9,9 +10,9 @@ public class EntityAITargetAggroCloaking extends EntityAITargetAggro {
|
||||
|
||||
int cloakLevel; // Level of cloaking that the owner demon is fooled by
|
||||
|
||||
public EntityAITargetAggroCloaking(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4,
|
||||
int cloak) {
|
||||
super(par1EntityDemon, par2Class, par3, par4);
|
||||
public EntityAITargetAggroCloaking(EntityDemon entityDemon, Class<? extends Entity> entityClass, int par3,
|
||||
boolean par4, int cloak) {
|
||||
super(entityDemon, entityClass, par3, par4);
|
||||
this.cloakLevel = cloak;
|
||||
}
|
||||
|
||||
|
||||
@@ -592,13 +592,13 @@ public enum NewPacketHandler {
|
||||
target.writeInt(list.size());
|
||||
|
||||
list.forEach(colourSet -> {
|
||||
target.writeInt(colourSet.colourRed);
|
||||
target.writeInt(colourSet.colourGreen);
|
||||
target.writeInt(colourSet.colourBlue);
|
||||
target.writeInt(colourSet.colourIntensity);
|
||||
target.writeInt(colourSet.xCoord);
|
||||
target.writeInt(colourSet.yCoord);
|
||||
target.writeInt(colourSet.zCoord);
|
||||
target.writeInt(colourSet.red());
|
||||
target.writeInt(colourSet.green());
|
||||
target.writeInt(colourSet.blue());
|
||||
target.writeInt(colourSet.intensity());
|
||||
target.writeInt(colourSet.x());
|
||||
target.writeInt(colourSet.y());
|
||||
target.writeInt(colourSet.z());
|
||||
});
|
||||
}
|
||||
case 11 -> {
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.stats.Achievement;
|
||||
|
||||
public class AchievementsMod extends Achievement {
|
||||
|
||||
public static List<Achievement> achievements = new ArrayList();
|
||||
public static List<Achievement> achievements = new ArrayList<>();
|
||||
|
||||
public AchievementsMod(String name, int x, int y, ItemStack icon, Achievement parent) {
|
||||
super("achievement.alchemicalwizardry:" + name, "alchemicalwizardry:" + name, x, y, icon, parent);
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
|
||||
|
||||
public class CombinedPotionRegistry {
|
||||
|
||||
public static List<CombinedPotionComponent> potionList = new ArrayList();
|
||||
public static List<CombinedPotionComponent> potionList = new ArrayList<>();
|
||||
|
||||
public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2) {
|
||||
potionList.add(new CombinedPotionComponent(result, pot1, pot2));
|
||||
|
||||
@@ -27,10 +27,10 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ArmourForge extends Block {
|
||||
|
||||
public static List<ArmourComponent> helmetList = new ArrayList();
|
||||
public static List<ArmourComponent> plateList = new ArrayList();
|
||||
public static List<ArmourComponent> leggingsList = new ArrayList();
|
||||
public static List<ArmourComponent> bootsList = new ArrayList();
|
||||
public static List<ArmourComponent> helmetList = new ArrayList<>();
|
||||
public static List<ArmourComponent> plateList = new ArrayList<>();
|
||||
public static List<ArmourComponent> leggingsList = new ArrayList<>();
|
||||
public static List<ArmourComponent> bootsList = new ArrayList<>();
|
||||
|
||||
public ArmourForge() {
|
||||
super(Material.iron);
|
||||
@@ -66,82 +66,53 @@ public class ArmourForge extends Block {
|
||||
}
|
||||
|
||||
List<ArmourComponent> list = null;
|
||||
ItemStack armourPiece = null;
|
||||
|
||||
switch (armourType) {
|
||||
case 0:
|
||||
ItemStack armourPiece = switch (armourType) {
|
||||
case 0 -> {
|
||||
list = plateList;
|
||||
armourPiece = new ItemStack(ModItems.boundPlate, 1, 0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
yield new ItemStack(ModItems.boundPlate, 1, 0);
|
||||
}
|
||||
case 1 -> {
|
||||
list = leggingsList;
|
||||
armourPiece = new ItemStack(ModItems.boundLeggings, 1, 0);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
yield new ItemStack(ModItems.boundLeggings, 1, 0);
|
||||
}
|
||||
case 2 -> {
|
||||
list = helmetList;
|
||||
armourPiece = new ItemStack(ModItems.boundHelmet, 1, 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
yield new ItemStack(ModItems.boundHelmet, 1, 0);
|
||||
}
|
||||
case 3 -> {
|
||||
list = bootsList;
|
||||
armourPiece = new ItemStack(ModItems.boundBoots, 1, 0);
|
||||
break;
|
||||
}
|
||||
yield new ItemStack(ModItems.boundBoots, 1, 0);
|
||||
}
|
||||
default -> null;
|
||||
};
|
||||
|
||||
if (list == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (armourPiece == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (armourPiece.getTagCompound() == null) {
|
||||
armourPiece.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
for (ArmourComponent ac : list) {
|
||||
int xOff = ac.getXOff();
|
||||
int zOff = ac.getZOff();
|
||||
TileEntity tileEntity;
|
||||
int xOff = ac.xOff();
|
||||
int zOff = ac.zOff();
|
||||
TileEntity tileEntity = switch (direction) {
|
||||
case 1 -> world.getTileEntity(x + xOff, y, z - zOff);
|
||||
case 2 -> world.getTileEntity(x + zOff, y, z + xOff);
|
||||
case 3 -> world.getTileEntity(x - xOff, y, z + zOff);
|
||||
case 4 -> world.getTileEntity(x - zOff, y, z - xOff);
|
||||
case 5 -> world.getTileEntity(x + xOff, y + zOff, z);
|
||||
case 6 -> world.getTileEntity(x, y + zOff, z + xOff);
|
||||
default -> null;
|
||||
};
|
||||
|
||||
switch (direction) {
|
||||
case 1:
|
||||
tileEntity = world.getTileEntity(x + xOff, y, z - zOff);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tileEntity = world.getTileEntity(x + zOff, y, z + xOff);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
tileEntity = world.getTileEntity(x - xOff, y, z + zOff);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
tileEntity = world.getTileEntity(x - zOff, y, z - xOff);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
tileEntity = world.getTileEntity(x + xOff, y + zOff, z);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
tileEntity = world.getTileEntity(x, y + zOff, z + xOff);
|
||||
break;
|
||||
|
||||
default:
|
||||
tileEntity = null;
|
||||
}
|
||||
|
||||
if (tileEntity instanceof TESocket) {
|
||||
ItemStack itemStack = ((TESocket) tileEntity).getStackInSlot(0);
|
||||
if (tileEntity instanceof TESocket socket) {
|
||||
ItemStack itemStack = socket.getStackInSlot(0);
|
||||
int xCoord = tileEntity.xCoord;
|
||||
int yCoord = tileEntity.yCoord;
|
||||
int zCoord = tileEntity.zCoord;
|
||||
((TESocket) tileEntity).setInventorySlotContents(0, null);
|
||||
socket.setInventorySlotContents(0, null);
|
||||
world.setBlockToAir(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
@@ -158,23 +129,21 @@ public class ArmourForge extends Block {
|
||||
zCoord);
|
||||
}
|
||||
|
||||
if (itemStack != null) {
|
||||
if (itemStack != null && armourPiece.getItem() instanceof BoundArmour armor) {
|
||||
Item item = itemStack.getItem();
|
||||
|
||||
if (item instanceof ArmourUpgrade) {
|
||||
((BoundArmour) armourPiece.getItem()).hasAddedToInventory(armourPiece, itemStack.copy());
|
||||
((TESocket) tileEntity).setInventorySlotContents(0, null);
|
||||
armor.hasAddedToInventory(armourPiece, itemStack.copy());
|
||||
socket.setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (armourPiece != null) {
|
||||
int xOff = (world.rand.nextInt(11) - 5);
|
||||
int zOff = (int) (Math.sqrt(25 - xOff * xOff) * (world.rand.nextInt(2) - 0.5) * 2);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + xOff, y + 5, z + zOff));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y + 1, z, armourPiece));
|
||||
}
|
||||
int xOff = (world.rand.nextInt(11) - 5);
|
||||
int zOff = (int) (Math.sqrt(25 - xOff * xOff) * (world.rand.nextInt(2) - 0.5) * 2);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + xOff, y + 5, z + zOff));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y + 1, z, armourPiece));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -201,79 +170,56 @@ public class ArmourForge extends Block {
|
||||
}
|
||||
|
||||
public boolean isParadigmValid(int armourType, int direction, World world, int x, int y, int z) {
|
||||
List<ArmourComponent> list = null;
|
||||
|
||||
switch (armourType) {
|
||||
case 0:
|
||||
list = plateList;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
list = leggingsList;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
list = helmetList;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
list = bootsList;
|
||||
break;
|
||||
}
|
||||
List<ArmourComponent> list = switch (armourType) {
|
||||
case 0 -> plateList;
|
||||
case 1 -> leggingsList;
|
||||
case 2 -> helmetList;
|
||||
case 3 -> bootsList;
|
||||
default -> null;
|
||||
};
|
||||
|
||||
if (list == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ArmourComponent ac : list) {
|
||||
int xOff = ac.getXOff();
|
||||
int zOff = ac.getZOff();
|
||||
int xOff = ac.xOff();
|
||||
int zOff = ac.zOff();
|
||||
|
||||
switch (direction) {
|
||||
case 1:
|
||||
case 1 -> {
|
||||
if (!(world.getTileEntity(x + xOff, y, z - zOff) instanceof TESocket)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
}
|
||||
case 2 -> {
|
||||
if (!(world.getTileEntity(x + zOff, y, z + xOff) instanceof TESocket)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
}
|
||||
case 3 -> {
|
||||
if (!(world.getTileEntity(x - xOff, y, z + zOff) instanceof TESocket)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
}
|
||||
case 4 -> {
|
||||
if (!(world.getTileEntity(x - zOff, y, z - xOff) instanceof TESocket)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
}
|
||||
case 5 -> {
|
||||
if (!(world.getTileEntity(x + xOff, y + zOff, z) instanceof TESocket)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
}
|
||||
case 6 -> {
|
||||
if (!(world.getTileEntity(x, y + zOff, z + xOff) instanceof TESocket)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -106,57 +107,31 @@ public class BlockAltar extends BlockContainer {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null) {
|
||||
if (playerItem.getItem().equals(ModItems.divinationSigil)) {
|
||||
if (player.worldObj.isRemote) {
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else {
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if (stack != null && stack.getItem() != null) {
|
||||
Item item = stack.getItem();
|
||||
if (showAltarInfo(world, x, y, z, player, item, tileEntity)) {
|
||||
return true;
|
||||
} else if (playerItem.getItem().equals(ModItems.itemSeerSigil)) {
|
||||
if (player.worldObj.isRemote) {
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else {
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (playerItem.getItem() instanceof IAltarManipulator) {
|
||||
} else if (item instanceof IAltarManipulator) {
|
||||
return false;
|
||||
} else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) {
|
||||
ItemStack item = SigilOfHolding.getCurrentSigil(playerItem);
|
||||
} else if (item == ModItems.sigilOfHolding) {
|
||||
ItemStack sigilStack = SigilOfHolding.getCurrentSigil(stack);
|
||||
|
||||
if (item != null && item.getItem().equals(ModItems.divinationSigil)) {
|
||||
if (player.worldObj.isRemote) {
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else {
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (item != null && item.getItem().equals(ModItems.itemSeerSigil)) {
|
||||
if (player.worldObj.isRemote) {
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else {
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
if (sigilStack != null) {
|
||||
Item sigilItem = sigilStack.getItem();
|
||||
if (showAltarInfo(world, x, y, z, player, sigilItem, tileEntity)) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null) {
|
||||
ItemStack newItem = playerItem.copy();
|
||||
if (tileEntity.getStackInSlot(0) == null && stack != null) {
|
||||
ItemStack newItem = stack.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
--stack.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
tileEntity.startCycle();
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null) {
|
||||
} else if (tileEntity.getStackInSlot(0) != null && stack == null) {
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
@@ -165,6 +140,22 @@ public class BlockAltar extends BlockContainer {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean showAltarInfo(World world, int x, int y, int z, EntityPlayer player, Item sigilItem,
|
||||
TEAltar tileEntity) {
|
||||
boolean sightSigil = sigilItem == ModItems.itemSeerSigil;
|
||||
if (!sightSigil && sigilItem != ModItems.divinationSigil) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else if (sightSigil) {
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
} else {
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
|
||||
dropItems(world, x, y, z);
|
||||
@@ -175,12 +166,10 @@ public class BlockAltar extends BlockContainer {
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
if (!(tileEntity instanceof IInventory inventory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
|
||||
@@ -61,13 +61,14 @@ public class BlockBelljar extends BlockContainer {
|
||||
this.otherIcon = iconRegister.registerIcon("minecraft:glass");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> items) {
|
||||
if (this.equals(ModBlocks.blockCrystalBelljar)) {
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
items.add(new ItemStack(item, 1, 0));
|
||||
|
||||
for (Reagent reagent : ReagentRegistry.reagentList.values()) {
|
||||
ItemStack stack = new ItemStack(par1, 1, 0);
|
||||
ItemStack stack = new ItemStack(item, 1, 0);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
ReagentContainer[] tanks = new ReagentContainer[1];
|
||||
@@ -76,19 +77,17 @@ public class BlockBelljar extends BlockContainer {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
NBTTagCompound savedTag = new NBTTagCompound();
|
||||
if (tanks[0] != null) {
|
||||
tanks[0].writeToNBT(savedTag);
|
||||
}
|
||||
tanks[0].writeToNBT(savedTag);
|
||||
tagList.appendTag(savedTag);
|
||||
|
||||
tag.setTag("reagentTanks", tagList);
|
||||
|
||||
stack.setTagCompound(tag);
|
||||
|
||||
par3List.add(stack);
|
||||
items.add(stack);
|
||||
}
|
||||
} else {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
super.getSubBlocks(item, tab, items);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,14 +150,14 @@ public class BlockBelljar extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEBellJar) {
|
||||
if (tile instanceof TEBellJar bellJar) {
|
||||
ItemStack drop = new ItemStack(this);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
((TEBellJar) tile).writeTankNBT(tag);
|
||||
bellJar.writeTankNBT(tag);
|
||||
drop.setTagCompound(tag);
|
||||
|
||||
list.add(drop);
|
||||
|
||||
@@ -61,11 +61,12 @@ public class BlockBloodLightSource extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB,
|
||||
List par6List, Entity par7Entity) {
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List<AxisAlignedBB> list,
|
||||
Entity entity) {
|
||||
this.setBlockBounds(0.40F, 0.40F, 0.40F, 0.60F, 0.60F, 0.60F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -137,12 +137,10 @@ public class BlockCrucible extends BlockContainer {
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
if (!(tileEntity instanceof IInventory inventory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
|
||||
@@ -35,17 +35,14 @@ public class BlockCrystal extends Block {
|
||||
this.brickIcon = iconRegister.registerIcon("AlchemicalWizardry:ShardClusterBrick");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> items) {
|
||||
if (this.equals(ModBlocks.blockCrystal)) {
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
items.add(new ItemStack(item, 1, 0));
|
||||
items.add(new ItemStack(item, 1, 1));
|
||||
} else {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
super.getSubBlocks(item, tab, items);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-19
@@ -47,40 +47,33 @@ public class BlockEnchantmentGlyph extends Block implements IEnchantmentGlyph {
|
||||
|
||||
@Override
|
||||
public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount) {
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return -faceCount * 10;
|
||||
case 1:
|
||||
return -faceCount * 20;
|
||||
default:
|
||||
return -faceCount * 20;
|
||||
if (meta == 0) {
|
||||
return -faceCount * 10;
|
||||
}
|
||||
return -faceCount * 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantability(World world, int x, int y, int z, int meta) {
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
if (meta == 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantmentLevel(World world, int x, int y, int z, int meta) {
|
||||
switch (meta) {
|
||||
case 1:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
if (meta == 1) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> items) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
items.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,11 +69,10 @@ public class BlockMasterStone extends BlockContainer {
|
||||
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
if (!(item instanceof ActivationCrystal)) {
|
||||
if (!(item instanceof ActivationCrystal acItem)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActivationCrystal acItem = (ActivationCrystal) item;
|
||||
// tileEntity.setOwner(acItem.getOwnerName(playerItem));
|
||||
tileEntity.activateRitual(
|
||||
world,
|
||||
|
||||
@@ -34,8 +34,7 @@ public class BlockOrientable extends BlockContainer {
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEOrientable) {
|
||||
TEOrientable newTile = (TEOrientable) tile;
|
||||
if (tile instanceof TEOrientable newTile) {
|
||||
if (player.isSneaking()) {
|
||||
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection()) + 1;
|
||||
|
||||
|
||||
@@ -72,12 +72,10 @@ public class BlockPedestal extends BlockContainer {
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
if (!(tileEntity instanceof IInventory inventory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
|
||||
@@ -72,12 +72,10 @@ public class BlockPlinth extends BlockContainer {
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
if (!(tileEntity instanceof IInventory inventory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
|
||||
@@ -77,12 +77,10 @@ public class BlockSocket extends BlockContainer {
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
if (!(tileEntity instanceof IInventory inventory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
|
||||
@@ -41,9 +41,10 @@ public class BlockSpectralContainer extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB,
|
||||
List par6List, Entity par7Entity) {}
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisAlignedBB,
|
||||
List<AxisAlignedBB> mask, Entity entity) {}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
@@ -59,7 +60,7 @@ public class BlockSpectralContainer extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TESpectralContainer();
|
||||
}
|
||||
}
|
||||
@@ -40,14 +40,15 @@ public class BlockSpellEffect extends BlockOrientable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> items) {
|
||||
if (this.equals(ModBlocks.blockSpellEffect)) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
items.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
} else {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
super.getSubBlocks(item, tab, items);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,14 +40,15 @@ public class BlockSpellEnhancement extends BlockOrientable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> items) {
|
||||
if (this.equals(ModBlocks.blockSpellEnhancement)) {
|
||||
for (int i = 0; i < 15; i++) {
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
items.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
} else {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
super.getSubBlocks(item, tab, items);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,14 +25,15 @@ public class BlockSpellModifier extends BlockOrientable {
|
||||
return new TESpellModifierBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> items) {
|
||||
if (this.equals(ModBlocks.blockSpellModifier)) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
items.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
} else {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
super.getSubBlocks(item, tab, items);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,19 +28,16 @@ public class BlockSpellParadigm extends BlockOrientable {
|
||||
return new TESpellParadigmBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> items) {
|
||||
if (this.equals(ModBlocks.blockSpellParadigm)) {
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
items.add(new ItemStack(item, 1, 0));
|
||||
items.add(new ItemStack(item, 1, 1));
|
||||
items.add(new ItemStack(item, 1, 2));
|
||||
items.add(new ItemStack(item, 1, 3));
|
||||
} else {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
super.getSubBlocks(item, tab, items);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,18 +33,17 @@ public class BlockStabilityGlyph extends Block implements IStabilityGlyph {
|
||||
|
||||
@Override
|
||||
public int getAdditionalStabilityForFaceCount(World world, int x, int y, int z, int meta, int faceCount) {
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return faceCount * 2;
|
||||
default:
|
||||
return faceCount;
|
||||
if (meta == 0) {
|
||||
return faceCount * 2;
|
||||
}
|
||||
return faceCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> items) {
|
||||
for (int i = 0; i < 1; i++) {
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
items.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,12 +62,10 @@ public class BlockWritingTable extends BlockContainer {
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory)) {
|
||||
if (!(tileEntity instanceof IInventory inventory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
@@ -122,14 +120,15 @@ public class BlockWritingTable extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB,
|
||||
List par6List, Entity par7Entity) {
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List<AxisAlignedBB> list,
|
||||
Entity entity) {
|
||||
this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.9375F, 0.5625F);
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
super.addCollisionBoxesToList(world, x, y, z, mask, list, entity);
|
||||
this.setBlockBoundsForItemRender();
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
super.addCollisionBoxesToList(world, x, y, z, mask, list, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender() {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -57,48 +57,26 @@ public class BloodRune extends Block {
|
||||
}
|
||||
|
||||
public int getRuneEffect(int metaData) {
|
||||
switch (metaData) {
|
||||
case 0:
|
||||
return 0;
|
||||
|
||||
case 1: // Altar Capacity rune
|
||||
return 5;
|
||||
|
||||
case 2: // Filling/emptying rune
|
||||
return 6;
|
||||
|
||||
case 3: // Orb Capacity rune
|
||||
return 7;
|
||||
|
||||
case 4: // Better Capacity rune
|
||||
return 8;
|
||||
|
||||
case 5: // Acceleration rune
|
||||
return 9;
|
||||
|
||||
case 6: // Quickness Rune
|
||||
return 10;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return switch (metaData) {
|
||||
case 1 -> 5; // Altar Capacity rune
|
||||
case 2 -> 6; // Filling/emptying rune
|
||||
case 3 -> 7; // Orb Capacity rune
|
||||
case 4 -> 8; // Better Capacity rune
|
||||
case 5 -> 9; // Acceleration rune
|
||||
case 6 -> 10; // Quickness Rune
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> items) {
|
||||
if (this.equals(ModBlocks.bloodRune)) {
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
par3List.add(new ItemStack(par1, 1, 5));
|
||||
par3List.add(new ItemStack(par1, 1, 6));
|
||||
for (int i = 0; i < 7; i++) {
|
||||
items.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
} else {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
super.getSubBlocks(item, tab, items);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -29,23 +28,22 @@ public class MimicBlock extends BlockContainer {
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockMimic");
|
||||
// this.setBlockBounds(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity TE = world.getTileEntity(x, y, z);
|
||||
if (!(TE instanceof TEMimicBlock)) {
|
||||
if (!(TE instanceof TEMimicBlock mimic)) {
|
||||
return true;
|
||||
}
|
||||
TEMimicBlock mimic = (TEMimicBlock) TE;
|
||||
|
||||
Block block = mimic.getBlock();
|
||||
|
||||
return block == null || block.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
@@ -58,9 +56,6 @@ public class MimicBlock extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
/**
|
||||
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
||||
*/
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
TileEntity TE = blockAccess.getTileEntity(x, y, z);
|
||||
TEMimicBlock mimic = (TEMimicBlock) TE;
|
||||
@@ -70,6 +65,7 @@ public class MimicBlock extends BlockContainer {
|
||||
return block != null ? block.getIcon(side, meta) : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@@ -105,53 +101,38 @@ public class MimicBlock extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) {
|
||||
TileEntity tile = world.getTileEntity(target.blockX, target.blockY, target.blockZ);
|
||||
TEMimicBlock tile = (TEMimicBlock) world.getTileEntity(target.blockX, target.blockY, target.blockZ);
|
||||
if (tile == null) {
|
||||
return super.addHitEffects(world, target, effectRenderer);
|
||||
}
|
||||
Block block = tile.getBlock();
|
||||
|
||||
TEMimicBlock TE = (TEMimicBlock) tile;
|
||||
double xOffset = target.blockX
|
||||
+ world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - 0.1F * 2.0F)
|
||||
+ 0.1F
|
||||
+ block.getBlockBoundsMinX();
|
||||
double yOffset = target.blockY
|
||||
+ world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - 0.1F * 2.0F)
|
||||
+ 0.1F
|
||||
+ block.getBlockBoundsMinY();
|
||||
double zOffset = target.blockZ
|
||||
+ world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - 0.1F * 2.0F)
|
||||
+ 0.1F
|
||||
+ block.getBlockBoundsMinZ();
|
||||
|
||||
if (TE != null) {
|
||||
Block block = TE.getBlock();
|
||||
|
||||
double xOffset = target.blockX
|
||||
+ world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - 0.1F * 2.0F)
|
||||
+ 0.1F
|
||||
+ block.getBlockBoundsMinX();
|
||||
double yOffset = target.blockY
|
||||
+ world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - 0.1F * 2.0F)
|
||||
+ 0.1F
|
||||
+ block.getBlockBoundsMinY();
|
||||
double zOffset = target.blockZ
|
||||
+ world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - 0.1F * 2.0F)
|
||||
+ 0.1F
|
||||
+ block.getBlockBoundsMinZ();
|
||||
|
||||
switch (target.sideHit) {
|
||||
case 0:
|
||||
yOffset = target.blockY + block.getBlockBoundsMinY() - 0.1D;
|
||||
break;
|
||||
case 1:
|
||||
yOffset = target.blockY + block.getBlockBoundsMaxY() + 0.1D;
|
||||
break;
|
||||
case 2:
|
||||
zOffset = target.blockZ + block.getBlockBoundsMinZ() - 0.1D;
|
||||
break;
|
||||
case 3:
|
||||
zOffset = target.blockZ + block.getBlockBoundsMaxZ() + 0.1D;
|
||||
break;
|
||||
case 4:
|
||||
xOffset = target.blockX + block.getBlockBoundsMinX() - 0.1D;
|
||||
break;
|
||||
case 5:
|
||||
xOffset = target.blockX + block.getBlockBoundsMaxX() + 0.1D;
|
||||
break;
|
||||
}
|
||||
|
||||
MimicBlock.addHitEffect(TE, target, xOffset, yOffset, zOffset, null, effectRenderer);
|
||||
|
||||
return true;
|
||||
switch (target.sideHit) {
|
||||
case 0 -> yOffset = target.blockY + block.getBlockBoundsMinY() - 0.1D;
|
||||
case 1 -> yOffset = target.blockY + block.getBlockBoundsMaxY() + 0.1D;
|
||||
case 2 -> zOffset = target.blockZ + block.getBlockBoundsMinZ() - 0.1D;
|
||||
case 3 -> zOffset = target.blockZ + block.getBlockBoundsMaxZ() + 0.1D;
|
||||
case 4 -> xOffset = target.blockX + block.getBlockBoundsMinX() - 0.1D;
|
||||
case 5 -> xOffset = target.blockX + block.getBlockBoundsMaxX() + 0.1D;
|
||||
}
|
||||
|
||||
return super.addHitEffects(world, target, effectRenderer);
|
||||
MimicBlock.addHitEffect(tile, target, xOffset, yOffset, zOffset, effectRenderer);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,9 +160,9 @@ public class MimicBlock extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec) {
|
||||
TEMimicBlock TE = (TEMimicBlock) world.getTileEntity(x, y, z);
|
||||
if (TE != null) {
|
||||
Block block = TE.getBlock();
|
||||
TEMimicBlock tile = (TEMimicBlock) world.getTileEntity(x, y, z);
|
||||
if (tile != null) {
|
||||
Block block = tile.getBlock();
|
||||
if (block != null) {
|
||||
block.velocityToAddToEntity(world, x, y, z, entity, vec);
|
||||
}
|
||||
@@ -189,7 +170,7 @@ public class MimicBlock extends BlockContainer {
|
||||
}
|
||||
|
||||
public static void addHitEffect(TEMimicBlock TE, MovingObjectPosition target, double x, double y, double z,
|
||||
ItemStack itemStack, EffectRenderer effectRenderer) {
|
||||
EffectRenderer effectRenderer) {
|
||||
EntityDiggingFX particle = new EntityDiggingFX(
|
||||
TE.getWorldObj(),
|
||||
x,
|
||||
@@ -207,12 +188,12 @@ public class MimicBlock extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
TEMimicBlock TE = (TEMimicBlock) world.getTileEntity(x, y, z);
|
||||
if (TE != null) {
|
||||
if (TE.getBlockEffectWhileInside(entity, x, y, z)) {
|
||||
TEMimicBlock tile = (TEMimicBlock) world.getTileEntity(x, y, z);
|
||||
if (tile != null) {
|
||||
if (tile.getBlockEffectWhileInside(entity, x, y, z)) {
|
||||
return;
|
||||
} else {
|
||||
Block block = TE.getBlock();
|
||||
Block block = tile.getBlock();
|
||||
if (block != null) {
|
||||
block.onEntityCollidedWithBlock(world, x, y, z, entity);
|
||||
return;
|
||||
|
||||
@@ -42,6 +42,7 @@ public class SpectralBlock extends BlockContainer {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_,
|
||||
int p_149646_5_) {
|
||||
@@ -58,10 +59,10 @@ public class SpectralBlock extends BlockContainer {
|
||||
return false;
|
||||
}
|
||||
|
||||
return block != this
|
||||
&& super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
return super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
|
||||
|
||||
+5
-55
@@ -1,6 +1,5 @@
|
||||
package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -9,77 +8,28 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.BlockStack;
|
||||
|
||||
public class AltarComponent {
|
||||
|
||||
private final int x, y, z;
|
||||
private final List<BlockStack> validBlocks;
|
||||
|
||||
private final boolean isBloodRune, isUpgradeSlot;
|
||||
|
||||
public AltarComponent(int x, int y, int z, Block block, int metadata, boolean isBloodRune, boolean isUpgradeSlot) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.validBlocks = new ArrayList<>();
|
||||
this.validBlocks.add(new BlockStack(block, metadata));
|
||||
this.isBloodRune = isBloodRune;
|
||||
this.isUpgradeSlot = isUpgradeSlot;
|
||||
}
|
||||
|
||||
public AltarComponent(int x, int y, int z, List<BlockStack> validBlocks, boolean isBloodRune,
|
||||
boolean isUpgradeSlot) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.validBlocks = validBlocks;
|
||||
this.isBloodRune = isBloodRune;
|
||||
this.isUpgradeSlot = isUpgradeSlot;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
public record AltarComponent(int x, int y, int z, List<BlockStack> validBlocks, boolean isBloodRune,
|
||||
boolean isUpgradeSlot) {
|
||||
|
||||
public Block getBlock() {
|
||||
if (anyBlockMatches()) {
|
||||
return Blocks.air;
|
||||
}
|
||||
return validBlocks.get(0).getBlock();
|
||||
return validBlocks.getFirst().block();
|
||||
}
|
||||
|
||||
public int getMetadata() {
|
||||
if (anyBlockMatches()) {
|
||||
return OreDictionary.WILDCARD_VALUE;
|
||||
}
|
||||
return validBlocks.get(0).getMeta();
|
||||
}
|
||||
|
||||
public boolean isBloodRune() {
|
||||
return isBloodRune;
|
||||
}
|
||||
|
||||
public boolean isUpgradeSlot() {
|
||||
return isUpgradeSlot;
|
||||
}
|
||||
|
||||
public List<BlockStack> getValidBlocks() {
|
||||
return validBlocks;
|
||||
return validBlocks.getFirst().meta();
|
||||
}
|
||||
|
||||
public boolean matches(Block block, int meta) {
|
||||
if (anyBlockMatches()) return true;
|
||||
|
||||
for (BlockStack pair : validBlocks) {
|
||||
if (pair.getBlock() == block
|
||||
&& (pair.getMeta() == meta || pair.getMeta() == OreDictionary.WILDCARD_VALUE)) {
|
||||
if (pair.block() == block && (pair.meta() == meta || pair.meta() == OreDictionary.WILDCARD_VALUE)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-23
@@ -2,29 +2,16 @@ package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade;
|
||||
|
||||
public class AltarUpgradeComponent {
|
||||
|
||||
private int speedUpgrades;
|
||||
private int efficiencyUpgrades;
|
||||
private int sacrificeUpgrades;
|
||||
private int selfSacrificeUpgrades;
|
||||
private int displacementUpgrades;
|
||||
private int altarCapacitiveUpgrades;
|
||||
private int orbCapacitiveUpgrades;
|
||||
private int betterCapacitiveUpgrades;
|
||||
private int accelerationUpgrades;
|
||||
private int quicknessUpgrades;
|
||||
|
||||
public AltarUpgradeComponent() {
|
||||
speedUpgrades = 0;
|
||||
efficiencyUpgrades = 0;
|
||||
sacrificeUpgrades = 0;
|
||||
selfSacrificeUpgrades = 0;
|
||||
displacementUpgrades = 0;
|
||||
altarCapacitiveUpgrades = 0;
|
||||
orbCapacitiveUpgrades = 0;
|
||||
betterCapacitiveUpgrades = 0;
|
||||
accelerationUpgrades = 0;
|
||||
quicknessUpgrades = 0;
|
||||
}
|
||||
private int speedUpgrades = 0;
|
||||
private int efficiencyUpgrades = 0;
|
||||
private int sacrificeUpgrades = 0;
|
||||
private int selfSacrificeUpgrades = 0;
|
||||
private int displacementUpgrades = 0;
|
||||
private int altarCapacitiveUpgrades = 0;
|
||||
private int orbCapacitiveUpgrades = 0;
|
||||
private int betterCapacitiveUpgrades = 0;
|
||||
private int accelerationUpgrades = 0;
|
||||
private int quicknessUpgrades = 0;
|
||||
|
||||
public void addSpeedUpgrade() {
|
||||
speedUpgrades++;
|
||||
|
||||
+3
-4
@@ -9,12 +9,11 @@ import WayofTime.alchemicalWizardry.api.BlockStack;
|
||||
public class CompatChecks {
|
||||
|
||||
public static boolean checkChiselBlock(BlockStack blockStack, String groupName) {
|
||||
if (blockStack.getBlock() == null) return false;
|
||||
if (blockStack.block() == null) return false;
|
||||
|
||||
ICarvingGroup group = CarvingUtils.getChiselRegistry().getGroup(blockStack.getBlock(), blockStack.getMeta());
|
||||
ICarvingGroup group = CarvingUtils.getChiselRegistry().getGroup(blockStack.block(), blockStack.meta());
|
||||
if (group != null) {
|
||||
String check = CarvingUtils.getChiselRegistry().getGroup(blockStack.getBlock(), blockStack.getMeta())
|
||||
.getName();
|
||||
String check = CarvingUtils.getChiselRegistry().getGroup(blockStack.block(), blockStack.meta()).getName();
|
||||
|
||||
if (Strings.isNullOrEmpty(check)) return false;
|
||||
|
||||
|
||||
+6
-7
@@ -58,9 +58,9 @@ public class UpgradedAltars {
|
||||
|
||||
private static boolean checkAltarComponent(AltarComponent altarComponent, IBlockAccess world, int x, int y, int z,
|
||||
int altarTier) {
|
||||
int compX = x + altarComponent.getX();
|
||||
int compY = y + altarComponent.getY();
|
||||
int compZ = z + altarComponent.getZ();
|
||||
int compX = x + altarComponent.x();
|
||||
int compY = y + altarComponent.y();
|
||||
int compZ = z + altarComponent.z();
|
||||
if (altarComponent.anyBlockMatches()) {
|
||||
return !world.isAirBlock(compX, compY, compZ);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class UpgradedAltars {
|
||||
}
|
||||
|
||||
for (BlockStack rune : runes) {
|
||||
if (altarComponent.isUpgradeSlot() ? block == rune.getBlock() && meta == rune.getMeta()
|
||||
if (altarComponent.isUpgradeSlot() ? block == rune.block() && meta == rune.meta()
|
||||
: altarComponent.matches(block, meta)) {
|
||||
return true;
|
||||
}
|
||||
@@ -101,10 +101,9 @@ public class UpgradedAltars {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = world
|
||||
.getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
|
||||
Block block = world.getBlock(x + altarComponent.x(), y + altarComponent.y(), z + altarComponent.z());
|
||||
int metadata = world
|
||||
.getBlockMetadata(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
|
||||
.getBlockMetadata(x + altarComponent.x(), y + altarComponent.y(), z + altarComponent.z());
|
||||
BlockStack blockStack = new BlockStack(block, metadata);
|
||||
switch (runes.indexOf(blockStack)) {
|
||||
case 1 -> upgrades.addSpeedUpgrade();
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -32,10 +32,6 @@ public class CommandBind extends CommandBase {
|
||||
ItemStack item = entityplayermp.getCurrentEquippedItem();
|
||||
EntityPlayerMP targetPlayer = getPlayer(iCommandSender, astring[0]);
|
||||
|
||||
if (targetPlayer == null) {
|
||||
throw new CommandException("commands.bind.failed.noPlayer");
|
||||
}
|
||||
|
||||
if (item != null && item.getItem() instanceof IBindable) {
|
||||
if (IBindable.getOwnerName(item).isEmpty()) {
|
||||
IBindable.checkAndSetItemOwner(item, targetPlayer);
|
||||
@@ -48,7 +44,7 @@ public class CommandBind extends CommandBase {
|
||||
}
|
||||
}
|
||||
|
||||
public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring) {
|
||||
public List<String> addTabCompletionOptions(ICommandSender iCommandSender, String[] astring) {
|
||||
return getListOfStringsMatchingLastWord(astring, this.getPlayer());
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,9 @@ import WayofTime.alchemicalWizardry.common.commands.sub.SubCommandOrb;
|
||||
|
||||
public class CommandBloodMagic extends CommandBase {
|
||||
|
||||
private final List aliases = new ArrayList();
|
||||
private final List<String> aliases = new ArrayList<>();
|
||||
private final Map<String, ISubCommand> subCommands = new HashMap<String, ISubCommand>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public CommandBloodMagic() {
|
||||
aliases.add("BloodMagic");
|
||||
aliases.add("bloodmagic");
|
||||
@@ -52,7 +51,7 @@ public class CommandBloodMagic extends CommandBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getCommandAliases() {
|
||||
public List<String> getCommandAliases() {
|
||||
return aliases;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,15 +81,13 @@ public class CommandSN extends CommandBase {
|
||||
} else {
|
||||
throw new CommandException("commands.soulnetwork.notACommand");
|
||||
}
|
||||
} else if (astring.length == 0) {
|
||||
throw new CommandException("commands.soulnetwork.noPlayer");
|
||||
} else if (astring.length == 1) {
|
||||
throw new CommandException("commands.soulnetwork.noCommand");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender iCommandSender, String[] astring) {
|
||||
public List<String> addTabCompletionOptions(ICommandSender iCommandSender, String[] astring) {
|
||||
if (astring.length == 1) {
|
||||
return getListOfStringsMatchingLastWord(astring, this.getPlayer());
|
||||
} else if (astring.length == 2) {
|
||||
|
||||
@@ -12,18 +12,22 @@ public class CommandUnbind extends CommandBase {
|
||||
|
||||
public CommandUnbind() {}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "unbind";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender icommandsender) {
|
||||
return "commands.unbind.usage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender iCommandSender, String[] astring) {
|
||||
EntityPlayerMP entityplayermp = getCommandSenderAsPlayer(iCommandSender);
|
||||
ItemStack item = entityplayermp.getCurrentEquippedItem();
|
||||
|
||||
+8
-17
@@ -52,7 +52,7 @@ public class SubCommandNetwork extends SubCommandBase {
|
||||
|
||||
try {
|
||||
switch (ValidCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH))) {
|
||||
case SYPHON: {
|
||||
case SYPHON -> {
|
||||
if (displayHelp) {
|
||||
displayHelpString(commandSender, ValidCommands.SYPHON.help);
|
||||
break;
|
||||
@@ -74,9 +74,8 @@ public class SubCommandNetwork extends SubCommandBase {
|
||||
displayErrorString(commandSender, "commands.error.arg.missing");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ADD: {
|
||||
case ADD -> {
|
||||
if (displayHelp) {
|
||||
displayHelpString(commandSender, ValidCommands.ADD.help);
|
||||
break;
|
||||
@@ -95,9 +94,8 @@ public class SubCommandNetwork extends SubCommandBase {
|
||||
displayErrorString(commandSender, "commands.error.arg.missing");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SET: {
|
||||
case SET -> {
|
||||
if (displayHelp) {
|
||||
displayHelpString(commandSender, ValidCommands.SET.help);
|
||||
break;
|
||||
@@ -115,9 +113,8 @@ public class SubCommandNetwork extends SubCommandBase {
|
||||
displayErrorString(commandSender, "commands.error.arg.missing");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case GET: {
|
||||
case GET -> {
|
||||
if (displayHelp) {
|
||||
displayHelpString(commandSender, ValidCommands.GET.help);
|
||||
break;
|
||||
@@ -129,9 +126,8 @@ public class SubCommandNetwork extends SubCommandBase {
|
||||
+ SoulNetworkHandler.getCurrentEssence(givenName)
|
||||
+ "LP"));
|
||||
|
||||
break;
|
||||
}
|
||||
case FILL: {
|
||||
case FILL -> {
|
||||
if (displayHelp) {
|
||||
displayHelpString(commandSender, ValidCommands.FILL.help, Integer.MAX_VALUE);
|
||||
break;
|
||||
@@ -142,9 +138,8 @@ public class SubCommandNetwork extends SubCommandBase {
|
||||
displaySuccessString(commandSender, "commands.network.fill.success", givenName);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CAP: {
|
||||
case CAP -> {
|
||||
if (displayHelp) {
|
||||
displayHelpString(commandSender, ValidCommands.CAP.help);
|
||||
break;
|
||||
@@ -156,7 +151,6 @@ public class SubCommandNetwork extends SubCommandBase {
|
||||
displaySuccessString(commandSender, "commands.network.cap.success", givenName);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
@@ -174,20 +168,17 @@ public class SubCommandNetwork extends SubCommandBase {
|
||||
FILL("commands.network.fill.help"),
|
||||
CAP("commands.network.cap.help");
|
||||
|
||||
public String help;
|
||||
public final String help;
|
||||
|
||||
ValidCommands(String help) {
|
||||
this.help = help;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
private static boolean isInteger(String s) {
|
||||
try {
|
||||
Integer.parseInt(s);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
} catch (NullPointerException e) {
|
||||
} catch (NumberFormatException | NullPointerException e) {
|
||||
return false;
|
||||
}
|
||||
// only got here if we didn't return false
|
||||
|
||||
@@ -93,20 +93,17 @@ public class SubCommandOrb extends SubCommandBase {
|
||||
SET("commands.orb.set.help"),
|
||||
GET("commands.orb.get.help");
|
||||
|
||||
public String help;
|
||||
public final String help;
|
||||
|
||||
ValidCommands(String help) {
|
||||
this.help = help;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
private static boolean isInteger(String s) {
|
||||
try {
|
||||
Integer.parseInt(s);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
} catch (NullPointerException e) {
|
||||
} catch (NumberFormatException | NullPointerException e) {
|
||||
return false;
|
||||
}
|
||||
// only got here if we didn't return false
|
||||
|
||||
Loaded 100 of 413 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user